T - The type of the elements that result from this StreamTransformationpublic abstract class StreamTransformation<T> extends Object
StreamTransformation represents the operation that creates a
DataStream. Every
DataStream has an underlying
StreamTransformation that is the origin of said DataStream.
API operations such as DataStream.map(org.apache.flink.api.common.functions.MapFunction<T, R>) create
a tree of StreamTransformations underneath. When the stream program is to be executed this
graph is translated to a StreamGraph using
StreamGraphGenerator.
A StreamTransformation does not necessarily correspond to a physical operation
at runtime. Some operations are only logical concepts. Examples of this are union,
split/select data stream, partitioning.
The following graph of StreamTransformations:
Source Source
+ +
| |
v v
Rebalance HashPartition
+ +
| |
| |
+------>Union<------+
+
|
v
Split
+
|
v
Select
+
v
Map
+
|
v
Sink
Would result in this graph of operations at runtime:
Source Source
+ +
| |
| |
+------->Map<-------+
+
|
v
Sink
The information about partitioning, union, split/select end up being encoded in the edges
that connect the sources to the map operation.| Modifier and Type | Field and Description |
|---|---|
protected long |
bufferTimeout |
protected int |
id |
protected static Integer |
idCounter |
protected String |
name |
protected TypeInformation<T> |
outputType |
protected StreamGraph.ResourceStrategy |
resourceStrategy |
protected boolean |
typeUsed |
| Constructor and Description |
|---|
StreamTransformation(String name,
TypeInformation<T> outputType,
int parallelism)
Creates a new
StreamTransformation with the given name, output type and parallelism. |
| Modifier and Type | Method and Description |
|---|---|
boolean |
equals(Object o) |
long |
getBufferTimeout()
Returns the buffer timeout of this
StreamTransformation. |
int |
getId()
Returns the unique ID of this
StreamTransformation. |
String |
getName()
Returns the name of this
StreamTransformation. |
static int |
getNewNodeId() |
TypeInformation<T> |
getOutputType()
Returns the output type of this
StreamTransformation as a TypeInformation. |
int |
getParallelism()
Returns the parallelism of this
StreamTransformation |
StreamGraph.ResourceStrategy |
getResourceStrategy()
Returns the
ResourceStrategy of this StreamTransformation. |
abstract Collection<StreamTransformation<?>> |
getTransitivePredecessors()
Returns all transitive predecessor
StreamTransformations of this StreamTransformation. |
int |
hashCode() |
void |
setBufferTimeout(long bufferTimeout)
Set the buffer timeout of this
StreamTransformation. |
abstract void |
setChainingStrategy(ChainingStrategy strategy)
Sets the chaining strategy of this
StreamTransformation. |
void |
setName(String name)
Changes the name of this
StreamTransformation. |
void |
setOutputType(TypeInformation<T> outputType)
Tries to fill in the type information.
|
void |
setParallelism(int parallelism)
Sets the parallelism of this
StreamTransformation |
void |
setResourceStrategy(StreamGraph.ResourceStrategy resourceStrategy)
Sets the
StreamGraph.ResourceStrategy of this
StreamTransformation. |
String |
toString() |
protected static Integer idCounter
protected final int id
protected String name
protected TypeInformation<T> outputType
protected boolean typeUsed
protected long bufferTimeout
protected StreamGraph.ResourceStrategy resourceStrategy
public StreamTransformation(String name, TypeInformation<T> outputType, int parallelism)
StreamTransformation with the given name, output type and parallelism.name - The name of the StreamTransformation, this will be shown in Visualizations and the LogoutputType - The output type of this StreamTransformationparallelism - The parallelism of this StreamTransformationpublic static int getNewNodeId()
public int getId()
StreamTransformation.public void setName(String name)
StreamTransformation.public String getName()
StreamTransformation.public int getParallelism()
StreamTransformationpublic void setParallelism(int parallelism)
StreamTransformationparallelism - The new parallelism to set on this StreamTransformationpublic void setOutputType(TypeInformation<T> outputType)
outputType - The type information to fill in.IllegalStateException - Thrown, if the type information has been accessed before.public TypeInformation<T> getOutputType()
StreamTransformation as a TypeInformation. Once
this is used once the output type cannot be changed anymore using setOutputType(org.apache.flink.api.common.typeinfo.TypeInformation<T>).StreamTransformationpublic abstract void setChainingStrategy(ChainingStrategy strategy)
StreamTransformation.public void setBufferTimeout(long bufferTimeout)
StreamTransformation. The timeout is used when
sending elements over the network. The timeout specifies how long a network buffer
should be kept waiting before sending. A higher timeout means that more elements will
be sent in one buffer, this increases throughput. The latency, however, is negatively
affected by a higher timeout.public long getBufferTimeout()
StreamTransformation.setBufferTimeout(long)public void setResourceStrategy(StreamGraph.ResourceStrategy resourceStrategy)
StreamGraph.ResourceStrategy of this
StreamTransformation. The resource strategy is used when scheduling operations on actual
workers when transforming the StreamTopology to an
ExecutionGraph.public StreamGraph.ResourceStrategy getResourceStrategy()
ResourceStrategy of this StreamTransformation.public abstract Collection<StreamTransformation<?>> getTransitivePredecessors()
StreamTransformations of this StreamTransformation. This
is, for example, used when determining whether a feedback edge of an iteration
actually has the iteration head as a predecessor.Copyright © 2014–2016 The Apache Software Foundation. All rights reserved.