Data: Handle null values properly in IN predicate filtering#16697
Open
hantangwangd wants to merge 1 commit into
Open
Data: Handle null values properly in IN predicate filtering#16697hantangwangd wants to merge 1 commit into
IN predicate filtering#16697hantangwangd wants to merge 1 commit into
Conversation
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.
When scanning table records via
IcebergGenerics.read(table)and specifying filter conditions withwhere(filter), if the filter contains anINpredicate and the corresponding target column contains null values, the query may fail directly with the following error:The root cause is: when
FilterIterator.advance()is called, it invokes theshouldKeep(item)closure method ofCloseableIterableto determine whether to keep the read item, during which thein(...)method ofEvalVisitoris executed for evaluation. In the original logic, it directly checks that the corresponding target column value is not null, and throws immediately if it is null.However, in many scenarios (such as the one constructed in the newly added test case), when a data file contains both possible valid values and null values in the target column, the records that contain null values will be read and passed to this method for evaluation, at which point an error will be thrown directly.
This PR fixes the issue by properly handling null values.