wuchong commented on a change in pull request #13543:
URL: https://github.com/apache/flink/pull/13543#discussion_r502208764



##########
File path: 
flink-formats/flink-json/src/main/java/org/apache/flink/formats/json/RowDataToJsonConverters.java
##########
@@ -218,14 +220,23 @@ private RowDataToJsonConverter 
createArrayConverter(ArrayType type) {
                };
        }
 
-       private RowDataToJsonConverter createMapConverter(MapType type) {
-               LogicalType keyType = type.getKeyType();
+       private RowDataToJsonConverter createMapConverter(LogicalType type) {

Review comment:
       The same to above. 

##########
File path: 
flink-formats/flink-json/src/main/java/org/apache/flink/formats/json/JsonToRowDataConverters.java
##########
@@ -298,15 +300,25 @@ private JsonToRowDataConverter 
createArrayConverter(ArrayType arrayType) {
                };
        }
 
-       private JsonToRowDataConverter createMapConverter(MapType mapType) {
-               LogicalType keyType = mapType.getKeyType();
+       private JsonToRowDataConverter createMapConverter(LogicalType type) {
+               LogicalType keyType;
+               LogicalType valueType;
+               if (type instanceof MapType) {
+                       MapType mapType = (MapType) type;
+                       keyType = mapType.getKeyType();
+                       valueType = mapType.getValueType();
+               } else {
+                       MultisetType multisetType = (MultisetType) type;
+                       keyType = multisetType.getElementType();
+                       valueType = new IntType();
+               }

Review comment:
       I would suggest to change the method parameters to 
`createMapConverter(String typeSummary, LogicalType keyType, LogicalType 
valueType)` and move the above code out of the method (i.e. move to the switch 
case block). This can make the method `createMapConverter` more generic. 




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


Reply via email to