Gabriel39 opened a new pull request, #70936: URL: https://github.com/apache/doris/pull/70936
### Background The external condition cache stores whether each file granule has surviving rows after file-level predicates run. Its scanner digest carries query, session and runtime-filter identity, while schema mapping determines which predicates actually run against each physical file. ### What problem does this PR solve? Issue Number: None Related PR: #65046 (introduced the file scanner v2 path), #65496 (source-range granule cache coordination) PR Type: Bugfix Problem Summary: Iceberg can delete a nested field and recreate its name with a new field ID and initial default without rewriting historical files. A predicate that previously ran in the file reader then becomes residual, but its old cache bitmap can still suppress rows before the default is materialized. Include localized predicates in cache identity; most changes are tests. For one unchanged file, query the whole struct and filter `mod(element_at(s,'x'),2)=1 AND mod(k,3)=1`. Replacing the old `x=0` child with a new BIGINT child defaulting to `9` gives: | Evolved schema query | Before fix | After fix | |---|---|---| | Condition cache disabled | 4096 rows | 4096 rows | | Condition cache enabled after warming the old schema | 0 rows | 4096 rows | ### Details - **Change map:** Production code +31/-21 lines; tests +434/-20; generated regression output +10/-0; no documentation changes. The production change reuses one eligibility digest and preserves the Iceberg positional-binding exclusion. Publication tests now inspect complete keys. - **Frequency:** Always when a cached false granule from local predicates P AND Q is reused after schema evolution leaves only Q localized under the same scanner digest. - **Root cause:** `TableReader` computed a localized digest only to decide cache eligibility, then keyed the bitmap solely by the scanner digest. It misses the changed file-local subset. - **Why existing tests missed it:** `TableReaderTest.ConditionCache*` covers scanner digests, INT96 contracts, RF refresh and EOF publication without changing the localized subset under the same scanner seed. `IcebergV2ReaderTest.ReusedNestedNameReadsNewFieldInitialDefault` verifies default materialization without warming condition cache. Iceberg schema-evolution regressions verify binding without requiring a positive cache hit across child replacement. - **Fix:** Return the existing localized digest from cache admission and mix it into the scanner seed before the existing INT96 key adjustment. Existing cache exclusions are preserved. Do not use the separately memoized scanner predicate snapshot digest or hash large RF payloads twice. - **Other paths and branches:** The common native `TableReader` key covers all its cacheable table formats and ORC/Parquet readers. Iceberg's positional fallback still rejects unstable field bindings. Internal-table cache is separate; legacy external readers have no condition-cache integration. Static inspection finds the scanner-only key on branch-4.1 and branch-4.2; branch-3.1 and branch-4.0 lack this native path. Release branches were not executed locally. ### Testing - Local ASAN: 277 tests passed across `TableReaderTest`, `IcebergV2ReaderTest` and ORC condition-cache tests. Two new tests cover P AND Q versus Q under the same seed, different scanner seeds with the same local predicates, positive reuse, zero-digest rejection and exactly one localized hash. The identity test fails against the original key. - Local native SQL: `test_iceberg_nested_predicate_cache` fails before the fix with 4096 rows from the cache-disabled oracle versus zero with the warmed cache. The candidate passes full-row comparison after evolution and positive cache-hit/pruning assertions; generated output is independently checked and replayed normally. - Standard Iceberg 1.12 and stock 1.10.1 SDK helpers author and read back all 8192 rows before and after public delete/add-column operations. Assertions preserve the parent ID, replace the child ID, retain the data snapshot/path/size, and check the new default, NULL parents and nonmatching granules. ### Notes for Reviewers BIGINT inputs avoid the implicit modulo cast whose zero digest deliberately disables caching. It supports an existing Spark/REST Docker environment or an explicitly configured local SDK/file warehouse. Docker deployment and automatic Docker CI execution were not verified locally. ### Release note Fix missing Iceberg query results caused by stale condition-cache bitmaps after a nested field is deleted and recreated with an initial default. ### Check List (For Author) - Behavior changed: No - Does this need documentation: No - Pre-submission status: Partially verified: Docker deployment and automatic Docker CI execution are unverified; the same SQL suite passed on an owned local cluster ### AI Disclosure - Tool: Codex (GPT-6) - Generated: Code, unit tests, regression tests and this description - Human review: not stated -- This is an automated message from the Apache Git Service. To respond to the message, please log on to GitHub and use the URL above to go to the specific comment. To unsubscribe, e-mail: [email protected] For queries about this service, please contact Infrastructure at: [email protected] --------------------------------------------------------------------- To unsubscribe, e-mail: [email protected] For additional commands, e-mail: [email protected]
