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

   ## Problem
   Reading a nested field from an OPEN_STRUCT key that lives in the sparse blob 
returned null. For a document
   `{"o": {"z": 2}}`, `col['o.z']` was a literal top-level lookup, so it only 
worked when the column had been
   flattened at ingest (`maxNestedKeyDepth > 1`). Columns whose sparse blob 
comes from an external source, such
   as a Parquet VARIANT, are never flattened, so every nested field read as 
null on every row, with no error, and
   filters on it matched nothing.
   
   ## Change
   - `OpenStructSparseBlobReader` walks a dotted key through nested objects 
when the document has no literal key of
     that name. It follows `OpenStructKeyFlattener`'s rules, so the result 
matches what flattening at ingest would
     have produced:
     - a literal key wins at every level (`.` is an ordinary key character);
     - two synthesized paths that collide resolve in document order;
     - arrays are not indexed into;
     - a missing, null or scalar intermediate, or an empty segment, is absent.
     Presence (`computePresence`) and filters go through the same lookup.
   - `ImmutableOpenStructDataSource` no longer treats a dotted key as 
definitively absent when the sparse manifest
     lists a key it is a path under (`o.z` under `o`). The manifest names 
document keys, never the nested paths below
     them. A declared child field spec for the path applies to the walked value 
as for any sparse key.
   
   Mutable (consuming) segments keep one column per key and are unchanged; 
nested keys there are reachable when
   flattening is enabled.
   
   ## Tests
   - `OpenStructSparseBlobReaderTest`: nested walk, object leaf, literal-wins 
at the top and inner levels, collision
     order, arrays / scalar / null / missing intermediates, empty segments, 
presence through a path.
   - `ImmutableOpenStructDataSourceTest`: a dotted key under a manifest key 
gets a sparse data source with the
     declared child type applied (`INT` value `2`); a path with no listed 
prefix stays a `NullDataSource`.
   - Failed before the change, pass after. All OPEN_STRUCT tests in 
`pinot-segment-local` (217) and `pinot-core`
     (45) pass.
   - End to end on a table whose OPEN_STRUCT is backed by an unshredded Parquet 
VARIANT: `col['o.z']` projection,
     `= 1` filter and `GROUP BY` now return the same results as the source 
engine (previously null on all 120 rows).
   


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