public abstract class TableModify extends SingleRel
It is similar to TableScan,
but represents a request to modify a table rather than read from it.
It takes one child which produces the modified rows. Those rows are:
INSERT, those rows are the new values;
DELETE, the old values;
UPDATE, all old values plus updated new values.
| Modifier and Type | Class and Description |
|---|---|
static class |
TableModify.Operation
Enumeration of supported modification operations.
|
RelNode.Context| Modifier and Type | Field and Description |
|---|---|
protected Prepare.CatalogReader |
catalogReader
The connection to the optimizing session.
|
private boolean |
flattened |
private RelDataType |
inputRowType |
private TableModify.Operation |
operation |
private List<RexNode> |
sourceExpressionList |
protected RelOptTable |
table
The table definition.
|
private List<String> |
updateColumnList |
digest, id, rowType, traitSet| Modifier | Constructor and Description |
|---|---|
protected |
TableModify(RelOptCluster cluster,
RelTraitSet traitSet,
RelOptTable table,
Prepare.CatalogReader catalogReader,
RelNode input,
TableModify.Operation operation,
List<String> updateColumnList,
List<RexNode> sourceExpressionList,
boolean flattened)
Creates a
TableModify. |
| Modifier and Type | Method and Description |
|---|---|
RelOptCost |
computeSelfCost(RelOptPlanner planner,
RelMetadataQuery mq)
Returns the cost of this plan (not including children).
|
RelDataType |
deriveRowType() |
RelWriter |
explainTerms(RelWriter pw)
Describes the inputs and attributes of this relational expression.
|
Prepare.CatalogReader |
getCatalogReader() |
RelDataType |
getExpectedInputRowType(int ordinalInParent)
Returns the type of the rows expected for an input.
|
TableModify.Operation |
getOperation() |
List<RexNode> |
getSourceExpressionList() |
RelOptTable |
getTable()
If this relational expression represents an access to a table, returns
that table, otherwise returns null.
|
List<String> |
getUpdateColumnList() |
boolean |
isDelete() |
boolean |
isFlattened() |
boolean |
isInsert() |
boolean |
isMerge() |
boolean |
isUpdate() |
childrenAccept, estimateRowCount, getInput, getInputs, replaceInputaccept, accept, collectVariablesSet, collectVariablesUsed, computeDigest, computeSelfCost, copy, explain, getChildExps, getCluster, getCollationList, getConvention, getCorrelVariable, getDescription, getDigest, getId, getInput, getQuery, getRelTypeName, getRows, getRowType, getTraitSet, getVariablesSet, getVariablesStopped, isDistinct, isKey, isValid, isValid, metadata, onRegister, recomputeDigest, register, sole, toStringprotected Prepare.CatalogReader catalogReader
protected final RelOptTable table
private final TableModify.Operation operation
private RelDataType inputRowType
private final boolean flattened
protected TableModify(RelOptCluster cluster, RelTraitSet traitSet, RelOptTable table, Prepare.CatalogReader catalogReader, RelNode input, TableModify.Operation operation, List<String> updateColumnList, List<RexNode> sourceExpressionList, boolean flattened)
TableModify.
The UPDATE operation has format like this:
UPDATE table SET iden1 = exp1, ident2 = exp2 WHERE condition
cluster - Cluster this relational expression belongs totraitSet - Traits of this relational expressiontable - Target table to modifycatalogReader - accessor to the table metadata.input - Sub-query or filter conditionoperation - Modify operation (INSERT, UPDATE, DELETE)updateColumnList - List of column identifiers to be updated
(e.g. ident1, ident2); null if not UPDATEsourceExpressionList - List of value expressions to be set
(e.g. exp1, exp2); null if not UPDATEflattened - Whether set flattens the input row typepublic Prepare.CatalogReader getCatalogReader()
public RelOptTable getTable()
RelNodegetTable in interface RelNodegetTable in class AbstractRelNodepublic boolean isFlattened()
public TableModify.Operation getOperation()
public boolean isInsert()
public boolean isUpdate()
public boolean isDelete()
public boolean isMerge()
public RelDataType deriveRowType()
deriveRowType in class SingleRelpublic RelDataType getExpectedInputRowType(int ordinalInParent)
RelNodeRelNode.getRowType().getExpectedInputRowType in interface RelNodegetExpectedInputRowType in class AbstractRelNodeordinalInParent - input's 0-based ordinal with respect to this
parent relpublic RelWriter explainTerms(RelWriter pw)
AbstractRelNodesuper.explainTerms, then call the
RelWriterImpl.input(String, RelNode)
and
RelWriterImpl.item(String, Object)
methods for each input and attribute.explainTerms in class SingleRelpw - Plan writerpublic RelOptCost computeSelfCost(RelOptPlanner planner, RelMetadataQuery mq)
RelNodeNOTE 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.
computeSelfCost in interface RelNodecomputeSelfCost in class AbstractRelNodeplanner - Planner for cost calculationmq - Metadata queryCopyright © 2012–2018 The Apache Software Foundation. All rights reserved.