Details
-
New Feature
-
Status: Closed
-
Major
-
Resolution: Fixed
-
None
-
None
Description
Replaceing Minus with Filter when both inputs are from the same source with only filter conditions differing.
SQL like
SELECT mgr, comm FROM emp WHERE mgr = 12 EXCEPT SELECT mgr, comm FROM emp WHERE comm = 5 ==> SELECT DISTINCT mgr, comm FROM emp WHERE mgr = 12 AND NOT(comm = 5)
Plan like
LogicalMinus(all=[false])
LogicalFilter(condition=[=($0, 12)])
LogicalProject(MGR=[$3], COMM=[$6])
LogicalTableScan(table=[[CATALOG, SALES, EMP]])
LogicalFilter(condition=[=($1, 5)])
LogicalProject(MGR=[$3], COMM=[$6])
LogicalTableScan(table=[[CATALOG, SALES, EMP]])
==>
LogicalAggregate(group=[{0, 1}])
LogicalFilter(condition=[AND(=($0, 12), <>($1, 5))])
LogicalProject(MGR=[$3], COMM=[$6])
LogicalTableScan(table=[[CATALOG, SALES, EMP]])
Some plans may contain complex alternating Filter and Project, which are not handled by this rule. Prerequisite rules are required to normalize such cases first. Currently only supports ALL is false and 2-way Minus.
Attachments
Issue Links
- links to