forked from sqlfluff/sqlfluff
-
Notifications
You must be signed in to change notification settings - Fork 0
Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
TRINO: support FILTER after WITHIN GROUP agg expression
- Loading branch information
1 parent
9252ea9
commit 9cacfde
Showing
5 changed files
with
291 additions
and
1 deletion.
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,11 @@ | ||
SELECT id, | ||
COUNT(*) FILTER (WHERE o IS NOT NULL) AS count | ||
FROM (VALUES | ||
(100, 2, 'a'), | ||
(100, 1, 'b'), | ||
(200, NULL, 'c'), | ||
(200, 2, 'a'), | ||
(300, NULL, 'b'), | ||
(300, NULL, 'c') | ||
) t(id, o, value) | ||
GROUP BY id; |
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,123 @@ | ||
# 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: 464b6edb476473531ba7dc5e1453ce36ca8b444d588ad3d41543bc754fb6faee | ||
file: | ||
statement: | ||
select_statement: | ||
select_clause: | ||
- keyword: SELECT | ||
- select_clause_element: | ||
column_reference: | ||
naked_identifier: id | ||
- comma: ',' | ||
- select_clause_element: | ||
function: | ||
- function_name: | ||
function_name_identifier: COUNT | ||
- bracketed: | ||
start_bracket: ( | ||
star: '*' | ||
end_bracket: ) | ||
- keyword: FILTER | ||
- bracketed: | ||
start_bracket: ( | ||
keyword: WHERE | ||
expression: | ||
- column_reference: | ||
naked_identifier: o | ||
- keyword: IS | ||
- keyword: NOT | ||
- null_literal: 'NULL' | ||
end_bracket: ) | ||
alias_expression: | ||
keyword: AS | ||
naked_identifier: count | ||
from_clause: | ||
keyword: FROM | ||
from_expression: | ||
from_expression_element: | ||
bracketed: | ||
start_bracket: ( | ||
table_expression: | ||
values_clause: | ||
- keyword: VALUES | ||
- expression: | ||
bracketed: | ||
- start_bracket: ( | ||
- numeric_literal: '100' | ||
- comma: ',' | ||
- numeric_literal: '2' | ||
- comma: ',' | ||
- quoted_literal: "'a'" | ||
- end_bracket: ) | ||
- comma: ',' | ||
- expression: | ||
bracketed: | ||
- start_bracket: ( | ||
- numeric_literal: '100' | ||
- comma: ',' | ||
- numeric_literal: '1' | ||
- comma: ',' | ||
- quoted_literal: "'b'" | ||
- end_bracket: ) | ||
- comma: ',' | ||
- expression: | ||
bracketed: | ||
- start_bracket: ( | ||
- numeric_literal: '200' | ||
- comma: ',' | ||
- null_literal: 'NULL' | ||
- comma: ',' | ||
- quoted_literal: "'c'" | ||
- end_bracket: ) | ||
- comma: ',' | ||
- expression: | ||
bracketed: | ||
- start_bracket: ( | ||
- numeric_literal: '200' | ||
- comma: ',' | ||
- numeric_literal: '2' | ||
- comma: ',' | ||
- quoted_literal: "'a'" | ||
- end_bracket: ) | ||
- comma: ',' | ||
- expression: | ||
bracketed: | ||
- start_bracket: ( | ||
- numeric_literal: '300' | ||
- comma: ',' | ||
- null_literal: 'NULL' | ||
- comma: ',' | ||
- quoted_literal: "'b'" | ||
- end_bracket: ) | ||
- comma: ',' | ||
- expression: | ||
bracketed: | ||
- start_bracket: ( | ||
- numeric_literal: '300' | ||
- comma: ',' | ||
- null_literal: 'NULL' | ||
- comma: ',' | ||
- quoted_literal: "'c'" | ||
- end_bracket: ) | ||
end_bracket: ) | ||
alias_expression: | ||
naked_identifier: t | ||
bracketed: | ||
start_bracket: ( | ||
identifier_list: | ||
- naked_identifier: id | ||
- comma: ',' | ||
- naked_identifier: o | ||
- comma: ',' | ||
- naked_identifier: value | ||
end_bracket: ) | ||
groupby_clause: | ||
- keyword: GROUP | ||
- keyword: BY | ||
- column_reference: | ||
naked_identifier: id | ||
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
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