我正在尝试使用java客户端库将json文件加载到Bigquery中。一些Json字段填充为null。并且负载因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 values和 Loading nulls into bigquery with bq
不幸的是,我无法更改json以删除具有空值的字段。有没有办法在Bigquery中加载这样的json?我在文档中找不到太多信息。请指出一些文档或一些解决方法。谢谢你的时间。
答案 0 :(得分:4)
这是我们当前JSON导入的已知问题。不幸的是,加载空记录的唯一方法是完全省略JSON中的记录,而不是明确地将其设置为null。我会在内部突破bug的优先级,但可能没有立即修复。