Github user tejasapatil commented on a diff in the pull request:
https://github.com/apache/spark/pull/14864#discussion_r78207768
--- Diff: sql/core/src/test/scala/org/apache/spark/sql/JoinSuite.scala ---
@@ -61,6 +62,51 @@ class JoinSuite extends QueryTest with SharedSQLContext {
}
}
+ test("SPARK-15453 : Sort Merge join on bucketed + sorted tables should
not add `sort` step " +
+ "if the join predicates are subset of the sorted columns of the
tables") {
+ withTable("SPARK_15453_table_a", "SPARK_15453_table_b") {
+ withSQLConf("spark.sql.autoBroadcastJoinThreshold" -> "0") {
+ val df =
+ (0 until 8)
+ .map(i => (i, i * 2, i.toString))
+ .toDF("i", "j", "k")
+ .coalesce(1)
+ df.write.bucketBy(4, "j", "k").sortBy("j",
"k").saveAsTable("SPARK_15453_table_a")
+ df.write.bucketBy(4, "j", "k").sortBy("j",
"k").saveAsTable("SPARK_15453_table_b")
+
+ val query = """
+ |SELECT *
+ |FROM
+ | SPARK_15453_table_a a
+ |JOIN
+ | SPARK_15453_table_b b
+ |ON a.j=b.j AND
+ | a.k=b.k
+ """.stripMargin
+ val joinDF = sql(query)
+
+ val executedPlan = joinDF.queryExecution.executedPlan
+ val operators = executedPlan.collect {
--- End diff --
L93 and L94 were ensuring that there is only one `SortMergeJoinExec` and no
sort operations. Anyways, I have deleted this test.
---
If your project is set up for it, you can reply to this email and have your
reply appear on GitHub as well. If your project does not have this feature
enabled and wishes so, or if the feature is enabled but not working, please
contact infrastructure at [email protected] or file a JIRA ticket
with INFRA.
---
---------------------------------------------------------------------
To unsubscribe, e-mail: [email protected]
For additional commands, e-mail: [email protected]