rubenada commented on code in PR #5275:
URL: https://github.com/apache/calcite/pull/5275#discussion_r4060993043


##########
core/src/main/java/org/apache/calcite/sql/validate/SetopNamespace.java:
##########
@@ -112,6 +116,25 @@ private static SqlMonotonicity combine(@Nullable 
SqlMonotonicity m0,
         }
         validator.validateQuery(operand, scope, targetRowType);
       }
+      // Propagate the operands' filter requirements to this namespace.
+      ImmutableBitSet filterFields = ImmutableBitSet.of();
+      @Nullable ImmutableBitSet bypassFields = null;
+      final Set<SqlQualified> remnantFilterFields = new LinkedHashSet<>();
+      for (SqlNode operand : call.getOperandList()) {
+        final SqlValidatorNamespace operandNamespace =
+            requireNonNull(validator.getNamespace(operand),
+                () -> "namespace for " + operand);
+        final FilterRequirement requirement = 
operandNamespace.getFilterRequirement();

Review Comment:
   Do you mean something like
   ```
   // Only operands that still owe a must-filter constrain the setop's bypass 
set
   if (!requirement.filterFields.isEmpty() || 
!requirement.remnantFilterFields.isEmpty()) {
     bypassFields = bypassFields == null
         ? requirement.bypassFields
         : bypassFields.intersect(requirement.bypassFields);
   }
   ```



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

To unsubscribe, e-mail: [email protected]

For queries about this service, please contact Infrastructure at:
[email protected]

Reply via email to