olivrlee commented on code in PR #3984:
URL: https://github.com/apache/calcite/pull/3984#discussion_r1806961280


##########
core/src/main/java/org/apache/calcite/sql/validate/SqlValidatorImpl.java:
##########
@@ -1217,12 +1219,21 @@ protected void validateNamespace(final 
SqlValidatorNamespace namespace,
         // fields; these are neutralized if the consuming query filters on 
them.
         final ImmutableBitSet mustFilterFields =
             namespace.getMustFilterFields();
-        if (!mustFilterFields.isEmpty()) {
+        // Remnant must filter fields are fields that are not selected and 
cannot

Review Comment:
   Actually that is not how the sets are populated.
   The purpose of remnant fields is to capture the fields that were marked as 
required, but no longer accessible to be filtered on and defused in the select 
clause. In other words, you cannot filter on any of the remnant fields. The 
presence of values being in the remant-filter set serves the purpose of being 
an indicator for erroring. 
   
   They can only be defused if any of the bypass fields are filtered on.
   
   In your example this would be the correct set values:
   `select b0, b1 from t` where `f` is a must-filter field
   
   must-filter field: []
   bypass-fields: [`b0`, `b1`]
   remnant-fields: [f]
   
   



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