Search in sources :

Example 1 with VarLongCoder

use of org.apache.beam.sdk.coders.VarLongCoder in project beam by apache.

the class KafkaIOTest method testInferKeyCoder.

@Test
public void testInferKeyCoder() {
    CoderRegistry registry = CoderRegistry.createDefault();
    assertTrue(KafkaIO.inferCoder(registry, LongDeserializer.class).getValueCoder() instanceof VarLongCoder);
    assertTrue(KafkaIO.inferCoder(registry, StringDeserializer.class).getValueCoder() instanceof StringUtf8Coder);
    assertTrue(KafkaIO.inferCoder(registry, InstantDeserializer.class).getValueCoder() instanceof InstantCoder);
    assertTrue(KafkaIO.inferCoder(registry, DeserializerWithInterfaces.class).getValueCoder() instanceof VarLongCoder);
}
Also used : CoderRegistry(org.apache.beam.sdk.coders.CoderRegistry) VarLongCoder(org.apache.beam.sdk.coders.VarLongCoder) LongDeserializer(org.apache.kafka.common.serialization.LongDeserializer) InstantDeserializer(org.apache.beam.sdk.io.kafka.serialization.InstantDeserializer) StringDeserializer(org.apache.kafka.common.serialization.StringDeserializer) InstantCoder(org.apache.beam.sdk.coders.InstantCoder) StringUtf8Coder(org.apache.beam.sdk.coders.StringUtf8Coder) Test(org.junit.Test)

Example 2 with VarLongCoder

use of org.apache.beam.sdk.coders.VarLongCoder in project beam by apache.

the class LocalDeserializerProviderTest method testInferKeyCoder.

@Test
public void testInferKeyCoder() {
    CoderRegistry registry = CoderRegistry.createDefault();
    assertTrue(LocalDeserializerProvider.of(LongDeserializer.class).getCoder(registry).getValueCoder() instanceof VarLongCoder);
    assertTrue(LocalDeserializerProvider.of(StringDeserializer.class).getCoder(registry).getValueCoder() instanceof StringUtf8Coder);
    assertTrue(LocalDeserializerProvider.of(InstantDeserializer.class).getCoder(registry).getValueCoder() instanceof InstantCoder);
    assertTrue(LocalDeserializerProvider.of(DeserializerWithInterfaces.class).getCoder(registry).getValueCoder() instanceof VarLongCoder);
}
Also used : CoderRegistry(org.apache.beam.sdk.coders.CoderRegistry) VarLongCoder(org.apache.beam.sdk.coders.VarLongCoder) InstantCoder(org.apache.beam.sdk.coders.InstantCoder) StringUtf8Coder(org.apache.beam.sdk.coders.StringUtf8Coder) Test(org.junit.Test)

Aggregations

CoderRegistry (org.apache.beam.sdk.coders.CoderRegistry)2 InstantCoder (org.apache.beam.sdk.coders.InstantCoder)2 StringUtf8Coder (org.apache.beam.sdk.coders.StringUtf8Coder)2 VarLongCoder (org.apache.beam.sdk.coders.VarLongCoder)2 Test (org.junit.Test)2 InstantDeserializer (org.apache.beam.sdk.io.kafka.serialization.InstantDeserializer)1 LongDeserializer (org.apache.kafka.common.serialization.LongDeserializer)1 StringDeserializer (org.apache.kafka.common.serialization.StringDeserializer)1