From bb8d1011708705e9032803a2886e7c8cffd62cdb Mon Sep 17 00:00:00 2001 From: apstndb <803393+apstndb@users.noreply.github.com> Date: Tue, 26 Nov 2024 23:38:51 +0900 Subject: [PATCH 1/8] Fix JoinMethod handling (#213) --- ast/const.go | 6 +- parser.go | 8 +- .../query/select_singer_with_hash_join.sql | 8 +- .../select_singer_with_hash_join.sql.txt | 183 +++--------------- .../select_singer_with_hash_join.sql.txt | 183 +++--------------- 5 files changed, 70 insertions(+), 318 deletions(-) diff --git a/ast/const.go b/ast/const.go index eff6d893..9ea9a7d9 100644 --- a/ast/const.go +++ b/ast/const.go @@ -14,12 +14,12 @@ const ( JoinTypeJoinHint JoinHintKey = "JOIN_TYPE" ) +// JoinMethod is used for prefix of JOIN, not for hint. type JoinMethod string const ( - HashJoinMethod JoinMethod = "HASH" - ApplyJoinMethod JoinMethod = "APPLY" - LoopJoinMethod JoinMethod = "LOOP" // Undocumented, but the Spanner accept this value at least. + HashJoinMethod JoinMethod = "HASH" + LookupJoinMethod JoinMethod = "LOOKUP" // Undocumented, but the GoogleSQL can parse this value. ) type PositionKeyword string diff --git a/parser.go b/parser.go index c2a2595f..0655fc52 100644 --- a/parser.go +++ b/parser.go @@ -737,13 +737,9 @@ func (p *Parser) parseTableExpr(toplevel bool) ast.TableExpr { p.nextToken() method = ast.HashJoinMethod needJoin = true - case p.Token.IsKeywordLike("APPLY"): + case p.Token.IsKeywordLike("LOOKUP"): p.nextToken() - method = ast.ApplyJoinMethod - needJoin = true - case p.Token.IsKeywordLike("LOOP"): - p.nextToken() - method = ast.LoopJoinMethod + method = ast.LookupJoinMethod needJoin = true } } diff --git a/testdata/input/query/select_singer_with_hash_join.sql b/testdata/input/query/select_singer_with_hash_join.sql index cd77034d..e5d1e7e4 100644 --- a/testdata/input/query/select_singer_with_hash_join.sql +++ b/testdata/input/query/select_singer_with_hash_join.sql @@ -4,10 +4,4 @@ FROM Singers A HASH JOIN Singers B - ON A.SingerID = B.SingerID - APPLY JOIN - Singer C - ON B.SingerID = C.SingerID - LOOP JOIN - Singer D - ON C.SingerID = D.SingerID + ON A.SingerID = B.SingerID \ No newline at end of file diff --git a/testdata/result/query/select_singer_with_hash_join.sql.txt b/testdata/result/query/select_singer_with_hash_join.sql.txt index 6a385ba4..51741f24 100644 --- a/testdata/result/query/select_singer_with_hash_join.sql.txt +++ b/testdata/result/query/select_singer_with_hash_join.sql.txt @@ -6,13 +6,6 @@ FROM HASH JOIN Singers B ON A.SingerID = B.SingerID - APPLY JOIN - Singer C - ON B.SingerID = C.SingerID - LOOP JOIN - Singer D - ON C.SingerID = D.SingerID - --- AST &ast.QueryStatement{ Hint: (*ast.Hint)(nil), @@ -30,168 +23,56 @@ FROM From: 11, Source: &ast.Join{ Op: "INNER JOIN", - Method: "LOOP", + Method: "HASH", Hint: (*ast.Hint)(nil), - Left: &ast.Join{ - Op: "INNER JOIN", - Method: "APPLY", - Hint: (*ast.Hint)(nil), - Left: &ast.Join{ - Op: "INNER JOIN", - Method: "HASH", - Hint: (*ast.Hint)(nil), - Left: &ast.TableName{ - Table: &ast.Ident{ - NamePos: 18, - NameEnd: 25, - Name: "Singers", - }, - Hint: (*ast.Hint)(nil), - As: &ast.AsAlias{ - As: -1, - Alias: &ast.Ident{ - NamePos: 26, - NameEnd: 27, - Name: "A", - }, - }, - Sample: (*ast.TableSample)(nil), - }, - Right: &ast.TableName{ - Table: &ast.Ident{ - NamePos: 42, - NameEnd: 49, - Name: "Singers", - }, - Hint: (*ast.Hint)(nil), - As: &ast.AsAlias{ - As: -1, - Alias: &ast.Ident{ - NamePos: 50, - NameEnd: 51, - Name: "B", - }, - }, - Sample: (*ast.TableSample)(nil), - }, - Cond: &ast.On{ - On: 54, - Expr: &ast.BinaryExpr{ - Op: "=", - Left: &ast.Path{ - Idents: []*ast.Ident{ - &ast.Ident{ - NamePos: 57, - NameEnd: 58, - Name: "A", - }, - &ast.Ident{ - NamePos: 59, - NameEnd: 67, - Name: "SingerID", - }, - }, - }, - Right: &ast.Path{ - Idents: []*ast.Ident{ - &ast.Ident{ - NamePos: 70, - NameEnd: 71, - Name: "B", - }, - &ast.Ident{ - NamePos: 72, - NameEnd: 80, - Name: "SingerID", - }, - }, - }, - }, - }, - }, - Right: &ast.TableName{ - Table: &ast.Ident{ - NamePos: 96, - NameEnd: 102, - Name: "Singer", - }, - Hint: (*ast.Hint)(nil), - As: &ast.AsAlias{ - As: -1, - Alias: &ast.Ident{ - NamePos: 103, - NameEnd: 104, - Name: "C", - }, - }, - Sample: (*ast.TableSample)(nil), + Left: &ast.TableName{ + Table: &ast.Ident{ + NamePos: 18, + NameEnd: 25, + Name: "Singers", }, - Cond: &ast.On{ - On: 107, - Expr: &ast.BinaryExpr{ - Op: "=", - Left: &ast.Path{ - Idents: []*ast.Ident{ - &ast.Ident{ - NamePos: 110, - NameEnd: 111, - Name: "B", - }, - &ast.Ident{ - NamePos: 112, - NameEnd: 120, - Name: "SingerID", - }, - }, - }, - Right: &ast.Path{ - Idents: []*ast.Ident{ - &ast.Ident{ - NamePos: 123, - NameEnd: 124, - Name: "C", - }, - &ast.Ident{ - NamePos: 125, - NameEnd: 133, - Name: "SingerID", - }, - }, - }, + Hint: (*ast.Hint)(nil), + As: &ast.AsAlias{ + As: -1, + Alias: &ast.Ident{ + NamePos: 26, + NameEnd: 27, + Name: "A", }, }, + Sample: (*ast.TableSample)(nil), }, Right: &ast.TableName{ Table: &ast.Ident{ - NamePos: 148, - NameEnd: 154, - Name: "Singer", + NamePos: 42, + NameEnd: 49, + Name: "Singers", }, Hint: (*ast.Hint)(nil), As: &ast.AsAlias{ As: -1, Alias: &ast.Ident{ - NamePos: 155, - NameEnd: 156, - Name: "D", + NamePos: 50, + NameEnd: 51, + Name: "B", }, }, Sample: (*ast.TableSample)(nil), }, Cond: &ast.On{ - On: 159, + On: 54, Expr: &ast.BinaryExpr{ Op: "=", Left: &ast.Path{ Idents: []*ast.Ident{ &ast.Ident{ - NamePos: 162, - NameEnd: 163, - Name: "C", + NamePos: 57, + NameEnd: 58, + Name: "A", }, &ast.Ident{ - NamePos: 164, - NameEnd: 172, + NamePos: 59, + NameEnd: 67, Name: "SingerID", }, }, @@ -199,13 +80,13 @@ FROM Right: &ast.Path{ Idents: []*ast.Ident{ &ast.Ident{ - NamePos: 175, - NameEnd: 176, - Name: "D", + NamePos: 70, + NameEnd: 71, + Name: "B", }, &ast.Ident{ - NamePos: 177, - NameEnd: 185, + NamePos: 72, + NameEnd: 80, Name: "SingerID", }, }, @@ -223,4 +104,4 @@ FROM } --- SQL -SELECT * FROM Singers A INNER JOIN Singers B ON A.SingerID = B.SingerID INNER JOIN Singer C ON B.SingerID = C.SingerID INNER JOIN Singer D ON C.SingerID = D.SingerID +SELECT * FROM Singers A INNER JOIN Singers B ON A.SingerID = B.SingerID diff --git a/testdata/result/statement/select_singer_with_hash_join.sql.txt b/testdata/result/statement/select_singer_with_hash_join.sql.txt index 6a385ba4..51741f24 100644 --- a/testdata/result/statement/select_singer_with_hash_join.sql.txt +++ b/testdata/result/statement/select_singer_with_hash_join.sql.txt @@ -6,13 +6,6 @@ FROM HASH JOIN Singers B ON A.SingerID = B.SingerID - APPLY JOIN - Singer C - ON B.SingerID = C.SingerID - LOOP JOIN - Singer D - ON C.SingerID = D.SingerID - --- AST &ast.QueryStatement{ Hint: (*ast.Hint)(nil), @@ -30,168 +23,56 @@ FROM From: 11, Source: &ast.Join{ Op: "INNER JOIN", - Method: "LOOP", + Method: "HASH", Hint: (*ast.Hint)(nil), - Left: &ast.Join{ - Op: "INNER JOIN", - Method: "APPLY", - Hint: (*ast.Hint)(nil), - Left: &ast.Join{ - Op: "INNER JOIN", - Method: "HASH", - Hint: (*ast.Hint)(nil), - Left: &ast.TableName{ - Table: &ast.Ident{ - NamePos: 18, - NameEnd: 25, - Name: "Singers", - }, - Hint: (*ast.Hint)(nil), - As: &ast.AsAlias{ - As: -1, - Alias: &ast.Ident{ - NamePos: 26, - NameEnd: 27, - Name: "A", - }, - }, - Sample: (*ast.TableSample)(nil), - }, - Right: &ast.TableName{ - Table: &ast.Ident{ - NamePos: 42, - NameEnd: 49, - Name: "Singers", - }, - Hint: (*ast.Hint)(nil), - As: &ast.AsAlias{ - As: -1, - Alias: &ast.Ident{ - NamePos: 50, - NameEnd: 51, - Name: "B", - }, - }, - Sample: (*ast.TableSample)(nil), - }, - Cond: &ast.On{ - On: 54, - Expr: &ast.BinaryExpr{ - Op: "=", - Left: &ast.Path{ - Idents: []*ast.Ident{ - &ast.Ident{ - NamePos: 57, - NameEnd: 58, - Name: "A", - }, - &ast.Ident{ - NamePos: 59, - NameEnd: 67, - Name: "SingerID", - }, - }, - }, - Right: &ast.Path{ - Idents: []*ast.Ident{ - &ast.Ident{ - NamePos: 70, - NameEnd: 71, - Name: "B", - }, - &ast.Ident{ - NamePos: 72, - NameEnd: 80, - Name: "SingerID", - }, - }, - }, - }, - }, - }, - Right: &ast.TableName{ - Table: &ast.Ident{ - NamePos: 96, - NameEnd: 102, - Name: "Singer", - }, - Hint: (*ast.Hint)(nil), - As: &ast.AsAlias{ - As: -1, - Alias: &ast.Ident{ - NamePos: 103, - NameEnd: 104, - Name: "C", - }, - }, - Sample: (*ast.TableSample)(nil), + Left: &ast.TableName{ + Table: &ast.Ident{ + NamePos: 18, + NameEnd: 25, + Name: "Singers", }, - Cond: &ast.On{ - On: 107, - Expr: &ast.BinaryExpr{ - Op: "=", - Left: &ast.Path{ - Idents: []*ast.Ident{ - &ast.Ident{ - NamePos: 110, - NameEnd: 111, - Name: "B", - }, - &ast.Ident{ - NamePos: 112, - NameEnd: 120, - Name: "SingerID", - }, - }, - }, - Right: &ast.Path{ - Idents: []*ast.Ident{ - &ast.Ident{ - NamePos: 123, - NameEnd: 124, - Name: "C", - }, - &ast.Ident{ - NamePos: 125, - NameEnd: 133, - Name: "SingerID", - }, - }, - }, + Hint: (*ast.Hint)(nil), + As: &ast.AsAlias{ + As: -1, + Alias: &ast.Ident{ + NamePos: 26, + NameEnd: 27, + Name: "A", }, }, + Sample: (*ast.TableSample)(nil), }, Right: &ast.TableName{ Table: &ast.Ident{ - NamePos: 148, - NameEnd: 154, - Name: "Singer", + NamePos: 42, + NameEnd: 49, + Name: "Singers", }, Hint: (*ast.Hint)(nil), As: &ast.AsAlias{ As: -1, Alias: &ast.Ident{ - NamePos: 155, - NameEnd: 156, - Name: "D", + NamePos: 50, + NameEnd: 51, + Name: "B", }, }, Sample: (*ast.TableSample)(nil), }, Cond: &ast.On{ - On: 159, + On: 54, Expr: &ast.BinaryExpr{ Op: "=", Left: &ast.Path{ Idents: []*ast.Ident{ &ast.Ident{ - NamePos: 162, - NameEnd: 163, - Name: "C", + NamePos: 57, + NameEnd: 58, + Name: "A", }, &ast.Ident{ - NamePos: 164, - NameEnd: 172, + NamePos: 59, + NameEnd: 67, Name: "SingerID", }, }, @@ -199,13 +80,13 @@ FROM Right: &ast.Path{ Idents: []*ast.Ident{ &ast.Ident{ - NamePos: 175, - NameEnd: 176, - Name: "D", + NamePos: 70, + NameEnd: 71, + Name: "B", }, &ast.Ident{ - NamePos: 177, - NameEnd: 185, + NamePos: 72, + NameEnd: 80, Name: "SingerID", }, }, @@ -223,4 +104,4 @@ FROM } --- SQL -SELECT * FROM Singers A INNER JOIN Singers B ON A.SingerID = B.SingerID INNER JOIN Singer C ON B.SingerID = C.SingerID INNER JOIN Singer D ON C.SingerID = D.SingerID +SELECT * FROM Singers A INNER JOIN Singers B ON A.SingerID = B.SingerID From 202999ac38e7e067eaedac14e0054e7618a495b0 Mon Sep 17 00:00:00 2001 From: apstndb <803393+apstndb@users.noreply.github.com> Date: Mon, 2 Dec 2024 17:06:45 +0900 Subject: [PATCH 2/8] Implement REPLACE_FIELDS (#220) * Implement REPLACE_FIELDS * Update testdata * Add blank line * Fix doc comment and receiver --- ast/ast.go | 26 ++++ ast/pos.go | 16 +++ ast/sql.go | 6 + parser.go | 29 ++++ ...otocol_buffer_functions_replace_fields.sql | 6 + ...ol_buffer_functions_replace_fields.sql.txt | 126 ++++++++++++++++++ 6 files changed, 209 insertions(+) create mode 100644 testdata/input/expr/protocol_buffer_functions_replace_fields.sql create mode 100644 testdata/result/expr/protocol_buffer_functions_replace_fields.sql.txt diff --git a/ast/ast.go b/ast/ast.go index 1de8aac0..a51cf9e4 100644 --- a/ast/ast.go +++ b/ast/ast.go @@ -172,6 +172,7 @@ func (CallExpr) isExpr() {} func (CountStarExpr) isExpr() {} func (CastExpr) isExpr() {} func (ExtractExpr) isExpr() {} +func (ReplaceFieldsExpr) isExpr() {} func (CaseExpr) isExpr() {} func (IfExpr) isExpr() {} func (ParenExpr) isExpr() {} @@ -1273,6 +1274,31 @@ type ExtractExpr struct { AtTimeZone *AtTimeZone // optional } +// ReplaceFieldsArg is value AS field_path node in ReplaceFieldsExpr. +// +// {{.Expr | sql}} AS {{.Field | sql}} +type ReplaceFieldsArg struct { + // pos = Expr.pos + // end = Field.end + + Expr Expr + Field *Path +} + +// ReplaceFieldsExpr is REPLACE_FIELDS call expression node. +// +// REPLACE_FIELDS({{.Expr.| sql}}, {{.Fields | sqlJoin ", "}}) +type ReplaceFieldsExpr struct { + // pos = ReplaceFields + // end = Rparen + 1 + + ReplaceFields token.Pos // position of "REPLACE_FIELDS" keyword + Rparen token.Pos // position of ")" + + Expr Expr + Fields []*ReplaceFieldsArg +} + // AtTimeZone is AT TIME ZONE clause in EXTRACT call. // // AT TIME ZONE {{.Expr | sql}} diff --git a/ast/pos.go b/ast/pos.go index dd0cd882..8bcac94f 100644 --- a/ast/pos.go +++ b/ast/pos.go @@ -478,6 +478,22 @@ func (e *ExtractExpr) End() token.Pos { return posAdd(e.Rparen, 1) } +func (r *ReplaceFieldsArg) Pos() token.Pos { + return nodePos(wrapNode(r.Expr)) +} + +func (r *ReplaceFieldsArg) End() token.Pos { + return nodeEnd(wrapNode(r.Field)) +} + +func (r *ReplaceFieldsExpr) Pos() token.Pos { + return r.ReplaceFields +} + +func (r *ReplaceFieldsExpr) End() token.Pos { + return posAdd(r.Rparen, 1) +} + func (a *AtTimeZone) Pos() token.Pos { return a.At } diff --git a/ast/sql.go b/ast/sql.go index 12f864db..e7a2ec76 100644 --- a/ast/sql.go +++ b/ast/sql.go @@ -549,6 +549,12 @@ func (a *AtTimeZone) SQL() string { return "AT TIME ZONE " + a.Expr.SQL() } +func (r *ReplaceFieldsArg) SQL() string { return r.Expr.SQL() + " AS " + r.Field.SQL() } + +func (r *ReplaceFieldsExpr) SQL() string { + return "REPLACE_FIELDS(" + r.Expr.SQL() + ", " + sqlJoin(r.Fields, ", ") + ")" +} + func (c *CastExpr) SQL() string { return strOpt(c.Safe, "SAFE_") + "CAST(" + c.Expr.SQL() + " AS " + c.Type.SQL() + ")" } diff --git a/parser.go b/parser.go index 0655fc52..ad6bf959 100644 --- a/parser.go +++ b/parser.go @@ -1469,6 +1469,8 @@ func (p *Parser) parseLit() ast.Expr { switch { case id.IsKeywordLike("SAFE_CAST"): return p.parseCastExpr() + case id.IsKeywordLike("REPLACE_FIELDS"): + return p.parseReplaceFieldsExpr() } p.nextToken() switch p.Token.Kind { @@ -1754,6 +1756,33 @@ func (p *Parser) parseIfExpr() *ast.IfExpr { } } +func (p *Parser) parseReplaceFieldsArg() *ast.ReplaceFieldsArg { + expr := p.parseExpr() + p.expect("AS") + field := p.parsePath() + + return &ast.ReplaceFieldsArg{ + Expr: expr, + Field: field, + } +} + +func (p *Parser) parseReplaceFieldsExpr() *ast.ReplaceFieldsExpr { + replaceFields := p.expectKeywordLike("REPLACE_FIELDS").Pos + p.expect("(") + expr := p.parseExpr() + p.expect(",") + fields := parseCommaSeparatedList(p, p.parseReplaceFieldsArg) + rparen := p.expect(")").Pos + + return &ast.ReplaceFieldsExpr{ + ReplaceFields: replaceFields, + Rparen: rparen, + Expr: expr, + Fields: fields, + } +} + func (p *Parser) parseCastExpr() *ast.CastExpr { if p.Token.Kind != "CAST" && !p.Token.IsKeywordLike("SAFE_CAST") { panic(p.errorfAtToken(&p.Token, `expected CAST keyword or SAFE_CAST pseudo keyword, but: %v`, p.Token.Kind)) diff --git a/testdata/input/expr/protocol_buffer_functions_replace_fields.sql b/testdata/input/expr/protocol_buffer_functions_replace_fields.sql new file mode 100644 index 00000000..64caec01 --- /dev/null +++ b/testdata/input/expr/protocol_buffer_functions_replace_fields.sql @@ -0,0 +1,6 @@ +REPLACE_FIELDS( + NEW Book( + "The Hummingbird" AS title, + NEW BookDetails(10 AS chapters) AS details), + "The Hummingbird II" AS title, + 11 AS details.chapters) \ No newline at end of file diff --git a/testdata/result/expr/protocol_buffer_functions_replace_fields.sql.txt b/testdata/result/expr/protocol_buffer_functions_replace_fields.sql.txt new file mode 100644 index 00000000..5587e16a --- /dev/null +++ b/testdata/result/expr/protocol_buffer_functions_replace_fields.sql.txt @@ -0,0 +1,126 @@ +--- protocol_buffer_functions_replace_fields.sql +REPLACE_FIELDS( + NEW Book( + "The Hummingbird" AS title, + NEW BookDetails(10 AS chapters) AS details), + "The Hummingbird II" AS title, + 11 AS details.chapters) +--- AST +&ast.ReplaceFieldsExpr{ + ReplaceFields: 0, + Rparen: 166, + Expr: &ast.NewConstructor{ + New: 18, + Type: &ast.NamedType{ + Path: []*ast.Ident{ + &ast.Ident{ + NamePos: 22, + NameEnd: 26, + Name: "Book", + }, + }, + }, + Args: []ast.NewConstructorArg{ + &ast.Alias{ + Expr: &ast.StringLiteral{ + ValuePos: 32, + ValueEnd: 49, + Value: "The Hummingbird", + }, + As: &ast.AsAlias{ + As: 50, + Alias: &ast.Ident{ + NamePos: 53, + NameEnd: 58, + Name: "title", + }, + }, + }, + &ast.Alias{ + Expr: &ast.NewConstructor{ + New: 64, + Type: &ast.NamedType{ + Path: []*ast.Ident{ + &ast.Ident{ + NamePos: 68, + NameEnd: 79, + Name: "BookDetails", + }, + }, + }, + Args: []ast.NewConstructorArg{ + &ast.Alias{ + Expr: &ast.IntLiteral{ + ValuePos: 80, + ValueEnd: 82, + Base: 10, + Value: "10", + }, + As: &ast.AsAlias{ + As: 83, + Alias: &ast.Ident{ + NamePos: 86, + NameEnd: 94, + Name: "chapters", + }, + }, + }, + }, + Rparen: 94, + }, + As: &ast.AsAlias{ + As: 96, + Alias: &ast.Ident{ + NamePos: 99, + NameEnd: 106, + Name: "details", + }, + }, + }, + }, + Rparen: 106, + }, + Fields: []*ast.ReplaceFieldsArg{ + &ast.ReplaceFieldsArg{ + Expr: &ast.StringLiteral{ + ValuePos: 111, + ValueEnd: 131, + Value: "The Hummingbird II", + }, + Field: &ast.Path{ + Idents: []*ast.Ident{ + &ast.Ident{ + NamePos: 135, + NameEnd: 140, + Name: "title", + }, + }, + }, + }, + &ast.ReplaceFieldsArg{ + Expr: &ast.IntLiteral{ + ValuePos: 144, + ValueEnd: 146, + Base: 10, + Value: "11", + }, + Field: &ast.Path{ + Idents: []*ast.Ident{ + &ast.Ident{ + NamePos: 150, + NameEnd: 157, + Name: "details", + }, + &ast.Ident{ + NamePos: 158, + NameEnd: 166, + Name: "chapters", + }, + }, + }, + }, + }, +} + +--- SQL +REPLACE_FIELDS(NEW Book("The Hummingbird" AS title, NEW BookDetails(10 AS chapters) AS details), "The Hummingbird II" AS title, 11 AS details.chapters) From 77fc9f82dccd12ca7fe48d71a06d95954a8ac365 Mon Sep 17 00:00:00 2001 From: apstndb <803393+apstndb@users.noreply.github.com> Date: Mon, 2 Dec 2024 17:43:41 +0900 Subject: [PATCH 3/8] Implement lambda expressions (#219) * Implement LambdaArg * Update testdata * Fix to use token.InvalidPos * Replace useless use of parseCommaSeparatedList * Add comment to LambdaArg.Args * Update LambdaArg comments --- ast/ast.go | 16 ++++ ast/pos.go | 8 ++ ast/sql.go | 9 +++ parser.go | 39 ++++++++++ ...unctions_array_filter_parenless_lambda.sql | 1 + ...functions_array_filter_two_args_lambda.sql | 1 + ...ions_array_filter_parenless_lambda.sql.txt | 72 ++++++++++++++++++ ...tions_array_filter_two_args_lambda.sql.txt | 76 +++++++++++++++++++ 8 files changed, 222 insertions(+) create mode 100644 testdata/input/expr/array_functions_array_filter_parenless_lambda.sql create mode 100644 testdata/input/expr/array_functions_array_filter_two_args_lambda.sql create mode 100644 testdata/result/expr/array_functions_array_filter_parenless_lambda.sql.txt create mode 100644 testdata/result/expr/array_functions_array_filter_two_args_lambda.sql.txt diff --git a/ast/ast.go b/ast/ast.go index a51cf9e4..e13a9791 100644 --- a/ast/ast.go +++ b/ast/ast.go @@ -218,6 +218,7 @@ type Arg interface { func (ExprArg) isArg() {} func (IntervalArg) isArg() {} func (SequenceArg) isArg() {} +func (LambdaArg) isArg() {} // NullHandlingModifier represents IGNORE/RESPECT NULLS of aggregate function calls type NullHandlingModifier interface { @@ -1193,6 +1194,21 @@ type SequenceArg struct { Expr Expr } +// LambdaArg is lambda expression argument of the generic function call. +// +// {{if .Lparen.Invalid}}{{.Args | sqlJoin ", "}}{{else}}({{.Args | sqlJoin ", "}}) -> {{.Expr | sql}} +// +// Note: Args won't be empty. If Lparen is not appeared, Args have exactly one element. +type LambdaArg struct { + // pos = Lparen || Args[0].pos + // end = Expr.end + + Lparen token.Pos // optional + + Args []*Ident // if Lparen.Invalid() then len(Args) = 1 else len(Args) > 0 + Expr Expr +} + // NamedArg represents a name and value pair in named arguments // // {{.Name | sql}} => {{.Value | sql}} diff --git a/ast/pos.go b/ast/pos.go index 8bcac94f..c6cc1f4b 100644 --- a/ast/pos.go +++ b/ast/pos.go @@ -422,6 +422,14 @@ func (s *SequenceArg) End() token.Pos { return nodeEnd(wrapNode(s.Expr)) } +func (l *LambdaArg) Pos() token.Pos { + return posChoice(l.Lparen, nodePos(nodeSliceIndex(l.Args, 0))) +} + +func (l *LambdaArg) End() token.Pos { + return nodeEnd(wrapNode(l.Expr)) +} + func (n *NamedArg) Pos() token.Pos { return nodePos(wrapNode(n.Name)) } diff --git a/ast/sql.go b/ast/sql.go index e7a2ec76..fa8caaf2 100644 --- a/ast/sql.go +++ b/ast/sql.go @@ -506,6 +506,15 @@ func (c *CallExpr) SQL() string { ")" } +func (l *LambdaArg) SQL() string { + // This implementation is not exactly matched with the doc comment for simplicity. + return strOpt(!l.Lparen.Invalid(), "(") + + sqlJoin(l.Args, ", ") + + strOpt(!l.Lparen.Invalid(), ")") + + " -> " + + l.Expr.SQL() +} + func (n *NamedArg) SQL() string { return n.Name.SQL() + " => " + n.Value.SQL() } func (i *IgnoreNulls) SQL() string { return "IGNORE NULLS" } diff --git a/parser.go b/parser.go index ad6bf959..f7c30ddb 100644 --- a/parser.go +++ b/parser.go @@ -1590,6 +1590,42 @@ func (p *Parser) tryParseNamedArg() *ast.NamedArg { } } +func (p *Parser) lookaheadLambdaArg() bool { + lexer := p.Lexer.Clone() + defer func() { + p.Lexer = lexer + }() + + if p.Token.Kind != "(" && p.Token.Kind != token.TokenIdent { + return false + } + + // Note: all lambda patterns can be parsed as expr -> expr. + p.parseExpr() + return p.Token.Kind == "->" +} + +func (p *Parser) parseLambdaArg() *ast.LambdaArg { + lparen := token.InvalidPos + var args []*ast.Ident + if p.Token.Kind == "(" { + lparen = p.expect("(").Pos + args = parseCommaSeparatedList(p, p.parseIdent) + p.expect(")") + } else { + args = []*ast.Ident{p.parseIdent()} + } + + p.expect("->") + expr := p.parseExpr() + + return &ast.LambdaArg{ + Lparen: lparen, + Args: args, + Expr: expr, + } +} + func (p *Parser) parseArg() ast.Arg { if i := p.tryParseIntervalArg(); i != nil { return i @@ -1597,6 +1633,9 @@ func (p *Parser) parseArg() ast.Arg { if s := p.tryParseSequenceArg(); s != nil { return s } + if p.lookaheadLambdaArg() { + return p.parseLambdaArg() + } return p.parseExprArg() } diff --git a/testdata/input/expr/array_functions_array_filter_parenless_lambda.sql b/testdata/input/expr/array_functions_array_filter_parenless_lambda.sql new file mode 100644 index 00000000..e00d2ea4 --- /dev/null +++ b/testdata/input/expr/array_functions_array_filter_parenless_lambda.sql @@ -0,0 +1 @@ +ARRAY_FILTER([1 ,2, 3], e -> e > 1) \ No newline at end of file diff --git a/testdata/input/expr/array_functions_array_filter_two_args_lambda.sql b/testdata/input/expr/array_functions_array_filter_two_args_lambda.sql new file mode 100644 index 00000000..205e21f0 --- /dev/null +++ b/testdata/input/expr/array_functions_array_filter_two_args_lambda.sql @@ -0,0 +1 @@ +ARRAY_FILTER([0, 2, 3], (e, i) -> e > i) \ No newline at end of file diff --git a/testdata/result/expr/array_functions_array_filter_parenless_lambda.sql.txt b/testdata/result/expr/array_functions_array_filter_parenless_lambda.sql.txt new file mode 100644 index 00000000..982a7bab --- /dev/null +++ b/testdata/result/expr/array_functions_array_filter_parenless_lambda.sql.txt @@ -0,0 +1,72 @@ +--- array_functions_array_filter_parenless_lambda.sql +ARRAY_FILTER([1 ,2, 3], e -> e > 1) +--- AST +&ast.CallExpr{ + Rparen: 34, + Func: &ast.Ident{ + NamePos: 0, + NameEnd: 12, + Name: "ARRAY_FILTER", + }, + Distinct: false, + Args: []ast.Arg{ + &ast.ExprArg{ + Expr: &ast.ArrayLiteral{ + Array: -1, + Lbrack: 13, + Rbrack: 21, + Type: nil, + Values: []ast.Expr{ + &ast.IntLiteral{ + ValuePos: 14, + ValueEnd: 15, + Base: 10, + Value: "1", + }, + &ast.IntLiteral{ + ValuePos: 17, + ValueEnd: 18, + Base: 10, + Value: "2", + }, + &ast.IntLiteral{ + ValuePos: 20, + ValueEnd: 21, + Base: 10, + Value: "3", + }, + }, + }, + }, + &ast.LambdaArg{ + Lparen: -1, + Args: []*ast.Ident{ + &ast.Ident{ + NamePos: 24, + NameEnd: 25, + Name: "e", + }, + }, + Expr: &ast.BinaryExpr{ + Op: ">", + Left: &ast.Ident{ + NamePos: 29, + NameEnd: 30, + Name: "e", + }, + Right: &ast.IntLiteral{ + ValuePos: 33, + ValueEnd: 34, + Base: 10, + Value: "1", + }, + }, + }, + }, + NamedArgs: []*ast.NamedArg(nil), + NullHandling: nil, + Having: nil, +} + +--- SQL +ARRAY_FILTER([1, 2, 3], e -> e > 1) diff --git a/testdata/result/expr/array_functions_array_filter_two_args_lambda.sql.txt b/testdata/result/expr/array_functions_array_filter_two_args_lambda.sql.txt new file mode 100644 index 00000000..7d83c243 --- /dev/null +++ b/testdata/result/expr/array_functions_array_filter_two_args_lambda.sql.txt @@ -0,0 +1,76 @@ +--- array_functions_array_filter_two_args_lambda.sql +ARRAY_FILTER([0, 2, 3], (e, i) -> e > i) +--- AST +&ast.CallExpr{ + Rparen: 39, + Func: &ast.Ident{ + NamePos: 0, + NameEnd: 12, + Name: "ARRAY_FILTER", + }, + Distinct: false, + Args: []ast.Arg{ + &ast.ExprArg{ + Expr: &ast.ArrayLiteral{ + Array: -1, + Lbrack: 13, + Rbrack: 21, + Type: nil, + Values: []ast.Expr{ + &ast.IntLiteral{ + ValuePos: 14, + ValueEnd: 15, + Base: 10, + Value: "0", + }, + &ast.IntLiteral{ + ValuePos: 17, + ValueEnd: 18, + Base: 10, + Value: "2", + }, + &ast.IntLiteral{ + ValuePos: 20, + ValueEnd: 21, + Base: 10, + Value: "3", + }, + }, + }, + }, + &ast.LambdaArg{ + Lparen: 24, + Args: []*ast.Ident{ + &ast.Ident{ + NamePos: 25, + NameEnd: 26, + Name: "e", + }, + &ast.Ident{ + NamePos: 28, + NameEnd: 29, + Name: "i", + }, + }, + Expr: &ast.BinaryExpr{ + Op: ">", + Left: &ast.Ident{ + NamePos: 34, + NameEnd: 35, + Name: "e", + }, + Right: &ast.Ident{ + NamePos: 38, + NameEnd: 39, + Name: "i", + }, + }, + }, + }, + NamedArgs: []*ast.NamedArg(nil), + NullHandling: nil, + Having: nil, +} + +--- SQL +ARRAY_FILTER([0, 2, 3], (e, i) -> e > i) From 82ce77ae7985bd0ccd29d264d61ed4f65b8ff98d Mon Sep 17 00:00:00 2001 From: apstndb <803393+apstndb@users.noreply.github.com> Date: Tue, 3 Dec 2024 16:36:09 +0900 Subject: [PATCH 4/8] Fix lookaheadLambdaArg not to use parseExpr (#221) * Fix lookaheadLambdaArg * Remove unreachable code --- parser.go | 31 ++++++-- ...array_filter_one_arg_with_paren_lambda.sql | 1 + ...y_filter_one_arg_with_paren_lambda.sql.txt | 72 +++++++++++++++++++ 3 files changed, 99 insertions(+), 5 deletions(-) create mode 100644 testdata/input/expr/array_functions_array_filter_one_arg_with_paren_lambda.sql create mode 100644 testdata/result/expr/array_functions_array_filter_one_arg_with_paren_lambda.sql.txt diff --git a/parser.go b/parser.go index f7c30ddb..72f17544 100644 --- a/parser.go +++ b/parser.go @@ -1596,13 +1596,34 @@ func (p *Parser) lookaheadLambdaArg() bool { p.Lexer = lexer }() - if p.Token.Kind != "(" && p.Token.Kind != token.TokenIdent { + switch p.Token.Kind { + case "(": + p.nextToken() + if p.Token.Kind != token.TokenIdent { + return false + } + p.nextToken() + + for p.Token.Kind != ")" { + if p.Token.Kind != "," { + return false + } + p.nextToken() + + if p.Token.Kind != token.TokenIdent { + return false + } + p.nextToken() + } + p.nextToken() + + return p.Token.Kind == "->" + case token.TokenIdent: + p.nextToken() + return p.Token.Kind == "->" + default: return false } - - // Note: all lambda patterns can be parsed as expr -> expr. - p.parseExpr() - return p.Token.Kind == "->" } func (p *Parser) parseLambdaArg() *ast.LambdaArg { diff --git a/testdata/input/expr/array_functions_array_filter_one_arg_with_paren_lambda.sql b/testdata/input/expr/array_functions_array_filter_one_arg_with_paren_lambda.sql new file mode 100644 index 00000000..c303120d --- /dev/null +++ b/testdata/input/expr/array_functions_array_filter_one_arg_with_paren_lambda.sql @@ -0,0 +1 @@ +ARRAY_FILTER([1 ,2, 3], (e) -> e > 1) \ No newline at end of file diff --git a/testdata/result/expr/array_functions_array_filter_one_arg_with_paren_lambda.sql.txt b/testdata/result/expr/array_functions_array_filter_one_arg_with_paren_lambda.sql.txt new file mode 100644 index 00000000..a2037132 --- /dev/null +++ b/testdata/result/expr/array_functions_array_filter_one_arg_with_paren_lambda.sql.txt @@ -0,0 +1,72 @@ +--- array_functions_array_filter_one_arg_with_paren_lambda.sql +ARRAY_FILTER([1 ,2, 3], (e) -> e > 1) +--- AST +&ast.CallExpr{ + Rparen: 36, + Func: &ast.Ident{ + NamePos: 0, + NameEnd: 12, + Name: "ARRAY_FILTER", + }, + Distinct: false, + Args: []ast.Arg{ + &ast.ExprArg{ + Expr: &ast.ArrayLiteral{ + Array: -1, + Lbrack: 13, + Rbrack: 21, + Type: nil, + Values: []ast.Expr{ + &ast.IntLiteral{ + ValuePos: 14, + ValueEnd: 15, + Base: 10, + Value: "1", + }, + &ast.IntLiteral{ + ValuePos: 17, + ValueEnd: 18, + Base: 10, + Value: "2", + }, + &ast.IntLiteral{ + ValuePos: 20, + ValueEnd: 21, + Base: 10, + Value: "3", + }, + }, + }, + }, + &ast.LambdaArg{ + Lparen: 24, + Args: []*ast.Ident{ + &ast.Ident{ + NamePos: 25, + NameEnd: 26, + Name: "e", + }, + }, + Expr: &ast.BinaryExpr{ + Op: ">", + Left: &ast.Ident{ + NamePos: 31, + NameEnd: 32, + Name: "e", + }, + Right: &ast.IntLiteral{ + ValuePos: 35, + ValueEnd: 36, + Base: 10, + Value: "1", + }, + }, + }, + }, + NamedArgs: []*ast.NamedArg(nil), + NullHandling: nil, + Having: nil, +} + +--- SQL +ARRAY_FILTER([1, 2, 3], (e) -> e > 1) From 66dfc61aa2dd037f5528e524f24732894f2f6cff Mon Sep 17 00:00:00 2001 From: apstndb <803393+apstndb@users.noreply.github.com> Date: Tue, 3 Dec 2024 16:42:41 +0900 Subject: [PATCH 5/8] Implement THEN RETURN clause in DML statements (#214) * Implement THEN RETURN * Update testdata * Fix Update.SQL() * Fix Update.SQL() * Fix needless sqlOpt --- ast/ast.go | 58 ++++++++--- ast/pos.go | 22 ++++- ast/sql.go | 55 +++++------ parser.go | 58 +++++++++-- testdata/input/dml/delete_then_return.sql | 1 + ...t_or_update_then_return_with_action_as.sql | 3 + .../dml/update_then_return_with_action.sql | 1 + testdata/result/dml/delete _from.sql.txt | 1 + testdata/result/dml/delete.sql.txt | 1 + testdata/result/dml/delete_as.sql.txt | 1 + .../result/dml/delete_then_return.sql.txt | 58 +++++++++++ .../result/dml/insert_into_values.sql.txt | 1 + testdata/result/dml/insert_or_ignore.sql.txt | 1 + testdata/result/dml/insert_or_update.sql.txt | 1 + ..._update_then_return_with_action_as.sql.txt | 80 +++++++++++++++ testdata/result/dml/insert_select.sql.txt | 1 + testdata/result/dml/insert_values.sql.txt | 1 + .../result/dml/insert_values_default.sql.txt | 1 + .../dml/insert_with_sequence_function.sql.txt | 1 + testdata/result/dml/update.sql.txt | 1 + testdata/result/dml/update_as.sql.txt | 1 + .../update_then_return_with_action.sql.txt | 97 +++++++++++++++++++ .../result/statement/delete _from.sql.txt | 1 + testdata/result/statement/delete.sql.txt | 1 + testdata/result/statement/delete_as.sql.txt | 1 + .../statement/delete_then_return.sql.txt | 58 +++++++++++ .../statement/insert_into_values.sql.txt | 1 + .../result/statement/insert_or_ignore.sql.txt | 1 + .../result/statement/insert_or_update.sql.txt | 1 + ..._update_then_return_with_action_as.sql.txt | 80 +++++++++++++++ .../result/statement/insert_select.sql.txt | 1 + .../result/statement/insert_values.sql.txt | 1 + .../statement/insert_values_default.sql.txt | 1 + .../insert_with_sequence_function.sql.txt | 1 + testdata/result/statement/update.sql.txt | 1 + testdata/result/statement/update_as.sql.txt | 1 + .../update_then_return_with_action.sql.txt | 97 +++++++++++++++++++ 37 files changed, 638 insertions(+), 54 deletions(-) create mode 100644 testdata/input/dml/delete_then_return.sql create mode 100644 testdata/input/dml/insert_or_update_then_return_with_action_as.sql create mode 100644 testdata/input/dml/update_then_return_with_action.sql create mode 100644 testdata/result/dml/delete_then_return.sql.txt create mode 100644 testdata/result/dml/insert_or_update_then_return_with_action_as.sql.txt create mode 100644 testdata/result/dml/update_then_return_with_action.sql.txt create mode 100644 testdata/result/statement/delete_then_return.sql.txt create mode 100644 testdata/result/statement/insert_or_update_then_return_with_action_as.sql.txt create mode 100644 testdata/result/statement/update_then_return_with_action.sql.txt diff --git a/ast/ast.go b/ast/ast.go index e13a9791..35718abc 100644 --- a/ast/ast.go +++ b/ast/ast.go @@ -3165,20 +3165,48 @@ type AlterSearchIndex struct { // // ================================================================================ +// WithAction is WITH ACTION clause in ThenReturn. +// +// WITH ACTION {{.Alias | sqlOpt}} +type WithAction struct { + // pos = With + // end = Alias.end || Action + 6 + + With token.Pos // position of "WITH" keyword + Action token.Pos // position of "ACTION" keyword + + Alias *AsAlias // optional +} + +// ThenReturn is THEN RETURN clause in DML. +// +// THEN RETURN {{.WithAction | sqlOpt}} {{.Items | sqlJoin ", "}} +type ThenReturn struct { + // pos = Then + // end = Items[$].end + + Then token.Pos // position of "THEN" keyword + + WithAction *WithAction // optional + Items []SelectItem +} + // Insert is INSERT statement node. // // INSERT {{if .InsertOrType}}OR .InsertOrType{{end}}INTO {{.TableName | sql}} ({{.Columns | sqlJoin ","}}) {{.Input | sql}} +// {{.ThenReturn | sqlOpt}} type Insert struct { // pos = Insert - // end = Input.end + // end = (ThenReturn ?? Input).end Insert token.Pos // position of "INSERT" keyword InsertOrType InsertOrType - TableName *Ident - Columns []*Ident - Input InsertInput + TableName *Ident + Columns []*Ident + Input InsertInput + ThenReturn *ThenReturn // optional } // ValuesInput is VALUES clause in INSERT. @@ -3231,31 +3259,35 @@ type SubQueryInput struct { // Delete is DELETE statement. // // DELETE FROM {{.TableName | sql}} {{.As | sqlOpt}} {{.Where | sql}} +// {{.ThenReturn | sqlOpt}} type Delete struct { // pos = Delete - // end = Where.end + // end = (ThenReturn ?? Where).end Delete token.Pos // position of "DELETE" keyword - TableName *Ident - As *AsAlias // optional - Where *Where + TableName *Ident + As *AsAlias // optional + Where *Where + ThenReturn *ThenReturn // optional } // Update is UPDATE statement. // // UPDATE {{.TableName | sql}} {{.As | sqlOpt}} // SET {{.Updates | sqlJoin ","}} {{.Where | sql}} +// {{.ThenReturn | sqlOpt}} type Update struct { // pos = Update - // end = Where.end + // end = (ThenReturn ?? Where).end Update token.Pos // position of "UPDATE" keyword - TableName *Ident - As *AsAlias // optional - Updates []*UpdateItem // len(Updates) > 0 - Where *Where + TableName *Ident + As *AsAlias // optional + Updates []*UpdateItem // len(Updates) > 0 + Where *Where + ThenReturn *ThenReturn // optional } // UpdateItem is SET clause items in UPDATE. diff --git a/ast/pos.go b/ast/pos.go index c6cc1f4b..7b7a108c 100644 --- a/ast/pos.go +++ b/ast/pos.go @@ -1590,12 +1590,28 @@ func (a *AlterSearchIndex) End() token.Pos { return nodeEnd(wrapNode(a.IndexAlteration)) } +func (w *WithAction) Pos() token.Pos { + return w.With +} + +func (w *WithAction) End() token.Pos { + return posChoice(nodeEnd(wrapNode(w.Alias)), posAdd(w.Action, 6)) +} + +func (t *ThenReturn) Pos() token.Pos { + return t.Then +} + +func (t *ThenReturn) End() token.Pos { + return nodeEnd(nodeSliceLast(t.Items)) +} + func (i *Insert) Pos() token.Pos { return i.Insert } func (i *Insert) End() token.Pos { - return nodeEnd(wrapNode(i.Input)) + return nodeEnd(nodeChoice(wrapNode(i.ThenReturn), wrapNode(i.Input))) } func (v *ValuesInput) Pos() token.Pos { @@ -1635,7 +1651,7 @@ func (d *Delete) Pos() token.Pos { } func (d *Delete) End() token.Pos { - return nodeEnd(wrapNode(d.Where)) + return nodeEnd(nodeChoice(wrapNode(d.ThenReturn), wrapNode(d.Where))) } func (u *Update) Pos() token.Pos { @@ -1643,7 +1659,7 @@ func (u *Update) Pos() token.Pos { } func (u *Update) End() token.Pos { - return nodeEnd(wrapNode(u.Where)) + return nodeEnd(nodeChoice(wrapNode(u.ThenReturn), wrapNode(u.Where))) } func (u *UpdateItem) Pos() token.Pos { diff --git a/ast/sql.go b/ast/sql.go index fa8caaf2..eedd404a 100644 --- a/ast/sql.go +++ b/ast/sql.go @@ -1385,20 +1385,22 @@ func (a *AlterSearchIndex) SQL() string { // // ================================================================================ +func (w *WithAction) SQL() string { + return "WITH ACTION" + sqlOpt(" ", w.Alias, "") +} + +func (t *ThenReturn) SQL() string { + return "THEN RETURN " + sqlOpt("", t.WithAction, " ") + sqlJoin(t.Items, ", ") +} + func (i *Insert) SQL() string { - sql := "INSERT " - if i.InsertOrType != "" { - sql += "OR " + string(i.InsertOrType) + " " - } - sql += "INTO " + i.TableName.SQL() + " (" - for i, c := range i.Columns { - if i != 0 { - sql += ", " - } - sql += c.SQL() - } - sql += ") " + i.Input.SQL() - return sql + return "INSERT " + + strOpt(i.InsertOrType != "", "OR "+string(i.InsertOrType)+" ") + + "INTO " + i.TableName.SQL() + " (" + + sqlJoin(i.Columns, ", ") + + ") " + + i.Input.SQL() + + sqlOpt(" ", i.ThenReturn, "") } func (v *ValuesInput) SQL() string { @@ -1436,25 +1438,20 @@ func (s *SubQueryInput) SQL() string { } func (d *Delete) SQL() string { - sql := "DELETE FROM " + d.TableName.SQL() - if d.As != nil { - sql += " " + d.As.SQL() - } - sql += " " + d.Where.SQL() - return sql + return "DELETE FROM " + + d.TableName.SQL() + " " + + sqlOpt("", d.As, " ") + + d.Where.SQL() + + sqlOpt(" ", d.ThenReturn, "") } func (u *Update) SQL() string { - sql := "UPDATE " + u.TableName.SQL() - if u.As != nil { - sql += " " + u.As.SQL() - } - sql += " SET " + u.Updates[0].SQL() - for _, item := range u.Updates[1:] { - sql += ", " + item.SQL() - } - sql += " " + u.Where.SQL() - return sql + return "UPDATE " + u.TableName.SQL() + " " + + sqlOpt("", u.As, " ") + + "SET " + + sqlJoin(u.Updates, ", ") + + " " + u.Where.SQL() + + sqlOpt(" ", u.ThenReturn, "") } func (u *UpdateItem) SQL() string { diff --git a/parser.go b/parser.go index 72f17544..40a3d9a6 100644 --- a/parser.go +++ b/parser.go @@ -4124,6 +4124,39 @@ func (p *Parser) parseDML() ast.DML { panic(p.errorfAtToken(id, "expect pseudo keyword: INSERT, DELETE, UPDATE but: %s", id.AsString)) } +func (p *Parser) tryParseWithAction() *ast.WithAction { + if p.Token.Kind != "WITH" { + return nil + } + + with := p.expect("WITH").Pos + action := p.expectKeywordLike("ACTION").Pos + alias := p.tryParseAsAlias(withRequiredAs) + + return &ast.WithAction{ + With: with, + Action: action, + Alias: alias, + } +} + +func (p *Parser) tryParseThenReturn() *ast.ThenReturn { + if p.Token.Kind != "THEN" { + return nil + } + + then := p.expect("THEN").Pos + p.expectKeywordLike("RETURN") + withAction := p.tryParseWithAction() + items := parseCommaSeparatedList(p, p.parseSelectItem) + + return &ast.ThenReturn{ + Then: then, + WithAction: withAction, + Items: items, + } +} + func (p *Parser) parseInsert(pos token.Pos) *ast.Insert { var insertOrType ast.InsertOrType if p.Token.Kind == "OR" { @@ -4165,12 +4198,15 @@ func (p *Parser) parseInsert(pos token.Pos) *ast.Insert { input = p.parseSubQueryInput() } + thenReturn := p.tryParseThenReturn() + return &ast.Insert{ Insert: pos, InsertOrType: insertOrType, TableName: name, Columns: columns, Input: input, + ThenReturn: thenReturn, } } @@ -4238,12 +4274,14 @@ func (p *Parser) parseDelete(pos token.Pos) *ast.Delete { name := p.parseIdent() as := p.tryParseAsAlias(withOptionalAs) where := p.parseWhere() + thenReturn := p.tryParseThenReturn() return &ast.Delete{ - Delete: pos, - TableName: name, - As: as, - Where: where, + Delete: pos, + TableName: name, + As: as, + Where: where, + ThenReturn: thenReturn, } } @@ -4256,13 +4294,15 @@ func (p *Parser) parseUpdate(pos token.Pos) *ast.Update { items := parseCommaSeparatedList(p, p.parseUpdateItem) where := p.parseWhere() + thenReturn := p.tryParseThenReturn() return &ast.Update{ - Update: pos, - TableName: name, - As: as, - Updates: items, - Where: where, + Update: pos, + TableName: name, + As: as, + Updates: items, + Where: where, + ThenReturn: thenReturn, } } diff --git a/testdata/input/dml/delete_then_return.sql b/testdata/input/dml/delete_then_return.sql new file mode 100644 index 00000000..4bbf277e --- /dev/null +++ b/testdata/input/dml/delete_then_return.sql @@ -0,0 +1 @@ +delete foo where foo = 1 and bar = 2 then return * \ No newline at end of file diff --git a/testdata/input/dml/insert_or_update_then_return_with_action_as.sql b/testdata/input/dml/insert_or_update_then_return_with_action_as.sql new file mode 100644 index 00000000..efb81ae3 --- /dev/null +++ b/testdata/input/dml/insert_or_update_then_return_with_action_as.sql @@ -0,0 +1,3 @@ +INSERT OR UPDATE INTO foo +(foo, bar) VALUES (1, 2) +THEN RETURN WITH ACTION AS act * \ No newline at end of file diff --git a/testdata/input/dml/update_then_return_with_action.sql b/testdata/input/dml/update_then_return_with_action.sql new file mode 100644 index 00000000..696d7db4 --- /dev/null +++ b/testdata/input/dml/update_then_return_with_action.sql @@ -0,0 +1 @@ +update foo set foo = bar, bar = foo, baz = DEFAULT where foo = 1 then return with action * \ No newline at end of file diff --git a/testdata/result/dml/delete _from.sql.txt b/testdata/result/dml/delete _from.sql.txt index c9972ae3..29eddeae 100644 --- a/testdata/result/dml/delete _from.sql.txt +++ b/testdata/result/dml/delete _from.sql.txt @@ -43,6 +43,7 @@ delete from foo where foo = 1 and bar = 2 }, }, }, + ThenReturn: (*ast.ThenReturn)(nil), } --- SQL diff --git a/testdata/result/dml/delete.sql.txt b/testdata/result/dml/delete.sql.txt index b5ec82a5..1bf07ded 100644 --- a/testdata/result/dml/delete.sql.txt +++ b/testdata/result/dml/delete.sql.txt @@ -43,6 +43,7 @@ delete foo where foo = 1 and bar = 2 }, }, }, + ThenReturn: (*ast.ThenReturn)(nil), } --- SQL diff --git a/testdata/result/dml/delete_as.sql.txt b/testdata/result/dml/delete_as.sql.txt index 2eee871a..36c330e3 100644 --- a/testdata/result/dml/delete_as.sql.txt +++ b/testdata/result/dml/delete_as.sql.txt @@ -42,6 +42,7 @@ delete foo as F where F.foo = 1 }, }, }, + ThenReturn: (*ast.ThenReturn)(nil), } --- SQL diff --git a/testdata/result/dml/delete_then_return.sql.txt b/testdata/result/dml/delete_then_return.sql.txt new file mode 100644 index 00000000..94b742a1 --- /dev/null +++ b/testdata/result/dml/delete_then_return.sql.txt @@ -0,0 +1,58 @@ +--- delete_then_return.sql +delete foo where foo = 1 and bar = 2 then return * +--- AST +&ast.Delete{ + Delete: 0, + TableName: &ast.Ident{ + NamePos: 7, + NameEnd: 10, + Name: "foo", + }, + As: (*ast.AsAlias)(nil), + Where: &ast.Where{ + Where: 11, + Expr: &ast.BinaryExpr{ + Op: "AND", + Left: &ast.BinaryExpr{ + Op: "=", + Left: &ast.Ident{ + NamePos: 17, + NameEnd: 20, + Name: "foo", + }, + Right: &ast.IntLiteral{ + ValuePos: 23, + ValueEnd: 24, + Base: 10, + Value: "1", + }, + }, + Right: &ast.BinaryExpr{ + Op: "=", + Left: &ast.Ident{ + NamePos: 29, + NameEnd: 32, + Name: "bar", + }, + Right: &ast.IntLiteral{ + ValuePos: 35, + ValueEnd: 36, + Base: 10, + Value: "2", + }, + }, + }, + }, + ThenReturn: &ast.ThenReturn{ + Then: 37, + WithAction: (*ast.WithAction)(nil), + Items: []ast.SelectItem{ + &ast.Star{ + Star: 49, + }, + }, + }, +} + +--- SQL +DELETE FROM foo WHERE foo = 1 AND bar = 2 THEN RETURN * diff --git a/testdata/result/dml/insert_into_values.sql.txt b/testdata/result/dml/insert_into_values.sql.txt index 047a68ed..dc897ce3 100644 --- a/testdata/result/dml/insert_into_values.sql.txt +++ b/testdata/result/dml/insert_into_values.sql.txt @@ -105,6 +105,7 @@ values (1, 2, 3), }, }, }, + ThenReturn: (*ast.ThenReturn)(nil), } --- SQL diff --git a/testdata/result/dml/insert_or_ignore.sql.txt b/testdata/result/dml/insert_or_ignore.sql.txt index 28adbf40..9994ff8e 100644 --- a/testdata/result/dml/insert_or_ignore.sql.txt +++ b/testdata/result/dml/insert_or_ignore.sql.txt @@ -53,6 +53,7 @@ INSERT OR IGNORE INTO foo }, }, }, + ThenReturn: (*ast.ThenReturn)(nil), } --- SQL diff --git a/testdata/result/dml/insert_or_update.sql.txt b/testdata/result/dml/insert_or_update.sql.txt index fbda7b80..a87b61f8 100644 --- a/testdata/result/dml/insert_or_update.sql.txt +++ b/testdata/result/dml/insert_or_update.sql.txt @@ -53,6 +53,7 @@ INSERT OR UPDATE INTO foo }, }, }, + ThenReturn: (*ast.ThenReturn)(nil), } --- SQL diff --git a/testdata/result/dml/insert_or_update_then_return_with_action_as.sql.txt b/testdata/result/dml/insert_or_update_then_return_with_action_as.sql.txt new file mode 100644 index 00000000..ab5e4a6d --- /dev/null +++ b/testdata/result/dml/insert_or_update_then_return_with_action_as.sql.txt @@ -0,0 +1,80 @@ +--- insert_or_update_then_return_with_action_as.sql +INSERT OR UPDATE INTO foo +(foo, bar) VALUES (1, 2) +THEN RETURN WITH ACTION AS act * +--- AST +&ast.Insert{ + Insert: 0, + InsertOrType: "UPDATE", + TableName: &ast.Ident{ + NamePos: 22, + NameEnd: 25, + Name: "foo", + }, + Columns: []*ast.Ident{ + &ast.Ident{ + NamePos: 27, + NameEnd: 30, + Name: "foo", + }, + &ast.Ident{ + NamePos: 32, + NameEnd: 35, + Name: "bar", + }, + }, + Input: &ast.ValuesInput{ + Values: 37, + Rows: []*ast.ValuesRow{ + &ast.ValuesRow{ + Lparen: 44, + Rparen: 49, + Exprs: []*ast.DefaultExpr{ + &ast.DefaultExpr{ + DefaultPos: -1, + Default: false, + Expr: &ast.IntLiteral{ + ValuePos: 45, + ValueEnd: 46, + Base: 10, + Value: "1", + }, + }, + &ast.DefaultExpr{ + DefaultPos: -1, + Default: false, + Expr: &ast.IntLiteral{ + ValuePos: 48, + ValueEnd: 49, + Base: 10, + Value: "2", + }, + }, + }, + }, + }, + }, + ThenReturn: &ast.ThenReturn{ + Then: 51, + WithAction: &ast.WithAction{ + With: 63, + Action: 68, + Alias: &ast.AsAlias{ + As: 75, + Alias: &ast.Ident{ + NamePos: 78, + NameEnd: 81, + Name: "act", + }, + }, + }, + Items: []ast.SelectItem{ + &ast.Star{ + Star: 82, + }, + }, + }, +} + +--- SQL +INSERT OR UPDATE INTO foo (foo, bar) VALUES (1, 2) THEN RETURN WITH ACTION AS act * diff --git a/testdata/result/dml/insert_select.sql.txt b/testdata/result/dml/insert_select.sql.txt index 6afe8c7c..5b3b5590 100644 --- a/testdata/result/dml/insert_select.sql.txt +++ b/testdata/result/dml/insert_select.sql.txt @@ -94,6 +94,7 @@ select * from unnest([(1, 2), (3, 4)]) Limit: (*ast.Limit)(nil), }, }, + ThenReturn: (*ast.ThenReturn)(nil), } --- SQL diff --git a/testdata/result/dml/insert_values.sql.txt b/testdata/result/dml/insert_values.sql.txt index 09897f47..aae84cad 100644 --- a/testdata/result/dml/insert_values.sql.txt +++ b/testdata/result/dml/insert_values.sql.txt @@ -105,6 +105,7 @@ values (1, 2, 3), }, }, }, + ThenReturn: (*ast.ThenReturn)(nil), } --- SQL diff --git a/testdata/result/dml/insert_values_default.sql.txt b/testdata/result/dml/insert_values_default.sql.txt index ae7d07c4..2b3b0083 100644 --- a/testdata/result/dml/insert_values_default.sql.txt +++ b/testdata/result/dml/insert_values_default.sql.txt @@ -48,6 +48,7 @@ values (1, default) }, }, }, + ThenReturn: (*ast.ThenReturn)(nil), } --- SQL diff --git a/testdata/result/dml/insert_with_sequence_function.sql.txt b/testdata/result/dml/insert_with_sequence_function.sql.txt index 7f5a4b8d..c78a7cd4 100644 --- a/testdata/result/dml/insert_with_sequence_function.sql.txt +++ b/testdata/result/dml/insert_with_sequence_function.sql.txt @@ -54,6 +54,7 @@ INSERT INTO foo(bar) VALUES (GET_NEXT_SEQUENCE_VALUE(SEQUENCE my_sequence)) }, }, }, + ThenReturn: (*ast.ThenReturn)(nil), } --- SQL diff --git a/testdata/result/dml/update.sql.txt b/testdata/result/dml/update.sql.txt index 8f218958..fcf32946 100644 --- a/testdata/result/dml/update.sql.txt +++ b/testdata/result/dml/update.sql.txt @@ -78,6 +78,7 @@ update foo set foo = bar, bar = foo, baz = DEFAULT where foo = 1 }, }, }, + ThenReturn: (*ast.ThenReturn)(nil), } --- SQL diff --git a/testdata/result/dml/update_as.sql.txt b/testdata/result/dml/update_as.sql.txt index a647ea85..00622578 100644 --- a/testdata/result/dml/update_as.sql.txt +++ b/testdata/result/dml/update_as.sql.txt @@ -84,6 +84,7 @@ update foo as F set F.foo = F.bar + 1 where foo = F.bar }, }, }, + ThenReturn: (*ast.ThenReturn)(nil), } --- SQL diff --git a/testdata/result/dml/update_then_return_with_action.sql.txt b/testdata/result/dml/update_then_return_with_action.sql.txt new file mode 100644 index 00000000..438a476f --- /dev/null +++ b/testdata/result/dml/update_then_return_with_action.sql.txt @@ -0,0 +1,97 @@ +--- update_then_return_with_action.sql +update foo set foo = bar, bar = foo, baz = DEFAULT where foo = 1 then return with action * +--- AST +&ast.Update{ + Update: 0, + TableName: &ast.Ident{ + NamePos: 7, + NameEnd: 10, + Name: "foo", + }, + As: (*ast.AsAlias)(nil), + Updates: []*ast.UpdateItem{ + &ast.UpdateItem{ + Path: []*ast.Ident{ + &ast.Ident{ + NamePos: 15, + NameEnd: 18, + Name: "foo", + }, + }, + DefaultExpr: &ast.DefaultExpr{ + DefaultPos: -1, + Default: false, + Expr: &ast.Ident{ + NamePos: 21, + NameEnd: 24, + Name: "bar", + }, + }, + }, + &ast.UpdateItem{ + Path: []*ast.Ident{ + &ast.Ident{ + NamePos: 26, + NameEnd: 29, + Name: "bar", + }, + }, + DefaultExpr: &ast.DefaultExpr{ + DefaultPos: -1, + Default: false, + Expr: &ast.Ident{ + NamePos: 32, + NameEnd: 35, + Name: "foo", + }, + }, + }, + &ast.UpdateItem{ + Path: []*ast.Ident{ + &ast.Ident{ + NamePos: 37, + NameEnd: 40, + Name: "baz", + }, + }, + DefaultExpr: &ast.DefaultExpr{ + DefaultPos: 43, + Default: true, + Expr: nil, + }, + }, + }, + Where: &ast.Where{ + Where: 51, + Expr: &ast.BinaryExpr{ + Op: "=", + Left: &ast.Ident{ + NamePos: 57, + NameEnd: 60, + Name: "foo", + }, + Right: &ast.IntLiteral{ + ValuePos: 63, + ValueEnd: 64, + Base: 10, + Value: "1", + }, + }, + }, + ThenReturn: &ast.ThenReturn{ + Then: 65, + WithAction: &ast.WithAction{ + With: 77, + Action: 82, + Alias: (*ast.AsAlias)(nil), + }, + Items: []ast.SelectItem{ + &ast.Star{ + Star: 89, + }, + }, + }, +} + +--- SQL +UPDATE foo SET foo = bar, bar = foo, baz = DEFAULT WHERE foo = 1 THEN RETURN WITH ACTION * diff --git a/testdata/result/statement/delete _from.sql.txt b/testdata/result/statement/delete _from.sql.txt index c9972ae3..29eddeae 100644 --- a/testdata/result/statement/delete _from.sql.txt +++ b/testdata/result/statement/delete _from.sql.txt @@ -43,6 +43,7 @@ delete from foo where foo = 1 and bar = 2 }, }, }, + ThenReturn: (*ast.ThenReturn)(nil), } --- SQL diff --git a/testdata/result/statement/delete.sql.txt b/testdata/result/statement/delete.sql.txt index b5ec82a5..1bf07ded 100644 --- a/testdata/result/statement/delete.sql.txt +++ b/testdata/result/statement/delete.sql.txt @@ -43,6 +43,7 @@ delete foo where foo = 1 and bar = 2 }, }, }, + ThenReturn: (*ast.ThenReturn)(nil), } --- SQL diff --git a/testdata/result/statement/delete_as.sql.txt b/testdata/result/statement/delete_as.sql.txt index 2eee871a..36c330e3 100644 --- a/testdata/result/statement/delete_as.sql.txt +++ b/testdata/result/statement/delete_as.sql.txt @@ -42,6 +42,7 @@ delete foo as F where F.foo = 1 }, }, }, + ThenReturn: (*ast.ThenReturn)(nil), } --- SQL diff --git a/testdata/result/statement/delete_then_return.sql.txt b/testdata/result/statement/delete_then_return.sql.txt new file mode 100644 index 00000000..94b742a1 --- /dev/null +++ b/testdata/result/statement/delete_then_return.sql.txt @@ -0,0 +1,58 @@ +--- delete_then_return.sql +delete foo where foo = 1 and bar = 2 then return * +--- AST +&ast.Delete{ + Delete: 0, + TableName: &ast.Ident{ + NamePos: 7, + NameEnd: 10, + Name: "foo", + }, + As: (*ast.AsAlias)(nil), + Where: &ast.Where{ + Where: 11, + Expr: &ast.BinaryExpr{ + Op: "AND", + Left: &ast.BinaryExpr{ + Op: "=", + Left: &ast.Ident{ + NamePos: 17, + NameEnd: 20, + Name: "foo", + }, + Right: &ast.IntLiteral{ + ValuePos: 23, + ValueEnd: 24, + Base: 10, + Value: "1", + }, + }, + Right: &ast.BinaryExpr{ + Op: "=", + Left: &ast.Ident{ + NamePos: 29, + NameEnd: 32, + Name: "bar", + }, + Right: &ast.IntLiteral{ + ValuePos: 35, + ValueEnd: 36, + Base: 10, + Value: "2", + }, + }, + }, + }, + ThenReturn: &ast.ThenReturn{ + Then: 37, + WithAction: (*ast.WithAction)(nil), + Items: []ast.SelectItem{ + &ast.Star{ + Star: 49, + }, + }, + }, +} + +--- SQL +DELETE FROM foo WHERE foo = 1 AND bar = 2 THEN RETURN * diff --git a/testdata/result/statement/insert_into_values.sql.txt b/testdata/result/statement/insert_into_values.sql.txt index 047a68ed..dc897ce3 100644 --- a/testdata/result/statement/insert_into_values.sql.txt +++ b/testdata/result/statement/insert_into_values.sql.txt @@ -105,6 +105,7 @@ values (1, 2, 3), }, }, }, + ThenReturn: (*ast.ThenReturn)(nil), } --- SQL diff --git a/testdata/result/statement/insert_or_ignore.sql.txt b/testdata/result/statement/insert_or_ignore.sql.txt index 28adbf40..9994ff8e 100644 --- a/testdata/result/statement/insert_or_ignore.sql.txt +++ b/testdata/result/statement/insert_or_ignore.sql.txt @@ -53,6 +53,7 @@ INSERT OR IGNORE INTO foo }, }, }, + ThenReturn: (*ast.ThenReturn)(nil), } --- SQL diff --git a/testdata/result/statement/insert_or_update.sql.txt b/testdata/result/statement/insert_or_update.sql.txt index fbda7b80..a87b61f8 100644 --- a/testdata/result/statement/insert_or_update.sql.txt +++ b/testdata/result/statement/insert_or_update.sql.txt @@ -53,6 +53,7 @@ INSERT OR UPDATE INTO foo }, }, }, + ThenReturn: (*ast.ThenReturn)(nil), } --- SQL diff --git a/testdata/result/statement/insert_or_update_then_return_with_action_as.sql.txt b/testdata/result/statement/insert_or_update_then_return_with_action_as.sql.txt new file mode 100644 index 00000000..ab5e4a6d --- /dev/null +++ b/testdata/result/statement/insert_or_update_then_return_with_action_as.sql.txt @@ -0,0 +1,80 @@ +--- insert_or_update_then_return_with_action_as.sql +INSERT OR UPDATE INTO foo +(foo, bar) VALUES (1, 2) +THEN RETURN WITH ACTION AS act * +--- AST +&ast.Insert{ + Insert: 0, + InsertOrType: "UPDATE", + TableName: &ast.Ident{ + NamePos: 22, + NameEnd: 25, + Name: "foo", + }, + Columns: []*ast.Ident{ + &ast.Ident{ + NamePos: 27, + NameEnd: 30, + Name: "foo", + }, + &ast.Ident{ + NamePos: 32, + NameEnd: 35, + Name: "bar", + }, + }, + Input: &ast.ValuesInput{ + Values: 37, + Rows: []*ast.ValuesRow{ + &ast.ValuesRow{ + Lparen: 44, + Rparen: 49, + Exprs: []*ast.DefaultExpr{ + &ast.DefaultExpr{ + DefaultPos: -1, + Default: false, + Expr: &ast.IntLiteral{ + ValuePos: 45, + ValueEnd: 46, + Base: 10, + Value: "1", + }, + }, + &ast.DefaultExpr{ + DefaultPos: -1, + Default: false, + Expr: &ast.IntLiteral{ + ValuePos: 48, + ValueEnd: 49, + Base: 10, + Value: "2", + }, + }, + }, + }, + }, + }, + ThenReturn: &ast.ThenReturn{ + Then: 51, + WithAction: &ast.WithAction{ + With: 63, + Action: 68, + Alias: &ast.AsAlias{ + As: 75, + Alias: &ast.Ident{ + NamePos: 78, + NameEnd: 81, + Name: "act", + }, + }, + }, + Items: []ast.SelectItem{ + &ast.Star{ + Star: 82, + }, + }, + }, +} + +--- SQL +INSERT OR UPDATE INTO foo (foo, bar) VALUES (1, 2) THEN RETURN WITH ACTION AS act * diff --git a/testdata/result/statement/insert_select.sql.txt b/testdata/result/statement/insert_select.sql.txt index 6afe8c7c..5b3b5590 100644 --- a/testdata/result/statement/insert_select.sql.txt +++ b/testdata/result/statement/insert_select.sql.txt @@ -94,6 +94,7 @@ select * from unnest([(1, 2), (3, 4)]) Limit: (*ast.Limit)(nil), }, }, + ThenReturn: (*ast.ThenReturn)(nil), } --- SQL diff --git a/testdata/result/statement/insert_values.sql.txt b/testdata/result/statement/insert_values.sql.txt index 09897f47..aae84cad 100644 --- a/testdata/result/statement/insert_values.sql.txt +++ b/testdata/result/statement/insert_values.sql.txt @@ -105,6 +105,7 @@ values (1, 2, 3), }, }, }, + ThenReturn: (*ast.ThenReturn)(nil), } --- SQL diff --git a/testdata/result/statement/insert_values_default.sql.txt b/testdata/result/statement/insert_values_default.sql.txt index ae7d07c4..2b3b0083 100644 --- a/testdata/result/statement/insert_values_default.sql.txt +++ b/testdata/result/statement/insert_values_default.sql.txt @@ -48,6 +48,7 @@ values (1, default) }, }, }, + ThenReturn: (*ast.ThenReturn)(nil), } --- SQL diff --git a/testdata/result/statement/insert_with_sequence_function.sql.txt b/testdata/result/statement/insert_with_sequence_function.sql.txt index 7f5a4b8d..c78a7cd4 100644 --- a/testdata/result/statement/insert_with_sequence_function.sql.txt +++ b/testdata/result/statement/insert_with_sequence_function.sql.txt @@ -54,6 +54,7 @@ INSERT INTO foo(bar) VALUES (GET_NEXT_SEQUENCE_VALUE(SEQUENCE my_sequence)) }, }, }, + ThenReturn: (*ast.ThenReturn)(nil), } --- SQL diff --git a/testdata/result/statement/update.sql.txt b/testdata/result/statement/update.sql.txt index 8f218958..fcf32946 100644 --- a/testdata/result/statement/update.sql.txt +++ b/testdata/result/statement/update.sql.txt @@ -78,6 +78,7 @@ update foo set foo = bar, bar = foo, baz = DEFAULT where foo = 1 }, }, }, + ThenReturn: (*ast.ThenReturn)(nil), } --- SQL diff --git a/testdata/result/statement/update_as.sql.txt b/testdata/result/statement/update_as.sql.txt index a647ea85..00622578 100644 --- a/testdata/result/statement/update_as.sql.txt +++ b/testdata/result/statement/update_as.sql.txt @@ -84,6 +84,7 @@ update foo as F set F.foo = F.bar + 1 where foo = F.bar }, }, }, + ThenReturn: (*ast.ThenReturn)(nil), } --- SQL diff --git a/testdata/result/statement/update_then_return_with_action.sql.txt b/testdata/result/statement/update_then_return_with_action.sql.txt new file mode 100644 index 00000000..438a476f --- /dev/null +++ b/testdata/result/statement/update_then_return_with_action.sql.txt @@ -0,0 +1,97 @@ +--- update_then_return_with_action.sql +update foo set foo = bar, bar = foo, baz = DEFAULT where foo = 1 then return with action * +--- AST +&ast.Update{ + Update: 0, + TableName: &ast.Ident{ + NamePos: 7, + NameEnd: 10, + Name: "foo", + }, + As: (*ast.AsAlias)(nil), + Updates: []*ast.UpdateItem{ + &ast.UpdateItem{ + Path: []*ast.Ident{ + &ast.Ident{ + NamePos: 15, + NameEnd: 18, + Name: "foo", + }, + }, + DefaultExpr: &ast.DefaultExpr{ + DefaultPos: -1, + Default: false, + Expr: &ast.Ident{ + NamePos: 21, + NameEnd: 24, + Name: "bar", + }, + }, + }, + &ast.UpdateItem{ + Path: []*ast.Ident{ + &ast.Ident{ + NamePos: 26, + NameEnd: 29, + Name: "bar", + }, + }, + DefaultExpr: &ast.DefaultExpr{ + DefaultPos: -1, + Default: false, + Expr: &ast.Ident{ + NamePos: 32, + NameEnd: 35, + Name: "foo", + }, + }, + }, + &ast.UpdateItem{ + Path: []*ast.Ident{ + &ast.Ident{ + NamePos: 37, + NameEnd: 40, + Name: "baz", + }, + }, + DefaultExpr: &ast.DefaultExpr{ + DefaultPos: 43, + Default: true, + Expr: nil, + }, + }, + }, + Where: &ast.Where{ + Where: 51, + Expr: &ast.BinaryExpr{ + Op: "=", + Left: &ast.Ident{ + NamePos: 57, + NameEnd: 60, + Name: "foo", + }, + Right: &ast.IntLiteral{ + ValuePos: 63, + ValueEnd: 64, + Base: 10, + Value: "1", + }, + }, + }, + ThenReturn: &ast.ThenReturn{ + Then: 65, + WithAction: &ast.WithAction{ + With: 77, + Action: 82, + Alias: (*ast.AsAlias)(nil), + }, + Items: []ast.SelectItem{ + &ast.Star{ + Star: 89, + }, + }, + }, +} + +--- SQL +UPDATE foo SET foo = bar, bar = foo, baz = DEFAULT WHERE foo = 1 THEN RETURN WITH ACTION * From eccf53dd628ae195aaebe923f8c9653f0f588425 Mon Sep 17 00:00:00 2001 From: apstndb <803393+apstndb@users.noreply.github.com> Date: Wed, 18 Dec 2024 16:02:12 +0900 Subject: [PATCH 6/8] Fix the format of CREATE INDEX statement (#228) * Fix format of (*CreateIndex).SQL() * Update testdata * Fix format --- ast/sql.go | 36 ++++++------------- testdata/result/ddl/create_index.sql.txt | 2 +- .../ddl/create_index_if_not_exists.sql.txt | 2 +- .../ddl/create_index_interleave.sql.txt | 2 +- .../result/ddl/create_index_storing.sql.txt | 2 +- .../create_uniq_null_filtered_index.sql.txt | 2 +- .../ddl/named_schemas_create_index.sql.txt | 2 +- .../result/statement/create_index.sql.txt | 2 +- .../create_index_if_not_exists.sql.txt | 2 +- .../statement/create_index_interleave.sql.txt | 2 +- .../statement/create_index_storing.sql.txt | 2 +- .../create_uniq_null_filtered_index.sql.txt | 2 +- .../named_schemas_create_index.sql.txt | 2 +- 13 files changed, 22 insertions(+), 38 deletions(-) diff --git a/ast/sql.go b/ast/sql.go index eedd404a..8113ec4d 100644 --- a/ast/sql.go +++ b/ast/sql.go @@ -1027,32 +1027,16 @@ func (r *RenameTable) SQL() string { return "RENAME TABLE " + sqlJoin(r.Tos, ", func (r *RenameTableTo) SQL() string { return r.Old.SQL() + " TO " + r.New.SQL() } func (c *CreateIndex) SQL() string { - sql := "CREATE " - if c.Unique { - sql += "UNIQUE " - } - if c.NullFiltered { - sql += "NULL_FILTERED " - } - sql += "INDEX " - if c.IfNotExists { - sql += "IF NOT EXISTS " - } - sql += c.Name.SQL() + " ON " + c.TableName.SQL() + " (" - for i, k := range c.Keys { - if i != 0 { - sql += ", " - } - sql += k.SQL() - } - sql += ")" - if c.Storing != nil { - sql += " " + c.Storing.SQL() - } - if c.InterleaveIn != nil { - sql += c.InterleaveIn.SQL() - } - return sql + return "CREATE " + + strOpt(c.Unique, "UNIQUE ") + + strOpt(c.NullFiltered, "NULL_FILTERED ") + + "INDEX " + + strOpt(c.IfNotExists, "IF NOT EXISTS ") + + c.Name.SQL() + " ON " + c.TableName.SQL() + "(" + + sqlJoin(c.Keys, ", ") + + ")" + + sqlOpt(" ", c.Storing, "") + + sqlOpt("", c.InterleaveIn, "") } func (c *CreateVectorIndex) SQL() string { diff --git a/testdata/result/ddl/create_index.sql.txt b/testdata/result/ddl/create_index.sql.txt index 568a898e..1e7c971e 100644 --- a/testdata/result/ddl/create_index.sql.txt +++ b/testdata/result/ddl/create_index.sql.txt @@ -54,4 +54,4 @@ create index foo_bar on foo ( } --- SQL -CREATE INDEX foo_bar ON foo (bar DESC, baz ASC) +CREATE INDEX foo_bar ON foo(bar DESC, baz ASC) diff --git a/testdata/result/ddl/create_index_if_not_exists.sql.txt b/testdata/result/ddl/create_index_if_not_exists.sql.txt index 760d3db7..fc35d85f 100644 --- a/testdata/result/ddl/create_index_if_not_exists.sql.txt +++ b/testdata/result/ddl/create_index_if_not_exists.sql.txt @@ -42,4 +42,4 @@ create index if not exists foo_bar on foo (bar) } --- SQL -CREATE INDEX IF NOT EXISTS foo_bar ON foo (bar) +CREATE INDEX IF NOT EXISTS foo_bar ON foo(bar) diff --git a/testdata/result/ddl/create_index_interleave.sql.txt b/testdata/result/ddl/create_index_interleave.sql.txt index c4efd04e..32e8a5dc 100644 --- a/testdata/result/ddl/create_index_interleave.sql.txt +++ b/testdata/result/ddl/create_index_interleave.sql.txt @@ -62,4 +62,4 @@ create index foo_bar on foo ( } --- SQL -CREATE INDEX foo_bar ON foo (foo DESC) STORING (bar), INTERLEAVE IN foobar +CREATE INDEX foo_bar ON foo(foo DESC) STORING (bar), INTERLEAVE IN foobar diff --git a/testdata/result/ddl/create_index_storing.sql.txt b/testdata/result/ddl/create_index_storing.sql.txt index 3c538ded..1d08e6e3 100644 --- a/testdata/result/ddl/create_index_storing.sql.txt +++ b/testdata/result/ddl/create_index_storing.sql.txt @@ -59,4 +59,4 @@ create index foo_bar on foo ( } --- SQL -CREATE INDEX foo_bar ON foo (bar ASC) STORING (foo, baz) +CREATE INDEX foo_bar ON foo(bar ASC) STORING (foo, baz) diff --git a/testdata/result/ddl/create_uniq_null_filtered_index.sql.txt b/testdata/result/ddl/create_uniq_null_filtered_index.sql.txt index 8337e5b6..d6bd80b5 100644 --- a/testdata/result/ddl/create_uniq_null_filtered_index.sql.txt +++ b/testdata/result/ddl/create_uniq_null_filtered_index.sql.txt @@ -42,4 +42,4 @@ create unique null_filtered index foo_bar on foo (foo) } --- SQL -CREATE UNIQUE NULL_FILTERED INDEX foo_bar ON foo (foo) +CREATE UNIQUE NULL_FILTERED INDEX foo_bar ON foo(foo) diff --git a/testdata/result/ddl/named_schemas_create_index.sql.txt b/testdata/result/ddl/named_schemas_create_index.sql.txt index 7f58a8e0..8ee2b3f1 100644 --- a/testdata/result/ddl/named_schemas_create_index.sql.txt +++ b/testdata/result/ddl/named_schemas_create_index.sql.txt @@ -51,4 +51,4 @@ CREATE INDEX sch1.indexOnSingers ON sch1.Singers(FirstName) } --- SQL -CREATE INDEX sch1.indexOnSingers ON sch1.Singers (FirstName) +CREATE INDEX sch1.indexOnSingers ON sch1.Singers(FirstName) diff --git a/testdata/result/statement/create_index.sql.txt b/testdata/result/statement/create_index.sql.txt index 568a898e..1e7c971e 100644 --- a/testdata/result/statement/create_index.sql.txt +++ b/testdata/result/statement/create_index.sql.txt @@ -54,4 +54,4 @@ create index foo_bar on foo ( } --- SQL -CREATE INDEX foo_bar ON foo (bar DESC, baz ASC) +CREATE INDEX foo_bar ON foo(bar DESC, baz ASC) diff --git a/testdata/result/statement/create_index_if_not_exists.sql.txt b/testdata/result/statement/create_index_if_not_exists.sql.txt index 760d3db7..fc35d85f 100644 --- a/testdata/result/statement/create_index_if_not_exists.sql.txt +++ b/testdata/result/statement/create_index_if_not_exists.sql.txt @@ -42,4 +42,4 @@ create index if not exists foo_bar on foo (bar) } --- SQL -CREATE INDEX IF NOT EXISTS foo_bar ON foo (bar) +CREATE INDEX IF NOT EXISTS foo_bar ON foo(bar) diff --git a/testdata/result/statement/create_index_interleave.sql.txt b/testdata/result/statement/create_index_interleave.sql.txt index c4efd04e..32e8a5dc 100644 --- a/testdata/result/statement/create_index_interleave.sql.txt +++ b/testdata/result/statement/create_index_interleave.sql.txt @@ -62,4 +62,4 @@ create index foo_bar on foo ( } --- SQL -CREATE INDEX foo_bar ON foo (foo DESC) STORING (bar), INTERLEAVE IN foobar +CREATE INDEX foo_bar ON foo(foo DESC) STORING (bar), INTERLEAVE IN foobar diff --git a/testdata/result/statement/create_index_storing.sql.txt b/testdata/result/statement/create_index_storing.sql.txt index 3c538ded..1d08e6e3 100644 --- a/testdata/result/statement/create_index_storing.sql.txt +++ b/testdata/result/statement/create_index_storing.sql.txt @@ -59,4 +59,4 @@ create index foo_bar on foo ( } --- SQL -CREATE INDEX foo_bar ON foo (bar ASC) STORING (foo, baz) +CREATE INDEX foo_bar ON foo(bar ASC) STORING (foo, baz) diff --git a/testdata/result/statement/create_uniq_null_filtered_index.sql.txt b/testdata/result/statement/create_uniq_null_filtered_index.sql.txt index 8337e5b6..d6bd80b5 100644 --- a/testdata/result/statement/create_uniq_null_filtered_index.sql.txt +++ b/testdata/result/statement/create_uniq_null_filtered_index.sql.txt @@ -42,4 +42,4 @@ create unique null_filtered index foo_bar on foo (foo) } --- SQL -CREATE UNIQUE NULL_FILTERED INDEX foo_bar ON foo (foo) +CREATE UNIQUE NULL_FILTERED INDEX foo_bar ON foo(foo) diff --git a/testdata/result/statement/named_schemas_create_index.sql.txt b/testdata/result/statement/named_schemas_create_index.sql.txt index 7f58a8e0..8ee2b3f1 100644 --- a/testdata/result/statement/named_schemas_create_index.sql.txt +++ b/testdata/result/statement/named_schemas_create_index.sql.txt @@ -51,4 +51,4 @@ CREATE INDEX sch1.indexOnSingers ON sch1.Singers(FirstName) } --- SQL -CREATE INDEX sch1.indexOnSingers ON sch1.Singers (FirstName) +CREATE INDEX sch1.indexOnSingers ON sch1.Singers(FirstName) From bf9af9a872491a59b02787d7b0248b9a05b64602 Mon Sep 17 00:00:00 2001 From: apstndb <803393+apstndb@users.noreply.github.com> Date: Wed, 18 Dec 2024 16:02:50 +0900 Subject: [PATCH 7/8] Support vector_length (#222) * Support vector_length * Update testdata --- ast/ast.go | 12 ++-- ast/pos.go | 2 +- ast/sql.go | 2 +- parser.go | 35 ++++++++--- testdata/input/ddl/create_table_types.sql | 1 + testdata/result/ddl/create_model.sql.txt | 24 ++++--- .../result/ddl/create_table_types.sql.txt | 62 ++++++++++++++++--- .../result/statement/create_model.sql.txt | 24 ++++--- .../statement/create_table_types.sql.txt | 62 ++++++++++++++++--- 9 files changed, 170 insertions(+), 54 deletions(-) diff --git a/ast/ast.go b/ast/ast.go index 35718abc..19980c72 100644 --- a/ast/ast.go +++ b/ast/ast.go @@ -3089,15 +3089,17 @@ type SizedSchemaType struct { // ArraySchemaType is array type node in schema. // -// ARRAY<{{.Item | sql}}> +// ARRAY<{{.Item | sql}}>{{if .NamedArgs}}({{.NamedArgs | sqlJoin ", "}}){{end}} type ArraySchemaType struct { // pos = Array - // end = Gt + 1 + // end = Rparen + 1 || Gt + 1 - Array token.Pos // position of "ARRAY" keyword - Gt token.Pos // position of ">" + Array token.Pos // position of "ARRAY" keyword + Gt token.Pos // position of ">" + Rparen token.Pos // position of ")" when len(NamedArgs) > 0 - Item SchemaType // ScalarSchemaType or SizedSchemaType + Item SchemaType // ScalarSchemaType or SizedSchemaType + NamedArgs []*NamedArg } // ================================================================================ diff --git a/ast/pos.go b/ast/pos.go index 7b7a108c..0c26d41b 100644 --- a/ast/pos.go +++ b/ast/pos.go @@ -1563,7 +1563,7 @@ func (a *ArraySchemaType) Pos() token.Pos { } func (a *ArraySchemaType) End() token.Pos { - return posAdd(a.Gt, 1) + return posChoice(posAdd(a.Rparen, 1), posAdd(a.Gt, 1)) } func (c *CreateSearchIndex) Pos() token.Pos { diff --git a/ast/sql.go b/ast/sql.go index 8113ec4d..0ab1eea7 100644 --- a/ast/sql.go +++ b/ast/sql.go @@ -1335,7 +1335,7 @@ func (s *SizedSchemaType) SQL() string { } func (a *ArraySchemaType) SQL() string { - return "ARRAY<" + a.Item.SQL() + ">" + return "ARRAY<" + a.Item.SQL() + ">" + strOpt(len(a.NamedArgs) > 0, "("+sqlJoin(a.NamedArgs, ", ")+")") } // ================================================================================ diff --git a/parser.go b/parser.go index 40a3d9a6..d41120a4 100644 --- a/parser.go +++ b/parser.go @@ -1577,19 +1577,25 @@ func (p *Parser) lookaheadNamedArg() bool { return p.Token.Kind == "=>" } -func (p *Parser) tryParseNamedArg() *ast.NamedArg { - if !p.lookaheadNamedArg() { - return nil - } +func (p *Parser) parseNamedArg() *ast.NamedArg { name := p.parseIdent() p.expect("=>") value := p.parseExpr() + return &ast.NamedArg{ Name: name, Value: value, } } +func (p *Parser) tryParseNamedArg() *ast.NamedArg { + if !p.lookaheadNamedArg() { + return nil + } + + return p.parseNamedArg() +} + func (p *Parser) lookaheadLambdaArg() bool { lexer := p.Lexer.Clone() defer func() { @@ -3916,10 +3922,21 @@ func (p *Parser) parseSchemaType() ast.SchemaType { p.expect("<") t := p.parseScalarSchemaType() end := p.expect(">").Pos + + var namedArgs []*ast.NamedArg + rparen := token.InvalidPos + if p.Token.Kind == "(" { + p.nextToken() + namedArgs = parseCommaSeparatedList(p, p.parseNamedArg) + rparen = p.expect(")").Pos + } + return &ast.ArraySchemaType{ - Array: pos, - Gt: end, - Item: t, + Array: pos, + Gt: end, + Item: t, + NamedArgs: namedArgs, + Rparen: rparen, } } @@ -4134,9 +4151,9 @@ func (p *Parser) tryParseWithAction() *ast.WithAction { alias := p.tryParseAsAlias(withRequiredAs) return &ast.WithAction{ - With: with, + With: with, Action: action, - Alias: alias, + Alias: alias, } } diff --git a/testdata/input/ddl/create_table_types.sql b/testdata/input/ddl/create_table_types.sql index d1d9c6f4..fb0379d0 100644 --- a/testdata/input/ddl/create_table_types.sql +++ b/testdata/input/ddl/create_table_types.sql @@ -12,4 +12,5 @@ create table types ( ab array, abs array, p examples.ProtoType, + af32vl array(vector_length=>128), ) primary key (i) diff --git a/testdata/result/ddl/create_model.sql.txt b/testdata/result/ddl/create_model.sql.txt index 8ef0fbe3..29e55f39 100644 --- a/testdata/result/ddl/create_model.sql.txt +++ b/testdata/result/ddl/create_model.sql.txt @@ -62,15 +62,17 @@ OPTIONS ( Name: "tag_array", }, DataType: &ast.ArraySchemaType{ - Array: 97, - Gt: 114, - Item: &ast.SizedSchemaType{ + Array: 97, + Gt: 114, + Rparen: -1, + Item: &ast.SizedSchemaType{ NamePos: 103, Rparen: 113, Name: "STRING", Max: true, Size: nil, }, + NamedArgs: []*ast.NamedArg(nil), }, Options: (*ast.Options)(nil), }, @@ -83,12 +85,14 @@ OPTIONS ( Name: "scores", }, DataType: &ast.ArraySchemaType{ - Array: 136, - Gt: 149, - Item: &ast.ScalarSchemaType{ + Array: 136, + Gt: 149, + Rparen: -1, + Item: &ast.ScalarSchemaType{ NamePos: 142, Name: "FLOAT64", }, + NamedArgs: []*ast.NamedArg(nil), }, Options: (*ast.Options)(nil), }, @@ -99,15 +103,17 @@ OPTIONS ( Name: "classes", }, DataType: &ast.ArraySchemaType{ - Array: 162, - Gt: 179, - Item: &ast.SizedSchemaType{ + Array: 162, + Gt: 179, + Rparen: -1, + Item: &ast.SizedSchemaType{ NamePos: 168, Rparen: 178, Name: "STRING", Max: true, Size: nil, }, + NamedArgs: []*ast.NamedArg(nil), }, Options: (*ast.Options)(nil), }, diff --git a/testdata/result/ddl/create_table_types.sql.txt b/testdata/result/ddl/create_table_types.sql.txt index c789d70b..dbb18756 100644 --- a/testdata/result/ddl/create_table_types.sql.txt +++ b/testdata/result/ddl/create_table_types.sql.txt @@ -13,12 +13,13 @@ create table types ( ab array, abs array, p examples.ProtoType, + af32vl array(vector_length=>128), ) primary key (i) --- AST &ast.CreateTable{ Create: 0, - Rparen: 252, + Rparen: 297, IfNotExists: false, Name: &ast.Path{ Idents: []*ast.Ident{ @@ -230,12 +231,14 @@ create table types ( Name: "ab", }, Type: &ast.ArraySchemaType{ - Array: 174, - Gt: 184, - Item: &ast.ScalarSchemaType{ + Array: 174, + Gt: 184, + Rparen: -1, + Item: &ast.ScalarSchemaType{ NamePos: 180, Name: "BOOL", }, + NamedArgs: []*ast.NamedArg(nil), }, NotNull: false, DefaultExpr: (*ast.ColumnDefaultExpr)(nil), @@ -251,15 +254,17 @@ create table types ( Name: "abs", }, Type: &ast.ArraySchemaType{ - Array: 193, - Gt: 209, - Item: &ast.SizedSchemaType{ + Array: 193, + Gt: 209, + Rparen: -1, + Item: &ast.SizedSchemaType{ NamePos: 199, Rparen: 208, Name: "BYTES", Max: true, Size: nil, }, + NamedArgs: []*ast.NamedArg(nil), }, NotNull: false, DefaultExpr: (*ast.ColumnDefaultExpr)(nil), @@ -294,14 +299,51 @@ create table types ( Hidden: -1, Options: (*ast.Options)(nil), }, + &ast.ColumnDef{ + Null: -1, + Name: &ast.Ident{ + NamePos: 238, + NameEnd: 244, + Name: "af32vl", + }, + Type: &ast.ArraySchemaType{ + Array: 245, + Gt: 258, + Rparen: 278, + Item: &ast.ScalarSchemaType{ + NamePos: 251, + Name: "FLOAT32", + }, + NamedArgs: []*ast.NamedArg{ + &ast.NamedArg{ + Name: &ast.Ident{ + NamePos: 260, + NameEnd: 273, + Name: "vector_length", + }, + Value: &ast.IntLiteral{ + ValuePos: 275, + ValueEnd: 278, + Base: 10, + Value: "128", + }, + }, + }, + }, + NotNull: false, + DefaultExpr: (*ast.ColumnDefaultExpr)(nil), + GeneratedExpr: (*ast.GeneratedColumnExpr)(nil), + Hidden: -1, + Options: (*ast.Options)(nil), + }, }, TableConstraints: []*ast.TableConstraint(nil), PrimaryKeys: []*ast.IndexKey{ &ast.IndexKey{ DirPos: -1, Name: &ast.Ident{ - NamePos: 251, - NameEnd: 252, + NamePos: 296, + NameEnd: 297, Name: "i", }, Dir: "", @@ -313,4 +355,4 @@ create table types ( } --- SQL -CREATE TABLE types (b BOOL, i INT64, f32 FLOAT32, f FLOAT64, d DATE, t TIMESTAMP, s STRING(256), smax STRING(MAX), bs BYTES(256), bsmax BYTES(MAX), ab ARRAY, abs ARRAY, p examples.ProtoType) PRIMARY KEY (i) +CREATE TABLE types (b BOOL, i INT64, f32 FLOAT32, f FLOAT64, d DATE, t TIMESTAMP, s STRING(256), smax STRING(MAX), bs BYTES(256), bsmax BYTES(MAX), ab ARRAY, abs ARRAY, p examples.ProtoType, af32vl ARRAY(vector_length => 128)) PRIMARY KEY (i) diff --git a/testdata/result/statement/create_model.sql.txt b/testdata/result/statement/create_model.sql.txt index 8ef0fbe3..29e55f39 100644 --- a/testdata/result/statement/create_model.sql.txt +++ b/testdata/result/statement/create_model.sql.txt @@ -62,15 +62,17 @@ OPTIONS ( Name: "tag_array", }, DataType: &ast.ArraySchemaType{ - Array: 97, - Gt: 114, - Item: &ast.SizedSchemaType{ + Array: 97, + Gt: 114, + Rparen: -1, + Item: &ast.SizedSchemaType{ NamePos: 103, Rparen: 113, Name: "STRING", Max: true, Size: nil, }, + NamedArgs: []*ast.NamedArg(nil), }, Options: (*ast.Options)(nil), }, @@ -83,12 +85,14 @@ OPTIONS ( Name: "scores", }, DataType: &ast.ArraySchemaType{ - Array: 136, - Gt: 149, - Item: &ast.ScalarSchemaType{ + Array: 136, + Gt: 149, + Rparen: -1, + Item: &ast.ScalarSchemaType{ NamePos: 142, Name: "FLOAT64", }, + NamedArgs: []*ast.NamedArg(nil), }, Options: (*ast.Options)(nil), }, @@ -99,15 +103,17 @@ OPTIONS ( Name: "classes", }, DataType: &ast.ArraySchemaType{ - Array: 162, - Gt: 179, - Item: &ast.SizedSchemaType{ + Array: 162, + Gt: 179, + Rparen: -1, + Item: &ast.SizedSchemaType{ NamePos: 168, Rparen: 178, Name: "STRING", Max: true, Size: nil, }, + NamedArgs: []*ast.NamedArg(nil), }, Options: (*ast.Options)(nil), }, diff --git a/testdata/result/statement/create_table_types.sql.txt b/testdata/result/statement/create_table_types.sql.txt index c789d70b..dbb18756 100644 --- a/testdata/result/statement/create_table_types.sql.txt +++ b/testdata/result/statement/create_table_types.sql.txt @@ -13,12 +13,13 @@ create table types ( ab array, abs array, p examples.ProtoType, + af32vl array(vector_length=>128), ) primary key (i) --- AST &ast.CreateTable{ Create: 0, - Rparen: 252, + Rparen: 297, IfNotExists: false, Name: &ast.Path{ Idents: []*ast.Ident{ @@ -230,12 +231,14 @@ create table types ( Name: "ab", }, Type: &ast.ArraySchemaType{ - Array: 174, - Gt: 184, - Item: &ast.ScalarSchemaType{ + Array: 174, + Gt: 184, + Rparen: -1, + Item: &ast.ScalarSchemaType{ NamePos: 180, Name: "BOOL", }, + NamedArgs: []*ast.NamedArg(nil), }, NotNull: false, DefaultExpr: (*ast.ColumnDefaultExpr)(nil), @@ -251,15 +254,17 @@ create table types ( Name: "abs", }, Type: &ast.ArraySchemaType{ - Array: 193, - Gt: 209, - Item: &ast.SizedSchemaType{ + Array: 193, + Gt: 209, + Rparen: -1, + Item: &ast.SizedSchemaType{ NamePos: 199, Rparen: 208, Name: "BYTES", Max: true, Size: nil, }, + NamedArgs: []*ast.NamedArg(nil), }, NotNull: false, DefaultExpr: (*ast.ColumnDefaultExpr)(nil), @@ -294,14 +299,51 @@ create table types ( Hidden: -1, Options: (*ast.Options)(nil), }, + &ast.ColumnDef{ + Null: -1, + Name: &ast.Ident{ + NamePos: 238, + NameEnd: 244, + Name: "af32vl", + }, + Type: &ast.ArraySchemaType{ + Array: 245, + Gt: 258, + Rparen: 278, + Item: &ast.ScalarSchemaType{ + NamePos: 251, + Name: "FLOAT32", + }, + NamedArgs: []*ast.NamedArg{ + &ast.NamedArg{ + Name: &ast.Ident{ + NamePos: 260, + NameEnd: 273, + Name: "vector_length", + }, + Value: &ast.IntLiteral{ + ValuePos: 275, + ValueEnd: 278, + Base: 10, + Value: "128", + }, + }, + }, + }, + NotNull: false, + DefaultExpr: (*ast.ColumnDefaultExpr)(nil), + GeneratedExpr: (*ast.GeneratedColumnExpr)(nil), + Hidden: -1, + Options: (*ast.Options)(nil), + }, }, TableConstraints: []*ast.TableConstraint(nil), PrimaryKeys: []*ast.IndexKey{ &ast.IndexKey{ DirPos: -1, Name: &ast.Ident{ - NamePos: 251, - NameEnd: 252, + NamePos: 296, + NameEnd: 297, Name: "i", }, Dir: "", @@ -313,4 +355,4 @@ create table types ( } --- SQL -CREATE TABLE types (b BOOL, i INT64, f32 FLOAT32, f FLOAT64, d DATE, t TIMESTAMP, s STRING(256), smax STRING(MAX), bs BYTES(256), bsmax BYTES(MAX), ab ARRAY, abs ARRAY, p examples.ProtoType) PRIMARY KEY (i) +CREATE TABLE types (b BOOL, i INT64, f32 FLOAT32, f FLOAT64, d DATE, t TIMESTAMP, s STRING(256), smax STRING(MAX), bs BYTES(256), bsmax BYTES(MAX), ab ARRAY, abs ARRAY, p examples.ProtoType, af32vl ARRAY(vector_length => 128)) PRIMARY KEY (i) From bbd31cf4357b11620ebfeff4486dd600ac691fdc Mon Sep 17 00:00:00 2001 From: Hiroya Fujinami Date: Wed, 18 Dec 2024 16:13:37 +0900 Subject: [PATCH 8/8] Fix up #217, update k0kubun/pp to v3 and use SeOmitEmpty (#229) * Use k0kubun/pp/v3 * Update testdata --------- Co-authored-by: apstndb <803393+apstndb@users.noreply.github.com> --- go.mod | 6 +- go.sum | 13 +- parser_test.go | 11 +- .../ddl/alter_change_stream_options.sql.txt | 3 +- ...ter_change_stream_set_drop_for_all.sql.txt | 3 +- .../alter_change_stream_set_for_all.sql.txt | 3 +- ...hange_stream_set_for_table_columns.sql.txt | 3 +- testdata/result/ddl/alter_database.sql.txt | 3 +- .../ddl/alter_index_add_stored_column.sql.txt | 3 +- .../alter_index_drop_stored_column.sql.txt | 3 +- testdata/result/ddl/alter_model.sql.txt | 5 +- .../result/ddl/alter_model_if_exists.sql.txt | 2 - .../result/ddl/alter_proto_bundle_all.sql.txt | 1 - .../ddl/alter_proto_bundle_delete.sql.txt | 3 - .../ddl/alter_proto_bundle_insert.sql.txt | 3 - .../ddl/alter_proto_bundle_noop.sql.txt | 4 - .../ddl/alter_proto_bundle_update.sql.txt | 3 - ...ter_search_index_add_stored_column.sql.txt | 3 +- ...er_search_index_drop_stored_column.sql.txt | 3 +- testdata/result/ddl/alter_sequence.sql.txt | 3 +- testdata/result/ddl/alter_statistics.sql.txt | 4 +- .../result/ddl/alter_table_add_check.sql.txt | 7 +- .../result/ddl/alter_table_add_column.sql.txt | 16 +- ...ter_table_add_column_if_not_exists.sql.txt | 11 +- ...able_add_column_with_if_expression.sql.txt | 19 +- .../alter_table_add_constraint_check.sql.txt | 3 +- ...r_table_add_constraint_foreign_key.sql.txt | 4 +- ...aint_foreign_key_on_delete_cascade.sql.txt | 3 +- ...nt_foreign_key_on_delete_no_action.sql.txt | 3 +- .../ddl/alter_table_add_foreign_key.sql.txt | 8 +- ...lter_table_add_row_deletion_policy.sql.txt | 3 +- .../ddl/alter_table_add_synonym.sql.txt | 3 +- .../ddl/alter_table_alter_column.sql.txt | 9 +- ...er_table_alter_column_drop_default.sql.txt | 3 +- .../ddl/alter_table_alter_column_set.sql.txt | 3 +- ...ter_table_alter_column_set_default.sql.txt | 4 +- ...er_table_alter_column_with_default.sql.txt | 5 +- .../ddl/alter_table_drop_column.sql.txt | 3 +- .../ddl/alter_table_drop_constraint.sql.txt | 3 +- ...ter_table_drop_row_deletion_policy.sql.txt | 3 +- .../ddl/alter_table_drop_synonym.sql.txt | 3 +- .../result/ddl/alter_table_rename_to.sql.txt | 4 +- .../alter_table_rename_to_add_synonym.sql.txt | 3 +- ..._table_replace_row_deletion_policy.sql.txt | 3 +- .../ddl/alter_table_set_on_delete.sql.txt | 3 +- ...lter_table_set_on_delete_no_action.sql.txt | 3 +- testdata/result/ddl/analyze.sql.txt | 4 +- .../result/ddl/create_change_stream.sql.txt | 5 +- .../ddl/create_change_stream_for_all.sql.txt | 4 +- ..._stream_for_multiple_table_columns.sql.txt | 4 +- .../create_change_stream_for_table.sql.txt | 6 +- ...ate_change_stream_for_table_column.sql.txt | 4 +- ...te_change_stream_for_table_columns.sql.txt | 4 +- .../create_change_stream_for_tables.sql.txt | 8 +- ...ange_stream_for_tables_with_option.sql.txt | 3 +- ...stream_for_tables_with_option_null.sql.txt | 3 +- ...nge_stream_for_tables_with_options.sql.txt | 3 +- testdata/result/ddl/create_database.sql.txt | 3 +- testdata/result/ddl/create_index.sql.txt | 10 +- .../ddl/create_index_if_not_exists.sql.txt | 12 +- .../ddl/create_index_interleave.sql.txt | 8 +- .../result/ddl/create_index_storing.sql.txt | 9 +- testdata/result/ddl/create_model.sql.txt | 18 +- .../ddl/create_model_if_not_exists.sql.txt | 6 - .../ddl/create_or_replace_model.sql.txt | 12 +- .../result/ddl/create_or_replace_view.sql.txt | 17 +- testdata/result/ddl/create_placement.sql.txt | 3 +- testdata/result/ddl/create_role.sql.txt | 3 +- testdata/result/ddl/create_schema.sql.txt | 3 +- .../ddl/create_search_index_full.sql.txt | 6 +- .../create_search_index_null_filtered.sql.txt | 9 +- .../ddl/create_search_index_simple.sql.txt | 8 +- testdata/result/ddl/create_sequance.sql.txt | 3 +- testdata/result/ddl/create_table.sql.txt | 65 +----- .../result/ddl/create_table_cluster.sql.txt | 25 +- ...le_cluster_and_row_deletion_policy.sql.txt | 30 +-- ..._table_cluster_on_delete_no_action.sql.txt | 20 +- ...create_table_cluster_set_on_delete.sql.txt | 20 +- .../ddl/create_table_fulltext_albums.sql.txt | 71 ++---- .../ddl/create_table_if_not_exists.sql.txt | 22 +- .../create_table_row_deletion_policy.sql.txt | 28 +-- .../result/ddl/create_table_synonyms.sql.txt | 26 +-- .../create_table_synonyms_abnormal.sql.txt | 27 +-- .../ddl/create_table_trailing_comma.sql.txt | 24 +- .../result/ddl/create_table_types.sql.txt | 104 ++------- ...reate_table_with_sequence_function.sql.txt | 37 +-- .../create_uniq_null_filtered_index.sql.txt | 5 - .../result/ddl/create_vector_index.sql.txt | 2 - ...vector_index_where_column_not_null.sql.txt | 4 +- testdata/result/ddl/create_view.sql.txt | 18 +- .../create_view_sql_security_definer.sql.txt | 18 +- .../result/ddl/drop_change_stream.sql.txt | 1 - testdata/result/ddl/drop_index.sql.txt | 4 +- .../result/ddl/drop_index_if_exists.sql.txt | 1 - testdata/result/ddl/drop_model.sql.txt | 4 +- .../result/ddl/drop_model_if_exists.sql.txt | 1 - .../result/ddl/drop_proto_bunldle.sql.txt | 1 - testdata/result/ddl/drop_role.sql.txt | 1 - testdata/result/ddl/drop_schema.sql.txt | 1 - testdata/result/ddl/drop_search_index.sql.txt | 1 - testdata/result/ddl/drop_sequence.sql.txt | 4 +- .../result/ddl/drop_sequence_if_exits.sql.txt | 1 - testdata/result/ddl/drop_table.sql.txt | 4 +- .../result/ddl/drop_table_if_exists.sql.txt | 1 - testdata/result/ddl/drop_vector_index.sql.txt | 4 +- testdata/result/ddl/drop_view.sql.txt | 1 - .../ddl/grant_change_stream_privilege.sql.txt | 1 - .../grant_execute_on_table_function.sql.txt | 1 - testdata/result/ddl/grant_privileges.sql.txt | 1 - testdata/result/ddl/grant_role.sql.txt | 1 - .../result/ddl/grant_select_on_view.sql.txt | 1 - ...med_schema_create_table_backquoted.sql.txt | 19 +- .../ddl/named_schemas_alter_index.sql.txt | 3 +- .../ddl/named_schemas_alter_sequence.sql.txt | 3 +- ...schemas_alter_table_add_constraint.sql.txt | 3 +- ...hemas_alter_table_drop_constraints.sql.txt | 3 +- .../ddl/named_schemas_create_index.sql.txt | 11 +- .../ddl/named_schemas_create_sequence.sql.txt | 6 +- .../ddl/named_schemas_create_table.sql.txt | 41 +--- ...d_schemas_create_table_foreign_key.sql.txt | 32 +-- ...ed_schemas_create_table_interleave.sql.txt | 36 +-- .../ddl/named_schemas_create_view.sql.txt | 19 +- .../ddl/named_schemas_drop_index.sql.txt | 4 +- .../ddl/named_schemas_drop_sequence.sql.txt | 4 +- .../ddl/named_schemas_drop_table.sql.txt | 4 +- .../ddl/named_schemas_drop_view.sql.txt | 1 - .../result/ddl/rename_table_multiple.sql.txt | 3 +- .../result/ddl/rename_table_single.sql.txt | 3 +- .../revoke_change_stream_privilege.sql.txt | 1 - .../revoke_execute_on_table_function.sql.txt | 1 - testdata/result/ddl/revoke_privileges.sql.txt | 1 - testdata/result/ddl/revoke_role.sql.txt | 1 - .../result/ddl/revoke_select_on_view.sql.txt | 1 - testdata/result/dml/delete _from.sql.txt | 3 - testdata/result/dml/delete.sql.txt | 3 - testdata/result/dml/delete_as.sql.txt | 2 - .../result/dml/delete_then_return.sql.txt | 7 +- .../result/dml/insert_into_values.sql.txt | 11 +- testdata/result/dml/insert_or_ignore.sql.txt | 4 - testdata/result/dml/insert_or_update.sql.txt | 4 - ..._update_then_return_with_action_as.sql.txt | 3 - testdata/result/dml/insert_select.sql.txt | 21 +- testdata/result/dml/insert_values.sql.txt | 11 +- .../result/dml/insert_values_default.sql.txt | 7 +- .../dml/insert_with_sequence_function.sql.txt | 12 +- testdata/result/dml/update.sql.txt | 6 - testdata/result/dml/update_as.sql.txt | 3 - .../update_then_return_with_action.sql.txt | 6 - ...y_filter_one_arg_with_paren_lambda.sql.txt | 8 +- ...ions_array_filter_parenless_lambda.sql.txt | 8 +- ...tions_array_filter_two_args_lambda.sql.txt | 8 +- .../array_literal_empty_with_types.sql.txt | 2 - ...iteral_empty_without_array_keyword.sql.txt | 3 - .../array_literal_empty_without_types.sql.txt | 3 - .../expr/braced_new_constructor.sql.txt | 16 +- .../expr/braced_new_constructor_empty.sql.txt | 2 - .../braced_new_constructor_oneliner.sql.txt | 2 - testdata/result/expr/cast_as_typename.sql.txt | 2 - .../conversion_functions_safe_cast.sql.txt | 1 - .../expr/edge_case_backquote_keyword.sql.txt | 1 - .../edge_case_backquote_non_keyword.sql.txt | 1 - testdata/result/expr/json_literal.sql.txt | 1 - testdata/result/expr/new_constructor.sql.txt | 1 - .../result/expr/new_constructor_empty.sql.txt | 2 - ...ol_buffer_functions_replace_fields.sql.txt | 5 +- ...ue_subquery_select_as_fqn_typename.sql.txt | 12 +- ...e_subquery_select_as_leaf_typename.sql.txt | 12 +- .../value_subquery_select_as_struct.sql.txt | 12 +- .../value_subquery_select_as_value.sql.txt | 12 +- .../query/aggregate_function_calls.sql.txt | 41 +--- .../select_album_with_index_directive.sql.txt | 13 +- .../query/select_alias_without_as.sql.txt | 13 +- .../query/select_array_with_struct.sql.txt | 16 +- .../query/select_call_with_named_expr.sql.txt | 20 +- testdata/result/query/select_cast.sql.txt | 43 +--- .../select_complex_with_array_path.sql.txt | 26 +-- ...ect_complex_with_unnest_array_path.sql.txt | 26 +-- .../query/select_count_asterisk.sql.txt | 15 +- .../query/select_count_distinct.sql.txt | 18 +- testdata/result/query/select_expr.sql.txt | 90 ++------ .../result/query/select_expr_extract.sql.txt | 30 +-- .../query/select_from_implicit_unnest.sql.txt | 30 +-- .../result/query/select_from_path.sql.txt | 18 +- testdata/result/query/select_hint.sql.txt | 14 +- .../result/query/select_literals_all.sql.txt | 66 ++---- .../query/select_literals_array.sql.txt | 17 +- .../select_literals_array_invalid.sql.txt | 17 +- .../query/select_literals_bytes.sql.txt | 33 +-- .../result/query/select_literals_date.sql.txt | 37 +-- .../query/select_literals_float.sql.txt | 13 +- .../result/query/select_literals_int.sql.txt | 13 +- .../query/select_literals_paren.sql.txt | 13 +- ...elect_literals_paren_with_operator.sql.txt | 13 +- .../query/select_literals_string.sql.txt | 13 +- .../query/select_literals_struct.sql.txt | 215 +++--------------- .../result/query/select_nest_complex.sql.txt | 90 ++------ .../query/select_select_limit_expr.sql.txt | 28 +-- .../select_select_set_operator_expr.sql.txt | 118 ++-------- ...ect_singer_with_as_struct_subquery.sql.txt | 30 +-- .../query/select_singer_with_asterisk.sql.txt | 15 +- ...ct_singer_with_column_and_asterisk.sql.txt | 15 +- .../select_singer_with_column_names.sql.txt | 15 +- .../select_singer_with_cross_join.sql.txt | 27 +-- .../query/select_singer_with_distinct.sql.txt | 12 - .../select_singer_with_full_join.sql.txt | 27 +-- .../query/select_singer_with_groupby.sql.txt | 14 +- .../select_singer_with_hash_join.sql.txt | 21 +- .../query/select_singer_with_having.sql.txt | 13 +- .../select_singer_with_in_and_unnest.sql.txt | 16 +- ...in_and_unnest_with_query_parameter.sql.txt | 15 +- .../query/select_singer_with_join.sql.txt | 26 +-- .../select_singer_with_join_hint.sql.txt | 52 ++--- .../select_singer_with_join_twice.sql.txt | 36 +-- .../select_singer_with_join_using.sql.txt | 26 +-- .../select_singer_with_join_various.sql.txt | 107 +++------ .../query/select_singer_with_limit.sql.txt | 17 +- ...ect_singer_with_limit_and_skiprows.sql.txt | 16 +- .../query/select_singer_with_orderby.sql.txt | 20 +- ...select_singer_with_query_parameter.sql.txt | 14 +- .../select_singer_with_root_parent.sql.txt | 19 +- .../select_singer_with_select_in_from.sql.txt | 27 +-- ..._singer_with_select_in_from_and_as.sql.txt | 26 +-- ...singer_with_single_column_subquery.sql.txt | 29 +-- ...ith_single_column_subquery_with_at.sql.txt | 29 +-- .../select_singer_with_table_alias.sql.txt | 16 +- ..._singer_with_table_alias_with_hint.sql.txt | 13 +- .../select_singer_with_table_hint.sql.txt | 14 +- .../select_singer_with_tablesample.sql.txt | 35 +-- .../query/select_singer_with_tableset.sql.txt | 36 +-- ...elect_singer_with_tableset_complex.sql.txt | 136 ++--------- ...ct_singer_with_tableset_with_where.sql.txt | 36 +-- ...ect_singer_with_toplevel_join_hint.sql.txt | 27 +-- .../select_singer_with_value_hex.sql.txt | 14 +- .../query/select_singer_with_where.sql.txt | 14 +- ...t_singer_with_where_and_comparison.sql.txt | 21 +- .../select_singer_with_where_and_op.sql.txt | 14 +- .../query/select_struct_compare_eq.sql.txt | 36 +-- .../query/select_subscript_operators.sql.txt | 18 +- ...select_tablesample_with_cross_join.sql.txt | 26 +-- .../select_tablesample_with_subquery.sql.txt | 27 +-- .../select_tablesample_with_table.sql.txt | 14 +- ...elect_tablesample_with_table_alias.sql.txt | 15 +- ...ct_tablesample_with_unnest_invalid.sql.txt | 17 +- .../result/query/select_union_chain.sql.txt | 52 +---- .../query/select_unnest_with_offset.sql.txt | 16 +- ...elect_unnest_with_offset_and_alias.sql.txt | 17 +- ...t_unnest_with_offset_and_alias_min.sql.txt | 17 +- .../query/select_with_after_hint.sql.txt | 29 +-- .../result/query/select_with_comment.sql.txt | 14 +- .../query/select_with_field_path.sql.txt | 30 +-- .../query/select_with_multiple_ctes.sql.txt | 44 +--- .../query/select_with_reservedword.sql.txt | 15 +- .../select_with_sequence_function.sql.txt | 19 +- .../query/select_with_trailing_comma.sql.txt | 13 +- .../aggregate_function_calls.sql.txt | 41 +--- .../alter_change_stream_options.sql.txt | 3 +- ...ter_change_stream_set_drop_for_all.sql.txt | 3 +- .../alter_change_stream_set_for_all.sql.txt | 3 +- ...hange_stream_set_for_table_columns.sql.txt | 3 +- .../result/statement/alter_database.sql.txt | 3 +- .../alter_index_add_stored_column.sql.txt | 3 +- .../alter_index_drop_stored_column.sql.txt | 3 +- testdata/result/statement/alter_model.sql.txt | 5 +- .../statement/alter_model_if_exists.sql.txt | 2 - .../statement/alter_proto_bundle_all.sql.txt | 1 - .../alter_proto_bundle_delete.sql.txt | 3 - .../alter_proto_bundle_insert.sql.txt | 3 - .../statement/alter_proto_bundle_noop.sql.txt | 4 - .../alter_proto_bundle_update.sql.txt | 3 - ...ter_search_index_add_stored_column.sql.txt | 3 +- ...er_search_index_drop_stored_column.sql.txt | 3 +- .../result/statement/alter_sequence.sql.txt | 3 +- .../result/statement/alter_statistics.sql.txt | 4 +- .../statement/alter_table_add_check.sql.txt | 7 +- .../statement/alter_table_add_column.sql.txt | 16 +- ...ter_table_add_column_if_not_exists.sql.txt | 11 +- ...able_add_column_with_if_expression.sql.txt | 19 +- .../alter_table_add_constraint_check.sql.txt | 3 +- ...r_table_add_constraint_foreign_key.sql.txt | 4 +- ...aint_foreign_key_on_delete_cascade.sql.txt | 3 +- ...nt_foreign_key_on_delete_no_action.sql.txt | 3 +- .../alter_table_add_foreign_key.sql.txt | 8 +- ...lter_table_add_row_deletion_policy.sql.txt | 3 +- .../statement/alter_table_add_synonym.sql.txt | 3 +- .../alter_table_alter_column.sql.txt | 9 +- ...er_table_alter_column_drop_default.sql.txt | 3 +- .../alter_table_alter_column_set.sql.txt | 3 +- ...ter_table_alter_column_set_default.sql.txt | 4 +- ...er_table_alter_column_with_default.sql.txt | 5 +- .../statement/alter_table_drop_column.sql.txt | 3 +- .../alter_table_drop_constraint.sql.txt | 3 +- ...ter_table_drop_row_deletion_policy.sql.txt | 3 +- .../alter_table_drop_synonym.sql.txt | 3 +- .../statement/alter_table_rename_to.sql.txt | 4 +- .../alter_table_rename_to_add_synonym.sql.txt | 3 +- ..._table_replace_row_deletion_policy.sql.txt | 3 +- .../alter_table_set_on_delete.sql.txt | 3 +- ...lter_table_set_on_delete_no_action.sql.txt | 3 +- testdata/result/statement/analyze.sql.txt | 4 +- .../statement/create_change_stream.sql.txt | 5 +- .../create_change_stream_for_all.sql.txt | 4 +- ..._stream_for_multiple_table_columns.sql.txt | 4 +- .../create_change_stream_for_table.sql.txt | 6 +- ...ate_change_stream_for_table_column.sql.txt | 4 +- ...te_change_stream_for_table_columns.sql.txt | 4 +- .../create_change_stream_for_tables.sql.txt | 8 +- ...ange_stream_for_tables_with_option.sql.txt | 3 +- ...stream_for_tables_with_option_null.sql.txt | 3 +- ...nge_stream_for_tables_with_options.sql.txt | 3 +- .../result/statement/create_database.sql.txt | 3 +- .../result/statement/create_index.sql.txt | 10 +- .../create_index_if_not_exists.sql.txt | 12 +- .../statement/create_index_interleave.sql.txt | 8 +- .../statement/create_index_storing.sql.txt | 9 +- .../result/statement/create_model.sql.txt | 18 +- .../create_model_if_not_exists.sql.txt | 6 - .../statement/create_or_replace_model.sql.txt | 12 +- .../statement/create_or_replace_view.sql.txt | 17 +- .../result/statement/create_placement.sql.txt | 3 +- testdata/result/statement/create_role.sql.txt | 3 +- .../result/statement/create_schema.sql.txt | 3 +- .../create_search_index_full.sql.txt | 6 +- .../create_search_index_null_filtered.sql.txt | 9 +- .../create_search_index_simple.sql.txt | 8 +- .../result/statement/create_sequance.sql.txt | 3 +- .../result/statement/create_table.sql.txt | 65 +----- .../statement/create_table_cluster.sql.txt | 25 +- ...le_cluster_and_row_deletion_policy.sql.txt | 30 +-- ..._table_cluster_on_delete_no_action.sql.txt | 20 +- ...create_table_cluster_set_on_delete.sql.txt | 20 +- .../create_table_fulltext_albums.sql.txt | 71 ++---- .../create_table_if_not_exists.sql.txt | 22 +- .../create_table_row_deletion_policy.sql.txt | 28 +-- .../statement/create_table_synonyms.sql.txt | 26 +-- .../create_table_synonyms_abnormal.sql.txt | 27 +-- .../create_table_trailing_comma.sql.txt | 24 +- .../statement/create_table_types.sql.txt | 104 ++------- ...reate_table_with_sequence_function.sql.txt | 37 +-- .../create_uniq_null_filtered_index.sql.txt | 5 - .../statement/create_vector_index.sql.txt | 2 - ...vector_index_where_column_not_null.sql.txt | 4 +- testdata/result/statement/create_view.sql.txt | 18 +- .../create_view_sql_security_definer.sql.txt | 18 +- .../result/statement/delete _from.sql.txt | 3 - testdata/result/statement/delete.sql.txt | 3 - testdata/result/statement/delete_as.sql.txt | 2 - .../statement/delete_then_return.sql.txt | 7 +- .../statement/drop_change_stream.sql.txt | 1 - testdata/result/statement/drop_index.sql.txt | 4 +- .../statement/drop_index_if_exists.sql.txt | 1 - testdata/result/statement/drop_model.sql.txt | 4 +- .../statement/drop_model_if_exists.sql.txt | 1 - .../statement/drop_proto_bunldle.sql.txt | 1 - testdata/result/statement/drop_role.sql.txt | 1 - testdata/result/statement/drop_schema.sql.txt | 1 - .../statement/drop_search_index.sql.txt | 1 - .../result/statement/drop_sequence.sql.txt | 4 +- .../statement/drop_sequence_if_exits.sql.txt | 1 - testdata/result/statement/drop_table.sql.txt | 4 +- .../statement/drop_table_if_exists.sql.txt | 1 - .../statement/drop_vector_index.sql.txt | 4 +- testdata/result/statement/drop_view.sql.txt | 1 - .../grant_change_stream_privilege.sql.txt | 1 - .../grant_execute_on_table_function.sql.txt | 1 - .../result/statement/grant_privileges.sql.txt | 1 - testdata/result/statement/grant_role.sql.txt | 1 - .../statement/grant_select_on_view.sql.txt | 1 - .../statement/insert_into_values.sql.txt | 11 +- .../result/statement/insert_or_ignore.sql.txt | 4 - .../result/statement/insert_or_update.sql.txt | 4 - ..._update_then_return_with_action_as.sql.txt | 3 - .../result/statement/insert_select.sql.txt | 21 +- .../result/statement/insert_values.sql.txt | 11 +- .../statement/insert_values_default.sql.txt | 7 +- .../insert_with_sequence_function.sql.txt | 12 +- ...med_schema_create_table_backquoted.sql.txt | 19 +- .../named_schemas_alter_index.sql.txt | 3 +- .../named_schemas_alter_sequence.sql.txt | 3 +- ...schemas_alter_table_add_constraint.sql.txt | 3 +- ...hemas_alter_table_drop_constraints.sql.txt | 3 +- .../named_schemas_create_index.sql.txt | 11 +- .../named_schemas_create_sequence.sql.txt | 6 +- .../named_schemas_create_table.sql.txt | 41 +--- ...d_schemas_create_table_foreign_key.sql.txt | 32 +-- ...ed_schemas_create_table_interleave.sql.txt | 36 +-- .../named_schemas_create_view.sql.txt | 19 +- .../named_schemas_drop_index.sql.txt | 4 +- .../named_schemas_drop_sequence.sql.txt | 4 +- .../named_schemas_drop_table.sql.txt | 4 +- .../statement/named_schemas_drop_view.sql.txt | 1 - .../statement/rename_table_multiple.sql.txt | 3 +- .../statement/rename_table_single.sql.txt | 3 +- .../revoke_change_stream_privilege.sql.txt | 1 - .../revoke_execute_on_table_function.sql.txt | 1 - .../statement/revoke_privileges.sql.txt | 1 - testdata/result/statement/revoke_role.sql.txt | 1 - .../statement/revoke_select_on_view.sql.txt | 1 - .../select_album_with_index_directive.sql.txt | 13 +- .../statement/select_alias_without_as.sql.txt | 13 +- .../select_array_with_struct.sql.txt | 16 +- .../select_call_with_named_expr.sql.txt | 20 +- testdata/result/statement/select_cast.sql.txt | 43 +--- .../select_complex_with_array_path.sql.txt | 26 +-- ...ect_complex_with_unnest_array_path.sql.txt | 26 +-- .../statement/select_count_asterisk.sql.txt | 15 +- .../statement/select_count_distinct.sql.txt | 18 +- testdata/result/statement/select_expr.sql.txt | 90 ++------ .../statement/select_expr_extract.sql.txt | 30 +-- .../select_from_implicit_unnest.sql.txt | 30 +-- .../result/statement/select_from_path.sql.txt | 18 +- testdata/result/statement/select_hint.sql.txt | 14 +- .../statement/select_literals_all.sql.txt | 66 ++---- .../statement/select_literals_array.sql.txt | 17 +- .../select_literals_array_invalid.sql.txt | 17 +- .../statement/select_literals_bytes.sql.txt | 33 +-- .../statement/select_literals_date.sql.txt | 37 +-- .../statement/select_literals_float.sql.txt | 13 +- .../statement/select_literals_int.sql.txt | 13 +- .../statement/select_literals_paren.sql.txt | 13 +- ...elect_literals_paren_with_operator.sql.txt | 13 +- .../statement/select_literals_string.sql.txt | 13 +- .../statement/select_literals_struct.sql.txt | 215 +++--------------- .../statement/select_nest_complex.sql.txt | 90 ++------ .../select_select_limit_expr.sql.txt | 28 +-- .../select_select_set_operator_expr.sql.txt | 118 ++-------- ...ect_singer_with_as_struct_subquery.sql.txt | 30 +-- .../select_singer_with_asterisk.sql.txt | 15 +- ...ct_singer_with_column_and_asterisk.sql.txt | 15 +- .../select_singer_with_column_names.sql.txt | 15 +- .../select_singer_with_cross_join.sql.txt | 27 +-- .../select_singer_with_distinct.sql.txt | 12 - .../select_singer_with_full_join.sql.txt | 27 +-- .../select_singer_with_groupby.sql.txt | 14 +- .../select_singer_with_hash_join.sql.txt | 21 +- .../select_singer_with_having.sql.txt | 13 +- .../select_singer_with_in_and_unnest.sql.txt | 16 +- ...in_and_unnest_with_query_parameter.sql.txt | 15 +- .../statement/select_singer_with_join.sql.txt | 26 +-- .../select_singer_with_join_hint.sql.txt | 52 ++--- .../select_singer_with_join_twice.sql.txt | 36 +-- .../select_singer_with_join_using.sql.txt | 26 +-- .../select_singer_with_join_various.sql.txt | 107 +++------ .../select_singer_with_limit.sql.txt | 17 +- ...ect_singer_with_limit_and_skiprows.sql.txt | 16 +- .../select_singer_with_orderby.sql.txt | 20 +- ...select_singer_with_query_parameter.sql.txt | 14 +- .../select_singer_with_root_parent.sql.txt | 19 +- .../select_singer_with_select_in_from.sql.txt | 27 +-- ..._singer_with_select_in_from_and_as.sql.txt | 26 +-- ...singer_with_single_column_subquery.sql.txt | 29 +-- ...ith_single_column_subquery_with_at.sql.txt | 29 +-- .../select_singer_with_table_alias.sql.txt | 16 +- ..._singer_with_table_alias_with_hint.sql.txt | 13 +- .../select_singer_with_table_hint.sql.txt | 14 +- .../select_singer_with_tablesample.sql.txt | 35 +-- .../select_singer_with_tableset.sql.txt | 36 +-- ...elect_singer_with_tableset_complex.sql.txt | 136 ++--------- ...ct_singer_with_tableset_with_where.sql.txt | 36 +-- ...ect_singer_with_toplevel_join_hint.sql.txt | 27 +-- .../select_singer_with_value_hex.sql.txt | 14 +- .../select_singer_with_where.sql.txt | 14 +- ...t_singer_with_where_and_comparison.sql.txt | 21 +- .../select_singer_with_where_and_op.sql.txt | 14 +- .../select_struct_compare_eq.sql.txt | 36 +-- .../select_subscript_operators.sql.txt | 18 +- ...select_tablesample_with_cross_join.sql.txt | 26 +-- .../select_tablesample_with_subquery.sql.txt | 27 +-- .../select_tablesample_with_table.sql.txt | 14 +- ...elect_tablesample_with_table_alias.sql.txt | 15 +- ...ct_tablesample_with_unnest_invalid.sql.txt | 17 +- .../statement/select_union_chain.sql.txt | 52 +---- .../select_unnest_with_offset.sql.txt | 16 +- ...elect_unnest_with_offset_and_alias.sql.txt | 17 +- ...t_unnest_with_offset_and_alias_min.sql.txt | 17 +- .../statement/select_with_after_hint.sql.txt | 29 +-- .../statement/select_with_comment.sql.txt | 14 +- .../statement/select_with_field_path.sql.txt | 30 +-- .../select_with_multiple_ctes.sql.txt | 44 +--- .../select_with_reservedword.sql.txt | 15 +- .../select_with_sequence_function.sql.txt | 19 +- .../select_with_trailing_comma.sql.txt | 13 +- testdata/result/statement/update.sql.txt | 6 - testdata/result/statement/update_as.sql.txt | 3 - .../update_then_return_with_action.sql.txt | 6 - 484 files changed, 1296 insertions(+), 6462 deletions(-) diff --git a/go.mod b/go.mod index 080ad5ec..5e49d66b 100644 --- a/go.mod +++ b/go.mod @@ -8,11 +8,13 @@ require ( github.com/MakeNowJust/heredoc/v2 v2.0.1 github.com/google/go-cmp v0.6.0 github.com/k0kubun/pp v1.3.1-0.20200204103551-99835366d1cc + github.com/k0kubun/pp/v3 v3.4.1 github.com/pmezard/go-difflib v1.0.0 ) require ( - github.com/mattn/go-colorable v0.1.4 // indirect - github.com/mattn/go-isatty v0.0.12 // indirect + github.com/mattn/go-colorable v0.1.13 // indirect + github.com/mattn/go-isatty v0.0.16 // indirect golang.org/x/sys v0.26.0 // indirect + golang.org/x/text v0.19.0 // indirect ) diff --git a/go.sum b/go.sum index 40b9b01f..595a205d 100644 --- a/go.sum +++ b/go.sum @@ -6,14 +6,19 @@ github.com/k0kubun/colorstring v0.0.0-20150214042306-9440f1994b88 h1:uC1QfSlInpQ github.com/k0kubun/colorstring v0.0.0-20150214042306-9440f1994b88/go.mod h1:3w7q1U84EfirKl04SVQ/s7nPm1ZPhiXd34z40TNz36k= github.com/k0kubun/pp v1.3.1-0.20200204103551-99835366d1cc h1:XLjmW07gT7cG/wb6mavIrvAIWBYaTacPo8UOnxGSspA= github.com/k0kubun/pp v1.3.1-0.20200204103551-99835366d1cc/go.mod h1:qK2ivXw91omfE1uXcpR5kWbAMZRdDOnGbqWlZ7reRFk= -github.com/mattn/go-colorable v0.1.4 h1:snbPLB8fVfU9iwbbo30TPtbLRzwWu6aJS6Xh4eaaviA= +github.com/k0kubun/pp/v3 v3.4.1 h1:1WdFZDRRqe8UsR61N/2RoOZ3ziTEqgTPVqKrHeb779Y= +github.com/k0kubun/pp/v3 v3.4.1/go.mod h1:+SiNiqKnBfw1Nkj82Lh5bIeKQOAkPy6Xw9CAZUZ8npI= github.com/mattn/go-colorable v0.1.4/go.mod h1:U0ppj6V5qS13XJ6of8GYAs25YV2eR4EVcfRqFIhoBtE= +github.com/mattn/go-colorable v0.1.13 h1:fFA4WZxdEF4tXPZVKMLwD8oUnCTTo08duU7wxecdEvA= +github.com/mattn/go-colorable v0.1.13/go.mod h1:7S9/ev0klgBDR4GtXTXX8a3vIGJpMovkB8vQcUbaXHg= github.com/mattn/go-isatty v0.0.8/go.mod h1:Iq45c/XA43vh69/j3iqttzPXn0bhXyGjM0Hdxcsrc5s= -github.com/mattn/go-isatty v0.0.12 h1:wuysRhFDzyxgEmMf5xjvJ2M9dZoWAXNNr5LSBS7uHXY= -github.com/mattn/go-isatty v0.0.12/go.mod h1:cbi8OIDigv2wuxKPP5vlRcQ1OAZbq2CE4Kysco4FUpU= +github.com/mattn/go-isatty v0.0.16 h1:bq3VjFmv/sOjHtdEhmkEV4x1AJtvUvOJ2PFAZ5+peKQ= +github.com/mattn/go-isatty v0.0.16/go.mod h1:kYGgaQfpe5nmfYZH+SKPsOc2e4SrIfOl2e/yFXSvRLM= github.com/pmezard/go-difflib v1.0.0 h1:4DBwDE0NGyQoBHbLQYPwSUPoCMWR5BEzIk/f1lZbAQM= github.com/pmezard/go-difflib v1.0.0/go.mod h1:iKH77koFhYxTK1pcRnkKkqfTogsbg7gZNVY4sRDYZ/4= golang.org/x/sys v0.0.0-20190222072716-a9d3bda3a223/go.mod h1:STP8DvDyc/dI5b8T5hshtkjS+E42TnysNCUPdjciGhY= -golang.org/x/sys v0.0.0-20200116001909-b77594299b42/go.mod h1:h1NjWce9XRLGQEsW7wpKNCjG9DtNlClVuFLEZdDNbEs= +golang.org/x/sys v0.0.0-20220811171246-fbc7d0a398ab/go.mod h1:oPkhp1MJrh7nUepCBck5+mAzfO9JrbApNNgaTdGDITg= golang.org/x/sys v0.26.0 h1:KHjCJyddX0LoSTb3J+vWpupP9p0oznkqVk/IfjymZbo= golang.org/x/sys v0.26.0/go.mod h1:/VUhepiaJMQUp4+oa/7Zr1D23ma6VTLIYjOOTFZPUcA= +golang.org/x/text v0.19.0 h1:kTxAhCbGbxhK0IwgSKiMO5awPoDQ0RpfiVYBfK860YM= +golang.org/x/text v0.19.0/go.mod h1:BuEKDfySbSR4drPmRPG/7iBdf8hvFMuRexcpahXilzY= diff --git a/parser_test.go b/parser_test.go index 1f5ef07d..ecc32f9d 100644 --- a/parser_test.go +++ b/parser_test.go @@ -12,16 +12,13 @@ import ( "github.com/cloudspannerecosystem/memefish" "github.com/cloudspannerecosystem/memefish/ast" "github.com/cloudspannerecosystem/memefish/token" - "github.com/k0kubun/pp" + "github.com/k0kubun/pp/v3" "github.com/pmezard/go-difflib/difflib" ) var update = flag.Bool("update", false, "update result files") func testParser(t *testing.T, inputPath, resultPath string, parse func(p *memefish.Parser) (ast.Node, error)) { - printer := pp.New() - printer.SetColoringEnabled(false) - if *update { _, err := os.Stat(resultPath) if err == nil { @@ -63,6 +60,10 @@ func testParser(t *testing.T, inputPath, resultPath string, parse func(p *memefi log.Fatalf("error on parsing input file: %v", err) } + pprinter := pp.New() + pprinter.SetColoringEnabled(false) + pprinter.SetOmitEmpty(true) + var buf bytes.Buffer fmt.Fprintf(&buf, "--- %s\n", in.Name()) @@ -70,7 +71,7 @@ func testParser(t *testing.T, inputPath, resultPath string, parse func(p *memefi fmt.Fprintln(&buf) fmt.Fprintf(&buf, "--- AST\n") - _, _ = printer.Fprintln(&buf, node) + _, _ = pprinter.Fprintln(&buf, node) fmt.Fprintln(&buf) fmt.Fprintf(&buf, "--- SQL\n") diff --git a/testdata/result/ddl/alter_change_stream_options.sql.txt b/testdata/result/ddl/alter_change_stream_options.sql.txt index 0069de75..b0214ab8 100644 --- a/testdata/result/ddl/alter_change_stream_options.sql.txt +++ b/testdata/result/ddl/alter_change_stream_options.sql.txt @@ -3,8 +3,7 @@ ALTER CHANGE STREAM change_stream_name SET OPTIONS (retention_period = '1d', val --- AST &ast.AlterChangeStream{ - Alter: 0, - Name: &ast.Ident{ + Name: &ast.Ident{ NamePos: 20, NameEnd: 38, Name: "change_stream_name", diff --git a/testdata/result/ddl/alter_change_stream_set_drop_for_all.sql.txt b/testdata/result/ddl/alter_change_stream_set_drop_for_all.sql.txt index 78744030..07c9db12 100644 --- a/testdata/result/ddl/alter_change_stream_set_drop_for_all.sql.txt +++ b/testdata/result/ddl/alter_change_stream_set_drop_for_all.sql.txt @@ -3,8 +3,7 @@ ALTER CHANGE STREAM change_stream_name DROP FOR ALL --- AST &ast.AlterChangeStream{ - Alter: 0, - Name: &ast.Ident{ + Name: &ast.Ident{ NamePos: 20, NameEnd: 38, Name: "change_stream_name", diff --git a/testdata/result/ddl/alter_change_stream_set_for_all.sql.txt b/testdata/result/ddl/alter_change_stream_set_for_all.sql.txt index 93247c77..a8dfc96e 100644 --- a/testdata/result/ddl/alter_change_stream_set_for_all.sql.txt +++ b/testdata/result/ddl/alter_change_stream_set_for_all.sql.txt @@ -3,8 +3,7 @@ ALTER CHANGE STREAM change_stream_name SET FOR ALL --- AST &ast.AlterChangeStream{ - Alter: 0, - Name: &ast.Ident{ + Name: &ast.Ident{ NamePos: 20, NameEnd: 38, Name: "change_stream_name", diff --git a/testdata/result/ddl/alter_change_stream_set_for_table_columns.sql.txt b/testdata/result/ddl/alter_change_stream_set_for_table_columns.sql.txt index ed5c412b..4b2104c9 100644 --- a/testdata/result/ddl/alter_change_stream_set_for_table_columns.sql.txt +++ b/testdata/result/ddl/alter_change_stream_set_for_table_columns.sql.txt @@ -3,8 +3,7 @@ ALTER CHANGE STREAM change_stream_name SET FOR table_name1(column1, column2), ta --- AST &ast.AlterChangeStream{ - Alter: 0, - Name: &ast.Ident{ + Name: &ast.Ident{ NamePos: 20, NameEnd: 38, Name: "change_stream_name", diff --git a/testdata/result/ddl/alter_database.sql.txt b/testdata/result/ddl/alter_database.sql.txt index 3fc122ab..7aee12b2 100644 --- a/testdata/result/ddl/alter_database.sql.txt +++ b/testdata/result/ddl/alter_database.sql.txt @@ -8,8 +8,7 @@ ALTER DATABASE dbname SET OPTIONS ( ) --- AST &ast.AlterDatabase{ - Alter: 0, - Name: &ast.Ident{ + Name: &ast.Ident{ NamePos: 15, NameEnd: 21, Name: "dbname", diff --git a/testdata/result/ddl/alter_index_add_stored_column.sql.txt b/testdata/result/ddl/alter_index_add_stored_column.sql.txt index ae278e40..831651a3 100644 --- a/testdata/result/ddl/alter_index_add_stored_column.sql.txt +++ b/testdata/result/ddl/alter_index_add_stored_column.sql.txt @@ -3,8 +3,7 @@ alter index foo add stored column bar --- AST &ast.AlterIndex{ - Alter: 0, - Name: &ast.Path{ + Name: &ast.Path{ Idents: []*ast.Ident{ &ast.Ident{ NamePos: 12, diff --git a/testdata/result/ddl/alter_index_drop_stored_column.sql.txt b/testdata/result/ddl/alter_index_drop_stored_column.sql.txt index 1a54ff45..d22dc9c7 100644 --- a/testdata/result/ddl/alter_index_drop_stored_column.sql.txt +++ b/testdata/result/ddl/alter_index_drop_stored_column.sql.txt @@ -3,8 +3,7 @@ alter index foo drop stored column bar --- AST &ast.AlterIndex{ - Alter: 0, - Name: &ast.Path{ + Name: &ast.Path{ Idents: []*ast.Ident{ &ast.Ident{ NamePos: 12, diff --git a/testdata/result/ddl/alter_model.sql.txt b/testdata/result/ddl/alter_model.sql.txt index cb6cf129..9cb212f6 100644 --- a/testdata/result/ddl/alter_model.sql.txt +++ b/testdata/result/ddl/alter_model.sql.txt @@ -9,9 +9,7 @@ SET OPTIONS ( ) --- AST &ast.AlterModel{ - Alter: 0, - IfExists: false, - Name: &ast.Ident{ + Name: &ast.Ident{ NamePos: 12, NameEnd: 33, Name: "MyClassificationModel", @@ -30,7 +28,6 @@ SET OPTIONS ( Array: -1, Lbrack: 64, Rbrack: 227, - Type: nil, Values: []ast.Expr{ &ast.StringLiteral{ ValuePos: 74, diff --git a/testdata/result/ddl/alter_model_if_exists.sql.txt b/testdata/result/ddl/alter_model_if_exists.sql.txt index a585c656..f6884fd5 100644 --- a/testdata/result/ddl/alter_model_if_exists.sql.txt +++ b/testdata/result/ddl/alter_model_if_exists.sql.txt @@ -9,7 +9,6 @@ SET OPTIONS ( ) --- AST &ast.AlterModel{ - Alter: 0, IfExists: true, Name: &ast.Ident{ NamePos: 22, @@ -30,7 +29,6 @@ SET OPTIONS ( Array: -1, Lbrack: 74, Rbrack: 237, - Type: nil, Values: []ast.Expr{ &ast.StringLiteral{ ValuePos: 84, diff --git a/testdata/result/ddl/alter_proto_bundle_all.sql.txt b/testdata/result/ddl/alter_proto_bundle_all.sql.txt index feb37248..6d94cede 100644 --- a/testdata/result/ddl/alter_proto_bundle_all.sql.txt +++ b/testdata/result/ddl/alter_proto_bundle_all.sql.txt @@ -2,7 +2,6 @@ ALTER PROTO BUNDLE INSERT (package.Inserted) UPDATE (package.Updated) DELETE (package.Deleted) --- AST &ast.AlterProtoBundle{ - Alter: 0, Bundle: 12, Insert: &ast.AlterProtoBundleInsert{ Insert: 19, diff --git a/testdata/result/ddl/alter_proto_bundle_delete.sql.txt b/testdata/result/ddl/alter_proto_bundle_delete.sql.txt index ca333576..663b0159 100644 --- a/testdata/result/ddl/alter_proto_bundle_delete.sql.txt +++ b/testdata/result/ddl/alter_proto_bundle_delete.sql.txt @@ -2,10 +2,7 @@ ALTER PROTO BUNDLE DELETE(`examples.shipping.OrderHistory`) --- AST &ast.AlterProtoBundle{ - Alter: 0, Bundle: 12, - Insert: (*ast.AlterProtoBundleInsert)(nil), - Update: (*ast.AlterProtoBundleUpdate)(nil), Delete: &ast.AlterProtoBundleDelete{ Delete: 19, Types: &ast.ProtoBundleTypes{ diff --git a/testdata/result/ddl/alter_proto_bundle_insert.sql.txt b/testdata/result/ddl/alter_proto_bundle_insert.sql.txt index 3b82c6c1..470928dc 100644 --- a/testdata/result/ddl/alter_proto_bundle_insert.sql.txt +++ b/testdata/result/ddl/alter_proto_bundle_insert.sql.txt @@ -4,7 +4,6 @@ ALTER PROTO BUNDLE INSERT ( ) --- AST &ast.AlterProtoBundle{ - Alter: 0, Bundle: 12, Insert: &ast.AlterProtoBundleInsert{ Insert: 19, @@ -34,8 +33,6 @@ ALTER PROTO BUNDLE INSERT ( }, }, }, - Update: (*ast.AlterProtoBundleUpdate)(nil), - Delete: (*ast.AlterProtoBundleDelete)(nil), } --- SQL diff --git a/testdata/result/ddl/alter_proto_bundle_noop.sql.txt b/testdata/result/ddl/alter_proto_bundle_noop.sql.txt index aa40ccc7..e33290f1 100644 --- a/testdata/result/ddl/alter_proto_bundle_noop.sql.txt +++ b/testdata/result/ddl/alter_proto_bundle_noop.sql.txt @@ -2,11 +2,7 @@ ALTER PROTO BUNDLE --- AST &ast.AlterProtoBundle{ - Alter: 0, Bundle: 12, - Insert: (*ast.AlterProtoBundleInsert)(nil), - Update: (*ast.AlterProtoBundleUpdate)(nil), - Delete: (*ast.AlterProtoBundleDelete)(nil), } --- SQL diff --git a/testdata/result/ddl/alter_proto_bundle_update.sql.txt b/testdata/result/ddl/alter_proto_bundle_update.sql.txt index 19f249b1..45376eb4 100644 --- a/testdata/result/ddl/alter_proto_bundle_update.sql.txt +++ b/testdata/result/ddl/alter_proto_bundle_update.sql.txt @@ -2,9 +2,7 @@ ALTER PROTO BUNDLE UPDATE(`examples.shipping.Order`) --- AST &ast.AlterProtoBundle{ - Alter: 0, Bundle: 12, - Insert: (*ast.AlterProtoBundleInsert)(nil), Update: &ast.AlterProtoBundleUpdate{ Update: 19, Types: &ast.ProtoBundleTypes{ @@ -23,7 +21,6 @@ ALTER PROTO BUNDLE UPDATE(`examples.shipping.Order`) }, }, }, - Delete: (*ast.AlterProtoBundleDelete)(nil), } --- SQL diff --git a/testdata/result/ddl/alter_search_index_add_stored_column.sql.txt b/testdata/result/ddl/alter_search_index_add_stored_column.sql.txt index e27c4f83..f0b3a65b 100644 --- a/testdata/result/ddl/alter_search_index_add_stored_column.sql.txt +++ b/testdata/result/ddl/alter_search_index_add_stored_column.sql.txt @@ -2,8 +2,7 @@ ALTER SEARCH INDEX AlbumsIndex ADD STORED COLUMN Genre --- AST &ast.AlterSearchIndex{ - Alter: 0, - Name: &ast.Ident{ + Name: &ast.Ident{ NamePos: 19, NameEnd: 30, Name: "AlbumsIndex", diff --git a/testdata/result/ddl/alter_search_index_drop_stored_column.sql.txt b/testdata/result/ddl/alter_search_index_drop_stored_column.sql.txt index 1a3f12bf..b7ac0f3d 100644 --- a/testdata/result/ddl/alter_search_index_drop_stored_column.sql.txt +++ b/testdata/result/ddl/alter_search_index_drop_stored_column.sql.txt @@ -2,8 +2,7 @@ ALTER SEARCH INDEX AlbumsIndex DROP STORED COLUMN Genre --- AST &ast.AlterSearchIndex{ - Alter: 0, - Name: &ast.Ident{ + Name: &ast.Ident{ NamePos: 19, NameEnd: 30, Name: "AlbumsIndex", diff --git a/testdata/result/ddl/alter_sequence.sql.txt b/testdata/result/ddl/alter_sequence.sql.txt index 0183cc1a..4be6e805 100644 --- a/testdata/result/ddl/alter_sequence.sql.txt +++ b/testdata/result/ddl/alter_sequence.sql.txt @@ -3,8 +3,7 @@ ALTER SEQUENCE my_sequence SET OPTIONS (skip_range_min=1, skip_range_max=1234567 --- AST &ast.AlterSequence{ - Alter: 0, - Name: &ast.Path{ + Name: &ast.Path{ Idents: []*ast.Ident{ &ast.Ident{ NamePos: 15, diff --git a/testdata/result/ddl/alter_statistics.sql.txt b/testdata/result/ddl/alter_statistics.sql.txt index 5e513edd..d5b5b3bb 100644 --- a/testdata/result/ddl/alter_statistics.sql.txt +++ b/testdata/result/ddl/alter_statistics.sql.txt @@ -2,8 +2,7 @@ ALTER STATISTICS auto_20191128_14_47_22UTC SET OPTIONS (allow_gc=false) --- AST &ast.AlterStatistics{ - Alter: 0, - Name: &ast.Ident{ + Name: &ast.Ident{ NamePos: 17, NameEnd: 42, Name: "auto_20191128_14_47_22UTC", @@ -20,7 +19,6 @@ ALTER STATISTICS auto_20191128_14_47_22UTC SET OPTIONS (allow_gc=false) }, Value: &ast.BoolLiteral{ ValuePos: 65, - Value: false, }, }, }, diff --git a/testdata/result/ddl/alter_table_add_check.sql.txt b/testdata/result/ddl/alter_table_add_check.sql.txt index 12790e88..16e305bb 100644 --- a/testdata/result/ddl/alter_table_add_check.sql.txt +++ b/testdata/result/ddl/alter_table_add_check.sql.txt @@ -3,8 +3,7 @@ alter table foo add check (c1 > 0) --- AST &ast.AlterTable{ - Alter: 0, - Name: &ast.Path{ + Name: &ast.Path{ Idents: []*ast.Ident{ &ast.Ident{ NamePos: 12, @@ -16,9 +15,7 @@ alter table foo add check (c1 > 0) TableAlteration: &ast.AddTableConstraint{ Add: 16, TableConstraint: &ast.TableConstraint{ - ConstraintPos: 0, - Name: (*ast.Ident)(nil), - Constraint: &ast.Check{ + Constraint: &ast.Check{ Check: 20, Rparen: 33, Expr: &ast.BinaryExpr{ diff --git a/testdata/result/ddl/alter_table_add_column.sql.txt b/testdata/result/ddl/alter_table_add_column.sql.txt index c1460578..a2e5b008 100644 --- a/testdata/result/ddl/alter_table_add_column.sql.txt +++ b/testdata/result/ddl/alter_table_add_column.sql.txt @@ -2,8 +2,7 @@ alter table foo add column baz string(max) not null --- AST &ast.AlterTable{ - Alter: 0, - Name: &ast.Path{ + Name: &ast.Path{ Idents: []*ast.Ident{ &ast.Ident{ NamePos: 12, @@ -13,9 +12,8 @@ alter table foo add column baz string(max) not null }, }, TableAlteration: &ast.AddColumn{ - Add: 16, - IfNotExists: false, - Column: &ast.ColumnDef{ + Add: 16, + Column: &ast.ColumnDef{ Null: 47, Name: &ast.Ident{ NamePos: 27, @@ -27,13 +25,9 @@ alter table foo add column baz string(max) not null Rparen: 41, Name: "STRING", Max: true, - Size: nil, }, - NotNull: true, - DefaultExpr: (*ast.ColumnDefaultExpr)(nil), - GeneratedExpr: (*ast.GeneratedColumnExpr)(nil), - Hidden: -1, - Options: (*ast.Options)(nil), + NotNull: true, + Hidden: -1, }, }, } diff --git a/testdata/result/ddl/alter_table_add_column_if_not_exists.sql.txt b/testdata/result/ddl/alter_table_add_column_if_not_exists.sql.txt index 4945c620..635672e2 100644 --- a/testdata/result/ddl/alter_table_add_column_if_not_exists.sql.txt +++ b/testdata/result/ddl/alter_table_add_column_if_not_exists.sql.txt @@ -3,8 +3,7 @@ alter table foo add column if not exists baz string(max) not null --- AST &ast.AlterTable{ - Alter: 0, - Name: &ast.Path{ + Name: &ast.Path{ Idents: []*ast.Ident{ &ast.Ident{ NamePos: 12, @@ -28,13 +27,9 @@ alter table foo add column if not exists baz string(max) not null Rparen: 55, Name: "STRING", Max: true, - Size: nil, }, - NotNull: true, - DefaultExpr: (*ast.ColumnDefaultExpr)(nil), - GeneratedExpr: (*ast.GeneratedColumnExpr)(nil), - Hidden: -1, - Options: (*ast.Options)(nil), + NotNull: true, + Hidden: -1, }, }, } diff --git a/testdata/result/ddl/alter_table_add_column_with_if_expression.sql.txt b/testdata/result/ddl/alter_table_add_column_with_if_expression.sql.txt index 580c5d12..181f03d3 100644 --- a/testdata/result/ddl/alter_table_add_column_with_if_expression.sql.txt +++ b/testdata/result/ddl/alter_table_add_column_with_if_expression.sql.txt @@ -2,8 +2,7 @@ ALTER TABLE foo ADD COLUMN expired_at TIMESTAMP AS (IF (status != "OPEN" AND status != "SCHEDULING", TIMESTAMP_ADD(updated_at, INTERVAL 120 DAY), NULL)) STORED --- AST &ast.AlterTable{ - Alter: 0, - Name: &ast.Path{ + Name: &ast.Path{ Idents: []*ast.Ident{ &ast.Ident{ NamePos: 12, @@ -13,9 +12,8 @@ ALTER TABLE foo ADD COLUMN expired_at TIMESTAMP AS (IF (status != "OPEN" AND sta }, }, TableAlteration: &ast.AddColumn{ - Add: 16, - IfNotExists: false, - Column: &ast.ColumnDef{ + Add: 16, + Column: &ast.ColumnDef{ Null: -1, Name: &ast.Ident{ NamePos: 27, @@ -26,8 +24,6 @@ ALTER TABLE foo ADD COLUMN expired_at TIMESTAMP AS (IF (status != "OPEN" AND sta NamePos: 38, Name: "TIMESTAMP", }, - NotNull: false, - DefaultExpr: (*ast.ColumnDefaultExpr)(nil), GeneratedExpr: &ast.GeneratedColumnExpr{ As: 48, Stored: 153, @@ -71,8 +67,7 @@ ALTER TABLE foo ADD COLUMN expired_at TIMESTAMP AS (IF (status != "OPEN" AND sta NameEnd: 114, Name: "TIMESTAMP_ADD", }, - Distinct: false, - Args: []ast.Arg{ + Args: []ast.Arg{ &ast.ExprArg{ Expr: &ast.Ident{ NamePos: 115, @@ -95,17 +90,13 @@ ALTER TABLE foo ADD COLUMN expired_at TIMESTAMP AS (IF (status != "OPEN" AND sta }, }, }, - NamedArgs: []*ast.NamedArg(nil), - NullHandling: nil, - Having: nil, }, ElseResult: &ast.NullLiteral{ Null: 146, }, }, }, - Hidden: -1, - Options: (*ast.Options)(nil), + Hidden: -1, }, }, } diff --git a/testdata/result/ddl/alter_table_add_constraint_check.sql.txt b/testdata/result/ddl/alter_table_add_constraint_check.sql.txt index c7b6bd73..03292861 100644 --- a/testdata/result/ddl/alter_table_add_constraint_check.sql.txt +++ b/testdata/result/ddl/alter_table_add_constraint_check.sql.txt @@ -3,8 +3,7 @@ alter table foo add constraint cname check (c1 > 0) --- AST &ast.AlterTable{ - Alter: 0, - Name: &ast.Path{ + Name: &ast.Path{ Idents: []*ast.Ident{ &ast.Ident{ NamePos: 12, diff --git a/testdata/result/ddl/alter_table_add_constraint_foreign_key.sql.txt b/testdata/result/ddl/alter_table_add_constraint_foreign_key.sql.txt index 14f2f1db..b0c986d8 100644 --- a/testdata/result/ddl/alter_table_add_constraint_foreign_key.sql.txt +++ b/testdata/result/ddl/alter_table_add_constraint_foreign_key.sql.txt @@ -3,8 +3,7 @@ alter table foo add constraint fkname foreign key (foo, bar) references t2 (t2ke --- AST &ast.AlterTable{ - Alter: 0, - Name: &ast.Path{ + Name: &ast.Path{ Idents: []*ast.Ident{ &ast.Ident{ NamePos: 12, @@ -59,7 +58,6 @@ alter table foo add constraint fkname foreign key (foo, bar) references t2 (t2ke Name: "t2key2", }, }, - OnDelete: "", }, }, }, diff --git a/testdata/result/ddl/alter_table_add_constraint_foreign_key_on_delete_cascade.sql.txt b/testdata/result/ddl/alter_table_add_constraint_foreign_key_on_delete_cascade.sql.txt index 5763ea75..7e7ab779 100644 --- a/testdata/result/ddl/alter_table_add_constraint_foreign_key_on_delete_cascade.sql.txt +++ b/testdata/result/ddl/alter_table_add_constraint_foreign_key_on_delete_cascade.sql.txt @@ -3,8 +3,7 @@ alter table foo add constraint fkname foreign key (foo, bar) references t2 (t2ke --- AST &ast.AlterTable{ - Alter: 0, - Name: &ast.Path{ + Name: &ast.Path{ Idents: []*ast.Ident{ &ast.Ident{ NamePos: 12, diff --git a/testdata/result/ddl/alter_table_add_constraint_foreign_key_on_delete_no_action.sql.txt b/testdata/result/ddl/alter_table_add_constraint_foreign_key_on_delete_no_action.sql.txt index 80052ce0..080c4819 100644 --- a/testdata/result/ddl/alter_table_add_constraint_foreign_key_on_delete_no_action.sql.txt +++ b/testdata/result/ddl/alter_table_add_constraint_foreign_key_on_delete_no_action.sql.txt @@ -3,8 +3,7 @@ alter table foo add constraint fkname foreign key (foo, bar) references t2 (t2ke --- AST &ast.AlterTable{ - Alter: 0, - Name: &ast.Path{ + Name: &ast.Path{ Idents: []*ast.Ident{ &ast.Ident{ NamePos: 12, diff --git a/testdata/result/ddl/alter_table_add_foreign_key.sql.txt b/testdata/result/ddl/alter_table_add_foreign_key.sql.txt index 040d5f20..510a9c43 100644 --- a/testdata/result/ddl/alter_table_add_foreign_key.sql.txt +++ b/testdata/result/ddl/alter_table_add_foreign_key.sql.txt @@ -3,8 +3,7 @@ alter table foo add foreign key (bar) references t2 (t2key1) --- AST &ast.AlterTable{ - Alter: 0, - Name: &ast.Path{ + Name: &ast.Path{ Idents: []*ast.Ident{ &ast.Ident{ NamePos: 12, @@ -16,9 +15,7 @@ alter table foo add foreign key (bar) references t2 (t2key1) TableAlteration: &ast.AddTableConstraint{ Add: 16, TableConstraint: &ast.TableConstraint{ - ConstraintPos: 0, - Name: (*ast.Ident)(nil), - Constraint: &ast.ForeignKey{ + Constraint: &ast.ForeignKey{ Foreign: 20, Rparen: 59, OnDeleteEnd: -1, @@ -45,7 +42,6 @@ alter table foo add foreign key (bar) references t2 (t2key1) Name: "t2key1", }, }, - OnDelete: "", }, }, }, diff --git a/testdata/result/ddl/alter_table_add_row_deletion_policy.sql.txt b/testdata/result/ddl/alter_table_add_row_deletion_policy.sql.txt index 4838ae3c..091ec583 100644 --- a/testdata/result/ddl/alter_table_add_row_deletion_policy.sql.txt +++ b/testdata/result/ddl/alter_table_add_row_deletion_policy.sql.txt @@ -3,8 +3,7 @@ alter table foo add row deletion policy ( older_than ( bar, interval 30 day )) --- AST &ast.AlterTable{ - Alter: 0, - Name: &ast.Path{ + Name: &ast.Path{ Idents: []*ast.Ident{ &ast.Ident{ NamePos: 12, diff --git a/testdata/result/ddl/alter_table_add_synonym.sql.txt b/testdata/result/ddl/alter_table_add_synonym.sql.txt index 0f384a60..cc54b865 100644 --- a/testdata/result/ddl/alter_table_add_synonym.sql.txt +++ b/testdata/result/ddl/alter_table_add_synonym.sql.txt @@ -2,8 +2,7 @@ ALTER TABLE Singers ADD SYNONYM SingersTest --- AST &ast.AlterTable{ - Alter: 0, - Name: &ast.Path{ + Name: &ast.Path{ Idents: []*ast.Ident{ &ast.Ident{ NamePos: 12, diff --git a/testdata/result/ddl/alter_table_alter_column.sql.txt b/testdata/result/ddl/alter_table_alter_column.sql.txt index 13e95b83..254ad98c 100644 --- a/testdata/result/ddl/alter_table_alter_column.sql.txt +++ b/testdata/result/ddl/alter_table_alter_column.sql.txt @@ -2,8 +2,7 @@ alter table foo alter column foo string(256) not null --- AST &ast.AlterTable{ - Alter: 0, - Name: &ast.Path{ + Name: &ast.Path{ Idents: []*ast.Ident{ &ast.Ident{ NamePos: 12, @@ -24,7 +23,6 @@ alter table foo alter column foo string(256) not null NamePos: 33, Rparen: 43, Name: "STRING", - Max: false, Size: &ast.IntLiteral{ ValuePos: 40, ValueEnd: 43, @@ -32,9 +30,8 @@ alter table foo alter column foo string(256) not null Value: "256", }, }, - Null: 49, - NotNull: true, - DefaultExpr: (*ast.ColumnDefaultExpr)(nil), + Null: 49, + NotNull: true, }, }, } diff --git a/testdata/result/ddl/alter_table_alter_column_drop_default.sql.txt b/testdata/result/ddl/alter_table_alter_column_drop_default.sql.txt index 21b4175f..8b5e7026 100644 --- a/testdata/result/ddl/alter_table_alter_column_drop_default.sql.txt +++ b/testdata/result/ddl/alter_table_alter_column_drop_default.sql.txt @@ -2,8 +2,7 @@ alter table foo alter column foo drop default --- AST &ast.AlterTable{ - Alter: 0, - Name: &ast.Path{ + Name: &ast.Path{ Idents: []*ast.Ident{ &ast.Ident{ NamePos: 12, diff --git a/testdata/result/ddl/alter_table_alter_column_set.sql.txt b/testdata/result/ddl/alter_table_alter_column_set.sql.txt index 79eebcf1..5ead03f4 100644 --- a/testdata/result/ddl/alter_table_alter_column_set.sql.txt +++ b/testdata/result/ddl/alter_table_alter_column_set.sql.txt @@ -2,8 +2,7 @@ alter table foo alter column foo set options(allow_commit_timestamp = true) --- AST &ast.AlterTable{ - Alter: 0, - Name: &ast.Path{ + Name: &ast.Path{ Idents: []*ast.Ident{ &ast.Ident{ NamePos: 12, diff --git a/testdata/result/ddl/alter_table_alter_column_set_default.sql.txt b/testdata/result/ddl/alter_table_alter_column_set_default.sql.txt index 61bfd3cc..5b75eba2 100644 --- a/testdata/result/ddl/alter_table_alter_column_set_default.sql.txt +++ b/testdata/result/ddl/alter_table_alter_column_set_default.sql.txt @@ -2,8 +2,7 @@ ALTER TABLE actions ALTER COLUMN output SET DEFAULT("") --- AST &ast.AlterTable{ - Alter: 0, - Name: &ast.Path{ + Name: &ast.Path{ Idents: []*ast.Ident{ &ast.Ident{ NamePos: 12, @@ -27,7 +26,6 @@ ALTER TABLE actions ALTER COLUMN output SET DEFAULT("") Expr: &ast.StringLiteral{ ValuePos: 52, ValueEnd: 54, - Value: "", }, }, }, diff --git a/testdata/result/ddl/alter_table_alter_column_with_default.sql.txt b/testdata/result/ddl/alter_table_alter_column_with_default.sql.txt index 1df22088..94a7fc3a 100644 --- a/testdata/result/ddl/alter_table_alter_column_with_default.sql.txt +++ b/testdata/result/ddl/alter_table_alter_column_with_default.sql.txt @@ -2,8 +2,7 @@ ALTER TABLE actions ALTER COLUMN output STRING(MAX) NOT NULL DEFAULT("") --- AST &ast.AlterTable{ - Alter: 0, - Name: &ast.Path{ + Name: &ast.Path{ Idents: []*ast.Ident{ &ast.Ident{ NamePos: 12, @@ -25,7 +24,6 @@ ALTER TABLE actions ALTER COLUMN output STRING(MAX) NOT NULL DEFAULT("") Rparen: 50, Name: "STRING", Max: true, - Size: nil, }, Null: 56, NotNull: true, @@ -35,7 +33,6 @@ ALTER TABLE actions ALTER COLUMN output STRING(MAX) NOT NULL DEFAULT("") Expr: &ast.StringLiteral{ ValuePos: 69, ValueEnd: 71, - Value: "", }, }, }, diff --git a/testdata/result/ddl/alter_table_drop_column.sql.txt b/testdata/result/ddl/alter_table_drop_column.sql.txt index 0a21940d..f279716f 100644 --- a/testdata/result/ddl/alter_table_drop_column.sql.txt +++ b/testdata/result/ddl/alter_table_drop_column.sql.txt @@ -3,8 +3,7 @@ alter table foo drop column bar --- AST &ast.AlterTable{ - Alter: 0, - Name: &ast.Path{ + Name: &ast.Path{ Idents: []*ast.Ident{ &ast.Ident{ NamePos: 12, diff --git a/testdata/result/ddl/alter_table_drop_constraint.sql.txt b/testdata/result/ddl/alter_table_drop_constraint.sql.txt index cd868b07..72380fbe 100644 --- a/testdata/result/ddl/alter_table_drop_constraint.sql.txt +++ b/testdata/result/ddl/alter_table_drop_constraint.sql.txt @@ -3,8 +3,7 @@ alter table foo drop constraint bar --- AST &ast.AlterTable{ - Alter: 0, - Name: &ast.Path{ + Name: &ast.Path{ Idents: []*ast.Ident{ &ast.Ident{ NamePos: 12, diff --git a/testdata/result/ddl/alter_table_drop_row_deletion_policy.sql.txt b/testdata/result/ddl/alter_table_drop_row_deletion_policy.sql.txt index 79604aa1..ea5aecd9 100644 --- a/testdata/result/ddl/alter_table_drop_row_deletion_policy.sql.txt +++ b/testdata/result/ddl/alter_table_drop_row_deletion_policy.sql.txt @@ -3,8 +3,7 @@ alter table foo drop row deletion policy --- AST &ast.AlterTable{ - Alter: 0, - Name: &ast.Path{ + Name: &ast.Path{ Idents: []*ast.Ident{ &ast.Ident{ NamePos: 12, diff --git a/testdata/result/ddl/alter_table_drop_synonym.sql.txt b/testdata/result/ddl/alter_table_drop_synonym.sql.txt index f5233212..bdd9f37e 100644 --- a/testdata/result/ddl/alter_table_drop_synonym.sql.txt +++ b/testdata/result/ddl/alter_table_drop_synonym.sql.txt @@ -2,8 +2,7 @@ ALTER TABLE Singers DROP SYNONYM SingersTest --- AST &ast.AlterTable{ - Alter: 0, - Name: &ast.Path{ + Name: &ast.Path{ Idents: []*ast.Ident{ &ast.Ident{ NamePos: 12, diff --git a/testdata/result/ddl/alter_table_rename_to.sql.txt b/testdata/result/ddl/alter_table_rename_to.sql.txt index 1e7c36a3..d195bd73 100644 --- a/testdata/result/ddl/alter_table_rename_to.sql.txt +++ b/testdata/result/ddl/alter_table_rename_to.sql.txt @@ -2,8 +2,7 @@ ALTER TABLE Singers RENAME TO SingersNew --- AST &ast.AlterTable{ - Alter: 0, - Name: &ast.Path{ + Name: &ast.Path{ Idents: []*ast.Ident{ &ast.Ident{ NamePos: 12, @@ -19,7 +18,6 @@ ALTER TABLE Singers RENAME TO SingersNew NameEnd: 40, Name: "SingersNew", }, - AddSynonym: (*ast.AddSynonym)(nil), }, } diff --git a/testdata/result/ddl/alter_table_rename_to_add_synonym.sql.txt b/testdata/result/ddl/alter_table_rename_to_add_synonym.sql.txt index 868eeb4e..bc921657 100644 --- a/testdata/result/ddl/alter_table_rename_to_add_synonym.sql.txt +++ b/testdata/result/ddl/alter_table_rename_to_add_synonym.sql.txt @@ -2,8 +2,7 @@ ALTER TABLE Singers RENAME TO SingersNew, ADD SYNONYM Singers --- AST &ast.AlterTable{ - Alter: 0, - Name: &ast.Path{ + Name: &ast.Path{ Idents: []*ast.Ident{ &ast.Ident{ NamePos: 12, diff --git a/testdata/result/ddl/alter_table_replace_row_deletion_policy.sql.txt b/testdata/result/ddl/alter_table_replace_row_deletion_policy.sql.txt index 3fe645be..36397cad 100644 --- a/testdata/result/ddl/alter_table_replace_row_deletion_policy.sql.txt +++ b/testdata/result/ddl/alter_table_replace_row_deletion_policy.sql.txt @@ -3,8 +3,7 @@ alter table foo replace row deletion policy ( older_than ( bar, interval 30 day --- AST &ast.AlterTable{ - Alter: 0, - Name: &ast.Path{ + Name: &ast.Path{ Idents: []*ast.Ident{ &ast.Ident{ NamePos: 12, diff --git a/testdata/result/ddl/alter_table_set_on_delete.sql.txt b/testdata/result/ddl/alter_table_set_on_delete.sql.txt index 366965fd..c87c0894 100644 --- a/testdata/result/ddl/alter_table_set_on_delete.sql.txt +++ b/testdata/result/ddl/alter_table_set_on_delete.sql.txt @@ -2,8 +2,7 @@ alter table foo set on delete cascade --- AST &ast.AlterTable{ - Alter: 0, - Name: &ast.Path{ + Name: &ast.Path{ Idents: []*ast.Ident{ &ast.Ident{ NamePos: 12, diff --git a/testdata/result/ddl/alter_table_set_on_delete_no_action.sql.txt b/testdata/result/ddl/alter_table_set_on_delete_no_action.sql.txt index 33386763..45ba919c 100644 --- a/testdata/result/ddl/alter_table_set_on_delete_no_action.sql.txt +++ b/testdata/result/ddl/alter_table_set_on_delete_no_action.sql.txt @@ -2,8 +2,7 @@ alter table foo set on delete no action --- AST &ast.AlterTable{ - Alter: 0, - Name: &ast.Path{ + Name: &ast.Path{ Idents: []*ast.Ident{ &ast.Ident{ NamePos: 12, diff --git a/testdata/result/ddl/analyze.sql.txt b/testdata/result/ddl/analyze.sql.txt index 44a712f1..0dcf9198 100644 --- a/testdata/result/ddl/analyze.sql.txt +++ b/testdata/result/ddl/analyze.sql.txt @@ -1,9 +1,7 @@ --- analyze.sql ANALYZE --- AST -&ast.Analyze{ - Analyze: 0, -} +&ast.Analyze{} --- SQL ANALYZE diff --git a/testdata/result/ddl/create_change_stream.sql.txt b/testdata/result/ddl/create_change_stream.sql.txt index 323175f1..195b135d 100644 --- a/testdata/result/ddl/create_change_stream.sql.txt +++ b/testdata/result/ddl/create_change_stream.sql.txt @@ -3,14 +3,11 @@ CREATE CHANGE STREAM change_stream_name --- AST &ast.CreateChangeStream{ - Create: 0, - Name: &ast.Ident{ + Name: &ast.Ident{ NamePos: 21, NameEnd: 39, Name: "change_stream_name", }, - For: nil, - Options: (*ast.Options)(nil), } --- SQL diff --git a/testdata/result/ddl/create_change_stream_for_all.sql.txt b/testdata/result/ddl/create_change_stream_for_all.sql.txt index ae3ae9de..454e5db2 100644 --- a/testdata/result/ddl/create_change_stream_for_all.sql.txt +++ b/testdata/result/ddl/create_change_stream_for_all.sql.txt @@ -3,8 +3,7 @@ CREATE CHANGE STREAM change_stream_name FOR ALL --- AST &ast.CreateChangeStream{ - Create: 0, - Name: &ast.Ident{ + Name: &ast.Ident{ NamePos: 21, NameEnd: 39, Name: "change_stream_name", @@ -13,7 +12,6 @@ CREATE CHANGE STREAM change_stream_name FOR ALL For: 40, All: 48, }, - Options: (*ast.Options)(nil), } --- SQL diff --git a/testdata/result/ddl/create_change_stream_for_multiple_table_columns.sql.txt b/testdata/result/ddl/create_change_stream_for_multiple_table_columns.sql.txt index 7f223ba7..6bfce3fb 100644 --- a/testdata/result/ddl/create_change_stream_for_multiple_table_columns.sql.txt +++ b/testdata/result/ddl/create_change_stream_for_multiple_table_columns.sql.txt @@ -3,8 +3,7 @@ CREATE CHANGE STREAM change_stream_name FOR table_name1(column1, column2), table --- AST &ast.CreateChangeStream{ - Create: 0, - Name: &ast.Ident{ + Name: &ast.Ident{ NamePos: 21, NameEnd: 39, Name: "change_stream_name", @@ -54,7 +53,6 @@ CREATE CHANGE STREAM change_stream_name FOR table_name1(column1, column2), table }, }, }, - Options: (*ast.Options)(nil), } --- SQL diff --git a/testdata/result/ddl/create_change_stream_for_table.sql.txt b/testdata/result/ddl/create_change_stream_for_table.sql.txt index e208fda4..ebde8b19 100644 --- a/testdata/result/ddl/create_change_stream_for_table.sql.txt +++ b/testdata/result/ddl/create_change_stream_for_table.sql.txt @@ -3,8 +3,7 @@ CREATE CHANGE STREAM change_stream_name FOR table_name --- AST &ast.CreateChangeStream{ - Create: 0, - Name: &ast.Ident{ + Name: &ast.Ident{ NamePos: 21, NameEnd: 39, Name: "change_stream_name", @@ -13,17 +12,14 @@ CREATE CHANGE STREAM change_stream_name FOR table_name For: 40, Tables: []*ast.ChangeStreamForTable{ &ast.ChangeStreamForTable{ - Rparen: 0, TableName: &ast.Ident{ NamePos: 44, NameEnd: 54, Name: "table_name", }, - Columns: []*ast.Ident(nil), }, }, }, - Options: (*ast.Options)(nil), } --- SQL diff --git a/testdata/result/ddl/create_change_stream_for_table_column.sql.txt b/testdata/result/ddl/create_change_stream_for_table_column.sql.txt index 8829eac0..3be46ca1 100644 --- a/testdata/result/ddl/create_change_stream_for_table_column.sql.txt +++ b/testdata/result/ddl/create_change_stream_for_table_column.sql.txt @@ -3,8 +3,7 @@ CREATE CHANGE STREAM change_stream_name FOR table_name(column) --- AST &ast.CreateChangeStream{ - Create: 0, - Name: &ast.Ident{ + Name: &ast.Ident{ NamePos: 21, NameEnd: 39, Name: "change_stream_name", @@ -29,7 +28,6 @@ CREATE CHANGE STREAM change_stream_name FOR table_name(column) }, }, }, - Options: (*ast.Options)(nil), } --- SQL diff --git a/testdata/result/ddl/create_change_stream_for_table_columns.sql.txt b/testdata/result/ddl/create_change_stream_for_table_columns.sql.txt index 320c4dd3..872ff41f 100644 --- a/testdata/result/ddl/create_change_stream_for_table_columns.sql.txt +++ b/testdata/result/ddl/create_change_stream_for_table_columns.sql.txt @@ -3,8 +3,7 @@ CREATE CHANGE STREAM change_stream_name FOR table_name(column1, column2) --- AST &ast.CreateChangeStream{ - Create: 0, - Name: &ast.Ident{ + Name: &ast.Ident{ NamePos: 21, NameEnd: 39, Name: "change_stream_name", @@ -34,7 +33,6 @@ CREATE CHANGE STREAM change_stream_name FOR table_name(column1, column2) }, }, }, - Options: (*ast.Options)(nil), } --- SQL diff --git a/testdata/result/ddl/create_change_stream_for_tables.sql.txt b/testdata/result/ddl/create_change_stream_for_tables.sql.txt index d152e46e..3cfd2415 100644 --- a/testdata/result/ddl/create_change_stream_for_tables.sql.txt +++ b/testdata/result/ddl/create_change_stream_for_tables.sql.txt @@ -3,8 +3,7 @@ CREATE CHANGE STREAM change_stream_name FOR table_name1, table_name2 --- AST &ast.CreateChangeStream{ - Create: 0, - Name: &ast.Ident{ + Name: &ast.Ident{ NamePos: 21, NameEnd: 39, Name: "change_stream_name", @@ -13,26 +12,21 @@ CREATE CHANGE STREAM change_stream_name FOR table_name1, table_name2 For: 40, Tables: []*ast.ChangeStreamForTable{ &ast.ChangeStreamForTable{ - Rparen: 0, TableName: &ast.Ident{ NamePos: 44, NameEnd: 55, Name: "table_name1", }, - Columns: []*ast.Ident(nil), }, &ast.ChangeStreamForTable{ - Rparen: 0, TableName: &ast.Ident{ NamePos: 57, NameEnd: 68, Name: "table_name2", }, - Columns: []*ast.Ident(nil), }, }, }, - Options: (*ast.Options)(nil), } --- SQL diff --git a/testdata/result/ddl/create_change_stream_for_tables_with_option.sql.txt b/testdata/result/ddl/create_change_stream_for_tables_with_option.sql.txt index 7f1778ce..9077f8c5 100644 --- a/testdata/result/ddl/create_change_stream_for_tables_with_option.sql.txt +++ b/testdata/result/ddl/create_change_stream_for_tables_with_option.sql.txt @@ -4,8 +4,7 @@ OPTIONS(retention_period = '1d') --- AST &ast.CreateChangeStream{ - Create: 0, - Name: &ast.Ident{ + Name: &ast.Ident{ NamePos: 21, NameEnd: 39, Name: "change_stream_name", diff --git a/testdata/result/ddl/create_change_stream_for_tables_with_option_null.sql.txt b/testdata/result/ddl/create_change_stream_for_tables_with_option_null.sql.txt index 1ff7f957..5f569192 100644 --- a/testdata/result/ddl/create_change_stream_for_tables_with_option_null.sql.txt +++ b/testdata/result/ddl/create_change_stream_for_tables_with_option_null.sql.txt @@ -4,8 +4,7 @@ OPTIONS(retention_period = null) --- AST &ast.CreateChangeStream{ - Create: 0, - Name: &ast.Ident{ + Name: &ast.Ident{ NamePos: 21, NameEnd: 39, Name: "change_stream_name", diff --git a/testdata/result/ddl/create_change_stream_for_tables_with_options.sql.txt b/testdata/result/ddl/create_change_stream_for_tables_with_options.sql.txt index ecb43509..8dbce278 100644 --- a/testdata/result/ddl/create_change_stream_for_tables_with_options.sql.txt +++ b/testdata/result/ddl/create_change_stream_for_tables_with_options.sql.txt @@ -4,8 +4,7 @@ OPTIONS(retention_period = '1d', value_capture_type = 'NEW_ROW') --- AST &ast.CreateChangeStream{ - Create: 0, - Name: &ast.Ident{ + Name: &ast.Ident{ NamePos: 21, NameEnd: 39, Name: "change_stream_name", diff --git a/testdata/result/ddl/create_database.sql.txt b/testdata/result/ddl/create_database.sql.txt index 85282278..54a7523e 100644 --- a/testdata/result/ddl/create_database.sql.txt +++ b/testdata/result/ddl/create_database.sql.txt @@ -3,8 +3,7 @@ create database foo_bar_baz --- AST &ast.CreateDatabase{ - Create: 0, - Name: &ast.Ident{ + Name: &ast.Ident{ NamePos: 16, NameEnd: 27, Name: "foo_bar_baz", diff --git a/testdata/result/ddl/create_index.sql.txt b/testdata/result/ddl/create_index.sql.txt index 1e7c971e..f29910dd 100644 --- a/testdata/result/ddl/create_index.sql.txt +++ b/testdata/result/ddl/create_index.sql.txt @@ -6,12 +6,8 @@ create index foo_bar on foo ( --- AST &ast.CreateIndex{ - Create: 0, - Rparen: 53, - Unique: false, - NullFiltered: false, - IfNotExists: false, - Name: &ast.Path{ + Rparen: 53, + Name: &ast.Path{ Idents: []*ast.Ident{ &ast.Ident{ NamePos: 13, @@ -49,8 +45,6 @@ create index foo_bar on foo ( Dir: "ASC", }, }, - Storing: (*ast.Storing)(nil), - InterleaveIn: (*ast.InterleaveIn)(nil), } --- SQL diff --git a/testdata/result/ddl/create_index_if_not_exists.sql.txt b/testdata/result/ddl/create_index_if_not_exists.sql.txt index fc35d85f..824fd9e4 100644 --- a/testdata/result/ddl/create_index_if_not_exists.sql.txt +++ b/testdata/result/ddl/create_index_if_not_exists.sql.txt @@ -3,12 +3,9 @@ create index if not exists foo_bar on foo (bar) --- AST &ast.CreateIndex{ - Create: 0, - Rparen: 46, - Unique: false, - NullFiltered: false, - IfNotExists: true, - Name: &ast.Path{ + Rparen: 46, + IfNotExists: true, + Name: &ast.Path{ Idents: []*ast.Ident{ &ast.Ident{ NamePos: 27, @@ -34,11 +31,8 @@ create index if not exists foo_bar on foo (bar) NameEnd: 46, Name: "bar", }, - Dir: "", }, }, - Storing: (*ast.Storing)(nil), - InterleaveIn: (*ast.InterleaveIn)(nil), } --- SQL diff --git a/testdata/result/ddl/create_index_interleave.sql.txt b/testdata/result/ddl/create_index_interleave.sql.txt index 32e8a5dc..5dffda20 100644 --- a/testdata/result/ddl/create_index_interleave.sql.txt +++ b/testdata/result/ddl/create_index_interleave.sql.txt @@ -6,12 +6,8 @@ create index foo_bar on foo ( --- AST &ast.CreateIndex{ - Create: 0, - Rparen: 41, - Unique: false, - NullFiltered: false, - IfNotExists: false, - Name: &ast.Path{ + Rparen: 41, + Name: &ast.Path{ Idents: []*ast.Ident{ &ast.Ident{ NamePos: 13, diff --git a/testdata/result/ddl/create_index_storing.sql.txt b/testdata/result/ddl/create_index_storing.sql.txt index 1d08e6e3..5f0a2dbf 100644 --- a/testdata/result/ddl/create_index_storing.sql.txt +++ b/testdata/result/ddl/create_index_storing.sql.txt @@ -5,12 +5,8 @@ create index foo_bar on foo ( --- AST &ast.CreateIndex{ - Create: 0, - Rparen: 40, - Unique: false, - NullFiltered: false, - IfNotExists: false, - Name: &ast.Path{ + Rparen: 40, + Name: &ast.Path{ Idents: []*ast.Ident{ &ast.Ident{ NamePos: 13, @@ -55,7 +51,6 @@ create index foo_bar on foo ( }, }, }, - InterleaveIn: (*ast.InterleaveIn)(nil), } --- SQL diff --git a/testdata/result/ddl/create_model.sql.txt b/testdata/result/ddl/create_model.sql.txt index 29e55f39..de647cb2 100644 --- a/testdata/result/ddl/create_model.sql.txt +++ b/testdata/result/ddl/create_model.sql.txt @@ -15,11 +15,8 @@ OPTIONS ( ) --- AST &ast.CreateModel{ - Create: 0, - Remote: 183, - OrReplace: false, - IfNotExists: false, - Name: &ast.Ident{ + Remote: 183, + Name: &ast.Ident{ NamePos: 13, NameEnd: 34, Name: "MyClassificationModel", @@ -38,7 +35,6 @@ OPTIONS ( NamePos: 52, Name: "FLOAT64", }, - Options: (*ast.Options)(nil), }, &ast.CreateModelColumn{ Name: &ast.Ident{ @@ -51,9 +47,7 @@ OPTIONS ( Rparen: 82, Name: "STRING", Max: true, - Size: nil, }, - Options: (*ast.Options)(nil), }, &ast.CreateModelColumn{ Name: &ast.Ident{ @@ -70,11 +64,8 @@ OPTIONS ( Rparen: 113, Name: "STRING", Max: true, - Size: nil, }, - NamedArgs: []*ast.NamedArg(nil), }, - Options: (*ast.Options)(nil), }, }, OutputColumns: []*ast.CreateModelColumn{ @@ -92,9 +83,7 @@ OPTIONS ( NamePos: 142, Name: "FLOAT64", }, - NamedArgs: []*ast.NamedArg(nil), }, - Options: (*ast.Options)(nil), }, &ast.CreateModelColumn{ Name: &ast.Ident{ @@ -111,11 +100,8 @@ OPTIONS ( Rparen: 178, Name: "STRING", Max: true, - Size: nil, }, - NamedArgs: []*ast.NamedArg(nil), }, - Options: (*ast.Options)(nil), }, }, }, diff --git a/testdata/result/ddl/create_model_if_not_exists.sql.txt b/testdata/result/ddl/create_model_if_not_exists.sql.txt index dfaea744..05f2efaa 100644 --- a/testdata/result/ddl/create_model_if_not_exists.sql.txt +++ b/testdata/result/ddl/create_model_if_not_exists.sql.txt @@ -8,9 +8,7 @@ REMOTE OPTIONS ( ) --- AST &ast.CreateModel{ - Create: 0, Remote: 93, - OrReplace: false, IfNotExists: true, Name: &ast.Ident{ NamePos: 13, @@ -32,9 +30,7 @@ REMOTE OPTIONS ( Rparen: 61, Name: "STRING", Max: true, - Size: nil, }, - Options: (*ast.Options)(nil), }, }, OutputColumns: []*ast.CreateModelColumn{ @@ -49,9 +45,7 @@ REMOTE OPTIONS ( Rparen: 90, Name: "STRING", Max: true, - Size: nil, }, - Options: (*ast.Options)(nil), }, }, }, diff --git a/testdata/result/ddl/create_or_replace_model.sql.txt b/testdata/result/ddl/create_or_replace_model.sql.txt index 7f9f4a2c..9955be94 100644 --- a/testdata/result/ddl/create_or_replace_model.sql.txt +++ b/testdata/result/ddl/create_or_replace_model.sql.txt @@ -8,11 +8,9 @@ REMOTE OPTIONS ( ) --- AST &ast.CreateModel{ - Create: 0, - Remote: 90, - OrReplace: true, - IfNotExists: false, - Name: &ast.Ident{ + Remote: 90, + OrReplace: true, + Name: &ast.Ident{ NamePos: 24, NameEnd: 33, Name: "GeminiPro", @@ -32,9 +30,7 @@ REMOTE OPTIONS ( Rparen: 58, Name: "STRING", Max: true, - Size: nil, }, - Options: (*ast.Options)(nil), }, }, OutputColumns: []*ast.CreateModelColumn{ @@ -49,9 +45,7 @@ REMOTE OPTIONS ( Rparen: 87, Name: "STRING", Max: true, - Size: nil, }, - Options: (*ast.Options)(nil), }, }, }, diff --git a/testdata/result/ddl/create_or_replace_view.sql.txt b/testdata/result/ddl/create_or_replace_view.sql.txt index f66ace7f..59a20e48 100644 --- a/testdata/result/ddl/create_or_replace_view.sql.txt +++ b/testdata/result/ddl/create_or_replace_view.sql.txt @@ -8,8 +8,7 @@ from singers --- AST &ast.CreateView{ - Create: 0, - Name: &ast.Path{ + Name: &ast.Path{ Idents: []*ast.Ident{ &ast.Ident{ NamePos: 23, @@ -21,10 +20,8 @@ from singers OrReplace: true, SecurityType: "INVOKER", Query: &ast.Select{ - Select: 59, - Distinct: false, - As: nil, - Results: []ast.SelectItem{ + Select: 59, + Results: []ast.SelectItem{ &ast.Alias{ Expr: &ast.Path{ Idents: []*ast.Ident{ @@ -107,16 +104,8 @@ from singers NameEnd: 169, Name: "singers", }, - Hint: (*ast.Hint)(nil), - As: (*ast.AsAlias)(nil), - Sample: (*ast.TableSample)(nil), }, }, - Where: (*ast.Where)(nil), - GroupBy: (*ast.GroupBy)(nil), - Having: (*ast.Having)(nil), - OrderBy: (*ast.OrderBy)(nil), - Limit: (*ast.Limit)(nil), }, } diff --git a/testdata/result/ddl/create_placement.sql.txt b/testdata/result/ddl/create_placement.sql.txt index efbb1bc0..4cae85d1 100644 --- a/testdata/result/ddl/create_placement.sql.txt +++ b/testdata/result/ddl/create_placement.sql.txt @@ -2,8 +2,7 @@ CREATE PLACEMENT `europeplacement` OPTIONS (instance_partition="europe-partition") --- AST &ast.CreatePlacement{ - Create: 0, - Name: &ast.Ident{ + Name: &ast.Ident{ NamePos: 17, NameEnd: 34, Name: "europeplacement", diff --git a/testdata/result/ddl/create_role.sql.txt b/testdata/result/ddl/create_role.sql.txt index 1ee359a6..272ed16b 100644 --- a/testdata/result/ddl/create_role.sql.txt +++ b/testdata/result/ddl/create_role.sql.txt @@ -3,8 +3,7 @@ CREATE ROLE hr_manager --- AST &ast.CreateRole{ - Create: 0, - Name: &ast.Ident{ + Name: &ast.Ident{ NamePos: 12, NameEnd: 22, Name: "hr_manager", diff --git a/testdata/result/ddl/create_schema.sql.txt b/testdata/result/ddl/create_schema.sql.txt index 2b04f8f5..0d7bd8cd 100644 --- a/testdata/result/ddl/create_schema.sql.txt +++ b/testdata/result/ddl/create_schema.sql.txt @@ -2,8 +2,7 @@ CREATE SCHEMA sch1 --- AST &ast.CreateSchema{ - Create: 0, - Name: &ast.Ident{ + Name: &ast.Ident{ NamePos: 14, NameEnd: 18, Name: "sch1", diff --git a/testdata/result/ddl/create_search_index_full.sql.txt b/testdata/result/ddl/create_search_index_full.sql.txt index 299f2fe0..3f4d4b09 100644 --- a/testdata/result/ddl/create_search_index_full.sql.txt +++ b/testdata/result/ddl/create_search_index_full.sql.txt @@ -9,8 +9,7 @@ WHERE Genre IS NOT NULL AND ReleaseTimestamp IS NOT NULL OPTIONS(sort_order_sharding=true) --- AST &ast.CreateSearchIndex{ - Create: 0, - Name: &ast.Ident{ + Name: &ast.Ident{ NamePos: 20, NameEnd: 35, Name: "AlbumsIndexFull", @@ -61,8 +60,7 @@ OPTIONS(sort_order_sharding=true) NameEnd: 137, Name: "ReleaseTimestamp", }, - Collate: (*ast.Collate)(nil), - Dir: "DESC", + Dir: "DESC", }, }, }, diff --git a/testdata/result/ddl/create_search_index_null_filtered.sql.txt b/testdata/result/ddl/create_search_index_null_filtered.sql.txt index f1fab7c1..d5729a3a 100644 --- a/testdata/result/ddl/create_search_index_null_filtered.sql.txt +++ b/testdata/result/ddl/create_search_index_null_filtered.sql.txt @@ -5,8 +5,7 @@ STORING(Genre) WHERE Genre IS NOT NULL --- AST &ast.CreateSearchIndex{ - Create: 0, - Name: &ast.Ident{ + Name: &ast.Ident{ NamePos: 20, NameEnd: 31, Name: "AlbumsIndex", @@ -35,9 +34,7 @@ WHERE Genre IS NOT NULL }, }, }, - PartitionColumns: []*ast.Ident(nil), - OrderBy: (*ast.OrderBy)(nil), - Where: &ast.Where{ + Where: &ast.Where{ Where: 76, Expr: &ast.IsNullExpr{ Null: 95, @@ -49,8 +46,6 @@ WHERE Genre IS NOT NULL }, }, }, - Interleave: (*ast.InterleaveIn)(nil), - Options: (*ast.Options)(nil), } --- SQL diff --git a/testdata/result/ddl/create_search_index_simple.sql.txt b/testdata/result/ddl/create_search_index_simple.sql.txt index 60072aa5..157fa39d 100644 --- a/testdata/result/ddl/create_search_index_simple.sql.txt +++ b/testdata/result/ddl/create_search_index_simple.sql.txt @@ -22,13 +22,7 @@ CREATE SEARCH INDEX AlbumsIndex Name: "AlbumTitle_Tokens", }, }, - Rparen: 84, - Storing: (*ast.Storing)(nil), - PartitionColumns: []*ast.Ident(nil), - OrderBy: (*ast.OrderBy)(nil), - Where: (*ast.Where)(nil), - Interleave: (*ast.InterleaveIn)(nil), - Options: (*ast.Options)(nil), + Rparen: 84, } --- SQL diff --git a/testdata/result/ddl/create_sequance.sql.txt b/testdata/result/ddl/create_sequance.sql.txt index c9b733f0..e38e825b 100644 --- a/testdata/result/ddl/create_sequance.sql.txt +++ b/testdata/result/ddl/create_sequance.sql.txt @@ -7,8 +7,7 @@ CREATE SEQUENCE IF NOT EXISTS MySequence OPTIONS ( --- AST &ast.CreateSequence{ - Create: 0, - Name: &ast.Path{ + Name: &ast.Path{ Idents: []*ast.Ident{ &ast.Ident{ NamePos: 30, diff --git a/testdata/result/ddl/create_table.sql.txt b/testdata/result/ddl/create_table.sql.txt index 955ce484..f3d84cdf 100644 --- a/testdata/result/ddl/create_table.sql.txt +++ b/testdata/result/ddl/create_table.sql.txt @@ -16,10 +16,8 @@ create table foo ( --- AST &ast.CreateTable{ - Create: 0, - Rparen: 573, - IfNotExists: false, - Name: &ast.Path{ + Rparen: 573, + Name: &ast.Path{ Idents: []*ast.Ident{ &ast.Ident{ NamePos: 13, @@ -40,11 +38,7 @@ create table foo ( NamePos: 25, Name: "INT64", }, - NotNull: false, - DefaultExpr: (*ast.ColumnDefaultExpr)(nil), - GeneratedExpr: (*ast.GeneratedColumnExpr)(nil), - Hidden: -1, - Options: (*ast.Options)(nil), + Hidden: -1, }, &ast.ColumnDef{ Null: 50, @@ -57,11 +51,8 @@ create table foo ( NamePos: 38, Name: "FLOAT64", }, - NotNull: true, - DefaultExpr: (*ast.ColumnDefaultExpr)(nil), - GeneratedExpr: (*ast.GeneratedColumnExpr)(nil), - Hidden: -1, - Options: (*ast.Options)(nil), + NotNull: true, + Hidden: -1, }, &ast.ColumnDef{ Null: 78, @@ -74,7 +65,6 @@ create table foo ( NamePos: 62, Rparen: 72, Name: "STRING", - Max: false, Size: &ast.IntLiteral{ ValuePos: 69, ValueEnd: 72, @@ -82,11 +72,9 @@ create table foo ( Value: "255", }, }, - NotNull: true, - DefaultExpr: (*ast.ColumnDefaultExpr)(nil), - GeneratedExpr: (*ast.GeneratedColumnExpr)(nil), - Hidden: -1, - Options: &ast.Options{ + NotNull: true, + Hidden: -1, + Options: &ast.Options{ Options: 83, Rparen: 120, Records: []*ast.OptionsDef{ @@ -114,7 +102,6 @@ create table foo ( NamePos: 129, Rparen: 139, Name: "STRING", - Max: false, Size: &ast.IntLiteral{ ValuePos: 136, ValueEnd: 139, @@ -123,7 +110,6 @@ create table foo ( }, }, NotNull: true, - DefaultExpr: (*ast.ColumnDefaultExpr)(nil), GeneratedExpr: &ast.GeneratedColumnExpr{ As: 150, Stored: 172, @@ -135,8 +121,7 @@ create table foo ( NameEnd: 160, Name: "concat", }, - Distinct: false, - Args: []ast.Arg{ + Args: []ast.Arg{ &ast.ExprArg{ Expr: &ast.Ident{ NamePos: 161, @@ -152,13 +137,9 @@ create table foo ( }, }, }, - NamedArgs: []*ast.NamedArg(nil), - NullHandling: nil, - Having: nil, }, }, - Hidden: -1, - Options: (*ast.Options)(nil), + Hidden: -1, }, &ast.ColumnDef{ Null: -1, @@ -171,11 +152,7 @@ create table foo ( NamePos: 487, Name: "JSON", }, - NotNull: false, - DefaultExpr: (*ast.ColumnDefaultExpr)(nil), - GeneratedExpr: (*ast.GeneratedColumnExpr)(nil), - Hidden: -1, - Options: (*ast.Options)(nil), + Hidden: -1, }, &ast.ColumnDef{ Null: 515, @@ -199,22 +176,14 @@ create table foo ( NameEnd: 546, Name: "current_timestamp", }, - Distinct: false, - Args: []ast.Arg(nil), - NamedArgs: []*ast.NamedArg(nil), - NullHandling: nil, - Having: nil, }, }, - GeneratedExpr: (*ast.GeneratedColumnExpr)(nil), - Hidden: -1, - Options: (*ast.Options)(nil), + Hidden: -1, }, }, TableConstraints: []*ast.TableConstraint{ &ast.TableConstraint{ ConstraintPos: -1, - Name: (*ast.Ident)(nil), Constraint: &ast.ForeignKey{ Foreign: 182, Rparen: 221, @@ -242,12 +211,10 @@ create table foo ( Name: "t2key1", }, }, - OnDelete: "", }, }, &ast.TableConstraint{ ConstraintPos: -1, - Name: (*ast.Ident)(nil), Constraint: &ast.ForeignKey{ Foreign: 226, Rparen: 265, @@ -280,7 +247,6 @@ create table foo ( }, &ast.TableConstraint{ ConstraintPos: -1, - Name: (*ast.Ident)(nil), Constraint: &ast.ForeignKey{ Foreign: 288, Rparen: 327, @@ -355,12 +321,10 @@ create table foo ( Name: "t2key2", }, }, - OnDelete: "", }, }, &ast.TableConstraint{ ConstraintPos: -1, - Name: (*ast.Ident)(nil), Constraint: &ast.Check{ Check: 427, Rparen: 441, @@ -415,7 +379,6 @@ create table foo ( NameEnd: 568, Name: "foo", }, - Dir: "", }, &ast.IndexKey{ DirPos: -1, @@ -424,12 +387,8 @@ create table foo ( NameEnd: 573, Name: "bar", }, - Dir: "", }, }, - Synonyms: []*ast.Synonym(nil), - Cluster: (*ast.Cluster)(nil), - RowDeletionPolicy: (*ast.CreateRowDeletionPolicy)(nil), } --- SQL diff --git a/testdata/result/ddl/create_table_cluster.sql.txt b/testdata/result/ddl/create_table_cluster.sql.txt index d68c4f45..bacaadc3 100644 --- a/testdata/result/ddl/create_table_cluster.sql.txt +++ b/testdata/result/ddl/create_table_cluster.sql.txt @@ -7,10 +7,8 @@ create table foo ( --- AST &ast.CreateTable{ - Create: 0, - Rparen: 59, - IfNotExists: false, - Name: &ast.Path{ + Rparen: 59, + Name: &ast.Path{ Idents: []*ast.Ident{ &ast.Ident{ NamePos: 13, @@ -31,11 +29,7 @@ create table foo ( NamePos: 25, Name: "INT64", }, - NotNull: false, - DefaultExpr: (*ast.ColumnDefaultExpr)(nil), - GeneratedExpr: (*ast.GeneratedColumnExpr)(nil), - Hidden: -1, - Options: (*ast.Options)(nil), + Hidden: -1, }, &ast.ColumnDef{ Null: -1, @@ -48,17 +42,10 @@ create table foo ( NamePos: 38, Name: "INT64", }, - NotNull: false, - DefaultExpr: (*ast.ColumnDefaultExpr)(nil), - GeneratedExpr: (*ast.GeneratedColumnExpr)(nil), - Hidden: -1, - Options: (*ast.Options)(nil), + Hidden: -1, }, }, - TableConstraints: []*ast.TableConstraint(nil), - PrimaryKeys: []*ast.IndexKey(nil), - Synonyms: []*ast.Synonym(nil), - Cluster: &ast.Cluster{ + Cluster: &ast.Cluster{ Comma: 60, OnDeleteEnd: -1, TableName: &ast.Path{ @@ -70,9 +57,7 @@ create table foo ( }, }, }, - OnDelete: "", }, - RowDeletionPolicy: (*ast.CreateRowDeletionPolicy)(nil), } --- SQL diff --git a/testdata/result/ddl/create_table_cluster_and_row_deletion_policy.sql.txt b/testdata/result/ddl/create_table_cluster_and_row_deletion_policy.sql.txt index 654d7abc..0f37325d 100644 --- a/testdata/result/ddl/create_table_cluster_and_row_deletion_policy.sql.txt +++ b/testdata/result/ddl/create_table_cluster_and_row_deletion_policy.sql.txt @@ -9,10 +9,8 @@ create table foo ( --- AST &ast.CreateTable{ - Create: 0, - Rparen: 77, - IfNotExists: false, - Name: &ast.Path{ + Rparen: 77, + Name: &ast.Path{ Idents: []*ast.Ident{ &ast.Ident{ NamePos: 13, @@ -33,11 +31,7 @@ create table foo ( NamePos: 25, Name: "INT64", }, - NotNull: false, - DefaultExpr: (*ast.ColumnDefaultExpr)(nil), - GeneratedExpr: (*ast.GeneratedColumnExpr)(nil), - Hidden: -1, - Options: (*ast.Options)(nil), + Hidden: -1, }, &ast.ColumnDef{ Null: -1, @@ -50,11 +44,7 @@ create table foo ( NamePos: 38, Name: "INT64", }, - NotNull: false, - DefaultExpr: (*ast.ColumnDefaultExpr)(nil), - GeneratedExpr: (*ast.GeneratedColumnExpr)(nil), - Hidden: -1, - Options: (*ast.Options)(nil), + Hidden: -1, }, &ast.ColumnDef{ Null: -1, @@ -67,17 +57,10 @@ create table foo ( NamePos: 51, Name: "TIMESTAMP", }, - NotNull: false, - DefaultExpr: (*ast.ColumnDefaultExpr)(nil), - GeneratedExpr: (*ast.GeneratedColumnExpr)(nil), - Hidden: -1, - Options: (*ast.Options)(nil), + Hidden: -1, }, }, - TableConstraints: []*ast.TableConstraint(nil), - PrimaryKeys: []*ast.IndexKey(nil), - Synonyms: []*ast.Synonym(nil), - Cluster: &ast.Cluster{ + Cluster: &ast.Cluster{ Comma: 78, OnDeleteEnd: -1, TableName: &ast.Path{ @@ -89,7 +72,6 @@ create table foo ( }, }, }, - OnDelete: "", }, RowDeletionPolicy: &ast.CreateRowDeletionPolicy{ Comma: 109, diff --git a/testdata/result/ddl/create_table_cluster_on_delete_no_action.sql.txt b/testdata/result/ddl/create_table_cluster_on_delete_no_action.sql.txt index df380466..393b0989 100644 --- a/testdata/result/ddl/create_table_cluster_on_delete_no_action.sql.txt +++ b/testdata/result/ddl/create_table_cluster_on_delete_no_action.sql.txt @@ -6,10 +6,8 @@ create table foo ( on delete no action --- AST &ast.CreateTable{ - Create: 0, - Rparen: 50, - IfNotExists: false, - Name: &ast.Path{ + Rparen: 50, + Name: &ast.Path{ Idents: []*ast.Ident{ &ast.Ident{ NamePos: 13, @@ -30,15 +28,10 @@ create table foo ( NamePos: 25, Name: "INT64", }, - NotNull: false, - DefaultExpr: (*ast.ColumnDefaultExpr)(nil), - GeneratedExpr: (*ast.GeneratedColumnExpr)(nil), - Hidden: -1, - Options: (*ast.Options)(nil), + Hidden: -1, }, }, - TableConstraints: []*ast.TableConstraint(nil), - PrimaryKeys: []*ast.IndexKey{ + PrimaryKeys: []*ast.IndexKey{ &ast.IndexKey{ DirPos: -1, Name: &ast.Ident{ @@ -46,11 +39,9 @@ create table foo ( NameEnd: 50, Name: "foo", }, - Dir: "", }, }, - Synonyms: []*ast.Synonym(nil), - Cluster: &ast.Cluster{ + Cluster: &ast.Cluster{ Comma: 51, OnDeleteEnd: 115, TableName: &ast.Path{ @@ -64,7 +55,6 @@ create table foo ( }, OnDelete: "ON DELETE NO ACTION", }, - RowDeletionPolicy: (*ast.CreateRowDeletionPolicy)(nil), } --- SQL diff --git a/testdata/result/ddl/create_table_cluster_set_on_delete.sql.txt b/testdata/result/ddl/create_table_cluster_set_on_delete.sql.txt index 615cc4a2..8f8605c5 100644 --- a/testdata/result/ddl/create_table_cluster_set_on_delete.sql.txt +++ b/testdata/result/ddl/create_table_cluster_set_on_delete.sql.txt @@ -6,10 +6,8 @@ create table foo ( on delete cascade --- AST &ast.CreateTable{ - Create: 0, - Rparen: 49, - IfNotExists: false, - Name: &ast.Path{ + Rparen: 49, + Name: &ast.Path{ Idents: []*ast.Ident{ &ast.Ident{ NamePos: 13, @@ -30,15 +28,10 @@ create table foo ( NamePos: 25, Name: "INT64", }, - NotNull: false, - DefaultExpr: (*ast.ColumnDefaultExpr)(nil), - GeneratedExpr: (*ast.GeneratedColumnExpr)(nil), - Hidden: -1, - Options: (*ast.Options)(nil), + Hidden: -1, }, }, - TableConstraints: []*ast.TableConstraint(nil), - PrimaryKeys: []*ast.IndexKey{ + PrimaryKeys: []*ast.IndexKey{ &ast.IndexKey{ DirPos: -1, Name: &ast.Ident{ @@ -46,11 +39,9 @@ create table foo ( NameEnd: 49, Name: "foo", }, - Dir: "", }, }, - Synonyms: []*ast.Synonym(nil), - Cluster: &ast.Cluster{ + Cluster: &ast.Cluster{ Comma: 50, OnDeleteEnd: 112, TableName: &ast.Path{ @@ -64,7 +55,6 @@ create table foo ( }, OnDelete: "ON DELETE CASCADE", }, - RowDeletionPolicy: (*ast.CreateRowDeletionPolicy)(nil), } --- SQL diff --git a/testdata/result/ddl/create_table_fulltext_albums.sql.txt b/testdata/result/ddl/create_table_fulltext_albums.sql.txt index f4a4b235..7f90a442 100644 --- a/testdata/result/ddl/create_table_fulltext_albums.sql.txt +++ b/testdata/result/ddl/create_table_fulltext_albums.sql.txt @@ -11,10 +11,9 @@ CREATE TABLE Albums ( ) PRIMARY KEY(AlbumId) --- AST &ast.CreateTable{ - Create: 105, - Rparen: 575, - IfNotExists: false, - Name: &ast.Path{ + Create: 105, + Rparen: 575, + Name: &ast.Path{ Idents: []*ast.Ident{ &ast.Ident{ NamePos: 118, @@ -36,13 +35,9 @@ CREATE TABLE Albums ( Rparen: 169, Name: "STRING", Max: true, - Size: nil, }, - NotNull: true, - DefaultExpr: (*ast.ColumnDefaultExpr)(nil), - GeneratedExpr: (*ast.GeneratedColumnExpr)(nil), - Hidden: -1, - Options: (*ast.Options)(nil), + NotNull: true, + Hidden: -1, }, &ast.ColumnDef{ Null: 224, @@ -55,11 +50,8 @@ CREATE TABLE Albums ( NamePos: 214, Name: "INT64", }, - NotNull: true, - DefaultExpr: (*ast.ColumnDefaultExpr)(nil), - GeneratedExpr: (*ast.GeneratedColumnExpr)(nil), - Hidden: -1, - Options: (*ast.Options)(nil), + NotNull: true, + Hidden: -1, }, &ast.ColumnDef{ Null: 281, @@ -72,11 +64,8 @@ CREATE TABLE Albums ( NamePos: 271, Name: "INT64", }, - NotNull: true, - DefaultExpr: (*ast.ColumnDefaultExpr)(nil), - GeneratedExpr: (*ast.GeneratedColumnExpr)(nil), - Hidden: -1, - Options: (*ast.Options)(nil), + NotNull: true, + Hidden: -1, }, &ast.ColumnDef{ Null: -1, @@ -90,13 +79,8 @@ CREATE TABLE Albums ( Rparen: 332, Name: "STRING", Max: true, - Size: nil, }, - NotNull: false, - DefaultExpr: (*ast.ColumnDefaultExpr)(nil), - GeneratedExpr: (*ast.GeneratedColumnExpr)(nil), - Hidden: -1, - Options: (*ast.Options)(nil), + Hidden: -1, }, &ast.ColumnDef{ Null: -1, @@ -109,11 +93,7 @@ CREATE TABLE Albums ( NamePos: 366, Name: "FLOAT64", }, - NotNull: false, - DefaultExpr: (*ast.ColumnDefaultExpr)(nil), - GeneratedExpr: (*ast.GeneratedColumnExpr)(nil), - Hidden: -1, - Options: (*ast.Options)(nil), + Hidden: -1, }, &ast.ColumnDef{ Null: -1, @@ -126,8 +106,6 @@ CREATE TABLE Albums ( NamePos: 417, Name: "TOKENLIST", }, - NotNull: false, - DefaultExpr: (*ast.ColumnDefaultExpr)(nil), GeneratedExpr: &ast.GeneratedColumnExpr{ As: 427, Stored: -1, @@ -139,8 +117,7 @@ CREATE TABLE Albums ( NameEnd: 448, Name: "TOKENIZE_FULLTEXT", }, - Distinct: false, - Args: []ast.Arg{ + Args: []ast.Arg{ &ast.ExprArg{ Expr: &ast.Ident{ NamePos: 449, @@ -149,13 +126,9 @@ CREATE TABLE Albums ( }, }, }, - NamedArgs: []*ast.NamedArg(nil), - NullHandling: nil, - Having: nil, }, }, - Hidden: 462, - Options: (*ast.Options)(nil), + Hidden: 462, }, &ast.ColumnDef{ Null: -1, @@ -168,8 +141,6 @@ CREATE TABLE Albums ( NamePos: 508, Name: "TOKENLIST", }, - NotNull: false, - DefaultExpr: (*ast.ColumnDefaultExpr)(nil), GeneratedExpr: &ast.GeneratedColumnExpr{ As: 518, Stored: -1, @@ -181,8 +152,7 @@ CREATE TABLE Albums ( NameEnd: 537, Name: "TOKENIZE_NUMBER", }, - Distinct: false, - Args: []ast.Arg{ + Args: []ast.Arg{ &ast.ExprArg{ Expr: &ast.Ident{ NamePos: 538, @@ -191,17 +161,12 @@ CREATE TABLE Albums ( }, }, }, - NamedArgs: []*ast.NamedArg(nil), - NullHandling: nil, - Having: nil, }, }, - Hidden: 547, - Options: (*ast.Options)(nil), + Hidden: 547, }, }, - TableConstraints: []*ast.TableConstraint(nil), - PrimaryKeys: []*ast.IndexKey{ + PrimaryKeys: []*ast.IndexKey{ &ast.IndexKey{ DirPos: -1, Name: &ast.Ident{ @@ -209,12 +174,8 @@ CREATE TABLE Albums ( NameEnd: 575, Name: "AlbumId", }, - Dir: "", }, }, - Synonyms: []*ast.Synonym(nil), - Cluster: (*ast.Cluster)(nil), - RowDeletionPolicy: (*ast.CreateRowDeletionPolicy)(nil), } --- SQL diff --git a/testdata/result/ddl/create_table_if_not_exists.sql.txt b/testdata/result/ddl/create_table_if_not_exists.sql.txt index ede4a61c..b7b52448 100644 --- a/testdata/result/ddl/create_table_if_not_exists.sql.txt +++ b/testdata/result/ddl/create_table_if_not_exists.sql.txt @@ -6,7 +6,6 @@ create table if not exists foo ( --- AST &ast.CreateTable{ - Create: 0, Rparen: 93, IfNotExists: true, Name: &ast.Path{ @@ -30,11 +29,7 @@ create table if not exists foo ( NamePos: 39, Name: "INT64", }, - NotNull: false, - DefaultExpr: (*ast.ColumnDefaultExpr)(nil), - GeneratedExpr: (*ast.GeneratedColumnExpr)(nil), - Hidden: -1, - Options: (*ast.Options)(nil), + Hidden: -1, }, &ast.ColumnDef{ Null: 64, @@ -47,15 +42,11 @@ create table if not exists foo ( NamePos: 52, Name: "FLOAT64", }, - NotNull: true, - DefaultExpr: (*ast.ColumnDefaultExpr)(nil), - GeneratedExpr: (*ast.GeneratedColumnExpr)(nil), - Hidden: -1, - Options: (*ast.Options)(nil), + NotNull: true, + Hidden: -1, }, }, - TableConstraints: []*ast.TableConstraint(nil), - PrimaryKeys: []*ast.IndexKey{ + PrimaryKeys: []*ast.IndexKey{ &ast.IndexKey{ DirPos: -1, Name: &ast.Ident{ @@ -63,7 +54,6 @@ create table if not exists foo ( NameEnd: 88, Name: "foo", }, - Dir: "", }, &ast.IndexKey{ DirPos: -1, @@ -72,12 +62,8 @@ create table if not exists foo ( NameEnd: 93, Name: "bar", }, - Dir: "", }, }, - Synonyms: []*ast.Synonym(nil), - Cluster: (*ast.Cluster)(nil), - RowDeletionPolicy: (*ast.CreateRowDeletionPolicy)(nil), } --- SQL diff --git a/testdata/result/ddl/create_table_row_deletion_policy.sql.txt b/testdata/result/ddl/create_table_row_deletion_policy.sql.txt index 3d17e37f..047b3cf6 100644 --- a/testdata/result/ddl/create_table_row_deletion_policy.sql.txt +++ b/testdata/result/ddl/create_table_row_deletion_policy.sql.txt @@ -8,10 +8,8 @@ create table foo ( --- AST &ast.CreateTable{ - Create: 0, - Rparen: 77, - IfNotExists: false, - Name: &ast.Path{ + Rparen: 77, + Name: &ast.Path{ Idents: []*ast.Ident{ &ast.Ident{ NamePos: 13, @@ -32,11 +30,7 @@ create table foo ( NamePos: 25, Name: "INT64", }, - NotNull: false, - DefaultExpr: (*ast.ColumnDefaultExpr)(nil), - GeneratedExpr: (*ast.GeneratedColumnExpr)(nil), - Hidden: -1, - Options: (*ast.Options)(nil), + Hidden: -1, }, &ast.ColumnDef{ Null: -1, @@ -49,11 +43,7 @@ create table foo ( NamePos: 38, Name: "INT64", }, - NotNull: false, - DefaultExpr: (*ast.ColumnDefaultExpr)(nil), - GeneratedExpr: (*ast.GeneratedColumnExpr)(nil), - Hidden: -1, - Options: (*ast.Options)(nil), + Hidden: -1, }, &ast.ColumnDef{ Null: -1, @@ -66,17 +56,9 @@ create table foo ( NamePos: 51, Name: "TIMESTAMP", }, - NotNull: false, - DefaultExpr: (*ast.ColumnDefaultExpr)(nil), - GeneratedExpr: (*ast.GeneratedColumnExpr)(nil), - Hidden: -1, - Options: (*ast.Options)(nil), + Hidden: -1, }, }, - TableConstraints: []*ast.TableConstraint(nil), - PrimaryKeys: []*ast.IndexKey(nil), - Synonyms: []*ast.Synonym(nil), - Cluster: (*ast.Cluster)(nil), RowDeletionPolicy: &ast.CreateRowDeletionPolicy{ Comma: 78, RowDeletionPolicy: &ast.RowDeletionPolicy{ diff --git a/testdata/result/ddl/create_table_synonyms.sql.txt b/testdata/result/ddl/create_table_synonyms.sql.txt index 00ce0aa7..1346e7d5 100644 --- a/testdata/result/ddl/create_table_synonyms.sql.txt +++ b/testdata/result/ddl/create_table_synonyms.sql.txt @@ -6,10 +6,8 @@ CREATE TABLE Singers ( ) PRIMARY KEY (SingerId) --- AST &ast.CreateTable{ - Create: 0, - Rparen: 126, - IfNotExists: false, - Name: &ast.Path{ + Rparen: 126, + Name: &ast.Path{ Idents: []*ast.Ident{ &ast.Ident{ NamePos: 13, @@ -30,11 +28,8 @@ CREATE TABLE Singers ( NamePos: 36, Name: "INT64", }, - NotNull: true, - DefaultExpr: (*ast.ColumnDefaultExpr)(nil), - GeneratedExpr: (*ast.GeneratedColumnExpr)(nil), - Hidden: -1, - Options: (*ast.Options)(nil), + NotNull: true, + Hidden: -1, }, &ast.ColumnDef{ Null: -1, @@ -47,7 +42,6 @@ CREATE TABLE Singers ( NamePos: 67, Rparen: 78, Name: "STRING", - Max: false, Size: &ast.IntLiteral{ ValuePos: 74, ValueEnd: 78, @@ -55,15 +49,10 @@ CREATE TABLE Singers ( Value: "1024", }, }, - NotNull: false, - DefaultExpr: (*ast.ColumnDefaultExpr)(nil), - GeneratedExpr: (*ast.GeneratedColumnExpr)(nil), - Hidden: -1, - Options: (*ast.Options)(nil), + Hidden: -1, }, }, - TableConstraints: []*ast.TableConstraint(nil), - PrimaryKeys: []*ast.IndexKey{ + PrimaryKeys: []*ast.IndexKey{ &ast.IndexKey{ DirPos: -1, Name: &ast.Ident{ @@ -71,7 +60,6 @@ CREATE TABLE Singers ( NameEnd: 126, Name: "SingerId", }, - Dir: "", }, }, Synonyms: []*ast.Synonym{ @@ -85,8 +73,6 @@ CREATE TABLE Singers ( }, }, }, - Cluster: (*ast.Cluster)(nil), - RowDeletionPolicy: (*ast.CreateRowDeletionPolicy)(nil), } --- SQL diff --git a/testdata/result/ddl/create_table_synonyms_abnormal.sql.txt b/testdata/result/ddl/create_table_synonyms_abnormal.sql.txt index f63129a2..43efa244 100644 --- a/testdata/result/ddl/create_table_synonyms_abnormal.sql.txt +++ b/testdata/result/ddl/create_table_synonyms_abnormal.sql.txt @@ -8,10 +8,9 @@ CREATE TABLE Singers ( ) PRIMARY KEY (SingerId) --- AST &ast.CreateTable{ - Create: 45, - Rparen: 194, - IfNotExists: false, - Name: &ast.Path{ + Create: 45, + Rparen: 194, + Name: &ast.Path{ Idents: []*ast.Ident{ &ast.Ident{ NamePos: 58, @@ -32,11 +31,8 @@ CREATE TABLE Singers ( NamePos: 104, Name: "INT64", }, - NotNull: true, - DefaultExpr: (*ast.ColumnDefaultExpr)(nil), - GeneratedExpr: (*ast.GeneratedColumnExpr)(nil), - Hidden: -1, - Options: (*ast.Options)(nil), + NotNull: true, + Hidden: -1, }, &ast.ColumnDef{ Null: -1, @@ -49,7 +45,6 @@ CREATE TABLE Singers ( NamePos: 135, Rparen: 146, Name: "STRING", - Max: false, Size: &ast.IntLiteral{ ValuePos: 142, ValueEnd: 146, @@ -57,15 +52,10 @@ CREATE TABLE Singers ( Value: "1024", }, }, - NotNull: false, - DefaultExpr: (*ast.ColumnDefaultExpr)(nil), - GeneratedExpr: (*ast.GeneratedColumnExpr)(nil), - Hidden: -1, - Options: (*ast.Options)(nil), + Hidden: -1, }, }, - TableConstraints: []*ast.TableConstraint(nil), - PrimaryKeys: []*ast.IndexKey{ + PrimaryKeys: []*ast.IndexKey{ &ast.IndexKey{ DirPos: -1, Name: &ast.Ident{ @@ -73,7 +63,6 @@ CREATE TABLE Singers ( NameEnd: 194, Name: "SingerId", }, - Dir: "", }, }, Synonyms: []*ast.Synonym{ @@ -96,8 +85,6 @@ CREATE TABLE Singers ( }, }, }, - Cluster: (*ast.Cluster)(nil), - RowDeletionPolicy: (*ast.CreateRowDeletionPolicy)(nil), } --- SQL diff --git a/testdata/result/ddl/create_table_trailing_comma.sql.txt b/testdata/result/ddl/create_table_trailing_comma.sql.txt index 0a81242d..0e7ddcdb 100644 --- a/testdata/result/ddl/create_table_trailing_comma.sql.txt +++ b/testdata/result/ddl/create_table_trailing_comma.sql.txt @@ -9,10 +9,8 @@ create table foo ( --- AST &ast.CreateTable{ - Create: 0, - Rparen: 83, - IfNotExists: false, - Name: &ast.Path{ + Rparen: 83, + Name: &ast.Path{ Idents: []*ast.Ident{ &ast.Ident{ NamePos: 13, @@ -33,11 +31,7 @@ create table foo ( NamePos: 25, Name: "INT64", }, - NotNull: false, - DefaultExpr: (*ast.ColumnDefaultExpr)(nil), - GeneratedExpr: (*ast.GeneratedColumnExpr)(nil), - Hidden: -1, - Options: (*ast.Options)(nil), + Hidden: -1, }, &ast.ColumnDef{ Null: -1, @@ -50,15 +44,10 @@ create table foo ( NamePos: 38, Name: "INT64", }, - NotNull: false, - DefaultExpr: (*ast.ColumnDefaultExpr)(nil), - GeneratedExpr: (*ast.GeneratedColumnExpr)(nil), - Hidden: -1, - Options: (*ast.Options)(nil), + Hidden: -1, }, }, - TableConstraints: []*ast.TableConstraint(nil), - PrimaryKeys: []*ast.IndexKey{ + PrimaryKeys: []*ast.IndexKey{ &ast.IndexKey{ DirPos: 66, Name: &ast.Ident{ @@ -78,9 +67,6 @@ create table foo ( Dir: "DESC", }, }, - Synonyms: []*ast.Synonym(nil), - Cluster: (*ast.Cluster)(nil), - RowDeletionPolicy: (*ast.CreateRowDeletionPolicy)(nil), } --- SQL diff --git a/testdata/result/ddl/create_table_types.sql.txt b/testdata/result/ddl/create_table_types.sql.txt index dbb18756..0dd70563 100644 --- a/testdata/result/ddl/create_table_types.sql.txt +++ b/testdata/result/ddl/create_table_types.sql.txt @@ -18,10 +18,8 @@ create table types ( --- AST &ast.CreateTable{ - Create: 0, - Rparen: 297, - IfNotExists: false, - Name: &ast.Path{ + Rparen: 297, + Name: &ast.Path{ Idents: []*ast.Ident{ &ast.Ident{ NamePos: 13, @@ -42,11 +40,7 @@ create table types ( NamePos: 25, Name: "BOOL", }, - NotNull: false, - DefaultExpr: (*ast.ColumnDefaultExpr)(nil), - GeneratedExpr: (*ast.GeneratedColumnExpr)(nil), - Hidden: -1, - Options: (*ast.Options)(nil), + Hidden: -1, }, &ast.ColumnDef{ Null: -1, @@ -59,11 +53,7 @@ create table types ( NamePos: 35, Name: "INT64", }, - NotNull: false, - DefaultExpr: (*ast.ColumnDefaultExpr)(nil), - GeneratedExpr: (*ast.GeneratedColumnExpr)(nil), - Hidden: -1, - Options: (*ast.Options)(nil), + Hidden: -1, }, &ast.ColumnDef{ Null: -1, @@ -76,11 +66,7 @@ create table types ( NamePos: 48, Name: "FLOAT32", }, - NotNull: false, - DefaultExpr: (*ast.ColumnDefaultExpr)(nil), - GeneratedExpr: (*ast.GeneratedColumnExpr)(nil), - Hidden: -1, - Options: (*ast.Options)(nil), + Hidden: -1, }, &ast.ColumnDef{ Null: -1, @@ -93,11 +79,7 @@ create table types ( NamePos: 61, Name: "FLOAT64", }, - NotNull: false, - DefaultExpr: (*ast.ColumnDefaultExpr)(nil), - GeneratedExpr: (*ast.GeneratedColumnExpr)(nil), - Hidden: -1, - Options: (*ast.Options)(nil), + Hidden: -1, }, &ast.ColumnDef{ Null: -1, @@ -110,11 +92,7 @@ create table types ( NamePos: 74, Name: "DATE", }, - NotNull: false, - DefaultExpr: (*ast.ColumnDefaultExpr)(nil), - GeneratedExpr: (*ast.GeneratedColumnExpr)(nil), - Hidden: -1, - Options: (*ast.Options)(nil), + Hidden: -1, }, &ast.ColumnDef{ Null: -1, @@ -127,11 +105,7 @@ create table types ( NamePos: 84, Name: "TIMESTAMP", }, - NotNull: false, - DefaultExpr: (*ast.ColumnDefaultExpr)(nil), - GeneratedExpr: (*ast.GeneratedColumnExpr)(nil), - Hidden: -1, - Options: (*ast.Options)(nil), + Hidden: -1, }, &ast.ColumnDef{ Null: -1, @@ -144,7 +118,6 @@ create table types ( NamePos: 99, Rparen: 109, Name: "STRING", - Max: false, Size: &ast.IntLiteral{ ValuePos: 106, ValueEnd: 109, @@ -152,11 +125,7 @@ create table types ( Value: "256", }, }, - NotNull: false, - DefaultExpr: (*ast.ColumnDefaultExpr)(nil), - GeneratedExpr: (*ast.GeneratedColumnExpr)(nil), - Hidden: -1, - Options: (*ast.Options)(nil), + Hidden: -1, }, &ast.ColumnDef{ Null: -1, @@ -170,13 +139,8 @@ create table types ( Rparen: 129, Name: "STRING", Max: true, - Size: nil, }, - NotNull: false, - DefaultExpr: (*ast.ColumnDefaultExpr)(nil), - GeneratedExpr: (*ast.GeneratedColumnExpr)(nil), - Hidden: -1, - Options: (*ast.Options)(nil), + Hidden: -1, }, &ast.ColumnDef{ Null: -1, @@ -189,7 +153,6 @@ create table types ( NamePos: 137, Rparen: 146, Name: "BYTES", - Max: false, Size: &ast.IntLiteral{ ValuePos: 143, ValueEnd: 146, @@ -197,11 +160,7 @@ create table types ( Value: "256", }, }, - NotNull: false, - DefaultExpr: (*ast.ColumnDefaultExpr)(nil), - GeneratedExpr: (*ast.GeneratedColumnExpr)(nil), - Hidden: -1, - Options: (*ast.Options)(nil), + Hidden: -1, }, &ast.ColumnDef{ Null: -1, @@ -215,13 +174,8 @@ create table types ( Rparen: 166, Name: "BYTES", Max: true, - Size: nil, }, - NotNull: false, - DefaultExpr: (*ast.ColumnDefaultExpr)(nil), - GeneratedExpr: (*ast.GeneratedColumnExpr)(nil), - Hidden: -1, - Options: (*ast.Options)(nil), + Hidden: -1, }, &ast.ColumnDef{ Null: -1, @@ -238,13 +192,8 @@ create table types ( NamePos: 180, Name: "BOOL", }, - NamedArgs: []*ast.NamedArg(nil), }, - NotNull: false, - DefaultExpr: (*ast.ColumnDefaultExpr)(nil), - GeneratedExpr: (*ast.GeneratedColumnExpr)(nil), - Hidden: -1, - Options: (*ast.Options)(nil), + Hidden: -1, }, &ast.ColumnDef{ Null: -1, @@ -262,15 +211,9 @@ create table types ( Rparen: 208, Name: "BYTES", Max: true, - Size: nil, }, - NamedArgs: []*ast.NamedArg(nil), }, - NotNull: false, - DefaultExpr: (*ast.ColumnDefaultExpr)(nil), - GeneratedExpr: (*ast.GeneratedColumnExpr)(nil), - Hidden: -1, - Options: (*ast.Options)(nil), + Hidden: -1, }, &ast.ColumnDef{ Null: -1, @@ -293,11 +236,7 @@ create table types ( }, }, }, - NotNull: false, - DefaultExpr: (*ast.ColumnDefaultExpr)(nil), - GeneratedExpr: (*ast.GeneratedColumnExpr)(nil), - Hidden: -1, - Options: (*ast.Options)(nil), + Hidden: -1, }, &ast.ColumnDef{ Null: -1, @@ -330,15 +269,10 @@ create table types ( }, }, }, - NotNull: false, - DefaultExpr: (*ast.ColumnDefaultExpr)(nil), - GeneratedExpr: (*ast.GeneratedColumnExpr)(nil), - Hidden: -1, - Options: (*ast.Options)(nil), + Hidden: -1, }, }, - TableConstraints: []*ast.TableConstraint(nil), - PrimaryKeys: []*ast.IndexKey{ + PrimaryKeys: []*ast.IndexKey{ &ast.IndexKey{ DirPos: -1, Name: &ast.Ident{ @@ -346,12 +280,8 @@ create table types ( NameEnd: 297, Name: "i", }, - Dir: "", }, }, - Synonyms: []*ast.Synonym(nil), - Cluster: (*ast.Cluster)(nil), - RowDeletionPolicy: (*ast.CreateRowDeletionPolicy)(nil), } --- SQL diff --git a/testdata/result/ddl/create_table_with_sequence_function.sql.txt b/testdata/result/ddl/create_table_with_sequence_function.sql.txt index a98ac027..cb4bd4d0 100644 --- a/testdata/result/ddl/create_table_with_sequence_function.sql.txt +++ b/testdata/result/ddl/create_table_with_sequence_function.sql.txt @@ -8,10 +8,8 @@ CREATE TABLE foo --- AST &ast.CreateTable{ - Create: 0, - Rparen: 143, - IfNotExists: false, - Name: &ast.Path{ + Rparen: 143, + Name: &ast.Path{ Idents: []*ast.Ident{ &ast.Ident{ NamePos: 13, @@ -32,7 +30,6 @@ CREATE TABLE foo NamePos: 27, Name: "INT64", }, - NotNull: false, DefaultExpr: &ast.ColumnDefaultExpr{ Default: 33, Rparen: 88, @@ -43,8 +40,7 @@ CREATE TABLE foo NameEnd: 65, Name: "GET_NEXT_SEQUENCE_VALUE", }, - Distinct: false, - Args: []ast.Arg{ + Args: []ast.Arg{ &ast.SequenceArg{ Sequence: 66, Expr: &ast.Ident{ @@ -54,14 +50,9 @@ CREATE TABLE foo }, }, }, - NamedArgs: []*ast.NamedArg(nil), - NullHandling: nil, - Having: nil, }, }, - GeneratedExpr: (*ast.GeneratedColumnExpr)(nil), - Hidden: -1, - Options: (*ast.Options)(nil), + Hidden: -1, }, &ast.ColumnDef{ Null: -1, @@ -75,13 +66,8 @@ CREATE TABLE foo Rparen: 110, Name: "STRING", Max: true, - Size: nil, }, - NotNull: false, - DefaultExpr: (*ast.ColumnDefaultExpr)(nil), - GeneratedExpr: (*ast.GeneratedColumnExpr)(nil), - Hidden: -1, - Options: (*ast.Options)(nil), + Hidden: -1, }, &ast.ColumnDef{ Null: -1, @@ -94,15 +80,10 @@ CREATE TABLE foo NamePos: 121, Name: "INT64", }, - NotNull: false, - DefaultExpr: (*ast.ColumnDefaultExpr)(nil), - GeneratedExpr: (*ast.GeneratedColumnExpr)(nil), - Hidden: -1, - Options: (*ast.Options)(nil), + Hidden: -1, }, }, - TableConstraints: []*ast.TableConstraint(nil), - PrimaryKeys: []*ast.IndexKey{ + PrimaryKeys: []*ast.IndexKey{ &ast.IndexKey{ DirPos: -1, Name: &ast.Ident{ @@ -110,12 +91,8 @@ CREATE TABLE foo NameEnd: 143, Name: "id", }, - Dir: "", }, }, - Synonyms: []*ast.Synonym(nil), - Cluster: (*ast.Cluster)(nil), - RowDeletionPolicy: (*ast.CreateRowDeletionPolicy)(nil), } --- SQL diff --git a/testdata/result/ddl/create_uniq_null_filtered_index.sql.txt b/testdata/result/ddl/create_uniq_null_filtered_index.sql.txt index d6bd80b5..c6f2a636 100644 --- a/testdata/result/ddl/create_uniq_null_filtered_index.sql.txt +++ b/testdata/result/ddl/create_uniq_null_filtered_index.sql.txt @@ -3,11 +3,9 @@ create unique null_filtered index foo_bar on foo (foo) --- AST &ast.CreateIndex{ - Create: 0, Rparen: 53, Unique: true, NullFiltered: true, - IfNotExists: false, Name: &ast.Path{ Idents: []*ast.Ident{ &ast.Ident{ @@ -34,11 +32,8 @@ create unique null_filtered index foo_bar on foo (foo) NameEnd: 53, Name: "foo", }, - Dir: "", }, }, - Storing: (*ast.Storing)(nil), - InterleaveIn: (*ast.InterleaveIn)(nil), } --- SQL diff --git a/testdata/result/ddl/create_vector_index.sql.txt b/testdata/result/ddl/create_vector_index.sql.txt index ed7d5a6c..e2b93b86 100644 --- a/testdata/result/ddl/create_vector_index.sql.txt +++ b/testdata/result/ddl/create_vector_index.sql.txt @@ -3,7 +3,6 @@ CREATE VECTOR INDEX IF NOT EXISTS hello_vector_index ON hello(embedding) OPTIONS(distance_type = 'COSINE') --- AST &ast.CreateVectorIndex{ - Create: 0, IfNotExists: true, Name: &ast.Ident{ NamePos: 34, @@ -20,7 +19,6 @@ OPTIONS(distance_type = 'COSINE') NameEnd: 71, Name: "embedding", }, - Where: (*ast.Where)(nil), Options: &ast.Options{ Options: 73, Rparen: 105, diff --git a/testdata/result/ddl/create_vector_index_where_column_not_null.sql.txt b/testdata/result/ddl/create_vector_index_where_column_not_null.sql.txt index 965499aa..b77f7dea 100644 --- a/testdata/result/ddl/create_vector_index_where_column_not_null.sql.txt +++ b/testdata/result/ddl/create_vector_index_where_column_not_null.sql.txt @@ -4,9 +4,7 @@ WHERE embedding IS NOT NULL OPTIONS(distance_type = 'COSINE') --- AST &ast.CreateVectorIndex{ - Create: 0, - IfNotExists: false, - Name: &ast.Ident{ + Name: &ast.Ident{ NamePos: 20, NameEnd: 38, Name: "hello_vector_index", diff --git a/testdata/result/ddl/create_view.sql.txt b/testdata/result/ddl/create_view.sql.txt index 09d3e5f3..7842821f 100644 --- a/testdata/result/ddl/create_view.sql.txt +++ b/testdata/result/ddl/create_view.sql.txt @@ -8,8 +8,7 @@ from singers --- AST &ast.CreateView{ - Create: 0, - Name: &ast.Path{ + Name: &ast.Path{ Idents: []*ast.Ident{ &ast.Ident{ NamePos: 12, @@ -18,13 +17,10 @@ from singers }, }, }, - OrReplace: false, SecurityType: "INVOKER", Query: &ast.Select{ - Select: 48, - Distinct: false, - As: nil, - Results: []ast.SelectItem{ + Select: 48, + Results: []ast.SelectItem{ &ast.Alias{ Expr: &ast.Path{ Idents: []*ast.Ident{ @@ -107,16 +103,8 @@ from singers NameEnd: 158, Name: "singers", }, - Hint: (*ast.Hint)(nil), - As: (*ast.AsAlias)(nil), - Sample: (*ast.TableSample)(nil), }, }, - Where: (*ast.Where)(nil), - GroupBy: (*ast.GroupBy)(nil), - Having: (*ast.Having)(nil), - OrderBy: (*ast.OrderBy)(nil), - Limit: (*ast.Limit)(nil), }, } diff --git a/testdata/result/ddl/create_view_sql_security_definer.sql.txt b/testdata/result/ddl/create_view_sql_security_definer.sql.txt index 345b29a3..a04d0c2f 100644 --- a/testdata/result/ddl/create_view_sql_security_definer.sql.txt +++ b/testdata/result/ddl/create_view_sql_security_definer.sql.txt @@ -8,8 +8,7 @@ from singers --- AST &ast.CreateView{ - Create: 0, - Name: &ast.Path{ + Name: &ast.Path{ Idents: []*ast.Ident{ &ast.Ident{ NamePos: 12, @@ -18,13 +17,10 @@ from singers }, }, }, - OrReplace: false, SecurityType: "DEFINER", Query: &ast.Select{ - Select: 48, - Distinct: false, - As: nil, - Results: []ast.SelectItem{ + Select: 48, + Results: []ast.SelectItem{ &ast.Alias{ Expr: &ast.Path{ Idents: []*ast.Ident{ @@ -107,16 +103,8 @@ from singers NameEnd: 158, Name: "singers", }, - Hint: (*ast.Hint)(nil), - As: (*ast.AsAlias)(nil), - Sample: (*ast.TableSample)(nil), }, }, - Where: (*ast.Where)(nil), - GroupBy: (*ast.GroupBy)(nil), - Having: (*ast.Having)(nil), - OrderBy: (*ast.OrderBy)(nil), - Limit: (*ast.Limit)(nil), }, } diff --git a/testdata/result/ddl/drop_change_stream.sql.txt b/testdata/result/ddl/drop_change_stream.sql.txt index ecbe86f7..edac2ca2 100644 --- a/testdata/result/ddl/drop_change_stream.sql.txt +++ b/testdata/result/ddl/drop_change_stream.sql.txt @@ -3,7 +3,6 @@ DROP CHANGE STREAM change_stream_name --- AST &ast.DropChangeStream{ - Drop: 0, Name: &ast.Ident{ NamePos: 19, NameEnd: 37, diff --git a/testdata/result/ddl/drop_index.sql.txt b/testdata/result/ddl/drop_index.sql.txt index 47ac6572..1896e268 100644 --- a/testdata/result/ddl/drop_index.sql.txt +++ b/testdata/result/ddl/drop_index.sql.txt @@ -3,9 +3,7 @@ drop index foo_bar --- AST &ast.DropIndex{ - Drop: 0, - IfExists: false, - Name: &ast.Path{ + Name: &ast.Path{ Idents: []*ast.Ident{ &ast.Ident{ NamePos: 11, diff --git a/testdata/result/ddl/drop_index_if_exists.sql.txt b/testdata/result/ddl/drop_index_if_exists.sql.txt index 54cf0a6a..5b190902 100644 --- a/testdata/result/ddl/drop_index_if_exists.sql.txt +++ b/testdata/result/ddl/drop_index_if_exists.sql.txt @@ -3,7 +3,6 @@ drop index if exists foo_bar --- AST &ast.DropIndex{ - Drop: 0, IfExists: true, Name: &ast.Path{ Idents: []*ast.Ident{ diff --git a/testdata/result/ddl/drop_model.sql.txt b/testdata/result/ddl/drop_model.sql.txt index be705286..c75558e9 100644 --- a/testdata/result/ddl/drop_model.sql.txt +++ b/testdata/result/ddl/drop_model.sql.txt @@ -2,9 +2,7 @@ DROP MODEL MyClassificationModel --- AST &ast.DropModel{ - Drop: 0, - IfExists: false, - Name: &ast.Ident{ + Name: &ast.Ident{ NamePos: 11, NameEnd: 32, Name: "MyClassificationModel", diff --git a/testdata/result/ddl/drop_model_if_exists.sql.txt b/testdata/result/ddl/drop_model_if_exists.sql.txt index 67ac03dc..99e670a2 100644 --- a/testdata/result/ddl/drop_model_if_exists.sql.txt +++ b/testdata/result/ddl/drop_model_if_exists.sql.txt @@ -2,7 +2,6 @@ DROP MODEL IF EXISTS MyClassificationModel --- AST &ast.DropModel{ - Drop: 0, IfExists: true, Name: &ast.Ident{ NamePos: 21, diff --git a/testdata/result/ddl/drop_proto_bunldle.sql.txt b/testdata/result/ddl/drop_proto_bunldle.sql.txt index b36d664b..3f5c6f02 100644 --- a/testdata/result/ddl/drop_proto_bunldle.sql.txt +++ b/testdata/result/ddl/drop_proto_bunldle.sql.txt @@ -2,7 +2,6 @@ DROP PROTO BUNDLE --- AST &ast.DropProtoBundle{ - Drop: 0, Bundle: 11, } diff --git a/testdata/result/ddl/drop_role.sql.txt b/testdata/result/ddl/drop_role.sql.txt index 62eadcab..45972f1a 100644 --- a/testdata/result/ddl/drop_role.sql.txt +++ b/testdata/result/ddl/drop_role.sql.txt @@ -3,7 +3,6 @@ DROP ROLE hr_manager --- AST &ast.DropRole{ - Drop: 0, Name: &ast.Ident{ NamePos: 10, NameEnd: 20, diff --git a/testdata/result/ddl/drop_schema.sql.txt b/testdata/result/ddl/drop_schema.sql.txt index b9356805..9916952a 100644 --- a/testdata/result/ddl/drop_schema.sql.txt +++ b/testdata/result/ddl/drop_schema.sql.txt @@ -2,7 +2,6 @@ DROP SCHEMA sch1 --- AST &ast.DropSchema{ - Drop: 0, Name: &ast.Ident{ NamePos: 12, NameEnd: 16, diff --git a/testdata/result/ddl/drop_search_index.sql.txt b/testdata/result/ddl/drop_search_index.sql.txt index fe6d374c..ca99f2d1 100644 --- a/testdata/result/ddl/drop_search_index.sql.txt +++ b/testdata/result/ddl/drop_search_index.sql.txt @@ -2,7 +2,6 @@ DROP SEARCH INDEX IF EXISTS AlbumsIndex --- AST &ast.DropSearchIndex{ - Drop: 0, IfExists: true, Name: &ast.Ident{ NamePos: 28, diff --git a/testdata/result/ddl/drop_sequence.sql.txt b/testdata/result/ddl/drop_sequence.sql.txt index 74d0585c..b8a4b84e 100644 --- a/testdata/result/ddl/drop_sequence.sql.txt +++ b/testdata/result/ddl/drop_sequence.sql.txt @@ -3,9 +3,7 @@ DROP SEQUENCE my_sequence --- AST &ast.DropSequence{ - Drop: 0, - IfExists: false, - Name: &ast.Path{ + Name: &ast.Path{ Idents: []*ast.Ident{ &ast.Ident{ NamePos: 14, diff --git a/testdata/result/ddl/drop_sequence_if_exits.sql.txt b/testdata/result/ddl/drop_sequence_if_exits.sql.txt index f8dd5731..34c58016 100644 --- a/testdata/result/ddl/drop_sequence_if_exits.sql.txt +++ b/testdata/result/ddl/drop_sequence_if_exits.sql.txt @@ -3,7 +3,6 @@ DROP SEQUENCE IF EXISTS my_sequence --- AST &ast.DropSequence{ - Drop: 0, IfExists: true, Name: &ast.Path{ Idents: []*ast.Ident{ diff --git a/testdata/result/ddl/drop_table.sql.txt b/testdata/result/ddl/drop_table.sql.txt index 099b9936..727dfa76 100644 --- a/testdata/result/ddl/drop_table.sql.txt +++ b/testdata/result/ddl/drop_table.sql.txt @@ -3,9 +3,7 @@ drop table foo --- AST &ast.DropTable{ - Drop: 0, - IfExists: false, - Name: &ast.Path{ + Name: &ast.Path{ Idents: []*ast.Ident{ &ast.Ident{ NamePos: 11, diff --git a/testdata/result/ddl/drop_table_if_exists.sql.txt b/testdata/result/ddl/drop_table_if_exists.sql.txt index de5578ca..053346fe 100644 --- a/testdata/result/ddl/drop_table_if_exists.sql.txt +++ b/testdata/result/ddl/drop_table_if_exists.sql.txt @@ -3,7 +3,6 @@ drop table if exists foo --- AST &ast.DropTable{ - Drop: 0, IfExists: true, Name: &ast.Path{ Idents: []*ast.Ident{ diff --git a/testdata/result/ddl/drop_vector_index.sql.txt b/testdata/result/ddl/drop_vector_index.sql.txt index 6c7fa9e2..f9a30112 100644 --- a/testdata/result/ddl/drop_vector_index.sql.txt +++ b/testdata/result/ddl/drop_vector_index.sql.txt @@ -2,9 +2,7 @@ DROP VECTOR INDEX hello_vector_index --- AST &ast.DropVectorIndex{ - Drop: 0, - IfExists: false, - Name: &ast.Ident{ + Name: &ast.Ident{ NamePos: 18, NameEnd: 36, Name: "hello_vector_index", diff --git a/testdata/result/ddl/drop_view.sql.txt b/testdata/result/ddl/drop_view.sql.txt index 959ce82d..c3c58848 100644 --- a/testdata/result/ddl/drop_view.sql.txt +++ b/testdata/result/ddl/drop_view.sql.txt @@ -2,7 +2,6 @@ DROP VIEW SingersView --- AST &ast.DropView{ - Drop: 0, Name: &ast.Path{ Idents: []*ast.Ident{ &ast.Ident{ diff --git a/testdata/result/ddl/grant_change_stream_privilege.sql.txt b/testdata/result/ddl/grant_change_stream_privilege.sql.txt index 92016944..7bae5ed3 100644 --- a/testdata/result/ddl/grant_change_stream_privilege.sql.txt +++ b/testdata/result/ddl/grant_change_stream_privilege.sql.txt @@ -2,7 +2,6 @@ GRANT SELECT ON CHANGE STREAM cs_name_one, cs_name_two TO ROLE hr_manager --- AST &ast.Grant{ - Grant: 0, Privilege: &ast.SelectPrivilegeOnChangeStream{ Select: 6, Names: []*ast.Ident{ diff --git a/testdata/result/ddl/grant_execute_on_table_function.sql.txt b/testdata/result/ddl/grant_execute_on_table_function.sql.txt index a7b0f16d..c3070368 100644 --- a/testdata/result/ddl/grant_execute_on_table_function.sql.txt +++ b/testdata/result/ddl/grant_execute_on_table_function.sql.txt @@ -2,7 +2,6 @@ GRANT EXECUTE ON TABLE FUNCTION READ_SingersNameStream TO ROLE hr_manager --- AST &ast.Grant{ - Grant: 0, Privilege: &ast.ExecutePrivilegeOnTableFunction{ Execute: 6, Names: []*ast.Ident{ diff --git a/testdata/result/ddl/grant_privileges.sql.txt b/testdata/result/ddl/grant_privileges.sql.txt index 12634b04..b9cc5586 100644 --- a/testdata/result/ddl/grant_privileges.sql.txt +++ b/testdata/result/ddl/grant_privileges.sql.txt @@ -3,7 +3,6 @@ GRANT SELECT(name, level, location), UPDATE(location) ON TABLE employees, contra --- AST &ast.Grant{ - Grant: 0, Privilege: &ast.PrivilegeOnTable{ Privileges: []ast.TablePrivilege{ &ast.SelectPrivilege{ diff --git a/testdata/result/ddl/grant_role.sql.txt b/testdata/result/ddl/grant_role.sql.txt index b748b957..c5df7aff 100644 --- a/testdata/result/ddl/grant_role.sql.txt +++ b/testdata/result/ddl/grant_role.sql.txt @@ -3,7 +3,6 @@ GRANT ROLE pii_access, pii_writter TO ROLE hr_manager, hr_director --- AST &ast.Grant{ - Grant: 0, Privilege: &ast.RolePrivilege{ Role: 6, Names: []*ast.Ident{ diff --git a/testdata/result/ddl/grant_select_on_view.sql.txt b/testdata/result/ddl/grant_select_on_view.sql.txt index 0c96a499..dbab8e74 100644 --- a/testdata/result/ddl/grant_select_on_view.sql.txt +++ b/testdata/result/ddl/grant_select_on_view.sql.txt @@ -2,7 +2,6 @@ GRANT SELECT ON VIEW singernames TO ROLE hr_manager --- AST &ast.Grant{ - Grant: 0, Privilege: &ast.SelectPrivilegeOnView{ Select: 6, Names: []*ast.Ident{ diff --git a/testdata/result/ddl/named_schema_create_table_backquoted.sql.txt b/testdata/result/ddl/named_schema_create_table_backquoted.sql.txt index df3b75b8..f2c9bff6 100644 --- a/testdata/result/ddl/named_schema_create_table_backquoted.sql.txt +++ b/testdata/result/ddl/named_schema_create_table_backquoted.sql.txt @@ -2,10 +2,8 @@ CREATE TABLE `ORDER`.`ORDER`(PK INT64) PRIMARY KEY(PK) --- AST &ast.CreateTable{ - Create: 0, - Rparen: 53, - IfNotExists: false, - Name: &ast.Path{ + Rparen: 53, + Name: &ast.Path{ Idents: []*ast.Ident{ &ast.Ident{ NamePos: 13, @@ -31,15 +29,10 @@ CREATE TABLE `ORDER`.`ORDER`(PK INT64) PRIMARY KEY(PK) NamePos: 32, Name: "INT64", }, - NotNull: false, - DefaultExpr: (*ast.ColumnDefaultExpr)(nil), - GeneratedExpr: (*ast.GeneratedColumnExpr)(nil), - Hidden: -1, - Options: (*ast.Options)(nil), + Hidden: -1, }, }, - TableConstraints: []*ast.TableConstraint(nil), - PrimaryKeys: []*ast.IndexKey{ + PrimaryKeys: []*ast.IndexKey{ &ast.IndexKey{ DirPos: -1, Name: &ast.Ident{ @@ -47,12 +40,8 @@ CREATE TABLE `ORDER`.`ORDER`(PK INT64) PRIMARY KEY(PK) NameEnd: 53, Name: "PK", }, - Dir: "", }, }, - Synonyms: []*ast.Synonym(nil), - Cluster: (*ast.Cluster)(nil), - RowDeletionPolicy: (*ast.CreateRowDeletionPolicy)(nil), } --- SQL diff --git a/testdata/result/ddl/named_schemas_alter_index.sql.txt b/testdata/result/ddl/named_schemas_alter_index.sql.txt index 9d5151de..5fd00cd8 100644 --- a/testdata/result/ddl/named_schemas_alter_index.sql.txt +++ b/testdata/result/ddl/named_schemas_alter_index.sql.txt @@ -2,8 +2,7 @@ ALTER INDEX sch1.indexOnSingers ADD STORED COLUMN SingerInfo --- AST &ast.AlterIndex{ - Alter: 0, - Name: &ast.Path{ + Name: &ast.Path{ Idents: []*ast.Ident{ &ast.Ident{ NamePos: 12, diff --git a/testdata/result/ddl/named_schemas_alter_sequence.sql.txt b/testdata/result/ddl/named_schemas_alter_sequence.sql.txt index 5f90e6c4..35240b72 100644 --- a/testdata/result/ddl/named_schemas_alter_sequence.sql.txt +++ b/testdata/result/ddl/named_schemas_alter_sequence.sql.txt @@ -3,8 +3,7 @@ ALTER SEQUENCE sch1.sequence SET OPTIONS (skip_range_min=1, skip_range_max=1234567) --- AST &ast.AlterSequence{ - Alter: 0, - Name: &ast.Path{ + Name: &ast.Path{ Idents: []*ast.Ident{ &ast.Ident{ NamePos: 15, diff --git a/testdata/result/ddl/named_schemas_alter_table_add_constraint.sql.txt b/testdata/result/ddl/named_schemas_alter_table_add_constraint.sql.txt index 92b6c59f..c91c4229 100644 --- a/testdata/result/ddl/named_schemas_alter_table_add_constraint.sql.txt +++ b/testdata/result/ddl/named_schemas_alter_table_add_constraint.sql.txt @@ -3,8 +3,7 @@ ALTER TABLE sch1.ShoppingCarts ADD CONSTRAINT FKShoppingCartsCustomers FOREIGN K REFERENCES sch1.Customers(CustomerId, CustomerName) ON DELETE CASCADE --- AST &ast.AlterTable{ - Alter: 0, - Name: &ast.Path{ + Name: &ast.Path{ Idents: []*ast.Ident{ &ast.Ident{ NamePos: 12, diff --git a/testdata/result/ddl/named_schemas_alter_table_drop_constraints.sql.txt b/testdata/result/ddl/named_schemas_alter_table_drop_constraints.sql.txt index e76de6a7..83f44484 100644 --- a/testdata/result/ddl/named_schemas_alter_table_drop_constraints.sql.txt +++ b/testdata/result/ddl/named_schemas_alter_table_drop_constraints.sql.txt @@ -2,8 +2,7 @@ ALTER TABLE sch1.ShoppingCarts DROP CONSTRAINT FKShoppingCartsCustomers --- AST &ast.AlterTable{ - Alter: 0, - Name: &ast.Path{ + Name: &ast.Path{ Idents: []*ast.Ident{ &ast.Ident{ NamePos: 12, diff --git a/testdata/result/ddl/named_schemas_create_index.sql.txt b/testdata/result/ddl/named_schemas_create_index.sql.txt index 8ee2b3f1..46e400bb 100644 --- a/testdata/result/ddl/named_schemas_create_index.sql.txt +++ b/testdata/result/ddl/named_schemas_create_index.sql.txt @@ -2,12 +2,8 @@ CREATE INDEX sch1.indexOnSingers ON sch1.Singers(FirstName) --- AST &ast.CreateIndex{ - Create: 0, - Rparen: 58, - Unique: false, - NullFiltered: false, - IfNotExists: false, - Name: &ast.Path{ + Rparen: 58, + Name: &ast.Path{ Idents: []*ast.Ident{ &ast.Ident{ NamePos: 13, @@ -43,11 +39,8 @@ CREATE INDEX sch1.indexOnSingers ON sch1.Singers(FirstName) NameEnd: 58, Name: "FirstName", }, - Dir: "", }, }, - Storing: (*ast.Storing)(nil), - InterleaveIn: (*ast.InterleaveIn)(nil), } --- SQL diff --git a/testdata/result/ddl/named_schemas_create_sequence.sql.txt b/testdata/result/ddl/named_schemas_create_sequence.sql.txt index 3fbcbdb9..7749d978 100644 --- a/testdata/result/ddl/named_schemas_create_sequence.sql.txt +++ b/testdata/result/ddl/named_schemas_create_sequence.sql.txt @@ -4,8 +4,7 @@ CREATE SEQUENCE sch1.sequence OPTIONS ( ) --- AST &ast.CreateSequence{ - Create: 0, - Name: &ast.Path{ + Name: &ast.Path{ Idents: []*ast.Ident{ &ast.Ident{ NamePos: 16, @@ -19,8 +18,7 @@ CREATE SEQUENCE sch1.sequence OPTIONS ( }, }, }, - IfNotExists: false, - Options: &ast.Options{ + Options: &ast.Options{ Options: 30, Rparen: 82, Records: []*ast.OptionsDef{ diff --git a/testdata/result/ddl/named_schemas_create_table.sql.txt b/testdata/result/ddl/named_schemas_create_table.sql.txt index 9d038399..beb9447b 100644 --- a/testdata/result/ddl/named_schemas_create_table.sql.txt +++ b/testdata/result/ddl/named_schemas_create_table.sql.txt @@ -7,10 +7,8 @@ CREATE TABLE sch1.Singers ( ) PRIMARY KEY(SingerId) --- AST &ast.CreateTable{ - Create: 0, - Rparen: 161, - IfNotExists: false, - Name: &ast.Path{ + Rparen: 161, + Name: &ast.Path{ Idents: []*ast.Ident{ &ast.Ident{ NamePos: 13, @@ -36,11 +34,8 @@ CREATE TABLE sch1.Singers ( NamePos: 41, Name: "INT64", }, - NotNull: true, - DefaultExpr: (*ast.ColumnDefaultExpr)(nil), - GeneratedExpr: (*ast.GeneratedColumnExpr)(nil), - Hidden: -1, - Options: (*ast.Options)(nil), + NotNull: true, + Hidden: -1, }, &ast.ColumnDef{ Null: -1, @@ -53,7 +48,6 @@ CREATE TABLE sch1.Singers ( NamePos: 71, Rparen: 82, Name: "STRING", - Max: false, Size: &ast.IntLiteral{ ValuePos: 78, ValueEnd: 82, @@ -61,11 +55,7 @@ CREATE TABLE sch1.Singers ( Value: "1024", }, }, - NotNull: false, - DefaultExpr: (*ast.ColumnDefaultExpr)(nil), - GeneratedExpr: (*ast.GeneratedColumnExpr)(nil), - Hidden: -1, - Options: (*ast.Options)(nil), + Hidden: -1, }, &ast.ColumnDef{ Null: -1, @@ -78,7 +68,6 @@ CREATE TABLE sch1.Singers ( NamePos: 98, Rparen: 109, Name: "STRING", - Max: false, Size: &ast.IntLiteral{ ValuePos: 105, ValueEnd: 109, @@ -86,11 +75,7 @@ CREATE TABLE sch1.Singers ( Value: "1024", }, }, - NotNull: false, - DefaultExpr: (*ast.ColumnDefaultExpr)(nil), - GeneratedExpr: (*ast.GeneratedColumnExpr)(nil), - Hidden: -1, - Options: (*ast.Options)(nil), + Hidden: -1, }, &ast.ColumnDef{ Null: -1, @@ -104,17 +89,11 @@ CREATE TABLE sch1.Singers ( Rparen: 136, Name: "BYTES", Max: true, - Size: nil, }, - NotNull: false, - DefaultExpr: (*ast.ColumnDefaultExpr)(nil), - GeneratedExpr: (*ast.GeneratedColumnExpr)(nil), - Hidden: -1, - Options: (*ast.Options)(nil), + Hidden: -1, }, }, - TableConstraints: []*ast.TableConstraint(nil), - PrimaryKeys: []*ast.IndexKey{ + PrimaryKeys: []*ast.IndexKey{ &ast.IndexKey{ DirPos: -1, Name: &ast.Ident{ @@ -122,12 +101,8 @@ CREATE TABLE sch1.Singers ( NameEnd: 161, Name: "SingerId", }, - Dir: "", }, }, - Synonyms: []*ast.Synonym(nil), - Cluster: (*ast.Cluster)(nil), - RowDeletionPolicy: (*ast.CreateRowDeletionPolicy)(nil), } --- SQL diff --git a/testdata/result/ddl/named_schemas_create_table_foreign_key.sql.txt b/testdata/result/ddl/named_schemas_create_table_foreign_key.sql.txt index 47a97bb3..deb384e1 100644 --- a/testdata/result/ddl/named_schemas_create_table_foreign_key.sql.txt +++ b/testdata/result/ddl/named_schemas_create_table_foreign_key.sql.txt @@ -8,10 +8,8 @@ CREATE TABLE sch1.ShoppingCarts ( ) PRIMARY KEY(CartId) --- AST &ast.CreateTable{ - Create: 0, - Rparen: 296, - IfNotExists: false, - Name: &ast.Path{ + Rparen: 296, + Name: &ast.Path{ Idents: []*ast.Ident{ &ast.Ident{ NamePos: 13, @@ -37,11 +35,8 @@ CREATE TABLE sch1.ShoppingCarts ( NamePos: 43, Name: "INT64", }, - NotNull: true, - DefaultExpr: (*ast.ColumnDefaultExpr)(nil), - GeneratedExpr: (*ast.GeneratedColumnExpr)(nil), - Hidden: -1, - Options: (*ast.Options)(nil), + NotNull: true, + Hidden: -1, }, &ast.ColumnDef{ Null: 82, @@ -54,11 +49,8 @@ CREATE TABLE sch1.ShoppingCarts ( NamePos: 72, Name: "INT64", }, - NotNull: true, - DefaultExpr: (*ast.ColumnDefaultExpr)(nil), - GeneratedExpr: (*ast.GeneratedColumnExpr)(nil), - Hidden: -1, - Options: (*ast.Options)(nil), + NotNull: true, + Hidden: -1, }, &ast.ColumnDef{ Null: 119, @@ -72,13 +64,9 @@ CREATE TABLE sch1.ShoppingCarts ( Rparen: 113, Name: "STRING", Max: true, - Size: nil, }, - NotNull: true, - DefaultExpr: (*ast.ColumnDefaultExpr)(nil), - GeneratedExpr: (*ast.GeneratedColumnExpr)(nil), - Hidden: -1, - Options: (*ast.Options)(nil), + NotNull: true, + Hidden: -1, }, }, TableConstraints: []*ast.TableConstraint{ @@ -143,12 +131,8 @@ CREATE TABLE sch1.ShoppingCarts ( NameEnd: 296, Name: "CartId", }, - Dir: "", }, }, - Synonyms: []*ast.Synonym(nil), - Cluster: (*ast.Cluster)(nil), - RowDeletionPolicy: (*ast.CreateRowDeletionPolicy)(nil), } --- SQL diff --git a/testdata/result/ddl/named_schemas_create_table_interleave.sql.txt b/testdata/result/ddl/named_schemas_create_table_interleave.sql.txt index 2f909ecc..82983cde 100644 --- a/testdata/result/ddl/named_schemas_create_table_interleave.sql.txt +++ b/testdata/result/ddl/named_schemas_create_table_interleave.sql.txt @@ -7,10 +7,8 @@ CREATE TABLE sch1.Albums ( INTERLEAVE IN PARENT sch1.Singers ON DELETE CASCADE --- AST &ast.CreateTable{ - Create: 0, - Rparen: 137, - IfNotExists: false, - Name: &ast.Path{ + Rparen: 137, + Name: &ast.Path{ Idents: []*ast.Ident{ &ast.Ident{ NamePos: 13, @@ -36,11 +34,8 @@ CREATE TABLE sch1.Albums ( NamePos: 38, Name: "INT64", }, - NotNull: true, - DefaultExpr: (*ast.ColumnDefaultExpr)(nil), - GeneratedExpr: (*ast.GeneratedColumnExpr)(nil), - Hidden: -1, - Options: (*ast.Options)(nil), + NotNull: true, + Hidden: -1, }, &ast.ColumnDef{ Null: 74, @@ -53,11 +48,8 @@ CREATE TABLE sch1.Albums ( NamePos: 64, Name: "INT64", }, - NotNull: true, - DefaultExpr: (*ast.ColumnDefaultExpr)(nil), - GeneratedExpr: (*ast.GeneratedColumnExpr)(nil), - Hidden: -1, - Options: (*ast.Options)(nil), + NotNull: true, + Hidden: -1, }, &ast.ColumnDef{ Null: -1, @@ -71,17 +63,11 @@ CREATE TABLE sch1.Albums ( Rparen: 103, Name: "STRING", Max: true, - Size: nil, }, - NotNull: false, - DefaultExpr: (*ast.ColumnDefaultExpr)(nil), - GeneratedExpr: (*ast.GeneratedColumnExpr)(nil), - Hidden: -1, - Options: (*ast.Options)(nil), + Hidden: -1, }, }, - TableConstraints: []*ast.TableConstraint(nil), - PrimaryKeys: []*ast.IndexKey{ + PrimaryKeys: []*ast.IndexKey{ &ast.IndexKey{ DirPos: -1, Name: &ast.Ident{ @@ -89,7 +75,6 @@ CREATE TABLE sch1.Albums ( NameEnd: 128, Name: "SingerId", }, - Dir: "", }, &ast.IndexKey{ DirPos: -1, @@ -98,11 +83,9 @@ CREATE TABLE sch1.Albums ( NameEnd: 137, Name: "AlbumId", }, - Dir: "", }, }, - Synonyms: []*ast.Synonym(nil), - Cluster: &ast.Cluster{ + Cluster: &ast.Cluster{ Comma: 138, OnDeleteEnd: 193, TableName: &ast.Path{ @@ -121,7 +104,6 @@ CREATE TABLE sch1.Albums ( }, OnDelete: "ON DELETE CASCADE", }, - RowDeletionPolicy: (*ast.CreateRowDeletionPolicy)(nil), } --- SQL diff --git a/testdata/result/ddl/named_schemas_create_view.sql.txt b/testdata/result/ddl/named_schemas_create_view.sql.txt index 19615943..bda5fae5 100644 --- a/testdata/result/ddl/named_schemas_create_view.sql.txt +++ b/testdata/result/ddl/named_schemas_create_view.sql.txt @@ -4,8 +4,7 @@ AS Select s.FirstName, s.LastName, s.SingerInfo FROM sch1.Singers AS s WHERE s.SingerId = 123456 --- AST &ast.CreateView{ - Create: 0, - Name: &ast.Path{ + Name: &ast.Path{ Idents: []*ast.Ident{ &ast.Ident{ NamePos: 12, @@ -19,13 +18,10 @@ AS Select s.FirstName, s.LastName, s.SingerInfo }, }, }, - OrReplace: false, SecurityType: "INVOKER", Query: &ast.Select{ - Select: 52, - Distinct: false, - As: nil, - Results: []ast.SelectItem{ + Select: 52, + Results: []ast.SelectItem{ &ast.ExprSelectItem{ Expr: &ast.Path{ Idents: []*ast.Ident{ @@ -92,8 +88,7 @@ AS Select s.FirstName, s.LastName, s.SingerInfo }, }, }, - Hint: (*ast.Hint)(nil), - As: &ast.AsAlias{ + As: &ast.AsAlias{ As: 118, Alias: &ast.Ident{ NamePos: 121, @@ -101,8 +96,6 @@ AS Select s.FirstName, s.LastName, s.SingerInfo Name: "s", }, }, - WithOffset: (*ast.WithOffset)(nil), - Sample: (*ast.TableSample)(nil), }, }, Where: &ast.Where{ @@ -131,10 +124,6 @@ AS Select s.FirstName, s.LastName, s.SingerInfo }, }, }, - GroupBy: (*ast.GroupBy)(nil), - Having: (*ast.Having)(nil), - OrderBy: (*ast.OrderBy)(nil), - Limit: (*ast.Limit)(nil), }, } diff --git a/testdata/result/ddl/named_schemas_drop_index.sql.txt b/testdata/result/ddl/named_schemas_drop_index.sql.txt index e39e22d3..a5ac72df 100644 --- a/testdata/result/ddl/named_schemas_drop_index.sql.txt +++ b/testdata/result/ddl/named_schemas_drop_index.sql.txt @@ -2,9 +2,7 @@ DROP INDEX sch1.indexOnSingers --- AST &ast.DropIndex{ - Drop: 0, - IfExists: false, - Name: &ast.Path{ + Name: &ast.Path{ Idents: []*ast.Ident{ &ast.Ident{ NamePos: 11, diff --git a/testdata/result/ddl/named_schemas_drop_sequence.sql.txt b/testdata/result/ddl/named_schemas_drop_sequence.sql.txt index 1714e94e..7252d218 100644 --- a/testdata/result/ddl/named_schemas_drop_sequence.sql.txt +++ b/testdata/result/ddl/named_schemas_drop_sequence.sql.txt @@ -2,9 +2,7 @@ DROP SEQUENCE sch1.sequence --- AST &ast.DropSequence{ - Drop: 0, - IfExists: false, - Name: &ast.Path{ + Name: &ast.Path{ Idents: []*ast.Ident{ &ast.Ident{ NamePos: 14, diff --git a/testdata/result/ddl/named_schemas_drop_table.sql.txt b/testdata/result/ddl/named_schemas_drop_table.sql.txt index f4a3fc70..f68cc7ba 100644 --- a/testdata/result/ddl/named_schemas_drop_table.sql.txt +++ b/testdata/result/ddl/named_schemas_drop_table.sql.txt @@ -2,9 +2,7 @@ DROP TABLE sch1.ShoppingCarts --- AST &ast.DropTable{ - Drop: 0, - IfExists: false, - Name: &ast.Path{ + Name: &ast.Path{ Idents: []*ast.Ident{ &ast.Ident{ NamePos: 11, diff --git a/testdata/result/ddl/named_schemas_drop_view.sql.txt b/testdata/result/ddl/named_schemas_drop_view.sql.txt index 0431f46a..6a963dbe 100644 --- a/testdata/result/ddl/named_schemas_drop_view.sql.txt +++ b/testdata/result/ddl/named_schemas_drop_view.sql.txt @@ -2,7 +2,6 @@ DROP VIEW sch1.SingerView --- AST &ast.DropView{ - Drop: 0, Name: &ast.Path{ Idents: []*ast.Ident{ &ast.Ident{ diff --git a/testdata/result/ddl/rename_table_multiple.sql.txt b/testdata/result/ddl/rename_table_multiple.sql.txt index e075f639..735954fc 100644 --- a/testdata/result/ddl/rename_table_multiple.sql.txt +++ b/testdata/result/ddl/rename_table_multiple.sql.txt @@ -2,8 +2,7 @@ RENAME TABLE Singers TO Artists, Albums TO Recordings --- AST &ast.RenameTable{ - Rename: 0, - Tos: []*ast.RenameTableTo{ + Tos: []*ast.RenameTableTo{ &ast.RenameTableTo{ Old: &ast.Ident{ NamePos: 13, diff --git a/testdata/result/ddl/rename_table_single.sql.txt b/testdata/result/ddl/rename_table_single.sql.txt index a6358055..7390f014 100644 --- a/testdata/result/ddl/rename_table_single.sql.txt +++ b/testdata/result/ddl/rename_table_single.sql.txt @@ -2,8 +2,7 @@ RENAME TABLE Singers TO Artists --- AST &ast.RenameTable{ - Rename: 0, - Tos: []*ast.RenameTableTo{ + Tos: []*ast.RenameTableTo{ &ast.RenameTableTo{ Old: &ast.Ident{ NamePos: 13, diff --git a/testdata/result/ddl/revoke_change_stream_privilege.sql.txt b/testdata/result/ddl/revoke_change_stream_privilege.sql.txt index b3f9b42c..59695a63 100644 --- a/testdata/result/ddl/revoke_change_stream_privilege.sql.txt +++ b/testdata/result/ddl/revoke_change_stream_privilege.sql.txt @@ -2,7 +2,6 @@ REVOKE SELECT ON CHANGE STREAM cs_name_one, cs_name_two FROM ROLE hr_manager --- AST &ast.Revoke{ - Revoke: 0, Privilege: &ast.SelectPrivilegeOnChangeStream{ Select: 7, Names: []*ast.Ident{ diff --git a/testdata/result/ddl/revoke_execute_on_table_function.sql.txt b/testdata/result/ddl/revoke_execute_on_table_function.sql.txt index 4dd6b857..b7695b39 100644 --- a/testdata/result/ddl/revoke_execute_on_table_function.sql.txt +++ b/testdata/result/ddl/revoke_execute_on_table_function.sql.txt @@ -2,7 +2,6 @@ REVOKE EXECUTE ON TABLE FUNCTION READ_SingersNameStream FROM ROLE hr_manager --- AST &ast.Revoke{ - Revoke: 0, Privilege: &ast.ExecutePrivilegeOnTableFunction{ Execute: 7, Names: []*ast.Ident{ diff --git a/testdata/result/ddl/revoke_privileges.sql.txt b/testdata/result/ddl/revoke_privileges.sql.txt index 1d0f03bf..700fab92 100644 --- a/testdata/result/ddl/revoke_privileges.sql.txt +++ b/testdata/result/ddl/revoke_privileges.sql.txt @@ -3,7 +3,6 @@ REVOKE SELECT(name, level, location), UPDATE(location) ON TABLE employees, contr --- AST &ast.Revoke{ - Revoke: 0, Privilege: &ast.PrivilegeOnTable{ Privileges: []ast.TablePrivilege{ &ast.SelectPrivilege{ diff --git a/testdata/result/ddl/revoke_role.sql.txt b/testdata/result/ddl/revoke_role.sql.txt index e9424539..532ada8b 100644 --- a/testdata/result/ddl/revoke_role.sql.txt +++ b/testdata/result/ddl/revoke_role.sql.txt @@ -3,7 +3,6 @@ REVOKE ROLE pii_access, pii_writter FROM ROLE hr_manager, hr_director --- AST &ast.Revoke{ - Revoke: 0, Privilege: &ast.RolePrivilege{ Role: 7, Names: []*ast.Ident{ diff --git a/testdata/result/ddl/revoke_select_on_view.sql.txt b/testdata/result/ddl/revoke_select_on_view.sql.txt index ecf3c1dd..4f45d474 100644 --- a/testdata/result/ddl/revoke_select_on_view.sql.txt +++ b/testdata/result/ddl/revoke_select_on_view.sql.txt @@ -2,7 +2,6 @@ REVOKE SELECT ON VIEW singernames FROM ROLE hr_manager --- AST &ast.Revoke{ - Revoke: 0, Privilege: &ast.SelectPrivilegeOnView{ Select: 7, Names: []*ast.Ident{ diff --git a/testdata/result/dml/delete _from.sql.txt b/testdata/result/dml/delete _from.sql.txt index 29eddeae..ef9d1756 100644 --- a/testdata/result/dml/delete _from.sql.txt +++ b/testdata/result/dml/delete _from.sql.txt @@ -2,13 +2,11 @@ delete from foo where foo = 1 and bar = 2 --- AST &ast.Delete{ - Delete: 0, TableName: &ast.Ident{ NamePos: 12, NameEnd: 15, Name: "foo", }, - As: (*ast.AsAlias)(nil), Where: &ast.Where{ Where: 16, Expr: &ast.BinaryExpr{ @@ -43,7 +41,6 @@ delete from foo where foo = 1 and bar = 2 }, }, }, - ThenReturn: (*ast.ThenReturn)(nil), } --- SQL diff --git a/testdata/result/dml/delete.sql.txt b/testdata/result/dml/delete.sql.txt index 1bf07ded..6c7b6ce8 100644 --- a/testdata/result/dml/delete.sql.txt +++ b/testdata/result/dml/delete.sql.txt @@ -2,13 +2,11 @@ delete foo where foo = 1 and bar = 2 --- AST &ast.Delete{ - Delete: 0, TableName: &ast.Ident{ NamePos: 7, NameEnd: 10, Name: "foo", }, - As: (*ast.AsAlias)(nil), Where: &ast.Where{ Where: 11, Expr: &ast.BinaryExpr{ @@ -43,7 +41,6 @@ delete foo where foo = 1 and bar = 2 }, }, }, - ThenReturn: (*ast.ThenReturn)(nil), } --- SQL diff --git a/testdata/result/dml/delete_as.sql.txt b/testdata/result/dml/delete_as.sql.txt index 36c330e3..f0758fd5 100644 --- a/testdata/result/dml/delete_as.sql.txt +++ b/testdata/result/dml/delete_as.sql.txt @@ -2,7 +2,6 @@ delete foo as F where F.foo = 1 --- AST &ast.Delete{ - Delete: 0, TableName: &ast.Ident{ NamePos: 7, NameEnd: 10, @@ -42,7 +41,6 @@ delete foo as F where F.foo = 1 }, }, }, - ThenReturn: (*ast.ThenReturn)(nil), } --- SQL diff --git a/testdata/result/dml/delete_then_return.sql.txt b/testdata/result/dml/delete_then_return.sql.txt index 94b742a1..6c160a1f 100644 --- a/testdata/result/dml/delete_then_return.sql.txt +++ b/testdata/result/dml/delete_then_return.sql.txt @@ -2,13 +2,11 @@ delete foo where foo = 1 and bar = 2 then return * --- AST &ast.Delete{ - Delete: 0, TableName: &ast.Ident{ NamePos: 7, NameEnd: 10, Name: "foo", }, - As: (*ast.AsAlias)(nil), Where: &ast.Where{ Where: 11, Expr: &ast.BinaryExpr{ @@ -44,9 +42,8 @@ delete foo where foo = 1 and bar = 2 then return * }, }, ThenReturn: &ast.ThenReturn{ - Then: 37, - WithAction: (*ast.WithAction)(nil), - Items: []ast.SelectItem{ + Then: 37, + Items: []ast.SelectItem{ &ast.Star{ Star: 49, }, diff --git a/testdata/result/dml/insert_into_values.sql.txt b/testdata/result/dml/insert_into_values.sql.txt index dc897ce3..670a2c4b 100644 --- a/testdata/result/dml/insert_into_values.sql.txt +++ b/testdata/result/dml/insert_into_values.sql.txt @@ -4,9 +4,7 @@ values (1, 2, 3), (4, 5, 6) --- AST &ast.Insert{ - Insert: 0, - InsertOrType: "", - TableName: &ast.Ident{ + TableName: &ast.Ident{ NamePos: 12, NameEnd: 15, Name: "foo", @@ -37,7 +35,6 @@ values (1, 2, 3), Exprs: []*ast.DefaultExpr{ &ast.DefaultExpr{ DefaultPos: -1, - Default: false, Expr: &ast.IntLiteral{ ValuePos: 40, ValueEnd: 41, @@ -47,7 +44,6 @@ values (1, 2, 3), }, &ast.DefaultExpr{ DefaultPos: -1, - Default: false, Expr: &ast.IntLiteral{ ValuePos: 43, ValueEnd: 44, @@ -57,7 +53,6 @@ values (1, 2, 3), }, &ast.DefaultExpr{ DefaultPos: -1, - Default: false, Expr: &ast.IntLiteral{ ValuePos: 46, ValueEnd: 47, @@ -73,7 +68,6 @@ values (1, 2, 3), Exprs: []*ast.DefaultExpr{ &ast.DefaultExpr{ DefaultPos: -1, - Default: false, Expr: &ast.IntLiteral{ ValuePos: 58, ValueEnd: 59, @@ -83,7 +77,6 @@ values (1, 2, 3), }, &ast.DefaultExpr{ DefaultPos: -1, - Default: false, Expr: &ast.IntLiteral{ ValuePos: 61, ValueEnd: 62, @@ -93,7 +86,6 @@ values (1, 2, 3), }, &ast.DefaultExpr{ DefaultPos: -1, - Default: false, Expr: &ast.IntLiteral{ ValuePos: 64, ValueEnd: 65, @@ -105,7 +97,6 @@ values (1, 2, 3), }, }, }, - ThenReturn: (*ast.ThenReturn)(nil), } --- SQL diff --git a/testdata/result/dml/insert_or_ignore.sql.txt b/testdata/result/dml/insert_or_ignore.sql.txt index 9994ff8e..43d4b19e 100644 --- a/testdata/result/dml/insert_or_ignore.sql.txt +++ b/testdata/result/dml/insert_or_ignore.sql.txt @@ -3,7 +3,6 @@ INSERT OR IGNORE INTO foo (foo, bar) VALUES (1, 2) --- AST &ast.Insert{ - Insert: 0, InsertOrType: "IGNORE", TableName: &ast.Ident{ NamePos: 22, @@ -31,7 +30,6 @@ INSERT OR IGNORE INTO foo Exprs: []*ast.DefaultExpr{ &ast.DefaultExpr{ DefaultPos: -1, - Default: false, Expr: &ast.IntLiteral{ ValuePos: 45, ValueEnd: 46, @@ -41,7 +39,6 @@ INSERT OR IGNORE INTO foo }, &ast.DefaultExpr{ DefaultPos: -1, - Default: false, Expr: &ast.IntLiteral{ ValuePos: 48, ValueEnd: 49, @@ -53,7 +50,6 @@ INSERT OR IGNORE INTO foo }, }, }, - ThenReturn: (*ast.ThenReturn)(nil), } --- SQL diff --git a/testdata/result/dml/insert_or_update.sql.txt b/testdata/result/dml/insert_or_update.sql.txt index a87b61f8..4ecc3acc 100644 --- a/testdata/result/dml/insert_or_update.sql.txt +++ b/testdata/result/dml/insert_or_update.sql.txt @@ -3,7 +3,6 @@ INSERT OR UPDATE INTO foo (foo, bar) VALUES (1, 2) --- AST &ast.Insert{ - Insert: 0, InsertOrType: "UPDATE", TableName: &ast.Ident{ NamePos: 22, @@ -31,7 +30,6 @@ INSERT OR UPDATE INTO foo Exprs: []*ast.DefaultExpr{ &ast.DefaultExpr{ DefaultPos: -1, - Default: false, Expr: &ast.IntLiteral{ ValuePos: 45, ValueEnd: 46, @@ -41,7 +39,6 @@ INSERT OR UPDATE INTO foo }, &ast.DefaultExpr{ DefaultPos: -1, - Default: false, Expr: &ast.IntLiteral{ ValuePos: 48, ValueEnd: 49, @@ -53,7 +50,6 @@ INSERT OR UPDATE INTO foo }, }, }, - ThenReturn: (*ast.ThenReturn)(nil), } --- SQL diff --git a/testdata/result/dml/insert_or_update_then_return_with_action_as.sql.txt b/testdata/result/dml/insert_or_update_then_return_with_action_as.sql.txt index ab5e4a6d..665e0e2a 100644 --- a/testdata/result/dml/insert_or_update_then_return_with_action_as.sql.txt +++ b/testdata/result/dml/insert_or_update_then_return_with_action_as.sql.txt @@ -4,7 +4,6 @@ INSERT OR UPDATE INTO foo THEN RETURN WITH ACTION AS act * --- AST &ast.Insert{ - Insert: 0, InsertOrType: "UPDATE", TableName: &ast.Ident{ NamePos: 22, @@ -32,7 +31,6 @@ THEN RETURN WITH ACTION AS act * Exprs: []*ast.DefaultExpr{ &ast.DefaultExpr{ DefaultPos: -1, - Default: false, Expr: &ast.IntLiteral{ ValuePos: 45, ValueEnd: 46, @@ -42,7 +40,6 @@ THEN RETURN WITH ACTION AS act * }, &ast.DefaultExpr{ DefaultPos: -1, - Default: false, Expr: &ast.IntLiteral{ ValuePos: 48, ValueEnd: 49, diff --git a/testdata/result/dml/insert_select.sql.txt b/testdata/result/dml/insert_select.sql.txt index 5b3b5590..2b2e713b 100644 --- a/testdata/result/dml/insert_select.sql.txt +++ b/testdata/result/dml/insert_select.sql.txt @@ -3,9 +3,7 @@ insert foo (foo, bar) select * from unnest([(1, 2), (3, 4)]) --- AST &ast.Insert{ - Insert: 0, - InsertOrType: "", - TableName: &ast.Ident{ + TableName: &ast.Ident{ NamePos: 7, NameEnd: 10, Name: "foo", @@ -24,10 +22,8 @@ select * from unnest([(1, 2), (3, 4)]) }, Input: &ast.SubQueryInput{ Query: &ast.Select{ - Select: 22, - Distinct: false, - As: nil, - Results: []ast.SelectItem{ + Select: 22, + Results: []ast.SelectItem{ &ast.Star{ Star: 29, }, @@ -41,7 +37,6 @@ select * from unnest([(1, 2), (3, 4)]) Array: -1, Lbrack: 43, Rbrack: 58, - Type: nil, Values: []ast.Expr{ &ast.TupleStructLiteral{ Lparen: 44, @@ -81,20 +76,10 @@ select * from unnest([(1, 2), (3, 4)]) }, }, }, - Hint: (*ast.Hint)(nil), - As: (*ast.AsAlias)(nil), - WithOffset: (*ast.WithOffset)(nil), - Sample: (*ast.TableSample)(nil), }, }, - Where: (*ast.Where)(nil), - GroupBy: (*ast.GroupBy)(nil), - Having: (*ast.Having)(nil), - OrderBy: (*ast.OrderBy)(nil), - Limit: (*ast.Limit)(nil), }, }, - ThenReturn: (*ast.ThenReturn)(nil), } --- SQL diff --git a/testdata/result/dml/insert_values.sql.txt b/testdata/result/dml/insert_values.sql.txt index aae84cad..e791c60d 100644 --- a/testdata/result/dml/insert_values.sql.txt +++ b/testdata/result/dml/insert_values.sql.txt @@ -4,9 +4,7 @@ values (1, 2, 3), (4, 5, 6) --- AST &ast.Insert{ - Insert: 0, - InsertOrType: "", - TableName: &ast.Ident{ + TableName: &ast.Ident{ NamePos: 7, NameEnd: 10, Name: "foo", @@ -37,7 +35,6 @@ values (1, 2, 3), Exprs: []*ast.DefaultExpr{ &ast.DefaultExpr{ DefaultPos: -1, - Default: false, Expr: &ast.IntLiteral{ ValuePos: 35, ValueEnd: 36, @@ -47,7 +44,6 @@ values (1, 2, 3), }, &ast.DefaultExpr{ DefaultPos: -1, - Default: false, Expr: &ast.IntLiteral{ ValuePos: 38, ValueEnd: 39, @@ -57,7 +53,6 @@ values (1, 2, 3), }, &ast.DefaultExpr{ DefaultPos: -1, - Default: false, Expr: &ast.IntLiteral{ ValuePos: 41, ValueEnd: 42, @@ -73,7 +68,6 @@ values (1, 2, 3), Exprs: []*ast.DefaultExpr{ &ast.DefaultExpr{ DefaultPos: -1, - Default: false, Expr: &ast.IntLiteral{ ValuePos: 53, ValueEnd: 54, @@ -83,7 +77,6 @@ values (1, 2, 3), }, &ast.DefaultExpr{ DefaultPos: -1, - Default: false, Expr: &ast.IntLiteral{ ValuePos: 56, ValueEnd: 57, @@ -93,7 +86,6 @@ values (1, 2, 3), }, &ast.DefaultExpr{ DefaultPos: -1, - Default: false, Expr: &ast.IntLiteral{ ValuePos: 59, ValueEnd: 60, @@ -105,7 +97,6 @@ values (1, 2, 3), }, }, }, - ThenReturn: (*ast.ThenReturn)(nil), } --- SQL diff --git a/testdata/result/dml/insert_values_default.sql.txt b/testdata/result/dml/insert_values_default.sql.txt index 2b3b0083..b379cda6 100644 --- a/testdata/result/dml/insert_values_default.sql.txt +++ b/testdata/result/dml/insert_values_default.sql.txt @@ -3,9 +3,7 @@ insert foo (foo, bar) values (1, default) --- AST &ast.Insert{ - Insert: 0, - InsertOrType: "", - TableName: &ast.Ident{ + TableName: &ast.Ident{ NamePos: 7, NameEnd: 10, Name: "foo", @@ -31,7 +29,6 @@ values (1, default) Exprs: []*ast.DefaultExpr{ &ast.DefaultExpr{ DefaultPos: -1, - Default: false, Expr: &ast.IntLiteral{ ValuePos: 30, ValueEnd: 31, @@ -42,13 +39,11 @@ values (1, default) &ast.DefaultExpr{ DefaultPos: 33, Default: true, - Expr: nil, }, }, }, }, }, - ThenReturn: (*ast.ThenReturn)(nil), } --- SQL diff --git a/testdata/result/dml/insert_with_sequence_function.sql.txt b/testdata/result/dml/insert_with_sequence_function.sql.txt index c78a7cd4..0183ca51 100644 --- a/testdata/result/dml/insert_with_sequence_function.sql.txt +++ b/testdata/result/dml/insert_with_sequence_function.sql.txt @@ -3,9 +3,7 @@ INSERT INTO foo(bar) VALUES (GET_NEXT_SEQUENCE_VALUE(SEQUENCE my_sequence)) --- AST &ast.Insert{ - Insert: 0, - InsertOrType: "", - TableName: &ast.Ident{ + TableName: &ast.Ident{ NamePos: 12, NameEnd: 15, Name: "foo", @@ -26,7 +24,6 @@ INSERT INTO foo(bar) VALUES (GET_NEXT_SEQUENCE_VALUE(SEQUENCE my_sequence)) Exprs: []*ast.DefaultExpr{ &ast.DefaultExpr{ DefaultPos: -1, - Default: false, Expr: &ast.CallExpr{ Rparen: 73, Func: &ast.Ident{ @@ -34,8 +31,7 @@ INSERT INTO foo(bar) VALUES (GET_NEXT_SEQUENCE_VALUE(SEQUENCE my_sequence)) NameEnd: 52, Name: "GET_NEXT_SEQUENCE_VALUE", }, - Distinct: false, - Args: []ast.Arg{ + Args: []ast.Arg{ &ast.SequenceArg{ Sequence: 53, Expr: &ast.Ident{ @@ -45,16 +41,12 @@ INSERT INTO foo(bar) VALUES (GET_NEXT_SEQUENCE_VALUE(SEQUENCE my_sequence)) }, }, }, - NamedArgs: []*ast.NamedArg(nil), - NullHandling: nil, - Having: nil, }, }, }, }, }, }, - ThenReturn: (*ast.ThenReturn)(nil), } --- SQL diff --git a/testdata/result/dml/update.sql.txt b/testdata/result/dml/update.sql.txt index fcf32946..e9e63cb1 100644 --- a/testdata/result/dml/update.sql.txt +++ b/testdata/result/dml/update.sql.txt @@ -2,13 +2,11 @@ update foo set foo = bar, bar = foo, baz = DEFAULT where foo = 1 --- AST &ast.Update{ - Update: 0, TableName: &ast.Ident{ NamePos: 7, NameEnd: 10, Name: "foo", }, - As: (*ast.AsAlias)(nil), Updates: []*ast.UpdateItem{ &ast.UpdateItem{ Path: []*ast.Ident{ @@ -20,7 +18,6 @@ update foo set foo = bar, bar = foo, baz = DEFAULT where foo = 1 }, DefaultExpr: &ast.DefaultExpr{ DefaultPos: -1, - Default: false, Expr: &ast.Ident{ NamePos: 21, NameEnd: 24, @@ -38,7 +35,6 @@ update foo set foo = bar, bar = foo, baz = DEFAULT where foo = 1 }, DefaultExpr: &ast.DefaultExpr{ DefaultPos: -1, - Default: false, Expr: &ast.Ident{ NamePos: 32, NameEnd: 35, @@ -57,7 +53,6 @@ update foo set foo = bar, bar = foo, baz = DEFAULT where foo = 1 DefaultExpr: &ast.DefaultExpr{ DefaultPos: 43, Default: true, - Expr: nil, }, }, }, @@ -78,7 +73,6 @@ update foo set foo = bar, bar = foo, baz = DEFAULT where foo = 1 }, }, }, - ThenReturn: (*ast.ThenReturn)(nil), } --- SQL diff --git a/testdata/result/dml/update_as.sql.txt b/testdata/result/dml/update_as.sql.txt index 00622578..002e9210 100644 --- a/testdata/result/dml/update_as.sql.txt +++ b/testdata/result/dml/update_as.sql.txt @@ -2,7 +2,6 @@ update foo as F set F.foo = F.bar + 1 where foo = F.bar --- AST &ast.Update{ - Update: 0, TableName: &ast.Ident{ NamePos: 7, NameEnd: 10, @@ -32,7 +31,6 @@ update foo as F set F.foo = F.bar + 1 where foo = F.bar }, DefaultExpr: &ast.DefaultExpr{ DefaultPos: -1, - Default: false, Expr: &ast.BinaryExpr{ Op: "+", Left: &ast.Path{ @@ -84,7 +82,6 @@ update foo as F set F.foo = F.bar + 1 where foo = F.bar }, }, }, - ThenReturn: (*ast.ThenReturn)(nil), } --- SQL diff --git a/testdata/result/dml/update_then_return_with_action.sql.txt b/testdata/result/dml/update_then_return_with_action.sql.txt index 438a476f..bfaba0eb 100644 --- a/testdata/result/dml/update_then_return_with_action.sql.txt +++ b/testdata/result/dml/update_then_return_with_action.sql.txt @@ -2,13 +2,11 @@ update foo set foo = bar, bar = foo, baz = DEFAULT where foo = 1 then return with action * --- AST &ast.Update{ - Update: 0, TableName: &ast.Ident{ NamePos: 7, NameEnd: 10, Name: "foo", }, - As: (*ast.AsAlias)(nil), Updates: []*ast.UpdateItem{ &ast.UpdateItem{ Path: []*ast.Ident{ @@ -20,7 +18,6 @@ update foo set foo = bar, bar = foo, baz = DEFAULT where foo = 1 then return wit }, DefaultExpr: &ast.DefaultExpr{ DefaultPos: -1, - Default: false, Expr: &ast.Ident{ NamePos: 21, NameEnd: 24, @@ -38,7 +35,6 @@ update foo set foo = bar, bar = foo, baz = DEFAULT where foo = 1 then return wit }, DefaultExpr: &ast.DefaultExpr{ DefaultPos: -1, - Default: false, Expr: &ast.Ident{ NamePos: 32, NameEnd: 35, @@ -57,7 +53,6 @@ update foo set foo = bar, bar = foo, baz = DEFAULT where foo = 1 then return wit DefaultExpr: &ast.DefaultExpr{ DefaultPos: 43, Default: true, - Expr: nil, }, }, }, @@ -83,7 +78,6 @@ update foo set foo = bar, bar = foo, baz = DEFAULT where foo = 1 then return wit WithAction: &ast.WithAction{ With: 77, Action: 82, - Alias: (*ast.AsAlias)(nil), }, Items: []ast.SelectItem{ &ast.Star{ diff --git a/testdata/result/expr/array_functions_array_filter_one_arg_with_paren_lambda.sql.txt b/testdata/result/expr/array_functions_array_filter_one_arg_with_paren_lambda.sql.txt index a2037132..54b635c4 100644 --- a/testdata/result/expr/array_functions_array_filter_one_arg_with_paren_lambda.sql.txt +++ b/testdata/result/expr/array_functions_array_filter_one_arg_with_paren_lambda.sql.txt @@ -4,18 +4,15 @@ ARRAY_FILTER([1 ,2, 3], (e) -> e > 1) &ast.CallExpr{ Rparen: 36, Func: &ast.Ident{ - NamePos: 0, NameEnd: 12, Name: "ARRAY_FILTER", }, - Distinct: false, - Args: []ast.Arg{ + Args: []ast.Arg{ &ast.ExprArg{ Expr: &ast.ArrayLiteral{ Array: -1, Lbrack: 13, Rbrack: 21, - Type: nil, Values: []ast.Expr{ &ast.IntLiteral{ ValuePos: 14, @@ -63,9 +60,6 @@ ARRAY_FILTER([1 ,2, 3], (e) -> e > 1) }, }, }, - NamedArgs: []*ast.NamedArg(nil), - NullHandling: nil, - Having: nil, } --- SQL diff --git a/testdata/result/expr/array_functions_array_filter_parenless_lambda.sql.txt b/testdata/result/expr/array_functions_array_filter_parenless_lambda.sql.txt index 982a7bab..b03a4a55 100644 --- a/testdata/result/expr/array_functions_array_filter_parenless_lambda.sql.txt +++ b/testdata/result/expr/array_functions_array_filter_parenless_lambda.sql.txt @@ -4,18 +4,15 @@ ARRAY_FILTER([1 ,2, 3], e -> e > 1) &ast.CallExpr{ Rparen: 34, Func: &ast.Ident{ - NamePos: 0, NameEnd: 12, Name: "ARRAY_FILTER", }, - Distinct: false, - Args: []ast.Arg{ + Args: []ast.Arg{ &ast.ExprArg{ Expr: &ast.ArrayLiteral{ Array: -1, Lbrack: 13, Rbrack: 21, - Type: nil, Values: []ast.Expr{ &ast.IntLiteral{ ValuePos: 14, @@ -63,9 +60,6 @@ ARRAY_FILTER([1 ,2, 3], e -> e > 1) }, }, }, - NamedArgs: []*ast.NamedArg(nil), - NullHandling: nil, - Having: nil, } --- SQL diff --git a/testdata/result/expr/array_functions_array_filter_two_args_lambda.sql.txt b/testdata/result/expr/array_functions_array_filter_two_args_lambda.sql.txt index 7d83c243..4f8bafb8 100644 --- a/testdata/result/expr/array_functions_array_filter_two_args_lambda.sql.txt +++ b/testdata/result/expr/array_functions_array_filter_two_args_lambda.sql.txt @@ -4,18 +4,15 @@ ARRAY_FILTER([0, 2, 3], (e, i) -> e > i) &ast.CallExpr{ Rparen: 39, Func: &ast.Ident{ - NamePos: 0, NameEnd: 12, Name: "ARRAY_FILTER", }, - Distinct: false, - Args: []ast.Arg{ + Args: []ast.Arg{ &ast.ExprArg{ Expr: &ast.ArrayLiteral{ Array: -1, Lbrack: 13, Rbrack: 21, - Type: nil, Values: []ast.Expr{ &ast.IntLiteral{ ValuePos: 14, @@ -67,9 +64,6 @@ ARRAY_FILTER([0, 2, 3], (e, i) -> e > i) }, }, }, - NamedArgs: []*ast.NamedArg(nil), - NullHandling: nil, - Having: nil, } --- SQL diff --git a/testdata/result/expr/array_literal_empty_with_types.sql.txt b/testdata/result/expr/array_literal_empty_with_types.sql.txt index 4936cbb1..8497da9f 100644 --- a/testdata/result/expr/array_literal_empty_with_types.sql.txt +++ b/testdata/result/expr/array_literal_empty_with_types.sql.txt @@ -2,14 +2,12 @@ ARRAY[] --- AST &ast.ArrayLiteral{ - Array: 0, Lbrack: 12, Rbrack: 13, Type: &ast.SimpleType{ NamePos: 6, Name: "INT64", }, - Values: []ast.Expr(nil), } --- SQL diff --git a/testdata/result/expr/array_literal_empty_without_array_keyword.sql.txt b/testdata/result/expr/array_literal_empty_without_array_keyword.sql.txt index 5f368857..f29481f3 100644 --- a/testdata/result/expr/array_literal_empty_without_array_keyword.sql.txt +++ b/testdata/result/expr/array_literal_empty_without_array_keyword.sql.txt @@ -3,10 +3,7 @@ --- AST &ast.ArrayLiteral{ Array: -1, - Lbrack: 0, Rbrack: 1, - Type: nil, - Values: []ast.Expr(nil), } --- SQL diff --git a/testdata/result/expr/array_literal_empty_without_types.sql.txt b/testdata/result/expr/array_literal_empty_without_types.sql.txt index 84ecb55d..e1aa12f9 100644 --- a/testdata/result/expr/array_literal_empty_without_types.sql.txt +++ b/testdata/result/expr/array_literal_empty_without_types.sql.txt @@ -2,11 +2,8 @@ ARRAY[] --- AST &ast.ArrayLiteral{ - Array: 0, Lbrack: 5, Rbrack: 6, - Type: nil, - Values: []ast.Expr(nil), } --- SQL diff --git a/testdata/result/expr/braced_new_constructor.sql.txt b/testdata/result/expr/braced_new_constructor.sql.txt index 18d206e3..99b23294 100644 --- a/testdata/result/expr/braced_new_constructor.sql.txt +++ b/testdata/result/expr/braced_new_constructor.sql.txt @@ -59,7 +59,6 @@ NEW Universe { Array: -1, Lbrack: 148, Rbrack: 177, - Type: nil, Values: []ast.Expr{ &ast.StringLiteral{ ValuePos: 149, @@ -137,7 +136,6 @@ NEW Universe { Array: -1, Lbrack: 255, Rbrack: 332, - Type: nil, Values: []ast.Expr{ &ast.BracedConstructor{ Lbrace: 256, @@ -229,10 +227,8 @@ NEW Universe { Lparen: 349, Rparen: 378, Query: &ast.Select{ - Select: 350, - Distinct: false, - As: nil, - Results: []ast.SelectItem{ + Select: 350, + Results: []ast.SelectItem{ &ast.ExprSelectItem{ Expr: &ast.Ident{ NamePos: 357, @@ -249,16 +245,8 @@ NEW Universe { NameEnd: 378, Name: "SolTable", }, - Hint: (*ast.Hint)(nil), - As: (*ast.AsAlias)(nil), - Sample: (*ast.TableSample)(nil), }, }, - Where: (*ast.Where)(nil), - GroupBy: (*ast.GroupBy)(nil), - Having: (*ast.Having)(nil), - OrderBy: (*ast.OrderBy)(nil), - Limit: (*ast.Limit)(nil), }, }, }, diff --git a/testdata/result/expr/braced_new_constructor_empty.sql.txt b/testdata/result/expr/braced_new_constructor_empty.sql.txt index 60878f90..9e845e6b 100644 --- a/testdata/result/expr/braced_new_constructor_empty.sql.txt +++ b/testdata/result/expr/braced_new_constructor_empty.sql.txt @@ -2,7 +2,6 @@ NEW Universe {} --- AST &ast.BracedNewConstructor{ - New: 0, Type: &ast.NamedType{ Path: []*ast.Ident{ &ast.Ident{ @@ -15,7 +14,6 @@ NEW Universe {} Body: &ast.BracedConstructor{ Lbrace: 13, Rbrace: 14, - Fields: []*ast.BracedConstructorField(nil), }, } diff --git a/testdata/result/expr/braced_new_constructor_oneliner.sql.txt b/testdata/result/expr/braced_new_constructor_oneliner.sql.txt index cc34fbeb..f0051def 100644 --- a/testdata/result/expr/braced_new_constructor_oneliner.sql.txt +++ b/testdata/result/expr/braced_new_constructor_oneliner.sql.txt @@ -2,7 +2,6 @@ NEW Universe {name: "Sol", closest_planets: ["Mercury", "Venus", "Earth" ]} --- AST &ast.BracedNewConstructor{ - New: 0, Type: &ast.NamedType{ Path: []*ast.Ident{ &ast.Ident{ @@ -43,7 +42,6 @@ NEW Universe {name: "Sol", closest_planets: ["Mercury", "Venus", "Earth" ]} Array: -1, Lbrack: 44, Rbrack: 73, - Type: nil, Values: []ast.Expr{ &ast.StringLiteral{ ValuePos: 45, diff --git a/testdata/result/expr/cast_as_typename.sql.txt b/testdata/result/expr/cast_as_typename.sql.txt index 3edb8beb..6f45397d 100644 --- a/testdata/result/expr/cast_as_typename.sql.txt +++ b/testdata/result/expr/cast_as_typename.sql.txt @@ -2,9 +2,7 @@ CAST('order_number: "123"' AS examples.shipping.`Order`) --- AST &ast.CastExpr{ - Cast: 0, Rparen: 55, - Safe: false, Expr: &ast.StringLiteral{ ValuePos: 5, ValueEnd: 26, diff --git a/testdata/result/expr/conversion_functions_safe_cast.sql.txt b/testdata/result/expr/conversion_functions_safe_cast.sql.txt index 8f9d1cb4..196c5201 100644 --- a/testdata/result/expr/conversion_functions_safe_cast.sql.txt +++ b/testdata/result/expr/conversion_functions_safe_cast.sql.txt @@ -2,7 +2,6 @@ SAFE_CAST("apple" AS INT64) --- AST &ast.CastExpr{ - Cast: 0, Rparen: 26, Safe: true, Expr: &ast.StringLiteral{ diff --git a/testdata/result/expr/edge_case_backquote_keyword.sql.txt b/testdata/result/expr/edge_case_backquote_keyword.sql.txt index 36e1fe1a..aaaa1ade 100644 --- a/testdata/result/expr/edge_case_backquote_keyword.sql.txt +++ b/testdata/result/expr/edge_case_backquote_keyword.sql.txt @@ -4,7 +4,6 @@ &ast.BinaryExpr{ Op: "+", Left: &ast.Ident{ - NamePos: 0, NameEnd: 4, Name: "IF", }, diff --git a/testdata/result/expr/edge_case_backquote_non_keyword.sql.txt b/testdata/result/expr/edge_case_backquote_non_keyword.sql.txt index beda1a6f..d512ba23 100644 --- a/testdata/result/expr/edge_case_backquote_non_keyword.sql.txt +++ b/testdata/result/expr/edge_case_backquote_non_keyword.sql.txt @@ -4,7 +4,6 @@ &ast.BinaryExpr{ Op: "+", Left: &ast.Ident{ - NamePos: 0, NameEnd: 10, Name: "DATABASE", }, diff --git a/testdata/result/expr/json_literal.sql.txt b/testdata/result/expr/json_literal.sql.txt index 6d4efa7d..6e358b4a 100644 --- a/testdata/result/expr/json_literal.sql.txt +++ b/testdata/result/expr/json_literal.sql.txt @@ -2,7 +2,6 @@ JSON '{"s": "foo", "n": 42}' --- AST &ast.JSONLiteral{ - JSON: 0, Value: &ast.StringLiteral{ ValuePos: 5, ValueEnd: 28, diff --git a/testdata/result/expr/new_constructor.sql.txt b/testdata/result/expr/new_constructor.sql.txt index 63cb5d39..734af855 100644 --- a/testdata/result/expr/new_constructor.sql.txt +++ b/testdata/result/expr/new_constructor.sql.txt @@ -2,7 +2,6 @@ NEW googlesql.examples.music.Chart(key AS rank, name AS chart_name) --- AST &ast.NewConstructor{ - New: 0, Type: &ast.NamedType{ Path: []*ast.Ident{ &ast.Ident{ diff --git a/testdata/result/expr/new_constructor_empty.sql.txt b/testdata/result/expr/new_constructor_empty.sql.txt index 805f975b..92267457 100644 --- a/testdata/result/expr/new_constructor_empty.sql.txt +++ b/testdata/result/expr/new_constructor_empty.sql.txt @@ -3,7 +3,6 @@ NEW googlesql.examples.music.Chart() --- AST &ast.NewConstructor{ - New: 0, Type: &ast.NamedType{ Path: []*ast.Ident{ &ast.Ident{ @@ -28,7 +27,6 @@ NEW googlesql.examples.music.Chart() }, }, }, - Args: []ast.NewConstructorArg(nil), Rparen: 35, } diff --git a/testdata/result/expr/protocol_buffer_functions_replace_fields.sql.txt b/testdata/result/expr/protocol_buffer_functions_replace_fields.sql.txt index 5587e16a..1a9e277a 100644 --- a/testdata/result/expr/protocol_buffer_functions_replace_fields.sql.txt +++ b/testdata/result/expr/protocol_buffer_functions_replace_fields.sql.txt @@ -7,9 +7,8 @@ REPLACE_FIELDS( 11 AS details.chapters) --- AST &ast.ReplaceFieldsExpr{ - ReplaceFields: 0, - Rparen: 166, - Expr: &ast.NewConstructor{ + Rparen: 166, + Expr: &ast.NewConstructor{ New: 18, Type: &ast.NamedType{ Path: []*ast.Ident{ diff --git a/testdata/result/expr/value_subquery_select_as_fqn_typename.sql.txt b/testdata/result/expr/value_subquery_select_as_fqn_typename.sql.txt index 73aed2a3..26c81619 100644 --- a/testdata/result/expr/value_subquery_select_as_fqn_typename.sql.txt +++ b/testdata/result/expr/value_subquery_select_as_fqn_typename.sql.txt @@ -2,12 +2,10 @@ (SELECT AS example.TypeName 1 AS i) --- AST &ast.ScalarSubQuery{ - Lparen: 0, Rparen: 34, Query: &ast.Select{ - Select: 1, - Distinct: false, - As: &ast.AsTypeName{ + Select: 1, + As: &ast.AsTypeName{ As: 8, TypeName: &ast.NamedType{ Path: []*ast.Ident{ @@ -42,12 +40,6 @@ }, }, }, - From: (*ast.From)(nil), - Where: (*ast.Where)(nil), - GroupBy: (*ast.GroupBy)(nil), - Having: (*ast.Having)(nil), - OrderBy: (*ast.OrderBy)(nil), - Limit: (*ast.Limit)(nil), }, } diff --git a/testdata/result/expr/value_subquery_select_as_leaf_typename.sql.txt b/testdata/result/expr/value_subquery_select_as_leaf_typename.sql.txt index e3aeb50b..b2ad15b2 100644 --- a/testdata/result/expr/value_subquery_select_as_leaf_typename.sql.txt +++ b/testdata/result/expr/value_subquery_select_as_leaf_typename.sql.txt @@ -2,12 +2,10 @@ (SELECT AS TypeName 1 AS i) --- AST &ast.ScalarSubQuery{ - Lparen: 0, Rparen: 26, Query: &ast.Select{ - Select: 1, - Distinct: false, - As: &ast.AsTypeName{ + Select: 1, + As: &ast.AsTypeName{ As: 8, TypeName: &ast.NamedType{ Path: []*ast.Ident{ @@ -37,12 +35,6 @@ }, }, }, - From: (*ast.From)(nil), - Where: (*ast.Where)(nil), - GroupBy: (*ast.GroupBy)(nil), - Having: (*ast.Having)(nil), - OrderBy: (*ast.OrderBy)(nil), - Limit: (*ast.Limit)(nil), }, } diff --git a/testdata/result/expr/value_subquery_select_as_struct.sql.txt b/testdata/result/expr/value_subquery_select_as_struct.sql.txt index f543cd53..cb391b73 100644 --- a/testdata/result/expr/value_subquery_select_as_struct.sql.txt +++ b/testdata/result/expr/value_subquery_select_as_struct.sql.txt @@ -3,12 +3,10 @@ --- AST &ast.ScalarSubQuery{ - Lparen: 0, Rparen: 24, Query: &ast.Select{ - Select: 1, - Distinct: false, - As: &ast.AsStruct{ + Select: 1, + As: &ast.AsStruct{ As: 8, Struct: 11, }, @@ -30,12 +28,6 @@ }, }, }, - From: (*ast.From)(nil), - Where: (*ast.Where)(nil), - GroupBy: (*ast.GroupBy)(nil), - Having: (*ast.Having)(nil), - OrderBy: (*ast.OrderBy)(nil), - Limit: (*ast.Limit)(nil), }, } diff --git a/testdata/result/expr/value_subquery_select_as_value.sql.txt b/testdata/result/expr/value_subquery_select_as_value.sql.txt index 30b7f508..8a293635 100644 --- a/testdata/result/expr/value_subquery_select_as_value.sql.txt +++ b/testdata/result/expr/value_subquery_select_as_value.sql.txt @@ -2,12 +2,10 @@ (SELECT AS VALUE 1) --- AST &ast.ScalarSubQuery{ - Lparen: 0, Rparen: 18, Query: &ast.Select{ - Select: 1, - Distinct: false, - As: &ast.AsValue{ + Select: 1, + As: &ast.AsValue{ As: 8, Value: 11, }, @@ -21,12 +19,6 @@ }, }, }, - From: (*ast.From)(nil), - Where: (*ast.Where)(nil), - GroupBy: (*ast.GroupBy)(nil), - Having: (*ast.Having)(nil), - OrderBy: (*ast.OrderBy)(nil), - Limit: (*ast.Limit)(nil), }, } diff --git a/testdata/result/query/aggregate_function_calls.sql.txt b/testdata/result/query/aggregate_function_calls.sql.txt index 9e2ad6c2..dc06d262 100644 --- a/testdata/result/query/aggregate_function_calls.sql.txt +++ b/testdata/result/query/aggregate_function_calls.sql.txt @@ -8,13 +8,8 @@ SELECT --- AST &ast.QueryStatement{ - Hint: (*ast.Hint)(nil), - With: (*ast.With)(nil), Query: &ast.Select{ - Select: 0, - Distinct: false, - As: nil, - Results: []ast.SelectItem{ + Results: []ast.SelectItem{ &ast.ExprSelectItem{ Expr: &ast.CallExpr{ Rparen: 43, @@ -23,8 +18,7 @@ SELECT NameEnd: 20, Name: "ARRAY_AGG", }, - Distinct: false, - Args: []ast.Arg{ + Args: []ast.Arg{ &ast.ExprArg{ Expr: &ast.Ident{ NamePos: 21, @@ -33,9 +27,7 @@ SELECT }, }, }, - NamedArgs: []*ast.NamedArg(nil), - NullHandling: nil, - Having: &ast.HavingMax{ + Having: &ast.HavingMax{ Having: 28, Expr: &ast.Ident{ NamePos: 39, @@ -53,8 +45,7 @@ SELECT NameEnd: 59, Name: "ARRAY_AGG", }, - Distinct: false, - Args: []ast.Arg{ + Args: []ast.Arg{ &ast.ExprArg{ Expr: &ast.Ident{ NamePos: 60, @@ -63,9 +54,7 @@ SELECT }, }, }, - NamedArgs: []*ast.NamedArg(nil), - NullHandling: nil, - Having: &ast.HavingMin{ + Having: &ast.HavingMin{ Having: 67, Expr: &ast.Ident{ NamePos: 78, @@ -83,8 +72,7 @@ SELECT NameEnd: 98, Name: "ARRAY_AGG", }, - Distinct: false, - Args: []ast.Arg{ + Args: []ast.Arg{ &ast.ExprArg{ Expr: &ast.Ident{ NamePos: 99, @@ -93,12 +81,10 @@ SELECT }, }, }, - NamedArgs: []*ast.NamedArg(nil), NullHandling: &ast.IgnoreNulls{ Ignore: 106, Nulls: 113, }, - Having: nil, }, }, &ast.ExprSelectItem{ @@ -109,8 +95,7 @@ SELECT NameEnd: 134, Name: "ARRAY_AGG", }, - Distinct: false, - Args: []ast.Arg{ + Args: []ast.Arg{ &ast.ExprArg{ Expr: &ast.Ident{ NamePos: 135, @@ -119,12 +104,10 @@ SELECT }, }, }, - NamedArgs: []*ast.NamedArg(nil), NullHandling: &ast.RespectNulls{ Respect: 142, Nulls: 150, }, - Having: nil, }, }, &ast.ExprSelectItem{ @@ -135,8 +118,7 @@ SELECT NameEnd: 171, Name: "ARRAY_AGG", }, - Distinct: false, - Args: []ast.Arg{ + Args: []ast.Arg{ &ast.ExprArg{ Expr: &ast.Ident{ NamePos: 172, @@ -145,7 +127,6 @@ SELECT }, }, }, - NamedArgs: []*ast.NamedArg(nil), NullHandling: &ast.RespectNulls{ Respect: 179, Nulls: 187, @@ -161,12 +142,6 @@ SELECT }, }, }, - From: (*ast.From)(nil), - Where: (*ast.Where)(nil), - GroupBy: (*ast.GroupBy)(nil), - Having: (*ast.Having)(nil), - OrderBy: (*ast.OrderBy)(nil), - Limit: (*ast.Limit)(nil), }, } diff --git a/testdata/result/query/select_album_with_index_directive.sql.txt b/testdata/result/query/select_album_with_index_directive.sql.txt index d919f75e..9e4e6986 100644 --- a/testdata/result/query/select_album_with_index_directive.sql.txt +++ b/testdata/result/query/select_album_with_index_directive.sql.txt @@ -5,13 +5,8 @@ WHERE AlbumTitle >= @startTitle AND AlbumTitle < @endTitle --- AST &ast.QueryStatement{ - Hint: (*ast.Hint)(nil), - With: (*ast.With)(nil), Query: &ast.Select{ - Select: 0, - Distinct: false, - As: nil, - Results: []ast.SelectItem{ + Results: []ast.SelectItem{ &ast.ExprSelectItem{ Expr: &ast.Ident{ NamePos: 7, @@ -60,8 +55,6 @@ WHERE AlbumTitle >= @startTitle AND AlbumTitle < @endTitle }, }, }, - As: (*ast.AsAlias)(nil), - Sample: (*ast.TableSample)(nil), }, }, Where: &ast.Where{ @@ -94,10 +87,6 @@ WHERE AlbumTitle >= @startTitle AND AlbumTitle < @endTitle }, }, }, - GroupBy: (*ast.GroupBy)(nil), - Having: (*ast.Having)(nil), - OrderBy: (*ast.OrderBy)(nil), - Limit: (*ast.Limit)(nil), }, } diff --git a/testdata/result/query/select_alias_without_as.sql.txt b/testdata/result/query/select_alias_without_as.sql.txt index c4604a96..2c446b42 100644 --- a/testdata/result/query/select_alias_without_as.sql.txt +++ b/testdata/result/query/select_alias_without_as.sql.txt @@ -3,13 +3,8 @@ select 1 A --- AST &ast.QueryStatement{ - Hint: (*ast.Hint)(nil), - With: (*ast.With)(nil), Query: &ast.Select{ - Select: 0, - Distinct: false, - As: nil, - Results: []ast.SelectItem{ + Results: []ast.SelectItem{ &ast.Alias{ Expr: &ast.IntLiteral{ ValuePos: 7, @@ -27,12 +22,6 @@ select 1 A }, }, }, - From: (*ast.From)(nil), - Where: (*ast.Where)(nil), - GroupBy: (*ast.GroupBy)(nil), - Having: (*ast.Having)(nil), - OrderBy: (*ast.OrderBy)(nil), - Limit: (*ast.Limit)(nil), }, } diff --git a/testdata/result/query/select_array_with_struct.sql.txt b/testdata/result/query/select_array_with_struct.sql.txt index 32f645d4..752145e7 100644 --- a/testdata/result/query/select_array_with_struct.sql.txt +++ b/testdata/result/query/select_array_with_struct.sql.txt @@ -6,13 +6,8 @@ FROM --- AST &ast.QueryStatement{ - Hint: (*ast.Hint)(nil), - With: (*ast.With)(nil), Query: &ast.Select{ - Select: 0, - Distinct: false, - As: nil, - Results: []ast.SelectItem{ + Results: []ast.SelectItem{ &ast.Star{ Star: 9, }, @@ -91,17 +86,8 @@ FROM }, }, }, - Hint: (*ast.Hint)(nil), - As: (*ast.AsAlias)(nil), - WithOffset: (*ast.WithOffset)(nil), - Sample: (*ast.TableSample)(nil), }, }, - Where: (*ast.Where)(nil), - GroupBy: (*ast.GroupBy)(nil), - Having: (*ast.Having)(nil), - OrderBy: (*ast.OrderBy)(nil), - Limit: (*ast.Limit)(nil), }, } diff --git a/testdata/result/query/select_call_with_named_expr.sql.txt b/testdata/result/query/select_call_with_named_expr.sql.txt index bae8b868..11f82c13 100644 --- a/testdata/result/query/select_call_with_named_expr.sql.txt +++ b/testdata/result/query/select_call_with_named_expr.sql.txt @@ -4,13 +4,8 @@ FROM Albums a WHERE a.SingerId = 1 AND SEARCH(a.DescriptionTokens, 'classic albums', enhance_query => TRUE) --- AST &ast.QueryStatement{ - Hint: (*ast.Hint)(nil), - With: (*ast.With)(nil), Query: &ast.Select{ - Select: 0, - Distinct: false, - As: nil, - Results: []ast.SelectItem{ + Results: []ast.SelectItem{ &ast.ExprSelectItem{ Expr: &ast.Path{ Idents: []*ast.Ident{ @@ -52,8 +47,7 @@ WHERE a.SingerId = 1 AND SEARCH(a.DescriptionTokens, 'classic albums', enhance_q NameEnd: 43, Name: "Albums", }, - Hint: (*ast.Hint)(nil), - As: &ast.AsAlias{ + As: &ast.AsAlias{ As: -1, Alias: &ast.Ident{ NamePos: 44, @@ -61,7 +55,6 @@ WHERE a.SingerId = 1 AND SEARCH(a.DescriptionTokens, 'classic albums', enhance_q Name: "a", }, }, - Sample: (*ast.TableSample)(nil), }, }, Where: &ast.Where{ @@ -98,8 +91,7 @@ WHERE a.SingerId = 1 AND SEARCH(a.DescriptionTokens, 'classic albums', enhance_q NameEnd: 77, Name: "SEARCH", }, - Distinct: false, - Args: []ast.Arg{ + Args: []ast.Arg{ &ast.ExprArg{ Expr: &ast.Path{ Idents: []*ast.Ident{ @@ -137,15 +129,9 @@ WHERE a.SingerId = 1 AND SEARCH(a.DescriptionTokens, 'classic albums', enhance_q }, }, }, - NullHandling: nil, - Having: nil, }, }, }, - GroupBy: (*ast.GroupBy)(nil), - Having: (*ast.Having)(nil), - OrderBy: (*ast.OrderBy)(nil), - Limit: (*ast.Limit)(nil), }, } diff --git a/testdata/result/query/select_cast.sql.txt b/testdata/result/query/select_cast.sql.txt index 84154e99..24f5a754 100644 --- a/testdata/result/query/select_cast.sql.txt +++ b/testdata/result/query/select_cast.sql.txt @@ -7,18 +7,12 @@ limit cast(1 as INT64) offset cast(@foo as INT64) --- AST &ast.QueryStatement{ - Hint: (*ast.Hint)(nil), - With: (*ast.With)(nil), Query: &ast.Select{ - Select: 0, - Distinct: false, - As: nil, - Results: []ast.SelectItem{ + Results: []ast.SelectItem{ &ast.ExprSelectItem{ Expr: &ast.CastExpr{ Cast: 7, Rparen: 22, - Safe: false, Expr: &ast.IntLiteral{ ValuePos: 12, ValueEnd: 13, @@ -35,7 +29,6 @@ limit cast(1 as INT64) offset cast(@foo as INT64) Expr: &ast.CastExpr{ Cast: 25, Rparen: 44, - Safe: false, Expr: &ast.FloatLiteral{ ValuePos: 30, ValueEnd: 33, @@ -51,7 +44,6 @@ limit cast(1 as INT64) offset cast(@foo as INT64) Expr: &ast.CastExpr{ Cast: 47, Rparen: 147, - Safe: false, Expr: &ast.TupleStructLiteral{ Lparen: 52, Rparen: 84, @@ -59,7 +51,6 @@ limit cast(1 as INT64) offset cast(@foo as INT64) &ast.TypelessStructLiteral{ Struct: 53, Rparen: 60, - Values: []ast.TypelessStructLiteralArg(nil), }, &ast.IntLiteral{ ValuePos: 63, @@ -71,7 +62,6 @@ limit cast(1 as INT64) offset cast(@foo as INT64) Array: -1, Lbrack: 66, Rbrack: 71, - Type: nil, Values: []ast.Expr{ &ast.IntLiteral{ ValuePos: 67, @@ -91,7 +81,6 @@ limit cast(1 as INT64) offset cast(@foo as INT64) Array: -1, Lbrack: 74, Rbrack: 83, - Type: nil, Values: []ast.Expr{ &ast.StringLiteral{ ValuePos: 75, @@ -112,11 +101,9 @@ limit cast(1 as INT64) offset cast(@foo as INT64) Gt: 146, Fields: []*ast.StructField{ &ast.StructField{ - Ident: (*ast.Ident)(nil), - Type: &ast.StructType{ + Type: &ast.StructType{ Struct: 96, Gt: 103, - Fields: []*ast.StructField(nil), }, }, &ast.StructField{ @@ -168,21 +155,15 @@ limit cast(1 as INT64) offset cast(@foo as INT64) From: &ast.From{ From: 149, Source: &ast.Join{ - Op: ",", - Method: "", - Hint: (*ast.Hint)(nil), - Left: &ast.Join{ - Op: ",", - Method: "", - Hint: (*ast.Hint)(nil), - Left: &ast.TableName{ + Op: ",", + Left: &ast.Join{ + Op: ",", + Left: &ast.TableName{ Table: &ast.Ident{ NamePos: 154, NameEnd: 155, Name: "x", }, - Hint: (*ast.Hint)(nil), - As: (*ast.AsAlias)(nil), Sample: &ast.TableSample{ TableSample: 156, Method: "BERNOULLI", @@ -209,8 +190,6 @@ limit cast(1 as INT64) offset cast(@foo as INT64) NameEnd: 216, Name: "y", }, - Hint: (*ast.Hint)(nil), - As: (*ast.AsAlias)(nil), Sample: &ast.TableSample{ TableSample: 217, Method: "BERNOULLI", @@ -232,7 +211,6 @@ limit cast(1 as INT64) offset cast(@foo as INT64) }, }, }, - Cond: nil, }, Right: &ast.TableName{ Table: &ast.Ident{ @@ -240,8 +218,6 @@ limit cast(1 as INT64) offset cast(@foo as INT64) NameEnd: 270, Name: "z", }, - Hint: (*ast.Hint)(nil), - As: (*ast.AsAlias)(nil), Sample: &ast.TableSample{ TableSample: 271, Method: "BERNOULLI", @@ -261,14 +237,9 @@ limit cast(1 as INT64) offset cast(@foo as INT64) }, }, }, - Cond: nil, }, }, - Where: (*ast.Where)(nil), - GroupBy: (*ast.GroupBy)(nil), - Having: (*ast.Having)(nil), - OrderBy: (*ast.OrderBy)(nil), - Limit: &ast.Limit{ + Limit: &ast.Limit{ Limit: 322, Count: &ast.CastIntValue{ Cast: 328, diff --git a/testdata/result/query/select_complex_with_array_path.sql.txt b/testdata/result/query/select_complex_with_array_path.sql.txt index 2ce3e66a..cbfb49b5 100644 --- a/testdata/result/query/select_complex_with_array_path.sql.txt +++ b/testdata/result/query/select_complex_with_array_path.sql.txt @@ -7,13 +7,8 @@ FROM --- AST &ast.QueryStatement{ - Hint: (*ast.Hint)(nil), - With: (*ast.With)(nil), Query: &ast.Select{ - Select: 0, - Distinct: false, - As: nil, - Results: []ast.SelectItem{ + Results: []ast.SelectItem{ &ast.Star{ Star: 9, }, @@ -21,18 +16,13 @@ FROM From: &ast.From{ From: 11, Source: &ast.Join{ - Op: ",", - Method: "", - Hint: (*ast.Hint)(nil), - Left: &ast.TableName{ + Op: ",", + Left: &ast.TableName{ Table: &ast.Ident{ NamePos: 18, NameEnd: 30, Name: "ComplexTable", }, - Hint: (*ast.Hint)(nil), - As: (*ast.AsAlias)(nil), - Sample: (*ast.TableSample)(nil), }, Right: &ast.PathTableExpr{ Path: &ast.Path{ @@ -49,19 +39,9 @@ FROM }, }, }, - Hint: (*ast.Hint)(nil), - As: (*ast.AsAlias)(nil), - WithOffset: (*ast.WithOffset)(nil), - Sample: (*ast.TableSample)(nil), }, - Cond: nil, }, }, - Where: (*ast.Where)(nil), - GroupBy: (*ast.GroupBy)(nil), - Having: (*ast.Having)(nil), - OrderBy: (*ast.OrderBy)(nil), - Limit: (*ast.Limit)(nil), }, } diff --git a/testdata/result/query/select_complex_with_unnest_array_path.sql.txt b/testdata/result/query/select_complex_with_unnest_array_path.sql.txt index 200e7d61..5008c0b7 100644 --- a/testdata/result/query/select_complex_with_unnest_array_path.sql.txt +++ b/testdata/result/query/select_complex_with_unnest_array_path.sql.txt @@ -7,13 +7,8 @@ FROM --- AST &ast.QueryStatement{ - Hint: (*ast.Hint)(nil), - With: (*ast.With)(nil), Query: &ast.Select{ - Select: 0, - Distinct: false, - As: nil, - Results: []ast.SelectItem{ + Results: []ast.SelectItem{ &ast.Star{ Star: 9, }, @@ -21,18 +16,13 @@ FROM From: &ast.From{ From: 11, Source: &ast.Join{ - Op: ",", - Method: "", - Hint: (*ast.Hint)(nil), - Left: &ast.TableName{ + Op: ",", + Left: &ast.TableName{ Table: &ast.Ident{ NamePos: 18, NameEnd: 30, Name: "ComplexTable", }, - Hint: (*ast.Hint)(nil), - As: (*ast.AsAlias)(nil), - Sample: (*ast.TableSample)(nil), }, Right: &ast.Unnest{ Unnest: 34, @@ -51,19 +41,9 @@ FROM }, }, }, - Hint: (*ast.Hint)(nil), - As: (*ast.AsAlias)(nil), - WithOffset: (*ast.WithOffset)(nil), - Sample: (*ast.TableSample)(nil), }, - Cond: nil, }, }, - Where: (*ast.Where)(nil), - GroupBy: (*ast.GroupBy)(nil), - Having: (*ast.Having)(nil), - OrderBy: (*ast.OrderBy)(nil), - Limit: (*ast.Limit)(nil), }, } diff --git a/testdata/result/query/select_count_asterisk.sql.txt b/testdata/result/query/select_count_asterisk.sql.txt index 5dcbd0b7..92036b3d 100644 --- a/testdata/result/query/select_count_asterisk.sql.txt +++ b/testdata/result/query/select_count_asterisk.sql.txt @@ -3,13 +3,8 @@ select count(*) from singers --- AST &ast.QueryStatement{ - Hint: (*ast.Hint)(nil), - With: (*ast.With)(nil), Query: &ast.Select{ - Select: 0, - Distinct: false, - As: nil, - Results: []ast.SelectItem{ + Results: []ast.SelectItem{ &ast.ExprSelectItem{ Expr: &ast.CountStarExpr{ Count: 7, @@ -25,16 +20,8 @@ select count(*) from singers NameEnd: 28, Name: "singers", }, - Hint: (*ast.Hint)(nil), - As: (*ast.AsAlias)(nil), - Sample: (*ast.TableSample)(nil), }, }, - Where: (*ast.Where)(nil), - GroupBy: (*ast.GroupBy)(nil), - Having: (*ast.Having)(nil), - OrderBy: (*ast.OrderBy)(nil), - Limit: (*ast.Limit)(nil), }, } diff --git a/testdata/result/query/select_count_distinct.sql.txt b/testdata/result/query/select_count_distinct.sql.txt index 76755e4a..f32ac131 100644 --- a/testdata/result/query/select_count_distinct.sql.txt +++ b/testdata/result/query/select_count_distinct.sql.txt @@ -2,13 +2,8 @@ select count(distinct x) from foo --- AST &ast.QueryStatement{ - Hint: (*ast.Hint)(nil), - With: (*ast.With)(nil), Query: &ast.Select{ - Select: 0, - Distinct: false, - As: nil, - Results: []ast.SelectItem{ + Results: []ast.SelectItem{ &ast.ExprSelectItem{ Expr: &ast.CallExpr{ Rparen: 23, @@ -27,9 +22,6 @@ select count(distinct x) from foo }, }, }, - NamedArgs: []*ast.NamedArg(nil), - NullHandling: nil, - Having: nil, }, }, }, @@ -41,16 +33,8 @@ select count(distinct x) from foo NameEnd: 33, Name: "foo", }, - Hint: (*ast.Hint)(nil), - As: (*ast.AsAlias)(nil), - Sample: (*ast.TableSample)(nil), }, }, - Where: (*ast.Where)(nil), - GroupBy: (*ast.GroupBy)(nil), - Having: (*ast.Having)(nil), - OrderBy: (*ast.OrderBy)(nil), - Limit: (*ast.Limit)(nil), }, } diff --git a/testdata/result/query/select_expr.sql.txt b/testdata/result/query/select_expr.sql.txt index 21b2ce8d..9d6dad5a 100644 --- a/testdata/result/query/select_expr.sql.txt +++ b/testdata/result/query/select_expr.sql.txt @@ -31,13 +31,8 @@ select 1 + 2, 1 - 2, --- AST &ast.QueryStatement{ - Hint: (*ast.Hint)(nil), - With: (*ast.With)(nil), Query: &ast.Select{ - Select: 0, - Distinct: false, - As: nil, - Results: []ast.SelectItem{ + Results: []ast.SelectItem{ &ast.ExprSelectItem{ Expr: &ast.BinaryExpr{ Op: "+", @@ -328,10 +323,8 @@ select 1 + 2, 1 - 2, Lparen: 194, Rparen: 207, Query: &ast.Select{ - Select: 195, - Distinct: false, - As: nil, - Results: []ast.SelectItem{ + Select: 195, + Results: []ast.SelectItem{ &ast.Alias{ Expr: &ast.IntLiteral{ ValuePos: 202, @@ -349,12 +342,6 @@ select 1 + 2, 1 - 2, }, }, }, - From: (*ast.From)(nil), - Where: (*ast.Where)(nil), - GroupBy: (*ast.GroupBy)(nil), - Having: (*ast.Having)(nil), - OrderBy: (*ast.OrderBy)(nil), - Limit: (*ast.Limit)(nil), }, }, Ident: &ast.Ident{ @@ -385,7 +372,6 @@ select 1 + 2, 1 - 2, Array: -1, Lbrack: 240, Rbrack: 248, - Type: nil, Values: []ast.Expr{ &ast.IntLiteral{ ValuePos: 241, @@ -427,7 +413,6 @@ select 1 + 2, 1 - 2, Array: -1, Lbrack: 269, Rbrack: 277, - Type: nil, Values: []ast.Expr{ &ast.IntLiteral{ ValuePos: 270, @@ -469,7 +454,6 @@ select 1 + 2, 1 - 2, Array: -1, Lbrack: 300, Rbrack: 308, - Type: nil, Values: []ast.Expr{ &ast.IntLiteral{ ValuePos: 301, @@ -508,7 +492,6 @@ select 1 + 2, 1 - 2, Expr: &ast.CaseExpr{ Case: 330, EndPos: 403, - Expr: nil, Whens: []*ast.CaseWhen{ &ast.CaseWhen{ When: 342, @@ -602,8 +585,7 @@ select 1 + 2, 1 - 2, NameEnd: 522, Name: "date_add", }, - Distinct: false, - Args: []ast.Arg{ + Args: []ast.Arg{ &ast.ExprArg{ Expr: &ast.DateLiteral{ Date: 523, @@ -629,9 +611,6 @@ select 1 + 2, 1 - 2, }, }, }, - NamedArgs: []*ast.NamedArg(nil), - NullHandling: nil, - Having: nil, }, }, &ast.ExprSelectItem{ @@ -642,8 +621,7 @@ select 1 + 2, 1 - 2, NameEnd: 579, Name: "timestamp_add", }, - Distinct: false, - Args: []ast.Arg{ + Args: []ast.Arg{ &ast.ExprArg{ Expr: &ast.TimestampLiteral{ Timestamp: 580, @@ -669,14 +647,10 @@ select 1 + 2, 1 - 2, }, }, }, - NamedArgs: []*ast.NamedArg(nil), - NullHandling: nil, - Having: nil, }, }, &ast.ExprSelectItem{ Expr: &ast.InExpr{ - Not: false, Left: &ast.IntLiteral{ ValuePos: 638, ValueEnd: 639, @@ -711,7 +685,6 @@ select 1 + 2, 1 - 2, }, &ast.ExprSelectItem{ Expr: &ast.InExpr{ - Not: false, Left: &ast.IntLiteral{ ValuePos: 661, ValueEnd: 662, @@ -725,7 +698,6 @@ select 1 + 2, 1 - 2, Array: -1, Lbrack: 673, Rbrack: 681, - Type: nil, Values: []ast.Expr{ &ast.IntLiteral{ ValuePos: 674, @@ -752,7 +724,6 @@ select 1 + 2, 1 - 2, }, &ast.ExprSelectItem{ Expr: &ast.InExpr{ - Not: false, Left: &ast.IntLiteral{ ValuePos: 692, ValueEnd: 693, @@ -763,14 +734,11 @@ select 1 + 2, 1 - 2, Lparen: 697, Rparen: 744, Query: &ast.CompoundQuery{ - Op: "UNION", - Distinct: false, - Queries: []ast.QueryExpr{ + Op: "UNION", + Queries: []ast.QueryExpr{ &ast.Select{ - Select: 698, - Distinct: false, - As: nil, - Results: []ast.SelectItem{ + Select: 698, + Results: []ast.SelectItem{ &ast.ExprSelectItem{ Expr: &ast.IntLiteral{ ValuePos: 705, @@ -780,18 +748,10 @@ select 1 + 2, 1 - 2, }, }, }, - From: (*ast.From)(nil), - Where: (*ast.Where)(nil), - GroupBy: (*ast.GroupBy)(nil), - Having: (*ast.Having)(nil), - OrderBy: (*ast.OrderBy)(nil), - Limit: (*ast.Limit)(nil), }, &ast.Select{ - Select: 717, - Distinct: false, - As: nil, - Results: []ast.SelectItem{ + Select: 717, + Results: []ast.SelectItem{ &ast.ExprSelectItem{ Expr: &ast.IntLiteral{ ValuePos: 724, @@ -801,18 +761,10 @@ select 1 + 2, 1 - 2, }, }, }, - From: (*ast.From)(nil), - Where: (*ast.Where)(nil), - GroupBy: (*ast.GroupBy)(nil), - Having: (*ast.Having)(nil), - OrderBy: (*ast.OrderBy)(nil), - Limit: (*ast.Limit)(nil), }, &ast.Select{ - Select: 736, - Distinct: false, - As: nil, - Results: []ast.SelectItem{ + Select: 736, + Results: []ast.SelectItem{ &ast.ExprSelectItem{ Expr: &ast.IntLiteral{ ValuePos: 743, @@ -822,16 +774,8 @@ select 1 + 2, 1 - 2, }, }, }, - From: (*ast.From)(nil), - Where: (*ast.Where)(nil), - GroupBy: (*ast.GroupBy)(nil), - Having: (*ast.Having)(nil), - OrderBy: (*ast.OrderBy)(nil), - Limit: (*ast.Limit)(nil), }, }, - OrderBy: (*ast.OrderBy)(nil), - Limit: (*ast.Limit)(nil), }, }, }, @@ -843,7 +787,6 @@ select 1 + 2, 1 - 2, Array: -1, Lbrack: 754, Rbrack: 756, - Type: nil, Values: []ast.Expr{ &ast.IntLiteral{ ValuePos: 755, @@ -857,7 +800,6 @@ select 1 + 2, 1 - 2, Array: -1, Lbrack: 761, Rbrack: 763, - Type: nil, Values: []ast.Expr{ &ast.IntLiteral{ ValuePos: 762, @@ -920,12 +862,6 @@ select 1 + 2, 1 - 2, }, }, }, - From: (*ast.From)(nil), - Where: (*ast.Where)(nil), - GroupBy: (*ast.GroupBy)(nil), - Having: (*ast.Having)(nil), - OrderBy: (*ast.OrderBy)(nil), - Limit: (*ast.Limit)(nil), }, } diff --git a/testdata/result/query/select_expr_extract.sql.txt b/testdata/result/query/select_expr_extract.sql.txt index 3ecdd405..788ea52f 100644 --- a/testdata/result/query/select_expr_extract.sql.txt +++ b/testdata/result/query/select_expr_extract.sql.txt @@ -21,13 +21,8 @@ select --- AST &ast.QueryStatement{ - Hint: (*ast.Hint)(nil), - With: (*ast.With)(nil), Query: &ast.Select{ - Select: 0, - Distinct: false, - As: nil, - Results: []ast.SelectItem{ + Results: []ast.SelectItem{ &ast.ExprSelectItem{ Expr: &ast.ExtractExpr{ Extract: 11, @@ -45,7 +40,6 @@ select Value: "2019-09-01 08:11:23", }, }, - AtTimeZone: (*ast.AtTimeZone)(nil), }, }, &ast.ExprSelectItem{ @@ -65,7 +59,6 @@ select Value: "2019-09-01 08:11:23", }, }, - AtTimeZone: (*ast.AtTimeZone)(nil), }, }, &ast.ExprSelectItem{ @@ -85,7 +78,6 @@ select Value: "2019-09-01 08:11:23", }, }, - AtTimeZone: (*ast.AtTimeZone)(nil), }, }, &ast.ExprSelectItem{ @@ -105,7 +97,6 @@ select Value: "2019-09-01 08:11:23", }, }, - AtTimeZone: (*ast.AtTimeZone)(nil), }, }, &ast.ExprSelectItem{ @@ -125,7 +116,6 @@ select Value: "2019-09-01 08:11:23", }, }, - AtTimeZone: (*ast.AtTimeZone)(nil), }, }, &ast.ExprSelectItem{ @@ -145,7 +135,6 @@ select Value: "2019-09-01 08:11:23", }, }, - AtTimeZone: (*ast.AtTimeZone)(nil), }, }, &ast.ExprSelectItem{ @@ -165,7 +154,6 @@ select Value: "2019-09-01", }, }, - AtTimeZone: (*ast.AtTimeZone)(nil), }, }, &ast.ExprSelectItem{ @@ -185,7 +173,6 @@ select Value: "2019-09-01", }, }, - AtTimeZone: (*ast.AtTimeZone)(nil), }, }, &ast.ExprSelectItem{ @@ -205,7 +192,6 @@ select Value: "2019-09-01", }, }, - AtTimeZone: (*ast.AtTimeZone)(nil), }, }, &ast.ExprSelectItem{ @@ -225,7 +211,6 @@ select Value: "2019-09-01", }, }, - AtTimeZone: (*ast.AtTimeZone)(nil), }, }, &ast.ExprSelectItem{ @@ -245,7 +230,6 @@ select Value: "2019-09-01", }, }, - AtTimeZone: (*ast.AtTimeZone)(nil), }, }, &ast.ExprSelectItem{ @@ -265,7 +249,6 @@ select Value: "2019-09-01", }, }, - AtTimeZone: (*ast.AtTimeZone)(nil), }, }, &ast.ExprSelectItem{ @@ -285,7 +268,6 @@ select Value: "2019-09-01", }, }, - AtTimeZone: (*ast.AtTimeZone)(nil), }, }, &ast.ExprSelectItem{ @@ -305,7 +287,6 @@ select Value: "2019-09-01", }, }, - AtTimeZone: (*ast.AtTimeZone)(nil), }, }, &ast.ExprSelectItem{ @@ -325,7 +306,6 @@ select Value: "2019-09-01", }, }, - AtTimeZone: (*ast.AtTimeZone)(nil), }, }, &ast.ExprSelectItem{ @@ -345,7 +325,6 @@ select Value: "2019-09-01", }, }, - AtTimeZone: (*ast.AtTimeZone)(nil), }, }, &ast.ExprSelectItem{ @@ -365,7 +344,6 @@ select Value: "2019-09-01 08:11:23", }, }, - AtTimeZone: (*ast.AtTimeZone)(nil), }, }, &ast.ExprSelectItem{ @@ -396,12 +374,6 @@ select }, }, }, - From: (*ast.From)(nil), - Where: (*ast.Where)(nil), - GroupBy: (*ast.GroupBy)(nil), - Having: (*ast.Having)(nil), - OrderBy: (*ast.OrderBy)(nil), - Limit: (*ast.Limit)(nil), }, } diff --git a/testdata/result/query/select_from_implicit_unnest.sql.txt b/testdata/result/query/select_from_implicit_unnest.sql.txt index f1d12b88..06a9e39a 100644 --- a/testdata/result/query/select_from_implicit_unnest.sql.txt +++ b/testdata/result/query/select_from_implicit_unnest.sql.txt @@ -4,13 +4,8 @@ FROM UNNEST([STRUCT>(["foo"])]) AS t, t.arr AS a WITH OFFSET AS off --- AST &ast.QueryStatement{ - Hint: (*ast.Hint)(nil), - With: (*ast.With)(nil), Query: &ast.Select{ - Select: 0, - Distinct: false, - As: nil, - Results: []ast.SelectItem{ + Results: []ast.SelectItem{ &ast.ExprSelectItem{ Expr: &ast.Ident{ NamePos: 7, @@ -29,17 +24,14 @@ FROM UNNEST([STRUCT>(["foo"])]) AS t, From: &ast.From{ From: 14, Source: &ast.Join{ - Op: ",", - Method: "", - Hint: (*ast.Hint)(nil), - Left: &ast.Unnest{ + Op: ",", + Left: &ast.Unnest{ Unnest: 19, Rparen: 62, Expr: &ast.ArrayLiteral{ Array: -1, Lbrack: 26, Rbrack: 61, - Type: nil, Values: []ast.Expr{ &ast.TypedStructLiteral{ Struct: 27, @@ -66,7 +58,6 @@ FROM UNNEST([STRUCT>(["foo"])]) AS t, Array: -1, Lbrack: 53, Rbrack: 59, - Type: nil, Values: []ast.Expr{ &ast.StringLiteral{ ValuePos: 54, @@ -79,8 +70,7 @@ FROM UNNEST([STRUCT>(["foo"])]) AS t, }, }, }, - Hint: (*ast.Hint)(nil), - As: &ast.AsAlias{ + As: &ast.AsAlias{ As: 64, Alias: &ast.Ident{ NamePos: 67, @@ -88,8 +78,6 @@ FROM UNNEST([STRUCT>(["foo"])]) AS t, Name: "t", }, }, - WithOffset: (*ast.WithOffset)(nil), - Sample: (*ast.TableSample)(nil), }, Right: &ast.PathTableExpr{ Path: &ast.Path{ @@ -106,8 +94,7 @@ FROM UNNEST([STRUCT>(["foo"])]) AS t, }, }, }, - Hint: (*ast.Hint)(nil), - As: &ast.AsAlias{ + As: &ast.AsAlias{ As: 81, Alias: &ast.Ident{ NamePos: 84, @@ -127,16 +114,9 @@ FROM UNNEST([STRUCT>(["foo"])]) AS t, }, }, }, - Sample: (*ast.TableSample)(nil), }, - Cond: nil, }, }, - Where: (*ast.Where)(nil), - GroupBy: (*ast.GroupBy)(nil), - Having: (*ast.Having)(nil), - OrderBy: (*ast.OrderBy)(nil), - Limit: (*ast.Limit)(nil), }, } diff --git a/testdata/result/query/select_from_path.sql.txt b/testdata/result/query/select_from_path.sql.txt index d58a1d70..d2ce6e21 100644 --- a/testdata/result/query/select_from_path.sql.txt +++ b/testdata/result/query/select_from_path.sql.txt @@ -5,13 +5,8 @@ FROM INFORMATION_SCHEMA.TABLES AS t TABLESAMPLE RESERVOIR (10 ROWS) --- AST &ast.QueryStatement{ - Hint: (*ast.Hint)(nil), - With: (*ast.With)(nil), Query: &ast.Select{ - Select: 0, - Distinct: false, - As: nil, - Results: []ast.SelectItem{ + Results: []ast.SelectItem{ &ast.Star{ Star: 9, }, @@ -33,8 +28,7 @@ FROM }, }, }, - Hint: (*ast.Hint)(nil), - As: &ast.AsAlias{ + As: &ast.AsAlias{ As: 44, Alias: &ast.Ident{ NamePos: 47, @@ -42,8 +36,7 @@ FROM Name: "t", }, }, - WithOffset: (*ast.WithOffset)(nil), - Sample: &ast.TableSample{ + Sample: &ast.TableSample{ TableSample: 49, Method: "RESERVOIR", Size: &ast.TableSampleSize{ @@ -60,11 +53,6 @@ FROM }, }, }, - Where: (*ast.Where)(nil), - GroupBy: (*ast.GroupBy)(nil), - Having: (*ast.Having)(nil), - OrderBy: (*ast.OrderBy)(nil), - Limit: (*ast.Limit)(nil), }, } diff --git a/testdata/result/query/select_hint.sql.txt b/testdata/result/query/select_hint.sql.txt index de37c85f..374f27f1 100644 --- a/testdata/result/query/select_hint.sql.txt +++ b/testdata/result/query/select_hint.sql.txt @@ -3,7 +3,6 @@ --- AST &ast.QueryStatement{ Hint: &ast.Hint{ - Atmark: 0, Rbrace: 22, Records: []*ast.HintRecord{ &ast.HintRecord{ @@ -34,12 +33,9 @@ }, }, }, - With: (*ast.With)(nil), Query: &ast.Select{ - Select: 24, - Distinct: false, - As: nil, - Results: []ast.SelectItem{ + Select: 24, + Results: []ast.SelectItem{ &ast.ExprSelectItem{ Expr: &ast.Ident{ NamePos: 31, @@ -48,12 +44,6 @@ }, }, }, - From: (*ast.From)(nil), - Where: (*ast.Where)(nil), - GroupBy: (*ast.GroupBy)(nil), - Having: (*ast.Having)(nil), - OrderBy: (*ast.OrderBy)(nil), - Limit: (*ast.Limit)(nil), }, } diff --git a/testdata/result/query/select_literals_all.sql.txt b/testdata/result/query/select_literals_all.sql.txt index 17137993..da902945 100644 --- a/testdata/result/query/select_literals_all.sql.txt +++ b/testdata/result/query/select_literals_all.sql.txt @@ -49,13 +49,8 @@ lines''', true, false --- AST &ast.QueryStatement{ - Hint: (*ast.Hint)(nil), - With: (*ast.With)(nil), Query: &ast.Select{ - Select: 0, - Distinct: false, - As: nil, - Results: []ast.SelectItem{ + Results: []ast.SelectItem{ &ast.ExprSelectItem{ Expr: &ast.StringLiteral{ ValuePos: 9, @@ -152,7 +147,7 @@ lines''', ValuePos: 204, ValueEnd: 210, Value: []uint8{ - 0x61, 0x62, 0x63, + 97, 98, 99, }, }, }, @@ -161,7 +156,7 @@ lines''', ValuePos: 214, ValueEnd: 224, Value: []uint8{ - 0x61, 0x62, 0x63, + 97, 98, 99, }, }, }, @@ -170,7 +165,7 @@ lines''', ValuePos: 228, ValueEnd: 238, Value: []uint8{ - 0x61, 0x62, 0x63, + 97, 98, 99, }, }, }, @@ -179,7 +174,7 @@ lines''', ValuePos: 242, ValueEnd: 250, Value: []uint8{ - 0x61, 0x62, 0x63, 0x2b, + 97, 98, 99, 43, }, }, }, @@ -188,7 +183,7 @@ lines''', ValuePos: 254, ValueEnd: 262, Value: []uint8{ - 0x61, 0x62, 0x63, 0x2b, + 97, 98, 99, 43, }, }, }, @@ -197,7 +192,7 @@ lines''', ValuePos: 266, ValueEnd: 277, Value: []uint8{ - 0x61, 0x62, 0x63, + 97, 98, 99, }, }, }, @@ -266,7 +261,6 @@ lines''', Array: -1, Lbrack: 352, Rbrack: 360, - Type: nil, Values: []ast.Expr{ &ast.IntLiteral{ ValuePos: 353, @@ -294,7 +288,6 @@ lines''', Array: -1, Lbrack: 365, Rbrack: 380, - Type: nil, Values: []ast.Expr{ &ast.StringLiteral{ ValuePos: 366, @@ -319,7 +312,6 @@ lines''', Array: 385, Lbrack: 390, Rbrack: 398, - Type: nil, Values: []ast.Expr{ &ast.IntLiteral{ ValuePos: 391, @@ -379,7 +371,6 @@ lines''', NamePos: 442, Name: "INT64", }, - Values: []ast.Expr(nil), }, }, &ast.ExprSelectItem{ @@ -387,10 +378,8 @@ lines''', Array: 454, Rparen: 482, Query: &ast.Select{ - Select: 460, - Distinct: false, - As: nil, - Results: []ast.SelectItem{ + Select: 460, + Results: []ast.SelectItem{ &ast.ExprSelectItem{ Expr: &ast.TypelessStructLiteral{ Struct: 467, @@ -424,12 +413,6 @@ lines''', }, }, }, - From: (*ast.From)(nil), - Where: (*ast.Where)(nil), - GroupBy: (*ast.GroupBy)(nil), - Having: (*ast.Having)(nil), - OrderBy: (*ast.OrderBy)(nil), - Limit: (*ast.Limit)(nil), }, }, }, @@ -438,10 +421,8 @@ lines''', Array: 487, Rparen: 509, Query: &ast.Select{ - Select: 493, - Distinct: false, - As: nil, - Results: []ast.SelectItem{ + Select: 493, + Results: []ast.SelectItem{ &ast.ExprSelectItem{ Expr: &ast.TupleStructLiteral{ Lparen: 500, @@ -469,12 +450,6 @@ lines''', }, }, }, - From: (*ast.From)(nil), - Where: (*ast.Where)(nil), - GroupBy: (*ast.GroupBy)(nil), - Having: (*ast.Having)(nil), - OrderBy: (*ast.OrderBy)(nil), - Limit: (*ast.Limit)(nil), }, }, }, @@ -496,8 +471,7 @@ lines''', NameEnd: 539, Name: "DATE", }, - Distinct: false, - Args: []ast.Arg{ + Args: []ast.Arg{ &ast.ExprArg{ Expr: &ast.StringLiteral{ ValuePos: 540, @@ -506,9 +480,6 @@ lines''', }, }, }, - NamedArgs: []*ast.NamedArg(nil), - NullHandling: nil, - Having: nil, }, }, &ast.ExprSelectItem{ @@ -549,8 +520,7 @@ lines''', NameEnd: 690, Name: "TIMESTAMP", }, - Distinct: false, - Args: []ast.Arg{ + Args: []ast.Arg{ &ast.ExprArg{ Expr: &ast.StringLiteral{ ValuePos: 691, @@ -559,9 +529,6 @@ lines''', }, }, }, - NamedArgs: []*ast.NamedArg(nil), - NullHandling: nil, - Having: nil, }, }, &ast.ExprSelectItem{ @@ -623,16 +590,9 @@ lines''', &ast.ExprSelectItem{ Expr: &ast.BoolLiteral{ ValuePos: 785, - Value: false, }, }, }, - From: (*ast.From)(nil), - Where: (*ast.Where)(nil), - GroupBy: (*ast.GroupBy)(nil), - Having: (*ast.Having)(nil), - OrderBy: (*ast.OrderBy)(nil), - Limit: (*ast.Limit)(nil), }, } diff --git a/testdata/result/query/select_literals_array.sql.txt b/testdata/result/query/select_literals_array.sql.txt index 5955dc62..24ad47f4 100644 --- a/testdata/result/query/select_literals_array.sql.txt +++ b/testdata/result/query/select_literals_array.sql.txt @@ -8,19 +8,13 @@ SELECT --- AST &ast.QueryStatement{ - Hint: (*ast.Hint)(nil), - With: (*ast.With)(nil), Query: &ast.Select{ - Select: 0, - Distinct: false, - As: nil, - Results: []ast.SelectItem{ + Results: []ast.SelectItem{ &ast.ExprSelectItem{ Expr: &ast.ArrayLiteral{ Array: -1, Lbrack: 9, Rbrack: 17, - Type: nil, Values: []ast.Expr{ &ast.IntLiteral{ ValuePos: 10, @@ -48,7 +42,6 @@ SELECT Array: -1, Lbrack: 22, Rbrack: 37, - Type: nil, Values: []ast.Expr{ &ast.StringLiteral{ ValuePos: 23, @@ -73,7 +66,6 @@ SELECT Array: 42, Lbrack: 47, Rbrack: 55, - Type: nil, Values: []ast.Expr{ &ast.IntLiteral{ ValuePos: 48, @@ -133,16 +125,9 @@ SELECT NamePos: 99, Name: "INT64", }, - Values: []ast.Expr(nil), }, }, }, - From: (*ast.From)(nil), - Where: (*ast.Where)(nil), - GroupBy: (*ast.GroupBy)(nil), - Having: (*ast.Having)(nil), - OrderBy: (*ast.OrderBy)(nil), - Limit: (*ast.Limit)(nil), }, } diff --git a/testdata/result/query/select_literals_array_invalid.sql.txt b/testdata/result/query/select_literals_array_invalid.sql.txt index 2ffd9a3e..c4c94b67 100644 --- a/testdata/result/query/select_literals_array_invalid.sql.txt +++ b/testdata/result/query/select_literals_array_invalid.sql.txt @@ -4,25 +4,18 @@ SELECT --- AST &ast.QueryStatement{ - Hint: (*ast.Hint)(nil), - With: (*ast.With)(nil), Query: &ast.Select{ - Select: 0, - Distinct: false, - As: nil, - Results: []ast.SelectItem{ + Results: []ast.SelectItem{ &ast.ExprSelectItem{ Expr: &ast.ArrayLiteral{ Array: -1, Lbrack: 9, Rbrack: 41, - Type: nil, Values: []ast.Expr{ &ast.ArrayLiteral{ Array: -1, Lbrack: 10, Rbrack: 18, - Type: nil, Values: []ast.Expr{ &ast.IntLiteral{ ValuePos: 11, @@ -48,7 +41,6 @@ SELECT Array: -1, Lbrack: 21, Rbrack: 29, - Type: nil, Values: []ast.Expr{ &ast.IntLiteral{ ValuePos: 22, @@ -74,7 +66,6 @@ SELECT Array: -1, Lbrack: 32, Rbrack: 40, - Type: nil, Values: []ast.Expr{ &ast.IntLiteral{ ValuePos: 33, @@ -100,12 +91,6 @@ SELECT }, }, }, - From: (*ast.From)(nil), - Where: (*ast.Where)(nil), - GroupBy: (*ast.GroupBy)(nil), - Having: (*ast.Having)(nil), - OrderBy: (*ast.OrderBy)(nil), - Limit: (*ast.Limit)(nil), }, } diff --git a/testdata/result/query/select_literals_bytes.sql.txt b/testdata/result/query/select_literals_bytes.sql.txt index 09b7dbee..498b1214 100644 --- a/testdata/result/query/select_literals_bytes.sql.txt +++ b/testdata/result/query/select_literals_bytes.sql.txt @@ -13,19 +13,14 @@ SELECT --- AST &ast.QueryStatement{ - Hint: (*ast.Hint)(nil), - With: (*ast.With)(nil), Query: &ast.Select{ - Select: 0, - Distinct: false, - As: nil, - Results: []ast.SelectItem{ + Results: []ast.SelectItem{ &ast.ExprSelectItem{ Expr: &ast.BytesLiteral{ ValuePos: 9, ValueEnd: 15, Value: []uint8{ - 0x61, 0x62, 0x63, + 97, 98, 99, }, }, }, @@ -34,7 +29,7 @@ SELECT ValuePos: 19, ValueEnd: 29, Value: []uint8{ - 0x61, 0x62, 0x63, + 97, 98, 99, }, }, }, @@ -43,7 +38,7 @@ SELECT ValuePos: 33, ValueEnd: 43, Value: []uint8{ - 0x61, 0x62, 0x63, + 97, 98, 99, }, }, }, @@ -52,7 +47,7 @@ SELECT ValuePos: 47, ValueEnd: 59, Value: []uint8{ - 0x61, 0x62, 0x63, 0x0a, + 97, 98, 99, 10, }, }, }, @@ -61,7 +56,7 @@ SELECT ValuePos: 63, ValueEnd: 71, Value: []uint8{ - 0x61, 0x62, 0x63, 0x2b, + 97, 98, 99, 43, }, }, }, @@ -70,7 +65,7 @@ SELECT ValuePos: 75, ValueEnd: 83, Value: []uint8{ - 0x61, 0x62, 0x63, 0x2b, + 97, 98, 99, 43, }, }, }, @@ -79,7 +74,7 @@ SELECT ValuePos: 87, ValueEnd: 98, Value: []uint8{ - 0x61, 0x62, 0x63, + 97, 98, 99, }, }, }, @@ -88,7 +83,7 @@ SELECT ValuePos: 102, ValueEnd: 115, Value: []uint8{ - 0x61, 0x62, 0x63, 0x5c, 0x6e, + 97, 98, 99, 92, 110, }, }, }, @@ -97,7 +92,7 @@ SELECT ValuePos: 119, ValueEnd: 126, Value: []uint8{ - 0x00, + 0, }, }, }, @@ -106,17 +101,11 @@ SELECT ValuePos: 130, ValueEnd: 145, Value: []uint8{ - 0x3f, 0x3f, 0x3f, + 63, 63, 63, }, }, }, }, - From: (*ast.From)(nil), - Where: (*ast.Where)(nil), - GroupBy: (*ast.GroupBy)(nil), - Having: (*ast.Having)(nil), - OrderBy: (*ast.OrderBy)(nil), - Limit: (*ast.Limit)(nil), }, } diff --git a/testdata/result/query/select_literals_date.sql.txt b/testdata/result/query/select_literals_date.sql.txt index 7d21137b..fafc2985 100644 --- a/testdata/result/query/select_literals_date.sql.txt +++ b/testdata/result/query/select_literals_date.sql.txt @@ -13,13 +13,8 @@ SELECT --- AST &ast.QueryStatement{ - Hint: (*ast.Hint)(nil), - With: (*ast.With)(nil), Query: &ast.Select{ - Select: 0, - Distinct: false, - As: nil, - Results: []ast.SelectItem{ + Results: []ast.SelectItem{ &ast.ExprSelectItem{ Expr: &ast.DateLiteral{ Date: 9, @@ -38,8 +33,7 @@ SELECT NameEnd: 33, Name: "DATE", }, - Distinct: false, - Args: []ast.Arg{ + Args: []ast.Arg{ &ast.ExprArg{ Expr: &ast.StringLiteral{ ValuePos: 34, @@ -48,9 +42,6 @@ SELECT }, }, }, - NamedArgs: []*ast.NamedArg(nil), - NullHandling: nil, - Having: nil, }, }, &ast.ExprSelectItem{ @@ -101,8 +92,7 @@ SELECT NameEnd: 206, Name: "TIMESTAMP", }, - Distinct: false, - Args: []ast.Arg{ + Args: []ast.Arg{ &ast.ExprArg{ Expr: &ast.StringLiteral{ ValuePos: 207, @@ -111,9 +101,6 @@ SELECT }, }, }, - NamedArgs: []*ast.NamedArg(nil), - NullHandling: nil, - Having: nil, }, }, &ast.ExprSelectItem{ @@ -134,8 +121,7 @@ SELECT NameEnd: 255, Name: "DATE", }, - Distinct: false, - Args: []ast.Arg{ + Args: []ast.Arg{ &ast.ExprArg{ Expr: &ast.StringLiteral{ ValuePos: 256, @@ -144,9 +130,6 @@ SELECT }, }, }, - NamedArgs: []*ast.NamedArg(nil), - NullHandling: nil, - Having: nil, }, As: &ast.AsAlias{ As: 270, @@ -165,8 +148,7 @@ SELECT NameEnd: 289, Name: "TIMESTAMP", }, - Distinct: false, - Args: []ast.Arg{ + Args: []ast.Arg{ &ast.ExprArg{ Expr: &ast.StringLiteral{ ValuePos: 290, @@ -175,9 +157,6 @@ SELECT }, }, }, - NamedArgs: []*ast.NamedArg(nil), - NullHandling: nil, - Having: nil, }, As: &ast.AsAlias{ As: 304, @@ -189,12 +168,6 @@ SELECT }, }, }, - From: (*ast.From)(nil), - Where: (*ast.Where)(nil), - GroupBy: (*ast.GroupBy)(nil), - Having: (*ast.Having)(nil), - OrderBy: (*ast.OrderBy)(nil), - Limit: (*ast.Limit)(nil), }, } diff --git a/testdata/result/query/select_literals_float.sql.txt b/testdata/result/query/select_literals_float.sql.txt index 1f90c1d9..3ccf54f0 100644 --- a/testdata/result/query/select_literals_float.sql.txt +++ b/testdata/result/query/select_literals_float.sql.txt @@ -7,13 +7,8 @@ SELECT --- AST &ast.QueryStatement{ - Hint: (*ast.Hint)(nil), - With: (*ast.With)(nil), Query: &ast.Select{ - Select: 0, - Distinct: false, - As: nil, - Results: []ast.SelectItem{ + Results: []ast.SelectItem{ &ast.ExprSelectItem{ Expr: &ast.FloatLiteral{ ValuePos: 9, @@ -43,12 +38,6 @@ SELECT }, }, }, - From: (*ast.From)(nil), - Where: (*ast.Where)(nil), - GroupBy: (*ast.GroupBy)(nil), - Having: (*ast.Having)(nil), - OrderBy: (*ast.OrderBy)(nil), - Limit: (*ast.Limit)(nil), }, } diff --git a/testdata/result/query/select_literals_int.sql.txt b/testdata/result/query/select_literals_int.sql.txt index 4634fef4..385b2f03 100644 --- a/testdata/result/query/select_literals_int.sql.txt +++ b/testdata/result/query/select_literals_int.sql.txt @@ -7,13 +7,8 @@ SELECT --- AST &ast.QueryStatement{ - Hint: (*ast.Hint)(nil), - With: (*ast.With)(nil), Query: &ast.Select{ - Select: 0, - Distinct: false, - As: nil, - Results: []ast.SelectItem{ + Results: []ast.SelectItem{ &ast.ExprSelectItem{ Expr: &ast.IntLiteral{ ValuePos: 9, @@ -47,12 +42,6 @@ SELECT }, }, }, - From: (*ast.From)(nil), - Where: (*ast.Where)(nil), - GroupBy: (*ast.GroupBy)(nil), - Having: (*ast.Having)(nil), - OrderBy: (*ast.OrderBy)(nil), - Limit: (*ast.Limit)(nil), }, } diff --git a/testdata/result/query/select_literals_paren.sql.txt b/testdata/result/query/select_literals_paren.sql.txt index 34ae9052..5c845ef2 100644 --- a/testdata/result/query/select_literals_paren.sql.txt +++ b/testdata/result/query/select_literals_paren.sql.txt @@ -3,13 +3,8 @@ SELECT (1) --- AST &ast.QueryStatement{ - Hint: (*ast.Hint)(nil), - With: (*ast.With)(nil), Query: &ast.Select{ - Select: 0, - Distinct: false, - As: nil, - Results: []ast.SelectItem{ + Results: []ast.SelectItem{ &ast.ExprSelectItem{ Expr: &ast.ParenExpr{ Lparen: 7, @@ -23,12 +18,6 @@ SELECT (1) }, }, }, - From: (*ast.From)(nil), - Where: (*ast.Where)(nil), - GroupBy: (*ast.GroupBy)(nil), - Having: (*ast.Having)(nil), - OrderBy: (*ast.OrderBy)(nil), - Limit: (*ast.Limit)(nil), }, } diff --git a/testdata/result/query/select_literals_paren_with_operator.sql.txt b/testdata/result/query/select_literals_paren_with_operator.sql.txt index 3efa5f2e..a0c52ced 100644 --- a/testdata/result/query/select_literals_paren_with_operator.sql.txt +++ b/testdata/result/query/select_literals_paren_with_operator.sql.txt @@ -3,13 +3,8 @@ SELECT (1+1) --- AST &ast.QueryStatement{ - Hint: (*ast.Hint)(nil), - With: (*ast.With)(nil), Query: &ast.Select{ - Select: 0, - Distinct: false, - As: nil, - Results: []ast.SelectItem{ + Results: []ast.SelectItem{ &ast.ExprSelectItem{ Expr: &ast.ParenExpr{ Lparen: 7, @@ -32,12 +27,6 @@ SELECT (1+1) }, }, }, - From: (*ast.From)(nil), - Where: (*ast.Where)(nil), - GroupBy: (*ast.GroupBy)(nil), - Having: (*ast.Having)(nil), - OrderBy: (*ast.OrderBy)(nil), - Limit: (*ast.Limit)(nil), }, } diff --git a/testdata/result/query/select_literals_string.sql.txt b/testdata/result/query/select_literals_string.sql.txt index c18ac805..8686fd58 100644 --- a/testdata/result/query/select_literals_string.sql.txt +++ b/testdata/result/query/select_literals_string.sql.txt @@ -25,13 +25,8 @@ lines''', --- AST &ast.QueryStatement{ - Hint: (*ast.Hint)(nil), - With: (*ast.With)(nil), Query: &ast.Select{ - Select: 0, - Distinct: false, - As: nil, - Results: []ast.SelectItem{ + Results: []ast.SelectItem{ &ast.ExprSelectItem{ Expr: &ast.StringLiteral{ ValuePos: 9, @@ -180,12 +175,6 @@ lines''', }, }, }, - From: (*ast.From)(nil), - Where: (*ast.Where)(nil), - GroupBy: (*ast.GroupBy)(nil), - Having: (*ast.Having)(nil), - OrderBy: (*ast.OrderBy)(nil), - Limit: (*ast.Limit)(nil), }, } diff --git a/testdata/result/query/select_literals_struct.sql.txt b/testdata/result/query/select_literals_struct.sql.txt index 3b45c25d..656850ee 100644 --- a/testdata/result/query/select_literals_struct.sql.txt +++ b/testdata/result/query/select_literals_struct.sql.txt @@ -18,22 +18,15 @@ SELECT --- AST &ast.QueryStatement{ - Hint: (*ast.Hint)(nil), - With: (*ast.With)(nil), Query: &ast.Select{ - Select: 0, - Distinct: false, - As: nil, - Results: []ast.SelectItem{ + Results: []ast.SelectItem{ &ast.ExprSelectItem{ Expr: &ast.ArraySubQuery{ Array: 9, Rparen: 37, Query: &ast.Select{ - Select: 15, - Distinct: false, - As: nil, - Results: []ast.SelectItem{ + Select: 15, + Results: []ast.SelectItem{ &ast.ExprSelectItem{ Expr: &ast.TypelessStructLiteral{ Struct: 22, @@ -67,12 +60,6 @@ SELECT }, }, }, - From: (*ast.From)(nil), - Where: (*ast.Where)(nil), - GroupBy: (*ast.GroupBy)(nil), - Having: (*ast.Having)(nil), - OrderBy: (*ast.OrderBy)(nil), - Limit: (*ast.Limit)(nil), }, }, }, @@ -81,10 +68,8 @@ SELECT Array: 42, Rparen: 73, Query: &ast.Select{ - Select: 48, - Distinct: false, - As: nil, - Results: []ast.SelectItem{ + Select: 48, + Results: []ast.SelectItem{ &ast.ExprSelectItem{ Expr: &ast.TypelessStructLiteral{ Struct: 55, @@ -116,12 +101,6 @@ SELECT }, }, }, - From: (*ast.From)(nil), - Where: (*ast.Where)(nil), - GroupBy: (*ast.GroupBy)(nil), - Having: (*ast.Having)(nil), - OrderBy: (*ast.OrderBy)(nil), - Limit: (*ast.Limit)(nil), }, }, }, @@ -130,10 +109,8 @@ SELECT Array: 78, Rparen: 133, Query: &ast.Select{ - Select: 84, - Distinct: false, - As: nil, - Results: []ast.SelectItem{ + Select: 84, + Results: []ast.SelectItem{ &ast.ExprSelectItem{ Expr: &ast.TypedStructLiteral{ Struct: 91, @@ -196,12 +173,6 @@ SELECT }, }, }, - From: (*ast.From)(nil), - Where: (*ast.Where)(nil), - GroupBy: (*ast.GroupBy)(nil), - Having: (*ast.Having)(nil), - OrderBy: (*ast.OrderBy)(nil), - Limit: (*ast.Limit)(nil), }, }, }, @@ -210,10 +181,8 @@ SELECT Array: 138, Rparen: 181, Query: &ast.Select{ - Select: 144, - Distinct: false, - As: nil, - Results: []ast.SelectItem{ + Select: 144, + Results: []ast.SelectItem{ &ast.ExprSelectItem{ Expr: &ast.TypelessStructLiteral{ Struct: 151, @@ -271,12 +240,6 @@ SELECT }, }, }, - From: (*ast.From)(nil), - Where: (*ast.Where)(nil), - GroupBy: (*ast.GroupBy)(nil), - Having: (*ast.Having)(nil), - OrderBy: (*ast.OrderBy)(nil), - Limit: (*ast.Limit)(nil), }, }, }, @@ -285,32 +248,27 @@ SELECT Array: 186, Rparen: 235, Query: &ast.Select{ - Select: 192, - Distinct: false, - As: nil, - Results: []ast.SelectItem{ + Select: 192, + Results: []ast.SelectItem{ &ast.ExprSelectItem{ Expr: &ast.TypedStructLiteral{ Struct: 199, Rparen: 234, Fields: []*ast.StructField{ &ast.StructField{ - Ident: (*ast.Ident)(nil), - Type: &ast.SimpleType{ + Type: &ast.SimpleType{ NamePos: 206, Name: "INT64", }, }, &ast.StructField{ - Ident: (*ast.Ident)(nil), - Type: &ast.SimpleType{ + Type: &ast.SimpleType{ NamePos: 213, Name: "INT64", }, }, &ast.StructField{ - Ident: (*ast.Ident)(nil), - Type: &ast.SimpleType{ + Type: &ast.SimpleType{ NamePos: 220, Name: "INT64", }, @@ -339,12 +297,6 @@ SELECT }, }, }, - From: (*ast.From)(nil), - Where: (*ast.Where)(nil), - GroupBy: (*ast.GroupBy)(nil), - Having: (*ast.Having)(nil), - OrderBy: (*ast.OrderBy)(nil), - Limit: (*ast.Limit)(nil), }, }, }, @@ -353,10 +305,8 @@ SELECT Array: 240, Rparen: 291, Query: &ast.Select{ - Select: 246, - Distinct: false, - As: nil, - Results: []ast.SelectItem{ + Select: 246, + Results: []ast.SelectItem{ &ast.ExprSelectItem{ Expr: &ast.TypedStructLiteral{ Struct: 253, @@ -374,15 +324,13 @@ SELECT }, }, &ast.StructField{ - Ident: (*ast.Ident)(nil), - Type: &ast.SimpleType{ + Type: &ast.SimpleType{ NamePos: 269, Name: "INT64", }, }, &ast.StructField{ - Ident: (*ast.Ident)(nil), - Type: &ast.SimpleType{ + Type: &ast.SimpleType{ NamePos: 276, Name: "INT64", }, @@ -411,12 +359,6 @@ SELECT }, }, }, - From: (*ast.From)(nil), - Where: (*ast.Where)(nil), - GroupBy: (*ast.GroupBy)(nil), - Having: (*ast.Having)(nil), - OrderBy: (*ast.OrderBy)(nil), - Limit: (*ast.Limit)(nil), }, }, }, @@ -425,10 +367,8 @@ SELECT Array: 296, Rparen: 329, Query: &ast.Select{ - Select: 302, - Distinct: false, - As: nil, - Results: []ast.SelectItem{ + Select: 302, + Results: []ast.SelectItem{ &ast.ExprSelectItem{ Expr: &ast.TypelessStructLiteral{ Struct: 309, @@ -470,12 +410,6 @@ SELECT }, }, }, - From: (*ast.From)(nil), - Where: (*ast.Where)(nil), - GroupBy: (*ast.GroupBy)(nil), - Having: (*ast.Having)(nil), - OrderBy: (*ast.OrderBy)(nil), - Limit: (*ast.Limit)(nil), }, }, }, @@ -484,10 +418,8 @@ SELECT Array: 334, Rparen: 356, Query: &ast.Select{ - Select: 340, - Distinct: false, - As: nil, - Results: []ast.SelectItem{ + Select: 340, + Results: []ast.SelectItem{ &ast.ExprSelectItem{ Expr: &ast.TupleStructLiteral{ Lparen: 347, @@ -515,12 +447,6 @@ SELECT }, }, }, - From: (*ast.From)(nil), - Where: (*ast.Where)(nil), - GroupBy: (*ast.GroupBy)(nil), - Having: (*ast.Having)(nil), - OrderBy: (*ast.OrderBy)(nil), - Limit: (*ast.Limit)(nil), }, }, }, @@ -529,10 +455,8 @@ SELECT Array: 361, Rparen: 392, Query: &ast.Select{ - Select: 367, - Distinct: false, - As: nil, - Results: []ast.SelectItem{ + Select: 367, + Results: []ast.SelectItem{ &ast.ExprSelectItem{ Expr: &ast.TypedStructLiteral{ Struct: 374, @@ -561,12 +485,6 @@ SELECT }, }, }, - From: (*ast.From)(nil), - Where: (*ast.Where)(nil), - GroupBy: (*ast.GroupBy)(nil), - Having: (*ast.Having)(nil), - OrderBy: (*ast.OrderBy)(nil), - Limit: (*ast.Limit)(nil), }, }, }, @@ -575,10 +493,8 @@ SELECT Array: 397, Rparen: 424, Query: &ast.Select{ - Select: 403, - Distinct: false, - As: nil, - Results: []ast.SelectItem{ + Select: 403, + Results: []ast.SelectItem{ &ast.ExprSelectItem{ Expr: &ast.TypelessStructLiteral{ Struct: 410, @@ -604,12 +520,6 @@ SELECT }, }, }, - From: (*ast.From)(nil), - Where: (*ast.Where)(nil), - GroupBy: (*ast.GroupBy)(nil), - Having: (*ast.Having)(nil), - OrderBy: (*ast.OrderBy)(nil), - Limit: (*ast.Limit)(nil), }, }, }, @@ -618,18 +528,15 @@ SELECT Array: 429, Rparen: 458, Query: &ast.Select{ - Select: 435, - Distinct: false, - As: nil, - Results: []ast.SelectItem{ + Select: 435, + Results: []ast.SelectItem{ &ast.ExprSelectItem{ Expr: &ast.TypedStructLiteral{ Struct: 442, Rparen: 457, Fields: []*ast.StructField{ &ast.StructField{ - Ident: (*ast.Ident)(nil), - Type: &ast.SimpleType{ + Type: &ast.SimpleType{ NamePos: 449, Name: "INT64", }, @@ -646,12 +553,6 @@ SELECT }, }, }, - From: (*ast.From)(nil), - Where: (*ast.Where)(nil), - GroupBy: (*ast.GroupBy)(nil), - Having: (*ast.Having)(nil), - OrderBy: (*ast.OrderBy)(nil), - Limit: (*ast.Limit)(nil), }, }, }, @@ -660,10 +561,8 @@ SELECT Array: 463, Rparen: 485, Query: &ast.Select{ - Select: 469, - Distinct: false, - As: nil, - Results: []ast.SelectItem{ + Select: 469, + Results: []ast.SelectItem{ &ast.ExprSelectItem{ Expr: &ast.TypelessStructLiteral{ Struct: 476, @@ -681,12 +580,6 @@ SELECT }, }, }, - From: (*ast.From)(nil), - Where: (*ast.Where)(nil), - GroupBy: (*ast.GroupBy)(nil), - Having: (*ast.Having)(nil), - OrderBy: (*ast.OrderBy)(nil), - Limit: (*ast.Limit)(nil), }, }, }, @@ -695,25 +588,15 @@ SELECT Array: 490, Rparen: 513, Query: &ast.Select{ - Select: 496, - Distinct: false, - As: nil, - Results: []ast.SelectItem{ + Select: 496, + Results: []ast.SelectItem{ &ast.ExprSelectItem{ Expr: &ast.TypedStructLiteral{ Struct: 503, Rparen: 512, - Fields: []*ast.StructField(nil), - Values: []ast.Expr(nil), }, }, }, - From: (*ast.From)(nil), - Where: (*ast.Where)(nil), - GroupBy: (*ast.GroupBy)(nil), - Having: (*ast.Having)(nil), - OrderBy: (*ast.OrderBy)(nil), - Limit: (*ast.Limit)(nil), }, }, }, @@ -722,24 +605,15 @@ SELECT Array: 518, Rparen: 539, Query: &ast.Select{ - Select: 524, - Distinct: false, - As: nil, - Results: []ast.SelectItem{ + Select: 524, + Results: []ast.SelectItem{ &ast.ExprSelectItem{ Expr: &ast.TypelessStructLiteral{ Struct: 531, Rparen: 538, - Values: []ast.TypelessStructLiteralArg(nil), }, }, }, - From: (*ast.From)(nil), - Where: (*ast.Where)(nil), - GroupBy: (*ast.GroupBy)(nil), - Having: (*ast.Having)(nil), - OrderBy: (*ast.OrderBy)(nil), - Limit: (*ast.Limit)(nil), }, }, }, @@ -747,12 +621,9 @@ SELECT Expr: &ast.ExistsSubQuery{ Exists: 544, Rparen: 564, - Hint: (*ast.Hint)(nil), Query: &ast.Select{ - Select: 551, - Distinct: false, - As: nil, - Results: []ast.SelectItem{ + Select: 551, + Results: []ast.SelectItem{ &ast.ExprSelectItem{ Expr: &ast.TupleStructLiteral{ Lparen: 558, @@ -774,22 +645,10 @@ SELECT }, }, }, - From: (*ast.From)(nil), - Where: (*ast.Where)(nil), - GroupBy: (*ast.GroupBy)(nil), - Having: (*ast.Having)(nil), - OrderBy: (*ast.OrderBy)(nil), - Limit: (*ast.Limit)(nil), }, }, }, }, - From: (*ast.From)(nil), - Where: (*ast.Where)(nil), - GroupBy: (*ast.GroupBy)(nil), - Having: (*ast.Having)(nil), - OrderBy: (*ast.OrderBy)(nil), - Limit: (*ast.Limit)(nil), }, } diff --git a/testdata/result/query/select_nest_complex.sql.txt b/testdata/result/query/select_nest_complex.sql.txt index 81059415..df297133 100644 --- a/testdata/result/query/select_nest_complex.sql.txt +++ b/testdata/result/query/select_nest_complex.sql.txt @@ -8,13 +8,8 @@ from ( --- AST &ast.QueryStatement{ - Hint: (*ast.Hint)(nil), - With: (*ast.With)(nil), Query: &ast.Select{ - Select: 0, - Distinct: false, - As: nil, - Results: []ast.SelectItem{ + Results: []ast.SelectItem{ &ast.Star{ Star: 7, }, @@ -25,10 +20,8 @@ from ( Lparen: 14, Rparen: 131, Source: &ast.Join{ - Op: "INNER JOIN", - Method: "", - Hint: (*ast.Hint)(nil), - Left: &ast.SubQueryTableExpr{ + Op: "INNER JOIN", + Left: &ast.SubQueryTableExpr{ Lparen: 20, Rparen: 90, Query: &ast.SubQuery{ @@ -42,14 +35,11 @@ from ( Lparen: 22, Rparen: 54, Query: &ast.CompoundQuery{ - Op: "UNION", - Distinct: false, - Queries: []ast.QueryExpr{ + Op: "UNION", + Queries: []ast.QueryExpr{ &ast.Select{ - Select: 23, - Distinct: false, - As: nil, - Results: []ast.SelectItem{ + Select: 23, + Results: []ast.SelectItem{ &ast.Alias{ Expr: &ast.IntLiteral{ ValuePos: 30, @@ -67,21 +57,13 @@ from ( }, }, }, - From: (*ast.From)(nil), - Where: (*ast.Where)(nil), - GroupBy: (*ast.GroupBy)(nil), - Having: (*ast.Having)(nil), - OrderBy: (*ast.OrderBy)(nil), - Limit: (*ast.Limit)(nil), }, &ast.SubQuery{ Lparen: 44, Rparen: 53, Query: &ast.Select{ - Select: 45, - Distinct: false, - As: nil, - Results: []ast.SelectItem{ + Select: 45, + Results: []ast.SelectItem{ &ast.ExprSelectItem{ Expr: &ast.IntLiteral{ ValuePos: 52, @@ -91,31 +73,17 @@ from ( }, }, }, - From: (*ast.From)(nil), - Where: (*ast.Where)(nil), - GroupBy: (*ast.GroupBy)(nil), - Having: (*ast.Having)(nil), - OrderBy: (*ast.OrderBy)(nil), - Limit: (*ast.Limit)(nil), }, - OrderBy: (*ast.OrderBy)(nil), - Limit: (*ast.Limit)(nil), }, }, - OrderBy: (*ast.OrderBy)(nil), - Limit: (*ast.Limit)(nil), }, - OrderBy: (*ast.OrderBy)(nil), - Limit: (*ast.Limit)(nil), }, &ast.SubQuery{ Lparen: 71, Rparen: 80, Query: &ast.Select{ - Select: 72, - Distinct: false, - As: nil, - Results: []ast.SelectItem{ + Select: 72, + Results: []ast.SelectItem{ &ast.ExprSelectItem{ Expr: &ast.IntLiteral{ ValuePos: 79, @@ -125,22 +93,11 @@ from ( }, }, }, - From: (*ast.From)(nil), - Where: (*ast.Where)(nil), - GroupBy: (*ast.GroupBy)(nil), - Having: (*ast.Having)(nil), - OrderBy: (*ast.OrderBy)(nil), - Limit: (*ast.Limit)(nil), }, - OrderBy: (*ast.OrderBy)(nil), - Limit: (*ast.Limit)(nil), }, }, - OrderBy: (*ast.OrderBy)(nil), - Limit: (*ast.Limit)(nil), }, - OrderBy: (*ast.OrderBy)(nil), - Limit: &ast.Limit{ + Limit: &ast.Limit{ Limit: 83, Count: &ast.IntLiteral{ ValuePos: 89, @@ -148,20 +105,15 @@ from ( Base: 10, Value: "1", }, - Offset: (*ast.Offset)(nil), }, }, - As: (*ast.AsAlias)(nil), - Sample: (*ast.TableSample)(nil), }, Right: &ast.SubQueryTableExpr{ Lparen: 103, Rparen: 119, Query: &ast.Select{ - Select: 104, - Distinct: false, - As: nil, - Results: []ast.SelectItem{ + Select: 104, + Results: []ast.SelectItem{ &ast.Alias{ Expr: &ast.IntLiteral{ ValuePos: 111, @@ -195,15 +147,7 @@ from ( }, }, }, - From: (*ast.From)(nil), - Where: (*ast.Where)(nil), - GroupBy: (*ast.GroupBy)(nil), - Having: (*ast.Having)(nil), - OrderBy: (*ast.OrderBy)(nil), - Limit: (*ast.Limit)(nil), }, - As: (*ast.AsAlias)(nil), - Sample: (*ast.TableSample)(nil), }, Cond: &ast.Using{ Using: 121, @@ -217,14 +161,8 @@ from ( }, }, }, - Sample: (*ast.TableSample)(nil), }, }, - Where: (*ast.Where)(nil), - GroupBy: (*ast.GroupBy)(nil), - Having: (*ast.Having)(nil), - OrderBy: (*ast.OrderBy)(nil), - Limit: (*ast.Limit)(nil), }, } diff --git a/testdata/result/query/select_select_limit_expr.sql.txt b/testdata/result/query/select_select_limit_expr.sql.txt index 7a4f364a..f88cc9d1 100644 --- a/testdata/result/query/select_select_limit_expr.sql.txt +++ b/testdata/result/query/select_select_limit_expr.sql.txt @@ -3,13 +3,8 @@ select ((select 1) limit 1 offset 0) + 3 --- AST &ast.QueryStatement{ - Hint: (*ast.Hint)(nil), - With: (*ast.With)(nil), Query: &ast.Select{ - Select: 0, - Distinct: false, - As: nil, - Results: []ast.SelectItem{ + Results: []ast.SelectItem{ &ast.ExprSelectItem{ Expr: &ast.BinaryExpr{ Op: "+", @@ -20,10 +15,8 @@ select ((select 1) limit 1 offset 0) + 3 Lparen: 8, Rparen: 17, Query: &ast.Select{ - Select: 9, - Distinct: false, - As: nil, - Results: []ast.SelectItem{ + Select: 9, + Results: []ast.SelectItem{ &ast.ExprSelectItem{ Expr: &ast.IntLiteral{ ValuePos: 16, @@ -33,15 +26,8 @@ select ((select 1) limit 1 offset 0) + 3 }, }, }, - From: (*ast.From)(nil), - Where: (*ast.Where)(nil), - GroupBy: (*ast.GroupBy)(nil), - Having: (*ast.Having)(nil), - OrderBy: (*ast.OrderBy)(nil), - Limit: (*ast.Limit)(nil), }, - OrderBy: (*ast.OrderBy)(nil), - Limit: &ast.Limit{ + Limit: &ast.Limit{ Limit: 19, Count: &ast.IntLiteral{ ValuePos: 25, @@ -70,12 +56,6 @@ select ((select 1) limit 1 offset 0) + 3 }, }, }, - From: (*ast.From)(nil), - Where: (*ast.Where)(nil), - GroupBy: (*ast.GroupBy)(nil), - Having: (*ast.Having)(nil), - OrderBy: (*ast.OrderBy)(nil), - Limit: (*ast.Limit)(nil), }, } diff --git a/testdata/result/query/select_select_set_operator_expr.sql.txt b/testdata/result/query/select_select_set_operator_expr.sql.txt index fc1d824d..e14cac9b 100644 --- a/testdata/result/query/select_select_set_operator_expr.sql.txt +++ b/testdata/result/query/select_select_set_operator_expr.sql.txt @@ -5,13 +5,8 @@ select ((select 1) union all (select 2)) + 3, --- AST &ast.QueryStatement{ - Hint: (*ast.Hint)(nil), - With: (*ast.With)(nil), Query: &ast.Select{ - Select: 0, - Distinct: false, - As: nil, - Results: []ast.SelectItem{ + Results: []ast.SelectItem{ &ast.ExprSelectItem{ Expr: &ast.BinaryExpr{ Op: "+", @@ -19,17 +14,14 @@ select ((select 1) union all (select 2)) + 3, Lparen: 7, Rparen: 39, Query: &ast.CompoundQuery{ - Op: "UNION", - Distinct: false, - Queries: []ast.QueryExpr{ + Op: "UNION", + Queries: []ast.QueryExpr{ &ast.SubQuery{ Lparen: 8, Rparen: 17, Query: &ast.Select{ - Select: 9, - Distinct: false, - As: nil, - Results: []ast.SelectItem{ + Select: 9, + Results: []ast.SelectItem{ &ast.ExprSelectItem{ Expr: &ast.IntLiteral{ ValuePos: 16, @@ -39,24 +31,14 @@ select ((select 1) union all (select 2)) + 3, }, }, }, - From: (*ast.From)(nil), - Where: (*ast.Where)(nil), - GroupBy: (*ast.GroupBy)(nil), - Having: (*ast.Having)(nil), - OrderBy: (*ast.OrderBy)(nil), - Limit: (*ast.Limit)(nil), }, - OrderBy: (*ast.OrderBy)(nil), - Limit: (*ast.Limit)(nil), }, &ast.SubQuery{ Lparen: 29, Rparen: 38, Query: &ast.Select{ - Select: 30, - Distinct: false, - As: nil, - Results: []ast.SelectItem{ + Select: 30, + Results: []ast.SelectItem{ &ast.ExprSelectItem{ Expr: &ast.IntLiteral{ ValuePos: 37, @@ -66,19 +48,9 @@ select ((select 1) union all (select 2)) + 3, }, }, }, - From: (*ast.From)(nil), - Where: (*ast.Where)(nil), - GroupBy: (*ast.GroupBy)(nil), - Having: (*ast.Having)(nil), - OrderBy: (*ast.OrderBy)(nil), - Limit: (*ast.Limit)(nil), }, - OrderBy: (*ast.OrderBy)(nil), - Limit: (*ast.Limit)(nil), }, }, - OrderBy: (*ast.OrderBy)(nil), - Limit: (*ast.Limit)(nil), }, }, Right: &ast.IntLiteral{ @@ -96,17 +68,14 @@ select ((select 1) union all (select 2)) + 3, Lparen: 53, Rparen: 89, Query: &ast.CompoundQuery{ - Op: "INTERSECT", - Distinct: false, - Queries: []ast.QueryExpr{ + Op: "INTERSECT", + Queries: []ast.QueryExpr{ &ast.SubQuery{ Lparen: 54, Rparen: 63, Query: &ast.Select{ - Select: 55, - Distinct: false, - As: nil, - Results: []ast.SelectItem{ + Select: 55, + Results: []ast.SelectItem{ &ast.ExprSelectItem{ Expr: &ast.IntLiteral{ ValuePos: 62, @@ -116,24 +85,14 @@ select ((select 1) union all (select 2)) + 3, }, }, }, - From: (*ast.From)(nil), - Where: (*ast.Where)(nil), - GroupBy: (*ast.GroupBy)(nil), - Having: (*ast.Having)(nil), - OrderBy: (*ast.OrderBy)(nil), - Limit: (*ast.Limit)(nil), }, - OrderBy: (*ast.OrderBy)(nil), - Limit: (*ast.Limit)(nil), }, &ast.SubQuery{ Lparen: 79, Rparen: 88, Query: &ast.Select{ - Select: 80, - Distinct: false, - As: nil, - Results: []ast.SelectItem{ + Select: 80, + Results: []ast.SelectItem{ &ast.ExprSelectItem{ Expr: &ast.IntLiteral{ ValuePos: 87, @@ -143,19 +102,9 @@ select ((select 1) union all (select 2)) + 3, }, }, }, - From: (*ast.From)(nil), - Where: (*ast.Where)(nil), - GroupBy: (*ast.GroupBy)(nil), - Having: (*ast.Having)(nil), - OrderBy: (*ast.OrderBy)(nil), - Limit: (*ast.Limit)(nil), }, - OrderBy: (*ast.OrderBy)(nil), - Limit: (*ast.Limit)(nil), }, }, - OrderBy: (*ast.OrderBy)(nil), - Limit: (*ast.Limit)(nil), }, }, Right: &ast.IntLiteral{ @@ -173,17 +122,14 @@ select ((select 1) union all (select 2)) + 3, Lparen: 103, Rparen: 136, Query: &ast.CompoundQuery{ - Op: "EXCEPT", - Distinct: false, - Queries: []ast.QueryExpr{ + Op: "EXCEPT", + Queries: []ast.QueryExpr{ &ast.SubQuery{ Lparen: 104, Rparen: 113, Query: &ast.Select{ - Select: 105, - Distinct: false, - As: nil, - Results: []ast.SelectItem{ + Select: 105, + Results: []ast.SelectItem{ &ast.ExprSelectItem{ Expr: &ast.IntLiteral{ ValuePos: 112, @@ -193,24 +139,14 @@ select ((select 1) union all (select 2)) + 3, }, }, }, - From: (*ast.From)(nil), - Where: (*ast.Where)(nil), - GroupBy: (*ast.GroupBy)(nil), - Having: (*ast.Having)(nil), - OrderBy: (*ast.OrderBy)(nil), - Limit: (*ast.Limit)(nil), }, - OrderBy: (*ast.OrderBy)(nil), - Limit: (*ast.Limit)(nil), }, &ast.SubQuery{ Lparen: 126, Rparen: 135, Query: &ast.Select{ - Select: 127, - Distinct: false, - As: nil, - Results: []ast.SelectItem{ + Select: 127, + Results: []ast.SelectItem{ &ast.ExprSelectItem{ Expr: &ast.IntLiteral{ ValuePos: 134, @@ -220,19 +156,9 @@ select ((select 1) union all (select 2)) + 3, }, }, }, - From: (*ast.From)(nil), - Where: (*ast.Where)(nil), - GroupBy: (*ast.GroupBy)(nil), - Having: (*ast.Having)(nil), - OrderBy: (*ast.OrderBy)(nil), - Limit: (*ast.Limit)(nil), }, - OrderBy: (*ast.OrderBy)(nil), - Limit: (*ast.Limit)(nil), }, }, - OrderBy: (*ast.OrderBy)(nil), - Limit: (*ast.Limit)(nil), }, }, Right: &ast.IntLiteral{ @@ -244,12 +170,6 @@ select ((select 1) union all (select 2)) + 3, }, }, }, - From: (*ast.From)(nil), - Where: (*ast.Where)(nil), - GroupBy: (*ast.GroupBy)(nil), - Having: (*ast.Having)(nil), - OrderBy: (*ast.OrderBy)(nil), - Limit: (*ast.Limit)(nil), }, } diff --git a/testdata/result/query/select_singer_with_as_struct_subquery.sql.txt b/testdata/result/query/select_singer_with_as_struct_subquery.sql.txt index 5bac5fd7..94cbc9e7 100644 --- a/testdata/result/query/select_singer_with_as_struct_subquery.sql.txt +++ b/testdata/result/query/select_singer_with_as_struct_subquery.sql.txt @@ -10,13 +10,8 @@ SELECT --- AST &ast.QueryStatement{ - Hint: (*ast.Hint)(nil), - With: (*ast.With)(nil), Query: &ast.Select{ - Select: 0, - Distinct: false, - As: nil, - Results: []ast.SelectItem{ + Results: []ast.SelectItem{ &ast.ExprSelectItem{ Expr: &ast.ArraySubQuery{ Array: 9, @@ -25,9 +20,8 @@ SELECT Lparen: 20, Rparen: 88, Query: &ast.Select{ - Select: 28, - Distinct: false, - As: &ast.AsStruct{ + Select: 28, + As: &ast.AsStruct{ As: 35, Struct: 38, }, @@ -44,16 +38,9 @@ SELECT NameEnd: 73, Name: "Singers", }, - Hint: (*ast.Hint)(nil), - As: (*ast.AsAlias)(nil), - Sample: (*ast.TableSample)(nil), }, }, - Where: (*ast.Where)(nil), - GroupBy: (*ast.GroupBy)(nil), - Having: (*ast.Having)(nil), - OrderBy: (*ast.OrderBy)(nil), - Limit: &ast.Limit{ + Limit: &ast.Limit{ Limit: 74, Count: &ast.IntLiteral{ ValuePos: 80, @@ -61,21 +48,12 @@ SELECT Base: 10, Value: "100", }, - Offset: (*ast.Offset)(nil), }, }, - OrderBy: (*ast.OrderBy)(nil), - Limit: (*ast.Limit)(nil), }, }, }, }, - From: (*ast.From)(nil), - Where: (*ast.Where)(nil), - GroupBy: (*ast.GroupBy)(nil), - Having: (*ast.Having)(nil), - OrderBy: (*ast.OrderBy)(nil), - Limit: (*ast.Limit)(nil), }, } diff --git a/testdata/result/query/select_singer_with_asterisk.sql.txt b/testdata/result/query/select_singer_with_asterisk.sql.txt index 2ef354d2..3511b775 100644 --- a/testdata/result/query/select_singer_with_asterisk.sql.txt +++ b/testdata/result/query/select_singer_with_asterisk.sql.txt @@ -6,13 +6,8 @@ FROM --- AST &ast.QueryStatement{ - Hint: (*ast.Hint)(nil), - With: (*ast.With)(nil), Query: &ast.Select{ - Select: 0, - Distinct: false, - As: nil, - Results: []ast.SelectItem{ + Results: []ast.SelectItem{ &ast.Star{ Star: 9, }, @@ -25,16 +20,8 @@ FROM NameEnd: 25, Name: "Singers", }, - Hint: (*ast.Hint)(nil), - As: (*ast.AsAlias)(nil), - Sample: (*ast.TableSample)(nil), }, }, - Where: (*ast.Where)(nil), - GroupBy: (*ast.GroupBy)(nil), - Having: (*ast.Having)(nil), - OrderBy: (*ast.OrderBy)(nil), - Limit: (*ast.Limit)(nil), }, } diff --git a/testdata/result/query/select_singer_with_column_and_asterisk.sql.txt b/testdata/result/query/select_singer_with_column_and_asterisk.sql.txt index 4aace401..40ae9fad 100644 --- a/testdata/result/query/select_singer_with_column_and_asterisk.sql.txt +++ b/testdata/result/query/select_singer_with_column_and_asterisk.sql.txt @@ -7,13 +7,8 @@ FROM --- AST &ast.QueryStatement{ - Hint: (*ast.Hint)(nil), - With: (*ast.With)(nil), Query: &ast.Select{ - Select: 0, - Distinct: false, - As: nil, - Results: []ast.SelectItem{ + Results: []ast.SelectItem{ &ast.ExprSelectItem{ Expr: &ast.Ident{ NamePos: 9, @@ -33,16 +28,8 @@ FROM NameEnd: 37, Name: "Singers", }, - Hint: (*ast.Hint)(nil), - As: (*ast.AsAlias)(nil), - Sample: (*ast.TableSample)(nil), }, }, - Where: (*ast.Where)(nil), - GroupBy: (*ast.GroupBy)(nil), - Having: (*ast.Having)(nil), - OrderBy: (*ast.OrderBy)(nil), - Limit: (*ast.Limit)(nil), }, } diff --git a/testdata/result/query/select_singer_with_column_names.sql.txt b/testdata/result/query/select_singer_with_column_names.sql.txt index 7bef784a..31e86dce 100644 --- a/testdata/result/query/select_singer_with_column_names.sql.txt +++ b/testdata/result/query/select_singer_with_column_names.sql.txt @@ -9,13 +9,8 @@ FROM Singers --- AST &ast.QueryStatement{ - Hint: (*ast.Hint)(nil), - With: (*ast.With)(nil), Query: &ast.Select{ - Select: 0, - Distinct: false, - As: nil, - Results: []ast.SelectItem{ + Results: []ast.SelectItem{ &ast.Alias{ Expr: &ast.Ident{ NamePos: 9, @@ -68,16 +63,8 @@ FROM Singers NameEnd: 88, Name: "Singers", }, - Hint: (*ast.Hint)(nil), - As: (*ast.AsAlias)(nil), - Sample: (*ast.TableSample)(nil), }, }, - Where: (*ast.Where)(nil), - GroupBy: (*ast.GroupBy)(nil), - Having: (*ast.Having)(nil), - OrderBy: (*ast.OrderBy)(nil), - Limit: (*ast.Limit)(nil), }, } diff --git a/testdata/result/query/select_singer_with_cross_join.sql.txt b/testdata/result/query/select_singer_with_cross_join.sql.txt index f7be0a42..34362fa4 100644 --- a/testdata/result/query/select_singer_with_cross_join.sql.txt +++ b/testdata/result/query/select_singer_with_cross_join.sql.txt @@ -8,13 +8,8 @@ FROM --- AST &ast.QueryStatement{ - Hint: (*ast.Hint)(nil), - With: (*ast.With)(nil), Query: &ast.Select{ - Select: 0, - Distinct: false, - As: nil, - Results: []ast.SelectItem{ + Results: []ast.SelectItem{ &ast.Star{ Star: 9, }, @@ -22,17 +17,14 @@ FROM From: &ast.From{ From: 11, Source: &ast.Join{ - Op: "CROSS JOIN", - Method: "", - Hint: (*ast.Hint)(nil), - Left: &ast.TableName{ + Op: "CROSS JOIN", + Left: &ast.TableName{ Table: &ast.Ident{ NamePos: 18, NameEnd: 25, Name: "Singers", }, - Hint: (*ast.Hint)(nil), - As: &ast.AsAlias{ + As: &ast.AsAlias{ As: -1, Alias: &ast.Ident{ NamePos: 26, @@ -40,7 +32,6 @@ FROM Name: "A", }, }, - Sample: (*ast.TableSample)(nil), }, Right: &ast.TableName{ Table: &ast.Ident{ @@ -48,8 +39,7 @@ FROM NameEnd: 50, Name: "Singers", }, - Hint: (*ast.Hint)(nil), - As: &ast.AsAlias{ + As: &ast.AsAlias{ As: -1, Alias: &ast.Ident{ NamePos: 51, @@ -57,16 +47,9 @@ FROM Name: "B", }, }, - Sample: (*ast.TableSample)(nil), }, - Cond: nil, }, }, - Where: (*ast.Where)(nil), - GroupBy: (*ast.GroupBy)(nil), - Having: (*ast.Having)(nil), - OrderBy: (*ast.OrderBy)(nil), - Limit: (*ast.Limit)(nil), }, } diff --git a/testdata/result/query/select_singer_with_distinct.sql.txt b/testdata/result/query/select_singer_with_distinct.sql.txt index e3018b3e..95a0a846 100644 --- a/testdata/result/query/select_singer_with_distinct.sql.txt +++ b/testdata/result/query/select_singer_with_distinct.sql.txt @@ -7,12 +7,8 @@ FROM --- AST &ast.QueryStatement{ - Hint: (*ast.Hint)(nil), - With: (*ast.With)(nil), Query: &ast.Select{ - Select: 0, Distinct: true, - As: nil, Results: []ast.SelectItem{ &ast.Star{ Star: 20, @@ -26,16 +22,8 @@ FROM NameEnd: 36, Name: "Singers", }, - Hint: (*ast.Hint)(nil), - As: (*ast.AsAlias)(nil), - Sample: (*ast.TableSample)(nil), }, }, - Where: (*ast.Where)(nil), - GroupBy: (*ast.GroupBy)(nil), - Having: (*ast.Having)(nil), - OrderBy: (*ast.OrderBy)(nil), - Limit: (*ast.Limit)(nil), }, } diff --git a/testdata/result/query/select_singer_with_full_join.sql.txt b/testdata/result/query/select_singer_with_full_join.sql.txt index 8e364024..4036f6ce 100644 --- a/testdata/result/query/select_singer_with_full_join.sql.txt +++ b/testdata/result/query/select_singer_with_full_join.sql.txt @@ -7,13 +7,8 @@ FROM --- AST &ast.QueryStatement{ - Hint: (*ast.Hint)(nil), - With: (*ast.With)(nil), Query: &ast.Select{ - Select: 0, - Distinct: false, - As: nil, - Results: []ast.SelectItem{ + Results: []ast.SelectItem{ &ast.Star{ Star: 9, }, @@ -21,17 +16,14 @@ FROM From: &ast.From{ From: 11, Source: &ast.Join{ - Op: ",", - Method: "", - Hint: (*ast.Hint)(nil), - Left: &ast.TableName{ + Op: ",", + Left: &ast.TableName{ Table: &ast.Ident{ NamePos: 18, NameEnd: 25, Name: "Singers", }, - Hint: (*ast.Hint)(nil), - As: &ast.AsAlias{ + As: &ast.AsAlias{ As: 26, Alias: &ast.Ident{ NamePos: 29, @@ -39,7 +31,6 @@ FROM Name: "A", }, }, - Sample: (*ast.TableSample)(nil), }, Right: &ast.TableName{ Table: &ast.Ident{ @@ -47,8 +38,7 @@ FROM NameEnd: 41, Name: "Singers", }, - Hint: (*ast.Hint)(nil), - As: &ast.AsAlias{ + As: &ast.AsAlias{ As: 42, Alias: &ast.Ident{ NamePos: 45, @@ -56,16 +46,9 @@ FROM Name: "B", }, }, - Sample: (*ast.TableSample)(nil), }, - Cond: nil, }, }, - Where: (*ast.Where)(nil), - GroupBy: (*ast.GroupBy)(nil), - Having: (*ast.Having)(nil), - OrderBy: (*ast.OrderBy)(nil), - Limit: (*ast.Limit)(nil), }, } diff --git a/testdata/result/query/select_singer_with_groupby.sql.txt b/testdata/result/query/select_singer_with_groupby.sql.txt index 2e8f6f26..0c93d97d 100644 --- a/testdata/result/query/select_singer_with_groupby.sql.txt +++ b/testdata/result/query/select_singer_with_groupby.sql.txt @@ -8,13 +8,8 @@ GROUP BY --- AST &ast.QueryStatement{ - Hint: (*ast.Hint)(nil), - With: (*ast.With)(nil), Query: &ast.Select{ - Select: 0, - Distinct: false, - As: nil, - Results: []ast.SelectItem{ + Results: []ast.SelectItem{ &ast.ExprSelectItem{ Expr: &ast.Ident{ NamePos: 9, @@ -38,12 +33,8 @@ GROUP BY NameEnd: 44, Name: "Singers", }, - Hint: (*ast.Hint)(nil), - As: (*ast.AsAlias)(nil), - Sample: (*ast.TableSample)(nil), }, }, - Where: (*ast.Where)(nil), GroupBy: &ast.GroupBy{ Group: 45, Exprs: []ast.Expr{ @@ -59,9 +50,6 @@ GROUP BY }, }, }, - Having: (*ast.Having)(nil), - OrderBy: (*ast.OrderBy)(nil), - Limit: (*ast.Limit)(nil), }, } diff --git a/testdata/result/query/select_singer_with_hash_join.sql.txt b/testdata/result/query/select_singer_with_hash_join.sql.txt index 51741f24..cd61e22e 100644 --- a/testdata/result/query/select_singer_with_hash_join.sql.txt +++ b/testdata/result/query/select_singer_with_hash_join.sql.txt @@ -8,13 +8,8 @@ FROM ON A.SingerID = B.SingerID --- AST &ast.QueryStatement{ - Hint: (*ast.Hint)(nil), - With: (*ast.With)(nil), Query: &ast.Select{ - Select: 0, - Distinct: false, - As: nil, - Results: []ast.SelectItem{ + Results: []ast.SelectItem{ &ast.Star{ Star: 9, }, @@ -24,15 +19,13 @@ FROM Source: &ast.Join{ Op: "INNER JOIN", Method: "HASH", - Hint: (*ast.Hint)(nil), Left: &ast.TableName{ Table: &ast.Ident{ NamePos: 18, NameEnd: 25, Name: "Singers", }, - Hint: (*ast.Hint)(nil), - As: &ast.AsAlias{ + As: &ast.AsAlias{ As: -1, Alias: &ast.Ident{ NamePos: 26, @@ -40,7 +33,6 @@ FROM Name: "A", }, }, - Sample: (*ast.TableSample)(nil), }, Right: &ast.TableName{ Table: &ast.Ident{ @@ -48,8 +40,7 @@ FROM NameEnd: 49, Name: "Singers", }, - Hint: (*ast.Hint)(nil), - As: &ast.AsAlias{ + As: &ast.AsAlias{ As: -1, Alias: &ast.Ident{ NamePos: 50, @@ -57,7 +48,6 @@ FROM Name: "B", }, }, - Sample: (*ast.TableSample)(nil), }, Cond: &ast.On{ On: 54, @@ -95,11 +85,6 @@ FROM }, }, }, - Where: (*ast.Where)(nil), - GroupBy: (*ast.GroupBy)(nil), - Having: (*ast.Having)(nil), - OrderBy: (*ast.OrderBy)(nil), - Limit: (*ast.Limit)(nil), }, } diff --git a/testdata/result/query/select_singer_with_having.sql.txt b/testdata/result/query/select_singer_with_having.sql.txt index 9d853bd1..c0af45ac 100644 --- a/testdata/result/query/select_singer_with_having.sql.txt +++ b/testdata/result/query/select_singer_with_having.sql.txt @@ -10,13 +10,8 @@ HAVING --- AST &ast.QueryStatement{ - Hint: (*ast.Hint)(nil), - With: (*ast.With)(nil), Query: &ast.Select{ - Select: 0, - Distinct: false, - As: nil, - Results: []ast.SelectItem{ + Results: []ast.SelectItem{ &ast.ExprSelectItem{ Expr: &ast.Ident{ NamePos: 9, @@ -33,12 +28,8 @@ HAVING NameEnd: 32, Name: "Singers", }, - Hint: (*ast.Hint)(nil), - As: (*ast.AsAlias)(nil), - Sample: (*ast.TableSample)(nil), }, }, - Where: (*ast.Where)(nil), GroupBy: &ast.GroupBy{ Group: 33, Exprs: []ast.Expr{ @@ -66,8 +57,6 @@ HAVING }, }, }, - OrderBy: (*ast.OrderBy)(nil), - Limit: (*ast.Limit)(nil), }, } diff --git a/testdata/result/query/select_singer_with_in_and_unnest.sql.txt b/testdata/result/query/select_singer_with_in_and_unnest.sql.txt index ac358ab5..c410d65a 100644 --- a/testdata/result/query/select_singer_with_in_and_unnest.sql.txt +++ b/testdata/result/query/select_singer_with_in_and_unnest.sql.txt @@ -8,13 +8,8 @@ WHERE --- AST &ast.QueryStatement{ - Hint: (*ast.Hint)(nil), - With: (*ast.With)(nil), Query: &ast.Select{ - Select: 0, - Distinct: false, - As: nil, - Results: []ast.SelectItem{ + Results: []ast.SelectItem{ &ast.Star{ Star: 9, }, @@ -27,15 +22,11 @@ WHERE NameEnd: 25, Name: "Singers", }, - Hint: (*ast.Hint)(nil), - As: (*ast.AsAlias)(nil), - Sample: (*ast.TableSample)(nil), }, }, Where: &ast.Where{ Where: 26, Expr: &ast.InExpr{ - Not: false, Left: &ast.Ident{ NamePos: 34, NameEnd: 42, @@ -48,7 +39,6 @@ WHERE Array: 53, Lbrack: 58, Rbrack: 66, - Type: nil, Values: []ast.Expr{ &ast.IntLiteral{ ValuePos: 59, @@ -73,10 +63,6 @@ WHERE }, }, }, - GroupBy: (*ast.GroupBy)(nil), - Having: (*ast.Having)(nil), - OrderBy: (*ast.OrderBy)(nil), - Limit: (*ast.Limit)(nil), }, } diff --git a/testdata/result/query/select_singer_with_in_and_unnest_with_query_parameter.sql.txt b/testdata/result/query/select_singer_with_in_and_unnest_with_query_parameter.sql.txt index 456d2286..293e2401 100644 --- a/testdata/result/query/select_singer_with_in_and_unnest_with_query_parameter.sql.txt +++ b/testdata/result/query/select_singer_with_in_and_unnest_with_query_parameter.sql.txt @@ -8,13 +8,8 @@ WHERE --- AST &ast.QueryStatement{ - Hint: (*ast.Hint)(nil), - With: (*ast.With)(nil), Query: &ast.Select{ - Select: 0, - Distinct: false, - As: nil, - Results: []ast.SelectItem{ + Results: []ast.SelectItem{ &ast.Star{ Star: 9, }, @@ -27,15 +22,11 @@ WHERE NameEnd: 25, Name: "Singers", }, - Hint: (*ast.Hint)(nil), - As: (*ast.AsAlias)(nil), - Sample: (*ast.TableSample)(nil), }, }, Where: &ast.Where{ Where: 26, Expr: &ast.InExpr{ - Not: false, Left: &ast.Ident{ NamePos: 34, NameEnd: 42, @@ -51,10 +42,6 @@ WHERE }, }, }, - GroupBy: (*ast.GroupBy)(nil), - Having: (*ast.Having)(nil), - OrderBy: (*ast.OrderBy)(nil), - Limit: (*ast.Limit)(nil), }, } diff --git a/testdata/result/query/select_singer_with_join.sql.txt b/testdata/result/query/select_singer_with_join.sql.txt index ab573b3f..70831a2f 100644 --- a/testdata/result/query/select_singer_with_join.sql.txt +++ b/testdata/result/query/select_singer_with_join.sql.txt @@ -9,13 +9,8 @@ FROM --- AST &ast.QueryStatement{ - Hint: (*ast.Hint)(nil), - With: (*ast.With)(nil), Query: &ast.Select{ - Select: 0, - Distinct: false, - As: nil, - Results: []ast.SelectItem{ + Results: []ast.SelectItem{ &ast.Star{ Star: 9, }, @@ -23,17 +18,14 @@ FROM From: &ast.From{ From: 11, Source: &ast.Join{ - Op: "LEFT OUTER JOIN", - Method: "", - Hint: (*ast.Hint)(nil), - Left: &ast.TableName{ + Op: "LEFT OUTER JOIN", + Left: &ast.TableName{ Table: &ast.Ident{ NamePos: 18, NameEnd: 25, Name: "Singers", }, - Hint: (*ast.Hint)(nil), - As: &ast.AsAlias{ + As: &ast.AsAlias{ As: -1, Alias: &ast.Ident{ NamePos: 26, @@ -41,7 +33,6 @@ FROM Name: "A", }, }, - Sample: (*ast.TableSample)(nil), }, Right: &ast.TableName{ Table: &ast.Ident{ @@ -49,8 +40,7 @@ FROM NameEnd: 55, Name: "Singers", }, - Hint: (*ast.Hint)(nil), - As: &ast.AsAlias{ + As: &ast.AsAlias{ As: -1, Alias: &ast.Ident{ NamePos: 56, @@ -58,7 +48,6 @@ FROM Name: "B", }, }, - Sample: (*ast.TableSample)(nil), }, Cond: &ast.On{ On: 60, @@ -96,11 +85,6 @@ FROM }, }, }, - Where: (*ast.Where)(nil), - GroupBy: (*ast.GroupBy)(nil), - Having: (*ast.Having)(nil), - OrderBy: (*ast.OrderBy)(nil), - Limit: (*ast.Limit)(nil), }, } diff --git a/testdata/result/query/select_singer_with_join_hint.sql.txt b/testdata/result/query/select_singer_with_join_hint.sql.txt index 92a14a85..272a54be 100644 --- a/testdata/result/query/select_singer_with_join_hint.sql.txt +++ b/testdata/result/query/select_singer_with_join_hint.sql.txt @@ -18,13 +18,8 @@ FROM --- AST &ast.QueryStatement{ - Hint: (*ast.Hint)(nil), - With: (*ast.With)(nil), Query: &ast.Select{ - Select: 0, - Distinct: false, - As: nil, - Results: []ast.SelectItem{ + Results: []ast.SelectItem{ &ast.Star{ Star: 9, }, @@ -32,9 +27,8 @@ FROM From: &ast.From{ From: 11, Source: &ast.Join{ - Op: "INNER JOIN", - Method: "", - Hint: &ast.Hint{ + Op: "INNER JOIN", + Hint: &ast.Hint{ Atmark: 258, Rbrace: 279, Records: []*ast.HintRecord{ @@ -53,9 +47,8 @@ FROM }, }, Left: &ast.Join{ - Op: "INNER JOIN", - Method: "", - Hint: &ast.Hint{ + Op: "INNER JOIN", + Hint: &ast.Hint{ Atmark: 187, Rbrace: 209, Records: []*ast.HintRecord{ @@ -74,9 +67,8 @@ FROM }, }, Left: &ast.Join{ - Op: "INNER JOIN", - Method: "", - Hint: &ast.Hint{ + Op: "INNER JOIN", + Hint: &ast.Hint{ Atmark: 117, Rbrace: 138, Records: []*ast.HintRecord{ @@ -95,9 +87,8 @@ FROM }, }, Left: &ast.Join{ - Op: "LEFT OUTER JOIN", - Method: "", - Hint: &ast.Hint{ + Op: "LEFT OUTER JOIN", + Hint: &ast.Hint{ Atmark: 45, Rbrace: 68, Records: []*ast.HintRecord{ @@ -120,8 +111,7 @@ FROM NameEnd: 25, Name: "Singers", }, - Hint: (*ast.Hint)(nil), - As: &ast.AsAlias{ + As: &ast.AsAlias{ As: -1, Alias: &ast.Ident{ NamePos: 26, @@ -129,7 +119,6 @@ FROM Name: "A", }, }, - Sample: (*ast.TableSample)(nil), }, Right: &ast.TableName{ Table: &ast.Ident{ @@ -137,8 +126,7 @@ FROM NameEnd: 79, Name: "Singers", }, - Hint: (*ast.Hint)(nil), - As: &ast.AsAlias{ + As: &ast.AsAlias{ As: -1, Alias: &ast.Ident{ NamePos: 80, @@ -146,7 +134,6 @@ FROM Name: "B", }, }, - Sample: (*ast.TableSample)(nil), }, Cond: &ast.On{ On: 84, @@ -189,8 +176,7 @@ FROM NameEnd: 149, Name: "Singers", }, - Hint: (*ast.Hint)(nil), - As: &ast.AsAlias{ + As: &ast.AsAlias{ As: -1, Alias: &ast.Ident{ NamePos: 150, @@ -198,7 +184,6 @@ FROM Name: "C", }, }, - Sample: (*ast.TableSample)(nil), }, Cond: &ast.On{ On: 154, @@ -241,8 +226,7 @@ FROM NameEnd: 220, Name: "Singers", }, - Hint: (*ast.Hint)(nil), - As: &ast.AsAlias{ + As: &ast.AsAlias{ As: -1, Alias: &ast.Ident{ NamePos: 221, @@ -250,7 +234,6 @@ FROM Name: "D", }, }, - Sample: (*ast.TableSample)(nil), }, Cond: &ast.On{ On: 225, @@ -293,8 +276,7 @@ FROM NameEnd: 290, Name: "Singers", }, - Hint: (*ast.Hint)(nil), - As: &ast.AsAlias{ + As: &ast.AsAlias{ As: -1, Alias: &ast.Ident{ NamePos: 291, @@ -302,7 +284,6 @@ FROM Name: "E", }, }, - Sample: (*ast.TableSample)(nil), }, Cond: &ast.On{ On: 295, @@ -340,11 +321,6 @@ FROM }, }, }, - Where: (*ast.Where)(nil), - GroupBy: (*ast.GroupBy)(nil), - Having: (*ast.Having)(nil), - OrderBy: (*ast.OrderBy)(nil), - Limit: (*ast.Limit)(nil), }, } diff --git a/testdata/result/query/select_singer_with_join_twice.sql.txt b/testdata/result/query/select_singer_with_join_twice.sql.txt index 035780a4..c2f8e6dd 100644 --- a/testdata/result/query/select_singer_with_join_twice.sql.txt +++ b/testdata/result/query/select_singer_with_join_twice.sql.txt @@ -12,13 +12,8 @@ FROM --- AST &ast.QueryStatement{ - Hint: (*ast.Hint)(nil), - With: (*ast.With)(nil), Query: &ast.Select{ - Select: 0, - Distinct: false, - As: nil, - Results: []ast.SelectItem{ + Results: []ast.SelectItem{ &ast.Star{ Star: 9, }, @@ -26,21 +21,16 @@ FROM From: &ast.From{ From: 11, Source: &ast.Join{ - Op: "INNER JOIN", - Method: "", - Hint: (*ast.Hint)(nil), - Left: &ast.Join{ - Op: "INNER JOIN", - Method: "", - Hint: (*ast.Hint)(nil), - Left: &ast.TableName{ + Op: "INNER JOIN", + Left: &ast.Join{ + Op: "INNER JOIN", + Left: &ast.TableName{ Table: &ast.Ident{ NamePos: 18, NameEnd: 25, Name: "Singers", }, - Hint: (*ast.Hint)(nil), - As: &ast.AsAlias{ + As: &ast.AsAlias{ As: -1, Alias: &ast.Ident{ NamePos: 26, @@ -48,7 +38,6 @@ FROM Name: "A", }, }, - Sample: (*ast.TableSample)(nil), }, Right: &ast.TableName{ Table: &ast.Ident{ @@ -56,8 +45,7 @@ FROM NameEnd: 44, Name: "Singers", }, - Hint: (*ast.Hint)(nil), - As: &ast.AsAlias{ + As: &ast.AsAlias{ As: -1, Alias: &ast.Ident{ NamePos: 45, @@ -65,7 +53,6 @@ FROM Name: "B", }, }, - Sample: (*ast.TableSample)(nil), }, Cond: &ast.On{ On: 49, @@ -108,8 +95,7 @@ FROM NameEnd: 98, Name: "Singers", }, - Hint: (*ast.Hint)(nil), - As: &ast.AsAlias{ + As: &ast.AsAlias{ As: -1, Alias: &ast.Ident{ NamePos: 99, @@ -117,7 +103,6 @@ FROM Name: "C", }, }, - Sample: (*ast.TableSample)(nil), }, Cond: &ast.On{ On: 103, @@ -155,11 +140,6 @@ FROM }, }, }, - Where: (*ast.Where)(nil), - GroupBy: (*ast.GroupBy)(nil), - Having: (*ast.Having)(nil), - OrderBy: (*ast.OrderBy)(nil), - Limit: (*ast.Limit)(nil), }, } diff --git a/testdata/result/query/select_singer_with_join_using.sql.txt b/testdata/result/query/select_singer_with_join_using.sql.txt index e37df1cb..a68579f7 100644 --- a/testdata/result/query/select_singer_with_join_using.sql.txt +++ b/testdata/result/query/select_singer_with_join_using.sql.txt @@ -9,13 +9,8 @@ FROM --- AST &ast.QueryStatement{ - Hint: (*ast.Hint)(nil), - With: (*ast.With)(nil), Query: &ast.Select{ - Select: 0, - Distinct: false, - As: nil, - Results: []ast.SelectItem{ + Results: []ast.SelectItem{ &ast.Star{ Star: 9, }, @@ -23,17 +18,14 @@ FROM From: &ast.From{ From: 11, Source: &ast.Join{ - Op: "LEFT OUTER JOIN", - Method: "", - Hint: (*ast.Hint)(nil), - Left: &ast.TableName{ + Op: "LEFT OUTER JOIN", + Left: &ast.TableName{ Table: &ast.Ident{ NamePos: 18, NameEnd: 25, Name: "Singers", }, - Hint: (*ast.Hint)(nil), - As: &ast.AsAlias{ + As: &ast.AsAlias{ As: -1, Alias: &ast.Ident{ NamePos: 26, @@ -41,7 +33,6 @@ FROM Name: "A", }, }, - Sample: (*ast.TableSample)(nil), }, Right: &ast.TableName{ Table: &ast.Ident{ @@ -49,8 +40,7 @@ FROM NameEnd: 55, Name: "Singers", }, - Hint: (*ast.Hint)(nil), - As: &ast.AsAlias{ + As: &ast.AsAlias{ As: -1, Alias: &ast.Ident{ NamePos: 56, @@ -58,7 +48,6 @@ FROM Name: "B", }, }, - Sample: (*ast.TableSample)(nil), }, Cond: &ast.Using{ Using: 60, @@ -78,11 +67,6 @@ FROM }, }, }, - Where: (*ast.Where)(nil), - GroupBy: (*ast.GroupBy)(nil), - Having: (*ast.Having)(nil), - OrderBy: (*ast.OrderBy)(nil), - Limit: (*ast.Limit)(nil), }, } diff --git a/testdata/result/query/select_singer_with_join_various.sql.txt b/testdata/result/query/select_singer_with_join_various.sql.txt index 45d847b9..17f7be5a 100644 --- a/testdata/result/query/select_singer_with_join_various.sql.txt +++ b/testdata/result/query/select_singer_with_join_various.sql.txt @@ -32,13 +32,8 @@ FROM --- AST &ast.QueryStatement{ - Hint: (*ast.Hint)(nil), - With: (*ast.With)(nil), Query: &ast.Select{ - Select: 0, - Distinct: false, - As: nil, - Results: []ast.SelectItem{ + Results: []ast.SelectItem{ &ast.Star{ Star: 9, }, @@ -46,49 +41,30 @@ FROM From: &ast.From{ From: 11, Source: &ast.Join{ - Op: "RIGHT OUTER JOIN", - Method: "", - Hint: (*ast.Hint)(nil), - Left: &ast.Join{ - Op: "RIGHT OUTER JOIN", - Method: "", - Hint: (*ast.Hint)(nil), - Left: &ast.Join{ - Op: "LEFT OUTER JOIN", - Method: "", - Hint: (*ast.Hint)(nil), - Left: &ast.Join{ - Op: "LEFT OUTER JOIN", - Method: "", - Hint: (*ast.Hint)(nil), - Left: &ast.Join{ - Op: "FULL OUTER JOIN", - Method: "", - Hint: (*ast.Hint)(nil), - Left: &ast.Join{ - Op: "FULL OUTER JOIN", - Method: "", - Hint: (*ast.Hint)(nil), - Left: &ast.Join{ - Op: "CROSS JOIN", - Method: "", - Hint: (*ast.Hint)(nil), - Left: &ast.Join{ - Op: "INNER JOIN", - Method: "", - Hint: (*ast.Hint)(nil), - Left: &ast.Join{ - Op: "INNER JOIN", - Method: "", - Hint: (*ast.Hint)(nil), - Left: &ast.TableName{ + Op: "RIGHT OUTER JOIN", + Left: &ast.Join{ + Op: "RIGHT OUTER JOIN", + Left: &ast.Join{ + Op: "LEFT OUTER JOIN", + Left: &ast.Join{ + Op: "LEFT OUTER JOIN", + Left: &ast.Join{ + Op: "FULL OUTER JOIN", + Left: &ast.Join{ + Op: "FULL OUTER JOIN", + Left: &ast.Join{ + Op: "CROSS JOIN", + Left: &ast.Join{ + Op: "INNER JOIN", + Left: &ast.Join{ + Op: "INNER JOIN", + Left: &ast.TableName{ Table: &ast.Ident{ NamePos: 18, NameEnd: 25, Name: "Singers", }, - Hint: (*ast.Hint)(nil), - As: &ast.AsAlias{ + As: &ast.AsAlias{ As: -1, Alias: &ast.Ident{ NamePos: 26, @@ -96,7 +72,6 @@ FROM Name: "A", }, }, - Sample: (*ast.TableSample)(nil), }, Right: &ast.TableName{ Table: &ast.Ident{ @@ -104,8 +79,7 @@ FROM NameEnd: 44, Name: "Singers", }, - Hint: (*ast.Hint)(nil), - As: &ast.AsAlias{ + As: &ast.AsAlias{ As: -1, Alias: &ast.Ident{ NamePos: 45, @@ -113,7 +87,6 @@ FROM Name: "B", }, }, - Sample: (*ast.TableSample)(nil), }, Cond: &ast.On{ On: 49, @@ -156,8 +129,7 @@ FROM NameEnd: 98, Name: "Singers", }, - Hint: (*ast.Hint)(nil), - As: &ast.AsAlias{ + As: &ast.AsAlias{ As: -1, Alias: &ast.Ident{ NamePos: 99, @@ -165,7 +137,6 @@ FROM Name: "C", }, }, - Sample: (*ast.TableSample)(nil), }, Cond: &ast.On{ On: 103, @@ -208,8 +179,7 @@ FROM NameEnd: 152, Name: "Singers", }, - Hint: (*ast.Hint)(nil), - As: &ast.AsAlias{ + As: &ast.AsAlias{ As: -1, Alias: &ast.Ident{ NamePos: 153, @@ -217,9 +187,7 @@ FROM Name: "D", }, }, - Sample: (*ast.TableSample)(nil), }, - Cond: nil, }, Right: &ast.TableName{ Table: &ast.Ident{ @@ -227,8 +195,7 @@ FROM NameEnd: 176, Name: "Singers", }, - Hint: (*ast.Hint)(nil), - As: &ast.AsAlias{ + As: &ast.AsAlias{ As: -1, Alias: &ast.Ident{ NamePos: 177, @@ -236,7 +203,6 @@ FROM Name: "E", }, }, - Sample: (*ast.TableSample)(nil), }, Cond: &ast.On{ On: 181, @@ -279,8 +245,7 @@ FROM NameEnd: 235, Name: "Singers", }, - Hint: (*ast.Hint)(nil), - As: &ast.AsAlias{ + As: &ast.AsAlias{ As: -1, Alias: &ast.Ident{ NamePos: 236, @@ -288,7 +253,6 @@ FROM Name: "F", }, }, - Sample: (*ast.TableSample)(nil), }, Cond: &ast.On{ On: 240, @@ -331,8 +295,7 @@ FROM NameEnd: 288, Name: "Singers", }, - Hint: (*ast.Hint)(nil), - As: &ast.AsAlias{ + As: &ast.AsAlias{ As: -1, Alias: &ast.Ident{ NamePos: 289, @@ -340,7 +303,6 @@ FROM Name: "G", }, }, - Sample: (*ast.TableSample)(nil), }, Cond: &ast.On{ On: 293, @@ -383,8 +345,7 @@ FROM NameEnd: 347, Name: "Singers", }, - Hint: (*ast.Hint)(nil), - As: &ast.AsAlias{ + As: &ast.AsAlias{ As: -1, Alias: &ast.Ident{ NamePos: 348, @@ -392,7 +353,6 @@ FROM Name: "H", }, }, - Sample: (*ast.TableSample)(nil), }, Cond: &ast.On{ On: 352, @@ -435,8 +395,7 @@ FROM NameEnd: 401, Name: "Singers", }, - Hint: (*ast.Hint)(nil), - As: &ast.AsAlias{ + As: &ast.AsAlias{ As: -1, Alias: &ast.Ident{ NamePos: 402, @@ -444,7 +403,6 @@ FROM Name: "I", }, }, - Sample: (*ast.TableSample)(nil), }, Cond: &ast.On{ On: 406, @@ -487,8 +445,7 @@ FROM NameEnd: 461, Name: "Singers", }, - Hint: (*ast.Hint)(nil), - As: &ast.AsAlias{ + As: &ast.AsAlias{ As: -1, Alias: &ast.Ident{ NamePos: 462, @@ -496,7 +453,6 @@ FROM Name: "J", }, }, - Sample: (*ast.TableSample)(nil), }, Cond: &ast.On{ On: 466, @@ -534,11 +490,6 @@ FROM }, }, }, - Where: (*ast.Where)(nil), - GroupBy: (*ast.GroupBy)(nil), - Having: (*ast.Having)(nil), - OrderBy: (*ast.OrderBy)(nil), - Limit: (*ast.Limit)(nil), }, } diff --git a/testdata/result/query/select_singer_with_limit.sql.txt b/testdata/result/query/select_singer_with_limit.sql.txt index 388574d4..b218c210 100644 --- a/testdata/result/query/select_singer_with_limit.sql.txt +++ b/testdata/result/query/select_singer_with_limit.sql.txt @@ -7,13 +7,8 @@ LIMIT 100 --- AST &ast.QueryStatement{ - Hint: (*ast.Hint)(nil), - With: (*ast.With)(nil), Query: &ast.Select{ - Select: 0, - Distinct: false, - As: nil, - Results: []ast.SelectItem{ + Results: []ast.SelectItem{ &ast.Star{ Star: 9, }, @@ -26,16 +21,9 @@ LIMIT 100 NameEnd: 25, Name: "Singers", }, - Hint: (*ast.Hint)(nil), - As: (*ast.AsAlias)(nil), - Sample: (*ast.TableSample)(nil), }, }, - Where: (*ast.Where)(nil), - GroupBy: (*ast.GroupBy)(nil), - Having: (*ast.Having)(nil), - OrderBy: (*ast.OrderBy)(nil), - Limit: &ast.Limit{ + Limit: &ast.Limit{ Limit: 26, Count: &ast.IntLiteral{ ValuePos: 32, @@ -43,7 +31,6 @@ LIMIT 100 Base: 10, Value: "100", }, - Offset: (*ast.Offset)(nil), }, }, } diff --git a/testdata/result/query/select_singer_with_limit_and_skiprows.sql.txt b/testdata/result/query/select_singer_with_limit_and_skiprows.sql.txt index f1293a6a..70c56b1f 100644 --- a/testdata/result/query/select_singer_with_limit_and_skiprows.sql.txt +++ b/testdata/result/query/select_singer_with_limit_and_skiprows.sql.txt @@ -8,13 +8,8 @@ OFFSET 10 --- AST &ast.QueryStatement{ - Hint: (*ast.Hint)(nil), - With: (*ast.With)(nil), Query: &ast.Select{ - Select: 0, - Distinct: false, - As: nil, - Results: []ast.SelectItem{ + Results: []ast.SelectItem{ &ast.Star{ Star: 9, }, @@ -27,16 +22,9 @@ OFFSET 10 NameEnd: 25, Name: "Singers", }, - Hint: (*ast.Hint)(nil), - As: (*ast.AsAlias)(nil), - Sample: (*ast.TableSample)(nil), }, }, - Where: (*ast.Where)(nil), - GroupBy: (*ast.GroupBy)(nil), - Having: (*ast.Having)(nil), - OrderBy: (*ast.OrderBy)(nil), - Limit: &ast.Limit{ + Limit: &ast.Limit{ Limit: 26, Count: &ast.IntLiteral{ ValuePos: 32, diff --git a/testdata/result/query/select_singer_with_orderby.sql.txt b/testdata/result/query/select_singer_with_orderby.sql.txt index 564ee7f5..5172b5f3 100644 --- a/testdata/result/query/select_singer_with_orderby.sql.txt +++ b/testdata/result/query/select_singer_with_orderby.sql.txt @@ -9,13 +9,8 @@ ORDER BY BirthDate DESC --- AST &ast.QueryStatement{ - Hint: (*ast.Hint)(nil), - With: (*ast.With)(nil), Query: &ast.Select{ - Select: 0, - Distinct: false, - As: nil, - Results: []ast.SelectItem{ + Results: []ast.SelectItem{ &ast.Star{ Star: 9, }, @@ -28,14 +23,8 @@ ORDER BY NameEnd: 25, Name: "Singers", }, - Hint: (*ast.Hint)(nil), - As: (*ast.AsAlias)(nil), - Sample: (*ast.TableSample)(nil), }, }, - Where: (*ast.Where)(nil), - GroupBy: (*ast.GroupBy)(nil), - Having: (*ast.Having)(nil), OrderBy: &ast.OrderBy{ Order: 26, Items: []*ast.OrderByItem{ @@ -46,8 +35,6 @@ ORDER BY NameEnd: 46, Name: "FirstName", }, - Collate: (*ast.Collate)(nil), - Dir: "", }, &ast.OrderByItem{ DirPos: -1, @@ -64,7 +51,6 @@ ORDER BY Value: "en_US", }, }, - Dir: "", }, &ast.OrderByItem{ DirPos: 88, @@ -73,12 +59,10 @@ ORDER BY NameEnd: 87, Name: "BirthDate", }, - Collate: (*ast.Collate)(nil), - Dir: "DESC", + Dir: "DESC", }, }, }, - Limit: (*ast.Limit)(nil), }, } diff --git a/testdata/result/query/select_singer_with_query_parameter.sql.txt b/testdata/result/query/select_singer_with_query_parameter.sql.txt index 3ec0effb..6eb90de2 100644 --- a/testdata/result/query/select_singer_with_query_parameter.sql.txt +++ b/testdata/result/query/select_singer_with_query_parameter.sql.txt @@ -9,13 +9,8 @@ WHERE --- AST &ast.QueryStatement{ - Hint: (*ast.Hint)(nil), - With: (*ast.With)(nil), Query: &ast.Select{ - Select: 0, - Distinct: false, - As: nil, - Results: []ast.SelectItem{ + Results: []ast.SelectItem{ &ast.Star{ Star: 9, }, @@ -28,9 +23,6 @@ WHERE NameEnd: 25, Name: "Singers", }, - Hint: (*ast.Hint)(nil), - As: (*ast.AsAlias)(nil), - Sample: (*ast.TableSample)(nil), }, }, Where: &ast.Where{ @@ -63,10 +55,6 @@ WHERE }, }, }, - GroupBy: (*ast.GroupBy)(nil), - Having: (*ast.Having)(nil), - OrderBy: (*ast.OrderBy)(nil), - Limit: (*ast.Limit)(nil), }, } diff --git a/testdata/result/query/select_singer_with_root_parent.sql.txt b/testdata/result/query/select_singer_with_root_parent.sql.txt index 0347bbaf..967a4a9e 100644 --- a/testdata/result/query/select_singer_with_root_parent.sql.txt +++ b/testdata/result/query/select_singer_with_root_parent.sql.txt @@ -3,16 +3,11 @@ --- AST &ast.QueryStatement{ - Hint: (*ast.Hint)(nil), - With: (*ast.With)(nil), Query: &ast.SubQuery{ - Lparen: 0, Rparen: 24, Query: &ast.Select{ - Select: 2, - Distinct: false, - As: nil, - Results: []ast.SelectItem{ + Select: 2, + Results: []ast.SelectItem{ &ast.Star{ Star: 9, }, @@ -25,19 +20,9 @@ NameEnd: 23, Name: "Singers", }, - Hint: (*ast.Hint)(nil), - As: (*ast.AsAlias)(nil), - Sample: (*ast.TableSample)(nil), }, }, - Where: (*ast.Where)(nil), - GroupBy: (*ast.GroupBy)(nil), - Having: (*ast.Having)(nil), - OrderBy: (*ast.OrderBy)(nil), - Limit: (*ast.Limit)(nil), }, - OrderBy: (*ast.OrderBy)(nil), - Limit: (*ast.Limit)(nil), }, } diff --git a/testdata/result/query/select_singer_with_select_in_from.sql.txt b/testdata/result/query/select_singer_with_select_in_from.sql.txt index 6502a2a8..8945f214 100644 --- a/testdata/result/query/select_singer_with_select_in_from.sql.txt +++ b/testdata/result/query/select_singer_with_select_in_from.sql.txt @@ -12,13 +12,8 @@ FROM ( --- AST &ast.QueryStatement{ - Hint: (*ast.Hint)(nil), - With: (*ast.With)(nil), Query: &ast.Select{ - Select: 0, - Distinct: false, - As: nil, - Results: []ast.SelectItem{ + Results: []ast.SelectItem{ &ast.Star{ Star: 9, }, @@ -29,10 +24,8 @@ FROM ( Lparen: 16, Rparen: 77, Query: &ast.Select{ - Select: 20, - Distinct: false, - As: nil, - Results: []ast.SelectItem{ + Select: 20, + Results: []ast.SelectItem{ &ast.Star{ Star: 31, }, @@ -45,9 +38,6 @@ FROM ( NameEnd: 51, Name: "Singers", }, - Hint: (*ast.Hint)(nil), - As: (*ast.AsAlias)(nil), - Sample: (*ast.TableSample)(nil), }, }, Where: &ast.Where{ @@ -67,20 +57,9 @@ FROM ( }, }, }, - GroupBy: (*ast.GroupBy)(nil), - Having: (*ast.Having)(nil), - OrderBy: (*ast.OrderBy)(nil), - Limit: (*ast.Limit)(nil), }, - As: (*ast.AsAlias)(nil), - Sample: (*ast.TableSample)(nil), }, }, - Where: (*ast.Where)(nil), - GroupBy: (*ast.GroupBy)(nil), - Having: (*ast.Having)(nil), - OrderBy: (*ast.OrderBy)(nil), - Limit: (*ast.Limit)(nil), }, } diff --git a/testdata/result/query/select_singer_with_select_in_from_and_as.sql.txt b/testdata/result/query/select_singer_with_select_in_from_and_as.sql.txt index fda2490e..7b5f6b4b 100644 --- a/testdata/result/query/select_singer_with_select_in_from_and_as.sql.txt +++ b/testdata/result/query/select_singer_with_select_in_from_and_as.sql.txt @@ -12,13 +12,8 @@ FROM ( --- AST &ast.QueryStatement{ - Hint: (*ast.Hint)(nil), - With: (*ast.With)(nil), Query: &ast.Select{ - Select: 0, - Distinct: false, - As: nil, - Results: []ast.SelectItem{ + Results: []ast.SelectItem{ &ast.Star{ Star: 9, }, @@ -29,10 +24,8 @@ FROM ( Lparen: 16, Rparen: 77, Query: &ast.Select{ - Select: 20, - Distinct: false, - As: nil, - Results: []ast.SelectItem{ + Select: 20, + Results: []ast.SelectItem{ &ast.Star{ Star: 31, }, @@ -45,9 +38,6 @@ FROM ( NameEnd: 51, Name: "Singers", }, - Hint: (*ast.Hint)(nil), - As: (*ast.AsAlias)(nil), - Sample: (*ast.TableSample)(nil), }, }, Where: &ast.Where{ @@ -67,10 +57,6 @@ FROM ( }, }, }, - GroupBy: (*ast.GroupBy)(nil), - Having: (*ast.Having)(nil), - OrderBy: (*ast.OrderBy)(nil), - Limit: (*ast.Limit)(nil), }, As: &ast.AsAlias{ As: 79, @@ -80,14 +66,8 @@ FROM ( Name: "S", }, }, - Sample: (*ast.TableSample)(nil), }, }, - Where: (*ast.Where)(nil), - GroupBy: (*ast.GroupBy)(nil), - Having: (*ast.Having)(nil), - OrderBy: (*ast.OrderBy)(nil), - Limit: (*ast.Limit)(nil), }, } diff --git a/testdata/result/query/select_singer_with_single_column_subquery.sql.txt b/testdata/result/query/select_singer_with_single_column_subquery.sql.txt index 976b4b8a..922f1ac1 100644 --- a/testdata/result/query/select_singer_with_single_column_subquery.sql.txt +++ b/testdata/result/query/select_singer_with_single_column_subquery.sql.txt @@ -6,22 +6,15 @@ SELECT ( --- AST &ast.QueryStatement{ - Hint: (*ast.Hint)(nil), - With: (*ast.With)(nil), Query: &ast.Select{ - Select: 0, - Distinct: false, - As: nil, - Results: []ast.SelectItem{ + Results: []ast.SelectItem{ &ast.ExprSelectItem{ Expr: &ast.ScalarSubQuery{ Lparen: 7, Rparen: 53, Query: &ast.Select{ - Select: 11, - Distinct: false, - As: nil, - Results: []ast.SelectItem{ + Select: 11, + Results: []ast.SelectItem{ &ast.ExprSelectItem{ Expr: &ast.Ident{ NamePos: 18, @@ -38,16 +31,9 @@ SELECT ( NameEnd: 42, Name: "Singers", }, - Hint: (*ast.Hint)(nil), - As: (*ast.AsAlias)(nil), - Sample: (*ast.TableSample)(nil), }, }, - Where: (*ast.Where)(nil), - GroupBy: (*ast.GroupBy)(nil), - Having: (*ast.Having)(nil), - OrderBy: (*ast.OrderBy)(nil), - Limit: &ast.Limit{ + Limit: &ast.Limit{ Limit: 43, Count: &ast.IntLiteral{ ValuePos: 49, @@ -55,18 +41,11 @@ SELECT ( Base: 10, Value: "100", }, - Offset: (*ast.Offset)(nil), }, }, }, }, }, - From: (*ast.From)(nil), - Where: (*ast.Where)(nil), - GroupBy: (*ast.GroupBy)(nil), - Having: (*ast.Having)(nil), - OrderBy: (*ast.OrderBy)(nil), - Limit: (*ast.Limit)(nil), }, } diff --git a/testdata/result/query/select_singer_with_single_column_subquery_with_at.sql.txt b/testdata/result/query/select_singer_with_single_column_subquery_with_at.sql.txt index c420f982..9a8668f3 100644 --- a/testdata/result/query/select_singer_with_single_column_subquery_with_at.sql.txt +++ b/testdata/result/query/select_singer_with_single_column_subquery_with_at.sql.txt @@ -6,22 +6,15 @@ SELECT ( --- AST &ast.QueryStatement{ - Hint: (*ast.Hint)(nil), - With: (*ast.With)(nil), Query: &ast.Select{ - Select: 0, - Distinct: false, - As: nil, - Results: []ast.SelectItem{ + Results: []ast.SelectItem{ &ast.Alias{ Expr: &ast.ScalarSubQuery{ Lparen: 7, Rparen: 53, Query: &ast.Select{ - Select: 11, - Distinct: false, - As: nil, - Results: []ast.SelectItem{ + Select: 11, + Results: []ast.SelectItem{ &ast.ExprSelectItem{ Expr: &ast.Ident{ NamePos: 18, @@ -38,16 +31,9 @@ SELECT ( NameEnd: 42, Name: "Singers", }, - Hint: (*ast.Hint)(nil), - As: (*ast.AsAlias)(nil), - Sample: (*ast.TableSample)(nil), }, }, - Where: (*ast.Where)(nil), - GroupBy: (*ast.GroupBy)(nil), - Having: (*ast.Having)(nil), - OrderBy: (*ast.OrderBy)(nil), - Limit: &ast.Limit{ + Limit: &ast.Limit{ Limit: 43, Count: &ast.IntLiteral{ ValuePos: 49, @@ -55,7 +41,6 @@ SELECT ( Base: 10, Value: "100", }, - Offset: (*ast.Offset)(nil), }, }, }, @@ -69,12 +54,6 @@ SELECT ( }, }, }, - From: (*ast.From)(nil), - Where: (*ast.Where)(nil), - GroupBy: (*ast.GroupBy)(nil), - Having: (*ast.Having)(nil), - OrderBy: (*ast.OrderBy)(nil), - Limit: (*ast.Limit)(nil), }, } diff --git a/testdata/result/query/select_singer_with_table_alias.sql.txt b/testdata/result/query/select_singer_with_table_alias.sql.txt index 190521fb..e4423eb7 100644 --- a/testdata/result/query/select_singer_with_table_alias.sql.txt +++ b/testdata/result/query/select_singer_with_table_alias.sql.txt @@ -7,13 +7,8 @@ FROM Singers S --- AST &ast.QueryStatement{ - Hint: (*ast.Hint)(nil), - With: (*ast.With)(nil), Query: &ast.Select{ - Select: 0, - Distinct: false, - As: nil, - Results: []ast.SelectItem{ + Results: []ast.SelectItem{ &ast.DotStar{ Star: 11, Expr: &ast.Ident{ @@ -71,8 +66,7 @@ FROM Singers S NameEnd: 60, Name: "Singers", }, - Hint: (*ast.Hint)(nil), - As: &ast.AsAlias{ + As: &ast.AsAlias{ As: -1, Alias: &ast.Ident{ NamePos: 61, @@ -80,14 +74,8 @@ FROM Singers S Name: "S", }, }, - Sample: (*ast.TableSample)(nil), }, }, - Where: (*ast.Where)(nil), - GroupBy: (*ast.GroupBy)(nil), - Having: (*ast.Having)(nil), - OrderBy: (*ast.OrderBy)(nil), - Limit: (*ast.Limit)(nil), }, } diff --git a/testdata/result/query/select_singer_with_table_alias_with_hint.sql.txt b/testdata/result/query/select_singer_with_table_alias_with_hint.sql.txt index 3d72f5bf..0632d7a7 100644 --- a/testdata/result/query/select_singer_with_table_alias_with_hint.sql.txt +++ b/testdata/result/query/select_singer_with_table_alias_with_hint.sql.txt @@ -6,13 +6,8 @@ FROM --- AST &ast.QueryStatement{ - Hint: (*ast.Hint)(nil), - With: (*ast.With)(nil), Query: &ast.Select{ - Select: 0, - Distinct: false, - As: nil, - Results: []ast.SelectItem{ + Results: []ast.SelectItem{ &ast.Star{ Star: 9, }, @@ -51,14 +46,8 @@ FROM Name: "S", }, }, - Sample: (*ast.TableSample)(nil), }, }, - Where: (*ast.Where)(nil), - GroupBy: (*ast.GroupBy)(nil), - Having: (*ast.Having)(nil), - OrderBy: (*ast.OrderBy)(nil), - Limit: (*ast.Limit)(nil), }, } diff --git a/testdata/result/query/select_singer_with_table_hint.sql.txt b/testdata/result/query/select_singer_with_table_hint.sql.txt index 5bac204b..ceac381e 100644 --- a/testdata/result/query/select_singer_with_table_hint.sql.txt +++ b/testdata/result/query/select_singer_with_table_hint.sql.txt @@ -6,13 +6,8 @@ FROM --- AST &ast.QueryStatement{ - Hint: (*ast.Hint)(nil), - With: (*ast.With)(nil), Query: &ast.Select{ - Select: 0, - Distinct: false, - As: nil, - Results: []ast.SelectItem{ + Results: []ast.SelectItem{ &ast.Star{ Star: 9, }, @@ -43,15 +38,8 @@ FROM }, }, }, - As: (*ast.AsAlias)(nil), - Sample: (*ast.TableSample)(nil), }, }, - Where: (*ast.Where)(nil), - GroupBy: (*ast.GroupBy)(nil), - Having: (*ast.Having)(nil), - OrderBy: (*ast.OrderBy)(nil), - Limit: (*ast.Limit)(nil), }, } diff --git a/testdata/result/query/select_singer_with_tablesample.sql.txt b/testdata/result/query/select_singer_with_tablesample.sql.txt index f333017d..6f4e56c8 100644 --- a/testdata/result/query/select_singer_with_tablesample.sql.txt +++ b/testdata/result/query/select_singer_with_tablesample.sql.txt @@ -8,13 +8,8 @@ FROM --- AST &ast.QueryStatement{ - Hint: (*ast.Hint)(nil), - With: (*ast.With)(nil), Query: &ast.Select{ - Select: 0, - Distinct: false, - As: nil, - Results: []ast.SelectItem{ + Results: []ast.SelectItem{ &ast.Star{ Star: 9, }, @@ -22,21 +17,16 @@ FROM From: &ast.From{ From: 11, Source: &ast.Join{ - Op: ",", - Method: "", - Hint: (*ast.Hint)(nil), - Left: &ast.Join{ - Op: ",", - Method: "", - Hint: (*ast.Hint)(nil), - Left: &ast.TableName{ + Op: ",", + Left: &ast.Join{ + Op: ",", + Left: &ast.TableName{ Table: &ast.Ident{ NamePos: 18, NameEnd: 25, Name: "Singers", }, - Hint: (*ast.Hint)(nil), - As: &ast.AsAlias{ + As: &ast.AsAlias{ As: 26, Alias: &ast.Ident{ NamePos: 29, @@ -66,8 +56,7 @@ FROM NameEnd: 74, Name: "Singers", }, - Hint: (*ast.Hint)(nil), - As: &ast.AsAlias{ + As: &ast.AsAlias{ As: 75, Alias: &ast.Ident{ NamePos: 78, @@ -90,7 +79,6 @@ FROM }, }, }, - Cond: nil, }, Right: &ast.TableName{ Table: &ast.Ident{ @@ -98,8 +86,7 @@ FROM NameEnd: 126, Name: "Singers", }, - Hint: (*ast.Hint)(nil), - As: &ast.AsAlias{ + As: &ast.AsAlias{ As: 127, Alias: &ast.Ident{ NamePos: 130, @@ -122,14 +109,8 @@ FROM }, }, }, - Cond: nil, }, }, - Where: (*ast.Where)(nil), - GroupBy: (*ast.GroupBy)(nil), - Having: (*ast.Having)(nil), - OrderBy: (*ast.OrderBy)(nil), - Limit: (*ast.Limit)(nil), }, } diff --git a/testdata/result/query/select_singer_with_tableset.sql.txt b/testdata/result/query/select_singer_with_tableset.sql.txt index d86f32dc..11c86d6e 100644 --- a/testdata/result/query/select_singer_with_tableset.sql.txt +++ b/testdata/result/query/select_singer_with_tableset.sql.txt @@ -5,17 +5,11 @@ SELECT * FROM Singers --- AST &ast.QueryStatement{ - Hint: (*ast.Hint)(nil), - With: (*ast.With)(nil), Query: &ast.CompoundQuery{ - Op: "UNION", - Distinct: false, - Queries: []ast.QueryExpr{ + Op: "UNION", + Queries: []ast.QueryExpr{ &ast.Select{ - Select: 0, - Distinct: false, - As: nil, - Results: []ast.SelectItem{ + Results: []ast.SelectItem{ &ast.Star{ Star: 7, }, @@ -28,22 +22,12 @@ SELECT * FROM Singers NameEnd: 21, Name: "Singers", }, - Hint: (*ast.Hint)(nil), - As: (*ast.AsAlias)(nil), - Sample: (*ast.TableSample)(nil), }, }, - Where: (*ast.Where)(nil), - GroupBy: (*ast.GroupBy)(nil), - Having: (*ast.Having)(nil), - OrderBy: (*ast.OrderBy)(nil), - Limit: (*ast.Limit)(nil), }, &ast.Select{ - Select: 32, - Distinct: false, - As: nil, - Results: []ast.SelectItem{ + Select: 32, + Results: []ast.SelectItem{ &ast.Star{ Star: 39, }, @@ -56,20 +40,10 @@ SELECT * FROM Singers NameEnd: 53, Name: "Singers", }, - Hint: (*ast.Hint)(nil), - As: (*ast.AsAlias)(nil), - Sample: (*ast.TableSample)(nil), }, }, - Where: (*ast.Where)(nil), - GroupBy: (*ast.GroupBy)(nil), - Having: (*ast.Having)(nil), - OrderBy: (*ast.OrderBy)(nil), - Limit: (*ast.Limit)(nil), }, }, - OrderBy: (*ast.OrderBy)(nil), - Limit: (*ast.Limit)(nil), }, } diff --git a/testdata/result/query/select_singer_with_tableset_complex.sql.txt b/testdata/result/query/select_singer_with_tableset_complex.sql.txt index 39c7e022..4deb7325 100644 --- a/testdata/result/query/select_singer_with_tableset_complex.sql.txt +++ b/testdata/result/query/select_singer_with_tableset_complex.sql.txt @@ -25,17 +25,11 @@ UNION ALL --- AST &ast.QueryStatement{ - Hint: (*ast.Hint)(nil), - With: (*ast.With)(nil), Query: &ast.CompoundQuery{ - Op: "UNION", - Distinct: false, - Queries: []ast.QueryExpr{ + Op: "UNION", + Queries: []ast.QueryExpr{ &ast.Select{ - Select: 0, - Distinct: false, - As: nil, - Results: []ast.SelectItem{ + Results: []ast.SelectItem{ &ast.Star{ Star: 7, }, @@ -48,16 +42,8 @@ UNION ALL NameEnd: 21, Name: "Singers", }, - Hint: (*ast.Hint)(nil), - As: (*ast.AsAlias)(nil), - Sample: (*ast.TableSample)(nil), }, }, - Where: (*ast.Where)(nil), - GroupBy: (*ast.GroupBy)(nil), - Having: (*ast.Having)(nil), - OrderBy: (*ast.OrderBy)(nil), - Limit: (*ast.Limit)(nil), }, &ast.SubQuery{ Lparen: 32, @@ -67,10 +53,8 @@ UNION ALL Distinct: true, Queries: []ast.QueryExpr{ &ast.Select{ - Select: 36, - Distinct: false, - As: nil, - Results: []ast.SelectItem{ + Select: 36, + Results: []ast.SelectItem{ &ast.Star{ Star: 43, }, @@ -83,29 +67,18 @@ UNION ALL NameEnd: 57, Name: "Singers", }, - Hint: (*ast.Hint)(nil), - As: (*ast.AsAlias)(nil), - Sample: (*ast.TableSample)(nil), }, }, - Where: (*ast.Where)(nil), - GroupBy: (*ast.GroupBy)(nil), - Having: (*ast.Having)(nil), - OrderBy: (*ast.OrderBy)(nil), - Limit: (*ast.Limit)(nil), }, &ast.SubQuery{ Lparen: 77, Rparen: 365, Query: &ast.CompoundQuery{ - Op: "INTERSECT", - Distinct: false, - Queries: []ast.QueryExpr{ + Op: "INTERSECT", + Queries: []ast.QueryExpr{ &ast.Select{ - Select: 83, - Distinct: false, - As: nil, - Results: []ast.SelectItem{ + Select: 83, + Results: []ast.SelectItem{ &ast.Star{ Star: 90, }, @@ -118,16 +91,8 @@ UNION ALL NameEnd: 104, Name: "Singers", }, - Hint: (*ast.Hint)(nil), - As: (*ast.AsAlias)(nil), - Sample: (*ast.TableSample)(nil), }, }, - Where: (*ast.Where)(nil), - GroupBy: (*ast.GroupBy)(nil), - Having: (*ast.Having)(nil), - OrderBy: (*ast.OrderBy)(nil), - Limit: (*ast.Limit)(nil), }, &ast.SubQuery{ Lparen: 127, @@ -137,10 +102,8 @@ UNION ALL Distinct: true, Queries: []ast.QueryExpr{ &ast.Select{ - Select: 135, - Distinct: false, - As: nil, - Results: []ast.SelectItem{ + Select: 135, + Results: []ast.SelectItem{ &ast.Star{ Star: 142, }, @@ -153,29 +116,18 @@ UNION ALL NameEnd: 156, Name: "Singers", }, - Hint: (*ast.Hint)(nil), - As: (*ast.AsAlias)(nil), - Sample: (*ast.TableSample)(nil), }, }, - Where: (*ast.Where)(nil), - GroupBy: (*ast.GroupBy)(nil), - Having: (*ast.Having)(nil), - OrderBy: (*ast.OrderBy)(nil), - Limit: (*ast.Limit)(nil), }, &ast.SubQuery{ Lparen: 188, Rparen: 355, Query: &ast.CompoundQuery{ - Op: "EXCEPT", - Distinct: false, - Queries: []ast.QueryExpr{ + Op: "EXCEPT", + Queries: []ast.QueryExpr{ &ast.Select{ - Select: 198, - Distinct: false, - As: nil, - Results: []ast.SelectItem{ + Select: 198, + Results: []ast.SelectItem{ &ast.Star{ Star: 205, }, @@ -188,16 +140,8 @@ UNION ALL NameEnd: 219, Name: "Singers", }, - Hint: (*ast.Hint)(nil), - As: (*ast.AsAlias)(nil), - Sample: (*ast.TableSample)(nil), }, }, - Where: (*ast.Where)(nil), - GroupBy: (*ast.GroupBy)(nil), - Having: (*ast.Having)(nil), - OrderBy: (*ast.OrderBy)(nil), - Limit: (*ast.Limit)(nil), }, &ast.SubQuery{ Lparen: 247, @@ -207,10 +151,8 @@ UNION ALL Distinct: true, Queries: []ast.QueryExpr{ &ast.Select{ - Select: 259, - Distinct: false, - As: nil, - Results: []ast.SelectItem{ + Select: 259, + Results: []ast.SelectItem{ &ast.Star{ Star: 266, }, @@ -223,22 +165,12 @@ UNION ALL NameEnd: 280, Name: "Singers", }, - Hint: (*ast.Hint)(nil), - As: (*ast.AsAlias)(nil), - Sample: (*ast.TableSample)(nil), }, }, - Where: (*ast.Where)(nil), - GroupBy: (*ast.GroupBy)(nil), - Having: (*ast.Having)(nil), - OrderBy: (*ast.OrderBy)(nil), - Limit: (*ast.Limit)(nil), }, &ast.Select{ - Select: 317, - Distinct: false, - As: nil, - Results: []ast.SelectItem{ + Select: 317, + Results: []ast.SelectItem{ &ast.Star{ Star: 324, }, @@ -251,55 +183,25 @@ UNION ALL NameEnd: 338, Name: "Singers", }, - Hint: (*ast.Hint)(nil), - As: (*ast.AsAlias)(nil), - Sample: (*ast.TableSample)(nil), }, }, - Where: (*ast.Where)(nil), - GroupBy: (*ast.GroupBy)(nil), - Having: (*ast.Having)(nil), - OrderBy: (*ast.OrderBy)(nil), - Limit: (*ast.Limit)(nil), }, }, - OrderBy: (*ast.OrderBy)(nil), - Limit: (*ast.Limit)(nil), }, - OrderBy: (*ast.OrderBy)(nil), - Limit: (*ast.Limit)(nil), }, }, - OrderBy: (*ast.OrderBy)(nil), - Limit: (*ast.Limit)(nil), }, - OrderBy: (*ast.OrderBy)(nil), - Limit: (*ast.Limit)(nil), }, }, - OrderBy: (*ast.OrderBy)(nil), - Limit: (*ast.Limit)(nil), }, - OrderBy: (*ast.OrderBy)(nil), - Limit: (*ast.Limit)(nil), }, }, - OrderBy: (*ast.OrderBy)(nil), - Limit: (*ast.Limit)(nil), }, - OrderBy: (*ast.OrderBy)(nil), - Limit: (*ast.Limit)(nil), }, }, - OrderBy: (*ast.OrderBy)(nil), - Limit: (*ast.Limit)(nil), }, - OrderBy: (*ast.OrderBy)(nil), - Limit: (*ast.Limit)(nil), }, }, - OrderBy: (*ast.OrderBy)(nil), - Limit: (*ast.Limit)(nil), }, } diff --git a/testdata/result/query/select_singer_with_tableset_with_where.sql.txt b/testdata/result/query/select_singer_with_tableset_with_where.sql.txt index 06389511..f4b5aa50 100644 --- a/testdata/result/query/select_singer_with_tableset_with_where.sql.txt +++ b/testdata/result/query/select_singer_with_tableset_with_where.sql.txt @@ -9,17 +9,11 @@ ORDER BY --- AST &ast.QueryStatement{ - Hint: (*ast.Hint)(nil), - With: (*ast.With)(nil), Query: &ast.CompoundQuery{ - Op: "UNION", - Distinct: false, - Queries: []ast.QueryExpr{ + Op: "UNION", + Queries: []ast.QueryExpr{ &ast.Select{ - Select: 0, - Distinct: false, - As: nil, - Results: []ast.SelectItem{ + Results: []ast.SelectItem{ &ast.Star{ Star: 7, }, @@ -32,22 +26,12 @@ ORDER BY NameEnd: 21, Name: "Singers", }, - Hint: (*ast.Hint)(nil), - As: (*ast.AsAlias)(nil), - Sample: (*ast.TableSample)(nil), }, }, - Where: (*ast.Where)(nil), - GroupBy: (*ast.GroupBy)(nil), - Having: (*ast.Having)(nil), - OrderBy: (*ast.OrderBy)(nil), - Limit: (*ast.Limit)(nil), }, &ast.Select{ - Select: 32, - Distinct: false, - As: nil, - Results: []ast.SelectItem{ + Select: 32, + Results: []ast.SelectItem{ &ast.Star{ Star: 39, }, @@ -60,9 +44,6 @@ ORDER BY NameEnd: 53, Name: "Singers", }, - Hint: (*ast.Hint)(nil), - As: (*ast.AsAlias)(nil), - Sample: (*ast.TableSample)(nil), }, }, Where: &ast.Where{ @@ -82,10 +63,6 @@ ORDER BY }, }, }, - GroupBy: (*ast.GroupBy)(nil), - Having: (*ast.Having)(nil), - OrderBy: (*ast.OrderBy)(nil), - Limit: (*ast.Limit)(nil), }, }, OrderBy: &ast.OrderBy{ @@ -98,12 +75,9 @@ ORDER BY NameEnd: 95, Name: "FirstName", }, - Collate: (*ast.Collate)(nil), - Dir: "", }, }, }, - Limit: (*ast.Limit)(nil), }, } diff --git a/testdata/result/query/select_singer_with_toplevel_join_hint.sql.txt b/testdata/result/query/select_singer_with_toplevel_join_hint.sql.txt index 450aca21..6b0504d6 100644 --- a/testdata/result/query/select_singer_with_toplevel_join_hint.sql.txt +++ b/testdata/result/query/select_singer_with_toplevel_join_hint.sql.txt @@ -11,7 +11,6 @@ FROM --- AST &ast.QueryStatement{ Hint: &ast.Hint{ - Atmark: 0, Rbrace: 23, Records: []*ast.HintRecord{ &ast.HintRecord{ @@ -27,12 +26,9 @@ FROM }, }, }, - With: (*ast.With)(nil), Query: &ast.Select{ - Select: 25, - Distinct: false, - As: nil, - Results: []ast.SelectItem{ + Select: 25, + Results: []ast.SelectItem{ &ast.Star{ Star: 34, }, @@ -40,17 +36,14 @@ FROM From: &ast.From{ From: 36, Source: &ast.Join{ - Op: "LEFT OUTER JOIN", - Method: "", - Hint: (*ast.Hint)(nil), - Left: &ast.TableName{ + Op: "LEFT OUTER JOIN", + Left: &ast.TableName{ Table: &ast.Ident{ NamePos: 43, NameEnd: 50, Name: "Singers", }, - Hint: (*ast.Hint)(nil), - As: &ast.AsAlias{ + As: &ast.AsAlias{ As: -1, Alias: &ast.Ident{ NamePos: 51, @@ -58,7 +51,6 @@ FROM Name: "A", }, }, - Sample: (*ast.TableSample)(nil), }, Right: &ast.TableName{ Table: &ast.Ident{ @@ -66,8 +58,7 @@ FROM NameEnd: 80, Name: "Singers", }, - Hint: (*ast.Hint)(nil), - As: &ast.AsAlias{ + As: &ast.AsAlias{ As: -1, Alias: &ast.Ident{ NamePos: 81, @@ -75,7 +66,6 @@ FROM Name: "B", }, }, - Sample: (*ast.TableSample)(nil), }, Cond: &ast.On{ On: 85, @@ -113,11 +103,6 @@ FROM }, }, }, - Where: (*ast.Where)(nil), - GroupBy: (*ast.GroupBy)(nil), - Having: (*ast.Having)(nil), - OrderBy: (*ast.OrderBy)(nil), - Limit: (*ast.Limit)(nil), }, } diff --git a/testdata/result/query/select_singer_with_value_hex.sql.txt b/testdata/result/query/select_singer_with_value_hex.sql.txt index 1cd2c0fc..b1694221 100644 --- a/testdata/result/query/select_singer_with_value_hex.sql.txt +++ b/testdata/result/query/select_singer_with_value_hex.sql.txt @@ -8,13 +8,8 @@ WHERE --- AST &ast.QueryStatement{ - Hint: (*ast.Hint)(nil), - With: (*ast.With)(nil), Query: &ast.Select{ - Select: 0, - Distinct: false, - As: nil, - Results: []ast.SelectItem{ + Results: []ast.SelectItem{ &ast.Star{ Star: 9, }, @@ -27,9 +22,6 @@ WHERE NameEnd: 25, Name: "Singers", }, - Hint: (*ast.Hint)(nil), - As: (*ast.AsAlias)(nil), - Sample: (*ast.TableSample)(nil), }, }, Where: &ast.Where{ @@ -49,10 +41,6 @@ WHERE }, }, }, - GroupBy: (*ast.GroupBy)(nil), - Having: (*ast.Having)(nil), - OrderBy: (*ast.OrderBy)(nil), - Limit: (*ast.Limit)(nil), }, } diff --git a/testdata/result/query/select_singer_with_where.sql.txt b/testdata/result/query/select_singer_with_where.sql.txt index 5c42d434..d51994ee 100644 --- a/testdata/result/query/select_singer_with_where.sql.txt +++ b/testdata/result/query/select_singer_with_where.sql.txt @@ -8,13 +8,8 @@ WHERE --- AST &ast.QueryStatement{ - Hint: (*ast.Hint)(nil), - With: (*ast.With)(nil), Query: &ast.Select{ - Select: 0, - Distinct: false, - As: nil, - Results: []ast.SelectItem{ + Results: []ast.SelectItem{ &ast.Star{ Star: 9, }, @@ -27,9 +22,6 @@ WHERE NameEnd: 25, Name: "Singers", }, - Hint: (*ast.Hint)(nil), - As: (*ast.AsAlias)(nil), - Sample: (*ast.TableSample)(nil), }, }, Where: &ast.Where{ @@ -49,10 +41,6 @@ WHERE }, }, }, - GroupBy: (*ast.GroupBy)(nil), - Having: (*ast.Having)(nil), - OrderBy: (*ast.OrderBy)(nil), - Limit: (*ast.Limit)(nil), }, } diff --git a/testdata/result/query/select_singer_with_where_and_comparison.sql.txt b/testdata/result/query/select_singer_with_where_and_comparison.sql.txt index ba18a39e..54044e35 100644 --- a/testdata/result/query/select_singer_with_where_and_comparison.sql.txt +++ b/testdata/result/query/select_singer_with_where_and_comparison.sql.txt @@ -25,13 +25,8 @@ WHERE --- AST &ast.QueryStatement{ - Hint: (*ast.Hint)(nil), - With: (*ast.With)(nil), Query: &ast.Select{ - Select: 0, - Distinct: false, - As: nil, - Results: []ast.SelectItem{ + Results: []ast.SelectItem{ &ast.Star{ Star: 9, }, @@ -44,9 +39,6 @@ WHERE NameEnd: 25, Name: "Singers", }, - Hint: (*ast.Hint)(nil), - As: (*ast.AsAlias)(nil), - Sample: (*ast.TableSample)(nil), }, }, Where: &ast.Where{ @@ -175,7 +167,6 @@ WHERE }, }, Right: &ast.InExpr{ - Not: false, Left: &ast.Ident{ NamePos: 145, NameEnd: 153, @@ -241,7 +232,6 @@ WHERE }, }, Right: &ast.BetweenExpr{ - Not: false, Left: &ast.Ident{ NamePos: 203, NameEnd: 211, @@ -312,7 +302,6 @@ WHERE }, Right: &ast.IsNullExpr{ Null: 329, - Not: false, Left: &ast.NullLiteral{ Null: 321, }, @@ -328,7 +317,6 @@ WHERE }, Right: &ast.IsBoolExpr{ RightPos: 379, - Not: false, Left: &ast.ParenExpr{ Lparen: 361, Rparen: 374, @@ -376,7 +364,6 @@ WHERE }, Right: &ast.IsBoolExpr{ RightPos: 439, - Not: false, Left: &ast.ParenExpr{ Lparen: 421, Rparen: 434, @@ -395,7 +382,6 @@ WHERE }, }, }, - Right: false, }, }, Right: &ast.IsBoolExpr{ @@ -419,14 +405,9 @@ WHERE }, }, }, - Right: false, }, }, }, - GroupBy: (*ast.GroupBy)(nil), - Having: (*ast.Having)(nil), - OrderBy: (*ast.OrderBy)(nil), - Limit: (*ast.Limit)(nil), }, } diff --git a/testdata/result/query/select_singer_with_where_and_op.sql.txt b/testdata/result/query/select_singer_with_where_and_op.sql.txt index e1fa8b0c..4cdc338c 100644 --- a/testdata/result/query/select_singer_with_where_and_op.sql.txt +++ b/testdata/result/query/select_singer_with_where_and_op.sql.txt @@ -8,13 +8,8 @@ WHERE --- AST &ast.QueryStatement{ - Hint: (*ast.Hint)(nil), - With: (*ast.With)(nil), Query: &ast.Select{ - Select: 0, - Distinct: false, - As: nil, - Results: []ast.SelectItem{ + Results: []ast.SelectItem{ &ast.Star{ Star: 9, }, @@ -27,9 +22,6 @@ WHERE NameEnd: 25, Name: "Singers", }, - Hint: (*ast.Hint)(nil), - As: (*ast.AsAlias)(nil), - Sample: (*ast.TableSample)(nil), }, }, Where: &ast.Where{ @@ -81,10 +73,6 @@ WHERE }, }, }, - GroupBy: (*ast.GroupBy)(nil), - Having: (*ast.Having)(nil), - OrderBy: (*ast.OrderBy)(nil), - Limit: (*ast.Limit)(nil), }, } diff --git a/testdata/result/query/select_struct_compare_eq.sql.txt b/testdata/result/query/select_struct_compare_eq.sql.txt index ff3acbd9..2ad47609 100644 --- a/testdata/result/query/select_struct_compare_eq.sql.txt +++ b/testdata/result/query/select_struct_compare_eq.sql.txt @@ -9,22 +9,15 @@ SELECT ARRAY( --- AST &ast.QueryStatement{ - Hint: (*ast.Hint)(nil), - With: (*ast.With)(nil), Query: &ast.Select{ - Select: 0, - Distinct: false, - As: nil, - Results: []ast.SelectItem{ + Results: []ast.SelectItem{ &ast.ExprSelectItem{ Expr: &ast.ArraySubQuery{ Array: 7, Rparen: 133, Query: &ast.Select{ - Select: 16, - Distinct: false, - As: nil, - Results: []ast.SelectItem{ + Select: 16, + Results: []ast.SelectItem{ &ast.Star{ Star: 27, }, @@ -35,10 +28,8 @@ SELECT ARRAY( Lparen: 40, Rparen: 90, Query: &ast.Select{ - Select: 41, - Distinct: false, - As: nil, - Results: []ast.SelectItem{ + Select: 41, + Results: []ast.SelectItem{ &ast.ExprSelectItem{ Expr: &ast.TypedStructLiteral{ Struct: 48, @@ -101,12 +92,6 @@ SELECT ARRAY( }, }, }, - From: (*ast.From)(nil), - Where: (*ast.Where)(nil), - GroupBy: (*ast.GroupBy)(nil), - Having: (*ast.Having)(nil), - OrderBy: (*ast.OrderBy)(nil), - Limit: (*ast.Limit)(nil), }, As: &ast.AsAlias{ As: 92, @@ -116,7 +101,6 @@ SELECT ARRAY( Name: "S", }, }, - Sample: (*ast.TableSample)(nil), }, }, Where: &ast.Where{ @@ -168,20 +152,10 @@ SELECT ARRAY( }, }, }, - GroupBy: (*ast.GroupBy)(nil), - Having: (*ast.Having)(nil), - OrderBy: (*ast.OrderBy)(nil), - Limit: (*ast.Limit)(nil), }, }, }, }, - From: (*ast.From)(nil), - Where: (*ast.Where)(nil), - GroupBy: (*ast.GroupBy)(nil), - Having: (*ast.Having)(nil), - OrderBy: (*ast.OrderBy)(nil), - Limit: (*ast.Limit)(nil), }, } diff --git a/testdata/result/query/select_subscript_operators.sql.txt b/testdata/result/query/select_subscript_operators.sql.txt index 64776a1d..0ee39c7b 100644 --- a/testdata/result/query/select_subscript_operators.sql.txt +++ b/testdata/result/query/select_subscript_operators.sql.txt @@ -15,13 +15,8 @@ select --- AST &ast.QueryStatement{ - Hint: (*ast.Hint)(nil), - With: (*ast.With)(nil), Query: &ast.Select{ - Select: 0, - Distinct: false, - As: nil, - Results: []ast.SelectItem{ + Results: []ast.SelectItem{ &ast.ExprSelectItem{ Expr: &ast.IndexExpr{ Rbrack: 30, @@ -29,7 +24,6 @@ select Array: -1, Lbrack: 11, Rbrack: 19, - Type: nil, Values: []ast.Expr{ &ast.IntLiteral{ ValuePos: 12, @@ -71,7 +65,6 @@ select Array: -1, Lbrack: 37, Rbrack: 45, - Type: nil, Values: []ast.Expr{ &ast.IntLiteral{ ValuePos: 38, @@ -113,7 +106,6 @@ select Array: -1, Lbrack: 64, Rbrack: 72, - Type: nil, Values: []ast.Expr{ &ast.IntLiteral{ ValuePos: 65, @@ -155,7 +147,6 @@ select Array: -1, Lbrack: 95, Rbrack: 103, - Type: nil, Values: []ast.Expr{ &ast.IntLiteral{ ValuePos: 96, @@ -197,7 +188,6 @@ select Array: -1, Lbrack: 122, Rbrack: 130, - Type: nil, Values: []ast.Expr{ &ast.IntLiteral{ ValuePos: 123, @@ -498,12 +488,6 @@ select }, }, }, - From: (*ast.From)(nil), - Where: (*ast.Where)(nil), - GroupBy: (*ast.GroupBy)(nil), - Having: (*ast.Having)(nil), - OrderBy: (*ast.OrderBy)(nil), - Limit: (*ast.Limit)(nil), }, } diff --git a/testdata/result/query/select_tablesample_with_cross_join.sql.txt b/testdata/result/query/select_tablesample_with_cross_join.sql.txt index b1e29e4a..f89a73f5 100644 --- a/testdata/result/query/select_tablesample_with_cross_join.sql.txt +++ b/testdata/result/query/select_tablesample_with_cross_join.sql.txt @@ -9,13 +9,8 @@ FROM --- AST &ast.QueryStatement{ - Hint: (*ast.Hint)(nil), - With: (*ast.With)(nil), Query: &ast.Select{ - Select: 0, - Distinct: false, - As: nil, - Results: []ast.SelectItem{ + Results: []ast.SelectItem{ &ast.Star{ Star: 9, }, @@ -23,17 +18,14 @@ FROM From: &ast.From{ From: 11, Source: &ast.Join{ - Op: "CROSS JOIN", - Method: "", - Hint: (*ast.Hint)(nil), - Left: &ast.TableName{ + Op: "CROSS JOIN", + Left: &ast.TableName{ Table: &ast.Ident{ NamePos: 18, NameEnd: 25, Name: "Singers", }, - Hint: (*ast.Hint)(nil), - As: &ast.AsAlias{ + As: &ast.AsAlias{ As: -1, Alias: &ast.Ident{ NamePos: 26, @@ -41,7 +33,6 @@ FROM Name: "A", }, }, - Sample: (*ast.TableSample)(nil), }, Right: &ast.TableName{ Table: &ast.Ident{ @@ -49,8 +40,7 @@ FROM NameEnd: 50, Name: "Singers", }, - Hint: (*ast.Hint)(nil), - As: &ast.AsAlias{ + As: &ast.AsAlias{ As: -1, Alias: &ast.Ident{ NamePos: 51, @@ -74,14 +64,8 @@ FROM }, }, }, - Cond: nil, }, }, - Where: (*ast.Where)(nil), - GroupBy: (*ast.GroupBy)(nil), - Having: (*ast.Having)(nil), - OrderBy: (*ast.OrderBy)(nil), - Limit: (*ast.Limit)(nil), }, } diff --git a/testdata/result/query/select_tablesample_with_subquery.sql.txt b/testdata/result/query/select_tablesample_with_subquery.sql.txt index 07aadcab..2eca5398 100644 --- a/testdata/result/query/select_tablesample_with_subquery.sql.txt +++ b/testdata/result/query/select_tablesample_with_subquery.sql.txt @@ -6,13 +6,8 @@ FROM --- AST &ast.QueryStatement{ - Hint: (*ast.Hint)(nil), - With: (*ast.With)(nil), Query: &ast.Select{ - Select: 0, - Distinct: false, - As: nil, - Results: []ast.SelectItem{ + Results: []ast.SelectItem{ &ast.Star{ Star: 9, }, @@ -23,10 +18,8 @@ FROM Lparen: 18, Rparen: 40, Query: &ast.Select{ - Select: 19, - Distinct: false, - As: nil, - Results: []ast.SelectItem{ + Select: 19, + Results: []ast.SelectItem{ &ast.Star{ Star: 26, }, @@ -39,18 +32,9 @@ FROM NameEnd: 40, Name: "Singers", }, - Hint: (*ast.Hint)(nil), - As: (*ast.AsAlias)(nil), - Sample: (*ast.TableSample)(nil), }, }, - Where: (*ast.Where)(nil), - GroupBy: (*ast.GroupBy)(nil), - Having: (*ast.Having)(nil), - OrderBy: (*ast.OrderBy)(nil), - Limit: (*ast.Limit)(nil), }, - As: (*ast.AsAlias)(nil), Sample: &ast.TableSample{ TableSample: 42, Method: "BERNOULLI", @@ -68,11 +52,6 @@ FROM }, }, }, - Where: (*ast.Where)(nil), - GroupBy: (*ast.GroupBy)(nil), - Having: (*ast.Having)(nil), - OrderBy: (*ast.OrderBy)(nil), - Limit: (*ast.Limit)(nil), }, } diff --git a/testdata/result/query/select_tablesample_with_table.sql.txt b/testdata/result/query/select_tablesample_with_table.sql.txt index b6d80bc3..105c0b18 100644 --- a/testdata/result/query/select_tablesample_with_table.sql.txt +++ b/testdata/result/query/select_tablesample_with_table.sql.txt @@ -6,13 +6,8 @@ FROM --- AST &ast.QueryStatement{ - Hint: (*ast.Hint)(nil), - With: (*ast.With)(nil), Query: &ast.Select{ - Select: 0, - Distinct: false, - As: nil, - Results: []ast.SelectItem{ + Results: []ast.SelectItem{ &ast.Star{ Star: 9, }, @@ -25,8 +20,6 @@ FROM NameEnd: 25, Name: "Singers", }, - Hint: (*ast.Hint)(nil), - As: (*ast.AsAlias)(nil), Sample: &ast.TableSample{ TableSample: 26, Method: "BERNOULLI", @@ -44,11 +37,6 @@ FROM }, }, }, - Where: (*ast.Where)(nil), - GroupBy: (*ast.GroupBy)(nil), - Having: (*ast.Having)(nil), - OrderBy: (*ast.OrderBy)(nil), - Limit: (*ast.Limit)(nil), }, } diff --git a/testdata/result/query/select_tablesample_with_table_alias.sql.txt b/testdata/result/query/select_tablesample_with_table_alias.sql.txt index 102ff2ed..06e78886 100644 --- a/testdata/result/query/select_tablesample_with_table_alias.sql.txt +++ b/testdata/result/query/select_tablesample_with_table_alias.sql.txt @@ -6,13 +6,8 @@ FROM --- AST &ast.QueryStatement{ - Hint: (*ast.Hint)(nil), - With: (*ast.With)(nil), Query: &ast.Select{ - Select: 0, - Distinct: false, - As: nil, - Results: []ast.SelectItem{ + Results: []ast.SelectItem{ &ast.Star{ Star: 9, }, @@ -25,8 +20,7 @@ FROM NameEnd: 25, Name: "Singers", }, - Hint: (*ast.Hint)(nil), - As: &ast.AsAlias{ + As: &ast.AsAlias{ As: 26, Alias: &ast.Ident{ NamePos: 29, @@ -51,11 +45,6 @@ FROM }, }, }, - Where: (*ast.Where)(nil), - GroupBy: (*ast.GroupBy)(nil), - Having: (*ast.Having)(nil), - OrderBy: (*ast.OrderBy)(nil), - Limit: (*ast.Limit)(nil), }, } diff --git a/testdata/result/query/select_tablesample_with_unnest_invalid.sql.txt b/testdata/result/query/select_tablesample_with_unnest_invalid.sql.txt index 44d34a87..13ac59cf 100644 --- a/testdata/result/query/select_tablesample_with_unnest_invalid.sql.txt +++ b/testdata/result/query/select_tablesample_with_unnest_invalid.sql.txt @@ -6,13 +6,8 @@ FROM --- AST &ast.QueryStatement{ - Hint: (*ast.Hint)(nil), - With: (*ast.With)(nil), Query: &ast.Select{ - Select: 0, - Distinct: false, - As: nil, - Results: []ast.SelectItem{ + Results: []ast.SelectItem{ &ast.Star{ Star: 9, }, @@ -91,10 +86,7 @@ FROM }, }, }, - Hint: (*ast.Hint)(nil), - As: (*ast.AsAlias)(nil), - WithOffset: (*ast.WithOffset)(nil), - Sample: &ast.TableSample{ + Sample: &ast.TableSample{ TableSample: 83, Method: "BERNOULLI", Size: &ast.TableSampleSize{ @@ -111,11 +103,6 @@ FROM }, }, }, - Where: (*ast.Where)(nil), - GroupBy: (*ast.GroupBy)(nil), - Having: (*ast.Having)(nil), - OrderBy: (*ast.OrderBy)(nil), - Limit: (*ast.Limit)(nil), }, } diff --git a/testdata/result/query/select_union_chain.sql.txt b/testdata/result/query/select_union_chain.sql.txt index a26ec131..4858c708 100644 --- a/testdata/result/query/select_union_chain.sql.txt +++ b/testdata/result/query/select_union_chain.sql.txt @@ -3,20 +3,14 @@ --- AST &ast.QueryStatement{ - Hint: (*ast.Hint)(nil), - With: (*ast.With)(nil), Query: &ast.CompoundQuery{ - Op: "UNION", - Distinct: false, - Queries: []ast.QueryExpr{ + Op: "UNION", + Queries: []ast.QueryExpr{ &ast.SubQuery{ - Lparen: 0, Rparen: 9, Query: &ast.Select{ - Select: 1, - Distinct: false, - As: nil, - Results: []ast.SelectItem{ + Select: 1, + Results: []ast.SelectItem{ &ast.ExprSelectItem{ Expr: &ast.IntLiteral{ ValuePos: 8, @@ -26,24 +20,14 @@ }, }, }, - From: (*ast.From)(nil), - Where: (*ast.Where)(nil), - GroupBy: (*ast.GroupBy)(nil), - Having: (*ast.Having)(nil), - OrderBy: (*ast.OrderBy)(nil), - Limit: (*ast.Limit)(nil), }, - OrderBy: (*ast.OrderBy)(nil), - Limit: (*ast.Limit)(nil), }, &ast.SubQuery{ Lparen: 21, Rparen: 30, Query: &ast.Select{ - Select: 22, - Distinct: false, - As: nil, - Results: []ast.SelectItem{ + Select: 22, + Results: []ast.SelectItem{ &ast.ExprSelectItem{ Expr: &ast.IntLiteral{ ValuePos: 29, @@ -53,24 +37,14 @@ }, }, }, - From: (*ast.From)(nil), - Where: (*ast.Where)(nil), - GroupBy: (*ast.GroupBy)(nil), - Having: (*ast.Having)(nil), - OrderBy: (*ast.OrderBy)(nil), - Limit: (*ast.Limit)(nil), }, - OrderBy: (*ast.OrderBy)(nil), - Limit: (*ast.Limit)(nil), }, &ast.SubQuery{ Lparen: 42, Rparen: 51, Query: &ast.Select{ - Select: 43, - Distinct: false, - As: nil, - Results: []ast.SelectItem{ + Select: 43, + Results: []ast.SelectItem{ &ast.ExprSelectItem{ Expr: &ast.IntLiteral{ ValuePos: 50, @@ -80,19 +54,9 @@ }, }, }, - From: (*ast.From)(nil), - Where: (*ast.Where)(nil), - GroupBy: (*ast.GroupBy)(nil), - Having: (*ast.Having)(nil), - OrderBy: (*ast.OrderBy)(nil), - Limit: (*ast.Limit)(nil), }, - OrderBy: (*ast.OrderBy)(nil), - Limit: (*ast.Limit)(nil), }, }, - OrderBy: (*ast.OrderBy)(nil), - Limit: (*ast.Limit)(nil), }, } diff --git a/testdata/result/query/select_unnest_with_offset.sql.txt b/testdata/result/query/select_unnest_with_offset.sql.txt index 776191c4..11f707a2 100644 --- a/testdata/result/query/select_unnest_with_offset.sql.txt +++ b/testdata/result/query/select_unnest_with_offset.sql.txt @@ -6,13 +6,8 @@ FROM --- AST &ast.QueryStatement{ - Hint: (*ast.Hint)(nil), - With: (*ast.With)(nil), Query: &ast.Select{ - Select: 0, - Distinct: false, - As: nil, - Results: []ast.SelectItem{ + Results: []ast.SelectItem{ &ast.Star{ Star: 9, }, @@ -26,7 +21,6 @@ FROM Array: -1, Lbrack: 25, Rbrack: 31, - Type: nil, Values: []ast.Expr{ &ast.IntLiteral{ ValuePos: 26, @@ -67,20 +61,12 @@ FROM }, }, }, - As: (*ast.AsAlias)(nil), WithOffset: &ast.WithOffset{ With: 46, Offset: 51, - As: (*ast.AsAlias)(nil), }, - Sample: (*ast.TableSample)(nil), }, }, - Where: (*ast.Where)(nil), - GroupBy: (*ast.GroupBy)(nil), - Having: (*ast.Having)(nil), - OrderBy: (*ast.OrderBy)(nil), - Limit: (*ast.Limit)(nil), }, } diff --git a/testdata/result/query/select_unnest_with_offset_and_alias.sql.txt b/testdata/result/query/select_unnest_with_offset_and_alias.sql.txt index 3b88c15d..ab2f4a32 100644 --- a/testdata/result/query/select_unnest_with_offset_and_alias.sql.txt +++ b/testdata/result/query/select_unnest_with_offset_and_alias.sql.txt @@ -6,13 +6,8 @@ FROM --- AST &ast.QueryStatement{ - Hint: (*ast.Hint)(nil), - With: (*ast.With)(nil), Query: &ast.Select{ - Select: 0, - Distinct: false, - As: nil, - Results: []ast.SelectItem{ + Results: []ast.SelectItem{ &ast.Star{ Star: 9, }, @@ -26,7 +21,6 @@ FROM Array: -1, Lbrack: 25, Rbrack: 31, - Type: nil, Values: []ast.Expr{ &ast.IntLiteral{ ValuePos: 26, @@ -48,8 +42,7 @@ FROM }, }, }, - Hint: (*ast.Hint)(nil), - As: &ast.AsAlias{ + As: &ast.AsAlias{ As: 34, Alias: &ast.Ident{ NamePos: 37, @@ -69,14 +62,8 @@ FROM }, }, }, - Sample: (*ast.TableSample)(nil), }, }, - Where: (*ast.Where)(nil), - GroupBy: (*ast.GroupBy)(nil), - Having: (*ast.Having)(nil), - OrderBy: (*ast.OrderBy)(nil), - Limit: (*ast.Limit)(nil), }, } diff --git a/testdata/result/query/select_unnest_with_offset_and_alias_min.sql.txt b/testdata/result/query/select_unnest_with_offset_and_alias_min.sql.txt index 684b1116..010a9a8a 100644 --- a/testdata/result/query/select_unnest_with_offset_and_alias_min.sql.txt +++ b/testdata/result/query/select_unnest_with_offset_and_alias_min.sql.txt @@ -6,13 +6,8 @@ FROM --- AST &ast.QueryStatement{ - Hint: (*ast.Hint)(nil), - With: (*ast.With)(nil), Query: &ast.Select{ - Select: 0, - Distinct: false, - As: nil, - Results: []ast.SelectItem{ + Results: []ast.SelectItem{ &ast.Star{ Star: 9, }, @@ -26,7 +21,6 @@ FROM Array: -1, Lbrack: 25, Rbrack: 31, - Type: nil, Values: []ast.Expr{ &ast.IntLiteral{ ValuePos: 26, @@ -48,8 +42,7 @@ FROM }, }, }, - Hint: (*ast.Hint)(nil), - As: &ast.AsAlias{ + As: &ast.AsAlias{ As: -1, Alias: &ast.Ident{ NamePos: 34, @@ -69,14 +62,8 @@ FROM }, }, }, - Sample: (*ast.TableSample)(nil), }, }, - Where: (*ast.Where)(nil), - GroupBy: (*ast.GroupBy)(nil), - Having: (*ast.Having)(nil), - OrderBy: (*ast.OrderBy)(nil), - Limit: (*ast.Limit)(nil), }, } diff --git a/testdata/result/query/select_with_after_hint.sql.txt b/testdata/result/query/select_with_after_hint.sql.txt index fbc3c178..a56de4ef 100644 --- a/testdata/result/query/select_with_after_hint.sql.txt +++ b/testdata/result/query/select_with_after_hint.sql.txt @@ -4,7 +4,6 @@ --- AST &ast.QueryStatement{ Hint: &ast.Hint{ - Atmark: 0, Rbrace: 11, Records: []*ast.HintRecord{ &ast.HintRecord{ @@ -33,10 +32,8 @@ Name: "subq1", }, QueryExpr: &ast.Select{ - Select: 28, - Distinct: false, - As: nil, - Results: []ast.SelectItem{ + Select: 28, + Results: []ast.SelectItem{ &ast.ExprSelectItem{ Expr: &ast.Ident{ NamePos: 35, @@ -53,25 +50,15 @@ NameEnd: 46, Name: "foo", }, - Hint: (*ast.Hint)(nil), - As: (*ast.AsAlias)(nil), - Sample: (*ast.TableSample)(nil), }, }, - Where: (*ast.Where)(nil), - GroupBy: (*ast.GroupBy)(nil), - Having: (*ast.Having)(nil), - OrderBy: (*ast.OrderBy)(nil), - Limit: (*ast.Limit)(nil), }, }, }, }, Query: &ast.Select{ - Select: 48, - Distinct: false, - As: nil, - Results: []ast.SelectItem{ + Select: 48, + Results: []ast.SelectItem{ &ast.Star{ Star: 55, }, @@ -84,16 +71,8 @@ NameEnd: 67, Name: "subq1", }, - Hint: (*ast.Hint)(nil), - As: (*ast.AsAlias)(nil), - Sample: (*ast.TableSample)(nil), }, }, - Where: (*ast.Where)(nil), - GroupBy: (*ast.GroupBy)(nil), - Having: (*ast.Having)(nil), - OrderBy: (*ast.OrderBy)(nil), - Limit: (*ast.Limit)(nil), }, } diff --git a/testdata/result/query/select_with_comment.sql.txt b/testdata/result/query/select_with_comment.sql.txt index a19849c0..369a1a18 100644 --- a/testdata/result/query/select_with_comment.sql.txt +++ b/testdata/result/query/select_with_comment.sql.txt @@ -4,13 +4,9 @@ select 1 --- AST &ast.QueryStatement{ - Hint: (*ast.Hint)(nil), - With: (*ast.With)(nil), Query: &ast.Select{ - Select: 10, - Distinct: false, - As: nil, - Results: []ast.SelectItem{ + Select: 10, + Results: []ast.SelectItem{ &ast.ExprSelectItem{ Expr: &ast.IntLiteral{ ValuePos: 17, @@ -20,12 +16,6 @@ select 1 }, }, }, - From: (*ast.From)(nil), - Where: (*ast.Where)(nil), - GroupBy: (*ast.GroupBy)(nil), - Having: (*ast.Having)(nil), - OrderBy: (*ast.OrderBy)(nil), - Limit: (*ast.Limit)(nil), }, } diff --git a/testdata/result/query/select_with_field_path.sql.txt b/testdata/result/query/select_with_field_path.sql.txt index fb07732a..67bd84c5 100644 --- a/testdata/result/query/select_with_field_path.sql.txt +++ b/testdata/result/query/select_with_field_path.sql.txt @@ -19,13 +19,8 @@ WHERE A.z.a = 2 --- AST &ast.QueryStatement{ - Hint: (*ast.Hint)(nil), - With: (*ast.With)(nil), Query: &ast.Select{ - Select: 0, - Distinct: false, - As: nil, - Results: []ast.SelectItem{ + Results: []ast.SelectItem{ &ast.ExprSelectItem{ Expr: &ast.Path{ Idents: []*ast.Ident{ @@ -110,9 +105,8 @@ WHERE A.z.a = 2 Array: 57, Rparen: 251, Query: &ast.Select{ - Select: 70, - Distinct: false, - As: &ast.AsStruct{ + Select: 70, + As: &ast.AsStruct{ As: 77, Struct: 80, }, @@ -284,21 +278,11 @@ WHERE A.z.a = 2 }, }, }, - Hint: (*ast.Hint)(nil), - As: (*ast.AsAlias)(nil), - WithOffset: (*ast.WithOffset)(nil), - Sample: (*ast.TableSample)(nil), }, }, - Where: (*ast.Where)(nil), - GroupBy: (*ast.GroupBy)(nil), - Having: (*ast.Having)(nil), - OrderBy: (*ast.OrderBy)(nil), - Limit: (*ast.Limit)(nil), }, }, - Hint: (*ast.Hint)(nil), - As: &ast.AsAlias{ + As: &ast.AsAlias{ As: 257, Alias: &ast.Ident{ NamePos: 260, @@ -306,8 +290,6 @@ WHERE A.z.a = 2 Name: "A", }, }, - WithOffset: (*ast.WithOffset)(nil), - Sample: (*ast.TableSample)(nil), }, }, Where: &ast.Where{ @@ -341,10 +323,6 @@ WHERE A.z.a = 2 }, }, }, - GroupBy: (*ast.GroupBy)(nil), - Having: (*ast.Having)(nil), - OrderBy: (*ast.OrderBy)(nil), - Limit: (*ast.Limit)(nil), }, } diff --git a/testdata/result/query/select_with_multiple_ctes.sql.txt b/testdata/result/query/select_with_multiple_ctes.sql.txt index f5221e7f..415ae2c5 100644 --- a/testdata/result/query/select_with_multiple_ctes.sql.txt +++ b/testdata/result/query/select_with_multiple_ctes.sql.txt @@ -3,9 +3,7 @@ with subq1 as (select c1 from foo), subq2 as (select c2 from foo) select * from --- AST &ast.QueryStatement{ - Hint: (*ast.Hint)(nil), With: &ast.With{ - With: 0, CTEs: []*ast.CTE{ &ast.CTE{ Rparen: 33, @@ -15,10 +13,8 @@ with subq1 as (select c1 from foo), subq2 as (select c2 from foo) select * from Name: "subq1", }, QueryExpr: &ast.Select{ - Select: 15, - Distinct: false, - As: nil, - Results: []ast.SelectItem{ + Select: 15, + Results: []ast.SelectItem{ &ast.ExprSelectItem{ Expr: &ast.Ident{ NamePos: 22, @@ -35,16 +31,8 @@ with subq1 as (select c1 from foo), subq2 as (select c2 from foo) select * from NameEnd: 33, Name: "foo", }, - Hint: (*ast.Hint)(nil), - As: (*ast.AsAlias)(nil), - Sample: (*ast.TableSample)(nil), }, }, - Where: (*ast.Where)(nil), - GroupBy: (*ast.GroupBy)(nil), - Having: (*ast.Having)(nil), - OrderBy: (*ast.OrderBy)(nil), - Limit: (*ast.Limit)(nil), }, }, &ast.CTE{ @@ -55,10 +43,8 @@ with subq1 as (select c1 from foo), subq2 as (select c2 from foo) select * from Name: "subq2", }, QueryExpr: &ast.Select{ - Select: 46, - Distinct: false, - As: nil, - Results: []ast.SelectItem{ + Select: 46, + Results: []ast.SelectItem{ &ast.ExprSelectItem{ Expr: &ast.Ident{ NamePos: 53, @@ -75,25 +61,15 @@ with subq1 as (select c1 from foo), subq2 as (select c2 from foo) select * from NameEnd: 64, Name: "foo", }, - Hint: (*ast.Hint)(nil), - As: (*ast.AsAlias)(nil), - Sample: (*ast.TableSample)(nil), }, }, - Where: (*ast.Where)(nil), - GroupBy: (*ast.GroupBy)(nil), - Having: (*ast.Having)(nil), - OrderBy: (*ast.OrderBy)(nil), - Limit: (*ast.Limit)(nil), }, }, }, }, Query: &ast.Select{ - Select: 66, - Distinct: false, - As: nil, - Results: []ast.SelectItem{ + Select: 66, + Results: []ast.SelectItem{ &ast.Star{ Star: 73, }, @@ -106,16 +82,8 @@ with subq1 as (select c1 from foo), subq2 as (select c2 from foo) select * from NameEnd: 85, Name: "subq1", }, - Hint: (*ast.Hint)(nil), - As: (*ast.AsAlias)(nil), - Sample: (*ast.TableSample)(nil), }, }, - Where: (*ast.Where)(nil), - GroupBy: (*ast.GroupBy)(nil), - Having: (*ast.Having)(nil), - OrderBy: (*ast.OrderBy)(nil), - Limit: (*ast.Limit)(nil), }, } diff --git a/testdata/result/query/select_with_reservedword.sql.txt b/testdata/result/query/select_with_reservedword.sql.txt index f310b6f0..f6a0e091 100644 --- a/testdata/result/query/select_with_reservedword.sql.txt +++ b/testdata/result/query/select_with_reservedword.sql.txt @@ -6,13 +6,8 @@ FROM --- AST &ast.QueryStatement{ - Hint: (*ast.Hint)(nil), - With: (*ast.With)(nil), Query: &ast.Select{ - Select: 0, - Distinct: false, - As: nil, - Results: []ast.SelectItem{ + Results: []ast.SelectItem{ &ast.Star{ Star: 9, }, @@ -25,16 +20,8 @@ FROM NameEnd: 26, Name: "UNNEST", }, - Hint: (*ast.Hint)(nil), - As: (*ast.AsAlias)(nil), - Sample: (*ast.TableSample)(nil), }, }, - Where: (*ast.Where)(nil), - GroupBy: (*ast.GroupBy)(nil), - Having: (*ast.Having)(nil), - OrderBy: (*ast.OrderBy)(nil), - Limit: (*ast.Limit)(nil), }, } diff --git a/testdata/result/query/select_with_sequence_function.sql.txt b/testdata/result/query/select_with_sequence_function.sql.txt index 333ec82a..c5a07b7a 100644 --- a/testdata/result/query/select_with_sequence_function.sql.txt +++ b/testdata/result/query/select_with_sequence_function.sql.txt @@ -3,13 +3,8 @@ SELECT GET_NEXT_SEQUENCE_VALUE(SEQUENCE my_sequence) as next_id --- AST &ast.QueryStatement{ - Hint: (*ast.Hint)(nil), - With: (*ast.With)(nil), Query: &ast.Select{ - Select: 0, - Distinct: false, - As: nil, - Results: []ast.SelectItem{ + Results: []ast.SelectItem{ &ast.Alias{ Expr: &ast.CallExpr{ Rparen: 51, @@ -18,8 +13,7 @@ SELECT GET_NEXT_SEQUENCE_VALUE(SEQUENCE my_sequence) as next_id NameEnd: 30, Name: "GET_NEXT_SEQUENCE_VALUE", }, - Distinct: false, - Args: []ast.Arg{ + Args: []ast.Arg{ &ast.SequenceArg{ Sequence: 31, Expr: &ast.Ident{ @@ -29,9 +23,6 @@ SELECT GET_NEXT_SEQUENCE_VALUE(SEQUENCE my_sequence) as next_id }, }, }, - NamedArgs: []*ast.NamedArg(nil), - NullHandling: nil, - Having: nil, }, As: &ast.AsAlias{ As: 53, @@ -43,12 +34,6 @@ SELECT GET_NEXT_SEQUENCE_VALUE(SEQUENCE my_sequence) as next_id }, }, }, - From: (*ast.From)(nil), - Where: (*ast.Where)(nil), - GroupBy: (*ast.GroupBy)(nil), - Having: (*ast.Having)(nil), - OrderBy: (*ast.OrderBy)(nil), - Limit: (*ast.Limit)(nil), }, } diff --git a/testdata/result/query/select_with_trailing_comma.sql.txt b/testdata/result/query/select_with_trailing_comma.sql.txt index 8aba7288..835ed9e3 100644 --- a/testdata/result/query/select_with_trailing_comma.sql.txt +++ b/testdata/result/query/select_with_trailing_comma.sql.txt @@ -2,13 +2,8 @@ SELECT 1, 2, --- AST &ast.QueryStatement{ - Hint: (*ast.Hint)(nil), - With: (*ast.With)(nil), Query: &ast.Select{ - Select: 0, - Distinct: false, - As: nil, - Results: []ast.SelectItem{ + Results: []ast.SelectItem{ &ast.ExprSelectItem{ Expr: &ast.IntLiteral{ ValuePos: 7, @@ -26,12 +21,6 @@ SELECT 1, 2, }, }, }, - From: (*ast.From)(nil), - Where: (*ast.Where)(nil), - GroupBy: (*ast.GroupBy)(nil), - Having: (*ast.Having)(nil), - OrderBy: (*ast.OrderBy)(nil), - Limit: (*ast.Limit)(nil), }, } diff --git a/testdata/result/statement/aggregate_function_calls.sql.txt b/testdata/result/statement/aggregate_function_calls.sql.txt index 9e2ad6c2..dc06d262 100644 --- a/testdata/result/statement/aggregate_function_calls.sql.txt +++ b/testdata/result/statement/aggregate_function_calls.sql.txt @@ -8,13 +8,8 @@ SELECT --- AST &ast.QueryStatement{ - Hint: (*ast.Hint)(nil), - With: (*ast.With)(nil), Query: &ast.Select{ - Select: 0, - Distinct: false, - As: nil, - Results: []ast.SelectItem{ + Results: []ast.SelectItem{ &ast.ExprSelectItem{ Expr: &ast.CallExpr{ Rparen: 43, @@ -23,8 +18,7 @@ SELECT NameEnd: 20, Name: "ARRAY_AGG", }, - Distinct: false, - Args: []ast.Arg{ + Args: []ast.Arg{ &ast.ExprArg{ Expr: &ast.Ident{ NamePos: 21, @@ -33,9 +27,7 @@ SELECT }, }, }, - NamedArgs: []*ast.NamedArg(nil), - NullHandling: nil, - Having: &ast.HavingMax{ + Having: &ast.HavingMax{ Having: 28, Expr: &ast.Ident{ NamePos: 39, @@ -53,8 +45,7 @@ SELECT NameEnd: 59, Name: "ARRAY_AGG", }, - Distinct: false, - Args: []ast.Arg{ + Args: []ast.Arg{ &ast.ExprArg{ Expr: &ast.Ident{ NamePos: 60, @@ -63,9 +54,7 @@ SELECT }, }, }, - NamedArgs: []*ast.NamedArg(nil), - NullHandling: nil, - Having: &ast.HavingMin{ + Having: &ast.HavingMin{ Having: 67, Expr: &ast.Ident{ NamePos: 78, @@ -83,8 +72,7 @@ SELECT NameEnd: 98, Name: "ARRAY_AGG", }, - Distinct: false, - Args: []ast.Arg{ + Args: []ast.Arg{ &ast.ExprArg{ Expr: &ast.Ident{ NamePos: 99, @@ -93,12 +81,10 @@ SELECT }, }, }, - NamedArgs: []*ast.NamedArg(nil), NullHandling: &ast.IgnoreNulls{ Ignore: 106, Nulls: 113, }, - Having: nil, }, }, &ast.ExprSelectItem{ @@ -109,8 +95,7 @@ SELECT NameEnd: 134, Name: "ARRAY_AGG", }, - Distinct: false, - Args: []ast.Arg{ + Args: []ast.Arg{ &ast.ExprArg{ Expr: &ast.Ident{ NamePos: 135, @@ -119,12 +104,10 @@ SELECT }, }, }, - NamedArgs: []*ast.NamedArg(nil), NullHandling: &ast.RespectNulls{ Respect: 142, Nulls: 150, }, - Having: nil, }, }, &ast.ExprSelectItem{ @@ -135,8 +118,7 @@ SELECT NameEnd: 171, Name: "ARRAY_AGG", }, - Distinct: false, - Args: []ast.Arg{ + Args: []ast.Arg{ &ast.ExprArg{ Expr: &ast.Ident{ NamePos: 172, @@ -145,7 +127,6 @@ SELECT }, }, }, - NamedArgs: []*ast.NamedArg(nil), NullHandling: &ast.RespectNulls{ Respect: 179, Nulls: 187, @@ -161,12 +142,6 @@ SELECT }, }, }, - From: (*ast.From)(nil), - Where: (*ast.Where)(nil), - GroupBy: (*ast.GroupBy)(nil), - Having: (*ast.Having)(nil), - OrderBy: (*ast.OrderBy)(nil), - Limit: (*ast.Limit)(nil), }, } diff --git a/testdata/result/statement/alter_change_stream_options.sql.txt b/testdata/result/statement/alter_change_stream_options.sql.txt index 0069de75..b0214ab8 100644 --- a/testdata/result/statement/alter_change_stream_options.sql.txt +++ b/testdata/result/statement/alter_change_stream_options.sql.txt @@ -3,8 +3,7 @@ ALTER CHANGE STREAM change_stream_name SET OPTIONS (retention_period = '1d', val --- AST &ast.AlterChangeStream{ - Alter: 0, - Name: &ast.Ident{ + Name: &ast.Ident{ NamePos: 20, NameEnd: 38, Name: "change_stream_name", diff --git a/testdata/result/statement/alter_change_stream_set_drop_for_all.sql.txt b/testdata/result/statement/alter_change_stream_set_drop_for_all.sql.txt index 78744030..07c9db12 100644 --- a/testdata/result/statement/alter_change_stream_set_drop_for_all.sql.txt +++ b/testdata/result/statement/alter_change_stream_set_drop_for_all.sql.txt @@ -3,8 +3,7 @@ ALTER CHANGE STREAM change_stream_name DROP FOR ALL --- AST &ast.AlterChangeStream{ - Alter: 0, - Name: &ast.Ident{ + Name: &ast.Ident{ NamePos: 20, NameEnd: 38, Name: "change_stream_name", diff --git a/testdata/result/statement/alter_change_stream_set_for_all.sql.txt b/testdata/result/statement/alter_change_stream_set_for_all.sql.txt index 93247c77..a8dfc96e 100644 --- a/testdata/result/statement/alter_change_stream_set_for_all.sql.txt +++ b/testdata/result/statement/alter_change_stream_set_for_all.sql.txt @@ -3,8 +3,7 @@ ALTER CHANGE STREAM change_stream_name SET FOR ALL --- AST &ast.AlterChangeStream{ - Alter: 0, - Name: &ast.Ident{ + Name: &ast.Ident{ NamePos: 20, NameEnd: 38, Name: "change_stream_name", diff --git a/testdata/result/statement/alter_change_stream_set_for_table_columns.sql.txt b/testdata/result/statement/alter_change_stream_set_for_table_columns.sql.txt index ed5c412b..4b2104c9 100644 --- a/testdata/result/statement/alter_change_stream_set_for_table_columns.sql.txt +++ b/testdata/result/statement/alter_change_stream_set_for_table_columns.sql.txt @@ -3,8 +3,7 @@ ALTER CHANGE STREAM change_stream_name SET FOR table_name1(column1, column2), ta --- AST &ast.AlterChangeStream{ - Alter: 0, - Name: &ast.Ident{ + Name: &ast.Ident{ NamePos: 20, NameEnd: 38, Name: "change_stream_name", diff --git a/testdata/result/statement/alter_database.sql.txt b/testdata/result/statement/alter_database.sql.txt index 3fc122ab..7aee12b2 100644 --- a/testdata/result/statement/alter_database.sql.txt +++ b/testdata/result/statement/alter_database.sql.txt @@ -8,8 +8,7 @@ ALTER DATABASE dbname SET OPTIONS ( ) --- AST &ast.AlterDatabase{ - Alter: 0, - Name: &ast.Ident{ + Name: &ast.Ident{ NamePos: 15, NameEnd: 21, Name: "dbname", diff --git a/testdata/result/statement/alter_index_add_stored_column.sql.txt b/testdata/result/statement/alter_index_add_stored_column.sql.txt index ae278e40..831651a3 100644 --- a/testdata/result/statement/alter_index_add_stored_column.sql.txt +++ b/testdata/result/statement/alter_index_add_stored_column.sql.txt @@ -3,8 +3,7 @@ alter index foo add stored column bar --- AST &ast.AlterIndex{ - Alter: 0, - Name: &ast.Path{ + Name: &ast.Path{ Idents: []*ast.Ident{ &ast.Ident{ NamePos: 12, diff --git a/testdata/result/statement/alter_index_drop_stored_column.sql.txt b/testdata/result/statement/alter_index_drop_stored_column.sql.txt index 1a54ff45..d22dc9c7 100644 --- a/testdata/result/statement/alter_index_drop_stored_column.sql.txt +++ b/testdata/result/statement/alter_index_drop_stored_column.sql.txt @@ -3,8 +3,7 @@ alter index foo drop stored column bar --- AST &ast.AlterIndex{ - Alter: 0, - Name: &ast.Path{ + Name: &ast.Path{ Idents: []*ast.Ident{ &ast.Ident{ NamePos: 12, diff --git a/testdata/result/statement/alter_model.sql.txt b/testdata/result/statement/alter_model.sql.txt index cb6cf129..9cb212f6 100644 --- a/testdata/result/statement/alter_model.sql.txt +++ b/testdata/result/statement/alter_model.sql.txt @@ -9,9 +9,7 @@ SET OPTIONS ( ) --- AST &ast.AlterModel{ - Alter: 0, - IfExists: false, - Name: &ast.Ident{ + Name: &ast.Ident{ NamePos: 12, NameEnd: 33, Name: "MyClassificationModel", @@ -30,7 +28,6 @@ SET OPTIONS ( Array: -1, Lbrack: 64, Rbrack: 227, - Type: nil, Values: []ast.Expr{ &ast.StringLiteral{ ValuePos: 74, diff --git a/testdata/result/statement/alter_model_if_exists.sql.txt b/testdata/result/statement/alter_model_if_exists.sql.txt index a585c656..f6884fd5 100644 --- a/testdata/result/statement/alter_model_if_exists.sql.txt +++ b/testdata/result/statement/alter_model_if_exists.sql.txt @@ -9,7 +9,6 @@ SET OPTIONS ( ) --- AST &ast.AlterModel{ - Alter: 0, IfExists: true, Name: &ast.Ident{ NamePos: 22, @@ -30,7 +29,6 @@ SET OPTIONS ( Array: -1, Lbrack: 74, Rbrack: 237, - Type: nil, Values: []ast.Expr{ &ast.StringLiteral{ ValuePos: 84, diff --git a/testdata/result/statement/alter_proto_bundle_all.sql.txt b/testdata/result/statement/alter_proto_bundle_all.sql.txt index feb37248..6d94cede 100644 --- a/testdata/result/statement/alter_proto_bundle_all.sql.txt +++ b/testdata/result/statement/alter_proto_bundle_all.sql.txt @@ -2,7 +2,6 @@ ALTER PROTO BUNDLE INSERT (package.Inserted) UPDATE (package.Updated) DELETE (package.Deleted) --- AST &ast.AlterProtoBundle{ - Alter: 0, Bundle: 12, Insert: &ast.AlterProtoBundleInsert{ Insert: 19, diff --git a/testdata/result/statement/alter_proto_bundle_delete.sql.txt b/testdata/result/statement/alter_proto_bundle_delete.sql.txt index ca333576..663b0159 100644 --- a/testdata/result/statement/alter_proto_bundle_delete.sql.txt +++ b/testdata/result/statement/alter_proto_bundle_delete.sql.txt @@ -2,10 +2,7 @@ ALTER PROTO BUNDLE DELETE(`examples.shipping.OrderHistory`) --- AST &ast.AlterProtoBundle{ - Alter: 0, Bundle: 12, - Insert: (*ast.AlterProtoBundleInsert)(nil), - Update: (*ast.AlterProtoBundleUpdate)(nil), Delete: &ast.AlterProtoBundleDelete{ Delete: 19, Types: &ast.ProtoBundleTypes{ diff --git a/testdata/result/statement/alter_proto_bundle_insert.sql.txt b/testdata/result/statement/alter_proto_bundle_insert.sql.txt index 3b82c6c1..470928dc 100644 --- a/testdata/result/statement/alter_proto_bundle_insert.sql.txt +++ b/testdata/result/statement/alter_proto_bundle_insert.sql.txt @@ -4,7 +4,6 @@ ALTER PROTO BUNDLE INSERT ( ) --- AST &ast.AlterProtoBundle{ - Alter: 0, Bundle: 12, Insert: &ast.AlterProtoBundleInsert{ Insert: 19, @@ -34,8 +33,6 @@ ALTER PROTO BUNDLE INSERT ( }, }, }, - Update: (*ast.AlterProtoBundleUpdate)(nil), - Delete: (*ast.AlterProtoBundleDelete)(nil), } --- SQL diff --git a/testdata/result/statement/alter_proto_bundle_noop.sql.txt b/testdata/result/statement/alter_proto_bundle_noop.sql.txt index aa40ccc7..e33290f1 100644 --- a/testdata/result/statement/alter_proto_bundle_noop.sql.txt +++ b/testdata/result/statement/alter_proto_bundle_noop.sql.txt @@ -2,11 +2,7 @@ ALTER PROTO BUNDLE --- AST &ast.AlterProtoBundle{ - Alter: 0, Bundle: 12, - Insert: (*ast.AlterProtoBundleInsert)(nil), - Update: (*ast.AlterProtoBundleUpdate)(nil), - Delete: (*ast.AlterProtoBundleDelete)(nil), } --- SQL diff --git a/testdata/result/statement/alter_proto_bundle_update.sql.txt b/testdata/result/statement/alter_proto_bundle_update.sql.txt index 19f249b1..45376eb4 100644 --- a/testdata/result/statement/alter_proto_bundle_update.sql.txt +++ b/testdata/result/statement/alter_proto_bundle_update.sql.txt @@ -2,9 +2,7 @@ ALTER PROTO BUNDLE UPDATE(`examples.shipping.Order`) --- AST &ast.AlterProtoBundle{ - Alter: 0, Bundle: 12, - Insert: (*ast.AlterProtoBundleInsert)(nil), Update: &ast.AlterProtoBundleUpdate{ Update: 19, Types: &ast.ProtoBundleTypes{ @@ -23,7 +21,6 @@ ALTER PROTO BUNDLE UPDATE(`examples.shipping.Order`) }, }, }, - Delete: (*ast.AlterProtoBundleDelete)(nil), } --- SQL diff --git a/testdata/result/statement/alter_search_index_add_stored_column.sql.txt b/testdata/result/statement/alter_search_index_add_stored_column.sql.txt index e27c4f83..f0b3a65b 100644 --- a/testdata/result/statement/alter_search_index_add_stored_column.sql.txt +++ b/testdata/result/statement/alter_search_index_add_stored_column.sql.txt @@ -2,8 +2,7 @@ ALTER SEARCH INDEX AlbumsIndex ADD STORED COLUMN Genre --- AST &ast.AlterSearchIndex{ - Alter: 0, - Name: &ast.Ident{ + Name: &ast.Ident{ NamePos: 19, NameEnd: 30, Name: "AlbumsIndex", diff --git a/testdata/result/statement/alter_search_index_drop_stored_column.sql.txt b/testdata/result/statement/alter_search_index_drop_stored_column.sql.txt index 1a3f12bf..b7ac0f3d 100644 --- a/testdata/result/statement/alter_search_index_drop_stored_column.sql.txt +++ b/testdata/result/statement/alter_search_index_drop_stored_column.sql.txt @@ -2,8 +2,7 @@ ALTER SEARCH INDEX AlbumsIndex DROP STORED COLUMN Genre --- AST &ast.AlterSearchIndex{ - Alter: 0, - Name: &ast.Ident{ + Name: &ast.Ident{ NamePos: 19, NameEnd: 30, Name: "AlbumsIndex", diff --git a/testdata/result/statement/alter_sequence.sql.txt b/testdata/result/statement/alter_sequence.sql.txt index 0183cc1a..4be6e805 100644 --- a/testdata/result/statement/alter_sequence.sql.txt +++ b/testdata/result/statement/alter_sequence.sql.txt @@ -3,8 +3,7 @@ ALTER SEQUENCE my_sequence SET OPTIONS (skip_range_min=1, skip_range_max=1234567 --- AST &ast.AlterSequence{ - Alter: 0, - Name: &ast.Path{ + Name: &ast.Path{ Idents: []*ast.Ident{ &ast.Ident{ NamePos: 15, diff --git a/testdata/result/statement/alter_statistics.sql.txt b/testdata/result/statement/alter_statistics.sql.txt index 5e513edd..d5b5b3bb 100644 --- a/testdata/result/statement/alter_statistics.sql.txt +++ b/testdata/result/statement/alter_statistics.sql.txt @@ -2,8 +2,7 @@ ALTER STATISTICS auto_20191128_14_47_22UTC SET OPTIONS (allow_gc=false) --- AST &ast.AlterStatistics{ - Alter: 0, - Name: &ast.Ident{ + Name: &ast.Ident{ NamePos: 17, NameEnd: 42, Name: "auto_20191128_14_47_22UTC", @@ -20,7 +19,6 @@ ALTER STATISTICS auto_20191128_14_47_22UTC SET OPTIONS (allow_gc=false) }, Value: &ast.BoolLiteral{ ValuePos: 65, - Value: false, }, }, }, diff --git a/testdata/result/statement/alter_table_add_check.sql.txt b/testdata/result/statement/alter_table_add_check.sql.txt index 12790e88..16e305bb 100644 --- a/testdata/result/statement/alter_table_add_check.sql.txt +++ b/testdata/result/statement/alter_table_add_check.sql.txt @@ -3,8 +3,7 @@ alter table foo add check (c1 > 0) --- AST &ast.AlterTable{ - Alter: 0, - Name: &ast.Path{ + Name: &ast.Path{ Idents: []*ast.Ident{ &ast.Ident{ NamePos: 12, @@ -16,9 +15,7 @@ alter table foo add check (c1 > 0) TableAlteration: &ast.AddTableConstraint{ Add: 16, TableConstraint: &ast.TableConstraint{ - ConstraintPos: 0, - Name: (*ast.Ident)(nil), - Constraint: &ast.Check{ + Constraint: &ast.Check{ Check: 20, Rparen: 33, Expr: &ast.BinaryExpr{ diff --git a/testdata/result/statement/alter_table_add_column.sql.txt b/testdata/result/statement/alter_table_add_column.sql.txt index c1460578..a2e5b008 100644 --- a/testdata/result/statement/alter_table_add_column.sql.txt +++ b/testdata/result/statement/alter_table_add_column.sql.txt @@ -2,8 +2,7 @@ alter table foo add column baz string(max) not null --- AST &ast.AlterTable{ - Alter: 0, - Name: &ast.Path{ + Name: &ast.Path{ Idents: []*ast.Ident{ &ast.Ident{ NamePos: 12, @@ -13,9 +12,8 @@ alter table foo add column baz string(max) not null }, }, TableAlteration: &ast.AddColumn{ - Add: 16, - IfNotExists: false, - Column: &ast.ColumnDef{ + Add: 16, + Column: &ast.ColumnDef{ Null: 47, Name: &ast.Ident{ NamePos: 27, @@ -27,13 +25,9 @@ alter table foo add column baz string(max) not null Rparen: 41, Name: "STRING", Max: true, - Size: nil, }, - NotNull: true, - DefaultExpr: (*ast.ColumnDefaultExpr)(nil), - GeneratedExpr: (*ast.GeneratedColumnExpr)(nil), - Hidden: -1, - Options: (*ast.Options)(nil), + NotNull: true, + Hidden: -1, }, }, } diff --git a/testdata/result/statement/alter_table_add_column_if_not_exists.sql.txt b/testdata/result/statement/alter_table_add_column_if_not_exists.sql.txt index 4945c620..635672e2 100644 --- a/testdata/result/statement/alter_table_add_column_if_not_exists.sql.txt +++ b/testdata/result/statement/alter_table_add_column_if_not_exists.sql.txt @@ -3,8 +3,7 @@ alter table foo add column if not exists baz string(max) not null --- AST &ast.AlterTable{ - Alter: 0, - Name: &ast.Path{ + Name: &ast.Path{ Idents: []*ast.Ident{ &ast.Ident{ NamePos: 12, @@ -28,13 +27,9 @@ alter table foo add column if not exists baz string(max) not null Rparen: 55, Name: "STRING", Max: true, - Size: nil, }, - NotNull: true, - DefaultExpr: (*ast.ColumnDefaultExpr)(nil), - GeneratedExpr: (*ast.GeneratedColumnExpr)(nil), - Hidden: -1, - Options: (*ast.Options)(nil), + NotNull: true, + Hidden: -1, }, }, } diff --git a/testdata/result/statement/alter_table_add_column_with_if_expression.sql.txt b/testdata/result/statement/alter_table_add_column_with_if_expression.sql.txt index 580c5d12..181f03d3 100644 --- a/testdata/result/statement/alter_table_add_column_with_if_expression.sql.txt +++ b/testdata/result/statement/alter_table_add_column_with_if_expression.sql.txt @@ -2,8 +2,7 @@ ALTER TABLE foo ADD COLUMN expired_at TIMESTAMP AS (IF (status != "OPEN" AND status != "SCHEDULING", TIMESTAMP_ADD(updated_at, INTERVAL 120 DAY), NULL)) STORED --- AST &ast.AlterTable{ - Alter: 0, - Name: &ast.Path{ + Name: &ast.Path{ Idents: []*ast.Ident{ &ast.Ident{ NamePos: 12, @@ -13,9 +12,8 @@ ALTER TABLE foo ADD COLUMN expired_at TIMESTAMP AS (IF (status != "OPEN" AND sta }, }, TableAlteration: &ast.AddColumn{ - Add: 16, - IfNotExists: false, - Column: &ast.ColumnDef{ + Add: 16, + Column: &ast.ColumnDef{ Null: -1, Name: &ast.Ident{ NamePos: 27, @@ -26,8 +24,6 @@ ALTER TABLE foo ADD COLUMN expired_at TIMESTAMP AS (IF (status != "OPEN" AND sta NamePos: 38, Name: "TIMESTAMP", }, - NotNull: false, - DefaultExpr: (*ast.ColumnDefaultExpr)(nil), GeneratedExpr: &ast.GeneratedColumnExpr{ As: 48, Stored: 153, @@ -71,8 +67,7 @@ ALTER TABLE foo ADD COLUMN expired_at TIMESTAMP AS (IF (status != "OPEN" AND sta NameEnd: 114, Name: "TIMESTAMP_ADD", }, - Distinct: false, - Args: []ast.Arg{ + Args: []ast.Arg{ &ast.ExprArg{ Expr: &ast.Ident{ NamePos: 115, @@ -95,17 +90,13 @@ ALTER TABLE foo ADD COLUMN expired_at TIMESTAMP AS (IF (status != "OPEN" AND sta }, }, }, - NamedArgs: []*ast.NamedArg(nil), - NullHandling: nil, - Having: nil, }, ElseResult: &ast.NullLiteral{ Null: 146, }, }, }, - Hidden: -1, - Options: (*ast.Options)(nil), + Hidden: -1, }, }, } diff --git a/testdata/result/statement/alter_table_add_constraint_check.sql.txt b/testdata/result/statement/alter_table_add_constraint_check.sql.txt index c7b6bd73..03292861 100644 --- a/testdata/result/statement/alter_table_add_constraint_check.sql.txt +++ b/testdata/result/statement/alter_table_add_constraint_check.sql.txt @@ -3,8 +3,7 @@ alter table foo add constraint cname check (c1 > 0) --- AST &ast.AlterTable{ - Alter: 0, - Name: &ast.Path{ + Name: &ast.Path{ Idents: []*ast.Ident{ &ast.Ident{ NamePos: 12, diff --git a/testdata/result/statement/alter_table_add_constraint_foreign_key.sql.txt b/testdata/result/statement/alter_table_add_constraint_foreign_key.sql.txt index 14f2f1db..b0c986d8 100644 --- a/testdata/result/statement/alter_table_add_constraint_foreign_key.sql.txt +++ b/testdata/result/statement/alter_table_add_constraint_foreign_key.sql.txt @@ -3,8 +3,7 @@ alter table foo add constraint fkname foreign key (foo, bar) references t2 (t2ke --- AST &ast.AlterTable{ - Alter: 0, - Name: &ast.Path{ + Name: &ast.Path{ Idents: []*ast.Ident{ &ast.Ident{ NamePos: 12, @@ -59,7 +58,6 @@ alter table foo add constraint fkname foreign key (foo, bar) references t2 (t2ke Name: "t2key2", }, }, - OnDelete: "", }, }, }, diff --git a/testdata/result/statement/alter_table_add_constraint_foreign_key_on_delete_cascade.sql.txt b/testdata/result/statement/alter_table_add_constraint_foreign_key_on_delete_cascade.sql.txt index 5763ea75..7e7ab779 100644 --- a/testdata/result/statement/alter_table_add_constraint_foreign_key_on_delete_cascade.sql.txt +++ b/testdata/result/statement/alter_table_add_constraint_foreign_key_on_delete_cascade.sql.txt @@ -3,8 +3,7 @@ alter table foo add constraint fkname foreign key (foo, bar) references t2 (t2ke --- AST &ast.AlterTable{ - Alter: 0, - Name: &ast.Path{ + Name: &ast.Path{ Idents: []*ast.Ident{ &ast.Ident{ NamePos: 12, diff --git a/testdata/result/statement/alter_table_add_constraint_foreign_key_on_delete_no_action.sql.txt b/testdata/result/statement/alter_table_add_constraint_foreign_key_on_delete_no_action.sql.txt index 80052ce0..080c4819 100644 --- a/testdata/result/statement/alter_table_add_constraint_foreign_key_on_delete_no_action.sql.txt +++ b/testdata/result/statement/alter_table_add_constraint_foreign_key_on_delete_no_action.sql.txt @@ -3,8 +3,7 @@ alter table foo add constraint fkname foreign key (foo, bar) references t2 (t2ke --- AST &ast.AlterTable{ - Alter: 0, - Name: &ast.Path{ + Name: &ast.Path{ Idents: []*ast.Ident{ &ast.Ident{ NamePos: 12, diff --git a/testdata/result/statement/alter_table_add_foreign_key.sql.txt b/testdata/result/statement/alter_table_add_foreign_key.sql.txt index 040d5f20..510a9c43 100644 --- a/testdata/result/statement/alter_table_add_foreign_key.sql.txt +++ b/testdata/result/statement/alter_table_add_foreign_key.sql.txt @@ -3,8 +3,7 @@ alter table foo add foreign key (bar) references t2 (t2key1) --- AST &ast.AlterTable{ - Alter: 0, - Name: &ast.Path{ + Name: &ast.Path{ Idents: []*ast.Ident{ &ast.Ident{ NamePos: 12, @@ -16,9 +15,7 @@ alter table foo add foreign key (bar) references t2 (t2key1) TableAlteration: &ast.AddTableConstraint{ Add: 16, TableConstraint: &ast.TableConstraint{ - ConstraintPos: 0, - Name: (*ast.Ident)(nil), - Constraint: &ast.ForeignKey{ + Constraint: &ast.ForeignKey{ Foreign: 20, Rparen: 59, OnDeleteEnd: -1, @@ -45,7 +42,6 @@ alter table foo add foreign key (bar) references t2 (t2key1) Name: "t2key1", }, }, - OnDelete: "", }, }, }, diff --git a/testdata/result/statement/alter_table_add_row_deletion_policy.sql.txt b/testdata/result/statement/alter_table_add_row_deletion_policy.sql.txt index 4838ae3c..091ec583 100644 --- a/testdata/result/statement/alter_table_add_row_deletion_policy.sql.txt +++ b/testdata/result/statement/alter_table_add_row_deletion_policy.sql.txt @@ -3,8 +3,7 @@ alter table foo add row deletion policy ( older_than ( bar, interval 30 day )) --- AST &ast.AlterTable{ - Alter: 0, - Name: &ast.Path{ + Name: &ast.Path{ Idents: []*ast.Ident{ &ast.Ident{ NamePos: 12, diff --git a/testdata/result/statement/alter_table_add_synonym.sql.txt b/testdata/result/statement/alter_table_add_synonym.sql.txt index 0f384a60..cc54b865 100644 --- a/testdata/result/statement/alter_table_add_synonym.sql.txt +++ b/testdata/result/statement/alter_table_add_synonym.sql.txt @@ -2,8 +2,7 @@ ALTER TABLE Singers ADD SYNONYM SingersTest --- AST &ast.AlterTable{ - Alter: 0, - Name: &ast.Path{ + Name: &ast.Path{ Idents: []*ast.Ident{ &ast.Ident{ NamePos: 12, diff --git a/testdata/result/statement/alter_table_alter_column.sql.txt b/testdata/result/statement/alter_table_alter_column.sql.txt index 13e95b83..254ad98c 100644 --- a/testdata/result/statement/alter_table_alter_column.sql.txt +++ b/testdata/result/statement/alter_table_alter_column.sql.txt @@ -2,8 +2,7 @@ alter table foo alter column foo string(256) not null --- AST &ast.AlterTable{ - Alter: 0, - Name: &ast.Path{ + Name: &ast.Path{ Idents: []*ast.Ident{ &ast.Ident{ NamePos: 12, @@ -24,7 +23,6 @@ alter table foo alter column foo string(256) not null NamePos: 33, Rparen: 43, Name: "STRING", - Max: false, Size: &ast.IntLiteral{ ValuePos: 40, ValueEnd: 43, @@ -32,9 +30,8 @@ alter table foo alter column foo string(256) not null Value: "256", }, }, - Null: 49, - NotNull: true, - DefaultExpr: (*ast.ColumnDefaultExpr)(nil), + Null: 49, + NotNull: true, }, }, } diff --git a/testdata/result/statement/alter_table_alter_column_drop_default.sql.txt b/testdata/result/statement/alter_table_alter_column_drop_default.sql.txt index 21b4175f..8b5e7026 100644 --- a/testdata/result/statement/alter_table_alter_column_drop_default.sql.txt +++ b/testdata/result/statement/alter_table_alter_column_drop_default.sql.txt @@ -2,8 +2,7 @@ alter table foo alter column foo drop default --- AST &ast.AlterTable{ - Alter: 0, - Name: &ast.Path{ + Name: &ast.Path{ Idents: []*ast.Ident{ &ast.Ident{ NamePos: 12, diff --git a/testdata/result/statement/alter_table_alter_column_set.sql.txt b/testdata/result/statement/alter_table_alter_column_set.sql.txt index 79eebcf1..5ead03f4 100644 --- a/testdata/result/statement/alter_table_alter_column_set.sql.txt +++ b/testdata/result/statement/alter_table_alter_column_set.sql.txt @@ -2,8 +2,7 @@ alter table foo alter column foo set options(allow_commit_timestamp = true) --- AST &ast.AlterTable{ - Alter: 0, - Name: &ast.Path{ + Name: &ast.Path{ Idents: []*ast.Ident{ &ast.Ident{ NamePos: 12, diff --git a/testdata/result/statement/alter_table_alter_column_set_default.sql.txt b/testdata/result/statement/alter_table_alter_column_set_default.sql.txt index 61bfd3cc..5b75eba2 100644 --- a/testdata/result/statement/alter_table_alter_column_set_default.sql.txt +++ b/testdata/result/statement/alter_table_alter_column_set_default.sql.txt @@ -2,8 +2,7 @@ ALTER TABLE actions ALTER COLUMN output SET DEFAULT("") --- AST &ast.AlterTable{ - Alter: 0, - Name: &ast.Path{ + Name: &ast.Path{ Idents: []*ast.Ident{ &ast.Ident{ NamePos: 12, @@ -27,7 +26,6 @@ ALTER TABLE actions ALTER COLUMN output SET DEFAULT("") Expr: &ast.StringLiteral{ ValuePos: 52, ValueEnd: 54, - Value: "", }, }, }, diff --git a/testdata/result/statement/alter_table_alter_column_with_default.sql.txt b/testdata/result/statement/alter_table_alter_column_with_default.sql.txt index 1df22088..94a7fc3a 100644 --- a/testdata/result/statement/alter_table_alter_column_with_default.sql.txt +++ b/testdata/result/statement/alter_table_alter_column_with_default.sql.txt @@ -2,8 +2,7 @@ ALTER TABLE actions ALTER COLUMN output STRING(MAX) NOT NULL DEFAULT("") --- AST &ast.AlterTable{ - Alter: 0, - Name: &ast.Path{ + Name: &ast.Path{ Idents: []*ast.Ident{ &ast.Ident{ NamePos: 12, @@ -25,7 +24,6 @@ ALTER TABLE actions ALTER COLUMN output STRING(MAX) NOT NULL DEFAULT("") Rparen: 50, Name: "STRING", Max: true, - Size: nil, }, Null: 56, NotNull: true, @@ -35,7 +33,6 @@ ALTER TABLE actions ALTER COLUMN output STRING(MAX) NOT NULL DEFAULT("") Expr: &ast.StringLiteral{ ValuePos: 69, ValueEnd: 71, - Value: "", }, }, }, diff --git a/testdata/result/statement/alter_table_drop_column.sql.txt b/testdata/result/statement/alter_table_drop_column.sql.txt index 0a21940d..f279716f 100644 --- a/testdata/result/statement/alter_table_drop_column.sql.txt +++ b/testdata/result/statement/alter_table_drop_column.sql.txt @@ -3,8 +3,7 @@ alter table foo drop column bar --- AST &ast.AlterTable{ - Alter: 0, - Name: &ast.Path{ + Name: &ast.Path{ Idents: []*ast.Ident{ &ast.Ident{ NamePos: 12, diff --git a/testdata/result/statement/alter_table_drop_constraint.sql.txt b/testdata/result/statement/alter_table_drop_constraint.sql.txt index cd868b07..72380fbe 100644 --- a/testdata/result/statement/alter_table_drop_constraint.sql.txt +++ b/testdata/result/statement/alter_table_drop_constraint.sql.txt @@ -3,8 +3,7 @@ alter table foo drop constraint bar --- AST &ast.AlterTable{ - Alter: 0, - Name: &ast.Path{ + Name: &ast.Path{ Idents: []*ast.Ident{ &ast.Ident{ NamePos: 12, diff --git a/testdata/result/statement/alter_table_drop_row_deletion_policy.sql.txt b/testdata/result/statement/alter_table_drop_row_deletion_policy.sql.txt index 79604aa1..ea5aecd9 100644 --- a/testdata/result/statement/alter_table_drop_row_deletion_policy.sql.txt +++ b/testdata/result/statement/alter_table_drop_row_deletion_policy.sql.txt @@ -3,8 +3,7 @@ alter table foo drop row deletion policy --- AST &ast.AlterTable{ - Alter: 0, - Name: &ast.Path{ + Name: &ast.Path{ Idents: []*ast.Ident{ &ast.Ident{ NamePos: 12, diff --git a/testdata/result/statement/alter_table_drop_synonym.sql.txt b/testdata/result/statement/alter_table_drop_synonym.sql.txt index f5233212..bdd9f37e 100644 --- a/testdata/result/statement/alter_table_drop_synonym.sql.txt +++ b/testdata/result/statement/alter_table_drop_synonym.sql.txt @@ -2,8 +2,7 @@ ALTER TABLE Singers DROP SYNONYM SingersTest --- AST &ast.AlterTable{ - Alter: 0, - Name: &ast.Path{ + Name: &ast.Path{ Idents: []*ast.Ident{ &ast.Ident{ NamePos: 12, diff --git a/testdata/result/statement/alter_table_rename_to.sql.txt b/testdata/result/statement/alter_table_rename_to.sql.txt index 1e7c36a3..d195bd73 100644 --- a/testdata/result/statement/alter_table_rename_to.sql.txt +++ b/testdata/result/statement/alter_table_rename_to.sql.txt @@ -2,8 +2,7 @@ ALTER TABLE Singers RENAME TO SingersNew --- AST &ast.AlterTable{ - Alter: 0, - Name: &ast.Path{ + Name: &ast.Path{ Idents: []*ast.Ident{ &ast.Ident{ NamePos: 12, @@ -19,7 +18,6 @@ ALTER TABLE Singers RENAME TO SingersNew NameEnd: 40, Name: "SingersNew", }, - AddSynonym: (*ast.AddSynonym)(nil), }, } diff --git a/testdata/result/statement/alter_table_rename_to_add_synonym.sql.txt b/testdata/result/statement/alter_table_rename_to_add_synonym.sql.txt index 868eeb4e..bc921657 100644 --- a/testdata/result/statement/alter_table_rename_to_add_synonym.sql.txt +++ b/testdata/result/statement/alter_table_rename_to_add_synonym.sql.txt @@ -2,8 +2,7 @@ ALTER TABLE Singers RENAME TO SingersNew, ADD SYNONYM Singers --- AST &ast.AlterTable{ - Alter: 0, - Name: &ast.Path{ + Name: &ast.Path{ Idents: []*ast.Ident{ &ast.Ident{ NamePos: 12, diff --git a/testdata/result/statement/alter_table_replace_row_deletion_policy.sql.txt b/testdata/result/statement/alter_table_replace_row_deletion_policy.sql.txt index 3fe645be..36397cad 100644 --- a/testdata/result/statement/alter_table_replace_row_deletion_policy.sql.txt +++ b/testdata/result/statement/alter_table_replace_row_deletion_policy.sql.txt @@ -3,8 +3,7 @@ alter table foo replace row deletion policy ( older_than ( bar, interval 30 day --- AST &ast.AlterTable{ - Alter: 0, - Name: &ast.Path{ + Name: &ast.Path{ Idents: []*ast.Ident{ &ast.Ident{ NamePos: 12, diff --git a/testdata/result/statement/alter_table_set_on_delete.sql.txt b/testdata/result/statement/alter_table_set_on_delete.sql.txt index 366965fd..c87c0894 100644 --- a/testdata/result/statement/alter_table_set_on_delete.sql.txt +++ b/testdata/result/statement/alter_table_set_on_delete.sql.txt @@ -2,8 +2,7 @@ alter table foo set on delete cascade --- AST &ast.AlterTable{ - Alter: 0, - Name: &ast.Path{ + Name: &ast.Path{ Idents: []*ast.Ident{ &ast.Ident{ NamePos: 12, diff --git a/testdata/result/statement/alter_table_set_on_delete_no_action.sql.txt b/testdata/result/statement/alter_table_set_on_delete_no_action.sql.txt index 33386763..45ba919c 100644 --- a/testdata/result/statement/alter_table_set_on_delete_no_action.sql.txt +++ b/testdata/result/statement/alter_table_set_on_delete_no_action.sql.txt @@ -2,8 +2,7 @@ alter table foo set on delete no action --- AST &ast.AlterTable{ - Alter: 0, - Name: &ast.Path{ + Name: &ast.Path{ Idents: []*ast.Ident{ &ast.Ident{ NamePos: 12, diff --git a/testdata/result/statement/analyze.sql.txt b/testdata/result/statement/analyze.sql.txt index 44a712f1..0dcf9198 100644 --- a/testdata/result/statement/analyze.sql.txt +++ b/testdata/result/statement/analyze.sql.txt @@ -1,9 +1,7 @@ --- analyze.sql ANALYZE --- AST -&ast.Analyze{ - Analyze: 0, -} +&ast.Analyze{} --- SQL ANALYZE diff --git a/testdata/result/statement/create_change_stream.sql.txt b/testdata/result/statement/create_change_stream.sql.txt index 323175f1..195b135d 100644 --- a/testdata/result/statement/create_change_stream.sql.txt +++ b/testdata/result/statement/create_change_stream.sql.txt @@ -3,14 +3,11 @@ CREATE CHANGE STREAM change_stream_name --- AST &ast.CreateChangeStream{ - Create: 0, - Name: &ast.Ident{ + Name: &ast.Ident{ NamePos: 21, NameEnd: 39, Name: "change_stream_name", }, - For: nil, - Options: (*ast.Options)(nil), } --- SQL diff --git a/testdata/result/statement/create_change_stream_for_all.sql.txt b/testdata/result/statement/create_change_stream_for_all.sql.txt index ae3ae9de..454e5db2 100644 --- a/testdata/result/statement/create_change_stream_for_all.sql.txt +++ b/testdata/result/statement/create_change_stream_for_all.sql.txt @@ -3,8 +3,7 @@ CREATE CHANGE STREAM change_stream_name FOR ALL --- AST &ast.CreateChangeStream{ - Create: 0, - Name: &ast.Ident{ + Name: &ast.Ident{ NamePos: 21, NameEnd: 39, Name: "change_stream_name", @@ -13,7 +12,6 @@ CREATE CHANGE STREAM change_stream_name FOR ALL For: 40, All: 48, }, - Options: (*ast.Options)(nil), } --- SQL diff --git a/testdata/result/statement/create_change_stream_for_multiple_table_columns.sql.txt b/testdata/result/statement/create_change_stream_for_multiple_table_columns.sql.txt index 7f223ba7..6bfce3fb 100644 --- a/testdata/result/statement/create_change_stream_for_multiple_table_columns.sql.txt +++ b/testdata/result/statement/create_change_stream_for_multiple_table_columns.sql.txt @@ -3,8 +3,7 @@ CREATE CHANGE STREAM change_stream_name FOR table_name1(column1, column2), table --- AST &ast.CreateChangeStream{ - Create: 0, - Name: &ast.Ident{ + Name: &ast.Ident{ NamePos: 21, NameEnd: 39, Name: "change_stream_name", @@ -54,7 +53,6 @@ CREATE CHANGE STREAM change_stream_name FOR table_name1(column1, column2), table }, }, }, - Options: (*ast.Options)(nil), } --- SQL diff --git a/testdata/result/statement/create_change_stream_for_table.sql.txt b/testdata/result/statement/create_change_stream_for_table.sql.txt index e208fda4..ebde8b19 100644 --- a/testdata/result/statement/create_change_stream_for_table.sql.txt +++ b/testdata/result/statement/create_change_stream_for_table.sql.txt @@ -3,8 +3,7 @@ CREATE CHANGE STREAM change_stream_name FOR table_name --- AST &ast.CreateChangeStream{ - Create: 0, - Name: &ast.Ident{ + Name: &ast.Ident{ NamePos: 21, NameEnd: 39, Name: "change_stream_name", @@ -13,17 +12,14 @@ CREATE CHANGE STREAM change_stream_name FOR table_name For: 40, Tables: []*ast.ChangeStreamForTable{ &ast.ChangeStreamForTable{ - Rparen: 0, TableName: &ast.Ident{ NamePos: 44, NameEnd: 54, Name: "table_name", }, - Columns: []*ast.Ident(nil), }, }, }, - Options: (*ast.Options)(nil), } --- SQL diff --git a/testdata/result/statement/create_change_stream_for_table_column.sql.txt b/testdata/result/statement/create_change_stream_for_table_column.sql.txt index 8829eac0..3be46ca1 100644 --- a/testdata/result/statement/create_change_stream_for_table_column.sql.txt +++ b/testdata/result/statement/create_change_stream_for_table_column.sql.txt @@ -3,8 +3,7 @@ CREATE CHANGE STREAM change_stream_name FOR table_name(column) --- AST &ast.CreateChangeStream{ - Create: 0, - Name: &ast.Ident{ + Name: &ast.Ident{ NamePos: 21, NameEnd: 39, Name: "change_stream_name", @@ -29,7 +28,6 @@ CREATE CHANGE STREAM change_stream_name FOR table_name(column) }, }, }, - Options: (*ast.Options)(nil), } --- SQL diff --git a/testdata/result/statement/create_change_stream_for_table_columns.sql.txt b/testdata/result/statement/create_change_stream_for_table_columns.sql.txt index 320c4dd3..872ff41f 100644 --- a/testdata/result/statement/create_change_stream_for_table_columns.sql.txt +++ b/testdata/result/statement/create_change_stream_for_table_columns.sql.txt @@ -3,8 +3,7 @@ CREATE CHANGE STREAM change_stream_name FOR table_name(column1, column2) --- AST &ast.CreateChangeStream{ - Create: 0, - Name: &ast.Ident{ + Name: &ast.Ident{ NamePos: 21, NameEnd: 39, Name: "change_stream_name", @@ -34,7 +33,6 @@ CREATE CHANGE STREAM change_stream_name FOR table_name(column1, column2) }, }, }, - Options: (*ast.Options)(nil), } --- SQL diff --git a/testdata/result/statement/create_change_stream_for_tables.sql.txt b/testdata/result/statement/create_change_stream_for_tables.sql.txt index d152e46e..3cfd2415 100644 --- a/testdata/result/statement/create_change_stream_for_tables.sql.txt +++ b/testdata/result/statement/create_change_stream_for_tables.sql.txt @@ -3,8 +3,7 @@ CREATE CHANGE STREAM change_stream_name FOR table_name1, table_name2 --- AST &ast.CreateChangeStream{ - Create: 0, - Name: &ast.Ident{ + Name: &ast.Ident{ NamePos: 21, NameEnd: 39, Name: "change_stream_name", @@ -13,26 +12,21 @@ CREATE CHANGE STREAM change_stream_name FOR table_name1, table_name2 For: 40, Tables: []*ast.ChangeStreamForTable{ &ast.ChangeStreamForTable{ - Rparen: 0, TableName: &ast.Ident{ NamePos: 44, NameEnd: 55, Name: "table_name1", }, - Columns: []*ast.Ident(nil), }, &ast.ChangeStreamForTable{ - Rparen: 0, TableName: &ast.Ident{ NamePos: 57, NameEnd: 68, Name: "table_name2", }, - Columns: []*ast.Ident(nil), }, }, }, - Options: (*ast.Options)(nil), } --- SQL diff --git a/testdata/result/statement/create_change_stream_for_tables_with_option.sql.txt b/testdata/result/statement/create_change_stream_for_tables_with_option.sql.txt index 7f1778ce..9077f8c5 100644 --- a/testdata/result/statement/create_change_stream_for_tables_with_option.sql.txt +++ b/testdata/result/statement/create_change_stream_for_tables_with_option.sql.txt @@ -4,8 +4,7 @@ OPTIONS(retention_period = '1d') --- AST &ast.CreateChangeStream{ - Create: 0, - Name: &ast.Ident{ + Name: &ast.Ident{ NamePos: 21, NameEnd: 39, Name: "change_stream_name", diff --git a/testdata/result/statement/create_change_stream_for_tables_with_option_null.sql.txt b/testdata/result/statement/create_change_stream_for_tables_with_option_null.sql.txt index 1ff7f957..5f569192 100644 --- a/testdata/result/statement/create_change_stream_for_tables_with_option_null.sql.txt +++ b/testdata/result/statement/create_change_stream_for_tables_with_option_null.sql.txt @@ -4,8 +4,7 @@ OPTIONS(retention_period = null) --- AST &ast.CreateChangeStream{ - Create: 0, - Name: &ast.Ident{ + Name: &ast.Ident{ NamePos: 21, NameEnd: 39, Name: "change_stream_name", diff --git a/testdata/result/statement/create_change_stream_for_tables_with_options.sql.txt b/testdata/result/statement/create_change_stream_for_tables_with_options.sql.txt index ecb43509..8dbce278 100644 --- a/testdata/result/statement/create_change_stream_for_tables_with_options.sql.txt +++ b/testdata/result/statement/create_change_stream_for_tables_with_options.sql.txt @@ -4,8 +4,7 @@ OPTIONS(retention_period = '1d', value_capture_type = 'NEW_ROW') --- AST &ast.CreateChangeStream{ - Create: 0, - Name: &ast.Ident{ + Name: &ast.Ident{ NamePos: 21, NameEnd: 39, Name: "change_stream_name", diff --git a/testdata/result/statement/create_database.sql.txt b/testdata/result/statement/create_database.sql.txt index 85282278..54a7523e 100644 --- a/testdata/result/statement/create_database.sql.txt +++ b/testdata/result/statement/create_database.sql.txt @@ -3,8 +3,7 @@ create database foo_bar_baz --- AST &ast.CreateDatabase{ - Create: 0, - Name: &ast.Ident{ + Name: &ast.Ident{ NamePos: 16, NameEnd: 27, Name: "foo_bar_baz", diff --git a/testdata/result/statement/create_index.sql.txt b/testdata/result/statement/create_index.sql.txt index 1e7c971e..f29910dd 100644 --- a/testdata/result/statement/create_index.sql.txt +++ b/testdata/result/statement/create_index.sql.txt @@ -6,12 +6,8 @@ create index foo_bar on foo ( --- AST &ast.CreateIndex{ - Create: 0, - Rparen: 53, - Unique: false, - NullFiltered: false, - IfNotExists: false, - Name: &ast.Path{ + Rparen: 53, + Name: &ast.Path{ Idents: []*ast.Ident{ &ast.Ident{ NamePos: 13, @@ -49,8 +45,6 @@ create index foo_bar on foo ( Dir: "ASC", }, }, - Storing: (*ast.Storing)(nil), - InterleaveIn: (*ast.InterleaveIn)(nil), } --- SQL diff --git a/testdata/result/statement/create_index_if_not_exists.sql.txt b/testdata/result/statement/create_index_if_not_exists.sql.txt index fc35d85f..824fd9e4 100644 --- a/testdata/result/statement/create_index_if_not_exists.sql.txt +++ b/testdata/result/statement/create_index_if_not_exists.sql.txt @@ -3,12 +3,9 @@ create index if not exists foo_bar on foo (bar) --- AST &ast.CreateIndex{ - Create: 0, - Rparen: 46, - Unique: false, - NullFiltered: false, - IfNotExists: true, - Name: &ast.Path{ + Rparen: 46, + IfNotExists: true, + Name: &ast.Path{ Idents: []*ast.Ident{ &ast.Ident{ NamePos: 27, @@ -34,11 +31,8 @@ create index if not exists foo_bar on foo (bar) NameEnd: 46, Name: "bar", }, - Dir: "", }, }, - Storing: (*ast.Storing)(nil), - InterleaveIn: (*ast.InterleaveIn)(nil), } --- SQL diff --git a/testdata/result/statement/create_index_interleave.sql.txt b/testdata/result/statement/create_index_interleave.sql.txt index 32e8a5dc..5dffda20 100644 --- a/testdata/result/statement/create_index_interleave.sql.txt +++ b/testdata/result/statement/create_index_interleave.sql.txt @@ -6,12 +6,8 @@ create index foo_bar on foo ( --- AST &ast.CreateIndex{ - Create: 0, - Rparen: 41, - Unique: false, - NullFiltered: false, - IfNotExists: false, - Name: &ast.Path{ + Rparen: 41, + Name: &ast.Path{ Idents: []*ast.Ident{ &ast.Ident{ NamePos: 13, diff --git a/testdata/result/statement/create_index_storing.sql.txt b/testdata/result/statement/create_index_storing.sql.txt index 1d08e6e3..5f0a2dbf 100644 --- a/testdata/result/statement/create_index_storing.sql.txt +++ b/testdata/result/statement/create_index_storing.sql.txt @@ -5,12 +5,8 @@ create index foo_bar on foo ( --- AST &ast.CreateIndex{ - Create: 0, - Rparen: 40, - Unique: false, - NullFiltered: false, - IfNotExists: false, - Name: &ast.Path{ + Rparen: 40, + Name: &ast.Path{ Idents: []*ast.Ident{ &ast.Ident{ NamePos: 13, @@ -55,7 +51,6 @@ create index foo_bar on foo ( }, }, }, - InterleaveIn: (*ast.InterleaveIn)(nil), } --- SQL diff --git a/testdata/result/statement/create_model.sql.txt b/testdata/result/statement/create_model.sql.txt index 29e55f39..de647cb2 100644 --- a/testdata/result/statement/create_model.sql.txt +++ b/testdata/result/statement/create_model.sql.txt @@ -15,11 +15,8 @@ OPTIONS ( ) --- AST &ast.CreateModel{ - Create: 0, - Remote: 183, - OrReplace: false, - IfNotExists: false, - Name: &ast.Ident{ + Remote: 183, + Name: &ast.Ident{ NamePos: 13, NameEnd: 34, Name: "MyClassificationModel", @@ -38,7 +35,6 @@ OPTIONS ( NamePos: 52, Name: "FLOAT64", }, - Options: (*ast.Options)(nil), }, &ast.CreateModelColumn{ Name: &ast.Ident{ @@ -51,9 +47,7 @@ OPTIONS ( Rparen: 82, Name: "STRING", Max: true, - Size: nil, }, - Options: (*ast.Options)(nil), }, &ast.CreateModelColumn{ Name: &ast.Ident{ @@ -70,11 +64,8 @@ OPTIONS ( Rparen: 113, Name: "STRING", Max: true, - Size: nil, }, - NamedArgs: []*ast.NamedArg(nil), }, - Options: (*ast.Options)(nil), }, }, OutputColumns: []*ast.CreateModelColumn{ @@ -92,9 +83,7 @@ OPTIONS ( NamePos: 142, Name: "FLOAT64", }, - NamedArgs: []*ast.NamedArg(nil), }, - Options: (*ast.Options)(nil), }, &ast.CreateModelColumn{ Name: &ast.Ident{ @@ -111,11 +100,8 @@ OPTIONS ( Rparen: 178, Name: "STRING", Max: true, - Size: nil, }, - NamedArgs: []*ast.NamedArg(nil), }, - Options: (*ast.Options)(nil), }, }, }, diff --git a/testdata/result/statement/create_model_if_not_exists.sql.txt b/testdata/result/statement/create_model_if_not_exists.sql.txt index dfaea744..05f2efaa 100644 --- a/testdata/result/statement/create_model_if_not_exists.sql.txt +++ b/testdata/result/statement/create_model_if_not_exists.sql.txt @@ -8,9 +8,7 @@ REMOTE OPTIONS ( ) --- AST &ast.CreateModel{ - Create: 0, Remote: 93, - OrReplace: false, IfNotExists: true, Name: &ast.Ident{ NamePos: 13, @@ -32,9 +30,7 @@ REMOTE OPTIONS ( Rparen: 61, Name: "STRING", Max: true, - Size: nil, }, - Options: (*ast.Options)(nil), }, }, OutputColumns: []*ast.CreateModelColumn{ @@ -49,9 +45,7 @@ REMOTE OPTIONS ( Rparen: 90, Name: "STRING", Max: true, - Size: nil, }, - Options: (*ast.Options)(nil), }, }, }, diff --git a/testdata/result/statement/create_or_replace_model.sql.txt b/testdata/result/statement/create_or_replace_model.sql.txt index 7f9f4a2c..9955be94 100644 --- a/testdata/result/statement/create_or_replace_model.sql.txt +++ b/testdata/result/statement/create_or_replace_model.sql.txt @@ -8,11 +8,9 @@ REMOTE OPTIONS ( ) --- AST &ast.CreateModel{ - Create: 0, - Remote: 90, - OrReplace: true, - IfNotExists: false, - Name: &ast.Ident{ + Remote: 90, + OrReplace: true, + Name: &ast.Ident{ NamePos: 24, NameEnd: 33, Name: "GeminiPro", @@ -32,9 +30,7 @@ REMOTE OPTIONS ( Rparen: 58, Name: "STRING", Max: true, - Size: nil, }, - Options: (*ast.Options)(nil), }, }, OutputColumns: []*ast.CreateModelColumn{ @@ -49,9 +45,7 @@ REMOTE OPTIONS ( Rparen: 87, Name: "STRING", Max: true, - Size: nil, }, - Options: (*ast.Options)(nil), }, }, }, diff --git a/testdata/result/statement/create_or_replace_view.sql.txt b/testdata/result/statement/create_or_replace_view.sql.txt index f66ace7f..59a20e48 100644 --- a/testdata/result/statement/create_or_replace_view.sql.txt +++ b/testdata/result/statement/create_or_replace_view.sql.txt @@ -8,8 +8,7 @@ from singers --- AST &ast.CreateView{ - Create: 0, - Name: &ast.Path{ + Name: &ast.Path{ Idents: []*ast.Ident{ &ast.Ident{ NamePos: 23, @@ -21,10 +20,8 @@ from singers OrReplace: true, SecurityType: "INVOKER", Query: &ast.Select{ - Select: 59, - Distinct: false, - As: nil, - Results: []ast.SelectItem{ + Select: 59, + Results: []ast.SelectItem{ &ast.Alias{ Expr: &ast.Path{ Idents: []*ast.Ident{ @@ -107,16 +104,8 @@ from singers NameEnd: 169, Name: "singers", }, - Hint: (*ast.Hint)(nil), - As: (*ast.AsAlias)(nil), - Sample: (*ast.TableSample)(nil), }, }, - Where: (*ast.Where)(nil), - GroupBy: (*ast.GroupBy)(nil), - Having: (*ast.Having)(nil), - OrderBy: (*ast.OrderBy)(nil), - Limit: (*ast.Limit)(nil), }, } diff --git a/testdata/result/statement/create_placement.sql.txt b/testdata/result/statement/create_placement.sql.txt index efbb1bc0..4cae85d1 100644 --- a/testdata/result/statement/create_placement.sql.txt +++ b/testdata/result/statement/create_placement.sql.txt @@ -2,8 +2,7 @@ CREATE PLACEMENT `europeplacement` OPTIONS (instance_partition="europe-partition") --- AST &ast.CreatePlacement{ - Create: 0, - Name: &ast.Ident{ + Name: &ast.Ident{ NamePos: 17, NameEnd: 34, Name: "europeplacement", diff --git a/testdata/result/statement/create_role.sql.txt b/testdata/result/statement/create_role.sql.txt index 1ee359a6..272ed16b 100644 --- a/testdata/result/statement/create_role.sql.txt +++ b/testdata/result/statement/create_role.sql.txt @@ -3,8 +3,7 @@ CREATE ROLE hr_manager --- AST &ast.CreateRole{ - Create: 0, - Name: &ast.Ident{ + Name: &ast.Ident{ NamePos: 12, NameEnd: 22, Name: "hr_manager", diff --git a/testdata/result/statement/create_schema.sql.txt b/testdata/result/statement/create_schema.sql.txt index 2b04f8f5..0d7bd8cd 100644 --- a/testdata/result/statement/create_schema.sql.txt +++ b/testdata/result/statement/create_schema.sql.txt @@ -2,8 +2,7 @@ CREATE SCHEMA sch1 --- AST &ast.CreateSchema{ - Create: 0, - Name: &ast.Ident{ + Name: &ast.Ident{ NamePos: 14, NameEnd: 18, Name: "sch1", diff --git a/testdata/result/statement/create_search_index_full.sql.txt b/testdata/result/statement/create_search_index_full.sql.txt index 299f2fe0..3f4d4b09 100644 --- a/testdata/result/statement/create_search_index_full.sql.txt +++ b/testdata/result/statement/create_search_index_full.sql.txt @@ -9,8 +9,7 @@ WHERE Genre IS NOT NULL AND ReleaseTimestamp IS NOT NULL OPTIONS(sort_order_sharding=true) --- AST &ast.CreateSearchIndex{ - Create: 0, - Name: &ast.Ident{ + Name: &ast.Ident{ NamePos: 20, NameEnd: 35, Name: "AlbumsIndexFull", @@ -61,8 +60,7 @@ OPTIONS(sort_order_sharding=true) NameEnd: 137, Name: "ReleaseTimestamp", }, - Collate: (*ast.Collate)(nil), - Dir: "DESC", + Dir: "DESC", }, }, }, diff --git a/testdata/result/statement/create_search_index_null_filtered.sql.txt b/testdata/result/statement/create_search_index_null_filtered.sql.txt index f1fab7c1..d5729a3a 100644 --- a/testdata/result/statement/create_search_index_null_filtered.sql.txt +++ b/testdata/result/statement/create_search_index_null_filtered.sql.txt @@ -5,8 +5,7 @@ STORING(Genre) WHERE Genre IS NOT NULL --- AST &ast.CreateSearchIndex{ - Create: 0, - Name: &ast.Ident{ + Name: &ast.Ident{ NamePos: 20, NameEnd: 31, Name: "AlbumsIndex", @@ -35,9 +34,7 @@ WHERE Genre IS NOT NULL }, }, }, - PartitionColumns: []*ast.Ident(nil), - OrderBy: (*ast.OrderBy)(nil), - Where: &ast.Where{ + Where: &ast.Where{ Where: 76, Expr: &ast.IsNullExpr{ Null: 95, @@ -49,8 +46,6 @@ WHERE Genre IS NOT NULL }, }, }, - Interleave: (*ast.InterleaveIn)(nil), - Options: (*ast.Options)(nil), } --- SQL diff --git a/testdata/result/statement/create_search_index_simple.sql.txt b/testdata/result/statement/create_search_index_simple.sql.txt index 60072aa5..157fa39d 100644 --- a/testdata/result/statement/create_search_index_simple.sql.txt +++ b/testdata/result/statement/create_search_index_simple.sql.txt @@ -22,13 +22,7 @@ CREATE SEARCH INDEX AlbumsIndex Name: "AlbumTitle_Tokens", }, }, - Rparen: 84, - Storing: (*ast.Storing)(nil), - PartitionColumns: []*ast.Ident(nil), - OrderBy: (*ast.OrderBy)(nil), - Where: (*ast.Where)(nil), - Interleave: (*ast.InterleaveIn)(nil), - Options: (*ast.Options)(nil), + Rparen: 84, } --- SQL diff --git a/testdata/result/statement/create_sequance.sql.txt b/testdata/result/statement/create_sequance.sql.txt index c9b733f0..e38e825b 100644 --- a/testdata/result/statement/create_sequance.sql.txt +++ b/testdata/result/statement/create_sequance.sql.txt @@ -7,8 +7,7 @@ CREATE SEQUENCE IF NOT EXISTS MySequence OPTIONS ( --- AST &ast.CreateSequence{ - Create: 0, - Name: &ast.Path{ + Name: &ast.Path{ Idents: []*ast.Ident{ &ast.Ident{ NamePos: 30, diff --git a/testdata/result/statement/create_table.sql.txt b/testdata/result/statement/create_table.sql.txt index 955ce484..f3d84cdf 100644 --- a/testdata/result/statement/create_table.sql.txt +++ b/testdata/result/statement/create_table.sql.txt @@ -16,10 +16,8 @@ create table foo ( --- AST &ast.CreateTable{ - Create: 0, - Rparen: 573, - IfNotExists: false, - Name: &ast.Path{ + Rparen: 573, + Name: &ast.Path{ Idents: []*ast.Ident{ &ast.Ident{ NamePos: 13, @@ -40,11 +38,7 @@ create table foo ( NamePos: 25, Name: "INT64", }, - NotNull: false, - DefaultExpr: (*ast.ColumnDefaultExpr)(nil), - GeneratedExpr: (*ast.GeneratedColumnExpr)(nil), - Hidden: -1, - Options: (*ast.Options)(nil), + Hidden: -1, }, &ast.ColumnDef{ Null: 50, @@ -57,11 +51,8 @@ create table foo ( NamePos: 38, Name: "FLOAT64", }, - NotNull: true, - DefaultExpr: (*ast.ColumnDefaultExpr)(nil), - GeneratedExpr: (*ast.GeneratedColumnExpr)(nil), - Hidden: -1, - Options: (*ast.Options)(nil), + NotNull: true, + Hidden: -1, }, &ast.ColumnDef{ Null: 78, @@ -74,7 +65,6 @@ create table foo ( NamePos: 62, Rparen: 72, Name: "STRING", - Max: false, Size: &ast.IntLiteral{ ValuePos: 69, ValueEnd: 72, @@ -82,11 +72,9 @@ create table foo ( Value: "255", }, }, - NotNull: true, - DefaultExpr: (*ast.ColumnDefaultExpr)(nil), - GeneratedExpr: (*ast.GeneratedColumnExpr)(nil), - Hidden: -1, - Options: &ast.Options{ + NotNull: true, + Hidden: -1, + Options: &ast.Options{ Options: 83, Rparen: 120, Records: []*ast.OptionsDef{ @@ -114,7 +102,6 @@ create table foo ( NamePos: 129, Rparen: 139, Name: "STRING", - Max: false, Size: &ast.IntLiteral{ ValuePos: 136, ValueEnd: 139, @@ -123,7 +110,6 @@ create table foo ( }, }, NotNull: true, - DefaultExpr: (*ast.ColumnDefaultExpr)(nil), GeneratedExpr: &ast.GeneratedColumnExpr{ As: 150, Stored: 172, @@ -135,8 +121,7 @@ create table foo ( NameEnd: 160, Name: "concat", }, - Distinct: false, - Args: []ast.Arg{ + Args: []ast.Arg{ &ast.ExprArg{ Expr: &ast.Ident{ NamePos: 161, @@ -152,13 +137,9 @@ create table foo ( }, }, }, - NamedArgs: []*ast.NamedArg(nil), - NullHandling: nil, - Having: nil, }, }, - Hidden: -1, - Options: (*ast.Options)(nil), + Hidden: -1, }, &ast.ColumnDef{ Null: -1, @@ -171,11 +152,7 @@ create table foo ( NamePos: 487, Name: "JSON", }, - NotNull: false, - DefaultExpr: (*ast.ColumnDefaultExpr)(nil), - GeneratedExpr: (*ast.GeneratedColumnExpr)(nil), - Hidden: -1, - Options: (*ast.Options)(nil), + Hidden: -1, }, &ast.ColumnDef{ Null: 515, @@ -199,22 +176,14 @@ create table foo ( NameEnd: 546, Name: "current_timestamp", }, - Distinct: false, - Args: []ast.Arg(nil), - NamedArgs: []*ast.NamedArg(nil), - NullHandling: nil, - Having: nil, }, }, - GeneratedExpr: (*ast.GeneratedColumnExpr)(nil), - Hidden: -1, - Options: (*ast.Options)(nil), + Hidden: -1, }, }, TableConstraints: []*ast.TableConstraint{ &ast.TableConstraint{ ConstraintPos: -1, - Name: (*ast.Ident)(nil), Constraint: &ast.ForeignKey{ Foreign: 182, Rparen: 221, @@ -242,12 +211,10 @@ create table foo ( Name: "t2key1", }, }, - OnDelete: "", }, }, &ast.TableConstraint{ ConstraintPos: -1, - Name: (*ast.Ident)(nil), Constraint: &ast.ForeignKey{ Foreign: 226, Rparen: 265, @@ -280,7 +247,6 @@ create table foo ( }, &ast.TableConstraint{ ConstraintPos: -1, - Name: (*ast.Ident)(nil), Constraint: &ast.ForeignKey{ Foreign: 288, Rparen: 327, @@ -355,12 +321,10 @@ create table foo ( Name: "t2key2", }, }, - OnDelete: "", }, }, &ast.TableConstraint{ ConstraintPos: -1, - Name: (*ast.Ident)(nil), Constraint: &ast.Check{ Check: 427, Rparen: 441, @@ -415,7 +379,6 @@ create table foo ( NameEnd: 568, Name: "foo", }, - Dir: "", }, &ast.IndexKey{ DirPos: -1, @@ -424,12 +387,8 @@ create table foo ( NameEnd: 573, Name: "bar", }, - Dir: "", }, }, - Synonyms: []*ast.Synonym(nil), - Cluster: (*ast.Cluster)(nil), - RowDeletionPolicy: (*ast.CreateRowDeletionPolicy)(nil), } --- SQL diff --git a/testdata/result/statement/create_table_cluster.sql.txt b/testdata/result/statement/create_table_cluster.sql.txt index d68c4f45..bacaadc3 100644 --- a/testdata/result/statement/create_table_cluster.sql.txt +++ b/testdata/result/statement/create_table_cluster.sql.txt @@ -7,10 +7,8 @@ create table foo ( --- AST &ast.CreateTable{ - Create: 0, - Rparen: 59, - IfNotExists: false, - Name: &ast.Path{ + Rparen: 59, + Name: &ast.Path{ Idents: []*ast.Ident{ &ast.Ident{ NamePos: 13, @@ -31,11 +29,7 @@ create table foo ( NamePos: 25, Name: "INT64", }, - NotNull: false, - DefaultExpr: (*ast.ColumnDefaultExpr)(nil), - GeneratedExpr: (*ast.GeneratedColumnExpr)(nil), - Hidden: -1, - Options: (*ast.Options)(nil), + Hidden: -1, }, &ast.ColumnDef{ Null: -1, @@ -48,17 +42,10 @@ create table foo ( NamePos: 38, Name: "INT64", }, - NotNull: false, - DefaultExpr: (*ast.ColumnDefaultExpr)(nil), - GeneratedExpr: (*ast.GeneratedColumnExpr)(nil), - Hidden: -1, - Options: (*ast.Options)(nil), + Hidden: -1, }, }, - TableConstraints: []*ast.TableConstraint(nil), - PrimaryKeys: []*ast.IndexKey(nil), - Synonyms: []*ast.Synonym(nil), - Cluster: &ast.Cluster{ + Cluster: &ast.Cluster{ Comma: 60, OnDeleteEnd: -1, TableName: &ast.Path{ @@ -70,9 +57,7 @@ create table foo ( }, }, }, - OnDelete: "", }, - RowDeletionPolicy: (*ast.CreateRowDeletionPolicy)(nil), } --- SQL diff --git a/testdata/result/statement/create_table_cluster_and_row_deletion_policy.sql.txt b/testdata/result/statement/create_table_cluster_and_row_deletion_policy.sql.txt index 654d7abc..0f37325d 100644 --- a/testdata/result/statement/create_table_cluster_and_row_deletion_policy.sql.txt +++ b/testdata/result/statement/create_table_cluster_and_row_deletion_policy.sql.txt @@ -9,10 +9,8 @@ create table foo ( --- AST &ast.CreateTable{ - Create: 0, - Rparen: 77, - IfNotExists: false, - Name: &ast.Path{ + Rparen: 77, + Name: &ast.Path{ Idents: []*ast.Ident{ &ast.Ident{ NamePos: 13, @@ -33,11 +31,7 @@ create table foo ( NamePos: 25, Name: "INT64", }, - NotNull: false, - DefaultExpr: (*ast.ColumnDefaultExpr)(nil), - GeneratedExpr: (*ast.GeneratedColumnExpr)(nil), - Hidden: -1, - Options: (*ast.Options)(nil), + Hidden: -1, }, &ast.ColumnDef{ Null: -1, @@ -50,11 +44,7 @@ create table foo ( NamePos: 38, Name: "INT64", }, - NotNull: false, - DefaultExpr: (*ast.ColumnDefaultExpr)(nil), - GeneratedExpr: (*ast.GeneratedColumnExpr)(nil), - Hidden: -1, - Options: (*ast.Options)(nil), + Hidden: -1, }, &ast.ColumnDef{ Null: -1, @@ -67,17 +57,10 @@ create table foo ( NamePos: 51, Name: "TIMESTAMP", }, - NotNull: false, - DefaultExpr: (*ast.ColumnDefaultExpr)(nil), - GeneratedExpr: (*ast.GeneratedColumnExpr)(nil), - Hidden: -1, - Options: (*ast.Options)(nil), + Hidden: -1, }, }, - TableConstraints: []*ast.TableConstraint(nil), - PrimaryKeys: []*ast.IndexKey(nil), - Synonyms: []*ast.Synonym(nil), - Cluster: &ast.Cluster{ + Cluster: &ast.Cluster{ Comma: 78, OnDeleteEnd: -1, TableName: &ast.Path{ @@ -89,7 +72,6 @@ create table foo ( }, }, }, - OnDelete: "", }, RowDeletionPolicy: &ast.CreateRowDeletionPolicy{ Comma: 109, diff --git a/testdata/result/statement/create_table_cluster_on_delete_no_action.sql.txt b/testdata/result/statement/create_table_cluster_on_delete_no_action.sql.txt index df380466..393b0989 100644 --- a/testdata/result/statement/create_table_cluster_on_delete_no_action.sql.txt +++ b/testdata/result/statement/create_table_cluster_on_delete_no_action.sql.txt @@ -6,10 +6,8 @@ create table foo ( on delete no action --- AST &ast.CreateTable{ - Create: 0, - Rparen: 50, - IfNotExists: false, - Name: &ast.Path{ + Rparen: 50, + Name: &ast.Path{ Idents: []*ast.Ident{ &ast.Ident{ NamePos: 13, @@ -30,15 +28,10 @@ create table foo ( NamePos: 25, Name: "INT64", }, - NotNull: false, - DefaultExpr: (*ast.ColumnDefaultExpr)(nil), - GeneratedExpr: (*ast.GeneratedColumnExpr)(nil), - Hidden: -1, - Options: (*ast.Options)(nil), + Hidden: -1, }, }, - TableConstraints: []*ast.TableConstraint(nil), - PrimaryKeys: []*ast.IndexKey{ + PrimaryKeys: []*ast.IndexKey{ &ast.IndexKey{ DirPos: -1, Name: &ast.Ident{ @@ -46,11 +39,9 @@ create table foo ( NameEnd: 50, Name: "foo", }, - Dir: "", }, }, - Synonyms: []*ast.Synonym(nil), - Cluster: &ast.Cluster{ + Cluster: &ast.Cluster{ Comma: 51, OnDeleteEnd: 115, TableName: &ast.Path{ @@ -64,7 +55,6 @@ create table foo ( }, OnDelete: "ON DELETE NO ACTION", }, - RowDeletionPolicy: (*ast.CreateRowDeletionPolicy)(nil), } --- SQL diff --git a/testdata/result/statement/create_table_cluster_set_on_delete.sql.txt b/testdata/result/statement/create_table_cluster_set_on_delete.sql.txt index 615cc4a2..8f8605c5 100644 --- a/testdata/result/statement/create_table_cluster_set_on_delete.sql.txt +++ b/testdata/result/statement/create_table_cluster_set_on_delete.sql.txt @@ -6,10 +6,8 @@ create table foo ( on delete cascade --- AST &ast.CreateTable{ - Create: 0, - Rparen: 49, - IfNotExists: false, - Name: &ast.Path{ + Rparen: 49, + Name: &ast.Path{ Idents: []*ast.Ident{ &ast.Ident{ NamePos: 13, @@ -30,15 +28,10 @@ create table foo ( NamePos: 25, Name: "INT64", }, - NotNull: false, - DefaultExpr: (*ast.ColumnDefaultExpr)(nil), - GeneratedExpr: (*ast.GeneratedColumnExpr)(nil), - Hidden: -1, - Options: (*ast.Options)(nil), + Hidden: -1, }, }, - TableConstraints: []*ast.TableConstraint(nil), - PrimaryKeys: []*ast.IndexKey{ + PrimaryKeys: []*ast.IndexKey{ &ast.IndexKey{ DirPos: -1, Name: &ast.Ident{ @@ -46,11 +39,9 @@ create table foo ( NameEnd: 49, Name: "foo", }, - Dir: "", }, }, - Synonyms: []*ast.Synonym(nil), - Cluster: &ast.Cluster{ + Cluster: &ast.Cluster{ Comma: 50, OnDeleteEnd: 112, TableName: &ast.Path{ @@ -64,7 +55,6 @@ create table foo ( }, OnDelete: "ON DELETE CASCADE", }, - RowDeletionPolicy: (*ast.CreateRowDeletionPolicy)(nil), } --- SQL diff --git a/testdata/result/statement/create_table_fulltext_albums.sql.txt b/testdata/result/statement/create_table_fulltext_albums.sql.txt index f4a4b235..7f90a442 100644 --- a/testdata/result/statement/create_table_fulltext_albums.sql.txt +++ b/testdata/result/statement/create_table_fulltext_albums.sql.txt @@ -11,10 +11,9 @@ CREATE TABLE Albums ( ) PRIMARY KEY(AlbumId) --- AST &ast.CreateTable{ - Create: 105, - Rparen: 575, - IfNotExists: false, - Name: &ast.Path{ + Create: 105, + Rparen: 575, + Name: &ast.Path{ Idents: []*ast.Ident{ &ast.Ident{ NamePos: 118, @@ -36,13 +35,9 @@ CREATE TABLE Albums ( Rparen: 169, Name: "STRING", Max: true, - Size: nil, }, - NotNull: true, - DefaultExpr: (*ast.ColumnDefaultExpr)(nil), - GeneratedExpr: (*ast.GeneratedColumnExpr)(nil), - Hidden: -1, - Options: (*ast.Options)(nil), + NotNull: true, + Hidden: -1, }, &ast.ColumnDef{ Null: 224, @@ -55,11 +50,8 @@ CREATE TABLE Albums ( NamePos: 214, Name: "INT64", }, - NotNull: true, - DefaultExpr: (*ast.ColumnDefaultExpr)(nil), - GeneratedExpr: (*ast.GeneratedColumnExpr)(nil), - Hidden: -1, - Options: (*ast.Options)(nil), + NotNull: true, + Hidden: -1, }, &ast.ColumnDef{ Null: 281, @@ -72,11 +64,8 @@ CREATE TABLE Albums ( NamePos: 271, Name: "INT64", }, - NotNull: true, - DefaultExpr: (*ast.ColumnDefaultExpr)(nil), - GeneratedExpr: (*ast.GeneratedColumnExpr)(nil), - Hidden: -1, - Options: (*ast.Options)(nil), + NotNull: true, + Hidden: -1, }, &ast.ColumnDef{ Null: -1, @@ -90,13 +79,8 @@ CREATE TABLE Albums ( Rparen: 332, Name: "STRING", Max: true, - Size: nil, }, - NotNull: false, - DefaultExpr: (*ast.ColumnDefaultExpr)(nil), - GeneratedExpr: (*ast.GeneratedColumnExpr)(nil), - Hidden: -1, - Options: (*ast.Options)(nil), + Hidden: -1, }, &ast.ColumnDef{ Null: -1, @@ -109,11 +93,7 @@ CREATE TABLE Albums ( NamePos: 366, Name: "FLOAT64", }, - NotNull: false, - DefaultExpr: (*ast.ColumnDefaultExpr)(nil), - GeneratedExpr: (*ast.GeneratedColumnExpr)(nil), - Hidden: -1, - Options: (*ast.Options)(nil), + Hidden: -1, }, &ast.ColumnDef{ Null: -1, @@ -126,8 +106,6 @@ CREATE TABLE Albums ( NamePos: 417, Name: "TOKENLIST", }, - NotNull: false, - DefaultExpr: (*ast.ColumnDefaultExpr)(nil), GeneratedExpr: &ast.GeneratedColumnExpr{ As: 427, Stored: -1, @@ -139,8 +117,7 @@ CREATE TABLE Albums ( NameEnd: 448, Name: "TOKENIZE_FULLTEXT", }, - Distinct: false, - Args: []ast.Arg{ + Args: []ast.Arg{ &ast.ExprArg{ Expr: &ast.Ident{ NamePos: 449, @@ -149,13 +126,9 @@ CREATE TABLE Albums ( }, }, }, - NamedArgs: []*ast.NamedArg(nil), - NullHandling: nil, - Having: nil, }, }, - Hidden: 462, - Options: (*ast.Options)(nil), + Hidden: 462, }, &ast.ColumnDef{ Null: -1, @@ -168,8 +141,6 @@ CREATE TABLE Albums ( NamePos: 508, Name: "TOKENLIST", }, - NotNull: false, - DefaultExpr: (*ast.ColumnDefaultExpr)(nil), GeneratedExpr: &ast.GeneratedColumnExpr{ As: 518, Stored: -1, @@ -181,8 +152,7 @@ CREATE TABLE Albums ( NameEnd: 537, Name: "TOKENIZE_NUMBER", }, - Distinct: false, - Args: []ast.Arg{ + Args: []ast.Arg{ &ast.ExprArg{ Expr: &ast.Ident{ NamePos: 538, @@ -191,17 +161,12 @@ CREATE TABLE Albums ( }, }, }, - NamedArgs: []*ast.NamedArg(nil), - NullHandling: nil, - Having: nil, }, }, - Hidden: 547, - Options: (*ast.Options)(nil), + Hidden: 547, }, }, - TableConstraints: []*ast.TableConstraint(nil), - PrimaryKeys: []*ast.IndexKey{ + PrimaryKeys: []*ast.IndexKey{ &ast.IndexKey{ DirPos: -1, Name: &ast.Ident{ @@ -209,12 +174,8 @@ CREATE TABLE Albums ( NameEnd: 575, Name: "AlbumId", }, - Dir: "", }, }, - Synonyms: []*ast.Synonym(nil), - Cluster: (*ast.Cluster)(nil), - RowDeletionPolicy: (*ast.CreateRowDeletionPolicy)(nil), } --- SQL diff --git a/testdata/result/statement/create_table_if_not_exists.sql.txt b/testdata/result/statement/create_table_if_not_exists.sql.txt index ede4a61c..b7b52448 100644 --- a/testdata/result/statement/create_table_if_not_exists.sql.txt +++ b/testdata/result/statement/create_table_if_not_exists.sql.txt @@ -6,7 +6,6 @@ create table if not exists foo ( --- AST &ast.CreateTable{ - Create: 0, Rparen: 93, IfNotExists: true, Name: &ast.Path{ @@ -30,11 +29,7 @@ create table if not exists foo ( NamePos: 39, Name: "INT64", }, - NotNull: false, - DefaultExpr: (*ast.ColumnDefaultExpr)(nil), - GeneratedExpr: (*ast.GeneratedColumnExpr)(nil), - Hidden: -1, - Options: (*ast.Options)(nil), + Hidden: -1, }, &ast.ColumnDef{ Null: 64, @@ -47,15 +42,11 @@ create table if not exists foo ( NamePos: 52, Name: "FLOAT64", }, - NotNull: true, - DefaultExpr: (*ast.ColumnDefaultExpr)(nil), - GeneratedExpr: (*ast.GeneratedColumnExpr)(nil), - Hidden: -1, - Options: (*ast.Options)(nil), + NotNull: true, + Hidden: -1, }, }, - TableConstraints: []*ast.TableConstraint(nil), - PrimaryKeys: []*ast.IndexKey{ + PrimaryKeys: []*ast.IndexKey{ &ast.IndexKey{ DirPos: -1, Name: &ast.Ident{ @@ -63,7 +54,6 @@ create table if not exists foo ( NameEnd: 88, Name: "foo", }, - Dir: "", }, &ast.IndexKey{ DirPos: -1, @@ -72,12 +62,8 @@ create table if not exists foo ( NameEnd: 93, Name: "bar", }, - Dir: "", }, }, - Synonyms: []*ast.Synonym(nil), - Cluster: (*ast.Cluster)(nil), - RowDeletionPolicy: (*ast.CreateRowDeletionPolicy)(nil), } --- SQL diff --git a/testdata/result/statement/create_table_row_deletion_policy.sql.txt b/testdata/result/statement/create_table_row_deletion_policy.sql.txt index 3d17e37f..047b3cf6 100644 --- a/testdata/result/statement/create_table_row_deletion_policy.sql.txt +++ b/testdata/result/statement/create_table_row_deletion_policy.sql.txt @@ -8,10 +8,8 @@ create table foo ( --- AST &ast.CreateTable{ - Create: 0, - Rparen: 77, - IfNotExists: false, - Name: &ast.Path{ + Rparen: 77, + Name: &ast.Path{ Idents: []*ast.Ident{ &ast.Ident{ NamePos: 13, @@ -32,11 +30,7 @@ create table foo ( NamePos: 25, Name: "INT64", }, - NotNull: false, - DefaultExpr: (*ast.ColumnDefaultExpr)(nil), - GeneratedExpr: (*ast.GeneratedColumnExpr)(nil), - Hidden: -1, - Options: (*ast.Options)(nil), + Hidden: -1, }, &ast.ColumnDef{ Null: -1, @@ -49,11 +43,7 @@ create table foo ( NamePos: 38, Name: "INT64", }, - NotNull: false, - DefaultExpr: (*ast.ColumnDefaultExpr)(nil), - GeneratedExpr: (*ast.GeneratedColumnExpr)(nil), - Hidden: -1, - Options: (*ast.Options)(nil), + Hidden: -1, }, &ast.ColumnDef{ Null: -1, @@ -66,17 +56,9 @@ create table foo ( NamePos: 51, Name: "TIMESTAMP", }, - NotNull: false, - DefaultExpr: (*ast.ColumnDefaultExpr)(nil), - GeneratedExpr: (*ast.GeneratedColumnExpr)(nil), - Hidden: -1, - Options: (*ast.Options)(nil), + Hidden: -1, }, }, - TableConstraints: []*ast.TableConstraint(nil), - PrimaryKeys: []*ast.IndexKey(nil), - Synonyms: []*ast.Synonym(nil), - Cluster: (*ast.Cluster)(nil), RowDeletionPolicy: &ast.CreateRowDeletionPolicy{ Comma: 78, RowDeletionPolicy: &ast.RowDeletionPolicy{ diff --git a/testdata/result/statement/create_table_synonyms.sql.txt b/testdata/result/statement/create_table_synonyms.sql.txt index 00ce0aa7..1346e7d5 100644 --- a/testdata/result/statement/create_table_synonyms.sql.txt +++ b/testdata/result/statement/create_table_synonyms.sql.txt @@ -6,10 +6,8 @@ CREATE TABLE Singers ( ) PRIMARY KEY (SingerId) --- AST &ast.CreateTable{ - Create: 0, - Rparen: 126, - IfNotExists: false, - Name: &ast.Path{ + Rparen: 126, + Name: &ast.Path{ Idents: []*ast.Ident{ &ast.Ident{ NamePos: 13, @@ -30,11 +28,8 @@ CREATE TABLE Singers ( NamePos: 36, Name: "INT64", }, - NotNull: true, - DefaultExpr: (*ast.ColumnDefaultExpr)(nil), - GeneratedExpr: (*ast.GeneratedColumnExpr)(nil), - Hidden: -1, - Options: (*ast.Options)(nil), + NotNull: true, + Hidden: -1, }, &ast.ColumnDef{ Null: -1, @@ -47,7 +42,6 @@ CREATE TABLE Singers ( NamePos: 67, Rparen: 78, Name: "STRING", - Max: false, Size: &ast.IntLiteral{ ValuePos: 74, ValueEnd: 78, @@ -55,15 +49,10 @@ CREATE TABLE Singers ( Value: "1024", }, }, - NotNull: false, - DefaultExpr: (*ast.ColumnDefaultExpr)(nil), - GeneratedExpr: (*ast.GeneratedColumnExpr)(nil), - Hidden: -1, - Options: (*ast.Options)(nil), + Hidden: -1, }, }, - TableConstraints: []*ast.TableConstraint(nil), - PrimaryKeys: []*ast.IndexKey{ + PrimaryKeys: []*ast.IndexKey{ &ast.IndexKey{ DirPos: -1, Name: &ast.Ident{ @@ -71,7 +60,6 @@ CREATE TABLE Singers ( NameEnd: 126, Name: "SingerId", }, - Dir: "", }, }, Synonyms: []*ast.Synonym{ @@ -85,8 +73,6 @@ CREATE TABLE Singers ( }, }, }, - Cluster: (*ast.Cluster)(nil), - RowDeletionPolicy: (*ast.CreateRowDeletionPolicy)(nil), } --- SQL diff --git a/testdata/result/statement/create_table_synonyms_abnormal.sql.txt b/testdata/result/statement/create_table_synonyms_abnormal.sql.txt index f63129a2..43efa244 100644 --- a/testdata/result/statement/create_table_synonyms_abnormal.sql.txt +++ b/testdata/result/statement/create_table_synonyms_abnormal.sql.txt @@ -8,10 +8,9 @@ CREATE TABLE Singers ( ) PRIMARY KEY (SingerId) --- AST &ast.CreateTable{ - Create: 45, - Rparen: 194, - IfNotExists: false, - Name: &ast.Path{ + Create: 45, + Rparen: 194, + Name: &ast.Path{ Idents: []*ast.Ident{ &ast.Ident{ NamePos: 58, @@ -32,11 +31,8 @@ CREATE TABLE Singers ( NamePos: 104, Name: "INT64", }, - NotNull: true, - DefaultExpr: (*ast.ColumnDefaultExpr)(nil), - GeneratedExpr: (*ast.GeneratedColumnExpr)(nil), - Hidden: -1, - Options: (*ast.Options)(nil), + NotNull: true, + Hidden: -1, }, &ast.ColumnDef{ Null: -1, @@ -49,7 +45,6 @@ CREATE TABLE Singers ( NamePos: 135, Rparen: 146, Name: "STRING", - Max: false, Size: &ast.IntLiteral{ ValuePos: 142, ValueEnd: 146, @@ -57,15 +52,10 @@ CREATE TABLE Singers ( Value: "1024", }, }, - NotNull: false, - DefaultExpr: (*ast.ColumnDefaultExpr)(nil), - GeneratedExpr: (*ast.GeneratedColumnExpr)(nil), - Hidden: -1, - Options: (*ast.Options)(nil), + Hidden: -1, }, }, - TableConstraints: []*ast.TableConstraint(nil), - PrimaryKeys: []*ast.IndexKey{ + PrimaryKeys: []*ast.IndexKey{ &ast.IndexKey{ DirPos: -1, Name: &ast.Ident{ @@ -73,7 +63,6 @@ CREATE TABLE Singers ( NameEnd: 194, Name: "SingerId", }, - Dir: "", }, }, Synonyms: []*ast.Synonym{ @@ -96,8 +85,6 @@ CREATE TABLE Singers ( }, }, }, - Cluster: (*ast.Cluster)(nil), - RowDeletionPolicy: (*ast.CreateRowDeletionPolicy)(nil), } --- SQL diff --git a/testdata/result/statement/create_table_trailing_comma.sql.txt b/testdata/result/statement/create_table_trailing_comma.sql.txt index 0a81242d..0e7ddcdb 100644 --- a/testdata/result/statement/create_table_trailing_comma.sql.txt +++ b/testdata/result/statement/create_table_trailing_comma.sql.txt @@ -9,10 +9,8 @@ create table foo ( --- AST &ast.CreateTable{ - Create: 0, - Rparen: 83, - IfNotExists: false, - Name: &ast.Path{ + Rparen: 83, + Name: &ast.Path{ Idents: []*ast.Ident{ &ast.Ident{ NamePos: 13, @@ -33,11 +31,7 @@ create table foo ( NamePos: 25, Name: "INT64", }, - NotNull: false, - DefaultExpr: (*ast.ColumnDefaultExpr)(nil), - GeneratedExpr: (*ast.GeneratedColumnExpr)(nil), - Hidden: -1, - Options: (*ast.Options)(nil), + Hidden: -1, }, &ast.ColumnDef{ Null: -1, @@ -50,15 +44,10 @@ create table foo ( NamePos: 38, Name: "INT64", }, - NotNull: false, - DefaultExpr: (*ast.ColumnDefaultExpr)(nil), - GeneratedExpr: (*ast.GeneratedColumnExpr)(nil), - Hidden: -1, - Options: (*ast.Options)(nil), + Hidden: -1, }, }, - TableConstraints: []*ast.TableConstraint(nil), - PrimaryKeys: []*ast.IndexKey{ + PrimaryKeys: []*ast.IndexKey{ &ast.IndexKey{ DirPos: 66, Name: &ast.Ident{ @@ -78,9 +67,6 @@ create table foo ( Dir: "DESC", }, }, - Synonyms: []*ast.Synonym(nil), - Cluster: (*ast.Cluster)(nil), - RowDeletionPolicy: (*ast.CreateRowDeletionPolicy)(nil), } --- SQL diff --git a/testdata/result/statement/create_table_types.sql.txt b/testdata/result/statement/create_table_types.sql.txt index dbb18756..0dd70563 100644 --- a/testdata/result/statement/create_table_types.sql.txt +++ b/testdata/result/statement/create_table_types.sql.txt @@ -18,10 +18,8 @@ create table types ( --- AST &ast.CreateTable{ - Create: 0, - Rparen: 297, - IfNotExists: false, - Name: &ast.Path{ + Rparen: 297, + Name: &ast.Path{ Idents: []*ast.Ident{ &ast.Ident{ NamePos: 13, @@ -42,11 +40,7 @@ create table types ( NamePos: 25, Name: "BOOL", }, - NotNull: false, - DefaultExpr: (*ast.ColumnDefaultExpr)(nil), - GeneratedExpr: (*ast.GeneratedColumnExpr)(nil), - Hidden: -1, - Options: (*ast.Options)(nil), + Hidden: -1, }, &ast.ColumnDef{ Null: -1, @@ -59,11 +53,7 @@ create table types ( NamePos: 35, Name: "INT64", }, - NotNull: false, - DefaultExpr: (*ast.ColumnDefaultExpr)(nil), - GeneratedExpr: (*ast.GeneratedColumnExpr)(nil), - Hidden: -1, - Options: (*ast.Options)(nil), + Hidden: -1, }, &ast.ColumnDef{ Null: -1, @@ -76,11 +66,7 @@ create table types ( NamePos: 48, Name: "FLOAT32", }, - NotNull: false, - DefaultExpr: (*ast.ColumnDefaultExpr)(nil), - GeneratedExpr: (*ast.GeneratedColumnExpr)(nil), - Hidden: -1, - Options: (*ast.Options)(nil), + Hidden: -1, }, &ast.ColumnDef{ Null: -1, @@ -93,11 +79,7 @@ create table types ( NamePos: 61, Name: "FLOAT64", }, - NotNull: false, - DefaultExpr: (*ast.ColumnDefaultExpr)(nil), - GeneratedExpr: (*ast.GeneratedColumnExpr)(nil), - Hidden: -1, - Options: (*ast.Options)(nil), + Hidden: -1, }, &ast.ColumnDef{ Null: -1, @@ -110,11 +92,7 @@ create table types ( NamePos: 74, Name: "DATE", }, - NotNull: false, - DefaultExpr: (*ast.ColumnDefaultExpr)(nil), - GeneratedExpr: (*ast.GeneratedColumnExpr)(nil), - Hidden: -1, - Options: (*ast.Options)(nil), + Hidden: -1, }, &ast.ColumnDef{ Null: -1, @@ -127,11 +105,7 @@ create table types ( NamePos: 84, Name: "TIMESTAMP", }, - NotNull: false, - DefaultExpr: (*ast.ColumnDefaultExpr)(nil), - GeneratedExpr: (*ast.GeneratedColumnExpr)(nil), - Hidden: -1, - Options: (*ast.Options)(nil), + Hidden: -1, }, &ast.ColumnDef{ Null: -1, @@ -144,7 +118,6 @@ create table types ( NamePos: 99, Rparen: 109, Name: "STRING", - Max: false, Size: &ast.IntLiteral{ ValuePos: 106, ValueEnd: 109, @@ -152,11 +125,7 @@ create table types ( Value: "256", }, }, - NotNull: false, - DefaultExpr: (*ast.ColumnDefaultExpr)(nil), - GeneratedExpr: (*ast.GeneratedColumnExpr)(nil), - Hidden: -1, - Options: (*ast.Options)(nil), + Hidden: -1, }, &ast.ColumnDef{ Null: -1, @@ -170,13 +139,8 @@ create table types ( Rparen: 129, Name: "STRING", Max: true, - Size: nil, }, - NotNull: false, - DefaultExpr: (*ast.ColumnDefaultExpr)(nil), - GeneratedExpr: (*ast.GeneratedColumnExpr)(nil), - Hidden: -1, - Options: (*ast.Options)(nil), + Hidden: -1, }, &ast.ColumnDef{ Null: -1, @@ -189,7 +153,6 @@ create table types ( NamePos: 137, Rparen: 146, Name: "BYTES", - Max: false, Size: &ast.IntLiteral{ ValuePos: 143, ValueEnd: 146, @@ -197,11 +160,7 @@ create table types ( Value: "256", }, }, - NotNull: false, - DefaultExpr: (*ast.ColumnDefaultExpr)(nil), - GeneratedExpr: (*ast.GeneratedColumnExpr)(nil), - Hidden: -1, - Options: (*ast.Options)(nil), + Hidden: -1, }, &ast.ColumnDef{ Null: -1, @@ -215,13 +174,8 @@ create table types ( Rparen: 166, Name: "BYTES", Max: true, - Size: nil, }, - NotNull: false, - DefaultExpr: (*ast.ColumnDefaultExpr)(nil), - GeneratedExpr: (*ast.GeneratedColumnExpr)(nil), - Hidden: -1, - Options: (*ast.Options)(nil), + Hidden: -1, }, &ast.ColumnDef{ Null: -1, @@ -238,13 +192,8 @@ create table types ( NamePos: 180, Name: "BOOL", }, - NamedArgs: []*ast.NamedArg(nil), }, - NotNull: false, - DefaultExpr: (*ast.ColumnDefaultExpr)(nil), - GeneratedExpr: (*ast.GeneratedColumnExpr)(nil), - Hidden: -1, - Options: (*ast.Options)(nil), + Hidden: -1, }, &ast.ColumnDef{ Null: -1, @@ -262,15 +211,9 @@ create table types ( Rparen: 208, Name: "BYTES", Max: true, - Size: nil, }, - NamedArgs: []*ast.NamedArg(nil), }, - NotNull: false, - DefaultExpr: (*ast.ColumnDefaultExpr)(nil), - GeneratedExpr: (*ast.GeneratedColumnExpr)(nil), - Hidden: -1, - Options: (*ast.Options)(nil), + Hidden: -1, }, &ast.ColumnDef{ Null: -1, @@ -293,11 +236,7 @@ create table types ( }, }, }, - NotNull: false, - DefaultExpr: (*ast.ColumnDefaultExpr)(nil), - GeneratedExpr: (*ast.GeneratedColumnExpr)(nil), - Hidden: -1, - Options: (*ast.Options)(nil), + Hidden: -1, }, &ast.ColumnDef{ Null: -1, @@ -330,15 +269,10 @@ create table types ( }, }, }, - NotNull: false, - DefaultExpr: (*ast.ColumnDefaultExpr)(nil), - GeneratedExpr: (*ast.GeneratedColumnExpr)(nil), - Hidden: -1, - Options: (*ast.Options)(nil), + Hidden: -1, }, }, - TableConstraints: []*ast.TableConstraint(nil), - PrimaryKeys: []*ast.IndexKey{ + PrimaryKeys: []*ast.IndexKey{ &ast.IndexKey{ DirPos: -1, Name: &ast.Ident{ @@ -346,12 +280,8 @@ create table types ( NameEnd: 297, Name: "i", }, - Dir: "", }, }, - Synonyms: []*ast.Synonym(nil), - Cluster: (*ast.Cluster)(nil), - RowDeletionPolicy: (*ast.CreateRowDeletionPolicy)(nil), } --- SQL diff --git a/testdata/result/statement/create_table_with_sequence_function.sql.txt b/testdata/result/statement/create_table_with_sequence_function.sql.txt index a98ac027..cb4bd4d0 100644 --- a/testdata/result/statement/create_table_with_sequence_function.sql.txt +++ b/testdata/result/statement/create_table_with_sequence_function.sql.txt @@ -8,10 +8,8 @@ CREATE TABLE foo --- AST &ast.CreateTable{ - Create: 0, - Rparen: 143, - IfNotExists: false, - Name: &ast.Path{ + Rparen: 143, + Name: &ast.Path{ Idents: []*ast.Ident{ &ast.Ident{ NamePos: 13, @@ -32,7 +30,6 @@ CREATE TABLE foo NamePos: 27, Name: "INT64", }, - NotNull: false, DefaultExpr: &ast.ColumnDefaultExpr{ Default: 33, Rparen: 88, @@ -43,8 +40,7 @@ CREATE TABLE foo NameEnd: 65, Name: "GET_NEXT_SEQUENCE_VALUE", }, - Distinct: false, - Args: []ast.Arg{ + Args: []ast.Arg{ &ast.SequenceArg{ Sequence: 66, Expr: &ast.Ident{ @@ -54,14 +50,9 @@ CREATE TABLE foo }, }, }, - NamedArgs: []*ast.NamedArg(nil), - NullHandling: nil, - Having: nil, }, }, - GeneratedExpr: (*ast.GeneratedColumnExpr)(nil), - Hidden: -1, - Options: (*ast.Options)(nil), + Hidden: -1, }, &ast.ColumnDef{ Null: -1, @@ -75,13 +66,8 @@ CREATE TABLE foo Rparen: 110, Name: "STRING", Max: true, - Size: nil, }, - NotNull: false, - DefaultExpr: (*ast.ColumnDefaultExpr)(nil), - GeneratedExpr: (*ast.GeneratedColumnExpr)(nil), - Hidden: -1, - Options: (*ast.Options)(nil), + Hidden: -1, }, &ast.ColumnDef{ Null: -1, @@ -94,15 +80,10 @@ CREATE TABLE foo NamePos: 121, Name: "INT64", }, - NotNull: false, - DefaultExpr: (*ast.ColumnDefaultExpr)(nil), - GeneratedExpr: (*ast.GeneratedColumnExpr)(nil), - Hidden: -1, - Options: (*ast.Options)(nil), + Hidden: -1, }, }, - TableConstraints: []*ast.TableConstraint(nil), - PrimaryKeys: []*ast.IndexKey{ + PrimaryKeys: []*ast.IndexKey{ &ast.IndexKey{ DirPos: -1, Name: &ast.Ident{ @@ -110,12 +91,8 @@ CREATE TABLE foo NameEnd: 143, Name: "id", }, - Dir: "", }, }, - Synonyms: []*ast.Synonym(nil), - Cluster: (*ast.Cluster)(nil), - RowDeletionPolicy: (*ast.CreateRowDeletionPolicy)(nil), } --- SQL diff --git a/testdata/result/statement/create_uniq_null_filtered_index.sql.txt b/testdata/result/statement/create_uniq_null_filtered_index.sql.txt index d6bd80b5..c6f2a636 100644 --- a/testdata/result/statement/create_uniq_null_filtered_index.sql.txt +++ b/testdata/result/statement/create_uniq_null_filtered_index.sql.txt @@ -3,11 +3,9 @@ create unique null_filtered index foo_bar on foo (foo) --- AST &ast.CreateIndex{ - Create: 0, Rparen: 53, Unique: true, NullFiltered: true, - IfNotExists: false, Name: &ast.Path{ Idents: []*ast.Ident{ &ast.Ident{ @@ -34,11 +32,8 @@ create unique null_filtered index foo_bar on foo (foo) NameEnd: 53, Name: "foo", }, - Dir: "", }, }, - Storing: (*ast.Storing)(nil), - InterleaveIn: (*ast.InterleaveIn)(nil), } --- SQL diff --git a/testdata/result/statement/create_vector_index.sql.txt b/testdata/result/statement/create_vector_index.sql.txt index ed7d5a6c..e2b93b86 100644 --- a/testdata/result/statement/create_vector_index.sql.txt +++ b/testdata/result/statement/create_vector_index.sql.txt @@ -3,7 +3,6 @@ CREATE VECTOR INDEX IF NOT EXISTS hello_vector_index ON hello(embedding) OPTIONS(distance_type = 'COSINE') --- AST &ast.CreateVectorIndex{ - Create: 0, IfNotExists: true, Name: &ast.Ident{ NamePos: 34, @@ -20,7 +19,6 @@ OPTIONS(distance_type = 'COSINE') NameEnd: 71, Name: "embedding", }, - Where: (*ast.Where)(nil), Options: &ast.Options{ Options: 73, Rparen: 105, diff --git a/testdata/result/statement/create_vector_index_where_column_not_null.sql.txt b/testdata/result/statement/create_vector_index_where_column_not_null.sql.txt index 965499aa..b77f7dea 100644 --- a/testdata/result/statement/create_vector_index_where_column_not_null.sql.txt +++ b/testdata/result/statement/create_vector_index_where_column_not_null.sql.txt @@ -4,9 +4,7 @@ WHERE embedding IS NOT NULL OPTIONS(distance_type = 'COSINE') --- AST &ast.CreateVectorIndex{ - Create: 0, - IfNotExists: false, - Name: &ast.Ident{ + Name: &ast.Ident{ NamePos: 20, NameEnd: 38, Name: "hello_vector_index", diff --git a/testdata/result/statement/create_view.sql.txt b/testdata/result/statement/create_view.sql.txt index 09d3e5f3..7842821f 100644 --- a/testdata/result/statement/create_view.sql.txt +++ b/testdata/result/statement/create_view.sql.txt @@ -8,8 +8,7 @@ from singers --- AST &ast.CreateView{ - Create: 0, - Name: &ast.Path{ + Name: &ast.Path{ Idents: []*ast.Ident{ &ast.Ident{ NamePos: 12, @@ -18,13 +17,10 @@ from singers }, }, }, - OrReplace: false, SecurityType: "INVOKER", Query: &ast.Select{ - Select: 48, - Distinct: false, - As: nil, - Results: []ast.SelectItem{ + Select: 48, + Results: []ast.SelectItem{ &ast.Alias{ Expr: &ast.Path{ Idents: []*ast.Ident{ @@ -107,16 +103,8 @@ from singers NameEnd: 158, Name: "singers", }, - Hint: (*ast.Hint)(nil), - As: (*ast.AsAlias)(nil), - Sample: (*ast.TableSample)(nil), }, }, - Where: (*ast.Where)(nil), - GroupBy: (*ast.GroupBy)(nil), - Having: (*ast.Having)(nil), - OrderBy: (*ast.OrderBy)(nil), - Limit: (*ast.Limit)(nil), }, } diff --git a/testdata/result/statement/create_view_sql_security_definer.sql.txt b/testdata/result/statement/create_view_sql_security_definer.sql.txt index 345b29a3..a04d0c2f 100644 --- a/testdata/result/statement/create_view_sql_security_definer.sql.txt +++ b/testdata/result/statement/create_view_sql_security_definer.sql.txt @@ -8,8 +8,7 @@ from singers --- AST &ast.CreateView{ - Create: 0, - Name: &ast.Path{ + Name: &ast.Path{ Idents: []*ast.Ident{ &ast.Ident{ NamePos: 12, @@ -18,13 +17,10 @@ from singers }, }, }, - OrReplace: false, SecurityType: "DEFINER", Query: &ast.Select{ - Select: 48, - Distinct: false, - As: nil, - Results: []ast.SelectItem{ + Select: 48, + Results: []ast.SelectItem{ &ast.Alias{ Expr: &ast.Path{ Idents: []*ast.Ident{ @@ -107,16 +103,8 @@ from singers NameEnd: 158, Name: "singers", }, - Hint: (*ast.Hint)(nil), - As: (*ast.AsAlias)(nil), - Sample: (*ast.TableSample)(nil), }, }, - Where: (*ast.Where)(nil), - GroupBy: (*ast.GroupBy)(nil), - Having: (*ast.Having)(nil), - OrderBy: (*ast.OrderBy)(nil), - Limit: (*ast.Limit)(nil), }, } diff --git a/testdata/result/statement/delete _from.sql.txt b/testdata/result/statement/delete _from.sql.txt index 29eddeae..ef9d1756 100644 --- a/testdata/result/statement/delete _from.sql.txt +++ b/testdata/result/statement/delete _from.sql.txt @@ -2,13 +2,11 @@ delete from foo where foo = 1 and bar = 2 --- AST &ast.Delete{ - Delete: 0, TableName: &ast.Ident{ NamePos: 12, NameEnd: 15, Name: "foo", }, - As: (*ast.AsAlias)(nil), Where: &ast.Where{ Where: 16, Expr: &ast.BinaryExpr{ @@ -43,7 +41,6 @@ delete from foo where foo = 1 and bar = 2 }, }, }, - ThenReturn: (*ast.ThenReturn)(nil), } --- SQL diff --git a/testdata/result/statement/delete.sql.txt b/testdata/result/statement/delete.sql.txt index 1bf07ded..6c7b6ce8 100644 --- a/testdata/result/statement/delete.sql.txt +++ b/testdata/result/statement/delete.sql.txt @@ -2,13 +2,11 @@ delete foo where foo = 1 and bar = 2 --- AST &ast.Delete{ - Delete: 0, TableName: &ast.Ident{ NamePos: 7, NameEnd: 10, Name: "foo", }, - As: (*ast.AsAlias)(nil), Where: &ast.Where{ Where: 11, Expr: &ast.BinaryExpr{ @@ -43,7 +41,6 @@ delete foo where foo = 1 and bar = 2 }, }, }, - ThenReturn: (*ast.ThenReturn)(nil), } --- SQL diff --git a/testdata/result/statement/delete_as.sql.txt b/testdata/result/statement/delete_as.sql.txt index 36c330e3..f0758fd5 100644 --- a/testdata/result/statement/delete_as.sql.txt +++ b/testdata/result/statement/delete_as.sql.txt @@ -2,7 +2,6 @@ delete foo as F where F.foo = 1 --- AST &ast.Delete{ - Delete: 0, TableName: &ast.Ident{ NamePos: 7, NameEnd: 10, @@ -42,7 +41,6 @@ delete foo as F where F.foo = 1 }, }, }, - ThenReturn: (*ast.ThenReturn)(nil), } --- SQL diff --git a/testdata/result/statement/delete_then_return.sql.txt b/testdata/result/statement/delete_then_return.sql.txt index 94b742a1..6c160a1f 100644 --- a/testdata/result/statement/delete_then_return.sql.txt +++ b/testdata/result/statement/delete_then_return.sql.txt @@ -2,13 +2,11 @@ delete foo where foo = 1 and bar = 2 then return * --- AST &ast.Delete{ - Delete: 0, TableName: &ast.Ident{ NamePos: 7, NameEnd: 10, Name: "foo", }, - As: (*ast.AsAlias)(nil), Where: &ast.Where{ Where: 11, Expr: &ast.BinaryExpr{ @@ -44,9 +42,8 @@ delete foo where foo = 1 and bar = 2 then return * }, }, ThenReturn: &ast.ThenReturn{ - Then: 37, - WithAction: (*ast.WithAction)(nil), - Items: []ast.SelectItem{ + Then: 37, + Items: []ast.SelectItem{ &ast.Star{ Star: 49, }, diff --git a/testdata/result/statement/drop_change_stream.sql.txt b/testdata/result/statement/drop_change_stream.sql.txt index ecbe86f7..edac2ca2 100644 --- a/testdata/result/statement/drop_change_stream.sql.txt +++ b/testdata/result/statement/drop_change_stream.sql.txt @@ -3,7 +3,6 @@ DROP CHANGE STREAM change_stream_name --- AST &ast.DropChangeStream{ - Drop: 0, Name: &ast.Ident{ NamePos: 19, NameEnd: 37, diff --git a/testdata/result/statement/drop_index.sql.txt b/testdata/result/statement/drop_index.sql.txt index 47ac6572..1896e268 100644 --- a/testdata/result/statement/drop_index.sql.txt +++ b/testdata/result/statement/drop_index.sql.txt @@ -3,9 +3,7 @@ drop index foo_bar --- AST &ast.DropIndex{ - Drop: 0, - IfExists: false, - Name: &ast.Path{ + Name: &ast.Path{ Idents: []*ast.Ident{ &ast.Ident{ NamePos: 11, diff --git a/testdata/result/statement/drop_index_if_exists.sql.txt b/testdata/result/statement/drop_index_if_exists.sql.txt index 54cf0a6a..5b190902 100644 --- a/testdata/result/statement/drop_index_if_exists.sql.txt +++ b/testdata/result/statement/drop_index_if_exists.sql.txt @@ -3,7 +3,6 @@ drop index if exists foo_bar --- AST &ast.DropIndex{ - Drop: 0, IfExists: true, Name: &ast.Path{ Idents: []*ast.Ident{ diff --git a/testdata/result/statement/drop_model.sql.txt b/testdata/result/statement/drop_model.sql.txt index be705286..c75558e9 100644 --- a/testdata/result/statement/drop_model.sql.txt +++ b/testdata/result/statement/drop_model.sql.txt @@ -2,9 +2,7 @@ DROP MODEL MyClassificationModel --- AST &ast.DropModel{ - Drop: 0, - IfExists: false, - Name: &ast.Ident{ + Name: &ast.Ident{ NamePos: 11, NameEnd: 32, Name: "MyClassificationModel", diff --git a/testdata/result/statement/drop_model_if_exists.sql.txt b/testdata/result/statement/drop_model_if_exists.sql.txt index 67ac03dc..99e670a2 100644 --- a/testdata/result/statement/drop_model_if_exists.sql.txt +++ b/testdata/result/statement/drop_model_if_exists.sql.txt @@ -2,7 +2,6 @@ DROP MODEL IF EXISTS MyClassificationModel --- AST &ast.DropModel{ - Drop: 0, IfExists: true, Name: &ast.Ident{ NamePos: 21, diff --git a/testdata/result/statement/drop_proto_bunldle.sql.txt b/testdata/result/statement/drop_proto_bunldle.sql.txt index b36d664b..3f5c6f02 100644 --- a/testdata/result/statement/drop_proto_bunldle.sql.txt +++ b/testdata/result/statement/drop_proto_bunldle.sql.txt @@ -2,7 +2,6 @@ DROP PROTO BUNDLE --- AST &ast.DropProtoBundle{ - Drop: 0, Bundle: 11, } diff --git a/testdata/result/statement/drop_role.sql.txt b/testdata/result/statement/drop_role.sql.txt index 62eadcab..45972f1a 100644 --- a/testdata/result/statement/drop_role.sql.txt +++ b/testdata/result/statement/drop_role.sql.txt @@ -3,7 +3,6 @@ DROP ROLE hr_manager --- AST &ast.DropRole{ - Drop: 0, Name: &ast.Ident{ NamePos: 10, NameEnd: 20, diff --git a/testdata/result/statement/drop_schema.sql.txt b/testdata/result/statement/drop_schema.sql.txt index b9356805..9916952a 100644 --- a/testdata/result/statement/drop_schema.sql.txt +++ b/testdata/result/statement/drop_schema.sql.txt @@ -2,7 +2,6 @@ DROP SCHEMA sch1 --- AST &ast.DropSchema{ - Drop: 0, Name: &ast.Ident{ NamePos: 12, NameEnd: 16, diff --git a/testdata/result/statement/drop_search_index.sql.txt b/testdata/result/statement/drop_search_index.sql.txt index fe6d374c..ca99f2d1 100644 --- a/testdata/result/statement/drop_search_index.sql.txt +++ b/testdata/result/statement/drop_search_index.sql.txt @@ -2,7 +2,6 @@ DROP SEARCH INDEX IF EXISTS AlbumsIndex --- AST &ast.DropSearchIndex{ - Drop: 0, IfExists: true, Name: &ast.Ident{ NamePos: 28, diff --git a/testdata/result/statement/drop_sequence.sql.txt b/testdata/result/statement/drop_sequence.sql.txt index 74d0585c..b8a4b84e 100644 --- a/testdata/result/statement/drop_sequence.sql.txt +++ b/testdata/result/statement/drop_sequence.sql.txt @@ -3,9 +3,7 @@ DROP SEQUENCE my_sequence --- AST &ast.DropSequence{ - Drop: 0, - IfExists: false, - Name: &ast.Path{ + Name: &ast.Path{ Idents: []*ast.Ident{ &ast.Ident{ NamePos: 14, diff --git a/testdata/result/statement/drop_sequence_if_exits.sql.txt b/testdata/result/statement/drop_sequence_if_exits.sql.txt index f8dd5731..34c58016 100644 --- a/testdata/result/statement/drop_sequence_if_exits.sql.txt +++ b/testdata/result/statement/drop_sequence_if_exits.sql.txt @@ -3,7 +3,6 @@ DROP SEQUENCE IF EXISTS my_sequence --- AST &ast.DropSequence{ - Drop: 0, IfExists: true, Name: &ast.Path{ Idents: []*ast.Ident{ diff --git a/testdata/result/statement/drop_table.sql.txt b/testdata/result/statement/drop_table.sql.txt index 099b9936..727dfa76 100644 --- a/testdata/result/statement/drop_table.sql.txt +++ b/testdata/result/statement/drop_table.sql.txt @@ -3,9 +3,7 @@ drop table foo --- AST &ast.DropTable{ - Drop: 0, - IfExists: false, - Name: &ast.Path{ + Name: &ast.Path{ Idents: []*ast.Ident{ &ast.Ident{ NamePos: 11, diff --git a/testdata/result/statement/drop_table_if_exists.sql.txt b/testdata/result/statement/drop_table_if_exists.sql.txt index de5578ca..053346fe 100644 --- a/testdata/result/statement/drop_table_if_exists.sql.txt +++ b/testdata/result/statement/drop_table_if_exists.sql.txt @@ -3,7 +3,6 @@ drop table if exists foo --- AST &ast.DropTable{ - Drop: 0, IfExists: true, Name: &ast.Path{ Idents: []*ast.Ident{ diff --git a/testdata/result/statement/drop_vector_index.sql.txt b/testdata/result/statement/drop_vector_index.sql.txt index 6c7fa9e2..f9a30112 100644 --- a/testdata/result/statement/drop_vector_index.sql.txt +++ b/testdata/result/statement/drop_vector_index.sql.txt @@ -2,9 +2,7 @@ DROP VECTOR INDEX hello_vector_index --- AST &ast.DropVectorIndex{ - Drop: 0, - IfExists: false, - Name: &ast.Ident{ + Name: &ast.Ident{ NamePos: 18, NameEnd: 36, Name: "hello_vector_index", diff --git a/testdata/result/statement/drop_view.sql.txt b/testdata/result/statement/drop_view.sql.txt index 959ce82d..c3c58848 100644 --- a/testdata/result/statement/drop_view.sql.txt +++ b/testdata/result/statement/drop_view.sql.txt @@ -2,7 +2,6 @@ DROP VIEW SingersView --- AST &ast.DropView{ - Drop: 0, Name: &ast.Path{ Idents: []*ast.Ident{ &ast.Ident{ diff --git a/testdata/result/statement/grant_change_stream_privilege.sql.txt b/testdata/result/statement/grant_change_stream_privilege.sql.txt index 92016944..7bae5ed3 100644 --- a/testdata/result/statement/grant_change_stream_privilege.sql.txt +++ b/testdata/result/statement/grant_change_stream_privilege.sql.txt @@ -2,7 +2,6 @@ GRANT SELECT ON CHANGE STREAM cs_name_one, cs_name_two TO ROLE hr_manager --- AST &ast.Grant{ - Grant: 0, Privilege: &ast.SelectPrivilegeOnChangeStream{ Select: 6, Names: []*ast.Ident{ diff --git a/testdata/result/statement/grant_execute_on_table_function.sql.txt b/testdata/result/statement/grant_execute_on_table_function.sql.txt index a7b0f16d..c3070368 100644 --- a/testdata/result/statement/grant_execute_on_table_function.sql.txt +++ b/testdata/result/statement/grant_execute_on_table_function.sql.txt @@ -2,7 +2,6 @@ GRANT EXECUTE ON TABLE FUNCTION READ_SingersNameStream TO ROLE hr_manager --- AST &ast.Grant{ - Grant: 0, Privilege: &ast.ExecutePrivilegeOnTableFunction{ Execute: 6, Names: []*ast.Ident{ diff --git a/testdata/result/statement/grant_privileges.sql.txt b/testdata/result/statement/grant_privileges.sql.txt index 12634b04..b9cc5586 100644 --- a/testdata/result/statement/grant_privileges.sql.txt +++ b/testdata/result/statement/grant_privileges.sql.txt @@ -3,7 +3,6 @@ GRANT SELECT(name, level, location), UPDATE(location) ON TABLE employees, contra --- AST &ast.Grant{ - Grant: 0, Privilege: &ast.PrivilegeOnTable{ Privileges: []ast.TablePrivilege{ &ast.SelectPrivilege{ diff --git a/testdata/result/statement/grant_role.sql.txt b/testdata/result/statement/grant_role.sql.txt index b748b957..c5df7aff 100644 --- a/testdata/result/statement/grant_role.sql.txt +++ b/testdata/result/statement/grant_role.sql.txt @@ -3,7 +3,6 @@ GRANT ROLE pii_access, pii_writter TO ROLE hr_manager, hr_director --- AST &ast.Grant{ - Grant: 0, Privilege: &ast.RolePrivilege{ Role: 6, Names: []*ast.Ident{ diff --git a/testdata/result/statement/grant_select_on_view.sql.txt b/testdata/result/statement/grant_select_on_view.sql.txt index 0c96a499..dbab8e74 100644 --- a/testdata/result/statement/grant_select_on_view.sql.txt +++ b/testdata/result/statement/grant_select_on_view.sql.txt @@ -2,7 +2,6 @@ GRANT SELECT ON VIEW singernames TO ROLE hr_manager --- AST &ast.Grant{ - Grant: 0, Privilege: &ast.SelectPrivilegeOnView{ Select: 6, Names: []*ast.Ident{ diff --git a/testdata/result/statement/insert_into_values.sql.txt b/testdata/result/statement/insert_into_values.sql.txt index dc897ce3..670a2c4b 100644 --- a/testdata/result/statement/insert_into_values.sql.txt +++ b/testdata/result/statement/insert_into_values.sql.txt @@ -4,9 +4,7 @@ values (1, 2, 3), (4, 5, 6) --- AST &ast.Insert{ - Insert: 0, - InsertOrType: "", - TableName: &ast.Ident{ + TableName: &ast.Ident{ NamePos: 12, NameEnd: 15, Name: "foo", @@ -37,7 +35,6 @@ values (1, 2, 3), Exprs: []*ast.DefaultExpr{ &ast.DefaultExpr{ DefaultPos: -1, - Default: false, Expr: &ast.IntLiteral{ ValuePos: 40, ValueEnd: 41, @@ -47,7 +44,6 @@ values (1, 2, 3), }, &ast.DefaultExpr{ DefaultPos: -1, - Default: false, Expr: &ast.IntLiteral{ ValuePos: 43, ValueEnd: 44, @@ -57,7 +53,6 @@ values (1, 2, 3), }, &ast.DefaultExpr{ DefaultPos: -1, - Default: false, Expr: &ast.IntLiteral{ ValuePos: 46, ValueEnd: 47, @@ -73,7 +68,6 @@ values (1, 2, 3), Exprs: []*ast.DefaultExpr{ &ast.DefaultExpr{ DefaultPos: -1, - Default: false, Expr: &ast.IntLiteral{ ValuePos: 58, ValueEnd: 59, @@ -83,7 +77,6 @@ values (1, 2, 3), }, &ast.DefaultExpr{ DefaultPos: -1, - Default: false, Expr: &ast.IntLiteral{ ValuePos: 61, ValueEnd: 62, @@ -93,7 +86,6 @@ values (1, 2, 3), }, &ast.DefaultExpr{ DefaultPos: -1, - Default: false, Expr: &ast.IntLiteral{ ValuePos: 64, ValueEnd: 65, @@ -105,7 +97,6 @@ values (1, 2, 3), }, }, }, - ThenReturn: (*ast.ThenReturn)(nil), } --- SQL diff --git a/testdata/result/statement/insert_or_ignore.sql.txt b/testdata/result/statement/insert_or_ignore.sql.txt index 9994ff8e..43d4b19e 100644 --- a/testdata/result/statement/insert_or_ignore.sql.txt +++ b/testdata/result/statement/insert_or_ignore.sql.txt @@ -3,7 +3,6 @@ INSERT OR IGNORE INTO foo (foo, bar) VALUES (1, 2) --- AST &ast.Insert{ - Insert: 0, InsertOrType: "IGNORE", TableName: &ast.Ident{ NamePos: 22, @@ -31,7 +30,6 @@ INSERT OR IGNORE INTO foo Exprs: []*ast.DefaultExpr{ &ast.DefaultExpr{ DefaultPos: -1, - Default: false, Expr: &ast.IntLiteral{ ValuePos: 45, ValueEnd: 46, @@ -41,7 +39,6 @@ INSERT OR IGNORE INTO foo }, &ast.DefaultExpr{ DefaultPos: -1, - Default: false, Expr: &ast.IntLiteral{ ValuePos: 48, ValueEnd: 49, @@ -53,7 +50,6 @@ INSERT OR IGNORE INTO foo }, }, }, - ThenReturn: (*ast.ThenReturn)(nil), } --- SQL diff --git a/testdata/result/statement/insert_or_update.sql.txt b/testdata/result/statement/insert_or_update.sql.txt index a87b61f8..4ecc3acc 100644 --- a/testdata/result/statement/insert_or_update.sql.txt +++ b/testdata/result/statement/insert_or_update.sql.txt @@ -3,7 +3,6 @@ INSERT OR UPDATE INTO foo (foo, bar) VALUES (1, 2) --- AST &ast.Insert{ - Insert: 0, InsertOrType: "UPDATE", TableName: &ast.Ident{ NamePos: 22, @@ -31,7 +30,6 @@ INSERT OR UPDATE INTO foo Exprs: []*ast.DefaultExpr{ &ast.DefaultExpr{ DefaultPos: -1, - Default: false, Expr: &ast.IntLiteral{ ValuePos: 45, ValueEnd: 46, @@ -41,7 +39,6 @@ INSERT OR UPDATE INTO foo }, &ast.DefaultExpr{ DefaultPos: -1, - Default: false, Expr: &ast.IntLiteral{ ValuePos: 48, ValueEnd: 49, @@ -53,7 +50,6 @@ INSERT OR UPDATE INTO foo }, }, }, - ThenReturn: (*ast.ThenReturn)(nil), } --- SQL diff --git a/testdata/result/statement/insert_or_update_then_return_with_action_as.sql.txt b/testdata/result/statement/insert_or_update_then_return_with_action_as.sql.txt index ab5e4a6d..665e0e2a 100644 --- a/testdata/result/statement/insert_or_update_then_return_with_action_as.sql.txt +++ b/testdata/result/statement/insert_or_update_then_return_with_action_as.sql.txt @@ -4,7 +4,6 @@ INSERT OR UPDATE INTO foo THEN RETURN WITH ACTION AS act * --- AST &ast.Insert{ - Insert: 0, InsertOrType: "UPDATE", TableName: &ast.Ident{ NamePos: 22, @@ -32,7 +31,6 @@ THEN RETURN WITH ACTION AS act * Exprs: []*ast.DefaultExpr{ &ast.DefaultExpr{ DefaultPos: -1, - Default: false, Expr: &ast.IntLiteral{ ValuePos: 45, ValueEnd: 46, @@ -42,7 +40,6 @@ THEN RETURN WITH ACTION AS act * }, &ast.DefaultExpr{ DefaultPos: -1, - Default: false, Expr: &ast.IntLiteral{ ValuePos: 48, ValueEnd: 49, diff --git a/testdata/result/statement/insert_select.sql.txt b/testdata/result/statement/insert_select.sql.txt index 5b3b5590..2b2e713b 100644 --- a/testdata/result/statement/insert_select.sql.txt +++ b/testdata/result/statement/insert_select.sql.txt @@ -3,9 +3,7 @@ insert foo (foo, bar) select * from unnest([(1, 2), (3, 4)]) --- AST &ast.Insert{ - Insert: 0, - InsertOrType: "", - TableName: &ast.Ident{ + TableName: &ast.Ident{ NamePos: 7, NameEnd: 10, Name: "foo", @@ -24,10 +22,8 @@ select * from unnest([(1, 2), (3, 4)]) }, Input: &ast.SubQueryInput{ Query: &ast.Select{ - Select: 22, - Distinct: false, - As: nil, - Results: []ast.SelectItem{ + Select: 22, + Results: []ast.SelectItem{ &ast.Star{ Star: 29, }, @@ -41,7 +37,6 @@ select * from unnest([(1, 2), (3, 4)]) Array: -1, Lbrack: 43, Rbrack: 58, - Type: nil, Values: []ast.Expr{ &ast.TupleStructLiteral{ Lparen: 44, @@ -81,20 +76,10 @@ select * from unnest([(1, 2), (3, 4)]) }, }, }, - Hint: (*ast.Hint)(nil), - As: (*ast.AsAlias)(nil), - WithOffset: (*ast.WithOffset)(nil), - Sample: (*ast.TableSample)(nil), }, }, - Where: (*ast.Where)(nil), - GroupBy: (*ast.GroupBy)(nil), - Having: (*ast.Having)(nil), - OrderBy: (*ast.OrderBy)(nil), - Limit: (*ast.Limit)(nil), }, }, - ThenReturn: (*ast.ThenReturn)(nil), } --- SQL diff --git a/testdata/result/statement/insert_values.sql.txt b/testdata/result/statement/insert_values.sql.txt index aae84cad..e791c60d 100644 --- a/testdata/result/statement/insert_values.sql.txt +++ b/testdata/result/statement/insert_values.sql.txt @@ -4,9 +4,7 @@ values (1, 2, 3), (4, 5, 6) --- AST &ast.Insert{ - Insert: 0, - InsertOrType: "", - TableName: &ast.Ident{ + TableName: &ast.Ident{ NamePos: 7, NameEnd: 10, Name: "foo", @@ -37,7 +35,6 @@ values (1, 2, 3), Exprs: []*ast.DefaultExpr{ &ast.DefaultExpr{ DefaultPos: -1, - Default: false, Expr: &ast.IntLiteral{ ValuePos: 35, ValueEnd: 36, @@ -47,7 +44,6 @@ values (1, 2, 3), }, &ast.DefaultExpr{ DefaultPos: -1, - Default: false, Expr: &ast.IntLiteral{ ValuePos: 38, ValueEnd: 39, @@ -57,7 +53,6 @@ values (1, 2, 3), }, &ast.DefaultExpr{ DefaultPos: -1, - Default: false, Expr: &ast.IntLiteral{ ValuePos: 41, ValueEnd: 42, @@ -73,7 +68,6 @@ values (1, 2, 3), Exprs: []*ast.DefaultExpr{ &ast.DefaultExpr{ DefaultPos: -1, - Default: false, Expr: &ast.IntLiteral{ ValuePos: 53, ValueEnd: 54, @@ -83,7 +77,6 @@ values (1, 2, 3), }, &ast.DefaultExpr{ DefaultPos: -1, - Default: false, Expr: &ast.IntLiteral{ ValuePos: 56, ValueEnd: 57, @@ -93,7 +86,6 @@ values (1, 2, 3), }, &ast.DefaultExpr{ DefaultPos: -1, - Default: false, Expr: &ast.IntLiteral{ ValuePos: 59, ValueEnd: 60, @@ -105,7 +97,6 @@ values (1, 2, 3), }, }, }, - ThenReturn: (*ast.ThenReturn)(nil), } --- SQL diff --git a/testdata/result/statement/insert_values_default.sql.txt b/testdata/result/statement/insert_values_default.sql.txt index 2b3b0083..b379cda6 100644 --- a/testdata/result/statement/insert_values_default.sql.txt +++ b/testdata/result/statement/insert_values_default.sql.txt @@ -3,9 +3,7 @@ insert foo (foo, bar) values (1, default) --- AST &ast.Insert{ - Insert: 0, - InsertOrType: "", - TableName: &ast.Ident{ + TableName: &ast.Ident{ NamePos: 7, NameEnd: 10, Name: "foo", @@ -31,7 +29,6 @@ values (1, default) Exprs: []*ast.DefaultExpr{ &ast.DefaultExpr{ DefaultPos: -1, - Default: false, Expr: &ast.IntLiteral{ ValuePos: 30, ValueEnd: 31, @@ -42,13 +39,11 @@ values (1, default) &ast.DefaultExpr{ DefaultPos: 33, Default: true, - Expr: nil, }, }, }, }, }, - ThenReturn: (*ast.ThenReturn)(nil), } --- SQL diff --git a/testdata/result/statement/insert_with_sequence_function.sql.txt b/testdata/result/statement/insert_with_sequence_function.sql.txt index c78a7cd4..0183ca51 100644 --- a/testdata/result/statement/insert_with_sequence_function.sql.txt +++ b/testdata/result/statement/insert_with_sequence_function.sql.txt @@ -3,9 +3,7 @@ INSERT INTO foo(bar) VALUES (GET_NEXT_SEQUENCE_VALUE(SEQUENCE my_sequence)) --- AST &ast.Insert{ - Insert: 0, - InsertOrType: "", - TableName: &ast.Ident{ + TableName: &ast.Ident{ NamePos: 12, NameEnd: 15, Name: "foo", @@ -26,7 +24,6 @@ INSERT INTO foo(bar) VALUES (GET_NEXT_SEQUENCE_VALUE(SEQUENCE my_sequence)) Exprs: []*ast.DefaultExpr{ &ast.DefaultExpr{ DefaultPos: -1, - Default: false, Expr: &ast.CallExpr{ Rparen: 73, Func: &ast.Ident{ @@ -34,8 +31,7 @@ INSERT INTO foo(bar) VALUES (GET_NEXT_SEQUENCE_VALUE(SEQUENCE my_sequence)) NameEnd: 52, Name: "GET_NEXT_SEQUENCE_VALUE", }, - Distinct: false, - Args: []ast.Arg{ + Args: []ast.Arg{ &ast.SequenceArg{ Sequence: 53, Expr: &ast.Ident{ @@ -45,16 +41,12 @@ INSERT INTO foo(bar) VALUES (GET_NEXT_SEQUENCE_VALUE(SEQUENCE my_sequence)) }, }, }, - NamedArgs: []*ast.NamedArg(nil), - NullHandling: nil, - Having: nil, }, }, }, }, }, }, - ThenReturn: (*ast.ThenReturn)(nil), } --- SQL diff --git a/testdata/result/statement/named_schema_create_table_backquoted.sql.txt b/testdata/result/statement/named_schema_create_table_backquoted.sql.txt index df3b75b8..f2c9bff6 100644 --- a/testdata/result/statement/named_schema_create_table_backquoted.sql.txt +++ b/testdata/result/statement/named_schema_create_table_backquoted.sql.txt @@ -2,10 +2,8 @@ CREATE TABLE `ORDER`.`ORDER`(PK INT64) PRIMARY KEY(PK) --- AST &ast.CreateTable{ - Create: 0, - Rparen: 53, - IfNotExists: false, - Name: &ast.Path{ + Rparen: 53, + Name: &ast.Path{ Idents: []*ast.Ident{ &ast.Ident{ NamePos: 13, @@ -31,15 +29,10 @@ CREATE TABLE `ORDER`.`ORDER`(PK INT64) PRIMARY KEY(PK) NamePos: 32, Name: "INT64", }, - NotNull: false, - DefaultExpr: (*ast.ColumnDefaultExpr)(nil), - GeneratedExpr: (*ast.GeneratedColumnExpr)(nil), - Hidden: -1, - Options: (*ast.Options)(nil), + Hidden: -1, }, }, - TableConstraints: []*ast.TableConstraint(nil), - PrimaryKeys: []*ast.IndexKey{ + PrimaryKeys: []*ast.IndexKey{ &ast.IndexKey{ DirPos: -1, Name: &ast.Ident{ @@ -47,12 +40,8 @@ CREATE TABLE `ORDER`.`ORDER`(PK INT64) PRIMARY KEY(PK) NameEnd: 53, Name: "PK", }, - Dir: "", }, }, - Synonyms: []*ast.Synonym(nil), - Cluster: (*ast.Cluster)(nil), - RowDeletionPolicy: (*ast.CreateRowDeletionPolicy)(nil), } --- SQL diff --git a/testdata/result/statement/named_schemas_alter_index.sql.txt b/testdata/result/statement/named_schemas_alter_index.sql.txt index 9d5151de..5fd00cd8 100644 --- a/testdata/result/statement/named_schemas_alter_index.sql.txt +++ b/testdata/result/statement/named_schemas_alter_index.sql.txt @@ -2,8 +2,7 @@ ALTER INDEX sch1.indexOnSingers ADD STORED COLUMN SingerInfo --- AST &ast.AlterIndex{ - Alter: 0, - Name: &ast.Path{ + Name: &ast.Path{ Idents: []*ast.Ident{ &ast.Ident{ NamePos: 12, diff --git a/testdata/result/statement/named_schemas_alter_sequence.sql.txt b/testdata/result/statement/named_schemas_alter_sequence.sql.txt index 5f90e6c4..35240b72 100644 --- a/testdata/result/statement/named_schemas_alter_sequence.sql.txt +++ b/testdata/result/statement/named_schemas_alter_sequence.sql.txt @@ -3,8 +3,7 @@ ALTER SEQUENCE sch1.sequence SET OPTIONS (skip_range_min=1, skip_range_max=1234567) --- AST &ast.AlterSequence{ - Alter: 0, - Name: &ast.Path{ + Name: &ast.Path{ Idents: []*ast.Ident{ &ast.Ident{ NamePos: 15, diff --git a/testdata/result/statement/named_schemas_alter_table_add_constraint.sql.txt b/testdata/result/statement/named_schemas_alter_table_add_constraint.sql.txt index 92b6c59f..c91c4229 100644 --- a/testdata/result/statement/named_schemas_alter_table_add_constraint.sql.txt +++ b/testdata/result/statement/named_schemas_alter_table_add_constraint.sql.txt @@ -3,8 +3,7 @@ ALTER TABLE sch1.ShoppingCarts ADD CONSTRAINT FKShoppingCartsCustomers FOREIGN K REFERENCES sch1.Customers(CustomerId, CustomerName) ON DELETE CASCADE --- AST &ast.AlterTable{ - Alter: 0, - Name: &ast.Path{ + Name: &ast.Path{ Idents: []*ast.Ident{ &ast.Ident{ NamePos: 12, diff --git a/testdata/result/statement/named_schemas_alter_table_drop_constraints.sql.txt b/testdata/result/statement/named_schemas_alter_table_drop_constraints.sql.txt index e76de6a7..83f44484 100644 --- a/testdata/result/statement/named_schemas_alter_table_drop_constraints.sql.txt +++ b/testdata/result/statement/named_schemas_alter_table_drop_constraints.sql.txt @@ -2,8 +2,7 @@ ALTER TABLE sch1.ShoppingCarts DROP CONSTRAINT FKShoppingCartsCustomers --- AST &ast.AlterTable{ - Alter: 0, - Name: &ast.Path{ + Name: &ast.Path{ Idents: []*ast.Ident{ &ast.Ident{ NamePos: 12, diff --git a/testdata/result/statement/named_schemas_create_index.sql.txt b/testdata/result/statement/named_schemas_create_index.sql.txt index 8ee2b3f1..46e400bb 100644 --- a/testdata/result/statement/named_schemas_create_index.sql.txt +++ b/testdata/result/statement/named_schemas_create_index.sql.txt @@ -2,12 +2,8 @@ CREATE INDEX sch1.indexOnSingers ON sch1.Singers(FirstName) --- AST &ast.CreateIndex{ - Create: 0, - Rparen: 58, - Unique: false, - NullFiltered: false, - IfNotExists: false, - Name: &ast.Path{ + Rparen: 58, + Name: &ast.Path{ Idents: []*ast.Ident{ &ast.Ident{ NamePos: 13, @@ -43,11 +39,8 @@ CREATE INDEX sch1.indexOnSingers ON sch1.Singers(FirstName) NameEnd: 58, Name: "FirstName", }, - Dir: "", }, }, - Storing: (*ast.Storing)(nil), - InterleaveIn: (*ast.InterleaveIn)(nil), } --- SQL diff --git a/testdata/result/statement/named_schemas_create_sequence.sql.txt b/testdata/result/statement/named_schemas_create_sequence.sql.txt index 3fbcbdb9..7749d978 100644 --- a/testdata/result/statement/named_schemas_create_sequence.sql.txt +++ b/testdata/result/statement/named_schemas_create_sequence.sql.txt @@ -4,8 +4,7 @@ CREATE SEQUENCE sch1.sequence OPTIONS ( ) --- AST &ast.CreateSequence{ - Create: 0, - Name: &ast.Path{ + Name: &ast.Path{ Idents: []*ast.Ident{ &ast.Ident{ NamePos: 16, @@ -19,8 +18,7 @@ CREATE SEQUENCE sch1.sequence OPTIONS ( }, }, }, - IfNotExists: false, - Options: &ast.Options{ + Options: &ast.Options{ Options: 30, Rparen: 82, Records: []*ast.OptionsDef{ diff --git a/testdata/result/statement/named_schemas_create_table.sql.txt b/testdata/result/statement/named_schemas_create_table.sql.txt index 9d038399..beb9447b 100644 --- a/testdata/result/statement/named_schemas_create_table.sql.txt +++ b/testdata/result/statement/named_schemas_create_table.sql.txt @@ -7,10 +7,8 @@ CREATE TABLE sch1.Singers ( ) PRIMARY KEY(SingerId) --- AST &ast.CreateTable{ - Create: 0, - Rparen: 161, - IfNotExists: false, - Name: &ast.Path{ + Rparen: 161, + Name: &ast.Path{ Idents: []*ast.Ident{ &ast.Ident{ NamePos: 13, @@ -36,11 +34,8 @@ CREATE TABLE sch1.Singers ( NamePos: 41, Name: "INT64", }, - NotNull: true, - DefaultExpr: (*ast.ColumnDefaultExpr)(nil), - GeneratedExpr: (*ast.GeneratedColumnExpr)(nil), - Hidden: -1, - Options: (*ast.Options)(nil), + NotNull: true, + Hidden: -1, }, &ast.ColumnDef{ Null: -1, @@ -53,7 +48,6 @@ CREATE TABLE sch1.Singers ( NamePos: 71, Rparen: 82, Name: "STRING", - Max: false, Size: &ast.IntLiteral{ ValuePos: 78, ValueEnd: 82, @@ -61,11 +55,7 @@ CREATE TABLE sch1.Singers ( Value: "1024", }, }, - NotNull: false, - DefaultExpr: (*ast.ColumnDefaultExpr)(nil), - GeneratedExpr: (*ast.GeneratedColumnExpr)(nil), - Hidden: -1, - Options: (*ast.Options)(nil), + Hidden: -1, }, &ast.ColumnDef{ Null: -1, @@ -78,7 +68,6 @@ CREATE TABLE sch1.Singers ( NamePos: 98, Rparen: 109, Name: "STRING", - Max: false, Size: &ast.IntLiteral{ ValuePos: 105, ValueEnd: 109, @@ -86,11 +75,7 @@ CREATE TABLE sch1.Singers ( Value: "1024", }, }, - NotNull: false, - DefaultExpr: (*ast.ColumnDefaultExpr)(nil), - GeneratedExpr: (*ast.GeneratedColumnExpr)(nil), - Hidden: -1, - Options: (*ast.Options)(nil), + Hidden: -1, }, &ast.ColumnDef{ Null: -1, @@ -104,17 +89,11 @@ CREATE TABLE sch1.Singers ( Rparen: 136, Name: "BYTES", Max: true, - Size: nil, }, - NotNull: false, - DefaultExpr: (*ast.ColumnDefaultExpr)(nil), - GeneratedExpr: (*ast.GeneratedColumnExpr)(nil), - Hidden: -1, - Options: (*ast.Options)(nil), + Hidden: -1, }, }, - TableConstraints: []*ast.TableConstraint(nil), - PrimaryKeys: []*ast.IndexKey{ + PrimaryKeys: []*ast.IndexKey{ &ast.IndexKey{ DirPos: -1, Name: &ast.Ident{ @@ -122,12 +101,8 @@ CREATE TABLE sch1.Singers ( NameEnd: 161, Name: "SingerId", }, - Dir: "", }, }, - Synonyms: []*ast.Synonym(nil), - Cluster: (*ast.Cluster)(nil), - RowDeletionPolicy: (*ast.CreateRowDeletionPolicy)(nil), } --- SQL diff --git a/testdata/result/statement/named_schemas_create_table_foreign_key.sql.txt b/testdata/result/statement/named_schemas_create_table_foreign_key.sql.txt index 47a97bb3..deb384e1 100644 --- a/testdata/result/statement/named_schemas_create_table_foreign_key.sql.txt +++ b/testdata/result/statement/named_schemas_create_table_foreign_key.sql.txt @@ -8,10 +8,8 @@ CREATE TABLE sch1.ShoppingCarts ( ) PRIMARY KEY(CartId) --- AST &ast.CreateTable{ - Create: 0, - Rparen: 296, - IfNotExists: false, - Name: &ast.Path{ + Rparen: 296, + Name: &ast.Path{ Idents: []*ast.Ident{ &ast.Ident{ NamePos: 13, @@ -37,11 +35,8 @@ CREATE TABLE sch1.ShoppingCarts ( NamePos: 43, Name: "INT64", }, - NotNull: true, - DefaultExpr: (*ast.ColumnDefaultExpr)(nil), - GeneratedExpr: (*ast.GeneratedColumnExpr)(nil), - Hidden: -1, - Options: (*ast.Options)(nil), + NotNull: true, + Hidden: -1, }, &ast.ColumnDef{ Null: 82, @@ -54,11 +49,8 @@ CREATE TABLE sch1.ShoppingCarts ( NamePos: 72, Name: "INT64", }, - NotNull: true, - DefaultExpr: (*ast.ColumnDefaultExpr)(nil), - GeneratedExpr: (*ast.GeneratedColumnExpr)(nil), - Hidden: -1, - Options: (*ast.Options)(nil), + NotNull: true, + Hidden: -1, }, &ast.ColumnDef{ Null: 119, @@ -72,13 +64,9 @@ CREATE TABLE sch1.ShoppingCarts ( Rparen: 113, Name: "STRING", Max: true, - Size: nil, }, - NotNull: true, - DefaultExpr: (*ast.ColumnDefaultExpr)(nil), - GeneratedExpr: (*ast.GeneratedColumnExpr)(nil), - Hidden: -1, - Options: (*ast.Options)(nil), + NotNull: true, + Hidden: -1, }, }, TableConstraints: []*ast.TableConstraint{ @@ -143,12 +131,8 @@ CREATE TABLE sch1.ShoppingCarts ( NameEnd: 296, Name: "CartId", }, - Dir: "", }, }, - Synonyms: []*ast.Synonym(nil), - Cluster: (*ast.Cluster)(nil), - RowDeletionPolicy: (*ast.CreateRowDeletionPolicy)(nil), } --- SQL diff --git a/testdata/result/statement/named_schemas_create_table_interleave.sql.txt b/testdata/result/statement/named_schemas_create_table_interleave.sql.txt index 2f909ecc..82983cde 100644 --- a/testdata/result/statement/named_schemas_create_table_interleave.sql.txt +++ b/testdata/result/statement/named_schemas_create_table_interleave.sql.txt @@ -7,10 +7,8 @@ CREATE TABLE sch1.Albums ( INTERLEAVE IN PARENT sch1.Singers ON DELETE CASCADE --- AST &ast.CreateTable{ - Create: 0, - Rparen: 137, - IfNotExists: false, - Name: &ast.Path{ + Rparen: 137, + Name: &ast.Path{ Idents: []*ast.Ident{ &ast.Ident{ NamePos: 13, @@ -36,11 +34,8 @@ CREATE TABLE sch1.Albums ( NamePos: 38, Name: "INT64", }, - NotNull: true, - DefaultExpr: (*ast.ColumnDefaultExpr)(nil), - GeneratedExpr: (*ast.GeneratedColumnExpr)(nil), - Hidden: -1, - Options: (*ast.Options)(nil), + NotNull: true, + Hidden: -1, }, &ast.ColumnDef{ Null: 74, @@ -53,11 +48,8 @@ CREATE TABLE sch1.Albums ( NamePos: 64, Name: "INT64", }, - NotNull: true, - DefaultExpr: (*ast.ColumnDefaultExpr)(nil), - GeneratedExpr: (*ast.GeneratedColumnExpr)(nil), - Hidden: -1, - Options: (*ast.Options)(nil), + NotNull: true, + Hidden: -1, }, &ast.ColumnDef{ Null: -1, @@ -71,17 +63,11 @@ CREATE TABLE sch1.Albums ( Rparen: 103, Name: "STRING", Max: true, - Size: nil, }, - NotNull: false, - DefaultExpr: (*ast.ColumnDefaultExpr)(nil), - GeneratedExpr: (*ast.GeneratedColumnExpr)(nil), - Hidden: -1, - Options: (*ast.Options)(nil), + Hidden: -1, }, }, - TableConstraints: []*ast.TableConstraint(nil), - PrimaryKeys: []*ast.IndexKey{ + PrimaryKeys: []*ast.IndexKey{ &ast.IndexKey{ DirPos: -1, Name: &ast.Ident{ @@ -89,7 +75,6 @@ CREATE TABLE sch1.Albums ( NameEnd: 128, Name: "SingerId", }, - Dir: "", }, &ast.IndexKey{ DirPos: -1, @@ -98,11 +83,9 @@ CREATE TABLE sch1.Albums ( NameEnd: 137, Name: "AlbumId", }, - Dir: "", }, }, - Synonyms: []*ast.Synonym(nil), - Cluster: &ast.Cluster{ + Cluster: &ast.Cluster{ Comma: 138, OnDeleteEnd: 193, TableName: &ast.Path{ @@ -121,7 +104,6 @@ CREATE TABLE sch1.Albums ( }, OnDelete: "ON DELETE CASCADE", }, - RowDeletionPolicy: (*ast.CreateRowDeletionPolicy)(nil), } --- SQL diff --git a/testdata/result/statement/named_schemas_create_view.sql.txt b/testdata/result/statement/named_schemas_create_view.sql.txt index 19615943..bda5fae5 100644 --- a/testdata/result/statement/named_schemas_create_view.sql.txt +++ b/testdata/result/statement/named_schemas_create_view.sql.txt @@ -4,8 +4,7 @@ AS Select s.FirstName, s.LastName, s.SingerInfo FROM sch1.Singers AS s WHERE s.SingerId = 123456 --- AST &ast.CreateView{ - Create: 0, - Name: &ast.Path{ + Name: &ast.Path{ Idents: []*ast.Ident{ &ast.Ident{ NamePos: 12, @@ -19,13 +18,10 @@ AS Select s.FirstName, s.LastName, s.SingerInfo }, }, }, - OrReplace: false, SecurityType: "INVOKER", Query: &ast.Select{ - Select: 52, - Distinct: false, - As: nil, - Results: []ast.SelectItem{ + Select: 52, + Results: []ast.SelectItem{ &ast.ExprSelectItem{ Expr: &ast.Path{ Idents: []*ast.Ident{ @@ -92,8 +88,7 @@ AS Select s.FirstName, s.LastName, s.SingerInfo }, }, }, - Hint: (*ast.Hint)(nil), - As: &ast.AsAlias{ + As: &ast.AsAlias{ As: 118, Alias: &ast.Ident{ NamePos: 121, @@ -101,8 +96,6 @@ AS Select s.FirstName, s.LastName, s.SingerInfo Name: "s", }, }, - WithOffset: (*ast.WithOffset)(nil), - Sample: (*ast.TableSample)(nil), }, }, Where: &ast.Where{ @@ -131,10 +124,6 @@ AS Select s.FirstName, s.LastName, s.SingerInfo }, }, }, - GroupBy: (*ast.GroupBy)(nil), - Having: (*ast.Having)(nil), - OrderBy: (*ast.OrderBy)(nil), - Limit: (*ast.Limit)(nil), }, } diff --git a/testdata/result/statement/named_schemas_drop_index.sql.txt b/testdata/result/statement/named_schemas_drop_index.sql.txt index e39e22d3..a5ac72df 100644 --- a/testdata/result/statement/named_schemas_drop_index.sql.txt +++ b/testdata/result/statement/named_schemas_drop_index.sql.txt @@ -2,9 +2,7 @@ DROP INDEX sch1.indexOnSingers --- AST &ast.DropIndex{ - Drop: 0, - IfExists: false, - Name: &ast.Path{ + Name: &ast.Path{ Idents: []*ast.Ident{ &ast.Ident{ NamePos: 11, diff --git a/testdata/result/statement/named_schemas_drop_sequence.sql.txt b/testdata/result/statement/named_schemas_drop_sequence.sql.txt index 1714e94e..7252d218 100644 --- a/testdata/result/statement/named_schemas_drop_sequence.sql.txt +++ b/testdata/result/statement/named_schemas_drop_sequence.sql.txt @@ -2,9 +2,7 @@ DROP SEQUENCE sch1.sequence --- AST &ast.DropSequence{ - Drop: 0, - IfExists: false, - Name: &ast.Path{ + Name: &ast.Path{ Idents: []*ast.Ident{ &ast.Ident{ NamePos: 14, diff --git a/testdata/result/statement/named_schemas_drop_table.sql.txt b/testdata/result/statement/named_schemas_drop_table.sql.txt index f4a3fc70..f68cc7ba 100644 --- a/testdata/result/statement/named_schemas_drop_table.sql.txt +++ b/testdata/result/statement/named_schemas_drop_table.sql.txt @@ -2,9 +2,7 @@ DROP TABLE sch1.ShoppingCarts --- AST &ast.DropTable{ - Drop: 0, - IfExists: false, - Name: &ast.Path{ + Name: &ast.Path{ Idents: []*ast.Ident{ &ast.Ident{ NamePos: 11, diff --git a/testdata/result/statement/named_schemas_drop_view.sql.txt b/testdata/result/statement/named_schemas_drop_view.sql.txt index 0431f46a..6a963dbe 100644 --- a/testdata/result/statement/named_schemas_drop_view.sql.txt +++ b/testdata/result/statement/named_schemas_drop_view.sql.txt @@ -2,7 +2,6 @@ DROP VIEW sch1.SingerView --- AST &ast.DropView{ - Drop: 0, Name: &ast.Path{ Idents: []*ast.Ident{ &ast.Ident{ diff --git a/testdata/result/statement/rename_table_multiple.sql.txt b/testdata/result/statement/rename_table_multiple.sql.txt index e075f639..735954fc 100644 --- a/testdata/result/statement/rename_table_multiple.sql.txt +++ b/testdata/result/statement/rename_table_multiple.sql.txt @@ -2,8 +2,7 @@ RENAME TABLE Singers TO Artists, Albums TO Recordings --- AST &ast.RenameTable{ - Rename: 0, - Tos: []*ast.RenameTableTo{ + Tos: []*ast.RenameTableTo{ &ast.RenameTableTo{ Old: &ast.Ident{ NamePos: 13, diff --git a/testdata/result/statement/rename_table_single.sql.txt b/testdata/result/statement/rename_table_single.sql.txt index a6358055..7390f014 100644 --- a/testdata/result/statement/rename_table_single.sql.txt +++ b/testdata/result/statement/rename_table_single.sql.txt @@ -2,8 +2,7 @@ RENAME TABLE Singers TO Artists --- AST &ast.RenameTable{ - Rename: 0, - Tos: []*ast.RenameTableTo{ + Tos: []*ast.RenameTableTo{ &ast.RenameTableTo{ Old: &ast.Ident{ NamePos: 13, diff --git a/testdata/result/statement/revoke_change_stream_privilege.sql.txt b/testdata/result/statement/revoke_change_stream_privilege.sql.txt index b3f9b42c..59695a63 100644 --- a/testdata/result/statement/revoke_change_stream_privilege.sql.txt +++ b/testdata/result/statement/revoke_change_stream_privilege.sql.txt @@ -2,7 +2,6 @@ REVOKE SELECT ON CHANGE STREAM cs_name_one, cs_name_two FROM ROLE hr_manager --- AST &ast.Revoke{ - Revoke: 0, Privilege: &ast.SelectPrivilegeOnChangeStream{ Select: 7, Names: []*ast.Ident{ diff --git a/testdata/result/statement/revoke_execute_on_table_function.sql.txt b/testdata/result/statement/revoke_execute_on_table_function.sql.txt index 4dd6b857..b7695b39 100644 --- a/testdata/result/statement/revoke_execute_on_table_function.sql.txt +++ b/testdata/result/statement/revoke_execute_on_table_function.sql.txt @@ -2,7 +2,6 @@ REVOKE EXECUTE ON TABLE FUNCTION READ_SingersNameStream FROM ROLE hr_manager --- AST &ast.Revoke{ - Revoke: 0, Privilege: &ast.ExecutePrivilegeOnTableFunction{ Execute: 7, Names: []*ast.Ident{ diff --git a/testdata/result/statement/revoke_privileges.sql.txt b/testdata/result/statement/revoke_privileges.sql.txt index 1d0f03bf..700fab92 100644 --- a/testdata/result/statement/revoke_privileges.sql.txt +++ b/testdata/result/statement/revoke_privileges.sql.txt @@ -3,7 +3,6 @@ REVOKE SELECT(name, level, location), UPDATE(location) ON TABLE employees, contr --- AST &ast.Revoke{ - Revoke: 0, Privilege: &ast.PrivilegeOnTable{ Privileges: []ast.TablePrivilege{ &ast.SelectPrivilege{ diff --git a/testdata/result/statement/revoke_role.sql.txt b/testdata/result/statement/revoke_role.sql.txt index e9424539..532ada8b 100644 --- a/testdata/result/statement/revoke_role.sql.txt +++ b/testdata/result/statement/revoke_role.sql.txt @@ -3,7 +3,6 @@ REVOKE ROLE pii_access, pii_writter FROM ROLE hr_manager, hr_director --- AST &ast.Revoke{ - Revoke: 0, Privilege: &ast.RolePrivilege{ Role: 7, Names: []*ast.Ident{ diff --git a/testdata/result/statement/revoke_select_on_view.sql.txt b/testdata/result/statement/revoke_select_on_view.sql.txt index ecf3c1dd..4f45d474 100644 --- a/testdata/result/statement/revoke_select_on_view.sql.txt +++ b/testdata/result/statement/revoke_select_on_view.sql.txt @@ -2,7 +2,6 @@ REVOKE SELECT ON VIEW singernames FROM ROLE hr_manager --- AST &ast.Revoke{ - Revoke: 0, Privilege: &ast.SelectPrivilegeOnView{ Select: 7, Names: []*ast.Ident{ diff --git a/testdata/result/statement/select_album_with_index_directive.sql.txt b/testdata/result/statement/select_album_with_index_directive.sql.txt index d919f75e..9e4e6986 100644 --- a/testdata/result/statement/select_album_with_index_directive.sql.txt +++ b/testdata/result/statement/select_album_with_index_directive.sql.txt @@ -5,13 +5,8 @@ WHERE AlbumTitle >= @startTitle AND AlbumTitle < @endTitle --- AST &ast.QueryStatement{ - Hint: (*ast.Hint)(nil), - With: (*ast.With)(nil), Query: &ast.Select{ - Select: 0, - Distinct: false, - As: nil, - Results: []ast.SelectItem{ + Results: []ast.SelectItem{ &ast.ExprSelectItem{ Expr: &ast.Ident{ NamePos: 7, @@ -60,8 +55,6 @@ WHERE AlbumTitle >= @startTitle AND AlbumTitle < @endTitle }, }, }, - As: (*ast.AsAlias)(nil), - Sample: (*ast.TableSample)(nil), }, }, Where: &ast.Where{ @@ -94,10 +87,6 @@ WHERE AlbumTitle >= @startTitle AND AlbumTitle < @endTitle }, }, }, - GroupBy: (*ast.GroupBy)(nil), - Having: (*ast.Having)(nil), - OrderBy: (*ast.OrderBy)(nil), - Limit: (*ast.Limit)(nil), }, } diff --git a/testdata/result/statement/select_alias_without_as.sql.txt b/testdata/result/statement/select_alias_without_as.sql.txt index c4604a96..2c446b42 100644 --- a/testdata/result/statement/select_alias_without_as.sql.txt +++ b/testdata/result/statement/select_alias_without_as.sql.txt @@ -3,13 +3,8 @@ select 1 A --- AST &ast.QueryStatement{ - Hint: (*ast.Hint)(nil), - With: (*ast.With)(nil), Query: &ast.Select{ - Select: 0, - Distinct: false, - As: nil, - Results: []ast.SelectItem{ + Results: []ast.SelectItem{ &ast.Alias{ Expr: &ast.IntLiteral{ ValuePos: 7, @@ -27,12 +22,6 @@ select 1 A }, }, }, - From: (*ast.From)(nil), - Where: (*ast.Where)(nil), - GroupBy: (*ast.GroupBy)(nil), - Having: (*ast.Having)(nil), - OrderBy: (*ast.OrderBy)(nil), - Limit: (*ast.Limit)(nil), }, } diff --git a/testdata/result/statement/select_array_with_struct.sql.txt b/testdata/result/statement/select_array_with_struct.sql.txt index 32f645d4..752145e7 100644 --- a/testdata/result/statement/select_array_with_struct.sql.txt +++ b/testdata/result/statement/select_array_with_struct.sql.txt @@ -6,13 +6,8 @@ FROM --- AST &ast.QueryStatement{ - Hint: (*ast.Hint)(nil), - With: (*ast.With)(nil), Query: &ast.Select{ - Select: 0, - Distinct: false, - As: nil, - Results: []ast.SelectItem{ + Results: []ast.SelectItem{ &ast.Star{ Star: 9, }, @@ -91,17 +86,8 @@ FROM }, }, }, - Hint: (*ast.Hint)(nil), - As: (*ast.AsAlias)(nil), - WithOffset: (*ast.WithOffset)(nil), - Sample: (*ast.TableSample)(nil), }, }, - Where: (*ast.Where)(nil), - GroupBy: (*ast.GroupBy)(nil), - Having: (*ast.Having)(nil), - OrderBy: (*ast.OrderBy)(nil), - Limit: (*ast.Limit)(nil), }, } diff --git a/testdata/result/statement/select_call_with_named_expr.sql.txt b/testdata/result/statement/select_call_with_named_expr.sql.txt index bae8b868..11f82c13 100644 --- a/testdata/result/statement/select_call_with_named_expr.sql.txt +++ b/testdata/result/statement/select_call_with_named_expr.sql.txt @@ -4,13 +4,8 @@ FROM Albums a WHERE a.SingerId = 1 AND SEARCH(a.DescriptionTokens, 'classic albums', enhance_query => TRUE) --- AST &ast.QueryStatement{ - Hint: (*ast.Hint)(nil), - With: (*ast.With)(nil), Query: &ast.Select{ - Select: 0, - Distinct: false, - As: nil, - Results: []ast.SelectItem{ + Results: []ast.SelectItem{ &ast.ExprSelectItem{ Expr: &ast.Path{ Idents: []*ast.Ident{ @@ -52,8 +47,7 @@ WHERE a.SingerId = 1 AND SEARCH(a.DescriptionTokens, 'classic albums', enhance_q NameEnd: 43, Name: "Albums", }, - Hint: (*ast.Hint)(nil), - As: &ast.AsAlias{ + As: &ast.AsAlias{ As: -1, Alias: &ast.Ident{ NamePos: 44, @@ -61,7 +55,6 @@ WHERE a.SingerId = 1 AND SEARCH(a.DescriptionTokens, 'classic albums', enhance_q Name: "a", }, }, - Sample: (*ast.TableSample)(nil), }, }, Where: &ast.Where{ @@ -98,8 +91,7 @@ WHERE a.SingerId = 1 AND SEARCH(a.DescriptionTokens, 'classic albums', enhance_q NameEnd: 77, Name: "SEARCH", }, - Distinct: false, - Args: []ast.Arg{ + Args: []ast.Arg{ &ast.ExprArg{ Expr: &ast.Path{ Idents: []*ast.Ident{ @@ -137,15 +129,9 @@ WHERE a.SingerId = 1 AND SEARCH(a.DescriptionTokens, 'classic albums', enhance_q }, }, }, - NullHandling: nil, - Having: nil, }, }, }, - GroupBy: (*ast.GroupBy)(nil), - Having: (*ast.Having)(nil), - OrderBy: (*ast.OrderBy)(nil), - Limit: (*ast.Limit)(nil), }, } diff --git a/testdata/result/statement/select_cast.sql.txt b/testdata/result/statement/select_cast.sql.txt index 84154e99..24f5a754 100644 --- a/testdata/result/statement/select_cast.sql.txt +++ b/testdata/result/statement/select_cast.sql.txt @@ -7,18 +7,12 @@ limit cast(1 as INT64) offset cast(@foo as INT64) --- AST &ast.QueryStatement{ - Hint: (*ast.Hint)(nil), - With: (*ast.With)(nil), Query: &ast.Select{ - Select: 0, - Distinct: false, - As: nil, - Results: []ast.SelectItem{ + Results: []ast.SelectItem{ &ast.ExprSelectItem{ Expr: &ast.CastExpr{ Cast: 7, Rparen: 22, - Safe: false, Expr: &ast.IntLiteral{ ValuePos: 12, ValueEnd: 13, @@ -35,7 +29,6 @@ limit cast(1 as INT64) offset cast(@foo as INT64) Expr: &ast.CastExpr{ Cast: 25, Rparen: 44, - Safe: false, Expr: &ast.FloatLiteral{ ValuePos: 30, ValueEnd: 33, @@ -51,7 +44,6 @@ limit cast(1 as INT64) offset cast(@foo as INT64) Expr: &ast.CastExpr{ Cast: 47, Rparen: 147, - Safe: false, Expr: &ast.TupleStructLiteral{ Lparen: 52, Rparen: 84, @@ -59,7 +51,6 @@ limit cast(1 as INT64) offset cast(@foo as INT64) &ast.TypelessStructLiteral{ Struct: 53, Rparen: 60, - Values: []ast.TypelessStructLiteralArg(nil), }, &ast.IntLiteral{ ValuePos: 63, @@ -71,7 +62,6 @@ limit cast(1 as INT64) offset cast(@foo as INT64) Array: -1, Lbrack: 66, Rbrack: 71, - Type: nil, Values: []ast.Expr{ &ast.IntLiteral{ ValuePos: 67, @@ -91,7 +81,6 @@ limit cast(1 as INT64) offset cast(@foo as INT64) Array: -1, Lbrack: 74, Rbrack: 83, - Type: nil, Values: []ast.Expr{ &ast.StringLiteral{ ValuePos: 75, @@ -112,11 +101,9 @@ limit cast(1 as INT64) offset cast(@foo as INT64) Gt: 146, Fields: []*ast.StructField{ &ast.StructField{ - Ident: (*ast.Ident)(nil), - Type: &ast.StructType{ + Type: &ast.StructType{ Struct: 96, Gt: 103, - Fields: []*ast.StructField(nil), }, }, &ast.StructField{ @@ -168,21 +155,15 @@ limit cast(1 as INT64) offset cast(@foo as INT64) From: &ast.From{ From: 149, Source: &ast.Join{ - Op: ",", - Method: "", - Hint: (*ast.Hint)(nil), - Left: &ast.Join{ - Op: ",", - Method: "", - Hint: (*ast.Hint)(nil), - Left: &ast.TableName{ + Op: ",", + Left: &ast.Join{ + Op: ",", + Left: &ast.TableName{ Table: &ast.Ident{ NamePos: 154, NameEnd: 155, Name: "x", }, - Hint: (*ast.Hint)(nil), - As: (*ast.AsAlias)(nil), Sample: &ast.TableSample{ TableSample: 156, Method: "BERNOULLI", @@ -209,8 +190,6 @@ limit cast(1 as INT64) offset cast(@foo as INT64) NameEnd: 216, Name: "y", }, - Hint: (*ast.Hint)(nil), - As: (*ast.AsAlias)(nil), Sample: &ast.TableSample{ TableSample: 217, Method: "BERNOULLI", @@ -232,7 +211,6 @@ limit cast(1 as INT64) offset cast(@foo as INT64) }, }, }, - Cond: nil, }, Right: &ast.TableName{ Table: &ast.Ident{ @@ -240,8 +218,6 @@ limit cast(1 as INT64) offset cast(@foo as INT64) NameEnd: 270, Name: "z", }, - Hint: (*ast.Hint)(nil), - As: (*ast.AsAlias)(nil), Sample: &ast.TableSample{ TableSample: 271, Method: "BERNOULLI", @@ -261,14 +237,9 @@ limit cast(1 as INT64) offset cast(@foo as INT64) }, }, }, - Cond: nil, }, }, - Where: (*ast.Where)(nil), - GroupBy: (*ast.GroupBy)(nil), - Having: (*ast.Having)(nil), - OrderBy: (*ast.OrderBy)(nil), - Limit: &ast.Limit{ + Limit: &ast.Limit{ Limit: 322, Count: &ast.CastIntValue{ Cast: 328, diff --git a/testdata/result/statement/select_complex_with_array_path.sql.txt b/testdata/result/statement/select_complex_with_array_path.sql.txt index 2ce3e66a..cbfb49b5 100644 --- a/testdata/result/statement/select_complex_with_array_path.sql.txt +++ b/testdata/result/statement/select_complex_with_array_path.sql.txt @@ -7,13 +7,8 @@ FROM --- AST &ast.QueryStatement{ - Hint: (*ast.Hint)(nil), - With: (*ast.With)(nil), Query: &ast.Select{ - Select: 0, - Distinct: false, - As: nil, - Results: []ast.SelectItem{ + Results: []ast.SelectItem{ &ast.Star{ Star: 9, }, @@ -21,18 +16,13 @@ FROM From: &ast.From{ From: 11, Source: &ast.Join{ - Op: ",", - Method: "", - Hint: (*ast.Hint)(nil), - Left: &ast.TableName{ + Op: ",", + Left: &ast.TableName{ Table: &ast.Ident{ NamePos: 18, NameEnd: 30, Name: "ComplexTable", }, - Hint: (*ast.Hint)(nil), - As: (*ast.AsAlias)(nil), - Sample: (*ast.TableSample)(nil), }, Right: &ast.PathTableExpr{ Path: &ast.Path{ @@ -49,19 +39,9 @@ FROM }, }, }, - Hint: (*ast.Hint)(nil), - As: (*ast.AsAlias)(nil), - WithOffset: (*ast.WithOffset)(nil), - Sample: (*ast.TableSample)(nil), }, - Cond: nil, }, }, - Where: (*ast.Where)(nil), - GroupBy: (*ast.GroupBy)(nil), - Having: (*ast.Having)(nil), - OrderBy: (*ast.OrderBy)(nil), - Limit: (*ast.Limit)(nil), }, } diff --git a/testdata/result/statement/select_complex_with_unnest_array_path.sql.txt b/testdata/result/statement/select_complex_with_unnest_array_path.sql.txt index 200e7d61..5008c0b7 100644 --- a/testdata/result/statement/select_complex_with_unnest_array_path.sql.txt +++ b/testdata/result/statement/select_complex_with_unnest_array_path.sql.txt @@ -7,13 +7,8 @@ FROM --- AST &ast.QueryStatement{ - Hint: (*ast.Hint)(nil), - With: (*ast.With)(nil), Query: &ast.Select{ - Select: 0, - Distinct: false, - As: nil, - Results: []ast.SelectItem{ + Results: []ast.SelectItem{ &ast.Star{ Star: 9, }, @@ -21,18 +16,13 @@ FROM From: &ast.From{ From: 11, Source: &ast.Join{ - Op: ",", - Method: "", - Hint: (*ast.Hint)(nil), - Left: &ast.TableName{ + Op: ",", + Left: &ast.TableName{ Table: &ast.Ident{ NamePos: 18, NameEnd: 30, Name: "ComplexTable", }, - Hint: (*ast.Hint)(nil), - As: (*ast.AsAlias)(nil), - Sample: (*ast.TableSample)(nil), }, Right: &ast.Unnest{ Unnest: 34, @@ -51,19 +41,9 @@ FROM }, }, }, - Hint: (*ast.Hint)(nil), - As: (*ast.AsAlias)(nil), - WithOffset: (*ast.WithOffset)(nil), - Sample: (*ast.TableSample)(nil), }, - Cond: nil, }, }, - Where: (*ast.Where)(nil), - GroupBy: (*ast.GroupBy)(nil), - Having: (*ast.Having)(nil), - OrderBy: (*ast.OrderBy)(nil), - Limit: (*ast.Limit)(nil), }, } diff --git a/testdata/result/statement/select_count_asterisk.sql.txt b/testdata/result/statement/select_count_asterisk.sql.txt index 5dcbd0b7..92036b3d 100644 --- a/testdata/result/statement/select_count_asterisk.sql.txt +++ b/testdata/result/statement/select_count_asterisk.sql.txt @@ -3,13 +3,8 @@ select count(*) from singers --- AST &ast.QueryStatement{ - Hint: (*ast.Hint)(nil), - With: (*ast.With)(nil), Query: &ast.Select{ - Select: 0, - Distinct: false, - As: nil, - Results: []ast.SelectItem{ + Results: []ast.SelectItem{ &ast.ExprSelectItem{ Expr: &ast.CountStarExpr{ Count: 7, @@ -25,16 +20,8 @@ select count(*) from singers NameEnd: 28, Name: "singers", }, - Hint: (*ast.Hint)(nil), - As: (*ast.AsAlias)(nil), - Sample: (*ast.TableSample)(nil), }, }, - Where: (*ast.Where)(nil), - GroupBy: (*ast.GroupBy)(nil), - Having: (*ast.Having)(nil), - OrderBy: (*ast.OrderBy)(nil), - Limit: (*ast.Limit)(nil), }, } diff --git a/testdata/result/statement/select_count_distinct.sql.txt b/testdata/result/statement/select_count_distinct.sql.txt index 76755e4a..f32ac131 100644 --- a/testdata/result/statement/select_count_distinct.sql.txt +++ b/testdata/result/statement/select_count_distinct.sql.txt @@ -2,13 +2,8 @@ select count(distinct x) from foo --- AST &ast.QueryStatement{ - Hint: (*ast.Hint)(nil), - With: (*ast.With)(nil), Query: &ast.Select{ - Select: 0, - Distinct: false, - As: nil, - Results: []ast.SelectItem{ + Results: []ast.SelectItem{ &ast.ExprSelectItem{ Expr: &ast.CallExpr{ Rparen: 23, @@ -27,9 +22,6 @@ select count(distinct x) from foo }, }, }, - NamedArgs: []*ast.NamedArg(nil), - NullHandling: nil, - Having: nil, }, }, }, @@ -41,16 +33,8 @@ select count(distinct x) from foo NameEnd: 33, Name: "foo", }, - Hint: (*ast.Hint)(nil), - As: (*ast.AsAlias)(nil), - Sample: (*ast.TableSample)(nil), }, }, - Where: (*ast.Where)(nil), - GroupBy: (*ast.GroupBy)(nil), - Having: (*ast.Having)(nil), - OrderBy: (*ast.OrderBy)(nil), - Limit: (*ast.Limit)(nil), }, } diff --git a/testdata/result/statement/select_expr.sql.txt b/testdata/result/statement/select_expr.sql.txt index 21b2ce8d..9d6dad5a 100644 --- a/testdata/result/statement/select_expr.sql.txt +++ b/testdata/result/statement/select_expr.sql.txt @@ -31,13 +31,8 @@ select 1 + 2, 1 - 2, --- AST &ast.QueryStatement{ - Hint: (*ast.Hint)(nil), - With: (*ast.With)(nil), Query: &ast.Select{ - Select: 0, - Distinct: false, - As: nil, - Results: []ast.SelectItem{ + Results: []ast.SelectItem{ &ast.ExprSelectItem{ Expr: &ast.BinaryExpr{ Op: "+", @@ -328,10 +323,8 @@ select 1 + 2, 1 - 2, Lparen: 194, Rparen: 207, Query: &ast.Select{ - Select: 195, - Distinct: false, - As: nil, - Results: []ast.SelectItem{ + Select: 195, + Results: []ast.SelectItem{ &ast.Alias{ Expr: &ast.IntLiteral{ ValuePos: 202, @@ -349,12 +342,6 @@ select 1 + 2, 1 - 2, }, }, }, - From: (*ast.From)(nil), - Where: (*ast.Where)(nil), - GroupBy: (*ast.GroupBy)(nil), - Having: (*ast.Having)(nil), - OrderBy: (*ast.OrderBy)(nil), - Limit: (*ast.Limit)(nil), }, }, Ident: &ast.Ident{ @@ -385,7 +372,6 @@ select 1 + 2, 1 - 2, Array: -1, Lbrack: 240, Rbrack: 248, - Type: nil, Values: []ast.Expr{ &ast.IntLiteral{ ValuePos: 241, @@ -427,7 +413,6 @@ select 1 + 2, 1 - 2, Array: -1, Lbrack: 269, Rbrack: 277, - Type: nil, Values: []ast.Expr{ &ast.IntLiteral{ ValuePos: 270, @@ -469,7 +454,6 @@ select 1 + 2, 1 - 2, Array: -1, Lbrack: 300, Rbrack: 308, - Type: nil, Values: []ast.Expr{ &ast.IntLiteral{ ValuePos: 301, @@ -508,7 +492,6 @@ select 1 + 2, 1 - 2, Expr: &ast.CaseExpr{ Case: 330, EndPos: 403, - Expr: nil, Whens: []*ast.CaseWhen{ &ast.CaseWhen{ When: 342, @@ -602,8 +585,7 @@ select 1 + 2, 1 - 2, NameEnd: 522, Name: "date_add", }, - Distinct: false, - Args: []ast.Arg{ + Args: []ast.Arg{ &ast.ExprArg{ Expr: &ast.DateLiteral{ Date: 523, @@ -629,9 +611,6 @@ select 1 + 2, 1 - 2, }, }, }, - NamedArgs: []*ast.NamedArg(nil), - NullHandling: nil, - Having: nil, }, }, &ast.ExprSelectItem{ @@ -642,8 +621,7 @@ select 1 + 2, 1 - 2, NameEnd: 579, Name: "timestamp_add", }, - Distinct: false, - Args: []ast.Arg{ + Args: []ast.Arg{ &ast.ExprArg{ Expr: &ast.TimestampLiteral{ Timestamp: 580, @@ -669,14 +647,10 @@ select 1 + 2, 1 - 2, }, }, }, - NamedArgs: []*ast.NamedArg(nil), - NullHandling: nil, - Having: nil, }, }, &ast.ExprSelectItem{ Expr: &ast.InExpr{ - Not: false, Left: &ast.IntLiteral{ ValuePos: 638, ValueEnd: 639, @@ -711,7 +685,6 @@ select 1 + 2, 1 - 2, }, &ast.ExprSelectItem{ Expr: &ast.InExpr{ - Not: false, Left: &ast.IntLiteral{ ValuePos: 661, ValueEnd: 662, @@ -725,7 +698,6 @@ select 1 + 2, 1 - 2, Array: -1, Lbrack: 673, Rbrack: 681, - Type: nil, Values: []ast.Expr{ &ast.IntLiteral{ ValuePos: 674, @@ -752,7 +724,6 @@ select 1 + 2, 1 - 2, }, &ast.ExprSelectItem{ Expr: &ast.InExpr{ - Not: false, Left: &ast.IntLiteral{ ValuePos: 692, ValueEnd: 693, @@ -763,14 +734,11 @@ select 1 + 2, 1 - 2, Lparen: 697, Rparen: 744, Query: &ast.CompoundQuery{ - Op: "UNION", - Distinct: false, - Queries: []ast.QueryExpr{ + Op: "UNION", + Queries: []ast.QueryExpr{ &ast.Select{ - Select: 698, - Distinct: false, - As: nil, - Results: []ast.SelectItem{ + Select: 698, + Results: []ast.SelectItem{ &ast.ExprSelectItem{ Expr: &ast.IntLiteral{ ValuePos: 705, @@ -780,18 +748,10 @@ select 1 + 2, 1 - 2, }, }, }, - From: (*ast.From)(nil), - Where: (*ast.Where)(nil), - GroupBy: (*ast.GroupBy)(nil), - Having: (*ast.Having)(nil), - OrderBy: (*ast.OrderBy)(nil), - Limit: (*ast.Limit)(nil), }, &ast.Select{ - Select: 717, - Distinct: false, - As: nil, - Results: []ast.SelectItem{ + Select: 717, + Results: []ast.SelectItem{ &ast.ExprSelectItem{ Expr: &ast.IntLiteral{ ValuePos: 724, @@ -801,18 +761,10 @@ select 1 + 2, 1 - 2, }, }, }, - From: (*ast.From)(nil), - Where: (*ast.Where)(nil), - GroupBy: (*ast.GroupBy)(nil), - Having: (*ast.Having)(nil), - OrderBy: (*ast.OrderBy)(nil), - Limit: (*ast.Limit)(nil), }, &ast.Select{ - Select: 736, - Distinct: false, - As: nil, - Results: []ast.SelectItem{ + Select: 736, + Results: []ast.SelectItem{ &ast.ExprSelectItem{ Expr: &ast.IntLiteral{ ValuePos: 743, @@ -822,16 +774,8 @@ select 1 + 2, 1 - 2, }, }, }, - From: (*ast.From)(nil), - Where: (*ast.Where)(nil), - GroupBy: (*ast.GroupBy)(nil), - Having: (*ast.Having)(nil), - OrderBy: (*ast.OrderBy)(nil), - Limit: (*ast.Limit)(nil), }, }, - OrderBy: (*ast.OrderBy)(nil), - Limit: (*ast.Limit)(nil), }, }, }, @@ -843,7 +787,6 @@ select 1 + 2, 1 - 2, Array: -1, Lbrack: 754, Rbrack: 756, - Type: nil, Values: []ast.Expr{ &ast.IntLiteral{ ValuePos: 755, @@ -857,7 +800,6 @@ select 1 + 2, 1 - 2, Array: -1, Lbrack: 761, Rbrack: 763, - Type: nil, Values: []ast.Expr{ &ast.IntLiteral{ ValuePos: 762, @@ -920,12 +862,6 @@ select 1 + 2, 1 - 2, }, }, }, - From: (*ast.From)(nil), - Where: (*ast.Where)(nil), - GroupBy: (*ast.GroupBy)(nil), - Having: (*ast.Having)(nil), - OrderBy: (*ast.OrderBy)(nil), - Limit: (*ast.Limit)(nil), }, } diff --git a/testdata/result/statement/select_expr_extract.sql.txt b/testdata/result/statement/select_expr_extract.sql.txt index 3ecdd405..788ea52f 100644 --- a/testdata/result/statement/select_expr_extract.sql.txt +++ b/testdata/result/statement/select_expr_extract.sql.txt @@ -21,13 +21,8 @@ select --- AST &ast.QueryStatement{ - Hint: (*ast.Hint)(nil), - With: (*ast.With)(nil), Query: &ast.Select{ - Select: 0, - Distinct: false, - As: nil, - Results: []ast.SelectItem{ + Results: []ast.SelectItem{ &ast.ExprSelectItem{ Expr: &ast.ExtractExpr{ Extract: 11, @@ -45,7 +40,6 @@ select Value: "2019-09-01 08:11:23", }, }, - AtTimeZone: (*ast.AtTimeZone)(nil), }, }, &ast.ExprSelectItem{ @@ -65,7 +59,6 @@ select Value: "2019-09-01 08:11:23", }, }, - AtTimeZone: (*ast.AtTimeZone)(nil), }, }, &ast.ExprSelectItem{ @@ -85,7 +78,6 @@ select Value: "2019-09-01 08:11:23", }, }, - AtTimeZone: (*ast.AtTimeZone)(nil), }, }, &ast.ExprSelectItem{ @@ -105,7 +97,6 @@ select Value: "2019-09-01 08:11:23", }, }, - AtTimeZone: (*ast.AtTimeZone)(nil), }, }, &ast.ExprSelectItem{ @@ -125,7 +116,6 @@ select Value: "2019-09-01 08:11:23", }, }, - AtTimeZone: (*ast.AtTimeZone)(nil), }, }, &ast.ExprSelectItem{ @@ -145,7 +135,6 @@ select Value: "2019-09-01 08:11:23", }, }, - AtTimeZone: (*ast.AtTimeZone)(nil), }, }, &ast.ExprSelectItem{ @@ -165,7 +154,6 @@ select Value: "2019-09-01", }, }, - AtTimeZone: (*ast.AtTimeZone)(nil), }, }, &ast.ExprSelectItem{ @@ -185,7 +173,6 @@ select Value: "2019-09-01", }, }, - AtTimeZone: (*ast.AtTimeZone)(nil), }, }, &ast.ExprSelectItem{ @@ -205,7 +192,6 @@ select Value: "2019-09-01", }, }, - AtTimeZone: (*ast.AtTimeZone)(nil), }, }, &ast.ExprSelectItem{ @@ -225,7 +211,6 @@ select Value: "2019-09-01", }, }, - AtTimeZone: (*ast.AtTimeZone)(nil), }, }, &ast.ExprSelectItem{ @@ -245,7 +230,6 @@ select Value: "2019-09-01", }, }, - AtTimeZone: (*ast.AtTimeZone)(nil), }, }, &ast.ExprSelectItem{ @@ -265,7 +249,6 @@ select Value: "2019-09-01", }, }, - AtTimeZone: (*ast.AtTimeZone)(nil), }, }, &ast.ExprSelectItem{ @@ -285,7 +268,6 @@ select Value: "2019-09-01", }, }, - AtTimeZone: (*ast.AtTimeZone)(nil), }, }, &ast.ExprSelectItem{ @@ -305,7 +287,6 @@ select Value: "2019-09-01", }, }, - AtTimeZone: (*ast.AtTimeZone)(nil), }, }, &ast.ExprSelectItem{ @@ -325,7 +306,6 @@ select Value: "2019-09-01", }, }, - AtTimeZone: (*ast.AtTimeZone)(nil), }, }, &ast.ExprSelectItem{ @@ -345,7 +325,6 @@ select Value: "2019-09-01", }, }, - AtTimeZone: (*ast.AtTimeZone)(nil), }, }, &ast.ExprSelectItem{ @@ -365,7 +344,6 @@ select Value: "2019-09-01 08:11:23", }, }, - AtTimeZone: (*ast.AtTimeZone)(nil), }, }, &ast.ExprSelectItem{ @@ -396,12 +374,6 @@ select }, }, }, - From: (*ast.From)(nil), - Where: (*ast.Where)(nil), - GroupBy: (*ast.GroupBy)(nil), - Having: (*ast.Having)(nil), - OrderBy: (*ast.OrderBy)(nil), - Limit: (*ast.Limit)(nil), }, } diff --git a/testdata/result/statement/select_from_implicit_unnest.sql.txt b/testdata/result/statement/select_from_implicit_unnest.sql.txt index f1d12b88..06a9e39a 100644 --- a/testdata/result/statement/select_from_implicit_unnest.sql.txt +++ b/testdata/result/statement/select_from_implicit_unnest.sql.txt @@ -4,13 +4,8 @@ FROM UNNEST([STRUCT>(["foo"])]) AS t, t.arr AS a WITH OFFSET AS off --- AST &ast.QueryStatement{ - Hint: (*ast.Hint)(nil), - With: (*ast.With)(nil), Query: &ast.Select{ - Select: 0, - Distinct: false, - As: nil, - Results: []ast.SelectItem{ + Results: []ast.SelectItem{ &ast.ExprSelectItem{ Expr: &ast.Ident{ NamePos: 7, @@ -29,17 +24,14 @@ FROM UNNEST([STRUCT>(["foo"])]) AS t, From: &ast.From{ From: 14, Source: &ast.Join{ - Op: ",", - Method: "", - Hint: (*ast.Hint)(nil), - Left: &ast.Unnest{ + Op: ",", + Left: &ast.Unnest{ Unnest: 19, Rparen: 62, Expr: &ast.ArrayLiteral{ Array: -1, Lbrack: 26, Rbrack: 61, - Type: nil, Values: []ast.Expr{ &ast.TypedStructLiteral{ Struct: 27, @@ -66,7 +58,6 @@ FROM UNNEST([STRUCT>(["foo"])]) AS t, Array: -1, Lbrack: 53, Rbrack: 59, - Type: nil, Values: []ast.Expr{ &ast.StringLiteral{ ValuePos: 54, @@ -79,8 +70,7 @@ FROM UNNEST([STRUCT>(["foo"])]) AS t, }, }, }, - Hint: (*ast.Hint)(nil), - As: &ast.AsAlias{ + As: &ast.AsAlias{ As: 64, Alias: &ast.Ident{ NamePos: 67, @@ -88,8 +78,6 @@ FROM UNNEST([STRUCT>(["foo"])]) AS t, Name: "t", }, }, - WithOffset: (*ast.WithOffset)(nil), - Sample: (*ast.TableSample)(nil), }, Right: &ast.PathTableExpr{ Path: &ast.Path{ @@ -106,8 +94,7 @@ FROM UNNEST([STRUCT>(["foo"])]) AS t, }, }, }, - Hint: (*ast.Hint)(nil), - As: &ast.AsAlias{ + As: &ast.AsAlias{ As: 81, Alias: &ast.Ident{ NamePos: 84, @@ -127,16 +114,9 @@ FROM UNNEST([STRUCT>(["foo"])]) AS t, }, }, }, - Sample: (*ast.TableSample)(nil), }, - Cond: nil, }, }, - Where: (*ast.Where)(nil), - GroupBy: (*ast.GroupBy)(nil), - Having: (*ast.Having)(nil), - OrderBy: (*ast.OrderBy)(nil), - Limit: (*ast.Limit)(nil), }, } diff --git a/testdata/result/statement/select_from_path.sql.txt b/testdata/result/statement/select_from_path.sql.txt index d58a1d70..d2ce6e21 100644 --- a/testdata/result/statement/select_from_path.sql.txt +++ b/testdata/result/statement/select_from_path.sql.txt @@ -5,13 +5,8 @@ FROM INFORMATION_SCHEMA.TABLES AS t TABLESAMPLE RESERVOIR (10 ROWS) --- AST &ast.QueryStatement{ - Hint: (*ast.Hint)(nil), - With: (*ast.With)(nil), Query: &ast.Select{ - Select: 0, - Distinct: false, - As: nil, - Results: []ast.SelectItem{ + Results: []ast.SelectItem{ &ast.Star{ Star: 9, }, @@ -33,8 +28,7 @@ FROM }, }, }, - Hint: (*ast.Hint)(nil), - As: &ast.AsAlias{ + As: &ast.AsAlias{ As: 44, Alias: &ast.Ident{ NamePos: 47, @@ -42,8 +36,7 @@ FROM Name: "t", }, }, - WithOffset: (*ast.WithOffset)(nil), - Sample: &ast.TableSample{ + Sample: &ast.TableSample{ TableSample: 49, Method: "RESERVOIR", Size: &ast.TableSampleSize{ @@ -60,11 +53,6 @@ FROM }, }, }, - Where: (*ast.Where)(nil), - GroupBy: (*ast.GroupBy)(nil), - Having: (*ast.Having)(nil), - OrderBy: (*ast.OrderBy)(nil), - Limit: (*ast.Limit)(nil), }, } diff --git a/testdata/result/statement/select_hint.sql.txt b/testdata/result/statement/select_hint.sql.txt index de37c85f..374f27f1 100644 --- a/testdata/result/statement/select_hint.sql.txt +++ b/testdata/result/statement/select_hint.sql.txt @@ -3,7 +3,6 @@ --- AST &ast.QueryStatement{ Hint: &ast.Hint{ - Atmark: 0, Rbrace: 22, Records: []*ast.HintRecord{ &ast.HintRecord{ @@ -34,12 +33,9 @@ }, }, }, - With: (*ast.With)(nil), Query: &ast.Select{ - Select: 24, - Distinct: false, - As: nil, - Results: []ast.SelectItem{ + Select: 24, + Results: []ast.SelectItem{ &ast.ExprSelectItem{ Expr: &ast.Ident{ NamePos: 31, @@ -48,12 +44,6 @@ }, }, }, - From: (*ast.From)(nil), - Where: (*ast.Where)(nil), - GroupBy: (*ast.GroupBy)(nil), - Having: (*ast.Having)(nil), - OrderBy: (*ast.OrderBy)(nil), - Limit: (*ast.Limit)(nil), }, } diff --git a/testdata/result/statement/select_literals_all.sql.txt b/testdata/result/statement/select_literals_all.sql.txt index 17137993..da902945 100644 --- a/testdata/result/statement/select_literals_all.sql.txt +++ b/testdata/result/statement/select_literals_all.sql.txt @@ -49,13 +49,8 @@ lines''', true, false --- AST &ast.QueryStatement{ - Hint: (*ast.Hint)(nil), - With: (*ast.With)(nil), Query: &ast.Select{ - Select: 0, - Distinct: false, - As: nil, - Results: []ast.SelectItem{ + Results: []ast.SelectItem{ &ast.ExprSelectItem{ Expr: &ast.StringLiteral{ ValuePos: 9, @@ -152,7 +147,7 @@ lines''', ValuePos: 204, ValueEnd: 210, Value: []uint8{ - 0x61, 0x62, 0x63, + 97, 98, 99, }, }, }, @@ -161,7 +156,7 @@ lines''', ValuePos: 214, ValueEnd: 224, Value: []uint8{ - 0x61, 0x62, 0x63, + 97, 98, 99, }, }, }, @@ -170,7 +165,7 @@ lines''', ValuePos: 228, ValueEnd: 238, Value: []uint8{ - 0x61, 0x62, 0x63, + 97, 98, 99, }, }, }, @@ -179,7 +174,7 @@ lines''', ValuePos: 242, ValueEnd: 250, Value: []uint8{ - 0x61, 0x62, 0x63, 0x2b, + 97, 98, 99, 43, }, }, }, @@ -188,7 +183,7 @@ lines''', ValuePos: 254, ValueEnd: 262, Value: []uint8{ - 0x61, 0x62, 0x63, 0x2b, + 97, 98, 99, 43, }, }, }, @@ -197,7 +192,7 @@ lines''', ValuePos: 266, ValueEnd: 277, Value: []uint8{ - 0x61, 0x62, 0x63, + 97, 98, 99, }, }, }, @@ -266,7 +261,6 @@ lines''', Array: -1, Lbrack: 352, Rbrack: 360, - Type: nil, Values: []ast.Expr{ &ast.IntLiteral{ ValuePos: 353, @@ -294,7 +288,6 @@ lines''', Array: -1, Lbrack: 365, Rbrack: 380, - Type: nil, Values: []ast.Expr{ &ast.StringLiteral{ ValuePos: 366, @@ -319,7 +312,6 @@ lines''', Array: 385, Lbrack: 390, Rbrack: 398, - Type: nil, Values: []ast.Expr{ &ast.IntLiteral{ ValuePos: 391, @@ -379,7 +371,6 @@ lines''', NamePos: 442, Name: "INT64", }, - Values: []ast.Expr(nil), }, }, &ast.ExprSelectItem{ @@ -387,10 +378,8 @@ lines''', Array: 454, Rparen: 482, Query: &ast.Select{ - Select: 460, - Distinct: false, - As: nil, - Results: []ast.SelectItem{ + Select: 460, + Results: []ast.SelectItem{ &ast.ExprSelectItem{ Expr: &ast.TypelessStructLiteral{ Struct: 467, @@ -424,12 +413,6 @@ lines''', }, }, }, - From: (*ast.From)(nil), - Where: (*ast.Where)(nil), - GroupBy: (*ast.GroupBy)(nil), - Having: (*ast.Having)(nil), - OrderBy: (*ast.OrderBy)(nil), - Limit: (*ast.Limit)(nil), }, }, }, @@ -438,10 +421,8 @@ lines''', Array: 487, Rparen: 509, Query: &ast.Select{ - Select: 493, - Distinct: false, - As: nil, - Results: []ast.SelectItem{ + Select: 493, + Results: []ast.SelectItem{ &ast.ExprSelectItem{ Expr: &ast.TupleStructLiteral{ Lparen: 500, @@ -469,12 +450,6 @@ lines''', }, }, }, - From: (*ast.From)(nil), - Where: (*ast.Where)(nil), - GroupBy: (*ast.GroupBy)(nil), - Having: (*ast.Having)(nil), - OrderBy: (*ast.OrderBy)(nil), - Limit: (*ast.Limit)(nil), }, }, }, @@ -496,8 +471,7 @@ lines''', NameEnd: 539, Name: "DATE", }, - Distinct: false, - Args: []ast.Arg{ + Args: []ast.Arg{ &ast.ExprArg{ Expr: &ast.StringLiteral{ ValuePos: 540, @@ -506,9 +480,6 @@ lines''', }, }, }, - NamedArgs: []*ast.NamedArg(nil), - NullHandling: nil, - Having: nil, }, }, &ast.ExprSelectItem{ @@ -549,8 +520,7 @@ lines''', NameEnd: 690, Name: "TIMESTAMP", }, - Distinct: false, - Args: []ast.Arg{ + Args: []ast.Arg{ &ast.ExprArg{ Expr: &ast.StringLiteral{ ValuePos: 691, @@ -559,9 +529,6 @@ lines''', }, }, }, - NamedArgs: []*ast.NamedArg(nil), - NullHandling: nil, - Having: nil, }, }, &ast.ExprSelectItem{ @@ -623,16 +590,9 @@ lines''', &ast.ExprSelectItem{ Expr: &ast.BoolLiteral{ ValuePos: 785, - Value: false, }, }, }, - From: (*ast.From)(nil), - Where: (*ast.Where)(nil), - GroupBy: (*ast.GroupBy)(nil), - Having: (*ast.Having)(nil), - OrderBy: (*ast.OrderBy)(nil), - Limit: (*ast.Limit)(nil), }, } diff --git a/testdata/result/statement/select_literals_array.sql.txt b/testdata/result/statement/select_literals_array.sql.txt index 5955dc62..24ad47f4 100644 --- a/testdata/result/statement/select_literals_array.sql.txt +++ b/testdata/result/statement/select_literals_array.sql.txt @@ -8,19 +8,13 @@ SELECT --- AST &ast.QueryStatement{ - Hint: (*ast.Hint)(nil), - With: (*ast.With)(nil), Query: &ast.Select{ - Select: 0, - Distinct: false, - As: nil, - Results: []ast.SelectItem{ + Results: []ast.SelectItem{ &ast.ExprSelectItem{ Expr: &ast.ArrayLiteral{ Array: -1, Lbrack: 9, Rbrack: 17, - Type: nil, Values: []ast.Expr{ &ast.IntLiteral{ ValuePos: 10, @@ -48,7 +42,6 @@ SELECT Array: -1, Lbrack: 22, Rbrack: 37, - Type: nil, Values: []ast.Expr{ &ast.StringLiteral{ ValuePos: 23, @@ -73,7 +66,6 @@ SELECT Array: 42, Lbrack: 47, Rbrack: 55, - Type: nil, Values: []ast.Expr{ &ast.IntLiteral{ ValuePos: 48, @@ -133,16 +125,9 @@ SELECT NamePos: 99, Name: "INT64", }, - Values: []ast.Expr(nil), }, }, }, - From: (*ast.From)(nil), - Where: (*ast.Where)(nil), - GroupBy: (*ast.GroupBy)(nil), - Having: (*ast.Having)(nil), - OrderBy: (*ast.OrderBy)(nil), - Limit: (*ast.Limit)(nil), }, } diff --git a/testdata/result/statement/select_literals_array_invalid.sql.txt b/testdata/result/statement/select_literals_array_invalid.sql.txt index 2ffd9a3e..c4c94b67 100644 --- a/testdata/result/statement/select_literals_array_invalid.sql.txt +++ b/testdata/result/statement/select_literals_array_invalid.sql.txt @@ -4,25 +4,18 @@ SELECT --- AST &ast.QueryStatement{ - Hint: (*ast.Hint)(nil), - With: (*ast.With)(nil), Query: &ast.Select{ - Select: 0, - Distinct: false, - As: nil, - Results: []ast.SelectItem{ + Results: []ast.SelectItem{ &ast.ExprSelectItem{ Expr: &ast.ArrayLiteral{ Array: -1, Lbrack: 9, Rbrack: 41, - Type: nil, Values: []ast.Expr{ &ast.ArrayLiteral{ Array: -1, Lbrack: 10, Rbrack: 18, - Type: nil, Values: []ast.Expr{ &ast.IntLiteral{ ValuePos: 11, @@ -48,7 +41,6 @@ SELECT Array: -1, Lbrack: 21, Rbrack: 29, - Type: nil, Values: []ast.Expr{ &ast.IntLiteral{ ValuePos: 22, @@ -74,7 +66,6 @@ SELECT Array: -1, Lbrack: 32, Rbrack: 40, - Type: nil, Values: []ast.Expr{ &ast.IntLiteral{ ValuePos: 33, @@ -100,12 +91,6 @@ SELECT }, }, }, - From: (*ast.From)(nil), - Where: (*ast.Where)(nil), - GroupBy: (*ast.GroupBy)(nil), - Having: (*ast.Having)(nil), - OrderBy: (*ast.OrderBy)(nil), - Limit: (*ast.Limit)(nil), }, } diff --git a/testdata/result/statement/select_literals_bytes.sql.txt b/testdata/result/statement/select_literals_bytes.sql.txt index 09b7dbee..498b1214 100644 --- a/testdata/result/statement/select_literals_bytes.sql.txt +++ b/testdata/result/statement/select_literals_bytes.sql.txt @@ -13,19 +13,14 @@ SELECT --- AST &ast.QueryStatement{ - Hint: (*ast.Hint)(nil), - With: (*ast.With)(nil), Query: &ast.Select{ - Select: 0, - Distinct: false, - As: nil, - Results: []ast.SelectItem{ + Results: []ast.SelectItem{ &ast.ExprSelectItem{ Expr: &ast.BytesLiteral{ ValuePos: 9, ValueEnd: 15, Value: []uint8{ - 0x61, 0x62, 0x63, + 97, 98, 99, }, }, }, @@ -34,7 +29,7 @@ SELECT ValuePos: 19, ValueEnd: 29, Value: []uint8{ - 0x61, 0x62, 0x63, + 97, 98, 99, }, }, }, @@ -43,7 +38,7 @@ SELECT ValuePos: 33, ValueEnd: 43, Value: []uint8{ - 0x61, 0x62, 0x63, + 97, 98, 99, }, }, }, @@ -52,7 +47,7 @@ SELECT ValuePos: 47, ValueEnd: 59, Value: []uint8{ - 0x61, 0x62, 0x63, 0x0a, + 97, 98, 99, 10, }, }, }, @@ -61,7 +56,7 @@ SELECT ValuePos: 63, ValueEnd: 71, Value: []uint8{ - 0x61, 0x62, 0x63, 0x2b, + 97, 98, 99, 43, }, }, }, @@ -70,7 +65,7 @@ SELECT ValuePos: 75, ValueEnd: 83, Value: []uint8{ - 0x61, 0x62, 0x63, 0x2b, + 97, 98, 99, 43, }, }, }, @@ -79,7 +74,7 @@ SELECT ValuePos: 87, ValueEnd: 98, Value: []uint8{ - 0x61, 0x62, 0x63, + 97, 98, 99, }, }, }, @@ -88,7 +83,7 @@ SELECT ValuePos: 102, ValueEnd: 115, Value: []uint8{ - 0x61, 0x62, 0x63, 0x5c, 0x6e, + 97, 98, 99, 92, 110, }, }, }, @@ -97,7 +92,7 @@ SELECT ValuePos: 119, ValueEnd: 126, Value: []uint8{ - 0x00, + 0, }, }, }, @@ -106,17 +101,11 @@ SELECT ValuePos: 130, ValueEnd: 145, Value: []uint8{ - 0x3f, 0x3f, 0x3f, + 63, 63, 63, }, }, }, }, - From: (*ast.From)(nil), - Where: (*ast.Where)(nil), - GroupBy: (*ast.GroupBy)(nil), - Having: (*ast.Having)(nil), - OrderBy: (*ast.OrderBy)(nil), - Limit: (*ast.Limit)(nil), }, } diff --git a/testdata/result/statement/select_literals_date.sql.txt b/testdata/result/statement/select_literals_date.sql.txt index 7d21137b..fafc2985 100644 --- a/testdata/result/statement/select_literals_date.sql.txt +++ b/testdata/result/statement/select_literals_date.sql.txt @@ -13,13 +13,8 @@ SELECT --- AST &ast.QueryStatement{ - Hint: (*ast.Hint)(nil), - With: (*ast.With)(nil), Query: &ast.Select{ - Select: 0, - Distinct: false, - As: nil, - Results: []ast.SelectItem{ + Results: []ast.SelectItem{ &ast.ExprSelectItem{ Expr: &ast.DateLiteral{ Date: 9, @@ -38,8 +33,7 @@ SELECT NameEnd: 33, Name: "DATE", }, - Distinct: false, - Args: []ast.Arg{ + Args: []ast.Arg{ &ast.ExprArg{ Expr: &ast.StringLiteral{ ValuePos: 34, @@ -48,9 +42,6 @@ SELECT }, }, }, - NamedArgs: []*ast.NamedArg(nil), - NullHandling: nil, - Having: nil, }, }, &ast.ExprSelectItem{ @@ -101,8 +92,7 @@ SELECT NameEnd: 206, Name: "TIMESTAMP", }, - Distinct: false, - Args: []ast.Arg{ + Args: []ast.Arg{ &ast.ExprArg{ Expr: &ast.StringLiteral{ ValuePos: 207, @@ -111,9 +101,6 @@ SELECT }, }, }, - NamedArgs: []*ast.NamedArg(nil), - NullHandling: nil, - Having: nil, }, }, &ast.ExprSelectItem{ @@ -134,8 +121,7 @@ SELECT NameEnd: 255, Name: "DATE", }, - Distinct: false, - Args: []ast.Arg{ + Args: []ast.Arg{ &ast.ExprArg{ Expr: &ast.StringLiteral{ ValuePos: 256, @@ -144,9 +130,6 @@ SELECT }, }, }, - NamedArgs: []*ast.NamedArg(nil), - NullHandling: nil, - Having: nil, }, As: &ast.AsAlias{ As: 270, @@ -165,8 +148,7 @@ SELECT NameEnd: 289, Name: "TIMESTAMP", }, - Distinct: false, - Args: []ast.Arg{ + Args: []ast.Arg{ &ast.ExprArg{ Expr: &ast.StringLiteral{ ValuePos: 290, @@ -175,9 +157,6 @@ SELECT }, }, }, - NamedArgs: []*ast.NamedArg(nil), - NullHandling: nil, - Having: nil, }, As: &ast.AsAlias{ As: 304, @@ -189,12 +168,6 @@ SELECT }, }, }, - From: (*ast.From)(nil), - Where: (*ast.Where)(nil), - GroupBy: (*ast.GroupBy)(nil), - Having: (*ast.Having)(nil), - OrderBy: (*ast.OrderBy)(nil), - Limit: (*ast.Limit)(nil), }, } diff --git a/testdata/result/statement/select_literals_float.sql.txt b/testdata/result/statement/select_literals_float.sql.txt index 1f90c1d9..3ccf54f0 100644 --- a/testdata/result/statement/select_literals_float.sql.txt +++ b/testdata/result/statement/select_literals_float.sql.txt @@ -7,13 +7,8 @@ SELECT --- AST &ast.QueryStatement{ - Hint: (*ast.Hint)(nil), - With: (*ast.With)(nil), Query: &ast.Select{ - Select: 0, - Distinct: false, - As: nil, - Results: []ast.SelectItem{ + Results: []ast.SelectItem{ &ast.ExprSelectItem{ Expr: &ast.FloatLiteral{ ValuePos: 9, @@ -43,12 +38,6 @@ SELECT }, }, }, - From: (*ast.From)(nil), - Where: (*ast.Where)(nil), - GroupBy: (*ast.GroupBy)(nil), - Having: (*ast.Having)(nil), - OrderBy: (*ast.OrderBy)(nil), - Limit: (*ast.Limit)(nil), }, } diff --git a/testdata/result/statement/select_literals_int.sql.txt b/testdata/result/statement/select_literals_int.sql.txt index 4634fef4..385b2f03 100644 --- a/testdata/result/statement/select_literals_int.sql.txt +++ b/testdata/result/statement/select_literals_int.sql.txt @@ -7,13 +7,8 @@ SELECT --- AST &ast.QueryStatement{ - Hint: (*ast.Hint)(nil), - With: (*ast.With)(nil), Query: &ast.Select{ - Select: 0, - Distinct: false, - As: nil, - Results: []ast.SelectItem{ + Results: []ast.SelectItem{ &ast.ExprSelectItem{ Expr: &ast.IntLiteral{ ValuePos: 9, @@ -47,12 +42,6 @@ SELECT }, }, }, - From: (*ast.From)(nil), - Where: (*ast.Where)(nil), - GroupBy: (*ast.GroupBy)(nil), - Having: (*ast.Having)(nil), - OrderBy: (*ast.OrderBy)(nil), - Limit: (*ast.Limit)(nil), }, } diff --git a/testdata/result/statement/select_literals_paren.sql.txt b/testdata/result/statement/select_literals_paren.sql.txt index 34ae9052..5c845ef2 100644 --- a/testdata/result/statement/select_literals_paren.sql.txt +++ b/testdata/result/statement/select_literals_paren.sql.txt @@ -3,13 +3,8 @@ SELECT (1) --- AST &ast.QueryStatement{ - Hint: (*ast.Hint)(nil), - With: (*ast.With)(nil), Query: &ast.Select{ - Select: 0, - Distinct: false, - As: nil, - Results: []ast.SelectItem{ + Results: []ast.SelectItem{ &ast.ExprSelectItem{ Expr: &ast.ParenExpr{ Lparen: 7, @@ -23,12 +18,6 @@ SELECT (1) }, }, }, - From: (*ast.From)(nil), - Where: (*ast.Where)(nil), - GroupBy: (*ast.GroupBy)(nil), - Having: (*ast.Having)(nil), - OrderBy: (*ast.OrderBy)(nil), - Limit: (*ast.Limit)(nil), }, } diff --git a/testdata/result/statement/select_literals_paren_with_operator.sql.txt b/testdata/result/statement/select_literals_paren_with_operator.sql.txt index 3efa5f2e..a0c52ced 100644 --- a/testdata/result/statement/select_literals_paren_with_operator.sql.txt +++ b/testdata/result/statement/select_literals_paren_with_operator.sql.txt @@ -3,13 +3,8 @@ SELECT (1+1) --- AST &ast.QueryStatement{ - Hint: (*ast.Hint)(nil), - With: (*ast.With)(nil), Query: &ast.Select{ - Select: 0, - Distinct: false, - As: nil, - Results: []ast.SelectItem{ + Results: []ast.SelectItem{ &ast.ExprSelectItem{ Expr: &ast.ParenExpr{ Lparen: 7, @@ -32,12 +27,6 @@ SELECT (1+1) }, }, }, - From: (*ast.From)(nil), - Where: (*ast.Where)(nil), - GroupBy: (*ast.GroupBy)(nil), - Having: (*ast.Having)(nil), - OrderBy: (*ast.OrderBy)(nil), - Limit: (*ast.Limit)(nil), }, } diff --git a/testdata/result/statement/select_literals_string.sql.txt b/testdata/result/statement/select_literals_string.sql.txt index c18ac805..8686fd58 100644 --- a/testdata/result/statement/select_literals_string.sql.txt +++ b/testdata/result/statement/select_literals_string.sql.txt @@ -25,13 +25,8 @@ lines''', --- AST &ast.QueryStatement{ - Hint: (*ast.Hint)(nil), - With: (*ast.With)(nil), Query: &ast.Select{ - Select: 0, - Distinct: false, - As: nil, - Results: []ast.SelectItem{ + Results: []ast.SelectItem{ &ast.ExprSelectItem{ Expr: &ast.StringLiteral{ ValuePos: 9, @@ -180,12 +175,6 @@ lines''', }, }, }, - From: (*ast.From)(nil), - Where: (*ast.Where)(nil), - GroupBy: (*ast.GroupBy)(nil), - Having: (*ast.Having)(nil), - OrderBy: (*ast.OrderBy)(nil), - Limit: (*ast.Limit)(nil), }, } diff --git a/testdata/result/statement/select_literals_struct.sql.txt b/testdata/result/statement/select_literals_struct.sql.txt index 3b45c25d..656850ee 100644 --- a/testdata/result/statement/select_literals_struct.sql.txt +++ b/testdata/result/statement/select_literals_struct.sql.txt @@ -18,22 +18,15 @@ SELECT --- AST &ast.QueryStatement{ - Hint: (*ast.Hint)(nil), - With: (*ast.With)(nil), Query: &ast.Select{ - Select: 0, - Distinct: false, - As: nil, - Results: []ast.SelectItem{ + Results: []ast.SelectItem{ &ast.ExprSelectItem{ Expr: &ast.ArraySubQuery{ Array: 9, Rparen: 37, Query: &ast.Select{ - Select: 15, - Distinct: false, - As: nil, - Results: []ast.SelectItem{ + Select: 15, + Results: []ast.SelectItem{ &ast.ExprSelectItem{ Expr: &ast.TypelessStructLiteral{ Struct: 22, @@ -67,12 +60,6 @@ SELECT }, }, }, - From: (*ast.From)(nil), - Where: (*ast.Where)(nil), - GroupBy: (*ast.GroupBy)(nil), - Having: (*ast.Having)(nil), - OrderBy: (*ast.OrderBy)(nil), - Limit: (*ast.Limit)(nil), }, }, }, @@ -81,10 +68,8 @@ SELECT Array: 42, Rparen: 73, Query: &ast.Select{ - Select: 48, - Distinct: false, - As: nil, - Results: []ast.SelectItem{ + Select: 48, + Results: []ast.SelectItem{ &ast.ExprSelectItem{ Expr: &ast.TypelessStructLiteral{ Struct: 55, @@ -116,12 +101,6 @@ SELECT }, }, }, - From: (*ast.From)(nil), - Where: (*ast.Where)(nil), - GroupBy: (*ast.GroupBy)(nil), - Having: (*ast.Having)(nil), - OrderBy: (*ast.OrderBy)(nil), - Limit: (*ast.Limit)(nil), }, }, }, @@ -130,10 +109,8 @@ SELECT Array: 78, Rparen: 133, Query: &ast.Select{ - Select: 84, - Distinct: false, - As: nil, - Results: []ast.SelectItem{ + Select: 84, + Results: []ast.SelectItem{ &ast.ExprSelectItem{ Expr: &ast.TypedStructLiteral{ Struct: 91, @@ -196,12 +173,6 @@ SELECT }, }, }, - From: (*ast.From)(nil), - Where: (*ast.Where)(nil), - GroupBy: (*ast.GroupBy)(nil), - Having: (*ast.Having)(nil), - OrderBy: (*ast.OrderBy)(nil), - Limit: (*ast.Limit)(nil), }, }, }, @@ -210,10 +181,8 @@ SELECT Array: 138, Rparen: 181, Query: &ast.Select{ - Select: 144, - Distinct: false, - As: nil, - Results: []ast.SelectItem{ + Select: 144, + Results: []ast.SelectItem{ &ast.ExprSelectItem{ Expr: &ast.TypelessStructLiteral{ Struct: 151, @@ -271,12 +240,6 @@ SELECT }, }, }, - From: (*ast.From)(nil), - Where: (*ast.Where)(nil), - GroupBy: (*ast.GroupBy)(nil), - Having: (*ast.Having)(nil), - OrderBy: (*ast.OrderBy)(nil), - Limit: (*ast.Limit)(nil), }, }, }, @@ -285,32 +248,27 @@ SELECT Array: 186, Rparen: 235, Query: &ast.Select{ - Select: 192, - Distinct: false, - As: nil, - Results: []ast.SelectItem{ + Select: 192, + Results: []ast.SelectItem{ &ast.ExprSelectItem{ Expr: &ast.TypedStructLiteral{ Struct: 199, Rparen: 234, Fields: []*ast.StructField{ &ast.StructField{ - Ident: (*ast.Ident)(nil), - Type: &ast.SimpleType{ + Type: &ast.SimpleType{ NamePos: 206, Name: "INT64", }, }, &ast.StructField{ - Ident: (*ast.Ident)(nil), - Type: &ast.SimpleType{ + Type: &ast.SimpleType{ NamePos: 213, Name: "INT64", }, }, &ast.StructField{ - Ident: (*ast.Ident)(nil), - Type: &ast.SimpleType{ + Type: &ast.SimpleType{ NamePos: 220, Name: "INT64", }, @@ -339,12 +297,6 @@ SELECT }, }, }, - From: (*ast.From)(nil), - Where: (*ast.Where)(nil), - GroupBy: (*ast.GroupBy)(nil), - Having: (*ast.Having)(nil), - OrderBy: (*ast.OrderBy)(nil), - Limit: (*ast.Limit)(nil), }, }, }, @@ -353,10 +305,8 @@ SELECT Array: 240, Rparen: 291, Query: &ast.Select{ - Select: 246, - Distinct: false, - As: nil, - Results: []ast.SelectItem{ + Select: 246, + Results: []ast.SelectItem{ &ast.ExprSelectItem{ Expr: &ast.TypedStructLiteral{ Struct: 253, @@ -374,15 +324,13 @@ SELECT }, }, &ast.StructField{ - Ident: (*ast.Ident)(nil), - Type: &ast.SimpleType{ + Type: &ast.SimpleType{ NamePos: 269, Name: "INT64", }, }, &ast.StructField{ - Ident: (*ast.Ident)(nil), - Type: &ast.SimpleType{ + Type: &ast.SimpleType{ NamePos: 276, Name: "INT64", }, @@ -411,12 +359,6 @@ SELECT }, }, }, - From: (*ast.From)(nil), - Where: (*ast.Where)(nil), - GroupBy: (*ast.GroupBy)(nil), - Having: (*ast.Having)(nil), - OrderBy: (*ast.OrderBy)(nil), - Limit: (*ast.Limit)(nil), }, }, }, @@ -425,10 +367,8 @@ SELECT Array: 296, Rparen: 329, Query: &ast.Select{ - Select: 302, - Distinct: false, - As: nil, - Results: []ast.SelectItem{ + Select: 302, + Results: []ast.SelectItem{ &ast.ExprSelectItem{ Expr: &ast.TypelessStructLiteral{ Struct: 309, @@ -470,12 +410,6 @@ SELECT }, }, }, - From: (*ast.From)(nil), - Where: (*ast.Where)(nil), - GroupBy: (*ast.GroupBy)(nil), - Having: (*ast.Having)(nil), - OrderBy: (*ast.OrderBy)(nil), - Limit: (*ast.Limit)(nil), }, }, }, @@ -484,10 +418,8 @@ SELECT Array: 334, Rparen: 356, Query: &ast.Select{ - Select: 340, - Distinct: false, - As: nil, - Results: []ast.SelectItem{ + Select: 340, + Results: []ast.SelectItem{ &ast.ExprSelectItem{ Expr: &ast.TupleStructLiteral{ Lparen: 347, @@ -515,12 +447,6 @@ SELECT }, }, }, - From: (*ast.From)(nil), - Where: (*ast.Where)(nil), - GroupBy: (*ast.GroupBy)(nil), - Having: (*ast.Having)(nil), - OrderBy: (*ast.OrderBy)(nil), - Limit: (*ast.Limit)(nil), }, }, }, @@ -529,10 +455,8 @@ SELECT Array: 361, Rparen: 392, Query: &ast.Select{ - Select: 367, - Distinct: false, - As: nil, - Results: []ast.SelectItem{ + Select: 367, + Results: []ast.SelectItem{ &ast.ExprSelectItem{ Expr: &ast.TypedStructLiteral{ Struct: 374, @@ -561,12 +485,6 @@ SELECT }, }, }, - From: (*ast.From)(nil), - Where: (*ast.Where)(nil), - GroupBy: (*ast.GroupBy)(nil), - Having: (*ast.Having)(nil), - OrderBy: (*ast.OrderBy)(nil), - Limit: (*ast.Limit)(nil), }, }, }, @@ -575,10 +493,8 @@ SELECT Array: 397, Rparen: 424, Query: &ast.Select{ - Select: 403, - Distinct: false, - As: nil, - Results: []ast.SelectItem{ + Select: 403, + Results: []ast.SelectItem{ &ast.ExprSelectItem{ Expr: &ast.TypelessStructLiteral{ Struct: 410, @@ -604,12 +520,6 @@ SELECT }, }, }, - From: (*ast.From)(nil), - Where: (*ast.Where)(nil), - GroupBy: (*ast.GroupBy)(nil), - Having: (*ast.Having)(nil), - OrderBy: (*ast.OrderBy)(nil), - Limit: (*ast.Limit)(nil), }, }, }, @@ -618,18 +528,15 @@ SELECT Array: 429, Rparen: 458, Query: &ast.Select{ - Select: 435, - Distinct: false, - As: nil, - Results: []ast.SelectItem{ + Select: 435, + Results: []ast.SelectItem{ &ast.ExprSelectItem{ Expr: &ast.TypedStructLiteral{ Struct: 442, Rparen: 457, Fields: []*ast.StructField{ &ast.StructField{ - Ident: (*ast.Ident)(nil), - Type: &ast.SimpleType{ + Type: &ast.SimpleType{ NamePos: 449, Name: "INT64", }, @@ -646,12 +553,6 @@ SELECT }, }, }, - From: (*ast.From)(nil), - Where: (*ast.Where)(nil), - GroupBy: (*ast.GroupBy)(nil), - Having: (*ast.Having)(nil), - OrderBy: (*ast.OrderBy)(nil), - Limit: (*ast.Limit)(nil), }, }, }, @@ -660,10 +561,8 @@ SELECT Array: 463, Rparen: 485, Query: &ast.Select{ - Select: 469, - Distinct: false, - As: nil, - Results: []ast.SelectItem{ + Select: 469, + Results: []ast.SelectItem{ &ast.ExprSelectItem{ Expr: &ast.TypelessStructLiteral{ Struct: 476, @@ -681,12 +580,6 @@ SELECT }, }, }, - From: (*ast.From)(nil), - Where: (*ast.Where)(nil), - GroupBy: (*ast.GroupBy)(nil), - Having: (*ast.Having)(nil), - OrderBy: (*ast.OrderBy)(nil), - Limit: (*ast.Limit)(nil), }, }, }, @@ -695,25 +588,15 @@ SELECT Array: 490, Rparen: 513, Query: &ast.Select{ - Select: 496, - Distinct: false, - As: nil, - Results: []ast.SelectItem{ + Select: 496, + Results: []ast.SelectItem{ &ast.ExprSelectItem{ Expr: &ast.TypedStructLiteral{ Struct: 503, Rparen: 512, - Fields: []*ast.StructField(nil), - Values: []ast.Expr(nil), }, }, }, - From: (*ast.From)(nil), - Where: (*ast.Where)(nil), - GroupBy: (*ast.GroupBy)(nil), - Having: (*ast.Having)(nil), - OrderBy: (*ast.OrderBy)(nil), - Limit: (*ast.Limit)(nil), }, }, }, @@ -722,24 +605,15 @@ SELECT Array: 518, Rparen: 539, Query: &ast.Select{ - Select: 524, - Distinct: false, - As: nil, - Results: []ast.SelectItem{ + Select: 524, + Results: []ast.SelectItem{ &ast.ExprSelectItem{ Expr: &ast.TypelessStructLiteral{ Struct: 531, Rparen: 538, - Values: []ast.TypelessStructLiteralArg(nil), }, }, }, - From: (*ast.From)(nil), - Where: (*ast.Where)(nil), - GroupBy: (*ast.GroupBy)(nil), - Having: (*ast.Having)(nil), - OrderBy: (*ast.OrderBy)(nil), - Limit: (*ast.Limit)(nil), }, }, }, @@ -747,12 +621,9 @@ SELECT Expr: &ast.ExistsSubQuery{ Exists: 544, Rparen: 564, - Hint: (*ast.Hint)(nil), Query: &ast.Select{ - Select: 551, - Distinct: false, - As: nil, - Results: []ast.SelectItem{ + Select: 551, + Results: []ast.SelectItem{ &ast.ExprSelectItem{ Expr: &ast.TupleStructLiteral{ Lparen: 558, @@ -774,22 +645,10 @@ SELECT }, }, }, - From: (*ast.From)(nil), - Where: (*ast.Where)(nil), - GroupBy: (*ast.GroupBy)(nil), - Having: (*ast.Having)(nil), - OrderBy: (*ast.OrderBy)(nil), - Limit: (*ast.Limit)(nil), }, }, }, }, - From: (*ast.From)(nil), - Where: (*ast.Where)(nil), - GroupBy: (*ast.GroupBy)(nil), - Having: (*ast.Having)(nil), - OrderBy: (*ast.OrderBy)(nil), - Limit: (*ast.Limit)(nil), }, } diff --git a/testdata/result/statement/select_nest_complex.sql.txt b/testdata/result/statement/select_nest_complex.sql.txt index 81059415..df297133 100644 --- a/testdata/result/statement/select_nest_complex.sql.txt +++ b/testdata/result/statement/select_nest_complex.sql.txt @@ -8,13 +8,8 @@ from ( --- AST &ast.QueryStatement{ - Hint: (*ast.Hint)(nil), - With: (*ast.With)(nil), Query: &ast.Select{ - Select: 0, - Distinct: false, - As: nil, - Results: []ast.SelectItem{ + Results: []ast.SelectItem{ &ast.Star{ Star: 7, }, @@ -25,10 +20,8 @@ from ( Lparen: 14, Rparen: 131, Source: &ast.Join{ - Op: "INNER JOIN", - Method: "", - Hint: (*ast.Hint)(nil), - Left: &ast.SubQueryTableExpr{ + Op: "INNER JOIN", + Left: &ast.SubQueryTableExpr{ Lparen: 20, Rparen: 90, Query: &ast.SubQuery{ @@ -42,14 +35,11 @@ from ( Lparen: 22, Rparen: 54, Query: &ast.CompoundQuery{ - Op: "UNION", - Distinct: false, - Queries: []ast.QueryExpr{ + Op: "UNION", + Queries: []ast.QueryExpr{ &ast.Select{ - Select: 23, - Distinct: false, - As: nil, - Results: []ast.SelectItem{ + Select: 23, + Results: []ast.SelectItem{ &ast.Alias{ Expr: &ast.IntLiteral{ ValuePos: 30, @@ -67,21 +57,13 @@ from ( }, }, }, - From: (*ast.From)(nil), - Where: (*ast.Where)(nil), - GroupBy: (*ast.GroupBy)(nil), - Having: (*ast.Having)(nil), - OrderBy: (*ast.OrderBy)(nil), - Limit: (*ast.Limit)(nil), }, &ast.SubQuery{ Lparen: 44, Rparen: 53, Query: &ast.Select{ - Select: 45, - Distinct: false, - As: nil, - Results: []ast.SelectItem{ + Select: 45, + Results: []ast.SelectItem{ &ast.ExprSelectItem{ Expr: &ast.IntLiteral{ ValuePos: 52, @@ -91,31 +73,17 @@ from ( }, }, }, - From: (*ast.From)(nil), - Where: (*ast.Where)(nil), - GroupBy: (*ast.GroupBy)(nil), - Having: (*ast.Having)(nil), - OrderBy: (*ast.OrderBy)(nil), - Limit: (*ast.Limit)(nil), }, - OrderBy: (*ast.OrderBy)(nil), - Limit: (*ast.Limit)(nil), }, }, - OrderBy: (*ast.OrderBy)(nil), - Limit: (*ast.Limit)(nil), }, - OrderBy: (*ast.OrderBy)(nil), - Limit: (*ast.Limit)(nil), }, &ast.SubQuery{ Lparen: 71, Rparen: 80, Query: &ast.Select{ - Select: 72, - Distinct: false, - As: nil, - Results: []ast.SelectItem{ + Select: 72, + Results: []ast.SelectItem{ &ast.ExprSelectItem{ Expr: &ast.IntLiteral{ ValuePos: 79, @@ -125,22 +93,11 @@ from ( }, }, }, - From: (*ast.From)(nil), - Where: (*ast.Where)(nil), - GroupBy: (*ast.GroupBy)(nil), - Having: (*ast.Having)(nil), - OrderBy: (*ast.OrderBy)(nil), - Limit: (*ast.Limit)(nil), }, - OrderBy: (*ast.OrderBy)(nil), - Limit: (*ast.Limit)(nil), }, }, - OrderBy: (*ast.OrderBy)(nil), - Limit: (*ast.Limit)(nil), }, - OrderBy: (*ast.OrderBy)(nil), - Limit: &ast.Limit{ + Limit: &ast.Limit{ Limit: 83, Count: &ast.IntLiteral{ ValuePos: 89, @@ -148,20 +105,15 @@ from ( Base: 10, Value: "1", }, - Offset: (*ast.Offset)(nil), }, }, - As: (*ast.AsAlias)(nil), - Sample: (*ast.TableSample)(nil), }, Right: &ast.SubQueryTableExpr{ Lparen: 103, Rparen: 119, Query: &ast.Select{ - Select: 104, - Distinct: false, - As: nil, - Results: []ast.SelectItem{ + Select: 104, + Results: []ast.SelectItem{ &ast.Alias{ Expr: &ast.IntLiteral{ ValuePos: 111, @@ -195,15 +147,7 @@ from ( }, }, }, - From: (*ast.From)(nil), - Where: (*ast.Where)(nil), - GroupBy: (*ast.GroupBy)(nil), - Having: (*ast.Having)(nil), - OrderBy: (*ast.OrderBy)(nil), - Limit: (*ast.Limit)(nil), }, - As: (*ast.AsAlias)(nil), - Sample: (*ast.TableSample)(nil), }, Cond: &ast.Using{ Using: 121, @@ -217,14 +161,8 @@ from ( }, }, }, - Sample: (*ast.TableSample)(nil), }, }, - Where: (*ast.Where)(nil), - GroupBy: (*ast.GroupBy)(nil), - Having: (*ast.Having)(nil), - OrderBy: (*ast.OrderBy)(nil), - Limit: (*ast.Limit)(nil), }, } diff --git a/testdata/result/statement/select_select_limit_expr.sql.txt b/testdata/result/statement/select_select_limit_expr.sql.txt index 7a4f364a..f88cc9d1 100644 --- a/testdata/result/statement/select_select_limit_expr.sql.txt +++ b/testdata/result/statement/select_select_limit_expr.sql.txt @@ -3,13 +3,8 @@ select ((select 1) limit 1 offset 0) + 3 --- AST &ast.QueryStatement{ - Hint: (*ast.Hint)(nil), - With: (*ast.With)(nil), Query: &ast.Select{ - Select: 0, - Distinct: false, - As: nil, - Results: []ast.SelectItem{ + Results: []ast.SelectItem{ &ast.ExprSelectItem{ Expr: &ast.BinaryExpr{ Op: "+", @@ -20,10 +15,8 @@ select ((select 1) limit 1 offset 0) + 3 Lparen: 8, Rparen: 17, Query: &ast.Select{ - Select: 9, - Distinct: false, - As: nil, - Results: []ast.SelectItem{ + Select: 9, + Results: []ast.SelectItem{ &ast.ExprSelectItem{ Expr: &ast.IntLiteral{ ValuePos: 16, @@ -33,15 +26,8 @@ select ((select 1) limit 1 offset 0) + 3 }, }, }, - From: (*ast.From)(nil), - Where: (*ast.Where)(nil), - GroupBy: (*ast.GroupBy)(nil), - Having: (*ast.Having)(nil), - OrderBy: (*ast.OrderBy)(nil), - Limit: (*ast.Limit)(nil), }, - OrderBy: (*ast.OrderBy)(nil), - Limit: &ast.Limit{ + Limit: &ast.Limit{ Limit: 19, Count: &ast.IntLiteral{ ValuePos: 25, @@ -70,12 +56,6 @@ select ((select 1) limit 1 offset 0) + 3 }, }, }, - From: (*ast.From)(nil), - Where: (*ast.Where)(nil), - GroupBy: (*ast.GroupBy)(nil), - Having: (*ast.Having)(nil), - OrderBy: (*ast.OrderBy)(nil), - Limit: (*ast.Limit)(nil), }, } diff --git a/testdata/result/statement/select_select_set_operator_expr.sql.txt b/testdata/result/statement/select_select_set_operator_expr.sql.txt index fc1d824d..e14cac9b 100644 --- a/testdata/result/statement/select_select_set_operator_expr.sql.txt +++ b/testdata/result/statement/select_select_set_operator_expr.sql.txt @@ -5,13 +5,8 @@ select ((select 1) union all (select 2)) + 3, --- AST &ast.QueryStatement{ - Hint: (*ast.Hint)(nil), - With: (*ast.With)(nil), Query: &ast.Select{ - Select: 0, - Distinct: false, - As: nil, - Results: []ast.SelectItem{ + Results: []ast.SelectItem{ &ast.ExprSelectItem{ Expr: &ast.BinaryExpr{ Op: "+", @@ -19,17 +14,14 @@ select ((select 1) union all (select 2)) + 3, Lparen: 7, Rparen: 39, Query: &ast.CompoundQuery{ - Op: "UNION", - Distinct: false, - Queries: []ast.QueryExpr{ + Op: "UNION", + Queries: []ast.QueryExpr{ &ast.SubQuery{ Lparen: 8, Rparen: 17, Query: &ast.Select{ - Select: 9, - Distinct: false, - As: nil, - Results: []ast.SelectItem{ + Select: 9, + Results: []ast.SelectItem{ &ast.ExprSelectItem{ Expr: &ast.IntLiteral{ ValuePos: 16, @@ -39,24 +31,14 @@ select ((select 1) union all (select 2)) + 3, }, }, }, - From: (*ast.From)(nil), - Where: (*ast.Where)(nil), - GroupBy: (*ast.GroupBy)(nil), - Having: (*ast.Having)(nil), - OrderBy: (*ast.OrderBy)(nil), - Limit: (*ast.Limit)(nil), }, - OrderBy: (*ast.OrderBy)(nil), - Limit: (*ast.Limit)(nil), }, &ast.SubQuery{ Lparen: 29, Rparen: 38, Query: &ast.Select{ - Select: 30, - Distinct: false, - As: nil, - Results: []ast.SelectItem{ + Select: 30, + Results: []ast.SelectItem{ &ast.ExprSelectItem{ Expr: &ast.IntLiteral{ ValuePos: 37, @@ -66,19 +48,9 @@ select ((select 1) union all (select 2)) + 3, }, }, }, - From: (*ast.From)(nil), - Where: (*ast.Where)(nil), - GroupBy: (*ast.GroupBy)(nil), - Having: (*ast.Having)(nil), - OrderBy: (*ast.OrderBy)(nil), - Limit: (*ast.Limit)(nil), }, - OrderBy: (*ast.OrderBy)(nil), - Limit: (*ast.Limit)(nil), }, }, - OrderBy: (*ast.OrderBy)(nil), - Limit: (*ast.Limit)(nil), }, }, Right: &ast.IntLiteral{ @@ -96,17 +68,14 @@ select ((select 1) union all (select 2)) + 3, Lparen: 53, Rparen: 89, Query: &ast.CompoundQuery{ - Op: "INTERSECT", - Distinct: false, - Queries: []ast.QueryExpr{ + Op: "INTERSECT", + Queries: []ast.QueryExpr{ &ast.SubQuery{ Lparen: 54, Rparen: 63, Query: &ast.Select{ - Select: 55, - Distinct: false, - As: nil, - Results: []ast.SelectItem{ + Select: 55, + Results: []ast.SelectItem{ &ast.ExprSelectItem{ Expr: &ast.IntLiteral{ ValuePos: 62, @@ -116,24 +85,14 @@ select ((select 1) union all (select 2)) + 3, }, }, }, - From: (*ast.From)(nil), - Where: (*ast.Where)(nil), - GroupBy: (*ast.GroupBy)(nil), - Having: (*ast.Having)(nil), - OrderBy: (*ast.OrderBy)(nil), - Limit: (*ast.Limit)(nil), }, - OrderBy: (*ast.OrderBy)(nil), - Limit: (*ast.Limit)(nil), }, &ast.SubQuery{ Lparen: 79, Rparen: 88, Query: &ast.Select{ - Select: 80, - Distinct: false, - As: nil, - Results: []ast.SelectItem{ + Select: 80, + Results: []ast.SelectItem{ &ast.ExprSelectItem{ Expr: &ast.IntLiteral{ ValuePos: 87, @@ -143,19 +102,9 @@ select ((select 1) union all (select 2)) + 3, }, }, }, - From: (*ast.From)(nil), - Where: (*ast.Where)(nil), - GroupBy: (*ast.GroupBy)(nil), - Having: (*ast.Having)(nil), - OrderBy: (*ast.OrderBy)(nil), - Limit: (*ast.Limit)(nil), }, - OrderBy: (*ast.OrderBy)(nil), - Limit: (*ast.Limit)(nil), }, }, - OrderBy: (*ast.OrderBy)(nil), - Limit: (*ast.Limit)(nil), }, }, Right: &ast.IntLiteral{ @@ -173,17 +122,14 @@ select ((select 1) union all (select 2)) + 3, Lparen: 103, Rparen: 136, Query: &ast.CompoundQuery{ - Op: "EXCEPT", - Distinct: false, - Queries: []ast.QueryExpr{ + Op: "EXCEPT", + Queries: []ast.QueryExpr{ &ast.SubQuery{ Lparen: 104, Rparen: 113, Query: &ast.Select{ - Select: 105, - Distinct: false, - As: nil, - Results: []ast.SelectItem{ + Select: 105, + Results: []ast.SelectItem{ &ast.ExprSelectItem{ Expr: &ast.IntLiteral{ ValuePos: 112, @@ -193,24 +139,14 @@ select ((select 1) union all (select 2)) + 3, }, }, }, - From: (*ast.From)(nil), - Where: (*ast.Where)(nil), - GroupBy: (*ast.GroupBy)(nil), - Having: (*ast.Having)(nil), - OrderBy: (*ast.OrderBy)(nil), - Limit: (*ast.Limit)(nil), }, - OrderBy: (*ast.OrderBy)(nil), - Limit: (*ast.Limit)(nil), }, &ast.SubQuery{ Lparen: 126, Rparen: 135, Query: &ast.Select{ - Select: 127, - Distinct: false, - As: nil, - Results: []ast.SelectItem{ + Select: 127, + Results: []ast.SelectItem{ &ast.ExprSelectItem{ Expr: &ast.IntLiteral{ ValuePos: 134, @@ -220,19 +156,9 @@ select ((select 1) union all (select 2)) + 3, }, }, }, - From: (*ast.From)(nil), - Where: (*ast.Where)(nil), - GroupBy: (*ast.GroupBy)(nil), - Having: (*ast.Having)(nil), - OrderBy: (*ast.OrderBy)(nil), - Limit: (*ast.Limit)(nil), }, - OrderBy: (*ast.OrderBy)(nil), - Limit: (*ast.Limit)(nil), }, }, - OrderBy: (*ast.OrderBy)(nil), - Limit: (*ast.Limit)(nil), }, }, Right: &ast.IntLiteral{ @@ -244,12 +170,6 @@ select ((select 1) union all (select 2)) + 3, }, }, }, - From: (*ast.From)(nil), - Where: (*ast.Where)(nil), - GroupBy: (*ast.GroupBy)(nil), - Having: (*ast.Having)(nil), - OrderBy: (*ast.OrderBy)(nil), - Limit: (*ast.Limit)(nil), }, } diff --git a/testdata/result/statement/select_singer_with_as_struct_subquery.sql.txt b/testdata/result/statement/select_singer_with_as_struct_subquery.sql.txt index 5bac5fd7..94cbc9e7 100644 --- a/testdata/result/statement/select_singer_with_as_struct_subquery.sql.txt +++ b/testdata/result/statement/select_singer_with_as_struct_subquery.sql.txt @@ -10,13 +10,8 @@ SELECT --- AST &ast.QueryStatement{ - Hint: (*ast.Hint)(nil), - With: (*ast.With)(nil), Query: &ast.Select{ - Select: 0, - Distinct: false, - As: nil, - Results: []ast.SelectItem{ + Results: []ast.SelectItem{ &ast.ExprSelectItem{ Expr: &ast.ArraySubQuery{ Array: 9, @@ -25,9 +20,8 @@ SELECT Lparen: 20, Rparen: 88, Query: &ast.Select{ - Select: 28, - Distinct: false, - As: &ast.AsStruct{ + Select: 28, + As: &ast.AsStruct{ As: 35, Struct: 38, }, @@ -44,16 +38,9 @@ SELECT NameEnd: 73, Name: "Singers", }, - Hint: (*ast.Hint)(nil), - As: (*ast.AsAlias)(nil), - Sample: (*ast.TableSample)(nil), }, }, - Where: (*ast.Where)(nil), - GroupBy: (*ast.GroupBy)(nil), - Having: (*ast.Having)(nil), - OrderBy: (*ast.OrderBy)(nil), - Limit: &ast.Limit{ + Limit: &ast.Limit{ Limit: 74, Count: &ast.IntLiteral{ ValuePos: 80, @@ -61,21 +48,12 @@ SELECT Base: 10, Value: "100", }, - Offset: (*ast.Offset)(nil), }, }, - OrderBy: (*ast.OrderBy)(nil), - Limit: (*ast.Limit)(nil), }, }, }, }, - From: (*ast.From)(nil), - Where: (*ast.Where)(nil), - GroupBy: (*ast.GroupBy)(nil), - Having: (*ast.Having)(nil), - OrderBy: (*ast.OrderBy)(nil), - Limit: (*ast.Limit)(nil), }, } diff --git a/testdata/result/statement/select_singer_with_asterisk.sql.txt b/testdata/result/statement/select_singer_with_asterisk.sql.txt index 2ef354d2..3511b775 100644 --- a/testdata/result/statement/select_singer_with_asterisk.sql.txt +++ b/testdata/result/statement/select_singer_with_asterisk.sql.txt @@ -6,13 +6,8 @@ FROM --- AST &ast.QueryStatement{ - Hint: (*ast.Hint)(nil), - With: (*ast.With)(nil), Query: &ast.Select{ - Select: 0, - Distinct: false, - As: nil, - Results: []ast.SelectItem{ + Results: []ast.SelectItem{ &ast.Star{ Star: 9, }, @@ -25,16 +20,8 @@ FROM NameEnd: 25, Name: "Singers", }, - Hint: (*ast.Hint)(nil), - As: (*ast.AsAlias)(nil), - Sample: (*ast.TableSample)(nil), }, }, - Where: (*ast.Where)(nil), - GroupBy: (*ast.GroupBy)(nil), - Having: (*ast.Having)(nil), - OrderBy: (*ast.OrderBy)(nil), - Limit: (*ast.Limit)(nil), }, } diff --git a/testdata/result/statement/select_singer_with_column_and_asterisk.sql.txt b/testdata/result/statement/select_singer_with_column_and_asterisk.sql.txt index 4aace401..40ae9fad 100644 --- a/testdata/result/statement/select_singer_with_column_and_asterisk.sql.txt +++ b/testdata/result/statement/select_singer_with_column_and_asterisk.sql.txt @@ -7,13 +7,8 @@ FROM --- AST &ast.QueryStatement{ - Hint: (*ast.Hint)(nil), - With: (*ast.With)(nil), Query: &ast.Select{ - Select: 0, - Distinct: false, - As: nil, - Results: []ast.SelectItem{ + Results: []ast.SelectItem{ &ast.ExprSelectItem{ Expr: &ast.Ident{ NamePos: 9, @@ -33,16 +28,8 @@ FROM NameEnd: 37, Name: "Singers", }, - Hint: (*ast.Hint)(nil), - As: (*ast.AsAlias)(nil), - Sample: (*ast.TableSample)(nil), }, }, - Where: (*ast.Where)(nil), - GroupBy: (*ast.GroupBy)(nil), - Having: (*ast.Having)(nil), - OrderBy: (*ast.OrderBy)(nil), - Limit: (*ast.Limit)(nil), }, } diff --git a/testdata/result/statement/select_singer_with_column_names.sql.txt b/testdata/result/statement/select_singer_with_column_names.sql.txt index 7bef784a..31e86dce 100644 --- a/testdata/result/statement/select_singer_with_column_names.sql.txt +++ b/testdata/result/statement/select_singer_with_column_names.sql.txt @@ -9,13 +9,8 @@ FROM Singers --- AST &ast.QueryStatement{ - Hint: (*ast.Hint)(nil), - With: (*ast.With)(nil), Query: &ast.Select{ - Select: 0, - Distinct: false, - As: nil, - Results: []ast.SelectItem{ + Results: []ast.SelectItem{ &ast.Alias{ Expr: &ast.Ident{ NamePos: 9, @@ -68,16 +63,8 @@ FROM Singers NameEnd: 88, Name: "Singers", }, - Hint: (*ast.Hint)(nil), - As: (*ast.AsAlias)(nil), - Sample: (*ast.TableSample)(nil), }, }, - Where: (*ast.Where)(nil), - GroupBy: (*ast.GroupBy)(nil), - Having: (*ast.Having)(nil), - OrderBy: (*ast.OrderBy)(nil), - Limit: (*ast.Limit)(nil), }, } diff --git a/testdata/result/statement/select_singer_with_cross_join.sql.txt b/testdata/result/statement/select_singer_with_cross_join.sql.txt index f7be0a42..34362fa4 100644 --- a/testdata/result/statement/select_singer_with_cross_join.sql.txt +++ b/testdata/result/statement/select_singer_with_cross_join.sql.txt @@ -8,13 +8,8 @@ FROM --- AST &ast.QueryStatement{ - Hint: (*ast.Hint)(nil), - With: (*ast.With)(nil), Query: &ast.Select{ - Select: 0, - Distinct: false, - As: nil, - Results: []ast.SelectItem{ + Results: []ast.SelectItem{ &ast.Star{ Star: 9, }, @@ -22,17 +17,14 @@ FROM From: &ast.From{ From: 11, Source: &ast.Join{ - Op: "CROSS JOIN", - Method: "", - Hint: (*ast.Hint)(nil), - Left: &ast.TableName{ + Op: "CROSS JOIN", + Left: &ast.TableName{ Table: &ast.Ident{ NamePos: 18, NameEnd: 25, Name: "Singers", }, - Hint: (*ast.Hint)(nil), - As: &ast.AsAlias{ + As: &ast.AsAlias{ As: -1, Alias: &ast.Ident{ NamePos: 26, @@ -40,7 +32,6 @@ FROM Name: "A", }, }, - Sample: (*ast.TableSample)(nil), }, Right: &ast.TableName{ Table: &ast.Ident{ @@ -48,8 +39,7 @@ FROM NameEnd: 50, Name: "Singers", }, - Hint: (*ast.Hint)(nil), - As: &ast.AsAlias{ + As: &ast.AsAlias{ As: -1, Alias: &ast.Ident{ NamePos: 51, @@ -57,16 +47,9 @@ FROM Name: "B", }, }, - Sample: (*ast.TableSample)(nil), }, - Cond: nil, }, }, - Where: (*ast.Where)(nil), - GroupBy: (*ast.GroupBy)(nil), - Having: (*ast.Having)(nil), - OrderBy: (*ast.OrderBy)(nil), - Limit: (*ast.Limit)(nil), }, } diff --git a/testdata/result/statement/select_singer_with_distinct.sql.txt b/testdata/result/statement/select_singer_with_distinct.sql.txt index e3018b3e..95a0a846 100644 --- a/testdata/result/statement/select_singer_with_distinct.sql.txt +++ b/testdata/result/statement/select_singer_with_distinct.sql.txt @@ -7,12 +7,8 @@ FROM --- AST &ast.QueryStatement{ - Hint: (*ast.Hint)(nil), - With: (*ast.With)(nil), Query: &ast.Select{ - Select: 0, Distinct: true, - As: nil, Results: []ast.SelectItem{ &ast.Star{ Star: 20, @@ -26,16 +22,8 @@ FROM NameEnd: 36, Name: "Singers", }, - Hint: (*ast.Hint)(nil), - As: (*ast.AsAlias)(nil), - Sample: (*ast.TableSample)(nil), }, }, - Where: (*ast.Where)(nil), - GroupBy: (*ast.GroupBy)(nil), - Having: (*ast.Having)(nil), - OrderBy: (*ast.OrderBy)(nil), - Limit: (*ast.Limit)(nil), }, } diff --git a/testdata/result/statement/select_singer_with_full_join.sql.txt b/testdata/result/statement/select_singer_with_full_join.sql.txt index 8e364024..4036f6ce 100644 --- a/testdata/result/statement/select_singer_with_full_join.sql.txt +++ b/testdata/result/statement/select_singer_with_full_join.sql.txt @@ -7,13 +7,8 @@ FROM --- AST &ast.QueryStatement{ - Hint: (*ast.Hint)(nil), - With: (*ast.With)(nil), Query: &ast.Select{ - Select: 0, - Distinct: false, - As: nil, - Results: []ast.SelectItem{ + Results: []ast.SelectItem{ &ast.Star{ Star: 9, }, @@ -21,17 +16,14 @@ FROM From: &ast.From{ From: 11, Source: &ast.Join{ - Op: ",", - Method: "", - Hint: (*ast.Hint)(nil), - Left: &ast.TableName{ + Op: ",", + Left: &ast.TableName{ Table: &ast.Ident{ NamePos: 18, NameEnd: 25, Name: "Singers", }, - Hint: (*ast.Hint)(nil), - As: &ast.AsAlias{ + As: &ast.AsAlias{ As: 26, Alias: &ast.Ident{ NamePos: 29, @@ -39,7 +31,6 @@ FROM Name: "A", }, }, - Sample: (*ast.TableSample)(nil), }, Right: &ast.TableName{ Table: &ast.Ident{ @@ -47,8 +38,7 @@ FROM NameEnd: 41, Name: "Singers", }, - Hint: (*ast.Hint)(nil), - As: &ast.AsAlias{ + As: &ast.AsAlias{ As: 42, Alias: &ast.Ident{ NamePos: 45, @@ -56,16 +46,9 @@ FROM Name: "B", }, }, - Sample: (*ast.TableSample)(nil), }, - Cond: nil, }, }, - Where: (*ast.Where)(nil), - GroupBy: (*ast.GroupBy)(nil), - Having: (*ast.Having)(nil), - OrderBy: (*ast.OrderBy)(nil), - Limit: (*ast.Limit)(nil), }, } diff --git a/testdata/result/statement/select_singer_with_groupby.sql.txt b/testdata/result/statement/select_singer_with_groupby.sql.txt index 2e8f6f26..0c93d97d 100644 --- a/testdata/result/statement/select_singer_with_groupby.sql.txt +++ b/testdata/result/statement/select_singer_with_groupby.sql.txt @@ -8,13 +8,8 @@ GROUP BY --- AST &ast.QueryStatement{ - Hint: (*ast.Hint)(nil), - With: (*ast.With)(nil), Query: &ast.Select{ - Select: 0, - Distinct: false, - As: nil, - Results: []ast.SelectItem{ + Results: []ast.SelectItem{ &ast.ExprSelectItem{ Expr: &ast.Ident{ NamePos: 9, @@ -38,12 +33,8 @@ GROUP BY NameEnd: 44, Name: "Singers", }, - Hint: (*ast.Hint)(nil), - As: (*ast.AsAlias)(nil), - Sample: (*ast.TableSample)(nil), }, }, - Where: (*ast.Where)(nil), GroupBy: &ast.GroupBy{ Group: 45, Exprs: []ast.Expr{ @@ -59,9 +50,6 @@ GROUP BY }, }, }, - Having: (*ast.Having)(nil), - OrderBy: (*ast.OrderBy)(nil), - Limit: (*ast.Limit)(nil), }, } diff --git a/testdata/result/statement/select_singer_with_hash_join.sql.txt b/testdata/result/statement/select_singer_with_hash_join.sql.txt index 51741f24..cd61e22e 100644 --- a/testdata/result/statement/select_singer_with_hash_join.sql.txt +++ b/testdata/result/statement/select_singer_with_hash_join.sql.txt @@ -8,13 +8,8 @@ FROM ON A.SingerID = B.SingerID --- AST &ast.QueryStatement{ - Hint: (*ast.Hint)(nil), - With: (*ast.With)(nil), Query: &ast.Select{ - Select: 0, - Distinct: false, - As: nil, - Results: []ast.SelectItem{ + Results: []ast.SelectItem{ &ast.Star{ Star: 9, }, @@ -24,15 +19,13 @@ FROM Source: &ast.Join{ Op: "INNER JOIN", Method: "HASH", - Hint: (*ast.Hint)(nil), Left: &ast.TableName{ Table: &ast.Ident{ NamePos: 18, NameEnd: 25, Name: "Singers", }, - Hint: (*ast.Hint)(nil), - As: &ast.AsAlias{ + As: &ast.AsAlias{ As: -1, Alias: &ast.Ident{ NamePos: 26, @@ -40,7 +33,6 @@ FROM Name: "A", }, }, - Sample: (*ast.TableSample)(nil), }, Right: &ast.TableName{ Table: &ast.Ident{ @@ -48,8 +40,7 @@ FROM NameEnd: 49, Name: "Singers", }, - Hint: (*ast.Hint)(nil), - As: &ast.AsAlias{ + As: &ast.AsAlias{ As: -1, Alias: &ast.Ident{ NamePos: 50, @@ -57,7 +48,6 @@ FROM Name: "B", }, }, - Sample: (*ast.TableSample)(nil), }, Cond: &ast.On{ On: 54, @@ -95,11 +85,6 @@ FROM }, }, }, - Where: (*ast.Where)(nil), - GroupBy: (*ast.GroupBy)(nil), - Having: (*ast.Having)(nil), - OrderBy: (*ast.OrderBy)(nil), - Limit: (*ast.Limit)(nil), }, } diff --git a/testdata/result/statement/select_singer_with_having.sql.txt b/testdata/result/statement/select_singer_with_having.sql.txt index 9d853bd1..c0af45ac 100644 --- a/testdata/result/statement/select_singer_with_having.sql.txt +++ b/testdata/result/statement/select_singer_with_having.sql.txt @@ -10,13 +10,8 @@ HAVING --- AST &ast.QueryStatement{ - Hint: (*ast.Hint)(nil), - With: (*ast.With)(nil), Query: &ast.Select{ - Select: 0, - Distinct: false, - As: nil, - Results: []ast.SelectItem{ + Results: []ast.SelectItem{ &ast.ExprSelectItem{ Expr: &ast.Ident{ NamePos: 9, @@ -33,12 +28,8 @@ HAVING NameEnd: 32, Name: "Singers", }, - Hint: (*ast.Hint)(nil), - As: (*ast.AsAlias)(nil), - Sample: (*ast.TableSample)(nil), }, }, - Where: (*ast.Where)(nil), GroupBy: &ast.GroupBy{ Group: 33, Exprs: []ast.Expr{ @@ -66,8 +57,6 @@ HAVING }, }, }, - OrderBy: (*ast.OrderBy)(nil), - Limit: (*ast.Limit)(nil), }, } diff --git a/testdata/result/statement/select_singer_with_in_and_unnest.sql.txt b/testdata/result/statement/select_singer_with_in_and_unnest.sql.txt index ac358ab5..c410d65a 100644 --- a/testdata/result/statement/select_singer_with_in_and_unnest.sql.txt +++ b/testdata/result/statement/select_singer_with_in_and_unnest.sql.txt @@ -8,13 +8,8 @@ WHERE --- AST &ast.QueryStatement{ - Hint: (*ast.Hint)(nil), - With: (*ast.With)(nil), Query: &ast.Select{ - Select: 0, - Distinct: false, - As: nil, - Results: []ast.SelectItem{ + Results: []ast.SelectItem{ &ast.Star{ Star: 9, }, @@ -27,15 +22,11 @@ WHERE NameEnd: 25, Name: "Singers", }, - Hint: (*ast.Hint)(nil), - As: (*ast.AsAlias)(nil), - Sample: (*ast.TableSample)(nil), }, }, Where: &ast.Where{ Where: 26, Expr: &ast.InExpr{ - Not: false, Left: &ast.Ident{ NamePos: 34, NameEnd: 42, @@ -48,7 +39,6 @@ WHERE Array: 53, Lbrack: 58, Rbrack: 66, - Type: nil, Values: []ast.Expr{ &ast.IntLiteral{ ValuePos: 59, @@ -73,10 +63,6 @@ WHERE }, }, }, - GroupBy: (*ast.GroupBy)(nil), - Having: (*ast.Having)(nil), - OrderBy: (*ast.OrderBy)(nil), - Limit: (*ast.Limit)(nil), }, } diff --git a/testdata/result/statement/select_singer_with_in_and_unnest_with_query_parameter.sql.txt b/testdata/result/statement/select_singer_with_in_and_unnest_with_query_parameter.sql.txt index 456d2286..293e2401 100644 --- a/testdata/result/statement/select_singer_with_in_and_unnest_with_query_parameter.sql.txt +++ b/testdata/result/statement/select_singer_with_in_and_unnest_with_query_parameter.sql.txt @@ -8,13 +8,8 @@ WHERE --- AST &ast.QueryStatement{ - Hint: (*ast.Hint)(nil), - With: (*ast.With)(nil), Query: &ast.Select{ - Select: 0, - Distinct: false, - As: nil, - Results: []ast.SelectItem{ + Results: []ast.SelectItem{ &ast.Star{ Star: 9, }, @@ -27,15 +22,11 @@ WHERE NameEnd: 25, Name: "Singers", }, - Hint: (*ast.Hint)(nil), - As: (*ast.AsAlias)(nil), - Sample: (*ast.TableSample)(nil), }, }, Where: &ast.Where{ Where: 26, Expr: &ast.InExpr{ - Not: false, Left: &ast.Ident{ NamePos: 34, NameEnd: 42, @@ -51,10 +42,6 @@ WHERE }, }, }, - GroupBy: (*ast.GroupBy)(nil), - Having: (*ast.Having)(nil), - OrderBy: (*ast.OrderBy)(nil), - Limit: (*ast.Limit)(nil), }, } diff --git a/testdata/result/statement/select_singer_with_join.sql.txt b/testdata/result/statement/select_singer_with_join.sql.txt index ab573b3f..70831a2f 100644 --- a/testdata/result/statement/select_singer_with_join.sql.txt +++ b/testdata/result/statement/select_singer_with_join.sql.txt @@ -9,13 +9,8 @@ FROM --- AST &ast.QueryStatement{ - Hint: (*ast.Hint)(nil), - With: (*ast.With)(nil), Query: &ast.Select{ - Select: 0, - Distinct: false, - As: nil, - Results: []ast.SelectItem{ + Results: []ast.SelectItem{ &ast.Star{ Star: 9, }, @@ -23,17 +18,14 @@ FROM From: &ast.From{ From: 11, Source: &ast.Join{ - Op: "LEFT OUTER JOIN", - Method: "", - Hint: (*ast.Hint)(nil), - Left: &ast.TableName{ + Op: "LEFT OUTER JOIN", + Left: &ast.TableName{ Table: &ast.Ident{ NamePos: 18, NameEnd: 25, Name: "Singers", }, - Hint: (*ast.Hint)(nil), - As: &ast.AsAlias{ + As: &ast.AsAlias{ As: -1, Alias: &ast.Ident{ NamePos: 26, @@ -41,7 +33,6 @@ FROM Name: "A", }, }, - Sample: (*ast.TableSample)(nil), }, Right: &ast.TableName{ Table: &ast.Ident{ @@ -49,8 +40,7 @@ FROM NameEnd: 55, Name: "Singers", }, - Hint: (*ast.Hint)(nil), - As: &ast.AsAlias{ + As: &ast.AsAlias{ As: -1, Alias: &ast.Ident{ NamePos: 56, @@ -58,7 +48,6 @@ FROM Name: "B", }, }, - Sample: (*ast.TableSample)(nil), }, Cond: &ast.On{ On: 60, @@ -96,11 +85,6 @@ FROM }, }, }, - Where: (*ast.Where)(nil), - GroupBy: (*ast.GroupBy)(nil), - Having: (*ast.Having)(nil), - OrderBy: (*ast.OrderBy)(nil), - Limit: (*ast.Limit)(nil), }, } diff --git a/testdata/result/statement/select_singer_with_join_hint.sql.txt b/testdata/result/statement/select_singer_with_join_hint.sql.txt index 92a14a85..272a54be 100644 --- a/testdata/result/statement/select_singer_with_join_hint.sql.txt +++ b/testdata/result/statement/select_singer_with_join_hint.sql.txt @@ -18,13 +18,8 @@ FROM --- AST &ast.QueryStatement{ - Hint: (*ast.Hint)(nil), - With: (*ast.With)(nil), Query: &ast.Select{ - Select: 0, - Distinct: false, - As: nil, - Results: []ast.SelectItem{ + Results: []ast.SelectItem{ &ast.Star{ Star: 9, }, @@ -32,9 +27,8 @@ FROM From: &ast.From{ From: 11, Source: &ast.Join{ - Op: "INNER JOIN", - Method: "", - Hint: &ast.Hint{ + Op: "INNER JOIN", + Hint: &ast.Hint{ Atmark: 258, Rbrace: 279, Records: []*ast.HintRecord{ @@ -53,9 +47,8 @@ FROM }, }, Left: &ast.Join{ - Op: "INNER JOIN", - Method: "", - Hint: &ast.Hint{ + Op: "INNER JOIN", + Hint: &ast.Hint{ Atmark: 187, Rbrace: 209, Records: []*ast.HintRecord{ @@ -74,9 +67,8 @@ FROM }, }, Left: &ast.Join{ - Op: "INNER JOIN", - Method: "", - Hint: &ast.Hint{ + Op: "INNER JOIN", + Hint: &ast.Hint{ Atmark: 117, Rbrace: 138, Records: []*ast.HintRecord{ @@ -95,9 +87,8 @@ FROM }, }, Left: &ast.Join{ - Op: "LEFT OUTER JOIN", - Method: "", - Hint: &ast.Hint{ + Op: "LEFT OUTER JOIN", + Hint: &ast.Hint{ Atmark: 45, Rbrace: 68, Records: []*ast.HintRecord{ @@ -120,8 +111,7 @@ FROM NameEnd: 25, Name: "Singers", }, - Hint: (*ast.Hint)(nil), - As: &ast.AsAlias{ + As: &ast.AsAlias{ As: -1, Alias: &ast.Ident{ NamePos: 26, @@ -129,7 +119,6 @@ FROM Name: "A", }, }, - Sample: (*ast.TableSample)(nil), }, Right: &ast.TableName{ Table: &ast.Ident{ @@ -137,8 +126,7 @@ FROM NameEnd: 79, Name: "Singers", }, - Hint: (*ast.Hint)(nil), - As: &ast.AsAlias{ + As: &ast.AsAlias{ As: -1, Alias: &ast.Ident{ NamePos: 80, @@ -146,7 +134,6 @@ FROM Name: "B", }, }, - Sample: (*ast.TableSample)(nil), }, Cond: &ast.On{ On: 84, @@ -189,8 +176,7 @@ FROM NameEnd: 149, Name: "Singers", }, - Hint: (*ast.Hint)(nil), - As: &ast.AsAlias{ + As: &ast.AsAlias{ As: -1, Alias: &ast.Ident{ NamePos: 150, @@ -198,7 +184,6 @@ FROM Name: "C", }, }, - Sample: (*ast.TableSample)(nil), }, Cond: &ast.On{ On: 154, @@ -241,8 +226,7 @@ FROM NameEnd: 220, Name: "Singers", }, - Hint: (*ast.Hint)(nil), - As: &ast.AsAlias{ + As: &ast.AsAlias{ As: -1, Alias: &ast.Ident{ NamePos: 221, @@ -250,7 +234,6 @@ FROM Name: "D", }, }, - Sample: (*ast.TableSample)(nil), }, Cond: &ast.On{ On: 225, @@ -293,8 +276,7 @@ FROM NameEnd: 290, Name: "Singers", }, - Hint: (*ast.Hint)(nil), - As: &ast.AsAlias{ + As: &ast.AsAlias{ As: -1, Alias: &ast.Ident{ NamePos: 291, @@ -302,7 +284,6 @@ FROM Name: "E", }, }, - Sample: (*ast.TableSample)(nil), }, Cond: &ast.On{ On: 295, @@ -340,11 +321,6 @@ FROM }, }, }, - Where: (*ast.Where)(nil), - GroupBy: (*ast.GroupBy)(nil), - Having: (*ast.Having)(nil), - OrderBy: (*ast.OrderBy)(nil), - Limit: (*ast.Limit)(nil), }, } diff --git a/testdata/result/statement/select_singer_with_join_twice.sql.txt b/testdata/result/statement/select_singer_with_join_twice.sql.txt index 035780a4..c2f8e6dd 100644 --- a/testdata/result/statement/select_singer_with_join_twice.sql.txt +++ b/testdata/result/statement/select_singer_with_join_twice.sql.txt @@ -12,13 +12,8 @@ FROM --- AST &ast.QueryStatement{ - Hint: (*ast.Hint)(nil), - With: (*ast.With)(nil), Query: &ast.Select{ - Select: 0, - Distinct: false, - As: nil, - Results: []ast.SelectItem{ + Results: []ast.SelectItem{ &ast.Star{ Star: 9, }, @@ -26,21 +21,16 @@ FROM From: &ast.From{ From: 11, Source: &ast.Join{ - Op: "INNER JOIN", - Method: "", - Hint: (*ast.Hint)(nil), - Left: &ast.Join{ - Op: "INNER JOIN", - Method: "", - Hint: (*ast.Hint)(nil), - Left: &ast.TableName{ + Op: "INNER JOIN", + Left: &ast.Join{ + Op: "INNER JOIN", + Left: &ast.TableName{ Table: &ast.Ident{ NamePos: 18, NameEnd: 25, Name: "Singers", }, - Hint: (*ast.Hint)(nil), - As: &ast.AsAlias{ + As: &ast.AsAlias{ As: -1, Alias: &ast.Ident{ NamePos: 26, @@ -48,7 +38,6 @@ FROM Name: "A", }, }, - Sample: (*ast.TableSample)(nil), }, Right: &ast.TableName{ Table: &ast.Ident{ @@ -56,8 +45,7 @@ FROM NameEnd: 44, Name: "Singers", }, - Hint: (*ast.Hint)(nil), - As: &ast.AsAlias{ + As: &ast.AsAlias{ As: -1, Alias: &ast.Ident{ NamePos: 45, @@ -65,7 +53,6 @@ FROM Name: "B", }, }, - Sample: (*ast.TableSample)(nil), }, Cond: &ast.On{ On: 49, @@ -108,8 +95,7 @@ FROM NameEnd: 98, Name: "Singers", }, - Hint: (*ast.Hint)(nil), - As: &ast.AsAlias{ + As: &ast.AsAlias{ As: -1, Alias: &ast.Ident{ NamePos: 99, @@ -117,7 +103,6 @@ FROM Name: "C", }, }, - Sample: (*ast.TableSample)(nil), }, Cond: &ast.On{ On: 103, @@ -155,11 +140,6 @@ FROM }, }, }, - Where: (*ast.Where)(nil), - GroupBy: (*ast.GroupBy)(nil), - Having: (*ast.Having)(nil), - OrderBy: (*ast.OrderBy)(nil), - Limit: (*ast.Limit)(nil), }, } diff --git a/testdata/result/statement/select_singer_with_join_using.sql.txt b/testdata/result/statement/select_singer_with_join_using.sql.txt index e37df1cb..a68579f7 100644 --- a/testdata/result/statement/select_singer_with_join_using.sql.txt +++ b/testdata/result/statement/select_singer_with_join_using.sql.txt @@ -9,13 +9,8 @@ FROM --- AST &ast.QueryStatement{ - Hint: (*ast.Hint)(nil), - With: (*ast.With)(nil), Query: &ast.Select{ - Select: 0, - Distinct: false, - As: nil, - Results: []ast.SelectItem{ + Results: []ast.SelectItem{ &ast.Star{ Star: 9, }, @@ -23,17 +18,14 @@ FROM From: &ast.From{ From: 11, Source: &ast.Join{ - Op: "LEFT OUTER JOIN", - Method: "", - Hint: (*ast.Hint)(nil), - Left: &ast.TableName{ + Op: "LEFT OUTER JOIN", + Left: &ast.TableName{ Table: &ast.Ident{ NamePos: 18, NameEnd: 25, Name: "Singers", }, - Hint: (*ast.Hint)(nil), - As: &ast.AsAlias{ + As: &ast.AsAlias{ As: -1, Alias: &ast.Ident{ NamePos: 26, @@ -41,7 +33,6 @@ FROM Name: "A", }, }, - Sample: (*ast.TableSample)(nil), }, Right: &ast.TableName{ Table: &ast.Ident{ @@ -49,8 +40,7 @@ FROM NameEnd: 55, Name: "Singers", }, - Hint: (*ast.Hint)(nil), - As: &ast.AsAlias{ + As: &ast.AsAlias{ As: -1, Alias: &ast.Ident{ NamePos: 56, @@ -58,7 +48,6 @@ FROM Name: "B", }, }, - Sample: (*ast.TableSample)(nil), }, Cond: &ast.Using{ Using: 60, @@ -78,11 +67,6 @@ FROM }, }, }, - Where: (*ast.Where)(nil), - GroupBy: (*ast.GroupBy)(nil), - Having: (*ast.Having)(nil), - OrderBy: (*ast.OrderBy)(nil), - Limit: (*ast.Limit)(nil), }, } diff --git a/testdata/result/statement/select_singer_with_join_various.sql.txt b/testdata/result/statement/select_singer_with_join_various.sql.txt index 45d847b9..17f7be5a 100644 --- a/testdata/result/statement/select_singer_with_join_various.sql.txt +++ b/testdata/result/statement/select_singer_with_join_various.sql.txt @@ -32,13 +32,8 @@ FROM --- AST &ast.QueryStatement{ - Hint: (*ast.Hint)(nil), - With: (*ast.With)(nil), Query: &ast.Select{ - Select: 0, - Distinct: false, - As: nil, - Results: []ast.SelectItem{ + Results: []ast.SelectItem{ &ast.Star{ Star: 9, }, @@ -46,49 +41,30 @@ FROM From: &ast.From{ From: 11, Source: &ast.Join{ - Op: "RIGHT OUTER JOIN", - Method: "", - Hint: (*ast.Hint)(nil), - Left: &ast.Join{ - Op: "RIGHT OUTER JOIN", - Method: "", - Hint: (*ast.Hint)(nil), - Left: &ast.Join{ - Op: "LEFT OUTER JOIN", - Method: "", - Hint: (*ast.Hint)(nil), - Left: &ast.Join{ - Op: "LEFT OUTER JOIN", - Method: "", - Hint: (*ast.Hint)(nil), - Left: &ast.Join{ - Op: "FULL OUTER JOIN", - Method: "", - Hint: (*ast.Hint)(nil), - Left: &ast.Join{ - Op: "FULL OUTER JOIN", - Method: "", - Hint: (*ast.Hint)(nil), - Left: &ast.Join{ - Op: "CROSS JOIN", - Method: "", - Hint: (*ast.Hint)(nil), - Left: &ast.Join{ - Op: "INNER JOIN", - Method: "", - Hint: (*ast.Hint)(nil), - Left: &ast.Join{ - Op: "INNER JOIN", - Method: "", - Hint: (*ast.Hint)(nil), - Left: &ast.TableName{ + Op: "RIGHT OUTER JOIN", + Left: &ast.Join{ + Op: "RIGHT OUTER JOIN", + Left: &ast.Join{ + Op: "LEFT OUTER JOIN", + Left: &ast.Join{ + Op: "LEFT OUTER JOIN", + Left: &ast.Join{ + Op: "FULL OUTER JOIN", + Left: &ast.Join{ + Op: "FULL OUTER JOIN", + Left: &ast.Join{ + Op: "CROSS JOIN", + Left: &ast.Join{ + Op: "INNER JOIN", + Left: &ast.Join{ + Op: "INNER JOIN", + Left: &ast.TableName{ Table: &ast.Ident{ NamePos: 18, NameEnd: 25, Name: "Singers", }, - Hint: (*ast.Hint)(nil), - As: &ast.AsAlias{ + As: &ast.AsAlias{ As: -1, Alias: &ast.Ident{ NamePos: 26, @@ -96,7 +72,6 @@ FROM Name: "A", }, }, - Sample: (*ast.TableSample)(nil), }, Right: &ast.TableName{ Table: &ast.Ident{ @@ -104,8 +79,7 @@ FROM NameEnd: 44, Name: "Singers", }, - Hint: (*ast.Hint)(nil), - As: &ast.AsAlias{ + As: &ast.AsAlias{ As: -1, Alias: &ast.Ident{ NamePos: 45, @@ -113,7 +87,6 @@ FROM Name: "B", }, }, - Sample: (*ast.TableSample)(nil), }, Cond: &ast.On{ On: 49, @@ -156,8 +129,7 @@ FROM NameEnd: 98, Name: "Singers", }, - Hint: (*ast.Hint)(nil), - As: &ast.AsAlias{ + As: &ast.AsAlias{ As: -1, Alias: &ast.Ident{ NamePos: 99, @@ -165,7 +137,6 @@ FROM Name: "C", }, }, - Sample: (*ast.TableSample)(nil), }, Cond: &ast.On{ On: 103, @@ -208,8 +179,7 @@ FROM NameEnd: 152, Name: "Singers", }, - Hint: (*ast.Hint)(nil), - As: &ast.AsAlias{ + As: &ast.AsAlias{ As: -1, Alias: &ast.Ident{ NamePos: 153, @@ -217,9 +187,7 @@ FROM Name: "D", }, }, - Sample: (*ast.TableSample)(nil), }, - Cond: nil, }, Right: &ast.TableName{ Table: &ast.Ident{ @@ -227,8 +195,7 @@ FROM NameEnd: 176, Name: "Singers", }, - Hint: (*ast.Hint)(nil), - As: &ast.AsAlias{ + As: &ast.AsAlias{ As: -1, Alias: &ast.Ident{ NamePos: 177, @@ -236,7 +203,6 @@ FROM Name: "E", }, }, - Sample: (*ast.TableSample)(nil), }, Cond: &ast.On{ On: 181, @@ -279,8 +245,7 @@ FROM NameEnd: 235, Name: "Singers", }, - Hint: (*ast.Hint)(nil), - As: &ast.AsAlias{ + As: &ast.AsAlias{ As: -1, Alias: &ast.Ident{ NamePos: 236, @@ -288,7 +253,6 @@ FROM Name: "F", }, }, - Sample: (*ast.TableSample)(nil), }, Cond: &ast.On{ On: 240, @@ -331,8 +295,7 @@ FROM NameEnd: 288, Name: "Singers", }, - Hint: (*ast.Hint)(nil), - As: &ast.AsAlias{ + As: &ast.AsAlias{ As: -1, Alias: &ast.Ident{ NamePos: 289, @@ -340,7 +303,6 @@ FROM Name: "G", }, }, - Sample: (*ast.TableSample)(nil), }, Cond: &ast.On{ On: 293, @@ -383,8 +345,7 @@ FROM NameEnd: 347, Name: "Singers", }, - Hint: (*ast.Hint)(nil), - As: &ast.AsAlias{ + As: &ast.AsAlias{ As: -1, Alias: &ast.Ident{ NamePos: 348, @@ -392,7 +353,6 @@ FROM Name: "H", }, }, - Sample: (*ast.TableSample)(nil), }, Cond: &ast.On{ On: 352, @@ -435,8 +395,7 @@ FROM NameEnd: 401, Name: "Singers", }, - Hint: (*ast.Hint)(nil), - As: &ast.AsAlias{ + As: &ast.AsAlias{ As: -1, Alias: &ast.Ident{ NamePos: 402, @@ -444,7 +403,6 @@ FROM Name: "I", }, }, - Sample: (*ast.TableSample)(nil), }, Cond: &ast.On{ On: 406, @@ -487,8 +445,7 @@ FROM NameEnd: 461, Name: "Singers", }, - Hint: (*ast.Hint)(nil), - As: &ast.AsAlias{ + As: &ast.AsAlias{ As: -1, Alias: &ast.Ident{ NamePos: 462, @@ -496,7 +453,6 @@ FROM Name: "J", }, }, - Sample: (*ast.TableSample)(nil), }, Cond: &ast.On{ On: 466, @@ -534,11 +490,6 @@ FROM }, }, }, - Where: (*ast.Where)(nil), - GroupBy: (*ast.GroupBy)(nil), - Having: (*ast.Having)(nil), - OrderBy: (*ast.OrderBy)(nil), - Limit: (*ast.Limit)(nil), }, } diff --git a/testdata/result/statement/select_singer_with_limit.sql.txt b/testdata/result/statement/select_singer_with_limit.sql.txt index 388574d4..b218c210 100644 --- a/testdata/result/statement/select_singer_with_limit.sql.txt +++ b/testdata/result/statement/select_singer_with_limit.sql.txt @@ -7,13 +7,8 @@ LIMIT 100 --- AST &ast.QueryStatement{ - Hint: (*ast.Hint)(nil), - With: (*ast.With)(nil), Query: &ast.Select{ - Select: 0, - Distinct: false, - As: nil, - Results: []ast.SelectItem{ + Results: []ast.SelectItem{ &ast.Star{ Star: 9, }, @@ -26,16 +21,9 @@ LIMIT 100 NameEnd: 25, Name: "Singers", }, - Hint: (*ast.Hint)(nil), - As: (*ast.AsAlias)(nil), - Sample: (*ast.TableSample)(nil), }, }, - Where: (*ast.Where)(nil), - GroupBy: (*ast.GroupBy)(nil), - Having: (*ast.Having)(nil), - OrderBy: (*ast.OrderBy)(nil), - Limit: &ast.Limit{ + Limit: &ast.Limit{ Limit: 26, Count: &ast.IntLiteral{ ValuePos: 32, @@ -43,7 +31,6 @@ LIMIT 100 Base: 10, Value: "100", }, - Offset: (*ast.Offset)(nil), }, }, } diff --git a/testdata/result/statement/select_singer_with_limit_and_skiprows.sql.txt b/testdata/result/statement/select_singer_with_limit_and_skiprows.sql.txt index f1293a6a..70c56b1f 100644 --- a/testdata/result/statement/select_singer_with_limit_and_skiprows.sql.txt +++ b/testdata/result/statement/select_singer_with_limit_and_skiprows.sql.txt @@ -8,13 +8,8 @@ OFFSET 10 --- AST &ast.QueryStatement{ - Hint: (*ast.Hint)(nil), - With: (*ast.With)(nil), Query: &ast.Select{ - Select: 0, - Distinct: false, - As: nil, - Results: []ast.SelectItem{ + Results: []ast.SelectItem{ &ast.Star{ Star: 9, }, @@ -27,16 +22,9 @@ OFFSET 10 NameEnd: 25, Name: "Singers", }, - Hint: (*ast.Hint)(nil), - As: (*ast.AsAlias)(nil), - Sample: (*ast.TableSample)(nil), }, }, - Where: (*ast.Where)(nil), - GroupBy: (*ast.GroupBy)(nil), - Having: (*ast.Having)(nil), - OrderBy: (*ast.OrderBy)(nil), - Limit: &ast.Limit{ + Limit: &ast.Limit{ Limit: 26, Count: &ast.IntLiteral{ ValuePos: 32, diff --git a/testdata/result/statement/select_singer_with_orderby.sql.txt b/testdata/result/statement/select_singer_with_orderby.sql.txt index 564ee7f5..5172b5f3 100644 --- a/testdata/result/statement/select_singer_with_orderby.sql.txt +++ b/testdata/result/statement/select_singer_with_orderby.sql.txt @@ -9,13 +9,8 @@ ORDER BY BirthDate DESC --- AST &ast.QueryStatement{ - Hint: (*ast.Hint)(nil), - With: (*ast.With)(nil), Query: &ast.Select{ - Select: 0, - Distinct: false, - As: nil, - Results: []ast.SelectItem{ + Results: []ast.SelectItem{ &ast.Star{ Star: 9, }, @@ -28,14 +23,8 @@ ORDER BY NameEnd: 25, Name: "Singers", }, - Hint: (*ast.Hint)(nil), - As: (*ast.AsAlias)(nil), - Sample: (*ast.TableSample)(nil), }, }, - Where: (*ast.Where)(nil), - GroupBy: (*ast.GroupBy)(nil), - Having: (*ast.Having)(nil), OrderBy: &ast.OrderBy{ Order: 26, Items: []*ast.OrderByItem{ @@ -46,8 +35,6 @@ ORDER BY NameEnd: 46, Name: "FirstName", }, - Collate: (*ast.Collate)(nil), - Dir: "", }, &ast.OrderByItem{ DirPos: -1, @@ -64,7 +51,6 @@ ORDER BY Value: "en_US", }, }, - Dir: "", }, &ast.OrderByItem{ DirPos: 88, @@ -73,12 +59,10 @@ ORDER BY NameEnd: 87, Name: "BirthDate", }, - Collate: (*ast.Collate)(nil), - Dir: "DESC", + Dir: "DESC", }, }, }, - Limit: (*ast.Limit)(nil), }, } diff --git a/testdata/result/statement/select_singer_with_query_parameter.sql.txt b/testdata/result/statement/select_singer_with_query_parameter.sql.txt index 3ec0effb..6eb90de2 100644 --- a/testdata/result/statement/select_singer_with_query_parameter.sql.txt +++ b/testdata/result/statement/select_singer_with_query_parameter.sql.txt @@ -9,13 +9,8 @@ WHERE --- AST &ast.QueryStatement{ - Hint: (*ast.Hint)(nil), - With: (*ast.With)(nil), Query: &ast.Select{ - Select: 0, - Distinct: false, - As: nil, - Results: []ast.SelectItem{ + Results: []ast.SelectItem{ &ast.Star{ Star: 9, }, @@ -28,9 +23,6 @@ WHERE NameEnd: 25, Name: "Singers", }, - Hint: (*ast.Hint)(nil), - As: (*ast.AsAlias)(nil), - Sample: (*ast.TableSample)(nil), }, }, Where: &ast.Where{ @@ -63,10 +55,6 @@ WHERE }, }, }, - GroupBy: (*ast.GroupBy)(nil), - Having: (*ast.Having)(nil), - OrderBy: (*ast.OrderBy)(nil), - Limit: (*ast.Limit)(nil), }, } diff --git a/testdata/result/statement/select_singer_with_root_parent.sql.txt b/testdata/result/statement/select_singer_with_root_parent.sql.txt index 0347bbaf..967a4a9e 100644 --- a/testdata/result/statement/select_singer_with_root_parent.sql.txt +++ b/testdata/result/statement/select_singer_with_root_parent.sql.txt @@ -3,16 +3,11 @@ --- AST &ast.QueryStatement{ - Hint: (*ast.Hint)(nil), - With: (*ast.With)(nil), Query: &ast.SubQuery{ - Lparen: 0, Rparen: 24, Query: &ast.Select{ - Select: 2, - Distinct: false, - As: nil, - Results: []ast.SelectItem{ + Select: 2, + Results: []ast.SelectItem{ &ast.Star{ Star: 9, }, @@ -25,19 +20,9 @@ NameEnd: 23, Name: "Singers", }, - Hint: (*ast.Hint)(nil), - As: (*ast.AsAlias)(nil), - Sample: (*ast.TableSample)(nil), }, }, - Where: (*ast.Where)(nil), - GroupBy: (*ast.GroupBy)(nil), - Having: (*ast.Having)(nil), - OrderBy: (*ast.OrderBy)(nil), - Limit: (*ast.Limit)(nil), }, - OrderBy: (*ast.OrderBy)(nil), - Limit: (*ast.Limit)(nil), }, } diff --git a/testdata/result/statement/select_singer_with_select_in_from.sql.txt b/testdata/result/statement/select_singer_with_select_in_from.sql.txt index 6502a2a8..8945f214 100644 --- a/testdata/result/statement/select_singer_with_select_in_from.sql.txt +++ b/testdata/result/statement/select_singer_with_select_in_from.sql.txt @@ -12,13 +12,8 @@ FROM ( --- AST &ast.QueryStatement{ - Hint: (*ast.Hint)(nil), - With: (*ast.With)(nil), Query: &ast.Select{ - Select: 0, - Distinct: false, - As: nil, - Results: []ast.SelectItem{ + Results: []ast.SelectItem{ &ast.Star{ Star: 9, }, @@ -29,10 +24,8 @@ FROM ( Lparen: 16, Rparen: 77, Query: &ast.Select{ - Select: 20, - Distinct: false, - As: nil, - Results: []ast.SelectItem{ + Select: 20, + Results: []ast.SelectItem{ &ast.Star{ Star: 31, }, @@ -45,9 +38,6 @@ FROM ( NameEnd: 51, Name: "Singers", }, - Hint: (*ast.Hint)(nil), - As: (*ast.AsAlias)(nil), - Sample: (*ast.TableSample)(nil), }, }, Where: &ast.Where{ @@ -67,20 +57,9 @@ FROM ( }, }, }, - GroupBy: (*ast.GroupBy)(nil), - Having: (*ast.Having)(nil), - OrderBy: (*ast.OrderBy)(nil), - Limit: (*ast.Limit)(nil), }, - As: (*ast.AsAlias)(nil), - Sample: (*ast.TableSample)(nil), }, }, - Where: (*ast.Where)(nil), - GroupBy: (*ast.GroupBy)(nil), - Having: (*ast.Having)(nil), - OrderBy: (*ast.OrderBy)(nil), - Limit: (*ast.Limit)(nil), }, } diff --git a/testdata/result/statement/select_singer_with_select_in_from_and_as.sql.txt b/testdata/result/statement/select_singer_with_select_in_from_and_as.sql.txt index fda2490e..7b5f6b4b 100644 --- a/testdata/result/statement/select_singer_with_select_in_from_and_as.sql.txt +++ b/testdata/result/statement/select_singer_with_select_in_from_and_as.sql.txt @@ -12,13 +12,8 @@ FROM ( --- AST &ast.QueryStatement{ - Hint: (*ast.Hint)(nil), - With: (*ast.With)(nil), Query: &ast.Select{ - Select: 0, - Distinct: false, - As: nil, - Results: []ast.SelectItem{ + Results: []ast.SelectItem{ &ast.Star{ Star: 9, }, @@ -29,10 +24,8 @@ FROM ( Lparen: 16, Rparen: 77, Query: &ast.Select{ - Select: 20, - Distinct: false, - As: nil, - Results: []ast.SelectItem{ + Select: 20, + Results: []ast.SelectItem{ &ast.Star{ Star: 31, }, @@ -45,9 +38,6 @@ FROM ( NameEnd: 51, Name: "Singers", }, - Hint: (*ast.Hint)(nil), - As: (*ast.AsAlias)(nil), - Sample: (*ast.TableSample)(nil), }, }, Where: &ast.Where{ @@ -67,10 +57,6 @@ FROM ( }, }, }, - GroupBy: (*ast.GroupBy)(nil), - Having: (*ast.Having)(nil), - OrderBy: (*ast.OrderBy)(nil), - Limit: (*ast.Limit)(nil), }, As: &ast.AsAlias{ As: 79, @@ -80,14 +66,8 @@ FROM ( Name: "S", }, }, - Sample: (*ast.TableSample)(nil), }, }, - Where: (*ast.Where)(nil), - GroupBy: (*ast.GroupBy)(nil), - Having: (*ast.Having)(nil), - OrderBy: (*ast.OrderBy)(nil), - Limit: (*ast.Limit)(nil), }, } diff --git a/testdata/result/statement/select_singer_with_single_column_subquery.sql.txt b/testdata/result/statement/select_singer_with_single_column_subquery.sql.txt index 976b4b8a..922f1ac1 100644 --- a/testdata/result/statement/select_singer_with_single_column_subquery.sql.txt +++ b/testdata/result/statement/select_singer_with_single_column_subquery.sql.txt @@ -6,22 +6,15 @@ SELECT ( --- AST &ast.QueryStatement{ - Hint: (*ast.Hint)(nil), - With: (*ast.With)(nil), Query: &ast.Select{ - Select: 0, - Distinct: false, - As: nil, - Results: []ast.SelectItem{ + Results: []ast.SelectItem{ &ast.ExprSelectItem{ Expr: &ast.ScalarSubQuery{ Lparen: 7, Rparen: 53, Query: &ast.Select{ - Select: 11, - Distinct: false, - As: nil, - Results: []ast.SelectItem{ + Select: 11, + Results: []ast.SelectItem{ &ast.ExprSelectItem{ Expr: &ast.Ident{ NamePos: 18, @@ -38,16 +31,9 @@ SELECT ( NameEnd: 42, Name: "Singers", }, - Hint: (*ast.Hint)(nil), - As: (*ast.AsAlias)(nil), - Sample: (*ast.TableSample)(nil), }, }, - Where: (*ast.Where)(nil), - GroupBy: (*ast.GroupBy)(nil), - Having: (*ast.Having)(nil), - OrderBy: (*ast.OrderBy)(nil), - Limit: &ast.Limit{ + Limit: &ast.Limit{ Limit: 43, Count: &ast.IntLiteral{ ValuePos: 49, @@ -55,18 +41,11 @@ SELECT ( Base: 10, Value: "100", }, - Offset: (*ast.Offset)(nil), }, }, }, }, }, - From: (*ast.From)(nil), - Where: (*ast.Where)(nil), - GroupBy: (*ast.GroupBy)(nil), - Having: (*ast.Having)(nil), - OrderBy: (*ast.OrderBy)(nil), - Limit: (*ast.Limit)(nil), }, } diff --git a/testdata/result/statement/select_singer_with_single_column_subquery_with_at.sql.txt b/testdata/result/statement/select_singer_with_single_column_subquery_with_at.sql.txt index c420f982..9a8668f3 100644 --- a/testdata/result/statement/select_singer_with_single_column_subquery_with_at.sql.txt +++ b/testdata/result/statement/select_singer_with_single_column_subquery_with_at.sql.txt @@ -6,22 +6,15 @@ SELECT ( --- AST &ast.QueryStatement{ - Hint: (*ast.Hint)(nil), - With: (*ast.With)(nil), Query: &ast.Select{ - Select: 0, - Distinct: false, - As: nil, - Results: []ast.SelectItem{ + Results: []ast.SelectItem{ &ast.Alias{ Expr: &ast.ScalarSubQuery{ Lparen: 7, Rparen: 53, Query: &ast.Select{ - Select: 11, - Distinct: false, - As: nil, - Results: []ast.SelectItem{ + Select: 11, + Results: []ast.SelectItem{ &ast.ExprSelectItem{ Expr: &ast.Ident{ NamePos: 18, @@ -38,16 +31,9 @@ SELECT ( NameEnd: 42, Name: "Singers", }, - Hint: (*ast.Hint)(nil), - As: (*ast.AsAlias)(nil), - Sample: (*ast.TableSample)(nil), }, }, - Where: (*ast.Where)(nil), - GroupBy: (*ast.GroupBy)(nil), - Having: (*ast.Having)(nil), - OrderBy: (*ast.OrderBy)(nil), - Limit: &ast.Limit{ + Limit: &ast.Limit{ Limit: 43, Count: &ast.IntLiteral{ ValuePos: 49, @@ -55,7 +41,6 @@ SELECT ( Base: 10, Value: "100", }, - Offset: (*ast.Offset)(nil), }, }, }, @@ -69,12 +54,6 @@ SELECT ( }, }, }, - From: (*ast.From)(nil), - Where: (*ast.Where)(nil), - GroupBy: (*ast.GroupBy)(nil), - Having: (*ast.Having)(nil), - OrderBy: (*ast.OrderBy)(nil), - Limit: (*ast.Limit)(nil), }, } diff --git a/testdata/result/statement/select_singer_with_table_alias.sql.txt b/testdata/result/statement/select_singer_with_table_alias.sql.txt index 190521fb..e4423eb7 100644 --- a/testdata/result/statement/select_singer_with_table_alias.sql.txt +++ b/testdata/result/statement/select_singer_with_table_alias.sql.txt @@ -7,13 +7,8 @@ FROM Singers S --- AST &ast.QueryStatement{ - Hint: (*ast.Hint)(nil), - With: (*ast.With)(nil), Query: &ast.Select{ - Select: 0, - Distinct: false, - As: nil, - Results: []ast.SelectItem{ + Results: []ast.SelectItem{ &ast.DotStar{ Star: 11, Expr: &ast.Ident{ @@ -71,8 +66,7 @@ FROM Singers S NameEnd: 60, Name: "Singers", }, - Hint: (*ast.Hint)(nil), - As: &ast.AsAlias{ + As: &ast.AsAlias{ As: -1, Alias: &ast.Ident{ NamePos: 61, @@ -80,14 +74,8 @@ FROM Singers S Name: "S", }, }, - Sample: (*ast.TableSample)(nil), }, }, - Where: (*ast.Where)(nil), - GroupBy: (*ast.GroupBy)(nil), - Having: (*ast.Having)(nil), - OrderBy: (*ast.OrderBy)(nil), - Limit: (*ast.Limit)(nil), }, } diff --git a/testdata/result/statement/select_singer_with_table_alias_with_hint.sql.txt b/testdata/result/statement/select_singer_with_table_alias_with_hint.sql.txt index 3d72f5bf..0632d7a7 100644 --- a/testdata/result/statement/select_singer_with_table_alias_with_hint.sql.txt +++ b/testdata/result/statement/select_singer_with_table_alias_with_hint.sql.txt @@ -6,13 +6,8 @@ FROM --- AST &ast.QueryStatement{ - Hint: (*ast.Hint)(nil), - With: (*ast.With)(nil), Query: &ast.Select{ - Select: 0, - Distinct: false, - As: nil, - Results: []ast.SelectItem{ + Results: []ast.SelectItem{ &ast.Star{ Star: 9, }, @@ -51,14 +46,8 @@ FROM Name: "S", }, }, - Sample: (*ast.TableSample)(nil), }, }, - Where: (*ast.Where)(nil), - GroupBy: (*ast.GroupBy)(nil), - Having: (*ast.Having)(nil), - OrderBy: (*ast.OrderBy)(nil), - Limit: (*ast.Limit)(nil), }, } diff --git a/testdata/result/statement/select_singer_with_table_hint.sql.txt b/testdata/result/statement/select_singer_with_table_hint.sql.txt index 5bac204b..ceac381e 100644 --- a/testdata/result/statement/select_singer_with_table_hint.sql.txt +++ b/testdata/result/statement/select_singer_with_table_hint.sql.txt @@ -6,13 +6,8 @@ FROM --- AST &ast.QueryStatement{ - Hint: (*ast.Hint)(nil), - With: (*ast.With)(nil), Query: &ast.Select{ - Select: 0, - Distinct: false, - As: nil, - Results: []ast.SelectItem{ + Results: []ast.SelectItem{ &ast.Star{ Star: 9, }, @@ -43,15 +38,8 @@ FROM }, }, }, - As: (*ast.AsAlias)(nil), - Sample: (*ast.TableSample)(nil), }, }, - Where: (*ast.Where)(nil), - GroupBy: (*ast.GroupBy)(nil), - Having: (*ast.Having)(nil), - OrderBy: (*ast.OrderBy)(nil), - Limit: (*ast.Limit)(nil), }, } diff --git a/testdata/result/statement/select_singer_with_tablesample.sql.txt b/testdata/result/statement/select_singer_with_tablesample.sql.txt index f333017d..6f4e56c8 100644 --- a/testdata/result/statement/select_singer_with_tablesample.sql.txt +++ b/testdata/result/statement/select_singer_with_tablesample.sql.txt @@ -8,13 +8,8 @@ FROM --- AST &ast.QueryStatement{ - Hint: (*ast.Hint)(nil), - With: (*ast.With)(nil), Query: &ast.Select{ - Select: 0, - Distinct: false, - As: nil, - Results: []ast.SelectItem{ + Results: []ast.SelectItem{ &ast.Star{ Star: 9, }, @@ -22,21 +17,16 @@ FROM From: &ast.From{ From: 11, Source: &ast.Join{ - Op: ",", - Method: "", - Hint: (*ast.Hint)(nil), - Left: &ast.Join{ - Op: ",", - Method: "", - Hint: (*ast.Hint)(nil), - Left: &ast.TableName{ + Op: ",", + Left: &ast.Join{ + Op: ",", + Left: &ast.TableName{ Table: &ast.Ident{ NamePos: 18, NameEnd: 25, Name: "Singers", }, - Hint: (*ast.Hint)(nil), - As: &ast.AsAlias{ + As: &ast.AsAlias{ As: 26, Alias: &ast.Ident{ NamePos: 29, @@ -66,8 +56,7 @@ FROM NameEnd: 74, Name: "Singers", }, - Hint: (*ast.Hint)(nil), - As: &ast.AsAlias{ + As: &ast.AsAlias{ As: 75, Alias: &ast.Ident{ NamePos: 78, @@ -90,7 +79,6 @@ FROM }, }, }, - Cond: nil, }, Right: &ast.TableName{ Table: &ast.Ident{ @@ -98,8 +86,7 @@ FROM NameEnd: 126, Name: "Singers", }, - Hint: (*ast.Hint)(nil), - As: &ast.AsAlias{ + As: &ast.AsAlias{ As: 127, Alias: &ast.Ident{ NamePos: 130, @@ -122,14 +109,8 @@ FROM }, }, }, - Cond: nil, }, }, - Where: (*ast.Where)(nil), - GroupBy: (*ast.GroupBy)(nil), - Having: (*ast.Having)(nil), - OrderBy: (*ast.OrderBy)(nil), - Limit: (*ast.Limit)(nil), }, } diff --git a/testdata/result/statement/select_singer_with_tableset.sql.txt b/testdata/result/statement/select_singer_with_tableset.sql.txt index d86f32dc..11c86d6e 100644 --- a/testdata/result/statement/select_singer_with_tableset.sql.txt +++ b/testdata/result/statement/select_singer_with_tableset.sql.txt @@ -5,17 +5,11 @@ SELECT * FROM Singers --- AST &ast.QueryStatement{ - Hint: (*ast.Hint)(nil), - With: (*ast.With)(nil), Query: &ast.CompoundQuery{ - Op: "UNION", - Distinct: false, - Queries: []ast.QueryExpr{ + Op: "UNION", + Queries: []ast.QueryExpr{ &ast.Select{ - Select: 0, - Distinct: false, - As: nil, - Results: []ast.SelectItem{ + Results: []ast.SelectItem{ &ast.Star{ Star: 7, }, @@ -28,22 +22,12 @@ SELECT * FROM Singers NameEnd: 21, Name: "Singers", }, - Hint: (*ast.Hint)(nil), - As: (*ast.AsAlias)(nil), - Sample: (*ast.TableSample)(nil), }, }, - Where: (*ast.Where)(nil), - GroupBy: (*ast.GroupBy)(nil), - Having: (*ast.Having)(nil), - OrderBy: (*ast.OrderBy)(nil), - Limit: (*ast.Limit)(nil), }, &ast.Select{ - Select: 32, - Distinct: false, - As: nil, - Results: []ast.SelectItem{ + Select: 32, + Results: []ast.SelectItem{ &ast.Star{ Star: 39, }, @@ -56,20 +40,10 @@ SELECT * FROM Singers NameEnd: 53, Name: "Singers", }, - Hint: (*ast.Hint)(nil), - As: (*ast.AsAlias)(nil), - Sample: (*ast.TableSample)(nil), }, }, - Where: (*ast.Where)(nil), - GroupBy: (*ast.GroupBy)(nil), - Having: (*ast.Having)(nil), - OrderBy: (*ast.OrderBy)(nil), - Limit: (*ast.Limit)(nil), }, }, - OrderBy: (*ast.OrderBy)(nil), - Limit: (*ast.Limit)(nil), }, } diff --git a/testdata/result/statement/select_singer_with_tableset_complex.sql.txt b/testdata/result/statement/select_singer_with_tableset_complex.sql.txt index 39c7e022..4deb7325 100644 --- a/testdata/result/statement/select_singer_with_tableset_complex.sql.txt +++ b/testdata/result/statement/select_singer_with_tableset_complex.sql.txt @@ -25,17 +25,11 @@ UNION ALL --- AST &ast.QueryStatement{ - Hint: (*ast.Hint)(nil), - With: (*ast.With)(nil), Query: &ast.CompoundQuery{ - Op: "UNION", - Distinct: false, - Queries: []ast.QueryExpr{ + Op: "UNION", + Queries: []ast.QueryExpr{ &ast.Select{ - Select: 0, - Distinct: false, - As: nil, - Results: []ast.SelectItem{ + Results: []ast.SelectItem{ &ast.Star{ Star: 7, }, @@ -48,16 +42,8 @@ UNION ALL NameEnd: 21, Name: "Singers", }, - Hint: (*ast.Hint)(nil), - As: (*ast.AsAlias)(nil), - Sample: (*ast.TableSample)(nil), }, }, - Where: (*ast.Where)(nil), - GroupBy: (*ast.GroupBy)(nil), - Having: (*ast.Having)(nil), - OrderBy: (*ast.OrderBy)(nil), - Limit: (*ast.Limit)(nil), }, &ast.SubQuery{ Lparen: 32, @@ -67,10 +53,8 @@ UNION ALL Distinct: true, Queries: []ast.QueryExpr{ &ast.Select{ - Select: 36, - Distinct: false, - As: nil, - Results: []ast.SelectItem{ + Select: 36, + Results: []ast.SelectItem{ &ast.Star{ Star: 43, }, @@ -83,29 +67,18 @@ UNION ALL NameEnd: 57, Name: "Singers", }, - Hint: (*ast.Hint)(nil), - As: (*ast.AsAlias)(nil), - Sample: (*ast.TableSample)(nil), }, }, - Where: (*ast.Where)(nil), - GroupBy: (*ast.GroupBy)(nil), - Having: (*ast.Having)(nil), - OrderBy: (*ast.OrderBy)(nil), - Limit: (*ast.Limit)(nil), }, &ast.SubQuery{ Lparen: 77, Rparen: 365, Query: &ast.CompoundQuery{ - Op: "INTERSECT", - Distinct: false, - Queries: []ast.QueryExpr{ + Op: "INTERSECT", + Queries: []ast.QueryExpr{ &ast.Select{ - Select: 83, - Distinct: false, - As: nil, - Results: []ast.SelectItem{ + Select: 83, + Results: []ast.SelectItem{ &ast.Star{ Star: 90, }, @@ -118,16 +91,8 @@ UNION ALL NameEnd: 104, Name: "Singers", }, - Hint: (*ast.Hint)(nil), - As: (*ast.AsAlias)(nil), - Sample: (*ast.TableSample)(nil), }, }, - Where: (*ast.Where)(nil), - GroupBy: (*ast.GroupBy)(nil), - Having: (*ast.Having)(nil), - OrderBy: (*ast.OrderBy)(nil), - Limit: (*ast.Limit)(nil), }, &ast.SubQuery{ Lparen: 127, @@ -137,10 +102,8 @@ UNION ALL Distinct: true, Queries: []ast.QueryExpr{ &ast.Select{ - Select: 135, - Distinct: false, - As: nil, - Results: []ast.SelectItem{ + Select: 135, + Results: []ast.SelectItem{ &ast.Star{ Star: 142, }, @@ -153,29 +116,18 @@ UNION ALL NameEnd: 156, Name: "Singers", }, - Hint: (*ast.Hint)(nil), - As: (*ast.AsAlias)(nil), - Sample: (*ast.TableSample)(nil), }, }, - Where: (*ast.Where)(nil), - GroupBy: (*ast.GroupBy)(nil), - Having: (*ast.Having)(nil), - OrderBy: (*ast.OrderBy)(nil), - Limit: (*ast.Limit)(nil), }, &ast.SubQuery{ Lparen: 188, Rparen: 355, Query: &ast.CompoundQuery{ - Op: "EXCEPT", - Distinct: false, - Queries: []ast.QueryExpr{ + Op: "EXCEPT", + Queries: []ast.QueryExpr{ &ast.Select{ - Select: 198, - Distinct: false, - As: nil, - Results: []ast.SelectItem{ + Select: 198, + Results: []ast.SelectItem{ &ast.Star{ Star: 205, }, @@ -188,16 +140,8 @@ UNION ALL NameEnd: 219, Name: "Singers", }, - Hint: (*ast.Hint)(nil), - As: (*ast.AsAlias)(nil), - Sample: (*ast.TableSample)(nil), }, }, - Where: (*ast.Where)(nil), - GroupBy: (*ast.GroupBy)(nil), - Having: (*ast.Having)(nil), - OrderBy: (*ast.OrderBy)(nil), - Limit: (*ast.Limit)(nil), }, &ast.SubQuery{ Lparen: 247, @@ -207,10 +151,8 @@ UNION ALL Distinct: true, Queries: []ast.QueryExpr{ &ast.Select{ - Select: 259, - Distinct: false, - As: nil, - Results: []ast.SelectItem{ + Select: 259, + Results: []ast.SelectItem{ &ast.Star{ Star: 266, }, @@ -223,22 +165,12 @@ UNION ALL NameEnd: 280, Name: "Singers", }, - Hint: (*ast.Hint)(nil), - As: (*ast.AsAlias)(nil), - Sample: (*ast.TableSample)(nil), }, }, - Where: (*ast.Where)(nil), - GroupBy: (*ast.GroupBy)(nil), - Having: (*ast.Having)(nil), - OrderBy: (*ast.OrderBy)(nil), - Limit: (*ast.Limit)(nil), }, &ast.Select{ - Select: 317, - Distinct: false, - As: nil, - Results: []ast.SelectItem{ + Select: 317, + Results: []ast.SelectItem{ &ast.Star{ Star: 324, }, @@ -251,55 +183,25 @@ UNION ALL NameEnd: 338, Name: "Singers", }, - Hint: (*ast.Hint)(nil), - As: (*ast.AsAlias)(nil), - Sample: (*ast.TableSample)(nil), }, }, - Where: (*ast.Where)(nil), - GroupBy: (*ast.GroupBy)(nil), - Having: (*ast.Having)(nil), - OrderBy: (*ast.OrderBy)(nil), - Limit: (*ast.Limit)(nil), }, }, - OrderBy: (*ast.OrderBy)(nil), - Limit: (*ast.Limit)(nil), }, - OrderBy: (*ast.OrderBy)(nil), - Limit: (*ast.Limit)(nil), }, }, - OrderBy: (*ast.OrderBy)(nil), - Limit: (*ast.Limit)(nil), }, - OrderBy: (*ast.OrderBy)(nil), - Limit: (*ast.Limit)(nil), }, }, - OrderBy: (*ast.OrderBy)(nil), - Limit: (*ast.Limit)(nil), }, - OrderBy: (*ast.OrderBy)(nil), - Limit: (*ast.Limit)(nil), }, }, - OrderBy: (*ast.OrderBy)(nil), - Limit: (*ast.Limit)(nil), }, - OrderBy: (*ast.OrderBy)(nil), - Limit: (*ast.Limit)(nil), }, }, - OrderBy: (*ast.OrderBy)(nil), - Limit: (*ast.Limit)(nil), }, - OrderBy: (*ast.OrderBy)(nil), - Limit: (*ast.Limit)(nil), }, }, - OrderBy: (*ast.OrderBy)(nil), - Limit: (*ast.Limit)(nil), }, } diff --git a/testdata/result/statement/select_singer_with_tableset_with_where.sql.txt b/testdata/result/statement/select_singer_with_tableset_with_where.sql.txt index 06389511..f4b5aa50 100644 --- a/testdata/result/statement/select_singer_with_tableset_with_where.sql.txt +++ b/testdata/result/statement/select_singer_with_tableset_with_where.sql.txt @@ -9,17 +9,11 @@ ORDER BY --- AST &ast.QueryStatement{ - Hint: (*ast.Hint)(nil), - With: (*ast.With)(nil), Query: &ast.CompoundQuery{ - Op: "UNION", - Distinct: false, - Queries: []ast.QueryExpr{ + Op: "UNION", + Queries: []ast.QueryExpr{ &ast.Select{ - Select: 0, - Distinct: false, - As: nil, - Results: []ast.SelectItem{ + Results: []ast.SelectItem{ &ast.Star{ Star: 7, }, @@ -32,22 +26,12 @@ ORDER BY NameEnd: 21, Name: "Singers", }, - Hint: (*ast.Hint)(nil), - As: (*ast.AsAlias)(nil), - Sample: (*ast.TableSample)(nil), }, }, - Where: (*ast.Where)(nil), - GroupBy: (*ast.GroupBy)(nil), - Having: (*ast.Having)(nil), - OrderBy: (*ast.OrderBy)(nil), - Limit: (*ast.Limit)(nil), }, &ast.Select{ - Select: 32, - Distinct: false, - As: nil, - Results: []ast.SelectItem{ + Select: 32, + Results: []ast.SelectItem{ &ast.Star{ Star: 39, }, @@ -60,9 +44,6 @@ ORDER BY NameEnd: 53, Name: "Singers", }, - Hint: (*ast.Hint)(nil), - As: (*ast.AsAlias)(nil), - Sample: (*ast.TableSample)(nil), }, }, Where: &ast.Where{ @@ -82,10 +63,6 @@ ORDER BY }, }, }, - GroupBy: (*ast.GroupBy)(nil), - Having: (*ast.Having)(nil), - OrderBy: (*ast.OrderBy)(nil), - Limit: (*ast.Limit)(nil), }, }, OrderBy: &ast.OrderBy{ @@ -98,12 +75,9 @@ ORDER BY NameEnd: 95, Name: "FirstName", }, - Collate: (*ast.Collate)(nil), - Dir: "", }, }, }, - Limit: (*ast.Limit)(nil), }, } diff --git a/testdata/result/statement/select_singer_with_toplevel_join_hint.sql.txt b/testdata/result/statement/select_singer_with_toplevel_join_hint.sql.txt index 450aca21..6b0504d6 100644 --- a/testdata/result/statement/select_singer_with_toplevel_join_hint.sql.txt +++ b/testdata/result/statement/select_singer_with_toplevel_join_hint.sql.txt @@ -11,7 +11,6 @@ FROM --- AST &ast.QueryStatement{ Hint: &ast.Hint{ - Atmark: 0, Rbrace: 23, Records: []*ast.HintRecord{ &ast.HintRecord{ @@ -27,12 +26,9 @@ FROM }, }, }, - With: (*ast.With)(nil), Query: &ast.Select{ - Select: 25, - Distinct: false, - As: nil, - Results: []ast.SelectItem{ + Select: 25, + Results: []ast.SelectItem{ &ast.Star{ Star: 34, }, @@ -40,17 +36,14 @@ FROM From: &ast.From{ From: 36, Source: &ast.Join{ - Op: "LEFT OUTER JOIN", - Method: "", - Hint: (*ast.Hint)(nil), - Left: &ast.TableName{ + Op: "LEFT OUTER JOIN", + Left: &ast.TableName{ Table: &ast.Ident{ NamePos: 43, NameEnd: 50, Name: "Singers", }, - Hint: (*ast.Hint)(nil), - As: &ast.AsAlias{ + As: &ast.AsAlias{ As: -1, Alias: &ast.Ident{ NamePos: 51, @@ -58,7 +51,6 @@ FROM Name: "A", }, }, - Sample: (*ast.TableSample)(nil), }, Right: &ast.TableName{ Table: &ast.Ident{ @@ -66,8 +58,7 @@ FROM NameEnd: 80, Name: "Singers", }, - Hint: (*ast.Hint)(nil), - As: &ast.AsAlias{ + As: &ast.AsAlias{ As: -1, Alias: &ast.Ident{ NamePos: 81, @@ -75,7 +66,6 @@ FROM Name: "B", }, }, - Sample: (*ast.TableSample)(nil), }, Cond: &ast.On{ On: 85, @@ -113,11 +103,6 @@ FROM }, }, }, - Where: (*ast.Where)(nil), - GroupBy: (*ast.GroupBy)(nil), - Having: (*ast.Having)(nil), - OrderBy: (*ast.OrderBy)(nil), - Limit: (*ast.Limit)(nil), }, } diff --git a/testdata/result/statement/select_singer_with_value_hex.sql.txt b/testdata/result/statement/select_singer_with_value_hex.sql.txt index 1cd2c0fc..b1694221 100644 --- a/testdata/result/statement/select_singer_with_value_hex.sql.txt +++ b/testdata/result/statement/select_singer_with_value_hex.sql.txt @@ -8,13 +8,8 @@ WHERE --- AST &ast.QueryStatement{ - Hint: (*ast.Hint)(nil), - With: (*ast.With)(nil), Query: &ast.Select{ - Select: 0, - Distinct: false, - As: nil, - Results: []ast.SelectItem{ + Results: []ast.SelectItem{ &ast.Star{ Star: 9, }, @@ -27,9 +22,6 @@ WHERE NameEnd: 25, Name: "Singers", }, - Hint: (*ast.Hint)(nil), - As: (*ast.AsAlias)(nil), - Sample: (*ast.TableSample)(nil), }, }, Where: &ast.Where{ @@ -49,10 +41,6 @@ WHERE }, }, }, - GroupBy: (*ast.GroupBy)(nil), - Having: (*ast.Having)(nil), - OrderBy: (*ast.OrderBy)(nil), - Limit: (*ast.Limit)(nil), }, } diff --git a/testdata/result/statement/select_singer_with_where.sql.txt b/testdata/result/statement/select_singer_with_where.sql.txt index 5c42d434..d51994ee 100644 --- a/testdata/result/statement/select_singer_with_where.sql.txt +++ b/testdata/result/statement/select_singer_with_where.sql.txt @@ -8,13 +8,8 @@ WHERE --- AST &ast.QueryStatement{ - Hint: (*ast.Hint)(nil), - With: (*ast.With)(nil), Query: &ast.Select{ - Select: 0, - Distinct: false, - As: nil, - Results: []ast.SelectItem{ + Results: []ast.SelectItem{ &ast.Star{ Star: 9, }, @@ -27,9 +22,6 @@ WHERE NameEnd: 25, Name: "Singers", }, - Hint: (*ast.Hint)(nil), - As: (*ast.AsAlias)(nil), - Sample: (*ast.TableSample)(nil), }, }, Where: &ast.Where{ @@ -49,10 +41,6 @@ WHERE }, }, }, - GroupBy: (*ast.GroupBy)(nil), - Having: (*ast.Having)(nil), - OrderBy: (*ast.OrderBy)(nil), - Limit: (*ast.Limit)(nil), }, } diff --git a/testdata/result/statement/select_singer_with_where_and_comparison.sql.txt b/testdata/result/statement/select_singer_with_where_and_comparison.sql.txt index ba18a39e..54044e35 100644 --- a/testdata/result/statement/select_singer_with_where_and_comparison.sql.txt +++ b/testdata/result/statement/select_singer_with_where_and_comparison.sql.txt @@ -25,13 +25,8 @@ WHERE --- AST &ast.QueryStatement{ - Hint: (*ast.Hint)(nil), - With: (*ast.With)(nil), Query: &ast.Select{ - Select: 0, - Distinct: false, - As: nil, - Results: []ast.SelectItem{ + Results: []ast.SelectItem{ &ast.Star{ Star: 9, }, @@ -44,9 +39,6 @@ WHERE NameEnd: 25, Name: "Singers", }, - Hint: (*ast.Hint)(nil), - As: (*ast.AsAlias)(nil), - Sample: (*ast.TableSample)(nil), }, }, Where: &ast.Where{ @@ -175,7 +167,6 @@ WHERE }, }, Right: &ast.InExpr{ - Not: false, Left: &ast.Ident{ NamePos: 145, NameEnd: 153, @@ -241,7 +232,6 @@ WHERE }, }, Right: &ast.BetweenExpr{ - Not: false, Left: &ast.Ident{ NamePos: 203, NameEnd: 211, @@ -312,7 +302,6 @@ WHERE }, Right: &ast.IsNullExpr{ Null: 329, - Not: false, Left: &ast.NullLiteral{ Null: 321, }, @@ -328,7 +317,6 @@ WHERE }, Right: &ast.IsBoolExpr{ RightPos: 379, - Not: false, Left: &ast.ParenExpr{ Lparen: 361, Rparen: 374, @@ -376,7 +364,6 @@ WHERE }, Right: &ast.IsBoolExpr{ RightPos: 439, - Not: false, Left: &ast.ParenExpr{ Lparen: 421, Rparen: 434, @@ -395,7 +382,6 @@ WHERE }, }, }, - Right: false, }, }, Right: &ast.IsBoolExpr{ @@ -419,14 +405,9 @@ WHERE }, }, }, - Right: false, }, }, }, - GroupBy: (*ast.GroupBy)(nil), - Having: (*ast.Having)(nil), - OrderBy: (*ast.OrderBy)(nil), - Limit: (*ast.Limit)(nil), }, } diff --git a/testdata/result/statement/select_singer_with_where_and_op.sql.txt b/testdata/result/statement/select_singer_with_where_and_op.sql.txt index e1fa8b0c..4cdc338c 100644 --- a/testdata/result/statement/select_singer_with_where_and_op.sql.txt +++ b/testdata/result/statement/select_singer_with_where_and_op.sql.txt @@ -8,13 +8,8 @@ WHERE --- AST &ast.QueryStatement{ - Hint: (*ast.Hint)(nil), - With: (*ast.With)(nil), Query: &ast.Select{ - Select: 0, - Distinct: false, - As: nil, - Results: []ast.SelectItem{ + Results: []ast.SelectItem{ &ast.Star{ Star: 9, }, @@ -27,9 +22,6 @@ WHERE NameEnd: 25, Name: "Singers", }, - Hint: (*ast.Hint)(nil), - As: (*ast.AsAlias)(nil), - Sample: (*ast.TableSample)(nil), }, }, Where: &ast.Where{ @@ -81,10 +73,6 @@ WHERE }, }, }, - GroupBy: (*ast.GroupBy)(nil), - Having: (*ast.Having)(nil), - OrderBy: (*ast.OrderBy)(nil), - Limit: (*ast.Limit)(nil), }, } diff --git a/testdata/result/statement/select_struct_compare_eq.sql.txt b/testdata/result/statement/select_struct_compare_eq.sql.txt index ff3acbd9..2ad47609 100644 --- a/testdata/result/statement/select_struct_compare_eq.sql.txt +++ b/testdata/result/statement/select_struct_compare_eq.sql.txt @@ -9,22 +9,15 @@ SELECT ARRAY( --- AST &ast.QueryStatement{ - Hint: (*ast.Hint)(nil), - With: (*ast.With)(nil), Query: &ast.Select{ - Select: 0, - Distinct: false, - As: nil, - Results: []ast.SelectItem{ + Results: []ast.SelectItem{ &ast.ExprSelectItem{ Expr: &ast.ArraySubQuery{ Array: 7, Rparen: 133, Query: &ast.Select{ - Select: 16, - Distinct: false, - As: nil, - Results: []ast.SelectItem{ + Select: 16, + Results: []ast.SelectItem{ &ast.Star{ Star: 27, }, @@ -35,10 +28,8 @@ SELECT ARRAY( Lparen: 40, Rparen: 90, Query: &ast.Select{ - Select: 41, - Distinct: false, - As: nil, - Results: []ast.SelectItem{ + Select: 41, + Results: []ast.SelectItem{ &ast.ExprSelectItem{ Expr: &ast.TypedStructLiteral{ Struct: 48, @@ -101,12 +92,6 @@ SELECT ARRAY( }, }, }, - From: (*ast.From)(nil), - Where: (*ast.Where)(nil), - GroupBy: (*ast.GroupBy)(nil), - Having: (*ast.Having)(nil), - OrderBy: (*ast.OrderBy)(nil), - Limit: (*ast.Limit)(nil), }, As: &ast.AsAlias{ As: 92, @@ -116,7 +101,6 @@ SELECT ARRAY( Name: "S", }, }, - Sample: (*ast.TableSample)(nil), }, }, Where: &ast.Where{ @@ -168,20 +152,10 @@ SELECT ARRAY( }, }, }, - GroupBy: (*ast.GroupBy)(nil), - Having: (*ast.Having)(nil), - OrderBy: (*ast.OrderBy)(nil), - Limit: (*ast.Limit)(nil), }, }, }, }, - From: (*ast.From)(nil), - Where: (*ast.Where)(nil), - GroupBy: (*ast.GroupBy)(nil), - Having: (*ast.Having)(nil), - OrderBy: (*ast.OrderBy)(nil), - Limit: (*ast.Limit)(nil), }, } diff --git a/testdata/result/statement/select_subscript_operators.sql.txt b/testdata/result/statement/select_subscript_operators.sql.txt index 64776a1d..0ee39c7b 100644 --- a/testdata/result/statement/select_subscript_operators.sql.txt +++ b/testdata/result/statement/select_subscript_operators.sql.txt @@ -15,13 +15,8 @@ select --- AST &ast.QueryStatement{ - Hint: (*ast.Hint)(nil), - With: (*ast.With)(nil), Query: &ast.Select{ - Select: 0, - Distinct: false, - As: nil, - Results: []ast.SelectItem{ + Results: []ast.SelectItem{ &ast.ExprSelectItem{ Expr: &ast.IndexExpr{ Rbrack: 30, @@ -29,7 +24,6 @@ select Array: -1, Lbrack: 11, Rbrack: 19, - Type: nil, Values: []ast.Expr{ &ast.IntLiteral{ ValuePos: 12, @@ -71,7 +65,6 @@ select Array: -1, Lbrack: 37, Rbrack: 45, - Type: nil, Values: []ast.Expr{ &ast.IntLiteral{ ValuePos: 38, @@ -113,7 +106,6 @@ select Array: -1, Lbrack: 64, Rbrack: 72, - Type: nil, Values: []ast.Expr{ &ast.IntLiteral{ ValuePos: 65, @@ -155,7 +147,6 @@ select Array: -1, Lbrack: 95, Rbrack: 103, - Type: nil, Values: []ast.Expr{ &ast.IntLiteral{ ValuePos: 96, @@ -197,7 +188,6 @@ select Array: -1, Lbrack: 122, Rbrack: 130, - Type: nil, Values: []ast.Expr{ &ast.IntLiteral{ ValuePos: 123, @@ -498,12 +488,6 @@ select }, }, }, - From: (*ast.From)(nil), - Where: (*ast.Where)(nil), - GroupBy: (*ast.GroupBy)(nil), - Having: (*ast.Having)(nil), - OrderBy: (*ast.OrderBy)(nil), - Limit: (*ast.Limit)(nil), }, } diff --git a/testdata/result/statement/select_tablesample_with_cross_join.sql.txt b/testdata/result/statement/select_tablesample_with_cross_join.sql.txt index b1e29e4a..f89a73f5 100644 --- a/testdata/result/statement/select_tablesample_with_cross_join.sql.txt +++ b/testdata/result/statement/select_tablesample_with_cross_join.sql.txt @@ -9,13 +9,8 @@ FROM --- AST &ast.QueryStatement{ - Hint: (*ast.Hint)(nil), - With: (*ast.With)(nil), Query: &ast.Select{ - Select: 0, - Distinct: false, - As: nil, - Results: []ast.SelectItem{ + Results: []ast.SelectItem{ &ast.Star{ Star: 9, }, @@ -23,17 +18,14 @@ FROM From: &ast.From{ From: 11, Source: &ast.Join{ - Op: "CROSS JOIN", - Method: "", - Hint: (*ast.Hint)(nil), - Left: &ast.TableName{ + Op: "CROSS JOIN", + Left: &ast.TableName{ Table: &ast.Ident{ NamePos: 18, NameEnd: 25, Name: "Singers", }, - Hint: (*ast.Hint)(nil), - As: &ast.AsAlias{ + As: &ast.AsAlias{ As: -1, Alias: &ast.Ident{ NamePos: 26, @@ -41,7 +33,6 @@ FROM Name: "A", }, }, - Sample: (*ast.TableSample)(nil), }, Right: &ast.TableName{ Table: &ast.Ident{ @@ -49,8 +40,7 @@ FROM NameEnd: 50, Name: "Singers", }, - Hint: (*ast.Hint)(nil), - As: &ast.AsAlias{ + As: &ast.AsAlias{ As: -1, Alias: &ast.Ident{ NamePos: 51, @@ -74,14 +64,8 @@ FROM }, }, }, - Cond: nil, }, }, - Where: (*ast.Where)(nil), - GroupBy: (*ast.GroupBy)(nil), - Having: (*ast.Having)(nil), - OrderBy: (*ast.OrderBy)(nil), - Limit: (*ast.Limit)(nil), }, } diff --git a/testdata/result/statement/select_tablesample_with_subquery.sql.txt b/testdata/result/statement/select_tablesample_with_subquery.sql.txt index 07aadcab..2eca5398 100644 --- a/testdata/result/statement/select_tablesample_with_subquery.sql.txt +++ b/testdata/result/statement/select_tablesample_with_subquery.sql.txt @@ -6,13 +6,8 @@ FROM --- AST &ast.QueryStatement{ - Hint: (*ast.Hint)(nil), - With: (*ast.With)(nil), Query: &ast.Select{ - Select: 0, - Distinct: false, - As: nil, - Results: []ast.SelectItem{ + Results: []ast.SelectItem{ &ast.Star{ Star: 9, }, @@ -23,10 +18,8 @@ FROM Lparen: 18, Rparen: 40, Query: &ast.Select{ - Select: 19, - Distinct: false, - As: nil, - Results: []ast.SelectItem{ + Select: 19, + Results: []ast.SelectItem{ &ast.Star{ Star: 26, }, @@ -39,18 +32,9 @@ FROM NameEnd: 40, Name: "Singers", }, - Hint: (*ast.Hint)(nil), - As: (*ast.AsAlias)(nil), - Sample: (*ast.TableSample)(nil), }, }, - Where: (*ast.Where)(nil), - GroupBy: (*ast.GroupBy)(nil), - Having: (*ast.Having)(nil), - OrderBy: (*ast.OrderBy)(nil), - Limit: (*ast.Limit)(nil), }, - As: (*ast.AsAlias)(nil), Sample: &ast.TableSample{ TableSample: 42, Method: "BERNOULLI", @@ -68,11 +52,6 @@ FROM }, }, }, - Where: (*ast.Where)(nil), - GroupBy: (*ast.GroupBy)(nil), - Having: (*ast.Having)(nil), - OrderBy: (*ast.OrderBy)(nil), - Limit: (*ast.Limit)(nil), }, } diff --git a/testdata/result/statement/select_tablesample_with_table.sql.txt b/testdata/result/statement/select_tablesample_with_table.sql.txt index b6d80bc3..105c0b18 100644 --- a/testdata/result/statement/select_tablesample_with_table.sql.txt +++ b/testdata/result/statement/select_tablesample_with_table.sql.txt @@ -6,13 +6,8 @@ FROM --- AST &ast.QueryStatement{ - Hint: (*ast.Hint)(nil), - With: (*ast.With)(nil), Query: &ast.Select{ - Select: 0, - Distinct: false, - As: nil, - Results: []ast.SelectItem{ + Results: []ast.SelectItem{ &ast.Star{ Star: 9, }, @@ -25,8 +20,6 @@ FROM NameEnd: 25, Name: "Singers", }, - Hint: (*ast.Hint)(nil), - As: (*ast.AsAlias)(nil), Sample: &ast.TableSample{ TableSample: 26, Method: "BERNOULLI", @@ -44,11 +37,6 @@ FROM }, }, }, - Where: (*ast.Where)(nil), - GroupBy: (*ast.GroupBy)(nil), - Having: (*ast.Having)(nil), - OrderBy: (*ast.OrderBy)(nil), - Limit: (*ast.Limit)(nil), }, } diff --git a/testdata/result/statement/select_tablesample_with_table_alias.sql.txt b/testdata/result/statement/select_tablesample_with_table_alias.sql.txt index 102ff2ed..06e78886 100644 --- a/testdata/result/statement/select_tablesample_with_table_alias.sql.txt +++ b/testdata/result/statement/select_tablesample_with_table_alias.sql.txt @@ -6,13 +6,8 @@ FROM --- AST &ast.QueryStatement{ - Hint: (*ast.Hint)(nil), - With: (*ast.With)(nil), Query: &ast.Select{ - Select: 0, - Distinct: false, - As: nil, - Results: []ast.SelectItem{ + Results: []ast.SelectItem{ &ast.Star{ Star: 9, }, @@ -25,8 +20,7 @@ FROM NameEnd: 25, Name: "Singers", }, - Hint: (*ast.Hint)(nil), - As: &ast.AsAlias{ + As: &ast.AsAlias{ As: 26, Alias: &ast.Ident{ NamePos: 29, @@ -51,11 +45,6 @@ FROM }, }, }, - Where: (*ast.Where)(nil), - GroupBy: (*ast.GroupBy)(nil), - Having: (*ast.Having)(nil), - OrderBy: (*ast.OrderBy)(nil), - Limit: (*ast.Limit)(nil), }, } diff --git a/testdata/result/statement/select_tablesample_with_unnest_invalid.sql.txt b/testdata/result/statement/select_tablesample_with_unnest_invalid.sql.txt index 44d34a87..13ac59cf 100644 --- a/testdata/result/statement/select_tablesample_with_unnest_invalid.sql.txt +++ b/testdata/result/statement/select_tablesample_with_unnest_invalid.sql.txt @@ -6,13 +6,8 @@ FROM --- AST &ast.QueryStatement{ - Hint: (*ast.Hint)(nil), - With: (*ast.With)(nil), Query: &ast.Select{ - Select: 0, - Distinct: false, - As: nil, - Results: []ast.SelectItem{ + Results: []ast.SelectItem{ &ast.Star{ Star: 9, }, @@ -91,10 +86,7 @@ FROM }, }, }, - Hint: (*ast.Hint)(nil), - As: (*ast.AsAlias)(nil), - WithOffset: (*ast.WithOffset)(nil), - Sample: &ast.TableSample{ + Sample: &ast.TableSample{ TableSample: 83, Method: "BERNOULLI", Size: &ast.TableSampleSize{ @@ -111,11 +103,6 @@ FROM }, }, }, - Where: (*ast.Where)(nil), - GroupBy: (*ast.GroupBy)(nil), - Having: (*ast.Having)(nil), - OrderBy: (*ast.OrderBy)(nil), - Limit: (*ast.Limit)(nil), }, } diff --git a/testdata/result/statement/select_union_chain.sql.txt b/testdata/result/statement/select_union_chain.sql.txt index a26ec131..4858c708 100644 --- a/testdata/result/statement/select_union_chain.sql.txt +++ b/testdata/result/statement/select_union_chain.sql.txt @@ -3,20 +3,14 @@ --- AST &ast.QueryStatement{ - Hint: (*ast.Hint)(nil), - With: (*ast.With)(nil), Query: &ast.CompoundQuery{ - Op: "UNION", - Distinct: false, - Queries: []ast.QueryExpr{ + Op: "UNION", + Queries: []ast.QueryExpr{ &ast.SubQuery{ - Lparen: 0, Rparen: 9, Query: &ast.Select{ - Select: 1, - Distinct: false, - As: nil, - Results: []ast.SelectItem{ + Select: 1, + Results: []ast.SelectItem{ &ast.ExprSelectItem{ Expr: &ast.IntLiteral{ ValuePos: 8, @@ -26,24 +20,14 @@ }, }, }, - From: (*ast.From)(nil), - Where: (*ast.Where)(nil), - GroupBy: (*ast.GroupBy)(nil), - Having: (*ast.Having)(nil), - OrderBy: (*ast.OrderBy)(nil), - Limit: (*ast.Limit)(nil), }, - OrderBy: (*ast.OrderBy)(nil), - Limit: (*ast.Limit)(nil), }, &ast.SubQuery{ Lparen: 21, Rparen: 30, Query: &ast.Select{ - Select: 22, - Distinct: false, - As: nil, - Results: []ast.SelectItem{ + Select: 22, + Results: []ast.SelectItem{ &ast.ExprSelectItem{ Expr: &ast.IntLiteral{ ValuePos: 29, @@ -53,24 +37,14 @@ }, }, }, - From: (*ast.From)(nil), - Where: (*ast.Where)(nil), - GroupBy: (*ast.GroupBy)(nil), - Having: (*ast.Having)(nil), - OrderBy: (*ast.OrderBy)(nil), - Limit: (*ast.Limit)(nil), }, - OrderBy: (*ast.OrderBy)(nil), - Limit: (*ast.Limit)(nil), }, &ast.SubQuery{ Lparen: 42, Rparen: 51, Query: &ast.Select{ - Select: 43, - Distinct: false, - As: nil, - Results: []ast.SelectItem{ + Select: 43, + Results: []ast.SelectItem{ &ast.ExprSelectItem{ Expr: &ast.IntLiteral{ ValuePos: 50, @@ -80,19 +54,9 @@ }, }, }, - From: (*ast.From)(nil), - Where: (*ast.Where)(nil), - GroupBy: (*ast.GroupBy)(nil), - Having: (*ast.Having)(nil), - OrderBy: (*ast.OrderBy)(nil), - Limit: (*ast.Limit)(nil), }, - OrderBy: (*ast.OrderBy)(nil), - Limit: (*ast.Limit)(nil), }, }, - OrderBy: (*ast.OrderBy)(nil), - Limit: (*ast.Limit)(nil), }, } diff --git a/testdata/result/statement/select_unnest_with_offset.sql.txt b/testdata/result/statement/select_unnest_with_offset.sql.txt index 776191c4..11f707a2 100644 --- a/testdata/result/statement/select_unnest_with_offset.sql.txt +++ b/testdata/result/statement/select_unnest_with_offset.sql.txt @@ -6,13 +6,8 @@ FROM --- AST &ast.QueryStatement{ - Hint: (*ast.Hint)(nil), - With: (*ast.With)(nil), Query: &ast.Select{ - Select: 0, - Distinct: false, - As: nil, - Results: []ast.SelectItem{ + Results: []ast.SelectItem{ &ast.Star{ Star: 9, }, @@ -26,7 +21,6 @@ FROM Array: -1, Lbrack: 25, Rbrack: 31, - Type: nil, Values: []ast.Expr{ &ast.IntLiteral{ ValuePos: 26, @@ -67,20 +61,12 @@ FROM }, }, }, - As: (*ast.AsAlias)(nil), WithOffset: &ast.WithOffset{ With: 46, Offset: 51, - As: (*ast.AsAlias)(nil), }, - Sample: (*ast.TableSample)(nil), }, }, - Where: (*ast.Where)(nil), - GroupBy: (*ast.GroupBy)(nil), - Having: (*ast.Having)(nil), - OrderBy: (*ast.OrderBy)(nil), - Limit: (*ast.Limit)(nil), }, } diff --git a/testdata/result/statement/select_unnest_with_offset_and_alias.sql.txt b/testdata/result/statement/select_unnest_with_offset_and_alias.sql.txt index 3b88c15d..ab2f4a32 100644 --- a/testdata/result/statement/select_unnest_with_offset_and_alias.sql.txt +++ b/testdata/result/statement/select_unnest_with_offset_and_alias.sql.txt @@ -6,13 +6,8 @@ FROM --- AST &ast.QueryStatement{ - Hint: (*ast.Hint)(nil), - With: (*ast.With)(nil), Query: &ast.Select{ - Select: 0, - Distinct: false, - As: nil, - Results: []ast.SelectItem{ + Results: []ast.SelectItem{ &ast.Star{ Star: 9, }, @@ -26,7 +21,6 @@ FROM Array: -1, Lbrack: 25, Rbrack: 31, - Type: nil, Values: []ast.Expr{ &ast.IntLiteral{ ValuePos: 26, @@ -48,8 +42,7 @@ FROM }, }, }, - Hint: (*ast.Hint)(nil), - As: &ast.AsAlias{ + As: &ast.AsAlias{ As: 34, Alias: &ast.Ident{ NamePos: 37, @@ -69,14 +62,8 @@ FROM }, }, }, - Sample: (*ast.TableSample)(nil), }, }, - Where: (*ast.Where)(nil), - GroupBy: (*ast.GroupBy)(nil), - Having: (*ast.Having)(nil), - OrderBy: (*ast.OrderBy)(nil), - Limit: (*ast.Limit)(nil), }, } diff --git a/testdata/result/statement/select_unnest_with_offset_and_alias_min.sql.txt b/testdata/result/statement/select_unnest_with_offset_and_alias_min.sql.txt index 684b1116..010a9a8a 100644 --- a/testdata/result/statement/select_unnest_with_offset_and_alias_min.sql.txt +++ b/testdata/result/statement/select_unnest_with_offset_and_alias_min.sql.txt @@ -6,13 +6,8 @@ FROM --- AST &ast.QueryStatement{ - Hint: (*ast.Hint)(nil), - With: (*ast.With)(nil), Query: &ast.Select{ - Select: 0, - Distinct: false, - As: nil, - Results: []ast.SelectItem{ + Results: []ast.SelectItem{ &ast.Star{ Star: 9, }, @@ -26,7 +21,6 @@ FROM Array: -1, Lbrack: 25, Rbrack: 31, - Type: nil, Values: []ast.Expr{ &ast.IntLiteral{ ValuePos: 26, @@ -48,8 +42,7 @@ FROM }, }, }, - Hint: (*ast.Hint)(nil), - As: &ast.AsAlias{ + As: &ast.AsAlias{ As: -1, Alias: &ast.Ident{ NamePos: 34, @@ -69,14 +62,8 @@ FROM }, }, }, - Sample: (*ast.TableSample)(nil), }, }, - Where: (*ast.Where)(nil), - GroupBy: (*ast.GroupBy)(nil), - Having: (*ast.Having)(nil), - OrderBy: (*ast.OrderBy)(nil), - Limit: (*ast.Limit)(nil), }, } diff --git a/testdata/result/statement/select_with_after_hint.sql.txt b/testdata/result/statement/select_with_after_hint.sql.txt index fbc3c178..a56de4ef 100644 --- a/testdata/result/statement/select_with_after_hint.sql.txt +++ b/testdata/result/statement/select_with_after_hint.sql.txt @@ -4,7 +4,6 @@ --- AST &ast.QueryStatement{ Hint: &ast.Hint{ - Atmark: 0, Rbrace: 11, Records: []*ast.HintRecord{ &ast.HintRecord{ @@ -33,10 +32,8 @@ Name: "subq1", }, QueryExpr: &ast.Select{ - Select: 28, - Distinct: false, - As: nil, - Results: []ast.SelectItem{ + Select: 28, + Results: []ast.SelectItem{ &ast.ExprSelectItem{ Expr: &ast.Ident{ NamePos: 35, @@ -53,25 +50,15 @@ NameEnd: 46, Name: "foo", }, - Hint: (*ast.Hint)(nil), - As: (*ast.AsAlias)(nil), - Sample: (*ast.TableSample)(nil), }, }, - Where: (*ast.Where)(nil), - GroupBy: (*ast.GroupBy)(nil), - Having: (*ast.Having)(nil), - OrderBy: (*ast.OrderBy)(nil), - Limit: (*ast.Limit)(nil), }, }, }, }, Query: &ast.Select{ - Select: 48, - Distinct: false, - As: nil, - Results: []ast.SelectItem{ + Select: 48, + Results: []ast.SelectItem{ &ast.Star{ Star: 55, }, @@ -84,16 +71,8 @@ NameEnd: 67, Name: "subq1", }, - Hint: (*ast.Hint)(nil), - As: (*ast.AsAlias)(nil), - Sample: (*ast.TableSample)(nil), }, }, - Where: (*ast.Where)(nil), - GroupBy: (*ast.GroupBy)(nil), - Having: (*ast.Having)(nil), - OrderBy: (*ast.OrderBy)(nil), - Limit: (*ast.Limit)(nil), }, } diff --git a/testdata/result/statement/select_with_comment.sql.txt b/testdata/result/statement/select_with_comment.sql.txt index a19849c0..369a1a18 100644 --- a/testdata/result/statement/select_with_comment.sql.txt +++ b/testdata/result/statement/select_with_comment.sql.txt @@ -4,13 +4,9 @@ select 1 --- AST &ast.QueryStatement{ - Hint: (*ast.Hint)(nil), - With: (*ast.With)(nil), Query: &ast.Select{ - Select: 10, - Distinct: false, - As: nil, - Results: []ast.SelectItem{ + Select: 10, + Results: []ast.SelectItem{ &ast.ExprSelectItem{ Expr: &ast.IntLiteral{ ValuePos: 17, @@ -20,12 +16,6 @@ select 1 }, }, }, - From: (*ast.From)(nil), - Where: (*ast.Where)(nil), - GroupBy: (*ast.GroupBy)(nil), - Having: (*ast.Having)(nil), - OrderBy: (*ast.OrderBy)(nil), - Limit: (*ast.Limit)(nil), }, } diff --git a/testdata/result/statement/select_with_field_path.sql.txt b/testdata/result/statement/select_with_field_path.sql.txt index fb07732a..67bd84c5 100644 --- a/testdata/result/statement/select_with_field_path.sql.txt +++ b/testdata/result/statement/select_with_field_path.sql.txt @@ -19,13 +19,8 @@ WHERE A.z.a = 2 --- AST &ast.QueryStatement{ - Hint: (*ast.Hint)(nil), - With: (*ast.With)(nil), Query: &ast.Select{ - Select: 0, - Distinct: false, - As: nil, - Results: []ast.SelectItem{ + Results: []ast.SelectItem{ &ast.ExprSelectItem{ Expr: &ast.Path{ Idents: []*ast.Ident{ @@ -110,9 +105,8 @@ WHERE A.z.a = 2 Array: 57, Rparen: 251, Query: &ast.Select{ - Select: 70, - Distinct: false, - As: &ast.AsStruct{ + Select: 70, + As: &ast.AsStruct{ As: 77, Struct: 80, }, @@ -284,21 +278,11 @@ WHERE A.z.a = 2 }, }, }, - Hint: (*ast.Hint)(nil), - As: (*ast.AsAlias)(nil), - WithOffset: (*ast.WithOffset)(nil), - Sample: (*ast.TableSample)(nil), }, }, - Where: (*ast.Where)(nil), - GroupBy: (*ast.GroupBy)(nil), - Having: (*ast.Having)(nil), - OrderBy: (*ast.OrderBy)(nil), - Limit: (*ast.Limit)(nil), }, }, - Hint: (*ast.Hint)(nil), - As: &ast.AsAlias{ + As: &ast.AsAlias{ As: 257, Alias: &ast.Ident{ NamePos: 260, @@ -306,8 +290,6 @@ WHERE A.z.a = 2 Name: "A", }, }, - WithOffset: (*ast.WithOffset)(nil), - Sample: (*ast.TableSample)(nil), }, }, Where: &ast.Where{ @@ -341,10 +323,6 @@ WHERE A.z.a = 2 }, }, }, - GroupBy: (*ast.GroupBy)(nil), - Having: (*ast.Having)(nil), - OrderBy: (*ast.OrderBy)(nil), - Limit: (*ast.Limit)(nil), }, } diff --git a/testdata/result/statement/select_with_multiple_ctes.sql.txt b/testdata/result/statement/select_with_multiple_ctes.sql.txt index f5221e7f..415ae2c5 100644 --- a/testdata/result/statement/select_with_multiple_ctes.sql.txt +++ b/testdata/result/statement/select_with_multiple_ctes.sql.txt @@ -3,9 +3,7 @@ with subq1 as (select c1 from foo), subq2 as (select c2 from foo) select * from --- AST &ast.QueryStatement{ - Hint: (*ast.Hint)(nil), With: &ast.With{ - With: 0, CTEs: []*ast.CTE{ &ast.CTE{ Rparen: 33, @@ -15,10 +13,8 @@ with subq1 as (select c1 from foo), subq2 as (select c2 from foo) select * from Name: "subq1", }, QueryExpr: &ast.Select{ - Select: 15, - Distinct: false, - As: nil, - Results: []ast.SelectItem{ + Select: 15, + Results: []ast.SelectItem{ &ast.ExprSelectItem{ Expr: &ast.Ident{ NamePos: 22, @@ -35,16 +31,8 @@ with subq1 as (select c1 from foo), subq2 as (select c2 from foo) select * from NameEnd: 33, Name: "foo", }, - Hint: (*ast.Hint)(nil), - As: (*ast.AsAlias)(nil), - Sample: (*ast.TableSample)(nil), }, }, - Where: (*ast.Where)(nil), - GroupBy: (*ast.GroupBy)(nil), - Having: (*ast.Having)(nil), - OrderBy: (*ast.OrderBy)(nil), - Limit: (*ast.Limit)(nil), }, }, &ast.CTE{ @@ -55,10 +43,8 @@ with subq1 as (select c1 from foo), subq2 as (select c2 from foo) select * from Name: "subq2", }, QueryExpr: &ast.Select{ - Select: 46, - Distinct: false, - As: nil, - Results: []ast.SelectItem{ + Select: 46, + Results: []ast.SelectItem{ &ast.ExprSelectItem{ Expr: &ast.Ident{ NamePos: 53, @@ -75,25 +61,15 @@ with subq1 as (select c1 from foo), subq2 as (select c2 from foo) select * from NameEnd: 64, Name: "foo", }, - Hint: (*ast.Hint)(nil), - As: (*ast.AsAlias)(nil), - Sample: (*ast.TableSample)(nil), }, }, - Where: (*ast.Where)(nil), - GroupBy: (*ast.GroupBy)(nil), - Having: (*ast.Having)(nil), - OrderBy: (*ast.OrderBy)(nil), - Limit: (*ast.Limit)(nil), }, }, }, }, Query: &ast.Select{ - Select: 66, - Distinct: false, - As: nil, - Results: []ast.SelectItem{ + Select: 66, + Results: []ast.SelectItem{ &ast.Star{ Star: 73, }, @@ -106,16 +82,8 @@ with subq1 as (select c1 from foo), subq2 as (select c2 from foo) select * from NameEnd: 85, Name: "subq1", }, - Hint: (*ast.Hint)(nil), - As: (*ast.AsAlias)(nil), - Sample: (*ast.TableSample)(nil), }, }, - Where: (*ast.Where)(nil), - GroupBy: (*ast.GroupBy)(nil), - Having: (*ast.Having)(nil), - OrderBy: (*ast.OrderBy)(nil), - Limit: (*ast.Limit)(nil), }, } diff --git a/testdata/result/statement/select_with_reservedword.sql.txt b/testdata/result/statement/select_with_reservedword.sql.txt index f310b6f0..f6a0e091 100644 --- a/testdata/result/statement/select_with_reservedword.sql.txt +++ b/testdata/result/statement/select_with_reservedword.sql.txt @@ -6,13 +6,8 @@ FROM --- AST &ast.QueryStatement{ - Hint: (*ast.Hint)(nil), - With: (*ast.With)(nil), Query: &ast.Select{ - Select: 0, - Distinct: false, - As: nil, - Results: []ast.SelectItem{ + Results: []ast.SelectItem{ &ast.Star{ Star: 9, }, @@ -25,16 +20,8 @@ FROM NameEnd: 26, Name: "UNNEST", }, - Hint: (*ast.Hint)(nil), - As: (*ast.AsAlias)(nil), - Sample: (*ast.TableSample)(nil), }, }, - Where: (*ast.Where)(nil), - GroupBy: (*ast.GroupBy)(nil), - Having: (*ast.Having)(nil), - OrderBy: (*ast.OrderBy)(nil), - Limit: (*ast.Limit)(nil), }, } diff --git a/testdata/result/statement/select_with_sequence_function.sql.txt b/testdata/result/statement/select_with_sequence_function.sql.txt index 333ec82a..c5a07b7a 100644 --- a/testdata/result/statement/select_with_sequence_function.sql.txt +++ b/testdata/result/statement/select_with_sequence_function.sql.txt @@ -3,13 +3,8 @@ SELECT GET_NEXT_SEQUENCE_VALUE(SEQUENCE my_sequence) as next_id --- AST &ast.QueryStatement{ - Hint: (*ast.Hint)(nil), - With: (*ast.With)(nil), Query: &ast.Select{ - Select: 0, - Distinct: false, - As: nil, - Results: []ast.SelectItem{ + Results: []ast.SelectItem{ &ast.Alias{ Expr: &ast.CallExpr{ Rparen: 51, @@ -18,8 +13,7 @@ SELECT GET_NEXT_SEQUENCE_VALUE(SEQUENCE my_sequence) as next_id NameEnd: 30, Name: "GET_NEXT_SEQUENCE_VALUE", }, - Distinct: false, - Args: []ast.Arg{ + Args: []ast.Arg{ &ast.SequenceArg{ Sequence: 31, Expr: &ast.Ident{ @@ -29,9 +23,6 @@ SELECT GET_NEXT_SEQUENCE_VALUE(SEQUENCE my_sequence) as next_id }, }, }, - NamedArgs: []*ast.NamedArg(nil), - NullHandling: nil, - Having: nil, }, As: &ast.AsAlias{ As: 53, @@ -43,12 +34,6 @@ SELECT GET_NEXT_SEQUENCE_VALUE(SEQUENCE my_sequence) as next_id }, }, }, - From: (*ast.From)(nil), - Where: (*ast.Where)(nil), - GroupBy: (*ast.GroupBy)(nil), - Having: (*ast.Having)(nil), - OrderBy: (*ast.OrderBy)(nil), - Limit: (*ast.Limit)(nil), }, } diff --git a/testdata/result/statement/select_with_trailing_comma.sql.txt b/testdata/result/statement/select_with_trailing_comma.sql.txt index 8aba7288..835ed9e3 100644 --- a/testdata/result/statement/select_with_trailing_comma.sql.txt +++ b/testdata/result/statement/select_with_trailing_comma.sql.txt @@ -2,13 +2,8 @@ SELECT 1, 2, --- AST &ast.QueryStatement{ - Hint: (*ast.Hint)(nil), - With: (*ast.With)(nil), Query: &ast.Select{ - Select: 0, - Distinct: false, - As: nil, - Results: []ast.SelectItem{ + Results: []ast.SelectItem{ &ast.ExprSelectItem{ Expr: &ast.IntLiteral{ ValuePos: 7, @@ -26,12 +21,6 @@ SELECT 1, 2, }, }, }, - From: (*ast.From)(nil), - Where: (*ast.Where)(nil), - GroupBy: (*ast.GroupBy)(nil), - Having: (*ast.Having)(nil), - OrderBy: (*ast.OrderBy)(nil), - Limit: (*ast.Limit)(nil), }, } diff --git a/testdata/result/statement/update.sql.txt b/testdata/result/statement/update.sql.txt index fcf32946..e9e63cb1 100644 --- a/testdata/result/statement/update.sql.txt +++ b/testdata/result/statement/update.sql.txt @@ -2,13 +2,11 @@ update foo set foo = bar, bar = foo, baz = DEFAULT where foo = 1 --- AST &ast.Update{ - Update: 0, TableName: &ast.Ident{ NamePos: 7, NameEnd: 10, Name: "foo", }, - As: (*ast.AsAlias)(nil), Updates: []*ast.UpdateItem{ &ast.UpdateItem{ Path: []*ast.Ident{ @@ -20,7 +18,6 @@ update foo set foo = bar, bar = foo, baz = DEFAULT where foo = 1 }, DefaultExpr: &ast.DefaultExpr{ DefaultPos: -1, - Default: false, Expr: &ast.Ident{ NamePos: 21, NameEnd: 24, @@ -38,7 +35,6 @@ update foo set foo = bar, bar = foo, baz = DEFAULT where foo = 1 }, DefaultExpr: &ast.DefaultExpr{ DefaultPos: -1, - Default: false, Expr: &ast.Ident{ NamePos: 32, NameEnd: 35, @@ -57,7 +53,6 @@ update foo set foo = bar, bar = foo, baz = DEFAULT where foo = 1 DefaultExpr: &ast.DefaultExpr{ DefaultPos: 43, Default: true, - Expr: nil, }, }, }, @@ -78,7 +73,6 @@ update foo set foo = bar, bar = foo, baz = DEFAULT where foo = 1 }, }, }, - ThenReturn: (*ast.ThenReturn)(nil), } --- SQL diff --git a/testdata/result/statement/update_as.sql.txt b/testdata/result/statement/update_as.sql.txt index 00622578..002e9210 100644 --- a/testdata/result/statement/update_as.sql.txt +++ b/testdata/result/statement/update_as.sql.txt @@ -2,7 +2,6 @@ update foo as F set F.foo = F.bar + 1 where foo = F.bar --- AST &ast.Update{ - Update: 0, TableName: &ast.Ident{ NamePos: 7, NameEnd: 10, @@ -32,7 +31,6 @@ update foo as F set F.foo = F.bar + 1 where foo = F.bar }, DefaultExpr: &ast.DefaultExpr{ DefaultPos: -1, - Default: false, Expr: &ast.BinaryExpr{ Op: "+", Left: &ast.Path{ @@ -84,7 +82,6 @@ update foo as F set F.foo = F.bar + 1 where foo = F.bar }, }, }, - ThenReturn: (*ast.ThenReturn)(nil), } --- SQL diff --git a/testdata/result/statement/update_then_return_with_action.sql.txt b/testdata/result/statement/update_then_return_with_action.sql.txt index 438a476f..bfaba0eb 100644 --- a/testdata/result/statement/update_then_return_with_action.sql.txt +++ b/testdata/result/statement/update_then_return_with_action.sql.txt @@ -2,13 +2,11 @@ update foo set foo = bar, bar = foo, baz = DEFAULT where foo = 1 then return with action * --- AST &ast.Update{ - Update: 0, TableName: &ast.Ident{ NamePos: 7, NameEnd: 10, Name: "foo", }, - As: (*ast.AsAlias)(nil), Updates: []*ast.UpdateItem{ &ast.UpdateItem{ Path: []*ast.Ident{ @@ -20,7 +18,6 @@ update foo set foo = bar, bar = foo, baz = DEFAULT where foo = 1 then return wit }, DefaultExpr: &ast.DefaultExpr{ DefaultPos: -1, - Default: false, Expr: &ast.Ident{ NamePos: 21, NameEnd: 24, @@ -38,7 +35,6 @@ update foo set foo = bar, bar = foo, baz = DEFAULT where foo = 1 then return wit }, DefaultExpr: &ast.DefaultExpr{ DefaultPos: -1, - Default: false, Expr: &ast.Ident{ NamePos: 32, NameEnd: 35, @@ -57,7 +53,6 @@ update foo set foo = bar, bar = foo, baz = DEFAULT where foo = 1 then return wit DefaultExpr: &ast.DefaultExpr{ DefaultPos: 43, Default: true, - Expr: nil, }, }, }, @@ -83,7 +78,6 @@ update foo set foo = bar, bar = foo, baz = DEFAULT where foo = 1 then return wit WithAction: &ast.WithAction{ With: 77, Action: 82, - Alias: (*ast.AsAlias)(nil), }, Items: []ast.SelectItem{ &ast.Star{