You are viewing a plain text version of this content. The canonical link for it is here.
Posted to commits@trafodion.apache.org by se...@apache.org on 2017/08/31 05:08:56 UTC
[4/7] incubator-trafodion git commit: [TRAFODION-2727] Memory leak in
the compiler part of the code in Trafodion
http://git-wip-us.apache.org/repos/asf/incubator-trafodion/blob/35a656be/core/sql/optimizer/NAColumn.cpp
----------------------------------------------------------------------
diff --git a/core/sql/optimizer/NAColumn.cpp b/core/sql/optimizer/NAColumn.cpp
index 812c951..430343d 100644
--- a/core/sql/optimizer/NAColumn.cpp
+++ b/core/sql/optimizer/NAColumn.cpp
@@ -217,200 +217,180 @@ NABoolean NAColumn::createNAType(TrafColumnsDesc *column_desc /*IN*/,
case REC_BPINT_UNSIGNED :
type = new (heap)
- SQLBPInt(column_desc->precision, column_desc->isNullable(), FALSE, heap);
+ SQLBPInt(heap, column_desc->precision, column_desc->isNullable(), FALSE);
break;
case REC_BIN8_SIGNED:
if (column_desc->precision > 0)
type = new (heap)
- SQLNumeric(column_desc->length,
+ SQLNumeric(heap, column_desc->length,
column_desc->precision,
column_desc->scale,
TRUE,
- column_desc->isNullable(),
- heap
+ column_desc->isNullable()
);
else
type = new (heap)
- SQLTiny(TRUE,
- column_desc->isNullable(),
- heap
+ SQLTiny(heap, TRUE,
+ column_desc->isNullable()
);
break;
case REC_BIN8_UNSIGNED:
if (column_desc->precision > 0)
type = new (heap)
- SQLNumeric(column_desc->length,
+ SQLNumeric(heap, column_desc->length,
column_desc->precision,
column_desc->scale,
FALSE,
- column_desc->isNullable(),
- heap
+ column_desc->isNullable()
);
else
type = new (heap)
- SQLTiny(FALSE,
- column_desc->isNullable(),
- heap
+ SQLTiny(heap, FALSE,
+ column_desc->isNullable()
);
break;
case REC_BIN16_SIGNED:
if (column_desc->precision > 0)
type = new (heap)
- SQLNumeric(column_desc->length,
+ SQLNumeric(heap, column_desc->length,
column_desc->precision,
column_desc->scale,
TRUE,
- column_desc->isNullable(),
- heap
+ column_desc->isNullable()
);
else
type = new (heap)
- SQLSmall(TRUE,
- column_desc->isNullable(),
- heap
+ SQLSmall(heap, TRUE,
+ column_desc->isNullable()
);
break;
case REC_BIN16_UNSIGNED:
if (column_desc->precision > 0)
type = new (heap)
- SQLNumeric(column_desc->length,
+ SQLNumeric(heap, column_desc->length,
column_desc->precision,
column_desc->scale,
FALSE,
- column_desc->isNullable(),
- heap
+ column_desc->isNullable()
);
else
type = new (heap)
- SQLSmall(FALSE,
- column_desc->isNullable(),
- heap
+ SQLSmall(heap, FALSE,
+ column_desc->isNullable()
);
break;
case REC_BIN32_SIGNED:
if (column_desc->precision > 0)
type = new (heap)
- SQLNumeric(column_desc->length,
+ SQLNumeric(heap, column_desc->length,
column_desc->precision,
column_desc->scale,
TRUE,
- column_desc->isNullable(),
- heap
+ column_desc->isNullable()
);
else
type = new (heap)
- SQLInt(TRUE,
- column_desc->isNullable(),
- heap
+ SQLInt(heap, TRUE,
+ column_desc->isNullable()
);
break;
case REC_BIN32_UNSIGNED:
if (column_desc->precision > 0)
type = new (heap)
- SQLNumeric(column_desc->length,
+ SQLNumeric(heap, column_desc->length,
column_desc->precision,
column_desc->scale,
FALSE,
- column_desc->isNullable(),
- heap
+ column_desc->isNullable()
);
else
type = new (heap)
- SQLInt(FALSE,
- column_desc->isNullable(),
- heap
+ SQLInt(heap, FALSE,
+ column_desc->isNullable()
);
break;
case REC_BIN64_SIGNED:
if (column_desc->precision > 0)
type = new (heap)
- SQLNumeric(column_desc->length,
+ SQLNumeric(heap, column_desc->length,
column_desc->precision,
column_desc->scale,
TRUE,
- column_desc->isNullable(),
- heap
+ column_desc->isNullable()
);
else
type = new (heap)
- SQLLargeInt(TRUE,
- column_desc->isNullable(),
- heap
+ SQLLargeInt(heap, TRUE,
+ column_desc->isNullable()
);
break;
case REC_BIN64_UNSIGNED:
if (column_desc->precision > 0)
type = new (heap)
- SQLNumeric(column_desc->length,
+ SQLNumeric(heap, column_desc->length,
column_desc->precision,
column_desc->scale,
FALSE,
- column_desc->isNullable(),
- heap
+ column_desc->isNullable()
);
else
type = new (heap)
- SQLLargeInt(FALSE,
- column_desc->isNullable(),
- heap
+ SQLLargeInt(heap, FALSE,
+ column_desc->isNullable()
);
break;
case REC_DECIMAL_UNSIGNED:
type = new (heap)
- SQLDecimal(column_desc->length,
+ SQLDecimal(heap, column_desc->length,
column_desc->scale,
FALSE,
- column_desc->isNullable(),
- heap
+ column_desc->isNullable()
);
break;
case REC_DECIMAL_LSE:
type = new (heap)
- SQLDecimal(column_desc->length,
+ SQLDecimal(heap, column_desc->length,
column_desc->scale,
TRUE,
- column_desc->isNullable(),
- heap
+ column_desc->isNullable()
);
break;
case REC_NUM_BIG_UNSIGNED:
type = new (heap)
- SQLBigNum(column_desc->precision,
+ SQLBigNum(heap, column_desc->precision,
column_desc->scale,
TRUE, // is a real bignum
FALSE,
- column_desc->isNullable(),
- heap
+ column_desc->isNullable()
);
break;
case REC_NUM_BIG_SIGNED:
type = new (heap)
- SQLBigNum(column_desc->precision,
+ SQLBigNum(heap, column_desc->precision,
column_desc->scale,
TRUE, // is a real bignum
TRUE,
- column_desc->isNullable(),
- heap
+ column_desc->isNullable()
);
break;
case REC_FLOAT32:
type = new (heap)
- SQLReal(column_desc->isNullable(), heap, column_desc->precision);
+ SQLReal(heap, column_desc->isNullable(), column_desc->precision);
break;
case REC_FLOAT64:
type = new (heap)
- SQLDoublePrecision(column_desc->isNullable(), heap, column_desc->precision);
+ SQLDoublePrecision(heap, column_desc->isNullable(), column_desc->precision);
break;
case REC_BYTE_F_DOUBLE:
charCount /= SQL_DBCHAR_SIZE; // divide the storage length by 2
type = new (heap)
- SQLChar(charCount,
+ SQLChar(heap, charCount,
column_desc->isNullable(),
column_desc->isUpshifted(),
column_desc->isCaseInsensitive(),
@@ -431,7 +411,7 @@ NABoolean NAColumn::createNAType(TrafColumnsDesc *column_desc /*IN*/,
if ( column_desc->precision > 0 )
sizeInChars = column_desc->precision;
type = new (heap)
- SQLChar(CharLenInfo(sizeInChars, charCount/*in_bytes*/),
+ SQLChar(heap, CharLenInfo(sizeInChars, charCount/*in_bytes*/),
column_desc->isNullable(),
column_desc->isUpshifted(),
column_desc->isCaseInsensitive(),
@@ -444,7 +424,7 @@ NABoolean NAColumn::createNAType(TrafColumnsDesc *column_desc /*IN*/,
}
else // keep the old behavior
type = new (heap)
- SQLChar(charCount,
+ SQLChar(heap, charCount,
column_desc->isNullable(),
column_desc->isUpshifted(),
column_desc->isCaseInsensitive(),
@@ -467,7 +447,7 @@ NABoolean NAColumn::createNAType(TrafColumnsDesc *column_desc /*IN*/,
if ( column_desc->precision > 0 )
sizeInChars = column_desc->precision;
type = new (heap)
- SQLVarChar(CharLenInfo(sizeInChars, charCount/*in_bytes*/),
+ SQLVarChar(heap, CharLenInfo(sizeInChars, charCount/*in_bytes*/),
column_desc->isNullable(),
column_desc->isUpshifted(),
column_desc->isCaseInsensitive(),
@@ -479,7 +459,7 @@ NABoolean NAColumn::createNAType(TrafColumnsDesc *column_desc /*IN*/,
}
else // keep the old behavior
type = new (heap)
- SQLVarChar(charCount,
+ SQLVarChar(heap, charCount,
column_desc->isNullable(),
column_desc->isUpshifted(),
column_desc->isCaseInsensitive(),
@@ -491,7 +471,7 @@ NABoolean NAColumn::createNAType(TrafColumnsDesc *column_desc /*IN*/,
case REC_BYTE_V_ASCII_LONG:
type = new (heap)
- SQLLongVarChar(charCount,
+ SQLLongVarChar(heap, charCount,
FALSE,
column_desc->isNullable(),
column_desc->isUpshifted(),
@@ -530,12 +510,11 @@ NABoolean NAColumn::createNAType(TrafColumnsDesc *column_desc /*IN*/,
break;
case REC_INTERVAL:
type = new (heap)
- SQLInterval(column_desc->isNullable(),
+ SQLInterval(heap, column_desc->isNullable(),
column_desc->datetimeStart(),
column_desc->intervalleadingprec,
column_desc->datetimeEnd(),
- column_desc->datetimefractprec,
- heap
+ column_desc->datetimefractprec
);
CMPASSERT(type);
if (! ((SQLInterval *)type)->checkValid(CmpCommon::diags()))
@@ -552,18 +531,18 @@ NABoolean NAColumn::createNAType(TrafColumnsDesc *column_desc /*IN*/,
break;
case REC_BLOB :
type = new (heap)
- SQLBlob(column_desc->precision, Lob_Invalid_Storage,
+ SQLBlob(heap, column_desc->precision, Lob_Invalid_Storage,
column_desc->isNullable());
break;
case REC_CLOB :
type = new (heap)
- SQLClob(column_desc->precision, Lob_Invalid_Storage,
+ SQLClob(heap, column_desc->precision, Lob_Invalid_Storage,
column_desc->isNullable());
break;
case REC_BOOLEAN :
- type = new (heap) SQLBooleanNative(column_desc->isNullable());
+ type = new (heap) SQLBooleanNative(heap, column_desc->isNullable());
break;
default:
http://git-wip-us.apache.org/repos/asf/incubator-trafodion/blob/35a656be/core/sql/optimizer/NARoutine.cpp
----------------------------------------------------------------------
diff --git a/core/sql/optimizer/NARoutine.cpp b/core/sql/optimizer/NARoutine.cpp
index edf703c..f98dd6c 100644
--- a/core/sql/optimizer/NARoutine.cpp
+++ b/core/sql/optimizer/NARoutine.cpp
@@ -219,7 +219,7 @@ NARoutine::NARoutine ( const QualifiedName &name
for (CollIndex currentCol=0; currentCol<colCount; currentCol++)
{
// Create the new NAType.
- newColType = new (heap) SQLVarChar ( 255
+ newColType = new (heap) SQLVarChar (heap, 255
, 1
, FALSE
, FALSE /*not caseinsensitive, for now*/
http://git-wip-us.apache.org/repos/asf/incubator-trafodion/blob/35a656be/core/sql/optimizer/NATable.cpp
----------------------------------------------------------------------
diff --git a/core/sql/optimizer/NATable.cpp b/core/sql/optimizer/NATable.cpp
index 0da775e..e8ba671 100644
--- a/core/sql/optimizer/NATable.cpp
+++ b/core/sql/optimizer/NATable.cpp
@@ -2905,200 +2905,180 @@ NABoolean createNAType(TrafColumnsDesc *column_desc /*IN*/,
case REC_BPINT_UNSIGNED :
type = new (heap)
- SQLBPInt(column_desc->precision, column_desc->isNullable(), FALSE, heap);
+ SQLBPInt(heap, column_desc->precision, column_desc->isNullable(), FALSE);
break;
case REC_BIN8_SIGNED:
if (column_desc->precision > 0)
type = new (heap)
- SQLNumeric(column_desc->length,
+ SQLNumeric(heap, column_desc->length,
column_desc->precision,
column_desc->scale,
TRUE,
- column_desc->isNullable(),
- heap
+ column_desc->isNullable()
);
else
type = new (heap)
- SQLTiny(TRUE,
- column_desc->isNullable(),
- heap
+ SQLTiny(heap, TRUE,
+ column_desc->isNullable()
);
break;
case REC_BIN8_UNSIGNED:
if (column_desc->precision > 0)
type = new (heap)
- SQLNumeric(column_desc->length,
+ SQLNumeric(heap, column_desc->length,
column_desc->precision,
column_desc->scale,
FALSE,
- column_desc->isNullable(),
- heap
+ column_desc->isNullable()
);
else
type = new (heap)
- SQLTiny(FALSE,
- column_desc->isNullable(),
- heap
+ SQLTiny(heap, FALSE,
+ column_desc->isNullable()
);
break;
case REC_BIN16_SIGNED:
if (column_desc->precision > 0)
type = new (heap)
- SQLNumeric(column_desc->length,
+ SQLNumeric(heap, column_desc->length,
column_desc->precision,
column_desc->scale,
TRUE,
- column_desc->isNullable(),
- heap
+ column_desc->isNullable()
);
else
type = new (heap)
- SQLSmall(TRUE,
- column_desc->isNullable(),
- heap
+ SQLSmall(heap, TRUE,
+ column_desc->isNullable()
);
break;
case REC_BIN16_UNSIGNED:
if (column_desc->precision > 0)
type = new (heap)
- SQLNumeric(column_desc->length,
+ SQLNumeric(heap, column_desc->length,
column_desc->precision,
column_desc->scale,
FALSE,
- column_desc->isNullable(),
- heap
+ column_desc->isNullable()
);
else
type = new (heap)
- SQLSmall(FALSE,
- column_desc->isNullable(),
- heap
+ SQLSmall(heap, FALSE,
+ column_desc->isNullable()
);
break;
case REC_BIN32_SIGNED:
if (column_desc->precision > 0)
type = new (heap)
- SQLNumeric(column_desc->length,
+ SQLNumeric(heap, column_desc->length,
column_desc->precision,
column_desc->scale,
TRUE,
- column_desc->isNullable(),
- heap
+ column_desc->isNullable()
);
else
type = new (heap)
- SQLInt(TRUE,
- column_desc->isNullable(),
- heap
+ SQLInt(heap, TRUE,
+ column_desc->isNullable()
);
break;
case REC_BIN32_UNSIGNED:
if (column_desc->precision > 0)
type = new (heap)
- SQLNumeric(column_desc->length,
+ SQLNumeric(heap, column_desc->length,
column_desc->precision,
column_desc->scale,
FALSE,
- column_desc->isNullable(),
- heap
+ column_desc->isNullable()
);
else
type = new (heap)
- SQLInt(FALSE,
- column_desc->isNullable(),
- heap
+ SQLInt(heap, FALSE,
+ column_desc->isNullable()
);
break;
case REC_BIN64_SIGNED:
if (column_desc->precision > 0)
type = new (heap)
- SQLNumeric(column_desc->length,
+ SQLNumeric(heap, column_desc->length,
column_desc->precision,
column_desc->scale,
TRUE,
- column_desc->isNullable(),
- heap
+ column_desc->isNullable()
);
else
type = new (heap)
- SQLLargeInt(TRUE,
- column_desc->isNullable(),
- heap
+ SQLLargeInt(heap, TRUE,
+ column_desc->isNullable()
);
break;
case REC_BIN64_UNSIGNED:
if (column_desc->precision > 0)
type = new (heap)
- SQLNumeric(column_desc->length,
+ SQLNumeric(heap, column_desc->length,
column_desc->precision,
column_desc->scale,
FALSE,
- column_desc->isNullable(),
- heap
+ column_desc->isNullable()
);
else
type = new (heap)
- SQLLargeInt(FALSE,
- column_desc->isNullable(),
- heap
+ SQLLargeInt(heap, FALSE,
+ column_desc->isNullable()
);
break;
case REC_DECIMAL_UNSIGNED:
type = new (heap)
- SQLDecimal(column_desc->length,
+ SQLDecimal(heap, column_desc->length,
column_desc->scale,
FALSE,
- column_desc->isNullable(),
- heap
+ column_desc->isNullable()
);
break;
case REC_DECIMAL_LSE:
type = new (heap)
- SQLDecimal(column_desc->length,
+ SQLDecimal(heap, column_desc->length,
column_desc->scale,
TRUE,
- column_desc->isNullable(),
- heap
+ column_desc->isNullable()
);
break;
case REC_NUM_BIG_UNSIGNED:
type = new (heap)
- SQLBigNum(column_desc->precision,
+ SQLBigNum(heap, column_desc->precision,
column_desc->scale,
TRUE, // is a real bignum
FALSE,
- column_desc->isNullable(),
- heap
+ column_desc->isNullable()
);
break;
case REC_NUM_BIG_SIGNED:
type = new (heap)
- SQLBigNum(column_desc->precision,
+ SQLBigNum(heap, column_desc->precision,
column_desc->scale,
TRUE, // is a real bignum
TRUE,
- column_desc->isNullable(),
- heap
+ column_desc->isNullable()
);
break;
case REC_FLOAT32:
type = new (heap)
- SQLReal(column_desc->isNullable(), heap, column_desc->precision);
+ SQLReal(heap, column_desc->isNullable(), column_desc->precision);
break;
case REC_FLOAT64:
type = new (heap)
- SQLDoublePrecision(column_desc->isNullable(), heap, column_desc->precision);
+ SQLDoublePrecision(heap, column_desc->isNullable(), column_desc->precision);
break;
case REC_BYTE_F_DOUBLE:
charCount /= SQL_DBCHAR_SIZE; // divide the storage length by 2
type = new (heap)
- SQLChar(charCount,
+ SQLChar(heap, charCount,
column_desc->isNullable(),
column_desc->isUpshifted(),
column_desc->isCaseInsensitive(),
@@ -3119,7 +3099,7 @@ NABoolean createNAType(TrafColumnsDesc *column_desc /*IN*/,
if ( column_desc->precision > 0 )
sizeInChars = column_desc->precision;
type = new (heap)
- SQLChar(CharLenInfo(sizeInChars, charCount/*in_bytes*/),
+ SQLChar(heap, CharLenInfo(sizeInChars, charCount/*in_bytes*/),
column_desc->isNullable(),
column_desc->isUpshifted(),
column_desc->isCaseInsensitive(),
@@ -3132,7 +3112,7 @@ NABoolean createNAType(TrafColumnsDesc *column_desc /*IN*/,
}
else // keep the old behavior
type = new (heap)
- SQLChar(charCount,
+ SQLChar(heap, charCount,
column_desc->isNullable(),
column_desc->isUpshifted(),
column_desc->isCaseInsensitive(),
@@ -3155,7 +3135,7 @@ NABoolean createNAType(TrafColumnsDesc *column_desc /*IN*/,
if ( column_desc->precision > 0 )
sizeInChars = column_desc->precision;
type = new (heap)
- SQLVarChar(CharLenInfo(sizeInChars, charCount/*in_bytes*/),
+ SQLVarChar(heap, CharLenInfo(sizeInChars, charCount/*in_bytes*/),
column_desc->isNullable(),
column_desc->isUpshifted(),
column_desc->isCaseInsensitive(),
@@ -3167,7 +3147,7 @@ NABoolean createNAType(TrafColumnsDesc *column_desc /*IN*/,
}
else // keep the old behavior
type = new (heap)
- SQLVarChar(charCount,
+ SQLVarChar(heap, charCount,
column_desc->isNullable(),
column_desc->isUpshifted(),
column_desc->isCaseInsensitive(),
@@ -3179,7 +3159,7 @@ NABoolean createNAType(TrafColumnsDesc *column_desc /*IN*/,
case REC_BYTE_V_ASCII_LONG:
type = new (heap)
- SQLLongVarChar(charCount,
+ SQLLongVarChar(heap, charCount,
FALSE,
column_desc->isNullable(),
column_desc->isUpshifted(),
@@ -3218,13 +3198,11 @@ NABoolean createNAType(TrafColumnsDesc *column_desc /*IN*/,
break;
case REC_INTERVAL:
type = new (heap)
- SQLInterval(column_desc->isNullable(),
+ SQLInterval(heap, column_desc->isNullable(),
column_desc->datetimeStart(),
column_desc->intervalleadingprec,
column_desc->datetimeEnd(),
- column_desc->datetimefractprec,
- heap
- );
+ column_desc->datetimefractprec);
CMPASSERT(type);
if (! ((SQLInterval *)type)->checkValid(CmpCommon::diags()))
return TRUE; // error
@@ -3241,19 +3219,19 @@ NABoolean createNAType(TrafColumnsDesc *column_desc /*IN*/,
case REC_BLOB :
type = new (heap)
- SQLBlob(column_desc->precision,Lob_Invalid_Storage,
+ SQLBlob(heap, column_desc->precision,Lob_Invalid_Storage,
column_desc->isNullable());
break;
case REC_CLOB :
type = new (heap)
- SQLClob(column_desc->precision,Lob_Invalid_Storage,
+ SQLClob(heap, column_desc->precision,Lob_Invalid_Storage,
column_desc->isNullable());
break;
case REC_BOOLEAN :
{
- type = new (heap) SQLBooleanNative(column_desc->isNullable());
+ type = new (heap) SQLBooleanNative(heap, column_desc->isNullable());
}
break;
http://git-wip-us.apache.org/repos/asf/incubator-trafodion/blob/35a656be/core/sql/optimizer/NormItemExpr.cpp
----------------------------------------------------------------------
diff --git a/core/sql/optimizer/NormItemExpr.cpp b/core/sql/optimizer/NormItemExpr.cpp
index 08e5d30..4a248e7 100644
--- a/core/sql/optimizer/NormItemExpr.cpp
+++ b/core/sql/optimizer/NormItemExpr.cpp
@@ -4772,7 +4772,7 @@ ItemExpr * ItmSeqDiff1::transformDiff1()
{
ItemExpr *castExpr = new HEAP Cast (tfm2,
new HEAP
- SQLLargeInt(TRUE, TRUE)); // (must be) signed; nulls allowed
+ SQLLargeInt(HEAP, TRUE, TRUE)); // (must be) signed; nulls allowed
tfm2 = castExpr;
}
@@ -4849,7 +4849,7 @@ ItemExpr * ItmSeqDiff2::transformDiff2()
{
ItemExpr *castExpr = new HEAP Cast (tfm2,
new HEAP
- SQLLargeInt(TRUE, TRUE)); // (must be) signed; nulls allowed
+ SQLLargeInt(HEAP, TRUE, TRUE)); // (must be) signed; nulls allowed
tfm2 = castExpr;
}
@@ -5015,7 +5015,7 @@ void ItmSeqRunningFunction::transformNode(NormWA & normWARef,
//--------------------------------------------------------------------------------------
ItemExpr * ItmSeqRunningFunction::transformRunningVariance()
{
- const NAType *desiredType = new HEAP SQLDoublePrecision(TRUE);
+ const NAType *desiredType = new HEAP SQLDoublePrecision(HEAP, TRUE);
ItemExpr *childDouble = new HEAP Cast(child(0), desiredType);
ItemExpr *childDoubleSquared = new HEAP BiArith(ITM_TIMES, // x * x
childDouble,
@@ -5189,7 +5189,7 @@ void ItmSeqOlapFunction::transformNode(NormWA & normWARef,
ItemExpr * ItmSeqOlapFunction::transformOlapVariance(CollHeap *wHeap)
{
- const NAType *desiredType = new (wHeap) SQLDoublePrecision(TRUE);
+ const NAType *desiredType = new (wHeap) SQLDoublePrecision(wHeap, TRUE);
ItemExpr *childDouble = new (wHeap) Cast(child(0), desiredType);
ItemExpr *childDoubleSquared = new (wHeap) BiArith(ITM_TIMES, // x * x
childDouble,
@@ -5819,7 +5819,7 @@ ItemExpr * ItmSeqMovingFunction::transformMovingMinMax()
//
ItemExpr * ItmSeqMovingFunction::transformMovingVariance()
{
- const NAType *desiredType = new HEAP SQLDoublePrecision(TRUE);
+ const NAType *desiredType = new HEAP SQLDoublePrecision(HEAP, TRUE);
ItemExpr *childDouble = new HEAP Cast(child(0), desiredType);
ItemExpr *childDoubleSquared = new HEAP BiArith(ITM_TIMES, // x * x
childDouble,
http://git-wip-us.apache.org/repos/asf/incubator-trafodion/blob/35a656be/core/sql/optimizer/OptRange.cpp
----------------------------------------------------------------------
diff --git a/core/sql/optimizer/OptRange.cpp b/core/sql/optimizer/OptRange.cpp
index 179acf4..0aacab3 100644
--- a/core/sql/optimizer/OptRange.cpp
+++ b/core/sql/optimizer/OptRange.cpp
@@ -1261,28 +1261,28 @@ static void downcastRangespecInt(Int64 val, Lng32 scale, NAType*& type,
{
*((Int16*)numBuf) = static_cast<Int16>(val);
if (scale == 0)
- type = new(heap) SQLSmall(TRUE, FALSE, heap);
+ type = new(heap) SQLSmall(heap, TRUE, FALSE);
else
- type = new(heap) SQLNumeric(sizeof(Int16), precision, scale,
- TRUE, FALSE, heap);
+ type = new(heap) SQLNumeric(heap, sizeof(Int16), precision, scale,
+ TRUE, FALSE);
}
else if (val <= INT_MAX && val >= INT_MIN)
{
*((Int32*)numBuf) = static_cast<Int32>(val);
if (scale == 0)
- type = new(heap) SQLInt(TRUE, FALSE, heap);
+ type = new(heap) SQLInt(heap, TRUE, FALSE);
else
- type = new(heap) SQLNumeric(sizeof(Int32), precision, scale,
- TRUE, FALSE, heap);
+ type = new(heap) SQLNumeric(heap, sizeof(Int32), precision, scale,
+ TRUE, FALSE);
}
else
{
*numBuf = val;
if(scale == 0)
- type = new(heap) SQLLargeInt(TRUE, FALSE, heap);
+ type = new(heap) SQLLargeInt(heap, TRUE, FALSE);
else
- type = new(heap) SQLNumeric(sizeof(Int64), precision, scale,
- TRUE, FALSE, heap);
+ type = new(heap) SQLNumeric(heap, sizeof(Int64), precision, scale,
+ TRUE, FALSE);
}
}
@@ -1342,7 +1342,7 @@ ConstValue* OptRangeSpec::reconstituteInt64Value(NAType* type, Int64 val) const
dtv.isValid(), QRLogicException,
"Invalid date value reconstructed from Julian timestamp");
constValTextStr = dtv.getValueAsString(*dtType);
- return new(mvqrHeap_) ConstValue(new(mvqrHeap_)SQLDate(FALSE, mvqrHeap_),
+ return new(mvqrHeap_) ConstValue(new(mvqrHeap_)SQLDate(mvqrHeap_, FALSE),
(void*)dtv.getValue(), dtv.getValueLen(),
&constValTextStr, mvqrHeap_);
break;
@@ -1367,9 +1367,8 @@ ConstValue* OptRangeSpec::reconstituteInt64Value(NAType* type, Int64 val) const
"Invalid time value reconstructed from Int64 value");
constValTextStr = dtv.getValueAsString(*dtType);
return new(mvqrHeap_)
- ConstValue(new(mvqrHeap_)SQLTime(FALSE,
- dtType->getFractionPrecision(),
- mvqrHeap_),
+ ConstValue(new(mvqrHeap_)SQLTime(mvqrHeap_, FALSE,
+ dtType->getFractionPrecision()),
(void*)dtv.getValue(), dtv.getValueLen(),
&constValTextStr, mvqrHeap_);
break;
@@ -1387,9 +1386,8 @@ ConstValue* OptRangeSpec::reconstituteInt64Value(NAType* type, Int64 val) const
"Invalid timestamp value reconstructed from Julian timestamp");
constValTextStr = dtv.getValueAsString(*dtType);
return new(mvqrHeap_) ConstValue(new(mvqrHeap_)
- SQLTimestamp(FALSE,
- dtType->getFractionPrecision(),
- mvqrHeap_),
+ SQLTimestamp(mvqrHeap_, FALSE,
+ dtType->getFractionPrecision()),
(void*)dtv.getValue(),
dtv.getValueLen(),
&constValTextStr, mvqrHeap_);
@@ -1509,12 +1507,11 @@ ConstValue* OptRangeSpec::reconstituteInt64Value(NAType* type, Int64 val) const
// the Normalizer rather than MVQR, because type constraints are not
// incorporated in that case). See bug 2974.
return new(mvqrHeap_) ConstValue(new(mvqrHeap_)SQLInterval
- (FALSE,
+ (mvqrHeap_, FALSE,
intvlType->getEndField(),
leadingPrec,
intvlType->getEndField(),
- intvlType->getFractionPrecision(),
- mvqrHeap_),
+ intvlType->getFractionPrecision()),
(void*)intvlVal.getValue(),
intvlVal.getValueLen(),
&constValTextStr, mvqrHeap_);
@@ -1560,7 +1557,7 @@ ConstValue* OptRangeSpec::reconstituteDoubleValue(NAType* type, Float64 val) con
"Expecting approximate numeric type in "
"reconstituteDoubleValue");
- NAType* constType = new(mvqrHeap_) SQLDoublePrecision(FALSE, mvqrHeap_);
+ NAType* constType = new(mvqrHeap_) SQLDoublePrecision(mvqrHeap_, FALSE);
return new(mvqrHeap_) ConstValue(constType, &val, constType->getNominalSize(),
&constValTextStr, mvqrHeap_);
} // reconstituteDoubleValue()
@@ -1573,7 +1570,7 @@ ItemExpr* OptRangeSpec::makeSubrangeORBackbone(SubrangeBase* subrange,
QRTRACER("makeSubrangeOrBackbone");
NAType* type = getType()->newCopy(mvqrHeap_);
- NAType* int64Type = new (mvqrHeap_) SQLLargeInt(TRUE, FALSE );
+ NAType* int64Type = new (mvqrHeap_) SQLLargeInt(mvqrHeap_, TRUE, FALSE );
type->resetSQLnullFlag();
type->resetSQLnullHdrSize();
assertLogAndThrow(CAT_SQL_COMP_RANGE, logLevel_,
http://git-wip-us.apache.org/repos/asf/incubator-trafodion/blob/35a656be/core/sql/optimizer/PartFunc.cpp
----------------------------------------------------------------------
diff --git a/core/sql/optimizer/PartFunc.cpp b/core/sql/optimizer/PartFunc.cpp
index 377c9d9..706c308 100644
--- a/core/sql/optimizer/PartFunc.cpp
+++ b/core/sql/optimizer/PartFunc.cpp
@@ -791,7 +791,7 @@ SinglePartitionPartitioningFunction::createPartitioningExpression()
// ---------------------------------------------------------------------
ItemExpr * partFunc = new (CmpCommon::statementHeap())
Cast(new (CmpCommon::statementHeap()) SystemLiteral(0),
- new (CmpCommon::statementHeap()) SQLInt(FALSE,FALSE));
+ new (CmpCommon::statementHeap()) SQLInt(CmpCommon::statementHeap(), FALSE,FALSE));
partFunc->synthTypeAndValueId();
storeExpression(partFunc);
@@ -1115,11 +1115,11 @@ void PartitioningFunction::createBetweenPartitioningKeyPredicates(
// the partition input values are two integer values: lo and hi part #
loPart = new (CmpCommon::statementHeap())
HostVar(pivLoName,
- new (CmpCommon::statementHeap()) SQLInt(FALSE,FALSE),
+ new (CmpCommon::statementHeap()) SQLInt(CmpCommon::statementHeap(), FALSE,FALSE),
TRUE);
hiPart = new (CmpCommon::statementHeap())
HostVar(pivHiName,
- new (CmpCommon::statementHeap()) SQLInt(FALSE,FALSE),
+ new (CmpCommon::statementHeap()) SQLInt(CmpCommon::statementHeap(), FALSE,FALSE),
TRUE);
loPart->synthTypeAndValueId();
hiPart->synthTypeAndValueId();
@@ -1160,9 +1160,8 @@ void PartitioningFunction::createBetweenPartitioningKeyPredicates(
NAString numPartsLiteral(numPartsString);
ConstValue *numPartns = new (CmpCommon::statementHeap())
ConstValue(new (CmpCommon::statementHeap())
- SQLInt(FALSE,
- FALSE,
- CmpCommon::statementHeap()),
+ SQLInt(CmpCommon::statementHeap(), FALSE,
+ FALSE),
(void *) &numOfOrigPartns,
(Lng32) sizeof(numOfOrigPartns),
&numPartsLiteral,
@@ -1457,7 +1456,7 @@ getCastedSkewValueExpr(const EncodedValue& ev, const NAType& oType, CollHeap* he
double x = ev.getDblValue();
return new (heap) Cast(
new (heap) ConstValue(
- new (heap) SQLDoublePrecision(FALSE /* no SQL NULL*/, heap),
+ new (heap) SQLDoublePrecision(heap, FALSE /* no SQL NULL*/),
(char*)&x, sizeof(x)
),
&oType
@@ -1541,7 +1540,7 @@ TableHashPartitioningFunction::createPartitionSelectionExprInputs()
ItemExpr *numParts = new (heap)
HostVar(hvFabricatedName,
// int not null
- new (heap) SQLInt(FALSE, FALSE),
+ new (heap) SQLInt(CmpCommon::statementHeap(), FALSE, FALSE),
// is system-supplied
TRUE);
numParts->synthTypeAndValueId();
@@ -1553,7 +1552,7 @@ TableHashPartitioningFunction::createPartitionSelectionExprInputs()
ItemExpr *partNum = new (heap)
HostVar(hvFabricatedName,
// int not null
- new (heap) SQLInt(FALSE, FALSE),
+ new (heap) SQLInt(CmpCommon::statementHeap(), FALSE, FALSE),
// is system-supplied
TRUE);
partNum->synthTypeAndValueId();
@@ -1718,7 +1717,7 @@ TableHashPartitioningFunction::createPartitioningExpressionImp(NABoolean doVarCh
{
dataConversionErrorFlag =
new (heap) HostVar("_sys_repartConvErrorFlg",
- new (heap) SQLInt(TRUE,FALSE),
+ new (heap) SQLInt(heap, TRUE,FALSE),
TRUE);
storeConvErrorExpr(dataConversionErrorFlag);
}
@@ -1884,7 +1883,7 @@ createPartitionSelectionExpr(const SearchKey *partSearchKey,
{
dataConversionErrorFlag =
new (heap) HostVar("_sys_repartConvErrorFlg",
- new (heap) SQLInt(TRUE,FALSE),
+ new (heap) SQLInt(heap, TRUE,FALSE),
TRUE);
storeConvErrorExpr(dataConversionErrorFlag);
}
@@ -2371,7 +2370,7 @@ HashDistPartitioningFunction::buildPartitioningExpression(
{
CollHeap *heap = CmpCommon::statementHeap();
- NAType *numPartsType = new (heap) SQLInt(FALSE,FALSE);
+ NAType *numPartsType = new (heap) SQLInt(heap, FALSE,FALSE);
char buffer[20];
// Create a ConstValue expression containing the original number of hash
@@ -2709,7 +2708,7 @@ ItemExpr *
Hash2PartitioningFunction::buildPartitioningExpression(const ValueIdList &keyCols) const
{
CollHeap *heap = CmpCommon::statementHeap();
- NAType *numPartsType = new (heap) SQLInt(FALSE,FALSE);
+ NAType *numPartsType = new (heap) SQLInt(heap, FALSE,FALSE);
// Build a ConstValue expression of the scaled number of partitions.
Lng32 numParts = getCountOfPartitions();
@@ -2757,7 +2756,7 @@ PartitioningFunction::getCastedItemExpre(ItemExpr* iv, const NAType& oType, Coll
dataConversionErrorFlag =
new (CmpCommon::statementHeap()) HostVar(
"_sys_repartConvErrorFlg",
- new (CmpCommon::statementHeap()) SQLInt(TRUE,FALSE),
+ new (CmpCommon::statementHeap()) SQLInt(CmpCommon::statementHeap(), TRUE,FALSE),
TRUE);
storeConvErrorExpr(dataConversionErrorFlag);
}
@@ -2825,7 +2824,7 @@ void SkewedDataPartitioningFunction::createPIV(ValueIdList &partInputValues)
//
ItemExpr *dummyPIV = new (CmpCommon::statementHeap())
HostVar("_sys_dummySkewBusterPartNo",
- new (CmpCommon::statementHeap()) SQLInt(FALSE, FALSE),
+ new (CmpCommon::statementHeap()) SQLInt(CmpCommon::statementHeap(), FALSE, FALSE),
TRUE);
dummyPIV->synthTypeAndValueId();
@@ -4181,7 +4180,7 @@ void RangePartitioningFunction::createPartitioningKeyPredicates()
ItemExpr *intervalExclusionIndicator =
new(CmpCommon::statementHeap()) HostVar(
"_sys_hostVarExclRange",
- new(CmpCommon::statementHeap()) SQLInt(TRUE,FALSE),
+ new(CmpCommon::statementHeap()) SQLInt(CmpCommon::statementHeap(), TRUE,FALSE),
TRUE);
intervalExclusionIndicator->synthTypeAndValueId();
partInputValues.insert(intervalExclusionIndicator->getValueId());
@@ -4595,7 +4594,7 @@ ItemExpr* RangePartitioningFunction::createPartitioningExpression()
dataConversionErrorFlag =
new (CmpCommon::statementHeap()) HostVar(
"_sys_repartConvErrorFlg",
- new (CmpCommon::statementHeap()) SQLInt(TRUE,FALSE),
+ new (CmpCommon::statementHeap()) SQLInt(CmpCommon::statementHeap(), TRUE,FALSE),
TRUE);
storeConvErrorExpr(dataConversionErrorFlag);
}
@@ -5739,12 +5738,12 @@ void RoundRobinPartitioningFunction::createPartitioningKeyPredicates()
//
ItemExpr *loPart = new (CmpCommon::statementHeap())
HostVar("_sys_HostVarLoRoundRobinPart",
- new (CmpCommon::statementHeap()) SQLInt(FALSE, FALSE),
+ new (CmpCommon::statementHeap()) SQLInt(CmpCommon::statementHeap(), FALSE, FALSE),
TRUE);
ItemExpr *hiPart = new (CmpCommon::statementHeap())
HostVar("_sys_HostVarHiRoundRobinPart",
- new (CmpCommon::statementHeap()) SQLInt(FALSE, FALSE),
+ new (CmpCommon::statementHeap()) SQLInt(CmpCommon::statementHeap(), FALSE, FALSE),
TRUE);
loPart->synthTypeAndValueId();
@@ -5844,7 +5843,7 @@ ItemExpr* RoundRobinPartitioningFunction::createPartitioningExpression()
// The type of the partitioning key for round robin is always
// SQLLargeInt (the type of SYSKEY)
//
- NAType *desiredType = new (heap) SQLLargeInt(TRUE, FALSE);
+ NAType *desiredType = new (heap) SQLLargeInt(heap, TRUE, FALSE);
// The layout of the SYSKEY is
//
@@ -5857,9 +5856,9 @@ ItemExpr* RoundRobinPartitioningFunction::createPartitioningExpression()
desiredType),
new (heap)
ConstValue(32)),
- new (heap) SQLInt(FALSE,FALSE));
+ new (heap) SQLInt(heap, FALSE,FALSE));
- NAType *numPartsType = new (heap) SQLInt(FALSE,FALSE);
+ NAType *numPartsType = new (heap) SQLInt(heap, FALSE,FALSE);
Lng32 numParts = getCountOfOrigRRPartitions();
char buffer[20];
@@ -5919,7 +5918,7 @@ createPartitionSelectionExpr(const SearchKey *partSearchKey,
//
ItemExpr *numParts = new (heap) HostVar("_sys_hostVarNumParts",
// int not null
- new (heap) SQLInt(FALSE, FALSE),
+ new (heap) SQLInt(heap, FALSE, FALSE),
// is system-supplied
TRUE);
numParts->synthTypeAndValueId();
@@ -5929,7 +5928,7 @@ createPartitionSelectionExpr(const SearchKey *partSearchKey,
//
ItemExpr *partNum = new (heap) HostVar("_sys_hostVarPartNo",
// int not null
- new (heap) SQLInt(FALSE, FALSE),
+ new (heap) SQLInt(heap, FALSE, FALSE),
// is system-supplied
TRUE);
partNum->synthTypeAndValueId();
@@ -5960,7 +5959,7 @@ createPartitionSelectionExpr(const SearchKey *partSearchKey,
new (heap) Modulus(new (heap) Cast(new (heap)
BiArith(ITM_PLUS, partNum,
new (heap) SystemLiteral(1)),
- new (heap) SQLInt(TRUE,FALSE)),
+ new (heap) SQLInt(heap, TRUE,FALSE)),
numParts);
// Bind the expression.
@@ -5987,7 +5986,7 @@ createPartitionSelectionExpr(const SearchKey *partSearchKey,
// The type of the partitioning key for round robin is always
// SQLLargeInt (the type of SYSKEY)
//
- NAType *desiredType = new (heap) SQLLargeInt(TRUE, FALSE);
+ NAType *desiredType = new (heap) SQLLargeInt(heap,TRUE, FALSE);
// The partition selection expression is:
//
@@ -6014,7 +6013,7 @@ createPartitionSelectionExpr(const SearchKey *partSearchKey,
desiredType),
new (heap)
SystemLiteral(0x1000)),
- new (heap) SQLInt(FALSE,FALSE)),
+ new (heap) SQLInt(heap, FALSE,FALSE)),
numParts);
// Bind the expression.
http://git-wip-us.apache.org/repos/asf/incubator-trafodion/blob/35a656be/core/sql/optimizer/QRDescGenerator.cpp
----------------------------------------------------------------------
diff --git a/core/sql/optimizer/QRDescGenerator.cpp b/core/sql/optimizer/QRDescGenerator.cpp
index 32901f3..9ea571c 100644
--- a/core/sql/optimizer/QRDescGenerator.cpp
+++ b/core/sql/optimizer/QRDescGenerator.cpp
@@ -178,22 +178,22 @@ void EqualitySet::determineType()
{
// Binary precision smallint, int, largeint, real, double)
if (magnitude < 50)
- type_ = new(heap_) SQLSmall(isSigned, isNullable, heap_);
+ type_ = new(heap_) SQLSmall(heap_,isSigned, isNullable);
else if (magnitude < 100)
- type_ = new(heap_) SQLInt(isSigned, isNullable, heap_);
+ type_ = new(heap_) SQLInt(heap_, isSigned, isNullable);
else if (magnitude < 200)
- type_ = new(heap_) SQLLargeInt(isSigned, isNullable, heap_);
+ type_ = new(heap_) SQLLargeInt(heap_, isSigned, isNullable);
else if (magnitude < 500)
- type_ = new(heap_) SQLReal(isNullable, heap_);
+ type_ = new(heap_) SQLReal(heap_, isNullable);
else
- type_ = new(heap_) SQLDoublePrecision(isNullable, heap_);
+ type_ = new(heap_) SQLDoublePrecision(heap_, isNullable);
}
else
{
// @ZX need to amend this (and elsewhere) for SQLBigNum.
// Numeric or Decimal -- type will be generated as Numeric
const Int16 DisAmbiguate = 0;
- type_ = new(heap_) SQLNumeric(isSigned, (magnitude / 10) + scale, scale,
+ type_ = new(heap_) SQLNumeric(heap_, isSigned, (magnitude / 10) + scale, scale,
DisAmbiguate, // added for 64bit proj.
isNullable);
}
http://git-wip-us.apache.org/repos/asf/incubator-trafodion/blob/35a656be/core/sql/optimizer/QRDescriptorExtentions.cpp
----------------------------------------------------------------------
diff --git a/core/sql/optimizer/QRDescriptorExtentions.cpp b/core/sql/optimizer/QRDescriptorExtentions.cpp
index fc40060..68556e4 100644
--- a/core/sql/optimizer/QRDescriptorExtentions.cpp
+++ b/core/sql/optimizer/QRDescriptorExtentions.cpp
@@ -171,7 +171,7 @@ ItemExpr* QRFunction::toItemExpr(const NAString& mvName, CollHeap* heap,
// otherwise, ScalarVariance::preCodeGen will GenAssert.
NABoolean isScalarVariance = (getFunctionName() == "Scalar Variance" ||
getFunctionName() == "Scalar Stddev" );
- NAType *dbl = new(heap) SQLDoublePrecision(FALSE, heap);
+ NAType *dbl = new(heap) SQLDoublePrecision(heap, FALSE);
// Loop over the arguments and call recursively.
for (CollIndex i=0; i<args.entries(); i++)
http://git-wip-us.apache.org/repos/asf/incubator-trafodion/blob/35a656be/core/sql/optimizer/RelCache.cpp
----------------------------------------------------------------------
diff --git a/core/sql/optimizer/RelCache.cpp b/core/sql/optimizer/RelCache.cpp
index 1c35fd1..5fb606c 100644
--- a/core/sql/optimizer/RelCache.cpp
+++ b/core/sql/optimizer/RelCache.cpp
@@ -241,7 +241,7 @@ RelExpr* Scan::normalizeForCache(CacheWA& cwa, BindWA& bindWA)
HostVar * hv =
new(bindWA.wHeap())
HostVar(hvName,
- new(bindWA.wHeap()) SQLChar(CACHED_MAX_ANSI_NAME_EXTERNAL_LEN));
+ new(bindWA.wHeap()) SQLChar(bindWA.wHeap(), CACHED_MAX_ANSI_NAME_EXTERNAL_LEN));
hv->setPrototypeValue(origName.getQualifiedNameAsString());
hv->synthTypeAndValueId();
hv->setIsCachedParam(TRUE);
@@ -265,7 +265,7 @@ RelExpr* Scan::normalizeForCache(CacheWA& cwa, BindWA& bindWA)
new(bindWA.wHeap()) char[CACHED_MAX_ANSI_NAME_EXTERNAL_LEN];
strcpy(strval, origName.getQualifiedNameAsString().data());
CharType * typ =
- new(bindWA.wHeap()) SQLChar(CACHED_MAX_ANSI_NAME_EXTERNAL_LEN, FALSE);
+ new(bindWA.wHeap()) SQLChar(bindWA.wHeap(), CACHED_MAX_ANSI_NAME_EXTERNAL_LEN, FALSE);
ConstValue * cv =
new(bindWA.wHeap()) ConstValue(typ, strval, CACHED_MAX_ANSI_NAME_EXTERNAL_LEN);
http://git-wip-us.apache.org/repos/asf/incubator-trafodion/blob/35a656be/core/sql/optimizer/RelStoredProc.cpp
----------------------------------------------------------------------
diff --git a/core/sql/optimizer/RelStoredProc.cpp b/core/sql/optimizer/RelStoredProc.cpp
index 43e5cff..79e23c8 100644
--- a/core/sql/optimizer/RelStoredProc.cpp
+++ b/core/sql/optimizer/RelStoredProc.cpp
@@ -350,7 +350,7 @@ RelExpr* RelInternalSP::bindNode(BindWA *bindWA)
str_cpy (&newInput[inputSize+1], defaultSchema.data(), defaultSchema.length());
#pragma warn(1506) // warning elimination
- NAType *newType = new (bindWA->wHeap()) SQLChar (newInputSize, FALSE);
+ NAType *newType = new (bindWA->wHeap()) SQLChar (bindWA->wHeap(), newInputSize, FALSE);
ItemExpr *newItem = new (bindWA->wHeap()) ConstValue(newType, newInput, newInputSize );
newItem->bindNode(bindWA);
getProcAllParamsVids()[0] = newItem->getValueId();