raghavyadav01 opened a new pull request, #20337:
URL: https://github.com/apache/pinot/pull/20337

   ## Summary
   
   `SELECT open_struct_col` rendered a BOOLEAN key as `1` or `0`, while 
`col['flag']` returns `true`. The whole-document text now says `true` or 
`false`.
   
   ## Where it breaks
   
   Take an OPEN_STRUCT column with a BOOLEAN key `flag` (materialized) and an 
INT key `count`, and a row with `flag = true`, `count = 5`:
   
   | query | before | after |
   |---|---|---|
   | `SELECT col['flag']` | `true` | `true` |
   | `SELECT col` | `{"flag":1,"count":5}` | `{"flag":true,"count":5}` |
   
   Pinot stores a BOOLEAN as INT 0/1. 
`OpenStructDataSource#openMapValueReader()` hands back the stored number, and 
`ProjectionBlock#openStructDocuments` rendered it as is. A BOOLEAN that lives 
in the sparse blob is already a JSON boolean, so the same value read 
differently depending on whether the key was materialized.
   
   ## Fix
   
   `ProjectionBlock` collects the materialized keys declared BOOLEAN from the 
per-key data sources and renders their 0/1 as `false`/`true` in the top-level 
document. The reconstruction shared with the seal path is not touched. Nested 
objects are the source's own JSON and are unchanged.
   
   ## User-visible change
   
   `SELECT col` on an OPEN_STRUCT column with a materialized BOOLEAN key now 
returns `true`/`false` instead of `1`/`0`. Worth a release-note line.
   
   ## Validation
   
   - `ProjectionBlockOpenStructTest.testBooleanKeyRendersAsBoolean` (new): read 
`{"flag":1,"off":0,"count":5}` before the fix. `testSparseBooleanStaysBoolean` 
pins the sparse side.
   - Related `pinot-core` OPEN_STRUCT, projection and item-transform tests: 583 
run, 0 failures.
   - Checkstyle, license and spotless clean.
   


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

Reply via email to