libenchao 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_r407157392
 
 

 ##########
 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:
   `if (ttlConfig.isEnabled()) {`
   we always add a space before `{`

----------------------------------------------------------------
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:
us...@infra.apache.org


With regards,
Apache Git Services

Reply via email to