Github user DaveBirdsall commented on a diff in the pull request:
https://github.com/apache/trafodion/pull/1585#discussion_r191857253
--- Diff: core/sql/optimizer/ItemExpr.cpp ---
@@ -3886,23 +3886,7 @@ ItemExpr * Parameter::copyTopNode(ItemExpr
*derivedNode, CollHeap* outHeap)
ItemExpr * DynamicParam::copyTopNode(ItemExpr *derivedNode, CollHeap*
outHeap)
{
- ItemExpr *result;
-
- if (derivedNode == NULL) {
- result = new (outHeap) DynamicParam(paramName_, indicatorName_,
outHeap);
- ((DynamicParam *) result)->setRowsetSize(rowsetSize_);
- ((DynamicParam *) result)->setRowsetInfo(rowsetInfo_);
- ((DynamicParam *) result)->setParamHeading(heading_);
- ((DynamicParam *) result)->setParamTablename(tablename_);
- // we remember our original dynamic parameter because we
- // must use their valueid at dynamicparam::codegen time
- ((DynamicParam *) result)->setOriginal(this);
- }
-
- else
- result = derivedNode;
-
- return Parameter::copyTopNode(result, outHeap);
+ return this;
--- End diff --
I do not believe this is correct. The copyTopNode method is used to make a
copy of a given node, sometimes on a different heap than the original. (For
example, we might be copying a bound query tree from the statement heap which
is destroyed at the end of statement compilation to the query cache heap which
lives until the end of the process.)
---