public final class TranslationUtils extends Object
| Modifier and Type | Class and Description |
|---|---|
static class |
TranslationUtils.CombineGroupedValues<K,InputT,OutputT>
A SparkKeyedCombineFn function applied to grouped KVs.
|
static class |
TranslationUtils.TupleTagFilter<V>
A utility class to filter
TupleTags. |
| Modifier and Type | Method and Description |
|---|---|
static <T1,T2> org.apache.spark.streaming.api.java.JavaDStream<T2> |
dStreamValues(org.apache.spark.streaming.api.java.JavaPairDStream<T1,T2> pairDStream)
Transform a pair stream into a value stream.
|
static <T> org.apache.spark.api.java.function.VoidFunction<T> |
emptyVoidFunction() |
static <InputT,OutputT> |
functionToFlatMapFunction(org.apache.spark.api.java.function.Function<InputT,OutputT> func)
|
static Map<TupleTag<?>,KV<WindowingStrategy<?,?>,SideInputBroadcast<?>>> |
getSideInputs(List<PCollectionView<?>> views,
org.apache.spark.api.java.JavaSparkContext context,
SparkPCollectionView pviews)
Create SideInputs as Broadcast variables.
|
static <T,K,V> org.apache.spark.api.java.function.PairFlatMapFunction<Iterator<T>,K,V> |
pairFunctionToPairFlatMapFunction(org.apache.spark.api.java.function.PairFunction<T,K,V> pairFunction)
|
static void |
rejectSplittable(DoFn<?,?> doFn) |
static void |
rejectStateAndTimers(DoFn<?,?> doFn)
Reject state and timers
DoFn. |
static <T,W extends BoundedWindow> |
skipAssignWindows(Window.Assign<T> transform,
EvaluationContext context)
Checks if the window transformation should be applied or skipped.
|
static <K,V> org.apache.spark.api.java.function.PairFunction<WindowedValue<KV<K,V>>,K,WindowedValue<KV<K,V>>> |
toPairByKeyInWindowedValue()
Extract key from a
WindowedValue KV into a pair. |
static <K,V> org.apache.spark.api.java.function.PairFlatMapFunction<Iterator<KV<K,V>>,K,V> |
toPairFlatMapFunction()
KV to pair flatmap function. |
static <K,V> org.apache.spark.api.java.function.PairFunction<KV<K,V>,K,V> |
toPairFunction()
KV to pair function. |
public static <T,W extends BoundedWindow> boolean skipAssignWindows(Window.Assign<T> transform, EvaluationContext context)
Avoid running assign windows if both source and destination are global window or if the user has not specified the WindowFn (meaning they are just messing with triggering or allowed lateness).
T - PCollection type.W - BoundedWindow type.transform - The Window.Assign transformation.context - The EvaluationContext.public static <T1,T2> org.apache.spark.streaming.api.java.JavaDStream<T2> dStreamValues(org.apache.spark.streaming.api.java.JavaPairDStream<T1,T2> pairDStream)
public static <K,V> org.apache.spark.api.java.function.PairFunction<KV<K,V>,K,V> toPairFunction()
KV to pair function.public static <K,V> org.apache.spark.api.java.function.PairFlatMapFunction<Iterator<KV<K,V>>,K,V> toPairFlatMapFunction()
KV to pair flatmap function.public static <K,V> org.apache.spark.api.java.function.PairFunction<WindowedValue<KV<K,V>>,K,WindowedValue<KV<K,V>>> toPairByKeyInWindowedValue()
WindowedValue KV into a pair.public static Map<TupleTag<?>,KV<WindowingStrategy<?,?>,SideInputBroadcast<?>>> getSideInputs(List<PCollectionView<?>> views, org.apache.spark.api.java.JavaSparkContext context, SparkPCollectionView pviews)
views - The PCollectionViews.context - The JavaSparkContext.pviews - The SparkPCollectionView.SideInputBroadcasts and their WindowingStrategy.public static void rejectSplittable(DoFn<?,?> doFn)
public static void rejectStateAndTimers(DoFn<?,?> doFn)
DoFn.doFn - the DoFn to possibly reject.public static <T> org.apache.spark.api.java.function.VoidFunction<T> emptyVoidFunction()
public static <T,K,V> org.apache.spark.api.java.function.PairFlatMapFunction<Iterator<T>,K,V> pairFunctionToPairFlatMapFunction(org.apache.spark.api.java.function.PairFunction<T,K,V> pairFunction)
PairFunction to a PairFlatMapFunction with an
Iterator input. This is particularly useful because it allows to use functions written
for mapToPair functions in flatmapToPair functions.T - the input type.K - the output key type.V - the output value type.pairFunction - the PairFunction to adapt.PairFlatMapFunction that accepts an Iterator as an input and applies
the PairFunction on every element.public static <InputT,OutputT> org.apache.spark.api.java.function.FlatMapFunction<Iterator<InputT>,OutputT> functionToFlatMapFunction(org.apache.spark.api.java.function.Function<InputT,OutputT> func)
Function to a FlatMapFunction with an Iterator input. This is particularly useful because it allows to use functions written for map
functions in flatmap functions.InputT - the input type.OutputT - the output type.func - the Function to adapt.FlatMapFunction that accepts an Iterator as an input and applies the
Function on every element.Copyright © 2016–2017 The Apache Software Foundation. All rights reserved.