Github user zellerh commented on a diff in the pull request:
https://github.com/apache/incubator-trafodion/pull/218#discussion_r47161912
--- Diff: core/sql/optimizer/GroupAttr.cpp ---
@@ -327,6 +327,38 @@ void GroupAttributes::addConstraint(ItemExpr *c)
}
break;
+ case ITM_CHECK_OPT_CONSTRAINT:
+ {
+ CheckOptConstraint *cc = (CheckOptConstraint *) c;
+
+ // check existing uniqueness constraints whether they are similar
+ // and combine uniqueness constraints if possible
+ for (ValueId occ = constraints_.init();
+ constraints_.next(occ);
+ constraints_.advance(occ))
+ {
+ if (occ.getItemExpr()->getOperatorType() ==
+ ITM_CHECK_OPT_CONSTRAINT)
+ {
+ const ValueIdSet &occPreds =
+ ((CheckOptConstraint *)
occ.getItemExpr())->getCheckPreds();
+
+ if (occPreds.contains(cc->getCheckPreds()))
--- End diff --
Sorry, just realize that below, the code may add the same check constraint
multiple times, so we do need the simple guard against that. Therefore the
check is not nearly useless, it's just not as smart as it could be.
---
If your project is set up for it, you can reply to this email and have your
reply appear on GitHub as well. If your project does not have this feature
enabled and wishes so, or if the feature is enabled but not working, please
contact infrastructure at [email protected] or file a JIRA ticket
with INFRA.
---