From af3e90411e36866a4afc6364a01655f2c42293cd Mon Sep 17 00:00:00 2001 From: Claude Date: Tue, 1 Dec 2026 06:33:08 +0000 Subject: [PATCH 1/4] Match ClickHouse :: cast operand rules, EPHEMERAL defaults; serialize explain printing Co-Authored-By: Claude Opus 5.5 Claude-Session: https://claude.ai/code/session_01LuRZ4KB7DMX365Nmn5ksnY --- internal/explain/explain.go | 29 ++++- internal/explain/functions.go | 44 +++++++- parser/parser.go | 4 +- .../01825_json_type_ephemeral/metadata.json | 6 +- .../metadata.json | 6 +- .../testdata/02933_ephemeral_mv/metadata.json | 6 +- .../metadata.json | 6 +- .../03250_ephemeral_comment/metadata.json | 6 +- .../metadata.json | 7 +- .../03636_storage_alias_basic/metadata.json | 6 +- .../metadata.json | 6 +- .../metadata.json | 6 +- .../03802_ephemeral_enum_type/metadata.json | 7 +- .../metadata.json | 6 +- .../metadata.json | 6 +- .../metadata.json | 6 +- .../metadata.json | 9 +- .../04046_unique_key_ddl/metadata.json | 1 - .../metadata.json | 101 +----------------- .../metadata.json | 7 +- .../metadata.json | 7 +- .../metadata.json | 6 +- .../metadata.json | 7 +- .../04651_gini_aggregate/metadata.json | 9 +- .../metadata.json | 3 +- .../metadata.json | 14 +-- .../metadata.json | 10 +- 27 files changed, 96 insertions(+), 235 deletions(-) diff --git a/internal/explain/explain.go b/internal/explain/explain.go index 5c911dd7be..aab22c7e80 100644 --- a/internal/explain/explain.go +++ b/internal/explain/explain.go @@ -4,10 +4,15 @@ package explain import ( "fmt" "strings" + "sync" "github.com/sqlc-dev/doubleclick/ast" ) +// explainMu serializes EXPLAIN printing: the printer keeps its context in +// package-level variables. +var explainMu sync.Mutex + // inSubqueryContext is a package-level flag to track when we're inside a Subquery // This affects how negated literals with aliases are formatted var inSubqueryContext bool @@ -18,6 +23,9 @@ var inCreateQueryContext bool // Explain returns the EXPLAIN AST output for a statement, matching ClickHouse's format. func Explain(stmt ast.Statement) string { + explainMu.Lock() + defer explainMu.Unlock() + constructionDisabled = 0 var sb strings.Builder Node(&sb, stmt, 0) return sb.String() @@ -31,6 +39,9 @@ func ExplainStatements(stmts []ast.Statement) string { return "" } + explainMu.Lock() + defer explainMu.Unlock() + constructionDisabled = 0 var sb strings.Builder Node(&sb, stmts[0], 0) @@ -486,7 +497,13 @@ func Column(sb *strings.Builder, col *ast.ColumnDeclaration, depth int) { Node(sb, col.Default, depth+1) } else if hasEphemeralDefault { // EPHEMERAL columns without explicit default value show defaultValueOfTypeName function - fmt.Fprintf(sb, "%s Function defaultValueOfTypeName\n", indent) + if col.Type != nil { + fmt.Fprintf(sb, "%s Function defaultValueOfTypeName (children 1)\n", indent) + fmt.Fprintf(sb, "%s ExpressionList (children 1)\n", indent) + fmt.Fprintf(sb, "%s Literal \\'%s\\'\n", indent, ephemeralTypeName(col.Type)) + } else { + fmt.Fprintf(sb, "%s Function defaultValueOfTypeName\n", indent) + } } if col.Comment != "" { fmt.Fprintf(sb, "%s Literal \\'%s\\'\n", indent, col.Comment) @@ -583,3 +600,13 @@ func Index(sb *strings.Builder, idx *ast.IndexDefinition, depth int) { } } } + +// ephemeralTypeName formats a column type as the argument of +// defaultValueOfTypeName. +func ephemeralTypeName(t *ast.DataType) string { + typeStr := FormatDataType(t) + if len(t.Parameters) == 0 { + typeStr = escapeStringLiteral(typeStr) + } + return typeStr +} diff --git a/internal/explain/functions.go b/internal/explain/functions.go index 4f705a7c99..edef0afe9d 100644 --- a/internal/explain/functions.go +++ b/internal/explain/functions.go @@ -2,6 +2,7 @@ package explain import ( "fmt" + "math" "strings" "github.com/sqlc-dev/doubleclick/ast" @@ -590,6 +591,9 @@ func explainCastExprWithAlias(sb *strings.Builder, n *ast.CastExpr, alias string if lit.Type == ast.LiteralArray || lit.Type == ast.LiteralTuple { // Determine format based on both content and target type useArrayFormat = shouldUseArrayFormat(lit, n.Type) + if elems, ok := lit.Value.([]ast.Expression); ok && lit.Type == ast.LiteralTuple && len(elems) == 1 { + useArrayFormat = false + } } } } @@ -612,7 +616,7 @@ func explainCastExprWithAlias(sb *strings.Builder, n *ast.CastExpr, alias string if lit.Type == ast.LiteralArray || lit.Type == ast.LiteralTuple { if useArrayFormat { fmt.Fprintf(sb, "%s Literal %s\n", indent, FormatLiteral(lit)) - } else if containsCastExpressions(lit) || !containsOnlyLiterals(lit) { + } else if containsCastExpressions(lit) || !containsOnlyLiterals(lit) || !castOperandIsPlainText(lit) { // Array contains CastExpr or non-literal elements - output as Function array with children Node(sb, n.Expr, depth+2) } else { @@ -2104,3 +2108,41 @@ func explainInListHeader(sb *strings.Builder, indent string, n int) { } fmt.Fprintf(sb, "%sExpressionList (children %d)\n", indent, n) } + +// castOperandIsPlainText mirrors ParserCastOperator: the operand of x::T is +// kept as source text only when it is made of numbers, strings and +// brackets. A one-element tuple "(x,)" (trailing comma), an empty tuple, or +// a word such as nan/inf/NULL/true makes it parse as an ordinary expression. +func castOperandIsPlainText(e ast.Expression) bool { + switch v := e.(type) { + case *ast.Literal: + switch v.Type { + case ast.LiteralInteger, ast.LiteralString: + return true + case ast.LiteralFloat: + f, _ := v.Value.(float64) + return !math.IsNaN(f) && !math.IsInf(f, 0) + case ast.LiteralArray, ast.LiteralTuple: + elems, ok := v.Value.([]ast.Expression) + if !ok { + return false + } + if v.Type == ast.LiteralTuple && len(elems) == 1 { + return false + } + for _, el := range elems { + if !castOperandIsPlainText(el) { + return false + } + } + return true + } + case *ast.UnaryExpr: + if v.Op == "-" { + if lit, ok := v.Operand.(*ast.Literal); ok && (lit.Type == ast.LiteralInteger || lit.Type == ast.LiteralFloat) { + return castOperandIsPlainText(lit) + } + } + } + return false +} diff --git a/parser/parser.go b/parser/parser.go index d60eeb3ace..dfeae417bb 100644 --- a/parser/parser.go +++ b/parser/parser.go @@ -4866,7 +4866,7 @@ func (p *Parser) parseColumnDeclaration() *ast.ColumnDeclaration { // DEFAULT/MATERIALIZED/ALIAS indicate we go straight to default expression // CODEC indicates we go straight to codec specification (no type) // COMMENT indicates we go straight to comment (no type) - isCodec := p.currentIs(token.IDENT) && strings.ToUpper(p.current.Value) == "CODEC" + isCodec := p.currentIs(token.IDENT) && (strings.ToUpper(p.current.Value) == "CODEC" || strings.ToUpper(p.current.Value) == "EPHEMERAL") if p.currentIs(token.DEFAULT) || p.currentIs(token.MATERIALIZED) || p.currentIs(token.ALIAS) || isCodec || p.currentIs(token.COMMENT) { // Type is omitted, skip to parsing below } else { @@ -4925,7 +4925,7 @@ func (p *Parser) parseColumnDeclaration() *ast.ColumnDeclaration { col.DefaultKind = "EPHEMERAL" p.nextToken() // Optional default value - but don't parse column keywords (CODEC, COMMENT, TTL, etc.) as expressions - if !p.currentIs(token.COMMA) && !p.currentIs(token.RPAREN) && !p.currentIs(token.IDENT) && + if !p.currentIs(token.COMMA) && !p.currentIs(token.RPAREN) && !p.currentIs(token.COMMENT) && !p.currentIs(token.TTL) && !p.currentIs(token.PRIMARY) && !p.currentIs(token.SETTINGS) { col.Default = p.parseExpression(LOWEST) diff --git a/parser/testdata/01825_json_type_ephemeral/metadata.json b/parser/testdata/01825_json_type_ephemeral/metadata.json index 1295a45747..0967ef424b 100644 --- a/parser/testdata/01825_json_type_ephemeral/metadata.json +++ b/parser/testdata/01825_json_type_ephemeral/metadata.json @@ -1,5 +1 @@ -{ - "explain_todo": { - "stmt3": true - } -} +{} diff --git a/parser/testdata/01825_new_type_json_ephemeral/metadata.json b/parser/testdata/01825_new_type_json_ephemeral/metadata.json index 1295a45747..0967ef424b 100644 --- a/parser/testdata/01825_new_type_json_ephemeral/metadata.json +++ b/parser/testdata/01825_new_type_json_ephemeral/metadata.json @@ -1,5 +1 @@ -{ - "explain_todo": { - "stmt3": true - } -} +{} diff --git a/parser/testdata/02933_ephemeral_mv/metadata.json b/parser/testdata/02933_ephemeral_mv/metadata.json index ef58f80315..0967ef424b 100644 --- a/parser/testdata/02933_ephemeral_mv/metadata.json +++ b/parser/testdata/02933_ephemeral_mv/metadata.json @@ -1,5 +1 @@ -{ - "explain_todo": { - "stmt2": true - } -} +{} diff --git a/parser/testdata/03199_join_with_materialized_column/metadata.json b/parser/testdata/03199_join_with_materialized_column/metadata.json index 1295a45747..0967ef424b 100644 --- a/parser/testdata/03199_join_with_materialized_column/metadata.json +++ b/parser/testdata/03199_join_with_materialized_column/metadata.json @@ -1,5 +1 @@ -{ - "explain_todo": { - "stmt3": true - } -} +{} diff --git a/parser/testdata/03250_ephemeral_comment/metadata.json b/parser/testdata/03250_ephemeral_comment/metadata.json index ef58f80315..0967ef424b 100644 --- a/parser/testdata/03250_ephemeral_comment/metadata.json +++ b/parser/testdata/03250_ephemeral_comment/metadata.json @@ -1,5 +1 @@ -{ - "explain_todo": { - "stmt2": true - } -} +{} diff --git a/parser/testdata/03541_table_without_insertable_columns/metadata.json b/parser/testdata/03541_table_without_insertable_columns/metadata.json index 04dec16ad7..0967ef424b 100644 --- a/parser/testdata/03541_table_without_insertable_columns/metadata.json +++ b/parser/testdata/03541_table_without_insertable_columns/metadata.json @@ -1,6 +1 @@ -{ - "explain_todo": { - "stmt1": true, - "stmt5": true - } -} +{} diff --git a/parser/testdata/03636_storage_alias_basic/metadata.json b/parser/testdata/03636_storage_alias_basic/metadata.json index 4866d3d721..0967ef424b 100644 --- a/parser/testdata/03636_storage_alias_basic/metadata.json +++ b/parser/testdata/03636_storage_alias_basic/metadata.json @@ -1,5 +1 @@ -{ - "explain_todo": { - "stmt184": true - } -} +{} diff --git a/parser/testdata/03667_insert_columns_description/metadata.json b/parser/testdata/03667_insert_columns_description/metadata.json index dbdbb76d4f..0967ef424b 100644 --- a/parser/testdata/03667_insert_columns_description/metadata.json +++ b/parser/testdata/03667_insert_columns_description/metadata.json @@ -1,5 +1 @@ -{ - "explain_todo": { - "stmt6": true - } -} +{} diff --git a/parser/testdata/03749_implicit_index_ephemeral_alias/metadata.json b/parser/testdata/03749_implicit_index_ephemeral_alias/metadata.json index 1295a45747..0967ef424b 100644 --- a/parser/testdata/03749_implicit_index_ephemeral_alias/metadata.json +++ b/parser/testdata/03749_implicit_index_ephemeral_alias/metadata.json @@ -1,5 +1 @@ -{ - "explain_todo": { - "stmt3": true - } -} +{} diff --git a/parser/testdata/03802_ephemeral_enum_type/metadata.json b/parser/testdata/03802_ephemeral_enum_type/metadata.json index f5dd12602b..0967ef424b 100644 --- a/parser/testdata/03802_ephemeral_enum_type/metadata.json +++ b/parser/testdata/03802_ephemeral_enum_type/metadata.json @@ -1,6 +1 @@ -{ - "explain_todo": { - "stmt2": true, - "stmt5": true - } -} +{} diff --git a/parser/testdata/03829_log_engine_ephemeral_subcolumn/metadata.json b/parser/testdata/03829_log_engine_ephemeral_subcolumn/metadata.json index ef58f80315..0967ef424b 100644 --- a/parser/testdata/03829_log_engine_ephemeral_subcolumn/metadata.json +++ b/parser/testdata/03829_log_engine_ephemeral_subcolumn/metadata.json @@ -1,5 +1 @@ -{ - "explain_todo": { - "stmt2": true - } -} +{} diff --git a/parser/testdata/04032_alter_version_column_nonexistent/metadata.json b/parser/testdata/04032_alter_version_column_nonexistent/metadata.json index b65b07d7a6..0967ef424b 100644 --- a/parser/testdata/04032_alter_version_column_nonexistent/metadata.json +++ b/parser/testdata/04032_alter_version_column_nonexistent/metadata.json @@ -1,5 +1 @@ -{ - "explain_todo": { - "stmt4": true - } -} +{} diff --git a/parser/testdata/04033_ephemeral_column_conflicts_with_virtual/metadata.json b/parser/testdata/04033_ephemeral_column_conflicts_with_virtual/metadata.json index e9d6e46171..0967ef424b 100644 --- a/parser/testdata/04033_ephemeral_column_conflicts_with_virtual/metadata.json +++ b/parser/testdata/04033_ephemeral_column_conflicts_with_virtual/metadata.json @@ -1,5 +1 @@ -{ - "explain_todo": { - "stmt1": true - } -} +{} diff --git a/parser/testdata/04044_mutation_ephemeral_materialized/metadata.json b/parser/testdata/04044_mutation_ephemeral_materialized/metadata.json index 1ad1cf6e65..0967ef424b 100644 --- a/parser/testdata/04044_mutation_ephemeral_materialized/metadata.json +++ b/parser/testdata/04044_mutation_ephemeral_materialized/metadata.json @@ -1,8 +1 @@ -{ - "explain_todo": { - "stmt12": true, - "stmt19": true, - "stmt26": true, - "stmt3": true - } -} +{} diff --git a/parser/testdata/04046_unique_key_ddl/metadata.json b/parser/testdata/04046_unique_key_ddl/metadata.json index e0070643fa..85cc99e9fa 100644 --- a/parser/testdata/04046_unique_key_ddl/metadata.json +++ b/parser/testdata/04046_unique_key_ddl/metadata.json @@ -1,6 +1,5 @@ { "explain_todo": { - "stmt26": true, "stmt34": true } } diff --git a/parser/testdata/04056_tuple_inside_nullable_casting/metadata.json b/parser/testdata/04056_tuple_inside_nullable_casting/metadata.json index 7dc51875d3..5550b23ed3 100644 --- a/parser/testdata/04056_tuple_inside_nullable_casting/metadata.json +++ b/parser/testdata/04056_tuple_inside_nullable_casting/metadata.json @@ -1,105 +1,6 @@ { "explain_todo": { - "stmt102": true, - "stmt105": true, - "stmt106": true, - "stmt107": true, - "stmt108": true, - "stmt109": true, - "stmt11": true, - "stmt110": true, - "stmt111": true, - "stmt112": true, - "stmt114": true, - "stmt119": true, - "stmt120": true, - "stmt121": true, - "stmt122": true, - "stmt123": true, - "stmt124": true, - "stmt125": true, - "stmt127": true, - "stmt129": true, - "stmt130": true, - "stmt134": true, - "stmt137": true, - "stmt138": true, - "stmt139": true, - "stmt14": true, - "stmt140": true, - "stmt141": true, - "stmt142": true, - "stmt144": true, - "stmt149": true, - "stmt15": true, - "stmt150": true, - "stmt151": true, - "stmt152": true, - "stmt153": true, - "stmt155": true, - "stmt175": true, - "stmt176": true, - "stmt177": true, - "stmt178": true, - "stmt179": true, - "stmt182": true, - "stmt183": true, - "stmt184": true, - "stmt185": true, - "stmt186": true, - "stmt187": true, - "stmt19": true, - "stmt190": true, - "stmt191": true, - "stmt192": true, - "stmt22": true, - "stmt23": true, - "stmt24": true, - "stmt25": true, - "stmt26": true, - "stmt27": true, - "stmt28": true, - "stmt29": true, - "stmt31": true, - "stmt38": true, - "stmt4": true, - "stmt41": true, - "stmt42": true, - "stmt44": true, - "stmt45": true, - "stmt46": true, - "stmt47": true, - "stmt5": true, - "stmt50": true, - "stmt51": true, "stmt52": true, - "stmt53": true, - "stmt56": true, - "stmt57": true, - "stmt58": true, - "stmt61": true, - "stmt63": true, - "stmt64": true, - "stmt65": true, - "stmt66": true, - "stmt68": true, - "stmt72": true, - "stmt73": true, - "stmt74": true, - "stmt77": true, - "stmt78": true, - "stmt79": true, - "stmt8": true, - "stmt80": true, - "stmt81": true, - "stmt82": true, - "stmt84": true, - "stmt89": true, - "stmt90": true, - "stmt91": true, - "stmt92": true, - "stmt93": true, - "stmt95": true, - "stmt98": true + "stmt53": true } } diff --git a/parser/testdata/04256_min_max_mapped_arrays_nan_consistent/metadata.json b/parser/testdata/04256_min_max_mapped_arrays_nan_consistent/metadata.json index c8d77584ec..0967ef424b 100644 --- a/parser/testdata/04256_min_max_mapped_arrays_nan_consistent/metadata.json +++ b/parser/testdata/04256_min_max_mapped_arrays_nan_consistent/metadata.json @@ -1,6 +1 @@ -{ - "explain_todo": { - "stmt27": true, - "stmt28": true - } -} +{} diff --git a/parser/testdata/04604_qbit_bfloat16_low_precision_centre_fill/metadata.json b/parser/testdata/04604_qbit_bfloat16_low_precision_centre_fill/metadata.json index 771bce3e63..0967ef424b 100644 --- a/parser/testdata/04604_qbit_bfloat16_low_precision_centre_fill/metadata.json +++ b/parser/testdata/04604_qbit_bfloat16_low_precision_centre_fill/metadata.json @@ -1,6 +1 @@ -{ - "explain_todo": { - "stmt32": true, - "stmt38": true - } -} +{} diff --git a/parser/testdata/04628_ephemeral_column_type_is_not_masked/metadata.json b/parser/testdata/04628_ephemeral_column_type_is_not_masked/metadata.json index ef58f80315..0967ef424b 100644 --- a/parser/testdata/04628_ephemeral_column_type_is_not_masked/metadata.json +++ b/parser/testdata/04628_ephemeral_column_type_is_not_masked/metadata.json @@ -1,5 +1 @@ -{ - "explain_todo": { - "stmt2": true - } -} +{} diff --git a/parser/testdata/04630_default_over_virtual_column/metadata.json b/parser/testdata/04630_default_over_virtual_column/metadata.json index 36d996a78f..0967ef424b 100644 --- a/parser/testdata/04630_default_over_virtual_column/metadata.json +++ b/parser/testdata/04630_default_over_virtual_column/metadata.json @@ -1,6 +1 @@ -{ - "explain_todo": { - "stmt18": true, - "stmt9": true - } -} +{} diff --git a/parser/testdata/04651_gini_aggregate/metadata.json b/parser/testdata/04651_gini_aggregate/metadata.json index 4a3785ad92..0967ef424b 100644 --- a/parser/testdata/04651_gini_aggregate/metadata.json +++ b/parser/testdata/04651_gini_aggregate/metadata.json @@ -1,8 +1 @@ -{ - "explain_todo": { - "stmt15": true, - "stmt16": true, - "stmt17": true, - "stmt18": true - } -} +{} diff --git a/parser/testdata/04660_column_comment_after_modifiers/metadata.json b/parser/testdata/04660_column_comment_after_modifiers/metadata.json index 38129bc470..adaefa741d 100644 --- a/parser/testdata/04660_column_comment_after_modifiers/metadata.json +++ b/parser/testdata/04660_column_comment_after_modifiers/metadata.json @@ -5,7 +5,6 @@ "stmt19": true, "stmt21": true, "stmt23": true, - "stmt27": true, - "stmt3": true + "stmt27": true } } diff --git a/parser/testdata/05029_timeseries_to_grid_duplicate_timestamps/metadata.json b/parser/testdata/05029_timeseries_to_grid_duplicate_timestamps/metadata.json index 6648745558..0967ef424b 100644 --- a/parser/testdata/05029_timeseries_to_grid_duplicate_timestamps/metadata.json +++ b/parser/testdata/05029_timeseries_to_grid_duplicate_timestamps/metadata.json @@ -1,13 +1 @@ -{ - "explain_todo": { - "stmt12": true, - "stmt13": true, - "stmt14": true, - "stmt15": true, - "stmt16": true, - "stmt17": true, - "stmt18": true, - "stmt20": true, - "stmt21": true - } -} +{} diff --git a/parser/testdata/05030_timeseries_group_array_duplicate_timestamps/metadata.json b/parser/testdata/05030_timeseries_group_array_duplicate_timestamps/metadata.json index 011edca6ee..0967ef424b 100644 --- a/parser/testdata/05030_timeseries_group_array_duplicate_timestamps/metadata.json +++ b/parser/testdata/05030_timeseries_group_array_duplicate_timestamps/metadata.json @@ -1,9 +1 @@ -{ - "explain_todo": { - "stmt10": true, - "stmt11": true, - "stmt6": true, - "stmt7": true, - "stmt8": true - } -} +{} From 2271958884c2fdb9d255d51c52cff88751f355bc Mon Sep 17 00:00:00 2001 From: Claude Date: Tue, 1 Dec 2026 06:37:26 +0000 Subject: [PATCH 2/4] Statistics ALL and bare types, CreateSQLFunctionQuery, storage ORDER BY DESC, drop query settings from engine SETTINGS Co-Authored-By: Claude Opus 5.5 Claude-Session: https://claude.ai/code/session_01LuRZ4KB7DMX365Nmn5ksnY --- internal/explain/query_setting_names.go | 779 ++++++++++++++++++ internal/explain/statements.go | 40 +- parser/expression.go | 1 + parser/parser.go | 5 + .../01856_create_function/metadata.json | 8 +- .../metadata.json | 6 +- .../metadata.json | 6 +- .../metadata.json | 6 +- .../metadata.json | 7 +- .../metadata.json | 6 +- .../metadata.json | 7 +- .../metadata.json | 8 +- .../metadata.json | 9 +- .../metadata.json | 8 +- .../metadata.json | 11 +- .../metadata.json | 6 +- .../metadata.json | 6 +- .../metadata.json | 6 +- .../metadata.json | 7 +- .../metadata.json | 9 +- .../02483_substitute_udf_create/metadata.json | 8 +- .../metadata.json | 10 +- .../02494_query_cache_udf_sql/metadata.json | 6 +- .../02864_statistics_bug_69589/metadata.json | 6 +- .../metadata.json | 6 +- .../02864_statistics_ddl/metadata.json | 29 +- .../metadata.json | 6 +- .../02864_statistics_usage/metadata.json | 7 +- .../02960_partition_by_udf/metadata.json | 6 +- .../metadata.json | 6 +- .../metadata.json | 8 +- .../03206_wasm_module_manage/metadata.json | 3 - .../03215_udf_with_union/metadata.json | 6 +- .../03274_aliases_in_udf/metadata.json | 7 +- .../metadata.json | 6 +- .../metadata.json | 7 +- .../metadata.json | 8 +- .../metadata.json | 6 +- .../metadata.json | 6 +- .../03444_explain_asterisk/metadata.json | 6 +- .../testdata/03518_bad_sql_udf/metadata.json | 6 +- .../03625_auto_statistics_alter/metadata.json | 8 +- .../metadata.json | 8 +- .../testdata/03660_udf_subquery/metadata.json | 6 +- .../metadata.json | 6 +- .../metadata.json | 6 +- .../03707_statistics_cache/metadata.json | 15 +- .../03743_fix_estimator_crash/metadata.json | 7 +- .../metadata.json | 6 +- .../metadata.json | 6 +- .../metadata.json | 7 +- .../metadata.json | 6 +- .../metadata.json | 6 +- .../metadata.json | 7 +- .../metadata.json | 8 +- .../metadata.json | 6 +- .../metadata.json | 8 +- .../metadata.json | 6 +- .../metadata.json | 9 +- .../metadata.json | 7 +- .../metadata.json | 11 +- .../metadata.json | 6 +- .../testdata/04304_lazy_crash_2/metadata.json | 6 +- .../metadata.json | 6 +- .../metadata.json | 7 +- .../metadata.json | 8 +- .../metadata.json | 6 +- .../metadata.json | 6 +- .../metadata.json | 6 +- .../metadata.json | 8 +- .../metadata.json | 7 +- .../metadata.json | 6 +- .../metadata.json | 6 +- .../metadata.json | 8 +- .../metadata.json | 6 +- .../metadata.json | 6 +- .../metadata.json | 10 +- .../metadata.json | 6 +- .../metadata.json | 6 +- .../metadata.json | 7 +- .../metadata.json | 4 +- .../metadata.json | 7 +- .../metadata.json | 6 +- .../05444_ai_functions_no_user/metadata.json | 1 - 84 files changed, 899 insertions(+), 495 deletions(-) create mode 100644 internal/explain/query_setting_names.go diff --git a/internal/explain/query_setting_names.go b/internal/explain/query_setting_names.go new file mode 100644 index 0000000000..f898f2b479 --- /dev/null +++ b/internal/explain/query_setting_names.go @@ -0,0 +1,779 @@ +package explain + +import "strings" + +// Generated from ClickHouse 26.8: names in system.settings that are not in +// system.merge_tree_settings. A table engine's SETTINGS clause drops them +// (they apply to the query, not the table). +var querySettingNames = func() map[string]bool { + m := map[string]bool{} + for _, n := range strings.Fields(querySettingNamesText) { + m[n] = true + } + return m +}() + +const querySettingNamesText = ` +adaptive_aggregator_freeze_threshold adaptive_aggregator_freeze_threshold_bytes add_http_cors_header +additional_result_filter additional_table_filters aggregate_function_input_format +aggregate_functions_null_for_empty aggregation_in_order_max_block_bytes +aggregation_memory_efficient_merge_threads ai_function_allow_insecure_endpoint +ai_function_embedding_default_credentials ai_function_embedding_max_batch_size +ai_function_max_api_calls_per_query ai_function_max_concurrent_requests_per_thread +ai_function_max_input_tokens_per_query ai_function_max_output_tokens_per_query +ai_function_max_retries ai_function_request_timeout_sec ai_function_retry_initial_delay_ms +ai_function_text_default_credentials ai_function_throw_on_error ai_function_throw_on_quota_exceeded +allow_aggregate_partitions_independently allow_archive_path_syntax +allow_asynchronous_read_from_io_pool_for_merge_tree +allow_calculating_subcolumns_sizes_for_merge_tree_reading +allow_changing_replica_until_first_data_packet allow_create_index_without_type +allow_creating_set_partitions_independently allow_custom_error_code_in_throwif +allow_database_glue_catalog allow_database_iceberg allow_database_unity_catalog allow_ddl +allow_delta_kernel_rs allow_delta_lake_writes allow_deprecated_database_ordinary +allow_deprecated_error_prone_window_functions allow_deprecated_snowflake_conversion_functions +allow_deprecated_syntax_for_merge_tree allow_distinct_partitions_independently allow_distributed_ddl +allow_drop_detached allow_dynamic_type_in_join_keys allow_executable_tables +allow_execute_multiif_columnar allow_experimental_ai_functions allow_experimental_alias_table_engine +allow_experimental_alter_materialized_view_structure allow_experimental_analyzer +allow_experimental_annoy_index allow_experimental_bfloat16_type allow_experimental_bigint_types +allow_experimental_cleanup_old_data_files_compaction allow_experimental_codecs +allow_experimental_correlated_subqueries allow_experimental_database_atomic +allow_experimental_database_glue_catalog allow_experimental_database_hms_catalog +allow_experimental_database_iceberg allow_experimental_database_materialized_mysql +allow_experimental_database_materialized_postgresql allow_experimental_database_paimon_rest_catalog +allow_experimental_database_replicated allow_experimental_database_unity_catalog +allow_experimental_delta_kernel_rs allow_experimental_delta_lake_writes +allow_experimental_dynamic_type allow_experimental_eval_table_function +allow_experimental_expire_snapshots allow_experimental_full_text_index +allow_experimental_funnel_functions allow_experimental_geo_types +allow_experimental_geo_types_in_iceberg allow_experimental_hash_functions +allow_experimental_iceberg_compaction allow_experimental_insert_into_iceberg +allow_experimental_inverted_index allow_experimental_join_condition +allow_experimental_join_right_table_sorting allow_experimental_json_lazy_type_hints +allow_experimental_json_type allow_experimental_kafka_offsets_storage_in_keeper +allow_experimental_kusto_dialect allow_experimental_lightweight_delete +allow_experimental_lightweight_update allow_experimental_live_view allow_experimental_map_type +allow_experimental_materialized_postgresql_table allow_experimental_nlp_functions +allow_experimental_nullable_tuple_type allow_experimental_object_storage_queue_hive_partitioning +allow_experimental_object_type allow_experimental_paimon_storage_engine +allow_experimental_parallel_reading_from_replicas allow_experimental_polyglot_dialect +allow_experimental_projection_optimization allow_experimental_prql_dialect +allow_experimental_qbit_type allow_experimental_query_cache allow_experimental_query_deduplication +allow_experimental_refreshable_materialized_view allow_experimental_s3queue +allow_experimental_shared_merge_tree allow_experimental_shared_set_join allow_experimental_statistic +allow_experimental_statistics allow_experimental_text_index_lazy_apply +allow_experimental_time_series_aggregate_functions allow_experimental_time_series_table +allow_experimental_time_time64_type allow_experimental_ts_to_grid_aggregate_function +allow_experimental_undrop_table_query allow_experimental_unique_key +allow_experimental_url_wildcard_from_index_pages allow_experimental_usearch_index +allow_experimental_variant_type allow_experimental_vector_similarity_index +allow_experimental_window_functions allow_experimental_window_view +allow_experimental_ytsaurus_dictionary_source allow_experimental_ytsaurus_table_engine +allow_experimental_ytsaurus_table_function allow_fuzz_query_functions allow_general_join_planning +allow_get_client_http_header allow_hyperscan allow_iceberg_remove_orphan_files +allow_insert_into_iceberg allow_introspection_functions allow_key_condition_coalesce_rewrite +allow_limit_by_partitions_independently allow_lossy_numeric_supertype +allow_materialized_view_with_bad_select allow_metadata_only_named_tuple_alter +allow_named_collection_override_by_default allow_non_metadata_alters +allow_nonconst_timezone_arguments allow_nondeterministic_mutations +allow_nondeterministic_optimize_skip_unused_shards +allow_not_comparable_types_in_comparison_functions allow_not_comparable_types_in_order_by +allow_nullable_tuple_in_extracted_subcolumns allow_prefetched_read_pool_for_local_filesystem +allow_prefetched_read_pool_for_remote_filesystem allow_push_predicate_ast_for_distributed_subqueries +allow_push_predicate_when_subquery_contains_with allow_rank_dense_rank_arguments +allow_reorder_prewhere_conditions allow_replace_partition_from_empty_source +allow_settings_after_format_in_insert allow_simdjson allow_special_bool_values_inside_variant +allow_special_serialization_kinds_in_output_formats allow_statistic_optimize allow_statistics +allow_statistics_optimize allow_suspicious_codecs allow_suspicious_fixed_string_types +allow_suspicious_low_cardinality_types allow_suspicious_primary_key allow_suspicious_ttl_expressions +allow_suspicious_types_in_group_by allow_suspicious_types_in_order_by allow_suspicious_variant_types +allow_unrestricted_reads_from_keeper allow_window_partitions_independently +alter_move_to_space_execute_async alter_partition_verbose_result alter_sync alter_update_mode +analyze_index_with_space_filling_curves +analyzer_compatibility_allow_compound_identifiers_in_unflatten_nested +analyzer_compatibility_allow_cte_redefinition analyzer_compatibility_allow_non_aggregate_in_having +analyzer_compatibility_apply_final_to_all_joined_tables +analyzer_compatibility_join_using_top_level_identifier +analyzer_compatibility_multiple_joins_qualify_column_names +analyzer_compatibility_prefer_alias_over_subcolumn analyzer_inline_views annoy_index_search_k_nodes +any_join_distinct_right_table_keys apply_deleted_mask apply_mutations_on_fly apply_patch_parts +apply_patch_parts_join_cache_buckets apply_prewhere_after_final apply_row_policy_after_final +apply_settings_from_server archive_adaptive_buffer_max_size_bytes +arrow_flight_request_descriptor_type ast_fuzzer_any_query ast_fuzzer_runs +asterisk_include_alias_columns asterisk_include_materialized_columns +asterisk_include_virtual_columns async_insert_busy_timeout_decrease_rate +async_insert_busy_timeout_increase_rate async_insert_busy_timeout_max_ms +async_insert_busy_timeout_min_ms async_insert_busy_timeout_ms async_insert_cleanup_timeout_ms +async_insert_deduplicate async_insert_max_data_size async_insert_max_query_number +async_insert_poll_timeout_ms async_insert_stale_timeout_ms async_insert_threads +async_insert_use_adaptive_busy_timeout async_query_sending_for_remote async_socket_for_remote +automatic_parallel_replicas_min_bytes_per_replica automatic_parallel_replicas_mode +azure_allow_parallel_part_upload azure_check_objects_after_upload azure_connect_timeout_ms +azure_create_new_file_on_insert azure_ignore_file_doesnt_exist azure_list_object_keys_size +azure_max_blocks_in_multipart_upload azure_max_get_burst azure_max_get_rps +azure_max_inflight_parts_for_one_file azure_max_put_burst azure_max_put_rps azure_max_redirects +azure_max_single_part_copy_size azure_max_single_part_upload_size azure_max_single_read_retries +azure_max_unexpected_write_error_retries azure_max_upload_part_size azure_min_upload_part_size +azure_request_timeout_ms azure_sdk_max_retries azure_sdk_retry_initial_backoff_ms +azure_sdk_retry_max_backoff_ms azure_sdk_use_native_client azure_skip_empty_files +azure_strict_upload_part_size azure_throw_on_zero_files_match azure_truncate_on_insert +azure_upload_part_size_multiply_factor azure_upload_part_size_multiply_parts_count_threshold +azure_use_adaptive_timeouts azure_validate_etag_on_read background_buffer_flush_schedule_pool_size +background_common_pool_size background_distributed_schedule_pool_size background_fetches_pool_size +background_merges_mutations_concurrency_ratio background_message_broker_schedule_pool_size +background_move_pool_size background_pool_size background_schedule_pool_size +backup_restore_batch_size_for_keeper_multi backup_restore_batch_size_for_keeper_multiread +backup_restore_failure_after_host_disconnected_for_seconds +backup_restore_finish_timeout_after_error_sec backup_restore_keeper_fault_injection_probability +backup_restore_keeper_fault_injection_seed backup_restore_keeper_max_retries +backup_restore_keeper_max_retries_while_handling_error +backup_restore_keeper_max_retries_while_initializing backup_restore_keeper_retry_initial_backoff_ms +backup_restore_keeper_retry_max_backoff_ms backup_restore_keeper_value_max_size +backup_restore_s3_retry_attempts backup_restore_s3_retry_initial_backoff_ms +backup_restore_s3_retry_jitter_factor backup_restore_s3_retry_max_backoff_ms +backup_s3_expired_token_retry_timeout_ms backup_slow_all_threads_after_retryable_s3_error +backup_threads bool_false_representation bool_true_representation cache_warmer_threads +calculate_text_stack_trace cancel_http_readonly_queries_on_client_close +cast_ipv4_ipv6_default_on_conversion_error cast_keep_nullable cast_string_to_date_time_mode +cast_string_to_dynamic_use_inference cast_string_to_variant_use_inference +check_conversion_from_numbers_to_enum check_named_collection_dependencies +check_query_single_value_result check_referential_table_dependencies check_table_dependencies +checksum_on_read cloud_mode cloud_mode_database_engine cloud_mode_engine +cluster_for_parallel_replicas cluster_function_process_archive_on_multiple_nodes +cluster_table_function_buckets_batch_size cluster_table_function_split_granularity +collect_hash_table_stats_during_aggregation collect_hash_table_stats_during_joins +column_names_for_schema_inference compatibility compatibility_ignore_auto_increment_in_create_table +compatibility_ignore_collation_in_create_table compatibility_s3_presigned_url_query_in_path +compile_aggregate_expressions compile_expressions compile_regular_expressions +compile_sort_description compression connect_timeout connect_timeout_with_failover_ms +connect_timeout_with_failover_secure_ms connection_pool_max_wait_ms +connections_with_failover_max_tries convert_query_to_cnf correlated_subqueries_default_join_kind +correlated_subqueries_substitute_equivalent_expressions correlated_subqueries_use_in_memory_buffer +count_distinct_implementation count_distinct_optimization count_matches_stop_at_empty_match +create_if_not_exists create_index_ignore_unique +create_replicated_merge_tree_fault_injection_probability create_table_empty_primary_key_by_default +cross_join_min_bytes_to_compress cross_join_min_rows_to_compress cross_to_inner_join_rewrite +data_type_default_nullable database database_atomic_wait_for_drop_and_detach_synchronously +database_datalake_require_metadata_access database_replicated_allow_explicit_uuid +database_replicated_allow_heavy_create database_replicated_allow_only_replicated_engine +database_replicated_allow_replicated_engine_arguments database_replicated_always_detach_permanently +database_replicated_ddl_output database_replicated_enforce_synchronous_settings +database_replicated_initial_query_timeout_sec database_shared_drop_table_delay_seconds +date_time_64_output_format_cut_trailing_zeros_align_to_groups_of_thousands date_time_input_format +date_time_output_format date_time_overflow_behavior decimal_check_overflow +deduplicate_blocks_in_dependent_materialized_views deduplicate_insert deduplicate_insert_select +default_database_engine default_format default_materialized_view_sql_security +default_max_bytes_in_join default_normal_view_sql_security default_table_engine +default_temporary_table_engine default_view_definer defer_partition_pruning_after_final +delta_lake_enable_engine_predicate delta_lake_enable_expression_visitor_logging +delta_lake_insert_max_bytes_in_data_file delta_lake_insert_max_rows_in_data_file +delta_lake_log_metadata delta_lake_reload_schema_for_consistency delta_lake_snapshot_end_version +delta_lake_snapshot_start_version delta_lake_snapshot_version +delta_lake_throw_on_engine_predicate_error describe_compact_output describe_extend_object_types +describe_include_subcolumns describe_include_virtual_columns dialect dictionary_lazy_load +dictionary_use_async_executor dictionary_validate_primary_key_type discard_query_data +distinct_overflow_mode distributed_aggregation_memory_efficient distributed_background_insert_batch +distributed_background_insert_max_sleep_time_ms distributed_background_insert_sleep_time_ms +distributed_background_insert_split_batch_on_failure distributed_background_insert_timeout +distributed_cache_alignment distributed_cache_bypass_connection_pool distributed_cache_client_id +distributed_cache_connect_backoff_max_ms distributed_cache_connect_backoff_min_ms +distributed_cache_connect_max_tries distributed_cache_connect_timeout_ms +distributed_cache_credentials_refresh_period_seconds distributed_cache_data_packet_ack_window +distributed_cache_discard_connection_if_unread_data +distributed_cache_fetch_metrics_only_from_current_az distributed_cache_file_cache_name +distributed_cache_log_mode distributed_cache_max_unacked_inflight_packets +distributed_cache_min_bytes_for_seek +distributed_cache_min_inflight_bytes_to_discard_connection_on_seek +distributed_cache_pool_behaviour_on_limit distributed_cache_prefer_bigger_buffer_size +distributed_cache_read_alignment distributed_cache_read_only_from_current_az +distributed_cache_read_request_max_tries distributed_cache_receive_response_wait_milliseconds +distributed_cache_receive_timeout_milliseconds distributed_cache_receive_timeout_ms +distributed_cache_registry_show_certificate_and_signature distributed_cache_send_timeout_ms +distributed_cache_tcp_keep_alive_timeout_ms distributed_cache_throw_on_error +distributed_cache_use_clients_cache_for_read distributed_cache_use_clients_cache_for_write +distributed_cache_wait_connection_from_pool_milliseconds distributed_cache_write_request_max_tries +distributed_connections_pool_size distributed_ddl_entry_format_version distributed_ddl_output_mode +distributed_ddl_task_timeout distributed_directory_monitor_batch_inserts +distributed_directory_monitor_max_sleep_time_ms distributed_directory_monitor_sleep_time_ms +distributed_directory_monitor_split_batch_on_failure distributed_foreground_insert +distributed_group_by_no_merge distributed_index_analysis +distributed_index_analysis_for_non_shared_merge_tree distributed_index_analysis_only_on_coordinator +distributed_insert_skip_read_only_replicas distributed_plan_default_reader_bucket_count +distributed_plan_default_shuffle_join_bucket_count distributed_plan_execute_locally +distributed_plan_force_exchange_kind distributed_plan_force_shuffle_aggregation +distributed_plan_max_rows_to_broadcast distributed_plan_optimize_exchanges +distributed_plan_prefer_replicas_over_workers distributed_plan_workers_num +distributed_plan_workers_provisioning_timeout_ms distributed_product_mode +distributed_push_down_limit distributed_replica_error_cap distributed_replica_error_half_life +distributed_replica_max_ignored_errors do_not_merge_across_partitions_select_final drain_timeout +dynamic_disk_allow_from_env dynamic_disk_allow_from_zk dynamic_disk_allow_include +dynamic_throw_on_type_mismatch empty_result_for_aggregation_by_constant_keys_on_empty_set +empty_result_for_aggregation_by_empty_set enable_adaptive_aggregator +enable_adaptive_memory_spill_scheduler enable_add_distinct_to_in_subqueries enable_alp_codec +enable_analyzer enable_automatic_decision_for_merging_across_partitions_for_final +enable_blob_storage_log enable_blob_storage_log_for_read_operations enable_cascades_optimizer +enable_debug_queries enable_deflate_qpl_codec enable_dynamic_type enable_early_constant_folding +enable_extended_results_for_datetime_functions enable_filesystem_cache enable_filesystem_cache_log +enable_filesystem_cache_on_write_operations enable_filesystem_read_prefetches_log +enable_full_text_index enable_function_early_short_circuit enable_global_with_statement +enable_group_by_top_k_optimization enable_hdfs_pread enable_http_compression +enable_identifier_resolve_cache enable_job_stack_trace enable_join_fixed_hash_table_conversion +enable_join_runtime_filters enable_join_runtime_filters_index_analysis +enable_join_transitive_predicates enable_json_ast_dialect enable_json_type +enable_lazy_columns_replication enable_lightweight_delete enable_lightweight_update +enable_materialized_cte enable_memory_bound_merging_of_aggregation_results +enable_multiple_prewhere_read_steps enable_named_columns_in_function_tuple +enable_nullable_tuple_type enable_optimize_predicate_expression +enable_optimize_predicate_expression_to_final_subquery enable_order_by_all +enable_packed_string_keys_in_aggregation enable_parallel_blocks_marshalling enable_parallel_replicas +enable_parallel_single_level_merge enable_parsing_to_custom_serialization +enable_positional_arguments enable_positional_arguments_for_projections +enable_producing_buckets_out_of_order_in_aggregation enable_qbit_type enable_quantized_codec +enable_reads_from_query_cache enable_s3_requests_logging enable_scalar_subquery_optimization +enable_scopes_for_with_statement enable_sharding_aggregator enable_shared_storage_snapshot_in_query +enable_sharing_sets_for_mutations enable_software_prefetch_in_aggregation +enable_software_prefetch_in_join enable_streaming_queries enable_sz3_codec enable_time_time64_type +enable_unaligned_array_join enable_url_encoding enable_variant_type enable_vector_similarity_index +enable_vertical_final enable_writes_to_query_cache enable_zstd_qat_codec enable_zxc_codec +enforce_strict_identifier_format engine_file_allow_create_multiple_files +engine_file_empty_if_not_exists engine_file_skip_empty_files engine_file_truncate_on_insert +engine_url_skip_empty_files errors_output_format evaluation_time exact_rows_before_limit +except_default_mode exclude_materialize_skip_indexes_on_insert execute_exists_as_scalar_subquery +explain_query_plan_default explain_syntax_single_record external_storage_connect_timeout_sec +external_storage_max_read_bytes external_storage_max_read_rows external_storage_rw_timeout_sec +external_table_functions_use_nulls external_table_strict_query +extract_key_value_pairs_max_pairs_per_row extract_kvp_max_pairs_per_row extremes +fallback_to_stale_replicas_for_distributed_queries file_like_engine_default_partition_strategy +filesystem_cache_allow_background_download filesystem_cache_boundary_alignment +filesystem_cache_enable_background_download_during_fetch +filesystem_cache_enable_background_download_for_metadata_files_in_packed_storage +filesystem_cache_max_download_size filesystem_cache_name filesystem_cache_prefer_bigger_buffer_size +filesystem_cache_reserve_space_wait_lock_timeout_milliseconds filesystem_cache_segments_batch_size +filesystem_cache_skip_download_if_exceeds_per_query_cache_write_limit +filesystem_cache_verbose_logging filesystem_cache_wait_for_concurrent_download_timeout_milliseconds +filesystem_prefetch_max_memory_usage filesystem_prefetch_min_bytes_for_single_read_task +filesystem_prefetch_step_bytes filesystem_prefetch_step_marks filesystem_prefetches_limit filter +final finalize_projection_parts_synchronously flatten_nested +force_aggregate_partitions_independently force_aggregation_in_order +force_creating_set_partitions_independently force_data_skipping_indices +force_distinct_partitions_independently force_grouping_standard_compatibility force_index_by_date +force_optimize_projection force_optimize_projection_name force_optimize_skip_unused_shards +force_optimize_skip_unused_shards_nesting force_primary_key force_read_through_distributed_cache +force_remove_data_recursively_on_drop force_window_partitions_independently +force_write_through_distributed_cache format format_avro_schema_registry_connection_timeout +format_avro_schema_registry_max_retries format_avro_schema_registry_receive_timeout +format_avro_schema_registry_retry_initial_backoff_ms format_avro_schema_registry_send_timeout +format_avro_schema_registry_url format_binary_max_array_size format_binary_max_object_size +format_binary_max_string_size format_capn_proto_enum_comparising_mode +format_capn_proto_max_message_size format_capn_proto_use_autogenerated_schema +format_csv_allow_double_quotes format_csv_allow_single_quotes format_csv_delimiter +format_csv_null_representation format_custom_escaping_rule format_custom_field_delimiter +format_custom_result_after_delimiter format_custom_result_before_delimiter +format_custom_row_after_delimiter format_custom_row_before_delimiter +format_custom_row_between_delimiter format_display_secrets_in_show_and_select +format_geojson_validate_geometry format_hive_text_rows_delimiter +format_json_object_each_row_column_for_object_name format_protobuf_use_autogenerated_schema +format_regexp format_regexp_escaping_rule format_regexp_skip_unmatched format_schema +format_schema_message_name format_schema_source format_template_resultset +format_template_resultset_format format_template_row format_template_row_format +format_template_rows_between_delimiter format_tsv_null_representation +formatdatetime_e_with_space_padding formatdatetime_f_prints_scale_number_of_digits +formatdatetime_f_prints_single_zero formatdatetime_format_without_leading_zeros +formatdatetime_parsedatetime_m_is_month_name framing_output_format fsync_metadata +function_base58_max_input_size function_date_trunc_return_type_behavior function_implementation +function_json_value_return_type_allow_complex function_json_value_return_type_allow_nullable +function_locate_has_mysql_compatible_argument_order function_range_max_elements_in_block +function_sleep_max_microseconds_per_block function_visible_width_behavior +functions_h3_default_if_invalid geo_distance_returns_float64_on_float64_arguments +geotoh3_argument_order glob_expansion_max_elements grace_hash_join_initial_buckets +grace_hash_join_max_buckets group_by_overflow_mode group_by_top_k_optimization_observation_rows +group_by_two_level_threshold group_by_two_level_threshold_bytes group_by_use_nulls +h3togeo_lon_lat_result_order handle_kafka_error_mode handshake_timeout_ms +hdfs_create_new_file_on_insert hdfs_ignore_file_doesnt_exist hdfs_replication hdfs_skip_empty_files +hdfs_throw_on_zero_files_match hdfs_truncate_on_insert hedged_connection_timeout_ms +highlight_max_matches_per_row hnsw_candidate_list_size_for_search hsts_max_age +http_allow_database_as_path http_allow_filters_as_path +http_allow_filters_as_unrecognized_url_parameters http_allow_table_as_file http_connection_timeout +http_headers_progress_interval_ms http_headers_read_timeout http_make_head_request +http_max_chunk_size http_max_field_name_size http_max_field_value_size http_max_fields +http_max_multipart_form_data_size http_max_request_header_size http_max_request_param_data_size +http_max_tries http_max_uri_size http_native_compression_disable_checksumming_on_decompress +http_receive_timeout http_response_buffer_size http_response_headers http_retry_initial_backoff_ms +http_retry_max_backoff_ms http_send_timeout http_skip_not_found_url_for_globs http_wait_end_of_query +http_write_exception_in_output_format http_x_clickhouse_format_overrides_output_format +http_zlib_compression_level iceberg_compaction_commit_batch_size iceberg_compaction_data_cleanup +iceberg_compaction_delay_bias iceberg_compaction_max_bytes_in_data_file +iceberg_compaction_max_rows_in_data_file iceberg_data_file_size_lower_threshold_compaction +iceberg_data_file_size_upper_threshold_compaction iceberg_delete_data_on_drop +iceberg_delete_manifest_decode_concurrency iceberg_engine_ignore_schema_evolution +iceberg_expire_default_max_ref_age_ms iceberg_expire_default_max_snapshot_age_ms +iceberg_expire_default_min_snapshots_to_keep iceberg_file_entries_queue_size +iceberg_insert_max_bytes_in_data_file iceberg_insert_max_partitions +iceberg_insert_max_rows_in_data_file iceberg_manifest_decode_concurrency +iceberg_manifest_min_count_to_compact iceberg_max_number_datafiles_to_compact +iceberg_metadata_compression_method iceberg_metadata_log_level iceberg_metadata_staleness_ms +iceberg_orphan_files_older_than_seconds iceberg_snapshot_id iceberg_timestamp_ms +iceberg_tolerate_conflicting_manifest_schemas idle_connection_timeout ignore_cold_parts_seconds +ignore_data_skipping_indices ignore_drop_queries_probability ignore_format_null_for_explain +ignore_materialized_views_with_dropped_target_table +ignore_on_cluster_for_replicated_access_entities_queries ignore_on_cluster_for_replicated_database +ignore_on_cluster_for_replicated_handler_queries +ignore_on_cluster_for_replicated_named_collections_queries +ignore_on_cluster_for_replicated_udf_queries implicit_select implicit_table_at_top_level +implicit_transaction inject_random_order_for_select_without_order_by input_format +input_format_allow_errors_num input_format_allow_errors_ratio input_format_allow_seeks +input_format_arrow_allow_missing_columns input_format_arrow_case_insensitive_column_matching +input_format_arrow_import_nested +input_format_arrow_skip_columns_with_unsupported_types_in_schema_inference +input_format_arrow_use_native_reader input_format_avro_allow_missing_fields +input_format_avro_null_as_default input_format_binary_decode_types_in_binary_format +input_format_binary_max_type_complexity input_format_binary_read_json_as_string +input_format_bson_skip_fields_with_unsupported_types_in_schema_inference +input_format_capn_proto_skip_fields_with_unsupported_types_in_schema_inference +input_format_column_name_matching_mode input_format_connection_handling +input_format_csv_allow_cr_end_of_line input_format_csv_allow_variable_number_of_columns +input_format_csv_allow_whitespace_or_tab_as_delimiter input_format_csv_arrays_as_nested_csv +input_format_csv_deserialize_separate_columns_into_tuple input_format_csv_detect_header +input_format_csv_empty_as_default input_format_csv_enum_as_number +input_format_csv_missing_nullable_as_empty_string input_format_csv_skip_first_lines +input_format_csv_skip_trailing_empty_lines input_format_csv_trim_whitespaces +input_format_csv_try_infer_numbers_from_strings +input_format_csv_try_infer_strings_from_quoted_tuples +input_format_csv_use_best_effort_in_schema_inference input_format_csv_use_default_on_bad_values +input_format_custom_allow_variable_number_of_columns input_format_custom_detect_header +input_format_custom_skip_trailing_empty_lines input_format_defaults_for_omitted_fields +input_format_force_null_for_omitted_fields input_format_geojson_unsupported_geometry_handling +input_format_hive_text_allow_variable_number_of_columns +input_format_hive_text_collection_items_delimiter input_format_hive_text_fields_delimiter +input_format_hive_text_map_keys_delimiter input_format_import_nested_json +input_format_ipv4_default_on_conversion_error input_format_ipv6_default_on_conversion_error +input_format_json_compact_allow_variable_number_of_columns +input_format_json_defaults_for_missing_elements_in_named_tuple input_format_json_empty_as_default +input_format_json_ignore_unknown_keys_in_named_tuple input_format_json_ignore_unnecessary_fields +input_format_json_infer_array_of_dynamic_from_array_of_different_types +input_format_json_infer_incomplete_types_as_strings input_format_json_map_as_array_of_tuples +input_format_json_max_depth input_format_json_max_object_size +input_format_json_max_string_column_growth_step input_format_json_named_tuples_as_objects +input_format_json_read_arrays_as_strings input_format_json_read_bools_as_numbers +input_format_json_read_bools_as_strings input_format_json_read_numbers_as_strings +input_format_json_read_objects_as_strings input_format_json_throw_on_bad_escape_sequence +input_format_json_try_infer_named_tuples_from_objects +input_format_json_try_infer_numbers_from_strings +input_format_json_use_string_type_for_ambiguous_paths_in_named_tuples_inference_from_objects +input_format_json_validate_types_from_metadata input_format_max_block_size_bytes +input_format_max_block_wait_ms input_format_max_bytes_to_read_for_schema_inference +input_format_max_rows_to_read_for_schema_inference input_format_msgpack_number_of_columns +input_format_mysql_dump_map_column_names input_format_mysql_dump_table_name +input_format_native_allow_types_conversion input_format_native_decode_types_in_binary_format +input_format_null_as_default input_format_orc_allow_missing_columns +input_format_orc_case_insensitive_column_matching input_format_orc_dictionary_as_low_cardinality +input_format_orc_filter_push_down input_format_orc_import_nested +input_format_orc_reader_time_zone_name input_format_orc_row_batch_size +input_format_orc_skip_columns_with_unsupported_types_in_schema_inference +input_format_orc_use_fast_decoder input_format_parallel_parsing +input_format_parquet_allow_geoparquet_parser input_format_parquet_allow_missing_columns +input_format_parquet_bloom_filter_push_down input_format_parquet_case_insensitive_column_matching +input_format_parquet_dictionary_filter_push_down input_format_parquet_enable_json_parsing +input_format_parquet_enable_row_group_prefetch input_format_parquet_filter_push_down +input_format_parquet_import_nested input_format_parquet_local_file_min_bytes_for_seek +input_format_parquet_local_time_as_utc input_format_parquet_max_block_size +input_format_parquet_memory_high_watermark input_format_parquet_memory_low_watermark +input_format_parquet_page_filter_push_down input_format_parquet_prefer_block_bytes +input_format_parquet_preserve_order +input_format_parquet_skip_columns_with_unsupported_types_in_schema_inference +input_format_parquet_spatial_filter_push_down input_format_parquet_use_native_reader +input_format_parquet_use_native_reader_v3 input_format_parquet_use_offset_index +input_format_parquet_verify_checksums input_format_protobuf_flatten_google_wrappers +input_format_protobuf_oneof_presence +input_format_protobuf_skip_fields_with_unsupported_types_in_schema_inference +input_format_read_datetime_number_as_raw_value input_format_record_errors_file_path +input_format_skip_unknown_fields input_format_try_infer_dates input_format_try_infer_datetimes +input_format_try_infer_datetimes_only_datetime64 input_format_try_infer_exponent_floats +input_format_try_infer_integers input_format_try_infer_variants +input_format_tsv_allow_variable_number_of_columns input_format_tsv_crlf_end_of_line +input_format_tsv_detect_header input_format_tsv_empty_as_default input_format_tsv_enum_as_number +input_format_tsv_skip_first_lines input_format_tsv_skip_trailing_empty_lines +input_format_tsv_use_best_effort_in_schema_inference input_format_values_accurate_types_of_literals +input_format_values_deduce_templates_of_expressions input_format_values_interpret_expressions +input_format_with_names_use_header input_format_with_types_use_header +insert_allow_materialized_columns insert_deduplicate insert_deduplication_token +insert_distributed_one_random_shard insert_distributed_sync insert_distributed_timeout +insert_keeper_fault_injection_probability insert_keeper_fault_injection_seed +insert_keeper_max_retries insert_keeper_retry_initial_backoff_ms insert_keeper_retry_max_backoff_ms +insert_null_as_default insert_quorum insert_quorum_parallel insert_quorum_timeout +insert_select_deduplicate insert_shard_id interactive_delay intersect_default_mode +interval_output_format into_outfile_create_parent_directories +jemalloc_collect_profile_samples_in_trace_log jemalloc_enable_profiler +jemalloc_profile_text_collapsed_use_count jemalloc_profile_text_output_format +jemalloc_profile_text_symbolize_with_inline join_algorithm join_any_take_last_row +join_default_strictness join_on_disk_max_files_to_merge join_output_by_rowlist_perkey_rows_threshold +join_overflow_mode join_runtime_bloom_filter_bytes join_runtime_bloom_filter_hash_functions +join_runtime_bloom_filter_max_ratio_of_set_bits join_runtime_filter_blocks_to_skip_before_reenabling +join_runtime_filter_exact_values_limit join_runtime_filter_from_fixed_hash_table +join_runtime_filter_min_probe_rows join_runtime_filter_pass_ratio_threshold_for_disabling +join_runtime_filter_size_from_hash_table_stats join_to_sort_maximum_table_rows +join_to_sort_minimum_perkey_rows join_use_nulls joined_block_split_single_row +joined_subquery_requires_alias json_extract_use_cast_string_to_date_time_mode +json_type_escape_dots_in_keys kafka_disable_num_consumers_limit kafka_max_wait_ms +keeper_map_strict_mode keeper_max_retries keeper_retry_initial_backoff_ms +keeper_retry_max_backoff_ms least_greatest_legacy_null_behavior legacy_column_name_of_tuple_literal +lightweight_delete_mode lightweight_deletes_sync limit live_view_heartbeat_interval load_balancing +load_balancing_first_offset load_marks_asynchronously local_filesystem_read_method +local_filesystem_read_prefetch lock_acquire_timeout log_comment log_formatted_queries +log_processors_profiles log_profile_events log_queries log_queries_cut_to_length +log_queries_min_query_duration_ms log_queries_min_type log_queries_probability log_query_settings +log_query_threads log_query_views low_cardinality_allow_in_native_format +low_cardinality_max_dictionary_size low_cardinality_use_single_dictionary_for_part +low_priority_query_wait_time_ms make_distributed_plan materialize_skip_indexes_on_insert +materialize_statistics_on_insert materialize_statistics_on_insert_max_table_size +materialize_ttl_after_modify materialized_views_ignore_errors materialized_views_populate_atomically +materialized_views_squash_parallel_inserts max_alter_threads max_analyze_depth max_ast_depth +max_ast_elements max_autoincrement_series max_backup_bandwidth max_block_size +max_bytes_before_external_group_by max_bytes_before_external_join max_bytes_before_external_sort +max_bytes_before_remerge_sort max_bytes_for_lazy_final max_bytes_in_distinct max_bytes_in_join +max_bytes_in_set max_bytes_ratio_before_external_group_by max_bytes_ratio_before_external_join +max_bytes_ratio_before_external_sort max_bytes_to_read max_bytes_to_read_leaf max_bytes_to_sort +max_bytes_to_transfer max_columns_to_read max_concurrent_queries_for_all_users +max_concurrent_queries_for_user max_consume_snapshots max_distributed_connections +max_distributed_depth max_download_buffer_size max_download_threads +max_dynamic_subcolumns_in_json_type_parsing max_entries_for_hash_table_stats +max_estimated_execution_time max_execution_speed max_execution_speed_bytes max_execution_time +max_execution_time_leaf max_expanded_ast_elements max_fetch_partition_retries_count +max_final_threads max_http_get_redirects max_hyperscan_regexp_length +max_hyperscan_regexp_total_length max_insert_block_size max_insert_block_size_bytes +max_insert_block_size_rows max_insert_delayed_streams_for_parallel_write max_insert_threads +max_insert_threads_min_free_memory_per_thread max_joined_block_size_bytes max_joined_block_size_rows +max_limit_for_ann_queries max_limit_for_vector_search_queries +max_live_view_insert_blocks_before_refresh max_local_read_bandwidth max_local_write_bandwidth +max_memory_usage max_memory_usage_for_all_queries max_memory_usage_for_user max_network_bandwidth +max_network_bandwidth_for_all_users max_network_bandwidth_for_user max_network_bytes +max_number_of_partitions_for_independent_aggregation +max_number_of_partitions_for_independent_distinct max_number_of_partitions_for_independent_window +max_os_cpu_wait_time_ratio_to_throw max_parallel_replicas max_parser_backtracks max_parser_depth +max_parsing_threads max_partition_size_to_drop max_partitions_per_insert_block max_parts_to_move +max_pipeline_depth max_projection_rows_to_use_projection_index max_query_size +max_rand_distribution_parameter max_rand_distribution_trials max_read_buffer_size +max_read_buffer_size_local_fs max_read_buffer_size_remote_fs max_recursive_cte_evaluation_depth +max_remote_read_network_bandwidth max_remote_read_network_bandwidth_for_server +max_remote_write_network_bandwidth max_remote_write_network_bandwidth_for_server +max_replica_delay_for_distributed_queries max_replicated_fetches_network_bandwidth_for_server +max_replicated_sends_network_bandwidth_for_server max_result_bytes max_result_rows +max_reverse_dictionary_lookup_cache_size_bytes max_rows_for_lazy_final max_rows_in_distinct +max_rows_in_join max_rows_in_set max_rows_in_set_to_optimize_join max_rows_to_group_by +max_rows_to_read max_rows_to_read_leaf max_rows_to_sort max_rows_to_transfer max_sessions_for_user +max_size_to_preallocate_for_aggregation max_size_to_preallocate_for_joins +max_skip_unavailable_shards_num max_skip_unavailable_shards_ratio +max_streams_for_files_processing_in_cluster_functions max_streams_for_merge_tree_reading +max_streams_for_union_step max_streams_for_union_step_to_max_threads_ratio +max_streams_multiplier_for_merge_tables max_streams_to_max_threads_ratio max_subquery_depth +max_table_size_to_drop max_temporary_columns max_temporary_data_on_disk_size_for_query +max_temporary_data_on_disk_size_for_user max_temporary_non_const_columns max_threads +max_threads_for_annoy_index_creation max_threads_for_indexes max_threads_min_free_memory_per_thread +max_untracked_memory max_wkb_geometry_elements memory_overcommit_ratio_denominator +memory_overcommit_ratio_denominator_for_user memory_profiler_sample_max_allocation_size +memory_profiler_sample_min_allocation_size memory_profiler_sample_probability memory_profiler_step +memory_tracker_fault_probability memory_usage_overcommit_max_wait_microseconds +merge_table_max_tables_to_look_for_schema_inference merge_tree_coarse_index_granularity +merge_tree_compact_parts_min_granules_to_multibuffer_read +merge_tree_determine_task_size_by_prewhere_columns merge_tree_generic_exclusion_search_max_steps +merge_tree_max_bytes_to_use_cache merge_tree_max_rows_to_use_cache +merge_tree_min_bytes_for_concurrent_read +merge_tree_min_bytes_for_concurrent_read_for_remote_filesystem merge_tree_min_bytes_for_seek +merge_tree_min_bytes_per_read_stream merge_tree_min_bytes_per_task_for_remote_reading +merge_tree_min_read_task_size merge_tree_min_rows_for_concurrent_read +merge_tree_min_rows_for_concurrent_read_for_remote_filesystem merge_tree_min_rows_for_seek +merge_tree_prefetch_json_shared_data_substreams +merge_tree_read_split_ranges_into_intersecting_and_non_intersecting_injection_probability +merge_tree_storage_snapshot_sleep_ms merge_tree_use_const_size_tasks_for_remote_reading +merge_tree_use_deserialization_prefixes_cache merge_tree_use_prefixes_deserialization_thread_pool +merge_tree_use_v1_object_and_dynamic_serialization metrics_perf_events_enabled +metrics_perf_events_list min_bytes_to_use_direct_io min_bytes_to_use_mmap_io +min_chunk_bytes_for_parallel_parsing min_count_to_compile_aggregate_expression +min_count_to_compile_expression min_count_to_compile_regular_expression +min_count_to_compile_sort_description min_execution_speed min_execution_speed_bytes +min_external_sort_block_bytes min_external_table_block_size_bytes min_external_table_block_size_rows +min_filtered_ratio_for_lazy_final min_free_disk_space_for_temporary_data +min_hit_rate_to_use_consecutive_keys_optimization min_insert_block_size_bytes +min_insert_block_size_bytes_for_materialized_views min_insert_block_size_rows +min_insert_block_size_rows_for_materialized_views min_joined_block_size_bytes +min_joined_block_size_rows min_os_cpu_wait_time_ratio_to_throw min_outstreams_per_resize_after_split +min_table_rows_to_use_projection_index mongodb_throw_on_unsupported_query +move_all_conditions_to_prewhere move_primary_key_columns_to_end_of_prewhere +multiple_joins_rewriter_version multiple_joins_try_to_keep_original_names +mutations_execute_nondeterministic_on_initiator mutations_execute_subqueries_on_initiator +mutations_max_literal_size_to_replace mutations_sync mysql_datatypes_support_level +mysql_map_fixed_string_to_text_in_show_columns mysql_map_string_to_text_in_show_columns +mysql_max_rows_to_insert network_compression_method network_zstd_compression_level +normalize_function_names odbc_bridge_connection_pool_size odbc_bridge_use_connection_pooling +odbc_max_field_size offset opentelemetry_start_keeper_trace_probability +opentelemetry_start_trace_probability opentelemetry_trace_cpu_scheduling +opentelemetry_trace_processors optimize_aggregation_in_order optimize_aggregation_in_order_limit +optimize_aggregators_of_group_by_keys optimize_and_compare_chain +optimize_and_compare_chain_max_hash_work optimize_append_index +optimize_arithmetic_operations_in_aggregate_functions optimize_const_name_size +optimize_count_from_files optimize_dictget_tuple_element optimize_distinct_in_order +optimize_distributed_group_by_sharding_key optimize_dry_run_check_part +optimize_duplicate_order_by_and_distinct optimize_empty_string_comparisons +optimize_extract_common_expressions optimize_functions_to_subcolumns optimize_fuse_sum_count_avg +optimize_group_by_constant_keys optimize_group_by_function_keys optimize_if_chain_to_multiif +optimize_if_transform_strings_to_enum optimize_injective_functions_in_group_by +optimize_injective_functions_in_limit_by optimize_injective_functions_inside_uniq +optimize_inverse_dictionary_lookup optimize_limit_by_function_keys optimize_limit_by_in_order +optimize_min_equality_disjunction_chain_length optimize_min_inequality_conjunction_chain_length +optimize_monotonous_functions_in_order_by optimize_move_functions_out_of_any +optimize_move_to_prewhere optimize_move_to_prewhere_if_final optimize_multiif_to_if +optimize_normalize_count_variants optimize_on_insert optimize_or_like_chain +optimize_or_like_chain_min_patterns optimize_or_like_chain_min_substrings +optimize_prewhere_after_pushdown optimize_qbit_distance_function_reads optimize_read_in_order +optimize_read_in_window_order optimize_redundant_comparisons +optimize_redundant_functions_in_order_by optimize_respect_aliases +optimize_rewrite_aggregate_function_with_if optimize_rewrite_array_exists_to_has +optimize_rewrite_has_to_in optimize_rewrite_like_perfect_affix optimize_rewrite_regexp_functions +optimize_rewrite_sum_if_to_count_if optimize_skip_merged_partitions optimize_skip_unused_shards +optimize_skip_unused_shards_limit optimize_skip_unused_shards_nesting +optimize_skip_unused_shards_rewrite_in optimize_sorting_by_input_stream_properties +optimize_substitute_columns optimize_syntax_fuse_functions optimize_throw_if_noop +optimize_time_filter_with_preimage optimize_trivial_approximate_count_query +optimize_trivial_count_query optimize_trivial_count_with_sparsity_filter +optimize_trivial_group_by_limit_query optimize_trivial_insert_select +optimize_trivial_view_pushdown_to_distributed optimize_truncate_order_by_after_group_by_keys +optimize_uniq_to_count optimize_use_implicit_projections optimize_use_projection_filtering +optimize_use_projections optimize_using_constraints order os_thread_priority +os_threads_nice_value_materialized_view os_threads_nice_value_query output_format +output_format_always_write_decimal_point_in_float_and_decimal output_format_arrow_compression_method +output_format_arrow_date_as_uint16 output_format_arrow_fixed_string_as_fixed_byte_array +output_format_arrow_low_cardinality_as_dictionary output_format_arrow_max_record_batch_size_bytes +output_format_arrow_record_batch_size output_format_arrow_record_batch_size_bytes +output_format_arrow_string_as_string output_format_arrow_unsupported_types_as_binary +output_format_arrow_use_64_bit_indexes_for_dictionary output_format_arrow_use_native_writer +output_format_arrow_use_signed_indexes_for_dictionary output_format_avro_codec +output_format_avro_confluent_subject output_format_avro_rows_in_file +output_format_avro_string_column_pattern output_format_avro_sync_interval +output_format_binary_encode_types_in_binary_format output_format_binary_write_json_as_string +output_format_bson_string_as_string output_format_compression_level +output_format_compression_zstd_window_log output_format_csv_crlf_end_of_line +output_format_csv_header_serialize_tuple_into_separate_columns +output_format_csv_serialize_tuple_into_separate_columns output_format_decimal_trailing_zeros +output_format_enable_streaming output_format_float_precision output_format_image_height +output_format_image_streaming_animation output_format_image_terminal_mode +output_format_image_time_divisor_seconds output_format_image_time_multiplier_seconds +output_format_image_width output_format_json_array_of_rows output_format_json_escape_forward_slashes +output_format_json_map_as_array_of_tuples output_format_json_named_tuples_as_objects +output_format_json_pretty_print output_format_json_quote_64bit_floats +output_format_json_quote_64bit_integers output_format_json_quote_decimals +output_format_json_quote_denormals output_format_json_skip_null_value_in_named_tuples +output_format_json_validate_utf8 output_format_markdown_escape_special_characters +output_format_msgpack_uuid_representation output_format_native_encode_types_in_binary_format +output_format_native_use_flattened_dynamic_and_json_serialization +output_format_native_write_json_as_string output_format_orc_compression_block_size +output_format_orc_compression_method output_format_orc_dictionary_key_size_threshold +output_format_orc_row_index_stride output_format_orc_string_as_string +output_format_orc_writer_time_zone_name output_format_parallel_formatting +output_format_parquet_batch_size output_format_parquet_bloom_filter_bits_per_value +output_format_parquet_bloom_filter_flush_threshold_bytes +output_format_parquet_compliant_nested_types output_format_parquet_compression_method +output_format_parquet_data_page_size output_format_parquet_date_as_uint16 +output_format_parquet_datetime_as_uint32 output_format_parquet_enum_as_byte_array +output_format_parquet_fixed_string_as_fixed_byte_array output_format_parquet_geometadata +output_format_parquet_max_dictionary_size output_format_parquet_parallel_encoding +output_format_parquet_row_group_size output_format_parquet_row_group_size_bytes +output_format_parquet_string_as_string output_format_parquet_unsupported_types_as_binary +output_format_parquet_use_custom_encoder output_format_parquet_version +output_format_parquet_wide_integer_as_decimal output_format_parquet_write_bloom_filter +output_format_parquet_write_checksums output_format_parquet_write_page_index +output_format_pretty_color output_format_pretty_display_footer_column_names +output_format_pretty_display_footer_column_names_min_rows output_format_pretty_fallback_to_vertical +output_format_pretty_fallback_to_vertical_max_rows_per_chunk +output_format_pretty_fallback_to_vertical_min_columns +output_format_pretty_fallback_to_vertical_min_table_width output_format_pretty_glue_chunks +output_format_pretty_grid_charset output_format_pretty_highlight_digit_groups +output_format_pretty_highlight_trailing_spaces output_format_pretty_max_column_name_width_cut_to +output_format_pretty_max_column_name_width_min_chars_to_cut +output_format_pretty_max_column_pad_width output_format_pretty_max_rows +output_format_pretty_max_value_width output_format_pretty_max_value_width_apply_for_single_value +output_format_pretty_multiline_fields output_format_pretty_named_tuples_as_json +output_format_pretty_row_numbers output_format_pretty_single_large_number_tip_threshold +output_format_pretty_squash_consecutive_ms output_format_pretty_squash_max_wait_ms +output_format_pretty_use_nbsp_for_padding output_format_protobuf_nullables_with_google_wrappers +output_format_schema output_format_sql_insert_include_column_names +output_format_sql_insert_max_batch_size output_format_sql_insert_quote_names +output_format_sql_insert_table_name output_format_sql_insert_use_replace +output_format_trim_fixed_string output_format_tsv_crlf_end_of_line +output_format_values_escape_quote_with_quote output_format_write_statistics page +page_cache_block_size page_cache_inject_eviction page_cache_lookahead_blocks +page_cache_max_coalesced_bytes paimon_target_snapshot_id parallel_distributed_insert_select +parallel_hash_join_threshold parallel_non_joined_rows_processing parallel_replica_offset +parallel_replicas_allow_in_with_subquery parallel_replicas_allow_materialized_views +parallel_replicas_allow_view_over_mergetree parallel_replicas_connect_timeout_ms +parallel_replicas_count parallel_replicas_custom_key parallel_replicas_custom_key_filter_type +parallel_replicas_custom_key_range_lower parallel_replicas_custom_key_range_upper +parallel_replicas_filter_pushdown parallel_replicas_for_cluster_engines +parallel_replicas_for_non_replicated_merge_tree parallel_replicas_index_analysis_only_on_coordinator +parallel_replicas_insert_select_local_pipeline parallel_replicas_local_plan +parallel_replicas_mark_segment_size parallel_replicas_min_number_of_granules_to_enable +parallel_replicas_min_number_of_rows_per_replica parallel_replicas_mode +parallel_replicas_only_with_analyzer parallel_replicas_plan_based +parallel_replicas_prefer_local_join parallel_replicas_prefer_local_replica +parallel_replicas_single_task_marks_count_multiplier parallel_replicas_support_projection +parallel_view_processing parallelize_output_from_storages parsedatetime_e_requires_space_padding +parsedatetime_parse_without_leading_zeros partial_merge_join_left_table_buffer_bytes +partial_merge_join_optimizations partial_merge_join_rows_in_right_blocks +partial_result_on_first_cancel per_part_index_stats periodic_live_view_refresh poll_interval +polyglot_dialect postgresql_connection_attempt_timeout +postgresql_connection_pool_auto_close_connection postgresql_connection_pool_retries +postgresql_connection_pool_size postgresql_connection_pool_wait_timeout +postgresql_fault_injection_probability precise_float_parsing predicate_statistics_sample_rate +prefer_column_name_to_alias prefer_external_sort_block_bytes prefer_global_in_and_join +prefer_localhost_replica prefer_warmed_unmerged_parts_seconds preferred_block_size_bytes +preferred_max_column_in_block_size_bytes preferred_optimize_projection_name prefetch_buffer_size +print_pretty_type_names priority promql_database promql_evaluation_time promql_table +push_external_roles_in_interserver_queries query_cache_compress_entries query_cache_for_subqueries +query_cache_max_entries query_cache_max_size_in_bytes query_cache_min_query_duration +query_cache_min_query_runs query_cache_nondeterministic_function_handling +query_cache_share_between_users query_cache_squash_partial_results +query_cache_store_results_of_queries_with_nondeterministic_functions +query_cache_system_table_handling query_cache_tag query_cache_ttl +query_condition_cache_store_conditions_as_plaintext query_metric_log_interval +query_plan_aggregation_bucket_top_k query_plan_aggregation_in_order +query_plan_convert_any_join_to_semi_or_anti_join query_plan_convert_join_to_in +query_plan_convert_outer_join_to_inner_join query_plan_direct_read_from_text_index +query_plan_display_internal_aliases query_plan_enable_multithreading_after_window_functions +query_plan_enable_optimizations query_plan_execute_functions_after_sorting +query_plan_filter_push_down query_plan_filter_push_down_below_limit_by +query_plan_join_shard_by_pk_ranges query_plan_join_swap_table query_plan_lift_up_array_join +query_plan_lift_up_union query_plan_max_limit_for_join_lazy_indexing +query_plan_max_limit_for_lazy_materialization query_plan_max_limit_for_top_k_optimization +query_plan_max_optimizations_to_apply query_plan_max_set_size_for_projection_match +query_plan_max_step_description_length query_plan_merge_expression_into_join +query_plan_merge_expressions query_plan_merge_filter_into_join_condition query_plan_merge_filters +query_plan_min_columns_for_join_lazy_indexing query_plan_optimize_count_from_text_index +query_plan_optimize_join_order_algorithm query_plan_optimize_join_order_limit +query_plan_optimize_join_order_max_searched_plans query_plan_optimize_join_order_randomize +query_plan_optimize_lazy_final query_plan_optimize_lazy_materialization +query_plan_optimize_lazy_materialization_for_file +query_plan_optimize_lazy_materialization_for_object_storage query_plan_optimize_prewhere +query_plan_optimize_primary_key query_plan_optimize_projection query_plan_push_down_limit +query_plan_push_down_volume_reducing_functions query_plan_push_limit_by_into_sort +query_plan_read_in_order query_plan_read_in_order_through_join query_plan_remove_redundant_distinct +query_plan_remove_redundant_sorting query_plan_remove_unused_columns +query_plan_reuse_storage_ordering_for_window_functions query_plan_short_circuit_constant_false_join +query_plan_split_filter query_plan_text_index_add_hint query_plan_top_k_through_join +query_plan_try_use_vector_search query_plan_use_logical_join_step +query_plan_use_new_logical_join_step query_profiler_cpu_time_period_ns +query_profiler_real_time_period_ns queue_max_wait_ms rabbitmq_max_wait_ms +read_backoff_max_throughput read_backoff_min_concurrency read_backoff_min_events +read_backoff_min_interval_between_events_ms read_backoff_min_latency_ms +read_from_distributed_cache_if_exists_otherwise_bypass_cache +read_from_filesystem_cache_if_exists_otherwise_bypass_cache +read_from_page_cache_if_exists_otherwise_bypass_cache read_in_order_two_level_merge_threshold +read_in_order_use_buffering read_in_order_use_virtual_row read_in_order_use_virtual_row_per_block +read_overflow_mode read_overflow_mode_leaf read_priority read_through_distributed_cache +reader_executor_block_size reader_executor_max_tail_for_drain reader_executor_min_bytes_for_seek +reader_executor_use_long_connections reader_executor_window_size readonly receive_data_timeout_ms +receive_timeout recursive_cte_max_steps_in_type_inference regexp_dict_allow_hyperscan +regexp_dict_flag_case_insensitive regexp_dict_flag_dotall regexp_max_matches_per_row +reject_expensive_hyperscan_regexps remerge_sort_lowered_memory_bytes_ratio +remote_filesystem_read_method remote_filesystem_read_prefetch remote_fs_read_backoff_max_tries +remote_fs_read_max_backoff_ms remote_read_min_bytes_for_seek rename_files_after_processing +replace_running_query replace_running_query_max_wait_ms replication_alter_columns_timeout +replication_alter_partitions_sync replication_wait_for_inactive_replica_timeout reserve_memory +restore_replace_external_dictionary_source_to_null restore_replace_external_engines_to_null +restore_replace_external_table_functions_to_null restore_replicated_merge_tree_to_shared_merge_tree +restore_threads result_overflow_mode resumable_backup_from_snapshot +rewrite_count_distinct_if_with_count_distinct_implementation rewrite_in_to_join +rows_before_aggregation run_query_in_background s3_allow_multipart_copy +s3_allow_parallel_part_upload s3_allow_server_credentials_in_user_queries s3_base +s3_check_objects_after_upload s3_connect_timeout_ms s3_create_new_file_on_insert s3_disable_checksum +s3_ignore_file_doesnt_exist s3_list_object_keys_size s3_max_connections s3_max_get_burst +s3_max_get_rps s3_max_inflight_parts_for_one_file s3_max_part_number s3_max_put_burst s3_max_put_rps +s3_max_redirects s3_max_single_operation_copy_size s3_max_single_part_upload_size +s3_max_single_read_retries s3_max_unexpected_write_error_retries s3_max_upload_part_size +s3_min_upload_part_size s3_path_filter_limit s3_request_timeout_ms s3_retry_attempts +s3_skip_empty_files s3_slow_all_threads_after_network_error +s3_slow_all_threads_after_retryable_error s3_strict_upload_part_size s3_throw_on_zero_files_match +s3_truncate_on_insert s3_upload_part_size_multiply_factor +s3_upload_part_size_multiply_parts_count_threshold s3_uri_style s3_use_adaptive_timeouts +s3_validate_etag_on_read s3_validate_request_settings s3queue_allow_experimental_sharded_mode +s3queue_default_zookeeper_path s3queue_enable_logging_to_s3queue_log +s3queue_keeper_fault_injection_probability s3queue_migrate_old_metadata_to_buckets +schema_inference_cache_require_modification_time_for_url schema_inference_hints +schema_inference_make_columns_nullable schema_inference_make_json_columns_nullable +schema_inference_mode schema_inference_use_cache_for_azure schema_inference_use_cache_for_file +schema_inference_use_cache_for_hdfs schema_inference_use_cache_for_s3 +schema_inference_use_cache_for_url secondary_indices_enable_bulk_filtering select +select_sequential_consistency send_logs_level send_logs_source_regexp send_profile_events +send_progress_in_http_headers send_table_structure_on_insert_with_inline_data send_timeout +serialize_query_plan serialize_string_in_memory_with_zero_byte session_timezone set_overflow_mode +shared_merge_tree_sequential_consistency_initial_parts_update_backoff_ms +shared_merge_tree_sequential_consistency_max_parts_update_backoff_ms +shared_merge_tree_sequential_consistency_parts_update_max_retries +shared_merge_tree_sync_parts_on_partition_operations short_circuit_function_evaluation +short_circuit_function_evaluation_for_nulls short_circuit_function_evaluation_for_nulls_threshold +show_create_query_identifier_quoting_rule show_create_query_identifier_quoting_style +show_data_lake_catalogs_in_system_tables show_processlist_include_internal +show_remote_databases_in_system_tables show_table_uuid_in_table_create_query_if_not_nil +shrink_over_allocated_columns_min_waste_bytes shrink_over_allocated_columns_min_waste_ratio +single_join_prefer_left_table skip_download_if_exceeds_query_cache skip_redundant_aliases_in_udf +skip_unavailable_shards skip_unavailable_shards_mode sleep_after_receiving_query_ms +sleep_in_send_data_ms sleep_in_send_tables_status_ms snappy_mode sort sort_overflow_mode +split_intersecting_parts_ranges_into_layers_final +split_parts_ranges_into_intersecting_and_non_intersecting_final +splitby_max_substrings_includes_remaining_string +statistics_max_set_size_for_exact_selectivity_estimation +stop_refreshable_materialized_views_on_startup storage_file_read_method +storage_system_stack_trace_pipe_read_timeout_ms stream_flush_interval_ms +stream_like_engine_allow_direct_select stream_like_engine_insert_queue stream_poll_timeout_ms +system_events_show_zero_values system_metric_log_show_zero_values_in_histograms +table_engine_read_through_distributed_cache table_function_remote_max_addresses +tcp_keep_alive_timeout temporary_data_in_cache_reserve_space_wait_lock_timeout_milliseconds +temporary_files_buffer_size temporary_files_codec temporary_live_view_timeout +text_index_density_threshold text_index_hint_max_selectivity +text_index_lazy_intersection_density_threshold text_index_like_max_postings_to_read +text_index_like_min_pattern_length text_index_posting_list_apply_mode text_index_use_bloom_filter +throw_if_deduplication_in_dependent_materialized_views_enabled_with_async_insert +throw_if_no_data_to_insert throw_on_error_from_cache_on_write_operations +throw_on_hive_partitioning_resolution_failure throw_on_max_partitions_per_insert_block +throw_on_unsupported_query_inside_transaction time_series_prefer_recent_samples_table +timeout_before_checking_execution_speed timeout_overflow_mode timeout_overflow_mode_leaf +totals_auto_threshold totals_mode trace_profile_events trace_profile_events_list +transfer_overflow_mode transform_null_in traverse_shadow_remote_data_paths +type_json_allow_duplicated_key_with_literal_and_nested_object type_json_skip_duplicated_paths +type_json_skip_invalid_typed_paths type_json_use_partial_match_to_skip_paths_by_regexp +union_default_mode unique_key_max_encoded_size unique_key_probe_implementation +unknown_packet_in_send_data update_insert_deduplication_token_in_dependent_materialized_views +update_parallel_mode update_sequential_consistency url_base url_wildcard_max_directories_to_read +use_aggregation_memory_tracker use_async_executor_for_materialized_views +use_cache_for_count_from_files use_client_time_zone use_compact_format_in_distributed_parts_names +use_concurrency_control use_constant_folding_in_index_analysis +use_hash_table_stats_for_join_reordering use_hedged_requests use_hive_partitioning +use_iceberg_metadata_files_cache use_iceberg_partition_pruning use_index_for_in_with_subqueries +use_index_for_in_with_subqueries_max_values use_indexes_refiner_in_read_pools +use_join_disjunctions_push_down use_json_alias_for_old_object_type use_legacy_to_time +use_lightweight_primary_key_index_analysis use_local_cache_for_remote_storage +use_mysql_types_in_show_columns use_page_cache_for_disks_without_file_cache +use_page_cache_for_local_disks use_page_cache_for_object_storage +use_page_cache_with_distributed_cache use_paimon_metadata_files_cache use_paimon_partition_pruning +use_parquet_metadata_cache use_partition_key use_partition_minmax_for_primary_key_pruning +use_partition_pruning use_primary_key use_projection_index_in_read_pools use_query_cache +use_query_condition_cache use_query_condition_cache_for_top_k use_reader_executor +use_roaring_bitmap_iceberg_positional_deletes use_skip_indexes use_skip_indexes_for_disjunctions +use_skip_indexes_for_top_k use_skip_indexes_if_final use_skip_indexes_if_final_exact_mode +use_skip_indexes_on_data_read use_statistics use_statistics_cache use_statistics_for_part_pruning +use_streaming_marks_compression use_strict_insert_block_limits +use_structure_from_insertion_table_in_table_functions use_text_index_dictionary_cache +use_text_index_header_cache use_text_index_like_evaluation_by_dictionary_scan +use_text_index_negative_tokens_cache use_text_index_postings_cache use_text_index_tokens_cache +use_top_k_dynamic_filtering use_top_k_dynamic_filtering_for_variable_length_types +use_uncompressed_cache use_variant_as_common_type use_variant_default_implementation_for_comparisons +use_with_fill_by_sorting_prefix validate_enum_literals_in_operators +validate_experimental_and_suspicious_types_inside_nested_types validate_group_by_all_key_types +validate_mutation_query validate_polygons variant_throw_on_type_mismatch +vector_search_filter_strategy vector_search_index_fetch_multiplier +vector_search_postfilter_multiplier vector_search_use_quantized_codes vector_search_with_rescoring +wait_changes_become_visible_after_commit_mode wait_for_async_insert wait_for_async_insert_timeout +wait_for_part_commit_in_dependent_materialized_views wait_for_window_view_fire_signal_timeout +webassembly_udf_max_fuel webassembly_udf_max_input_block_size webassembly_udf_max_instances +webassembly_udf_max_memory window_view_clean_interval window_view_heartbeat_interval workload +write_full_path_in_iceberg_metadata write_through_distributed_cache +write_through_distributed_cache_buffer_size zstd_window_log_max +` diff --git a/internal/explain/statements.go b/internal/explain/statements.go index eac2900823..86c11b493b 100644 --- a/internal/explain/statements.go +++ b/internal/explain/statements.go @@ -112,6 +112,20 @@ func explainInsertQuery(sb *strings.Builder, n *ast.InsertQuery, indent string, } func explainCreateQuery(sb *strings.Builder, n *ast.CreateQuery, indent string, depth int) { + // A table engine's SETTINGS clause drops query-level settings. + if n.Table != "" && n.Engine != nil && len(n.Settings) > 0 && (n.Comment == "" || n.SettingsBeforeComment) && engineDropsQuerySettings(n.Engine.Name) { + var kept []*ast.SettingExpr + for _, st := range n.Settings { + if !querySettingNames[st.Name] { + kept = append(kept, st) + } + } + if len(kept) != len(n.Settings) { + cp := *n + cp.Settings = kept + n = &cp + } + } // A view definition keeps its query-construction settings as written. if n.View != "" || n.Materialized || n.WindowView { constructionDisabled++ @@ -128,7 +142,7 @@ func explainCreateQuery(sb *strings.Builder, n *ast.CreateQuery, indent string, } if n.CreateFunction { children := 2 // identifier + lambda - fmt.Fprintf(sb, "%sCreateFunctionQuery %s (children %d)\n", indent, n.FunctionName, children) + fmt.Fprintf(sb, "%sCreateSQLFunctionQuery %s (children %d)\n", indent, n.FunctionName, children) fmt.Fprintf(sb, "%s Identifier %s\n", indent, n.FunctionName) if n.FunctionBody != nil { Node(sb, n.FunctionBody, depth+1) @@ -2114,6 +2128,9 @@ func explainStatisticsCommand(sb *strings.Builder, cmd *ast.AlterCommand, indent statChildren++ } + if statChildren == 0 { + return + } fmt.Fprintf(sb, "%s Stat (children %d)\n", indent, statChildren) // First: column names as ExpressionList of Identifiers @@ -2136,13 +2153,13 @@ func explainStatisticsCommand(sb *strings.Builder, cmd *ast.AlterCommand, indent func explainStatisticsTypeFunction(sb *strings.Builder, fn *ast.FunctionCall, indent string, depth int) { // Statistics type functions always have (children 1) even if no actual arguments // because ClickHouse shows them with an empty ExpressionList - fmt.Fprintf(sb, "%sFunction %s (children 1)\n", indent, fn.Name) if len(fn.Arguments) == 0 { - fmt.Fprintf(sb, "%s ExpressionList\n", indent) + fmt.Fprintf(sb, "%sFunction %s\n", indent, fn.Name) } else { + fmt.Fprintf(sb, "%sFunction %s (children 1)\n", indent, fn.Name) fmt.Fprintf(sb, "%s ExpressionList (children %d)\n", indent, len(fn.Arguments)) for _, arg := range fn.Arguments { - Node(sb, arg, depth+1) + Node(sb, arg, depth+2) } } } @@ -2973,3 +2990,18 @@ func explainCreateUser(sb *strings.Builder, n *ast.CreateQuery, indent string) { fmt.Fprintf(sb, "%s Literal \\'%s\\'\n", indent, escapeStringLiteral(n.UserValidUntil)) } } + +// engineDropsQuerySettings reports whether a table engine has no settings of +// its own that share names with query settings, so query-level settings in +// its SETTINGS clause are dropped from the AST. Engines with overlapping +// settings (Distributed, Join, PostgreSQL, File, ...) keep them all. +func engineDropsQuerySettings(engine string) bool { + if strings.HasSuffix(engine, "MergeTree") { + return true + } + switch engine { + case "Log", "TinyLog", "StripeLog", "Memory", "Null", "Kafka": + return true + } + return false +} diff --git a/parser/expression.go b/parser/expression.go index ec2ec7e9db..da222bef5d 100644 --- a/parser/expression.go +++ b/parser/expression.go @@ -212,6 +212,7 @@ func (p *Parser) parseCreateOrderByExpressions() ([]ast.Expression, bool, bool) p.nextToken() } else if p.currentIs(token.DESC) { hasModifier = true + hasDesc = true p.nextToken() } diff --git a/parser/parser.go b/parser/parser.go index dfeae417bb..0d93173af0 100644 --- a/parser/parser.go +++ b/parser/parser.go @@ -5371,6 +5371,11 @@ func (p *Parser) parseStatisticsExpr() []*ast.FunctionCall { func (p *Parser) parseStatisticsColumnList() []string { var columns []string + // STATISTICS ALL: every column, printed without a Stat child + if p.currentIs(token.ALL) && !p.peekIs(token.COMMA) { + p.nextToken() + return nil + } for p.currentIs(token.IDENT) || p.current.Token.IsKeyword() { columns = append(columns, p.current.Value) p.nextToken() diff --git a/parser/testdata/01856_create_function/metadata.json b/parser/testdata/01856_create_function/metadata.json index cba8b1fd5c..0967ef424b 100644 --- a/parser/testdata/01856_create_function/metadata.json +++ b/parser/testdata/01856_create_function/metadata.json @@ -1,7 +1 @@ -{ - "explain_todo": { - "stmt1": true, - "stmt5": true, - "stmt6": true - } -} +{} diff --git a/parser/testdata/02096_sql_user_defined_function_alias/metadata.json b/parser/testdata/02096_sql_user_defined_function_alias/metadata.json index e9d6e46171..0967ef424b 100644 --- a/parser/testdata/02096_sql_user_defined_function_alias/metadata.json +++ b/parser/testdata/02096_sql_user_defined_function_alias/metadata.json @@ -1,5 +1 @@ -{ - "explain_todo": { - "stmt1": true - } -} +{} diff --git a/parser/testdata/02098_sql_user_defined_functions_aliases/metadata.json b/parser/testdata/02098_sql_user_defined_functions_aliases/metadata.json index e9d6e46171..0967ef424b 100644 --- a/parser/testdata/02098_sql_user_defined_functions_aliases/metadata.json +++ b/parser/testdata/02098_sql_user_defined_functions_aliases/metadata.json @@ -1,5 +1 @@ -{ - "explain_todo": { - "stmt1": true - } -} +{} diff --git a/parser/testdata/02099_sql_user_defined_functions_lambda/metadata.json b/parser/testdata/02099_sql_user_defined_functions_lambda/metadata.json index e9d6e46171..0967ef424b 100644 --- a/parser/testdata/02099_sql_user_defined_functions_lambda/metadata.json +++ b/parser/testdata/02099_sql_user_defined_functions_lambda/metadata.json @@ -1,5 +1 @@ -{ - "explain_todo": { - "stmt1": true - } -} +{} diff --git a/parser/testdata/02101_sql_user_defined_functions_create_or_replace/metadata.json b/parser/testdata/02101_sql_user_defined_functions_create_or_replace/metadata.json index aeb01f1428..0967ef424b 100644 --- a/parser/testdata/02101_sql_user_defined_functions_create_or_replace/metadata.json +++ b/parser/testdata/02101_sql_user_defined_functions_create_or_replace/metadata.json @@ -1,6 +1 @@ -{ - "explain_todo": { - "stmt1": true, - "stmt4": true - } -} +{} diff --git a/parser/testdata/02101_sql_user_defined_functions_drop_if_exists/metadata.json b/parser/testdata/02101_sql_user_defined_functions_drop_if_exists/metadata.json index e9d6e46171..0967ef424b 100644 --- a/parser/testdata/02101_sql_user_defined_functions_drop_if_exists/metadata.json +++ b/parser/testdata/02101_sql_user_defined_functions_drop_if_exists/metadata.json @@ -1,5 +1 @@ -{ - "explain_todo": { - "stmt1": true - } -} +{} diff --git a/parser/testdata/02102_sql_user_defined_functions_create_if_not_exists/metadata.json b/parser/testdata/02102_sql_user_defined_functions_create_if_not_exists/metadata.json index e5e4780514..0967ef424b 100644 --- a/parser/testdata/02102_sql_user_defined_functions_create_if_not_exists/metadata.json +++ b/parser/testdata/02102_sql_user_defined_functions_create_if_not_exists/metadata.json @@ -1,6 +1 @@ -{ - "explain_todo": { - "stmt1": true, - "stmt3": true - } -} +{} diff --git a/parser/testdata/02103_sql_user_defined_functions_composition/metadata.json b/parser/testdata/02103_sql_user_defined_functions_composition/metadata.json index f7c9a031b3..0967ef424b 100644 --- a/parser/testdata/02103_sql_user_defined_functions_composition/metadata.json +++ b/parser/testdata/02103_sql_user_defined_functions_composition/metadata.json @@ -1,7 +1 @@ -{ - "explain_todo": { - "stmt1": true, - "stmt2": true, - "stmt3": true - } -} +{} diff --git a/parser/testdata/02125_recursive_sql_user_defined_functions/metadata.json b/parser/testdata/02125_recursive_sql_user_defined_functions/metadata.json index b663b7c8e4..0967ef424b 100644 --- a/parser/testdata/02125_recursive_sql_user_defined_functions/metadata.json +++ b/parser/testdata/02125_recursive_sql_user_defined_functions/metadata.json @@ -1,8 +1 @@ -{ - "explain_todo": { - "stmt11": true, - "stmt2": true, - "stmt6": true, - "stmt8": true - } -} +{} diff --git a/parser/testdata/02126_identity_user_defined_function/metadata.json b/parser/testdata/02126_identity_user_defined_function/metadata.json index 1b658d02c1..0967ef424b 100644 --- a/parser/testdata/02126_identity_user_defined_function/metadata.json +++ b/parser/testdata/02126_identity_user_defined_function/metadata.json @@ -1,7 +1 @@ -{ - "explain_todo": { - "stmt2": true, - "stmt5": true, - "stmt7": true - } -} +{} diff --git a/parser/testdata/02148_sql_user_defined_function_subquery/metadata.json b/parser/testdata/02148_sql_user_defined_function_subquery/metadata.json index cc95675c50..0967ef424b 100644 --- a/parser/testdata/02148_sql_user_defined_function_subquery/metadata.json +++ b/parser/testdata/02148_sql_user_defined_function_subquery/metadata.json @@ -1,10 +1 @@ -{ - "explain_todo": { - "stmt10": true, - "stmt17": true, - "stmt19": true, - "stmt2": true, - "stmt4": true, - "stmt7": true - } -} +{} diff --git a/parser/testdata/02181_sql_user_defined_functions_invalid_lambda/metadata.json b/parser/testdata/02181_sql_user_defined_functions_invalid_lambda/metadata.json index e9d6e46171..0967ef424b 100644 --- a/parser/testdata/02181_sql_user_defined_functions_invalid_lambda/metadata.json +++ b/parser/testdata/02181_sql_user_defined_functions_invalid_lambda/metadata.json @@ -1,5 +1 @@ -{ - "explain_todo": { - "stmt1": true - } -} +{} diff --git a/parser/testdata/02292_create_function_validate/metadata.json b/parser/testdata/02292_create_function_validate/metadata.json index e9d6e46171..0967ef424b 100644 --- a/parser/testdata/02292_create_function_validate/metadata.json +++ b/parser/testdata/02292_create_function_validate/metadata.json @@ -1,5 +1 @@ -{ - "explain_todo": { - "stmt1": true - } -} +{} diff --git a/parser/testdata/02346_text_index_preprocessor/metadata.json b/parser/testdata/02346_text_index_preprocessor/metadata.json index 9e1224da1b..0967ef424b 100644 --- a/parser/testdata/02346_text_index_preprocessor/metadata.json +++ b/parser/testdata/02346_text_index_preprocessor/metadata.json @@ -1,5 +1 @@ -{ - "explain_todo": { - "stmt75": true - } -} +{} diff --git a/parser/testdata/02346_text_index_transform_access/metadata.json b/parser/testdata/02346_text_index_transform_access/metadata.json index f87dc5c0a5..0967ef424b 100644 --- a/parser/testdata/02346_text_index_transform_access/metadata.json +++ b/parser/testdata/02346_text_index_transform_access/metadata.json @@ -1,6 +1 @@ -{ - "explain_todo": { - "stmt49": true, - "stmt62": true - } -} +{} diff --git a/parser/testdata/02354_vector_search_reference_vector_types/metadata.json b/parser/testdata/02354_vector_search_reference_vector_types/metadata.json index c5e75d2569..0967ef424b 100644 --- a/parser/testdata/02354_vector_search_reference_vector_types/metadata.json +++ b/parser/testdata/02354_vector_search_reference_vector_types/metadata.json @@ -1,8 +1 @@ -{ - "explain_todo": { - "stmt15": true, - "stmt17": true, - "stmt19": true, - "stmt45": true - } -} +{} diff --git a/parser/testdata/02483_substitute_udf_create/metadata.json b/parser/testdata/02483_substitute_udf_create/metadata.json index 49407b86d5..0967ef424b 100644 --- a/parser/testdata/02483_substitute_udf_create/metadata.json +++ b/parser/testdata/02483_substitute_udf_create/metadata.json @@ -1,7 +1 @@ -{ - "explain_todo": { - "stmt10": true, - "stmt15": true, - "stmt5": true - } -} +{} diff --git a/parser/testdata/02484_substitute_udf_storage_args/metadata.json b/parser/testdata/02484_substitute_udf_storage_args/metadata.json index 114f6ae142..0967ef424b 100644 --- a/parser/testdata/02484_substitute_udf_storage_args/metadata.json +++ b/parser/testdata/02484_substitute_udf_storage_args/metadata.json @@ -1,9 +1 @@ -{ - "explain_todo": { - "stmt12": true, - "stmt15": true, - "stmt7": true, - "stmt8": true, - "stmt9": true - } -} +{} diff --git a/parser/testdata/02494_query_cache_udf_sql/metadata.json b/parser/testdata/02494_query_cache_udf_sql/metadata.json index 1295a45747..0967ef424b 100644 --- a/parser/testdata/02494_query_cache_udf_sql/metadata.json +++ b/parser/testdata/02494_query_cache_udf_sql/metadata.json @@ -1,5 +1 @@ -{ - "explain_todo": { - "stmt3": true - } -} +{} diff --git a/parser/testdata/02864_statistics_bug_69589/metadata.json b/parser/testdata/02864_statistics_bug_69589/metadata.json index b563327205..0967ef424b 100644 --- a/parser/testdata/02864_statistics_bug_69589/metadata.json +++ b/parser/testdata/02864_statistics_bug_69589/metadata.json @@ -1,5 +1 @@ -{ - "explain_todo": { - "stmt7": true - } -} +{} diff --git a/parser/testdata/02864_statistics_create_materialize_drop/metadata.json b/parser/testdata/02864_statistics_create_materialize_drop/metadata.json index c45b7602ba..0967ef424b 100644 --- a/parser/testdata/02864_statistics_create_materialize_drop/metadata.json +++ b/parser/testdata/02864_statistics_create_materialize_drop/metadata.json @@ -1,5 +1 @@ -{ - "explain_todo": { - "stmt12": true - } -} +{} diff --git a/parser/testdata/02864_statistics_ddl/metadata.json b/parser/testdata/02864_statistics_ddl/metadata.json index a49d37d388..0967ef424b 100644 --- a/parser/testdata/02864_statistics_ddl/metadata.json +++ b/parser/testdata/02864_statistics_ddl/metadata.json @@ -1,28 +1 @@ -{ - "explain_todo": { - "stmt116": true, - "stmt117": true, - "stmt118": true, - "stmt119": true, - "stmt120": true, - "stmt121": true, - "stmt122": true, - "stmt123": true, - "stmt124": true, - "stmt125": true, - "stmt126": true, - "stmt127": true, - "stmt134": true, - "stmt141": true, - "stmt142": true, - "stmt145": true, - "stmt146": true, - "stmt149": true, - "stmt150": true, - "stmt161": true, - "stmt162": true, - "stmt165": true, - "stmt167": true, - "stmt189": true - } -} +{} diff --git a/parser/testdata/02864_statistics_delayed_materialization_in_merge/metadata.json b/parser/testdata/02864_statistics_delayed_materialization_in_merge/metadata.json index abe45ba24a..0967ef424b 100644 --- a/parser/testdata/02864_statistics_delayed_materialization_in_merge/metadata.json +++ b/parser/testdata/02864_statistics_delayed_materialization_in_merge/metadata.json @@ -1,5 +1 @@ -{ - "explain_todo": { - "stmt27": true - } -} +{} diff --git a/parser/testdata/02864_statistics_usage/metadata.json b/parser/testdata/02864_statistics_usage/metadata.json index a367200361..0967ef424b 100644 --- a/parser/testdata/02864_statistics_usage/metadata.json +++ b/parser/testdata/02864_statistics_usage/metadata.json @@ -1,6 +1 @@ -{ - "explain_todo": { - "stmt19": true, - "stmt20": true - } -} +{} diff --git a/parser/testdata/02960_partition_by_udf/metadata.json b/parser/testdata/02960_partition_by_udf/metadata.json index ef58f80315..0967ef424b 100644 --- a/parser/testdata/02960_partition_by_udf/metadata.json +++ b/parser/testdata/02960_partition_by_udf/metadata.json @@ -1,5 +1 @@ -{ - "explain_todo": { - "stmt2": true - } -} +{} diff --git a/parser/testdata/03033_index_definition_sql_udf_bug/metadata.json b/parser/testdata/03033_index_definition_sql_udf_bug/metadata.json index ef58f80315..0967ef424b 100644 --- a/parser/testdata/03033_index_definition_sql_udf_bug/metadata.json +++ b/parser/testdata/03033_index_definition_sql_udf_bug/metadata.json @@ -1,5 +1 @@ -{ - "explain_todo": { - "stmt2": true - } -} +{} diff --git a/parser/testdata/03071_fix_short_circuit_logic/metadata.json b/parser/testdata/03071_fix_short_circuit_logic/metadata.json index f7c9a031b3..0967ef424b 100644 --- a/parser/testdata/03071_fix_short_circuit_logic/metadata.json +++ b/parser/testdata/03071_fix_short_circuit_logic/metadata.json @@ -1,7 +1 @@ -{ - "explain_todo": { - "stmt1": true, - "stmt2": true, - "stmt3": true - } -} +{} diff --git a/parser/testdata/03206_wasm_module_manage/metadata.json b/parser/testdata/03206_wasm_module_manage/metadata.json index 7b1a632e14..9c4cf918a6 100644 --- a/parser/testdata/03206_wasm_module_manage/metadata.json +++ b/parser/testdata/03206_wasm_module_manage/metadata.json @@ -6,10 +6,7 @@ "stmt112": true, "stmt16": true, "stmt18": true, - "stmt31": true, - "stmt33": true, "stmt57": true, - "stmt59": true, "stmt6": true, "stmt64": true, "stmt66": true, diff --git a/parser/testdata/03215_udf_with_union/metadata.json b/parser/testdata/03215_udf_with_union/metadata.json index ef58f80315..0967ef424b 100644 --- a/parser/testdata/03215_udf_with_union/metadata.json +++ b/parser/testdata/03215_udf_with_union/metadata.json @@ -1,5 +1 @@ -{ - "explain_todo": { - "stmt2": true - } -} +{} diff --git a/parser/testdata/03274_aliases_in_udf/metadata.json b/parser/testdata/03274_aliases_in_udf/metadata.json index 21fc3533ea..0967ef424b 100644 --- a/parser/testdata/03274_aliases_in_udf/metadata.json +++ b/parser/testdata/03274_aliases_in_udf/metadata.json @@ -1,6 +1 @@ -{ - "explain_todo": { - "stmt17": true, - "stmt5": true - } -} +{} diff --git a/parser/testdata/03279_join_choose_build_table_statistics/metadata.json b/parser/testdata/03279_join_choose_build_table_statistics/metadata.json index 5395f06a45..0967ef424b 100644 --- a/parser/testdata/03279_join_choose_build_table_statistics/metadata.json +++ b/parser/testdata/03279_join_choose_build_table_statistics/metadata.json @@ -1,5 +1 @@ -{ - "explain_todo": { - "stmt20": true - } -} +{} diff --git a/parser/testdata/03286_reverse_sorting_key_final/metadata.json b/parser/testdata/03286_reverse_sorting_key_final/metadata.json index fcb05d2f7d..0967ef424b 100644 --- a/parser/testdata/03286_reverse_sorting_key_final/metadata.json +++ b/parser/testdata/03286_reverse_sorting_key_final/metadata.json @@ -1,6 +1 @@ -{ - "explain_todo": { - "stmt17": true, - "stmt6": true - } -} +{} diff --git a/parser/testdata/03286_reverse_sorting_key_final2/metadata.json b/parser/testdata/03286_reverse_sorting_key_final2/metadata.json index f33d7d9f5a..0967ef424b 100644 --- a/parser/testdata/03286_reverse_sorting_key_final2/metadata.json +++ b/parser/testdata/03286_reverse_sorting_key_final2/metadata.json @@ -1,7 +1 @@ -{ - "explain_todo": { - "stmt10": true, - "stmt2": true, - "stmt6": true - } -} +{} diff --git a/parser/testdata/03314_analyzer_resolve_in_parent_scope_4/metadata.json b/parser/testdata/03314_analyzer_resolve_in_parent_scope_4/metadata.json index 342b3ff5b4..0967ef424b 100644 --- a/parser/testdata/03314_analyzer_resolve_in_parent_scope_4/metadata.json +++ b/parser/testdata/03314_analyzer_resolve_in_parent_scope_4/metadata.json @@ -1,5 +1 @@ -{ - "explain_todo": { - "stmt8": true - } -} +{} diff --git a/parser/testdata/03334_aliases_function_infinite_loop/metadata.json b/parser/testdata/03334_aliases_function_infinite_loop/metadata.json index b65b07d7a6..0967ef424b 100644 --- a/parser/testdata/03334_aliases_function_infinite_loop/metadata.json +++ b/parser/testdata/03334_aliases_function_infinite_loop/metadata.json @@ -1,5 +1 @@ -{ - "explain_todo": { - "stmt4": true - } -} +{} diff --git a/parser/testdata/03444_explain_asterisk/metadata.json b/parser/testdata/03444_explain_asterisk/metadata.json index b65b07d7a6..0967ef424b 100644 --- a/parser/testdata/03444_explain_asterisk/metadata.json +++ b/parser/testdata/03444_explain_asterisk/metadata.json @@ -1,5 +1 @@ -{ - "explain_todo": { - "stmt4": true - } -} +{} diff --git a/parser/testdata/03518_bad_sql_udf/metadata.json b/parser/testdata/03518_bad_sql_udf/metadata.json index e9d6e46171..0967ef424b 100644 --- a/parser/testdata/03518_bad_sql_udf/metadata.json +++ b/parser/testdata/03518_bad_sql_udf/metadata.json @@ -1,5 +1 @@ -{ - "explain_todo": { - "stmt1": true - } -} +{} diff --git a/parser/testdata/03625_auto_statistics_alter/metadata.json b/parser/testdata/03625_auto_statistics_alter/metadata.json index 3e377e3ee6..0967ef424b 100644 --- a/parser/testdata/03625_auto_statistics_alter/metadata.json +++ b/parser/testdata/03625_auto_statistics_alter/metadata.json @@ -1,7 +1 @@ -{ - "explain_todo": { - "stmt10": true, - "stmt17": true, - "stmt20": true - } -} +{} diff --git a/parser/testdata/03625_auto_statistics_alter_rmt/metadata.json b/parser/testdata/03625_auto_statistics_alter_rmt/metadata.json index 3e377e3ee6..0967ef424b 100644 --- a/parser/testdata/03625_auto_statistics_alter_rmt/metadata.json +++ b/parser/testdata/03625_auto_statistics_alter_rmt/metadata.json @@ -1,7 +1 @@ -{ - "explain_todo": { - "stmt10": true, - "stmt17": true, - "stmt20": true - } -} +{} diff --git a/parser/testdata/03660_udf_subquery/metadata.json b/parser/testdata/03660_udf_subquery/metadata.json index b65b07d7a6..0967ef424b 100644 --- a/parser/testdata/03660_udf_subquery/metadata.json +++ b/parser/testdata/03660_udf_subquery/metadata.json @@ -1,5 +1 @@ -{ - "explain_todo": { - "stmt4": true - } -} +{} diff --git a/parser/testdata/03668_shard_join_in_reverse_order/metadata.json b/parser/testdata/03668_shard_join_in_reverse_order/metadata.json index ef58f80315..0967ef424b 100644 --- a/parser/testdata/03668_shard_join_in_reverse_order/metadata.json +++ b/parser/testdata/03668_shard_join_in_reverse_order/metadata.json @@ -1,5 +1 @@ -{ - "explain_todo": { - "stmt2": true - } -} +{} diff --git a/parser/testdata/03669_min_max_projection_with_reverse_order_key/metadata.json b/parser/testdata/03669_min_max_projection_with_reverse_order_key/metadata.json index ef58f80315..0967ef424b 100644 --- a/parser/testdata/03669_min_max_projection_with_reverse_order_key/metadata.json +++ b/parser/testdata/03669_min_max_projection_with_reverse_order_key/metadata.json @@ -1,5 +1 @@ -{ - "explain_todo": { - "stmt2": true - } -} +{} diff --git a/parser/testdata/03707_statistics_cache/metadata.json b/parser/testdata/03707_statistics_cache/metadata.json index 96d0ae5f23..0967ef424b 100644 --- a/parser/testdata/03707_statistics_cache/metadata.json +++ b/parser/testdata/03707_statistics_cache/metadata.json @@ -1,14 +1 @@ -{ - "explain_todo": { - "stmt12": true, - "stmt13": true, - "stmt20": true, - "stmt21": true, - "stmt31": true, - "stmt32": true, - "stmt33": true, - "stmt34": true, - "stmt7": true, - "stmt8": true - } -} +{} diff --git a/parser/testdata/03743_fix_estimator_crash/metadata.json b/parser/testdata/03743_fix_estimator_crash/metadata.json index bc5c6edb66..0967ef424b 100644 --- a/parser/testdata/03743_fix_estimator_crash/metadata.json +++ b/parser/testdata/03743_fix_estimator_crash/metadata.json @@ -1,6 +1 @@ -{ - "explain_todo": { - "stmt3": true, - "stmt5": true - } -} +{} diff --git a/parser/testdata/03764_empty_tuple_permutation_bug/metadata.json b/parser/testdata/03764_empty_tuple_permutation_bug/metadata.json index 1295a45747..0967ef424b 100644 --- a/parser/testdata/03764_empty_tuple_permutation_bug/metadata.json +++ b/parser/testdata/03764_empty_tuple_permutation_bug/metadata.json @@ -1,5 +1 @@ -{ - "explain_todo": { - "stmt3": true - } -} +{} diff --git a/parser/testdata/03774_ttl_group_by_lowcardinality/metadata.json b/parser/testdata/03774_ttl_group_by_lowcardinality/metadata.json index ef58f80315..0967ef424b 100644 --- a/parser/testdata/03774_ttl_group_by_lowcardinality/metadata.json +++ b/parser/testdata/03774_ttl_group_by_lowcardinality/metadata.json @@ -1,5 +1 @@ -{ - "explain_todo": { - "stmt2": true - } -} +{} diff --git a/parser/testdata/03788_statistics_part_pruning_partial/metadata.json b/parser/testdata/03788_statistics_part_pruning_partial/metadata.json index d624b76101..0967ef424b 100644 --- a/parser/testdata/03788_statistics_part_pruning_partial/metadata.json +++ b/parser/testdata/03788_statistics_part_pruning_partial/metadata.json @@ -1,6 +1 @@ -{ - "explain_todo": { - "stmt13": true, - "stmt20": true - } -} +{} diff --git a/parser/testdata/03800_assume_not_null_coalesce_if_null_monotonicity_key_condition/metadata.json b/parser/testdata/03800_assume_not_null_coalesce_if_null_monotonicity_key_condition/metadata.json index 8c319158f7..0967ef424b 100644 --- a/parser/testdata/03800_assume_not_null_coalesce_if_null_monotonicity_key_condition/metadata.json +++ b/parser/testdata/03800_assume_not_null_coalesce_if_null_monotonicity_key_condition/metadata.json @@ -1,5 +1 @@ -{ - "explain_todo": { - "stmt48": true - } -} +{} diff --git a/parser/testdata/04053_prewhere_statistics_decimal_overflow/metadata.json b/parser/testdata/04053_prewhere_statistics_decimal_overflow/metadata.json index b65b07d7a6..0967ef424b 100644 --- a/parser/testdata/04053_prewhere_statistics_decimal_overflow/metadata.json +++ b/parser/testdata/04053_prewhere_statistics_decimal_overflow/metadata.json @@ -1,5 +1 @@ -{ - "explain_todo": { - "stmt4": true - } -} +{} diff --git a/parser/testdata/04064_bare_function_name_as_lambda/metadata.json b/parser/testdata/04064_bare_function_name_as_lambda/metadata.json index bf42a54db0..0967ef424b 100644 --- a/parser/testdata/04064_bare_function_name_as_lambda/metadata.json +++ b/parser/testdata/04064_bare_function_name_as_lambda/metadata.json @@ -1,6 +1 @@ -{ - "explain_todo": { - "stmt21": true, - "stmt24": true - } -} +{} diff --git a/parser/testdata/04076_allow_statistics_blocks_add_drop/metadata.json b/parser/testdata/04076_allow_statistics_blocks_add_drop/metadata.json index 3c17446e87..0967ef424b 100644 --- a/parser/testdata/04076_allow_statistics_blocks_add_drop/metadata.json +++ b/parser/testdata/04076_allow_statistics_blocks_add_drop/metadata.json @@ -1,7 +1 @@ -{ - "explain_todo": { - "stmt5": true, - "stmt6": true, - "stmt8": true - } -} +{} diff --git a/parser/testdata/04105_key_condition_nested_lc_variant/metadata.json b/parser/testdata/04105_key_condition_nested_lc_variant/metadata.json index b65b07d7a6..0967ef424b 100644 --- a/parser/testdata/04105_key_condition_nested_lc_variant/metadata.json +++ b/parser/testdata/04105_key_condition_nested_lc_variant/metadata.json @@ -1,5 +1 @@ -{ - "explain_todo": { - "stmt4": true - } -} +{} diff --git a/parser/testdata/04201_inverse_dictionary_lookup_edge_cases/metadata.json b/parser/testdata/04201_inverse_dictionary_lookup_edge_cases/metadata.json index 09460446df..0967ef424b 100644 --- a/parser/testdata/04201_inverse_dictionary_lookup_edge_cases/metadata.json +++ b/parser/testdata/04201_inverse_dictionary_lookup_edge_cases/metadata.json @@ -1,7 +1 @@ -{ - "explain_todo": { - "stmt108": true, - "stmt54": true, - "stmt93": true - } -} +{} diff --git a/parser/testdata/04212_system_functions_arity_determinism/metadata.json b/parser/testdata/04212_system_functions_arity_determinism/metadata.json index 9be7220609..0967ef424b 100644 --- a/parser/testdata/04212_system_functions_arity_determinism/metadata.json +++ b/parser/testdata/04212_system_functions_arity_determinism/metadata.json @@ -1,5 +1 @@ -{ - "explain_todo": { - "stmt22": true - } -} +{} diff --git a/parser/testdata/04214_create_function_normalized_union_query/metadata.json b/parser/testdata/04214_create_function_normalized_union_query/metadata.json index b803898e71..0967ef424b 100644 --- a/parser/testdata/04214_create_function_normalized_union_query/metadata.json +++ b/parser/testdata/04214_create_function_normalized_union_query/metadata.json @@ -1,8 +1 @@ -{ - "explain_todo": { - "stmt11": true, - "stmt5": true, - "stmt7": true, - "stmt9": true - } -} +{} diff --git a/parser/testdata/04251_stid_2635_empty_pipe_reverse_order/metadata.json b/parser/testdata/04251_stid_2635_empty_pipe_reverse_order/metadata.json index ef382ce51e..0967ef424b 100644 --- a/parser/testdata/04251_stid_2635_empty_pipe_reverse_order/metadata.json +++ b/parser/testdata/04251_stid_2635_empty_pipe_reverse_order/metadata.json @@ -1,6 +1 @@ -{ - "explain_todo": { - "stmt4": true, - "stmt5": true - } -} +{} diff --git a/parser/testdata/04266_statistics_basic_prewhere/metadata.json b/parser/testdata/04266_statistics_basic_prewhere/metadata.json index b15cba9418..0967ef424b 100644 --- a/parser/testdata/04266_statistics_basic_prewhere/metadata.json +++ b/parser/testdata/04266_statistics_basic_prewhere/metadata.json @@ -1,10 +1 @@ -{ - "explain_todo": { - "stmt13": true, - "stmt14": true, - "stmt44": true, - "stmt45": true, - "stmt52": true, - "stmt53": true - } -} +{} diff --git a/parser/testdata/04280_udf_normalizer_dangling_source_columns/metadata.json b/parser/testdata/04280_udf_normalizer_dangling_source_columns/metadata.json index ef58f80315..0967ef424b 100644 --- a/parser/testdata/04280_udf_normalizer_dangling_source_columns/metadata.json +++ b/parser/testdata/04280_udf_normalizer_dangling_source_columns/metadata.json @@ -1,5 +1 @@ -{ - "explain_todo": { - "stmt2": true - } -} +{} diff --git a/parser/testdata/04304_lazy_crash_2/metadata.json b/parser/testdata/04304_lazy_crash_2/metadata.json index ef58f80315..0967ef424b 100644 --- a/parser/testdata/04304_lazy_crash_2/metadata.json +++ b/parser/testdata/04304_lazy_crash_2/metadata.json @@ -1,5 +1 @@ -{ - "explain_todo": { - "stmt2": true - } -} +{} diff --git a/parser/testdata/04304_prewhere_statistics_column_grouping/metadata.json b/parser/testdata/04304_prewhere_statistics_column_grouping/metadata.json index 342b3ff5b4..0967ef424b 100644 --- a/parser/testdata/04304_prewhere_statistics_column_grouping/metadata.json +++ b/parser/testdata/04304_prewhere_statistics_column_grouping/metadata.json @@ -1,5 +1 @@ -{ - "explain_todo": { - "stmt8": true - } -} +{} diff --git a/parser/testdata/04312_reverse_key_obsolete_setting/metadata.json b/parser/testdata/04312_reverse_key_obsolete_setting/metadata.json index 323c7c4c53..0967ef424b 100644 --- a/parser/testdata/04312_reverse_key_obsolete_setting/metadata.json +++ b/parser/testdata/04312_reverse_key_obsolete_setting/metadata.json @@ -1,6 +1 @@ -{ - "explain_todo": { - "stmt2": true, - "stmt6": true - } -} +{} diff --git a/parser/testdata/04316_limit_by_in_order_reverse_key/metadata.json b/parser/testdata/04316_limit_by_in_order_reverse_key/metadata.json index 0ad1b1778d..0967ef424b 100644 --- a/parser/testdata/04316_limit_by_in_order_reverse_key/metadata.json +++ b/parser/testdata/04316_limit_by_in_order_reverse_key/metadata.json @@ -1,7 +1 @@ -{ - "explain_todo": { - "stmt13": true, - "stmt3": true, - "stmt44": true - } -} +{} diff --git a/parser/testdata/04322_106474_session_timezone_lowcardinality_datetime/metadata.json b/parser/testdata/04322_106474_session_timezone_lowcardinality_datetime/metadata.json index b65b07d7a6..0967ef424b 100644 --- a/parser/testdata/04322_106474_session_timezone_lowcardinality_datetime/metadata.json +++ b/parser/testdata/04322_106474_session_timezone_lowcardinality_datetime/metadata.json @@ -1,5 +1 @@ -{ - "explain_todo": { - "stmt4": true - } -} +{} diff --git a/parser/testdata/04322_limit_by_monotonic_desc_key/metadata.json b/parser/testdata/04322_limit_by_monotonic_desc_key/metadata.json index 1295a45747..0967ef424b 100644 --- a/parser/testdata/04322_limit_by_monotonic_desc_key/metadata.json +++ b/parser/testdata/04322_limit_by_monotonic_desc_key/metadata.json @@ -1,5 +1 @@ -{ - "explain_todo": { - "stmt3": true - } -} +{} diff --git a/parser/testdata/04322_memory_mutate_no_op_commands_2380_3043/metadata.json b/parser/testdata/04322_memory_mutate_no_op_commands_2380_3043/metadata.json index c45b7602ba..0967ef424b 100644 --- a/parser/testdata/04322_memory_mutate_no_op_commands_2380_3043/metadata.json +++ b/parser/testdata/04322_memory_mutate_no_op_commands_2380_3043/metadata.json @@ -1,5 +1 @@ -{ - "explain_todo": { - "stmt12": true - } -} +{} diff --git a/parser/testdata/04326_create_or_replace_size_check_pre_flight/metadata.json b/parser/testdata/04326_create_or_replace_size_check_pre_flight/metadata.json index 6e29f7f5f9..0967ef424b 100644 --- a/parser/testdata/04326_create_or_replace_size_check_pre_flight/metadata.json +++ b/parser/testdata/04326_create_or_replace_size_check_pre_flight/metadata.json @@ -1,7 +1 @@ -{ - "explain_todo": { - "stmt12": true, - "stmt4": true, - "stmt8": true - } -} +{} diff --git a/parser/testdata/04329_array_tuple_fill_missing_column_bad_cast/metadata.json b/parser/testdata/04329_array_tuple_fill_missing_column_bad_cast/metadata.json index 9438414527..0967ef424b 100644 --- a/parser/testdata/04329_array_tuple_fill_missing_column_bad_cast/metadata.json +++ b/parser/testdata/04329_array_tuple_fill_missing_column_bad_cast/metadata.json @@ -1,6 +1 @@ -{ - "explain_todo": { - "stmt10": true, - "stmt18": true - } -} +{} diff --git a/parser/testdata/04344_server_ast_fuzzer_insert_limit/metadata.json b/parser/testdata/04344_server_ast_fuzzer_insert_limit/metadata.json index 62b81668c3..0967ef424b 100644 --- a/parser/testdata/04344_server_ast_fuzzer_insert_limit/metadata.json +++ b/parser/testdata/04344_server_ast_fuzzer_insert_limit/metadata.json @@ -1,5 +1 @@ -{ - "explain_todo": { - "stmt13": true - } -} +{} diff --git a/parser/testdata/04368_mergetree_projection_table_function_row_policy/metadata.json b/parser/testdata/04368_mergetree_projection_table_function_row_policy/metadata.json index e0698860e7..0967ef424b 100644 --- a/parser/testdata/04368_mergetree_projection_table_function_row_policy/metadata.json +++ b/parser/testdata/04368_mergetree_projection_table_function_row_policy/metadata.json @@ -1,5 +1 @@ -{ - "explain_todo": { - "stmt145": true - } -} +{} diff --git a/parser/testdata/04545_prewhere_final_summing_implicit_bool_key/metadata.json b/parser/testdata/04545_prewhere_final_summing_implicit_bool_key/metadata.json index b32bb991ba..0967ef424b 100644 --- a/parser/testdata/04545_prewhere_final_summing_implicit_bool_key/metadata.json +++ b/parser/testdata/04545_prewhere_final_summing_implicit_bool_key/metadata.json @@ -1,7 +1 @@ -{ - "explain_todo": { - "stmt17": true, - "stmt25": true, - "stmt7": true - } -} +{} diff --git a/parser/testdata/04611_bool_literal_to_string_const_eval/metadata.json b/parser/testdata/04611_bool_literal_to_string_const_eval/metadata.json index 3a06a4a1ac..0967ef424b 100644 --- a/parser/testdata/04611_bool_literal_to_string_const_eval/metadata.json +++ b/parser/testdata/04611_bool_literal_to_string_const_eval/metadata.json @@ -1,5 +1 @@ -{ - "explain_todo": { - "stmt5": true - } -} +{} diff --git a/parser/testdata/04612_reverse_key_index_analysis/metadata.json b/parser/testdata/04612_reverse_key_index_analysis/metadata.json index 85cc99e9fa..0967ef424b 100644 --- a/parser/testdata/04612_reverse_key_index_analysis/metadata.json +++ b/parser/testdata/04612_reverse_key_index_analysis/metadata.json @@ -1,5 +1 @@ -{ - "explain_todo": { - "stmt34": true - } -} +{} diff --git a/parser/testdata/04627_prewhere_final_sorting_key_not_projected/metadata.json b/parser/testdata/04627_prewhere_final_sorting_key_not_projected/metadata.json index e4bea16ff9..0967ef424b 100644 --- a/parser/testdata/04627_prewhere_final_sorting_key_not_projected/metadata.json +++ b/parser/testdata/04627_prewhere_final_sorting_key_not_projected/metadata.json @@ -1,9 +1 @@ -{ - "explain_todo": { - "stmt17": true, - "stmt24": true, - "stmt31": true, - "stmt38": true, - "stmt7": true - } -} +{} diff --git a/parser/testdata/04628_join_runtime_filter_reverse_key/metadata.json b/parser/testdata/04628_join_runtime_filter_reverse_key/metadata.json index 62b81668c3..0967ef424b 100644 --- a/parser/testdata/04628_join_runtime_filter_reverse_key/metadata.json +++ b/parser/testdata/04628_join_runtime_filter_reverse_key/metadata.json @@ -1,5 +1 @@ -{ - "explain_todo": { - "stmt13": true - } -} +{} diff --git a/parser/testdata/04652_schema_inference_float_parser_parity/metadata.json b/parser/testdata/04652_schema_inference_float_parser_parity/metadata.json index 8c319158f7..0967ef424b 100644 --- a/parser/testdata/04652_schema_inference_float_parser_parity/metadata.json +++ b/parser/testdata/04652_schema_inference_float_parser_parity/metadata.json @@ -1,5 +1 @@ -{ - "explain_todo": { - "stmt48": true - } -} +{} diff --git a/parser/testdata/04812_codec_chain_reserve_overflow/metadata.json b/parser/testdata/04812_codec_chain_reserve_overflow/metadata.json index 183ae84c87..0967ef424b 100644 --- a/parser/testdata/04812_codec_chain_reserve_overflow/metadata.json +++ b/parser/testdata/04812_codec_chain_reserve_overflow/metadata.json @@ -1,6 +1 @@ -{ - "explain_todo": { - "stmt50": true, - "stmt53": true - } -} +{} diff --git a/parser/testdata/04839_column_declaration_statistics_engine_gate/metadata.json b/parser/testdata/04839_column_declaration_statistics_engine_gate/metadata.json index 9640c87a23..3a06a4a1ac 100644 --- a/parser/testdata/04839_column_declaration_statistics_engine_gate/metadata.json +++ b/parser/testdata/04839_column_declaration_statistics_engine_gate/metadata.json @@ -1,7 +1,5 @@ { "explain_todo": { - "stmt21": true, - "stmt5": true, - "stmt7": true + "stmt5": true } } diff --git a/parser/testdata/05175_materialize_statistics_session_gate/metadata.json b/parser/testdata/05175_materialize_statistics_session_gate/metadata.json index e47c967938..0967ef424b 100644 --- a/parser/testdata/05175_materialize_statistics_session_gate/metadata.json +++ b/parser/testdata/05175_materialize_statistics_session_gate/metadata.json @@ -1,6 +1 @@ -{ - "explain_todo": { - "stmt11": true, - "stmt6": true - } -} +{} diff --git a/parser/testdata/05233_assume_not_null_nullable_partition_key_pruning/metadata.json b/parser/testdata/05233_assume_not_null_nullable_partition_key_pruning/metadata.json index fec152526a..0967ef424b 100644 --- a/parser/testdata/05233_assume_not_null_nullable_partition_key_pruning/metadata.json +++ b/parser/testdata/05233_assume_not_null_nullable_partition_key_pruning/metadata.json @@ -1,5 +1 @@ -{ - "explain_todo": { - "stmt32": true - } -} +{} diff --git a/parser/testdata/05444_ai_functions_no_user/metadata.json b/parser/testdata/05444_ai_functions_no_user/metadata.json index 1390321eeb..8c319158f7 100644 --- a/parser/testdata/05444_ai_functions_no_user/metadata.json +++ b/parser/testdata/05444_ai_functions_no_user/metadata.json @@ -1,6 +1,5 @@ { "explain_todo": { - "stmt29": true, "stmt48": true } } From caac42bf9c5d6a17fe7e670a977b2b85cbe23d6d Mon Sep 17 00:00:00 2001 From: Claude Date: Tue, 1 Dec 2026 06:39:34 +0000 Subject: [PATCH 3/4] LIMIT n BY ALL Co-Authored-By: Claude Opus 5.5 Claude-Session: https://claude.ai/code/session_01LuRZ4KB7DMX365Nmn5ksnY --- ast/ast.go | 1 + internal/explain/select.go | 26 ++++++++++++----- parser/parser.go | 14 ++++++++-- .../testdata/03570_limit_by_all/metadata.json | 28 +------------------ .../metadata.json | 6 +--- .../metadata.json | 7 +---- .../metadata.json | 6 +--- .../metadata.json | 6 +--- 8 files changed, 36 insertions(+), 58 deletions(-) diff --git a/ast/ast.go b/ast/ast.go index a2d6bffc2f..04c0999c01 100644 --- a/ast/ast.go +++ b/ast/ast.go @@ -86,6 +86,7 @@ type SelectQuery struct { LimitByLimit Expression `json:"limit_by_limit,omitempty"` // LIMIT value before BY (e.g., LIMIT 1 BY x LIMIT 3) LimitByOffset Expression `json:"limit_by_offset,omitempty"` // Offset for LIMIT BY (e.g., LIMIT 2, 3 BY x -> offset=2) LimitByHasLimit bool `json:"limit_by_has_limit,omitempty"` // true if LIMIT BY was followed by another LIMIT + LimitByAll bool `json:"limit_by_all,omitempty"` // LIMIT n BY ALL Offset Expression `json:"offset,omitempty"` Settings []*SettingExpr `json:"settings,omitempty"` SettingsAfterFormat bool `json:"settings_after_format,omitempty"` // true if SETTINGS came after FORMAT (at union level) diff --git a/internal/explain/select.go b/internal/explain/select.go index 7d465e8a49..3c6a44a7f1 100644 --- a/internal/explain/select.go +++ b/internal/explain/select.go @@ -161,7 +161,9 @@ func explainSelectQueryWithInheritedWith(sb *strings.Builder, stmt ast.Statement // Output LIMIT BY count Node(sb, sq.LimitByLimit, depth+1) // Output LIMIT BY expressions - if len(sq.LimitBy) > 0 { + if sq.LimitByAll { + fmt.Fprintf(sb, "%s ExpressionList\n", indent) + } else if len(sq.LimitBy) > 0 || sq.LimitByAll { fmt.Fprintf(sb, "%s ExpressionList (children %d)\n", indent, len(sq.LimitBy)) for _, expr := range sq.LimitBy { Node(sb, expr, depth+2) @@ -175,12 +177,16 @@ func explainSelectQueryWithInheritedWith(sb *strings.Builder, stmt ast.Statement if sq.Limit != nil { Node(sb, sq.Limit, depth+1) } - } else if len(sq.LimitBy) > 0 { + } else if len(sq.LimitBy) > 0 || sq.LimitByAll { // LIMIT BY without explicit LimitByLimit if sq.Limit != nil { Node(sb, sq.Limit, depth+1) } - fmt.Fprintf(sb, "%s ExpressionList (children %d)\n", indent, len(sq.LimitBy)) + if sq.LimitByAll { + fmt.Fprintf(sb, "%s ExpressionList\n", indent) + } else { + fmt.Fprintf(sb, "%s ExpressionList (children %d)\n", indent, len(sq.LimitBy)) + } for _, expr := range sq.LimitBy { Node(sb, expr, depth+2) } @@ -494,7 +500,9 @@ func explainSelectQuery(sb *strings.Builder, n *ast.SelectQuery, indent string, // Output LIMIT BY count Node(sb, n.LimitByLimit, depth+1) // Output LIMIT BY expressions - if len(n.LimitBy) > 0 { + if n.LimitByAll { + fmt.Fprintf(sb, "%s ExpressionList\n", indent) + } else if len(n.LimitBy) > 0 || n.LimitByAll { fmt.Fprintf(sb, "%s ExpressionList (children %d)\n", indent, len(n.LimitBy)) for _, expr := range n.LimitBy { Node(sb, expr, depth+2) @@ -508,12 +516,16 @@ func explainSelectQuery(sb *strings.Builder, n *ast.SelectQuery, indent string, if n.Limit != nil { Node(sb, n.Limit, depth+1) } - } else if len(n.LimitBy) > 0 { + } else if len(n.LimitBy) > 0 || n.LimitByAll { // LIMIT BY without explicit LimitByLimit if n.Limit != nil { Node(sb, n.Limit, depth+1) } - fmt.Fprintf(sb, "%s ExpressionList (children %d)\n", indent, len(n.LimitBy)) + if n.LimitByAll { + fmt.Fprintf(sb, "%s ExpressionList\n", indent) + } else { + fmt.Fprintf(sb, "%s ExpressionList (children %d)\n", indent, len(n.LimitBy)) + } for _, expr := range n.LimitBy { Node(sb, expr, depth+2) } @@ -865,7 +877,7 @@ func countSelectQueryChildren(n *ast.SelectQuery) int { if n.Limit != nil { count++ } - if len(n.LimitBy) > 0 { + if len(n.LimitBy) > 0 || n.LimitByAll { count++ } if n.Offset != nil { diff --git a/parser/parser.go b/parser/parser.go index 0d93173af0..8dae87b198 100644 --- a/parser/parser.go +++ b/parser/parser.go @@ -1290,7 +1290,11 @@ func (p *Parser) parseSelectInternal(preParsedWith []ast.Expression) *ast.Select sel.Limit = nil } // Parse LIMIT BY expressions - for !p.isEndOfExpression() { + if p.currentIs(token.ALL) && !p.peekIs(token.LPAREN) && !p.peekIs(token.DOT) { + p.nextToken() + sel.LimitByAll = true + } + for !sel.LimitByAll && !p.isEndOfExpression() { expr := p.parseExpression(LOWEST) sel.LimitBy = append(sel.LimitBy, expr) if p.currentIs(token.COMMA) { @@ -1329,7 +1333,7 @@ func (p *Parser) parseSelectInternal(preParsedWith []ast.Expression) *ast.Select p.nextToken() } // LIMIT n OFFSET m BY expr syntax - handle BY after OFFSET - if p.currentIs(token.BY) && sel.Limit != nil && len(sel.LimitBy) == 0 { + if p.currentIs(token.BY) && sel.Limit != nil && len(sel.LimitBy) == 0 && !sel.LimitByAll { p.nextToken() // Move Limit and Offset to LimitByLimit and LimitByOffset sel.LimitByLimit = sel.Limit @@ -1337,7 +1341,11 @@ func (p *Parser) parseSelectInternal(preParsedWith []ast.Expression) *ast.Select sel.Limit = nil sel.Offset = nil // Parse LIMIT BY expressions - for !p.isEndOfExpression() { + if p.currentIs(token.ALL) && !p.peekIs(token.LPAREN) && !p.peekIs(token.DOT) { + p.nextToken() + sel.LimitByAll = true + } + for !sel.LimitByAll && !p.isEndOfExpression() { expr := p.parseExpression(LOWEST) sel.LimitBy = append(sel.LimitBy, expr) if p.currentIs(token.COMMA) { diff --git a/parser/testdata/03570_limit_by_all/metadata.json b/parser/testdata/03570_limit_by_all/metadata.json index 3ae49697ca..0967ef424b 100644 --- a/parser/testdata/03570_limit_by_all/metadata.json +++ b/parser/testdata/03570_limit_by_all/metadata.json @@ -1,27 +1 @@ -{ - "explain_todo": { - "stmt10": true, - "stmt11": true, - "stmt13": true, - "stmt14": true, - "stmt15": true, - "stmt16": true, - "stmt17": true, - "stmt18": true, - "stmt19": true, - "stmt20": true, - "stmt21": true, - "stmt22": true, - "stmt23": true, - "stmt24": true, - "stmt25": true, - "stmt29": true, - "stmt30": true, - "stmt32": true, - "stmt39": true, - "stmt40": true, - "stmt42": true, - "stmt8": true, - "stmt9": true - } -} +{} diff --git a/parser/testdata/03571_limit_by_all_old_planner/metadata.json b/parser/testdata/03571_limit_by_all_old_planner/metadata.json index 342b3ff5b4..0967ef424b 100644 --- a/parser/testdata/03571_limit_by_all_old_planner/metadata.json +++ b/parser/testdata/03571_limit_by_all_old_planner/metadata.json @@ -1,5 +1 @@ -{ - "explain_todo": { - "stmt8": true - } -} +{} diff --git a/parser/testdata/03921_quoted_all_column_in_order_group_limit_by/metadata.json b/parser/testdata/03921_quoted_all_column_in_order_group_limit_by/metadata.json index faefb5fc59..0967ef424b 100644 --- a/parser/testdata/03921_quoted_all_column_in_order_group_limit_by/metadata.json +++ b/parser/testdata/03921_quoted_all_column_in_order_group_limit_by/metadata.json @@ -1,6 +1 @@ -{ - "explain_todo": { - "stmt12": true, - "stmt13": true - } -} +{} diff --git a/parser/testdata/04330_join_global_left_semi_chunk_consistency/metadata.json b/parser/testdata/04330_join_global_left_semi_chunk_consistency/metadata.json index ef58f80315..0967ef424b 100644 --- a/parser/testdata/04330_join_global_left_semi_chunk_consistency/metadata.json +++ b/parser/testdata/04330_join_global_left_semi_chunk_consistency/metadata.json @@ -1,5 +1 @@ -{ - "explain_todo": { - "stmt2": true - } -} +{} diff --git a/parser/testdata/04372_trivial_view_pushdown_group_by_all/metadata.json b/parser/testdata/04372_trivial_view_pushdown_group_by_all/metadata.json index c45b7602ba..0967ef424b 100644 --- a/parser/testdata/04372_trivial_view_pushdown_group_by_all/metadata.json +++ b/parser/testdata/04372_trivial_view_pushdown_group_by_all/metadata.json @@ -1,5 +1 @@ -{ - "explain_todo": { - "stmt12": true - } -} +{} From c023c0ee4630cfcbaef60daf1bbf65c87f178f2e Mon Sep 17 00:00:00 2001 From: Claude Date: Tue, 1 Dec 2026 06:43:55 +0000 Subject: [PATCH 4/4] Regex operators, parenthesized joins, trim(s, chars), eval(SELECT), DELETE db.table, WITH trailing comma Co-Authored-By: Claude Opus 5.5 Claude-Session: https://claude.ai/code/session_01LuRZ4KB7DMX365Nmn5ksnY --- internal/explain/functions.go | 16 -------- internal/explain/select.go | 20 +++++++++- internal/explain/statements.go | 8 +++- lexer/lexer.go | 16 ++++++++ parser/expression.go | 40 +++++++++++++++++-- parser/parser.go | 24 +++++++++-- .../03206_wasm_module_manage/metadata.json | 26 +----------- .../03224_trim_empty_string/metadata.json | 11 +---- .../03715_projection_settings/metadata.json | 6 +-- .../metadata.json | 9 +---- .../metadata.json | 6 +-- .../metadata.json | 9 +---- .../metadata.json | 8 +--- .../metadata.json | 7 +--- .../04070_with_trailing_comma/metadata.json | 14 +------ .../04512_eval_table_function/metadata.json | 13 +----- .../metadata.json | 15 +------ .../metadata.json | 16 -------- token/token.go | 2 + 19 files changed, 111 insertions(+), 155 deletions(-) diff --git a/internal/explain/functions.go b/internal/explain/functions.go index edef0afe9d..75a246d49f 100644 --- a/internal/explain/functions.go +++ b/internal/explain/functions.go @@ -267,22 +267,6 @@ func handleSpecialFunction(sb *strings.Builder, n *ast.FunctionCall, alias strin return handleDateDiff(sb, n, alias, indent, depth) } - // TRIM functions with empty string as trim characters - simplify to just the string - // Only for SQL standard syntax: trim(LEADING '' FROM 'foo') -> just 'foo' - // Direct function calls like trimLeft('foo', '') are NOT simplified - if n.SQLStandard && (fnName == "TRIM" || fnName == "LTRIM" || fnName == "RTRIM" || - fnName == "TRIMLEFT" || fnName == "TRIMRIGHT" || fnName == "TRIMBOTH") { - if len(n.Arguments) == 2 { - if lit, ok := n.Arguments[1].(*ast.Literal); ok { - if lit.Type == ast.LiteralString && lit.Value == "" { - // Trim with empty string is a no-op, just output the original string - Node(sb, n.Arguments[0], depth) - return true - } - } - } - } - return false } diff --git a/internal/explain/select.go b/internal/explain/select.go index 3c6a44a7f1..73b5fbc183 100644 --- a/internal/explain/select.go +++ b/internal/explain/select.go @@ -83,9 +83,25 @@ func explainSelectQueryWithInheritedWith(sb *strings.Builder, stmt ast.Statement return } - // If the SelectQuery already has a WITH clause, output normally + // If the SelectQuery already has a WITH clause, the inherited elements + // it does not redefine are appended to it if len(sq.With) > 0 { - Node(sb, stmt, depth) + own := map[string]bool{} + for _, w := range sq.With { + if we, ok := w.(*ast.WithElement); ok { + own[we.Name] = true + } + } + merged := append([]ast.Expression(nil), sq.With...) + for _, w := range inheritedWith { + if we, ok := w.(*ast.WithElement); ok && own[we.Name] { + continue + } + merged = append(merged, w) + } + cp := *sq + cp.With = merged + Node(sb, &cp, depth) return } diff --git a/internal/explain/statements.go b/internal/explain/statements.go index 86c11b493b..7792192383 100644 --- a/internal/explain/statements.go +++ b/internal/explain/statements.go @@ -2448,6 +2448,9 @@ func explainDeleteQuery(sb *strings.Builder, n *ast.DeleteQuery, indent string, // Count children: Partition + Where expression + table identifier + settings children := 1 // table identifier + if n.Database != "" { + children++ + } if n.Partition != nil { children++ } @@ -2458,7 +2461,7 @@ func explainDeleteQuery(sb *strings.Builder, n *ast.DeleteQuery, indent string, children++ } - fmt.Fprintf(sb, "%sDeleteQuery %s (children %d)\n", indent, n.Table, children) + fmt.Fprintf(sb, "%sDeleteQuery %s %s (children %d)\n", indent, n.Database, n.Table, children) // Output order: Partition, Where, Table identifier, Settings if n.Partition != nil { fmt.Fprintf(sb, "%s Partition (children 1)\n", indent) @@ -2467,6 +2470,9 @@ func explainDeleteQuery(sb *strings.Builder, n *ast.DeleteQuery, indent string, if n.Where != nil { Node(sb, n.Where, depth+1) } + if n.Database != "" { + fmt.Fprintf(sb, "%s Identifier %s\n", indent, n.Database) + } fmt.Fprintf(sb, "%s Identifier %s\n", indent, n.Table) if len(n.Settings) > 0 { fmt.Fprintf(sb, "%s Set\n", indent) diff --git a/lexer/lexer.go b/lexer/lexer.go index a0b3697167..3234b933eb 100644 --- a/lexer/lexer.go +++ b/lexer/lexer.go @@ -231,8 +231,24 @@ func (l *Lexer) NextToken() Item { l.readChar() return Item{Token: token.NEQ, Value: "!=", Pos: pos} } + if l.peekChar() == '~' { + l.readChar() + l.readChar() + if l.ch == '*' { + l.readChar() + return Item{Token: token.REGEX_OP, Value: "!~*", Pos: pos} + } + return Item{Token: token.REGEX_OP, Value: "!~", Pos: pos} + } l.readChar() return Item{Token: token.ILLEGAL, Value: "!", Pos: pos} + case '~': + l.readChar() + if l.ch == '*' { + l.readChar() + return Item{Token: token.REGEX_OP, Value: "~*", Pos: pos} + } + return Item{Token: token.REGEX_OP, Value: "~", Pos: pos} case '<': if l.peekChar() == '=' { l.readChar() diff --git a/parser/expression.go b/parser/expression.go index da222bef5d..179553b373 100644 --- a/parser/expression.go +++ b/parser/expression.go @@ -58,7 +58,7 @@ func (p *Parser) precedence(tok token.Token) int { return NOT_PREC case token.EQ, token.NEQ, token.LT, token.GT, token.LTE, token.GTE, token.LIKE, token.ILIKE, token.REGEXP, token.IN, token.BETWEEN, token.IS, - token.NULL_SAFE_EQ, token.GLOBAL: + token.NULL_SAFE_EQ, token.GLOBAL, token.REGEX_OP: return COMPARE case token.QUESTION: return TERNARY_PREC // Ternary operator has very low precedence @@ -260,6 +260,10 @@ func (p *Parser) isClauseKeyword() bool { // If followed by comma, it's likely an identifier in a list return !p.peekIs(token.LPAREN) && !p.peekIs(token.LBRACKET) && !p.peekIs(token.COMMA) && !p.peekIs(token.RPAREN) case token.INTO, token.SETTINGS, token.FORMAT: + // "settings FROM" names a column + if p.currentIs(token.SETTINGS) && p.peekIs(token.FROM) { + return false + } return !p.peekIs(token.LPAREN) && !p.peekIs(token.LBRACKET) && !p.peekIs(token.EQ) && !p.peekIs(token.COMMA) && !p.peekIs(token.RPAREN) // UNION, EXCEPT, INTERSECT, OFFSET are often used as identifiers // Don't treat them as clause terminators to avoid breaking valid code @@ -593,6 +597,8 @@ func (p *Parser) parseInfixExpression(left ast.Expression) ast.Expression { return p.parseLikeExpression(left, false) case token.REGEXP: return p.parseRegexpExpression(left, false) + case token.REGEX_OP: + return p.parseRegexOperator(left) case token.NOT: // NOT IN, NOT LIKE, NOT BETWEEN, NOT REGEXP, IS NOT p.nextToken() @@ -839,7 +845,7 @@ func (p *Parser) parseFunctionCall(name string, pos token.Position) *ast.Functio // Handle view() and similar functions that take a subquery as argument // view(SELECT ...) should parse SELECT as a subquery - if strings.ToLower(name) == "view" && (p.isQueryStart()) { + if (strings.EqualFold(name, "view") || strings.EqualFold(name, "eval")) && (p.isQueryStart()) { subquery := p.parseSelectWithUnion() fn.Arguments = []ast.Expression{&ast.Subquery{Position: pos, Query: subquery}} } else if !p.currentIs(token.RPAREN) && !(p.isSettingsClauseInArgs()) { @@ -2044,7 +2050,12 @@ func (p *Parser) parseSubstring() ast.Expression { func (p *Parser) parseTrim() ast.Expression { pos := p.current.Pos p.nextToken() // skip TRIM + return p.parseTrimCall(pos) +} +// parseTrimCall parses the parenthesized arguments of TRIM, with the +// current token at "(". +func (p *Parser) parseTrimCall(pos token.Position) ast.Expression { if !p.expect(token.LPAREN) { return nil } @@ -2085,7 +2096,12 @@ func (p *Parser) parseTrim() ast.Expression { // FROM clause var expr ast.Expression - if p.currentIs(token.FROM) { + if trimType == "" && trimChars != nil && p.currentIs(token.COMMA) { + // trim(s, chars) + p.nextToken() + expr = trimChars + trimChars = p.parseExpression(LOWEST) + } else if p.currentIs(token.FROM) { p.nextToken() // Parse expression with possible alias expr = p.parseExpression(ALIAS_PREC) @@ -2998,7 +3014,7 @@ func (p *Parser) parseKeywordAsFunction() ast.Expression { } // Handle view() and similar functions that take a subquery as argument - if name == "view" && (p.isQueryStart()) { + if (name == "view" || name == "eval") && (p.isQueryStart()) { subquery := p.parseSelectWithUnion() fn.Arguments = []ast.Expression{&ast.Subquery{Position: pos, Query: subquery}} } else if !p.currentIs(token.RPAREN) { @@ -3623,3 +3639,19 @@ func collectIdentifierNames(v reflect.Value, out map[string]bool) { } } } + +// parseRegexOperator parses the PostgreSQL-style regular expression +// operators: ~ (match), ~* (matchCaseInsensitive), !~ (notMatch) and !~* +// (notMatchCaseInsensitive). +func (p *Parser) parseRegexOperator(left ast.Expression) ast.Expression { + pos := p.current.Pos + name := map[string]string{"~": "match", "~*": "matchCaseInsensitive", "!~": "notMatch", "!~*": "notMatchCaseInsensitive"}[p.current.Value] + p.nextToken() + build := func(l, r ast.Expression) ast.Expression { + return &ast.FunctionCall{Position: pos, Name: name, Arguments: []ast.Expression{l, r}} + } + if p.isArrayQuantifier() { + return p.parseArrayQuantifier(left, name, build) + } + return build(left, p.parseExpression(COMPARE)) +} diff --git a/parser/parser.go b/parser/parser.go index 8dae87b198..70e196eb75 100644 --- a/parser/parser.go +++ b/parser/parser.go @@ -1576,6 +1576,10 @@ func (p *Parser) parseWithClause() []ast.Expression { break } p.nextToken() + // A trailing comma before SELECT ends the list + if p.currentIs(token.SELECT) { + break + } } return elements @@ -1831,8 +1835,20 @@ func (p *Parser) parseTableExpression() *ast.TableExpression { // (VALUES (1, 'a'), (2, 'b')) is SELECT * FROM SQLStandardValues(...) expr.Table = &ast.Subquery{Query: p.parseStandardValues()} } else { - // Table function or expression - expr.Table = p.parseExpression(LOWEST) + // A parenthesized list of joined tables is SELECT * FROM + tables := p.parseTablesInSelect() + if len(tables.Tables) == 1 && tables.Tables[0].Table != nil && tables.Tables[0].Join == nil { + expr.Table = tables.Tables[0].Table.Table + } else { + expr.Table = &ast.Subquery{Query: &ast.SelectWithUnionQuery{ + Position: expr.Position, + Selects: []ast.Statement{&ast.SelectQuery{ + Position: expr.Position, + Columns: []ast.Expression{&ast.Asterisk{Position: expr.Position}}, + From: tables, + }}, + }} + } } p.expect(token.RPAREN) } else if p.currentIs(token.IDENT) || p.current.Token.IsKeyword() || p.currentIs(token.NUMBER) { @@ -1841,7 +1857,9 @@ func (p *Parser) parseTableExpression() *ast.TableExpression { pos := p.current.Pos ident := p.parseIdentifierName() - if p.currentIs(token.LPAREN) { + if p.currentIs(token.LPAREN) && strings.EqualFold(ident, "trim") { + expr.Table = p.parseTrimCall(pos) + } else if p.currentIs(token.LPAREN) { // Table function expr.Table = p.parseFunctionCall(ident, pos) } else if p.currentIs(token.DOT) { diff --git a/parser/testdata/03206_wasm_module_manage/metadata.json b/parser/testdata/03206_wasm_module_manage/metadata.json index 9c4cf918a6..0967ef424b 100644 --- a/parser/testdata/03206_wasm_module_manage/metadata.json +++ b/parser/testdata/03206_wasm_module_manage/metadata.json @@ -1,25 +1 @@ -{ - "explain_todo": { - "stmt109": true, - "stmt110": true, - "stmt111": true, - "stmt112": true, - "stmt16": true, - "stmt18": true, - "stmt57": true, - "stmt6": true, - "stmt64": true, - "stmt66": true, - "stmt68": true, - "stmt70": true, - "stmt71": true, - "stmt72": true, - "stmt73": true, - "stmt74": true, - "stmt75": true, - "stmt80": true, - "stmt81": true, - "stmt82": true, - "stmt83": true - } -} +{} diff --git a/parser/testdata/03224_trim_empty_string/metadata.json b/parser/testdata/03224_trim_empty_string/metadata.json index 1aae0cd1d0..0967ef424b 100644 --- a/parser/testdata/03224_trim_empty_string/metadata.json +++ b/parser/testdata/03224_trim_empty_string/metadata.json @@ -1,10 +1 @@ -{ - "explain_todo": { - "stmt1": true, - "stmt2": true, - "stmt3": true, - "stmt4": true, - "stmt5": true, - "stmt6": true - } -} +{} diff --git a/parser/testdata/03715_projection_settings/metadata.json b/parser/testdata/03715_projection_settings/metadata.json index ab9202e88e..0967ef424b 100644 --- a/parser/testdata/03715_projection_settings/metadata.json +++ b/parser/testdata/03715_projection_settings/metadata.json @@ -1,5 +1 @@ -{ - "explain_todo": { - "stmt11": true - } -} +{} diff --git a/parser/testdata/03722_function_trim_ltrim_rtrim_alias/metadata.json b/parser/testdata/03722_function_trim_ltrim_rtrim_alias/metadata.json index 90594adf7f..0967ef424b 100644 --- a/parser/testdata/03722_function_trim_ltrim_rtrim_alias/metadata.json +++ b/parser/testdata/03722_function_trim_ltrim_rtrim_alias/metadata.json @@ -1,8 +1 @@ -{ - "explain_todo": { - "stmt11": true, - "stmt12": true, - "stmt13": true, - "stmt6": true - } -} +{} diff --git a/parser/testdata/03926_wasm_limit_large_module/metadata.json b/parser/testdata/03926_wasm_limit_large_module/metadata.json index 1295a45747..0967ef424b 100644 --- a/parser/testdata/03926_wasm_limit_large_module/metadata.json +++ b/parser/testdata/03926_wasm_limit_large_module/metadata.json @@ -1,5 +1 @@ -{ - "explain_todo": { - "stmt3": true - } -} +{} diff --git a/parser/testdata/03985_parenthesized_from_join/metadata.json b/parser/testdata/03985_parenthesized_from_join/metadata.json index c865360d5c..0967ef424b 100644 --- a/parser/testdata/03985_parenthesized_from_join/metadata.json +++ b/parser/testdata/03985_parenthesized_from_join/metadata.json @@ -1,8 +1 @@ -{ - "explain_todo": { - "stmt10": true, - "stmt12": true, - "stmt14": true, - "stmt8": true - } -} +{} diff --git a/parser/testdata/04068_projection_index_settings/metadata.json b/parser/testdata/04068_projection_index_settings/metadata.json index 4064af5a5b..0967ef424b 100644 --- a/parser/testdata/04068_projection_index_settings/metadata.json +++ b/parser/testdata/04068_projection_index_settings/metadata.json @@ -1,7 +1 @@ -{ - "explain_todo": { - "stmt12": true, - "stmt5": true, - "stmt9": true - } -} +{} diff --git a/parser/testdata/04069_index_type_with_settings/metadata.json b/parser/testdata/04069_index_type_with_settings/metadata.json index 08a237ec55..0967ef424b 100644 --- a/parser/testdata/04069_index_type_with_settings/metadata.json +++ b/parser/testdata/04069_index_type_with_settings/metadata.json @@ -1,6 +1 @@ -{ - "explain_todo": { - "stmt6": true, - "stmt9": true - } -} +{} diff --git a/parser/testdata/04070_with_trailing_comma/metadata.json b/parser/testdata/04070_with_trailing_comma/metadata.json index 06cdd45a5d..0967ef424b 100644 --- a/parser/testdata/04070_with_trailing_comma/metadata.json +++ b/parser/testdata/04070_with_trailing_comma/metadata.json @@ -1,13 +1 @@ -{ - "explain_todo": { - "stmt1": true, - "stmt10": true, - "stmt11": true, - "stmt2": true, - "stmt3": true, - "stmt6": true, - "stmt7": true, - "stmt8": true, - "stmt9": true - } -} +{} diff --git a/parser/testdata/04512_eval_table_function/metadata.json b/parser/testdata/04512_eval_table_function/metadata.json index db0d4490ea..0967ef424b 100644 --- a/parser/testdata/04512_eval_table_function/metadata.json +++ b/parser/testdata/04512_eval_table_function/metadata.json @@ -1,12 +1 @@ -{ - "explain_todo": { - "stmt11": true, - "stmt12": true, - "stmt13": true, - "stmt14": true, - "stmt29": true, - "stmt31": true, - "stmt32": true, - "stmt9": true - } -} +{} diff --git a/parser/testdata/04512_postgresql_regexp_operators/metadata.json b/parser/testdata/04512_postgresql_regexp_operators/metadata.json index 72fba37dba..0967ef424b 100644 --- a/parser/testdata/04512_postgresql_regexp_operators/metadata.json +++ b/parser/testdata/04512_postgresql_regexp_operators/metadata.json @@ -1,14 +1 @@ -{ - "explain_todo": { - "stmt1": true, - "stmt11": true, - "stmt12": true, - "stmt13": true, - "stmt2": true, - "stmt4": true, - "stmt5": true, - "stmt6": true, - "stmt7": true, - "stmt8": true - } -} +{} diff --git a/parser/testdata/05175_trim_empty_chars_is_a_function_call/metadata.json b/parser/testdata/05175_trim_empty_chars_is_a_function_call/metadata.json index e0eec3b9fd..2ef6a38008 100644 --- a/parser/testdata/05175_trim_empty_chars_is_a_function_call/metadata.json +++ b/parser/testdata/05175_trim_empty_chars_is_a_function_call/metadata.json @@ -1,22 +1,6 @@ { "explain_todo": { - "stmt11": true, "stmt15": true, - "stmt18": true, - "stmt19": true, - "stmt2": true, - "stmt20": true, - "stmt21": true, - "stmt24": true, - "stmt25": true, - "stmt26": true, - "stmt27": true, - "stmt3": true, - "stmt31": true, - "stmt32": true, - "stmt33": true, - "stmt34": true, - "stmt4": true, "stmt8": true, "stmt9": true } diff --git a/token/token.go b/token/token.go index e999cafa3f..9bcc1906f7 100644 --- a/token/token.go +++ b/token/token.go @@ -35,6 +35,7 @@ const ( COLONCOLON // :: NULL_SAFE_EQ // <=> CARET // ^ + REGEX_OP // ~ ~* !~ !~* (regular expression match) // Delimiters LPAREN // ( @@ -230,6 +231,7 @@ var tokens = [...]string{ PERCENT: "%", EQ: "=", NEQ: "!=", + REGEX_OP: "~", LT: "<", GT: ">", LTE: "<=",