cshuo opened a new pull request, #20292:
URL: https://github.com/apache/hudi/pull/20292

   ### Describe the issue this Pull Request addresses
   
   Closes https://github.com/apache/hudi/issues/20291.
   
   Flink equality queries can miss rows whose compound record keys contain the 
literal strings `__empty__` or `__null__`. With eight buckets, 
`(uuid='__empty__', name='x')` is written to bucket 1, but reader pruning 
selects bucket 4 and returns no rows. The writer decodes these placeholders 
before hashing; the reader previously hashed the literals directly.
   
   ### Summary and Changelog
   
   - Normalize compound-key placeholder literals before calculating the pruning 
bucket ID, matching the writer's key-extraction semantics.
   - Preserve literal values for single-field record keys and record-key field 
ordering for bucket hashing, including hash-key subsets.
   - Add writer/reader bucket parity tests and SQL write/read regressions for 
COPY_ON_WRITE and MERGE_ON_READ tables.
   
   Validation with Flink 1.20.1 and Java 11:
   
   - Verified the unpatched implementation fails 10 compound-key unit cases and 
both new SQL regressions, including the bucket 1 versus bucket 4 mismatch and 
empty query result.
   - With the fix, all 27 selected tests pass: 23 `TestPrimaryKeyPruners` cases 
and four SQL cases covering the new regression and existing bucket pruning for 
both table types.
   - Checkstyle and `git diff --check` pass.
   
   ### Impact
   
   Equality queries using bucket pruning now return matching rows for compound 
keys containing placeholder literals. No storage format, writer bucket 
assignment, public API, or configuration changes. Existing data does not need 
to be rewritten.
   
   ### Risk Level
   
   Low. The change is limited to placeholder normalization for compound-key 
pruning. Tests compare reader bucket IDs with the actual writer key-generation 
and bucket-assignment APIs and cover single-field keys, reordered filters and 
index fields, hash-key subsets, and multiple bucket counts.
   
   ### Documentation Update
   
   None.
   
   ### Contributor's checklist
   
   - [ ] Read through [contributor's 
guide](https://hudi.apache.org/contribute/how-to-contribute)
   - [x] Enough context is provided in the sections above
   - [x] Adequate tests were added if applicable
   
   🤖 Generated with [Claude Code](https://claude.com/claude-code)
   


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