Repository: trafodion Updated Branches: refs/heads/master ed0daf50f -> 8dbf5dffc
[TRAFODION 3091] Unnamed Dynamic parameter doesn't work in WITH statement Project: http://git-wip-us.apache.org/repos/asf/trafodion/repo Commit: http://git-wip-us.apache.org/repos/asf/trafodion/commit/e30f17a5 Tree: http://git-wip-us.apache.org/repos/asf/trafodion/tree/e30f17a5 Diff: http://git-wip-us.apache.org/repos/asf/trafodion/diff/e30f17a5 Branch: refs/heads/master Commit: e30f17a5f6aee0ca5aa49868d8cef255d3414e72 Parents: 609d7a4 Author: Andy Yang <[email protected]> Authored: Thu May 31 00:16:19 2018 +0800 Committer: Andy Yang <[email protected]> Committed: Thu May 31 00:16:19 2018 +0800 ---------------------------------------------------------------------- core/sql/optimizer/BindItemExpr.cpp | 5 +++++ core/sql/optimizer/ItemExpr.cpp | 18 +----------------- 2 files changed, 6 insertions(+), 17 deletions(-) ---------------------------------------------------------------------- http://git-wip-us.apache.org/repos/asf/trafodion/blob/e30f17a5/core/sql/optimizer/BindItemExpr.cpp ---------------------------------------------------------------------- diff --git a/core/sql/optimizer/BindItemExpr.cpp b/core/sql/optimizer/BindItemExpr.cpp index 6a2055f..6835c6c 100644 --- a/core/sql/optimizer/BindItemExpr.cpp +++ b/core/sql/optimizer/BindItemExpr.cpp @@ -8622,7 +8622,12 @@ ItemExpr *CurrentTimestampRunning::bindNode(BindWA *bindWA) ItemExpr *Parameter::bindNode(BindWA *bindWA) { if (nodeIsBound()) + { + OperatorTypeEnum opTyp = getOperatorType(); + // All user inputs are treated as outer references in the current scope. + bindWA->getCurrentScope()->addOuterRef(getValueId()); return getValueId().getItemExpr(); + } if (bindWA->getCurrentScope()->context()->inTDFunction()) { //Paramaters and outer references are not supported with rank function. http://git-wip-us.apache.org/repos/asf/trafodion/blob/e30f17a5/core/sql/optimizer/ItemExpr.cpp ---------------------------------------------------------------------- diff --git a/core/sql/optimizer/ItemExpr.cpp b/core/sql/optimizer/ItemExpr.cpp index 920d2f4..ace5a84 100644 --- a/core/sql/optimizer/ItemExpr.cpp +++ b/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; } const NAType * DynamicParam::pushDownType(NAType& desiredType,
