Github user sandhyasun commented on a diff in the pull request: https://github.com/apache/incubator-trafodion/pull/826#discussion_r87506823 --- 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 -- We are not remembering the origOpType in any other operator. So I think we may be ok with this. Only in the RelSequence operator, we remeber what the original opType was.
--- 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 infrastruct...@apache.org or file a JIRA ticket with INFRA. ---