clintropolis opened a new pull request, #12972: URL: https://github.com/apache/druid/pull/12972
### Description This PR adds SQL and native JSON function support for using negative array indexes in jsonpath expressions, e.g. `json_value(nested, '$.x[-2]')` will return the 2nd to last element of the array. This fixes a bug where using negative array indexes would cause an `ArrayIndexOutOfBoundsException` to be thrown, failing the query. Since the underlying column does not currently provide an optimal way to select the values, using negative array indexes with `JSON_VALUE` will "fall back" to processing the "raw" JSON data, similar to when using `JSON_QUERY`. Additionally, using negative array indexes will make the query not eligible for vectorization. I save both of these optimizations for a future PR or two. <hr> This PR has: - [ ] been self-reviewed. - [ ] added documentation for new or modified features or behaviors. - [ ] added Javadocs for most classes and all non-trivial methods. Linked related entities via Javadoc links. - [ ] added comments explaining the "why" and the intent of the code wherever would not be obvious for an unfamiliar reader. - [ ] added unit tests or modified existing tests to cover new code paths, ensuring the threshold for [code coverage](https://github.com/apache/druid/blob/master/dev/code-review/code-coverage.md) is met. - [ ] been tested in a test Druid cluster. -- 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]
