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
,InnodbTableScan
,JdbcTableScan
,LogicalTableScan
,MongoTableScan
,PigTableScan
,SplunkTableScan
,StarTable.StarTableScan
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
Modifier and TypeFieldDescriptionprotected final com.google.common.collect.ImmutableList<RelHint>
The table hints.protected final RelOptTable
The table definition.Fields inherited from class org.apache.calcite.rel.AbstractRelNode
digest, id, rowType, traitSet
-
Constructor Summary
ModifierConstructorDescriptionprotected
TableScan
(RelOptCluster cluster, RelTraitSet traitSet, List<RelHint> hints, RelOptTable table) protected
TableScan
(RelOptCluster cluster, RelTraitSet traitSet, RelOptTable table) Deprecated.protected
Creates a TableScan by parsing serialized output. -
Method Summary
Modifier and TypeMethodDescriptionaccept
(RelShuttle shuttle) Accepts a visit from a shuttle.@Nullable RelOptCost
computeSelfCost
(RelOptPlanner planner, RelMetadataQuery mq) Returns the cost of this plan (not including children).double
Returns an estimate of the number of rows this relational expression will return.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.getTable()
If this relational expression represents an access to a table, returns that table, otherwise returns null.identity()
Returns an identity projection.static ImmutableIntList
identity
(RelOptTable table) Returns an identity projection for the given table.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
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, withHints
Methods inherited from interface org.apache.calcite.rel.RelNode
explain, fieldIsNullable, stripped
-
Field Details
-
table
The table definition. -
hints
The table hints.
-
-
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)
andRelWriter.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.
-