[ 
https://issues.apache.org/jira/browse/TRAFODION-1562?page=com.atlassian.jira.plugin.system.issuetabpanels:comment-tabpanel&focusedCommentId=15652762#comment-15652762
 ] 

ASF GitHub Bot commented on TRAFODION-1562:
-------------------------------------------

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

    https://github.com/apache/incubator-trafodion/pull/826#discussion_r87316978
  
    --- Diff: core/sql/optimizer/Inlining.cpp ---
    @@ -618,25 +619,58 @@ RETDesc 
*GenericUpdate::createOldAndNewCorrelationNames(BindWA *bindWA, NABoolea
       }
     
       if ((getOperatorType() != REL_UNARY_INSERT) || 
    -   getUpdateCKorUniqueIndexKey())
    +      getUpdateCKorUniqueIndexKey() ||
    +      ((getOperatorType() == REL_UNARY_INSERT) &&((Insert 
*)this)->isMerge()) ||
    +      ((getOperatorType() == REL_UNARY_INSERT) && ((Insert 
*)this)->isUpsert() && (CmpCommon::getDefault(TRAF_UPSERT_TO_EFF_TREE) == DF_ON 
)))  
       {
         // DELETE or UPDATE --
         // Now merge the old/target/before valueid's (the Scan child RETDesc)
         // into this RETDesc such that these cols are all named "OLD@.<col>"
    -    //
    +    //f
         Scan *scan ;
         if (getOperatorType() != REL_UNARY_INSERT)
           scan = getScanNode();
         else 
           scan = getLeftmostScanNode();
    +    if ((getOperatorType() == REL_UNARY_INSERT) && ((Insert 
*)this)->isUpsert() && (CmpCommon::getDefault(TRAF_UPSERT_TO_EFF_TREE) == DF_ON 
))
    +      {
    +   RelSequence *olapChild = getOlapChild();
    +   CorrName 
corrName(getTableDesc()->getCorrNameObj().getQualifiedNameObj(), 
    +                     bindWA->wHeap(),
    +                     OLDCorr);
    +   
    +        // ColumnDescList *colList = 
(olapChild->getRETDesc())->getColumnList();
    +   for (short i = 0; i< olapChild->getRETDesc()->getDegree();i++)
    +     {
    +       // we remembered if the original columns was from the right side of
    +       // this olap node so add those to the RetDesc since those are the 
    +       //ones we want to delete from the dependent indexes.
    +       if 
((olapChild->getRETDesc()->getValueId(i)).getItemExpr()->origOpType() == 
ITM_INSTANTIATE_NULL)
    --- End diff --
    
    The left side of the left join could also produce some ITM_INSTANTIATE_NULL 
expressions, couldn't it? Wouldn't that happen if the select part of the upsert 
is itself a left join? Maybe get to the left join somehow and use its 
nullInstantiatedOutput() method, then map that through the sequence node's map?


> Changes in query tree when the upsert command is transformed into merge
> -----------------------------------------------------------------------
>
>                 Key: TRAFODION-1562
>                 URL: https://issues.apache.org/jira/browse/TRAFODION-1562
>             Project: Apache Trafodion
>          Issue Type: Sub-task
>          Components: sql-cmp
>            Reporter: Selvaganesan Govindarajan
>            Assignee: Sandhya Sundaresan
>         Attachments: BatchUpsertTransformation.pdf
>
>
> to improve the performance as explained in the main JIRA



--
This message was sent by Atlassian JIRA
(v6.3.4#6332)

Reply via email to