Skip to content

Commit 9947e88

Browse files
authored
Avoid rewriting join to unsupported join (#1888)
1 parent 9d10ea8 commit 9947e88

File tree

2 files changed

+4
-4
lines changed

2 files changed

+4
-4
lines changed

spark/src/main/scala/org/apache/comet/rules/RewriteJoin.scala

Lines changed: 3 additions & 4 deletions
Original file line numberDiff line numberDiff line change
@@ -20,7 +20,7 @@
2020
package org.apache.comet.rules
2121

2222
import org.apache.spark.sql.catalyst.optimizer.{BuildLeft, BuildRight, BuildSide, JoinSelectionHelper}
23-
import org.apache.spark.sql.catalyst.plans.LeftSemi
23+
import org.apache.spark.sql.catalyst.plans.LeftAnti
2424
import org.apache.spark.sql.catalyst.plans.logical.Join
2525
import org.apache.spark.sql.execution.{SortExec, SparkPlan}
2626
import org.apache.spark.sql.execution.joins.{ShuffledHashJoinExec, SortMergeJoinExec}
@@ -65,9 +65,8 @@ object RewriteJoin extends JoinSelectionHelper {
6565
def rewrite(plan: SparkPlan): SparkPlan = plan match {
6666
case smj: SortMergeJoinExec =>
6767
getSmjBuildSide(smj) match {
68-
case Some(BuildRight) if smj.joinType == LeftSemi =>
69-
// TODO this was added as a workaround for TPC-DS q14 hanging and needs
70-
// further investigation
68+
case Some(BuildRight) if smj.joinType == LeftAnti =>
69+
// https://github.com/apache/datafusion-comet/issues/457
7170
plan
7271
case Some(buildSide) =>
7372
ShuffledHashJoinExec(

spark/src/main/scala/org/apache/comet/serde/QueryPlanSerde.scala

Lines changed: 1 addition & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -2592,6 +2592,7 @@ object QueryPlanSerde extends Logging with CometExprShim {
25922592
}
25932593

25942594
if (join.buildSide == BuildRight && join.joinType == LeftAnti) {
2595+
// https://github.com/apache/datafusion-comet/issues/457
25952596
withInfo(join, "BuildRight with LeftAnti is not supported")
25962597
return None
25972598
}

0 commit comments

Comments
 (0)