Repository navigation
[python] Match no rows for a null literal in comparison predicates - #10814
Merged
JingsongLi merged 1 commit intoOct 27, 2026
Merged
Conversation
As in Java LeafBinaryFunction and LeafTernaryFunction, a comparison with a null literal matches no row and no file. The Python predicates compared values, stats and Arrow columns with None instead: - notEqual kept every non-null row when a primary-key read filters the merged rows. - equal, lessThan, lessOrEqual, greaterThan, greaterOrEqual, between, notBetween, startsWith, endsWith and contains raised TypeError, in the row filter or when pruning files by value stats. - like turned the null pattern into the string 'None' and matched it. - notBetween with a null bound kept rows where the Arrow expression is the final filter, as in an append table read: Arrow evaluates `x < a OR x > NULL` as true for x < a. - System tables did the same for notBetween with a null bound, in both the Arrow filter and the row filter used with string predicates. A null literal now fails the row test and the stats test, and converts to an Arrow expression that matches no row. The system-table row filter drops its own null handling and relies on this.
plusplusjiajia
force-pushed
the
fix/python-null-literal-predicates
branch
from
October 26, 2026 13:29
11f04cd to
586f180
Compare
plusplusjiajia
marked this pull request as ready for review
October 26, 2026 13:50
Contributor
|
+1 |
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.
Purpose
As in Java
LeafBinaryFunctionandLeafTernaryFunction, a comparison with a null literal matches no row and no file. The Python predicates compared values, stats and Arrow columns withNoneinstead, so a filter such asnot_equal('v', None)built withPredicateBuildergave wrong results or failed:notEqualreturned every non-null row when a primary-key read filters the merged rows. Java returns no rows.equal,lessThan,lessOrEqual,greaterThan,greaterOrEqual,between,notBetween,startsWith,endsWithandcontainsraisedTypeError, in the row filter or when pruning files by value stats, for example in an append table withmetadata.stats-mode: full.liketurned the null pattern into the string'None'and matched it.notBetweenwith a null bound returned rows where the Arrow expression is the final filter, as in an append table read: Arrow evaluatesx < a OR x > NULLas true forx < a.notBetweenwith a null bound, both in the Arrow filter and in the row filter that [python] Support string filters on system tables #10631 added for string predicates:not_between('id', 3, None)returned the rows withid < 3.A null literal now fails the row test and the stats test, as in Java, and converts to an Arrow expression that matches no row. The system-table row filter drops its own null handling and relies on this.
inandnotInalready follow Java since #9132 and are unchanged.Tests
PredicateTest#test_null_literal_matches_nothing: all 12 comparisons with a null literal return no rows from four tables: an append table with full stats, an append table without stats so that the Arrow filter decides, a primary-key table, and a primary-key table with two commits to one bucket so that rows are filtered after the merge.PredicateTest#test_null_literal_by_value_stats_and_arrow: the row test, the stats test and the Arrow expression of each comparison reject a null literal, andlikedoes not match the string'None'.system_string_filter_test#test_mixed_null_range_and_set_comparisons:not_betweenwith a null bound now expects no rows, alone and combined with a string predicate.