You are viewing a plain text version of this content. The canonical link for it is here.
Posted to commits@spark.apache.org by do...@apache.org on 2020/04/05 23:38:14 UTC
[spark] branch master updated: [SPARK-29554][SQL][FOLLOWUP] Update
Auto-generated Alias Name for Version
This is an automated email from the ASF dual-hosted git repository.
dongjoon pushed a commit to branch master
in repository https://gitbox.apache.org/repos/asf/spark.git
The following commit(s) were added to refs/heads/master by this push:
new 39a6f51 [SPARK-29554][SQL][FOLLOWUP] Update Auto-generated Alias Name for Version
39a6f51 is described below
commit 39a6f518cbc1e203a447c109d62a762cce031ac9
Author: gatorsmile <ga...@gmail.com>
AuthorDate: Sun Apr 5 16:37:03 2020 -0700
[SPARK-29554][SQL][FOLLOWUP] Update Auto-generated Alias Name for Version
### What changes were proposed in this pull request?
The auto-generated alias name of built-in function `version()` is `sparkversion()`. After this PR, it is updated to `version()`.
### Why are the changes needed?
Based on our auto-generated alias name convention for the built-in functions, the alias names should be consistent with the function names.
This built-in function `version` is added in the upcoming Spark 3.0. Thus, we should fix it before the release.
### Does this PR introduce any user-facing change?
Yes. Update the column name in schema if users do not specify the alias.
### How was this patch tested?
Added a test case.
Closes #28131 from gatorsmile/spark-29554followup.
Authored-by: gatorsmile <ga...@gmail.com>
Signed-off-by: Dongjoon Hyun <do...@apache.org>
---
.../main/scala/org/apache/spark/sql/catalyst/expressions/misc.scala | 1 +
sql/core/src/test/scala/org/apache/spark/sql/MiscFunctionsSuite.scala | 4 +++-
2 files changed, 4 insertions(+), 1 deletion(-)
diff --git a/sql/catalyst/src/main/scala/org/apache/spark/sql/catalyst/expressions/misc.scala b/sql/catalyst/src/main/scala/org/apache/spark/sql/catalyst/expressions/misc.scala
index f576873..8ce3ddd 100644
--- a/sql/catalyst/src/main/scala/org/apache/spark/sql/catalyst/expressions/misc.scala
+++ b/sql/catalyst/src/main/scala/org/apache/spark/sql/catalyst/expressions/misc.scala
@@ -173,6 +173,7 @@ case class SparkVersion() extends LeafExpression with CodegenFallback {
override def nullable: Boolean = false
override def foldable: Boolean = true
override def dataType: DataType = StringType
+ override def prettyName: String = "version"
override def eval(input: InternalRow): Any = {
UTF8String.fromString(SPARK_VERSION_SHORT + " " + SPARK_REVISION)
}
diff --git a/sql/core/src/test/scala/org/apache/spark/sql/MiscFunctionsSuite.scala b/sql/core/src/test/scala/org/apache/spark/sql/MiscFunctionsSuite.scala
index 5ab06b1..16edf35 100644
--- a/sql/core/src/test/scala/org/apache/spark/sql/MiscFunctionsSuite.scala
+++ b/sql/core/src/test/scala/org/apache/spark/sql/MiscFunctionsSuite.scala
@@ -34,9 +34,11 @@ class MiscFunctionsSuite extends QueryTest with SharedSparkSession {
}
test("version") {
+ val df = sql("SELECT version()")
checkAnswer(
- Seq("").toDF("a").selectExpr("version()"),
+ df,
Row(SPARK_VERSION_SHORT + " " + SPARK_REVISION))
+ assert(df.schema.fieldNames === Seq("version()"))
}
}
---------------------------------------------------------------------
To unsubscribe, e-mail: commits-unsubscribe@spark.apache.org
For additional commands, e-mail: commits-help@spark.apache.org