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

The following examples show how to use org.apache.flink.api.common.typeutils.base.ByteSerializer. These examples are extracted from open source projects. 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 Project: Flink-CEPplus   Source File: ByteComparatorTest.java    License: Apache License 2.0 4 votes vote down vote up
@Override
protected TypeSerializer<Byte> createSerializer() {
	return new ByteSerializer();
}
 
Example 2
Source Project: Flink-CEPplus   Source File: ByteSerializerTest.java    License: Apache License 2.0 4 votes vote down vote up
@Override
protected TypeSerializer<Byte> createSerializer() {
	return new ByteSerializer();
}
 
Example 3
Source Project: flink   Source File: InternalSerializers.java    License: 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 Project: flink   Source File: FirstValueWithRetractAggFunction.java    License: Apache License 2.0 4 votes vote down vote up
@Override
protected TypeSerializer<Byte> createValueSerializer() {
	return ByteSerializer.INSTANCE;
}
 
Example 5
Source Project: flink   Source File: LastValueWithRetractAggFunction.java    License: Apache License 2.0 4 votes vote down vote up
@Override
protected TypeSerializer<Byte> createValueSerializer() {
	return ByteSerializer.INSTANCE;
}
 
Example 6
Source Project: flink   Source File: ByteComparatorTest.java    License: Apache License 2.0 4 votes vote down vote up
@Override
protected TypeSerializer<Byte> createSerializer() {
	return new ByteSerializer();
}
 
Example 7
Source Project: flink   Source File: ByteSerializerTest.java    License: Apache License 2.0 4 votes vote down vote up
@Override
protected TypeSerializer<Byte> createSerializer() {
	return new ByteSerializer();
}
 
Example 8
Source Project: flink   Source File: InternalSerializers.java    License: 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 Project: flink   Source File: FirstValueWithRetractAggFunction.java    License: Apache License 2.0 4 votes vote down vote up
@Override
protected TypeSerializer<Byte> createValueSerializer() {
	return ByteSerializer.INSTANCE;
}
 
Example 10
Source Project: flink   Source File: LastValueWithRetractAggFunction.java    License: Apache License 2.0 4 votes vote down vote up
@Override
protected TypeSerializer<Byte> createValueSerializer() {
	return ByteSerializer.INSTANCE;
}
 
Example 11
Source Project: flink   Source File: PythonTypeUtils.java    License: Apache License 2.0 4 votes vote down vote up
@Override
public TypeSerializer visit(TinyIntType tinyIntType) {
	return ByteSerializer.INSTANCE;
}
 
Example 12
Source Project: flink   Source File: ByteComparatorTest.java    License: Apache License 2.0 4 votes vote down vote up
@Override
protected TypeSerializer<Byte> createSerializer() {
	return new ByteSerializer();
}
 
Example 13
Source Project: flink   Source File: ByteSerializerTest.java    License: Apache License 2.0 4 votes vote down vote up
@Override
protected TypeSerializer<Byte> createSerializer() {
	return new ByteSerializer();
}