Annotation Type StateHint


@PublicEvolving @Retention(RUNTIME) @Target({TYPE,METHOD,PARAMETER}) public @interface StateHint
A hint that declares an intermediate result (i.e. state entry) that is managed by the framework (i.e. Flink managed state).

State hints are primarily intended for ProcessTableFunction. A PTF supports multiple state entries at the beginning of an eval()/onTimer() method (after an optional context parameter).

Aggregating functions (i.e. AggregateFunction and TableAggregateFunction) support a single state entry at the beginning of an accumulate()/retract() method (i.e. the accumulator).

For example, @StateHint(name = "count", type = @DataTypeHint("BIGINT")) is a state entry with the data type BIGINT named "count".

Note: Usually, a state entry is partitioned by a key and can not be accessed globally. The partitioning (or whether it is only a single partition) is defined by the corresponding function call.

See Also:
  • Optional Element Summary

    Optional Elements
    Modifier and Type
    Optional Element
    Description
    The name of the state entry.
    The data type hint for the state entry.
  • Element Details

    • name

      String name
      The name of the state entry. It must be unique among other state entries.

      This can be used to provide a descriptive name for the state entry. The name can be used for referencing the entry during clean up.

      Default:
      ""
    • type

      The data type hint for the state entry.

      This can be used to provide additional information about the expected data type of the argument. The DataTypeHint annotation can be used to specify the data type explicitly or provide hints for the reflection-based extraction of the data type.

      Default:
      @org.apache.flink.table.annotation.DataTypeHint