org.apache.flink.api.common.typeutils.base.ByteSerializer Java Examples

The following examples show how to use org.apache.flink.api.common.typeutils.base.ByteSerializer. You can vote up the ones you like or vote down the ones you don't like, and go to the original project or source file by following the links above each example. You may check out the related API usage on the sidebar.
Example #1
Source File: ByteComparatorTest.java    From Flink-CEPplus with Apache License 2.0 4 votes vote down vote up
@Override
protected TypeSerializer<Byte> createSerializer() {
	return new ByteSerializer();
}
 
Example #2
Source File: ByteSerializerTest.java    From Flink-CEPplus with Apache License 2.0 4 votes vote down vote up
@Override
protected TypeSerializer<Byte> createSerializer() {
	return new ByteSerializer();
}
 
Example #3
Source File: InternalSerializers.java    From flink with Apache License 2.0 4 votes vote down vote up
public static TypeSerializer create(LogicalType type, ExecutionConfig config) {
	switch (type.getTypeRoot()) {
		case BOOLEAN:
			return BooleanSerializer.INSTANCE;
		case TINYINT:
			return ByteSerializer.INSTANCE;
		case SMALLINT:
			return ShortSerializer.INSTANCE;
		case INTEGER:
		case DATE:
		case TIME_WITHOUT_TIME_ZONE:
		case INTERVAL_YEAR_MONTH:
			return IntSerializer.INSTANCE;
		case BIGINT:
		case TIMESTAMP_WITHOUT_TIME_ZONE:
		case TIMESTAMP_WITH_LOCAL_TIME_ZONE:
		case INTERVAL_DAY_TIME:
			return LongSerializer.INSTANCE;
		case FLOAT:
			return FloatSerializer.INSTANCE;
		case DOUBLE:
			return DoubleSerializer.INSTANCE;
		case CHAR:
		case VARCHAR:
			return BinaryStringSerializer.INSTANCE;
		case DECIMAL:
			DecimalType decimalType = (DecimalType) type;
			return new DecimalSerializer(decimalType.getPrecision(), decimalType.getScale());
		case ARRAY:
			return new BaseArraySerializer(((ArrayType) type).getElementType(), config);
		case MAP:
			MapType mapType = (MapType) type;
			return new BaseMapSerializer(mapType.getKeyType(), mapType.getValueType(), config);
		case MULTISET:
			return new BaseMapSerializer(((MultisetType) type).getElementType(), new IntType(), config);
		case ROW:
			RowType rowType = (RowType) type;
			return new BaseRowSerializer(config, rowType);
		case BINARY:
		case VARBINARY:
			return BytePrimitiveArraySerializer.INSTANCE;
		case ANY:
			return new BinaryGenericSerializer(
					((TypeInformationAnyType) type).getTypeInformation().createSerializer(config));
		default:
			throw new RuntimeException("Not support type: " + type);
	}
}
 
Example #4
Source File: FirstValueWithRetractAggFunction.java    From flink with Apache License 2.0 4 votes vote down vote up
@Override
protected TypeSerializer<Byte> createValueSerializer() {
	return ByteSerializer.INSTANCE;
}
 
Example #5
Source File: LastValueWithRetractAggFunction.java    From flink with Apache License 2.0 4 votes vote down vote up
@Override
protected TypeSerializer<Byte> createValueSerializer() {
	return ByteSerializer.INSTANCE;
}
 
Example #6
Source File: ByteComparatorTest.java    From flink with Apache License 2.0 4 votes vote down vote up
@Override
protected TypeSerializer<Byte> createSerializer() {
	return new ByteSerializer();
}
 
Example #7
Source File: ByteSerializerTest.java    From flink with Apache License 2.0 4 votes vote down vote up
@Override
protected TypeSerializer<Byte> createSerializer() {
	return new ByteSerializer();
}
 
Example #8
Source File: InternalSerializers.java    From flink with Apache License 2.0 4 votes vote down vote up
/**
 * Creates a {@link TypeSerializer} for internal data structures of the given {@link LogicalType}.
 */
public static TypeSerializer create(LogicalType type, ExecutionConfig config) {
	// ordered by type root definition
	switch (type.getTypeRoot()) {
		case CHAR:
		case VARCHAR:
			return StringDataSerializer.INSTANCE;
		case BOOLEAN:
			return BooleanSerializer.INSTANCE;
		case BINARY:
		case VARBINARY:
			return BytePrimitiveArraySerializer.INSTANCE;
		case DECIMAL:
			return new DecimalDataSerializer(getPrecision(type), getScale(type));
		case TINYINT:
			return ByteSerializer.INSTANCE;
		case SMALLINT:
			return ShortSerializer.INSTANCE;
		case INTEGER:
		case DATE:
		case TIME_WITHOUT_TIME_ZONE:
		case INTERVAL_YEAR_MONTH:
			return IntSerializer.INSTANCE;
		case BIGINT:
		case INTERVAL_DAY_TIME:
			return LongSerializer.INSTANCE;
		case FLOAT:
			return FloatSerializer.INSTANCE;
		case DOUBLE:
			return DoubleSerializer.INSTANCE;
		case TIMESTAMP_WITHOUT_TIME_ZONE:
		case TIMESTAMP_WITH_LOCAL_TIME_ZONE:
			return new TimestampDataSerializer(getPrecision(type));
		case TIMESTAMP_WITH_TIME_ZONE:
			throw new UnsupportedOperationException();
		case ARRAY:
			return new ArrayDataSerializer(((ArrayType) type).getElementType(), config);
		case MULTISET:
			return new MapDataSerializer(((MultisetType) type).getElementType(), new IntType(false), config);
		case MAP:
			MapType mapType = (MapType) type;
			return new MapDataSerializer(mapType.getKeyType(), mapType.getValueType(), config);
		case ROW:
		case STRUCTURED_TYPE:
			return new RowDataSerializer(config, type.getChildren().toArray(new LogicalType[0]));
		case DISTINCT_TYPE:
			return create(((DistinctType) type).getSourceType(), config);
		case RAW:
			if (type instanceof RawType) {
				final RawType<?> rawType = (RawType<?>) type;
				return new RawValueDataSerializer<>(rawType.getTypeSerializer());
			}
			return new RawValueDataSerializer<>(
				((TypeInformationRawType<?>) type).getTypeInformation().createSerializer(config));
		case NULL:
		case SYMBOL:
		case UNRESOLVED:
		default:
			throw new UnsupportedOperationException(
				"Unsupported type '" + type + "' to get internal serializer");
	}
}
 
Example #9
Source File: FirstValueWithRetractAggFunction.java    From flink with Apache License 2.0 4 votes vote down vote up
@Override
protected TypeSerializer<Byte> createValueSerializer() {
	return ByteSerializer.INSTANCE;
}
 
Example #10
Source File: LastValueWithRetractAggFunction.java    From flink with Apache License 2.0 4 votes vote down vote up
@Override
protected TypeSerializer<Byte> createValueSerializer() {
	return ByteSerializer.INSTANCE;
}
 
Example #11
Source File: PythonTypeUtils.java    From flink with Apache License 2.0 4 votes vote down vote up
@Override
public TypeSerializer visit(TinyIntType tinyIntType) {
	return ByteSerializer.INSTANCE;
}
 
Example #12
Source File: ByteComparatorTest.java    From flink with Apache License 2.0 4 votes vote down vote up
@Override
protected TypeSerializer<Byte> createSerializer() {
	return new ByteSerializer();
}
 
Example #13
Source File: ByteSerializerTest.java    From flink with Apache License 2.0 4 votes vote down vote up
@Override
protected TypeSerializer<Byte> createSerializer() {
	return new ByteSerializer();
}