Package org.apache.beam.sdk.coders
Class SetCoder<T>
java.lang.Object
org.apache.beam.sdk.coders.Coder<Set<T>>
org.apache.beam.sdk.coders.StructuredCoder<Set<T>>
org.apache.beam.sdk.coders.IterableLikeCoder<T,Set<T>>
org.apache.beam.sdk.coders.SetCoder<T>
- Type Parameters:
T- the type of the elements of the set
- All Implemented Interfaces:
Serializable
A
SetCoder encodes any Set using the format of IterableLikeCoder. The
elements may not be in a deterministic order, depending on the Set implementation.- See Also:
-
Nested Class Summary
Nested classes/interfaces inherited from class org.apache.beam.sdk.coders.Coder
Coder.Context, Coder.NonDeterministicException -
Constructor Summary
Constructors -
Method Summary
Modifier and TypeMethodDescriptiondecodeToIterable(List<T> decodedElements) Builds an instance ofIterableT, this coder's associatedIterable-like subtype, from a list of decoded elements.Returns theTypeDescriptorfor the type encoded.static <T> SetCoder<T> Produces aSetCoderwith the givenelementCoder.voidThrowCoder.NonDeterministicExceptionif the coding is not deterministic.Methods inherited from class org.apache.beam.sdk.coders.IterableLikeCoder
decode, decodeToIterable, encode, getCoderArguments, getElemCoder, isRegisterByteSizeObserverCheap, registerByteSizeObserverMethods inherited from class org.apache.beam.sdk.coders.StructuredCoder
equals, getComponents, hashCode, toStringMethods inherited from class org.apache.beam.sdk.coders.Coder
consistentWithEquals, decode, encode, getEncodedElementByteSize, getEncodedElementByteSizeUsingCoder, structuralValue, verifyDeterministic, verifyDeterministic
-
Constructor Details
-
SetCoder
-
-
Method Details
-
of
Produces aSetCoderwith the givenelementCoder. -
verifyDeterministic
ThrowCoder.NonDeterministicExceptionif the coding is not deterministic.In order for a
Coderto be considered deterministic, the following must be true:- two values that compare as equal (via
Object.equals()orComparable.compareTo(), if supported) have the same encoding. - the
Coderalways produces a canonical encoding, which is the same for an instance of an object even if produced on different computers at different times.
- Overrides:
verifyDeterministicin classIterableLikeCoder<T,Set<T>> - Throws:
Coder.NonDeterministicException- always. Sets are not ordered, but they are encoded in the order of an arbitrary iteration.
- two values that compare as equal (via
-
getEncodedTypeDescriptor
Description copied from class:CoderReturns theTypeDescriptorfor the type encoded.- Overrides:
getEncodedTypeDescriptorin classCoder<Set<T>>
-
decodeToIterable
Builds an instance ofIterableT, this coder's associatedIterable-like subtype, from a list of decoded elements.Override
IterableLikeCoder.decodeToIterable(List, long, InputStream)if you need access to the terminator value and theInputStream.- Specified by:
decodeToIterablein classIterableLikeCoder<T,Set<T>> - Returns:
- A new
Setbuilt from the elements in theListdecoded byIterableLikeCoder.
-