fix: void copy when getting json chunk #43183 (#43202)

master https://github.com/milvus-io/milvus/pull/43183
fix: https://github.com/milvus-io/milvus/issues/43182

---------

Signed-off-by: SpadeA <tangchenjie1210@gmail.com>
This commit is contained in:
Spade A 2025-07-16 15:34:51 +08:00 committed by GitHub
parent 8ac3adcc52
commit 6ccf1aa9b8
No known key found for this signature in database
GPG Key ID: B5690EEEBB952194
2 changed files with 8 additions and 1 deletions

View File

@ -90,6 +90,13 @@ class Json {
cap);
}
// WARN: this is used for fast non-copy construction,
// MUST make sure there at least SIMDJSON_PADDING bytes allocated
// after the string_view.
explicit Json(const std::string_view& data)
: Json(data.data(), data.size()) {
}
// WARN: this is used for fast non-copy construction,
// MUST make sure that the data points to a memory that
// with size at least len + SIMDJSON_PADDING

View File

@ -183,7 +183,7 @@ class SegmentInternalInterface : public SegmentInterface {
std::vector<Json> res;
res.reserve(string_views.size());
for (const auto& str_view : string_views) {
res.emplace_back(str_view);
res.emplace_back(Json(str_view));
}
return {std::move(res), std::move(valid_data)};
}