Github user zellerh commented on a diff in the pull request:

    
https://github.com/apache/incubator-trafodion/pull/1051#discussion_r111510932
  
    --- 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 --
    
    If we never hit line 9130 then isn't needsHalloweenProtection left at 
whatever value was passed in?


---
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.
---

Reply via email to