From 868884145cdba87eebccf0c06dd7c0d786e885dc Mon Sep 17 00:00:00 2001 From: Qi Chen Date: Mon, 18 Dec 2023 18:56:31 +0800 Subject: [PATCH] [Opt](expr) Opt decimal comparsion expr. (#28551) --- be/src/vec/core/decimal_comparison.h | 11 +++++------ 1 file changed, 5 insertions(+), 6 deletions(-) diff --git a/be/src/vec/core/decimal_comparison.h b/be/src/vec/core/decimal_comparison.h index 46c6f729ca..a24b85bc7f 100644 --- a/be/src/vec/core/decimal_comparison.h +++ b/be/src/vec/core/decimal_comparison.h @@ -189,8 +189,6 @@ private: template static ColumnPtr apply(const ColumnPtr& c0, const ColumnPtr& c1, CompareInt scale) { - auto c_res = ColumnUInt8::create(); - if constexpr (_actual) { bool c0_is_const = is_column_const(*c0); bool c1_is_const = is_column_const(*c1); @@ -205,8 +203,8 @@ private: return DataTypeUInt8().create_column_const(c0->size(), to_field(res)); } + auto c_res = ColumnUInt8::create(c0->size()); ColumnUInt8::Container& vec_res = c_res->get_data(); - vec_res.resize(c0->size()); if (c0_is_const) { const ColumnConst* c0_const = check_and_get_column_const(c0.get()); @@ -236,13 +234,14 @@ private: LOG(FATAL) << "Wrong column in Decimal comparison"; } } + return c_res; + } else { + return ColumnUInt8::create(); } - - return c_res; } template - static NO_INLINE UInt8 apply(A a, B b, CompareInt scale [[maybe_unused]]) { + static UInt8 apply(A a, B b, CompareInt scale [[maybe_unused]]) { CompareInt x = a; CompareInt y = b;