public class SortValues<PrimaryKeyT,SecondaryKeyT,ValueT> extends PTransform<PCollection<KV<PrimaryKeyT,java.lang.Iterable<KV<SecondaryKeyT,ValueT>>>>,PCollection<KV<PrimaryKeyT,java.lang.Iterable<KV<SecondaryKeyT,ValueT>>>>>
SortValues<PrimaryKeyT, SecondaryKeyT, ValueT>
takes a PCollection<KV<PrimaryKeyT,
Iterable<KV<SecondaryKeyT, ValueT>>>>
with elements consisting of a primary key and iterables
over <secondary key, value>
pairs, and returns a PCollection<KV<PrimaryKeyT,
Iterable<KV<SecondaryKeyT, ValueT>>>
of the same elements but with values sorted by a secondary
key.
This transform ignores the primary key, there is no guarantee of any relationship between
elements with different primary keys. The primary key is explicit here only because this
transform is typically used on a result of a GroupByKey
transform.
This transform sorts by lexicographic comparison of the byte representations of the secondary
keys and may write secondary key-value pairs to disk. In order to retrieve the byte
representations it requires the input PCollection to use a KvCoder
for its input, an
IterableCoder
for its input values and a KvCoder
for its secondary key-value
pairs.
annotations, displayData, name, resourceHints
Modifier and Type | Method and Description |
---|---|
static <PrimaryKeyT,SecondaryKeyT,ValueT> |
create(BufferedExternalSorter.Options sorterOptions)
Returns a
SortValues<PrimaryKeyT, SecondaryKeyT, ValueT> PTransform . |
PCollection<KV<PrimaryKeyT,java.lang.Iterable<KV<SecondaryKeyT,ValueT>>>> |
expand(PCollection<KV<PrimaryKeyT,java.lang.Iterable<KV<SecondaryKeyT,ValueT>>>> input)
Override this method to specify how this
PTransform should be expanded on the given
InputT . |
addAnnotation, compose, compose, getAdditionalInputs, getAnnotations, getDefaultOutputCoder, getDefaultOutputCoder, getDefaultOutputCoder, getKindString, getName, getResourceHints, populateDisplayData, setDisplayData, setResourceHints, toString, validate, validate
public static <PrimaryKeyT,SecondaryKeyT,ValueT> SortValues<PrimaryKeyT,SecondaryKeyT,ValueT> create(BufferedExternalSorter.Options sorterOptions)
SortValues<PrimaryKeyT, SecondaryKeyT, ValueT>
PTransform
.PrimaryKeyT
- the type of the primary keys of the input and output PCollection
sSecondaryKeyT
- the type of the secondary (sort) keys of the input and output PCollection
sValueT
- the type of the values of the input and output PCollection
spublic PCollection<KV<PrimaryKeyT,java.lang.Iterable<KV<SecondaryKeyT,ValueT>>>> expand(PCollection<KV<PrimaryKeyT,java.lang.Iterable<KV<SecondaryKeyT,ValueT>>>> input)
PTransform
PTransform
should be expanded on the given
InputT
.
NOTE: This method should not be called directly. Instead apply the PTransform
should
be applied to the InputT
using the apply
method.
Composite transforms, which are defined in terms of other transforms, should return the output of one of the composed transforms. Non-composite transforms, which do not apply any transforms internally, should return a new unbound output and register evaluators (via backend-specific registration methods).
expand
in class PTransform<PCollection<KV<PrimaryKeyT,java.lang.Iterable<KV<SecondaryKeyT,ValueT>>>>,PCollection<KV<PrimaryKeyT,java.lang.Iterable<KV<SecondaryKeyT,ValueT>>>>>