raghavyadav01 opened a new pull request, #18590:
URL: https://github.com/apache/iceberg/pull/18590
Closes #18412
`ResidualEvaluator` dereferences the partition value in `startsWith` and
`notStartsWith` without a null check, so computing a residual for a partition
whose value is null throws `NullPointerException`:
```
java.lang.NullPointerException: Cannot invoke "String.startsWith(String)"
because the return value of
"org.apache.iceberg.expressions.BoundReference.eval(org.apache.iceberg.StructLike)"
is null
at
org.apache.iceberg.expressions.ResidualEvaluator$ResidualVisitor.startsWith(ResidualEvaluator.java:215)
```
`ManifestFilterManager` computes a residual for every live file in a
manifest it rewrites, so a delete by row filter fails whenever the manifest
also holds a file with a null partition value. Scans hit it too: with
`or(isNull(s), startsWith(s, "a"))` the null-partition file survives planning
through the `isNull` branch, and `FileScanTask.residual()` then throws.
## Change
Treat a null partition value as not matching, so `startsWith` returns
`alwaysFalse()` and `notStartsWith` returns `alwaysTrue()`.
This keeps `ResidualEvaluator` consistent with `Evaluator`, which already
evaluates `startsWith` as `evalRes != null && ((String)
evalRes).startsWith(...)` and `notStartsWith` as its negation, and it mirrors
the guard `in` and `notIn` received in #17014.
## Tests
Added `testStartsWithWithNullStringPartition` and
`testNotStartsWithWithNullStringPartition` to `TestResiduals`, following the
shape of the existing `testInWithNullStringPartition` /
`testNotInWithNullStringPartition` cases. Both fail with `NullPointerException`
on main and pass with this change.
--
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]
---------------------------------------------------------------------
To unsubscribe, e-mail: [email protected]
For additional commands, e-mail: [email protected]