pvary commented on code in PR #17644:
URL: https://github.com/apache/iceberg/pull/17644#discussion_r4002823279


##########
flink/v2.1/flink/src/main/java/org/apache/iceberg/flink/data/FlinkSchemaVisitor.java:
##########
@@ -41,7 +43,16 @@ private static <T> T visit(LogicalType flinkType, Type 
iType, FlinkSchemaVisitor
         return visitRecord(flinkType, iType.asStructType(), visitor);
 
       case MAP:
-        MapType mapType = (MapType) flinkType;
+        // A Flink MULTISET<T> is converted to an Iceberg map<T, int> of 
element to occurrence
+        // count by FlinkTypeToType#visit(MultisetType), and RowData 
represents both as MapData,
+        // so the multiset is visited as its equivalent map.
+        MapType mapType =
+            flinkType instanceof MultisetType
+                ? new MapType(
+                    flinkType.isNullable(),
+                    ((MultisetType) flinkType).getElementType(),
+                    new IntType(false))
+                : (MapType) flinkType;

Review Comment:
   Duplicated code. Please extract



-- 
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: [email protected]

For queries about this service, please contact Infrastructure at:
[email protected]


---------------------------------------------------------------------
To unsubscribe, e-mail: [email protected]
For additional commands, e-mail: [email protected]

Reply via email to