From 2d9c0e71582e5ee6ac37afe317f064bca0021ccc Mon Sep 17 00:00:00 2001 From: Claude Date: Tue, 1 Dec 2026 05:07:30 +0000 Subject: [PATCH 1/3] Parse EXECUTE AS user [statement] Co-Authored-By: Claude Opus 5.5 Claude-Session: https://claude.ai/code/session_01LuRZ4KB7DMX365Nmn5ksnY --- ast/ast.go | 11 ++++++ internal/explain/explain.go | 11 ++++++ parser/parser.go | 20 +++++++++++ .../metadata.json | 6 +--- .../metadata.json | 8 +---- .../metadata.json | 34 +------------------ .../05444_ai_functions_no_user/metadata.json | 6 ---- 7 files changed, 45 insertions(+), 51 deletions(-) diff --git a/ast/ast.go b/ast/ast.go index 96abb236a1..f931e152d5 100644 --- a/ast/ast.go +++ b/ast/ast.go @@ -1810,3 +1810,14 @@ type ParallelWithQuery struct { func (p *ParallelWithQuery) Pos() token.Position { return p.Position } func (p *ParallelWithQuery) End() token.Position { return p.Position } func (p *ParallelWithQuery) statementNode() {} + +// ExecuteAsQuery represents EXECUTE AS user [statement]. +type ExecuteAsQuery struct { + Position token.Position `json:"-"` + User Expression `json:"user"` + Statement Statement `json:"statement,omitempty"` +} + +func (e *ExecuteAsQuery) Pos() token.Position { return e.Position } +func (e *ExecuteAsQuery) End() token.Position { return e.Position } +func (e *ExecuteAsQuery) statementNode() {} diff --git a/internal/explain/explain.go b/internal/explain/explain.go index 9458324bfd..0b12f76fa9 100644 --- a/internal/explain/explain.go +++ b/internal/explain/explain.go @@ -214,6 +214,17 @@ func Node(sb *strings.Builder, node interface{}, depth int) { fmt.Fprintf(sb, "%sASTTransactionControl\n", indent) case *ast.ExplainQuery: explainExplainQuery(sb, n, indent, depth) + case *ast.ExecuteAsQuery: + children := 1 + if n.Statement != nil { + children++ + } + fmt.Fprintf(sb, "%sExecuteAsQuery (children %d)\n", indent, children) + fmt.Fprintf(sb, "%s UserNameWithHost (children 1)\n", indent) + Node(sb, n.User, depth+2) + if n.Statement != nil { + Node(sb, n.Statement, depth+1) + } case *ast.ShowQuery: explainShowQuery(sb, n, indent) case *ast.ShowPrivilegesQuery: diff --git a/parser/parser.go b/parser/parser.go index b578e0bd75..d87aa879ba 100644 --- a/parser/parser.go +++ b/parser/parser.go @@ -351,6 +351,9 @@ func (p *Parser) parseStatement() ast.Statement { case token.KILL: return p.parseKill() default: + if p.currentIs(token.IDENT) && strings.EqualFold(p.current.Value, "EXECUTE") && p.peekIs(token.AS) { + return p.parseExecuteAs() + } p.errors = append(p.errors, fmt.Errorf("unexpected token %s at line %d, column %d", p.current.Token, p.current.Pos.Line, p.current.Pos.Column)) p.nextToken() @@ -8696,3 +8699,20 @@ func identifierNames(exprs []ast.Expression) ([]string, bool) { } return names, true } + +// parseExecuteAs parses EXECUTE AS user [statement]. +func (p *Parser) parseExecuteAs() *ast.ExecuteAsQuery { + q := &ast.ExecuteAsQuery{Position: p.current.Pos} + p.nextToken() // skip EXECUTE + p.nextToken() // skip AS + if p.currentIs(token.STRING) { + q.User = &ast.Literal{Position: p.current.Pos, Type: ast.LiteralString, Value: p.current.Value} + p.nextToken() + } else { + q.User = &ast.Identifier{Position: p.current.Pos, Parts: []string{p.parseIdentifierName()}} + } + if !p.currentIs(token.EOF) && !p.currentIs(token.SEMICOLON) { + q.Statement = p.parseStatement() + } + return q +} diff --git a/parser/testdata/03727_alter_with_localhost_remote/metadata.json b/parser/testdata/03727_alter_with_localhost_remote/metadata.json index f4c74e32be..0967ef424b 100644 --- a/parser/testdata/03727_alter_with_localhost_remote/metadata.json +++ b/parser/testdata/03727_alter_with_localhost_remote/metadata.json @@ -1,5 +1 @@ -{ - "explain_todo": { - "stmt10": true - } -} +{} diff --git a/parser/testdata/04042_system_wait_blobs_cleanup_access/metadata.json b/parser/testdata/04042_system_wait_blobs_cleanup_access/metadata.json index ad61064d66..0967ef424b 100644 --- a/parser/testdata/04042_system_wait_blobs_cleanup_access/metadata.json +++ b/parser/testdata/04042_system_wait_blobs_cleanup_access/metadata.json @@ -1,7 +1 @@ -{ - "explain_todo": { - "stmt3": true, - "stmt5": true, - "stmt6": true - } -} +{} diff --git a/parser/testdata/05442_ai_functions_privileges_stored_expressions/metadata.json b/parser/testdata/05442_ai_functions_privileges_stored_expressions/metadata.json index 116ab96ed3..0967ef424b 100644 --- a/parser/testdata/05442_ai_functions_privileges_stored_expressions/metadata.json +++ b/parser/testdata/05442_ai_functions_privileges_stored_expressions/metadata.json @@ -1,33 +1 @@ -{ - "explain_todo": { - "stmt10": true, - "stmt11": true, - "stmt12": true, - "stmt13": true, - "stmt14": true, - "stmt15": true, - "stmt17": true, - "stmt19": true, - "stmt22": true, - "stmt23": true, - "stmt24": true, - "stmt25": true, - "stmt26": true, - "stmt27": true, - "stmt28": true, - "stmt29": true, - "stmt30": true, - "stmt31": true, - "stmt32": true, - "stmt33": true, - "stmt34": true, - "stmt35": true, - "stmt36": true, - "stmt37": true, - "stmt5": true, - "stmt6": true, - "stmt7": true, - "stmt8": true, - "stmt9": true - } -} +{} diff --git a/parser/testdata/05444_ai_functions_no_user/metadata.json b/parser/testdata/05444_ai_functions_no_user/metadata.json index 6e2d96f5bb..1390321eeb 100644 --- a/parser/testdata/05444_ai_functions_no_user/metadata.json +++ b/parser/testdata/05444_ai_functions_no_user/metadata.json @@ -1,11 +1,5 @@ { "explain_todo": { - "stmt17": true, - "stmt18": true, - "stmt19": true, - "stmt20": true, - "stmt21": true, - "stmt22": true, "stmt29": true, "stmt48": true } From ef86ba6b54f068375bc944ffd1dbaf567c308b22 Mon Sep 17 00:00:00 2001 From: Claude Date: Tue, 1 Dec 2026 05:09:06 +0000 Subject: [PATCH 2/3] Parse MASKING POLICY statements and SHOW access entity queries Supports CREATE/ALTER/DROP MASKING POLICY, SHOW CREATE MASKING POLICY, and SHOW USERS/ROLES/QUOTAS/[ROW|MASKING] POLICIES/SETTINGS PROFILES and their CURRENT/ENABLED variants. Co-Authored-By: Claude Opus 5.5 Claude-Session: https://claude.ai/code/session_01LuRZ4KB7DMX365Nmn5ksnY --- ast/ast.go | 14 +++ internal/explain/explain.go | 28 +++++- parser/parser.go | 90 +++++++++++++++++-- .../metadata.json | 6 +- .../metadata.json | 12 +-- .../metadata.json | 10 +-- 6 files changed, 127 insertions(+), 33 deletions(-) diff --git a/ast/ast.go b/ast/ast.go index f931e152d5..c971460aa6 100644 --- a/ast/ast.go +++ b/ast/ast.go @@ -1197,6 +1197,7 @@ func (s *ShowCreateSettingsProfileQuery) statementNode() {} type CreateRowPolicyQuery struct { Position token.Position `json:"-"` IsAlter bool `json:"is_alter,omitempty"` + Masking bool `json:"masking,omitempty"` // MASKING POLICY } func (c *CreateRowPolicyQuery) Pos() token.Position { return c.Position } @@ -1207,6 +1208,7 @@ func (c *CreateRowPolicyQuery) statementNode() {} type DropRowPolicyQuery struct { Position token.Position `json:"-"` IfExists bool `json:"if_exists,omitempty"` + Masking bool `json:"masking,omitempty"` // MASKING POLICY } func (d *DropRowPolicyQuery) Pos() token.Position { return d.Position } @@ -1217,6 +1219,7 @@ func (d *DropRowPolicyQuery) statementNode() {} type ShowCreateRowPolicyQuery struct { Position token.Position `json:"-"` Format string `json:"format,omitempty"` + Masking bool `json:"masking,omitempty"` // MASKING POLICY } func (s *ShowCreateRowPolicyQuery) Pos() token.Position { return s.Position } @@ -1821,3 +1824,14 @@ type ExecuteAsQuery struct { func (e *ExecuteAsQuery) Pos() token.Position { return e.Position } func (e *ExecuteAsQuery) End() token.Position { return e.Position } func (e *ExecuteAsQuery) statementNode() {} + +// ShowAccessEntitiesQuery represents SHOW USERS, SHOW ROLES, SHOW [ROW] POLICIES, etc. +type ShowAccessEntitiesQuery struct { + Position token.Position `json:"-"` + Keyword string `json:"keyword"` // e.g. "USERS", "ROW POLICIES" + Format string `json:"format,omitempty"` +} + +func (s *ShowAccessEntitiesQuery) Pos() token.Position { return s.Position } +func (s *ShowAccessEntitiesQuery) End() token.Position { return s.Position } +func (s *ShowAccessEntitiesQuery) statementNode() {} diff --git a/internal/explain/explain.go b/internal/explain/explain.go index 0b12f76fa9..23f5a94c8e 100644 --- a/internal/explain/explain.go +++ b/internal/explain/explain.go @@ -264,10 +264,34 @@ func Node(sb *strings.Builder, node interface{}, depth int) { fmt.Fprintf(sb, "%s%s\n", indent, queryName) } case *ast.CreateRowPolicyQuery: - fmt.Fprintf(sb, "%sCREATE ROW POLICY or ALTER ROW POLICY query\n", indent) + if n.Masking { + fmt.Fprintf(sb, "%sCREATE MASKING POLICY or ALTER MASKING POLICY query\n", indent) + } else { + fmt.Fprintf(sb, "%sCREATE ROW POLICY or ALTER ROW POLICY query\n", indent) + } case *ast.DropRowPolicyQuery: - fmt.Fprintf(sb, "%sDROP ROW POLICY query\n", indent) + if n.Masking { + fmt.Fprintf(sb, "%sDROP MASKING POLICY query\n", indent) + } else { + fmt.Fprintf(sb, "%sDROP ROW POLICY query\n", indent) + } + case *ast.ShowAccessEntitiesQuery: + if n.Format != "" { + fmt.Fprintf(sb, "%sSHOW %s query (children 1)\n", indent, n.Keyword) + fmt.Fprintf(sb, "%s Identifier %s\n", indent, n.Format) + } else { + fmt.Fprintf(sb, "%sSHOW %s query\n", indent, n.Keyword) + } case *ast.ShowCreateRowPolicyQuery: + if n.Masking { + if n.Format != "" { + fmt.Fprintf(sb, "%sSHOW CREATE MASKING POLICIES query (children 1)\n", indent) + fmt.Fprintf(sb, "%s Identifier %s\n", indent, n.Format) + } else { + fmt.Fprintf(sb, "%sSHOW CREATE MASKING POLICIES query\n", indent) + } + break + } // ClickHouse uses "ROW POLICIES" (plural) when FORMAT is present if n.Format != "" { fmt.Fprintf(sb, "%sSHOW CREATE ROW POLICIES query (children 1)\n", indent) diff --git a/parser/parser.go b/parser/parser.go index d87aa879ba..9afe1b6257 100644 --- a/parser/parser.go +++ b/parser/parser.go @@ -245,7 +245,7 @@ func (p *Parser) parseStatement() ast.Statement { return p.parseDropSettingsProfile() } // Check for DROP ROW POLICY or DROP POLICY - if p.peek.Token == token.IDENT && (strings.ToUpper(p.peek.Value) == "ROW" || strings.ToUpper(p.peek.Value) == "POLICY") { + if p.peek.Token == token.IDENT && (strings.ToUpper(p.peek.Value) == "ROW" || strings.ToUpper(p.peek.Value) == "POLICY" || strings.ToUpper(p.peek.Value) == "MASKING") { return p.parseDropRowPolicy() } // Check for DROP ROLE @@ -279,7 +279,7 @@ func (p *Parser) parseStatement() ast.Statement { return p.parseAlterSettingsProfile() } // Check for ALTER ROW POLICY or ALTER POLICY - if p.peek.Token == token.IDENT && (strings.ToUpper(p.peek.Value) == "ROW" || strings.ToUpper(p.peek.Value) == "POLICY") { + if p.peek.Token == token.IDENT && (strings.ToUpper(p.peek.Value) == "ROW" || strings.ToUpper(p.peek.Value) == "POLICY" || strings.ToUpper(p.peek.Value) == "MASKING") { return p.parseAlterRowPolicy() } // Check for ALTER ROLE @@ -2301,8 +2301,8 @@ func (p *Parser) parseCreate() ast.Statement { case "ROW": // CREATE ROW POLICY return p.parseCreateRowPolicy(pos) - case "POLICY": - // CREATE POLICY (without ROW keyword) + case "POLICY", "MASKING": + // CREATE POLICY (without ROW keyword), CREATE MASKING POLICY return p.parseCreateRowPolicy(pos) case "ROLE": // CREATE ROLE @@ -3517,6 +3517,10 @@ func (p *Parser) parseCreateRowPolicy(pos token.Position) *ast.CreateRowPolicyQu if p.currentIs(token.IDENT) && strings.ToUpper(p.current.Value) == "ROW" { p.nextToken() } + if p.currentIs(token.IDENT) && strings.ToUpper(p.current.Value) == "MASKING" { + query.Masking = true + p.nextToken() + } // Skip POLICY if p.currentIs(token.IDENT) && strings.ToUpper(p.current.Value) == "POLICY" { @@ -3542,6 +3546,10 @@ func (p *Parser) parseDropRowPolicy() *ast.DropRowPolicyQuery { if p.currentIs(token.IDENT) && strings.ToUpper(p.current.Value) == "ROW" { p.nextToken() } + if p.currentIs(token.IDENT) && strings.ToUpper(p.current.Value) == "MASKING" { + query.Masking = true + p.nextToken() + } // Skip POLICY if p.currentIs(token.IDENT) && strings.ToUpper(p.current.Value) == "POLICY" { @@ -3577,6 +3585,10 @@ func (p *Parser) parseAlterRowPolicy() *ast.CreateRowPolicyQuery { if p.currentIs(token.IDENT) && strings.ToUpper(p.current.Value) == "ROW" { p.nextToken() } + if p.currentIs(token.IDENT) && strings.ToUpper(p.current.Value) == "MASKING" { + query.Masking = true + p.nextToken() + } // Skip POLICY if p.currentIs(token.IDENT) && strings.ToUpper(p.current.Value) == "POLICY" { @@ -3600,6 +3612,10 @@ func (p *Parser) parseShowCreateRowPolicy(pos token.Position) *ast.ShowCreateRow if p.currentIs(token.IDENT) && strings.ToUpper(p.current.Value) == "ROW" { p.nextToken() } + if p.currentIs(token.IDENT) && strings.ToUpper(p.current.Value) == "MASKING" { + query.Masking = true + p.nextToken() + } // Skip POLICY if p.currentIs(token.IDENT) && strings.ToUpper(p.current.Value) == "POLICY" { @@ -6594,6 +6610,22 @@ func (p *Parser) parseShow() ast.Statement { return query } + if kw := p.showAccessEntitiesKeyword(); kw != "" { + query := &ast.ShowAccessEntitiesQuery{Position: pos, Keyword: kw} + // Skip ON table filters until FORMAT or end of statement + for !p.currentIs(token.EOF) && !p.currentIs(token.SEMICOLON) && !p.currentIs(token.FORMAT) { + p.nextToken() + } + if p.currentIs(token.FORMAT) { + p.nextToken() + if p.currentIs(token.IDENT) || p.current.Token.IsKeyword() { + query.Format = p.current.Value + p.nextToken() + } + } + return query + } + show := &ast.ShowQuery{ Position: pos, } @@ -6651,8 +6683,8 @@ func (p *Parser) parseShow() ast.Statement { } else if p.currentIs(token.SETTINGS) || (p.currentIs(token.IDENT) && strings.ToUpper(p.current.Value) == "PROFILE") { // SHOW CREATE SETTINGS PROFILE or SHOW CREATE PROFILE return p.parseShowCreateSettingsProfile(pos) - } else if p.currentIs(token.IDENT) && (strings.ToUpper(p.current.Value) == "ROW" || strings.ToUpper(p.current.Value) == "POLICY") { - // SHOW CREATE ROW POLICY or SHOW CREATE POLICY + } else if p.currentIs(token.IDENT) && (strings.ToUpper(p.current.Value) == "ROW" || strings.ToUpper(p.current.Value) == "POLICY" || strings.ToUpper(p.current.Value) == "MASKING") { + // SHOW CREATE ROW POLICY, SHOW CREATE POLICY or SHOW CREATE MASKING POLICY return p.parseShowCreateRowPolicy(pos) } else if p.currentIs(token.IDENT) && strings.ToUpper(p.current.Value) == "ROLE" { // SHOW CREATE ROLE @@ -8716,3 +8748,49 @@ func (p *Parser) parseExecuteAs() *ast.ExecuteAsQuery { } return q } + +// showAccessEntitiesKeyword consumes the entity type of SHOW USERS, SHOW ROLES, +// SHOW [ROW] POLICIES and similar queries and returns ClickHouse's keyword for +// it, or returns "" without consuming anything. +func (p *Parser) showAccessEntitiesKeyword() string { + if !p.currentIs(token.IDENT) && !p.currentIs(token.SETTINGS) { + return "" + } + upper := strings.ToUpper(p.current.Value) + next := "" + if p.peekIs(token.IDENT) { + next = strings.ToUpper(p.peek.Value) + } + two := func(kw string) string { + p.nextToken() + p.nextToken() + return kw + } + switch { + case upper == "USERS" || upper == "ROLES" || upper == "QUOTAS": + p.nextToken() + return upper + case upper == "POLICIES": + p.nextToken() + return "ROW POLICIES" + case upper == "PROFILES": + p.nextToken() + return "SETTINGS PROFILES" + case upper == "QUOTA": + p.nextToken() + return "CURRENT QUOTA" + case upper == "ROW" && next == "POLICIES": + return two("ROW POLICIES") + case upper == "MASKING" && next == "POLICIES": + return two("MASKING POLICIES") + case upper == "SETTINGS" && next == "PROFILES": + return two("SETTINGS PROFILES") + case upper == "CURRENT" && next == "ROLES": + return two("CURRENT ROLES") + case upper == "CURRENT" && next == "QUOTA": + return two("CURRENT QUOTA") + case upper == "ENABLED" && next == "ROLES": + return two("ENABLED ROLES") + } + return "" +} diff --git a/parser/testdata/03923_masking_policy_on_cluster_format/metadata.json b/parser/testdata/03923_masking_policy_on_cluster_format/metadata.json index e9d6e46171..0967ef424b 100644 --- a/parser/testdata/03923_masking_policy_on_cluster_format/metadata.json +++ b/parser/testdata/03923_masking_policy_on_cluster_format/metadata.json @@ -1,5 +1 @@ -{ - "explain_todo": { - "stmt1": true - } -} +{} diff --git a/parser/testdata/04330_show_policies_format_clause/metadata.json b/parser/testdata/04330_show_policies_format_clause/metadata.json index 0413c05ffb..14d1e29271 100644 --- a/parser/testdata/04330_show_policies_format_clause/metadata.json +++ b/parser/testdata/04330_show_policies_format_clause/metadata.json @@ -1,6 +1,5 @@ { "explain_todo": { - "stmt1": true, "stmt10": true, "stmt11": true, "stmt12": true, @@ -9,16 +8,7 @@ "stmt15": true, "stmt16": true, "stmt18": true, - "stmt19": true, - "stmt2": true, - "stmt20": true, - "stmt21": true, - "stmt27": true, - "stmt3": true, "stmt4": true, - "stmt5": true, - "stmt6": true, - "stmt7": true, - "stmt9": true + "stmt5": true } } diff --git a/parser/testdata/04489_masking_policies_introspection/metadata.json b/parser/testdata/04489_masking_policies_introspection/metadata.json index 8ffbed3efd..0967ef424b 100644 --- a/parser/testdata/04489_masking_policies_introspection/metadata.json +++ b/parser/testdata/04489_masking_policies_introspection/metadata.json @@ -1,9 +1 @@ -{ - "explain_todo": { - "stmt1": true, - "stmt4": true, - "stmt5": true, - "stmt6": true, - "stmt7": true - } -} +{} From 2c26f140d0fbe3dd3c085920d8f840b439d9555a Mon Sep 17 00:00:00 2001 From: Claude Date: Tue, 1 Dec 2026 05:12:41 +0000 Subject: [PATCH 3/3] Parse UNIQUE KEY and move inline PRIMARY KEY to storage - CREATE TABLE ... UNIQUE KEY expr, printed between ORDER BY and SAMPLE BY. - A primary key declared in the column list is printed as the storage PRIMARY KEY, as ClickHouse 26 does. Co-Authored-By: Claude Opus 5.5 Claude-Session: https://claude.ai/code/session_01LuRZ4KB7DMX365Nmn5ksnY --- ast/ast.go | 1 + internal/explain/statements.go | 112 +++++++++++++----- parser/parser.go | 16 +++ .../metadata.json | 6 +- .../metadata.json | 7 +- .../metadata.json | 6 +- .../metadata.json | 7 +- .../metadata.json | 6 +- .../02184_default_table_engine/metadata.json | 4 +- .../metadata.json | 6 +- .../metadata.json | 9 +- .../metadata.json | 6 +- .../02494_query_cache_key/metadata.json | 4 +- .../02517_union_columns_order/metadata.json | 6 +- .../02568_and_consistency/metadata.json | 6 +- .../metadata.json | 6 +- .../metadata.json | 6 +- .../metadata.json | 6 +- .../testdata/02581_width_bucket/metadata.json | 6 +- .../metadata.json | 17 +-- .../metadata.json | 6 +- .../metadata.json | 6 +- .../metadata.json | 8 +- .../02982_create_mv_inner_extra/metadata.json | 7 +- .../metadata.json | 7 +- .../metadata.json | 6 +- .../03156_nullable_number_tips/metadata.json | 7 +- .../metadata.json | 6 +- .../metadata.json | 4 +- .../metadata.json | 6 +- .../metadata.json | 6 +- .../03516_int_exp2_join/metadata.json | 8 +- .../metadata.json | 7 +- .../metadata.json | 7 +- .../04046_unique_key_ddl/metadata.json | 27 +---- .../metadata.json | 7 +- .../metadata.json | 6 +- .../metadata.json | 3 +- .../metadata.json | 5 +- .../metadata.json | 6 +- .../metadata.json | 7 +- .../metadata.json | 6 +- .../metadata.json | 1 - .../metadata.json | 3 +- .../metadata.json | 6 +- .../metadata.json | 6 +- 46 files changed, 142 insertions(+), 275 deletions(-) diff --git a/ast/ast.go b/ast/ast.go index c971460aa6..0aed1641ee 100644 --- a/ast/ast.go +++ b/ast/ast.go @@ -299,6 +299,7 @@ type CreateQuery struct { OrderByHasModifiers bool `json:"order_by_has_modifiers,omitempty"` // True if ORDER BY has ASC/DESC modifiers PartitionBy Expression `json:"partition_by,omitempty"` PrimaryKey []Expression `json:"primary_key,omitempty"` + UniqueKey []Expression `json:"unique_key,omitempty"` // UNIQUE KEY SampleBy Expression `json:"sample_by,omitempty"` TTL *TTLClause `json:"ttl,omitempty"` Settings []*SettingExpr `json:"settings,omitempty"` diff --git a/internal/explain/statements.go b/internal/explain/statements.go index db2c5e8d1c..bf473e690d 100644 --- a/internal/explain/statements.go +++ b/internal/explain/statements.go @@ -197,6 +197,7 @@ func explainCreateQuery(sb *strings.Builder, n *ast.CreateQuery, indent string, return } + n = moveInlinePrimaryKeyToStorage(n) name := n.Table if n.View != "" { name = n.View @@ -227,7 +228,7 @@ func explainCreateQuery(sb *strings.Builder, n *ast.CreateQuery, indent string, settingsInStorage := len(n.Settings) > 0 && (n.Comment == "" || n.SettingsBeforeComment) // For WINDOW VIEW with INNER ENGINE, ORDER BY goes inside ViewTargets, not in regular Storage definition orderByInRegularStorage := len(n.OrderBy) > 0 && !(n.WindowView && n.InnerEngine != nil) - hasStorageChild := n.Engine != nil || orderByInRegularStorage || len(n.PrimaryKey) > 0 || n.PartitionBy != nil || n.SampleBy != nil || n.TTL != nil || settingsInStorage || len(n.ColumnsPrimaryKey) > 0 || hasColumnPrimaryKey + hasStorageChild := n.Engine != nil || orderByInRegularStorage || len(n.PrimaryKey) > 0 || len(n.UniqueKey) > 0 || n.PartitionBy != nil || n.SampleBy != nil || n.TTL != nil || settingsInStorage || len(n.ColumnsPrimaryKey) > 0 || hasColumnPrimaryKey if hasStorageChild { children++ } @@ -388,7 +389,7 @@ func explainCreateQuery(sb *strings.Builder, n *ast.CreateQuery, indent string, } // For WINDOW VIEW with INNER ENGINE, ORDER BY goes inside ViewTargets hasOrderByInStorage := len(n.OrderBy) > 0 && !(n.WindowView && n.InnerEngine != nil) - hasStorage := n.Engine != nil || hasOrderByInStorage || len(n.PrimaryKey) > 0 || n.PartitionBy != nil || n.SampleBy != nil || n.TTL != nil || settingsInStorage || len(n.ColumnsPrimaryKey) > 0 || hasColumnPrimaryKey + hasStorage := n.Engine != nil || hasOrderByInStorage || len(n.PrimaryKey) > 0 || len(n.UniqueKey) > 0 || n.PartitionBy != nil || n.SampleBy != nil || n.TTL != nil || settingsInStorage || len(n.ColumnsPrimaryKey) > 0 || hasColumnPrimaryKey if hasStorage { storageChildren := 0 if n.Engine != nil { @@ -403,6 +404,9 @@ func explainCreateQuery(sb *strings.Builder, n *ast.CreateQuery, indent string, if len(n.PrimaryKey) > 0 { storageChildren++ } + if len(n.UniqueKey) > 0 { + storageChildren++ + } // SAMPLE BY is always shown in EXPLAIN AST when present if n.SampleBy != nil { storageChildren++ @@ -453,33 +457,7 @@ func explainCreateQuery(sb *strings.Builder, n *ast.CreateQuery, indent string, } } // PRIMARY KEY comes before ORDER BY in EXPLAIN output - if len(n.PrimaryKey) > 0 { - if len(n.PrimaryKey) == 1 { - if ident, ok := n.PrimaryKey[0].(*ast.Identifier); ok { - fmt.Fprintf(sb, "%s Identifier %s\n", storageIndent, ident.Name()) - } else if lit, ok := n.PrimaryKey[0].(*ast.Literal); ok && lit.Type == ast.LiteralTuple { - // Handle tuple literal (including empty tuple from PRIMARY KEY ()) - exprs, _ := lit.Value.([]ast.Expression) - fmt.Fprintf(sb, "%s Function tuple (children %d)\n", storageIndent, 1) - if len(exprs) > 0 { - fmt.Fprintf(sb, "%s ExpressionList (children %d)\n", storageIndent, len(exprs)) - for _, e := range exprs { - Node(sb, e, storageChildDepth+2) - } - } else { - fmt.Fprintf(sb, "%s ExpressionList\n", storageIndent) - } - } else { - Node(sb, n.PrimaryKey[0], storageChildDepth) - } - } else { - fmt.Fprintf(sb, "%s Function tuple (children %d)\n", storageIndent, 1) - fmt.Fprintf(sb, "%s ExpressionList (children %d)\n", storageIndent, len(n.PrimaryKey)) - for _, p := range n.PrimaryKey { - Node(sb, p, storageChildDepth+2) - } - } - } + explainStorageKey(sb, n.PrimaryKey, storageIndent, storageChildDepth) // ORDER BY comes after PRIMARY KEY in EXPLAIN output if len(n.OrderBy) > 0 { if len(n.OrderBy) == 1 { @@ -521,6 +499,8 @@ func explainCreateQuery(sb *strings.Builder, n *ast.CreateQuery, indent string, } } } + // UNIQUE KEY comes between ORDER BY and SAMPLE BY + explainStorageKey(sb, n.UniqueKey, storageIndent, storageChildDepth) // SAMPLE BY is always shown in EXPLAIN AST when present if n.SampleBy != nil { Node(sb, n.SampleBy, storageChildDepth) @@ -2718,3 +2698,77 @@ func explainAlterPartition(sb *strings.Builder, cmd *ast.AlterCommand, indent st fmt.Fprintf(sb, "%s Partition (children 1)\n", indent) Node(sb, cmd.Partition, depth+2) } + +// explainStorageKey prints a PRIMARY KEY or UNIQUE KEY storage expression. +func explainStorageKey(sb *strings.Builder, keys []ast.Expression, storageIndent string, storageChildDepth int) { + if len(keys) > 0 { + if len(keys) == 1 { + if ident, ok := keys[0].(*ast.Identifier); ok { + fmt.Fprintf(sb, "%s Identifier %s\n", storageIndent, ident.Name()) + } else if lit, ok := keys[0].(*ast.Literal); ok && lit.Type == ast.LiteralTuple { + // Handle tuple literal (including empty tuple from PRIMARY KEY ()) + exprs, _ := lit.Value.([]ast.Expression) + fmt.Fprintf(sb, "%s Function tuple (children %d)\n", storageIndent, 1) + if len(exprs) > 0 { + fmt.Fprintf(sb, "%s ExpressionList (children %d)\n", storageIndent, len(exprs)) + for _, e := range exprs { + Node(sb, e, storageChildDepth+2) + } + } else { + fmt.Fprintf(sb, "%s ExpressionList\n", storageIndent) + } + } else { + Node(sb, keys[0], storageChildDepth) + } + } else { + fmt.Fprintf(sb, "%s Function tuple (children %d)\n", storageIndent, 1) + fmt.Fprintf(sb, "%s ExpressionList (children %d)\n", storageIndent, len(keys)) + for _, k := range keys { + Node(sb, k, storageChildDepth+2) + } + } + } +} + +// moveInlinePrimaryKeyToStorage returns n with a PRIMARY KEY declared in the +// column list ("a T PRIMARY KEY" or "PRIMARY KEY (a, b)") moved to the storage +// PRIMARY KEY, as ClickHouse 26 does. +func moveInlinePrimaryKeyToStorage(n *ast.CreateQuery) *ast.CreateQuery { + if len(n.PrimaryKey) > 0 { + return n + } + var pk []ast.Expression + var cols []string + for _, col := range n.Columns { + if col.PrimaryKey { + cols = append(cols, col.Name) + } + } + switch { + case len(cols) > 0: + exprs := make([]ast.Expression, len(cols)) + for i, c := range cols { + exprs[i] = &ast.Identifier{Parts: []string{c}} + } + pk = []ast.Expression{&ast.Literal{Type: ast.LiteralTuple, Value: exprs}} + case n.HasEmptyColumnsPrimaryKey: + pk = []ast.Expression{&ast.Literal{Type: ast.LiteralTuple, Value: []ast.Expression{}}} + case len(n.ColumnsPrimaryKey) == 1: + pk = n.ColumnsPrimaryKey + case len(n.ColumnsPrimaryKey) > 1: + pk = []ast.Expression{&ast.Literal{Type: ast.LiteralTuple, Value: n.ColumnsPrimaryKey}} + default: + return n + } + c := *n + c.PrimaryKey = pk + c.ColumnsPrimaryKey = nil + c.HasEmptyColumnsPrimaryKey = false + c.Columns = make([]*ast.ColumnDeclaration, len(n.Columns)) + for i, col := range n.Columns { + cc := *col + cc.PrimaryKey = false + c.Columns[i] = &cc + } + return &c +} diff --git a/parser/parser.go b/parser/parser.go index 9afe1b6257..991eeb234b 100644 --- a/parser/parser.go +++ b/parser/parser.go @@ -2738,6 +2738,22 @@ func (p *Parser) parseTableOptions(create *ast.CreateQuery) { create.PrimaryKey = []ast.Expression{p.parseExpression(ALIAS_PREC)} } } + case p.currentIs(token.IDENT) && strings.EqualFold(p.current.Value, "UNIQUE") && p.peekIs(token.KEY): + p.nextToken() // skip UNIQUE + p.nextToken() // skip KEY + if p.currentIs(token.LPAREN) { + pos := p.current.Pos + p.nextToken() + exprs := p.parseExpressionList() + p.expect(token.RPAREN) + if len(exprs) == 1 { + create.UniqueKey = exprs + } else { + create.UniqueKey = []ast.Expression{&ast.Literal{Position: pos, Type: ast.LiteralTuple, Value: exprs}} + } + } else { + create.UniqueKey = []ast.Expression{p.parseExpression(ALIAS_PREC)} + } case p.currentIs(token.SAMPLE): p.nextToken() if p.expect(token.BY) { diff --git a/parser/testdata/01148_zookeeper_path_macros_unfolding/metadata.json b/parser/testdata/01148_zookeeper_path_macros_unfolding/metadata.json index 983800a6c0..0967ef424b 100644 --- a/parser/testdata/01148_zookeeper_path_macros_unfolding/metadata.json +++ b/parser/testdata/01148_zookeeper_path_macros_unfolding/metadata.json @@ -1,5 +1 @@ -{ - "explain_todo": { - "stmt23": true - } -} +{} diff --git a/parser/testdata/01166_truncate_multiple_partitions/metadata.json b/parser/testdata/01166_truncate_multiple_partitions/metadata.json index 29d5769dc5..0967ef424b 100644 --- a/parser/testdata/01166_truncate_multiple_partitions/metadata.json +++ b/parser/testdata/01166_truncate_multiple_partitions/metadata.json @@ -1,6 +1 @@ -{ - "explain_todo": { - "stmt17": true, - "stmt3": true - } -} +{} diff --git a/parser/testdata/01516_create_table_primary_key/metadata.json b/parser/testdata/01516_create_table_primary_key/metadata.json index f30ee7a239..33d67d4ea4 100644 --- a/parser/testdata/01516_create_table_primary_key/metadata.json +++ b/parser/testdata/01516_create_table_primary_key/metadata.json @@ -1,10 +1,6 @@ { "explain_todo": { "stmt10": true, - "stmt19": true, - "stmt22": true, - "stmt31": true, - "stmt32": true, - "stmt7": true + "stmt22": true } } diff --git a/parser/testdata/01532_primary_key_without_order_by_zookeeper/metadata.json b/parser/testdata/01532_primary_key_without_order_by_zookeeper/metadata.json index 18b076dbe5..0967ef424b 100644 --- a/parser/testdata/01532_primary_key_without_order_by_zookeeper/metadata.json +++ b/parser/testdata/01532_primary_key_without_order_by_zookeeper/metadata.json @@ -1,6 +1 @@ -{ - "explain_todo": { - "stmt13": true, - "stmt29": true - } -} +{} diff --git a/parser/testdata/01710_projection_aggregate_functions_null_for_empty/metadata.json b/parser/testdata/01710_projection_aggregate_functions_null_for_empty/metadata.json index ef58f80315..0967ef424b 100644 --- a/parser/testdata/01710_projection_aggregate_functions_null_for_empty/metadata.json +++ b/parser/testdata/01710_projection_aggregate_functions_null_for_empty/metadata.json @@ -1,5 +1 @@ -{ - "explain_todo": { - "stmt2": true - } -} +{} diff --git a/parser/testdata/02184_default_table_engine/metadata.json b/parser/testdata/02184_default_table_engine/metadata.json index aed66a47e3..ec15f27e12 100644 --- a/parser/testdata/02184_default_table_engine/metadata.json +++ b/parser/testdata/02184_default_table_engine/metadata.json @@ -1,7 +1,5 @@ { "explain_todo": { - "stmt106": true, - "stmt61": true, - "stmt73": true + "stmt106": true } } diff --git a/parser/testdata/02354_vector_search_multiple_indexes/metadata.json b/parser/testdata/02354_vector_search_multiple_indexes/metadata.json index ef58f80315..0967ef424b 100644 --- a/parser/testdata/02354_vector_search_multiple_indexes/metadata.json +++ b/parser/testdata/02354_vector_search_multiple_indexes/metadata.json @@ -1,5 +1 @@ -{ - "explain_todo": { - "stmt2": true - } -} +{} diff --git a/parser/testdata/02354_vector_search_unquoted_index_parameters/metadata.json b/parser/testdata/02354_vector_search_unquoted_index_parameters/metadata.json index 510c07c4b4..0967ef424b 100644 --- a/parser/testdata/02354_vector_search_unquoted_index_parameters/metadata.json +++ b/parser/testdata/02354_vector_search_unquoted_index_parameters/metadata.json @@ -1,8 +1 @@ -{ - "explain_todo": { - "stmt3": true, - "stmt4": true, - "stmt7": true, - "stmt8": true - } -} +{} diff --git a/parser/testdata/02400_create_table_on_cluster_normalization/metadata.json b/parser/testdata/02400_create_table_on_cluster_normalization/metadata.json index ef58f80315..0967ef424b 100644 --- a/parser/testdata/02400_create_table_on_cluster_normalization/metadata.json +++ b/parser/testdata/02400_create_table_on_cluster_normalization/metadata.json @@ -1,5 +1 @@ -{ - "explain_todo": { - "stmt2": true - } -} +{} diff --git a/parser/testdata/02494_query_cache_key/metadata.json b/parser/testdata/02494_query_cache_key/metadata.json index 594baf0429..8c6a18d871 100644 --- a/parser/testdata/02494_query_cache_key/metadata.json +++ b/parser/testdata/02494_query_cache_key/metadata.json @@ -1,7 +1,5 @@ { "explain_todo": { - "stmt19": true, - "stmt7": true, - "stmt8": true + "stmt19": true } } diff --git a/parser/testdata/02517_union_columns_order/metadata.json b/parser/testdata/02517_union_columns_order/metadata.json index e9d6e46171..0967ef424b 100644 --- a/parser/testdata/02517_union_columns_order/metadata.json +++ b/parser/testdata/02517_union_columns_order/metadata.json @@ -1,5 +1 @@ -{ - "explain_todo": { - "stmt1": true - } -} +{} diff --git a/parser/testdata/02568_and_consistency/metadata.json b/parser/testdata/02568_and_consistency/metadata.json index ef58f80315..0967ef424b 100644 --- a/parser/testdata/02568_and_consistency/metadata.json +++ b/parser/testdata/02568_and_consistency/metadata.json @@ -1,5 +1 @@ -{ - "explain_todo": { - "stmt2": true - } -} +{} diff --git a/parser/testdata/02581_share_big_sets_between_multiple_mutations_tasks_long/metadata.json b/parser/testdata/02581_share_big_sets_between_multiple_mutations_tasks_long/metadata.json index ef58f80315..0967ef424b 100644 --- a/parser/testdata/02581_share_big_sets_between_multiple_mutations_tasks_long/metadata.json +++ b/parser/testdata/02581_share_big_sets_between_multiple_mutations_tasks_long/metadata.json @@ -1,5 +1 @@ -{ - "explain_todo": { - "stmt2": true - } -} +{} diff --git a/parser/testdata/02581_share_big_sets_between_mutation_tasks_long/metadata.json b/parser/testdata/02581_share_big_sets_between_mutation_tasks_long/metadata.json index ef58f80315..0967ef424b 100644 --- a/parser/testdata/02581_share_big_sets_between_mutation_tasks_long/metadata.json +++ b/parser/testdata/02581_share_big_sets_between_mutation_tasks_long/metadata.json @@ -1,5 +1 @@ -{ - "explain_todo": { - "stmt2": true - } -} +{} diff --git a/parser/testdata/02581_share_big_sets_between_mutation_tasks_with_storage_set/metadata.json b/parser/testdata/02581_share_big_sets_between_mutation_tasks_with_storage_set/metadata.json index ef58f80315..0967ef424b 100644 --- a/parser/testdata/02581_share_big_sets_between_mutation_tasks_with_storage_set/metadata.json +++ b/parser/testdata/02581_share_big_sets_between_mutation_tasks_with_storage_set/metadata.json @@ -1,5 +1 @@ -{ - "explain_todo": { - "stmt2": true - } -} +{} diff --git a/parser/testdata/02581_width_bucket/metadata.json b/parser/testdata/02581_width_bucket/metadata.json index e9d6e46171..0967ef424b 100644 --- a/parser/testdata/02581_width_bucket/metadata.json +++ b/parser/testdata/02581_width_bucket/metadata.json @@ -1,5 +1 @@ -{ - "explain_todo": { - "stmt1": true - } -} +{} diff --git a/parser/testdata/02811_primary_key_in_columns/metadata.json b/parser/testdata/02811_primary_key_in_columns/metadata.json index df2ef0a9cc..0967ef424b 100644 --- a/parser/testdata/02811_primary_key_in_columns/metadata.json +++ b/parser/testdata/02811_primary_key_in_columns/metadata.json @@ -1,16 +1 @@ -{ - "explain_todo": { - "stmt26": true, - "stmt27": true, - "stmt28": true, - "stmt29": true, - "stmt30": true, - "stmt31": true, - "stmt44": true, - "stmt45": true, - "stmt46": true, - "stmt47": true, - "stmt48": true, - "stmt49": true - } -} +{} diff --git a/parser/testdata/02815_fix_not_found_constants_col_in_block/metadata.json b/parser/testdata/02815_fix_not_found_constants_col_in_block/metadata.json index ef58f80315..0967ef424b 100644 --- a/parser/testdata/02815_fix_not_found_constants_col_in_block/metadata.json +++ b/parser/testdata/02815_fix_not_found_constants_col_in_block/metadata.json @@ -1,5 +1 @@ -{ - "explain_todo": { - "stmt2": true - } -} +{} diff --git a/parser/testdata/02830_insert_values_time_interval/metadata.json b/parser/testdata/02830_insert_values_time_interval/metadata.json index ef58f80315..0967ef424b 100644 --- a/parser/testdata/02830_insert_values_time_interval/metadata.json +++ b/parser/testdata/02830_insert_values_time_interval/metadata.json @@ -1,5 +1 @@ -{ - "explain_todo": { - "stmt2": true - } -} +{} diff --git a/parser/testdata/02911_cte_invalid_query_analysis/metadata.json b/parser/testdata/02911_cte_invalid_query_analysis/metadata.json index 19830977ac..0967ef424b 100644 --- a/parser/testdata/02911_cte_invalid_query_analysis/metadata.json +++ b/parser/testdata/02911_cte_invalid_query_analysis/metadata.json @@ -1,7 +1 @@ -{ - "explain_todo": { - "stmt4": true, - "stmt5": true, - "stmt6": true - } -} +{} diff --git a/parser/testdata/02982_create_mv_inner_extra/metadata.json b/parser/testdata/02982_create_mv_inner_extra/metadata.json index ec09c7e10e..0967ef424b 100644 --- a/parser/testdata/02982_create_mv_inner_extra/metadata.json +++ b/parser/testdata/02982_create_mv_inner_extra/metadata.json @@ -1,6 +1 @@ -{ - "explain_todo": { - "stmt11": true, - "stmt12": true - } -} +{} diff --git a/parser/testdata/03101_analyzer_invalid_join_on/metadata.json b/parser/testdata/03101_analyzer_invalid_join_on/metadata.json index ef382ce51e..0967ef424b 100644 --- a/parser/testdata/03101_analyzer_invalid_join_on/metadata.json +++ b/parser/testdata/03101_analyzer_invalid_join_on/metadata.json @@ -1,6 +1 @@ -{ - "explain_todo": { - "stmt4": true, - "stmt5": true - } -} +{} diff --git a/parser/testdata/03147_datetime64_constant_index_analysis/metadata.json b/parser/testdata/03147_datetime64_constant_index_analysis/metadata.json index ef58f80315..0967ef424b 100644 --- a/parser/testdata/03147_datetime64_constant_index_analysis/metadata.json +++ b/parser/testdata/03147_datetime64_constant_index_analysis/metadata.json @@ -1,5 +1 @@ -{ - "explain_todo": { - "stmt2": true - } -} +{} diff --git a/parser/testdata/03156_nullable_number_tips/metadata.json b/parser/testdata/03156_nullable_number_tips/metadata.json index b0fb544e9a..0967ef424b 100644 --- a/parser/testdata/03156_nullable_number_tips/metadata.json +++ b/parser/testdata/03156_nullable_number_tips/metadata.json @@ -1,6 +1 @@ -{ - "explain_todo": { - "stmt14": true, - "stmt7": true - } -} +{} diff --git a/parser/testdata/03205_parallel_window_finctions_and_column_sparse_bug/metadata.json b/parser/testdata/03205_parallel_window_finctions_and_column_sparse_bug/metadata.json index c45b7602ba..0967ef424b 100644 --- a/parser/testdata/03205_parallel_window_finctions_and_column_sparse_bug/metadata.json +++ b/parser/testdata/03205_parallel_window_finctions_and_column_sparse_bug/metadata.json @@ -1,5 +1 @@ -{ - "explain_todo": { - "stmt12": true - } -} +{} diff --git a/parser/testdata/03313_unique_key_mutation_guard/metadata.json b/parser/testdata/03313_unique_key_mutation_guard/metadata.json index 51aed11aa1..dc0702ac62 100644 --- a/parser/testdata/03313_unique_key_mutation_guard/metadata.json +++ b/parser/testdata/03313_unique_key_mutation_guard/metadata.json @@ -1,7 +1,5 @@ { "explain_todo": { - "stmt30": true, - "stmt4": true, - "stmt45": true + "stmt30": true } } diff --git a/parser/testdata/03371_bfloat16_special_values/metadata.json b/parser/testdata/03371_bfloat16_special_values/metadata.json index 4090191c62..0967ef424b 100644 --- a/parser/testdata/03371_bfloat16_special_values/metadata.json +++ b/parser/testdata/03371_bfloat16_special_values/metadata.json @@ -1,5 +1 @@ -{ - "explain_todo": { - "stmt35": true - } -} +{} diff --git a/parser/testdata/03449_window_cannot_find_column/metadata.json b/parser/testdata/03449_window_cannot_find_column/metadata.json index 1295a45747..0967ef424b 100644 --- a/parser/testdata/03449_window_cannot_find_column/metadata.json +++ b/parser/testdata/03449_window_cannot_find_column/metadata.json @@ -1,5 +1 @@ -{ - "explain_todo": { - "stmt3": true - } -} +{} diff --git a/parser/testdata/03516_int_exp2_join/metadata.json b/parser/testdata/03516_int_exp2_join/metadata.json index c55f31987e..0967ef424b 100644 --- a/parser/testdata/03516_int_exp2_join/metadata.json +++ b/parser/testdata/03516_int_exp2_join/metadata.json @@ -1,7 +1 @@ -{ - "explain_todo": { - "stmt3": true, - "stmt4": true, - "stmt6": true - } -} +{} diff --git a/parser/testdata/03781_tuple_inside_nullable_sparse_serialization/metadata.json b/parser/testdata/03781_tuple_inside_nullable_sparse_serialization/metadata.json index 3fa0d8dbb1..0967ef424b 100644 --- a/parser/testdata/03781_tuple_inside_nullable_sparse_serialization/metadata.json +++ b/parser/testdata/03781_tuple_inside_nullable_sparse_serialization/metadata.json @@ -1,6 +1 @@ -{ - "explain_todo": { - "stmt18": true, - "stmt22": true - } -} +{} diff --git a/parser/testdata/03823_table_disk_cache_key_collision/metadata.json b/parser/testdata/03823_table_disk_cache_key_collision/metadata.json index 7b4ddafa53..0967ef424b 100644 --- a/parser/testdata/03823_table_disk_cache_key_collision/metadata.json +++ b/parser/testdata/03823_table_disk_cache_key_collision/metadata.json @@ -1,6 +1 @@ -{ - "explain_todo": { - "stmt3": true, - "stmt4": true - } -} +{} diff --git a/parser/testdata/04046_unique_key_ddl/metadata.json b/parser/testdata/04046_unique_key_ddl/metadata.json index c454356ea8..e0070643fa 100644 --- a/parser/testdata/04046_unique_key_ddl/metadata.json +++ b/parser/testdata/04046_unique_key_ddl/metadata.json @@ -1,31 +1,6 @@ { "explain_todo": { - "stmt14": true, - "stmt16": true, - "stmt18": true, - "stmt19": true, - "stmt20": true, - "stmt21": true, - "stmt22": true, - "stmt23": true, - "stmt24": true, - "stmt25": true, "stmt26": true, - "stmt27": true, - "stmt28": true, - "stmt32": true, - "stmt34": true, - "stmt51": true, - "stmt53": true, - "stmt59": true, - "stmt61": true, - "stmt70": true, - "stmt73": true, - "stmt78": true, - "stmt86": true, - "stmt87": true, - "stmt88": true, - "stmt89": true, - "stmt9": true + "stmt34": true } } diff --git a/parser/testdata/04053_in_subquery_prewhere_not_ready_set/metadata.json b/parser/testdata/04053_in_subquery_prewhere_not_ready_set/metadata.json index ef382ce51e..0967ef424b 100644 --- a/parser/testdata/04053_in_subquery_prewhere_not_ready_set/metadata.json +++ b/parser/testdata/04053_in_subquery_prewhere_not_ready_set/metadata.json @@ -1,6 +1 @@ -{ - "explain_todo": { - "stmt4": true, - "stmt5": true - } -} +{} diff --git a/parser/testdata/04070_global_in_subquery_prewhere/metadata.json b/parser/testdata/04070_global_in_subquery_prewhere/metadata.json index b65b07d7a6..0967ef424b 100644 --- a/parser/testdata/04070_global_in_subquery_prewhere/metadata.json +++ b/parser/testdata/04070_global_in_subquery_prewhere/metadata.json @@ -1,5 +1 @@ -{ - "explain_todo": { - "stmt4": true - } -} +{} diff --git a/parser/testdata/04158_unique_key_optimize_rejected/metadata.json b/parser/testdata/04158_unique_key_optimize_rejected/metadata.json index 114ee38611..c45b7602ba 100644 --- a/parser/testdata/04158_unique_key_optimize_rejected/metadata.json +++ b/parser/testdata/04158_unique_key_optimize_rejected/metadata.json @@ -1,6 +1,5 @@ { "explain_todo": { - "stmt12": true, - "stmt7": true + "stmt12": true } } diff --git a/parser/testdata/04159_unique_key_ttl_rejected/metadata.json b/parser/testdata/04159_unique_key_ttl_rejected/metadata.json index 5d92f5f250..62b81668c3 100644 --- a/parser/testdata/04159_unique_key_ttl_rejected/metadata.json +++ b/parser/testdata/04159_unique_key_ttl_rejected/metadata.json @@ -1,8 +1,5 @@ { "explain_todo": { - "stmt13": true, - "stmt3": true, - "stmt4": true, - "stmt5": true + "stmt13": true } } diff --git a/parser/testdata/04160_unique_key_backup_check_rejected/metadata.json b/parser/testdata/04160_unique_key_backup_check_rejected/metadata.json index b65b07d7a6..0967ef424b 100644 --- a/parser/testdata/04160_unique_key_backup_check_rejected/metadata.json +++ b/parser/testdata/04160_unique_key_backup_check_rejected/metadata.json @@ -1,5 +1 @@ -{ - "explain_todo": { - "stmt4": true - } -} +{} diff --git a/parser/testdata/04161_unique_key_insert_duplicate/metadata.json b/parser/testdata/04161_unique_key_insert_duplicate/metadata.json index 6200de9839..0967ef424b 100644 --- a/parser/testdata/04161_unique_key_insert_duplicate/metadata.json +++ b/parser/testdata/04161_unique_key_insert_duplicate/metadata.json @@ -1,6 +1 @@ -{ - "explain_todo": { - "stmt14": true, - "stmt4": true - } -} +{} diff --git a/parser/testdata/04277_merge_read_in_order_with_prewhere/metadata.json b/parser/testdata/04277_merge_read_in_order_with_prewhere/metadata.json index 1295a45747..0967ef424b 100644 --- a/parser/testdata/04277_merge_read_in_order_with_prewhere/metadata.json +++ b/parser/testdata/04277_merge_read_in_order_with_prewhere/metadata.json @@ -1,5 +1 @@ -{ - "explain_todo": { - "stmt3": true - } -} +{} diff --git a/parser/testdata/04657_streaming_queries_unique_key_reject/metadata.json b/parser/testdata/04657_streaming_queries_unique_key_reject/metadata.json index ef382ce51e..3a06a4a1ac 100644 --- a/parser/testdata/04657_streaming_queries_unique_key_reject/metadata.json +++ b/parser/testdata/04657_streaming_queries_unique_key_reject/metadata.json @@ -1,6 +1,5 @@ { "explain_todo": { - "stmt4": true, "stmt5": true } } diff --git a/parser/testdata/04660_column_comment_after_modifiers/metadata.json b/parser/testdata/04660_column_comment_after_modifiers/metadata.json index 20c54b4e48..38129bc470 100644 --- a/parser/testdata/04660_column_comment_after_modifiers/metadata.json +++ b/parser/testdata/04660_column_comment_after_modifiers/metadata.json @@ -6,7 +6,6 @@ "stmt21": true, "stmt23": true, "stmt27": true, - "stmt3": true, - "stmt36": true + "stmt3": true } } diff --git a/parser/testdata/04670_query_condition_cache_unique_key/metadata.json b/parser/testdata/04670_query_condition_cache_unique_key/metadata.json index dbdbb76d4f..0967ef424b 100644 --- a/parser/testdata/04670_query_condition_cache_unique_key/metadata.json +++ b/parser/testdata/04670_query_condition_cache_unique_key/metadata.json @@ -1,5 +1 @@ -{ - "explain_todo": { - "stmt6": true - } -} +{} diff --git a/parser/testdata/04680_share_sets_between_mutation_tasks_index_analysis/metadata.json b/parser/testdata/04680_share_sets_between_mutation_tasks_index_analysis/metadata.json index ef58f80315..0967ef424b 100644 --- a/parser/testdata/04680_share_sets_between_mutation_tasks_index_analysis/metadata.json +++ b/parser/testdata/04680_share_sets_between_mutation_tasks_index_analysis/metadata.json @@ -1,5 +1 @@ -{ - "explain_todo": { - "stmt2": true - } -} +{}