Skip to content

Commit 384d758

Browse files
committed
Reorder output: JSON first, then EXPLAIN
1 parent 3317a59 commit 384d758

1 file changed

Lines changed: 28 additions & 28 deletions

File tree

README.md

Lines changed: 28 additions & 28 deletions
Original file line numberDiff line numberDiff line change
@@ -30,37 +30,13 @@ func main() {
3030
panic(err)
3131
}
3232

33-
// Print EXPLAIN AST output (matches ClickHouse format)
34-
fmt.Println(parser.Explain(stmts[0]))
35-
36-
// Or serialize to JSON
33+
// Serialize to JSON
3734
jsonBytes, _ := json.MarshalIndent(stmts[0], "", " ")
3835
fmt.Println(string(jsonBytes))
39-
}
40-
```
4136

42-
Output:
43-
44-
```
45-
SelectWithUnionQuery (children 1)
46-
ExpressionList (children 1)
47-
SelectQuery (children 4)
48-
ExpressionList (children 2)
49-
Identifier id
50-
Identifier name
51-
TablesInSelectQuery (children 1)
52-
TablesInSelectQueryElement (children 1)
53-
TableExpression (children 1)
54-
TableIdentifier (children 1)
55-
Identifier users
56-
Function equals (children 1)
57-
ExpressionList (children 2)
58-
Identifier active
59-
Literal UInt64_1
60-
ExpressionList (children 1)
61-
OrderByElement (children 1)
62-
Identifier created_at
63-
Literal UInt64_10
37+
// Or print EXPLAIN AST output (matches ClickHouse format)
38+
fmt.Println(parser.Explain(stmts[0]))
39+
}
6440
```
6541

6642
JSON output:
@@ -95,6 +71,30 @@ JSON output:
9571
}
9672
```
9773

74+
EXPLAIN output:
75+
76+
```
77+
SelectWithUnionQuery (children 1)
78+
ExpressionList (children 1)
79+
SelectQuery (children 4)
80+
ExpressionList (children 2)
81+
Identifier id
82+
Identifier name
83+
TablesInSelectQuery (children 1)
84+
TablesInSelectQueryElement (children 1)
85+
TableExpression (children 1)
86+
TableIdentifier (children 1)
87+
Identifier users
88+
Function equals (children 1)
89+
ExpressionList (children 2)
90+
Identifier active
91+
Literal UInt64_1
92+
ExpressionList (children 1)
93+
OrderByElement (children 1)
94+
Identifier created_at
95+
Literal UInt64_10
96+
```
97+
9898
## Features
9999

100100
- Parses SELECT, INSERT, CREATE, DROP, ALTER, and other ClickHouse statements

0 commit comments

Comments
 (0)