diff options
author | Wenchen Fan <wenchen@databricks.com> | 2016-07-20 18:37:15 -0700 |
---|---|---|
committer | Yin Huai <yhuai@databricks.com> | 2016-07-20 18:37:15 -0700 |
commit | cfa5ae84ed0f48b3b108d0614dbf6fcd79ef5179 (patch) | |
tree | 1b529627a22b96cfc04cea4506c717a3737f1698 /sql/core/src/test | |
parent | 75a06aa256aa256c112555609a93c1e1dbb1cb4b (diff) | |
download | spark-cfa5ae84ed0f48b3b108d0614dbf6fcd79ef5179.tar.gz spark-cfa5ae84ed0f48b3b108d0614dbf6fcd79ef5179.tar.bz2 spark-cfa5ae84ed0f48b3b108d0614dbf6fcd79ef5179.zip |
[SPARK-16644][SQL] Aggregate should not propagate constraints containing aggregate expressions
## What changes were proposed in this pull request?
aggregate expressions can only be executed inside `Aggregate`, if we propagate it up with constraints, the parent operator can not execute it and will fail at runtime.
## How was this patch tested?
new test in SQLQuerySuite
Author: Wenchen Fan <wenchen@databricks.com>
Author: Yin Huai <yhuai@databricks.com>
Closes #14281 from cloud-fan/bug.
Diffstat (limited to 'sql/core/src/test')
-rw-r--r-- | sql/core/src/test/scala/org/apache/spark/sql/SQLQuerySuite.scala | 17 |
1 files changed, 17 insertions, 0 deletions
diff --git a/sql/core/src/test/scala/org/apache/spark/sql/SQLQuerySuite.scala b/sql/core/src/test/scala/org/apache/spark/sql/SQLQuerySuite.scala index eeaa0103a0..7513640582 100644 --- a/sql/core/src/test/scala/org/apache/spark/sql/SQLQuerySuite.scala +++ b/sql/core/src/test/scala/org/apache/spark/sql/SQLQuerySuite.scala @@ -2965,4 +2965,21 @@ class SQLQuerySuite extends QueryTest with SharedSQLContext { } } } + + test("SPARK-16644: Aggregate should not put aggregate expressions to constraints") { + withTable("tbl") { + sql("CREATE TABLE tbl(a INT, b INT) USING parquet") + checkAnswer(sql( + """ + |SELECT + | a, + | MAX(b) AS c1, + | b AS c2 + |FROM tbl + |WHERE a = b + |GROUP BY a, b + |HAVING c1 = 1 + """.stripMargin), Nil) + } + } } |