[Bug](regresstest) BE Crash in DEBUG mode run regress test (#16042)

This commit is contained in:
HappenLee
2023-01-18 17:58:16 +08:00
committed by GitHub
parent 95c91fab2e
commit ee76b9796c
3 changed files with 20 additions and 12 deletions

View File

@ -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;

View File

@ -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)

View File

@ -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;