Github user sureshsubbiah commented on a diff in the pull request:
https://github.com/apache/incubator-trafodion/pull/1051#discussion_r111517054
--- Diff: core/sql/optimizer/RelExpr.cpp ---
@@ -9121,39 +9106,90 @@ NABoolean Scan::updateableIndex(IndexDesc *idx)
{
ItemExpr *updateCol = colUpdated[i].getItemExpr();
CMPASSERT(updateCol->getOperatorType() == ITM_BASECOLUMN);
-
for (CollIndex j = 0; j < indexKey.entries(); j++)
{
ItemExpr *keyCol = indexKey[j].getItemExpr();
-
ItemExpr *baseCol =
((IndexColumn*)keyCol)->getDefinition().getItemExpr();
CMPASSERT(baseCol->getOperatorType() == ITM_BASECOLUMN);
-
- // QSTUFF
if (getGroupAttr()->isEmbeddedUpdate()){
if (((BaseColumn*)updateCol)->getColNumber() ==
- ((BaseColumn*)baseCol)->getColNumber())
+ ((BaseColumn*)baseCol)->getColNumber())
return FALSE;
}
- // QSTUFF
-
- if ((NOT(idx->isUniqueIndex() || idx->isClusteringIndex()))
- ||
+ if ((NOT(idx->isUniqueIndex() || idx->isClusteringIndex()) &&
+ (CmpCommon::getDefault(UPDATE_CLUSTERING_OR_UNIQUE_INDEX_KEY)
!= DF_AGGRESSIVE))
+ ||
(CmpCommon::getDefault(UPDATE_CLUSTERING_OR_UNIQUE_INDEX_KEY) ==
DF_OFF))
-
{
- if (((BaseColumn*)updateCol)->getColNumber() ==
- ((BaseColumn*)baseCol)->getColNumber() AND
- NOT equalityPredOnCol(baseCol))
- return FALSE;
- }
- }
- }
+ if (((BaseColumn*)updateCol)->getColNumber() ==
+ ((BaseColumn*)baseCol)->getColNumber())
+ {
+ if (preds.containsAsEquiLocalPred(baseCol->getValueId()))
+ continue;
+ else if (preds.containsAsRangeLocalPred(baseCol->getValueId()))
+ needsHalloweenProtection = TRUE;
+ else {
+ needsHalloweenProtection = FALSE;
+ return FALSE;
+ }
+ } // index key col is being updated
+ } // not a clustering or unique index
+ } // loop over index key cols
+ } // loop over cols being updated
return TRUE;
--- End diff --
True. I guarded against this by making sure needsHalloweenProtection is
reinitialized in the normalizer, each time we call this function in the
normalizer. Clearly it is better to reinitialize at the top of this method too.
I will do that at that in my next checkin along with the vidset issue mentioned
above. Thanks much for your ideas. Without them, this change would not have
been possible,
---
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.
---