Skip to content
Closed
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
Original file line number Diff line number Diff line change
Expand Up @@ -17,6 +17,7 @@
*/
package org.apache.hadoop.hive.serde2.avro;

import org.apache.avro.JsonProperties;
import org.apache.avro.Schema;
import org.apache.hadoop.hive.serde2.objectinspector.PrimitiveObjectInspector;
import org.apache.hadoop.hive.serde2.typeinfo.CharTypeInfo;
Expand Down Expand Up @@ -73,7 +74,7 @@ public Schema convert(List<String> columnNames, List<TypeInfo> columnTypes,
}

private Schema.Field createAvroField(String name, TypeInfo typeInfo, String comment) {
return new Schema.Field(name, createAvroSchema(typeInfo), comment, null);
return new Schema.Field(name, createAvroSchema(typeInfo), comment, JsonProperties.NULL_VALUE);
}
Comment on lines +77 to 78
Copy link
Member

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.


private Schema createAvroSchema(TypeInfo typeInfo) {
Expand Down Expand Up @@ -235,7 +236,7 @@ private Schema createAvroArray(TypeInfo typeInfo) {
private List<Schema.Field> getFields(Schema.Field schemaField) {
List<Schema.Field> fields = new ArrayList<Schema.Field>();

JsonNode nullDefault = JsonNodeFactory.instance.nullNode();
JsonProperties.Null nullDefault = JsonProperties.NULL_VALUE;
if (schemaField.schema().getType() == Schema.Type.RECORD) {
for (Schema.Field field : schemaField.schema().getFields()) {
fields.add(new Schema.Field(field.name(), field.schema(), field.doc(), nullDefault));
Expand Down