Package org.apache.calcite.rel.core
Class TableScan
- java.lang.Object
-
- org.apache.calcite.rel.AbstractRelNode
-
- org.apache.calcite.rel.core.TableScan
-
- All Implemented Interfaces:
java.lang.Cloneable
,RelOptNode
,RelNode
- Direct Known Subclasses:
Bindables.BindableTableScan
,CassandraTableScan
,CsvTableScan
,ElasticsearchTableScan
,EnumerableTableScan
,FileTableScan
,GeodeTableScan
,JdbcTableScan
,LogicalTableScan
,MongoTableScan
,PigTableScan
,SplunkTableScan
,StarTable.StarTableScan
public abstract class TableScan extends AbstractRelNode
Relational operator that returns the contents of a table.
-
-
Nested Class Summary
-
Nested classes/interfaces inherited from interface org.apache.calcite.rel.RelNode
RelNode.Context
-
-
Field Summary
Fields Modifier and Type Field Description protected RelOptTable
table
The table definition.-
Fields inherited from class org.apache.calcite.rel.AbstractRelNode
digest, id, rowType, traitSet
-
-
Constructor Summary
Constructors Modifier Constructor Description protected
TableScan(RelOptCluster cluster, RelTraitSet traitSet, RelOptTable table)
protected
TableScan(RelInput input)
Creates a TableScan by parsing serialized output.
-
Method Summary
All Methods Static Methods Instance Methods Concrete Methods Modifier and Type Method Description RelNode
accept(RelShuttle shuttle)
Accepts a visit from a shuttle.RelOptCost
computeSelfCost(RelOptPlanner planner, RelMetadataQuery mq)
Returns the cost of this plan (not including children).RelDataType
deriveRowType()
double
estimateRowCount(RelMetadataQuery mq)
Returns an estimate of the number of rows this relational expression will return.RelWriter
explainTerms(RelWriter pw)
Describes the inputs and attributes of this relational expression.java.util.List<RelCollation>
getCollationList()
Returns a description of the physical ordering (or orderings) of this relational expression.RelOptTable
getTable()
If this relational expression represents an access to a table, returns that table, otherwise returns null.ImmutableIntList
identity()
Returns an identity projection.static ImmutableIntList
identity(RelOptTable table)
Returns an identity projection for the given table.RelNode
project(ImmutableBitSet fieldsUsed, java.util.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.-
Methods inherited from class org.apache.calcite.rel.AbstractRelNode
accept, childrenAccept, collectVariablesSet, collectVariablesUsed, computeDigest, computeSelfCost, copy, explain, getChildExps, getCluster, getConvention, getCorrelVariable, getDescription, getDigest, getExpectedInputRowType, getId, getInput, getInputs, getQuery, getRelTypeName, getRows, getRowType, getTraitSet, getVariablesSet, getVariablesStopped, isDistinct, isKey, isValid, isValid, metadata, onRegister, recomputeDigest, register, replaceInput, sole, toString
-
-
-
-
Field Detail
-
table
protected final RelOptTable table
The table definition.
-
-
Constructor Detail
-
TableScan
protected TableScan(RelOptCluster cluster, RelTraitSet traitSet, RelOptTable table)
-
TableScan
protected TableScan(RelInput input)
Creates a TableScan by parsing serialized output.
-
-
Method Detail
-
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 interfaceRelNode
- Overrides:
estimateRowCount
in classAbstractRelNode
- 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 interfaceRelNode
- Overrides:
getTable
in classAbstractRelNode
- Returns:
- If this relational expression represents an access to a table, returns that table, otherwise returns null
-
getCollationList
public java.util.List<RelCollation> getCollationList()
Description copied from interface:RelNode
Returns a description of the physical ordering (or orderings) of this relational expression. Never null.- Specified by:
getCollationList
in interfaceRelNode
- Overrides:
getCollationList
in classAbstractRelNode
- Returns:
- Description of the physical ordering (or orderings) of this relational expression. Never null
-
computeSelfCost
public 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 interfaceRelNode
- Overrides:
computeSelfCost
in classAbstractRelNode
- Parameters:
planner
- Planner for cost calculationmq
- Metadata query- Returns:
- Cost of this plan (not including children)
-
deriveRowType
public RelDataType deriveRowType()
- Overrides:
deriveRowType
in classAbstractRelNode
-
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 callsuper.explainTerms
, then call theRelWriterImpl.input(String, RelNode)
andRelWriterImpl.item(String, Object)
methods for each input and attribute.- Overrides:
explainTerms
in classAbstractRelNode
- Parameters:
pw
- Plan writer- Returns:
- Plan writer for fluent-explain pattern
-
project
public RelNode project(ImmutableBitSet fieldsUsed, java.util.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 projectsNULL
values for the extra fields, using theRelBuilder.project(Iterable)
method.Sub-classes, representing table types that have these capabilities, should override.
- Parameters:
fieldsUsed
- Bitmap of the fields desired by the consumerextraFields
- Extra fields, not advertised in the table's row-type, wanted by the consumerrelBuilder
- 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 interfaceRelNode
- Overrides:
accept
in classAbstractRelNode
- Parameters:
shuttle
- Shuttle- Returns:
- A copy of this node incorporating changes made by the shuttle to this node's children
-
-