Skip to content

inject @Json ObjectMapper for to_json_string and parse_json expressions#12900

Merged
gianm merged 4 commits intoapache:masterfrom
clintropolis:json-expr-better-objectmapper
Aug 15, 2022
Merged

inject @Json ObjectMapper for to_json_string and parse_json expressions#12900
gianm merged 4 commits intoapache:masterfrom
clintropolis:json-expr-better-objectmapper

Conversation

@clintropolis
Copy link
Member

Description

This PR switches TO_JSON_STRING and PARSE_JSON functions to use the @Json annotated ObjectMapper to better tie into the standard JSON serde we use for result formats, as mentioned as an alternative to solving the problem in #12893 (we should do both).

This allows a much wider variety of complex types to be translated into strings using TO_JSON_STRING, many of these likely just being turned into base64 string values, but now they at least work instead of failing with an error such as

Unable to stringify [org.apache.druid.query.aggregation.datasketches.theta.SketchHolder@a92fef64] to JSON

This PR has:

  • been self-reviewed.
  • 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.

@gianm
Copy link
Contributor

gianm commented Aug 14, 2022

Looks good to me, once the test is fixed. (The CI failure seems legitimate)

@gianm gianm merged commit e42e025 into apache:master Aug 15, 2022
@clintropolis clintropolis deleted the json-expr-better-objectmapper branch August 15, 2022 19:26
@abhishekagarwal87 abhishekagarwal87 added this to the 24.0.0 milestone Aug 26, 2022
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.

4 participants