kbendick commented on a change in pull request #2062:
URL: https://github.com/apache/iceberg/pull/2062#discussion_r568071302
##########
File path: api/src/test/java/org/apache/iceberg/expressions/TestEvaluator.java
##########
@@ -220,6 +222,24 @@ public void testNotEqual() {
}
+ @Test
+ public void testStartsWith() {
+ StructType struct = StructType.of(required(24, "s",
Types.StringType.get()));
+ Evaluator evaluator = new Evaluator(struct, startsWith("s", "abc"));
+ Assert.assertTrue("abc startsWith abc => true",
evaluator.eval(TestHelpers.Row.of("abc")));
+ Assert.assertFalse("abc startsWith Abc => false",
evaluator.eval(TestHelpers.Row.of("Abc")));
+ Assert.assertFalse("a startsWith abc => false",
evaluator.eval(TestHelpers.Row.of("a")));
Review comment:
I can add that. With respect to the syntax, I copied a similar variant
to what is found elsewhere. For converting it to typical "should" test syntax,
would `abcd startsWith abc should be true` work?
The original syntax for this which I modified somewhat comes from a test in
`TestStartsWith` (and possibly elsewhere), which reads as `"startsWith(abcde,
truncate(abcdg,2)) => true"` (where the test row is "abcdg"). For me, I have
to think about what exactly that statement is expressing a little harder than
I'd like, but I will admit I haven't had all of my morning coffee so maybe it's
plenty clear expressed that way?
I'm open to suggestions, but I'll switch to `abcd startsWith abc should be
true` for now.
----------------------------------------------------------------
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]