|
|||||||||
| PREV CLASS NEXT CLASS | FRAMES NO FRAMES | ||||||||
| SUMMARY: NESTED | FIELD | CONSTR | METHOD | DETAIL: FIELD | CONSTR | METHOD | ||||||||
java.lang.Objectorg.eigenbase.relopt.RelOptRule
com.lucidera.lcs.LcsTableMergeRule
public class LcsTableMergeRule
LcsTableMergeRule is a rule for converting an abstract TableModificationRel into a corresponding LcsTableMergeRel.
| Field Summary | |
|---|---|
private static double |
COLUMN_UPDATE_THRESHOLD
The upper bound on the percentage of columns that must be updated for the replace column optimization to be used |
static LcsTableMergeRule |
instance
|
private static double |
ROW_UPDATE_THRESHOLD
The lower bound on the percentage of rows that must be updated for the replace column optimization to be used. |
private static Logger |
tracer
|
| Fields inherited from class org.eigenbase.relopt.RelOptRule |
|---|
ANY, description, operands |
| Constructor Summary | |
|---|---|
private |
LcsTableMergeRule()
Creates a LcsTableMergeRule. |
| Method Summary | |
|---|---|
private List<FemLocalIndex> |
checkSingleColClusters(List<String> updateCols,
LcsTable table,
FarragoRepos repos)
Determines if each of the columns from a list of columns being updated all belong to clusters containing only a single column. |
private boolean |
checkUniqueJoinKeys(JoinRel joinRel)
Determines if the join keys corresponding to the source for the MERGE are unique. |
private RelNode |
createChangeFilterRel(ProjectRel origProj,
RelDataTypeField[] targetFields,
List<String> updateList,
boolean updateOnly,
RexNode ridExpr,
RexBuilder rexBuilder,
int nInsertFields)
Creates the filter expression used to detect changed rows. |
private RelNode |
createInsertSource(ProjectRel origProj,
RelDataTypeField[] targetFields,
RexNode ridExpr,
RexBuilder rexBuilder)
Creates a RelNode that serves as the source for an insert-only MERGE. |
private void |
createNullFilter(RexBuilder rexBuilder,
RexNode expr,
List<RexNode> filterList)
Creates an is null expression on an expression and adds it to a list of filters |
private RelNode |
createUpdateSource(ProjectRel origProj,
RelDataTypeField[] targetFields,
List<String> updateList,
boolean updateOnly,
boolean replaceColumns,
RexNode ridExpr,
RexBuilder rexBuilder)
Creates the source RelNode for a MERGE that contains an UPDATE component. |
CallingConvention |
getOutConvention()
Returns the calling convention of the result of firing this rule, null if not known. |
void |
onMatch(RelOptRuleCall call)
Receives notification about a rule match. |
(package private) List<FemLocalIndex> |
shouldReplaceColumns(LcsTable target,
JoinRel source,
List<String> updateCols,
boolean updateOnly)
Determines whether the merge should be executed by replacing the columns being updated, as opposed to updating individual rows. |
| Methods inherited from class org.eigenbase.relopt.RelOptRule |
|---|
convert, equals, equals, getOperand, getOperands, getOutTrait, hashCode, matches, mergeTraitsAndConvert, mergeTraitsAndConvert, toString |
| Methods inherited from class java.lang.Object |
|---|
clone, finalize, getClass, notify, notifyAll, wait, wait, wait |
| Field Detail |
|---|
private static final Logger tracer
private static final double COLUMN_UPDATE_THRESHOLD
private static final double ROW_UPDATE_THRESHOLD
public static final LcsTableMergeRule instance
| Constructor Detail |
|---|
private LcsTableMergeRule()
| Method Detail |
|---|
public CallingConvention getOutConvention()
RelOptRule
getOutConvention in class RelOptRulepublic void onMatch(RelOptRuleCall call)
RelOptRulecall.rels holds the set of relational
expressions which match the operands to the rule;
call.rels[0] is the root expression.
Typically a rule would check that the nodes are valid matches, creates
a new expression, then calls back RelOptRuleCall.transformTo(org.eigenbase.rel.RelNode) to
register the expression.
onMatch in class RelOptRulecall - Rule callRelOptRule.matches(RelOptRuleCall)
List<FemLocalIndex> shouldReplaceColumns(LcsTable target,
JoinRel source,
List<String> updateCols,
boolean updateOnly)
target - the target tablesource - the source for the mergeupdateCols - list of columns being updatedupdateOnly - true if the statement only contains an update
substatement
private boolean checkUniqueJoinKeys(JoinRel joinRel)
joinRel - the join
private List<FemLocalIndex> checkSingleColClusters(List<String> updateCols,
LcsTable table,
FarragoRepos repos)
updateCols - the list of columns being updatedtable - the target tablerepos - repository
private RelNode createInsertSource(ProjectRel origProj,
RelDataTypeField[] targetFields,
RexNode ridExpr,
RexBuilder rexBuilder)
origProj - original projectiontargetFields - fields from the target tableridExpr - expression representing the target rid columnrexBuilder - rex builder
private RelNode createUpdateSource(ProjectRel origProj,
RelDataTypeField[] targetFields,
List<String> updateList,
boolean updateOnly,
boolean replaceColumns,
RexNode ridExpr,
RexBuilder rexBuilder)
The new projection projects the target rid followed by a set of expressions representing new insert rows, or in the case where columns are being replaced, the replaced column values.
origProj - the original projection being replacedtargetFields - fields from the target tableupdateList - list of names corresponding to the update columnsupdateOnly - if true, MERGE statement contains no INSERTreplaceColumns - true if the MERGE will be executed by replacing
entire columnsridExpr - expression representing the target rid columnrexBuilder - rex builder
private RelNode createChangeFilterRel(ProjectRel origProj,
RelDataTypeField[] targetFields,
List<String> updateList,
boolean updateOnly,
RexNode ridExpr,
RexBuilder rexBuilder,
int nInsertFields)
RelOptUtil.isDistinctFrom(org.eigenbase.rex.RexBuilder, org.eigenbase.rex.RexNode, org.eigenbase.rex.RexNode, boolean), which generates a deeply nested tree.)
origProj - the original projection being replacedtargetFields - fields from the target tableupdateList - list of names corresponding to the update columnsupdateOnly - if true, MERGE statement contains no INSERTridExpr - expression representing the target rid columnrexBuilder - rex buildernInsertFields - number of fields in INSERT portion of UPSERT
private void createNullFilter(RexBuilder rexBuilder,
RexNode expr,
List<RexNode> filterList)
rexBuilder - rex builderexpr - expression to create the is null expression onfilterList - list of filters
|
|||||||||
| PREV CLASS NEXT CLASS | FRAMES NO FRAMES | ||||||||
| SUMMARY: NESTED | FIELD | CONSTR | METHOD | DETAIL: FIELD | CONSTR | METHOD | ||||||||