This is an automated email from the ASF dual-hosted git repository.
sunchao pushed a commit to branch branch-2.3
in repository https://gitbox.apache.org/repos/asf/hive.git
The following commit(s) were added to refs/heads/branch-2.3 by this push:
new 11b81d7 HIVE-24436: Fix Avro NULL_DEFAULT_VALUE compatibility issue
(#1722)
11b81d7 is described below
commit 11b81d7b11693b1efad619cf09d5f2b61bc5564c
Author: Yuming Wang <[email protected]>
AuthorDate: Wed Dec 2 04:23:14 2020 +0800
HIVE-24436: Fix Avro NULL_DEFAULT_VALUE compatibility issue (#1722)
---
.../java/org/apache/hadoop/hive/serde2/avro/TypeInfoToSchema.java | 5 +++--
1 file changed, 3 insertions(+), 2 deletions(-)
diff --git
a/serde/src/java/org/apache/hadoop/hive/serde2/avro/TypeInfoToSchema.java
b/serde/src/java/org/apache/hadoop/hive/serde2/avro/TypeInfoToSchema.java
index 4f8b05f..b4f2194 100644
--- a/serde/src/java/org/apache/hadoop/hive/serde2/avro/TypeInfoToSchema.java
+++ b/serde/src/java/org/apache/hadoop/hive/serde2/avro/TypeInfoToSchema.java
@@ -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;
@@ -73,7 +74,7 @@ public class TypeInfoToSchema {
}
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);
}
private Schema createAvroSchema(TypeInfo typeInfo) {
@@ -235,7 +236,7 @@ public class TypeInfoToSchema {
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));