You are viewing a plain text version of this content. The canonical link for it is here.
Posted to commits@spark.apache.org by ma...@apache.org on 2015/01/30 00:49:38 UTC
spark git commit: [SPARK-4296][SQL] Trims aliases when resolving and
checking aggregate expressions
Repository: spark
Updated Branches:
refs/heads/master c1b3eebf9 -> c00d517d6
[SPARK-4296][SQL] Trims aliases when resolving and checking aggregate expressions
I believe that SPARK-4296 has been fixed by 3684fd21e1ffdc0adaad8ff6b31394b637e866ce. I am adding tests based #3910 (change the udf to HiveUDF instead).
Author: Yin Huai <yh...@databricks.com>
Author: Cheng Lian <li...@databricks.com>
Closes #4010 from yhuai/SPARK-4296-yin and squashes the following commits:
6343800 [Yin Huai] Merge remote-tracking branch 'upstream/master' into SPARK-4296-yin
6cfadd2 [Yin Huai] Actually, this issue has been fixed by 3684fd21e1ffdc0adaad8ff6b31394b637e866ce.
d42b707 [Yin Huai] Update comment.
8b3a274 [Yin Huai] Since expressions in grouping expressions can have aliases, which can be used by the outer query block, revert this change.
443538d [Cheng Lian] Trims aliases when resolving and checking aggregate expressions
Project: http://git-wip-us.apache.org/repos/asf/spark/repo
Commit: http://git-wip-us.apache.org/repos/asf/spark/commit/c00d517d
Tree: http://git-wip-us.apache.org/repos/asf/spark/tree/c00d517d
Diff: http://git-wip-us.apache.org/repos/asf/spark/diff/c00d517d
Branch: refs/heads/master
Commit: c00d517d660ddc3c7b4302651e5567534a819905
Parents: c1b3eeb
Author: Yin Huai <yh...@databricks.com>
Authored: Thu Jan 29 15:49:34 2015 -0800
Committer: Michael Armbrust <mi...@databricks.com>
Committed: Thu Jan 29 15:49:34 2015 -0800
----------------------------------------------------------------------
.../spark/sql/hive/execution/SQLQuerySuite.scala | 15 +++++++++++++++
1 file changed, 15 insertions(+)
----------------------------------------------------------------------
http://git-wip-us.apache.org/repos/asf/spark/blob/c00d517d/sql/hive/src/test/scala/org/apache/spark/sql/hive/execution/SQLQuerySuite.scala
----------------------------------------------------------------------
diff --git a/sql/hive/src/test/scala/org/apache/spark/sql/hive/execution/SQLQuerySuite.scala b/sql/hive/src/test/scala/org/apache/spark/sql/hive/execution/SQLQuerySuite.scala
index faa7357..eb7a775 100644
--- a/sql/hive/src/test/scala/org/apache/spark/sql/hive/execution/SQLQuerySuite.scala
+++ b/sql/hive/src/test/scala/org/apache/spark/sql/hive/execution/SQLQuerySuite.scala
@@ -267,4 +267,19 @@ class SQLQuerySuite extends QueryTest {
sql("DROP TABLE nullValuesInInnerComplexTypes")
dropTempTable("testTable")
}
+
+ test("SPARK-4296 Grouping field with Hive UDF as sub expression") {
+ val rdd = sparkContext.makeRDD( """{"a": "str", "b":"1", "c":"1970-01-01 00:00:00"}""" :: Nil)
+ jsonRDD(rdd).registerTempTable("data")
+ checkAnswer(
+ sql("SELECT concat(a, '-', b), year(c) FROM data GROUP BY concat(a, '-', b), year(c)"),
+ Row("str-1", 1970))
+
+ dropTempTable("data")
+
+ jsonRDD(rdd).registerTempTable("data")
+ checkAnswer(sql("SELECT year(c) + 1 FROM data GROUP BY year(c) + 1"), Row(1971))
+
+ dropTempTable("data")
+ }
}
---------------------------------------------------------------------
To unsubscribe, e-mail: commits-unsubscribe@spark.apache.org
For additional commands, e-mail: commits-help@spark.apache.org