xuyangzhong commented on code in PR #24179:
URL: https://github.com/apache/flink/pull/24179#discussion_r1466314159


##########
flink-table/flink-table-planner/src/main/java/org/apache/flink/table/planner/hint/StateTtlHint.java:
##########
@@ -87,4 +91,28 @@ public static Map<Integer, Long> 
getStateTtlFromHint(List<RelHint> hints) {
 
         return stateTtlFromHint;
     }
+
+    /**
+     * Get the state ttl from hints on the {@link 
org.apache.calcite.rel.SingleRel} such as
+     * Aggregate.
+     *
+     * @return the state ttl in milliseconds. If no state ttl hints set from 
hint, return "null".
+     */
+    @Nullable
+    public static Long getStateTtlFromHintOnSingleRel(List<RelHint> hints) {
+        AtomicReference<Long> stateTtlFromHint = new AtomicReference<>(null);
+        hints.stream()
+                .filter(hint -> StateTtlHint.isStateTtlHint(hint.hintName))
+                .forEach(
+                        hint ->
+                                hint.kvOptions.forEach(
+                                        (input, ttl) -> {
+                                            if 
(FlinkHints.INPUT.equals(input)) {
+                                                stateTtlFromHint.set(
+                                                        
TimeUtils.parseDuration(ttl).toMillis());
+                                            }
+                                        }));
+
+        return stateTtlFromHint.get();

Review Comment:
   I'll modify the code to return null if the list is empty.



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

Reply via email to