You are viewing a plain text version of this content. The canonical link for it is here.
Posted to reviews@spark.apache.org by GitBox <gi...@apache.org> on 2018/12/13 01:51:10 UTC

[GitHub] gatorsmile commented on a change in pull request #23303: [SPARK-26352][SQL] ReorderJoin should not change the order of columns

gatorsmile commented on a change in pull request #23303: [SPARK-26352][SQL] ReorderJoin should not change the order of columns
URL: https://github.com/apache/spark/pull/23303#discussion_r241249013
 
 

 ##########
 File path: sql/core/src/test/scala/org/apache/spark/sql/JoinSuite.scala
 ##########
 @@ -895,4 +895,18 @@ class JoinSuite extends QueryTest with SharedSQLContext {
       checkAnswer(res, Row(0, 0, 0))
     }
   }
+
+  test("SPARK-26352: join reordering should not change the order of columns") {
+    withTable("tab1", "tab2", "tab3") {
+      spark.sql("select 1 as x, 100 as y").write.saveAsTable("tab1")
+      spark.sql("select 42 as i, 200 as j").write.saveAsTable("tab2")
+      spark.sql("select 1 as a, 42 as b").write.saveAsTable("tab3")
+
+      val df = spark.sql("""
+        with tmp as (select * from tab1 cross join tab2)
+        select * from tmp join tab3 on a = x and b = i
+      """)
+      checkAnswer(df, Row(1, 100, 42, 200, 1, 42))
 
 Review comment:
   ```Scala
   scala> spark.sql("with tmp as (select * from tab1 cross join tab2) select * from tmp join tab3 on a = x and b = i").show()
   +---+---+---+---+---+---+
   |  x|  y|  i|  j|  a|  b|
   +---+---+---+---+---+---+
   |  1|100| 42|200|  1| 42|
   +---+---+---+---+---+---+
   ```
   
   This still passes without code changes, right?

----------------------------------------------------------------
This is an automated message from the Apache Git Service.
To respond to the message, please log on 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


With regards,
Apache Git Services

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