You are viewing a plain text version of this content. The canonical link for it is here.
Posted to commits@doris.apache.org by ya...@apache.org on 2023/01/03 02:05:53 UTC
[doris] branch master updated: [bugfix](datetimev2) fix coredump when load datatime data to doris (#15510)
This is an automated email from the ASF dual-hosted git repository.
yangzhg pushed a commit to branch master
in repository https://gitbox.apache.org/repos/asf/doris.git
The following commit(s) were added to refs/heads/master by this push:
new 57620f6f0d [bugfix](datetimev2) fix coredump when load datatime data to doris (#15510)
57620f6f0d is described below
commit 57620f6f0d4e5e499cba0827489b079c9be5cba9
Author: Zhengguo Yang <ya...@gmail.com>
AuthorDate: Tue Jan 3 10:05:44 2023 +0800
[bugfix](datetimev2) fix coredump when load datatime data to doris (#15510)
---
be/src/runtime/types.h | 2 ++
be/src/vec/data_types/data_type_decimal.h | 3 +--
be/src/vec/data_types/data_type_time_v2.cpp | 4 ++--
be/src/vec/data_types/data_type_time_v2.h | 8 ++++----
4 files changed, 9 insertions(+), 8 deletions(-)
diff --git a/be/src/runtime/types.h b/be/src/runtime/types.h
index 4f4c2ef0fe..06629a655e 100644
--- a/be/src/runtime/types.h
+++ b/be/src/runtime/types.h
@@ -73,6 +73,8 @@ struct TypeDescriptor {
if (type == TYPE_DECIMALV2) {
precision = 27;
scale = 9;
+ } else if (type == TYPE_DATETIMEV2) {
+ scale = 6;
}
}
diff --git a/be/src/vec/data_types/data_type_decimal.h b/be/src/vec/data_types/data_type_decimal.h
index 2213093104..633ed8963b 100644
--- a/be/src/vec/data_types/data_type_decimal.h
+++ b/be/src/vec/data_types/data_type_decimal.h
@@ -123,8 +123,7 @@ public:
static constexpr size_t max_precision() { return max_decimal_precision<T>(); }
- DataTypeDecimal(UInt32 precision_ = 27, UInt32 scale_ = 9)
- : precision(precision_), scale(scale_) {
+ DataTypeDecimal(UInt32 precision = 27, UInt32 scale = 9) : precision(precision), scale(scale) {
if (UNLIKELY(precision < 1 || precision > max_precision())) {
LOG(FATAL) << fmt::format("Precision {} is out of bounds", precision);
}
diff --git a/be/src/vec/data_types/data_type_time_v2.cpp b/be/src/vec/data_types/data_type_time_v2.cpp
index a42c9be4aa..ed52721ee7 100644
--- a/be/src/vec/data_types/data_type_time_v2.cpp
+++ b/be/src/vec/data_types/data_type_time_v2.cpp
@@ -92,7 +92,7 @@ std::string DataTypeDateTimeV2::to_string(const IColumn& column, size_t row_num)
binary_cast<UInt64, DateV2Value<DateTimeV2ValueType>>(int_val);
char buf[64];
- char* pos = val.to_string(buf, scale_);
+ char* pos = val.to_string(buf, _scale);
return std::string(buf, pos - buf - 1);
}
@@ -105,7 +105,7 @@ void DataTypeDateTimeV2::to_string(const IColumn& column, size_t row_num,
binary_cast<UInt64, DateV2Value<DateTimeV2ValueType>>(int_val);
char buf[64];
- char* pos = value.to_string(buf, scale_);
+ char* pos = value.to_string(buf, _scale);
// DateTime to_string the end is /0
ostr.write(buf, pos - buf - 1);
}
diff --git a/be/src/vec/data_types/data_type_time_v2.h b/be/src/vec/data_types/data_type_time_v2.h
index f65768a45c..75c8c9b142 100644
--- a/be/src/vec/data_types/data_type_time_v2.h
+++ b/be/src/vec/data_types/data_type_time_v2.h
@@ -57,13 +57,13 @@ class DataTypeDateTimeV2 final : public DataTypeNumberBase<UInt64> {
public:
static constexpr bool is_parametric = true;
- DataTypeDateTimeV2(UInt32 scale = 0) : scale_(scale) {
+ DataTypeDateTimeV2(UInt32 scale = 0) : _scale(scale) {
if (UNLIKELY(scale > 6)) {
LOG(FATAL) << fmt::format("Scale {} is out of bounds", scale);
}
}
- DataTypeDateTimeV2(const DataTypeDateTimeV2& rhs) : scale_(rhs.scale_) {}
+ DataTypeDateTimeV2(const DataTypeDateTimeV2& rhs) : _scale(rhs._scale) {}
TypeIndex get_type_id() const override { return TypeIndex::DateTimeV2; }
const char* get_family_name() const override { return "DateTimeV2"; }
std::string do_get_name() const override { return "DateTimeV2"; }
@@ -77,7 +77,7 @@ public:
MutableColumnPtr create_column() const override;
- const UInt32 get_scale() const { return scale_; }
+ const UInt32 get_scale() const { return _scale; }
static void cast_to_date(const UInt64 from, Int64& to);
static void cast_to_date_time(const UInt64 from, Int64& to);
@@ -86,7 +86,7 @@ public:
static void cast_from_date_time(const Int64 from, UInt64& to);
private:
- UInt32 scale_;
+ UInt32 _scale;
};
template <typename DataType>
---------------------------------------------------------------------
To unsubscribe, e-mail: commits-unsubscribe@doris.apache.org
For additional commands, e-mail: commits-help@doris.apache.org