raghavyadav01 opened a new pull request, #19602:
URL: https://github.com/apache/pinot/pull/19602
### Problem
`JsonNode.asText()` is defined as the empty string for an object or array
node. `SparseKeyDataSource.SparseKeyForwardIndexReader.getString` calls it
directly, so a sparse OPEN_STRUCT key whose value is a nested document read
back as `""` — indistinguishable from a key the document never had.
Any blob key holding an object or an array was therefore unreachable:
```json
{"device": {"os": "android", "sdk": 33}, "tags": [1, 2, 3]}
```
`col['device']` returned `""`, and so did `col['tags']`.
### Change
Serialize container nodes and leave scalars on `asText()`:
```java
node -> node.isContainerNode() ? node.toString() : node.asText()
```
That is what a caller asking a JSON blob for a value expects, and it is the
form the JSON functions (`JSON_EXTRACT_SCALAR` and friends) can consume, so a
nested value becomes reachable rather than silently empty.
Scalars, absent keys and the null-default path are unchanged.
### Testing
`SparseKeyDataSourceTest` gains an object value and an array value in its
fixture and a case asserting both serialize as JSON, that scalars still read as
before, and that an absent key still falls back to the default. The existing
OPEN_STRUCT suite passes (134 tests in `pinot-segment-local`).
🤖 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]
---------------------------------------------------------------------
To unsubscribe, e-mail: [email protected]
For additional commands, e-mail: [email protected]