diff --git a/internal/core/src/common/BitsetView.h b/internal/core/src/common/BitsetView.h index 7df3815627..7d496493e7 100644 --- a/internal/core/src/common/BitsetView.h +++ b/internal/core/src/common/BitsetView.h @@ -16,10 +16,13 @@ #pragma once -#include +#include + #include -#include "exceptions/EasyAssert.h" +#include + #include "common/Types.h" +#include "exceptions/EasyAssert.h" #include "knowhere/bitsetview.h" namespace milvus { @@ -52,9 +55,8 @@ class BitsetView : public knowhere::BitsetView { } AssertInfo((offset & 0x7) == 0, "offset is not divisible by 8"); - AssertInfo((offset + size) <= this->size(), "offset + size cross the border.[offset=" + std::to_string(offset) + - "][size=" + std::to_string(size) + - "][this.size()=" + std::to_string(this->size()) + "]"); + AssertInfo(offset + size <= this->size(), + fmt::format("index out of range, offset={}, size={}, bitset.size={}", offset, size, this->size())); return {data() + (offset >> 3), size}; } }; diff --git a/internal/core/src/segcore/ConcurrentVector.h b/internal/core/src/segcore/ConcurrentVector.h index 3670d8840e..caa033ec17 100644 --- a/internal/core/src/segcore/ConcurrentVector.h +++ b/internal/core/src/segcore/ConcurrentVector.h @@ -11,6 +11,7 @@ #pragma once +#include #include #include @@ -284,8 +285,9 @@ class ConcurrentVectorImpl : public VectorBase { if (element_count <= 0) { return; } - auto chunk_max_size = chunks_.size(); - AssertInfo(chunk_id < chunk_max_size, "chunk_id=" + std::to_string(chunk_id)); + auto chunk_num = chunks_.size(); + AssertInfo(chunk_id < chunk_num, + fmt::format("chunk_id out of chunk num, chunk_id={}, chunk_num={}", chunk_id, chunk_num)); Chunk& chunk = chunks_[chunk_id]; auto ptr = chunk.data(); std::copy_n(source + source_offset * Dim, element_count * Dim, ptr + chunk_offset * Dim); diff --git a/internal/core/src/segcore/SegmentSealedImpl.cpp b/internal/core/src/segcore/SegmentSealedImpl.cpp index 6e8b3b75ed..b8b211263d 100644 --- a/internal/core/src/segcore/SegmentSealedImpl.cpp +++ b/internal/core/src/segcore/SegmentSealedImpl.cpp @@ -155,10 +155,9 @@ SegmentSealedImpl::LoadFieldData(const LoadFieldDataInfo& info) { AssertInfo(info.field_data != nullptr, "Field info blob is null"); auto size = info.row_count; if (row_count_opt_.has_value()) { - AssertInfo(row_count_opt_.value() == size, "field (" + std::to_string(field_id.get()) + - ") data has different row count (" + std::to_string(size) + - ") than other column's row count (" + - std::to_string(row_count_opt_.value()) + ")"); + AssertInfo(row_count_opt_.value() == size, + fmt::format("field {} has different row count {} to other column's {}", field_id.get(), size, + row_count_opt_.value())); } if (SystemProperty::Instance().IsSystem(field_id)) {