IN1
- Type of the first input data steam.IN2
- Type of the second input data stream.public class ConnectedStreams<IN1,IN2> extends Object
ConnectedStreams
represents two connected streams of (possible) different data types. It
can be used to apply transformations such as CoMapFunction
on two
DataStreams
Modifier and Type | Field and Description |
---|---|
protected StreamExecutionEnvironment |
environment |
protected DataStream<IN1> |
inputStream1 |
protected DataStream<IN2> |
inputStream2 |
Modifier | Constructor and Description |
---|---|
protected |
ConnectedStreams(StreamExecutionEnvironment env,
DataStream<IN1> input1,
DataStream<IN2> input2) |
Modifier and Type | Method and Description |
---|---|
<OUT> SingleOutputStreamOperator<OUT,?> |
flatMap(CoFlatMapFunction<IN1,IN2,OUT> coFlatMapper)
Applies a CoFlatMap transformation on a
ConnectedStreams and
maps the output to a common type. |
StreamExecutionEnvironment |
getExecutionEnvironment() |
DataStream<IN1> |
getFirstInput()
Returns the first
DataStream . |
DataStream<IN2> |
getSecondInput()
Returns the second
DataStream . |
org.apache.flink.api.common.typeinfo.TypeInformation<IN1> |
getType1()
Gets the type of the first input
|
org.apache.flink.api.common.typeinfo.TypeInformation<IN2> |
getType2()
Gets the type of the second input
|
ConnectedStreams<IN1,IN2> |
keyBy(int[] keyPositions1,
int[] keyPositions2)
KeyBy operation for connected data stream.
|
ConnectedStreams<IN1,IN2> |
keyBy(int keyPosition1,
int keyPosition2)
KeyBy operation for connected data stream.
|
ConnectedStreams<IN1,IN2> |
keyBy(org.apache.flink.api.java.functions.KeySelector<IN1,?> keySelector1,
org.apache.flink.api.java.functions.KeySelector<IN2,?> keySelector2)
KeyBy operation for connected data stream.
|
ConnectedStreams<IN1,IN2> |
keyBy(String[] fields1,
String[] fields2)
KeyBy operation for connected data stream using key expressions.
|
ConnectedStreams<IN1,IN2> |
keyBy(String field1,
String field2)
KeyBy operation for connected data stream using key expressions.
|
<OUT> SingleOutputStreamOperator<OUT,?> |
map(CoMapFunction<IN1,IN2,OUT> coMapper)
Applies a CoMap transformation on a
ConnectedStreams and maps
the output to a common type. |
ConnectedStreams<IN1,IN2> |
partitionByHash(int[] keyPositions1,
int[] keyPositions2)
PartitionBy operation for connected data stream.
|
ConnectedStreams<IN1,IN2> |
partitionByHash(int keyPosition1,
int keyPosition2)
PartitionBy operation for connected data stream.
|
ConnectedStreams<IN1,IN2> |
partitionByHash(org.apache.flink.api.java.functions.KeySelector<IN1,?> keySelector1,
org.apache.flink.api.java.functions.KeySelector<IN2,?> keySelector2)
PartitionBy operation for connected data stream.
|
ConnectedStreams<IN1,IN2> |
partitionByHash(String[] fields1,
String[] fields2)
PartitionBy operation for connected data stream using key expressions.
|
ConnectedStreams<IN1,IN2> |
partitionByHash(String field1,
String field2)
PartitionBy operation for connected data stream using key expressions.
|
<OUT> SingleOutputStreamOperator<OUT,?> |
transform(String functionName,
org.apache.flink.api.common.typeinfo.TypeInformation<OUT> outTypeInfo,
TwoInputStreamOperator<IN1,IN2,OUT> operator) |
protected StreamExecutionEnvironment environment
protected DataStream<IN1> inputStream1
protected DataStream<IN2> inputStream2
protected ConnectedStreams(StreamExecutionEnvironment env, DataStream<IN1> input1, DataStream<IN2> input2)
public StreamExecutionEnvironment getExecutionEnvironment()
public DataStream<IN1> getFirstInput()
DataStream
.public DataStream<IN2> getSecondInput()
DataStream
.public org.apache.flink.api.common.typeinfo.TypeInformation<IN1> getType1()
public org.apache.flink.api.common.typeinfo.TypeInformation<IN2> getType2()
public ConnectedStreams<IN1,IN2> keyBy(int keyPosition1, int keyPosition2)
keyPosition1
- The field used to compute the hashcode of the elements in the
first input stream.keyPosition2
- The field used to compute the hashcode of the elements in the
second input stream.ConnectedStreams
public ConnectedStreams<IN1,IN2> keyBy(int[] keyPositions1, int[] keyPositions2)
keyPositions1
- The fields used to group the first input stream.keyPositions2
- The fields used to group the second input stream.ConnectedStreams
public ConnectedStreams<IN1,IN2> keyBy(String field1, String field2)
DataStream
S underlying type. A dot can be used
to drill down into objects, as in "field1.getInnerField2()"
.field1
- The grouping expression for the first inputfield2
- The grouping expression for the second inputConnectedStreams
public ConnectedStreams<IN1,IN2> keyBy(String[] fields1, String[] fields2)
DataStream
S underlying type. A dot can be
used to drill down into objects, as in "field1.getInnerField2()"
.fields1
- The grouping expressions for the first inputfields2
- The grouping expressions for the second inputConnectedStreams
public ConnectedStreams<IN1,IN2> keyBy(org.apache.flink.api.java.functions.KeySelector<IN1,?> keySelector1, org.apache.flink.api.java.functions.KeySelector<IN2,?> keySelector2)
keySelector1
- The KeySelector
used for grouping the first inputkeySelector2
- The KeySelector
used for grouping the second inputConnectedStreams
public ConnectedStreams<IN1,IN2> partitionByHash(int keyPosition1, int keyPosition2)
keyPosition1
- The field used to compute the hashcode of the elements in the
first input stream.keyPosition2
- The field used to compute the hashcode of the elements in the
second input stream.ConnectedStreams
public ConnectedStreams<IN1,IN2> partitionByHash(int[] keyPositions1, int[] keyPositions2)
keyPositions1
- The fields used to group the first input stream.keyPositions2
- The fields used to group the second input stream.ConnectedStreams
public ConnectedStreams<IN1,IN2> partitionByHash(String field1, String field2)
DataStream
s underlying type. A dot can be
used to drill down into objects, as in "field1.getInnerField2()"
field1
- The partitioning expressions for the first inputfield2
- The partitioning expressions for the second inputConnectedStreams
public ConnectedStreams<IN1,IN2> partitionByHash(String[] fields1, String[] fields2)
DataStream
s underlying type. A dot can be
used to drill down into objects, as in "field1.getInnerField2()"
fields1
- The partitioning expressions for the first inputfields2
- The partitioning expressions for the second inputConnectedStreams
public ConnectedStreams<IN1,IN2> partitionByHash(org.apache.flink.api.java.functions.KeySelector<IN1,?> keySelector1, org.apache.flink.api.java.functions.KeySelector<IN2,?> keySelector2)
keySelector1
- The KeySelector
used for partitioning the first inputkeySelector2
- The KeySelector
used for partitioning the second inputConnectedStreams
public <OUT> SingleOutputStreamOperator<OUT,?> map(CoMapFunction<IN1,IN2,OUT> coMapper)
ConnectedStreams
and maps
the output to a common type. The transformation calls a
CoMapFunction.map1(IN1)
for each element of the first input and
CoMapFunction.map2(IN2)
for each element of the second input. Each
CoMapFunction call returns exactly one element.coMapper
- The CoMapFunction used to jointly transform the two input DataStreamsDataStream
public <OUT> SingleOutputStreamOperator<OUT,?> flatMap(CoFlatMapFunction<IN1,IN2,OUT> coFlatMapper)
ConnectedStreams
and
maps the output to a common type. The transformation calls a
CoFlatMapFunction.flatMap1(IN1, org.apache.flink.util.Collector<OUT>)
for each element of the first input
and CoFlatMapFunction.flatMap2(IN2, org.apache.flink.util.Collector<OUT>)
for each element of the second
input. Each CoFlatMapFunction call returns any number of elements
including none.coFlatMapper
- The CoFlatMapFunction used to jointly transform the two input
DataStreamsDataStream
public <OUT> SingleOutputStreamOperator<OUT,?> transform(String functionName, org.apache.flink.api.common.typeinfo.TypeInformation<OUT> outTypeInfo, TwoInputStreamOperator<IN1,IN2,OUT> operator)
Copyright © 2014–2015 The Apache Software Foundation. All rights reserved.