trafodion-codereview mailing list archives

Site index · List index
Message view « Date » · « Thread »
Top « Date » · « Thread »
From zellerh <...@git.apache.org>
Subject [GitHub] incubator-trafodion pull request #1306: [TRAFODION-2813] Ignore leading salt...
Date Tue, 21 Nov 2017 18:31:24 GMT
Github user zellerh commented on a diff in the pull request:

    https://github.com/apache/incubator-trafodion/pull/1306#discussion_r152363289
  
    --- Diff: core/sql/optimizer/IndexDesc.cpp ---
    @@ -802,10 +802,30 @@ IndexProperty::compareIndexPromise(const IndexProperty *ixProp)
const
     
         const IndexDesc * index = getIndexDesc();
         const IndexDesc * otherIndex = ixProp->getIndexDesc();
    -    if ( ((IndexColumn *)(index->getIndexKey()[0]).getItemExpr())->getDefinition()
!= 
    -         ((IndexColumn *)(otherIndex->getIndexKey()[0]).getItemExpr())->getDefinition()
)
    -
    -      return INCOMPATIBLE;
    +    
    +    // If the two indexes have differing leading columns, consider them incompatible.
    +    // For this check, we ignore the "_SALT_" column if both are salted.
    +    CollIndex columnToCheck = 0;
    +    NABoolean done = FALSE;
    +    while (!done)
    +      {
    +        if (columnToCheck >= index->getIndexKey().entries())
    +          return INCOMPATIBLE;  // must be one of the indexes is just "_SALT_" (seems
unlikely actually)
    +        else if (columnToCheck >= otherIndex->getIndexKey().entries())
    +          return INCOMPATIBLE;  // must be one of the indexes is just "_SALT_" (seems
unlikely actually)
    +        else
    +          {
    +            IndexColumn * indexCol = (IndexColumn *)(index->getIndexKey()[columnToCheck]).getItemExpr();
    +            IndexColumn * otherIndexCol = (IndexColumn *)(otherIndex->getIndexKey()[columnToCheck]).getItemExpr();
    +            if ( indexCol->getNAColumn()->isSaltColumn() &&
    +                 otherIndexCol->getNAColumn()->isSaltColumn() )
    --- End diff --
    
    Right now, all we allow is DIVISION LIKE TABLE, the index must have the same divisioning
columns as the base table, if any. So, it's the same restriction we have for salting.


---

Mime
View raw message