xuefuz commented on a change in pull request #8814: [FLINK-12917][hive] support complex type of array, map, struct for Hive functions URL: https://github.com/apache/flink/pull/8814#discussion_r296433764
########## File path: flink-connectors/flink-connector-hive/src/main/java/org/apache/flink/table/functions/hive/conversion/HiveInspectors.java ########## @@ -181,15 +191,72 @@ public static HiveObjectConversion getConversion(ObjectInspector inspector, Data inspector instanceof BinaryObjectInspector) { return IdentityConversion.INSTANCE; } else if (inspector instanceof HiveCharObjectInspector) { - return o -> new HiveChar((String) o, ((CharType) dataType.getLogicalType()).getLength()); + return o -> new HiveChar((String) o, ((CharType) dataType).getLength()); } else if (inspector instanceof HiveVarcharObjectInspector) { - return o -> new HiveVarchar((String) o, ((VarCharType) dataType.getLogicalType()).getLength()); + return o -> new HiveVarchar((String) o, ((VarCharType) dataType).getLength()); } // TODO: handle decimal type } - // TODO: handle complex types like struct, list, and map + if (inspector instanceof ListObjectInspector) { + HiveObjectConversion eleConvert = getConversion( + ((ListObjectInspector) inspector).getListElementObjectInspector(), + ((ArrayType) dataType).getElementType()); + return o -> { + Object[] array = (Object[]) o; + List<Object> result = new ArrayList<>(); Review comment: We can probably instantiate the list with the known size. ---------------------------------------------------------------- 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. For queries about this service, please contact Infrastructure at: us...@infra.apache.org With regards, Apache Git Services