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

    https://github.com/apache/trafodion/pull/1585#discussion_r191868295
  
    --- 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 --
    
    Thanks, @zellerh. I take it then that when we copy trees from the Statement 
heap to the Context heap we use something different than copyTopNode? Otherwise 
it's not clear to me how dangling pointers are avoided.


---

Reply via email to