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 2020/04/12 07:23:09 UTC

[GitHub] [flink] lsyldliu commented on a change in pull request #11482: [FLINK-16581][table] Minibatch deduplication lack state TTL bug fix

lsyldliu commented on a change in pull request #11482: [FLINK-16581][table] Minibatch deduplication lack state TTL bug fix
URL: https://github.com/apache/flink/pull/11482#discussion_r407158794
 
 

 ##########
 File path: flink-table/flink-table-runtime-blink/src/main/java/org/apache/flink/table/runtime/operators/deduplicate/MiniBatchDeduplicateKeepFirstRowFunction.java
 ##########
 @@ -42,18 +44,25 @@
 	private static final long serialVersionUID = -7994602893547654994L;
 
 	private final TypeSerializer<BaseRow> typeSerializer;
-
+	private final long minRetentionTime;
+	private final boolean stateCleaningEnabled;
 	// state stores a boolean flag to indicate whether key appears before.
 	private ValueState<Boolean> state;
 
-	public MiniBatchDeduplicateKeepFirstRowFunction(TypeSerializer<BaseRow> typeSerializer) {
+	public MiniBatchDeduplicateKeepFirstRowFunction(TypeSerializer<BaseRow> typeSerializer, long minRetentionTime) {
+		this.minRetentionTime = minRetentionTime;
+		stateCleaningEnabled = minRetentionTime > 1;
 		this.typeSerializer = typeSerializer;
 	}
 
 	@Override
 	public void open(ExecutionContext ctx) throws Exception {
 		super.open(ctx);
 		ValueStateDescriptor<Boolean> stateDesc = new ValueStateDescriptor<>("existsState", Types.BOOLEAN);
+		StateTtlConfig ttlConfig = createTtlConfig(minRetentionTime, stateCleaningEnabled);
+		if (ttlConfig.isEnabled()){
 
 Review comment:
   got 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.
 
For queries about this service, please contact Infrastructure at:
users@infra.apache.org


With regards,
Apache Git Services