jackylee-ch opened a new pull request, #10122:
URL: https://github.com/apache/paimon/pull/10122

   ### Purpose
   
   `FileIndexProcessor` (the `rewrite_file_index` procedure) rebuilds a data 
file's file index. It computes `projectedIndexCols` as the index columns' 
positions in the **file** schema and builds the writer with 
`fileSchema.project(projectedIndexCols)`. But the reader used 
`ReadBuilder.withProjection(projectedIndexCols)`, which `ReadBuilderImpl` 
resolves against the **current table** schema.
   
   For a file whose `schemaId` differs from current, the spaces diverge once 
columns shift: `[k, a, v]` (bloom on `v`) → drop `a`, add `w` leaves `v` at 
file-index 2 while current-index 2 is now `w`. The reader then reads `w` 
(null-filled for the old file), so the bloom is rebuilt over nulls and a later 
`v = 100` query silently prunes the file.
   
   Fix: read with `withReadType(fileSchema.project(projectedIndexCols))` — the 
writer's own file-schema projection — so reader and writer share the file's 
column space. Current-schema files are unchanged.
   
   ### Tests
   
   `testRebuildsIndexOnCorrectColumnAfterColumnDropAndAdd`: bloom on `v` in 
`[k, a, v]`, write `v=100`, drop `a`, add `w`, rebuild, assert the `v` bloom 
still reports `100` present. Fails on master (wrong column → `100` absent); 
passes here.
   


-- 
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]

Reply via email to