Class CachedDataStream<T>
java.lang.Object
org.apache.flink.streaming.api.datastream.DataStream<T>
org.apache.flink.streaming.api.datastream.CachedDataStream<T>
- Type Parameters:
T- The type of the elements in this stream.
CachedDataStream represents a DataStream whose intermediate result will be cached
at the first time when it is computed. And the cached intermediate result can be used in later
job that using the same CachedDataStream to avoid re-computing the intermediate result.-
Nested Class Summary
Nested classes/interfaces inherited from class org.apache.flink.streaming.api.datastream.DataStream
DataStream.Collector<T> -
Field Summary
Fields inherited from class org.apache.flink.streaming.api.datastream.DataStream
environment, transformation -
Constructor Summary
ConstructorsConstructorDescriptionCachedDataStream(StreamExecutionEnvironment environment, org.apache.flink.api.dag.Transformation<T> transformation) Create a newCachedDataStreamin the given execution environment that wrap the given physical transformation to indicates that the transformation should be cached. -
Method Summary
Modifier and TypeMethodDescriptionvoidInvalidate the cache intermediate result of this DataStream to release the physical resources.Methods inherited from class org.apache.flink.streaming.api.datastream.DataStream
addSink, assignTimestampsAndWatermarks, broadcast, broadcast, clean, coGroup, collectAsync, collectAsync, connect, connect, countWindowAll, countWindowAll, doTransform, executeAndCollect, executeAndCollect, executeAndCollect, executeAndCollect, filter, flatMap, flatMap, forward, fullWindowPartition, getExecutionConfig, getExecutionEnvironment, getId, getMinResources, getParallelism, getPreferredResources, getTransformation, getType, global, join, keyBy, keyBy, keyBy, map, map, partitionCustom, print, print, printToErr, printToErr, process, process, project, rebalance, rescale, setConnectionType, shuffle, sinkTo, sinkTo, transform, transform, union, windowAll, writeToSocket, writeUsingOutputFormat
-
Constructor Details
-
CachedDataStream
public CachedDataStream(StreamExecutionEnvironment environment, org.apache.flink.api.dag.Transformation<T> transformation) Create a newCachedDataStreamin the given execution environment that wrap the given physical transformation to indicates that the transformation should be cached.- Parameters:
environment- The StreamExecutionEnvironmenttransformation- The physical transformation whose intermediate result should be cached.
-
-
Method Details
-
invalidate
Invalidate the cache intermediate result of this DataStream to release the physical resources. Users are not required to invoke this method to release physical resources unless they want to. Cache will be recreated if it is used after invalidated.- Throws:
Exception
-