You are viewing a plain text version of this content. The canonical link for it is here.
Posted to issues@flink.apache.org by GitBox <gi...@apache.org> on 2021/01/26 12:43:03 UTC

[GitHub] [flink] shuiqiangchen opened a new pull request #14758: [FLINK-21112][python] Add ValueState/ListState/MapState and corresponding StateDescriptors for Python DataStream API

shuiqiangchen opened a new pull request #14758:
URL: https://github.com/apache/flink/pull/14758


   <!--
   *Thank you very much for contributing to Apache Flink - we are happy that you want to help us improve Flink. To help the community review your contribution in the best possible way, please go through the checklist below, which will get the contribution into a shape in which it can be best reviewed.*
   
   *Please understand that we do not do this to make contributions to Flink a hassle. In order to uphold a high standard of quality for code contributions, while at the same time managing a large number of contributions, we need contributors to prepare the contributions well, and give reviewers enough contextual information for the review. Please also understand that contributions that do not follow this guide will take longer to review and thus typically be picked up with lower priority by the community.*
   
   ## Contribution Checklist
   
     - Make sure that the pull request corresponds to a [JIRA issue](https://issues.apache.org/jira/projects/FLINK/issues). Exceptions are made for typos in JavaDoc or documentation files, which need no JIRA issue.
     
     - Name the pull request in the form "[FLINK-XXXX] [component] Title of the pull request", where *FLINK-XXXX* should be replaced by the actual issue number. Skip *component* if you are unsure about which is the best component.
     Typo fixes that have no associated JIRA issue should be named following this pattern: `[hotfix] [docs] Fix typo in event time introduction` or `[hotfix] [javadocs] Expand JavaDoc for PuncuatedWatermarkGenerator`.
   
     - Fill out the template below to describe the changes contributed by the pull request. That will give reviewers the context they need to do the review.
     
     - Make sure that the change passes the automated tests, i.e., `mvn clean verify` passes. You can set up Azure Pipelines CI to do that following [this guide](https://cwiki.apache.org/confluence/display/FLINK/Azure+Pipelines#AzurePipelines-Tutorial:SettingupAzurePipelinesforaforkoftheFlinkrepository).
   
     - Each pull request should address only one issue, not mix up code from multiple issues.
     
     - Each commit in the pull request has a meaningful commit message (including the JIRA id)
   
     - Once all items of the checklist are addressed, remove the above text and this checklist, leaving only the filled out template below.
   
   
   **(The sections below can be removed for hotfixes of typos)**
   -->
   
   ## What is the purpose of the change
   
   *Add ValueState/ListState/MapState and corresponding StateDescriptors for Python DataStream API*
   
   
   ## Brief change log
   
   - *Added ValueState/ListState/MapState and StateDescriptors*
   
   ## Verifying this change
   
   This change has test case covered by test_keyed_process_function_with_state() in test_data_stream.py.
   
   ## 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/Mesos, 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 documented)
   


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

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



[GitHub] [flink] shuiqiangchen commented on a change in pull request #14758: [FLINK-21112][python] Add ValueState/ListState/MapState and corresponding StateDescriptors for Python DataStream API

Posted by GitBox <gi...@apache.org>.
shuiqiangchen commented on a change in pull request #14758:
URL: https://github.com/apache/flink/pull/14758#discussion_r566700684



##########
File path: flink-python/pyflink/fn_execution/operation_utils.py
##########
@@ -310,7 +310,7 @@ def wrapped_keyed_process_function(value):
             on_timer_ctx.set_timestamp(value[1])
             on_timer_ctx.timer_service().set_current_watermark(value[2])
             current_key = value[3]
-            on_timer_ctx.set_current_key(current_key)
+            on_timer_ctx.set_current_key(current_key[0])

Review comment:
       Actually, this issue also exists in 1.12. It would be better to create a new issue and fix it in a separate PR.




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

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



[GitHub] [flink] shuiqiangchen commented on pull request #14758: [FLINK-21112][python] Add ValueState/ListState/MapState and corresponding StateDescriptors for Python DataStream API

Posted by GitBox <gi...@apache.org>.
shuiqiangchen commented on pull request #14758:
URL: https://github.com/apache/flink/pull/14758#issuecomment-769534362


   @WeiZhong94 Thank you for your suggestions, I have updated the pr, please have a look.


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

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



[GitHub] [flink] dianfu commented on a change in pull request #14758: [FLINK-21112][python] Add ValueState/ListState/MapState and corresponding StateDescriptors for Python DataStream API

Posted by GitBox <gi...@apache.org>.
dianfu commented on a change in pull request #14758:
URL: https://github.com/apache/flink/pull/14758#discussion_r566700442



##########
File path: flink-python/pyflink/common/state.py
##########
@@ -67,33 +71,56 @@ def update(self, value: T) -> None:
         pass
 
 
-class ListState(State, Generic[T]):
+class AppendingState(State, Generic[IN, OUT]):
     """
-    :class:`State` interface for partitioned list state in Operations.
-    The state is accessed and modified by user functions, and checkpointed consistently
-    by the system as part of the distributed snapshots.
+    Base interface for partitioned state taht supports adding elements and inspecting the current
+    state. Elements can either be kept in a buffer (list-like) or aggregated into one value.
 
-    Currently only keyed list state is supported.
+    This state is accessed and modified by user functions, and checkpointed consistently by the
+    system as part of the distributed snapshots.
 
-    When it is a keyed list state, the state key is automatically supplied by the system, so the
-    user function always sees the value mapped to the key of the current element. That way, the
-    system can handle stream and state partitioning consistently together.
+    The state is only accessible by functions applied on a KeyedStream. The key is automatically
+    supplied by the system, so the function always sees the value mapped to the key of the current
+    element. That way, the system can handle stream and state partitioning consistently together.
     """
 
     @abstractmethod
-    def get(self) -> Iterable[T]:
+    def get(self) -> OUT:
         """
         Returns the elements under the current key.
         """
         pass
 
     @abstractmethod
-    def add(self, value: T) -> None:
+    def add(self, value: IN) -> None:
         """
         Adding the given value to the tail of this list state.
         """
         pass
 
+
+class MergingState(AppendingState[IN, OUT]):
+    """
+    Extension of AppendingState that allows merging of state. That is, two instance of MergingState
+    can be combined into a single instance that contains all the information of the two merged
+    states.
+    """
+    pass
+
+
+class ListState(MergingState[T, Iterable[T]]):

Review comment:
       FLIP-153 is trying to expose State to users and so I think it's time to export them~




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

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



[GitHub] [flink] dianfu commented on a change in pull request #14758: [FLINK-21112][python] Add ValueState/ListState/MapState and corresponding StateDescriptors for Python DataStream API

Posted by GitBox <gi...@apache.org>.
dianfu commented on a change in pull request #14758:
URL: https://github.com/apache/flink/pull/14758#discussion_r566698903



##########
File path: flink-python/pyflink/fn_execution/operation_utils.py
##########
@@ -310,7 +310,7 @@ def wrapped_keyed_process_function(value):
             on_timer_ctx.set_timestamp(value[1])
             on_timer_ctx.timer_service().set_current_watermark(value[2])
             current_key = value[3]
-            on_timer_ctx.set_current_key(current_key)
+            on_timer_ctx.set_current_key(current_key[0])

Review comment:
       Is this a change specific for this PR or is it an issue which also exists in 1.12? If this is the latter case, we'd better split it into a separate commit or separate PR and also cherry pick to 1.12. What do you think?




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

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



[GitHub] [flink] dianfu commented on a change in pull request #14758: [FLINK-21112][python] Add ValueState/ListState/MapState and corresponding StateDescriptors for Python DataStream API

Posted by GitBox <gi...@apache.org>.
dianfu commented on a change in pull request #14758:
URL: https://github.com/apache/flink/pull/14758#discussion_r566662632



##########
File path: flink-python/pyflink/fn_execution/operation_utils.py
##########
@@ -310,7 +310,7 @@ def wrapped_keyed_process_function(value):
             on_timer_ctx.set_timestamp(value[1])
             on_timer_ctx.timer_service().set_current_watermark(value[2])
             current_key = value[3]
-            on_timer_ctx.set_current_key(current_key)
+            on_timer_ctx.set_current_key(current_key[0])

Review comment:
       What's the purpose of this change?

##########
File path: flink-python/pyflink/common/state.py
##########
@@ -67,33 +71,56 @@ def update(self, value: T) -> None:
         pass
 
 
-class ListState(State, Generic[T]):
+class AppendingState(State, Generic[IN, OUT]):
     """
-    :class:`State` interface for partitioned list state in Operations.
-    The state is accessed and modified by user functions, and checkpointed consistently
-    by the system as part of the distributed snapshots.
+    Base interface for partitioned state taht supports adding elements and inspecting the current
+    state. Elements can either be kept in a buffer (list-like) or aggregated into one value.
 
-    Currently only keyed list state is supported.
+    This state is accessed and modified by user functions, and checkpointed consistently by the
+    system as part of the distributed snapshots.
 
-    When it is a keyed list state, the state key is automatically supplied by the system, so the
-    user function always sees the value mapped to the key of the current element. That way, the
-    system can handle stream and state partitioning consistently together.
+    The state is only accessible by functions applied on a KeyedStream. The key is automatically
+    supplied by the system, so the function always sees the value mapped to the key of the current
+    element. That way, the system can handle stream and state partitioning consistently together.
     """
 
     @abstractmethod
-    def get(self) -> Iterable[T]:
+    def get(self) -> OUT:
         """
         Returns the elements under the current key.
         """
         pass
 
     @abstractmethod
-    def add(self, value: T) -> None:
+    def add(self, value: IN) -> None:
         """
         Adding the given value to the tail of this list state.
         """
         pass
 
+
+class MergingState(AppendingState[IN, OUT]):
+    """
+    Extension of AppendingState that allows merging of state. That is, two instance of MergingState
+    can be combined into a single instance that contains all the information of the two merged
+    states.
+    """
+    pass
+
+
+class ListState(MergingState[T, Iterable[T]]):

Review comment:
       Should we export these kinds of classes to users? If so, what about declare them in the __all__ = []?




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

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



[GitHub] [flink] flinkbot edited a comment on pull request #14758: [FLINK-21112][python] Add ValueState/ListState/MapState and corresponding StateDescriptors for Python DataStream API

Posted by GitBox <gi...@apache.org>.
flinkbot edited a comment on pull request #14758:
URL: https://github.com/apache/flink/pull/14758#issuecomment-767522160


   <!--
   Meta data
   {
     "version" : 1,
     "metaDataEntries" : [ {
       "hash" : "fbe57c797c3fc1623892afae812701eb06ea8676",
       "status" : "DELETED",
       "url" : "https://dev.azure.com/apache-flink/98463496-1af2-4620-8eab-a2ecc1a2e6fe/_build/results?buildId=12510",
       "triggerID" : "fbe57c797c3fc1623892afae812701eb06ea8676",
       "triggerType" : "PUSH"
     }, {
       "hash" : "0afefe95b5f1f7a94e3245c77ccd170fb04c9fa9",
       "status" : "UNKNOWN",
       "url" : "TBD",
       "triggerID" : "0afefe95b5f1f7a94e3245c77ccd170fb04c9fa9",
       "triggerType" : "PUSH"
     }, {
       "hash" : "c9ac6bd3ff2afb28ce3f9d686a9d7c14f431fb64",
       "status" : "DELETED",
       "url" : "https://dev.azure.com/apache-flink/98463496-1af2-4620-8eab-a2ecc1a2e6fe/_build/results?buildId=12631",
       "triggerID" : "c9ac6bd3ff2afb28ce3f9d686a9d7c14f431fb64",
       "triggerType" : "PUSH"
     }, {
       "hash" : "b55612a0af52ea2acd48c29908b77d2080349d5f",
       "status" : "SUCCESS",
       "url" : "https://dev.azure.com/apache-flink/98463496-1af2-4620-8eab-a2ecc1a2e6fe/_build/results?buildId=12634",
       "triggerID" : "b55612a0af52ea2acd48c29908b77d2080349d5f",
       "triggerType" : "PUSH"
     }, {
       "hash" : "2af7a109f695bda25b7649b3fab68898b284dbeb",
       "status" : "PENDING",
       "url" : "https://dev.azure.com/apache-flink/98463496-1af2-4620-8eab-a2ecc1a2e6fe/_build/results?buildId=12650",
       "triggerID" : "2af7a109f695bda25b7649b3fab68898b284dbeb",
       "triggerType" : "PUSH"
     } ]
   }-->
   ## CI report:
   
   * 0afefe95b5f1f7a94e3245c77ccd170fb04c9fa9 UNKNOWN
   * b55612a0af52ea2acd48c29908b77d2080349d5f Azure: [SUCCESS](https://dev.azure.com/apache-flink/98463496-1af2-4620-8eab-a2ecc1a2e6fe/_build/results?buildId=12634) 
   * 2af7a109f695bda25b7649b3fab68898b284dbeb Azure: [PENDING](https://dev.azure.com/apache-flink/98463496-1af2-4620-8eab-a2ecc1a2e6fe/_build/results?buildId=12650) 
   
   <details>
   <summary>Bot commands</summary>
     The @flinkbot bot supports the following commands:
   
    - `@flinkbot run travis` re-run the last Travis build
    - `@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.

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



[GitHub] [flink] flinkbot edited a comment on pull request #14758: [FLINK-21112][python] Add ValueState/ListState/MapState and corresponding StateDescriptors for Python DataStream API

Posted by GitBox <gi...@apache.org>.
flinkbot edited a comment on pull request #14758:
URL: https://github.com/apache/flink/pull/14758#issuecomment-767522160


   <!--
   Meta data
   {
     "version" : 1,
     "metaDataEntries" : [ {
       "hash" : "fbe57c797c3fc1623892afae812701eb06ea8676",
       "status" : "PENDING",
       "url" : "https://dev.azure.com/apache-flink/98463496-1af2-4620-8eab-a2ecc1a2e6fe/_build/results?buildId=12510",
       "triggerID" : "fbe57c797c3fc1623892afae812701eb06ea8676",
       "triggerType" : "PUSH"
     } ]
   }-->
   ## CI report:
   
   * fbe57c797c3fc1623892afae812701eb06ea8676 Azure: [PENDING](https://dev.azure.com/apache-flink/98463496-1af2-4620-8eab-a2ecc1a2e6fe/_build/results?buildId=12510) 
   
   <details>
   <summary>Bot commands</summary>
     The @flinkbot bot supports the following commands:
   
    - `@flinkbot run travis` re-run the last Travis build
    - `@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.

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



[GitHub] [flink] flinkbot edited a comment on pull request #14758: [FLINK-21112][python] Add ValueState/ListState/MapState and corresponding StateDescriptors for Python DataStream API

Posted by GitBox <gi...@apache.org>.
flinkbot edited a comment on pull request #14758:
URL: https://github.com/apache/flink/pull/14758#issuecomment-767522160


   <!--
   Meta data
   {
     "version" : 1,
     "metaDataEntries" : [ {
       "hash" : "fbe57c797c3fc1623892afae812701eb06ea8676",
       "status" : "DELETED",
       "url" : "https://dev.azure.com/apache-flink/98463496-1af2-4620-8eab-a2ecc1a2e6fe/_build/results?buildId=12510",
       "triggerID" : "fbe57c797c3fc1623892afae812701eb06ea8676",
       "triggerType" : "PUSH"
     }, {
       "hash" : "0afefe95b5f1f7a94e3245c77ccd170fb04c9fa9",
       "status" : "UNKNOWN",
       "url" : "TBD",
       "triggerID" : "0afefe95b5f1f7a94e3245c77ccd170fb04c9fa9",
       "triggerType" : "PUSH"
     }, {
       "hash" : "c9ac6bd3ff2afb28ce3f9d686a9d7c14f431fb64",
       "status" : "DELETED",
       "url" : "https://dev.azure.com/apache-flink/98463496-1af2-4620-8eab-a2ecc1a2e6fe/_build/results?buildId=12631",
       "triggerID" : "c9ac6bd3ff2afb28ce3f9d686a9d7c14f431fb64",
       "triggerType" : "PUSH"
     }, {
       "hash" : "b55612a0af52ea2acd48c29908b77d2080349d5f",
       "status" : "SUCCESS",
       "url" : "https://dev.azure.com/apache-flink/98463496-1af2-4620-8eab-a2ecc1a2e6fe/_build/results?buildId=12634",
       "triggerID" : "b55612a0af52ea2acd48c29908b77d2080349d5f",
       "triggerType" : "PUSH"
     } ]
   }-->
   ## CI report:
   
   * 0afefe95b5f1f7a94e3245c77ccd170fb04c9fa9 UNKNOWN
   * b55612a0af52ea2acd48c29908b77d2080349d5f Azure: [SUCCESS](https://dev.azure.com/apache-flink/98463496-1af2-4620-8eab-a2ecc1a2e6fe/_build/results?buildId=12634) 
   
   <details>
   <summary>Bot commands</summary>
     The @flinkbot bot supports the following commands:
   
    - `@flinkbot run travis` re-run the last Travis build
    - `@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.

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



[GitHub] [flink] flinkbot edited a comment on pull request #14758: [FLINK-21112][python] Add ValueState/ListState/MapState and corresponding StateDescriptors for Python DataStream API

Posted by GitBox <gi...@apache.org>.
flinkbot edited a comment on pull request #14758:
URL: https://github.com/apache/flink/pull/14758#issuecomment-767522160


   <!--
   Meta data
   {
     "version" : 1,
     "metaDataEntries" : [ {
       "hash" : "fbe57c797c3fc1623892afae812701eb06ea8676",
       "status" : "DELETED",
       "url" : "https://dev.azure.com/apache-flink/98463496-1af2-4620-8eab-a2ecc1a2e6fe/_build/results?buildId=12510",
       "triggerID" : "fbe57c797c3fc1623892afae812701eb06ea8676",
       "triggerType" : "PUSH"
     }, {
       "hash" : "0afefe95b5f1f7a94e3245c77ccd170fb04c9fa9",
       "status" : "UNKNOWN",
       "url" : "TBD",
       "triggerID" : "0afefe95b5f1f7a94e3245c77ccd170fb04c9fa9",
       "triggerType" : "PUSH"
     }, {
       "hash" : "c9ac6bd3ff2afb28ce3f9d686a9d7c14f431fb64",
       "status" : "DELETED",
       "url" : "https://dev.azure.com/apache-flink/98463496-1af2-4620-8eab-a2ecc1a2e6fe/_build/results?buildId=12631",
       "triggerID" : "c9ac6bd3ff2afb28ce3f9d686a9d7c14f431fb64",
       "triggerType" : "PUSH"
     }, {
       "hash" : "b55612a0af52ea2acd48c29908b77d2080349d5f",
       "status" : "DELETED",
       "url" : "https://dev.azure.com/apache-flink/98463496-1af2-4620-8eab-a2ecc1a2e6fe/_build/results?buildId=12634",
       "triggerID" : "b55612a0af52ea2acd48c29908b77d2080349d5f",
       "triggerType" : "PUSH"
     }, {
       "hash" : "2af7a109f695bda25b7649b3fab68898b284dbeb",
       "status" : "SUCCESS",
       "url" : "https://dev.azure.com/apache-flink/98463496-1af2-4620-8eab-a2ecc1a2e6fe/_build/results?buildId=12650",
       "triggerID" : "2af7a109f695bda25b7649b3fab68898b284dbeb",
       "triggerType" : "PUSH"
     } ]
   }-->
   ## CI report:
   
   * 0afefe95b5f1f7a94e3245c77ccd170fb04c9fa9 UNKNOWN
   * 2af7a109f695bda25b7649b3fab68898b284dbeb Azure: [SUCCESS](https://dev.azure.com/apache-flink/98463496-1af2-4620-8eab-a2ecc1a2e6fe/_build/results?buildId=12650) 
   
   <details>
   <summary>Bot commands</summary>
     The @flinkbot bot supports the following commands:
   
    - `@flinkbot run travis` re-run the last Travis build
    - `@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.

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



[GitHub] [flink] flinkbot edited a comment on pull request #14758: [FLINK-21112][python] Add ValueState/ListState/MapState and corresponding StateDescriptors for Python DataStream API

Posted by GitBox <gi...@apache.org>.
flinkbot edited a comment on pull request #14758:
URL: https://github.com/apache/flink/pull/14758#issuecomment-767522160


   <!--
   Meta data
   {
     "version" : 1,
     "metaDataEntries" : [ {
       "hash" : "fbe57c797c3fc1623892afae812701eb06ea8676",
       "status" : "SUCCESS",
       "url" : "https://dev.azure.com/apache-flink/98463496-1af2-4620-8eab-a2ecc1a2e6fe/_build/results?buildId=12510",
       "triggerID" : "fbe57c797c3fc1623892afae812701eb06ea8676",
       "triggerType" : "PUSH"
     } ]
   }-->
   ## CI report:
   
   * fbe57c797c3fc1623892afae812701eb06ea8676 Azure: [SUCCESS](https://dev.azure.com/apache-flink/98463496-1af2-4620-8eab-a2ecc1a2e6fe/_build/results?buildId=12510) 
   
   <details>
   <summary>Bot commands</summary>
     The @flinkbot bot supports the following commands:
   
    - `@flinkbot run travis` re-run the last Travis build
    - `@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.

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



[GitHub] [flink] flinkbot commented on pull request #14758: [FLINK-21112][python] Add ValueState/ListState/MapState and corresponding StateDescriptors for Python DataStream API

Posted by GitBox <gi...@apache.org>.
flinkbot commented on pull request #14758:
URL: https://github.com/apache/flink/pull/14758#issuecomment-767518245


   Thanks a lot for your contribution to the Apache Flink project. I'm the @flinkbot. I help the community
   to review your pull request. We will use this comment to track the progress of the review.
   
   
   ## Automated Checks
   Last check on commit fbe57c797c3fc1623892afae812701eb06ea8676 (Tue Jan 26 12:44:48 UTC 2021)
   
   **Warnings:**
    * No documentation files were touched! Remember to keep the Flink docs up to date!
    * **This pull request references an unassigned [Jira ticket](https://issues.apache.org/jira/browse/FLINK-21112).** According to the [code contribution guide](https://flink.apache.org/contributing/contribute-code.html), tickets need to be assigned before starting with the implementation work.
   
   
   <sub>Mention the bot in a comment to re-run the automated checks.</sub>
   ## Review Progress
   
   * ❓ 1. The [description] looks good.
   * ❓ 2. There is [consensus] that the contribution should go into to Flink.
   * ❓ 3. Needs [attention] from.
   * ❓ 4. The change fits into the overall [architecture].
   * ❓ 5. Overall code [quality] is good.
   
   Please see the [Pull Request Review Guide](https://flink.apache.org/contributing/reviewing-prs.html) for a full explanation of the review process.<details>
    The Bot is tracking the review progress through labels. Labels are applied according to the order of the review items. For consensus, approval by a Flink committer of PMC member is required <summary>Bot commands</summary>
     The @flinkbot bot supports the following commands:
   
    - `@flinkbot approve description` to approve one or more aspects (aspects: `description`, `consensus`, `architecture` and `quality`)
    - `@flinkbot approve all` to approve all aspects
    - `@flinkbot approve-until architecture` to approve everything until `architecture`
    - `@flinkbot attention @username1 [@username2 ..]` to require somebody's attention
    - `@flinkbot disapprove architecture` to remove an approval you gave earlier
   </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.

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



[GitHub] [flink] flinkbot edited a comment on pull request #14758: [FLINK-21112][python] Add ValueState/ListState/MapState and corresponding StateDescriptors for Python DataStream API

Posted by GitBox <gi...@apache.org>.
flinkbot edited a comment on pull request #14758:
URL: https://github.com/apache/flink/pull/14758#issuecomment-767522160


   <!--
   Meta data
   {
     "version" : 1,
     "metaDataEntries" : [ {
       "hash" : "fbe57c797c3fc1623892afae812701eb06ea8676",
       "status" : "SUCCESS",
       "url" : "https://dev.azure.com/apache-flink/98463496-1af2-4620-8eab-a2ecc1a2e6fe/_build/results?buildId=12510",
       "triggerID" : "fbe57c797c3fc1623892afae812701eb06ea8676",
       "triggerType" : "PUSH"
     }, {
       "hash" : "0afefe95b5f1f7a94e3245c77ccd170fb04c9fa9",
       "status" : "UNKNOWN",
       "url" : "TBD",
       "triggerID" : "0afefe95b5f1f7a94e3245c77ccd170fb04c9fa9",
       "triggerType" : "PUSH"
     }, {
       "hash" : "c9ac6bd3ff2afb28ce3f9d686a9d7c14f431fb64",
       "status" : "PENDING",
       "url" : "https://dev.azure.com/apache-flink/98463496-1af2-4620-8eab-a2ecc1a2e6fe/_build/results?buildId=12631",
       "triggerID" : "c9ac6bd3ff2afb28ce3f9d686a9d7c14f431fb64",
       "triggerType" : "PUSH"
     }, {
       "hash" : "b55612a0af52ea2acd48c29908b77d2080349d5f",
       "status" : "UNKNOWN",
       "url" : "TBD",
       "triggerID" : "b55612a0af52ea2acd48c29908b77d2080349d5f",
       "triggerType" : "PUSH"
     } ]
   }-->
   ## CI report:
   
   * fbe57c797c3fc1623892afae812701eb06ea8676 Azure: [SUCCESS](https://dev.azure.com/apache-flink/98463496-1af2-4620-8eab-a2ecc1a2e6fe/_build/results?buildId=12510) 
   * 0afefe95b5f1f7a94e3245c77ccd170fb04c9fa9 UNKNOWN
   * c9ac6bd3ff2afb28ce3f9d686a9d7c14f431fb64 Azure: [PENDING](https://dev.azure.com/apache-flink/98463496-1af2-4620-8eab-a2ecc1a2e6fe/_build/results?buildId=12631) 
   * b55612a0af52ea2acd48c29908b77d2080349d5f UNKNOWN
   
   <details>
   <summary>Bot commands</summary>
     The @flinkbot bot supports the following commands:
   
    - `@flinkbot run travis` re-run the last Travis build
    - `@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.

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



[GitHub] [flink] flinkbot commented on pull request #14758: [FLINK-21112][python] Add ValueState/ListState/MapState and corresponding StateDescriptors for Python DataStream API

Posted by GitBox <gi...@apache.org>.
flinkbot commented on pull request #14758:
URL: https://github.com/apache/flink/pull/14758#issuecomment-767522160


   <!--
   Meta data
   {
     "version" : 1,
     "metaDataEntries" : [ {
       "hash" : "fbe57c797c3fc1623892afae812701eb06ea8676",
       "status" : "UNKNOWN",
       "url" : "TBD",
       "triggerID" : "fbe57c797c3fc1623892afae812701eb06ea8676",
       "triggerType" : "PUSH"
     } ]
   }-->
   ## CI report:
   
   * fbe57c797c3fc1623892afae812701eb06ea8676 UNKNOWN
   
   <details>
   <summary>Bot commands</summary>
     The @flinkbot bot supports the following commands:
   
    - `@flinkbot run travis` re-run the last Travis build
    - `@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.

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



[GitHub] [flink] shuiqiangchen commented on pull request #14758: [FLINK-21112][python] Add ValueState/ListState/MapState and corresponding StateDescriptors for Python DataStream API

Posted by GitBox <gi...@apache.org>.
shuiqiangchen commented on pull request #14758:
URL: https://github.com/apache/flink/pull/14758#issuecomment-769708232


   @dianfu Thank you for your comments, I have updated the PR according to your comments, please have a look.


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

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



[GitHub] [flink] WeiZhong94 commented on a change in pull request #14758: [FLINK-21112][python] Add ValueState/ListState/MapState and corresponding StateDescriptors for Python DataStream API

Posted by GitBox <gi...@apache.org>.
WeiZhong94 commented on a change in pull request #14758:
URL: https://github.com/apache/flink/pull/14758#discussion_r565170564



##########
File path: flink-python/pyflink/common/state.py
##########
@@ -94,6 +98,29 @@ def add(self, value: T) -> None:
         """
         pass
 
+
+class MergingState(AppendingState[IN, OUT], ABC):

Review comment:
       ```suggestion
   class MergingState(AppendingState[IN, OUT]):
   ```

##########
File path: flink-python/pyflink/common/state.py
##########
@@ -67,17 +71,17 @@ def update(self, value: T) -> None:
         pass
 
 
-class ListState(State, Generic[T]):
+class AppendingState(State, Generic[IN, OUT]):
     """
-    :class:`State` interface for partitioned list state in Operations.
-    The state is accessed and modified by user functions, and checkpointed consistently
-    by the system as part of the distributed snapshots.
+    Base interface for partitioned state taht supports adding elements and inspecting the current
+    state. Elements can either be kept in a buffer (list-like) or aggregated into one value.
 
-    Currently only keyed list state is supported.
+    This state is accessed and modified by user functions, and checkpointed consistently by the
+    system as part of the distributed snapshots.
 
-    When it is a keyed list state, the state key is automatically supplied by the system, so the
-    user function always sees the value mapped to the key of the current element. That way, the
-    system can handle stream and state partitioning consistently together.
+    The state is only accessible by functions applied on a KeyedStream. The key is automatically
+    supplied by the system, so the function always sees the value mapped to the key of the current
+    element. That way, the system can handle stream and state partitioning consistently together.
     """
 
     @abstractmethod

Review comment:
       def get(self) -> OUT:

##########
File path: flink-python/pyflink/fn_execution/operations.py
##########
@@ -500,6 +503,43 @@ def generate_func(self, serialized_fn) -> Tuple:
             self.keyed_state_backend)
         return func, [proc_func]
 
+    def open(self):
+        for user_defined_func in self.user_defined_funcs:
+            if hasattr(user_defined_func, 'open'):
+                runtime_context = KeyedProcessFunctionOperation.InternalRuntimeContext(
+                    self.spec.serialized_fn.runtime_context.task_name,
+                    self.spec.serialized_fn.runtime_context.task_name_with_subtasks,
+                    self.spec.serialized_fn.runtime_context.number_of_parallel_subtasks,
+                    self.spec.serialized_fn.runtime_context.max_number_of_parallel_subtasks,
+                    self.spec.serialized_fn.runtime_context.index_of_this_subtask,
+                    self.spec.serialized_fn.runtime_context.attempt_number,
+                    {p.key: p.value for p in
+                     self.spec.serialized_fn.runtime_context.job_parameters},
+                    self.keyed_state_backend)
+                user_defined_func.open(runtime_context)
+
+    class InternalRuntimeContext(RuntimeContext):

Review comment:
       The InternalRuntimeContext should be extracted to outer scope as other operations will use it in the future.

##########
File path: flink-python/pyflink/fn_execution/operations.py
##########
@@ -500,6 +503,43 @@ def generate_func(self, serialized_fn) -> Tuple:
             self.keyed_state_backend)
         return func, [proc_func]
 
+    def open(self):
+        for user_defined_func in self.user_defined_funcs:
+            if hasattr(user_defined_func, 'open'):
+                runtime_context = KeyedProcessFunctionOperation.InternalRuntimeContext(
+                    self.spec.serialized_fn.runtime_context.task_name,
+                    self.spec.serialized_fn.runtime_context.task_name_with_subtasks,
+                    self.spec.serialized_fn.runtime_context.number_of_parallel_subtasks,
+                    self.spec.serialized_fn.runtime_context.max_number_of_parallel_subtasks,
+                    self.spec.serialized_fn.runtime_context.index_of_this_subtask,
+                    self.spec.serialized_fn.runtime_context.attempt_number,
+                    {p.key: p.value for p in
+                     self.spec.serialized_fn.runtime_context.job_parameters},
+                    self.keyed_state_backend)
+                user_defined_func.open(runtime_context)
+
+    class InternalRuntimeContext(RuntimeContext):
+
+        def __init__(self, task_name: str, task_name_with_subtasks: str,
+                     number_of_parallel_subtasks: int, max_number_of_parallel_subtasks: int,
+                     index_of_this_subtask: int, attempt_number: int,
+                     job_parameters: Dict[str, str], keyed_state_backend: RemoteKeyedStateBackend):
+            super(KeyedProcessFunctionOperation.InternalRuntimeContext, self).__init__(
+                task_name, task_name_with_subtasks, number_of_parallel_subtasks,
+                max_number_of_parallel_subtasks, index_of_this_subtask, attempt_number,
+                job_parameters)
+            self.keyed_state_backend = keyed_state_backend

Review comment:
       The private member should have a "_" prefix. Users can touch the instance of this class in their code so we need to eliminate unnecessary confusion.




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

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



[GitHub] [flink] shuiqiangchen commented on a change in pull request #14758: [FLINK-21112][python] Add ValueState/ListState/MapState and corresponding StateDescriptors for Python DataStream API

Posted by GitBox <gi...@apache.org>.
shuiqiangchen commented on a change in pull request #14758:
URL: https://github.com/apache/flink/pull/14758#discussion_r566696591



##########
File path: flink-python/pyflink/fn_execution/operation_utils.py
##########
@@ -310,7 +310,7 @@ def wrapped_keyed_process_function(value):
             on_timer_ctx.set_timestamp(value[1])
             on_timer_ctx.timer_service().set_current_watermark(value[2])
             current_key = value[3]
-            on_timer_ctx.set_current_key(current_key)
+            on_timer_ctx.set_current_key(current_key[0])

Review comment:
       The `current_key` is a Row that is wrapped in java operator before sending it to python process, therefore we need to unwrap it before setting to the `on_timer_ctx`. 




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

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



[GitHub] [flink] shuiqiangchen commented on a change in pull request #14758: [FLINK-21112][python] Add ValueState/ListState/MapState and corresponding StateDescriptors for Python DataStream API

Posted by GitBox <gi...@apache.org>.
shuiqiangchen commented on a change in pull request #14758:
URL: https://github.com/apache/flink/pull/14758#discussion_r566697754



##########
File path: flink-python/pyflink/common/state.py
##########
@@ -67,33 +71,56 @@ def update(self, value: T) -> None:
         pass
 
 
-class ListState(State, Generic[T]):
+class AppendingState(State, Generic[IN, OUT]):
     """
-    :class:`State` interface for partitioned list state in Operations.
-    The state is accessed and modified by user functions, and checkpointed consistently
-    by the system as part of the distributed snapshots.
+    Base interface for partitioned state taht supports adding elements and inspecting the current
+    state. Elements can either be kept in a buffer (list-like) or aggregated into one value.
 
-    Currently only keyed list state is supported.
+    This state is accessed and modified by user functions, and checkpointed consistently by the
+    system as part of the distributed snapshots.
 
-    When it is a keyed list state, the state key is automatically supplied by the system, so the
-    user function always sees the value mapped to the key of the current element. That way, the
-    system can handle stream and state partitioning consistently together.
+    The state is only accessible by functions applied on a KeyedStream. The key is automatically
+    supplied by the system, so the function always sees the value mapped to the key of the current
+    element. That way, the system can handle stream and state partitioning consistently together.
     """
 
     @abstractmethod
-    def get(self) -> Iterable[T]:
+    def get(self) -> OUT:
         """
         Returns the elements under the current key.
         """
         pass
 
     @abstractmethod
-    def add(self, value: T) -> None:
+    def add(self, value: IN) -> None:
         """
         Adding the given value to the tail of this list state.
         """
         pass
 
+
+class MergingState(AppendingState[IN, OUT]):
+    """
+    Extension of AppendingState that allows merging of state. That is, two instance of MergingState
+    can be combined into a single instance that contains all the information of the two merged
+    states.
+    """
+    pass
+
+
+class ListState(MergingState[T, Iterable[T]]):

Review comment:
       since users can not directly new a State, I think we should not export these classes.




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

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



[GitHub] [flink] dianfu commented on a change in pull request #14758: [FLINK-21112][python] Add ValueState/ListState/MapState and corresponding StateDescriptors for Python DataStream API

Posted by GitBox <gi...@apache.org>.
dianfu commented on a change in pull request #14758:
URL: https://github.com/apache/flink/pull/14758#discussion_r567399024



##########
File path: flink-python/pyflink/common/state.py
##########
@@ -19,9 +19,22 @@
 
 from typing import TypeVar, Generic, Iterable, List, Iterator, Dict, Tuple
 
+from pyflink.common.typeinfo import TypeInformation, Types
+
+__all__ = [
+    'ValueStateDescriptor',
+    'ValueState',
+    'ListStateDescriptor',
+    'ListState',
+    'MapStateDescriptor',
+    'MergingState'

Review comment:
       I guess it should be MapState.




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

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



[GitHub] [flink] shuiqiangchen commented on a change in pull request #14758: [FLINK-21112][python] Add ValueState/ListState/MapState and corresponding StateDescriptors for Python DataStream API

Posted by GitBox <gi...@apache.org>.
shuiqiangchen commented on a change in pull request #14758:
URL: https://github.com/apache/flink/pull/14758#discussion_r566696591



##########
File path: flink-python/pyflink/fn_execution/operation_utils.py
##########
@@ -310,7 +310,7 @@ def wrapped_keyed_process_function(value):
             on_timer_ctx.set_timestamp(value[1])
             on_timer_ctx.timer_service().set_current_watermark(value[2])
             current_key = value[3]
-            on_timer_ctx.set_current_key(current_key)
+            on_timer_ctx.set_current_key(current_key[0])

Review comment:
       The `current_key` is a Row that is wrapped in java operator before sending it to python process, therefore we need to unwrap it and set the original key data to the `on_timer_ctx`. 




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

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



[GitHub] [flink] flinkbot edited a comment on pull request #14758: [FLINK-21112][python] Add ValueState/ListState/MapState and corresponding StateDescriptors for Python DataStream API

Posted by GitBox <gi...@apache.org>.
flinkbot edited a comment on pull request #14758:
URL: https://github.com/apache/flink/pull/14758#issuecomment-767522160


   <!--
   Meta data
   {
     "version" : 1,
     "metaDataEntries" : [ {
       "hash" : "fbe57c797c3fc1623892afae812701eb06ea8676",
       "status" : "DELETED",
       "url" : "https://dev.azure.com/apache-flink/98463496-1af2-4620-8eab-a2ecc1a2e6fe/_build/results?buildId=12510",
       "triggerID" : "fbe57c797c3fc1623892afae812701eb06ea8676",
       "triggerType" : "PUSH"
     }, {
       "hash" : "0afefe95b5f1f7a94e3245c77ccd170fb04c9fa9",
       "status" : "UNKNOWN",
       "url" : "TBD",
       "triggerID" : "0afefe95b5f1f7a94e3245c77ccd170fb04c9fa9",
       "triggerType" : "PUSH"
     }, {
       "hash" : "c9ac6bd3ff2afb28ce3f9d686a9d7c14f431fb64",
       "status" : "SUCCESS",
       "url" : "https://dev.azure.com/apache-flink/98463496-1af2-4620-8eab-a2ecc1a2e6fe/_build/results?buildId=12631",
       "triggerID" : "c9ac6bd3ff2afb28ce3f9d686a9d7c14f431fb64",
       "triggerType" : "PUSH"
     }, {
       "hash" : "b55612a0af52ea2acd48c29908b77d2080349d5f",
       "status" : "PENDING",
       "url" : "https://dev.azure.com/apache-flink/98463496-1af2-4620-8eab-a2ecc1a2e6fe/_build/results?buildId=12634",
       "triggerID" : "b55612a0af52ea2acd48c29908b77d2080349d5f",
       "triggerType" : "PUSH"
     } ]
   }-->
   ## CI report:
   
   * 0afefe95b5f1f7a94e3245c77ccd170fb04c9fa9 UNKNOWN
   * c9ac6bd3ff2afb28ce3f9d686a9d7c14f431fb64 Azure: [SUCCESS](https://dev.azure.com/apache-flink/98463496-1af2-4620-8eab-a2ecc1a2e6fe/_build/results?buildId=12631) 
   * b55612a0af52ea2acd48c29908b77d2080349d5f Azure: [PENDING](https://dev.azure.com/apache-flink/98463496-1af2-4620-8eab-a2ecc1a2e6fe/_build/results?buildId=12634) 
   
   <details>
   <summary>Bot commands</summary>
     The @flinkbot bot supports the following commands:
   
    - `@flinkbot run travis` re-run the last Travis build
    - `@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.

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



[GitHub] [flink] shuiqiangchen commented on a change in pull request #14758: [FLINK-21112][python] Add ValueState/ListState/MapState and corresponding StateDescriptors for Python DataStream API

Posted by GitBox <gi...@apache.org>.
shuiqiangchen commented on a change in pull request #14758:
URL: https://github.com/apache/flink/pull/14758#discussion_r566704664



##########
File path: flink-python/pyflink/common/state.py
##########
@@ -67,33 +71,56 @@ def update(self, value: T) -> None:
         pass
 
 
-class ListState(State, Generic[T]):
+class AppendingState(State, Generic[IN, OUT]):
     """
-    :class:`State` interface for partitioned list state in Operations.
-    The state is accessed and modified by user functions, and checkpointed consistently
-    by the system as part of the distributed snapshots.
+    Base interface for partitioned state taht supports adding elements and inspecting the current
+    state. Elements can either be kept in a buffer (list-like) or aggregated into one value.
 
-    Currently only keyed list state is supported.
+    This state is accessed and modified by user functions, and checkpointed consistently by the
+    system as part of the distributed snapshots.
 
-    When it is a keyed list state, the state key is automatically supplied by the system, so the
-    user function always sees the value mapped to the key of the current element. That way, the
-    system can handle stream and state partitioning consistently together.
+    The state is only accessible by functions applied on a KeyedStream. The key is automatically
+    supplied by the system, so the function always sees the value mapped to the key of the current
+    element. That way, the system can handle stream and state partitioning consistently together.
     """
 
     @abstractmethod
-    def get(self) -> Iterable[T]:
+    def get(self) -> OUT:
         """
         Returns the elements under the current key.
         """
         pass
 
     @abstractmethod
-    def add(self, value: T) -> None:
+    def add(self, value: IN) -> None:
         """
         Adding the given value to the tail of this list state.
         """
         pass
 
+
+class MergingState(AppendingState[IN, OUT]):
+    """
+    Extension of AppendingState that allows merging of state. That is, two instance of MergingState
+    can be combined into a single instance that contains all the information of the two merged
+    states.
+    """
+    pass
+
+
+class ListState(MergingState[T, Iterable[T]]):

Review comment:
       Ok, I will add them in the next commit.




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

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



[GitHub] [flink] dianfu closed pull request #14758: [FLINK-21112][python] Add ValueState/ListState/MapState and corresponding StateDescriptors for Python DataStream API

Posted by GitBox <gi...@apache.org>.
dianfu closed pull request #14758:
URL: https://github.com/apache/flink/pull/14758


   


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

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



[GitHub] [flink] flinkbot edited a comment on pull request #14758: [FLINK-21112][python] Add ValueState/ListState/MapState and corresponding StateDescriptors for Python DataStream API

Posted by GitBox <gi...@apache.org>.
flinkbot edited a comment on pull request #14758:
URL: https://github.com/apache/flink/pull/14758#issuecomment-767522160


   <!--
   Meta data
   {
     "version" : 1,
     "metaDataEntries" : [ {
       "hash" : "fbe57c797c3fc1623892afae812701eb06ea8676",
       "status" : "SUCCESS",
       "url" : "https://dev.azure.com/apache-flink/98463496-1af2-4620-8eab-a2ecc1a2e6fe/_build/results?buildId=12510",
       "triggerID" : "fbe57c797c3fc1623892afae812701eb06ea8676",
       "triggerType" : "PUSH"
     }, {
       "hash" : "0afefe95b5f1f7a94e3245c77ccd170fb04c9fa9",
       "status" : "UNKNOWN",
       "url" : "TBD",
       "triggerID" : "0afefe95b5f1f7a94e3245c77ccd170fb04c9fa9",
       "triggerType" : "PUSH"
     } ]
   }-->
   ## CI report:
   
   * fbe57c797c3fc1623892afae812701eb06ea8676 Azure: [SUCCESS](https://dev.azure.com/apache-flink/98463496-1af2-4620-8eab-a2ecc1a2e6fe/_build/results?buildId=12510) 
   * 0afefe95b5f1f7a94e3245c77ccd170fb04c9fa9 UNKNOWN
   
   <details>
   <summary>Bot commands</summary>
     The @flinkbot bot supports the following commands:
   
    - `@flinkbot run travis` re-run the last Travis build
    - `@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.

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



[GitHub] [flink] flinkbot edited a comment on pull request #14758: [FLINK-21112][python] Add ValueState/ListState/MapState and corresponding StateDescriptors for Python DataStream API

Posted by GitBox <gi...@apache.org>.
flinkbot edited a comment on pull request #14758:
URL: https://github.com/apache/flink/pull/14758#issuecomment-767522160


   <!--
   Meta data
   {
     "version" : 1,
     "metaDataEntries" : [ {
       "hash" : "fbe57c797c3fc1623892afae812701eb06ea8676",
       "status" : "SUCCESS",
       "url" : "https://dev.azure.com/apache-flink/98463496-1af2-4620-8eab-a2ecc1a2e6fe/_build/results?buildId=12510",
       "triggerID" : "fbe57c797c3fc1623892afae812701eb06ea8676",
       "triggerType" : "PUSH"
     }, {
       "hash" : "0afefe95b5f1f7a94e3245c77ccd170fb04c9fa9",
       "status" : "UNKNOWN",
       "url" : "TBD",
       "triggerID" : "0afefe95b5f1f7a94e3245c77ccd170fb04c9fa9",
       "triggerType" : "PUSH"
     }, {
       "hash" : "c9ac6bd3ff2afb28ce3f9d686a9d7c14f431fb64",
       "status" : "PENDING",
       "url" : "https://dev.azure.com/apache-flink/98463496-1af2-4620-8eab-a2ecc1a2e6fe/_build/results?buildId=12631",
       "triggerID" : "c9ac6bd3ff2afb28ce3f9d686a9d7c14f431fb64",
       "triggerType" : "PUSH"
     }, {
       "hash" : "b55612a0af52ea2acd48c29908b77d2080349d5f",
       "status" : "PENDING",
       "url" : "https://dev.azure.com/apache-flink/98463496-1af2-4620-8eab-a2ecc1a2e6fe/_build/results?buildId=12634",
       "triggerID" : "b55612a0af52ea2acd48c29908b77d2080349d5f",
       "triggerType" : "PUSH"
     } ]
   }-->
   ## CI report:
   
   * fbe57c797c3fc1623892afae812701eb06ea8676 Azure: [SUCCESS](https://dev.azure.com/apache-flink/98463496-1af2-4620-8eab-a2ecc1a2e6fe/_build/results?buildId=12510) 
   * 0afefe95b5f1f7a94e3245c77ccd170fb04c9fa9 UNKNOWN
   * c9ac6bd3ff2afb28ce3f9d686a9d7c14f431fb64 Azure: [PENDING](https://dev.azure.com/apache-flink/98463496-1af2-4620-8eab-a2ecc1a2e6fe/_build/results?buildId=12631) 
   * b55612a0af52ea2acd48c29908b77d2080349d5f Azure: [PENDING](https://dev.azure.com/apache-flink/98463496-1af2-4620-8eab-a2ecc1a2e6fe/_build/results?buildId=12634) 
   
   <details>
   <summary>Bot commands</summary>
     The @flinkbot bot supports the following commands:
   
    - `@flinkbot run travis` re-run the last Travis build
    - `@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.

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



[GitHub] [flink] flinkbot edited a comment on pull request #14758: [FLINK-21112][python] Add ValueState/ListState/MapState and corresponding StateDescriptors for Python DataStream API

Posted by GitBox <gi...@apache.org>.
flinkbot edited a comment on pull request #14758:
URL: https://github.com/apache/flink/pull/14758#issuecomment-767522160


   <!--
   Meta data
   {
     "version" : 1,
     "metaDataEntries" : [ {
       "hash" : "fbe57c797c3fc1623892afae812701eb06ea8676",
       "status" : "DELETED",
       "url" : "https://dev.azure.com/apache-flink/98463496-1af2-4620-8eab-a2ecc1a2e6fe/_build/results?buildId=12510",
       "triggerID" : "fbe57c797c3fc1623892afae812701eb06ea8676",
       "triggerType" : "PUSH"
     }, {
       "hash" : "0afefe95b5f1f7a94e3245c77ccd170fb04c9fa9",
       "status" : "UNKNOWN",
       "url" : "TBD",
       "triggerID" : "0afefe95b5f1f7a94e3245c77ccd170fb04c9fa9",
       "triggerType" : "PUSH"
     }, {
       "hash" : "c9ac6bd3ff2afb28ce3f9d686a9d7c14f431fb64",
       "status" : "DELETED",
       "url" : "https://dev.azure.com/apache-flink/98463496-1af2-4620-8eab-a2ecc1a2e6fe/_build/results?buildId=12631",
       "triggerID" : "c9ac6bd3ff2afb28ce3f9d686a9d7c14f431fb64",
       "triggerType" : "PUSH"
     }, {
       "hash" : "b55612a0af52ea2acd48c29908b77d2080349d5f",
       "status" : "SUCCESS",
       "url" : "https://dev.azure.com/apache-flink/98463496-1af2-4620-8eab-a2ecc1a2e6fe/_build/results?buildId=12634",
       "triggerID" : "b55612a0af52ea2acd48c29908b77d2080349d5f",
       "triggerType" : "PUSH"
     }, {
       "hash" : "2af7a109f695bda25b7649b3fab68898b284dbeb",
       "status" : "UNKNOWN",
       "url" : "TBD",
       "triggerID" : "2af7a109f695bda25b7649b3fab68898b284dbeb",
       "triggerType" : "PUSH"
     } ]
   }-->
   ## CI report:
   
   * 0afefe95b5f1f7a94e3245c77ccd170fb04c9fa9 UNKNOWN
   * b55612a0af52ea2acd48c29908b77d2080349d5f Azure: [SUCCESS](https://dev.azure.com/apache-flink/98463496-1af2-4620-8eab-a2ecc1a2e6fe/_build/results?buildId=12634) 
   * 2af7a109f695bda25b7649b3fab68898b284dbeb UNKNOWN
   
   <details>
   <summary>Bot commands</summary>
     The @flinkbot bot supports the following commands:
   
    - `@flinkbot run travis` re-run the last Travis build
    - `@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.

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



[GitHub] [flink] flinkbot edited a comment on pull request #14758: [FLINK-21112][python] Add ValueState/ListState/MapState and corresponding StateDescriptors for Python DataStream API

Posted by GitBox <gi...@apache.org>.
flinkbot edited a comment on pull request #14758:
URL: https://github.com/apache/flink/pull/14758#issuecomment-767522160


   <!--
   Meta data
   {
     "version" : 1,
     "metaDataEntries" : [ {
       "hash" : "fbe57c797c3fc1623892afae812701eb06ea8676",
       "status" : "SUCCESS",
       "url" : "https://dev.azure.com/apache-flink/98463496-1af2-4620-8eab-a2ecc1a2e6fe/_build/results?buildId=12510",
       "triggerID" : "fbe57c797c3fc1623892afae812701eb06ea8676",
       "triggerType" : "PUSH"
     }, {
       "hash" : "0afefe95b5f1f7a94e3245c77ccd170fb04c9fa9",
       "status" : "UNKNOWN",
       "url" : "TBD",
       "triggerID" : "0afefe95b5f1f7a94e3245c77ccd170fb04c9fa9",
       "triggerType" : "PUSH"
     }, {
       "hash" : "c9ac6bd3ff2afb28ce3f9d686a9d7c14f431fb64",
       "status" : "UNKNOWN",
       "url" : "TBD",
       "triggerID" : "c9ac6bd3ff2afb28ce3f9d686a9d7c14f431fb64",
       "triggerType" : "PUSH"
     } ]
   }-->
   ## CI report:
   
   * fbe57c797c3fc1623892afae812701eb06ea8676 Azure: [SUCCESS](https://dev.azure.com/apache-flink/98463496-1af2-4620-8eab-a2ecc1a2e6fe/_build/results?buildId=12510) 
   * 0afefe95b5f1f7a94e3245c77ccd170fb04c9fa9 UNKNOWN
   * c9ac6bd3ff2afb28ce3f9d686a9d7c14f431fb64 UNKNOWN
   
   <details>
   <summary>Bot commands</summary>
     The @flinkbot bot supports the following commands:
   
    - `@flinkbot run travis` re-run the last Travis build
    - `@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.

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



[GitHub] [flink] flinkbot edited a comment on pull request #14758: [FLINK-21112][python] Add ValueState/ListState/MapState and corresponding StateDescriptors for Python DataStream API

Posted by GitBox <gi...@apache.org>.
flinkbot edited a comment on pull request #14758:
URL: https://github.com/apache/flink/pull/14758#issuecomment-767518245


   Thanks a lot for your contribution to the Apache Flink project. I'm the @flinkbot. I help the community
   to review your pull request. We will use this comment to track the progress of the review.
   
   
   ## Automated Checks
   Last check on commit 2af7a109f695bda25b7649b3fab68898b284dbeb (Fri May 28 08:15:16 UTC 2021)
   
   **Warnings:**
    * No documentation files were touched! Remember to keep the Flink docs up to date!
   
   
   <sub>Mention the bot in a comment to re-run the automated checks.</sub>
   ## Review Progress
   
   * ❓ 1. The [description] looks good.
   * ❓ 2. There is [consensus] that the contribution should go into to Flink.
   * ❓ 3. Needs [attention] from.
   * ❓ 4. The change fits into the overall [architecture].
   * ❓ 5. Overall code [quality] is good.
   
   Please see the [Pull Request Review Guide](https://flink.apache.org/contributing/reviewing-prs.html) for a full explanation of the review process.<details>
    The Bot is tracking the review progress through labels. Labels are applied according to the order of the review items. For consensus, approval by a Flink committer of PMC member is required <summary>Bot commands</summary>
     The @flinkbot bot supports the following commands:
   
    - `@flinkbot approve description` to approve one or more aspects (aspects: `description`, `consensus`, `architecture` and `quality`)
    - `@flinkbot approve all` to approve all aspects
    - `@flinkbot approve-until architecture` to approve everything until `architecture`
    - `@flinkbot attention @username1 [@username2 ..]` to require somebody's attention
    - `@flinkbot disapprove architecture` to remove an approval you gave earlier
   </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.

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



[GitHub] [flink] dianfu commented on a change in pull request #14758: [FLINK-21112][python] Add ValueState/ListState/MapState and corresponding StateDescriptors for Python DataStream API

Posted by GitBox <gi...@apache.org>.
dianfu commented on a change in pull request #14758:
URL: https://github.com/apache/flink/pull/14758#discussion_r567399024



##########
File path: flink-python/pyflink/common/state.py
##########
@@ -19,9 +19,22 @@
 
 from typing import TypeVar, Generic, Iterable, List, Iterator, Dict, Tuple
 
+from pyflink.common.typeinfo import TypeInformation, Types
+
+__all__ = [
+    'ValueStateDescriptor',
+    'ValueState',
+    'ListStateDescriptor',
+    'ListState',
+    'MapStateDescriptor',
+    'MergingState'

Review comment:
       I guess it should be MapState?




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

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