JingsongLi commented on code in PR #11067:
URL: https://github.com/apache/paimon/pull/11067#discussion_r4532673410
##########
paimon-common/src/main/java/org/apache/paimon/predicate/RowIdPredicateVisitor.java:
##########
@@ -56,11 +56,16 @@ public Optional<List<Range>> visit(LeafPredicate predicate)
{
if (function instanceof Equal || function instanceof In) {
ArrayList<Long> rowIds = new ArrayList<>();
for (Object literal : predicate.literals()) {
- rowIds.add((Long) literal);
+ if (literal != null) {
+ rowIds.add((Long) literal);
+ }
}
return Optional.of(Range.toRanges(rowIds));
} else if (function instanceof Between) {
List<Object> literals = predicate.literals();
+ if (literals.contains(null)) {
Review Comment:
[P2] Check the two bounds directly instead of calling contains(null)
Java 17 clients can construct a valid row-ID BETWEEN predicate through the
Java API with immutable bounds, for example `new
LeafPredicate(Between.INSTANCE, DataTypes.BIGINT(), 0, "_ROW_ID", List.of(1L,
2L))`. JDK immutable lists reject `contains(null)`, so this new check throws a
`NullPointerException` even though neither bound is null. `ReadBuilderImpl`
forwards the predicate to `DataEvolutionBatchScan.withFilter`, so this also
breaks normal scan construction for such callers.
I reproduced this on Java 17: the baseline returns the range `[1, 2]`, while
this PR throws at this line. Please check `literals.get(0) == null ||
literals.get(1) == null` instead, and add regression coverage for an immutable
bounds list.
--
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.
To unsubscribe, e-mail: [email protected]
For queries about this service, please contact Infrastructure at:
[email protected]