diff --git a/fastserde/avro-fastserde/src/main/java/com/linkedin/avro/fastserde/FastSerializerGenerator.java b/fastserde/avro-fastserde/src/main/java/com/linkedin/avro/fastserde/FastSerializerGenerator.java index 8d8525f0..913dc973 100644 --- a/fastserde/avro-fastserde/src/main/java/com/linkedin/avro/fastserde/FastSerializerGenerator.java +++ b/fastserde/avro-fastserde/src/main/java/com/linkedin/avro/fastserde/FastSerializerGenerator.java @@ -246,7 +246,7 @@ private void processArrayElementLoop(final Schema arraySchema, final JClass arra final Schema elementSchema = arraySchema.getElementType(); if (SchemaAssistant.isComplexType(elementSchema)) { - JVar containerVar = declareValueVar(elementSchema.getName(), elementSchema, forBody); + JVar containerVar = declareValueVar(getUniqueName("element"), elementSchema, forBody); forBody.assign(containerVar, JExpr.invoke(JExpr.cast(arrayClass, arrayExpr), getMethodName).arg(counter)); processComplexType(elementSchema, containerVar, forBody, customizationSupplier); } else { @@ -290,7 +290,7 @@ private void processMap(final Schema mapSchema, JExpression mapExpr, JBlock body JVar containerVar; if (SchemaAssistant.isComplexType(valueSchema)) { - containerVar = declareValueVar(valueSchema.getName(), valueSchema, forBody); + containerVar = declareValueVar(getUniqueName("element"), valueSchema, forBody); forBody.assign(containerVar, JExpr.invoke(JExpr.cast(mapClass, mapExpr), "get").arg(mapKeysLoop.var())); processComplexType(valueSchema, containerVar, forBody, customizationSupplier);