trafodion-codereview mailing list archives

Site index · List index
Message view « Date » · « Thread »
Top « Date » · « Thread »
From selvaganesang <...@git.apache.org>
Subject [GitHub] incubator-trafodion pull request #946: TRAFODION-1562 Enable Vsbb upsert for...
Date Mon, 13 Feb 2017 15:34:50 GMT
Github user selvaganesang commented on a diff in the pull request:

    https://github.com/apache/incubator-trafodion/pull/946#discussion_r100820073
  
    --- Diff: core/sql/optimizer/BindRelExpr.cpp ---
    @@ -10600,37 +10600,67 @@ 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
    +  toMerge = FALSE;
    +  // If the the table has an identity column in clustering key or has a syskey 
    +  // we dont need to do this transformation.The incoming row will always be 
    +  // unique. So first check if we any of the conditions are satisfied to 
    +  //even try the transform
    +  NABoolean mustTryTransform = FALSE;
       if (isUpsert() && 
    -      (NOT getIsTrafLoadPrep()) && 
    -      (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) &&
    -            // omitted current default columns with non-aligned row format tables
    -            // or omitted default columns with aligned row format tables 
    -            (((NOT isAlignedRowFormat) && omittedCurrentDefaultClassCols) ||
    -            (isAlignedRowFormat && omittedDefaultCols))) ||
    -          // CQD is set to Optimal, for non-aligned row format with omitted 
    -          // current columns, it is converted into merge though it is not
    -          // optimal for performance - This is done to ensure that when the 
    -          // CQD is set to optimal, non-aligned format would behave like 
    -          // merge when any column is  omitted 
    -          ((CmpCommon::getDefault(TRAF_UPSERT_MODE) == DF_OPTIMAL) &&
    -            ((NOT isAlignedRowFormat) && omittedCurrentDefaultClassCols))
    -        ) 
    -     )
    -     return TRUE;
    -  else
    -     return FALSE;
    +      ( NOT getIsTrafLoadPrep()) &&
    +      (NOT (getTableDesc()->isIdentityColumnGeneratedAlways() && 
    +            getTableDesc()->hasIdentityColumnInClusteringKey()))  && 
    +      (NOT(getTableDesc()->getClusteringIndex()->getNAFileSet()->hasSyskey())))
    +    {
    +      mustTryTransform = TRUE;
    +    }
    +
    +  // Transform upsert to merge in case of special modes and
    +  // omitted default columns
    +  // Case 1 :  CQD is set to MERGE, omitted current(timestamp) default 
    +  //           columns with  non-aligned row format table or omitted 
    +  //           default columns with aligned row format tables 
    +
    +  // Case 2 :  CQD is set to Optimal, for non-aligned row format with omitted 
    +  //           current(timestamp) columns, it is converted into merge 
    +  //           though it is not optimal for performance. This is done to ensure
    +  //           that when the CQD is set to optimal, non-aligned format would 
    +  //           behave like merge when any column is  omitted 
    +  if (isUpsert()  &&   
    +      mustTryTransform &&          
    +      ((CmpCommon::getDefault(TRAF_UPSERT_MODE) == DF_MERGE) &&     
    +       (((NOT isAlignedRowFormat) && omittedCurrentDefaultClassCols) ||
    +        (isAlignedRowFormat && omittedDefaultCols)))
    +      ||
    +      ((CmpCommon::getDefault(TRAF_UPSERT_MODE) == DF_OPTIMAL) &&
    +       ((NOT isAlignedRowFormat) && omittedCurrentDefaultClassCols)))
    +    {
    +      toMerge = TRUE;
    --- End diff --
    
    The non-aligned format table needs merge behavior by default. Will the non-aligned format
table work as it was before then?


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

Mime
View raw message