use of org.apache.beam.vendor.calcite.v1_28_0.org.apache.calcite.schema.Table in project drill by apache.
the class AbstractSchema method getTablesByNames.
/**
* Get the collection of {@link Table} tables specified in the tableNames.
*
* @param tableNames the requested tables, specified by the table names
* @return the collection of requested tables
*/
public List<Pair<String, ? extends Table>> getTablesByNames(final List<String> tableNames) {
final List<Pair<String, ? extends Table>> tables = Lists.newArrayList();
for (String tableName : tableNames) {
final Table table = getTable(tableName);
if (table == null) {
// tables as INFO SCHEMA is about showing tables which the use has access to query.
continue;
}
tables.add(Pair.of(tableName, table));
}
return tables;
}
use of org.apache.beam.vendor.calcite.v1_28_0.org.apache.calcite.schema.Table in project lucene-solr by apache.
the class SolrSchema method getTableMap.
@Override
protected Map<String, Table> getTableMap() {
String zk = this.properties.getProperty("zk");
try (CloudSolrClient cloudSolrClient = new CloudSolrClient.Builder().withZkHost(zk).build()) {
cloudSolrClient.connect();
ZkStateReader zkStateReader = cloudSolrClient.getZkStateReader();
ClusterState clusterState = zkStateReader.getClusterState();
final ImmutableMap.Builder<String, Table> builder = ImmutableMap.builder();
for (String collection : clusterState.getCollectionsMap().keySet()) {
builder.put(collection, new SolrTable(this, collection));
}
Aliases aliases = zkStateReader.getAliases();
if (aliases.collectionAliasSize() > 0) {
for (Map.Entry<String, String> alias : aliases.getCollectionAliasMap().entrySet()) {
builder.put(alias.getKey(), new SolrTable(this, alias.getValue()));
}
}
return builder.build();
} catch (IOException e) {
throw new RuntimeException(e);
}
}
use of org.apache.beam.vendor.calcite.v1_28_0.org.apache.calcite.schema.Table in project drill by axbaretto.
the class AbstractSchema method getTablesByNames.
/**
* Get the collection of {@link Table} tables specified in the tableNames.
*
* @param tableNames the requested tables, specified by the table names
* @return the collection of requested tables
*/
public List<Pair<String, ? extends Table>> getTablesByNames(final List<String> tableNames) {
final List<Pair<String, ? extends Table>> tables = Lists.newArrayList();
for (String tableName : tableNames) {
final Table table = getTable(tableName);
if (table == null) {
// tables as INFO SCHEMA is about showing tables which the use has access to query.
continue;
}
tables.add(Pair.of(tableName, table));
}
return tables;
}
use of org.apache.beam.vendor.calcite.v1_28_0.org.apache.calcite.schema.Table in project drill by axbaretto.
the class DirPrunedEnumerableTableScan method create.
/**
* Creates an DirPrunedEnumerableTableScan.
*/
public static EnumerableTableScan create(RelOptCluster cluster, RelOptTable relOptTable, String digestFromSelection) {
final Table table = relOptTable.unwrap(Table.class);
Class elementType = EnumerableTableScan.deduceElementType(table);
final RelTraitSet traitSet = cluster.traitSetOf(EnumerableConvention.INSTANCE).replaceIfs(RelCollationTraitDef.INSTANCE, new Supplier<List<RelCollation>>() {
public List<RelCollation> get() {
if (table != null) {
return table.getStatistic().getCollations();
}
return ImmutableList.of();
}
});
return new DirPrunedEnumerableTableScan(cluster, traitSet, relOptTable, elementType, digestFromSelection);
}
use of org.apache.beam.vendor.calcite.v1_28_0.org.apache.calcite.schema.Table in project drill by axbaretto.
the class DirPrunedEnumerableTableScan method copy.
@Override
public RelNode copy(RelTraitSet traitSet, List<RelNode> inputs) {
final Table tbl = this.table.unwrap(Table.class);
Class elementType = EnumerableTableScan.deduceElementType(tbl);
return new DirPrunedEnumerableTableScan(getCluster(), traitSet, table, elementType, digestFromSelection);
}
Aggregations