private Map<Object, Object> convertNestedMap(MapData mapData, LogicalType type) {
        if (mapData instanceof GenericMapData) {
            HashMap<Object, Object> m = Maps.newHashMap();
            for (Object k : ((GenericArrayData) ((GenericMapData) mapData).keyArray()).toObjectArray()) {
                m.put(k, ((GenericMapData) mapData).get(k));
            }
            return m;
        }
        if (mapData instanceof BinaryMapData) {
            Map<Object, Object> result = Maps.newHashMap();
            LogicalType valType = ((MapType) type).getValueType();
            Map<?, ?> javaMap = ((BinaryMapData) mapData).toJavaMap(((MapType) type).getKeyType(), valType);
            for (Map.Entry<?, ?> en : javaMap.entrySet()) {
                if (LogicalTypeRoot.MAP.equals(valType.getTypeRoot())) {
                    // traversal of the nested map
                    result.put(en.getKey().toString(), convertNestedMap((MapData) en.getValue(), valType));
                    continue;
                }
                if (LogicalTypeRoot.DATE.equals(valType.getTypeRoot())) {
                    result.put(en.getKey().toString(),
                            dateFormatter.format(Date.valueOf(LocalDate.ofEpochDay((Integer) en.getValue()))));
                    continue;
                }
                if (LogicalTypeRoot.ARRAY.equals(valType.getTypeRoot())) {
                    result.put(en.getKey().toString(), convertNestedArray((ArrayData) en.getValue(), valType));
                    continue;
                }
                result.put(en.getKey().toString(), en.getValue());
            }
            return result;
        }
        throw new UnsupportedOperationException(String.format("Unsupported map data: %s", mapData.getClass()));
    }
copy from {@link com.starrocks.connector.flink.row.sink.StarRocksTableRowTransformer}
inlong-sort/sort-flink/sort-flink-v1.15/sort-connectors/starrocks/src/main/java/org/apache/inlong/sort/starrocks/table/sink/table/StarRocksTableRowTransformer.java