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

    https://github.com/apache/trafodion/pull/1585#discussion_r191925480
  
    --- 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 did a quick experiment. I put a breakpoint at DynamicParam::copyTopNode 
in sqlci, then did some prepares using dynamic parameters. I wanted to see if 
this method was called to copy a tree into the query cache. I didn't get any 
hits. So my tentative conclusion is that this method isn't used for such 
copies, or perhaps plans with dynamic parameters are not cacheable (which would 
surprise me). In either case though the change looks safe. So I'm OK with it.


---

Reply via email to