From d0b62956285097c7f1678b1d85d23b78ac4c9234 Mon Sep 17 00:00:00 2001 From: jacktengg <18241664+jacktengg@users.noreply.github.com> Date: Thu, 28 Sep 2023 14:39:17 +0800 Subject: [PATCH] compile ok --- be/src/exec/olap_common.h | 2 ++ be/src/runtime/runtime_predicate.cpp | 8 ++++---- be/src/runtime/runtime_predicate.h | 10 +++++----- be/src/vec/common/field_visitors.h | 4 ++-- be/src/vec/core/field.h | 10 +++++----- be/src/vec/core/types.h | 1 - 6 files changed, 18 insertions(+), 17 deletions(-) diff --git a/be/src/exec/olap_common.h b/be/src/exec/olap_common.h index 7a58645b74cbbcd..31d68b998fd0eba 100644 --- a/be/src/exec/olap_common.h +++ b/be/src/exec/olap_common.h @@ -55,6 +55,8 @@ std::string cast_to_string(T value, int scale) { return ((vectorized::Decimal)value).to_string(scale); } else if constexpr (primitive_type == TYPE_DECIMAL128I) { return ((vectorized::Decimal)value).to_string(scale); + } else if constexpr (primitive_type == TYPE_DECIMAL256) { + return ((vectorized::Decimal)value).to_string(scale); } else if constexpr (primitive_type == TYPE_TINYINT) { return std::to_string(static_cast(value)); } else if constexpr (primitive_type == TYPE_LARGEINT) { diff --git a/be/src/runtime/runtime_predicate.cpp b/be/src/runtime/runtime_predicate.cpp index 9a8c82a4c8ebf28..2b949fb10e6c534 100644 --- a/be/src/runtime/runtime_predicate.cpp +++ b/be/src/runtime/runtime_predicate.cpp @@ -112,10 +112,10 @@ Status RuntimePredicate::init(const PrimitiveType type, const bool nulls_first) _get_value_fn = get_decimal128_value; break; } - // case PrimitiveType::TYPE_DECIMAL256: { - // _get_value_fn = get_decimal256_value; - // break; - // } + case PrimitiveType::TYPE_DECIMAL256: { + _get_value_fn = get_decimal256_value; + break; + } default: return Status::InvalidArgument("unsupported runtime predicate type {}", type); } diff --git a/be/src/runtime/runtime_predicate.h b/be/src/runtime/runtime_predicate.h index a99633f2f3edc97..b1d4dadf1a4fa8a 100644 --- a/be/src/runtime/runtime_predicate.h +++ b/be/src/runtime/runtime_predicate.h @@ -174,11 +174,11 @@ class RuntimePredicate { return cast_to_string(v.get_value(), v.get_scale()); } - // static std::string get_decimal256_value(const Field& field) { - // using ValueType = typename PrimitiveTypeTraits::CppType; - // auto v = field.get>(); - // return cast_to_string(v.get_value(), v.get_scale()); - // } + static std::string get_decimal256_value(const Field& field) { + using ValueType = typename PrimitiveTypeTraits::CppType; + auto v = field.get>(); + return cast_to_string(v.get_value(), v.get_scale()); + } }; } // namespace vectorized diff --git a/be/src/vec/common/field_visitors.h b/be/src/vec/common/field_visitors.h index 5bde905bbe3f803..8434483b7721eaf 100644 --- a/be/src/vec/common/field_visitors.h +++ b/be/src/vec/common/field_visitors.h @@ -63,8 +63,8 @@ typename std::decay_t::ResultType apply_visitor(Visitor&& visitor, F&& return visitor(field.template get>()); case Field::Types::Decimal128I: return visitor(field.template get>()); - // case Field::Types::Decimal256: - // return visitor(field.template get>()); + case Field::Types::Decimal256: + return visitor(field.template get>()); default: LOG(FATAL) << "Bad type of Field"; return {}; diff --git a/be/src/vec/core/field.h b/be/src/vec/core/field.h index 0177f7f124709bc..b997d9ddc222450 100644 --- a/be/src/vec/core/field.h +++ b/be/src/vec/core/field.h @@ -237,11 +237,11 @@ class DecimalField { return decimal_less_or_equal(dec, r.get_value(), scale, r.get_scale()); } - // template - // bool operator==(const DecimalField& r) const { - // using MaxType = std::conditional_t<(sizeof(T) > sizeof(U)), T, U>; - // return decimal_equal(dec, r.get_value(), scale, r.get_scale()); - // } + template + bool operator==(const DecimalField& r) const { + using MaxType = std::conditional_t<(sizeof(T) > sizeof(U)), T, U>; + return decimal_equal(dec, r.get_value(), scale, r.get_scale()); + } template bool operator>(const DecimalField& r) const { diff --git a/be/src/vec/core/types.h b/be/src/vec/core/types.h index 6fc8b73c6c31f03..a0baae5b84b5e6c 100644 --- a/be/src/vec/core/types.h +++ b/be/src/vec/core/types.h @@ -26,7 +26,6 @@ #include #include "common/consts.h" -#include "gutil/integral_types.h" #include "util/binary_cast.hpp" #include "vec/common/int_exp.h" #include "vec/core/wide_integer.h"