danny0405 commented on a change in pull request #1322: [CALCITE-3198] 
ReduceExpressionsRule.FILTER_INSTANCE does not reduce 'NOT(x=a AND x=b)'
URL: https://github.com/apache/calcite/pull/1322#discussion_r305571886
 
 

 ##########
 File path: core/src/main/java/org/apache/calcite/rex/RexSimplify.java
 ##########
 @@ -1605,6 +1605,8 @@ private void ensureParanoidOff() {
   /** Simplifies a list of terms and combines them into an OR.
    * Modifies the list in place. */
   private RexNode simplifyOrs(List<RexNode> terms, RexUnknownAs unknownAs) {
+    // Auxiliary map to simplify cases like: X <> A OR X <> B => TRUE
+    final Map<RexNode, Comparison> notEqualsComparisonMap = new HashMap<>();
     for (int i = 0; i < terms.size(); i++) {
 
 Review comment:
   Shouldn't we invoke the `#simplifyComparison` firstly for the `OR` operator 
operands ? And BTW, this hashMap cache would trigger the digest computation of 
`RexNode`, could we have another way to identify the equivalence for RexNode ?

----------------------------------------------------------------
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.
 
For queries about this service, please contact Infrastructure at:
[email protected]


With regards,
Apache Git Services

Reply via email to