You are viewing a plain text version of this content. The canonical link for it is here.
Posted to issues@flink.apache.org by "Zakelly (via GitHub)" <gi...@apache.org> on 2024/12/20 11:07:21 UTC

[PR] [FLINK-36944][DataStream/API] Introduce 'enableAsycState' in KeyedStream interfaces and implement reduce operator [flink]

Zakelly opened a new pull request, #25831:
URL: https://github.com/apache/flink/pull/25831

   ## What is the purpose of the change
   
   As first part of FLIP-488, this PR introduces `enableAsycState` in KeyedStream and its related interface classes. Also it provides a basic implementation of async reduce operator.
   
   
   ## Brief change log
   
   Please check each commit.
    - Introduce `enableAsyncState` API
    - Introduce serializer based state descriptor constructors
    - Implement async reduce operator
    - Introduce async state version of wordcount example
   
   
   ## Verifying this change
   
   This PR adds a IT test on the wordcount example, which can be a IT test of new APIs and reduce operator.
   
   ## Does this pull request potentially affect one of the following parts:
   
     - Dependencies (does it add or upgrade a dependency): no
     - The public API, i.e., is any changed class annotated with `@Public(Evolving)`: no
     - The serializers: no
     - The runtime per-record code paths (performance sensitive): no
     - Anything that affects deployment or recovery: JobManager (and its components), Checkpointing, Kubernetes/Yarn, ZooKeeper: no
     - The S3 file system connector: no
   
   ## Documentation
   
     - Does this pull request introduce a new feature? no
     - If yes, how is the feature documented? not applicable
   


-- 
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: issues-unsubscribe@flink.apache.org

For queries about this service, please contact Infrastructure at:
users@infra.apache.org


Re: [PR] [FLINK-36944][DataStream/API] Introduce 'enableAsycState' in KeyedStream interfaces and implement reduce operator [flink]

Posted by "Zakelly (via GitHub)" <gi...@apache.org>.
Zakelly commented on code in PR #25831:
URL: https://github.com/apache/flink/pull/25831#discussion_r1895238875


##########
flink-runtime/src/main/java/org/apache/flink/streaming/api/operators/StreamGroupedReduceAsyncStateOperator.java:
##########
@@ -0,0 +1,74 @@
+/*
+ * Licensed to the Apache Software Foundation (ASF) under one or more
+ * contributor license agreements.  See the NOTICE file distributed with
+ * this work for additional information regarding copyright ownership.
+ * The ASF licenses this file to You under the Apache License, Version 2.0
+ * (the "License"); you may not use this file except in compliance with
+ * the License.  You may obtain a copy of the License at
+ *
+ *    http://www.apache.org/licenses/LICENSE-2.0
+ *
+ * Unless required by applicable law or agreed to in writing, software
+ * distributed under the License is distributed on an "AS IS" BASIS,
+ * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
+ * See the License for the specific language governing permissions and
+ * limitations under the License.
+ */
+
+package org.apache.flink.streaming.api.operators;
+
+import org.apache.flink.annotation.Internal;
+import org.apache.flink.api.common.functions.ReduceFunction;
+import org.apache.flink.api.common.state.v2.ValueState;
+import org.apache.flink.api.common.typeutils.TypeSerializer;
+import org.apache.flink.runtime.asyncprocessing.operators.AbstractAsyncStateUdfStreamOperator;
+import org.apache.flink.runtime.state.v2.ValueStateDescriptor;
+import org.apache.flink.streaming.runtime.streamrecord.StreamRecord;
+
+/**
+ * A {@link StreamOperator} for executing a {@link ReduceFunction} on a {@link
+ * org.apache.flink.streaming.api.datastream.KeyedStream}.
+ */
+@Internal
+public class StreamGroupedReduceAsyncStateOperator<IN>

Review Comment:
   Good suggestion, added accordingly.



-- 
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: issues-unsubscribe@flink.apache.org

For queries about this service, please contact Infrastructure at:
users@infra.apache.org


Re: [PR] [FLINK-36944][DataStream/API] Introduce 'enableAsycState' in KeyedStream interfaces and implement reduce operator [flink]

Posted by "Zakelly (via GitHub)" <gi...@apache.org>.
Zakelly commented on code in PR #25831:
URL: https://github.com/apache/flink/pull/25831#discussion_r1895239013


##########
flink-runtime/src/main/java/org/apache/flink/streaming/api/datastream/KeyedStream.java:
##########
@@ -1018,4 +1053,21 @@ public QueryableStateStream<KEY, T> asQueryableState(
                 stateDescriptor,
                 getKeyType().createSerializer(getExecutionConfig().getSerializerConfig()));
     }
+
+    /**
+     * Enable the async state processing for following keyed processing function. This also requires
+     * only State V2 APIs are used in the function.
+     *
+     * @return the configured KeyedStream itself.
+     */
+    @Experimental

Review Comment:
   Well, since the queryable state is deprecated, we won't support that.



-- 
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: issues-unsubscribe@flink.apache.org

For queries about this service, please contact Infrastructure at:
users@infra.apache.org


Re: [PR] [FLINK-36944][DataStream/API] Introduce 'enableAsycState' in KeyedStream interfaces and implement reduce operator [flink]

Posted by "flinkbot (via GitHub)" <gi...@apache.org>.
flinkbot commented on PR #25831:
URL: https://github.com/apache/flink/pull/25831#issuecomment-2556824926

   <!--
   Meta data
   {
     "version" : 1,
     "metaDataEntries" : [ {
       "hash" : "4ac574bb292d7f89898f61b2f82132c9686d82c6",
       "status" : "UNKNOWN",
       "url" : "TBD",
       "triggerID" : "4ac574bb292d7f89898f61b2f82132c9686d82c6",
       "triggerType" : "PUSH"
     } ]
   }-->
   ## CI report:
   
   * 4ac574bb292d7f89898f61b2f82132c9686d82c6 UNKNOWN
   
   <details>
   <summary>Bot commands</summary>
     The @flinkbot bot supports the following commands:
   
    - `@flinkbot run azure` re-run the last Azure build
   </details>


-- 
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: issues-unsubscribe@flink.apache.org

For queries about this service, please contact Infrastructure at:
users@infra.apache.org


Re: [PR] [FLINK-36944][DataStream/API] Introduce 'enableAsycState' in KeyedStream interfaces and implement reduce operator [flink]

Posted by "fredia (via GitHub)" <gi...@apache.org>.
fredia commented on code in PR #25831:
URL: https://github.com/apache/flink/pull/25831#discussion_r1895196362


##########
flink-runtime/src/main/java/org/apache/flink/streaming/api/operators/StreamGroupedReduceAsyncStateOperator.java:
##########
@@ -0,0 +1,74 @@
+/*
+ * Licensed to the Apache Software Foundation (ASF) under one or more
+ * contributor license agreements.  See the NOTICE file distributed with
+ * this work for additional information regarding copyright ownership.
+ * The ASF licenses this file to You under the Apache License, Version 2.0
+ * (the "License"); you may not use this file except in compliance with
+ * the License.  You may obtain a copy of the License at
+ *
+ *    http://www.apache.org/licenses/LICENSE-2.0
+ *
+ * Unless required by applicable law or agreed to in writing, software
+ * distributed under the License is distributed on an "AS IS" BASIS,
+ * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
+ * See the License for the specific language governing permissions and
+ * limitations under the License.
+ */
+
+package org.apache.flink.streaming.api.operators;
+
+import org.apache.flink.annotation.Internal;
+import org.apache.flink.api.common.functions.ReduceFunction;
+import org.apache.flink.api.common.state.v2.ValueState;
+import org.apache.flink.api.common.typeutils.TypeSerializer;
+import org.apache.flink.runtime.asyncprocessing.operators.AbstractAsyncStateUdfStreamOperator;
+import org.apache.flink.runtime.state.v2.ValueStateDescriptor;
+import org.apache.flink.streaming.runtime.streamrecord.StreamRecord;
+
+/**
+ * A {@link StreamOperator} for executing a {@link ReduceFunction} on a {@link
+ * org.apache.flink.streaming.api.datastream.KeyedStream}.
+ */
+@Internal
+public class StreamGroupedReduceAsyncStateOperator<IN>

Review Comment:
   How about adding `StreamGroupedReduceAsyncOperatorTest` and parameterizing `AggregationFunctionTest`?



##########
flink-runtime/src/main/java/org/apache/flink/streaming/api/datastream/KeyedStream.java:
##########
@@ -1018,4 +1053,21 @@ public QueryableStateStream<KEY, T> asQueryableState(
                 stateDescriptor,
                 getKeyType().createSerializer(getExecutionConfig().getSerializerConfig()));
     }
+
+    /**
+     * Enable the async state processing for following keyed processing function. This also requires
+     * only State V2 APIs are used in the function.
+     *
+     * @return the configured KeyedStream itself.
+     */
+    @Experimental

Review Comment:
   Does the queryable state need to support async state?



-- 
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: issues-unsubscribe@flink.apache.org

For queries about this service, please contact Infrastructure at:
users@infra.apache.org


Re: [PR] [FLINK-36944][DataStream/API] Introduce 'enableAsycState' in KeyedStream interfaces and implement reduce operator [flink]

Posted by "Zakelly (via GitHub)" <gi...@apache.org>.
Zakelly commented on PR #25831:
URL: https://github.com/apache/flink/pull/25831#issuecomment-2559552085

   Thanks for the review, merging...


-- 
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: issues-unsubscribe@flink.apache.org

For queries about this service, please contact Infrastructure at:
users@infra.apache.org


Re: [PR] [FLINK-36944][DataStream/API] Introduce 'enableAsycState' in KeyedStream interfaces and implement reduce operator [flink]

Posted by "Zakelly (via GitHub)" <gi...@apache.org>.
Zakelly merged PR #25831:
URL: https://github.com/apache/flink/pull/25831


-- 
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: issues-unsubscribe@flink.apache.org

For queries about this service, please contact Infrastructure at:
users@infra.apache.org