allegro / allegro/json-avro-converter

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

Open
#8 1 comment 0 reactions 0 assignees View on GitHub
Dominant language
Groovy
Stars
286
Forks
98
PR merge metrics
No merged PRs in 30d

Description

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.

Contributor guide

No contributing guide indexed for this repository

Assessment

This issue has not been assessed yet.

Get new issues in your inbox

A short digest of beginner-friendly GitHub issues.