Repository navigation
Fix JSON_QUERY/JSON_VALUE/JSON_EXISTS returning Dynamic instead of String/UInt8 on Dynamic arguments - #106877
Merged
Conversation
… of their declared types when input is Dynamic Override `getReturnTypeForDefaultImplementationForDynamic` in `FunctionSQLJSON` so that the `FunctionBaseDynamicAdaptor` uses the correct fixed return type (`String` for `JSON_QUERY`/`JSON_VALUE`, `UInt8` for `JSON_EXISTS`) instead of falling back to Dynamic. Closes: #106461 Co-Authored-By: Claude Opus 4.6 <[email protected]>
JSON_QUERY/JSON_VALUE/JSON_EXISTS returning Dynamic instead of String on Dynamic argumentsJSON_QUERY/JSON_VALUE/JSON_EXISTS returning Dynamic instead of String/UInt8 on Dynamic arguments
Contributor
|
Workflow [PR], commit [2e3e096] Summary: ❌
AI ReviewSummaryThis PR fixes the Final Verdict
|
…:ClickHouse/ClickHouse into fix-json-query-dynamic-return-type
`FunctionSQLJSON` return type depends on argument types (multi-path Tuple/Array paths produce nested return types). The no-argument `getReturnTypeForDefaultImplementationForDynamic` could not account for this, returning wrong types when Dynamic input was combined with multi-path arguments. Add a new virtual overload that accepts `const DataTypes &` and defaults to delegating to the existing no-argument version, so all 128+ existing overrides are unaffected. `FunctionBaseDynamicAdaptor` now calls the argument-aware version. Related: #106461 Related: #106877 Co-Authored-By: Claude Opus 4.6 <[email protected]>
serxa
approved these changes
Jun 26, 2026
…:ClickHouse/ClickHouse into fix-json-query-dynamic-return-type
Contributor
LLVM Coverage Report
Changed lines: Changed C/C++ lines covered: 31/33 (93.94%) · Uncovered code |
groeneai
added a commit
to groeneai/ClickHouse
that referenced
this pull request
Jul 10, 2026
…path arg STID 4811-66fc (AST fuzzer). ClickHouse#106877 declared concrete result types over Dynamic input via getReturnTypeForDefaultImplementationForDynamic, but the Dynamic path received the raw path-argument type while the normal path only sees the type after the framework has stripped wrappers. The framework normalizes the second argument before executeImpl/buildPlan exactly one way: LowCardinality is removed recursively (defaultImplementationForLowCardinalityColumns), while Nullable is removed only at the top level (createBlockWithNestedColumns keeps any Nullable nested inside a Tuple/Array). Mirror that in the return-type helpers via normalizePathArgument, and recurse with the same bare-String/Tuple/Array acceptance the runtime plan uses, so the declared return type always agrees with what the plan accepts and produces. Nested wrapped path nodes (e.g. a scalar subquery producing Nullable(Tuple(...)) nested inside an outer tuple) are rejected as non-path types, identically on the normal and Dynamic paths. Related: ClickHouse#106877, ClickHouse#106461. Co-Authored-By: Claude Opus 4.8 <[email protected]>
This was referenced Jul 13, 2026
This was referenced Jul 16, 2026
This was referenced Jul 20, 2026
zeekay
pushed a commit
to hanzoai/datastore
that referenced
this pull request
Sep 11, 2026
…path arg STID 4811-66fc (AST fuzzer). ClickHouse#106877 declared concrete result types over Dynamic input via getReturnTypeForDefaultImplementationForDynamic, but the Dynamic path received the raw path-argument type while the normal path only sees the type after the framework has stripped wrappers. The framework normalizes the second argument before executeImpl/buildPlan exactly one way: LowCardinality is removed recursively (defaultImplementationForLowCardinalityColumns), while Nullable is removed only at the top level (createBlockWithNestedColumns keeps any Nullable nested inside a Tuple/Array). Mirror that in the return-type helpers via normalizePathArgument, and recurse with the same bare-String/Tuple/Array acceptance the runtime plan uses, so the declared return type always agrees with what the plan accepts and produces. Nested wrapped path nodes (e.g. a scalar subquery producing Nullable(Tuple(...)) nested inside an outer tuple) are rejected as non-path types, identically on the normal and Dynamic paths. Related: ClickHouse#106877, ClickHouse#106461. Co-Authored-By: Claude Opus 4.8 <[email protected]>
zeekay
pushed a commit
to hanzoai/datastore
that referenced
this pull request
Sep 11, 2026
`FunctionSQLJSON` return type depends on argument types (multi-path Tuple/Array paths produce nested return types). The no-argument `getReturnTypeForDefaultImplementationForDynamic` could not account for this, returning wrong types when Dynamic input was combined with multi-path arguments. Add a new virtual overload that accepts `const DataTypes &` and defaults to delegating to the existing no-argument version, so all 128+ existing overrides are unaffected. `FunctionBaseDynamicAdaptor` now calls the argument-aware version. Related: ClickHouse#106461 Related: ClickHouse#106877 Co-Authored-By: Claude Opus 4.6 <[email protected]>
zeekay
pushed a commit
to hanzoai/datastore
that referenced
this pull request
Sep 11, 2026
…ynamic-return-type Fix `JSON_QUERY`/`JSON_VALUE`/`JSON_EXISTS` returning Dynamic instead of String/UInt8 on Dynamic arguments
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment
Add this suggestion to a batch that can be applied as a single commit.This suggestion is invalid because no changes were made to the code.Suggestions cannot be applied while the pull request is closed.Suggestions cannot be applied while viewing a subset of changes.Only one suggestion per line can be applied in a batch.Add this suggestion to a batch that can be applied as a single commit.Applying suggestions on deleted lines is not supported.You must change the existing code in this line in order to create a valid suggestion.Outdated suggestions cannot be applied.This suggestion has been applied or marked resolved.Suggestions cannot be applied from pending reviews.Suggestions cannot be applied on multi-line comments.Suggestions cannot be applied while the pull request is queued to merge.Suggestion cannot be applied right now. Please check back later.
Changelog category (leave one):
Changelog entry (a user-readable short description of the changes that goes into CHANGELOG.md):
Fix
JSON_QUERY/JSON_VALUE/JSON_EXISTSreturning Dynamic instead of String/UInt8 on Dynamic arguments. Closes: #106461.Version info
26.7.1.714(included in26.7and later)