trafodion-codereview mailing list archives

Site index · List index
Message view « Date » · « Thread »
Top « Date » · « Thread »
From sureshsubbiah <...@git.apache.org>
Subject [GitHub] incubator-trafodion pull request: [TRAFODION-1896] CQD TRAF_UPSERT...
Date Wed, 30 Mar 2016 17:43:48 GMT
Github user sureshsubbiah commented on a diff in the pull request:

    https://github.com/apache/incubator-trafodion/pull/393#discussion_r57931410
  
    --- Diff: core/sql/optimizer/BindRelExpr.cpp ---
    @@ -10165,22 +10165,35 @@ base table then the old version of the row will have to be deleted
from
     indexes, and a new version inserted. Upsert is being transformed to merge
     so that we can delete the old version of an updated row from the index.
     
    -Upsert is also converted into merge when there are omitted cols with default values and

    -TRAF_UPSERT_WITH_INSERT_DEFAULT_SEMANTICS is set to  OFF in case of aligned format table
or 
    +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
     {
    +  // The necessary conditions to convert upsert to merge and
       if (isUpsert() && 
           (NOT getIsTrafLoadPrep()) && 
           (NOT (getTableDesc()->isIdentityColumnGeneratedAlways() && getTableDesc()->hasIdentityColumnInClusteringKey()))
&& 
           (NOT (getTableDesc()->getClusteringIndex()->getNAFileSet()->hasSyskey()))
&& 
    -       ((getTableDesc()->hasSecondaryIndexes()) ||
    -         (( NOT isAlignedRowFormat) && omittedCurrentDefaultClassCols) ||
    -             ((isAlignedRowFormat && omittedDefaultCols
    -              && (CmpCommon::getDefault(TRAF_UPSERT_WITH_INSERT_DEFAULT_SEMANTICS)
== DF_OFF)))
    -       ))
    +        // 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 
    --- End diff --
    
    I suppose the comment in line 10192 should say "when any current default column is omitted"
?
    
    A table some place in code that shows what the behaviour is with 3 cqd settings for aligned
omitted default, aligned omitted default current non-aligned omitted default, non-aligned
omitted current default will be helpful.  


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