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;
}
Aggregations