dianfu commented on a change in pull request #15575:
URL: https://github.com/apache/flink/pull/15575#discussion_r611568620



##########
File path: flink-python/pyflink/fn_execution/timerservice_impl.py
##########
@@ -59,6 +69,7 @@ def __init__(self, keyed_state_backend: 
RemoteKeyedStateBackend):
         self._keyed_state_backend = keyed_state_backend
         self._current_watermark = None
         self.timers = []  # type: List[Tuple[TimerOperandType, InternalTimer]]
+        self._exist_timers = set()  # type: Set[Tuple[TimerOperandType, 
InternalTimer]]

Review comment:
       ```suggestion
           self._existing_timers = set()  # type: Set[Tuple[TimerOperandType, 
InternalTimer]]
   ```

##########
File path: flink-python/pyflink/fn_execution/timerservice_impl.py
##########
@@ -42,6 +42,16 @@ def get_key(self) -> K:
     def get_namespace(self) -> N:
         return self._namespace
 
+    def __hash__(self):
+        result = int(self._timestamp ^ (self._timestamp >> 32))

Review comment:
       What about cached the calculated hash value?

##########
File path: flink-python/pyflink/fn_execution/timerservice_impl.py
##########
@@ -59,6 +69,7 @@ def __init__(self, keyed_state_backend: 
RemoteKeyedStateBackend):
         self._keyed_state_backend = keyed_state_backend
         self._current_watermark = None
         self.timers = []  # type: List[Tuple[TimerOperandType, InternalTimer]]
+        self._exist_timers = set()  # type: Set[Tuple[TimerOperandType, 
InternalTimer]]

Review comment:
       What about change the type of timers to OrderedDict, then we can avoid 
to introduce _exist_timers.




-- 
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:
[email protected]


Reply via email to