dianfu commented on a change in pull request #16667:
URL: https://github.com/apache/flink/pull/16667#discussion_r686607042
##########
File path:
flink-python/src/main/java/org/apache/flink/streaming/api/utils/ProtoUtils.java
##########
@@ -306,4 +361,40 @@
builder.setSeparatedWithEndMessage(separatedWithEndMessage);
return builder.build();
}
+
+ private static StateTtlConfig.UpdateType parseUpdateTypeFromProto(
Review comment:
Group these methods together?
##########
File path: flink-python/pyflink/datastream/state.py
##########
@@ -402,3 +417,494 @@ def __init__(self,
def get_agg_function(self):
return self._agg_function
+
+
+class StateTtlConfig(object):
+ class UpdateType(Enum):
+ """
+ This option value configures when to update last access timestamp
which prolongs state TTL.
+ """
+
+ Disabled = 0
+ """
+ TTL is disabled. State does not expire.
+ """
+
+ OnCreateAndWrite = 1
+ """
+ Last access timestamp is initialised when state is created and updated
on every write
+ operation.
+ """
+
+ OnReadAndWrite = 2
+ """
+ The same as OnCreateAndWrite but also updated on read.
+ """
+
+ def _to_proto(self):
+ from pyflink.fn_execution.flink_fn_execution_pb2 import
StateDescriptor
Review comment:
The implementaion of _to_proto and _from_proto could be simplified.
Could refer to RuntimeExecutionMode as an example.
##########
File path:
flink-python/src/main/java/org/apache/flink/streaming/api/runners/python/beam/SimpleStateRequestHandler.java
##########
@@ -597,6 +612,13 @@
mapStateDescriptor =
new MapStateDescriptor<>(
stateName, ByteArrayWrapperSerializer.INSTANCE,
valueSerializer);
+ if (stateDescriptor.hasStateTtlConfig()) {
Review comment:
The state ttl config is transferred in each state request. Is it
possible to optimize it?
--
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]