Search in sources :

Example 1 with DoubleValueSerializer

use of org.apache.flink.api.common.typeutils.base.DoubleValueSerializer in project flink by apache.

the class InstantiationUtilTest method testSerializationToByteArray.

@Test
public void testSerializationToByteArray() throws IOException {
    final DoubleValue toSerialize = new DoubleValue(Math.random());
    final DoubleValueSerializer serializer = new DoubleValueSerializer();
    byte[] serialized = InstantiationUtil.serializeToByteArray(serializer, toSerialize);
    DoubleValue deserialized = InstantiationUtil.deserializeFromByteArray(serializer, serialized);
    assertEquals("Serialized record is not equal after serialization.", toSerialize, deserialized);
}
Also used : DoubleValue(org.apache.flink.types.DoubleValue) DoubleValueSerializer(org.apache.flink.api.common.typeutils.base.DoubleValueSerializer) Test(org.junit.Test)

Aggregations

DoubleValueSerializer (org.apache.flink.api.common.typeutils.base.DoubleValueSerializer)1 DoubleValue (org.apache.flink.types.DoubleValue)1 Test (org.junit.Test)1