use of org.apache.calcite.schema.impl.AbstractTableQueryable in project calcite by apache.
the class QueryableRelBuilder method toRel.
RelNode toRel(Queryable<T> queryable) {
if (queryable instanceof QueryableDefaults.Replayable) {
// noinspection unchecked
((QueryableDefaults.Replayable) queryable).replay(this);
return rel;
}
if (queryable instanceof AbstractTableQueryable) {
final AbstractTableQueryable tableQueryable = (AbstractTableQueryable) queryable;
final QueryableTable table = tableQueryable.table;
final CalciteSchema.TableEntry tableEntry = CalciteSchema.from(tableQueryable.schema).add(tableQueryable.tableName, tableQueryable.table);
final RelOptTableImpl relOptTable = RelOptTableImpl.create(null, table.getRowType(translator.typeFactory), tableEntry, null);
if (table instanceof TranslatableTable) {
return ((TranslatableTable) table).toRel(translator, relOptTable);
} else {
return LogicalTableScan.create(translator.cluster, relOptTable);
}
}
return translator.translate(queryable.getExpression());
}
Aggregations