admin管理员组文章数量:1355068
What I run:
I run this in the BigQuery console:
SELECT CAST([1, 2, 3] AS ARRAY<INTEGER>) AS col
I select to view the results as JSON and get:
[{
"col": ["1", "2", "3"]
}]
What's wrong:
The values in the list have been cast to STRING
.
What I expect:
The values in the list should be numeric (unquoted).
What I run:
I run this in the BigQuery console:
SELECT CAST([1, 2, 3] AS ARRAY<INTEGER>) AS col
I select to view the results as JSON and get:
[{
"col": ["1", "2", "3"]
}]
What's wrong:
The values in the list have been cast to STRING
.
What I expect:
The values in the list should be numeric (unquoted).
Share Improve this question asked Mar 28 at 12:51 Ben WatsonBen Watson 5,5516 gold badges43 silver badges71 bronze badges1 Answer
Reset to default 0These are JSON numbers in string format. Based on SQL syntax notation rules. The GoogleSQL documentation commonly uses the following syntax notation rules and one of those rules are: Double quotes ": Syntax wrapped in double quotes ("") is required.
Based on working with JSON data in GoogleSQL, By using the JSON data type, you can load semi-structured JSON into BigQuery without providing a schema for the JSON data upfront. This lets you store and query data that doesn't always adhere to fixed schemas and data types. By ingesting JSON data as a JSON data type, BigQuery can encode and process each JSON field individually. You can then query the values of fields and array elements within the JSON data by using the field access operator, which makes JSON queries intuitive and cost efficient.
本文标签: Correctly export numeric lists as JSON in BigQueryStack Overflow
版权声明:本文标题:Correctly export numeric lists as JSON in BigQuery - Stack Overflow 内容由网友自发贡献,该文观点仅代表作者本人, 转载请联系作者并注明出处:http://www.betaflare.com/web/1744036828a2579929.html, 本站仅提供信息存储空间服务,不拥有所有权,不承担相关法律责任。如发现本站有涉嫌抄袭侵权/违法违规的内容,一经查实,本站将立刻删除。
发表评论