Skip to content

Commit 0c025e7

Browse files
Merge pull request #1702 from taozhi8833998/feat-string-agg-bigquery
feat: support string_agg function in bigquery
2 parents 99bec8b + 00bcbbb commit 0c025e7

File tree

2 files changed

+8
-1
lines changed

2 files changed

+8
-1
lines changed

pegjs/bigquery.pegjs

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -2450,7 +2450,7 @@ over_partition
24502450
/ on_update_current_timestamp
24512451

24522452
aggr_fun_count
2453-
= name:KW_COUNT __ LPAREN __ arg:count_arg __ RPAREN __ bc:over_partition? {
2453+
= name:(KW_COUNT / 'string_agg'i) __ LPAREN __ arg:count_arg __ RPAREN __ bc:over_partition? {
24542454
return {
24552455
type: 'aggr_func',
24562456
name: name,

test/bigquery.spec.js

Lines changed: 7 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -808,6 +808,13 @@ describe('BigQuery', () => {
808808
"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"
809809
]
810810
},
811+
{
812+
title: 'string_agg function',
813+
sql: [
814+
'SELECT string_agg(DISTINCT column1) as some_column1, string_agg(column2) as some_column1 from table1',
815+
'SELECT string_agg(DISTINCT column1) AS some_column1, string_agg(column2) AS some_column1 FROM table1'
816+
]
817+
},
811818
]
812819

813820
SQL_LIST.forEach(sqlInfo => {

0 commit comments

Comments
 (0)