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:
Cloneable
,RelOptNode
,Hintable
,RelNode
- Direct Known Subclasses:
Bindables.BindableTableScan
,CassandraTableScan
,CsvTableScan
,CsvTableScan
,ElasticsearchTableScan
,EnumerableTableScan
,GeodeTableScan
,JdbcTableScan
,LogicalTableScan
,MongoTableScan
,PigTableScan
,SplunkTableScan
,StarTable.StarTableScan
public abstract class TableScan extends AbstractRelNode implements Hintable
Relational operator that returns the contents of a table.
-
Nested Class Summary
-
Field Summary
Fields Modifier and Type Field Description protected com.google.common.collect.ImmutableList<RelHint>
hints
The table hints.protected RelOptTable
table
The table definition. -
Constructor Summary
Constructors Modifier Constructor Description protected
TableScan(RelOptCluster cluster, RelTraitSet traitSet, List<RelHint> hints, RelOptTable table)
protected
TableScan(RelOptCluster cluster, RelTraitSet traitSet, RelOptTable table)
Deprecated.protected
TableScan(RelInput input)
Creates a TableScan by parsing serialized output. -
Method Summary
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.com.google.common.collect.ImmutableList<RelHint>
getHints()
Returns the hints of this relational expressions as an immutable list.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, 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, copy, 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
-
Field Details
-
Constructor Details
-
TableScan
protected TableScan(RelOptCluster cluster, RelTraitSet traitSet, List<RelHint> hints, RelOptTable table) -
TableScan
Deprecated. -
TableScan
Creates a TableScan by parsing serialized output.
-
-
Method Details
-
estimateRowCount
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
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
-
computeSelfCost
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
- Overrides:
deriveRowType
in classAbstractRelNode
-
identity
Returns an identity projection for the given table. -
identity
Returns an identity projection. -
explainTerms
Description copied from class:AbstractRelNode
Describes the inputs and attributes of this relational expression. Each node should callsuper.explainTerms
, then call theRelWriter.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, 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
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
-
getHints
Description copied from interface:Hintable
Returns the hints of this relational expressions as an immutable list.
-