IN1 - The data type of the first input data set.IN2 - The data type of the second input data set.OUT - The data type of the returned data set.public abstract class TwoInputUdfOperator<IN1,IN2,OUT,O extends TwoInputUdfOperator<IN1,IN2,OUT,O>> extends TwoInputOperator<IN1,IN2,OUT,O> implements UdfOperator<O>
RichJoinFunction or
RichCoGroupFunction).
This class encapsulates utilities for the UDFs, such as broadcast variables, parameterization through configuration objects, and semantic properties.
| Modifier | Constructor and Description |
|---|---|
protected |
TwoInputUdfOperator(DataSet<IN1> input1,
DataSet<IN2> input2,
TypeInformation<OUT> resultType)
Creates a new operators with the two given data sets as inputs.
|
| Modifier and Type | Method and Description |
|---|---|
protected void |
extractSemanticAnnotationsFromUdf(Class<?> udfClass) |
Map<String,DataSet<?>> |
getBroadcastSets()
Gets the broadcast sets (name and data set) that have been added to context of the UDF.
|
Configuration |
getParameters()
Gets the configuration parameters that will be passed to the UDF's open method
AbstractRichFunction.open(Configuration). |
DualInputSemanticProperties |
getSemanticProperties()
Gets the semantic properties that have been set for the user-defined functions (UDF).
|
void |
setSemanticProperties(DualInputSemanticProperties properties)
Sets the semantic properties for the user-defined function (UDF).
|
O |
withBroadcastSet(DataSet<?> data,
String name)
Adds a certain data set as a broadcast set to this operator.
|
O |
withConstantSetFirst(String... constantSetFirst)
Adds a constant-set annotation for the first input of the UDF.
|
O |
withConstantSetSecond(String... constantSetSecond)
Adds a constant-set annotation for the second input of the UDF.
|
O |
withParameters(Configuration parameters)
Sets the configuration parameters for the UDF.
|
getInput1, getInput1Type, getInput2, getInput2Type, translateToDataFlowgetName, getParallelism, getResultType, name, setParallelismaggregate, checkSameExecutionContext, clean, coGroup, cross, crossWithHuge, crossWithTiny, distinct, distinct, distinct, distinct, filter, first, flatMap, getExecutionEnvironment, getType, groupBy, groupBy, groupBy, iterate, iterateDelta, join, join, joinWithHuge, joinWithTiny, map, mapPartition, max, maxBy, min, minBy, output, partitionByHash, partitionByHash, partitionByHash, partitionCustom, partitionCustom, partitionCustom, print, printToErr, project, rebalance, reduce, reduceGroup, runOperation, sum, union, write, write, writeAsCsv, writeAsCsv, writeAsCsv, writeAsCsv, writeAsFormattedText, writeAsFormattedText, writeAsText, writeAsTextprotected TwoInputUdfOperator(DataSet<IN1> input1, DataSet<IN2> input2, TypeInformation<OUT> resultType)
input1 - The data set for the first input.input2 - The data set for the second input.resultType - The type of the elements in the resulting data set.protected void extractSemanticAnnotationsFromUdf(Class<?> udfClass)
public O withParameters(Configuration parameters)
UdfOperatorAbstractRichFunction.open(Configuration) method.withParameters in interface UdfOperator<O extends TwoInputUdfOperator<IN1,IN2,OUT,O>>parameters - The configuration parameters for the UDF.public O withBroadcastSet(DataSet<?> data, String name)
UdfOperatorRuntimeContext.getBroadcastVariable(String).
The runtime context itself is available in all UDFs via
AbstractRichFunction.getRuntimeContext().withBroadcastSet in interface UdfOperator<O extends TwoInputUdfOperator<IN1,IN2,OUT,O>>data - The data set to be broadcasted.name - The name under which the broadcast data set retrieved.public O withConstantSetFirst(String... constantSetFirst)
Constant set annotations are used by the optimizer to infer the existence of data properties (sorted, partitioned, grouped).
In certain cases, these annotations allow the optimizer to generate a more efficient execution plan which can lead to improved performance.
Constant set annotations can only be specified if the first input and the output type of the UDF are of
Tuple data types.
A constant-set annotation is a set of constant field specifications. The constant field specification String "4->3" specifies, that this UDF copies the fourth field of an input tuple to the third field of the output tuple. Field references are zero-indexed.
NOTICE: Constant set annotations are optional, but if given need to be correct. Otherwise, the program might produce wrong results!
constantSetFirst - A list of constant field specification Strings for the first input.public O withConstantSetSecond(String... constantSetSecond)
Constant set annotations are used by the optimizer to infer the existence of data properties (sorted, partitioned, grouped).
In certain cases, these annotations allow the optimizer to generate a more efficient execution plan which can lead to improved performance.
Constant set annotations can only be specified if the second input and the output type of the UDF are of
Tuple data types.
A constant-set annotation is a set of constant field specifications. The constant field specification String "4->3" specifies, that this UDF copies the fourth field of an input tuple to the third field of the output tuple. Field references are zero-indexed.
NOTICE: Constant set annotations are optional, but if given need to be correct. Otherwise, the program might produce wrong results!
constantSetSecond - A list of constant field specification Strings for the second input.public Map<String,DataSet<?>> getBroadcastSets()
UdfOperatorUdfOperator.withBroadcastSet(DataSet, String).getBroadcastSets in interface UdfOperator<O extends TwoInputUdfOperator<IN1,IN2,OUT,O>>public Configuration getParameters()
UdfOperatorAbstractRichFunction.open(Configuration).
The configuration is set via the UdfOperator.withParameters(Configuration)
method.getParameters in interface UdfOperator<O extends TwoInputUdfOperator<IN1,IN2,OUT,O>>public DualInputSemanticProperties getSemanticProperties()
UdfOperatorgetSemanticProperties in interface UdfOperator<O extends TwoInputUdfOperator<IN1,IN2,OUT,O>>public void setSemanticProperties(DualInputSemanticProperties properties)
UdfOperator.getSemanticProperties().properties - The semantic properties for the UDF.UdfOperator.getSemanticProperties()Copyright © 2015 The Apache Software Foundation. All rights reserved.