trafodion-codereview mailing list archives

Site index · List index
Message view « Date » · « Thread »
Top « Date » · « Thread »
From sureshsubbiah <>
Subject [GitHub] incubator-trafodion pull request #946: TRAFODION-1562 Enable Vsbb upsert for...
Date Wed, 08 Feb 2017 15:57:03 GMT
Github user sureshsubbiah commented on a diff in the pull request:
    --- Diff: core/sql/optimizer/BindRelExpr.cpp ---
    @@ -10600,34 +10600,45 @@ Upsert is also converted into merge when TRAF_UPSERT_MODE is
set to MERGE and
     there are omitted cols with default values in case of aligned format table or 
     omitted current timestamp cols in case of non-aligned row format
    -NABoolean Insert::isUpsertThatNeedsMerge(NABoolean isAlignedRowFormat, NABoolean omittedDefaultCols,
    -                                   NABoolean omittedCurrentDefaultClassCols) const
    +NABoolean Insert::isUpsertThatNeedsTransformation(NABoolean isAlignedRowFormat, 
    +                                                  NABoolean omittedDefaultCols,
    +                                                  NABoolean omittedCurrentDefaultClassCols,
    +                                                  NABoolean &toMerge) const
    -  // The necessary conditions to convert upsert to merge and
    +  // The necessary conditions to transform upsert 
       if (isUpsert() && 
           (NOT getIsTrafLoadPrep()) && 
    -      (NOT (getTableDesc()->isIdentityColumnGeneratedAlways() && getTableDesc()->hasIdentityColumnInClusteringKey()))
    +      (NOT (getTableDesc()->isIdentityColumnGeneratedAlways() && 
    +            getTableDesc()->hasIdentityColumnInClusteringKey())) && 
           (NOT (getTableDesc()->getClusteringIndex()->getNAFileSet()->hasSyskey()))
    -        // table has secondary indexes or
    -        (getTableDesc()->hasSecondaryIndexes() ||
    -          // CQD is set to MERGE  
    -          ((CmpCommon::getDefault(TRAF_UPSERT_MODE) == DF_MERGE) &&
    +      // table has secondary indexes or
    +      (getTableDesc()->hasSecondaryIndexes() ))
    +        {
    +          toMerge = FALSE;
    +          return TRUE;
    +        }
    +  else if (isUpsert() &&   (NOT getIsTrafLoadPrep()) && 
    +           (NOT (getTableDesc()->isIdentityColumnGeneratedAlways() && getTableDesc()->hasIdentityColumnInClusteringKey()))
    +           (NOT (getTableDesc()->getClusteringIndex()->getNAFileSet()->hasSyskey()))
    +           // CQD is set to MERGE  
    --- End diff --
    The conditions in IF and ELSE IF are duplicated, making it harder to read. Please consider
using a local variable to store the result of common conditions. Also, it is not clear what
should happen if we have both IM (no syskey etc.) and default values in the upsert. With current
code we will do the new efficient transformation. I suppose that means the new efficient transformation
can handle the missing default values case too. Is the else if case used as fallback ? 

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 or file a JIRA ticket
with INFRA.

View raw message