Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

support non-constant expressions for path arguments for json_value and json_query #15320

Merged

Conversation

clintropolis
Copy link
Member

Description

This PR adds support for using expressions to compute the json path argument for JSON_VALUE and JSON_QUERY functions. Note that when using a path expression that isn't a constant, Druid cannot take advantage of the specialized virtual column typically used, and so must fall back to a pure expression virtual column to compute the values from the 'raw' json blob, which will be much less performant than if the path is constant and known up front.


This PR has:

  • been self-reviewed.
  • 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 is met.
  • been tested in a test Druid cluster.

Copy link
Contributor

@gianm gianm left a comment

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Logic looks good, but about code structure— the triply-nested if statements with long bodies make it hard to follow, so it'd be better to split this into multiple methods, or break out the inner classes, or something.

@clintropolis clintropolis merged commit a95c22c into apache:master Nov 17, 2023
83 checks passed
@clintropolis clintropolis deleted the json-value-with-dynamic-paths branch November 17, 2023 09:12
writer-jill pushed a commit to writer-jill/druid that referenced this pull request Nov 20, 2023
…d json_query (apache#15320)

* support dynamic expressions for path arguments for json_value and json_query
yashdeep97 pushed a commit to yashdeep97/druid that referenced this pull request Dec 1, 2023
…d json_query (apache#15320)

* support dynamic expressions for path arguments for json_value and json_query
@LakshSingla LakshSingla added this to the 29.0.0 milestone Jan 29, 2024
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Projects
None yet
Development

Successfully merging this pull request may close these issues.

3 participants