Commit 2b2b4b2 1 parent e11cd83 commit 2b2b4b2 Copy full SHA for 2b2b4b2
File tree 7 files changed +52
-1
lines changed
7 files changed +52
-1
lines changed Original file line number Diff line number Diff line change @@ -90,6 +90,7 @@ func (CreateSequence) isStatement() {}
90
90
func (AlterSequence ) isStatement () {}
91
91
func (DropSequence ) isStatement () {}
92
92
func (AlterStatistics ) isStatement () {}
93
+ func (Analyze ) isStatement () {}
93
94
func (CreateVectorIndex ) isStatement () {}
94
95
func (DropVectorIndex ) isStatement () {}
95
96
func (Insert ) isStatement () {}
@@ -332,6 +333,7 @@ func (CreateSequence) isDDL() {}
332
333
func (AlterSequence ) isDDL () {}
333
334
func (DropSequence ) isDDL () {}
334
335
func (AlterStatistics ) isDDL () {}
336
+ func (Analyze ) isDDL () {}
335
337
func (CreateVectorIndex ) isDDL () {}
336
338
func (DropVectorIndex ) isDDL () {}
337
339
@@ -2866,6 +2868,16 @@ type AlterStatistics struct {
2866
2868
Options * Options
2867
2869
}
2868
2870
2871
+ // Analyze is ANALYZE statement node.
2872
+ //
2873
+ // ANALYZE
2874
+ type Analyze struct {
2875
+ // pos = Analyze
2876
+ // end = Analyze + 7
2877
+
2878
+ Analyze token.Pos // position of "ANALYZE" keyword
2879
+ }
2880
+
2869
2881
// ================================================================================
2870
2882
//
2871
2883
// Types for Schema
Original file line number Diff line number Diff line change @@ -1270,6 +1270,7 @@ func (r *RolePrivilege) SQL() string {
1270
1270
func (s * AlterStatistics ) SQL () string {
1271
1271
return "ALTER STATISTICS " + s .Name .SQL () + " SET " + s .Options .SQL ()
1272
1272
}
1273
+ func (a * Analyze ) SQL () string { return "ANALYZE" }
1273
1274
1274
1275
// ================================================================================
1275
1276
//
Original file line number Diff line number Diff line change @@ -213,7 +213,8 @@ func (p *Parser) parseStatement() ast.Statement {
213
213
case p .Token .Kind == "SELECT" || p .Token .Kind == "@" || p .Token .Kind == "WITH" || p .Token .Kind == "(" :
214
214
return p .parseQueryStatement ()
215
215
case p .Token .Kind == "CREATE" || p .Token .IsKeywordLike ("ALTER" ) || p .Token .IsKeywordLike ("DROP" ) ||
216
- p .Token .IsKeywordLike ("RENAME" ) || p .Token .IsKeywordLike ("GRANT" ) || p .Token .IsKeywordLike ("REVOKE" ):
216
+ p .Token .IsKeywordLike ("RENAME" ) || p .Token .IsKeywordLike ("GRANT" ) || p .Token .IsKeywordLike ("REVOKE" ) ||
217
+ p .Token .IsKeywordLike ("ANALYZE" ):
217
218
return p .parseDDL ()
218
219
case p .Token .IsKeywordLike ("INSERT" ) || p .Token .IsKeywordLike ("DELETE" ) || p .Token .IsKeywordLike ("UPDATE" ):
219
220
return p .parseDML ()
@@ -2378,6 +2379,8 @@ func (p *Parser) parseDDL() ast.DDL {
2378
2379
case p .Token .IsKeywordLike ("REVOKE" ):
2379
2380
p .nextToken ()
2380
2381
return p .parseRevoke (pos )
2382
+ case p .Token .IsKeywordLike ("ANALYZE" ):
2383
+ return p .parseAnalyze ()
2381
2384
}
2382
2385
2383
2386
if p .Token .Kind != token .TokenIdent {
@@ -3736,6 +3739,14 @@ func (p *Parser) parseAlterStatistics(pos token.Pos) *ast.AlterStatistics {
3736
3739
}
3737
3740
}
3738
3741
3742
+ func (p * Parser ) parseAnalyze () * ast.Analyze {
3743
+ pos := p .expectKeywordLike ("ANALYZE" ).Pos
3744
+
3745
+ return & ast.Analyze {
3746
+ Analyze : pos ,
3747
+ }
3748
+ }
3749
+
3739
3750
var scalarSchemaTypes = []string {
3740
3751
"BOOL" ,
3741
3752
"INT64" ,
Original file line number Diff line number Diff line change
1
+ ANALYZE
Original file line number Diff line number Diff line change
1
+ --- analyze.sql
2
+ ANALYZE
3
+ --- AST
4
+ &ast.Analyze{
5
+ Analyze: 0,
6
+ }
7
+
8
+ --- SQL
9
+ ANALYZE
Original file line number Diff line number Diff line change
1
+ --- analyze.sql
2
+ ANALYZE
3
+ --- AST
4
+ &ast.Analyze{
5
+ Analyze: 0,
6
+ }
7
+
8
+ --- SQL
9
+ ANALYZE
You can’t perform that action at this time.
0 commit comments