-
-
Notifications
You must be signed in to change notification settings - Fork 1.4k
Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
Signed-off-by: Andreas Reichel <andreas@manticore-projects.com>
- Loading branch information
1 parent
64f1433
commit 2812f75
Showing
1 changed file
with
28 additions
and
0 deletions.
There are no files selected for viewing
28 changes: 28 additions & 0 deletions
28
src/test/java/net/sf/jsqlparser/statement/select/BigQueryTest.java
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,28 @@ | ||
package net.sf.jsqlparser.statement.select; | ||
|
||
import org.junit.jupiter.api.Test; | ||
|
||
public class BigQueryTest { | ||
|
||
@Test | ||
void testTrailingComma() { | ||
|
||
// allows trailing commas after the last select items | ||
String sqlStr = "WITH\n" + | ||
" Products AS (\n" + | ||
" SELECT 'shirt' AS product_type, 't-shirt' AS product_name, 3 AS product_count UNION ALL\n" + | ||
" SELECT 'shirt', 't-shirt', 8 UNION ALL\n" + | ||
" SELECT 'shirt', 'polo', 25 UNION ALL\n" + | ||
" SELECT 'pants', 'jeans', 6\n" + | ||
" )\n" + | ||
"SELECT\n" + | ||
" product_type,\n" + | ||
" product_name,\n" + | ||
" SUM(product_count) AS product_sum,\n" + | ||
" GROUPING(product_type) AS product_type_agg,\n" + | ||
" GROUPING(product_name) AS product_name_agg,\n" + | ||
"FROM Products\n" + | ||
"GROUP BY GROUPING SETS(product_type, product_name, ())\n" + | ||
"ORDER BY product_name, product_type"; | ||
} | ||
} |