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.
|
protected RelOptTable |
table
The table definition.
|
digest, id, rowType, traitSet| Modifier | Constructor and Description |
|---|---|
protected |
TableModify(RelInput input)
Creates a TableModify by parsing serialized output.
|
protected |
TableModify(RelOptCluster cluster,
RelTraitSet traitSet,
RelOptTable table,
Prepare.CatalogReader catalogReader,
RelNode input,
TableModify.Operation operation,
@Nullable List<String> updateColumnList,
@Nullable List<RexNode> sourceExpressionList,
boolean flattened)
Creates a
TableModify. |
| Modifier and Type | Method and Description |
|---|---|
@Nullable 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() |
@Nullable List<RexNode> |
getSourceExpressionList() |
RelOptTable |
getTable()
If this relational expression represents an access to a table, returns
that table, otherwise returns null.
|
@Nullable List<String> |
getUpdateColumnList() |
boolean |
isDelete() |
boolean |
isFlattened() |
boolean |
isInsert() |
boolean |
isMerge() |
boolean |
isUpdate() |
childrenAccept, estimateRowCount, getInput, getInputs, replaceInputaccept, accept, collectVariablesSet, collectVariablesUsed, copy, deepEquals, deepHashCode, equals, explain, getCluster, getConvention, getCorrelVariable, getDescription, getDigest, getId, getInput, getRelDigest, getRelTypeName, getRowType, getTraitSet, getVariablesSet, hashCode, isEnforcer, isValid, metadata, onRegister, recomputeDigest, register, sole, toStringclone, finalize, getClass, notify, notifyAll, wait, wait, waitexplain, fieldIsNullableprotected Prepare.CatalogReader catalogReader
protected final RelOptTable table
protected TableModify(RelOptCluster cluster, RelTraitSet traitSet, RelOptTable table, Prepare.CatalogReader catalogReader, RelNode input, TableModify.Operation operation, @Nullable List<String> updateColumnList, @Nullable 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 typeprotected TableModify(RelInput input)
public 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
RelWriter.input(String, RelNode)
and
RelWriter.item(String, Object)
methods for each input and attribute.explainTerms in class SingleRelpw - Plan writerpublic @Nullable 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-2022 Apache Software Foundation. All Rights Reserved.