Aaaaaaron commented on a change in pull request #2398:
URL: https://github.com/apache/calcite/pull/2398#discussion_r614010474



##########
File path: core/src/main/java/org/apache/calcite/tools/RelBuilder.java
##########
@@ -1334,22 +1334,28 @@ public RelBuilder filter(Iterable<CorrelationId> 
variablesSet,
    *
    * <p>The predicates are combined using AND,
    * and optimized in a similar way to the {@link #and} method.
-   * If the result is TRUE no filter is created. */
+   * If simplification is on and the result is TRUE, no filter is created. */
   public RelBuilder filter(Iterable<CorrelationId> variablesSet,
       Iterable<? extends RexNode> predicates) {
-    final RexNode simplifiedPredicates =
-        simplifier.simplifyFilterPredicates(predicates);
-    if (simplifiedPredicates == null) {
-      return empty();
+    final RexNode conjunctionPredicates;
+    if (config.simplify()) {
+      conjunctionPredicates = simplifier.simplifyFilterPredicates(predicates);
+      if (conjunctionPredicates == null) {
+        return empty();
+      }
+      if (conjunctionPredicates.isAlwaysTrue()) {
+        return this;
+      }

Review comment:
       Sorry, not get your point😂, can you desc more?




-- 
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]


Reply via email to