From 0af6a62c3142587ee55412dcb2dfb701b6f60126 Mon Sep 17 00:00:00 2001 From: Jalin Wang Date: Mon, 26 Jan 2026 16:22:37 +0800 Subject: [PATCH] fix: flat support more segments (#32) * fix * fix compilation --- src/core/algorithm/flat/flat_index_format.h | 12 ++++++------ src/core/algorithm/flat/flat_streamer_entity.h | 4 ++-- src/include/zvec/ailego/utility/string_helper.h | 1 + 3 files changed, 9 insertions(+), 8 deletions(-) diff --git a/src/core/algorithm/flat/flat_index_format.h b/src/core/algorithm/flat/flat_index_format.h index 8c3e690..d91385a 100644 --- a/src/core/algorithm/flat/flat_index_format.h +++ b/src/core/algorithm/flat/flat_index_format.h @@ -89,8 +89,8 @@ struct LinearIntegerQuantizerParams { /*! Location of Vectors Block in Storage Segment */ struct BlockLocation { - uint16_t segment_id{0}; - uint16_t block_index{0}; + uint32_t segment_id{0}; + uint32_t block_index{0}; }; /*! The Header of a Block in Storage Segment @@ -153,10 +153,10 @@ struct VectorLocation { : segment_id(0u), column_major(0u), reserved(0u), offset(0u) {} //! Constructor - VectorLocation(uint16_t id, bool col, uint32_t off) + VectorLocation(uint32_t id, bool col, uint32_t off) : segment_id(id), column_major(col), reserved(0u), offset(off) {} - uint16_t segment_id{0}; + uint32_t segment_id{0}; uint16_t column_major : 1; uint16_t reserved : 15; uint32_t offset{0}; @@ -168,8 +168,8 @@ struct VectorLocation { } }; -static_assert(sizeof(VectorLocation) == sizeof(uint64_t), - "VectorLocation must be size of 8 bytes"); +// static_assert(sizeof(VectorLocation) == sizeof(uint64_t), +// "VectorLocation must be size of 8 bytes"); struct KeyInfo { KeyInfo(void) : centroid_idx(0u) {} diff --git a/src/core/algorithm/flat/flat_streamer_entity.h b/src/core/algorithm/flat/flat_streamer_entity.h index 277e8f2..06c691d 100644 --- a/src/core/algorithm/flat/flat_streamer_entity.h +++ b/src/core/algorithm/flat/flat_streamer_entity.h @@ -380,8 +380,8 @@ class FlatStreamerEntity { private: //! Constants - static constexpr size_t kMaxSegmentId = std::numeric_limits::max(); - static constexpr size_t kMaxBlockId = std::numeric_limits::max(); + static constexpr size_t kMaxSegmentId = std::numeric_limits::max(); + static constexpr size_t kMaxBlockId = std::numeric_limits::max(); //! Members std::mutex mutex_{}; diff --git a/src/include/zvec/ailego/utility/string_helper.h b/src/include/zvec/ailego/utility/string_helper.h index 7a924ec..2dab937 100644 --- a/src/include/zvec/ailego/utility/string_helper.h +++ b/src/include/zvec/ailego/utility/string_helper.h @@ -14,6 +14,7 @@ #pragma once +#include #include #include #include