You are viewing a plain text version of this content. The canonical link for it is here.
Posted to dev@flink.apache.org by "Jianhui Dong (Jira)" <ji...@apache.org> on 2022/03/19 11:13:00 UTC

[jira] [Created] (FLINK-26738) Default value of StateDescriptor is valid when enable state ttl config

Jianhui Dong created FLINK-26738:
------------------------------------

             Summary: Default value of StateDescriptor is valid when enable state ttl config
                 Key: FLINK-26738
                 URL: https://issues.apache.org/jira/browse/FLINK-26738
             Project: Flink
          Issue Type: Bug
          Components: API / Core
    Affects Versions: 1.15.0
            Reporter: Jianhui Dong


Suppose we declare a ValueState like following:

{code:java}
ValueStateDescriptor<Tuple2<Long, Long>> descriptor =
                new ValueStateDescriptor<>(
                        "average", // the state name
                        TypeInformation.of(new TypeHint<Tuple2<Long, Long>>() {}),  
                        Tuple2.of(0L, 0L)); 
{code}

and then we add state ttl config to the state:

{code:java}
descriptor.enableTimeToLive(StateTtlConfigUtil.createTtlConfig(60000));
{code}

the default value Tuple2.of(0L, 0L) will be invalid and may cause NPE.




--
This message was sent by Atlassian Jira
(v8.20.1#820001)