Search in sources :

Example 1 with RelOptSchemaWithSampling

use of org.apache.calcite.plan.RelOptSchemaWithSampling in project calcite by apache.

the class SqlValidatorUtil method getRelOptTable.

private static RelOptTable getRelOptTable(TableNamespace tableNamespace, Prepare.CatalogReader catalogReader, String datasetName, boolean[] usedDataset, List<RelDataTypeField> extendedFields) {
    final List<String> names = tableNamespace.getTable().getQualifiedName();
    RelOptTable table;
    if (datasetName != null && catalogReader instanceof RelOptSchemaWithSampling) {
        final RelOptSchemaWithSampling reader = (RelOptSchemaWithSampling) catalogReader;
        table = reader.getTableForMember(names, datasetName, usedDataset);
    } else {
        // Schema does not support substitution. Ignore the data set, if any.
        table = catalogReader.getTableForMember(names);
    }
    if (!extendedFields.isEmpty()) {
        table = table.extend(extendedFields);
    }
    return table;
}
Also used : RelOptSchemaWithSampling(org.apache.calcite.plan.RelOptSchemaWithSampling) RelOptTable(org.apache.calcite.plan.RelOptTable)

Aggregations

RelOptSchemaWithSampling (org.apache.calcite.plan.RelOptSchemaWithSampling)1 RelOptTable (org.apache.calcite.plan.RelOptTable)1