Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
Snowflake: Support TOP N select clause modifier
- Loading branch information
1 parent
789b46a
commit 71df779
Showing
4 changed files
with
332 additions
and
0 deletions.
There are no files selected for viewing
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
|
@@ -378,6 +378,7 @@ | |
TEXT | ||
TIME | ||
TIMESTAMP | ||
TOP | ||
TRANSACTION | ||
TRANSACTIONS | ||
TRANSIENT | ||
|
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,27 @@ | ||
SELECT * FROM my_table; | ||
|
||
SELECT col1 FROM my_table; | ||
|
||
SELECT my_table.* FROM my_table; | ||
|
||
SELECT col1, my_table.* FROM my_table; | ||
|
||
SELECT DISTINCT * FROM my_table; | ||
|
||
SELECT DISTINCT col1 FROM my_table; | ||
|
||
SELECT ALL my_table.* FROM my_table; | ||
|
||
SELECT TOP 1 * FROM my_table; | ||
|
||
SELECT TOP 2 col1 FROM my_table; | ||
|
||
SELECT TOP 3 col1, my_table.* FROM my_table; | ||
|
||
SELECT ALL TOP 10 col1 FROM my_table; | ||
|
||
SELECT DISTINCT TOP 20 my_table.col1 FROM my_table; | ||
|
||
SELECT DISTINCT TOP 30 * FROM my_table; | ||
|
||
SELECT DISTINCT TOP 40 col1, my_table.* FROM my_table; |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,281 @@ | ||
# YML test files are auto-generated from SQL files and should not be edited by | ||
# hand. To help enforce this, the "hash" field in the file must match a hash | ||
# computed by SQLFluff when running the tests. Please run | ||
# `python test/generate_parse_fixture_yml.py` to generate them after adding or | ||
# altering SQL files. | ||
_hash: 26d141e713503b04886224bbca31b248026a732e703db347db4bb782dc102917 | ||
file: | ||
- statement: | ||
select_statement: | ||
select_clause: | ||
keyword: SELECT | ||
select_clause_element: | ||
wildcard_expression: | ||
wildcard_identifier: | ||
star: '*' | ||
from_clause: | ||
keyword: FROM | ||
from_expression: | ||
from_expression_element: | ||
table_expression: | ||
table_reference: | ||
identifier: my_table | ||
- statement_terminator: ; | ||
- statement: | ||
select_statement: | ||
select_clause: | ||
keyword: SELECT | ||
select_clause_element: | ||
column_reference: | ||
identifier: col1 | ||
from_clause: | ||
keyword: FROM | ||
from_expression: | ||
from_expression_element: | ||
table_expression: | ||
table_reference: | ||
identifier: my_table | ||
- statement_terminator: ; | ||
- statement: | ||
select_statement: | ||
select_clause: | ||
keyword: SELECT | ||
select_clause_element: | ||
wildcard_expression: | ||
wildcard_identifier: | ||
identifier: my_table | ||
dot: . | ||
star: '*' | ||
from_clause: | ||
keyword: FROM | ||
from_expression: | ||
from_expression_element: | ||
table_expression: | ||
table_reference: | ||
identifier: my_table | ||
- statement_terminator: ; | ||
- statement: | ||
select_statement: | ||
select_clause: | ||
- keyword: SELECT | ||
- select_clause_element: | ||
column_reference: | ||
identifier: col1 | ||
- comma: ',' | ||
- select_clause_element: | ||
wildcard_expression: | ||
wildcard_identifier: | ||
identifier: my_table | ||
dot: . | ||
star: '*' | ||
from_clause: | ||
keyword: FROM | ||
from_expression: | ||
from_expression_element: | ||
table_expression: | ||
table_reference: | ||
identifier: my_table | ||
- statement_terminator: ; | ||
- statement: | ||
select_statement: | ||
select_clause: | ||
keyword: SELECT | ||
select_clause_modifier: | ||
keyword: DISTINCT | ||
select_clause_element: | ||
wildcard_expression: | ||
wildcard_identifier: | ||
star: '*' | ||
from_clause: | ||
keyword: FROM | ||
from_expression: | ||
from_expression_element: | ||
table_expression: | ||
table_reference: | ||
identifier: my_table | ||
- statement_terminator: ; | ||
- statement: | ||
select_statement: | ||
select_clause: | ||
keyword: SELECT | ||
select_clause_modifier: | ||
keyword: DISTINCT | ||
select_clause_element: | ||
column_reference: | ||
identifier: col1 | ||
from_clause: | ||
keyword: FROM | ||
from_expression: | ||
from_expression_element: | ||
table_expression: | ||
table_reference: | ||
identifier: my_table | ||
- statement_terminator: ; | ||
- statement: | ||
select_statement: | ||
select_clause: | ||
keyword: SELECT | ||
select_clause_modifier: | ||
keyword: ALL | ||
select_clause_element: | ||
wildcard_expression: | ||
wildcard_identifier: | ||
identifier: my_table | ||
dot: . | ||
star: '*' | ||
from_clause: | ||
keyword: FROM | ||
from_expression: | ||
from_expression_element: | ||
table_expression: | ||
table_reference: | ||
identifier: my_table | ||
- statement_terminator: ; | ||
- statement: | ||
select_statement: | ||
select_clause: | ||
keyword: SELECT | ||
select_clause_modifier: | ||
keyword: TOP | ||
literal: '1' | ||
select_clause_element: | ||
wildcard_expression: | ||
wildcard_identifier: | ||
star: '*' | ||
from_clause: | ||
keyword: FROM | ||
from_expression: | ||
from_expression_element: | ||
table_expression: | ||
table_reference: | ||
identifier: my_table | ||
- statement_terminator: ; | ||
- statement: | ||
select_statement: | ||
select_clause: | ||
keyword: SELECT | ||
select_clause_modifier: | ||
keyword: TOP | ||
literal: '2' | ||
select_clause_element: | ||
column_reference: | ||
identifier: col1 | ||
from_clause: | ||
keyword: FROM | ||
from_expression: | ||
from_expression_element: | ||
table_expression: | ||
table_reference: | ||
identifier: my_table | ||
- statement_terminator: ; | ||
- statement: | ||
select_statement: | ||
select_clause: | ||
- keyword: SELECT | ||
- select_clause_modifier: | ||
keyword: TOP | ||
literal: '3' | ||
- select_clause_element: | ||
column_reference: | ||
identifier: col1 | ||
- comma: ',' | ||
- select_clause_element: | ||
wildcard_expression: | ||
wildcard_identifier: | ||
identifier: my_table | ||
dot: . | ||
star: '*' | ||
from_clause: | ||
keyword: FROM | ||
from_expression: | ||
from_expression_element: | ||
table_expression: | ||
table_reference: | ||
identifier: my_table | ||
- statement_terminator: ; | ||
- statement: | ||
select_statement: | ||
select_clause: | ||
keyword: SELECT | ||
select_clause_modifier: | ||
- keyword: ALL | ||
- keyword: TOP | ||
- literal: '10' | ||
select_clause_element: | ||
column_reference: | ||
identifier: col1 | ||
from_clause: | ||
keyword: FROM | ||
from_expression: | ||
from_expression_element: | ||
table_expression: | ||
table_reference: | ||
identifier: my_table | ||
- statement_terminator: ; | ||
- statement: | ||
select_statement: | ||
select_clause: | ||
keyword: SELECT | ||
select_clause_modifier: | ||
- keyword: DISTINCT | ||
- keyword: TOP | ||
- literal: '20' | ||
select_clause_element: | ||
column_reference: | ||
- identifier: my_table | ||
- dot: . | ||
- identifier: col1 | ||
from_clause: | ||
keyword: FROM | ||
from_expression: | ||
from_expression_element: | ||
table_expression: | ||
table_reference: | ||
identifier: my_table | ||
- statement_terminator: ; | ||
- statement: | ||
select_statement: | ||
select_clause: | ||
keyword: SELECT | ||
select_clause_modifier: | ||
- keyword: DISTINCT | ||
- keyword: TOP | ||
- literal: '30' | ||
select_clause_element: | ||
wildcard_expression: | ||
wildcard_identifier: | ||
star: '*' | ||
from_clause: | ||
keyword: FROM | ||
from_expression: | ||
from_expression_element: | ||
table_expression: | ||
table_reference: | ||
identifier: my_table | ||
- statement_terminator: ; | ||
- statement: | ||
select_statement: | ||
select_clause: | ||
- keyword: SELECT | ||
- select_clause_modifier: | ||
- keyword: DISTINCT | ||
- keyword: TOP | ||
- literal: '40' | ||
- select_clause_element: | ||
column_reference: | ||
identifier: col1 | ||
- comma: ',' | ||
- select_clause_element: | ||
wildcard_expression: | ||
wildcard_identifier: | ||
identifier: my_table | ||
dot: . | ||
star: '*' | ||
from_clause: | ||
keyword: FROM | ||
from_expression: | ||
from_expression_element: | ||
table_expression: | ||
table_reference: | ||
identifier: my_table | ||
- statement_terminator: ; |