trafodion-commits mailing list archives

Site index · List index
Message view « Date » · « Thread »
Top « Date » · « Thread »
From ansha...@apache.org
Subject [06/11] incubator-trafodion git commit: JIRA 2086 Add support for largeint unsigned
Date Fri, 01 Jul 2016 14:46:24 GMT
http://git-wip-us.apache.org/repos/asf/incubator-trafodion/blob/911f1d64/core/sql/sqlcomp/DefaultConstants.h
----------------------------------------------------------------------
diff --git a/core/sql/sqlcomp/DefaultConstants.h b/core/sql/sqlcomp/DefaultConstants.h
index 5776a00..3aaebbc 100644
--- a/core/sql/sqlcomp/DefaultConstants.h
+++ b/core/sql/sqlcomp/DefaultConstants.h
@@ -3842,6 +3842,15 @@ enum DefaultConstants
   // if 3, null inserted if conversion error, and processing continues.
   HIVE_INSERT_ERROR_MODE,
   
+  // If ON, largeint unsigned is supported as returned datatype for a select
+  // stmt, and for input params.
+  // Otherwise typed as bignum
+  TRAF_LARGEINT_UNSIGNED_IO,
+
+  // if TRUE, create signed numeric literal for both +ve and -ve numbers.
+  // if FALSE, create unsigned literal for +ve and signed literal for -ve nums.
+  TRAF_CREATE_SIGNED_NUMERIC_LITERAL,
+
   // This enum constant must be the LAST one in the list; it's a count,
   // not an Attribute (it's not IN DefaultDefaults; it's the SIZE of it)!
   __NUM_DEFAULT_ATTRIBUTES

http://git-wip-us.apache.org/repos/asf/incubator-trafodion/blob/911f1d64/core/sql/sqlcomp/nadefaults.cpp
----------------------------------------------------------------------
diff --git a/core/sql/sqlcomp/nadefaults.cpp b/core/sql/sqlcomp/nadefaults.cpp
index 7301575..3856a76 100644
--- a/core/sql/sqlcomp/nadefaults.cpp
+++ b/core/sql/sqlcomp/nadefaults.cpp
@@ -3329,6 +3329,8 @@ XDDkwd__(SUBQUERY_UNNESTING,			"ON"),
 
   DDkwd__(TRAF_COL_LENGTH_IS_CHAR,                 "ON"),   
 
+  DDkwd__(TRAF_CREATE_SIGNED_NUMERIC_LITERAL,      "ON"),   
+
   DDansi_(TRAF_CREATE_TABLE_WITH_UID,          ""),
 
  DDkwd__(TRAF_DEFAULT_COL_CHARSET,            (char *)SQLCHARSETSTRING_ISO88591),
@@ -3337,6 +3339,9 @@ XDDkwd__(SUBQUERY_UNNESTING,			"ON"),
 
   DDkwd__(TRAF_INDEX_ALIGNED_ROW_FORMAT,        "ON"),   
   DDkwd__(TRAF_INDEX_CREATE_OPT,          "OFF"),
+
+  DDkwd__(TRAF_LARGEINT_UNSIGNED_IO,                        "OFF"),
+
   DDkwd__(TRAF_LOAD_ALLOW_RISKY_INDEX_MAINTENANCE,        "OFF"),
   DDkwd__(TRAF_LOAD_CONTINUE_ON_ERROR,          "OFF"),
   DD_____(TRAF_LOAD_ERROR_COUNT_ID,             "" ),

http://git-wip-us.apache.org/repos/asf/incubator-trafodion/blob/911f1d64/core/sql/ustat/hs_cli.cpp
----------------------------------------------------------------------
diff --git a/core/sql/ustat/hs_cli.cpp b/core/sql/ustat/hs_cli.cpp
index dfa28f1..d65eb0e 100644
--- a/core/sql/ustat/hs_cli.cpp
+++ b/core/sql/ustat/hs_cli.cpp
@@ -3305,6 +3305,12 @@ Lng32 HSCursor::buildNAType()
                                       TRUE, nullflag, heap_);
 #pragma warn(1506)  // warning elimination
           break;
+        case REC_BIN64_UNSIGNED:
+          if (precision <= 0)
+            length = 8;
+          type = ConstructNumericType(addr, i, length, precision, scale,
+                                      FALSE, nullflag, heap_);
+          break;
         //
         //----------------------------------------------------------------
 	case REC_FLOAT32:
@@ -6010,6 +6016,9 @@ template
 void profileGaps(HSColGroupStruct *, boundarySet<Int64>*, double&, Int64&,
                  NABoolean);
 template
+void profileGaps(HSColGroupStruct *, boundarySet<UInt64>*, double&, Int64&,
+                 NABoolean);
+template
 void profileGaps(HSColGroupStruct *, boundarySet<ISFixedChar>*, double&, Int64&,
                  NABoolean);
 template

http://git-wip-us.apache.org/repos/asf/incubator-trafodion/blob/911f1d64/core/sql/ustat/hs_faststats.cpp
----------------------------------------------------------------------
diff --git a/core/sql/ustat/hs_faststats.cpp b/core/sql/ustat/hs_faststats.cpp
index c81604a..f102a1a 100644
--- a/core/sql/ustat/hs_faststats.cpp
+++ b/core/sql/ustat/hs_faststats.cpp
@@ -211,7 +211,8 @@ template void FastStatsHist<int>::addRowset(Lng32 numRows);
 template void FastStatsHist<unsigned int>::addRowset(Lng32 numRows);
 template void FastStatsHist<short>::addRowset(Lng32 numRows);
 template void FastStatsHist<unsigned short>::addRowset(Lng32 numRows);
-template void FastStatsHist<long>::addRowset(Lng32 numRows);
+template void FastStatsHist<Int64>::addRowset(Lng32 numRows);
+template void FastStatsHist<UInt64>::addRowset(Lng32 numRows);
 template void FastStatsHist<float>::addRowset(Lng32 numRows);
 template void FastStatsHist<double>::addRowset(Lng32 numRows);
 
@@ -221,7 +222,8 @@ template void FastStatsHist<int>::actuate(Lng32);
 template void FastStatsHist<unsigned int>::actuate(Lng32);
 template void FastStatsHist<short>::actuate(Lng32);
 template void FastStatsHist<unsigned short>::actuate(Lng32);
-template void FastStatsHist<long>::actuate(Lng32);
+template void FastStatsHist<Int64>::actuate(Lng32);
+template void FastStatsHist<UInt64>::actuate(Lng32);
 template void FastStatsHist<float>::actuate(Lng32);
 template void FastStatsHist<double>::actuate(Lng32);
 
@@ -231,6 +233,7 @@ template void FSInterval<int>::estimateRowsAndUecs(double, float);
 template void FSInterval<unsigned int>::estimateRowsAndUecs(double, float);
 template void FSInterval<short>::estimateRowsAndUecs(double, float);
 template void FSInterval<unsigned short>::estimateRowsAndUecs(double, float);
-template void FSInterval<long>::estimateRowsAndUecs(double, float);
+template void FSInterval<Int64>::estimateRowsAndUecs(double, float);
+template void FSInterval<UInt64>::estimateRowsAndUecs(double, float);
 template void FSInterval<float>::estimateRowsAndUecs(double, float);
 template void FSInterval<double>::estimateRowsAndUecs(double, float);

http://git-wip-us.apache.org/repos/asf/incubator-trafodion/blob/911f1d64/core/sql/ustat/hs_globals.cpp
----------------------------------------------------------------------
diff --git a/core/sql/ustat/hs_globals.cpp b/core/sql/ustat/hs_globals.cpp
index 3f4fe71..32654db 100644
--- a/core/sql/ustat/hs_globals.cpp
+++ b/core/sql/ustat/hs_globals.cpp
@@ -315,6 +315,10 @@ Lng32 MCWrapper::setupMCColumnIterator (HSColGroupStruct *group, MCIterator**
it
         iter[currentLoc] = new (STMTHEAP) MCNonCharIterator<Int64>((Int64 *)group->mcis_data);
         break;
 
+      case REC_BIN64_UNSIGNED:
+        iter[currentLoc] = new (STMTHEAP) MCNonCharIterator<UInt64>((UInt64 *)group->mcis_data);
+        break;
+
       case REC_IEEE_FLOAT32:
         iter[currentLoc] = new (STMTHEAP) MCNonCharIterator<float>((float *)group->mcis_data);
         break;
@@ -4880,6 +4884,7 @@ void HSGlobalsClass::getMemoryRequirementsForOneGroup(HSColGroupStruct*
group, I
             break;
 
           case REC_BIN64_SIGNED:
+          case REC_BIN64_UNSIGNED:
           case REC_IEEE_FLOAT64:
             elementSize = 8;
             break;
@@ -7081,6 +7086,9 @@ Int32 HSGlobalsClass::processIUSColumn(HSColGroupStruct* smplGroup,
       case REC_BIN64_SIGNED:
         return processIUSColumn((Int64*)smplGroup->data, L"%lld", smplGroup, delGroup,
insGroup);
         break;
+      case REC_BIN64_UNSIGNED:
+        return processIUSColumn((UInt64*)smplGroup->data, L"%llu", smplGroup, delGroup,
insGroup);
+        break;
       case REC_FLOAT32:
         return processIUSColumn((Float32*)smplGroup->data, L"%f", smplGroup, delGroup,
insGroup);
         break;
@@ -10064,6 +10072,10 @@ Lng32 HSGlobalsClass::processInternalSortNulls(Lng32 rowsRead, HSColGroupStruct
             processNullsForColumn(group, rowsRead, (Int64*)NULL);
             break;
 
+          case REC_BIN64_UNSIGNED:
+            processNullsForColumn(group, rowsRead, (UInt64*)NULL);
+            break;
+
           case REC_IEEE_FLOAT32:
             processNullsForColumn(group, rowsRead, (float*)NULL);
             break;
@@ -10214,6 +10226,7 @@ bool isInternalSortType(HSColumnStruct &col)
       case REC_BIN32_SIGNED:
       case REC_BIN32_UNSIGNED:
       case REC_BIN64_SIGNED:
+      case REC_BIN64_UNSIGNED:
       case REC_DECIMAL_LSE:
       case REC_DECIMAL_UNSIGNED:
       case REC_DECIMAL_LS:
@@ -10954,6 +10967,11 @@ Lng32 doSort(HSColGroupStruct *group)
                        (Int64*)group->nextData - (Int64*)group->data - 1);
         break;
 
+      case REC_BIN64_UNSIGNED:
+        quicksort((UInt64*)group->data, 0,
+                       (UInt64*)group->nextData - (UInt64*)group->data - 1);
+        break;
+
       case REC_IEEE_FLOAT32:
         quicksort((float*)group->data, 0,
                        (float*)group->nextData - (float*)group->data - 1);
@@ -11437,6 +11455,10 @@ Lng32 HSGlobalsClass::createStatsForColumn(HSColGroupStruct *group,
Int64 rowsAl
         createHistogram(group, intCount, sampleRowCount, samplingUsed, (Int64*)NULL);
         break;
 
+      case REC_BIN64_UNSIGNED:
+        createHistogram(group, intCount, sampleRowCount, samplingUsed, (UInt64*)NULL);
+        break;
+
       case REC_BYTE_F_ASCII:
       case REC_BYTE_F_DOUBLE:
         //
@@ -11785,6 +11807,7 @@ Int32 computeKeyLengthInfo(Lng32 datatype)
         return ExHDPHash::SWAP_FOUR;
 
       case REC_BIN64_SIGNED:
+      case REC_BIN64_UNSIGNED:
       case REC_FLOAT64:
         return ExHDPHash::SWAP_EIGHT;
 
@@ -12694,6 +12717,10 @@ Lng32 HSGlobalsClass::mergeDatasetsForIUS(
         return mergeDatasetsForIUS((Int64*)smplGroup->data, (Int64*)NULL,
                                    smplGroup, smplrows, delGroup, delrows, insGroup, insrows);
         break;
+      case REC_BIN64_UNSIGNED:
+        return mergeDatasetsForIUS((UInt64*)smplGroup->data, (UInt64*)NULL,
+                                   smplGroup, smplrows, delGroup, delrows, insGroup, insrows);
+        break;
       case REC_FLOAT32:
         return mergeDatasetsForIUS((Float32*)smplGroup->data, (Float32*)NULL,
                                    smplGroup, smplrows, delGroup, delrows, insGroup, insrows);
@@ -13648,6 +13675,9 @@ Lng32 setBufferValue(MCWrapper& value,
              case REC_BIN64_SIGNED:
                 retcode = copyValue(*((MCNonCharIterator<Int64>*)(value.allCols_[i]))->getContent(value.index_),
valueBuff, mgroup->colSet[i], len);
                 break;
+             case REC_BIN64_UNSIGNED:
+                retcode = copyValue(*((MCNonCharIterator<UInt64>*)(value.allCols_[i]))->getContent(value.index_),
valueBuff, mgroup->colSet[i], len);
+                break;
              case REC_IEEE_FLOAT32:
                 retcode = copyValue(*((MCNonCharIterator<float>*)(value.allCols_[i]))->getContent(value.index_),
valueBuff, mgroup->colSet[i], len);
                 break;
@@ -15508,6 +15538,10 @@ Lng32 HSGlobalsClass::processFastStatsBatch(CollIndex numCols, HSColGroupStruct*
           group->fastStatsHist = new(STMTHEAP) FastStatsHist<Int64>(group, cbf);
           break;
 
+        case REC_BIN64_UNSIGNED:
+          group->fastStatsHist = new(STMTHEAP) FastStatsHist<UInt64>(group, cbf);
+          break;
+
         case REC_IEEE_FLOAT32:
           group->fastStatsHist = new(STMTHEAP) FastStatsHist<Float32>(group, cbf);
           break;


Mime
View raw message