apache/iceberg · error · UnsupportedOperationException
AlwaysTrue is a placeholder only
Error message
AlwaysTrue is a placeholder only
What it means
AlwaysTrue in ParquetFilters is only a placeholder FilterPredicate used as an identity marker when converting expressions; it is never a real filter to be evaluated. Calling its accept(Visitor) method always throws UnsupportedOperationException because no visitor evaluation is defined for it.
Solutions
- Do not use AlwaysTrue as an actual filter — use FilterApi alwaysTrue() from parquet-mr's FilterApi if a real always-match filter is needed
- Treat AlwaysTrue in converted output as a signal to skip filtering entirely rather than feeding it to a visitor
Example fix
// before FilterPredicate p = ParquetFilters.predicate(Expressions.alwaysTrue()); visitor.visit(p); // throws // after FilterPredicate p = FilterApi.alwaysTrue(); // real parquet-mr filter
Defensive patterns
Strategy: type-guard
Validate before calling
if (pred instanceof ParquetFilters.AlwaysTrue) { /* skip filtering: match all rows */ } Type guard
static boolean isPlaceholder(FilterPredicate p) {
return p instanceof ParquetFilters.AlwaysTrue || p instanceof ParquetFilters.AlwaysFalse;
} Try / catch
if (!isPlaceholder(pred)) {
visitor.visit(pred);
} else {
// handle sentinel explicitly, never call accept()
} Prevention
- Never feed converted sentinel predicates to parquet-mr visitors
- Short-circuit alwaysTrue/alwaysFalse results before evaluation
When it happens
Trigger: Passing ParquetFilters.AlwaysTrue.INSTANCE to a Parquet FilterPredicate Visitor (e.g. LogicalFilterPredicate composition or parquet-mr's FilterPredicate visitor evaluation), which invokes accept().
Common situations: Manually composing Parquet filters with and()/or() using the sentinel; running parquet-mr's filter evaluation against a converted predicate that collapsed to AlwaysTrue.
Understand the failure class
Background: "This is a bug, please report it": internal invariant violations, unreachable panics, and SNH errors explained — this error's family across 47 libraries.
Related errors
- AlwaysFalse is a placeholder only
- Batch reading is not supported in non-vectorized reader
- doesn't implement setPageSource(PageReadStore)
- doesn't implement setRowGroupInfo(PageReadStore…
- readBinary is not supported
AI-assisted analysis of apache/iceberg@86d9c8fc54 (2026-09-12).
Data as JSON: /api/errors/ef54e7fd05d30d2f.
Report an issue: GitHub.
Appendix: source
Thrown at parquet/src/main/java/org/apache/iceberg/parquet/ParquetFilters.java:242
// TODO: this needs to convert to handle BigDecimal and UUID
Object value = lit.value();
if (value instanceof Number) {
return (C) lit.value();
} else if (value instanceof CharSequence) {
return (C) Binary.fromString(value.toString());
} else if (value instanceof ByteBuffer) {
return (C) Binary.fromReusedByteBuffer((ByteBuffer) value);
}
throw new UnsupportedOperationException(
"Type not supported yet: " + value.getClass().getName());
}
private static class AlwaysTrue implements FilterPredicate {
static final AlwaysTrue INSTANCE = new AlwaysTrue();
@Override
public <R> R accept(Visitor<R> visitor) {
throw new UnsupportedOperationException("AlwaysTrue is a placeholder only");
}
}
private static class AlwaysFalse implements FilterPredicate {
static final AlwaysFalse INSTANCE = new AlwaysFalse();
@Override
public <R> R accept(Visitor<R> visitor) {
throw new UnsupportedOperationException("AlwaysFalse is a placeholder only");
}
}
}
View on GitHub (pinned to 86d9c8fc54)