Class LengthPrefixUnknownCoders
java.lang.Object
org.apache.beam.runners.fnexecution.wire.LengthPrefixUnknownCoders
Utilities for replacing or wrapping unknown coders with
LengthPrefixCoder
.-
Constructor Summary
Constructors -
Method Summary
Modifier and TypeMethodDescriptionstatic void
addKnownCoderUrn
(String urn) Registers a coder as being of known type and as such not meriting length prefixing.static String
addLengthPrefixedCoder
(String coderId, org.apache.beam.model.pipeline.v1.RunnerApi.Components.Builder components, boolean replaceWithByteArrayCoder) Recursively traverses the coder tree and wraps the first unknown coder in every branch with aLengthPrefixCoder
unless an ancestor coder is itself aLengthPrefixCoder
.
-
Constructor Details
-
LengthPrefixUnknownCoders
public LengthPrefixUnknownCoders()
-
-
Method Details
-
addKnownCoderUrn
Registers a coder as being of known type and as such not meriting length prefixing.- Parameters:
urn
- The urn of the coder that should not be length prefixed.
-
addLengthPrefixedCoder
public static String addLengthPrefixedCoder(String coderId, org.apache.beam.model.pipeline.v1.RunnerApi.Components.Builder components, boolean replaceWithByteArrayCoder) Recursively traverses the coder tree and wraps the first unknown coder in every branch with aLengthPrefixCoder
unless an ancestor coder is itself aLengthPrefixCoder
. IfreplaceWithByteArrayCoder
is set, then replaces that unknown coder with aByteArrayCoder
. Registers the new coders in the givenRunnerApi.Components.Builder
. Note that no ids that are generated will collide with the ids supplied within thecoder map
key space.- Parameters:
coderId
- The root coder contained withincoders
to start the recursive descent from.components
- Components builder that initially contains the root coder and all component coders, and will be modified to contain all the necessary additional coders (including the resulting coder).replaceWithByteArrayCoder
- whether to replace an unknown coder with aByteArrayCoder
.- Returns:
- Id of the original coder (if unchanged) or the newly generated length-prefixed coder.
-