rdsr commented on a change in pull request #1208:
URL: https://github.com/apache/iceberg/pull/1208#discussion_r460364692
##########
File path:
orc/src/test/java/org/apache/iceberg/orc/TestExpressionToSearchArgument.java
##########
@@ -262,4 +264,65 @@ public void testEvolvedSchema() {
actual = ExpressionToSearchArgument.convert(boundFilter, readSchema);
Assert.assertEquals(expected.toString(), actual.toString());
}
+
+ @Test
+ public void testOriginalSchemaNameMapping() {
+ Schema originalSchema = new Schema(
+ required(1, "int", Types.IntegerType.get()),
+ optional(2, "long", Types.LongType.get())
+ );
+
+ TypeDescription orcSchemaWithoutIds =
ORCSchemaUtil.removeIds(ORCSchemaUtil.convert(originalSchema));
+ NameMapping nameMapping = MappingUtil.create(originalSchema);
+
+ TypeDescription readSchema =
ORCSchemaUtil.buildOrcProjection(originalSchema,
+ ORCSchemaUtil.applyNameMapping(orcSchemaWithoutIds, nameMapping));
+
+ Expression expr = and(equal("int", 1), equal("long", 1));
+ Expression boundFilter = Binder.bind(originalSchema.asStruct(), expr,
true);
+ SearchArgument expected = SearchArgumentFactory.newBuilder()
+ .equals("`int`", Type.LONG, 1L)
+ .equals("`long`", Type.LONG, 1L)
+ .build();
+
+ SearchArgument actual = ExpressionToSearchArgument.convert(boundFilter,
readSchema);
+ Assert.assertEquals(expected.toString(), actual.toString());
+ }
+
+ @Test
+ public void testModifiedSchemaNameMapping() {
Review comment:
can we have a test case for where complex fields are also pruned? For
instance if all fields of a struct are pruned, the struct is pruned. Similarly
for maps and lists?
----------------------------------------------------------------
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]