[
https://issues.apache.org/jira/browse/AVRO-2910?page=com.atlassian.jira.plugin.system.issuetabpanels:all-tabpanel
]
Chris Coutinho resolved AVRO-2910.
----------------------------------
Resolution: Not A Problem
I spoke too early - this is actually the intended output based on avro JSON
encoding
**http://avro.apache.org/docs/current/spec.html#json_encoding
> Random untion(__, null) data doesn't conform to schema
> ------------------------------------------------------
>
> Key: AVRO-2910
> URL: https://issues.apache.org/jira/browse/AVRO-2910
> Project: Apache Avro
> Issue Type: Bug
> Components: tools
> Reporter: Chris Coutinho
> Priority: Minor
> Attachments: sample.json, test.avdl, test.avsc
>
>
> The random Avro data generator tool doesn't generate data that conforms to a
> schema containing nullable fields.
> For example, the following test.avdl can be used to define a schema for
> single `test` record, where some of the fields are nullable based on `union`.
> There doesn't seem to be a difference between setting null first or last.
>
> Using the `idl2schemata` tool, the attached .avdl file generates the attached
> (.avsc) schema
>
> Using the `random` tool and piping the result into `tojson`, you can see that
> the generated data (attached sample.json) doesn't conform to the schema:
>
> {{$ avro-tools random --count 10 --schema-file test.avsc - | avro-tools
> tojson --reader-schema-file test.avsc - > sample.json}}
>
> Note how the non-null random values are unnecessarily nested in the following
> examples, where the generated value is nested within an object with the data
> type as a key (e.g. {{"null_num2":\{"int":1517937645}` instead of
> `"null_num2":1517937645}})
>
>
--
This message was sent by Atlassian Jira
(v8.3.4#803005)