Skip to content

Commit 48aa892

Browse files
author
David Astle
committed
Merge branch 'topic/avro-translate-default' RB=630569 G=si-dev R=gogenc,sihde,eleshem A=sihde,eleshem
2 parents b5ee1f4 + 185f7bb commit 48aa892

File tree

2 files changed

+4
-23
lines changed

2 files changed

+4
-23
lines changed

data-avro/src/main/java/com/linkedin/data/avro/DataTranslator.java

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -553,8 +553,8 @@ else if (fieldValue == null)
553553
else
554554
{
555555
appendMessage("required field is absent");
556-
_path.removeLast();
557556
}
557+
_path.removeLast();
558558
continue;
559559
}
560560
Object fieldAvroValue = translate(fieldValue, fieldDataSchema, fieldAvroSchema);

data-avro/src/test/java/com/linkedin/data/avro/TestDataTranslator.java

Lines changed: 3 additions & 22 deletions
Original file line numberDiff line numberDiff line change
@@ -927,7 +927,7 @@ public void testAvroSchemaMissingFields() throws IOException
927927
@Test
928928
public void testMissingDefaultFieldsOnDataMap() throws IOException
929929
{
930-
final String P_SCHEMA =
930+
final String SCHEMA =
931931
"{" +
932932
" \"type\":\"record\"," +
933933
" \"name\":\"Foo\"," +
@@ -946,27 +946,8 @@ public void testMissingDefaultFieldsOnDataMap() throws IOException
946946
" }" +
947947
" ]" +
948948
"}";
949-
final String A_SCHEMA =
950-
"{" +
951-
" \"type\":\"record\"," +
952-
" \"name\":\"Foo\"," +
953-
" \"fields\":[" +
954-
" {\n" +
955-
" \"name\":\"field1\"," +
956-
" \"type\":\"string\"" +
957-
" },\n" +
958-
" {\n" +
959-
" \"name\":\"field2\"," +
960-
" \"type\":{\n" +
961-
" \"type\":\"array\"," +
962-
" \"items\":\"string\"" +
963-
" }," +
964-
" \"default\":[ ]" +
965-
" }" +
966-
" ]" +
967-
"}";
968-
RecordDataSchema pegasusSchema = (RecordDataSchema)TestUtil.dataSchemaFromString(P_SCHEMA);
969-
Schema avroShema = Schema.parse(A_SCHEMA);
949+
RecordDataSchema pegasusSchema = (RecordDataSchema)TestUtil.dataSchemaFromString(SCHEMA);
950+
Schema avroShema = Schema.parse(SCHEMA);
970951
DataMap dataMap = new DataMap();
971952
dataMap.put("field1", "test");
972953
GenericRecord record = DataTranslator.dataMapToGenericRecord(dataMap, pegasusSchema, avroShema);

0 commit comments

Comments
 (0)