Skip to content

Commit

Permalink
bigquery sql parser support extra commas in select list
Browse files Browse the repository at this point in the history
  • Loading branch information
wenshao committed Dec 5, 2024
1 parent 4e13fd7 commit 99a5a99
Show file tree
Hide file tree
Showing 2 changed files with 9 additions and 1 deletion.
Original file line number Diff line number Diff line change
Expand Up @@ -1139,7 +1139,7 @@ protected void parseSelectList(SQLSelectQueryBlock queryBlock) {
}

// https://github.com/alibaba/druid/issues/5140
if (lexer.token == Token.FROM) {
if (lexer.token == Token.FROM || lexer.token == Token.UNION) {
if (parseSelectListFromError()) {
throw new ParserException("syntax error, expect is not TOKEN:from " + lexer.info());
} else {
Expand Down
8 changes: 8 additions & 0 deletions core/src/test/resources/bvt/parser/bigquery/0.txt
Original file line number Diff line number Diff line change
@@ -1,3 +1,11 @@
select 1,2,
union all
select 2, 3
--------------------
SELECT 1, 2
UNION ALL
SELECT 2, 3
------------------------------------------------------------------------------------------------------------------------
select a, b, c
from t1
group by all
Expand Down

0 comments on commit 99a5a99

Please sign in to comment.