是否可以在使用 SPLIT() IN BigQuery 创建的数组上使用 STRING_AGG 进行连接
Is it possible to concatenate using STRING_AGG on an array that was created with SPLIT() IN BigQuery
我正在尝试使用 string_agg 连接一个使用 SPLIT() 创建的数组。
我尝试连接的数组代码如下所示:
ARRAY (
SELECT AS STRUCT
SPLIT(CustomField.SubComponents, ' | ') AS Name
) AS SubComponents,
我使用 LEFT JOIN UNNEST (Subcomponents) AS Subcomponents
在我的连接中有未嵌套的 Supcomponents
但是,我收到以下错误:
No matching signature for aggregate function STRING_AGG for argument types: ARRAY <STRING>
我刚刚弄明白了,我不得不 UNNEST 两次,一次是 LEFT JOIN UNNEST (Subcomponents) AS Subcomponents
然后再次作为 LEFT JOIN UNNEST (SubComponents.Name) AS SubComponentsName
这让我可以成功地使用 string_agg。
我正在尝试使用 string_agg 连接一个使用 SPLIT() 创建的数组。
我尝试连接的数组代码如下所示:
ARRAY (
SELECT AS STRUCT
SPLIT(CustomField.SubComponents, ' | ') AS Name
) AS SubComponents,
我使用 LEFT JOIN UNNEST (Subcomponents) AS Subcomponents
但是,我收到以下错误:
No matching signature for aggregate function STRING_AGG for argument types: ARRAY <STRING>
我刚刚弄明白了,我不得不 UNNEST 两次,一次是 LEFT JOIN UNNEST (Subcomponents) AS Subcomponents
然后再次作为 LEFT JOIN UNNEST (SubComponents.Name) AS SubComponentsName
这让我可以成功地使用 string_agg。