Fix row policies silently ignored on Iceberg tables with PREWHERE enabled#1597
Fix row policies silently ignored on Iceberg tables with PREWHERE enabled#1597mkmkme wants to merge 1 commit intobackports/antalya-26.1/95476from
Conversation
…bled The Iceberg read optimization (`allow_experimental_iceberg_read_optimization`) identifies constant columns from Iceberg metadata and removes them from the read request. When all requested columns become constant, it sets `need_only_count = true`, which tells the Parquet reader to skip all initialization — including `preparePrewhere` — and just return the raw row count from file metadata. This completely bypasses `row_level_filter` (row policies) and `prewhere_info`, returning unfiltered row counts. The InterpreterSelectQuery relies on the storage to apply these filters when `supportsPrewhere` is true and does not add a fallback FilterStep to the query plan, so the filter is silently lost. The fix prevents `need_only_count` from being set when an active `row_level_filter` or `prewhere_info` exists in the format filter info. Fixes #1595
|
AI audit note: This review comment was generated by AI (claude-4.6-opus-high-thinking). Audit update for PR #1597 (Fix row policies silently ignored on Iceberg tables with PREWHERE enabled): Confirmed defectsNo confirmed defects in reviewed scope. The fix is correct and minimal. The analysis follows. Bug being fixed (pre-existing): When Fix correctness: The added guard
Null safety: The fix correctly short-circuits on Consistency with caller: The caller in
Coverage summary
|
|
I've also checked the regression test is passing with this change. |
The Iceberg read optimization (
allow_experimental_iceberg_read_optimization) identifies constant columns from Iceberg metadata and removes them from the read request. When all requested columns become constant, it setsneed_only_count = true, which tells the Parquet reader to skip all initialization — includingpreparePrewhere— and just return the raw row count from file metadata.This completely bypasses
row_level_filter(row policies) andprewhere_info, returning unfiltered row counts. The InterpreterSelectQuery relies on the storage to apply these filters whensupportsPrewhereis true and does not add a fallback FilterStep to the query plan, so the filter is silently lost.The fix prevents
need_only_countfrom being set when an activerow_level_filterorprewhere_infoexists in the format filter info.Fixes #1595
Changelog category (leave one):
Changelog entry (a user-readable short description of the changes that goes to CHANGELOG.md):
Fix row policies silently ignored on Iceberg tables with PREWHERE enabled
Documentation entry for user-facing changes
...
CI/CD Options
Exclude tests:
Regression jobs to run: