Skip to content

Commit

Permalink
feat: support string_agg function in bigquery
Browse files Browse the repository at this point in the history
  • Loading branch information
taozhi8833998 committed Dec 13, 2023
1 parent 99bec8b commit 00bcbbb
Show file tree
Hide file tree
Showing 2 changed files with 8 additions and 1 deletion.
2 changes: 1 addition & 1 deletion pegjs/bigquery.pegjs
Original file line number Diff line number Diff line change
Expand Up @@ -2450,7 +2450,7 @@ over_partition
/ on_update_current_timestamp

aggr_fun_count
= name:KW_COUNT __ LPAREN __ arg:count_arg __ RPAREN __ bc:over_partition? {
= name:(KW_COUNT / 'string_agg'i) __ LPAREN __ arg:count_arg __ RPAREN __ bc:over_partition? {
return {
type: 'aggr_func',
name: name,
Expand Down
7 changes: 7 additions & 0 deletions test/bigquery.spec.js
Original file line number Diff line number Diff line change
Expand Up @@ -808,6 +808,13 @@ describe('BigQuery', () => {
"CREATE OR REPLACE TEMP TABLE table1 DEFAULT COLLATE 'und:ci' PARTITION BY DATE(event_time) CLUSTER BY id OPTIONS (require_partition_filter = TRUE) AS SELECT table2.id, table2.value, table2.event_time FROM table2"
]
},
{
title: 'string_agg function',
sql: [
'SELECT string_agg(DISTINCT column1) as some_column1, string_agg(column2) as some_column1 from table1',
'SELECT string_agg(DISTINCT column1) AS some_column1, string_agg(column2) AS some_column1 FROM table1'
]
},
]

SQL_LIST.forEach(sqlInfo => {
Expand Down

0 comments on commit 00bcbbb

Please sign in to comment.