opwvhk commented on a change in pull request #1355:
URL: https://github.com/apache/avro/pull/1355#discussion_r820463337



##########
File path: 
lang/java/avro/src/main/java/org/apache/avro/reflect/ReflectDatumReader.java
##########
@@ -152,68 +160,39 @@ protected Object readArray(Object old, Schema expected, 
ResolvingDecoder in) thr
         throw new AvroRuntimeException(msg);
       }
     } else {
-      return readJavaArray(array, expectedType, l, in);
-    }
-  }
-
-  private Object readJavaArray(Object array, Schema expectedType, long l, 
ResolvingDecoder in) throws IOException {
-    Class<?> elementType = array.getClass().getComponentType();
-    if (elementType.isPrimitive()) {
-      return readPrimitiveArray(array, elementType, l, in);
-    } else {
-      return readObjectArray((Object[]) array, expectedType, l, in);
+      return readJavaArray(array, elementClass, elementSchema, l, in);
     }
   }
 
-  private Object readPrimitiveArray(Object array, Class<?> c, long l, 
ResolvingDecoder in) throws IOException {
-    return ArrayAccessor.readArray(array, c, l, in);
-  }
-
-  private Object readObjectArray(Object[] array, Schema expectedType, long l, 
ResolvingDecoder in) throws IOException {
-    LogicalType logicalType = expectedType.getLogicalType();
-    Conversion<?> conversion = getData().getConversionFor(logicalType);
-    int index = 0;
-    if (logicalType != null && conversion != null) {
-      do {
-        int limit = index + (int) l;
-        while (index < limit) {
-          Object element = readWithConversion(null, expectedType, logicalType, 
conversion, in);
-          array[index] = element;
-          index++;
-        }
-      } while ((l = in.arrayNext()) > 0);
+  private Object readJavaArray(Object array, Class<?> elementClass, Schema 
expected, long l, ResolvingDecoder in)
+      throws IOException {
+    Class<?> arrayElementClass = array.getClass().getComponentType();
+    if (arrayElementClass.isPrimitive()) {
+      return ArrayAccessor.readArray(array, arrayElementClass, l, in);

Review comment:
       I don't understand this; are conversions of primitive types really 
impossible?




-- 
This is an automated message from the Apache Git Service.
To respond to the message, please log on to GitHub and use the
URL above to go to the specific comment.

To unsubscribe, e-mail: [email protected]

For queries about this service, please contact Infrastructure at:
[email protected]


Reply via email to