Repository navigation
API: Handle null partition values in ResidualEvaluator startsWith/notStartsWith - #18590
Open
raghavyadav01 wants to merge 1 commit into
Open
raghavyadav01 wants to merge 1 commit into
raghavyadav01 wants to merge 1 commit into
Conversation
…StartsWith ResidualEvaluator dereferenced the partition value in startsWith and notStartsWith without a null check, so computing a residual for a partition whose value is null threw NullPointerException. ManifestFilterManager computes a residual for every live file in a manifest it rewrites, so a delete by row filter failed whenever the manifest also held 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. Treat a null partition value as not matching, so startsWith returns alwaysFalse() and notStartsWith returns alwaysTrue(). This matches Evaluator, which already evaluates startsWith as `evalRes != null && ...` and notStartsWith as its negation, and mirrors the guard in and notIn received in apache#17014. Fixes apache#18412 Signed-off-by: Raghvendra Yadav <raghavmnnit@gmail.com>
This branch has not been deployed
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment
Add this suggestion to a batch that can be applied as a single commit.This suggestion is invalid because no changes were made to the code.Suggestions cannot be applied while the pull request is closed.Suggestions cannot be applied while viewing a subset of changes.Only one suggestion per line can be applied in a batch.Add this suggestion to a batch that can be applied as a single commit.Applying suggestions on deleted lines is not supported.You must change the existing code in this line in order to create a valid suggestion.Outdated suggestions cannot be applied.This suggestion has been applied or marked resolved.Suggestions cannot be applied from pending reviews.Suggestions cannot be applied on multi-line comments.Suggestions cannot be applied while the pull request is queued to merge.Suggestion cannot be applied right now. Please check back later.
Closes #18412
ResidualEvaluatordereferences the partition value instartsWithandnotStartsWithwithout a null check, so computing a residual for a partition whose value is null throwsNullPointerException:ManifestFilterManagercomputes 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: withor(isNull(s), startsWith(s, "a"))the null-partition file survives planning through theisNullbranch, andFileScanTask.residual()then throws.Change
Treat a null partition value as not matching, so
startsWithreturnsalwaysFalse()andnotStartsWithreturnsalwaysTrue().This keeps
ResidualEvaluatorconsistent withEvaluator, which already evaluatesstartsWithasevalRes != null && ((String) evalRes).startsWith(...)andnotStartsWithas its negation, and it mirrors the guardinandnotInreceived in #17014.Tests
Added
testStartsWithWithNullStringPartitionandtestNotStartsWithWithNullStringPartitiontoTestResiduals, following the shape of the existingtestInWithNullStringPartition/testNotInWithNullStringPartitioncases. Both fail withNullPointerExceptionon main and pass with this change.