From 45b3adda0e9631c398172c7b45bbdd0dccca481c Mon Sep 17 00:00:00 2001 From: apstndb <803393+apstndb@users.noreply.github.com> Date: Mon, 23 Sep 2024 22:45:43 +0900 Subject: [PATCH] Support named arguments (#114) --- ast/ast.go | 20 ++- ast/pos.go | 3 + ast/sql.go | 11 ++ lexer.go | 12 +- parser.go | 52 +++++- .../query/select_call_with_named_expr.sql | 3 + ...able_add_column_with_if_expression.sql.txt | 2 + testdata/result/ddl/create_table.sql.txt | 6 +- ...reate_table_with_sequence_function.sql.txt | 1 + .../dml/insert_with_sequence_function.sql.txt | 1 + .../query/select_call_with_named_expr.sql.txt | 151 ++++++++++++++++++ .../query/select_count_distinct.sql.txt | 1 + testdata/result/query/select_expr.sql.txt | 3 + .../result/query/select_literals_all.sql.txt | 2 + .../result/query/select_literals_date.sql.txt | 4 + .../select_with_sequence_function.sql.txt | 1 + ...able_add_column_with_if_expression.sql.txt | 2 + .../result/statement/create_table.sql.txt | 6 +- ...reate_table_with_sequence_function.sql.txt | 1 + .../insert_with_sequence_function.sql.txt | 1 + .../select_call_with_named_expr.sql.txt | 151 ++++++++++++++++++ .../statement/select_count_distinct.sql.txt | 1 + testdata/result/statement/select_expr.sql.txt | 3 + .../statement/select_literals_all.sql.txt | 2 + .../statement/select_literals_date.sql.txt | 4 + .../select_with_sequence_function.sql.txt | 1 + 26 files changed, 431 insertions(+), 14 deletions(-) create mode 100644 testdata/input/query/select_call_with_named_expr.sql create mode 100644 testdata/result/query/select_call_with_named_expr.sql.txt create mode 100644 testdata/result/statement/select_call_with_named_expr.sql.txt diff --git a/ast/ast.go b/ast/ast.go index a58895cf..bda55c26 100644 --- a/ast/ast.go +++ b/ast/ast.go @@ -944,16 +944,17 @@ type IndexExpr struct { // CallExpr is function call expression node. // -// {{.Func | sql}}({{if .Distinct}}DISTINCT{{end}} {{.Args | sql}}) +// {{.Func | sql}}({{if .Distinct}}DISTINCT{{end}} {{.Args | sqlJoin ", "}}{{if len(.Args) > 0 && len(.NamedArgs) > 0}}, {{end}}{{.NamedArgs || sqlJoin ", "}}) type CallExpr struct { // pos = Func.pos // end = Rparen + 1 Rparen token.Pos // position of ")" - Func *Ident - Distinct bool - Args []Arg + Func *Ident + Distinct bool + Args []Arg + NamedArgs []*NamedArg } // ExprArg is argument of the generic function call. @@ -991,6 +992,17 @@ type SequenceArg struct { Expr Expr } +// NamedArg represents a name and value pair in named arguments +// +// {{.Name | sql}} => {{.Value | sql}} +type NamedArg struct { + // pos = Name.pos + // end = Value.end + + Name *Ident + Value Expr +} + // CountStarExpr is node just for COUNT(*). // // COUNT(*) diff --git a/ast/pos.go b/ast/pos.go index ad28dcae..4e877709 100644 --- a/ast/pos.go +++ b/ast/pos.go @@ -328,6 +328,9 @@ func (i *IntervalArg) End() token.Pos { func (s *SequenceArg) Pos() token.Pos { return s.Sequence } func (s *SequenceArg) End() token.Pos { return s.Expr.End() } +func (n *NamedArg) Pos() token.Pos { return n.Name.Pos() } +func (n *NamedArg) End() token.Pos { return n.Value.End() } + func (c *CountStarExpr) Pos() token.Pos { return c.Count } func (c *CountStarExpr) End() token.Pos { return c.Rparen + 1 } diff --git a/ast/sql.go b/ast/sql.go index 8c3fdad5..dce4c552 100644 --- a/ast/sql.go +++ b/ast/sql.go @@ -474,10 +474,21 @@ func (c *CallExpr) SQL() string { } sql += a.SQL() } + if len(c.Args) > 0 && len(c.NamedArgs) > 0 { + sql += ", " + } + for i, v := range c.NamedArgs { + if i != 0 { + sql += ", " + } + sql += v.SQL() + } sql += ")" return sql } +func (n *NamedArg) SQL() string { return n.Name.SQL() + " => " + n.Value.SQL() } + func (o *SequenceOption) SQL() string { return o.Name.SQL() + " = " + o.Value.SQL() } diff --git a/lexer.go b/lexer.go index 7612ce16..26d679b0 100644 --- a/lexer.go +++ b/lexer.go @@ -109,7 +109,7 @@ func (l *Lexer) consumeToken() { } switch l.peek(0) { - case '(', ')', '{', '}', ';', ',', '[', ']', '~', '*', '/', '&', '^', '=', '+', '-': + case '(', ')', '{', '}', ';', ',', '[', ']', '~', '*', '/', '&', '^', '+', '-': l.Token.Kind = token.TokenKind([]byte{l.skip()}) return case '.': @@ -151,6 +151,16 @@ func (l *Lexer) consumeToken() { l.Token.Kind = ">" } return + case '=': + switch { + case l.peekIs(1, '>'): + l.skipN(2) + l.Token.Kind = "=>" + default: + l.skip() + l.Token.Kind = "=" + } + return case '|': switch { case l.peekIs(1, '|'): diff --git a/parser.go b/parser.go index fb5473c3..50edf82a 100644 --- a/parser.go +++ b/parser.go @@ -1460,7 +1460,7 @@ func (p *Parser) parseCall(id token.Token) ast.Expr { var args []ast.Arg if p.Token.Kind != ")" { - for p.Token.Kind != token.TokenEOF { + for p.Token.Kind != token.TokenEOF && !p.lookaheadNamedArg() { args = append(args, p.parseArg()) if p.Token.Kind != "," { break @@ -1468,12 +1468,54 @@ func (p *Parser) parseCall(id token.Token) ast.Expr { p.nextToken() } } + + // https://github.com/google/zetasql/blob/master/docs/functions-reference.md#named-arguments + // You cannot specify positional arguments after named arguments. + var namedArgs []*ast.NamedArg + for { + namedArg := p.tryParseNamedArg() + if namedArg == nil { + break + } + namedArgs = append(namedArgs, namedArg) + if p.Token.Kind != "," { + break + } + p.nextToken() + } + rparen := p.expect(")").Pos return &ast.CallExpr{ - Rparen: rparen, - Func: fn, - Distinct: distinct, - Args: args, + Rparen: rparen, + Func: fn, + Distinct: distinct, + Args: args, + NamedArgs: namedArgs, + } +} +func (p *Parser) lookaheadNamedArg() bool { + lexer := p.Lexer.Clone() + defer func() { + p.Lexer = lexer + }() + + if p.Token.Kind != token.TokenIdent { + return false + } + p.parseIdent() + return p.Token.Kind == "=>" +} + +func (p *Parser) tryParseNamedArg() *ast.NamedArg { + if !p.lookaheadNamedArg() { + return nil + } + name := p.parseIdent() + p.expect("=>") + value := p.parseExpr() + return &ast.NamedArg{ + Name: name, + Value: value, } } diff --git a/testdata/input/query/select_call_with_named_expr.sql b/testdata/input/query/select_call_with_named_expr.sql new file mode 100644 index 00000000..cbada767 --- /dev/null +++ b/testdata/input/query/select_call_with_named_expr.sql @@ -0,0 +1,3 @@ +SELECT a.AlbumId, a.Description +FROM Albums a +WHERE a.SingerId = 1 AND SEARCH(a.DescriptionTokens, 'classic albums', enhance_query => TRUE) \ No newline at end of file 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 72daf188..296ec2a0 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 @@ -99,6 +99,7 @@ ALTER TABLE foo ADD COLUMN expired_at TIMESTAMP AS (IF (status != "OPEN" AND sta }, }, }, + NamedArgs: []*ast.NamedArg(nil), }, }, &ast.ExprArg{ @@ -107,6 +108,7 @@ ALTER TABLE foo ADD COLUMN expired_at TIMESTAMP AS (IF (status != "OPEN" AND sta }, }, }, + NamedArgs: []*ast.NamedArg(nil), }, }, Options: (*ast.ColumnDefOptions)(nil), diff --git a/testdata/result/ddl/create_table.sql.txt b/testdata/result/ddl/create_table.sql.txt index b0640aa2..09e7fed4 100644 --- a/testdata/result/ddl/create_table.sql.txt +++ b/testdata/result/ddl/create_table.sql.txt @@ -133,6 +133,7 @@ create table foo ( }, }, }, + NamedArgs: []*ast.NamedArg(nil), }, }, Options: (*ast.ColumnDefOptions)(nil), @@ -175,8 +176,9 @@ create table foo ( NameEnd: 546, Name: "current_timestamp", }, - Distinct: false, - Args: []ast.Arg(nil), + Distinct: false, + Args: []ast.Arg(nil), + NamedArgs: []*ast.NamedArg(nil), }, }, GeneratedExpr: (*ast.GeneratedColumnExpr)(nil), 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 af66d782..d3fac4a3 100644 --- a/testdata/result/ddl/create_table_with_sequence_function.sql.txt +++ b/testdata/result/ddl/create_table_with_sequence_function.sql.txt @@ -50,6 +50,7 @@ CREATE TABLE foo }, }, }, + NamedArgs: []*ast.NamedArg(nil), }, }, GeneratedExpr: (*ast.GeneratedColumnExpr)(nil), diff --git a/testdata/result/dml/insert_with_sequence_function.sql.txt b/testdata/result/dml/insert_with_sequence_function.sql.txt index 19283145..2424b7a2 100644 --- a/testdata/result/dml/insert_with_sequence_function.sql.txt +++ b/testdata/result/dml/insert_with_sequence_function.sql.txt @@ -45,6 +45,7 @@ INSERT INTO foo(bar) VALUES (GET_NEXT_SEQUENCE_VALUE(SEQUENCE my_sequence)) }, }, }, + NamedArgs: []*ast.NamedArg(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 new file mode 100644 index 00000000..ec26e038 --- /dev/null +++ b/testdata/result/query/select_call_with_named_expr.sql.txt @@ -0,0 +1,151 @@ +--- select_call_with_named_expr.sql +SELECT a.AlbumId, a.Description +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, + AsStruct: false, + Results: []ast.SelectItem{ + &ast.ExprSelectItem{ + Expr: &ast.Path{ + Idents: []*ast.Ident{ + &ast.Ident{ + NamePos: 7, + NameEnd: 8, + Name: "a", + }, + &ast.Ident{ + NamePos: 9, + NameEnd: 16, + Name: "AlbumId", + }, + }, + }, + }, + &ast.ExprSelectItem{ + Expr: &ast.Path{ + Idents: []*ast.Ident{ + &ast.Ident{ + NamePos: 18, + NameEnd: 19, + Name: "a", + }, + &ast.Ident{ + NamePos: 20, + NameEnd: 31, + Name: "Description", + }, + }, + }, + }, + }, + From: &ast.From{ + From: 32, + Source: &ast.TableName{ + Table: &ast.Ident{ + NamePos: 37, + NameEnd: 43, + Name: "Albums", + }, + Hint: (*ast.Hint)(nil), + As: &ast.AsAlias{ + As: 44, + Alias: &ast.Ident{ + NamePos: 44, + NameEnd: 45, + Name: "a", + }, + }, + Sample: (*ast.TableSample)(nil), + }, + }, + Where: &ast.Where{ + Where: 46, + Expr: &ast.BinaryExpr{ + Op: "AND", + Left: &ast.BinaryExpr{ + Op: "=", + Left: &ast.Path{ + Idents: []*ast.Ident{ + &ast.Ident{ + NamePos: 52, + NameEnd: 53, + Name: "a", + }, + &ast.Ident{ + NamePos: 54, + NameEnd: 62, + Name: "SingerId", + }, + }, + }, + Right: &ast.IntLiteral{ + ValuePos: 65, + ValueEnd: 66, + Base: 10, + Value: "1", + }, + }, + Right: &ast.CallExpr{ + Rparen: 138, + Func: &ast.Ident{ + NamePos: 71, + NameEnd: 77, + Name: "SEARCH", + }, + Distinct: false, + Args: []ast.Arg{ + &ast.ExprArg{ + Expr: &ast.Path{ + Idents: []*ast.Ident{ + &ast.Ident{ + NamePos: 78, + NameEnd: 79, + Name: "a", + }, + &ast.Ident{ + NamePos: 80, + NameEnd: 97, + Name: "DescriptionTokens", + }, + }, + }, + }, + &ast.ExprArg{ + Expr: &ast.StringLiteral{ + ValuePos: 99, + ValueEnd: 115, + Value: "classic albums", + }, + }, + }, + NamedArgs: []*ast.NamedArg{ + &ast.NamedArg{ + Name: &ast.Ident{ + NamePos: 117, + NameEnd: 130, + Name: "enhance_query", + }, + Value: &ast.BoolLiteral{ + ValuePos: 134, + Value: true, + }, + }, + }, + }, + }, + }, + GroupBy: (*ast.GroupBy)(nil), + Having: (*ast.Having)(nil), + OrderBy: (*ast.OrderBy)(nil), + Limit: (*ast.Limit)(nil), + }, +} + +--- SQL +SELECT a.AlbumId, a.Description FROM Albums AS a WHERE a.SingerId = 1 AND SEARCH(a.DescriptionTokens, "classic albums", enhance_query => TRUE) diff --git a/testdata/result/query/select_count_distinct.sql.txt b/testdata/result/query/select_count_distinct.sql.txt index 5af2d362..49418b2a 100644 --- a/testdata/result/query/select_count_distinct.sql.txt +++ b/testdata/result/query/select_count_distinct.sql.txt @@ -27,6 +27,7 @@ select count(distinct x) from foo }, }, }, + NamedArgs: []*ast.NamedArg(nil), }, }, }, diff --git a/testdata/result/query/select_expr.sql.txt b/testdata/result/query/select_expr.sql.txt index 87e68b89..bbf95796 100644 --- a/testdata/result/query/select_expr.sql.txt +++ b/testdata/result/query/select_expr.sql.txt @@ -617,6 +617,7 @@ select 1 + 2, 1 - 2, }, }, }, + NamedArgs: []*ast.NamedArg(nil), }, }, &ast.ExprSelectItem{ @@ -654,6 +655,7 @@ select 1 + 2, 1 - 2, }, }, }, + NamedArgs: []*ast.NamedArg(nil), }, }, &ast.ExprSelectItem{ @@ -897,6 +899,7 @@ select 1 + 2, 1 - 2, }, }, }, + NamedArgs: []*ast.NamedArg(nil), }, Right: &ast.IntLiteral{ ValuePos: 790, diff --git a/testdata/result/query/select_literals_all.sql.txt b/testdata/result/query/select_literals_all.sql.txt index 37ca4c61..7e9710cf 100644 --- a/testdata/result/query/select_literals_all.sql.txt +++ b/testdata/result/query/select_literals_all.sql.txt @@ -501,6 +501,7 @@ lines''', }, }, }, + NamedArgs: []*ast.NamedArg(nil), }, }, &ast.ExprSelectItem{ @@ -551,6 +552,7 @@ lines''', }, }, }, + NamedArgs: []*ast.NamedArg(nil), }, }, &ast.ExprSelectItem{ diff --git a/testdata/result/query/select_literals_date.sql.txt b/testdata/result/query/select_literals_date.sql.txt index 24c00893..082ff35a 100644 --- a/testdata/result/query/select_literals_date.sql.txt +++ b/testdata/result/query/select_literals_date.sql.txt @@ -48,6 +48,7 @@ SELECT }, }, }, + NamedArgs: []*ast.NamedArg(nil), }, }, &ast.ExprSelectItem{ @@ -108,6 +109,7 @@ SELECT }, }, }, + NamedArgs: []*ast.NamedArg(nil), }, }, &ast.ExprSelectItem{ @@ -138,6 +140,7 @@ SELECT }, }, }, + NamedArgs: []*ast.NamedArg(nil), }, As: &ast.AsAlias{ As: -1, @@ -166,6 +169,7 @@ SELECT }, }, }, + NamedArgs: []*ast.NamedArg(nil), }, As: &ast.AsAlias{ As: -1, diff --git a/testdata/result/query/select_with_sequence_function.sql.txt b/testdata/result/query/select_with_sequence_function.sql.txt index 5d5e76ed..f940e62d 100644 --- a/testdata/result/query/select_with_sequence_function.sql.txt +++ b/testdata/result/query/select_with_sequence_function.sql.txt @@ -29,6 +29,7 @@ SELECT GET_NEXT_SEQUENCE_VALUE(SEQUENCE my_sequence) as next_id }, }, }, + NamedArgs: []*ast.NamedArg(nil), }, As: &ast.AsAlias{ As: -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 72daf188..296ec2a0 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 @@ -99,6 +99,7 @@ ALTER TABLE foo ADD COLUMN expired_at TIMESTAMP AS (IF (status != "OPEN" AND sta }, }, }, + NamedArgs: []*ast.NamedArg(nil), }, }, &ast.ExprArg{ @@ -107,6 +108,7 @@ ALTER TABLE foo ADD COLUMN expired_at TIMESTAMP AS (IF (status != "OPEN" AND sta }, }, }, + NamedArgs: []*ast.NamedArg(nil), }, }, Options: (*ast.ColumnDefOptions)(nil), diff --git a/testdata/result/statement/create_table.sql.txt b/testdata/result/statement/create_table.sql.txt index b0640aa2..09e7fed4 100644 --- a/testdata/result/statement/create_table.sql.txt +++ b/testdata/result/statement/create_table.sql.txt @@ -133,6 +133,7 @@ create table foo ( }, }, }, + NamedArgs: []*ast.NamedArg(nil), }, }, Options: (*ast.ColumnDefOptions)(nil), @@ -175,8 +176,9 @@ create table foo ( NameEnd: 546, Name: "current_timestamp", }, - Distinct: false, - Args: []ast.Arg(nil), + Distinct: false, + Args: []ast.Arg(nil), + NamedArgs: []*ast.NamedArg(nil), }, }, GeneratedExpr: (*ast.GeneratedColumnExpr)(nil), 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 af66d782..d3fac4a3 100644 --- a/testdata/result/statement/create_table_with_sequence_function.sql.txt +++ b/testdata/result/statement/create_table_with_sequence_function.sql.txt @@ -50,6 +50,7 @@ CREATE TABLE foo }, }, }, + NamedArgs: []*ast.NamedArg(nil), }, }, GeneratedExpr: (*ast.GeneratedColumnExpr)(nil), diff --git a/testdata/result/statement/insert_with_sequence_function.sql.txt b/testdata/result/statement/insert_with_sequence_function.sql.txt index 19283145..2424b7a2 100644 --- a/testdata/result/statement/insert_with_sequence_function.sql.txt +++ b/testdata/result/statement/insert_with_sequence_function.sql.txt @@ -45,6 +45,7 @@ INSERT INTO foo(bar) VALUES (GET_NEXT_SEQUENCE_VALUE(SEQUENCE my_sequence)) }, }, }, + NamedArgs: []*ast.NamedArg(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 new file mode 100644 index 00000000..ec26e038 --- /dev/null +++ b/testdata/result/statement/select_call_with_named_expr.sql.txt @@ -0,0 +1,151 @@ +--- select_call_with_named_expr.sql +SELECT a.AlbumId, a.Description +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, + AsStruct: false, + Results: []ast.SelectItem{ + &ast.ExprSelectItem{ + Expr: &ast.Path{ + Idents: []*ast.Ident{ + &ast.Ident{ + NamePos: 7, + NameEnd: 8, + Name: "a", + }, + &ast.Ident{ + NamePos: 9, + NameEnd: 16, + Name: "AlbumId", + }, + }, + }, + }, + &ast.ExprSelectItem{ + Expr: &ast.Path{ + Idents: []*ast.Ident{ + &ast.Ident{ + NamePos: 18, + NameEnd: 19, + Name: "a", + }, + &ast.Ident{ + NamePos: 20, + NameEnd: 31, + Name: "Description", + }, + }, + }, + }, + }, + From: &ast.From{ + From: 32, + Source: &ast.TableName{ + Table: &ast.Ident{ + NamePos: 37, + NameEnd: 43, + Name: "Albums", + }, + Hint: (*ast.Hint)(nil), + As: &ast.AsAlias{ + As: 44, + Alias: &ast.Ident{ + NamePos: 44, + NameEnd: 45, + Name: "a", + }, + }, + Sample: (*ast.TableSample)(nil), + }, + }, + Where: &ast.Where{ + Where: 46, + Expr: &ast.BinaryExpr{ + Op: "AND", + Left: &ast.BinaryExpr{ + Op: "=", + Left: &ast.Path{ + Idents: []*ast.Ident{ + &ast.Ident{ + NamePos: 52, + NameEnd: 53, + Name: "a", + }, + &ast.Ident{ + NamePos: 54, + NameEnd: 62, + Name: "SingerId", + }, + }, + }, + Right: &ast.IntLiteral{ + ValuePos: 65, + ValueEnd: 66, + Base: 10, + Value: "1", + }, + }, + Right: &ast.CallExpr{ + Rparen: 138, + Func: &ast.Ident{ + NamePos: 71, + NameEnd: 77, + Name: "SEARCH", + }, + Distinct: false, + Args: []ast.Arg{ + &ast.ExprArg{ + Expr: &ast.Path{ + Idents: []*ast.Ident{ + &ast.Ident{ + NamePos: 78, + NameEnd: 79, + Name: "a", + }, + &ast.Ident{ + NamePos: 80, + NameEnd: 97, + Name: "DescriptionTokens", + }, + }, + }, + }, + &ast.ExprArg{ + Expr: &ast.StringLiteral{ + ValuePos: 99, + ValueEnd: 115, + Value: "classic albums", + }, + }, + }, + NamedArgs: []*ast.NamedArg{ + &ast.NamedArg{ + Name: &ast.Ident{ + NamePos: 117, + NameEnd: 130, + Name: "enhance_query", + }, + Value: &ast.BoolLiteral{ + ValuePos: 134, + Value: true, + }, + }, + }, + }, + }, + }, + GroupBy: (*ast.GroupBy)(nil), + Having: (*ast.Having)(nil), + OrderBy: (*ast.OrderBy)(nil), + Limit: (*ast.Limit)(nil), + }, +} + +--- SQL +SELECT a.AlbumId, a.Description FROM Albums AS a WHERE a.SingerId = 1 AND SEARCH(a.DescriptionTokens, "classic albums", enhance_query => TRUE) diff --git a/testdata/result/statement/select_count_distinct.sql.txt b/testdata/result/statement/select_count_distinct.sql.txt index 5af2d362..49418b2a 100644 --- a/testdata/result/statement/select_count_distinct.sql.txt +++ b/testdata/result/statement/select_count_distinct.sql.txt @@ -27,6 +27,7 @@ select count(distinct x) from foo }, }, }, + NamedArgs: []*ast.NamedArg(nil), }, }, }, diff --git a/testdata/result/statement/select_expr.sql.txt b/testdata/result/statement/select_expr.sql.txt index 87e68b89..bbf95796 100644 --- a/testdata/result/statement/select_expr.sql.txt +++ b/testdata/result/statement/select_expr.sql.txt @@ -617,6 +617,7 @@ select 1 + 2, 1 - 2, }, }, }, + NamedArgs: []*ast.NamedArg(nil), }, }, &ast.ExprSelectItem{ @@ -654,6 +655,7 @@ select 1 + 2, 1 - 2, }, }, }, + NamedArgs: []*ast.NamedArg(nil), }, }, &ast.ExprSelectItem{ @@ -897,6 +899,7 @@ select 1 + 2, 1 - 2, }, }, }, + NamedArgs: []*ast.NamedArg(nil), }, Right: &ast.IntLiteral{ ValuePos: 790, diff --git a/testdata/result/statement/select_literals_all.sql.txt b/testdata/result/statement/select_literals_all.sql.txt index 37ca4c61..7e9710cf 100644 --- a/testdata/result/statement/select_literals_all.sql.txt +++ b/testdata/result/statement/select_literals_all.sql.txt @@ -501,6 +501,7 @@ lines''', }, }, }, + NamedArgs: []*ast.NamedArg(nil), }, }, &ast.ExprSelectItem{ @@ -551,6 +552,7 @@ lines''', }, }, }, + NamedArgs: []*ast.NamedArg(nil), }, }, &ast.ExprSelectItem{ diff --git a/testdata/result/statement/select_literals_date.sql.txt b/testdata/result/statement/select_literals_date.sql.txt index 24c00893..082ff35a 100644 --- a/testdata/result/statement/select_literals_date.sql.txt +++ b/testdata/result/statement/select_literals_date.sql.txt @@ -48,6 +48,7 @@ SELECT }, }, }, + NamedArgs: []*ast.NamedArg(nil), }, }, &ast.ExprSelectItem{ @@ -108,6 +109,7 @@ SELECT }, }, }, + NamedArgs: []*ast.NamedArg(nil), }, }, &ast.ExprSelectItem{ @@ -138,6 +140,7 @@ SELECT }, }, }, + NamedArgs: []*ast.NamedArg(nil), }, As: &ast.AsAlias{ As: -1, @@ -166,6 +169,7 @@ SELECT }, }, }, + NamedArgs: []*ast.NamedArg(nil), }, As: &ast.AsAlias{ As: -1, diff --git a/testdata/result/statement/select_with_sequence_function.sql.txt b/testdata/result/statement/select_with_sequence_function.sql.txt index 5d5e76ed..f940e62d 100644 --- a/testdata/result/statement/select_with_sequence_function.sql.txt +++ b/testdata/result/statement/select_with_sequence_function.sql.txt @@ -29,6 +29,7 @@ SELECT GET_NEXT_SEQUENCE_VALUE(SEQUENCE my_sequence) as next_id }, }, }, + NamedArgs: []*ast.NamedArg(nil), }, As: &ast.AsAlias{ As: -1,