Package org.apache.wayang.spark.compiler
Class FunctionCompiler
java.lang.Object
org.apache.wayang.spark.compiler.FunctionCompiler
A compiler translates Wayang functions into executable Java functions.
-
Nested Class Summary
Nested ClassesModifier and TypeClassDescriptionstatic class
Spark function for building pair RDDs.static class
Spark function for aggregating data quanta.static interface
Describes functions coming from Wayang, designated for Spark. -
Constructor Summary
Constructors -
Method Summary
Modifier and TypeMethodDescription<I,
O> org.apache.spark.api.java.function.FlatMapFunction<I, O> compile
(FlatMapDescriptor<I, O> descriptor, SparkExecutionOperator operator, OptimizationContext.OperatorContext operatorContext, ChannelInstance[] inputs) Create an appropriateFlatMapFunction
for deploying the givenFlatMapDescriptor
on Apache Spark.<I,
O> org.apache.spark.api.java.function.FlatMapFunction<Iterator<I>, O> compile
(MapPartitionsDescriptor<I, O> descriptor, SparkExecutionOperator operator, OptimizationContext.OperatorContext operatorContext, ChannelInstance[] inputs) Create an appropriateFunction
for deploying the givenMapPartitionsDescriptor
on Apache Spark'sAbstractJavaRDDLike.mapPartitions(FlatMapFunction)
.<Type> org.apache.spark.api.java.function.Function<Type,
Boolean> compile
(PredicateDescriptor<Type> predicateDescriptor, SparkExecutionOperator operator, OptimizationContext.OperatorContext operatorContext, ChannelInstance[] inputs) Create an appropriateFunction
-based predicate for deploying the givenPredicateDescriptor
on Apache Spark.<T> org.apache.spark.api.java.function.Function2<T,
T, T> compile
(ReduceDescriptor<T> descriptor, SparkExecutionOperator operator, OptimizationContext.OperatorContext operatorContext, ChannelInstance[] inputs) Create an appropriateFunction
for deploying the givenReduceDescriptor
on Apache Spark.<I,
O> org.apache.spark.api.java.function.Function<I, O> compile
(TransformationDescriptor<I, O> descriptor, SparkExecutionOperator operator, OptimizationContext.OperatorContext operatorContext, ChannelInstance[] inputs) Create an appropriateFunction
for deploying the givenTransformationDescriptor
on Apache Spark.<T,
K> FunctionCompiler.KeyExtractor<T, K> compileToKeyExtractor
(TransformationDescriptor<T, K> descriptor) Compile a key extraction.
-
Constructor Details
-
FunctionCompiler
public FunctionCompiler()
-
-
Method Details
-
compile
public <I,O> org.apache.spark.api.java.function.Function<I,O> compile(TransformationDescriptor<I, O> descriptor, SparkExecutionOperator operator, OptimizationContext.OperatorContext operatorContext, ChannelInstance[] inputs) Create an appropriateFunction
for deploying the givenTransformationDescriptor
on Apache Spark.- Parameters:
descriptor
- describes the transformation functionoperator
- that executes theFunction
; only required if thedescriptor
describes anExtendedFunction
operatorContext
- contains optimization information for theoperator
inputs
- that feed theoperator
; only required if thedescriptor
describes anExtendedFunction
-
compile
public <I,O> org.apache.spark.api.java.function.FlatMapFunction<Iterator<I>,O> compile(MapPartitionsDescriptor<I, O> descriptor, SparkExecutionOperator operator, OptimizationContext.OperatorContext operatorContext, ChannelInstance[] inputs) Create an appropriateFunction
for deploying the givenMapPartitionsDescriptor
on Apache Spark'sAbstractJavaRDDLike.mapPartitions(FlatMapFunction)
.- Parameters:
descriptor
- describes the functionoperator
- that executes theFunction
; only required if thedescriptor
describes anExtendedFunction
operatorContext
- contains optimization information for theoperator
inputs
- that feed theoperator
; only required if thedescriptor
describes anExtendedFunction
-
compileToKeyExtractor
public <T,K> FunctionCompiler.KeyExtractor<T,K> compileToKeyExtractor(TransformationDescriptor<T, K> descriptor) Compile a key extraction.- Returns:
- a compiled function
-
compile
public <I,O> org.apache.spark.api.java.function.FlatMapFunction<I,O> compile(FlatMapDescriptor<I, O> descriptor, SparkExecutionOperator operator, OptimizationContext.OperatorContext operatorContext, ChannelInstance[] inputs) Create an appropriateFlatMapFunction
for deploying the givenFlatMapDescriptor
on Apache Spark.- Parameters:
descriptor
- describes the functionoperator
- that executes theFunction
; only required if thedescriptor
describes anExtendedFunction
operatorContext
- contains optimization information for theoperator
inputs
- that feed theoperator
; only required if thedescriptor
describes anExtendedFunction
-
compile
public <T> org.apache.spark.api.java.function.Function2<T,T, compileT> (ReduceDescriptor<T> descriptor, SparkExecutionOperator operator, OptimizationContext.OperatorContext operatorContext, ChannelInstance[] inputs) Create an appropriateFunction
for deploying the givenReduceDescriptor
on Apache Spark. -
compile
public <Type> org.apache.spark.api.java.function.Function<Type,Boolean> compile(PredicateDescriptor<Type> predicateDescriptor, SparkExecutionOperator operator, OptimizationContext.OperatorContext operatorContext, ChannelInstance[] inputs) Create an appropriateFunction
-based predicate for deploying the givenPredicateDescriptor
on Apache Spark.- Parameters:
predicateDescriptor
- describes the functionoperator
- that executes theFunction
; only required if thedescriptor
describes anExtendedFunction
operatorContext
- contains optimization information for theoperator
inputs
- that feed theoperator
; only required if thedescriptor
describes anExtendedFunction
-