allegro / allegro/json-avro-converter

Field [fieldName] is expected to be type: java.util.List

未关闭
#8 1 条评论 0 个 reaction 已指派 0 人 在 GitHub 查看
主要语言
Groovy
星标
286
派生
98
PR 合并指标
30 天内没有已合并 PR

描述

I got this exception message when running it on my json string from a **TableRow** object.
the record is null and the schema type is:

```
{
"name": "customDimensions",
"type": {
"type": "array",
"items": {
"type": "record",
"namespace": "root",
"name": "CustomDimensions",
"fields": [
{
"name": "index",
"type": [
"long",
"null"
]
},
{
"name": "value",
"type": [
"string",
"null"
]
}
]
}
}
},
...
```

The problem is that when I try the export of a **Bigquery** table with that schema, even if the record is null it works fine and gives me empty array, when I try this in a **dataflow**, writing the **TableRow** object in a **GenericRecord** using this great utility, then it fails.
I think Google internally does the transformation in _Proto_ (as documented [here](https://code.google.com/p/google-bigquery/issues/detail?id=544)) first and then in Avro so in these steps it probably checks if the value List is null then serialize empty array. I personally applied this check in:
`Object read(Schema.Field field, Schema schema, Object value, Deque path, boolean silently)`
when case: ARRAY.

Thanks for help anyway.

贡献指南

这个仓库没有索引到贡献指南

评估

这个 Issue 还没有评估数据。

把新 issue 发到你的邮箱

精选适合新手参与的 GitHub issue 摘要。