bvarghese1 commented on code in PR #30076:
URL: https://github.com/apache/flink/pull/30076#discussion_r4700863750
##########
flink-table/flink-table-planner/src/test/resources/org/apache/flink/table/planner/plan/batch/sql/SetOperatorsTest.xml:
##########
@@ -119,6 +120,32 @@ LogicalIntersect(all=[false])
<Resource name="optimized exec plan">
<![CDATA[
Values(tuples=[[]], values=[c])
+]]>
+ </Resource>
+ </TestCase>
+ <TestCase name="testIntersectRightInputWithDuplicates">
+ <Resource name="sql">
+ <![CDATA[SELECT s_suppkey FROM supplier INTERSECT SELECT ps_suppkey FROM
partsupp]]>
+ </Resource>
+ <Resource name="ast">
+ <![CDATA[
+LogicalIntersect(all=[false])
+:- LogicalProject(s_suppkey=[$0])
+: +- LogicalTableScan(table=[[default_catalog, default_database, supplier,
source: [TestTableSource(s_suppkey)]]])
++- LogicalProject(ps_suppkey=[$0])
+ +- LogicalTableScan(table=[[default_catalog, default_database, partsupp,
source: [TestTableSource(ps_suppkey)]]])
+]]>
+ </Resource>
+ <Resource name="optimized exec plan">
+ <![CDATA[
+HashAggregate(isMerge=[false], groupBy=[s_suppkey], select=[s_suppkey])
++- Exchange(distribution=[keep_input_as_is[hash[s_suppkey]]])
+ +- MultipleInput(members=[\nSortMergeJoin(joinType=[LeftSemiJoin],
where=[IS NOT DISTINCT FROM(s_suppkey, ps_suppkey)], select=[s_suppkey])\n:-
[#1] Exchange(distribution=[hash[s_suppkey]])\n+- HashAggregate(isMerge=[true],
groupBy=[ps_suppkey], select=[ps_suppkey])\n +- [#2]
Exchange(distribution=[hash[ps_suppkey]])\n])
Review Comment:
Thanks for pointing this. The distinct itself doesn't change the results but
the join strategy can change.
##########
flink-table/flink-table-planner/src/main/scala/org/apache/flink/table/planner/plan/rules/FlinkBatchRuleSets.scala:
##########
@@ -329,9 +329,9 @@ object FlinkBatchRuleSets {
FlinkSemiAntiJoinFilterTransposeRule.INSTANCE,
// set operators
- ReplaceIntersectWithSemiJoinRule.INSTANCE,
+ ReplaceIntersectWithSemiJoinRule.BATCH_INSTANCE,
Review Comment:
The two-phase aggregate was intended but losing `AdaptiveJoin` wasn't!
--
This is an automated message from the Apache Git Service.
To respond to the message, please log on to GitHub and use the
URL above to go to the specific comment.
To unsubscribe, e-mail: [email protected]
For queries about this service, please contact Infrastructure at:
[email protected]