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

    
https://github.com/apache/incubator-trafodion/pull/1051#discussion_r110730023
  
    --- Diff: core/sql/optimizer/RelExpr.cpp ---
    @@ -9121,38 +9090,85 @@ 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();
    +      ItemExpr *baseCol = 
    +        ((IndexColumn*)keyCol)->getDefinition().getItemExpr();
           CMPASSERT(baseCol->getOperatorType() == ITM_BASECOLUMN);
    -
    -      // QSTUFF
    -      if (getGroupAttr()->isEmbeddedUpdate()){
    -        if (((BaseColumn*)updateCol)->getColNumber() ==
    +      if (((BaseColumn*)updateCol)->getColNumber() ==
               ((BaseColumn*)baseCol)->getColNumber())
    -          return FALSE;
    -      }
    -      // QSTUFF
    +        return FALSE;
    +    }
    +  }
    +  return TRUE;
    +} // Scan::updateableIndex
    +
    +NABoolean Scan::requiresHalloweenForUpdateUsingIndexScan()
    +{
    +
    +  // Returns TRUE if any non clustering index can be used for a scan 
    +  // during an UPDATE and a key column of that index is in the SET
    +  // clause of the update. If this method returns TRUE we will use a 
    +  // sort node to prevent the "Halloween Update Problem".
    --- End diff --
    
    I wonder why you are writing a new method to determine this. There already 
was a method Scan::updateableIndex() that tests an index, which you changed 
above. We could call this updateableIndex() method here in a loop, if we need 
the info for all indexes. I also have comments on a few places in this code 
that are different from the Scan::updateableIndex() method, see below. Maybe 
you need this different behavior and that's why this new method is here?


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