danny0405 commented on a change in pull request #2238: URL: https://github.com/apache/calcite/pull/2238#discussion_r517056551
########## File path: core/src/main/java/org/apache/calcite/rex/RexSimplify.java ########## @@ -1330,7 +1330,7 @@ RexNode simplifyAnd(RexCall e, RexUnknownAs unknownAs) { final SargCollector sargCollector = new SargCollector(rexBuilder, true); operands.forEach(t -> sargCollector.accept(t, terms)); - if (sargCollector.map.values().stream().anyMatch(b -> b.complexity() > 1)) { + if (sargCollector.needToFix(terms.size())) { Review comment: For example, a simple `$0=1` would be converted to `Sarg` which is meaningless. ---------------------------------------------------------------- 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: us...@infra.apache.org