Class SchemaTranslator


  • @Internal
    public final class SchemaTranslator
    extends Object
    Utility to derive a physical DataType, Schema, and projections for sinks and sources.
    • Constructor Detail

      • SchemaTranslator

        public SchemaTranslator()
    • Method Detail

      • createProducingResult

        public static SchemaTranslator.ProducingResult createProducingResult​(org.apache.flink.table.catalog.ResolvedSchema inputSchema,
                                                                             @Nullable
                                                                             org.apache.flink.table.api.Schema declaredSchema)
        Converts the given DataType into the final SchemaTranslator.ProducingResult.

        This method serves three types of use cases:

        • 1. Derive physical columns from the input schema.
        • 2. Derive physical columns from the input schema but enrich with metadata column and primary key.
        • 3. Entirely use declared schema.
      • createProducingResult

        public static SchemaTranslator.ProducingResult createProducingResult​(org.apache.flink.table.catalog.DataTypeFactory dataTypeFactory,
                                                                             org.apache.flink.table.catalog.ResolvedSchema inputSchema,
                                                                             org.apache.flink.table.types.AbstractDataType<?> targetDataType)
        Converts the given DataType into the final SchemaTranslator.ProducingResult.

        This method serves one type of use case:

        • 1. Derive physical columns from the input data type.
      • createConsumingResult

        public static SchemaTranslator.ConsumingResult createConsumingResult​(org.apache.flink.table.catalog.DataTypeFactory dataTypeFactory,
                                                                             org.apache.flink.api.common.typeinfo.TypeInformation<?> inputTypeInfo,
                                                                             @Nullable
                                                                             org.apache.flink.table.api.Schema declaredSchema)
        Converts the given TypeInformation and an optional declared Schema (possibly incomplete) into the final SchemaTranslator.ConsumingResult.

        This method serves three types of use cases:

        • 1. Derive physical columns from the input type information.
        • 2. Derive physical columns but merge them with declared computed columns and other schema information.
        • 3. Derive and enrich physical columns and merge other schema information.
      • createConsumingResult

        public static SchemaTranslator.ConsumingResult createConsumingResult​(org.apache.flink.table.catalog.DataTypeFactory dataTypeFactory,
                                                                             org.apache.flink.table.types.DataType inputDataType,
                                                                             @Nullable
                                                                             org.apache.flink.table.api.Schema declaredSchema,
                                                                             boolean mergePhysicalSchema)
        Converts the given DataType and an optional declared Schema (possibly incomplete) into the final SchemaTranslator.ConsumingResult.

        This method serves three types of use cases:

        • 1. Derive physical columns from the input data type.
        • 2. Derive physical columns but merge them with declared computed columns and other schema information.
        • 3. Derive and enrich physical columns and merge other schema information (only if {@param mergePhysicalSchema} is set to true).