Class MinusToFilterRule

All Implemented Interfaces:
TransformationRule

@Enclosing public class MinusToFilterRule extends RelRule<MinusToFilterRule.Config> implements TransformationRule
Rule that replaces Minus operator with Filter when both inputs are from the same source with only filter conditions differing. Only inspect a single Filter layer in the inputs of Minus. For inputs with nested Filters, apply CoreRules.FILTER_MERGE as a preprocessing step.

Example transformation:

 SELECT mgr, comm FROM emp WHERE mgr = 12
 EXCEPT
 SELECT mgr, comm FROM emp WHERE comm = 5

 to

 SELECT DISTINCT mgr, comm FROM emp
 WHERE mgr = 12 AND NOT(comm = 5)