Class TypeMappingUtils


  • @Internal
    public final class TypeMappingUtils
    extends Object
    Utility methods for dealing with field types in TableSource and TableSink.
    • Method Detail

      • computePhysicalIndices

        public static int[] computePhysicalIndices​(List<TableColumn> logicalColumns,
                                                   DataType physicalType,
                                                   Function<String,​String> nameRemapping)
        Computes indices of physical fields corresponding to the selected logical fields of a TableSchema.
        Parameters:
        logicalColumns - Logical columns that describe the physical type.
        physicalType - Physical type to retrieve indices from.
        nameRemapping - Additional remapping of a logical to a physical field name. TimestampExtractor works with logical names, but accesses physical fields
        Returns:
        Physical indices of logical fields selected with projectedLogicalFields mask.
      • checkPhysicalLogicalTypeCompatible

        public static void checkPhysicalLogicalTypeCompatible​(LogicalType physicalFieldType,
                                                              LogicalType logicalFieldType,
                                                              String physicalFieldName,
                                                              String logicalFieldName,
                                                              boolean isSource)
        Checks whether the given physical field type and logical field type are compatible at the edges of the table ecosystem. Types are still compatible if the physical type is a legacy decimal type (converted from Types#BIG_DEC) and the logical type is DECIMAL(38, 18). This is to support legacy TypeInformation for TableSource and TableSink.
        Parameters:
        physicalFieldType - physical field type
        logicalFieldType - logical field type
        physicalFieldName - physical field name
        logicalFieldName - logical field name
        isSource - whether it is a source or sink, used for logging.