Class ObjectOfTypeStrategy
- java.lang.Object
-
- org.apache.flink.table.types.inference.strategies.ObjectOfTypeStrategy
-
- All Implemented Interfaces:
TypeStrategy
@Internal public class ObjectOfTypeStrategy extends Object implements TypeStrategy
Type strategy for theOBJECT_OFfunction 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)
-
-
Constructor Summary
Constructors Constructor Description ObjectOfTypeStrategy()
-
Method Summary
All Methods Instance Methods Concrete Methods Modifier and Type Method Description Optional<DataType>inferType(CallContext callContext)Infers a type from the given function call.
-
-
-
Method Detail
-
inferType
public Optional<DataType> inferType(CallContext callContext)
Description copied from interface:TypeStrategyInfers a type from the given function call.- Specified by:
inferTypein interfaceTypeStrategy
-
-