Repository navigation
Fix inconsistent AST formatting for array/tuple with tuple element access - #96894
Merged
Merged
Conversation
…nt access PR #96799 added parenthesization around the left operand in `tupleElement` formatting when `size() > 1`, to fix `(tab.*).N` formatting. However, this check was too broad: it also wrapped `ASTFunction("array")` and `ASTFunction("tuple")` in extra parens (e.g., `([['你们']]).3`). When re-parsed, the parser's fast literal path converts `[['你们']]` to `ASTLiteral(Array(...))` which has `size() == 1`, so no parens are added on the second format pass. The formatted strings differ, triggering the debug AST consistency check exception. The fix excludes `array` and `tuple` functions from the extra parenthesization since their bracket syntax (`[...]` and `(...)`) is already unambiguous with `.N` access. The necessary parens for `(tab.*).N` and `((t1.1).1).1` are preserved. https://s3.amazonaws.com/clickhouse-test-reports/json.html?PR=96871&sha=8c08d137d9d40503cff353ed51ec4c8cf55e9d38&name_0=PR&name_1=BuzzHouse%20%28amd_debug%29 Co-Authored-By: Claude Opus 4.6 <[email protected]>
Contributor
|
Workflow [PR], commit [20e3ac9] Summary: ❌
|
Member
Author
|
Ok, I like it. |
This was referenced Apr 8, 2026
1 task
1 task
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.
Summary
Function_arrayandLiteral_Array" in debug buildssize() > 1parenthesization intupleElementformatting to fix(tab.*).N, but it also wrappedarrayandtuplefunctions in unnecessary extra parens (e.g.,([['你们']]).3)[['你们']]toASTLiteral(size=1, no parens), producing[['你们']].3— the formatted strings differ, triggering the debug AST consistency checkarrayandtuplefunctions from extra parenthesization since[...]and(...)syntax is already unambiguous with.Naccesstuple(...)got wrapped in extra parensCI report: https://s3.amazonaws.com/clickhouse-test-reports/json.html?PR=96871&sha=8c08d137d9d40503cff353ed51ec4c8cf55e9d38&name_0=PR&name_1=BuzzHouse%20%28amd_debug%29
#96871
Changelog category (leave one):
Changelog entry (a user-readable short description of the changes that goes into CHANGELOG.md):
Fix inconsistent AST formatting for
array/tuplefunctions with.Ntuple element access that caused exceptions in debug builds.Test plan
clickhouse-formatproduces consistent output for[['hello']].1,tuple(1,2,3).1,(tab.*).2,((t1.1).1).101852_cast_operator_4,02560_tuple_format,03780_AST_formatting_inconsistencies_in_debug_check,03786_AST_formatting_inconsistencies_in_debug_check.Naccess in03786🤖 Generated with Claude Code
Version info
26.2.1.679