enhance: eliminate compile warnings (part2) (#38535)

See #38435

---------

Signed-off-by: Ted Xu <ted.xu@zilliz.com>
pull/38743/head
Ted Xu 2024-12-25 15:30:50 +08:00 committed by GitHub
parent 5395ec19ad
commit acc8fb7af6
No known key found for this signature in database
GPG Key ID: B5690EEEBB952194
24 changed files with 106 additions and 116 deletions

View File

@ -152,6 +152,7 @@ if ( APPLE )
"-D_DARWIN_C_SOURCE"
"-Wno-gnu-zero-variadic-macro-arguments"
"-Wno-variadic-macros"
"-Wno-reorder-ctor"
"-DBOOST_STACKTRACE_GNU_SOURCE_NOT_REQUIRED=1"
)
endif ()

View File

@ -987,22 +987,21 @@ class BitsetView : public BitsetBase<PolicyT,
using range_checker = RangeChecker<IsRangeCheckEnabled>;
BitsetView() {
}
BitsetView() = default;
BitsetView(const BitsetView&) = default;
BitsetView(BitsetView&&) = default;
BitsetView(BitsetView&&) noexcept = default;
BitsetView&
operator=(const BitsetView&) = default;
BitsetView&
operator=(BitsetView&&) = default;
operator=(BitsetView&&) noexcept = default;
template <typename ImplT, bool R>
BitsetView(BitsetBase<PolicyT, ImplT, R>& bitset)
explicit BitsetView(BitsetBase<PolicyT, ImplT, R>& bitset)
: Data{bitset.data()}, Size{bitset.size()}, Offset{bitset.offset()} {
}
BitsetView(void* data, const size_t size)
: Data{reinterpret_cast<data_type*>(data)}, Size{size}, Offset{0} {
: Data{reinterpret_cast<data_type*>(data)}, Size{size} {
}
BitsetView(void* data, const size_t offset, const size_t size)
@ -1064,10 +1063,9 @@ class Bitset
using range_checker = RangeChecker<IsRangeCheckEnabled>;
// Allocate an empty one.
Bitset() {
}
Bitset() = default;
// Allocate the given number of bits.
Bitset(const size_t size)
explicit Bitset(const size_t size)
: Data(get_required_size_in_container_elements(size)), Size{size} {
}
// Allocate the given number of bits, initialize with a given value.
@ -1079,16 +1077,16 @@ class Bitset
// Do not allow implicit copies (Rust style).
Bitset(const Bitset&) = delete;
// Allow default move.
Bitset(Bitset&&) = default;
Bitset(Bitset&&) noexcept = default;
// Do not allow implicit copies (Rust style).
Bitset&
operator=(const Bitset&) = delete;
// Allow default move.
Bitset&
operator=(Bitset&&) = default;
operator=(Bitset&&) noexcept = default;
template <typename C, bool R>
Bitset(const BitsetBase<PolicyT, C, R>& other) {
explicit Bitset(const BitsetBase<PolicyT, C, R>& other) {
Data = container_type(
get_required_size_in_container_elements(other.size()));
Size = other.size();

View File

@ -733,8 +733,6 @@ struct ElementWiseBitsetPolicy {
const auto start_shift = get_shift(start + starting_idx);
const auto end_shift = get_shift(start + size);
size_t extra_offset = 0;
// same element?
if (start_element == end_element) {
const data_type existing_v = data[start_element];
@ -764,7 +762,6 @@ struct ElementWiseBitsetPolicy {
}
start_element += 1;
extra_offset += data_bits - start_shift;
}
// process the middle

View File

@ -449,8 +449,8 @@ class ArrayView {
DataType element_type,
std::vector<uint64_t>&& element_offsets)
: size_(size),
element_type_(element_type),
offsets_(std::move(element_offsets)) {
offsets_(std::move(element_offsets)),
element_type_(element_type) {
data_ = data;
if (IsVariableDataType(element_type_)) {
length_ = offsets_.size();

View File

@ -41,7 +41,7 @@ class BitsetView : public knowhere::BitsetView {
}
BitsetView(const BitsetType& bitset) // NOLINT
: BitsetView((uint8_t*)(bitset.data()), size_t(bitset.size())) {
: BitsetView((uint8_t*)(bitset.data()), bitset.size()) {
}
BitsetView(const BitsetTypePtr& bitset_ptr) { // NOLINT

View File

@ -36,7 +36,7 @@ class Chunk {
public:
Chunk() = default;
Chunk(int64_t row_nums, char* data, uint64_t size, bool nullable)
: row_nums_(row_nums), data_(data), size_(size), nullable_(nullable) {
: data_(data), row_nums_(row_nums), size_(size), nullable_(nullable) {
if (nullable) {
valid_.reserve(row_nums);
for (int i = 0; i < row_nums; i++) {

View File

@ -52,7 +52,7 @@ class ChunkWriterBase {
};
template <typename ArrowType, typename T>
class ChunkWriter : public ChunkWriterBase {
class ChunkWriter final : public ChunkWriterBase {
public:
ChunkWriter(int dim, bool nullable) : ChunkWriterBase(nullable), dim_(dim) {
}

View File

@ -97,8 +97,8 @@ class FieldData<BinaryVector> : public FieldDataImpl<uint8_t, false> {
explicit FieldData(int64_t dim,
DataType data_type,
int64_t buffered_num_rows = 0)
: binary_dim_(dim),
FieldDataImpl(dim / 8, data_type, false, buffered_num_rows) {
: FieldDataImpl(dim / 8, data_type, false, buffered_num_rows),
binary_dim_(dim) {
Assert(dim % 8 == 0);
}

View File

@ -19,6 +19,7 @@
#include <optional>
#include <stdexcept>
#include <string>
#include <utility>
#include "common/EasyAssert.h"
#include "common/Types.h"
@ -40,25 +41,25 @@ class FieldMeta {
FieldMeta&
operator=(FieldMeta&&) = default;
FieldMeta(const FieldName& name, FieldId id, DataType type, bool nullable)
: name_(name), id_(id), type_(type), nullable_(nullable) {
FieldMeta(FieldName name, FieldId id, DataType type, bool nullable)
: name_(std::move(name)), id_(id), type_(type), nullable_(nullable) {
Assert(!IsVectorDataType(type_));
}
FieldMeta(const FieldName& name,
FieldMeta(FieldName name,
FieldId id,
DataType type,
int64_t max_length,
bool nullable)
: name_(name),
: name_(std::move(name)),
id_(id),
type_(type),
string_info_(StringInfo{max_length}),
nullable_(nullable) {
nullable_(nullable),
string_info_(StringInfo{max_length}) {
Assert(IsStringDataType(type_));
}
FieldMeta(const FieldName& name,
FieldMeta(FieldName name,
FieldId id,
DataType type,
int64_t max_length,
@ -66,21 +67,21 @@ class FieldMeta {
bool enable_match,
bool enable_analyzer,
std::map<std::string, std::string>& params)
: name_(name),
: name_(std::move(name)),
id_(id),
type_(type),
nullable_(nullable),
string_info_(StringInfo{
max_length, enable_match, enable_analyzer, std::move(params)}),
nullable_(nullable) {
max_length, enable_match, enable_analyzer, std::move(params)}) {
Assert(IsStringDataType(type_));
}
FieldMeta(const FieldName& name,
FieldMeta(FieldName name,
FieldId id,
DataType type,
DataType element_type,
bool nullable)
: name_(name),
: name_(std::move(name)),
id_(id),
type_(type),
element_type_(element_type),
@ -90,17 +91,17 @@ class FieldMeta {
// pass in any value for dim for sparse vector is ok as it'll never be used:
// get_dim() not allowed to be invoked on a sparse vector field.
FieldMeta(const FieldName& name,
FieldMeta(FieldName name,
FieldId id,
DataType type,
int64_t dim,
std::optional<knowhere::MetricType> metric_type,
bool nullable)
: name_(name),
: name_(std::move(name)),
id_(id),
type_(type),
vector_info_(VectorInfo{dim, std::move(metric_type)}),
nullable_(nullable) {
nullable_(nullable),
vector_info_(VectorInfo{dim, std::move(metric_type)}) {
Assert(IsVectorDataType(type_));
Assert(!nullable);
}

View File

@ -138,7 +138,7 @@ class Span<
using embedded_type = typename VectorType::embedded_type;
Span(const embedded_type* data, int64_t row_count, int64_t element_sizeof)
: row_count_(row_count), data_(data), element_sizeof_(element_sizeof) {
: data_(data), row_count_(row_count), element_sizeof_(element_sizeof) {
}
explicit Span(const SpanBase& base)

View File

@ -680,6 +680,9 @@ struct fmt::formatter<milvus::OpType> : formatter<string_view> {
case milvus::OpType::OpType_INT_MAX_SENTINEL_DO_NOT_USE_:
name = "OpType_INT_MAX_SENTINEL_DO_NOT_USE";
break;
case milvus::OpType::TextMatch:
name = "TextMatch";
break;
}
return formatter<string_view>::format(name, ctx);
}

View File

@ -43,11 +43,10 @@ class EvalCtx {
}
explicit EvalCtx(ExecContext* exec_ctx, ExprSet* expr_set)
: exec_ctx_(exec_ctx), expr_set_(expr_set), offset_input_(nullptr) {
: exec_ctx_(exec_ctx), expr_set_(expr_set) {
}
explicit EvalCtx(ExecContext* exec_ctx)
: exec_ctx_(exec_ctx), expr_set_(nullptr), offset_input_(nullptr) {
explicit EvalCtx(ExecContext* exec_ctx) : exec_ctx_(exec_ctx) {
}
ExecContext*

View File

@ -53,15 +53,15 @@ class ChunkedColumnBase : public ColumnBase {
public:
ChunkedColumnBase() = default;
// memory mode ctor
ChunkedColumnBase(const FieldMeta& field_meta) {
explicit ChunkedColumnBase(const FieldMeta& field_meta) {
if (field_meta.is_nullable()) {
nullable_ = true;
}
}
virtual ~ChunkedColumnBase(){};
virtual ~ChunkedColumnBase() = default;
virtual void
void
AppendBatch(const FieldDataPtr data) override {
PanicInfo(ErrorCode::Unsupported, "AppendBatch not supported");
}

View File

@ -132,7 +132,7 @@ class ColumnBase {
AppendBatch(const FieldDataPtr data) = 0;
virtual const char*
Data(int chunk_id = 0) const = 0;
Data(int chunk_id) const = 0;
};
class SingleChunkColumnBase : public ColumnBase {
public:
@ -183,8 +183,6 @@ class SingleChunkColumnBase : public ColumnBase {
bool nullable)
: mcm_(mcm),
mmap_descriptor_(descriptor),
num_rows_(0),
data_size_(0),
data_cap_size_(reserve),
mapping_type_(MappingType::MAP_WITH_MANAGER),
nullable_(nullable) {
@ -267,7 +265,7 @@ class SingleChunkColumnBase : public ColumnBase {
// Data() points at an addr that contains the elements
virtual const char*
Data(int chunk_id = 0) const override {
Data(int chunk_id) const override {
return data_;
}
@ -297,7 +295,7 @@ class SingleChunkColumnBase : public ColumnBase {
// returns the number of bytes used to store actual data
size_t
DataByteSize() const {
DataByteSize() const override {
return data_size_;
}
@ -330,7 +328,7 @@ class SingleChunkColumnBase : public ColumnBase {
}
virtual void
AppendBatch(const FieldDataPtr data) {
AppendBatch(const FieldDataPtr data) override {
size_t required_size = data_size_ + data->DataSize();
if (required_size > data_cap_size_) {
ExpandData(required_size * 2);
@ -584,7 +582,7 @@ class SingleChunkSparseFloatColumn : public SingleChunkColumnBase {
// returned pointer points at a list of knowhere::sparse::SparseRow<float>
const char*
Data(int chunk_id = 0) const override {
Data(int chunk_id) const override {
return static_cast<const char*>(static_cast<const void*>(vec_.data()));
}
@ -705,7 +703,7 @@ class SingleChunkVariableColumn : public SingleChunkColumnBase {
}
std::pair<std::vector<std::string_view>, FixedVector<bool>>
ViewsByOffsets(const FixedVector<int32_t>& offsets) const {
ViewsByOffsets(const FixedVector<int32_t>& offsets) const override {
std::vector<std::string_view> res;
FixedVector<bool> valid;
res.reserve(offsets.size());

View File

@ -119,10 +119,10 @@ class ChunkedSegmentSealedImpl : public SegmentSealed {
get_schema() const override;
std::vector<SegOffset>
search_pk(const PkType& pk, Timestamp timestamp) const;
search_pk(const PkType& pk, Timestamp timestamp) const override;
std::vector<SegOffset>
search_pk(const PkType& pk, int64_t insert_barrier) const;
search_pk(const PkType& pk, int64_t insert_barrier) const override;
template <typename Condition>
std::vector<SegOffset>
@ -201,7 +201,7 @@ class ChunkedSegmentSealedImpl : public SegmentSealed {
is_mmap_field(FieldId id) const override;
void
ClearData();
ClearData() override;
protected:
// blob and row_count
@ -340,7 +340,7 @@ class ChunkedSegmentSealedImpl : public SegmentSealed {
void
LoadScalarIndex(const LoadIndexInfo& info);
virtual void
void
WarmupChunkCache(const FieldId field_id, bool mmap_enabled) override;
bool

View File

@ -405,7 +405,7 @@ class ConcurrentVector<std::string>
int64_t size_per_chunk,
storage::MmapChunkDescriptorPtr mmap_descriptor = nullptr)
: ConcurrentVectorImpl<std::string, true>::ConcurrentVectorImpl(
1, size_per_chunk, mmap_descriptor) {
1, size_per_chunk, std::move(mmap_descriptor)) {
}
std::string_view
@ -423,7 +423,7 @@ class ConcurrentVector<Json> : public ConcurrentVectorImpl<Json, true> {
int64_t size_per_chunk,
storage::MmapChunkDescriptorPtr mmap_descriptor = nullptr)
: ConcurrentVectorImpl<Json, true>::ConcurrentVectorImpl(
1, size_per_chunk, mmap_descriptor) {
1, size_per_chunk, std::move(mmap_descriptor)) {
}
std::string_view
@ -442,7 +442,7 @@ class ConcurrentVector<Array> : public ConcurrentVectorImpl<Array, true> {
int64_t size_per_chunk,
storage::MmapChunkDescriptorPtr mmap_descriptor = nullptr)
: ConcurrentVectorImpl<Array, true>::ConcurrentVectorImpl(
1, size_per_chunk, mmap_descriptor) {
1, size_per_chunk, std::move(mmap_descriptor)) {
}
ArrayView
@ -460,10 +460,9 @@ class ConcurrentVector<SparseFloatVector>
explicit ConcurrentVector(
int64_t size_per_chunk,
storage::MmapChunkDescriptorPtr mmap_descriptor = nullptr)
: ConcurrentVectorImpl<knowhere::sparse::SparseRow<float>,
true>::ConcurrentVectorImpl(1,
size_per_chunk,
mmap_descriptor),
: ConcurrentVectorImpl<knowhere::sparse::SparseRow<float>, true>::
ConcurrentVectorImpl(
1, size_per_chunk, std::move(mmap_descriptor)),
dim_(0) {
}
@ -499,7 +498,7 @@ class ConcurrentVector<FloatVector>
int64_t size_per_chunk,
storage::MmapChunkDescriptorPtr mmap_descriptor = nullptr)
: ConcurrentVectorImpl<float, false>::ConcurrentVectorImpl(
dim, size_per_chunk, mmap_descriptor) {
dim, size_per_chunk, std::move(mmap_descriptor)) {
}
};
@ -511,7 +510,8 @@ class ConcurrentVector<BinaryVector>
int64_t dim,
int64_t size_per_chunk,
storage::MmapChunkDescriptorPtr mmap_descriptor = nullptr)
: ConcurrentVectorImpl(dim / 8, size_per_chunk, mmap_descriptor) {
: ConcurrentVectorImpl(
dim / 8, size_per_chunk, std::move(mmap_descriptor)) {
AssertInfo(dim % 8 == 0,
fmt::format("dim is not a multiple of 8, dim={}", dim));
}
@ -525,7 +525,7 @@ class ConcurrentVector<Float16Vector>
int64_t size_per_chunk,
storage::MmapChunkDescriptorPtr mmap_descriptor = nullptr)
: ConcurrentVectorImpl<float16, false>::ConcurrentVectorImpl(
dim, size_per_chunk, mmap_descriptor) {
dim, size_per_chunk, std::move(mmap_descriptor)) {
}
};
@ -537,7 +537,7 @@ class ConcurrentVector<BFloat16Vector>
int64_t size_per_chunk,
storage::MmapChunkDescriptorPtr mmap_descriptor = nullptr)
: ConcurrentVectorImpl<bfloat16, false>::ConcurrentVectorImpl(
dim, size_per_chunk, mmap_descriptor) {
dim, size_per_chunk, std::move(mmap_descriptor)) {
}
};

View File

@ -120,8 +120,7 @@ class DeletedRecord {
}
std::vector<SegOffset> offsets;
if (segment_) {
offsets =
std::move(segment_->search_pk(deleted_pk, deleted_ts));
offsets = segment_->search_pk(deleted_pk, deleted_ts);
} else {
// only for testing
offsets = std::move(
@ -268,7 +267,7 @@ class DeletedRecord {
} else {
// add new snapshot
snapshots_.push_back(
std::make_pair(dump_ts, std::move(bitmap.clone())));
std::make_pair(dump_ts, bitmap.clone()));
Assert(it != accessor.end() && it.good());
snap_next_iter_.push_back(it);
}
@ -314,7 +313,7 @@ class DeletedRecord {
for (const auto& snap : snapshots_) {
snapshots.emplace_back(snap.first, snap.second.clone());
}
return std::move(snapshots);
return snapshots;
}
public:

View File

@ -535,7 +535,7 @@ struct InsertRecord {
case DataType::INT64: {
auto column =
std::dynamic_pointer_cast<SingleChunkColumn>(data);
auto pks = reinterpret_cast<const int64_t*>(column->Data());
auto pks = reinterpret_cast<const int64_t*>(column->Data(0));
for (int i = 0; i < column->NumRows(); ++i) {
pk2offset_->insert(pks[i], offset++);
}

View File

@ -61,7 +61,6 @@ namespace milvus::segcore {
case DataType::INT64: { \
auto col = \
std::dynamic_pointer_cast<SingleChunkColumn>(column); \
auto pks = reinterpret_cast<const int64_t*>(col->Data()); \
for (int i = 1; i < col->NumRows(); ++i) { \
assert(pks[i - 1] <= pks[i] && \
"INT64 Column is not ordered!"); \
@ -122,7 +121,6 @@ void
SegmentSealedImpl::LoadVecIndex(const LoadIndexInfo& info) {
// NOTE: lock only when data is ready to avoid starvation
auto field_id = FieldId(info.field_id);
auto& field_meta = schema_->operator[](field_id);
AssertInfo(info.index_params.count("metric_type"),
"Can't get metric_type in index_params");
@ -712,7 +710,6 @@ SegmentSealedImpl::get_chunk_buffer(FieldId field_id,
std::shared_lock lck(mutex_);
AssertInfo(get_bit(field_data_ready_bitset_, field_id),
"Can't get bitset element at " + std::to_string(field_id.get()));
auto& field_meta = schema_->operator[](field_id);
if (auto it = fields_.find(field_id); it != fields_.end()) {
auto& field_data = it->second;
FixedVector<bool> valid_data;
@ -839,7 +836,7 @@ SegmentSealedImpl::search_sorted_pk(const PkType& pk,
case DataType::INT64: {
auto target = std::get<int64_t>(pk);
// get int64 pks
auto src = reinterpret_cast<const int64_t*>(pk_column->Data());
auto src = reinterpret_cast<const int64_t*>(pk_column->Data(0));
auto it =
std::lower_bound(src,
src + pk_column->NumRows(),
@ -950,7 +947,7 @@ SegmentSealedImpl::vector_search(SearchInfo& search_info,
}
query::SearchOnSealed(*schema_,
vec_data->Data(),
vec_data->Data(0),
search_info,
index_info,
query_data,
@ -1069,8 +1066,8 @@ SegmentSealedImpl::get_vector(FieldId field_id,
pool.Submit(ReadFromChunkCache, cc, data_path, mmap_descriptor_));
}
for (int i = 0; i < futures.size(); ++i) {
const auto& [data_path, column] = futures[i].get();
for (auto& future : futures) {
const auto& [data_path, column] = future.get();
path_to_column[data_path] = column;
}
@ -1091,7 +1088,7 @@ SegmentSealedImpl::get_vector(FieldId field_id,
AssertInfo(sparse_column, "incorrect column created");
buf[i] = static_cast<const knowhere::sparse::SparseRow<float>*>(
static_cast<const void*>(
sparse_column->Data()))[offset_in_binlog];
sparse_column->Data(0)))[offset_in_binlog];
}
return segcore::CreateVectorDataArrayFrom(
buf.data(), count, field_meta);
@ -1112,7 +1109,7 @@ SegmentSealedImpl::get_vector(FieldId field_id,
offset_in_binlog,
column->NumRows(),
data_path);
auto vector = &column->Data()[offset_in_binlog * row_bytes];
auto vector = &column->Data(0)[offset_in_binlog * row_bytes];
std::memcpy(buf.data() + i * row_bytes, vector, row_bytes);
}
return segcore::CreateVectorDataArrayFrom(
@ -1133,7 +1130,6 @@ SegmentSealedImpl::DropFieldData(const FieldId field_id) {
}
lck.unlock();
} else {
auto& field_meta = schema_->operator[](field_id);
std::unique_lock lck(mutex_);
if (get_bit(field_data_ready_bitset_, field_id)) {
fields_.erase(field_id);
@ -1379,7 +1375,7 @@ SegmentSealedImpl::get_raw_data(FieldId field_id,
const FieldMeta& field_meta,
const int64_t* seg_offsets,
int64_t count) const {
// DO NOT directly access the column by map like: `fields_.at(field_id)->Data()`,
// DO NOT directly access the column by map like: `fields_.at(field_id)->Data(0)`,
// we have to clone the shared pointer,
// to make sure it won't get released if segment released
auto column = fields_.at(field_id);
@ -1421,7 +1417,7 @@ SegmentSealedImpl::get_raw_data(FieldId field_id,
}
case DataType::BOOL: {
bulk_subscript_impl<bool>(column->Data(),
bulk_subscript_impl<bool>(column->Data(0),
seg_offsets,
count,
ret->mutable_scalars()
@ -1431,7 +1427,7 @@ SegmentSealedImpl::get_raw_data(FieldId field_id,
break;
}
case DataType::INT8: {
bulk_subscript_impl<int8_t>(column->Data(),
bulk_subscript_impl<int8_t>(column->Data(0),
seg_offsets,
count,
ret->mutable_scalars()
@ -1441,7 +1437,7 @@ SegmentSealedImpl::get_raw_data(FieldId field_id,
break;
}
case DataType::INT16: {
bulk_subscript_impl<int16_t>(column->Data(),
bulk_subscript_impl<int16_t>(column->Data(0),
seg_offsets,
count,
ret->mutable_scalars()
@ -1451,7 +1447,7 @@ SegmentSealedImpl::get_raw_data(FieldId field_id,
break;
}
case DataType::INT32: {
bulk_subscript_impl<int32_t>(column->Data(),
bulk_subscript_impl<int32_t>(column->Data(0),
seg_offsets,
count,
ret->mutable_scalars()
@ -1461,7 +1457,7 @@ SegmentSealedImpl::get_raw_data(FieldId field_id,
break;
}
case DataType::INT64: {
bulk_subscript_impl<int64_t>(column->Data(),
bulk_subscript_impl<int64_t>(column->Data(0),
seg_offsets,
count,
ret->mutable_scalars()
@ -1471,7 +1467,7 @@ SegmentSealedImpl::get_raw_data(FieldId field_id,
break;
}
case DataType::FLOAT: {
bulk_subscript_impl<float>(column->Data(),
bulk_subscript_impl<float>(column->Data(0),
seg_offsets,
count,
ret->mutable_scalars()
@ -1481,7 +1477,7 @@ SegmentSealedImpl::get_raw_data(FieldId field_id,
break;
}
case DataType::DOUBLE: {
bulk_subscript_impl<double>(column->Data(),
bulk_subscript_impl<double>(column->Data(0),
seg_offsets,
count,
ret->mutable_scalars()
@ -1492,7 +1488,7 @@ SegmentSealedImpl::get_raw_data(FieldId field_id,
}
case DataType::VECTOR_FLOAT: {
bulk_subscript_impl(field_meta.get_sizeof(),
column->Data(),
column->Data(0),
seg_offsets,
count,
ret->mutable_vectors()
@ -1504,7 +1500,7 @@ SegmentSealedImpl::get_raw_data(FieldId field_id,
case DataType::VECTOR_FLOAT16: {
bulk_subscript_impl(
field_meta.get_sizeof(),
column->Data(),
column->Data(0),
seg_offsets,
count,
ret->mutable_vectors()->mutable_float16_vector()->data());
@ -1513,7 +1509,7 @@ SegmentSealedImpl::get_raw_data(FieldId field_id,
case DataType::VECTOR_BFLOAT16: {
bulk_subscript_impl(
field_meta.get_sizeof(),
column->Data(),
column->Data(0),
seg_offsets,
count,
ret->mutable_vectors()->mutable_bfloat16_vector()->data());
@ -1522,7 +1518,7 @@ SegmentSealedImpl::get_raw_data(FieldId field_id,
case DataType::VECTOR_BINARY: {
bulk_subscript_impl(
field_meta.get_sizeof(),
column->Data(),
column->Data(0),
seg_offsets,
count,
ret->mutable_vectors()->mutable_binary_vector()->data());
@ -1530,7 +1526,7 @@ SegmentSealedImpl::get_raw_data(FieldId field_id,
}
case DataType::VECTOR_SPARSE_FLOAT: {
auto rows = static_cast<const knowhere::sparse::SparseRow<float>*>(
static_cast<const void*>(column->Data()));
static_cast<const void*>(column->Data(0)));
auto dst = ret->mutable_vectors()->mutable_sparse_float_vector();
SparseRowsToProto(
[&](size_t i) {
@ -1590,7 +1586,6 @@ SegmentSealedImpl::bulk_subscript(
int64_t count,
const std::vector<std::string>& dynamic_field_names) const {
Assert(!dynamic_field_names.empty());
auto& field_meta = schema_->operator[](field_id);
if (count == 0) {
return fill_with_empty(field_id, 0);
}
@ -1920,7 +1915,7 @@ SegmentSealedImpl::generate_interim_index(const FieldId field_id) {
auto index_metric = field_binlog_config->GetMetricType();
auto dataset =
knowhere::GenDataSet(row_count, dim, (void*)vec_data->Data());
knowhere::GenDataSet(row_count, dim, (void*)vec_data->Data(0));
dataset->SetIsOwner(false);
dataset->SetIsSparse(is_sparse);

View File

@ -91,7 +91,7 @@ class SegmentSealedImpl : public SegmentSealed {
GetFieldDataType(FieldId fieldId) const override;
void
RemoveFieldFile(const FieldId field_id);
RemoveFieldFile(const FieldId field_id) override;
void
CreateTextIndex(FieldId field_id) override;
@ -116,10 +116,10 @@ class SegmentSealedImpl : public SegmentSealed {
get_schema() const override;
std::vector<SegOffset>
search_pk(const PkType& pk, Timestamp timestamp) const;
search_pk(const PkType& pk, Timestamp timestamp) const override;
std::vector<SegOffset>
search_pk(const PkType& pk, int64_t insert_barrier) const;
search_pk(const PkType& pk, int64_t insert_barrier) const override;
template <typename Condition>
std::vector<SegOffset>
@ -214,7 +214,7 @@ class SegmentSealedImpl : public SegmentSealed {
is_mmap_field(FieldId id) const override;
void
ClearData();
ClearData() override;
protected:
// blob and row_count

View File

@ -29,8 +29,8 @@ namespace milvus::storage {
std::unique_ptr<DataCodec>
DeserializeRemoteFileData(BinlogReaderPtr reader, bool is_field_data) {
DescriptorEvent descriptor_event(reader);
DataType data_type =
DataType(descriptor_event.event_data.fix_part.data_type);
auto data_type =
static_cast<DataType>(descriptor_event.event_data.fix_part.data_type);
auto& extras = descriptor_event.event_data.extras;
bool nullable = (extras.find(NULLABLE) != extras.end())
? std::any_cast<bool>(extras[NULLABLE])

View File

@ -18,6 +18,7 @@
#include <arrow/record_batch.h>
#include <cstdint>
#include <utility>
#include <vector>
#include <memory>
#include <utility>
@ -33,11 +34,11 @@ namespace milvus::storage {
class DataCodec {
public:
explicit DataCodec(FieldDataPtr data, CodecType type)
: field_data_(std::move(data)), codec_type_(type) {
: codec_type_(type), field_data_(std::move(data)) {
}
explicit DataCodec(std::shared_ptr<PayloadReader> reader, CodecType type)
: payload_reader_(reader), codec_type_(type) {
: codec_type_(type), payload_reader_(std::move(reader)) {
}
virtual ~DataCodec() = default;
@ -87,7 +88,7 @@ class DataCodec {
void
SetData(std::shared_ptr<uint8_t[]> data) {
data_ = data;
data_ = std::move(data);
}
protected:

View File

@ -14,7 +14,7 @@
// See the License for the specific language governing permissions and
// limitations under the License.
#pragma
#pragma once
#include <queue>
#include <shared_mutex>
@ -25,10 +25,8 @@ namespace milvus {
template <typename T>
class SafeQueue {
public:
SafeQueue(void) {
}
~SafeQueue() {
}
SafeQueue() = default;
~SafeQueue() = default;
bool
empty() {

View File

@ -150,7 +150,7 @@ TEST_P(ChunkCacheTest, Read) {
dense_file_name, descriptor, dense_field_meta, mmap_enabled);
Assert(dense_column->DataByteSize() == dim * N * 4);
}
auto actual_dense = (const float*)(dense_column->Data());
auto actual_dense = (const float*)(dense_column->Data(0));
for (auto i = 0; i < N * dim; i++) {
AssertInfo(dense_data[i] == actual_dense[i],
fmt::format(
@ -168,7 +168,7 @@ TEST_P(ChunkCacheTest, Read) {
}
auto expected_sparse_size = 0;
auto actual_sparse =
(const knowhere::sparse::SparseRow<float>*)(sparse_column->Data());
(const knowhere::sparse::SparseRow<float>*)(sparse_column->Data(0));
for (auto i = 0; i < N; i++) {
const auto& actual_sparse_row = actual_sparse[i];
const auto& expect_sparse_row = sparse_data[i];
@ -215,7 +215,7 @@ TEST_P(ChunkCacheTest, TestMultithreads) {
Assert(dense_column->DataByteSize() == dim * N * 4);
}
auto actual_dense = (const float*)dense_column->Data();
auto actual_dense = (const float*)dense_column->Data(0);
for (auto i = 0; i < N * dim; i++) {
AssertInfo(
dense_data[i] == actual_dense[i],
@ -232,7 +232,7 @@ TEST_P(ChunkCacheTest, TestMultithreads) {
sparse_file_name, descriptor, sparse_field_meta, mmap_enabled);
}
auto actual_sparse =
(const knowhere::sparse::SparseRow<float>*)sparse_column->Data();
(const knowhere::sparse::SparseRow<float>*)sparse_column->Data(0);
for (auto i = 0; i < N; i++) {
const auto& actual_sparse_row = actual_sparse[i];
const auto& expect_sparse_row = sparse_data[i];