allegro / allegro/json-avro-converter

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

Aperta
#8 1 commento 0 reazioni 0 assegnatari Vedi su GitHub
Lingua principale
Groovy
Stelle
286
Fork
98
Metriche di merge delle PR
Nessuna PR unita negli ultimi 30g

Descrizione

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.

Guida per i contributori

Nessuna guida per i contributori indicizzata per questo repository

Valutazione

Questa issue non è ancora stata valutata.

Ricevi le nuove issue nella tua casella

Un breve riepilogo di issue GitHub adatte ai principianti.