未找到函数:group_concat

bsm*_*osj 4 google-bigquery google-api-nodejs-client

我对使用“group_concat”BigQuery 函数执行查询很感兴趣。当我直接在 BigQuery 界面中执行查询时,查询成功结束,但是当我尝试通过 Node js 执行该查询时,出现了以下错误:

errors:
   [ { domain: 'global',
       reason: 'invalidQuery',
       message: 'Function not found: group_concat at [4:3]',
       locationType: 'other',
       location: 'query' } ]
Run Code Online (Sandbox Code Playgroud)

代码不是问题,因为它执行一个简单的查询没有任何问题。

我的查询:

SELECT
  st_hub_session_id,
  num_requests,
  group_concat( group.code, '|' ) as Codes
FROM
  table.name
GROUP BY
  st_hub_session_id,
  group_concat
LIMIT
  1000
Run Code Online (Sandbox Code Playgroud)

问题可能出在哪里?

Ell*_*ard 6

STRING_AGG在标准 SQL 中使用而不是在旧的GROUP_CONCAT. 您可以通过取消选中“显示选项”下的“使用旧版 SQL”或放置#standardSQL在查询的顶部,通过 UI 使用标准 SQL 。另请参阅启用标准 SQL