Search in sources :

Example 6 with RelOptTableImpl

use of org.apache.beam.vendor.calcite.v1_28_0.org.apache.calcite.prepare.RelOptTableImpl 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

RelOptTableImpl (org.apache.calcite.prepare.RelOptTableImpl)5 DrillTranslatableTable (org.apache.drill.exec.planner.logical.DrillTranslatableTable)3 DynamicDrillTable (org.apache.drill.exec.planner.logical.DynamicDrillTable)3 FileSelection (org.apache.drill.exec.store.dfs.FileSelection)3 FormatSelection (org.apache.drill.exec.store.dfs.FormatSelection)3 RelDataType (org.apache.calcite.rel.type.RelDataType)2 HazelcastRelOptTable (com.hazelcast.jet.sql.impl.schema.HazelcastRelOptTable)1 ArrayList (java.util.ArrayList)1 Properties (java.util.Properties)1 CalciteConnectionConfigImpl (org.apache.beam.vendor.calcite.v1_28_0.org.apache.calcite.config.CalciteConnectionConfigImpl)1 RelOptTable (org.apache.beam.vendor.calcite.v1_28_0.org.apache.calcite.plan.RelOptTable)1 CalciteCatalogReader (org.apache.beam.vendor.calcite.v1_28_0.org.apache.calcite.prepare.CalciteCatalogReader)1 RelOptTableImpl (org.apache.beam.vendor.calcite.v1_28_0.org.apache.calcite.prepare.RelOptTableImpl)1 SchemaPlus (org.apache.beam.vendor.calcite.v1_28_0.org.apache.calcite.schema.SchemaPlus)1 Table (org.apache.beam.vendor.calcite.v1_28_0.org.apache.calcite.schema.Table)1 TranslatableTable (org.apache.beam.vendor.calcite.v1_28_0.org.apache.calcite.schema.TranslatableTable)1 DrillElasticsearchTableScan (org.apache.calcite.adapter.elasticsearch.DrillElasticsearchTableScan)1 ElasticsearchTable (org.apache.calcite.adapter.elasticsearch.ElasticsearchTable)1 EnumerableTableScan (org.apache.calcite.adapter.enumerable.EnumerableTableScan)1 RelOptTable (org.apache.calcite.plan.RelOptTable)1