hi 我正在解析json数组,在解析的时候遇到一个问题,当解析的json数组元素为同一类型的时候,我可以使用ddl的array进行存储,但是当json数组元素为不同类型的时候,我没办法做ddl映射,我查看JsonRowSchemaConverter解析json array的时候,对于不同类型的数组元素解析后可以用row存储,但请问我在ddl时候要怎么做,因为在DDL用row表示数组会抛出异常
private static TypeInformation<?> convertArray(String location, JsonNode node, JsonNode root) { // validate items if (!node.has(ITEMS)) { throw new IllegalArgumentException( "Arrays must specify an '" + ITEMS + "' property in node: " + location); } final JsonNode items = node.get(ITEMS); // list (translated to object array) if (items.isObject()) { final TypeInformation<?> elementType = convertType( location + '/' + ITEMS, items, root); // result type might either be ObjectArrayTypeInfo or BasicArrayTypeInfo for Strings return Types.OBJECT_ARRAY(elementType); } // tuple (translated to row) else if (items.isArray()) { final TypeInformation<?>[] types = convertTypes(location + '/' + ITEMS, items, root); // validate that array does not contain additional items if (node.has(ADDITIONAL_ITEMS) && node.get(ADDITIONAL_ITEMS).isBoolean() && node.get(ADDITIONAL_ITEMS).asBoolean()) { throw new IllegalArgumentException( "An array tuple must not allow additional items in node: " + location); } return Types.ROW(types); } throw new IllegalArgumentException( "Invalid type for '" + ITEMS + "' property in node: " + location); }