Enum ArgumentTrait

java.lang.Object
java.lang.Enum<ArgumentTrait>
org.apache.flink.table.annotation.ArgumentTrait
All Implemented Interfaces:
Serializable, Comparable<ArgumentTrait>

@PublicEvolving public enum ArgumentTrait extends Enum<ArgumentTrait>
Declares traits for ArgumentHint. They enable basic validation by the framework.

Some traits have dependencies to other traits, which is why this enum reflects a hierarchy in which SCALAR, TABLE_AS_ROW, and TABLE_AS_SET are the top-level roots.

  • Enum Constant Details

    • SCALAR

      public static final ArgumentTrait SCALAR
      An argument that accepts a scalar value. For example: f(1), f(true), f('Some string').

      It's the default if no ArgumentHint is provided.

    • TABLE_AS_ROW

      public static final ArgumentTrait TABLE_AS_ROW
      An argument that accepts a table "as row" (i.e. with row semantics). This trait only applies to ProcessTableFunction (PTF).

      For scalability, input tables are distributed across so-called "virtual processors". A virtual processor, as defined by the SQL standard, executes a PTF instance and has access only to a portion of the entire table. The argument declaration decides about the size of the portion and co-location of data. Conceptually, tables can be processed either "as row" (i.e. with row semantics) or "as set" (i.e. with set semantics).

      A table with row semantics assumes that there is no correlation between rows and each row can be processed independently. The framework is free in how to distribute rows across virtual processors and each virtual processor has access only to the currently processed row.

    • TABLE_AS_SET

      public static final ArgumentTrait TABLE_AS_SET
      An argument that accepts a table "as set" (i.e. with set semantics). This trait only applies to ProcessTableFunction (PTF).

      For scalability, input tables are distributed across so-called "virtual processors". A virtual processor, as defined by the SQL standard, executes a PTF instance and has access only to a portion of the entire table. The argument declaration decides about the size of the portion and co-location of data. Conceptually, tables can be processed either "as row" (i.e. with row semantics) or "as set" (i.e. with set semantics).

      A table with set semantics assumes that there is a correlation between rows. When calling the function, the PARTITION BY clause defines the columns for correlation. The framework ensures that all rows belonging to same set are co-located. A PTF instance is able to access all rows belonging to the same set. In other words: The virtual processor is scoped by a key context.

      It is also possible not to provide a key (OPTIONAL_PARTITION_BY), in which case only one virtual processor handles the entire table, thereby losing scalability benefits.

    • OPTIONAL_PARTITION_BY

      public static final ArgumentTrait OPTIONAL_PARTITION_BY
      Defines that a PARTITION BY clause is optional for TABLE_AS_SET. By default, it is mandatory for improving the parallel execution by distributing the table by key.
    • PASS_COLUMNS_THROUGH

      public static final ArgumentTrait PASS_COLUMNS_THROUGH
      Defines that all columns of a table argument (i.e. TABLE_AS_ROW or TABLE_AS_SET) are included in the output of the PTF. By default, only columns of the PARTITION BY clause are passed through.

      Given a table t (containing columns k and v), and a PTF f() (producing columns c1 and c2), the output of a SELECT * FROM f(tableArg => TABLE t PARTITION BY k) uses the following order:

           Default: | k | c1 | c2 |
           With pass-through columns: | k | v | c1 | c2 |
       

      In case of multiple table arguments, pass-through columns are added according to the declaration order in the PTF signature.

  • Method Details

    • values

      public static ArgumentTrait[] values()
      Returns an array containing the constants of this enum type, in the order they are declared.
      Returns:
      an array containing the constants of this enum type, in the order they are declared
    • valueOf

      public static ArgumentTrait valueOf(String name)
      Returns the enum constant of this type with the specified name. The string must match exactly an identifier used to declare an enum constant in this type. (Extraneous whitespace characters are not permitted.)
      Parameters:
      name - the name of the enum constant to be returned.
      Returns:
      the enum constant with the specified name
      Throws:
      IllegalArgumentException - if this enum type has no constant with the specified name
      NullPointerException - if the argument is null
    • isRoot

      public boolean isRoot()
    • toStaticTrait

      public StaticArgumentTrait toStaticTrait()