Skip to content
Open
Show file tree
Hide file tree
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
1 change: 1 addition & 0 deletions sdks/java/extensions/avro/build.gradle
Original file line number Diff line number Diff line change
Expand Up @@ -40,6 +40,7 @@ def avroVersions = [
'182' : "1.8.2",
'192' : "1.9.2",
'1102': "1.10.2",
'1120': "1.12.0",
]

avroVersions.each { k, v ->
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -21,6 +21,7 @@
import static org.junit.Assert.assertFalse;
import static org.junit.Assert.assertTrue;

import com.fasterxml.jackson.databind.ObjectMapper;
import com.pholser.junit.quickcheck.From;
import com.pholser.junit.quickcheck.Property;
import com.pholser.junit.quickcheck.runner.JUnitQuickcheck;
Expand Down Expand Up @@ -284,10 +285,14 @@ public void avroToBeamRoundTrip(
Iterable iterable = randomData(avroSchema, 10);
List<GenericRecord> records = Lists.newArrayList((Iterable<GenericRecord>) iterable);

// Use JSON tree comparison to avoid Avro 1.12.0 GenericRecord.equals() throwing
// "Can't compare maps!" for records with nested map types
// (see AVRO-4139)
ObjectMapper mapper = new ObjectMapper();
for (GenericRecord record : records) {
Row row = AvroUtils.toBeamRowStrict(record, schema);
GenericRecord out = AvroUtils.toGenericRecord(row, avroSchema);
assertEquals(record, out);
assertEquals(mapper.readTree(record.toString()), mapper.readTree(out.toString()));
}
}

Expand Down
Loading