Class ObjectOfTypeStrategy

  • All Implemented Interfaces:
    TypeStrategy

    @Internal
    public class ObjectOfTypeStrategy
    extends Object
    implements TypeStrategy
    Type strategy for the OBJECT_OF function that infers the output type as a structured type.

    This strategy creates a DataTypes.STRUCTURED(java.lang.Class<?>, org.apache.flink.table.api.DataTypes.Field...) type based on the provided class name and key-value pairs. The function signature is: OBJECT_OF(className, key1, value1, key2, value2, ...)

    The strategy performs the following operations:

    • Extracts the class name from the first argument (must be a non-null string literal)
    • Processes key-value pairs starting from the second argument
    • Extracts field names (keys) from odd-positioned arguments (indices 1, 3, 5, ...)

    Examples:

    • OBJECT_OF('com.example.User', 'name', 'Alice', 'age', 30) STRUCTURED<com.example.User>(name CHAR(5), age INT)
    • OBJECT_OF('com.example.Point', 'x', 1.5, 'y', 2.0) STRUCTURED<com.example.Point>(x DOUBLE, y DOUBLE)
    See Also:
    BuiltInFunctionDefinitions.OBJECT_OF, ObjectOfInputTypeStrategy