Class LogicalTableScan

java.lang.Object
org.apache.calcite.rel.AbstractRelNode
org.apache.calcite.rel.core.TableScan
org.apache.calcite.rel.logical.LogicalTableScan
All Implemented Interfaces:
Cloneable, org.apache.calcite.plan.RelOptNode, org.apache.calcite.rel.hint.Hintable, org.apache.calcite.rel.RelNode

public final class LogicalTableScan extends org.apache.calcite.rel.core.TableScan
A LogicalTableScan reads all the rows from a RelOptTable.

This class is copied from Calcite because the explainTerms(org.apache.calcite.rel.RelWriter) should consider hints.

If the table is a net.sf.saffron.ext.JdbcTable, then this is literally possible. But for other kinds of tables, there may be many ways to read the data from the table. For some kinds of table, it may not even be possible to read all of the rows unless some narrowing constraint is applied.

In the example of the net.sf.saffron.ext.ReflectSchema schema,

select from fields

cannot be implemented, but

select from fields as f
 where f.getClass().getName().equals("java.lang.String")

can. It is the optimizer's responsibility to find these ways, by applying transformation rules.

  • Nested Class Summary

    Nested classes/interfaces inherited from interface org.apache.calcite.rel.RelNode

    org.apache.calcite.rel.RelNode.Context
  • Field Summary

    Fields inherited from class org.apache.calcite.rel.core.TableScan

    hints, table

    Fields inherited from class org.apache.calcite.rel.AbstractRelNode

    digest, id, rowType, traitSet
  • Constructor Summary

    Constructors
    Constructor
    Description
    LogicalTableScan(org.apache.calcite.plan.RelOptCluster cluster, org.apache.calcite.plan.RelOptTable table)
    Deprecated.
    LogicalTableScan(org.apache.calcite.plan.RelOptCluster cluster, org.apache.calcite.plan.RelTraitSet traitSet, List<org.apache.calcite.rel.hint.RelHint> hints, org.apache.calcite.plan.RelOptTable table)
    Creates a LogicalTableScan.
    LogicalTableScan(org.apache.calcite.plan.RelOptCluster cluster, org.apache.calcite.plan.RelTraitSet traitSet, org.apache.calcite.plan.RelOptTable table)
    Deprecated.
    LogicalTableScan(org.apache.calcite.rel.RelInput input)
    Creates a LogicalTableScan by parsing serialized output.
  • Method Summary

    Modifier and Type
    Method
    Description
    org.apache.calcite.rel.RelNode
    copy(org.apache.calcite.plan.RelTraitSet traitSet, List<org.apache.calcite.rel.RelNode> inputs)
     
    create(org.apache.calcite.plan.RelOptCluster cluster, org.apache.calcite.plan.RelOptTable relOptTable, List<org.apache.calcite.rel.hint.RelHint> hints)
    Creates a LogicalTableScan.
    org.apache.calcite.rel.RelWriter
    explainTerms(org.apache.calcite.rel.RelWriter pw)
     
    org.apache.calcite.rel.RelNode
    withHints(List<org.apache.calcite.rel.hint.RelHint> hintList)
     

    Methods inherited from class org.apache.calcite.rel.core.TableScan

    accept, computeSelfCost, deriveRowType, estimateRowCount, getHints, getTable, identity, identity, project

    Methods inherited from class org.apache.calcite.rel.AbstractRelNode

    accept, childrenAccept, collectVariablesSet, collectVariablesUsed, deepEquals, deepHashCode, equals, explain, getCluster, getConvention, getCorrelVariable, getDescription, getDigest, getExpectedInputRowType, getId, getInput, getInputs, getRelDigest, getRelTypeName, getRowType, getTraitSet, getVariablesSet, hashCode, isEnforcer, isValid, metadata, onRegister, recomputeDigest, register, replaceInput, sole, toString

    Methods inherited from class java.lang.Object

    clone, finalize, getClass, notify, notifyAll, wait, wait, wait

    Methods inherited from interface org.apache.calcite.rel.hint.Hintable

    attachHints

    Methods inherited from interface org.apache.calcite.rel.RelNode

    explain, fieldIsNullable
  • Constructor Details

    • LogicalTableScan

      public LogicalTableScan(org.apache.calcite.plan.RelOptCluster cluster, org.apache.calcite.plan.RelTraitSet traitSet, List<org.apache.calcite.rel.hint.RelHint> hints, org.apache.calcite.plan.RelOptTable table)
    • LogicalTableScan

      @Deprecated public LogicalTableScan(org.apache.calcite.plan.RelOptCluster cluster, org.apache.calcite.plan.RelTraitSet traitSet, org.apache.calcite.plan.RelOptTable table)
      Deprecated.
    • LogicalTableScan

      @Deprecated public LogicalTableScan(org.apache.calcite.plan.RelOptCluster cluster, org.apache.calcite.plan.RelOptTable table)
      Deprecated.
    • LogicalTableScan

      public LogicalTableScan(org.apache.calcite.rel.RelInput input)
      Creates a LogicalTableScan by parsing serialized output.
  • Method Details

    • copy

      public org.apache.calcite.rel.RelNode copy(org.apache.calcite.plan.RelTraitSet traitSet, List<org.apache.calcite.rel.RelNode> inputs)
      Specified by:
      copy in interface org.apache.calcite.rel.RelNode
      Overrides:
      copy in class org.apache.calcite.rel.AbstractRelNode
    • explainTerms

      public org.apache.calcite.rel.RelWriter explainTerms(org.apache.calcite.rel.RelWriter pw)
      Overrides:
      explainTerms in class org.apache.calcite.rel.core.TableScan
    • create

      public static LogicalTableScan create(org.apache.calcite.plan.RelOptCluster cluster, org.apache.calcite.plan.RelOptTable relOptTable, List<org.apache.calcite.rel.hint.RelHint> hints)
      Creates a LogicalTableScan.
      Parameters:
      cluster - Cluster
      relOptTable - Table
      hints - The hints
    • withHints

      public org.apache.calcite.rel.RelNode withHints(List<org.apache.calcite.rel.hint.RelHint> hintList)