Github user gatorsmile commented on a diff in the pull request:
https://github.com/apache/spark/pull/19257#discussion_r156580049
--- Diff:
sql/core/src/test/scala/org/apache/spark/sql/sources/BucketedReadSuite.scala ---
@@ -602,6 +602,37 @@ abstract class BucketedReadSuite extends QueryTest
with SQLTestUtils {
)
}
+ test("SPARK-22042 ReorderJoinPredicates can break when child's
partitioning is not decided") {
+ withTable("bucketed_table", "table1", "table2") {
+ df.write.format("parquet").saveAsTable("table1")
+ df.write.format("parquet").saveAsTable("table2")
+ df.write.format("parquet").bucketBy(8, "j",
"k").saveAsTable("bucketed_table")
+
+ withSQLConf(SQLConf.AUTO_BROADCASTJOIN_THRESHOLD.key -> "0") {
+ checkAnswer(
+ sql("""
+ |SELECT ab.i, ab.j, ab.k, c.i, c.j, c.k
+ |FROM (
+ | SELECT a.i, a.j, a.k
+ | FROM bucketed_table a
+ | JOIN table1 b
+ | ON a.i = b.i
+ |) ab
+ |JOIN table2 c
+ |ON ab.i = c.i
+ |""".stripMargin),
+ sql("""
+ |SELECT a.i, a.j, a.k, c.i, c.j, c.k
+ |FROM bucketed_table a
+ |JOIN table1 b
+ |ON a.i = b.i
+ |JOIN table2 c
+ |ON a.i = c.i
+ |""".stripMargin))
--- End diff --
Please follow the other test cases
---
---------------------------------------------------------------------
To unsubscribe, e-mail: [email protected]
For additional commands, e-mail: [email protected]