Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
…2814) * add support for auxiliary cache and uncache statements * new test cases for fixing options grammar to allow more than just strings Co-authored-by: Barry Pollard <barry@tunetheweb.com>
- Loading branch information
1 parent
d7ef8ba
commit 8bcd099
Showing
9 changed files
with
335 additions
and
15 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 |
---|---|---|
@@ -0,0 +1,18 @@ | ||
CACHE TABLE TESTCACHE | ||
OPTIONS ('storageLevel' 'DISK_ONLY') | ||
SELECT | ||
A, | ||
B | ||
FROM TESTDATA; | ||
|
||
CACHE LAZY TABLE TESTCACHE | ||
OPTIONS ('storageLevel' 'DISK_ONLY') | ||
SELECT A FROM TESTDATA; | ||
|
||
CACHE TABLE TESTCACHE | ||
OPTIONS ('storageLevel' 'DISK_ONLY') AS | ||
SELECT A FROM TESTDATA; | ||
|
||
CACHE TABLE TESTCACHE | ||
OPTIONS ('storageLevel' = 'DISK_ONLY') AS | ||
SELECT A FROM TESTDATA; |
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,120 @@ | ||
# 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: 9893a5321046754c08de6b201414c0d15e03c66e2cfca6e0e0de7a4b46403e32 | ||
file: | ||
- statement: | ||
cache_table: | ||
- keyword: CACHE | ||
- keyword: TABLE | ||
- table_reference: | ||
identifier: TESTCACHE | ||
- keyword: OPTIONS | ||
- bracketed: | ||
- start_bracket: ( | ||
- literal: "'storageLevel'" | ||
- literal: "'DISK_ONLY'" | ||
- end_bracket: ) | ||
- select_statement: | ||
select_clause: | ||
- keyword: SELECT | ||
- select_clause_element: | ||
column_reference: | ||
identifier: A | ||
- comma: ',' | ||
- select_clause_element: | ||
column_reference: | ||
identifier: B | ||
from_clause: | ||
keyword: FROM | ||
from_expression: | ||
from_expression_element: | ||
table_expression: | ||
table_reference: | ||
identifier: TESTDATA | ||
- statement_terminator: ; | ||
- statement: | ||
cache_table: | ||
- keyword: CACHE | ||
- keyword: LAZY | ||
- keyword: TABLE | ||
- table_reference: | ||
identifier: TESTCACHE | ||
- keyword: OPTIONS | ||
- bracketed: | ||
- start_bracket: ( | ||
- literal: "'storageLevel'" | ||
- literal: "'DISK_ONLY'" | ||
- end_bracket: ) | ||
- select_statement: | ||
select_clause: | ||
keyword: SELECT | ||
select_clause_element: | ||
column_reference: | ||
identifier: A | ||
from_clause: | ||
keyword: FROM | ||
from_expression: | ||
from_expression_element: | ||
table_expression: | ||
table_reference: | ||
identifier: TESTDATA | ||
- statement_terminator: ; | ||
- statement: | ||
cache_table: | ||
- keyword: CACHE | ||
- keyword: TABLE | ||
- table_reference: | ||
identifier: TESTCACHE | ||
- keyword: OPTIONS | ||
- bracketed: | ||
- start_bracket: ( | ||
- literal: "'storageLevel'" | ||
- literal: "'DISK_ONLY'" | ||
- end_bracket: ) | ||
- keyword: AS | ||
- select_statement: | ||
select_clause: | ||
keyword: SELECT | ||
select_clause_element: | ||
column_reference: | ||
identifier: A | ||
from_clause: | ||
keyword: FROM | ||
from_expression: | ||
from_expression_element: | ||
table_expression: | ||
table_reference: | ||
identifier: TESTDATA | ||
- statement_terminator: ; | ||
- statement: | ||
cache_table: | ||
- keyword: CACHE | ||
- keyword: TABLE | ||
- table_reference: | ||
identifier: TESTCACHE | ||
- keyword: OPTIONS | ||
- bracketed: | ||
- start_bracket: ( | ||
- literal: "'storageLevel'" | ||
- comparison_operator: | ||
raw_comparison_operator: '=' | ||
- literal: "'DISK_ONLY'" | ||
- end_bracket: ) | ||
- keyword: AS | ||
- select_statement: | ||
select_clause: | ||
keyword: SELECT | ||
select_clause_element: | ||
column_reference: | ||
identifier: A | ||
from_clause: | ||
keyword: FROM | ||
from_expression: | ||
from_expression_element: | ||
table_expression: | ||
table_reference: | ||
identifier: TESTDATA | ||
- statement_terminator: ; |
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 @@ | ||
CLEAR CACHE; |
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,12 @@ | ||
# 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: 88187c4784eba3d8ed01791d6bb354c7e716f93c2526abf5e4b76d77e47499c9 | ||
file: | ||
statement: | ||
clear_cache: | ||
- keyword: CLEAR | ||
- keyword: CACHE | ||
statement_terminator: ; |
14 changes: 12 additions & 2 deletions
14
test/fixtures/dialects/spark3/insert_overwrite_directory.sql
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 |
---|---|---|
@@ -1,11 +1,21 @@ | ||
INSERT OVERWRITE DIRECTORY '/tmp/destination' | ||
USING PARQUET | ||
OPTIONS ("col1" = "1", "col2" = "2", "col3" = 'test') | ||
SELECT * FROM test_table; | ||
SELECT a FROM test_table; | ||
|
||
INSERT OVERWRITE DIRECTORY | ||
USING PARQUET | ||
OPTIONS ( | ||
'path' = '/tmp/destination', "col1" = "1", "col2" = "2", "col3" = 'test' | ||
) | ||
SELECT * FROM test_table; | ||
SELECT a FROM test_table; | ||
|
||
INSERT OVERWRITE DIRECTORY | ||
USING PARQUET | ||
OPTIONS ('path' '/tmp/destination', col1 1, col2 2, col3 'test') | ||
SELECT a FROM test_table; | ||
|
||
INSERT OVERWRITE DIRECTORY '/tmp/destination' | ||
USING PARQUET | ||
OPTIONS (col1 1, col2 2, col3 'test') | ||
SELECT a FROM test_table; |
Oops, something went wrong.