Snowflake: Support ORDER BY boolean (#6435)

This commit is contained in:
Danny Jones
2024-11-10 04:44:46 +00:00
committed by GitHub
parent f0602da8df
commit cbcbe52676
3 changed files with 40 additions and 1 deletions

View File

@@ -7933,6 +7933,7 @@ class OrderByClauseSegment(ansi.OrderByClauseSegment):
Delimited(
Sequence(
OneOf(
Ref("BooleanLiteralGrammar"),
Ref("ColumnReferenceSegment"),
# Can `ORDER BY 1`
Ref("NumericLiteralSegment"),

View File

@@ -20,3 +20,11 @@ select notify from foo;
select
coalesce(do.a, do.b) as value
from delivery_override as do
;
SELECT
t.id
, TRUE AS test
FROM mytable t
ORDER BY TRUE
;

View File

@@ -3,7 +3,7 @@
# 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: e04cf674461ae0533dfd32e6e7e16a4c4247b41edc11efd7b3e51c75b4be42af
_hash: bf47c096b83f3a1a7e3107f5b90f7767e0a717db8b8ae79914887140f6b173a9
file:
- statement:
select_statement:
@@ -171,3 +171,33 @@ file:
alias_expression:
keyword: as
naked_identifier: do
- statement_terminator: ;
- statement:
select_statement:
select_clause:
- keyword: SELECT
- select_clause_element:
column_reference:
- naked_identifier: t
- dot: .
- naked_identifier: id
- comma: ','
- select_clause_element:
boolean_literal: 'TRUE'
alias_expression:
keyword: AS
naked_identifier: test
from_clause:
keyword: FROM
from_expression:
from_expression_element:
table_expression:
table_reference:
naked_identifier: mytable
alias_expression:
naked_identifier: t
orderby_clause:
- keyword: ORDER
- keyword: BY
- boolean_literal: 'TRUE'
- statement_terminator: ;