Github user zellerh commented on a diff in the pull request:
https://github.com/apache/incubator-trafodion/pull/218#discussion_r47160804
--- 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 --
Yes, good point, this check is nearly useless, probably comes from cloning
the logic from another case. I could remove it entirely or add a comment that
explains it. I'm leaning towards something like this comment:
"Note that the check for inclusion of value ids of the predicates is not
very useful. A more useful check would be whether the existing predicates imply
the new ones or vice versa, but that would be much more complicated code and is
not required at this point."
---
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.
---