xabriel commented on a change in pull request #89: Make read-path Evaluators
honor case sensitivity flag. Expose flag in Spark Reader.
URL: https://github.com/apache/incubator-iceberg/pull/89#discussion_r263639035
##########
File path: api/src/test/java/com/netflix/iceberg/transforms/TestProjection.java
##########
@@ -86,6 +87,53 @@ public void testIdentityProjection() {
}
}
+ @Test
+ public void testCaseInsensitiveIdentityProjection() {
+ List<UnboundPredicate<?>> predicates = Lists.newArrayList(
+ Expressions.notNull("ID"),
+ Expressions.isNull("ID"),
+ Expressions.lessThan("ID", 100),
+ Expressions.lessThanOrEqual("ID", 101),
+ Expressions.greaterThan("ID", 102),
+ Expressions.greaterThanOrEqual("ID", 103),
+ Expressions.equal("ID", 104),
+ Expressions.notEqual("ID", 105)
+ );
+
+ PartitionSpec spec = PartitionSpec.builderFor(SCHEMA)
+ .identity("id")
+ .build();
+
+ for (UnboundPredicate<?> predicate : predicates) {
+ // get the projected predicate
+ Expression expr = Projections.inclusive(spec, false).project(predicate);
+ UnboundPredicate<?> projected = assertAndUnwrapUnbound(expr);
+
+ // check inclusive the bound predicate to ensure the types are correct
+ BoundPredicate<?> bound =
assertAndUnwrap(predicate.bind(spec.schema().asStruct(), false));
+
+ Assert.assertEquals("Field name should match partition struct field",
+ "id", projected.ref().name());
+ Assert.assertEquals("Operation should match", bound.op(),
projected.op());
+
+ if (bound.literal() != null) {
+ Assert.assertEquals("Literal should be equal",
+ bound.literal().value(), projected.literal().value());
+ } else {
+ Assert.assertNull("Literal should be null", projected.literal());
+ }
+ }
+ }
+
+ @Test(expected = ValidationException.class)
+ public void testCaseSensitiveIdentityProjection() {
Review comment:
Agreed.
----------------------------------------------------------------
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]
With regards,
Apache Git Services
---------------------------------------------------------------------
To unsubscribe, e-mail: [email protected]
For additional commands, e-mail: [email protected]