Skip to content

Commit

Permalink
Do not push down filter to ORC for union type schema (#123)
Browse files Browse the repository at this point in the history
  • Loading branch information
rzhang10 authored Aug 23, 2022
1 parent 21c3a80 commit f2e5bd2
Showing 1 changed file with 5 additions and 1 deletion.
6 changes: 5 additions & 1 deletion orc/src/main/java/org/apache/iceberg/orc/OrcIterable.java
Original file line number Diff line number Diff line change
Expand Up @@ -102,8 +102,12 @@ public CloseableIterator<T> iterator() {
// to push down filters to ORC's SearchArgument, since we are not reading anything from files at all
boolean isEmptyStruct = readOrcSchema.getChildren().size() == 0;

// If the projected ORC schema has union type, we can't reliably build a pushdown filter for the
// underlying ORC files, since the Iceberg schema has a different representation than the ORC schema.
boolean containsUnion = readOrcSchema.toString().contains("uniontype");

SearchArgument sarg = null;
if (filter != null && !isEmptyStruct) {
if (filter != null && !isEmptyStruct && !containsUnion) {
Expression boundFilter = Binder.bind(schema.asStruct(), filter, caseSensitive);
sarg = ExpressionToSearchArgument.convert(boundFilter, readOrcSchema);
}
Expand Down

0 comments on commit f2e5bd2

Please sign in to comment.