BigQuery - 正在加载具有空值的 JSON 个字段

BigQuery - Loading JSON fields with null values

我正在尝试使用 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?我在文档中找不到太多信息。请指出一些文档或一些解决方法。感谢您的宝贵时间。

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