Repository navigation
Conversation
After add_column, a scan with `!=` or `not like` returned every row of the files written before the column existed, but not rows that store an explicit null, so rewriting those files changed the result of the same scan. A null missing value now decides only IsNull and NotNull, as a null partition value does since apache#4278. Negations are pushed down before translating so that Not(EqualTo) behaves like NotEqualTo. NotIn is unchanged because the PyArrow filter keeps nulls for it as well. Co-Authored-By: Claude Fable 5.2 <noreply@anthropic.com>
Fokko
reviewed
Dec 4, 2026
Fokko
left a comment
Contributor
There was a problem hiding this comment.
Thanks @DE-Dobby! Nice fix, the scans now agree before and after a rewrite, closes #4613 🙌. Verified that count() and to_arrow() agree for != and not in across the rewrite, and that the single-literal NotIn collapse to NotEqualTo behaves the same on files with and without the column. Nit: in tests/expressions/test_visitors.py (the cases loops around line 1921) could you use @pytest.mark.parametrize instead of a loop?
Co-Authored-By: Claude Fable 5.2 <noreply@anthropic.com>
Author
|
Thanks for the review! Switched both tests to |
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 #4613
Rationale for this change
After
add_column,!=andnot likeon the new column returned every row of files written before the column existed, but not rows with an explicit null, so rewriting those files changed the result.For a column missing from the file the predicate was evaluated in Python against None, where
None != 'ok'is true. A null missing value now only decidesIsNull/NotNull, as #4278 did for null partition values. Negations are pushed down withrewrite_notfirst sonot x = 'a'behaves likex != 'a'.NotInis left alone since the PyArrow filter keeps nulls for it too (#3918).Are these changes tested?
Yes. Unit tests for each predicate on a missing column, and a scan test that compares results before and after the files are rewritten.
Are there any user-facing changes?
Yes. These scans no longer return rows from files that lack the column.
AI disclosure: drafted with Claude Code; I reviewed the change and the tests.