From 5183c36e1fcd228a126fc23b6948345c845214d0 Mon Sep 17 00:00:00 2001 From: TSUYUSATO Kitsune Date: Wed, 1 Jan 2025 12:59:56 +0900 Subject: [PATCH] Enable path keys in hints Fix #242 It is a breaking change due to modifying the AST node structure. --- ast/ast.go | 2 +- parser.go | 2 +- testdata/input/query/select_hint_path.sql | 1 + .../dml/update_with_safe_ml_predict.sql.txt | 12 +++-- .../result/query/!bad_hint_select_2.sql.txt | 12 +++-- .../select_album_with_index_directive.sql.txt | 12 +++-- .../query/select_from_ml_predict_hint.sql.txt | 12 +++-- .../select_from_ml_predict_textbison.sql.txt | 12 +++-- .../query/select_function_hints.sql.txt | 12 +++-- testdata/result/query/select_hint.sql.txt | 24 ++++++---- .../result/query/select_hint_path.sql.txt | 48 +++++++++++++++++++ .../select_singer_with_join_hint.sql.txt | 48 ++++++++++++------- ..._singer_with_table_alias_with_hint.sql.txt | 12 +++-- .../select_singer_with_table_hint.sql.txt | 12 +++-- ...ect_singer_with_toplevel_join_hint.sql.txt | 12 +++-- .../query/select_unnest_with_offset.sql.txt | 12 +++-- .../query/select_with_after_hint.sql.txt | 12 +++-- .../statement/!bad_hint_select_2.sql.txt | 12 +++-- .../select_album_with_index_directive.sql.txt | 12 +++-- .../select_from_ml_predict_hint.sql.txt | 12 +++-- .../select_from_ml_predict_textbison.sql.txt | 12 +++-- .../statement/select_function_hints.sql.txt | 12 +++-- testdata/result/statement/select_hint.sql.txt | 24 ++++++---- .../result/statement/select_hint_path.sql.txt | 48 +++++++++++++++++++ .../select_singer_with_join_hint.sql.txt | 48 ++++++++++++------- ..._singer_with_table_alias_with_hint.sql.txt | 12 +++-- .../select_singer_with_table_hint.sql.txt | 12 +++-- ...ect_singer_with_toplevel_join_hint.sql.txt | 12 +++-- .../select_unnest_with_offset.sql.txt | 12 +++-- .../statement/select_with_after_hint.sql.txt | 12 +++-- .../update_with_safe_ml_predict.sql.txt | 12 +++-- 31 files changed, 371 insertions(+), 138 deletions(-) create mode 100644 testdata/input/query/select_hint_path.sql create mode 100644 testdata/result/query/select_hint_path.sql.txt create mode 100644 testdata/result/statement/select_hint_path.sql.txt diff --git a/ast/ast.go b/ast/ast.go index 5f8f08ed..04fe8cd3 100644 --- a/ast/ast.go +++ b/ast/ast.go @@ -680,7 +680,7 @@ type HintRecord struct { // pos = Key.pos // end = Value.end - Key *Ident + Key *Path Value Expr } diff --git a/parser.go b/parser.go index 16be4e2a..b5726da9 100644 --- a/parser.go +++ b/parser.go @@ -347,7 +347,7 @@ func (p *Parser) tryParseHint() *ast.Hint { } func (p *Parser) parseHintRecord() *ast.HintRecord { - key := p.parseIdent() + key := p.parsePath() p.expect("=") value := p.parseExpr() return &ast.HintRecord{ diff --git a/testdata/input/query/select_hint_path.sql b/testdata/input/query/select_hint_path.sql new file mode 100644 index 00000000..d5332867 --- /dev/null +++ b/testdata/input/query/select_hint_path.sql @@ -0,0 +1 @@ +@{spanner.optimizer_version=5} SELECT 1 \ No newline at end of file diff --git a/testdata/result/dml/update_with_safe_ml_predict.sql.txt b/testdata/result/dml/update_with_safe_ml_predict.sql.txt index 423cf296..60bd0d1c 100644 --- a/testdata/result/dml/update_with_safe_ml_predict.sql.txt +++ b/testdata/result/dml/update_with_safe_ml_predict.sql.txt @@ -135,10 +135,14 @@ WHERE products.desc_embed IS NULL Rbrace: 327, Records: []*ast.HintRecord{ &ast.HintRecord{ - Key: &ast.Ident{ - NamePos: 296, - NameEnd: 323, - Name: "remote_udf_max_rows_per_rpc", + Key: &ast.Path{ + Idents: []*ast.Ident{ + &ast.Ident{ + NamePos: 296, + NameEnd: 323, + Name: "remote_udf_max_rows_per_rpc", + }, + }, }, Value: &ast.IntLiteral{ ValuePos: 324, diff --git a/testdata/result/query/!bad_hint_select_2.sql.txt b/testdata/result/query/!bad_hint_select_2.sql.txt index 5f06efa5..8cd9beeb 100644 --- a/testdata/result/query/!bad_hint_select_2.sql.txt +++ b/testdata/result/query/!bad_hint_select_2.sql.txt @@ -12,10 +12,14 @@ syntax error: testdata/input/query/!bad_hint_select_2.sql:1:19: unexpected token Rbrace: 10, Records: []*ast.HintRecord{ &ast.HintRecord{ - Key: &ast.Ident{ - NamePos: 2, - NameEnd: 6, - Name: "hint", + Key: &ast.Path{ + Idents: []*ast.Ident{ + &ast.Ident{ + NamePos: 2, + NameEnd: 6, + Name: "hint", + }, + }, }, Value: &ast.IntLiteral{ ValuePos: 9, 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 9e4e6986..e938bfa0 100644 --- a/testdata/result/query/select_album_with_index_directive.sql.txt +++ b/testdata/result/query/select_album_with_index_directive.sql.txt @@ -42,10 +42,14 @@ WHERE AlbumTitle >= @startTitle AND AlbumTitle < @endTitle Rbrace: 87, Records: []*ast.HintRecord{ &ast.HintRecord{ - Key: &ast.Ident{ - NamePos: 57, - NameEnd: 68, - Name: "FORCE_INDEX", + Key: &ast.Path{ + Idents: []*ast.Ident{ + &ast.Ident{ + NamePos: 57, + NameEnd: 68, + Name: "FORCE_INDEX", + }, + }, }, Value: &ast.Ident{ NamePos: 69, diff --git a/testdata/result/query/select_from_ml_predict_hint.sql.txt b/testdata/result/query/select_from_ml_predict_hint.sql.txt index 78b338b2..3d04ece4 100644 --- a/testdata/result/query/select_from_ml_predict_hint.sql.txt +++ b/testdata/result/query/select_from_ml_predict_hint.sql.txt @@ -152,10 +152,14 @@ FROM ML.PREDICT( Rbrace: 322, Records: []*ast.HintRecord{ &ast.HintRecord{ - Key: &ast.Ident{ - NamePos: 293, - NameEnd: 320, - Name: "remote_udf_max_rows_per_rpc", + Key: &ast.Path{ + Idents: []*ast.Ident{ + &ast.Ident{ + NamePos: 293, + NameEnd: 320, + Name: "remote_udf_max_rows_per_rpc", + }, + }, }, Value: &ast.IntLiteral{ ValuePos: 321, diff --git a/testdata/result/query/select_from_ml_predict_textbison.sql.txt b/testdata/result/query/select_from_ml_predict_textbison.sql.txt index 5c05bdcb..60bf3d4c 100644 --- a/testdata/result/query/select_from_ml_predict_textbison.sql.txt +++ b/testdata/result/query/select_from_ml_predict_textbison.sql.txt @@ -351,10 +351,14 @@ FROM ML.PREDICT( Rbrace: 613, Records: []*ast.HintRecord{ &ast.HintRecord{ - Key: &ast.Ident{ - NamePos: 584, - NameEnd: 611, - Name: "remote_udf_max_rows_per_rpc", + Key: &ast.Path{ + Idents: []*ast.Ident{ + &ast.Ident{ + NamePos: 584, + NameEnd: 611, + Name: "remote_udf_max_rows_per_rpc", + }, + }, }, Value: &ast.IntLiteral{ ValuePos: 612, diff --git a/testdata/result/query/select_function_hints.sql.txt b/testdata/result/query/select_function_hints.sql.txt index 75ab03be..cc536049 100644 --- a/testdata/result/query/select_function_hints.sql.txt +++ b/testdata/result/query/select_function_hints.sql.txt @@ -154,10 +154,14 @@ FROM (SELECT SHA512(z) @{DISABLE_INLINE = TRUE} AS x FROM t) Rbrace: 241, Records: []*ast.HintRecord{ &ast.HintRecord{ - Key: &ast.Ident{ - NamePos: 220, - NameEnd: 234, - Name: "DISABLE_INLINE", + Key: &ast.Path{ + Idents: []*ast.Ident{ + &ast.Ident{ + NamePos: 220, + NameEnd: 234, + Name: "DISABLE_INLINE", + }, + }, }, Value: &ast.BoolLiteral{ ValuePos: 237, diff --git a/testdata/result/query/select_hint.sql.txt b/testdata/result/query/select_hint.sql.txt index 374f27f1..ff76da5b 100644 --- a/testdata/result/query/select_hint.sql.txt +++ b/testdata/result/query/select_hint.sql.txt @@ -6,10 +6,14 @@ Rbrace: 22, Records: []*ast.HintRecord{ &ast.HintRecord{ - Key: &ast.Ident{ - NamePos: 2, - NameEnd: 7, - Name: "hint1", + Key: &ast.Path{ + Idents: []*ast.Ident{ + &ast.Ident{ + NamePos: 2, + NameEnd: 7, + Name: "hint1", + }, + }, }, Value: &ast.IntLiteral{ ValuePos: 10, @@ -19,10 +23,14 @@ }, }, &ast.HintRecord{ - Key: &ast.Ident{ - NamePos: 13, - NameEnd: 18, - Name: "hint2", + Key: &ast.Path{ + Idents: []*ast.Ident{ + &ast.Ident{ + NamePos: 13, + NameEnd: 18, + Name: "hint2", + }, + }, }, Value: &ast.IntLiteral{ ValuePos: 21, diff --git a/testdata/result/query/select_hint_path.sql.txt b/testdata/result/query/select_hint_path.sql.txt new file mode 100644 index 00000000..8ac1ea3f --- /dev/null +++ b/testdata/result/query/select_hint_path.sql.txt @@ -0,0 +1,48 @@ +--- select_hint_path.sql +@{spanner.optimizer_version=5} SELECT 1 +--- AST +&ast.QueryStatement{ + Hint: &ast.Hint{ + Rbrace: 29, + Records: []*ast.HintRecord{ + &ast.HintRecord{ + Key: &ast.Path{ + Idents: []*ast.Ident{ + &ast.Ident{ + NamePos: 2, + NameEnd: 9, + Name: "spanner", + }, + &ast.Ident{ + NamePos: 10, + NameEnd: 27, + Name: "optimizer_version", + }, + }, + }, + Value: &ast.IntLiteral{ + ValuePos: 28, + ValueEnd: 29, + Base: 10, + Value: "5", + }, + }, + }, + }, + Query: &ast.Select{ + Select: 31, + Results: []ast.SelectItem{ + &ast.ExprSelectItem{ + Expr: &ast.IntLiteral{ + ValuePos: 38, + ValueEnd: 39, + Base: 10, + Value: "1", + }, + }, + }, + }, +} + +--- SQL +@{spanner.optimizer_version=5} SELECT 1 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 272a54be..06d8a6ef 100644 --- a/testdata/result/query/select_singer_with_join_hint.sql.txt +++ b/testdata/result/query/select_singer_with_join_hint.sql.txt @@ -33,10 +33,14 @@ FROM Rbrace: 279, Records: []*ast.HintRecord{ &ast.HintRecord{ - Key: &ast.Ident{ - NamePos: 260, - NameEnd: 269, - Name: "JOIN_TYPE", + Key: &ast.Path{ + Idents: []*ast.Ident{ + &ast.Ident{ + NamePos: 260, + NameEnd: 269, + Name: "JOIN_TYPE", + }, + }, }, Value: &ast.Ident{ NamePos: 270, @@ -53,10 +57,14 @@ FROM Rbrace: 209, Records: []*ast.HintRecord{ &ast.HintRecord{ - Key: &ast.Ident{ - NamePos: 189, - NameEnd: 198, - Name: "JOIN_TYPE", + Key: &ast.Path{ + Idents: []*ast.Ident{ + &ast.Ident{ + NamePos: 189, + NameEnd: 198, + Name: "JOIN_TYPE", + }, + }, }, Value: &ast.Ident{ NamePos: 199, @@ -73,10 +81,14 @@ FROM Rbrace: 138, Records: []*ast.HintRecord{ &ast.HintRecord{ - Key: &ast.Ident{ - NamePos: 119, - NameEnd: 128, - Name: "JOIN_TYPE", + Key: &ast.Path{ + Idents: []*ast.Ident{ + &ast.Ident{ + NamePos: 119, + NameEnd: 128, + Name: "JOIN_TYPE", + }, + }, }, Value: &ast.Ident{ NamePos: 129, @@ -93,10 +105,14 @@ FROM Rbrace: 68, Records: []*ast.HintRecord{ &ast.HintRecord{ - Key: &ast.Ident{ - NamePos: 47, - NameEnd: 63, - Name: "FORCE_JOIN_ORDER", + Key: &ast.Path{ + Idents: []*ast.Ident{ + &ast.Ident{ + NamePos: 47, + NameEnd: 63, + Name: "FORCE_JOIN_ORDER", + }, + }, }, Value: &ast.BoolLiteral{ ValuePos: 64, 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 0632d7a7..3d59a2a4 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 @@ -25,10 +25,14 @@ FROM Rbrace: 61, Records: []*ast.HintRecord{ &ast.HintRecord{ - Key: &ast.Ident{ - NamePos: 27, - NameEnd: 38, - Name: "FORCE_INDEX", + Key: &ast.Path{ + Idents: []*ast.Ident{ + &ast.Ident{ + NamePos: 27, + NameEnd: 38, + Name: "FORCE_INDEX", + }, + }, }, Value: &ast.Ident{ NamePos: 39, 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 ceac381e..d652a1af 100644 --- a/testdata/result/query/select_singer_with_table_hint.sql.txt +++ b/testdata/result/query/select_singer_with_table_hint.sql.txt @@ -25,10 +25,14 @@ FROM Rbrace: 61, Records: []*ast.HintRecord{ &ast.HintRecord{ - Key: &ast.Ident{ - NamePos: 27, - NameEnd: 38, - Name: "FORCE_INDEX", + Key: &ast.Path{ + Idents: []*ast.Ident{ + &ast.Ident{ + NamePos: 27, + NameEnd: 38, + Name: "FORCE_INDEX", + }, + }, }, Value: &ast.Ident{ NamePos: 39, 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 6b0504d6..0b7ededc 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 @@ -14,10 +14,14 @@ FROM Rbrace: 23, Records: []*ast.HintRecord{ &ast.HintRecord{ - Key: &ast.Ident{ - NamePos: 2, - NameEnd: 18, - Name: "FORCE_JOIN_ORDER", + Key: &ast.Path{ + Idents: []*ast.Ident{ + &ast.Ident{ + NamePos: 2, + NameEnd: 18, + Name: "FORCE_JOIN_ORDER", + }, + }, }, Value: &ast.BoolLiteral{ ValuePos: 19, diff --git a/testdata/result/query/select_unnest_with_offset.sql.txt b/testdata/result/query/select_unnest_with_offset.sql.txt index 11f707a2..36479d87 100644 --- a/testdata/result/query/select_unnest_with_offset.sql.txt +++ b/testdata/result/query/select_unnest_with_offset.sql.txt @@ -47,10 +47,14 @@ FROM Rbrace: 44, Records: []*ast.HintRecord{ &ast.HintRecord{ - Key: &ast.Ident{ - NamePos: 36, - NameEnd: 40, - Name: "hint", + Key: &ast.Path{ + Idents: []*ast.Ident{ + &ast.Ident{ + NamePos: 36, + NameEnd: 40, + Name: "hint", + }, + }, }, Value: &ast.IntLiteral{ ValuePos: 43, diff --git a/testdata/result/query/select_with_after_hint.sql.txt b/testdata/result/query/select_with_after_hint.sql.txt index 5a759851..abb7ac86 100644 --- a/testdata/result/query/select_with_after_hint.sql.txt +++ b/testdata/result/query/select_with_after_hint.sql.txt @@ -7,10 +7,14 @@ Rbrace: 11, Records: []*ast.HintRecord{ &ast.HintRecord{ - Key: &ast.Ident{ - NamePos: 2, - NameEnd: 7, - Name: "hint1", + Key: &ast.Path{ + Idents: []*ast.Ident{ + &ast.Ident{ + NamePos: 2, + NameEnd: 7, + Name: "hint1", + }, + }, }, Value: &ast.IntLiteral{ ValuePos: 10, diff --git a/testdata/result/statement/!bad_hint_select_2.sql.txt b/testdata/result/statement/!bad_hint_select_2.sql.txt index 5f06efa5..8cd9beeb 100644 --- a/testdata/result/statement/!bad_hint_select_2.sql.txt +++ b/testdata/result/statement/!bad_hint_select_2.sql.txt @@ -12,10 +12,14 @@ syntax error: testdata/input/query/!bad_hint_select_2.sql:1:19: unexpected token Rbrace: 10, Records: []*ast.HintRecord{ &ast.HintRecord{ - Key: &ast.Ident{ - NamePos: 2, - NameEnd: 6, - Name: "hint", + Key: &ast.Path{ + Idents: []*ast.Ident{ + &ast.Ident{ + NamePos: 2, + NameEnd: 6, + Name: "hint", + }, + }, }, Value: &ast.IntLiteral{ ValuePos: 9, 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 9e4e6986..e938bfa0 100644 --- a/testdata/result/statement/select_album_with_index_directive.sql.txt +++ b/testdata/result/statement/select_album_with_index_directive.sql.txt @@ -42,10 +42,14 @@ WHERE AlbumTitle >= @startTitle AND AlbumTitle < @endTitle Rbrace: 87, Records: []*ast.HintRecord{ &ast.HintRecord{ - Key: &ast.Ident{ - NamePos: 57, - NameEnd: 68, - Name: "FORCE_INDEX", + Key: &ast.Path{ + Idents: []*ast.Ident{ + &ast.Ident{ + NamePos: 57, + NameEnd: 68, + Name: "FORCE_INDEX", + }, + }, }, Value: &ast.Ident{ NamePos: 69, diff --git a/testdata/result/statement/select_from_ml_predict_hint.sql.txt b/testdata/result/statement/select_from_ml_predict_hint.sql.txt index 78b338b2..3d04ece4 100644 --- a/testdata/result/statement/select_from_ml_predict_hint.sql.txt +++ b/testdata/result/statement/select_from_ml_predict_hint.sql.txt @@ -152,10 +152,14 @@ FROM ML.PREDICT( Rbrace: 322, Records: []*ast.HintRecord{ &ast.HintRecord{ - Key: &ast.Ident{ - NamePos: 293, - NameEnd: 320, - Name: "remote_udf_max_rows_per_rpc", + Key: &ast.Path{ + Idents: []*ast.Ident{ + &ast.Ident{ + NamePos: 293, + NameEnd: 320, + Name: "remote_udf_max_rows_per_rpc", + }, + }, }, Value: &ast.IntLiteral{ ValuePos: 321, diff --git a/testdata/result/statement/select_from_ml_predict_textbison.sql.txt b/testdata/result/statement/select_from_ml_predict_textbison.sql.txt index 5c05bdcb..60bf3d4c 100644 --- a/testdata/result/statement/select_from_ml_predict_textbison.sql.txt +++ b/testdata/result/statement/select_from_ml_predict_textbison.sql.txt @@ -351,10 +351,14 @@ FROM ML.PREDICT( Rbrace: 613, Records: []*ast.HintRecord{ &ast.HintRecord{ - Key: &ast.Ident{ - NamePos: 584, - NameEnd: 611, - Name: "remote_udf_max_rows_per_rpc", + Key: &ast.Path{ + Idents: []*ast.Ident{ + &ast.Ident{ + NamePos: 584, + NameEnd: 611, + Name: "remote_udf_max_rows_per_rpc", + }, + }, }, Value: &ast.IntLiteral{ ValuePos: 612, diff --git a/testdata/result/statement/select_function_hints.sql.txt b/testdata/result/statement/select_function_hints.sql.txt index 75ab03be..cc536049 100644 --- a/testdata/result/statement/select_function_hints.sql.txt +++ b/testdata/result/statement/select_function_hints.sql.txt @@ -154,10 +154,14 @@ FROM (SELECT SHA512(z) @{DISABLE_INLINE = TRUE} AS x FROM t) Rbrace: 241, Records: []*ast.HintRecord{ &ast.HintRecord{ - Key: &ast.Ident{ - NamePos: 220, - NameEnd: 234, - Name: "DISABLE_INLINE", + Key: &ast.Path{ + Idents: []*ast.Ident{ + &ast.Ident{ + NamePos: 220, + NameEnd: 234, + Name: "DISABLE_INLINE", + }, + }, }, Value: &ast.BoolLiteral{ ValuePos: 237, diff --git a/testdata/result/statement/select_hint.sql.txt b/testdata/result/statement/select_hint.sql.txt index 374f27f1..ff76da5b 100644 --- a/testdata/result/statement/select_hint.sql.txt +++ b/testdata/result/statement/select_hint.sql.txt @@ -6,10 +6,14 @@ Rbrace: 22, Records: []*ast.HintRecord{ &ast.HintRecord{ - Key: &ast.Ident{ - NamePos: 2, - NameEnd: 7, - Name: "hint1", + Key: &ast.Path{ + Idents: []*ast.Ident{ + &ast.Ident{ + NamePos: 2, + NameEnd: 7, + Name: "hint1", + }, + }, }, Value: &ast.IntLiteral{ ValuePos: 10, @@ -19,10 +23,14 @@ }, }, &ast.HintRecord{ - Key: &ast.Ident{ - NamePos: 13, - NameEnd: 18, - Name: "hint2", + Key: &ast.Path{ + Idents: []*ast.Ident{ + &ast.Ident{ + NamePos: 13, + NameEnd: 18, + Name: "hint2", + }, + }, }, Value: &ast.IntLiteral{ ValuePos: 21, diff --git a/testdata/result/statement/select_hint_path.sql.txt b/testdata/result/statement/select_hint_path.sql.txt new file mode 100644 index 00000000..8ac1ea3f --- /dev/null +++ b/testdata/result/statement/select_hint_path.sql.txt @@ -0,0 +1,48 @@ +--- select_hint_path.sql +@{spanner.optimizer_version=5} SELECT 1 +--- AST +&ast.QueryStatement{ + Hint: &ast.Hint{ + Rbrace: 29, + Records: []*ast.HintRecord{ + &ast.HintRecord{ + Key: &ast.Path{ + Idents: []*ast.Ident{ + &ast.Ident{ + NamePos: 2, + NameEnd: 9, + Name: "spanner", + }, + &ast.Ident{ + NamePos: 10, + NameEnd: 27, + Name: "optimizer_version", + }, + }, + }, + Value: &ast.IntLiteral{ + ValuePos: 28, + ValueEnd: 29, + Base: 10, + Value: "5", + }, + }, + }, + }, + Query: &ast.Select{ + Select: 31, + Results: []ast.SelectItem{ + &ast.ExprSelectItem{ + Expr: &ast.IntLiteral{ + ValuePos: 38, + ValueEnd: 39, + Base: 10, + Value: "1", + }, + }, + }, + }, +} + +--- SQL +@{spanner.optimizer_version=5} SELECT 1 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 272a54be..06d8a6ef 100644 --- a/testdata/result/statement/select_singer_with_join_hint.sql.txt +++ b/testdata/result/statement/select_singer_with_join_hint.sql.txt @@ -33,10 +33,14 @@ FROM Rbrace: 279, Records: []*ast.HintRecord{ &ast.HintRecord{ - Key: &ast.Ident{ - NamePos: 260, - NameEnd: 269, - Name: "JOIN_TYPE", + Key: &ast.Path{ + Idents: []*ast.Ident{ + &ast.Ident{ + NamePos: 260, + NameEnd: 269, + Name: "JOIN_TYPE", + }, + }, }, Value: &ast.Ident{ NamePos: 270, @@ -53,10 +57,14 @@ FROM Rbrace: 209, Records: []*ast.HintRecord{ &ast.HintRecord{ - Key: &ast.Ident{ - NamePos: 189, - NameEnd: 198, - Name: "JOIN_TYPE", + Key: &ast.Path{ + Idents: []*ast.Ident{ + &ast.Ident{ + NamePos: 189, + NameEnd: 198, + Name: "JOIN_TYPE", + }, + }, }, Value: &ast.Ident{ NamePos: 199, @@ -73,10 +81,14 @@ FROM Rbrace: 138, Records: []*ast.HintRecord{ &ast.HintRecord{ - Key: &ast.Ident{ - NamePos: 119, - NameEnd: 128, - Name: "JOIN_TYPE", + Key: &ast.Path{ + Idents: []*ast.Ident{ + &ast.Ident{ + NamePos: 119, + NameEnd: 128, + Name: "JOIN_TYPE", + }, + }, }, Value: &ast.Ident{ NamePos: 129, @@ -93,10 +105,14 @@ FROM Rbrace: 68, Records: []*ast.HintRecord{ &ast.HintRecord{ - Key: &ast.Ident{ - NamePos: 47, - NameEnd: 63, - Name: "FORCE_JOIN_ORDER", + Key: &ast.Path{ + Idents: []*ast.Ident{ + &ast.Ident{ + NamePos: 47, + NameEnd: 63, + Name: "FORCE_JOIN_ORDER", + }, + }, }, Value: &ast.BoolLiteral{ ValuePos: 64, 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 0632d7a7..3d59a2a4 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 @@ -25,10 +25,14 @@ FROM Rbrace: 61, Records: []*ast.HintRecord{ &ast.HintRecord{ - Key: &ast.Ident{ - NamePos: 27, - NameEnd: 38, - Name: "FORCE_INDEX", + Key: &ast.Path{ + Idents: []*ast.Ident{ + &ast.Ident{ + NamePos: 27, + NameEnd: 38, + Name: "FORCE_INDEX", + }, + }, }, Value: &ast.Ident{ NamePos: 39, 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 ceac381e..d652a1af 100644 --- a/testdata/result/statement/select_singer_with_table_hint.sql.txt +++ b/testdata/result/statement/select_singer_with_table_hint.sql.txt @@ -25,10 +25,14 @@ FROM Rbrace: 61, Records: []*ast.HintRecord{ &ast.HintRecord{ - Key: &ast.Ident{ - NamePos: 27, - NameEnd: 38, - Name: "FORCE_INDEX", + Key: &ast.Path{ + Idents: []*ast.Ident{ + &ast.Ident{ + NamePos: 27, + NameEnd: 38, + Name: "FORCE_INDEX", + }, + }, }, Value: &ast.Ident{ NamePos: 39, 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 6b0504d6..0b7ededc 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 @@ -14,10 +14,14 @@ FROM Rbrace: 23, Records: []*ast.HintRecord{ &ast.HintRecord{ - Key: &ast.Ident{ - NamePos: 2, - NameEnd: 18, - Name: "FORCE_JOIN_ORDER", + Key: &ast.Path{ + Idents: []*ast.Ident{ + &ast.Ident{ + NamePos: 2, + NameEnd: 18, + Name: "FORCE_JOIN_ORDER", + }, + }, }, Value: &ast.BoolLiteral{ ValuePos: 19, diff --git a/testdata/result/statement/select_unnest_with_offset.sql.txt b/testdata/result/statement/select_unnest_with_offset.sql.txt index 11f707a2..36479d87 100644 --- a/testdata/result/statement/select_unnest_with_offset.sql.txt +++ b/testdata/result/statement/select_unnest_with_offset.sql.txt @@ -47,10 +47,14 @@ FROM Rbrace: 44, Records: []*ast.HintRecord{ &ast.HintRecord{ - Key: &ast.Ident{ - NamePos: 36, - NameEnd: 40, - Name: "hint", + Key: &ast.Path{ + Idents: []*ast.Ident{ + &ast.Ident{ + NamePos: 36, + NameEnd: 40, + Name: "hint", + }, + }, }, Value: &ast.IntLiteral{ ValuePos: 43, diff --git a/testdata/result/statement/select_with_after_hint.sql.txt b/testdata/result/statement/select_with_after_hint.sql.txt index 5a759851..abb7ac86 100644 --- a/testdata/result/statement/select_with_after_hint.sql.txt +++ b/testdata/result/statement/select_with_after_hint.sql.txt @@ -7,10 +7,14 @@ Rbrace: 11, Records: []*ast.HintRecord{ &ast.HintRecord{ - Key: &ast.Ident{ - NamePos: 2, - NameEnd: 7, - Name: "hint1", + Key: &ast.Path{ + Idents: []*ast.Ident{ + &ast.Ident{ + NamePos: 2, + NameEnd: 7, + Name: "hint1", + }, + }, }, Value: &ast.IntLiteral{ ValuePos: 10, diff --git a/testdata/result/statement/update_with_safe_ml_predict.sql.txt b/testdata/result/statement/update_with_safe_ml_predict.sql.txt index 423cf296..60bd0d1c 100644 --- a/testdata/result/statement/update_with_safe_ml_predict.sql.txt +++ b/testdata/result/statement/update_with_safe_ml_predict.sql.txt @@ -135,10 +135,14 @@ WHERE products.desc_embed IS NULL Rbrace: 327, Records: []*ast.HintRecord{ &ast.HintRecord{ - Key: &ast.Ident{ - NamePos: 296, - NameEnd: 323, - Name: "remote_udf_max_rows_per_rpc", + Key: &ast.Path{ + Idents: []*ast.Ident{ + &ast.Ident{ + NamePos: 296, + NameEnd: 323, + Name: "remote_udf_max_rows_per_rpc", + }, + }, }, Value: &ast.IntLiteral{ ValuePos: 324,