Repository navigation
Render JSON children through the configured expression deparser - #2767
Merged
manticore-projects merged 2 commits intoOct 11, 2026
Merged
manticore-projects merged 2 commits into
manticore-projects merged 2 commits into
Conversation
Share callback-based rendering for JSON functions and JSON_TABLE so custom deparsers can rewrite structured inputs, paths, defaults, passing values, and plan expressions. Preserve opaque and incomplete-builder output, and document the rendering hooks for subclasses. Signed-off-by: minleejae <mmj9808@gmail.com>
Signed-off-by: minleejae <mmj9808@gmail.com>
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.
Purpose
Allow a custom
ExpressionDeParserto rewrite structured expressions inside scalar JSON functions and JSON_TABLE. For example, rewriting a referenced column should also work inside a generated column's JSON_VALUE input and inside JSON_TABLE paths, PASSING values and DEFAULT expressions.Current design (As-is)
The JSON deparser visits append the node's string representation, while the JSON renderers append child expressions directly. This bypasses the caller's expression visitor and makes JSON output behave differently from expressions rendered through that visitor.
Target design (To-be)
appendTo(StringBuilder, Consumer<Expression>), with consumer overloads for scalar JSON function variants. Default string output and visitor output use the same clause ordering and formatting.appendTo; legacy type-specific one-argumentappend*overrides and concrete JSON_TABLE columntoString()overrides no longer control the shared rendering path.This covers
JsonFunctionandJsonTableFunction; JSON aggregate and XML table renderers are unchanged. No SQL grammar changes or AST mutation are required for a custom deparser rewrite.Validation
spotlessApply check: 9,967 tests, 9,942 passed, 25 skipped, zero failures/errors. Grammar, formatting, Checkstyle, PMD, SpotBugs and coverage checks pass.master(cdbaf1ad). No fresh live database execution was performed for this rendering refactor.1e02ab36before the internal helper extraction: all five patches apply without conflicts; full Java 17 Gradlecheckpasses with 10,030 tests (10,005 passed, 25 skipped). Replaying 882 previously DB-validated fixtures preserves the AST and both SQL outputs for 875 supported cases, with the same seven existing parse gaps and no semantic regression. No fresh database execution.c2b441d6passes with zero issues; the grammar check and Gradle/Maven checks on Ubuntu, Windows and macOS also pass (all eight checks successful).