Documentation
¶
Overview ¶
Package explain provides EXPLAIN AST output functionality for ClickHouse SQL.
Index ¶
- func Column(sb *strings.Builder, col *ast.ColumnDeclaration, depth int)
- func EscapeIdentifier(s string) string
- func Explain(stmt ast.Statement) string
- func ExplainSelectWithInheritedWith(sb *strings.Builder, stmt ast.Statement, inheritedWith []ast.Expression, ...)
- func ExplainStatements(stmts []ast.Statement) string
- func FormatDataType(dt *ast.DataType) string
- func FormatFloat(val float64) string
- func FormatLiteral(lit *ast.Literal) string
- func Index(sb *strings.Builder, idx *ast.IndexDefinition, depth int)
- func Node(sb *strings.Builder, node interface{}, depth int)
- func NormalizeFunctionName(name string) string
- func OperatorToFunction(op string) string
- func TablesWithArrayJoin(sb *strings.Builder, from *ast.TablesInSelectQuery, ...)
- func UnaryOperatorToFunction(op string) string
Constants ¶
This section is empty.
Variables ¶
This section is empty.
Functions ¶
func Column ¶
func Column(sb *strings.Builder, col *ast.ColumnDeclaration, depth int)
Column handles column declarations
func EscapeIdentifier ¶
EscapeIdentifier escapes single quotes in identifiers for EXPLAIN AST output ClickHouse escapes ' as \' in identifier names
func Explain ¶
Explain returns the EXPLAIN AST output for a statement, matching ClickHouse's format.
func ExplainSelectWithInheritedWith ¶
func ExplainSelectWithInheritedWith(sb *strings.Builder, stmt ast.Statement, inheritedWith []ast.Expression, depth int)
ExplainSelectWithInheritedWith recursively explains a select statement with inherited WITH clause This is used for WITH ... INSERT ... SELECT where the WITH clause belongs to the INSERT but needs to be output at the end of each SelectQuery in the tree
func ExplainStatements ¶
ExplainStatements returns the EXPLAIN AST output for multiple statements. This handles the special ClickHouse behavior where INSERT VALUES followed by SELECT on the same line outputs the INSERT AST and then executes the SELECT, printing its result.
func FormatDataType ¶
FormatDataType formats a DataType for EXPLAIN AST output
func FormatFloat ¶
FormatFloat formats a float value for EXPLAIN AST output
func FormatLiteral ¶
FormatLiteral formats a literal value for EXPLAIN AST output
func NormalizeFunctionName ¶
NormalizeFunctionName normalizes function names to match ClickHouse's EXPLAIN AST output
func OperatorToFunction ¶
OperatorToFunction maps binary operators to ClickHouse function names
func TablesWithArrayJoin ¶
func TablesWithArrayJoin(sb *strings.Builder, from *ast.TablesInSelectQuery, arrayJoin *ast.ArrayJoinClause, depth int)
TablesWithArrayJoin handles FROM and ARRAY JOIN together as TablesInSelectQuery
func UnaryOperatorToFunction ¶
UnaryOperatorToFunction maps unary operators to ClickHouse function names
Types ¶
This section is empty.