privatefinal ObjectIdentifier tableIdentifier; privatefinal CatalogBaseTable catalogBaseTable; privatefinal FlinkStatistic statistic; privatefinalboolean isStreamingMode; privatefinalboolean isTemporary; ... privatestaticRelDataTypegetRowType(RelDataTypeFactory typeFactory, CatalogBaseTable catalogBaseTable, boolean isStreamingMode) { finalFlinkTypeFactoryflinkTypeFactory= (FlinkTypeFactory) typeFactory; TableSchematableSchema= catalogBaseTable.getSchema(); finalDataType[] fieldDataTypes= tableSchema.getFieldDataTypes(); if (!isStreamingMode && catalogBaseTable instanceof ConnectorCatalogTable && ((ConnectorCatalogTable) catalogBaseTable).getTableSource().isPresent()) { // If the table source is bounded, materialize the time attributes to normal TIMESTAMP type. // Now for ConnectorCatalogTable, there is no way to // deduce if it is bounded in the table environment, so the data types in TableSchema // always patched with TimeAttribute. // See ConnectorCatalogTable#calculateSourceSchema // for details.
// Remove the patched time attributes type to let the TableSourceTable handle it. // We should remove this logic if the isBatch flag in ConnectorCatalogTable is fixed. // TODO: Fix FLINK-14844. for (inti=0; i < fieldDataTypes.length; i++) { LogicalTypelt= fieldDataTypes[i].getLogicalType(); if (lt instanceof TimestampType && (((TimestampType) lt).getKind() == TimestampKind.PROCTIME || ((TimestampType) lt).getKind() == TimestampKind.ROWTIME)) { intprecision= ((TimestampType) lt).getPrecision(); fieldDataTypes[i] = DataTypes.TIMESTAMP(precision); } } } return TableSourceUtil.getSourceRowType(flinkTypeFactory, tableSchema, scala.Option.empty(), isStreamingMode); } }
publicinterfaceCatalogBaseTable { /** * Get the properties of the table. * * @return property map of the table/view */ Map<String, String> getProperties();
/** * Get the schema of the table. * * @return schema of the table/view. */ TableSchemagetSchema();
/** * Get comment of the table or view. * * @return comment of the table/view. */ StringgetComment();
/** * Get a deep copy of the CatalogBaseTable instance. * * @return a copy of the CatalogBaseTable instance */ CatalogBaseTablecopy();
/** * Get a brief description of the table or view. * * @return an optional short description of the table/view */ Optional<String> getDescription();
/** * Get a detailed description of the table or view. * * @return an optional long description of the table/view */ Optional<String> getDetailedDescription(); }