【问题标题】:BigQuery - Loading JSON fields with null valuesBigQuery - 加载具有空值的 JSON 字段
【发布时间】:2015-09-16 19:55:56
【问题描述】:

我正在尝试使用 java 客户端库将 json 文件加载到 Bigquery 中。一些 Json 字段填充为空。并且加载失败,Bigquery 出现以下错误。

{
    "reason": "invalid",
    "location": "File: 0 / Offset:0 / Line:1 / Column:1666 / Field:field1",
    "message": "flat value specified for record field"
}

我的架构是这样的。

{
    "name": "field1",
    "type": "RECORD",
    "mode": "NULLABLE",
    "fields": [{
        "name": "field2",
        "type": "TIMESTAMP",
        "mode": "REQUIRED"
    },
    {
        "name": "field3",
        "type": "TIMESTAMP",
        "mode": "REQUIRED"
    }]
}

而我的Json就是这样的。

{
    ...
    "field1": null,
    ...
}

我看到了这两个链接。

Import json data with null valuesLoading nulls into bigquery with bq

不幸的是,我无法更改 json 以删除具有空值的字段。有没有办法在 Bigquery 中加载这样的 json?我在文档中找不到太多信息。请指点我一些文档或一些解决方法。感谢您的宝贵时间。

【问题讨论】:

    标签: google-bigquery


    【解决方案1】:

    这是我们当前 JSON 导入的一个已知问题。不幸的是,加载空记录的唯一方法是完全忽略 JSON 中的记录,而不是将其显式设置为空。我会在内部提高 bug 的优先级,但可能不会立即修复。

    【讨论】:

    • 感谢 Jeremy 的确认。
    • Jeremy,这仍然是一个已知问题还是已解决?谢谢。
    • 仍然没有修复..? 2年后?
    猜你喜欢
    • 1970-01-01
    • 1970-01-01
    • 2020-02-07
    • 1970-01-01
    • 1970-01-01
    • 1970-01-01
    • 2015-11-09
    • 2011-11-23
    • 1970-01-01
    相关资源
    最近更新 更多