Package org.apache.beam.sdk.coders
Coders to specify how data is encoded to and
decoded from byte strings.
During execution of a Pipeline, elements in a PCollection
may need to be encoded into byte strings. This happens both at the beginning and end of a
pipeline when data is read from and written to persistent storage and also during execution of a
pipeline when elements are communicated between machines.
Exactly when PCollection elements are encoded during execution depends on which PipelineRunner is being used and how that runner chooses to execute the
pipeline. As such, Beam requires that all PCollections have an appropriate Coder in case it
becomes necessary. In many cases, the Coder can be inferred from the available Java type
information and the Pipeline's CoderRegistry. It can be
specified per PCollection via PCollection.setCoder(Coder) or
per type using the DefaultCoder annotation.
This package provides a number of coders for common types like Integer,
String, and List, as well as coders like
invalid reference
org.apache.beam.sdk.coders.AvroCoder
-
ClassDescriptionAtomicCoder<T>A
BigDecimalCoderencodes aBigDecimalas an integer scale encoded withVarIntCoderand aBigIntegerencoded usingBigIntegerCoder.ABigEndianIntegerCoderencodesIntegersin 4 bytes, big-endian.ABigEndianLongCoderencodesLongsin 8 bytes, big-endian.ABigEndianShortCoderencodesShortsin 2 bytes, big-endian.ABigIntegerCoderencodes aBigIntegeras a byte array containing the big endian two's-complement representation, encoded viaByteArrayCoder.Coder forBitSet.ACoderforbyte[].The exception thrown when aCoderRegistryorCoderProvidercannot provide aCoderthat has been requested.Indicates the reason thatCoderinference failed.Coder<T>ACoder<T>defines how to encode and decode values of typeTinto byte streams.Deprecated.Exception thrown byCoder.verifyDeterministic()if the encoding is not deterministic, including details of why the encoding is not deterministic.AnExceptionthrown if there is a problem encoding or decoding a value.ACoderProviderprovidesCoders.Codercreators have the ability to automatically have theircodersregistered with this SDK by creating aServiceLoaderentry and a concrete implementation of this interface.Static utility methods for creating and working withCoderProviders.CustomCoder<T>An abstract base class that implements all methods ofCoderexceptCoder.encode(T, java.io.OutputStream)andCoder.decode(java.io.InputStream).TheDefaultCoderannotation specifies aCoderclass to handle encoding and decoding instances of the annotated class.ACoderProviderRegistrarthat registers aCoderProviderwhich can use the@DefaultCoderannotation to providecoder providersthat createsCoders.ACoderProviderthat uses the@DefaultCoderannotation to providecoder providersthat createCoders.DelegateCoder<T,IntermediateT> ADelegateCoder<T, IntermediateT>wraps aCoderforIntermediateTand encodes/decodes values of typeTby converting to/fromIntermediateTand then encoding/decoding using the underlyingCoder<IntermediateT>.DelegateCoder.CodingFunction<InputT,OutputT> ACodingFunction<InputT, OutputT>is a serializable function fromInputTtoOutputTthat may throw anyException.ADoubleCoderencodesDoublevalues in 8 bytes using Java serialization.AFloatCoderencodesFloatvalues in 4 bytes using Java serialization.IterableLikeCoder<T,IterableT extends Iterable<T>> An abstract base class with functionality for assembling aCoderfor a class that implementsIterable.AKvCoderencodesKVs.ACoderwhich is able to take any existing coder and wrap it such that it is only invoked in theouter context.ListCoder<T>MapCoder<K,V> ANullableCoderencodes nullable values of typeTusing a nestedCoder<T>that does not toleratenullvalues.A sub-class of SchemaCoder that can only encodeRowinstances.SerializableCoder<T extends Serializable>ACoderfor Java classes that implementSerializable.ACoderProviderRegistrarwhich registers aCoderProviderwhich can handle serializable types.SetCoder<T>ShardedKeyCoder<KeyT>SnappyCoder<T>Wraps an existing coder with Snappy compression.ACoderthat wraps aCoder<String>and encodes/decodes values via string representations.A wrapper around a byte[] that uses structural, value-based equality rather than byte[]'s normal object identity.An abstract base class to implement aCoderthat defines equality, hashing, and printing via the class name and recursively usingStructuredCoder.getComponents().ACoderthat encodesInteger Integersas the ASCII bytes of their textual, decimal, representation.TimestampPrefixingWindowCoder<T extends BoundedWindow>ATimestampPrefixingWindowCoderwraps arbitrary user custom window coder.ZstdCoder<T>Wraps an existing coder with Zstandard compression.
Coder.Context.