HAWQ-1772. ADD NUMERIC[]
diff --git a/depends/dbcommon/src/dbcommon/type/array.cc b/depends/dbcommon/src/dbcommon/type/array.cc
index 8d70634..532b48a 100644
--- a/depends/dbcommon/src/dbcommon/type/array.cc
+++ b/depends/dbcommon/src/dbcommon/type/array.cc
@@ -22,6 +22,7 @@
#include <utility>
#include "dbcommon/common/vector/list-vector.h"
+#include "dbcommon/function/typecast-texttonum-func.h"
namespace dbcommon {
@@ -195,4 +196,14 @@
return ret;
}
+std::unique_ptr<Vector> Decimal128ArrayType::getScalarFromString(
+ const std::string &input) {
+ auto ret = dbcommon::Vector::BuildVector(getBaseTypeKind(), true, -1);
+ StringArrayType stringArrayType;
+ auto strVec = stringArrayType.getScalarFromString(input);
+ std::vector<Datum> params{CreateDatum(ret.get()), CreateDatum(strVec.get())};
+ textToDecimal(params.data(), params.size());
+ return std::move(ret);
+}
+
} // namespace dbcommon
diff --git a/depends/dbcommon/src/dbcommon/type/array.h b/depends/dbcommon/src/dbcommon/type/array.h
index f0e3dff..7dbb237 100644
--- a/depends/dbcommon/src/dbcommon/type/array.h
+++ b/depends/dbcommon/src/dbcommon/type/array.h
@@ -20,11 +20,10 @@
#ifndef DBCOMMON_SRC_DBCOMMON_TYPE_ARRAY_H_
#define DBCOMMON_SRC_DBCOMMON_TYPE_ARRAY_H_
-#include <climits>
#include <cstdint>
-#include <limits>
#include <memory>
#include <string>
+#include <vector>
#include "dbcommon/log/logger.h"
#include "dbcommon/type/typebase.h"
@@ -127,6 +126,16 @@
BpcharArrayType() { typeKind = BPCHARARRAYID; }
};
+class Decimal128ArrayType : public ArrayType {
+ public:
+ Decimal128ArrayType() { typeKind = DECIMAL128ARRAYID; }
+
+ TypeKind getBaseTypeKind() override { return DECIMALNEWID; }
+
+ std::unique_ptr<Vector> getScalarFromString(
+ const std::string &input) override;
+};
+
} // namespace dbcommon
#endif // DBCOMMON_SRC_DBCOMMON_TYPE_ARRAY_H_
diff --git a/depends/dbcommon/src/dbcommon/type/type-util.cc b/depends/dbcommon/src/dbcommon/type/type-util.cc
index 10e15a7..6025845 100644
--- a/depends/dbcommon/src/dbcommon/type/type-util.cc
+++ b/depends/dbcommon/src/dbcommon/type/type-util.cc
@@ -115,6 +115,8 @@
std::shared_ptr<TypeBase>(new StringArrayType())},
{BPCHARARRAYID, "bpchararray", VAR_TYPE_LENGTH, false,
std::shared_ptr<TypeBase>(new BpcharArrayType())},
+ {DECIMAL128ARRAYID, "decimal128array", VAR_TYPE_LENGTH, false,
+ std::shared_ptr<TypeBase>(new Decimal128ArrayType())},
{ANYID, "any", VAR_TYPE_LENGTH, false, nullptr},
{UNKNOWNID, "unknown", VAR_TYPE_LENGTH, false,
std::shared_ptr<TypeBase>(new UnknownType())},
diff --git a/depends/univplan/src/univplan/common/expression.cc b/depends/univplan/src/univplan/common/expression.cc
index 152d9c5..a7255b7 100644
--- a/depends/univplan/src/univplan/common/expression.cc
+++ b/depends/univplan/src/univplan/common/expression.cc
@@ -183,7 +183,9 @@
univplan::PlanNodeUtil::typeKindMapping(val->type()) ==
dbcommon::TypeKind::STRINGARRAYID ||
univplan::PlanNodeUtil::typeKindMapping(val->type()) ==
- dbcommon::TypeKind::BPCHARARRAYID) {
+ dbcommon::TypeKind::BPCHARARRAYID ||
+ univplan::PlanNodeUtil::typeKindMapping(val->type()) ==
+ dbcommon::TypeKind::DECIMAL128ARRAYID) {
auto typeEnt = reinterpret_cast<dbcommon::ArrayType *>(
dbcommon::TypeUtil::instance()
->getTypeEntryById(