davidradl commented on code in PR #26120:
URL: https://github.com/apache/flink/pull/26120#discussion_r1946810230
##########
flink-core/src/main/java/org/apache/flink/api/common/functions/RuntimeContext.java:
##########
@@ -410,6 +411,95 @@ <IN, ACC, OUT> AggregatingState<IN, OUT>
getAggregatingState(
@PublicEvolving
<UK, UV> MapState<UK, UV> getMapState(MapStateDescriptor<UK, UV>
stateProperties);
+ // ------------------------------------------------------------------------
+ // Methods for accessing state V2
+ // ------------------------------------------------------------------------
+
+ /**
+ * Gets a handle to the system's key/value state. The key/value state is
only accessible if the
+ * function is executed on a KeyedStream. On each access, the state
exposes the value for the
+ * key of the element currently processed by the function. Each function
may have multiple
+ * partitioned states, addressed with different names.
+ *
+ * <p>Because the scope of each value is the key of the currently
processed element, and the
+ * elements are distributed by the Flink runtime, the system can
transparently scale out and
+ * redistribute the state and KeyedStream.
+ *
+ * @param stateProperties The descriptor defining the properties of the
stats.
+ * @param <T> The type of value stored in the state.
+ * @return The partitioned state object.
+ * @throws UnsupportedOperationException Thrown, if no partitioned state
is available for the
+ * function (function is not part of a KeyedStream).
+ */
+ @Experimental
+ <T> org.apache.flink.api.common.state.v2.ValueState<T> getState(
+ org.apache.flink.api.common.state.v2.ValueStateDescriptor<T>
stateProperties);
+
+ /**
+ * Gets a handle to the system's key/value list state. This state is
similar to the state
+ * accessed via {@link #getState(ValueStateDescriptor)}, but is optimized
for state that holds
+ * lists. One can add elements to the list, or retrieve the list as a
whole.
+ *
+ * @param stateProperties The descriptor defining the properties of the
stats.
+ * @param <T> The type of value stored in the state.
+ * @return The partitioned state object.
+ * @throws UnsupportedOperationException Thrown, if no partitioned state
is available for the
+ * function (function is not part os a KeyedStream).
+ */
+ @Experimental
+ <T> org.apache.flink.api.common.state.v2.ListState<T> getListState(
+ org.apache.flink.api.common.state.v2.ListStateDescriptor<T>
stateProperties);
+
+ /**
+ * Gets a handle to the system's key/value reducing state. This state is
similar to the state
+ * accessed via {@link #getState(ValueStateDescriptor)}, but is optimized
for state that
+ * aggregates values.
+ *
+ * @param stateProperties The descriptor defining the properties of the
stats.
+ * @param <T> The type of value stored in the state.
+ * @return The partitioned state object.
+ * @throws UnsupportedOperationException Thrown, if no partitioned state
is available for the
+ * function (function is not part of a KeyedStream).
+ */
+ @Experimental
+ <T> org.apache.flink.api.common.state.v2.ReducingState<T> getReducingState(
+ org.apache.flink.api.common.state.v2.ReducingStateDescriptor<T>
stateProperties);
+
+ /**
+ * Gets a handle to the system's key/value aggregating state. This state
is similar to the state
+ * accessed via {@link #getState(ValueStateDescriptor)}, but is optimized
for state that
+ * aggregates values with different types.
+ *
+ * @param stateProperties The descriptor defining the properties of the
stats.
+ * @param <IN> The type of the values that are added to the state.
+ * @param <ACC> The type of the accumulator (intermediate aggregation
state).
+ * @param <OUT> The type of the values that are returned from the state.
+ * @return The partitioned state object.
+ * @throws UnsupportedOperationException Thrown, if no partitioned state
is available for the
+ * function (function is not part of a KeyedStream).
+ */
+ @Experimental
+ <IN, ACC, OUT>
+ org.apache.flink.api.common.state.v2.AggregatingState<IN, OUT>
getAggregatingState(
+
org.apache.flink.api.common.state.v2.AggregatingStateDescriptor<IN, ACC, OUT>
+ stateProperties);
+
+ /**
+ * Gets a handle to the system's key/value map state. This state is
similar to the state
Review Comment:
nit: I am curious about the use of the word handle in these methods would we
not say AggregatingState instead (for this method)
--
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]