ian-bertolacci commented on code in PR #3452:
URL: https://github.com/apache/calcite/pull/3452#discussion_r1350768855


##########
core/src/main/java/org/apache/calcite/rel/metadata/RelMdPredicates.java:
##########
@@ -666,6 +666,29 @@ static class JoinConditionBasedPredicateInference {
       equivalence = BitSets.closure(equivalence);
     }
 
+    /**
+     * As RexPermuteInputsShuttle, with one exception. When visiting an 
inputRef,
+     * it will replace the type of the InputRef with the type found in the 
input fields,
+     * instead of keeping the original type. This is used within
+     * when generating the Left/RightInferredPredicates, to avoid nullability 
mismatches
+     * between the types of the join and the types of the inputs.
+     */
+    private class TypeChangingRexPermuteInputsShuttle
+        extends org.apache.calcite.rex.RexPermuteInputsShuttle {

Review Comment:
   Maybe there are situations where fields is not empty, but also not the same 
size as the number of input columns?
   I could see something like this working:
   ```java
   RelDataType dataType = target < fields.size() ? local.getType() : 
fields.get(target).getType();
   ```



-- 
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: commits-unsubscr...@calcite.apache.org

For queries about this service, please contact Infrastructure at:
us...@infra.apache.org

Reply via email to