You are viewing a plain text version of this content. The canonical link for it is here.
Posted to issues@iceberg.apache.org by GitBox <gi...@apache.org> on 2021/12/20 20:35:33 UTC

[GitHub] [iceberg] rdblue commented on a change in pull request #2062: [CORE] Add in a NOT_STARTS_WITH operator

rdblue commented on a change in pull request #2062:
URL: https://github.com/apache/iceberg/pull/2062#discussion_r772652476



##########
File path: api/src/main/java/org/apache/iceberg/expressions/InclusiveMetricsEvaluator.java
##########
@@ -408,6 +408,54 @@ public Boolean or(Boolean leftResult, Boolean rightResult) {
       return ROWS_MIGHT_MATCH;
     }
 
+    @Override
+    public <T> Boolean notStartsWith(BoundReference<T> ref, Literal<T> lit) {
+      Integer id = ref.fieldId();
+
+      // Iceberg does not implement SQL 3-boolean logic. Return ROWS_MIGHT_MATCH
+      // to allow the query engine to make its own decision regarding NULL values.
+      if (mayContainNull(id)) {
+        return ROWS_MIGHT_MATCH;

Review comment:
       I don't think this is correct. In SQL, `null LIKE 'a%'` should result in `null`, and `null NOT LIKE 'a%'` should also result in `null`. So in both cases, `null` does not match and is ignored.
   
   Here, I think this should use `containsNullsOnly(id)`. In that case, we know that no rows match and can exit before checking bounds.




-- 
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: issues-unsubscribe@iceberg.apache.org

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



---------------------------------------------------------------------
To unsubscribe, e-mail: issues-unsubscribe@iceberg.apache.org
For additional commands, e-mail: issues-help@iceberg.apache.org