Java Code Examples for org.apache.calcite.rel.logical.LogicalTableScan#getTable()

The following examples show how to use org.apache.calcite.rel.logical.LogicalTableScan#getTable() . You can vote up the ones you like or vote down the ones you don't like, and go to the original project or source file by following the links above each example. You may check out the related API usage on the sidebar.
Example 1
Source File: CopyWithCluster.java    From dremio-oss with Apache License 2.0 5 votes vote down vote up
private RelNode copyOf(LogicalTableScan rel) {
  return new LogicalTableScan(
    cluster,
    copyOf(rel.getTraitSet()),
    rel.getTable()
  );
}
 
Example 2
Source File: EnumerableTableScanRule.java    From calcite with Apache License 2.0 5 votes vote down vote up
@Override public RelNode convert(RelNode rel) {
  LogicalTableScan scan = (LogicalTableScan) rel;
  final RelOptTable relOptTable = scan.getTable();
  final Table table = relOptTable.unwrap(Table.class);
  // The QueryableTable can only be implemented as ENUMERABLE convention,
  // but some test QueryableTables do not really implement the expressions,
  // just skips the QueryableTable#getExpression invocation and returns early.
  if (table instanceof QueryableTable || relOptTable.getExpression(Object.class) != null) {
    return EnumerableTableScan.create(scan.getCluster(), relOptTable);
  }

  return null;
}
 
Example 3
Source File: Bindables.java    From calcite with Apache License 2.0 5 votes vote down vote up
@Override public void onMatch(RelOptRuleCall call) {
  final LogicalTableScan scan = call.rel(0);
  final RelOptTable table = scan.getTable();
  if (BindableTableScan.canHandle(table)) {
    call.transformTo(
        BindableTableScan.create(scan.getCluster(), table));
  }
}
 
Example 4
Source File: PigRules.java    From calcite with Apache License 2.0 4 votes vote down vote up
public RelNode convert(RelNode rel) {
  final LogicalTableScan scan = (LogicalTableScan) rel;
  final RelTraitSet traitSet = scan.getTraitSet().replace(PigRel.CONVENTION);
  return new PigTableScan(rel.getCluster(), traitSet, scan.getTable());
}