Search in sources :

Example 1 with DefinedProctimeAttribute

use of org.apache.flink.table.sources.DefinedProctimeAttribute in project flink by apache.

the class ConnectorCatalogTable method calculateSourceSchema.

public static <T1> TableSchema calculateSourceSchema(TableSource<T1> source, boolean isBatch) {
    TableSchema tableSchema = source.getTableSchema();
    if (isBatch) {
        return tableSchema;
    }
    DataType[] types = Arrays.copyOf(tableSchema.getFieldDataTypes(), tableSchema.getFieldCount());
    String[] fieldNames = tableSchema.getFieldNames();
    if (source instanceof DefinedRowtimeAttributes) {
        updateRowtimeIndicators((DefinedRowtimeAttributes) source, fieldNames, types);
    }
    if (source instanceof DefinedProctimeAttribute) {
        updateProctimeIndicator((DefinedProctimeAttribute) source, fieldNames, types);
    }
    return TableSchema.builder().fields(fieldNames, types).build();
}
Also used : DefinedProctimeAttribute(org.apache.flink.table.sources.DefinedProctimeAttribute) TableSchema(org.apache.flink.table.api.TableSchema) DefinedRowtimeAttributes(org.apache.flink.table.sources.DefinedRowtimeAttributes) DataType(org.apache.flink.table.types.DataType) AtomicDataType(org.apache.flink.table.types.AtomicDataType)

Aggregations

TableSchema (org.apache.flink.table.api.TableSchema)1 DefinedProctimeAttribute (org.apache.flink.table.sources.DefinedProctimeAttribute)1 DefinedRowtimeAttributes (org.apache.flink.table.sources.DefinedRowtimeAttributes)1 AtomicDataType (org.apache.flink.table.types.AtomicDataType)1 DataType (org.apache.flink.table.types.DataType)1