spark-reviews mailing list archives

Site index · List index
Message view « Date » · « Thread »
Top « Date » · « Thread »
From GitBox <...@apache.org>
Subject [GitHub] [spark] AngersZhuuuu commented on a change in pull request #28490: [SPARK-31670][SQL]Resolve Struct Field in Grouping Aggregate with same ExprId
Date Sun, 07 Jun 2020 04:55:06 GMT

AngersZhuuuu commented on a change in pull request #28490:
URL: https://github.com/apache/spark/pull/28490#discussion_r436324734



##########
File path: sql/core/src/test/scala/org/apache/spark/sql/SQLQuerySuite.scala
##########
@@ -3496,6 +3496,88 @@ class SQLQuerySuite extends QueryTest with SharedSparkSession with
AdaptiveSpark
     checkIfSeedExistsInExplain(df2)
   }
 
+  test("SPARK-31670: Struct Field in groupByExpr with CUBE") {
+    withTable("t") {
+      sql(
+        """CREATE TABLE t(
+          |a STRING,
+          |b INT,
+          |c ARRAY<STRUCT<row_id:INT,json_string:STRING>>,
+          |d ARRAY<ARRAY<STRING>>,
+          |e ARRAY<MAP<STRING, INT>>)
+          |USING ORC""".stripMargin)
+
+      checkAnswer(
+        sql(
+          """
+            |SELECT a, each.json_string, SUM(b)
+            |FROM t
+            |LATERAL VIEW EXPLODE(c) x AS each
+            |GROUP BY a, each.json_string
+            |WITH CUBE
+            |""".stripMargin), Nil)
+
+      checkAnswer(
+        sql(
+          """
+            |SELECT a, get_json_object(each.json_string, '$.i'), SUM(b)
+            |FROM t
+            |LATERAL VIEW EXPLODE(c) X AS each
+            |GROUP BY a, get_json_object(each.json_string, '$.i')
+            |WITH CUBE
+            |""".stripMargin), Nil)
+
+      checkAnswer(
+        sql(
+          """
+            |SELECT a, each.json_string AS json_string, SUM(b)
+            |FROM t
+            |LATERAL VIEW EXPLODE(c) x AS each

Review comment:
       > btw, we must need `lateral view` to reproduce this issue? I mean, this issue cannot
happen without `lateral view`?
   
   No, I changed.




----------------------------------------------------------------
This is an automated message from the Apache Git Service.
To respond to the message, please log on to GitHub and use the
URL above to go to the specific comment.

For queries about this service, please contact Infrastructure at:
users@infra.apache.org



---------------------------------------------------------------------
To unsubscribe, e-mail: reviews-unsubscribe@spark.apache.org
For additional commands, e-mail: reviews-help@spark.apache.org


Mime
View raw message