use of org.apache.flink.table.types.logical.MapType in project flink by apache.
the class LogicalTypeJsonDeserializer method deserializeMap.
private static LogicalType deserializeMap(JsonNode logicalTypeNode, SerdeContext serdeContext) {
final JsonNode keyNode = logicalTypeNode.get(FIELD_NAME_KEY_TYPE);
final LogicalType keyType = deserialize(keyNode, serdeContext);
final JsonNode valueNode = logicalTypeNode.get(FIELD_NAME_VALUE_TYPE);
final LogicalType valueType = deserialize(valueNode, serdeContext);
return new MapType(keyType, valueType);
}
use of org.apache.flink.table.types.logical.MapType in project flink by apache.
the class RowDataSerializerTest method testRowDataSerializerWithComplexTypes.
private static Object[] testRowDataSerializerWithComplexTypes() {
InternalTypeInfo<RowData> typeInfo = InternalTypeInfo.ofFields(new IntType(), new DoubleType(), VarCharType.STRING_TYPE, new ArrayType(new IntType()), new MapType(new IntType(), new IntType()));
GenericRowData[] data = new GenericRowData[] { createRow(null, null, null, null, null), createRow(0, null, null, null, null), createRow(0, 0.0, null, null, null), createRow(0, 0.0, fromString("a"), null, null), createRow(1, 0.0, fromString("a"), null, null), createRow(1, 1.0, fromString("a"), null, null), createRow(1, 1.0, fromString("b"), null, null), createRow(1, 1.0, fromString("b"), createArray(1), createMap(new int[] { 1 }, new int[] { 1 })), createRow(1, 1.0, fromString("b"), createArray(1, 2), createMap(new int[] { 1, 4 }, new int[] { 1, 2 })), createRow(1, 1.0, fromString("b"), createArray(1, 2, 3), createMap(new int[] { 1, 5 }, new int[] { 1, 3 })), createRow(1, 1.0, fromString("b"), createArray(1, 2, 3, 4), createMap(new int[] { 1, 6 }, new int[] { 1, 4 })), createRow(1, 1.0, fromString("b"), createArray(1, 2, 3, 4, 5), createMap(new int[] { 1, 7 }, new int[] { 1, 5 })), createRow(1, 1.0, fromString("b"), createArray(1, 2, 3, 4, 5, 6), createMap(new int[] { 1, 8 }, new int[] { 1, 6 })) };
RowDataSerializer serializer = typeInfo.toRowSerializer();
return new Object[] { serializer, data };
}
Aggregations