Search in sources :

Example 1 with TridentStreamScanRel

use of org.apache.storm.sql.planner.trident.rel.TridentStreamScanRel in project storm by apache.

the class TridentScanRule method convert.

@Override
public RelNode convert(RelNode rel) {
    final TableScan scan = (TableScan) rel;
    int parallelismHint = DEFAULT_PARALLELISM_HINT;
    final ParallelStreamableTable parallelTable = scan.getTable().unwrap(ParallelStreamableTable.class);
    if (parallelTable != null && parallelTable.parallelismHint() != null) {
        parallelismHint = parallelTable.parallelismHint();
    }
    final Table table = scan.getTable().unwrap(Table.class);
    switch(table.getJdbcTableType()) {
        case STREAM:
            return new TridentStreamScanRel(scan.getCluster(), scan.getTraitSet().replace(TridentLogicalConvention.INSTANCE), scan.getTable(), parallelismHint);
        default:
            throw new IllegalArgumentException(String.format("Unsupported table type: %s", table.getJdbcTableType()));
    }
}
Also used : ParallelStreamableTable(org.apache.storm.sql.calcite.ParallelStreamableTable) TableScan(org.apache.calcite.rel.core.TableScan) EnumerableTableScan(org.apache.calcite.adapter.enumerable.EnumerableTableScan) ParallelStreamableTable(org.apache.storm.sql.calcite.ParallelStreamableTable) Table(org.apache.calcite.schema.Table) TridentStreamScanRel(org.apache.storm.sql.planner.trident.rel.TridentStreamScanRel)

Aggregations

EnumerableTableScan (org.apache.calcite.adapter.enumerable.EnumerableTableScan)1 TableScan (org.apache.calcite.rel.core.TableScan)1 Table (org.apache.calcite.schema.Table)1 ParallelStreamableTable (org.apache.storm.sql.calcite.ParallelStreamableTable)1 TridentStreamScanRel (org.apache.storm.sql.planner.trident.rel.TridentStreamScanRel)1