Skip to content

Commit 939d725

Browse files
committed
[chore](be) remove useless cast to string
1 parent 6deea82 commit 939d725

File tree

1 file changed

+0
-35
lines changed

1 file changed

+0
-35
lines changed

be/src/exec/olap_common.h

Lines changed: 0 additions & 35 deletions
Original file line numberDiff line numberDiff line change
@@ -55,41 +55,6 @@
5555
namespace doris {
5656
#include "common/compile_check_begin.h"
5757

58-
template <PrimitiveType primitive_type, class T>
59-
std::string cast_to_string(T value, int scale) {
60-
if constexpr (primitive_type == TYPE_DECIMAL32) {
61-
return ((vectorized::Decimal<int32_t>)value).to_string(scale);
62-
} else if constexpr (primitive_type == TYPE_DECIMAL64) {
63-
return ((vectorized::Decimal<int64_t>)value).to_string(scale);
64-
} else if constexpr (primitive_type == TYPE_DECIMAL128I) {
65-
return ((vectorized::Decimal<int128_t>)value).to_string(scale);
66-
} else if constexpr (primitive_type == TYPE_DECIMAL256) {
67-
return ((vectorized::Decimal<wide::Int256>)value).to_string(scale);
68-
} else if constexpr (primitive_type == TYPE_TINYINT) {
69-
return std::to_string(static_cast<int>(value));
70-
} else if constexpr (primitive_type == TYPE_LARGEINT) {
71-
return vectorized::int128_to_string(value);
72-
} else if constexpr (primitive_type == TYPE_DATETIMEV2) {
73-
auto datetimev2_val = static_cast<DateV2Value<DateTimeV2ValueType>>(value);
74-
char buf[30];
75-
datetimev2_val.to_string(buf);
76-
std::stringstream ss;
77-
ss << buf;
78-
return ss.str();
79-
} else if constexpr (primitive_type == TYPE_TIMESTAMPTZ) {
80-
auto timestamptz_val = static_cast<TimestampTzValue>(value);
81-
return timestamptz_val.to_string(cctz::utc_time_zone(), scale);
82-
} else if constexpr (primitive_type == TYPE_TIMEV2) {
83-
return TimeValue::to_string(value, scale);
84-
} else if constexpr (primitive_type == TYPE_IPV4) {
85-
return IPv4Value::to_string(value);
86-
} else if constexpr (primitive_type == TYPE_IPV6) {
87-
return IPv6Value::to_string(value);
88-
} else {
89-
return boost::lexical_cast<std::string>(value);
90-
}
91-
}
92-
9358
/**
9459
* @brief Column's value range
9560
**/

0 commit comments

Comments
 (0)