@@ -129,7 +129,7 @@ class ConstantFactory{
129129
130130 Dictionary* createDictionary (DATA_TYPE keyInternalType, DATA_TYPE keyType, DATA_TYPE valueType){
131131 if (valueType > DT_STRING
132- && (valueType != DT_UUID && valueType != DT_IP && valueType != DT_INT128 && valueType!= DT_BLOB && valueType != DT_DATEHOUR && valueType != DT_DATEMINUTE )) {
132+ && (valueType != DT_DATEHOUR && valueType != DT_DATEMINUTE && valueType!= DT_BLOB)) {
133133 valueType = DT_ANY;
134134 }
135135 if (valueType != DT_ANY){
@@ -140,23 +140,24 @@ class ConstantFactory{
140140 case DT_LONG : return new LongDictionary (keyType,valueType);
141141 case DT_FLOAT : return new FloatDictionary (valueType);
142142 case DT_DOUBLE : return new DoubleDictionary (valueType);
143- case DT_INT128 :
144- if (valueType == DT_INT128)
145- return NULL ;
146- return new Int128Dictionary (keyType,valueType);
147- case DT_STRING : return new StringDictionary (keyType,valueType);
148- default : return NULL ;
143+ case DT_INT128 : return new Int128Dictionary (keyType,valueType);
144+ case DT_STRING :
145+ case DT_BLOB : return new StringDictionary (keyType,valueType);
146+ default : throw RuntimeException (" Not allowed to create Dictionary for the key type " + Util::getDataTypeString (keyType));
149147 }
150148 }
151149 else {
152150 switch (keyInternalType){
153151 case DT_CHAR :
154152 case DT_SHORT :
155153 case DT_INT : return new IntAnyDictionary (keyType);
154+ case DT_FLOAT: return new FloatAnyDictionary (keyType);
155+ case DT_DOUBLE: return new DoubleAnyDictionary (keyType);
156156 case DT_LONG : return new LongAnyDictionary (keyType);
157157 case DT_INT128 : return new Int128AnyDictionary (keyType);
158- case DT_STRING : return new AnyDictionary ();
159- default : return NULL ;
158+ case DT_STRING :
159+ case DT_BLOB : return new AnyDictionary ();
160+ default : throw RuntimeException (" Not allowed to create Dictionary for this key type " + Util::getDataTypeString (keyType));
160161 }
161162 }
162163 }
@@ -271,6 +272,7 @@ class ConstantFactory{
271272 Constant* createIPAddr (int extraParam){return new IPAddr ();}
272273 Constant* createDecima32 (int extraParam) { return new Decimal32 (extraParam); }
273274 Constant* createDecima64 (int extraParam) { return new Decimal64 (extraParam); }
275+ Constant* createDecima128 (int extraParam) { return new Decimal128 (extraParam); }
274276
275277 Vector* createVoidVector (INDEX size, INDEX capacity, bool fastMode, int extraParam, void * data, void ** dataSegment, int segmentSizeInBit, bool containNull){
276278 throw RuntimeException (" Not allowed to create void vector" );
@@ -497,6 +499,16 @@ class ConstantFactory{
497499 return NULL ;
498500 }
499501
502+ Vector* createDecimal128Vector (INDEX size, INDEX capacity, bool fastMode, int extraParam, void * data, void ** dataSegment, int segmentSizeInBit, bool containNull) {
503+ if (data == NULL && dataSegment == NULL ) {
504+ allocate<wide_integer::int128>(size, capacity, fastMode, segmentSizeInBit, data, dataSegment);
505+ }
506+ if (data != NULL )
507+ return new FastDecimalVector<wide_integer::int128>(extraParam, size, capacity, (wide_integer::int128*)data, containNull);
508+ else
509+ return NULL ;
510+ }
511+
500512 Vector* createBoolArrayVector (INDEX size, INDEX capacity, bool fastMode, int extraParam, void *data, void *pindex, void ** dataSegment, int segmentSizeInBit, bool containNull) {
501513 // if(data == NULL && dataSegment == NULL){
502514 // allocate<char>(size, capacity, fastMode, segmentSizeInBit, data, dataSegment);
@@ -627,7 +639,10 @@ class ConstantFactory{
627639 return new FastArrayVector (size, capacity, (char *)data, containNull, DATA_TYPE (DT_DECIMAL64 + ARRAY_TYPE_BASE), (INDEX *)pindex, extraParam);
628640 }
629641
630-
642+ Vector* createDecimal128ArrayVector (INDEX size, INDEX capacity, bool fastMode, int extraParam, void * data, void *pindex, void ** dataSegment, int segmentSizeInBit, bool containNull) {
643+ return new FastArrayVector (size, capacity, (char *)data, containNull, DATA_TYPE (DT_DECIMAL128 + ARRAY_TYPE_BASE), (INDEX *)pindex, extraParam);
644+ }
645+
631646 Vector* createVoidMatrix (int cols, int rows, int colCapacity, int extraParam, void * data, void ** dataSegment, int segmentSizeInBit, bool containNull){
632647 throw RuntimeException (" Not allowed to create a void matrix" );
633648 }
@@ -808,6 +823,8 @@ class ConstantFactory{
808823 arrConstFactory[DT_IP]=&ConstantFactory::createIPAddr;
809824 arrConstFactory[DT_DECIMAL32] = &ConstantFactory::createDecima32;
810825 arrConstFactory[DT_DECIMAL64] = &ConstantFactory::createDecima64;
826+ arrConstFactory[DT_DECIMAL128] = &ConstantFactory::createDecima128;
827+
811828 arrConstFactory[DT_DICTIONARY]=NULL ;
812829
813830 arrConstVectorFactory[DT_VOID]=&ConstantFactory::createVoidVector;
@@ -836,6 +853,8 @@ class ConstantFactory{
836853 arrConstVectorFactory[DT_IP]=&ConstantFactory::createIPAddrVector;
837854 arrConstVectorFactory[DT_DECIMAL32] = &ConstantFactory::createDecimal32Vector;
838855 arrConstVectorFactory[DT_DECIMAL64] = &ConstantFactory::createDecimal64Vector;
856+ arrConstVectorFactory[DT_DECIMAL128] = &ConstantFactory::createDecimal128Vector;
857+
839858 arrConstVectorFactory[DT_FUNCTIONDEF]=&ConstantFactory::createAnyVector;
840859 arrConstVectorFactory[DT_HANDLE]=&ConstantFactory::createAnyVector;
841860 arrConstVectorFactory[DT_ANY]=&ConstantFactory::createAnyVector;
@@ -867,6 +886,7 @@ class ConstantFactory{
867886 arrConstArrayVectorFactory[DT_IP] = &ConstantFactory::createIpArrayVector;
868887 arrConstArrayVectorFactory[DT_DECIMAL32] = &ConstantFactory::createDecimal32ArrayVector;
869888 arrConstArrayVectorFactory[DT_DECIMAL64] = &ConstantFactory::createDecimal64ArrayVector;
889+ arrConstArrayVectorFactory[DT_DECIMAL128] = &ConstantFactory::createDecimal128ArrayVector;
870890
871891 arrConstMatrixFactory[DT_VOID]=&ConstantFactory::createVoidMatrix;
872892 arrConstMatrixFactory[DT_BOOL]=&ConstantFactory::createBoolMatrix;
@@ -1047,7 +1067,6 @@ class ConstantFactory{
10471067 ConstantVectorFunc arrConstVectorFactory[TYPE_COUNT];
10481068 ConstantArrayVectorFunc arrConstArrayVectorFactory[TYPE_COUNT];
10491069 ConstantMatrixFunc arrConstMatrixFactory[TYPE_COUNT];
1050- ConstantRptVectorFunc arrConstRptVectorFactory[TYPE_COUNT];
10511070 unordered_map<string,DATA_TYPE> typeMap_;
10521071 unordered_map<string,DATA_FORM> formMap_;
10531072 char arrTypeSymbol[TYPE_COUNT];
0 commit comments