rdblue commented on a change in pull request #357: Add in and not in predicates URL: https://github.com/apache/incubator-iceberg/pull/357#discussion_r317373623
########## File path: api/src/test/java/org/apache/iceberg/expressions/TestEvaluator.java ########## @@ -362,4 +368,197 @@ public void testCharSeqValue() { Assert.assertFalse("string(abc) == utf8(abcd) => false", evaluator.eval(TestHelpers.Row.of(new Utf8("abcd")))); } + + @Test + public void testIn() { + Assert.assertEquals(3, in("s", 7, 8, 9).literals().size()); + Assert.assertEquals(3, in("s", 7, 8.1, Long.MAX_VALUE).literals().size()); + Assert.assertEquals(2, in("s", "abc", "abd", "abc").literals().size()); + Assert.assertEquals(0, in("s").literals().size()); + Assert.assertEquals(1, in("s", 5).literals().size()); + Assert.assertEquals(1, in("s", 5, 5).literals().size()); + Assert.assertEquals(1, in("s", Arrays.asList(5, 5)).literals().size()); + Assert.assertEquals(0, in("s", Collections.emptyList()).literals().size()); + + Evaluator evaluator = new Evaluator(STRUCT, in("x", 7, 8, Long.MAX_VALUE)); + Assert.assertTrue("7 in [7, 8] => true", evaluator.eval(TestHelpers.Row.of(7, 8, null))); + Assert.assertFalse("9 in [7, 8] => false", evaluator.eval(TestHelpers.Row.of(9, 8, null))); + + Evaluator longEvaluator = new Evaluator(STRUCT, Review comment: This name is misleading because the predicate is on an integer field in the schema. Can you rename it to `intSetEvaluator` or something more clear? ---------------------------------------------------------------- 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: us...@infra.apache.org With regards, Apache Git Services --------------------------------------------------------------------- To unsubscribe, e-mail: issues-unsubscr...@iceberg.apache.org For additional commands, e-mail: issues-h...@iceberg.apache.org