use of org.apache.beam.runners.core.construction.ModelCoders.KvCoderComponents in project beam by apache.
the class ModelCodersTest method kvCoderComponentsToConstructor.
@Test
public void kvCoderComponentsToConstructor() throws IOException {
KvCoder<byte[], Iterable<Long>> javaCoder = KvCoder.of(ByteArrayCoder.of(), IterableCoder.of(LengthPrefixCoder.of(VarLongCoder.of())));
MessageWithComponents coderAndComponents = CoderTranslation.toProto(javaCoder);
KvCoderComponents kvCoderComponents = ModelCoders.getKvCoderComponents(coderAndComponents.getCoder());
Coder kvCoder = ModelCoders.kvCoder(kvCoderComponents.keyCoderId(), kvCoderComponents.valueCoderId());
assertThat(kvCoder, equalTo(coderAndComponents.getCoder()));
}
Aggregations