Search in sources :

Example 1 with ParallelTable

use of org.apache.storm.sql.calcite.ParallelTable in project storm by apache.

the class StreamsScanRule method convert.

@Override
public RelNode convert(RelNode rel) {
    final TableScan scan = (TableScan) rel;
    int parallelismHint = DEFAULT_PARALLELISM_HINT;
    final ParallelTable parallelTable = scan.getTable().unwrap(ParallelTable.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 StreamsStreamScanRel(scan.getCluster(), scan.getTraitSet().replace(StreamsLogicalConvention.INSTANCE), scan.getTable(), parallelismHint);
        default:
            throw new IllegalArgumentException(String.format("Unsupported table type: %s", table.getJdbcTableType()));
    }
}
Also used : 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) ParallelTable(org.apache.storm.sql.calcite.ParallelTable) StreamsStreamScanRel(org.apache.storm.sql.planner.streams.rel.StreamsStreamScanRel) ParallelTable(org.apache.storm.sql.calcite.ParallelTable)

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 ParallelTable (org.apache.storm.sql.calcite.ParallelTable)1 StreamsStreamScanRel (org.apache.storm.sql.planner.streams.rel.StreamsStreamScanRel)1