Search in sources :

Example 11 with DoubleType

use of org.apache.flink.table.types.logical.DoubleType 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 };
}
Also used : ArrayType(org.apache.flink.table.types.logical.ArrayType) GenericRowData(org.apache.flink.table.data.GenericRowData) RowData(org.apache.flink.table.data.RowData) BinaryRowData(org.apache.flink.table.data.binary.BinaryRowData) DoubleType(org.apache.flink.table.types.logical.DoubleType) GenericRowData(org.apache.flink.table.data.GenericRowData) MapType(org.apache.flink.table.types.logical.MapType) IntType(org.apache.flink.table.types.logical.IntType)

Aggregations

DoubleType (org.apache.flink.table.types.logical.DoubleType)11 IntType (org.apache.flink.table.types.logical.IntType)10 BigIntType (org.apache.flink.table.types.logical.BigIntType)9 LogicalType (org.apache.flink.table.types.logical.LogicalType)9 SmallIntType (org.apache.flink.table.types.logical.SmallIntType)9 TinyIntType (org.apache.flink.table.types.logical.TinyIntType)9 VarCharType (org.apache.flink.table.types.logical.VarCharType)7 ArrayList (java.util.ArrayList)6 BooleanType (org.apache.flink.table.types.logical.BooleanType)6 DateType (org.apache.flink.table.types.logical.DateType)6 DecimalType (org.apache.flink.table.types.logical.DecimalType)6 FloatType (org.apache.flink.table.types.logical.FloatType)6 TimestampType (org.apache.flink.table.types.logical.TimestampType)6 Configuration (org.apache.hadoop.conf.Configuration)6 AtomicInteger (java.util.concurrent.atomic.AtomicInteger)4 FileSourceSplit (org.apache.flink.connector.file.src.FileSourceSplit)4 Path (org.apache.flink.core.fs.Path)4 ArrayType (org.apache.flink.table.types.logical.ArrayType)4 TimeType (org.apache.flink.table.types.logical.TimeType)4 Row (org.apache.flink.types.Row)4