wqshr12345 commented on code in PR #25221:
URL: https://github.com/apache/flink/pull/25221#discussion_r1726156110
##########
flink-core-api/src/main/java/org/apache/flink/api/common/state/v2/AppendingState.java:
##########
@@ -54,12 +55,40 @@ public interface AppendingState<IN, OUT> extends State {
/**
* Updates the operator state accessible by {@link #asyncGet()} by adding
the given value to the
- * list of values. The next time {@link #asyncGet()} is called (for the
same state partition)
- * the returned state will represent the updated list.
+ * list of values asynchronously. The next time {@link #asyncGet()} is
called (for the same
+ * state partition) the returned state will represent the updated list.
*
* <p>null value is not allowed to be passed in.
*
* @param value The new value for the state.
*/
StateFuture<Void> asyncAdd(IN value);
+
+ /**
+ * Returns the current value for the state. When the state is not
partitioned the returned value
+ * is the same for all inputs in a given operator instance. If state
partitioning is applied,
+ * the value returned depends on the current operator input, as the
operator maintains an
+ * independent state for each partition.
+ *
+ * <p><b>NOTE TO IMPLEMENTERS:</b> if the state is empty, then this method
should return {@code
+ * null}.
+ *
+ * @return The operator state value corresponding to the current input or
{@code null} if the
+ * state is empty.
+ * @throws Exception Thrown if the system cannot access the state.
+ */
+ SYNCOUT get() throws Exception;
+
+ /**
+ * Updates the operator state accessible by {@link #get()} by adding the
given value to the list
+ * of values. The next time {@link #get()} is called (for the same state
partition) the returned
+ * state will represent the updated list.
+ *
+ * <p>If null is passed in, the behaviour is undefined (implementation
related). TODO: An
+ * unified behaviour across all sub-classes.
Review Comment:
The comment has been addressed.
--
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]