[
https://issues.apache.org/jira/browse/TRAFODION-1610?page=com.atlassian.jira.plugin.system.issuetabpanels:comment-tabpanel&focusedCommentId=16192142#comment-16192142
]
ASF GitHub Bot commented on TRAFODION-1610:
-------------------------------------------
Github user DaveBirdsall commented on a diff in the pull request:
https://github.com/apache/incubator-trafodion/pull/1253#discussion_r142806660
--- Diff: core/sql/generator/GenRelUpdate.cpp ---
@@ -1718,19 +1806,56 @@ short HbaseUpdate::codeGen(Generator * generator)
}
else if (getIndexDesc()->isClusteringIndex() &&
getCheckConstraints().entries())
{
- GenAssert(FALSE, "Should not reach here. This update should have
been transformed to delete/insert");
- // To be uncommented when TRAFODION-1610 is implemented
- // Need to generate insConstraintExpr also
-/*
+ // Generate the update and insert constraint check expressions
+
+ // The attributes for the columns referenced in the constraint
expressions
+ // refer to the source values of the columns. We want to evaluate the
+ // constraints aganst the target values, though. So, there is some
+ // Attributes gymnastics that has to happen to generate them.
+
+ // Obtain the ValueIds of base table columns referenced in the
+ // constraints
+
+ ValueId constraintId;
+ ValueIdSet constraintColumns;
+ for (CollIndex ci = 0; ci < getCheckConstraints().entries(); ci++)
+ {
+ constraintId = getCheckConstraints()[ci];
+ constraintId.getItemExpr()->findAll(ITM_INDEXCOLUMN,
+ constraintColumns, // out,
has append semantics
+ TRUE, // visitVEGmembers
+ FALSE); // don't visit index
descriptors
+ }
+
+ // Prepare the constraint tree for generation
+
ItemExpr *constrTree =
getCheckConstraints().rebuildExprTree(ITM_AND, TRUE, TRUE);
if (getTableDesc()->getNATable()->hasSerializedEncodedColumn())
- constrTree = generator->addCompDecodeForDerialization(constrTree);
+ constrTree = generator->addCompDecodeForDerialization(constrTree,
isAlignedFormat);
+
+ // Generate the update constraint expression, substituting
Attributes for
--- End diff --
Should have edited this comment too
> Generate constraint expression for update/merge commands
> --------------------------------------------------------
>
> Key: TRAFODION-1610
> URL: https://issues.apache.org/jira/browse/TRAFODION-1610
> Project: Apache Trafodion
> Issue Type: Sub-task
> Components: sql-cmp
> Reporter: Selvaganesan Govindarajan
> Assignee: David Wayne Birdsall
>
--
This message was sent by Atlassian JIRA
(v6.4.14#64029)