dianfu commented on code in PR #20618:
URL: https://github.com/apache/flink/pull/20618#discussion_r949738102


##########
flink-python/pyflink/datastream/data_stream.py:
##########
@@ -895,6 +895,20 @@ def get_side_output(self, output_tag: OutputTag) -> 
'DataStream':
         """
         return 
DataStream(self._j_data_stream.getSideOutput(output_tag.get_java_output_tag()))
 
+    def cache(self) -> 'DataStream':
+        """
+        Cache the intermediate result of the transformation. Only support 
bounded streams and
+        currently only block mode is supported. The cache is generated lazily 
at the first time the
+        intermediate result is computed. The cache will be clear when the 
StreamExecutionEnvironment
+        close.
+
+        :return: The cached DataStream that can use in later job to reuse the 
cached intermediate
+                 result.
+

Review Comment:
   Need also add close method in StreamExecutionEnvironment.



##########
flink-python/pyflink/datastream/data_stream.py:
##########
@@ -895,6 +895,20 @@ def get_side_output(self, output_tag: OutputTag) -> 
'DataStream':
         """
         return 
DataStream(self._j_data_stream.getSideOutput(output_tag.get_java_output_tag()))
 
+    def cache(self) -> 'DataStream':
+        """
+        Cache the intermediate result of the transformation. Only support 
bounded streams and
+        currently only block mode is supported. The cache is generated lazily 
at the first time the
+        intermediate result is computed. The cache will be clear when the 
StreamExecutionEnvironment
+        close.
+
+        :return: The cached DataStream that can use in later job to reuse the 
cached intermediate
+                 result.
+
+        .. versionadded:: 1.16.0
+        """
+        return DataStream(self._j_data_stream.cache())

Review Comment:
   I guess we may need to return CachedDataStream which has some specific API, 
e.g. invalidate.



-- 
This is an automated message from the Apache Git Service.
To respond to the message, please log on to GitHub and use the
URL above to go to the specific comment.

To unsubscribe, e-mail: [email protected]

For queries about this service, please contact Infrastructure at:
[email protected]

Reply via email to