KurtYoung commented on a change in pull request #10060: [FLINK-14546] [flink-json] Support map type in flink-json URL: https://github.com/apache/flink/pull/10060#discussion_r342405648
########## File path: flink-formats/flink-json/src/main/java/org/apache/flink/formats/json/JsonRowDeserializationSchema.java ########## @@ -242,11 +247,25 @@ private DeserializationRuntimeConverter wrapIntoNullableConverter(Deserializatio return Optional.of(createObjectArrayConverter(((BasicArrayTypeInfo) typeInfo).getComponentInfo())); } else if (isPrimitiveByteArray(typeInfo)) { return Optional.of(createByteArrayConverter()); + } else if (typeInfo instanceof MapTypeInfo) { + MapTypeInfo<?, ?> mapTypeInfo = (MapTypeInfo<?, ?>) typeInfo; + return Optional.of(createMapConverter(mapTypeInfo.getKeyTypeInfo(), mapTypeInfo.getValueTypeInfo())); } else { return Optional.empty(); } } + private DeserializationRuntimeConverter createMapConverter(TypeInformation keyType, TypeInformation valueType) { + DeserializationRuntimeConverter valueConverter = createConverter(valueType); + DeserializationRuntimeConverter keyConverter = createConverter(keyType); + + return (mapper, jsonNode) -> StreamSupport.stream( Review comment: According to [flink code style](https://flink.apache.org/contributing/code-style-and-quality-java.html), we should avoid Java Streams in any performance critical code. Since this DeserializationRuntimeConverter will be called in per record fashion, I would suggest to write it without Java Streams. (I know the old codes are written with Java Streams, but we should follow the code style in newly added codes) ---------------------------------------------------------------- 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