From 244bcf65da81c17bad83dde17c0ba9dacb6f77d1 Mon Sep 17 00:00:00 2001 From: Pxl Date: Tue, 30 Dec 2025 17:43:27 +0800 Subject: [PATCH] [Chore](bitmap) change BitmapValue CHECK to throw exception (#59464) This pull request refactors error handling in the `BitmapValue` class to improve robustness and provide clearer error messages. Instead of using `CHECK` macros, it now throws exceptions with detailed information when inconsistencies are detected in the bitmap value's set count. **Error handling improvements:** * Replaced `CHECK` and `CHECK_EQ` macros with explicit exception throwing (`Exception(ErrorCode::INTERNAL_ERROR, ...)`) when the set count exceeds the threshold or does not match the expected size, including detailed error messages with the problematic values. --- be/src/util/bitmap_value.h | 11 +++++++++-- 1 file changed, 9 insertions(+), 2 deletions(-) diff --git a/be/src/util/bitmap_value.h b/be/src/util/bitmap_value.h index 06a18f8bb4f6c0..dbdd1ff84c1aa5 100644 --- a/be/src/util/bitmap_value.h +++ b/be/src/util/bitmap_value.h @@ -1977,12 +1977,19 @@ class BitmapValue { ++src; uint8_t count = *src; ++src; - CHECK(count <= SET_TYPE_THRESHOLD) << "bitmap value with incorrect set count"; + if (count > SET_TYPE_THRESHOLD) { + throw Exception(ErrorCode::INTERNAL_ERROR, + "bitmap value with incorrect set count, count: {}", count); + } _set.reserve(count); for (uint8_t i = 0; i != count; ++i, src += sizeof(uint64_t)) { _set.insert(decode_fixed64_le(reinterpret_cast(src))); } - CHECK_EQ(count, _set.size()) << "bitmap value with incorrect set count"; + if (_set.size() != count) { + throw Exception(ErrorCode::INTERNAL_ERROR, + "bitmap value with incorrect set count, count: {}, set size: {}", + count, _set.size()); + } if (!config::enable_set_in_bitmap_value) { _prepare_bitmap_for_write();