mkeskells commented on code in PR #3307:
URL: https://github.com/apache/avro/pull/3307#discussion_r1993595940


##########
lang/java/avro/src/main/java/org/apache/avro/generic/PrimitivesArrays.java:
##########
@@ -17,23 +17,60 @@
  */
 package org.apache.avro.generic;
 
-import org.apache.avro.AvroRuntimeException;
 import org.apache.avro.Schema;
 
 import java.util.Arrays;
 import java.util.Collection;
 
 public class PrimitivesArrays {
 
-  public static class IntArray extends GenericData.AbstractArray<Integer> {
+  /**
+   * Create a primitive array if the value type is has an associated optimised
+   * implementation, otherwise a generic array is returned. The value type is
+   * determined form the convertedElementType if supplied, otherwise the
+   * underlying type from the schema
+   *
+   * @param size      the size of the array to create
+   * @param schema    the schema of the array
+   * @param valueType the converted elements value type. This may not be the 
same
+   *                  and the schema if for instance there is a logical type, 
and
+   *                  a convertor is use
+   * @return an instance of a primitive array or a Generic array if the value 
type
+   *         is does not have an associated optimised implementation.
+   */
+  public static GenericData.AbstractArray<?> createOptimizedArray(int size, 
Schema schema, Schema.Type valueType) {
+
+    if (valueType != null)
+      switch (valueType) {

Review Comment:
   am I expected to add a `default:break;`



-- 
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