chunweilei commented on PR #2800:
URL: https://github.com/apache/calcite/pull/2800#issuecomment-1127387370

   > I saw you used `Strong`, which is great. At some point we could improve 
this - add a method say `ImmutableBitSet Strong.strongKeys(RexNode e)` that 
returns, for a given expression `e`, the columns that must not be null in order 
for `e` to be not null.
   > 
   > The rule currently does
   > 
   > ```
   >     final ImmutableBitSet.Builder notNullableKeys = 
ImmutableBitSet.builder();
   >     RelOptUtil.conjunctions(join.getCondition()).forEach(node -> {
   >       if (Strong.isStrong(node)) {
   >         notNullableKeys.addAll(RelOptUtil.InputFinder.bits(node));
   >       }
   >     });
   > ```
   > 
   > but that `strongKeys` would not need to call `conjunctions` because it 
would work on `AND` just like any other operator.
   
   I am not sure whether I understand correctly. Is the `strongKeys` like
   ```
   public static ImmutableBitSet strongKeys(RexNode e) {
     final ImmutableBitSet.Builder strongKeys = ImmutableBitSet.builder();
     if (isStrong(e)) {
       strongKeys.addAll(RelOptUtil.InputFinder.bits(e));
     }
     return strongKeys.build();
   }
   ```
   ? If so, we still need to use `conjunctions ` to handle `AND` operator, like
   ```
       final ImmutableBitSet.Builder notNullableKeys = 
ImmutableBitSet.builder();
       RelOptUtil.conjunctions(join.getCondition()).forEach(node -> { 
             notNullableKeys.addAll(Strong.strongKeys(node));
       });
   ```


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