Skip to content

Commit 9f1c12e

Browse files
authored
Fix AvroConverter when multiple Array of Struct schemas is converted (#157)
1 parent 20017a5 commit 9f1c12e

File tree

1 file changed

+6
-2
lines changed

1 file changed

+6
-2
lines changed

hoptimator-avro/src/main/java/com/linkedin/hoptimator/avro/AvroConverter.java

Lines changed: 6 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -62,10 +62,14 @@ public static Schema avro(String namespace, String name, RelDataType dataType) {
6262
case BOOLEAN:
6363
return createAvroTypeWithNullability(Schema.Type.BOOLEAN, dataType.isNullable());
6464
case ARRAY:
65-
return createAvroSchemaWithNullability(Schema.createArray(avro(null, "arrayElement", Objects.requireNonNull(dataType.getComponentType()))),
65+
return createAvroSchemaWithNullability(
66+
Schema.createArray(avro(null, sanitize(name) + "ArrayElement",
67+
Objects.requireNonNull(dataType.getComponentType()))),
6668
dataType.isNullable());
6769
case MAP:
68-
return createAvroSchemaWithNullability(Schema.createMap(avro(null, "mapElement", Objects.requireNonNull(dataType.getValueType()))),
70+
return createAvroSchemaWithNullability(
71+
Schema.createMap(avro(null, sanitize(name) + "MapElement",
72+
Objects.requireNonNull(dataType.getValueType()))),
6973
dataType.isNullable());
7074
case UNKNOWN:
7175
case NULL:

0 commit comments

Comments
 (0)