This is an automated email from the ASF dual-hosted git repository.

lihaopeng 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 ee76b9796c [Bug](regresstest) BE Crash in DEBUG mode run regress test 
(#16042)
ee76b9796c is described below

commit ee76b9796c0be144d036304d155de444cb9ef095
Author: HappenLee <[email protected]>
AuthorDate: Wed Jan 18 17:58:16 2023 +0800

    [Bug](regresstest) BE Crash in DEBUG mode run regress test (#16042)
---
 be/src/olap/column_predicate.h     |  8 ++++++++
 be/src/olap/comparison_predicate.h | 16 ++++++++--------
 be/src/olap/in_list_predicate.h    |  8 ++++----
 3 files changed, 20 insertions(+), 12 deletions(-)

diff --git a/be/src/olap/column_predicate.h b/be/src/olap/column_predicate.h
index 0574eb3c23..e95a444e24 100644
--- a/be/src/olap/column_predicate.h
+++ b/be/src/olap/column_predicate.h
@@ -221,6 +221,14 @@ public:
     }
 
 protected:
+    // Just prevent access not align memory address coredump
+    template <class T>
+    T _get_zone_map_value(void* data_ptr) const {
+        T res;
+        memcpy(&res, data_ptr, sizeof(T));
+        return res;
+    }
+
     virtual std::string _debug_string() const = 0;
 
     uint32_t _column_id;
diff --git a/be/src/olap/comparison_predicate.h 
b/be/src/olap/comparison_predicate.h
index 91ad1705e5..ec2be5b609 100644
--- a/be/src/olap/comparison_predicate.h
+++ b/be/src/olap/comparison_predicate.h
@@ -150,8 +150,8 @@ public:
                                  true);
             } else {
                 return _operator(
-                        *reinterpret_cast<const 
T*>(statistic.first->cell_ptr()) <= _value &&
-                                *reinterpret_cast<const 
T*>(statistic.second->cell_ptr()) >= _value,
+                        _get_zone_map_value<T>(statistic.first->cell_ptr()) <= 
_value &&
+                                
_get_zone_map_value<T>(statistic.second->cell_ptr()) >= _value,
                         true);
             }
         } else if constexpr (PT == PredicateType::NE) {
@@ -166,8 +166,8 @@ public:
                                  true);
             } else {
                 return _operator(
-                        *reinterpret_cast<const 
T*>(statistic.first->cell_ptr()) == _value &&
-                                *reinterpret_cast<const 
T*>(statistic.second->cell_ptr()) == _value,
+                        _get_zone_map_value<T>(statistic.first->cell_ptr()) == 
_value &&
+                                
_get_zone_map_value<T>(statistic.second->cell_ptr()) == _value,
                         true);
             }
         } else if constexpr (PT == PredicateType::LT || PT == 
PredicateType::LE) {
@@ -193,8 +193,8 @@ public:
                 return _operator(tmp_min_uint32_value == _value && 
tmp_max_uint32_value == _value,
                                  true);
             } else {
-                return *reinterpret_cast<const 
T*>(statistic.first->cell_ptr()) == _value &&
-                       *reinterpret_cast<const 
T*>(statistic.second->cell_ptr()) == _value;
+                return _get_zone_map_value<T>(statistic.first->cell_ptr()) == 
_value &&
+                       _get_zone_map_value<T>(statistic.second->cell_ptr()) == 
_value;
             }
         } else if constexpr (PT == PredicateType::NE) {
             if constexpr (Type == TYPE_DATE) {
@@ -206,8 +206,8 @@ public:
                        sizeof(uint24_t));
                 return tmp_min_uint32_value > _value || tmp_max_uint32_value < 
_value;
             } else {
-                return *reinterpret_cast<const 
T*>(statistic.first->cell_ptr()) > _value ||
-                       *reinterpret_cast<const 
T*>(statistic.second->cell_ptr()) < _value;
+                return _get_zone_map_value<T>(statistic.first->cell_ptr()) > 
_value ||
+                       _get_zone_map_value<T>(statistic.second->cell_ptr()) < 
_value;
             }
         } else if constexpr (PT == PredicateType::LT || PT == 
PredicateType::LE) {
             COMPARE_TO_MIN_OR_MAX(second)
diff --git a/be/src/olap/in_list_predicate.h b/be/src/olap/in_list_predicate.h
index ffc8928715..e85b1280f9 100644
--- a/be/src/olap/in_list_predicate.h
+++ b/be/src/olap/in_list_predicate.h
@@ -313,8 +313,8 @@ public:
                        sizeof(uint24_t));
                 return tmp_min_uint32_value <= _max_value && 
tmp_max_uint32_value >= _min_value;
             } else {
-                return *reinterpret_cast<const 
T*>(statistic.first->cell_ptr()) <= _max_value &&
-                       *reinterpret_cast<const 
T*>(statistic.second->cell_ptr()) >= _min_value;
+                return _get_zone_map_value<T>(statistic.first->cell_ptr()) <= 
_max_value &&
+                       _get_zone_map_value<T>(statistic.second->cell_ptr()) >= 
_min_value;
             }
         } else {
             return true;
@@ -335,8 +335,8 @@ public:
                        sizeof(uint24_t));
                 return tmp_min_uint32_value > _max_value || 
tmp_max_uint32_value < _min_value;
             } else {
-                return *reinterpret_cast<const 
T*>(statistic.first->cell_ptr()) > _max_value ||
-                       *reinterpret_cast<const 
T*>(statistic.second->cell_ptr()) < _min_value;
+                return _get_zone_map_value<T>(statistic.first->cell_ptr()) > 
_max_value ||
+                       _get_zone_map_value<T>(statistic.second->cell_ptr()) < 
_min_value;
             }
         } else {
             return false;


---------------------------------------------------------------------
To unsubscribe, e-mail: [email protected]
For additional commands, e-mail: [email protected]

Reply via email to