SEPURI-SAI-KRISHNA commented on code in PR #29345:
URL: https://github.com/apache/flink/pull/29345#discussion_r4284097853


##########
flink-table/flink-table-test-utils/src/main/java/org/apache/flink/table/runtime/functions/ProcessTableFunctionTestHarness.java:
##########
@@ -234,6 +239,58 @@ public static <OUT> Builder<OUT> ofClass(
         return new Builder<>(functionClass);
     }
 
+    // 
-------------------------------------------------------------------------
+    // Test State Snapshotting
+    // 
-------------------------------------------------------------------------
+
+    /**
+     * Takes a snapshot of this harness: the configuration it was built with, 
the state of every
+     * partition, the pending and the fired timers, the watermark of every 
table argument, and the
+     * collected output.
+     *
+     * <p>The snapshot is isolated from this harness, so processing further 
elements, advancing a
+     * watermark or mutating state afterwards does not change what the 
snapshot holds. State is
+     * copied in its internal representation, which means no user-facing state 
object is touched.
+     * The one part that is not copied is the values collected by the PTF 
itself (see {@link
+     * #getFunctionOutput()}), since those are the instances the function 
emitted.

Review Comment:
   You were right, a POJO-typed PTF leaked. `functionOutput` is copied now. One 
wrinkle: a PTF may `collect(null)`, which the serializer cannot convert, so 
both copies skip nulls.



-- 
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