Github user zellerh commented on a diff in the pull request:
https://github.com/apache/incubator-trafodion/pull/291#discussion_r51219873
--- Diff: core/sql/optimizer/BindRelExpr.cpp ---
@@ -10272,8 +10273,14 @@ RelExpr* Insert::xformUpsertToMerge(BindWA *bindWA)
((Join*)re)->doNotTransformToTSJ();
((Join*)re)->setTSJForMerge(TRUE);
((Join*)re)->setTSJForMergeWithInsert(TRUE);
+ ((Join*)re)->setTSJForMergeUpsert(TRUE);
((Join*)re)->setTSJForWrite(TRUE);
- if (bindWA->hasDynamicRowsetsInQuery())
+
+ // if Inputs of current insert are empty (i.e. we have no params/rowsets)
+ // then there will be no pull up of inputs during transform and the join
will
+ // not see the inputs of the mergeUpdate due to intermediate nodes. So
+ // add inputs directly to join and use elimination to remove extra inputs
+ if (NOT getGroupAttr()->getCharacteristicInputs().isEmpty())
--- End diff --
I'm having trouble understanding this if statement. As far as I can see,
_myOuterRefs_ are the source values, coming from the child of the original
insert. After the transformation they will come from the left child of the
tuple flow, _re_, and be passed to the right child, _mu_. So, I would have
added them unconditionally as char. inputs of _mu_. If the insert (_this_)
char. inputs are non-empty, then I would have add those to _re_ and maybe even
to _mu_.
---
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 [email protected] or file a JIRA ticket
with INFRA.
---