3
Supose我有以下模式:串连上的BigQuery嵌套字段的值
[
{
'name': 'id',
'type': 'INTEGER'
}
{
'name': 'record',
'type': 'RECORD',
'fields': [
{
'name': 'repeated',
'type': 'STRING',
'mode': 'REPEATED'
}
]
}
]
,后面的数据:
+--------------------+
|id |record.repeated|
+--------------------+
|1 |'a' |
| |'b' |
| |'c' |
+--------------------+
|2 |'a' |
| |'c' |
+--------------------+
|3 |'d' |
+--------------------+
我需要做的是创建一个返回的查询:
+--------------------+
|id |record.repeated|
+--------------------+
|1 |'a,b,c' |
+--------------------+
|2 |'a,c' |
+--------------------+
|3 |'d' |
+--------------------+
换句话说,我需要查询它允许我使用sep连接嵌套字段的值arator(在这种情况下,逗号)。就像MySQL的GROUP_CONCAT函数,但在BigQuery上。
相关的想法:Concat all column values in sql
这可能吗?
谢谢。
完全错过了对文档的(我一直在寻找字符串函数)。记录:[聚合函数](https://cloud.google.com/bigquery/query-reference#aggfunctions)。 –
如何将浮点数连接到数组?如果我使用组concat,我必须将float转换为字符串,并且转换会降低精度。 –
如果你投了一个值,据我所知你失去了精度 – Pentium10