Skip to content

Fix translation of special cast+json_parse functions#22844

Merged
martint merged 1 commit intotrinodb:masterfrom
martint:json-parse-coercion
Jul 27, 2024
Merged

Fix translation of special cast+json_parse functions#22844
martint merged 1 commit intotrinodb:masterfrom
martint:json-parse-coercion

Conversation

@martint
Copy link
Copy Markdown
Member

@martint martint commented Jul 26, 2024

These functions need to be resolved via getCoercion().

Fixes #22840

Release notes

(x) Release notes are required, with the following suggested text:

# General
* Fix failure for queries involving {func}`json_parse` and a cast to `array`, `map`, or `row`. ({issue}`22840`)

@cla-bot cla-bot bot added the cla-signed label Jul 26, 2024
These functions need to be resolved via getCoercion()
@martint martint force-pushed the json-parse-coercion branch from c433747 to 90ca612 Compare July 26, 2024 21:44
@martint martint merged commit e52de13 into trinodb:master Jul 27, 2024
@martint martint deleted the json-parse-coercion branch July 27, 2024 02:50
@github-actions github-actions bot added this to the 454 milestone Jul 27, 2024
JSON_STRING_TO_ARRAY_NAME.equals(call.getFunctionName().getName()) ||
JSON_STRING_TO_ROW_NAME.equals(call.getFunctionName().getName())) {
// These are special functions that currently need to be resolved via getCoercion() -- TODO: fix this
resolved = plannerContext.getMetadata().getCoercion(builtinFunctionName(call.getFunctionName().getName()), call.getArguments().get(0).getType(), call.getType());
Copy link
Copy Markdown
Member

Choose a reason for hiding this comment

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

Isn't getCoercion API is a bit tricky - The internal logic which we do to resolving the function - but the API looks like we are applying coercion from one type to another

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Development

Successfully merging this pull request may close these issues.

Metadata can't resolve $internal$json_string_to_array_cast built in function

4 participants