suibianwanwank commented on code in PR #4332:
URL: https://github.com/apache/calcite/pull/4332#discussion_r2067758768


##########
core/src/main/java/org/apache/calcite/sql2rel/RelDecorrelator.java:
##########
@@ -3201,6 +3212,61 @@ assert allLessThan(this.oldToNewOutputs.values(),
     }
   }
 
+  /**
+   * Check if the field at the given index is non-nullable.
+   *
+   * <p>This method performs a basic check for `null` values in the field. 
However, a
+   * `false` result does not necessarily mean that the field contains `null` 
values.
+   * It only guarantees that if the result is `true`, the field contains no 
`null` values.
+   */
+  private static boolean isFilterNull(RelNode rel, int index) {
+    RelDataType type = rel.getRowType().getFieldList().get(index).getType();
+    return !type.isNullable() || isFilterNullRecursive(rel, index);
+  }
+
+  private static boolean isFilterNullRecursive(RelNode rel, int index) {

Review Comment:
   Thanks for the suggestion! Indeed, if similar logic is required in more 
places in the future, I would consider moving this method into metadataQuery 
for better reusability. Given its current simplicity, I’ve kept it as a private 
method in this PR.



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