From 8031ab773bf90026ee47204dbab554e566958424 Mon Sep 17 00:00:00 2001 From: chenhao <510341142@qq.com> Date: Thu, 25 Apr 2019 16:09:19 +0800 Subject: [PATCH] Support add hll column in Schemachange (#1033) --- be/src/olap/column_reader.h | 3 ++- be/src/olap/wrapper_field.cpp | 10 +++++++--- 2 files changed, 9 insertions(+), 4 deletions(-) diff --git a/be/src/olap/column_reader.h b/be/src/olap/column_reader.h index 566dde1dc6..106976342e 100644 --- a/be/src/olap/column_reader.h +++ b/be/src/olap/column_reader.h @@ -347,7 +347,8 @@ public: } break; } - case OLAP_FIELD_TYPE_VARCHAR: { + case OLAP_FIELD_TYPE_VARCHAR: + case OLAP_FIELD_TYPE_HLL: { _values = reinterpret_cast(mem_pool->allocate(size * sizeof(Slice))); int32_t length = _default_value.length(); diff --git a/be/src/olap/wrapper_field.cpp b/be/src/olap/wrapper_field.cpp index 02ab4363dd..6df628dc17 100644 --- a/be/src/olap/wrapper_field.cpp +++ b/be/src/olap/wrapper_field.cpp @@ -21,7 +21,9 @@ namespace doris { WrapperField* WrapperField::create(const FieldInfo& info, uint32_t len) { bool is_string_type = - (info.type == OLAP_FIELD_TYPE_CHAR || info.type == OLAP_FIELD_TYPE_VARCHAR); + (info.type == OLAP_FIELD_TYPE_CHAR + || info.type == OLAP_FIELD_TYPE_VARCHAR + || info.type == OLAP_FIELD_TYPE_HLL); if (is_string_type && len > OLAP_STRING_MAX_LENGTH) { OLAP_LOG_WARNING("length of string parameter is too long[len=%lu, max_len=%lu].", len, OLAP_STRING_MAX_LENGTH); @@ -36,7 +38,7 @@ WrapperField* WrapperField::create(const FieldInfo& info, uint32_t len) { size_t variable_len = 0; if (info.type == OLAP_FIELD_TYPE_CHAR) { variable_len = std::max(len, info.length); - } else if (info.type == OLAP_FIELD_TYPE_VARCHAR) { + } else if (info.type == OLAP_FIELD_TYPE_VARCHAR || info.type == OLAP_FIELD_TYPE_HLL) { variable_len = std::max(len, static_cast(info.length - sizeof(StringLengthType))); } else { @@ -52,7 +54,9 @@ WrapperField* WrapperField::create_by_type(const FieldType& type) { if (rep == nullptr) { return nullptr; } - bool is_string_type = (type == OLAP_FIELD_TYPE_CHAR || type == OLAP_FIELD_TYPE_VARCHAR); + bool is_string_type = (type == OLAP_FIELD_TYPE_CHAR + || type == OLAP_FIELD_TYPE_VARCHAR + || type == OLAP_FIELD_TYPE_HLL); WrapperField* wrapper = new WrapperField(rep, 0, is_string_type); return wrapper; }