Package org.apache.wayang.spark.compiler
Class FunctionCompiler
- java.lang.Object
-
- org.apache.wayang.spark.compiler.FunctionCompiler
-
public class FunctionCompiler extends java.lang.Object
A compiler translates Wayang functions into executable Java functions.
-
-
Nested Class Summary
Nested Classes Modifier and Type Class Description static class
FunctionCompiler.KeyExtractor<T,K>
Spark function for building pair RDDs.static class
FunctionCompiler.Reducer<Type>
Spark function for aggregating data quanta.static interface
FunctionCompiler.WayangSparkFunction
Describes functions coming from Wayang, designated for Spark.
-
Constructor Summary
Constructors Constructor Description FunctionCompiler()
-
Method Summary
All Methods Instance Methods Concrete Methods Modifier and Type Method Description <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<java.util.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,java.lang.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.
-
-
-
Method Detail
-
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<java.util.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,T> compile(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,java.lang.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
-
-