diff --git a/pegjs/bigquery.pegjs b/pegjs/bigquery.pegjs index 2a973a26..6dc5bc3d 100644 --- a/pegjs/bigquery.pegjs +++ b/pegjs/bigquery.pegjs @@ -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, diff --git a/test/bigquery.spec.js b/test/bigquery.spec.js index 7711e363..d04c4645 100644 --- a/test/bigquery.spec.js +++ b/test/bigquery.spec.js @@ -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 => {