Class TableScan

java.lang.Object
org.apache.calcite.rel.AbstractRelNode
org.apache.calcite.rel.core.TableScan
All Implemented Interfaces:
Cloneable, RelOptNode, Hintable, RelNode
Direct Known Subclasses:
Bindables.BindableTableScan, CassandraTableScan, CsvTableScan, CsvTableScan, ElasticsearchTableScan, EnumerableTableScan, GeodeTableScan, InnodbTableScan, JdbcTableScan, LogicalTableScan, MongoTableScan, PigTableScan, SplunkTableScan, StarTable.StarTableScan

public abstract class TableScan extends AbstractRelNode implements Hintable
Relational operator that returns the contents of a table.
  • Field Details

    • table

      protected final RelOptTable table
      The table definition.
    • hints

      protected final com.google.common.collect.ImmutableList<RelHint> hints
      The table hints.
  • Constructor Details

  • Method Details

    • estimateRowCount

      public double estimateRowCount(RelMetadataQuery mq)
      Description copied from interface: RelNode
      Returns an estimate of the number of rows this relational expression will return.

      NOTE jvs 29-Mar-2006: Don't call this method directly. Instead, use RelMetadataQuery.getRowCount(org.apache.calcite.rel.RelNode), which gives plugins a chance to override the rel's default ideas about row count.

      Specified by:
      estimateRowCount in interface RelNode
      Overrides:
      estimateRowCount in class AbstractRelNode
      Parameters:
      mq - Metadata query
      Returns:
      Estimate of the number of rows this relational expression will return
    • getTable

      public RelOptTable getTable()
      Description copied from interface: RelNode
      If this relational expression represents an access to a table, returns that table, otherwise returns null.
      Specified by:
      getTable in interface RelNode
      Overrides:
      getTable in class AbstractRelNode
      Returns:
      If this relational expression represents an access to a table, returns that table, otherwise returns null
    • computeSelfCost

      public @Nullable RelOptCost computeSelfCost(RelOptPlanner planner, RelMetadataQuery mq)
      Description copied from interface: RelNode
      Returns the cost of this plan (not including children). The base implementation throws an error; derived classes should override.

      NOTE jvs 29-Mar-2006: Don't call this method directly. Instead, use RelMetadataQuery.getNonCumulativeCost(org.apache.calcite.rel.RelNode), which gives plugins a chance to override the rel's default ideas about cost.

      Specified by:
      computeSelfCost in interface RelNode
      Overrides:
      computeSelfCost in class AbstractRelNode
      Parameters:
      planner - Planner for cost calculation
      mq - Metadata query
      Returns:
      Cost of this plan (not including children)
    • deriveRowType

      public RelDataType deriveRowType()
      Overrides:
      deriveRowType in class AbstractRelNode
    • identity

      public static ImmutableIntList identity(RelOptTable table)
      Returns an identity projection for the given table.
    • identity

      public ImmutableIntList identity()
      Returns an identity projection.
    • explainTerms

      public RelWriter explainTerms(RelWriter pw)
      Description copied from class: AbstractRelNode
      Describes the inputs and attributes of this relational expression. Each node should call super.explainTerms, then call the RelWriter.input(String, RelNode) and RelWriter.item(String, Object) methods for each input and attribute.
      Overrides:
      explainTerms in class AbstractRelNode
      Parameters:
      pw - Plan writer
      Returns:
      Plan writer for fluent-explain pattern
    • project

      public RelNode project(ImmutableBitSet fieldsUsed, Set<RelDataTypeField> extraFields, RelBuilder relBuilder)
      Projects a subset of the fields of the table, and also asks for "extra" fields that were not included in the table's official type.

      The default implementation assumes that tables cannot do either of these operations, therefore it adds a Project that projects NULL values for the extra fields, using the RelBuilder.project(Iterable) method.

      Sub-classes, representing table types that have these capabilities, should override.

      Parameters:
      fieldsUsed - Bitmap of the fields desired by the consumer
      extraFields - Extra fields, not advertised in the table's row-type, wanted by the consumer
      relBuilder - Builder used to create a Project
      Returns:
      Relational expression that projects the desired fields
    • accept

      public RelNode accept(RelShuttle shuttle)
      Description copied from interface: RelNode
      Accepts a visit from a shuttle.
      Specified by:
      accept in interface RelNode
      Overrides:
      accept in class AbstractRelNode
      Parameters:
      shuttle - Shuttle
      Returns:
      A copy of this node incorporating changes made by the shuttle to this node's children
    • getHints

      public com.google.common.collect.ImmutableList<RelHint> getHints()
      Description copied from interface: Hintable
      Returns the hints of this relational expressions as an immutable list.
      Specified by:
      getHints in interface Hintable