Skip to content

feat: json_merge expression and sql function#17081

Merged
abhishekagarwal87 merged 1 commit intoapache:masterfrom
lkm:json_merge
Sep 17, 2024
Merged

feat: json_merge expression and sql function#17081
abhishekagarwal87 merged 1 commit intoapache:masterfrom
lkm:json_merge

Conversation

@lkm
Copy link
Copy Markdown
Contributor

@lkm lkm commented Sep 16, 2024

Description

This add a new json_merge expression which takes two or more arguments to merge into a single json structure. It also added the corresponding SQL function. This is useful for transforming data in druid, for instance I use it for flattening arrays of objects using fold, e.g. fold((a, acc) -> json_merge(acc, json_object(json_value(a, '$.key'), json_value(a, '$.value'))), arrayofkv, json_object())

Fixed the bug ...

Renamed the class ...

Added a forbidden-apis entry ...

Release note


Key changed/added classes in this PR
  • json_merge expression function
  • json_merge sql function

This PR has:

  • been self-reviewed.
  • added documentation for new or modified features or behaviors.
  • a release note entry in the PR description.
  • added Javadocs for most classes and all non-trivial methods. Linked related entities via Javadoc links.
  • added or updated version, license, or notice information in licenses.yaml
  • 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.
  • added integration tests.
  • been tested in a test Druid cluster.

@abhishekagarwal87
Copy link
Copy Markdown
Contributor

@lkm - There are compilation failures. You may have to rebase your PR too.

@lkm
Copy link
Copy Markdown
Contributor Author

lkm commented Sep 17, 2024

@lkm - There are compilation failures. You may have to rebase your PR too.

It seems things have shifted in master since I did this originally. Will resolve those problems soon

@lkm
Copy link
Copy Markdown
Contributor Author

lkm commented Sep 17, 2024

@abhishekagarwal87 I think we're good to go now.

@abhishekagarwal87 abhishekagarwal87 merged commit 307b8e3 into apache:master Sep 17, 2024
@abhishekagarwal87
Copy link
Copy Markdown
Contributor

Thank you for your contribution @lkm

@lkm
Copy link
Copy Markdown
Contributor Author

lkm commented Sep 17, 2024

Thank you for your contribution @lkm

Thanks for merging!

pranavbhole pushed a commit to pranavbhole/druid that referenced this pull request Sep 17, 2024
@adarshsanjeev adarshsanjeev added this to the 32.0.0 milestone Jan 16, 2025
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