Search in sources :

Example 1 with DrillElasticsearchTableScan

use of org.apache.calcite.adapter.elasticsearch.DrillElasticsearchTableScan in project drill by apache.

the class ElasticPlanTransformer method visit.

/**
 * Replaces rowType of RelOptTable by rowType obtained from ElasticsearchTable.
 */
@Override
public RelNode visit(TableScan other) {
    RelOptTableImpl table = (RelOptTableImpl) other.getTable();
    ElasticsearchTable elasticsearchTable = Objects.requireNonNull(table.unwrap(ElasticsearchTable.class), "ElasticSearch table cannot be null");
    RelDataType rowType = elasticsearchTable.getRowType(other.getCluster().getTypeFactory());
    mapField = rowType.getFieldList().get(0);
    return new DrillElasticsearchTableScan(other.getCluster(), other.getTraitSet(), table.copy(rowType), elasticsearchTable, rowType);
}
Also used : ElasticsearchTable(org.apache.calcite.adapter.elasticsearch.ElasticsearchTable) RelOptTableImpl(org.apache.calcite.prepare.RelOptTableImpl) RelDataType(org.apache.calcite.rel.type.RelDataType) DrillElasticsearchTableScan(org.apache.calcite.adapter.elasticsearch.DrillElasticsearchTableScan)

Aggregations

DrillElasticsearchTableScan (org.apache.calcite.adapter.elasticsearch.DrillElasticsearchTableScan)1 ElasticsearchTable (org.apache.calcite.adapter.elasticsearch.ElasticsearchTable)1 RelOptTableImpl (org.apache.calcite.prepare.RelOptTableImpl)1 RelDataType (org.apache.calcite.rel.type.RelDataType)1