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_r241249373
##########
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:
Maybe the command lines work but the test case does not work since we turn
off `ConvertToLocalRelation` in the test environment?
----------------------------------------------------------------
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:
[email protected]
With regards,
Apache Git Services
---------------------------------------------------------------------
To unsubscribe, e-mail: [email protected]
For additional commands, e-mail: [email protected]