Skip to content

[core][python] Fix mixed row-id OR pushdown#8496

Merged
JingsongLi merged 1 commit into
apache:masterfrom
QuakeWang:rowid-or-filter
Jul 7, 2026
Merged

[core][python] Fix mixed row-id OR pushdown#8496
JingsongLi merged 1 commit into
apache:masterfrom
QuakeWang:rowid-or-filter

Conversation

@QuakeWang

Copy link
Copy Markdown
Member

Purpose

Data evolution scans reused the full filter for row-range extraction, stats pruning, and global index evaluation.

For mixed predicates such as _ROW_ID = 1 OR f0 > 5, the row-id visitor cannot fully convert the predicate to row ranges. The old path could still remove or push _ROW_ID branches into stats/global-index pruning, which may narrow scan semantics, hit system-field handling bugs, or incorrectly enable limit/top-n split pruning.

This PR keeps the full predicate for read-time filtering and limit/top-n safety, while only pushing row-id-safe residual predicates into scan pruning and global index evaluation. Python follows the same rule and excludes _ROW_ID from stats predicates.

Tests

  • mvn -pl paimon-core -am -DfailIfNoTests=false -Dtest=DataEvolutionBatchScanTest,BtreeGlobalIndexTableTest,DataEvolutionTableTest#testMixedRowIdOrFilterDoesNotPruneByUnsafeStatsResidual+testMixedRowIdOrFilterDisablesUnsafeLimitPushDown+testLimitPushDownWithFilterShouldNotEarlyStop test
  • python -m pytest paimon-python/pypaimon/tests/range_test.py paimon-python/pypaimon/tests/reader_predicate_test.py paimon-python/pypaimon/tests/test_early_row_range_filter.py paimon-python/pypaimon/tests/data_evolution_test.py paimon-python/pypaimon/ tests/predicates_test.py::PredicateTest::test_exclude_predicate_with_fields -q

Data evolution scans previously reused the full filter for row range extraction, stats pruning, and global index evaluation. A mixed OR such as _ROW_ID = 1 OR f0 > 5 cannot be fully converted to row ranges, but parts of it could still be stripped or pushed into pruning paths.

Keep the full predicate for read-time filtering and limit/top-n safety, while only pushing row-id-safe residual predicates into scan pruning and global index evaluation. Python now follows the same rule and excludes _ROW_ID from stats predicates.

Signed-off-by: QuakeWang <wangfuzheng0814@foxmail.com>
@JingsongLi

Copy link
Copy Markdown
Contributor

+1

@JingsongLi JingsongLi merged commit dd0bbf6 into apache:master Jul 7, 2026
17 checks passed
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

None yet

Projects

None yet

Development

Successfully merging this pull request may close these issues.

2 participants