RussellSpitzer commented on a change in pull request #2062:
URL: https://github.com/apache/iceberg/pull/2062#discussion_r770852322
##########
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;
+ }
+
+ ByteBuffer prefixAsBytes = lit.toByteBuffer();
+
+ Comparator<ByteBuffer> comparator = Comparators.unsignedBytes();
+
+ // notStartsWith will match unless all values must start with the
prefix. This happens when the lower and upper
+ // bounds both start with the prefix.
+ if (lowerBounds != null && upperBounds != null &&
+ lowerBounds.containsKey(id) && upperBounds.containsKey(id)) {
+ ByteBuffer lower = lowerBounds.get(id);
+ // if lower is shorter than the prefix, it can't start with the prefix
Review comment:
I think let's try to keep pronouns out of this since I have difficulty
parsing this statement. I'm always confused though.
// if lower is shorter than the prefix then lower doesn't start with the
prefix
--
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]
---------------------------------------------------------------------
To unsubscribe, e-mail: [email protected]
For additional commands, e-mail: [email protected]