Copilot commented on code in PR #15654: URL: https://github.com/apache/pinot/pull/15654#discussion_r2062645895
########## pinot-plugins/pinot-input-format/pinot-avro-base/src/main/java/org/apache/pinot/plugin/inputformat/avro/AvroSchemaUtil.java: ########## @@ -193,8 +194,26 @@ private static Object applySchemaTypeLogic(Schema schema, Object value) { } } - private static Object processArraySchema(GenericData.Array array, Schema schema) { + private static Object processArraySchema(Object object, Schema schema) { Schema elementSchema = schema.getElementType(); + if (object == null) { + return null; + } + if (object instanceof List) { + List<Object> list = (List<Object>) object; + list.replaceAll(element -> processElement(element, elementSchema)); + return list; + } + if (object.getClass().isArray()) { + int length = java.lang.reflect.Array.getLength(object); + for (int i = 0; i < length; i++) { + Object element = java.lang.reflect.Array.get(object, i); + java.lang.reflect.Array.set(object, i, processElement(element, elementSchema)); + } + return object; + } + + GenericData.Array array = (GenericData.Array) object; Review Comment: Consider adding an instanceof check for GenericData.Array before casting to avoid a potential ClassCastException if a type outside List or native arrays is passed. -- 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: commits-unsubscr...@pinot.apache.org For queries about this service, please contact Infrastructure at: us...@infra.apache.org --------------------------------------------------------------------- To unsubscribe, e-mail: commits-unsubscr...@pinot.apache.org For additional commands, e-mail: commits-h...@pinot.apache.org