Skip to content

[Chore](check) modify sanity_check's rows type from int32 to int64 #48821

New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Merged
merged 1 commit into from
Mar 10, 2025
Merged
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
16 changes: 12 additions & 4 deletions be/src/vec/columns/column_string.cpp
Original file line number Diff line number Diff line change
Expand Up @@ -40,8 +40,8 @@ template <typename T>
void ColumnStr<T>::sanity_check() const {
#ifndef NDEBUG
sanity_check_simple();
auto count = cast_set<int>(offsets.size());
for (int i = 0; i < count; ++i) {
auto count = cast_set<int64_t>(offsets.size());
for (int64_t i = 0; i < count; ++i) {
if (offsets[i] < offsets[i - 1]) {
throw Exception(Status::InternalError("row count: {}, offsets[{}]: {}, offsets[{}]: {}",
count, i, offsets[i], i - 1, offsets[i - 1]));
Expand All @@ -53,7 +53,7 @@ void ColumnStr<T>::sanity_check() const {
template <typename T>
void ColumnStr<T>::sanity_check_simple() const {
#ifndef NDEBUG
auto count = cast_set<int>(offsets.size());
auto count = cast_set<int64_t>(offsets.size());
if (chars.size() != offsets[count - 1]) {
throw Exception(Status::InternalError("row count: {}, chars.size(): {}, offset[{}]: {}",
count, chars.size(), count - 1, offsets[count - 1]));
Expand Down Expand Up @@ -157,7 +157,15 @@ void ColumnStr<T>::insert_range_from_ignore_overflow(const doris::vectorized::IC
src_concrete.offsets[start + i] - nested_offset + prev_max_offset;
}
}
sanity_check_simple();

#ifndef NDEBUG
auto count = cast_set<int64_t>(offsets.size());
// offsets may overflow, so we make chars.size() as T to do same overflow check
if (offsets.back() != T(chars.size())) {
throw Exception(Status::InternalError("row count: {}, chars.size(): {}, offset[{}]: {}",
count, chars.size(), count - 1, offsets[count - 1]));
}
#endif
}

template <typename T>
Expand Down
Loading