Details
-
Bug
-
Status: Resolved
-
Major
-
Resolution: Fixed
-
None
-
None
-
None
Description
I'm getting an error from the convertRecord processor saying an Avro Schema couldn't be found. I've narrowed it down to the processor thinking that my schema is invalid. Would it be possible to change the log message to say when the schema is invalid instead?
In my schema I have a field that is optional, so I'm using a null default. This is what the processor thinks is invalid about it. I tried the same schema using the Java avro library and it seems like it's valid.
I've attached an example template and here's the java code I'm using.
Schema schema = new Schema.Parser().parse("{\"type\":\"record\",\"name\":\"Test\",\"fields\":[{\"name\":\"name\",\"type\":\"string\"},{\"name\":\"deleted\",\"type\":[\"null\",\"boolean\"],\"default\":null}]}"); GenericRecord t1 = new GenericData.Record(schema); t1.put("name", "Bob"); ByteArrayOutputStream out = new ByteArrayOutputStream(); DatumWriter<GenericRecord> datumWriter = new GenericDatumWriter<GenericRecord>(schema); DataFileWriter<GenericRecord> dataFileWriter = new DataFileWriter<GenericRecord>(datumWriter); dataFileWriter.create(schema, out); dataFileWriter.append(t1); dataFileWriter.close(); System.out.println(new String(out.toByteArray()));
Attachments
Attachments
Issue Links
- links to