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



##########
File path: 
api/src/main/java/org/apache/iceberg/expressions/ResidualEvaluator.java
##########
@@ -214,6 +214,11 @@ public Expression or(Expression leftResult, Expression 
rightResult) {
       return ((String) ref.eval(struct)).startsWith((String) lit.value()) ? 
alwaysTrue() : alwaysFalse();
     }
 
+    @Override
+    public <T> Expression notStartsWith(BoundReference<T> ref, Literal<T> lit) 
{
+      return ((String) ref.eval(struct)).startsWith((String) lit.value()) ? 
alwaysFalse() : alwaysTrue();
+    }

Review comment:
       If we can't use String comparison, then the right way to compare is to 
convert to `CharSequence`. `ByteBuffer` gets converted to `CharBuffer` using 
UTF-8 and that implements `CharSequence`, while `String` already implements 
`CharSequence`.
   
   We know that the literal's value is a `String` because that is the only 
literal value that is accepted by the API, so that cast is fine here and in 
other places. I'm not sure that the result of evaluating the reference is a 
String. It seems like that should be a `CharSequence` instead. But let's fix 
that problem later.




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

For queries about this service, please contact Infrastructure at:
[email protected]



---------------------------------------------------------------------
To unsubscribe, e-mail: [email protected]
For additional commands, e-mail: [email protected]

Reply via email to