Add code for PanicInfo (#27364)

Signed-off-by: Enwei Jiao <enwei.jiao@zilliz.com>
pull/27401/head
Enwei Jiao 2023-09-27 12:01:28 +08:00 committed by GitHub
parent 4071132f6a
commit b80a3e19d3
No known key found for this signature in database
GPG Key ID: 4AEE18F83AFDEB23
47 changed files with 680 additions and 426 deletions

View File

@ -227,8 +227,7 @@ class Array {
return true;
}
default:
PanicCodeInfo(Unsupported,
"unsupported element type for array");
PanicInfo(Unsupported, "unsupported element type for array");
}
}
@ -264,8 +263,8 @@ class Array {
return static_cast<T>(
reinterpret_cast<double*>(data_)[index]);
default:
PanicCodeInfo(Unsupported,
"unsupported element type for array");
PanicInfo(Unsupported,
"unsupported element type for array");
}
}
return reinterpret_cast<T*>(data_)[index];
@ -481,8 +480,8 @@ class ArrayView {
return static_cast<T>(
reinterpret_cast<double*>(data_)[index]);
default:
PanicCodeInfo(Unsupported,
"unsupported element type for array");
PanicInfo(Unsupported,
"unsupported element type for array");
}
}
return reinterpret_cast<T*>(data_)[index];

View File

@ -53,6 +53,8 @@ enum ErrorCode {
DataFormatBroken = 2024,
JsonKeyInvalid = 2025,
MetricTypeInvalid = 2026,
FieldNotLoaded = 2027,
ExprInvalid = 2028,
UnistdError = 2030,
KnowhereError = 2100,
};
@ -71,7 +73,7 @@ class SegcoreError : public std::runtime_error {
public:
static SegcoreError
success() {
return SegcoreError(ErrorCode::Success, "");
return {ErrorCode::Success, ""};
}
SegcoreError(ErrorCode error_code, const std::string& error_msg)
@ -125,13 +127,8 @@ FailureCStatus(std::exception* ex) {
} while (0)
#define Assert(expr) AssertInfo((expr), "")
#define PanicInfo(info) \
do { \
milvus::impl::EasyAssertInfo(false, "", __FILE__, __LINE__, (info)); \
__builtin_unreachable(); \
} while (0)
#define PanicCodeInfo(errcode, info) \
#define PanicInfo(errcode, info) \
do { \
milvus::impl::EasyAssertInfo( \
false, "", __FILE__, __LINE__, (info), errcode); \

View File

@ -95,9 +95,8 @@ datatype_name(DataType data_type) {
return "vector_float16";
}
default: {
PanicCodeInfo(DataTypeInvalid,
fmt::format("Unsupported DataType({})",
fmt::underlying(data_type)));
PanicInfo(DataTypeInvalid,
fmt::format("Unsupported DataType({})", data_type));
}
}
}

View File

@ -18,7 +18,7 @@
#include <string>
#include "Types.h"
#include "common/Types.h"
namespace milvus {
@ -63,3 +63,23 @@ class SystemProperty {
};
} // namespace milvus
template <>
struct fmt::formatter<milvus::SystemFieldType> : formatter<string_view> {
auto
format(milvus::SystemFieldType c, format_context& ctx) const {
string_view name = "unknown";
switch (c) {
case milvus::SystemFieldType::Invalid:
name = "Invalid";
break;
case milvus::SystemFieldType::RowId:
name = "RowId";
break;
case milvus::SystemFieldType::Timestamp:
name = "Timestamp";
break;
}
return formatter<string_view>::format(name, ctx);
}
};

View File

@ -35,6 +35,7 @@
#include <variant>
#include <vector>
#include "fmt/core.h"
#include "knowhere/binaryset.h"
#include "knowhere/comp/index_param.h"
#include "knowhere/dataset.h"
@ -238,3 +239,59 @@ struct fmt::formatter<milvus::DataType> : formatter<string_view> {
return formatter<string_view>::format(name, ctx);
}
};
template <>
struct fmt::formatter<milvus::OpType> : formatter<string_view> {
auto
format(milvus::OpType c, format_context& ctx) const {
string_view name = "unknown";
switch (c) {
case milvus::OpType::Invalid:
name = "Invalid";
break;
case milvus::OpType::GreaterThan:
name = "GreaterThan";
break;
case milvus::OpType::GreaterEqual:
name = "GreaterEqual";
break;
case milvus::OpType::LessThan:
name = "LessThan";
break;
case milvus::OpType::LessEqual:
name = "LessEqual";
break;
case milvus::OpType::Equal:
name = "Equal";
break;
case milvus::OpType::NotEqual:
name = "NotEqual";
break;
case milvus::OpType::PrefixMatch:
name = "PrefixMatch";
break;
case milvus::OpType::PostfixMatch:
name = "PostfixMatch";
break;
case milvus::OpType::Match:
name = "Match";
break;
case milvus::OpType::Range:
name = "Range";
break;
case milvus::OpType::In:
name = "In";
break;
case milvus::OpType::NotIn:
name = "NotIn";
break;
case milvus::OpType::OpType_INT_MIN_SENTINEL_DO_NOT_USE_:
name = "OpType_INT_MIN_SENTINEL_DO_NOT_USE";
break;
case milvus::OpType::OpType_INT_MAX_SENTINEL_DO_NOT_USE_:
name = "OpType_INT_MAX_SENTINEL_DO_NOT_USE";
break;
}
return formatter<string_view>::format(name, ctx);
}
};

View File

@ -62,13 +62,13 @@ KnowhereSetSimdType(const char* value) {
} else if (strcmp(value, "avx") == 0 || strcmp(value, "sse4_2") == 0) {
simd_type = knowhere::KnowhereConfig::SimdType::SSE4_2;
} else {
PanicInfo("invalid SIMD type: " + std::string(value));
PanicInfo(ConfigInvalid, "invalid SIMD type: " + std::string(value));
}
try {
return knowhere::KnowhereConfig::SetSimdType(simd_type);
} catch (std::exception& e) {
LOG_SERVER_ERROR_ << e.what();
PanicInfo(e.what());
PanicInfo(ConfigInvalid, e.what());
}
}
@ -81,8 +81,9 @@ void
KnowhereInitSearchThreadPool(const uint32_t num_threads) {
knowhere::KnowhereConfig::SetSearchThreadPoolSize(num_threads);
if (!knowhere::KnowhereConfig::SetAioContextPool(num_threads)) {
PanicInfo("Failed to set aio context pool with num_threads " +
std::to_string(num_threads));
PanicInfo(ConfigInvalid,
"Failed to set aio context pool with num_threads " +
std::to_string(num_threads));
}
}

View File

@ -64,9 +64,9 @@ ScalarIndex<T>::Query(const DatasetPtr& dataset) {
case OpType::PrefixMatch:
case OpType::PostfixMatch:
default:
throw SegcoreError(OpTypeInvalid,
fmt::format("unsupported operator type: {}",
fmt::underlying(op)));
throw SegcoreError(
OpTypeInvalid,
fmt::format("unsupported operator type: {}", op));
}
}

View File

@ -39,8 +39,8 @@ class ScalarIndex : public IndexBase {
void
BuildWithDataset(const DatasetPtr& dataset,
const Config& config = {}) override {
PanicCodeInfo(Unsupported,
"scalar index don't support build index with dataset");
PanicInfo(Unsupported,
"scalar index don't support build index with dataset");
};
public:

View File

@ -24,6 +24,7 @@
#include "Meta.h"
#include "common/Utils.h"
#include "common/Slice.h"
#include "common/Types.h"
#include "index/Utils.h"
namespace milvus::index {
@ -253,9 +254,8 @@ ScalarIndexSort<T>::Range(const T value, const OpType op) {
data_.begin(), data_.end(), IndexStructure<T>(value));
break;
default:
throw SegcoreError(
OpTypeInvalid,
fmt::format("Invalid OperatorType: {}", fmt::underlying(op)));
throw SegcoreError(OpTypeInvalid,
fmt::format("Invalid OperatorType: {}", op));
}
for (; lb < ub; ++lb) {
bitset[lb->idx_] = true;

View File

@ -80,9 +80,8 @@ VectorDiskAnnIndex<T>::Load(const Config& config) {
auto stat = index_.Deserialize(knowhere::BinarySet(), load_config);
if (stat != knowhere::Status::success)
PanicCodeInfo(
ErrorCode::UnexpectedError,
"failed to Deserialize index, " + KnowhereStatusString(stat));
PanicInfo(ErrorCode::UnexpectedError,
"failed to Deserialize index, " + KnowhereStatusString(stat));
SetDim(index_.Dim());
}
@ -185,8 +184,8 @@ VectorDiskAnnIndex<T>::BuildWithDataset(const DatasetPtr& dataset,
knowhere::DataSet* ds_ptr = nullptr;
auto stat = index_.Build(*ds_ptr, build_config);
if (stat != knowhere::Status::success)
PanicCodeInfo(ErrorCode::IndexBuildError,
"failed to build index, " + KnowhereStatusString(stat));
PanicInfo(ErrorCode::IndexBuildError,
"failed to build index, " + KnowhereStatusString(stat));
local_chunk_manager->RemoveDir(
storage::GetSegmentRawDataPathPrefix(local_chunk_manager, segment_id));
@ -243,20 +242,20 @@ VectorDiskAnnIndex<T>::Query(const DatasetPtr dataset,
auto res = index_.RangeSearch(*dataset, search_config, bitset);
if (!res.has_value()) {
PanicCodeInfo(ErrorCode::UnexpectedError,
fmt::format("failed to range search: {}: {}",
KnowhereStatusString(res.error()),
res.what()));
PanicInfo(ErrorCode::UnexpectedError,
fmt::format("failed to range search: {}: {}",
KnowhereStatusString(res.error()),
res.what()));
}
return ReGenRangeSearchResult(
res.value(), topk, num_queries, GetMetricType());
} else {
auto res = index_.Search(*dataset, search_config, bitset);
if (!res.has_value()) {
PanicCodeInfo(ErrorCode::UnexpectedError,
fmt::format("failed to search: {}: {}",
KnowhereStatusString(res.error()),
res.what()));
PanicInfo(ErrorCode::UnexpectedError,
fmt::format("failed to search: {}: {}",
KnowhereStatusString(res.error()),
res.what()));
}
return res.value();
}
@ -298,10 +297,10 @@ std::vector<uint8_t>
VectorDiskAnnIndex<T>::GetVector(const DatasetPtr dataset) const {
auto res = index_.GetVectorByIds(*dataset);
if (!res.has_value()) {
PanicCodeInfo(ErrorCode::UnexpectedError,
fmt::format("failed to get vector: {}: {}",
KnowhereStatusString(res.error()),
res.what()));
PanicInfo(ErrorCode::UnexpectedError,
fmt::format("failed to get vector: {}: {}",
KnowhereStatusString(res.error()),
res.what()));
}
auto index_type = GetIndexType();
auto tensor = res.value()->GetTensor();

View File

@ -45,14 +45,13 @@ class VectorIndex : public IndexBase {
BuildWithRawData(size_t n,
const void* values,
const Config& config = {}) override {
PanicCodeInfo(Unsupported,
"vector index don't support build index with raw data");
PanicInfo(Unsupported,
"vector index don't support build index with raw data");
};
virtual void
AddWithDataset(const DatasetPtr& dataset, const Config& config) {
PanicCodeInfo(Unsupported,
"vector index don't support add with dataset");
PanicInfo(Unsupported, "vector index don't support add with dataset");
}
virtual std::unique_ptr<SearchResult>

View File

@ -84,9 +84,8 @@ VectorMemIndex::Serialize(const Config& config) {
knowhere::BinarySet ret;
auto stat = index_.Serialize(ret);
if (stat != knowhere::Status::success)
PanicCodeInfo(
ErrorCode::UnexpectedError,
"failed to serialize index, " + KnowhereStatusString(stat));
PanicInfo(ErrorCode::UnexpectedError,
"failed to serialize index, " + KnowhereStatusString(stat));
Disassemble(ret);
return ret;
@ -97,9 +96,8 @@ VectorMemIndex::LoadWithoutAssemble(const BinarySet& binary_set,
const Config& config) {
auto stat = index_.Deserialize(binary_set, config);
if (stat != knowhere::Status::success)
PanicCodeInfo(
ErrorCode::UnexpectedError,
"failed to Deserialize index, " + KnowhereStatusString(stat));
PanicInfo(ErrorCode::UnexpectedError,
"failed to Deserialize index, " + KnowhereStatusString(stat));
SetDim(index_.Dim());
}
@ -231,8 +229,8 @@ VectorMemIndex::BuildWithDataset(const DatasetPtr& dataset,
knowhere::TimeRecorder rc("BuildWithoutIds", 1);
auto stat = index_.Build(*dataset, index_config);
if (stat != knowhere::Status::success)
PanicCodeInfo(ErrorCode::IndexBuildError,
"failed to build index, " + KnowhereStatusString(stat));
PanicInfo(ErrorCode::IndexBuildError,
"failed to build index, " + KnowhereStatusString(stat));
rc.ElapseFromBegin("Done");
SetDim(index_.Dim());
}
@ -283,8 +281,8 @@ VectorMemIndex::AddWithDataset(const DatasetPtr& dataset,
knowhere::TimeRecorder rc("AddWithDataset", 1);
auto stat = index_.Add(*dataset, index_config);
if (stat != knowhere::Status::success)
PanicCodeInfo(ErrorCode::IndexBuildError,
"failed to append index, " + KnowhereStatusString(stat));
PanicInfo(ErrorCode::IndexBuildError,
"failed to append index, " + KnowhereStatusString(stat));
rc.ElapseFromBegin("Done");
}
@ -313,10 +311,10 @@ VectorMemIndex::Query(const DatasetPtr dataset,
auto res = index_.RangeSearch(*dataset, search_conf, bitset);
milvus::tracer::AddEvent("finish_knowhere_index_range_search");
if (!res.has_value()) {
PanicCodeInfo(ErrorCode::UnexpectedError,
fmt::format("failed to range search: {}: {}",
KnowhereStatusString(res.error()),
res.what()));
PanicInfo(ErrorCode::UnexpectedError,
fmt::format("failed to range search: {}: {}",
KnowhereStatusString(res.error()),
res.what()));
}
auto result = ReGenRangeSearchResult(
res.value(), topk, num_queries, GetMetricType());
@ -327,10 +325,10 @@ VectorMemIndex::Query(const DatasetPtr dataset,
auto res = index_.Search(*dataset, search_conf, bitset);
milvus::tracer::AddEvent("finish_knowhere_index_search");
if (!res.has_value()) {
PanicCodeInfo(ErrorCode::UnexpectedError,
fmt::format("failed to search: {}: {}",
KnowhereStatusString(res.error()),
res.what()));
PanicInfo(ErrorCode::UnexpectedError,
fmt::format("failed to search: {}: {}",
KnowhereStatusString(res.error()),
res.what()));
}
return res.value();
}
@ -369,9 +367,8 @@ std::vector<uint8_t>
VectorMemIndex::GetVector(const DatasetPtr dataset) const {
auto res = index_.GetVectorByIds(*dataset);
if (!res.has_value()) {
PanicCodeInfo(
ErrorCode::UnexpectedError,
"failed to get vector, " + KnowhereStatusString(res.error()));
PanicInfo(ErrorCode::UnexpectedError,
"failed to get vector, " + KnowhereStatusString(res.error()));
}
auto index_type = GetIndexType();
auto tensor = res.value()->GetTensor();
@ -489,9 +486,9 @@ VectorMemIndex::LoadFromFile(const Config& config) {
conf[kEnableMmap] = true;
auto stat = index_.DeserializeFromFile(filepath.value(), conf);
if (stat != knowhere::Status::success) {
PanicCodeInfo(ErrorCode::UnexpectedError,
fmt::format("failed to Deserialize index: {}",
KnowhereStatusString(stat)));
PanicInfo(ErrorCode::UnexpectedError,
fmt::format("failed to Deserialize index: {}",
KnowhereStatusString(stat)));
}
auto dim = index_.Dim();

View File

@ -66,8 +66,8 @@ FillField(DataType data_type, const storage::FieldDataPtr data, void* dst) {
break;
}
default:
PanicInfo(fmt::format("not supported data type {}",
datatype_name(data_type)));
PanicInfo(DataTypeInvalid,
fmt::format("not supported data type {}", data_type));
}
} else {
memcpy(dst, data->Data(), data->Size());
@ -125,7 +125,8 @@ WriteFieldData(File& file,
break;
}
default:
PanicInfo(fmt::format("not supported data type {}",
PanicInfo(DataTypeInvalid,
fmt::format("not supported data type {}",
datatype_name(data_type)));
}
} else {

View File

@ -310,3 +310,50 @@ IsTermExpr(Expr* expr) {
}
} // namespace milvus::query
template <>
struct fmt::formatter<milvus::query::LogicalUnaryExpr::OpType>
: formatter<string_view> {
auto
format(milvus::query::LogicalUnaryExpr::OpType c,
format_context& ctx) const {
string_view name = "unknown";
switch (c) {
case milvus::query::LogicalUnaryExpr::OpType::Invalid:
name = "Invalid";
break;
case milvus::query::LogicalUnaryExpr::OpType::LogicalNot:
name = "LogicalNot";
break;
}
return formatter<string_view>::format(name, ctx);
}
};
template <>
struct fmt::formatter<milvus::query::LogicalBinaryExpr::OpType>
: formatter<string_view> {
auto
format(milvus::query::LogicalBinaryExpr::OpType c,
format_context& ctx) const {
string_view name = "unknown";
switch (c) {
case milvus::query::LogicalBinaryExpr::OpType::Invalid:
name = "Invalid";
break;
case milvus::query::LogicalBinaryExpr::OpType::LogicalAnd:
name = "LogicalAdd";
break;
case milvus::query::LogicalBinaryExpr::OpType::LogicalOr:
name = "LogicalOr";
break;
case milvus::query::LogicalBinaryExpr::OpType::LogicalXor:
name = "LogicalXor";
break;
case milvus::query::LogicalBinaryExpr::OpType::LogicalMinus:
name = "LogicalMinus";
break;
}
return formatter<string_view>::format(name, ctx);
}
};

View File

@ -339,12 +339,13 @@ ProtoParser::ParseUnaryRangeExpr(const proto::plan::UnaryRangeExpr& expr_pb) {
field_id, data_type, expr_pb);
default:
PanicInfo(
DataTypeInvalid,
fmt::format("unknown data type: {} in expression",
expr_pb.value().val_case()));
}
}
default: {
PanicInfo("unsupported data type");
PanicInfo(DataTypeInvalid, "unsupported data type");
}
}
}();
@ -401,7 +402,10 @@ ProtoParser::ParseBinaryRangeExpr(const proto::plan::BinaryRangeExpr& expr_pb) {
return ExtractBinaryRangeExprImpl<std::string>(
field_id, data_type, expr_pb);
default:
PanicInfo("unknown data type in expression");
PanicInfo(
DataTypeInvalid,
fmt::format("unknown data type in expression {}",
data_type));
}
}
case DataType::ARRAY: {
@ -416,12 +420,16 @@ ProtoParser::ParseBinaryRangeExpr(const proto::plan::BinaryRangeExpr& expr_pb) {
return ExtractBinaryRangeExprImpl<std::string>(
field_id, data_type, expr_pb);
default:
PanicInfo("unknown data type in expression");
PanicInfo(
DataTypeInvalid,
fmt::format("unknown data type in expression {}",
data_type));
}
}
default: {
PanicInfo("unsupported data type");
PanicInfo(DataTypeInvalid,
fmt::format("unsupported data type {}", data_type));
}
}
}();
@ -513,6 +521,7 @@ ProtoParser::ParseTermExpr(const proto::plan::TermExpr& expr_pb) {
field_id, data_type, expr_pb);
default:
PanicInfo(
DataTypeInvalid,
fmt::format("unknown data type: {} in expression",
expr_pb.values()[0].val_case()));
}
@ -537,12 +546,14 @@ ProtoParser::ParseTermExpr(const proto::plan::TermExpr& expr_pb) {
field_id, data_type, expr_pb);
default:
PanicInfo(
DataTypeInvalid,
fmt::format("unknown data type: {} in expression",
expr_pb.values()[0].val_case()));
}
}
default: {
PanicInfo("unsupported data type");
PanicInfo(DataTypeInvalid,
fmt::format("unsupported data type {}", data_type));
}
}
}();
@ -601,9 +612,10 @@ ProtoParser::ParseBinaryArithOpEvalRangeExpr(
return ExtractBinaryArithOpEvalRangeExprImpl<double>(
field_id, data_type, expr_pb);
default:
PanicInfo(fmt::format(
"unsupported data type {} in expression",
expr_pb.value().val_case()));
PanicInfo(DataTypeInvalid,
fmt::format(
"unsupported data type {} in expression",
expr_pb.value().val_case()));
}
}
case DataType::ARRAY: {
@ -615,13 +627,15 @@ ProtoParser::ParseBinaryArithOpEvalRangeExpr(
return ExtractBinaryArithOpEvalRangeExprImpl<double>(
field_id, data_type, expr_pb);
default:
PanicInfo(fmt::format(
"unsupported data type {} in expression",
expr_pb.value().val_case()));
PanicInfo(DataTypeInvalid,
fmt::format(
"unsupported data type {} in expression",
expr_pb.value().val_case()));
}
}
default: {
PanicInfo("unsupported data type");
PanicInfo(DataTypeInvalid,
fmt::format("unsupported data type {}", data_type));
}
}
}();
@ -646,7 +660,8 @@ ProtoParser::ParseExistExpr(const proto::plan::ExistsExpr& expr_pb) {
return ExtractExistsExprImpl(expr_pb);
}
default: {
PanicInfo("unsupported data type");
PanicInfo(DataTypeInvalid,
fmt::format("unsupported data type {}", data_type));
}
}
}();
@ -714,7 +729,7 @@ ProtoParser::ParseJsonContainsExpr(
// auto& field_meta = schema[field_offset];
auto result = [&]() -> ExprPtr {
if (expr_pb.elements_size() == 0) {
PanicInfo("no elements in expression");
PanicInfo(DataIsEmpty, "no elements in expression");
}
if (expr_pb.elements_same_type()) {
switch (expr_pb.elements(0).val_case()) {
@ -730,7 +745,9 @@ ProtoParser::ParseJsonContainsExpr(
return ExtractJsonContainsExprImpl<proto::plan::Array>(
expr_pb);
default:
PanicInfo("unsupported data type");
PanicInfo(
DataTypeInvalid,
fmt::format("unsupported data type {}", data_type));
}
}
return ExtractJsonContainsExprImpl<proto::plan::GenericValue>(expr_pb);
@ -776,7 +793,8 @@ ProtoParser::ParseExpr(const proto::plan::Expr& expr_pb) {
default: {
std::string s;
google::protobuf::TextFormat::PrintToString(expr_pb, &s);
PanicInfo(std::string("unsupported expr proto node: ") + s);
PanicInfo(ExprInvalid,
fmt::format("unsupported expr proto node: {}", s));
}
}
}

View File

@ -98,6 +98,9 @@ struct fmt::formatter<milvus::proto::plan::GenericValue::ValCase>
case milvus::proto::plan::GenericValue::ValCase::kStringVal:
name = "kStringVal";
break;
case milvus::proto::plan::GenericValue::ValCase::kArrayVal:
name = "kArrayVal";
break;
case milvus::proto::plan::GenericValue::ValCase::VAL_NOT_SET:
name = "VAL_NOT_SET";
break;

View File

@ -30,13 +30,13 @@ RelationalImpl(const T& t, const U& u, FundamentalTag, FundamentalTag) {
template <typename Op, typename T, typename U>
bool
RelationalImpl(const T& t, const U& u, FundamentalTag, StringTag) {
PanicInfo("incompitible data type");
PanicInfo(DataTypeInvalid, "incompitible data type");
}
template <typename Op, typename T, typename U>
bool
RelationalImpl(const T& t, const U& u, StringTag, FundamentalTag) {
PanicInfo("incompitible data type");
PanicInfo(DataTypeInvalid, "incompitible data type");
}
template <typename Op, typename T, typename U>
@ -59,7 +59,7 @@ struct Relational {
template <typename... T>
bool
operator()(const T&...) const {
PanicInfo("incompatible operands");
PanicInfo(OpTypeInvalid, "incompatible operands");
}
};

View File

@ -58,7 +58,8 @@ generate_scalar_index(SpanBase data, DataType data_type) {
case DataType::VARCHAR:
return generate_scalar_index(Span<std::string>(data));
default:
PanicInfo("unsupported type");
PanicInfo(DataTypeInvalid,
fmt::format("unsupported type {}", data_type));
}
}

View File

@ -105,10 +105,10 @@ BruteForceSearch(const dataset::SearchDataset& dataset,
base_dataset, query_dataset, config, bitset);
milvus::tracer::AddEvent("knowhere_finish_BruteForce_RangeSearch");
if (!res.has_value()) {
PanicCodeInfo(KnowhereError,
fmt::format("failed to range search: {}: {}",
KnowhereStatusString(res.error()),
res.what()));
PanicInfo(KnowhereError,
fmt::format("failed to range search: {}: {}",
KnowhereStatusString(res.error()),
res.what()));
}
auto result =
ReGenRangeSearchResult(res.value(), topk, nq, dataset.metric_type);

View File

@ -22,7 +22,7 @@ namespace milvus::query {
template <typename T, typename U>
inline bool
Match(const T& x, const U& y, OpType op) {
PanicInfo("not supported");
PanicInfo(NotImplemented, "not supported");
}
template <>
@ -34,7 +34,7 @@ Match<std::string>(const std::string& str, const std::string& val, OpType op) {
case OpType::PostfixMatch:
return PostfixMatch(str, val);
default:
PanicInfo("not supported");
PanicInfo(OpTypeInvalid, "not supported");
}
}
@ -49,7 +49,7 @@ Match<std::string_view>(const std::string_view& str,
case OpType::PostfixMatch:
return PostfixMatch(str, val);
default:
PanicInfo("not supported");
PanicInfo(OpTypeInvalid, "not supported");
}
}

View File

@ -28,6 +28,7 @@
#include "common/Json.h"
#include "common/Types.h"
#include "common/EasyAssert.h"
#include "fmt/core.h"
#include "pb/plan.pb.h"
#include "query/ExprImpl.h"
#include "query/Relational.h"
@ -117,7 +118,8 @@ ExecExprVisitor::visit(LogicalUnaryExpr& expr) {
break;
}
default: {
PanicInfo("Invalid Unary Op");
PanicInfo(OpTypeInvalid,
fmt::format("Invalid Unary Op {}", expr.op_type_));
}
}
AssertInfo(res.size() == row_count_,
@ -164,7 +166,8 @@ ExecExprVisitor::visit(LogicalBinaryExpr& expr) {
break;
}
default: {
PanicInfo("Invalid Binary Op");
PanicInfo(OpTypeInvalid,
fmt::format("Invalid Binary Op {}", expr.op_type_));
}
}
AssertInfo(res.size() == row_count_,
@ -440,7 +443,8 @@ ExecExprVisitor::ExecUnaryRangeVisitorDispatcherImpl(UnaryRangeExpr& expr_raw)
}
// TODO: PostfixMatch
default: {
PanicInfo("unsupported range node");
PanicInfo(OpTypeInvalid,
fmt::format("unsupported range node {}", op));
}
}
}
@ -494,7 +498,9 @@ ExecExprVisitor::ExecUnaryRangeVisitorDispatcher(UnaryRangeExpr& expr_raw)
}
default: {
PanicInfo("unsupported range node");
PanicInfo(
OpTypeInvalid,
fmt::format("unsupported range node {}", expr.op_type_));
}
}
}
@ -550,9 +556,9 @@ CompareTwoJsonArray(T arr1, const proto::plan::Array& arr2) {
break;
}
default:
PanicCodeInfo(DataTypeInvalid,
fmt::format("unsupported data type {}",
arr2.array(i).val_case()));
PanicInfo(DataTypeInvalid,
fmt::format("unsupported data type {}",
arr2.array(i).val_case()));
}
i++;
}
@ -693,7 +699,8 @@ ExecExprVisitor::ExecUnaryRangeVisitorDispatcherJson(UnaryRangeExpr& expr_raw)
}
// TODO: PostfixMatch
default: {
PanicInfo("unsupported range node");
PanicInfo(OpTypeInvalid,
fmt::format("unsupported range node {}", op));
}
}
}
@ -805,7 +812,8 @@ ExecExprVisitor::ExecUnaryRangeVisitorDispatcherArray(UnaryRangeExpr& expr_raw)
}
// TODO: PostfixMatch
default: {
PanicInfo("unsupported range node");
PanicInfo(OpTypeInvalid,
fmt::format("unsupported range node {}", op));
}
}
}
@ -896,7 +904,9 @@ ExecExprVisitor::ExecBinaryArithOpEvalRangeVisitorDispatcher(
expr.column_.field_id, index_func, elem_func);
}
default: {
PanicInfo("unsupported arithmetic operation");
PanicInfo(
OpTypeInvalid,
fmt::format("unsupported arithmetic operation {}", op));
}
}
}
@ -963,12 +973,17 @@ ExecExprVisitor::ExecBinaryArithOpEvalRangeVisitorDispatcher(
expr.column_.field_id, index_func, elem_func);
}
default: {
PanicInfo("unsupported arithmetic operation");
PanicInfo(
OpTypeInvalid,
fmt::format("unsupported arithmetic operation {}", op));
}
}
}
default: {
PanicInfo("unsupported range node with arithmetic operation");
PanicInfo(
OpTypeInvalid,
fmt::format(
"unsupported range node with arithmetic operation {}", op));
}
}
}
@ -1100,7 +1115,9 @@ ExecExprVisitor::ExecBinaryArithOpEvalRangeVisitorDispatcherJson(
expr.column_.field_id, index_func, elem_func);
}
default: {
PanicInfo("unsupported arithmetic operation");
PanicInfo(
OpTypeInvalid,
fmt::format("unsupported arithmetic operation {}", op));
}
}
}
@ -1185,12 +1202,17 @@ ExecExprVisitor::ExecBinaryArithOpEvalRangeVisitorDispatcherJson(
expr.column_.field_id, index_func, elem_func);
}
default: {
PanicInfo("unsupported arithmetic operation");
PanicInfo(
OpTypeInvalid,
fmt::format("unsupported arithmetic operation {}", op));
}
}
}
default: {
PanicInfo("unsupported range node with arithmetic operation");
PanicInfo(
OpTypeInvalid,
fmt::format(
"unsupported range node with arithmetic operation {}", op));
}
}
} // namespace milvus::query
@ -1292,7 +1314,9 @@ ExecExprVisitor::ExecBinaryArithOpEvalRangeVisitorDispatcherArray(
expr.column_.field_id, index_func, elem_func);
}
default: {
PanicInfo("unsupported arithmetic operation");
PanicInfo(
OpTypeInvalid,
fmt::format("unsupported arithmetic operation {}", op));
}
}
}
@ -1371,12 +1395,17 @@ ExecExprVisitor::ExecBinaryArithOpEvalRangeVisitorDispatcherArray(
expr.column_.field_id, index_func, elem_func);
}
default: {
PanicInfo("unsupported arithmetic operation");
PanicInfo(
OpTypeInvalid,
fmt::format("unsupported arithmetic operation {}", op));
}
}
}
default: {
PanicInfo("unsupported range node with arithmetic operation");
PanicInfo(
OpTypeInvalid,
fmt::format(
"unsupported range node with arithmetic operation {}", op));
}
}
} // namespace milvus::query
@ -1640,6 +1669,7 @@ ExecExprVisitor::visit(UnaryRangeExpr& expr) {
break;
default:
PanicInfo(
DataTypeInvalid,
fmt::format("unknown data type: {}", expr.val_case_));
}
break;
@ -1665,12 +1695,14 @@ ExecExprVisitor::visit(UnaryRangeExpr& expr) {
break;
default:
PanicInfo(
DataTypeInvalid,
fmt::format("unknown data type: {}", expr.val_case_));
}
break;
}
default:
PanicInfo(fmt::format("unsupported data type: {}",
PanicInfo(DataTypeInvalid,
fmt::format("unsupported data type: {}",
expr.column_.data_type));
}
AssertInfo(res.size() == row_count_,
@ -1729,6 +1761,7 @@ ExecExprVisitor::visit(BinaryArithOpEvalRangeExpr& expr) {
}
default: {
PanicInfo(
DataTypeInvalid,
fmt::format("unsupported value type {} in expression",
expr.val_case_));
}
@ -1749,6 +1782,7 @@ ExecExprVisitor::visit(BinaryArithOpEvalRangeExpr& expr) {
}
default: {
PanicInfo(
DataTypeInvalid,
fmt::format("unsupported value type {} in expression",
expr.val_case_));
}
@ -1756,7 +1790,8 @@ ExecExprVisitor::visit(BinaryArithOpEvalRangeExpr& expr) {
break;
}
default:
PanicInfo(fmt::format("unsupported data type: {}",
PanicInfo(DataTypeInvalid,
fmt::format("unsupported data type: {}",
expr.column_.data_type));
}
AssertInfo(res.size() == row_count_,
@ -1824,6 +1859,7 @@ ExecExprVisitor::visit(BinaryRangeExpr& expr) {
}
default: {
PanicInfo(
DataTypeInvalid,
fmt::format("unsupported value type {} in expression",
expr.val_case_));
}
@ -1846,8 +1882,8 @@ ExecExprVisitor::visit(BinaryRangeExpr& expr) {
break;
}
default: {
PanicCodeInfo(
Unsupported,
PanicInfo(
DataTypeInvalid,
fmt::format("unsupported value type {} in expression",
expr.val_case_));
}
@ -1855,7 +1891,8 @@ ExecExprVisitor::visit(BinaryRangeExpr& expr) {
break;
}
default:
PanicInfo(fmt::format("unsupported data type: {}",
PanicInfo(DataTypeInvalid,
fmt::format("unsupported data type: {}",
expr.column_.data_type));
}
AssertInfo(res.size() == row_count_,
@ -1873,7 +1910,7 @@ struct relational {
template <typename... T>
bool
operator()(T const&...) const {
PanicInfo("incompatible operands");
PanicInfo(OpTypeInvalid, "incompatible operands");
}
};
@ -1946,7 +1983,10 @@ ExecExprVisitor::ExecCompareLeftType(const FieldId& left_field_id,
left_raw_data, right_field_id, chunk_id, cmp_func);
break;
default:
PanicInfo("unsupported left datatype of compare expr");
PanicInfo(
DataTypeInvalid,
fmt::format("unsupported right datatype {} of compare expr",
right_field_type));
}
results.push_back(result);
}
@ -1997,7 +2037,10 @@ ExecExprVisitor::ExecCompareExprDispatcherForNonIndexedSegment(
expr.right_data_type_,
cmp_func);
default:
PanicInfo("unsupported right datatype of compare expr");
PanicInfo(
DataTypeInvalid,
fmt::format("unsupported right datatype {} of compare expr",
expr.left_data_type_));
}
}
@ -2202,9 +2245,8 @@ ExecExprVisitor::ExecCompareExprDispatcher(CompareExpr& expr, Op op)
}
}
default:
PanicCodeInfo(
DataTypeInvalid,
fmt::format("unsupported data type {}", type));
PanicInfo(DataTypeInvalid,
fmt::format("unsupported data type {}", type));
}
};
auto left = getChunkData(
@ -2272,9 +2314,8 @@ ExecExprVisitor::visit(CompareExpr& expr) {
// case OpType::PostfixMatch: {
// }
default: {
PanicCodeInfo(OpTypeInvalid,
fmt::format("unsupported optype {}",
fmt::underlying(expr.op_type_)));
PanicInfo(OpTypeInvalid,
fmt::format("unsupported optype {}", expr.op_type_));
}
}
AssertInfo(res.size() == row_count_,
@ -2318,7 +2359,7 @@ ExecExprVisitor::ExecTermVisitorImpl(TermExpr& expr_raw) -> BitsetType {
break;
}
default: {
PanicCodeInfo(
PanicInfo(
DataTypeInvalid,
fmt::format("unsupported data type {}", expr.val_case_));
}
@ -2651,9 +2692,9 @@ ExecExprVisitor::visit(TermExpr& expr) {
res = ExecTermVisitorImplTemplateJson<bool>(expr);
break;
default:
PanicCodeInfo(DataTypeInvalid,
fmt::format("unsupported data type {}",
expr.val_case_));
PanicInfo(DataTypeInvalid,
fmt::format("unsupported data type {}",
expr.val_case_));
}
break;
}
@ -2675,16 +2716,16 @@ ExecExprVisitor::visit(TermExpr& expr) {
res = ExecTermVisitorImplTemplateArray<bool>(expr);
break;
default:
PanicCodeInfo(
PanicInfo(
Unsupported,
fmt::format("unknown data type: {}", expr.val_case_));
}
break;
}
default:
PanicCodeInfo(DataTypeInvalid,
fmt::format("unsupported data type {}",
expr.column_.data_type));
PanicInfo(DataTypeInvalid,
fmt::format("unsupported data type {}",
expr.column_.data_type));
}
AssertInfo(res.size() == row_count_,
"[ExecExprVisitor]Size of results not equal row count");
@ -2711,9 +2752,9 @@ ExecExprVisitor::visit(ExistsExpr& expr) {
break;
}
default:
PanicCodeInfo(DataTypeInvalid,
fmt::format("unsupported data type {}",
expr.column_.data_type));
PanicInfo(DataTypeInvalid,
fmt::format("unsupported data type {}",
expr.column_.data_type));
}
AssertInfo(res.size() == row_count_,
"[ExecExprVisitor]Size of results not equal row count");
@ -2902,9 +2943,9 @@ ExecExprVisitor::ExecJsonContainsWithDiffType(JsonContainsExpr& expr_raw)
break;
}
default:
PanicCodeInfo(DataTypeInvalid,
fmt::format("unsupported data type {}",
element.val_case()));
PanicInfo(DataTypeInvalid,
fmt::format("unsupported data type {}",
element.val_case()));
}
}
}
@ -3052,84 +3093,84 @@ ExecExprVisitor::ExecJsonContainsAllWithDiffType(JsonContainsExpr& expr_raw)
elements_index.insert(i);
i++;
}
auto elem_func = [&elements, &elements_index, &pointer](
const milvus::Json& json) {
auto doc = json.doc();
auto array = doc.at_pointer(pointer).get_array();
if (array.error()) {
return false;
}
std::unordered_set<int> tmp_elements_index(elements_index);
for (auto&& it : array) {
int i = -1;
for (auto& element : elements) {
i++;
switch (element.val_case()) {
case proto::plan::GenericValue::kBoolVal: {
auto val = it.template get<bool>();
if (val.error()) {
continue;
auto elem_func =
[&elements, &elements_index, &pointer](const milvus::Json& json) {
auto doc = json.doc();
auto array = doc.at_pointer(pointer).get_array();
if (array.error()) {
return false;
}
std::unordered_set<int> tmp_elements_index(elements_index);
for (auto&& it : array) {
int i = -1;
for (auto& element : elements) {
i++;
switch (element.val_case()) {
case proto::plan::GenericValue::kBoolVal: {
auto val = it.template get<bool>();
if (val.error()) {
continue;
}
if (val.value() == element.bool_val()) {
tmp_elements_index.erase(i);
}
break;
}
if (val.value() == element.bool_val()) {
tmp_elements_index.erase(i);
case proto::plan::GenericValue::kInt64Val: {
auto val = it.template get<int64_t>();
if (val.error()) {
continue;
}
if (val.value() == element.int64_val()) {
tmp_elements_index.erase(i);
}
break;
}
break;
}
case proto::plan::GenericValue::kInt64Val: {
auto val = it.template get<int64_t>();
if (val.error()) {
continue;
case proto::plan::GenericValue::kFloatVal: {
auto val = it.template get<double>();
if (val.error()) {
continue;
}
if (val.value() == element.float_val()) {
tmp_elements_index.erase(i);
}
break;
}
if (val.value() == element.int64_val()) {
tmp_elements_index.erase(i);
case proto::plan::GenericValue::kStringVal: {
auto val = it.template get<std::string_view>();
if (val.error()) {
continue;
}
if (val.value() == element.string_val()) {
tmp_elements_index.erase(i);
}
break;
}
break;
}
case proto::plan::GenericValue::kFloatVal: {
auto val = it.template get<double>();
if (val.error()) {
continue;
case proto::plan::GenericValue::kArrayVal: {
auto val = it.get_array();
if (val.error()) {
continue;
}
if (CompareTwoJsonArray(val, element.array_val())) {
tmp_elements_index.erase(i);
}
break;
}
if (val.value() == element.float_val()) {
tmp_elements_index.erase(i);
}
break;
}
case proto::plan::GenericValue::kStringVal: {
auto val = it.template get<std::string_view>();
if (val.error()) {
continue;
}
if (val.value() == element.string_val()) {
tmp_elements_index.erase(i);
}
break;
}
case proto::plan::GenericValue::kArrayVal: {
auto val = it.get_array();
if (val.error()) {
continue;
}
if (CompareTwoJsonArray(val, element.array_val())) {
tmp_elements_index.erase(i);
}
break;
}
default:
PanicCodeInfo(DataTypeInvalid,
default:
PanicInfo(DataTypeInvalid,
fmt::format("unsupported data type {}",
element.val_case()));
}
if (tmp_elements_index.size() == 0) {
return true;
}
}
if (tmp_elements_index.size() == 0) {
return true;
}
}
if (tmp_elements_index.size() == 0) {
return true;
}
}
return tmp_elements_index.size() == 0;
};
return tmp_elements_index.size() == 0;
};
return ExecRangeVisitorImpl<milvus::Json>(
expr.column_.field_id, index_func, elem_func);
@ -3166,9 +3207,9 @@ ExecExprVisitor::visit(JsonContainsExpr& expr) {
break;
}
default:
PanicCodeInfo(DataTypeInvalid,
fmt::format("unsupported data type {}",
expr.val_case_));
PanicInfo(DataTypeInvalid,
fmt::format("unsupported data type {}",
expr.val_case_));
}
} else {
if (expr.same_type_) {
@ -3194,10 +3235,9 @@ ExecExprVisitor::visit(JsonContainsExpr& expr) {
break;
}
default:
PanicCodeInfo(
Unsupported,
fmt::format("unsupported value type {}",
expr.val_case_));
PanicInfo(Unsupported,
fmt::format("unsupported value type {}",
expr.val_case_));
}
} else {
res = ExecJsonContainsWithDiffType(expr);
@ -3225,9 +3265,9 @@ ExecExprVisitor::visit(JsonContainsExpr& expr) {
break;
}
default:
PanicCodeInfo(DataTypeInvalid,
fmt::format("unsupported data type {}",
expr.val_case_));
PanicInfo(DataTypeInvalid,
fmt::format("unsupported data type {}",
expr.val_case_));
}
} else {
if (expr.same_type_) {
@ -3253,7 +3293,7 @@ ExecExprVisitor::visit(JsonContainsExpr& expr) {
break;
}
default:
PanicCodeInfo(
PanicInfo(
Unsupported,
fmt::format(
"unsupported value type {} in expression",
@ -3266,9 +3306,9 @@ ExecExprVisitor::visit(JsonContainsExpr& expr) {
break;
}
default:
PanicCodeInfo(DataTypeInvalid,
fmt::format("unsupported json contains type {}",
expr.val_case_));
PanicInfo(DataTypeInvalid,
fmt::format("unsupported json contains type {}",
expr.val_case_));
}
AssertInfo(res.size() == row_count_,
"[ExecExprVisitor]Size of results not equal row count");

View File

@ -14,6 +14,7 @@
#include "query/ExprImpl.h"
#include "query/Plan.h"
#include "query/generated/ShowExprVisitor.h"
#include "common/Types.h"
namespace milvus::query {
using Json = nlohmann::json;
@ -90,7 +91,8 @@ ShowExprVisitor::visit(LogicalBinaryExpr& expr) {
case OpType::LogicalXor:
return "LogicalXor";
default:
PanicInfo("unsupported op");
PanicInfo(OpTypeInvalid,
fmt::format("unsupported operation {}", op));
}
}(expr.op_type_);
@ -134,7 +136,9 @@ ShowExprVisitor::visit(TermExpr& expr) {
case DataType::JSON:
return TermExtract<milvus::Json>(expr);
default:
PanicInfo("unsupported type");
PanicInfo(
DataTypeInvalid,
fmt::format("unsupported type {}", expr.column_.data_type));
}
}();
@ -192,7 +196,9 @@ ShowExprVisitor::visit(UnaryRangeExpr& expr) {
json_opt_ = UnaryRangeExtract<milvus::Json>(expr);
return;
default:
PanicInfo("unsupported type");
PanicInfo(
DataTypeInvalid,
fmt::format("unsupported type {}", expr.column_.data_type));
}
}
@ -247,7 +253,9 @@ ShowExprVisitor::visit(BinaryRangeExpr& expr) {
json_opt_ = BinaryRangeExtract<milvus::Json>(expr);
return;
default:
PanicInfo("unsupported type");
PanicInfo(
DataTypeInvalid,
fmt::format("unsupported type {}", expr.column_.data_type));
}
}
@ -317,7 +325,9 @@ ShowExprVisitor::visit(BinaryArithOpEvalRangeExpr& expr) {
json_opt_ = BinaryArithOpEvalRangeExtract<milvus::Json>(expr);
return;
default:
PanicInfo("unsupported type");
PanicInfo(
DataTypeInvalid,
fmt::format("unsupported type {}", expr.column_.data_type));
}
}

View File

@ -34,7 +34,7 @@ VectorBase::set_data_raw(ssize_t element_offset,
return set_data_raw(
element_offset, VEC_FIELD_DATA(data, float16), element_count);
} else {
PanicCodeInfo(DataTypeInvalid, "unsupported");
PanicInfo(DataTypeInvalid, "unsupported");
}
}
@ -98,9 +98,9 @@ VectorBase::set_data_raw(ssize_t element_offset,
return set_data_raw(element_offset, data_raw.data(), element_count);
}
default: {
PanicCodeInfo(DataTypeInvalid,
fmt::format("unsupported datatype {}",
field_meta.get_data_type()));
PanicInfo(DataTypeInvalid,
fmt::format("unsupported datatype {}",
field_meta.get_data_type()));
}
}
}

View File

@ -183,7 +183,7 @@ class ConcurrentVectorImpl : public VectorBase {
} else if constexpr (std::is_same_v<Type, int64_t> || // NOLINT
std::is_same_v<Type, int>) {
// only for testing
PanicCodeInfo(NotImplemented, "unimplemented");
PanicInfo(NotImplemented, "unimplemented");
} else {
static_assert(
std::is_same_v<typename TraitType::embedded_type, Type>);

View File

@ -250,10 +250,9 @@ CreateIndex(const FieldMeta& field_meta,
segment_max_row_count,
segcore_config);
} else {
PanicCodeInfo(
DataTypeInvalid,
fmt::format("unsupported vector type in index: {}",
fmt::underlying(field_meta.get_data_type())));
PanicInfo(DataTypeInvalid,
fmt::format("unsupported vector type in index: {}",
field_meta.get_data_type()));
}
}
switch (field_meta.get_data_type()) {
@ -282,10 +281,9 @@ CreateIndex(const FieldMeta& field_meta,
return std::make_unique<ScalarFieldIndexing<std::string>>(
field_meta, segcore_config);
default:
PanicCodeInfo(
DataTypeInvalid,
fmt::format("unsupported scalar type in index: {}",
fmt::underlying(field_meta.get_data_type())));
PanicInfo(DataTypeInvalid,
fmt::format("unsupported scalar type in index: {}",
field_meta.get_data_type()));
}
}

View File

@ -111,8 +111,8 @@ class ScalarFieldIndexing : public FieldIndexing {
int64_t size,
const VectorBase* vec_base,
const void* data_source) override {
PanicCodeInfo(Unsupported,
"scalar index don't support append segment index");
PanicInfo(Unsupported,
"scalar index don't support append segment index");
}
void
@ -120,8 +120,8 @@ class ScalarFieldIndexing : public FieldIndexing {
int64_t count,
int64_t element_size,
void* output) override {
PanicCodeInfo(Unsupported,
"scalar index don't support get data from index");
PanicInfo(Unsupported,
"scalar index don't support get data from index");
}
idx_t
get_index_cursor() override {

View File

@ -87,7 +87,7 @@ class OffsetOrderedMap : public OffsetMap {
void
seal() override {
PanicCodeInfo(
PanicInfo(
NotImplemented,
"OffsetOrderedMap used for growing segment could not be sealed.");
}
@ -182,8 +182,8 @@ class OffsetOrderedArray : public OffsetMap {
void
insert(const PkType& pk, int64_t offset) override {
if (is_sealed) {
PanicCodeInfo(Unsupported,
"OffsetOrderedArray could not insert after seal");
PanicInfo(Unsupported,
"OffsetOrderedArray could not insert after seal");
}
array_.push_back(std::make_pair(std::get<T>(pk), offset));
}
@ -294,11 +294,9 @@ struct InsertRecord {
break;
}
default: {
PanicCodeInfo(
DataTypeInvalid,
fmt::format(
"unsupported pk type",
fmt::underlying(field_meta.get_data_type())));
PanicInfo(DataTypeInvalid,
fmt::format("unsupported pk type",
field_meta.get_data_type()));
}
}
}
@ -318,10 +316,9 @@ struct InsertRecord {
field_id, field_meta.get_dim(), size_per_chunk);
continue;
} else {
PanicCodeInfo(DataTypeInvalid,
fmt::format("unsupported vector type",
fmt::underlying(
field_meta.get_data_type())));
PanicInfo(DataTypeInvalid,
fmt::format("unsupported vector type",
field_meta.get_data_type()));
}
}
switch (field_meta.get_data_type()) {
@ -367,10 +364,9 @@ struct InsertRecord {
break;
}
default: {
PanicCodeInfo(DataTypeInvalid,
fmt::format("unsupported scalar type",
fmt::underlying(
field_meta.get_data_type())));
PanicInfo(DataTypeInvalid,
fmt::format("unsupported scalar type",
field_meta.get_data_type()));
}
}
}
@ -420,9 +416,9 @@ struct InsertRecord {
break;
}
default: {
PanicCodeInfo(DataTypeInvalid,
fmt::format("unsupported primary key data type",
fmt::underlying(data_type)));
PanicInfo(DataTypeInvalid,
fmt::format("unsupported primary key data type",
data_type));
}
}
}
@ -452,10 +448,9 @@ struct InsertRecord {
break;
}
default: {
PanicCodeInfo(
DataTypeInvalid,
fmt::format("unsupported primary key data type",
fmt::underlying(data_type)));
PanicInfo(DataTypeInvalid,
fmt::format("unsupported primary key data type",
data_type));
}
}
}

View File

@ -318,9 +318,8 @@ ReduceHelper::GetSearchResultDataSlice(int slice_index) {
break;
}
default: {
PanicCodeInfo(DataTypeInvalid,
fmt::format("unsupported primary key type {}",
fmt::underlying(pk_type)));
PanicInfo(DataTypeInvalid,
fmt::format("unsupported primary key type {}", pk_type));
}
}
@ -367,10 +366,9 @@ ReduceHelper::GetSearchResultDataSlice(int slice_index) {
break;
}
default: {
PanicCodeInfo(
DataTypeInvalid,
fmt::format("unsupported primary key type {}",
fmt::underlying(pk_type)));
PanicInfo(DataTypeInvalid,
fmt::format("unsupported primary key type {}",
pk_type));
}
}

View File

@ -37,7 +37,7 @@ apply_parser(const YAML::Node& node, Func func) {
results.emplace_back(func(element));
}
} else {
PanicCodeInfo(ConfigInvalid, "node should be scalar or sequence");
PanicInfo(ConfigInvalid, "node should be scalar or sequence");
}
return results;
}
@ -102,7 +102,7 @@ SegcoreConfig::parse_from(const std::string& config_path) {
} catch (const std::exception& e) {
std::string str =
std::string("Invalid Yaml: ") + config_path + ", err: " + e.what();
PanicCodeInfo(ConfigInvalid, str);
PanicInfo(ConfigInvalid, str);
}
}

View File

@ -364,7 +364,7 @@ SegmentGrowingImpl::bulk_subscript(FieldId field_id,
count,
output.data());
} else {
PanicCodeInfo(DataTypeInvalid, "logical error");
PanicInfo(DataTypeInvalid, "logical error");
}
return CreateVectorDataArrayFrom(output.data(), count, field_meta);
}
@ -433,10 +433,9 @@ SegmentGrowingImpl::bulk_subscript(FieldId field_id,
return CreateScalarDataArrayFrom(output.data(), count, field_meta);
}
default: {
PanicCodeInfo(
PanicInfo(
DataTypeInvalid,
fmt::format("unsupported type {}",
fmt::underlying(field_meta.get_data_type())));
fmt::format("unsupported type {}", field_meta.get_data_type()));
}
}
}
@ -531,7 +530,7 @@ SegmentGrowingImpl::bulk_subscript(SystemFieldType system_type,
&this->insert_record_.row_ids_, seg_offsets, count, output);
break;
default:
PanicCodeInfo(DataTypeInvalid, "unknown subscript fields");
PanicInfo(DataTypeInvalid, "unknown subscript fields");
}
}
@ -564,9 +563,8 @@ SegmentGrowingImpl::search_ids(const IdArray& id_array,
break;
}
default: {
PanicCodeInfo(DataTypeInvalid,
fmt::format("unsupported type {}",
fmt::underlying(data_type)));
PanicInfo(DataTypeInvalid,
fmt::format("unsupported type {}", data_type));
}
}
res_offsets.push_back(offset);

View File

@ -165,9 +165,9 @@ SegmentInternalInterface::Retrieve(const query::RetrievePlan* plan,
break;
}
default: {
PanicCodeInfo(DataTypeInvalid,
fmt::format("unsupported datatype {}",
field_meta.get_data_type()));
PanicInfo(DataTypeInvalid,
fmt::format("unsupported datatype {}",
field_meta.get_data_type()));
}
}
}

View File

@ -160,9 +160,9 @@ SegmentSealedImpl::LoadScalarIndex(const LoadIndexInfo& info) {
break;
}
default: {
PanicCodeInfo(DataTypeInvalid,
fmt::format("unsupported primary key type",
field_meta.get_data_type()));
PanicInfo(DataTypeInvalid,
fmt::format("unsupported primary key type {}",
field_meta.get_data_type()));
}
}
}
@ -330,7 +330,8 @@ SegmentSealedImpl::LoadFieldData(FieldId field_id, FieldDataInfo& data) {
break;
}
default: {
PanicInfo("unsupported data type");
PanicInfo(DataTypeInvalid,
fmt::format("unsupported data type", data_type));
}
}
@ -443,7 +444,8 @@ SegmentSealedImpl::MapFieldData(const FieldId field_id, FieldDataInfo& data) {
break;
}
default: {
PanicInfo(fmt::format("unsupported data type {}", data_type));
PanicInfo(DataTypeInvalid,
fmt::format("unsupported data type {}", data_type));
}
}
} else {
@ -782,9 +784,10 @@ SegmentSealedImpl::check_search(const query::Plan* plan) const {
if (!is_system_field_ready()) {
PanicInfo(
FieldNotLoaded,
"failed to load row ID or timestamp, potential missing bin logs or "
"empty segments. Segment ID = " +
std::to_string(this->id_));
std::to_string(this->id_));
}
auto& request_fields = plan->extra_info_opt_.value().involved_fields_;
@ -798,17 +801,18 @@ SegmentSealedImpl::check_search(const query::Plan* plan) const {
auto field_id =
FieldId(absent_fields.find_first() + START_USER_FIELDID);
auto& field_meta = schema_->operator[](field_id);
PanicInfo("User Field(" + field_meta.get_name().get() +
") is not loaded");
PanicInfo(
FieldNotLoaded,
"User Field(" + field_meta.get_name().get() + ") is not loaded");
}
}
SegmentSealedImpl::SegmentSealedImpl(SchemaPtr schema, int64_t segment_id)
: schema_(schema),
insert_record_(*schema, MAX_ROW_COUNT),
field_data_ready_bitset_(schema->size()),
: field_data_ready_bitset_(schema->size()),
index_ready_bitset_(schema->size()),
scalar_indexings_(schema->size()),
insert_record_(*schema, MAX_ROW_COUNT),
schema_(schema),
id_(segment_id) {
}
@ -853,7 +857,8 @@ SegmentSealedImpl::bulk_subscript(SystemFieldType system_type,
output);
break;
default:
PanicInfo("unknown subscript fields");
PanicInfo(DataTypeInvalid,
fmt::format("unknown subscript fields", system_type));
}
}
@ -986,6 +991,7 @@ SegmentSealedImpl::bulk_subscript(FieldId field_id,
default:
PanicInfo(
DataTypeInvalid,
fmt::format("unsupported data type: {}",
datatype_name(field_meta.get_data_type())));
}
@ -1049,7 +1055,9 @@ SegmentSealedImpl::bulk_subscript(FieldId field_id,
}
default: {
PanicInfo("unsupported");
PanicInfo(DataTypeInvalid,
fmt::format("unsupported data type {}",
field_meta.get_data_type()));
}
}
}
@ -1117,7 +1125,8 @@ SegmentSealedImpl::search_ids(const IdArray& id_array,
break;
}
default: {
PanicInfo("unsupported type");
PanicInfo(DataTypeInvalid,
fmt::format("unsupported type {}", data_type));
}
}
res_offsets.push_back(offset);
@ -1182,7 +1191,7 @@ SegmentSealedImpl::LoadSegmentMeta(
slice_lengths.push_back(info.row_count());
}
insert_record_.timestamp_index_.set_length_meta(std::move(slice_lengths));
PanicInfo("unimplemented");
PanicInfo(NotImplemented, "unimplemented");
}
int64_t

View File

@ -26,7 +26,8 @@ namespace milvus::segcore {
void
ParsePksFromFieldData(std::vector<PkType>& pks, const DataArray& data) {
switch (static_cast<DataType>(data.type())) {
auto data_type = static_cast<DataType>(data.type());
switch (data_type) {
case DataType::INT64: {
auto source_data = reinterpret_cast<const int64_t*>(
data.scalars().long_data().data().data());
@ -39,7 +40,8 @@ ParsePksFromFieldData(std::vector<PkType>& pks, const DataArray& data) {
break;
}
default: {
PanicInfo("unsupported");
PanicInfo(DataTypeInvalid,
fmt::format("unsupported PK {}", data_type));
}
}
}
@ -68,7 +70,8 @@ ParsePksFromFieldData(DataType data_type,
break;
}
default: {
PanicInfo("unsupported");
PanicInfo(DataTypeInvalid,
fmt::format("unsupported PK {}", data_type));
}
}
offset += row_count;
@ -92,7 +95,8 @@ ParsePksFromIDs(std::vector<PkType>& pks,
break;
}
default: {
PanicInfo("unsupported");
PanicInfo(DataTypeInvalid,
fmt::format("unsupported PK {}", data_type));
}
}
}
@ -107,7 +111,8 @@ GetSizeOfIdArray(const IdArray& data) {
return data.str_id().data_size();
}
PanicInfo("unsupported id type");
PanicInfo(DataTypeInvalid,
fmt::format("unsupported id {}", data.descriptor()->name()));
}
int64_t
@ -188,13 +193,17 @@ GetRawDataSizeOfDataArray(const DataArray* data,
break;
}
default:
PanicInfo("unsupported element type for array");
PanicInfo(
DataTypeInvalid,
fmt::format("unsupported element type for array",
field_meta.get_element_type()));
}
break;
}
default: {
PanicInfo(
DataTypeInvalid,
fmt::format("unsupported variable datatype {}", data_type));
}
}
@ -276,7 +285,8 @@ CreateScalarDataArray(int64_t count, const FieldMeta& field_meta) {
break;
}
default: {
PanicInfo("unsupported datatype");
PanicInfo(DataTypeInvalid,
fmt::format("unsupported datatype {}", data_type));
}
}
@ -316,7 +326,8 @@ CreateVectorDataArray(int64_t count, const FieldMeta& field_meta) {
break;
}
default: {
PanicInfo("unsupported datatype");
PanicInfo(DataTypeInvalid,
fmt::format("unsupported datatype {}", data_type));
}
}
return data_array;
@ -401,7 +412,8 @@ CreateScalarDataArrayFrom(const void* data_raw,
break;
}
default: {
PanicInfo("unsupported datatype");
PanicInfo(DataTypeInvalid,
fmt::format("unsupported datatype {}", data_type));
}
}
@ -446,7 +458,8 @@ CreateVectorDataArrayFrom(const void* data_raw,
break;
}
default: {
PanicInfo("unsupported datatype");
PanicInfo(DataTypeInvalid,
fmt::format("unsupported datatype {}", data_type));
}
}
return data_array;
@ -500,7 +513,8 @@ MergeDataArray(
auto obj = vector_array->mutable_binary_vector();
obj->assign(data + src_offset * num_bytes, num_bytes);
} else {
PanicInfo("logical error");
PanicInfo(DataTypeInvalid,
fmt::format("unsupported datatype {}", data_type));
}
continue;
}
@ -560,7 +574,8 @@ MergeDataArray(
break;
}
default: {
PanicInfo(fmt::format("unsupported data type {}", data_type));
PanicInfo(DataTypeInvalid,
fmt::format("unsupported datatype {}", data_type));
}
}
}
@ -671,7 +686,8 @@ ReverseDataFromIndex(const index::IndexBase* index,
break;
}
default: {
PanicInfo("unsupported datatype");
PanicInfo(DataTypeInvalid,
fmt::format("unsupported datatype {}", data_type));
}
}

View File

@ -19,7 +19,7 @@ struct Int64PKVisitor {
template <typename T>
int64_t
operator()(T t) const {
PanicCodeInfo(Unsupported, "invalid int64 pk value");
PanicInfo(Unsupported, "invalid int64 pk value");
}
};
@ -33,7 +33,7 @@ struct StrPKVisitor {
template <typename T>
std::string
operator()(T t) const {
PanicCodeInfo(Unsupported, "invalid string pk value");
PanicInfo(Unsupported, "invalid string pk value");
}
};

View File

@ -86,16 +86,16 @@ DeserializeRemoteFileData(BinlogReaderPtr reader) {
return index_data;
}
default:
PanicCodeInfo(DataFormatBroken,
fmt::format("unsupported event type {}",
fmt::underlying(header.event_type_)));
PanicInfo(
DataFormatBroken,
fmt::format("unsupported event type {}", header.event_type_));
}
}
// For now, no file header in file data
std::unique_ptr<DataCodec>
DeserializeLocalFileData(BinlogReaderPtr reader) {
PanicCodeInfo(NotImplemented, "not supported");
PanicInfo(NotImplemented, "not supported");
}
std::unique_ptr<DataCodec>
@ -111,9 +111,8 @@ DeserializeFileData(const std::shared_ptr<uint8_t[]> input_data,
return DeserializeLocalFileData(binlog_reader);
}
default:
PanicCodeInfo(DataFormatBroken,
fmt::format("unsupported medium type {}",
fmt::underlying(medium_type)));
PanicInfo(DataFormatBroken,
fmt::format("unsupported medium type {}", medium_type));
}
}

View File

@ -65,9 +65,8 @@ GetEventFixPartSize(EventType event_type) {
return GetFixPartSize(data);
}
default:
PanicCodeInfo(DataFormatBroken,
fmt::format("unsupported event type {}",
fmt::underlying(event_type)));
PanicInfo(DataFormatBroken,
fmt::format("unsupported event type {}", event_type));
}
}

View File

@ -41,9 +41,8 @@ IndexData::Serialize(StorageType medium) {
case StorageType::LocalDisk:
return serialize_to_local_file();
default:
PanicCodeInfo(DataFormatBroken,
fmt::format("unsupported medium type {}",
fmt::underlying(medium)));
PanicInfo(DataFormatBroken,
fmt::format("unsupported medium type {}", medium));
}
}

View File

@ -37,9 +37,8 @@ InsertData::Serialize(StorageType medium) {
case StorageType::LocalDisk:
return serialize_to_local_file();
default:
PanicCodeInfo(DataFormatBroken,
fmt::format("unsupported medium type {}",
fmt::underlying(medium)));
PanicInfo(DataFormatBroken,
fmt::format("unsupported medium type {}", medium));
}
}

View File

@ -98,3 +98,59 @@ struct StorageConfig {
};
} // namespace milvus::storage
template <>
struct fmt::formatter<milvus::storage::EventType> : formatter<string_view> {
auto
format(milvus::storage::EventType c, format_context& ctx) const {
string_view name = "unknown";
switch (c) {
case milvus::storage::EventType::DescriptorEvent:
name = "DescriptorEvent";
break;
case milvus::storage::EventType::InsertEvent:
name = "InsertEvent";
break;
case milvus::storage::EventType::DeleteEvent:
name = "DeleteEvent";
break;
case milvus::storage::EventType::CreateCollectionEvent:
name = "CreateCollectionEvent";
break;
case milvus::storage::EventType::DropCollectionEvent:
name = "DropCollectionEvent";
break;
case milvus::storage::EventType::CreatePartitionEvent:
name = "CreatePartitionEvent";
break;
case milvus::storage::EventType::DropPartitionEvent:
name = "DropPartitionEvent";
break;
case milvus::storage::EventType::IndexFileEvent:
name = "IndexFileEvent";
break;
case milvus::storage::EventType::EventTypeEnd:
name = "EventTypeEnd";
break;
}
return formatter<string_view>::format(name, ctx);
}
};
template <>
struct fmt::formatter<milvus::storage::StorageType> : formatter<string_view> {
auto
format(milvus::storage::StorageType c, format_context& ctx) const {
switch (c) {
case milvus::storage::StorageType::None:
return formatter<string_view>::format("None", ctx);
case milvus::storage::StorageType::Memory:
return formatter<string_view>::format("Memory", ctx);
case milvus::storage::StorageType::LocalDisk:
return formatter<string_view>::format("LocalDisk", ctx);
case milvus::storage::StorageType::Remote:
return formatter<string_view>::format("Remote", ctx);
}
return formatter<string_view>::format("unknown", ctx);
}
};

View File

@ -150,9 +150,8 @@ AddPayloadToArrowBuilder(std::shared_ptr<arrow::ArrayBuilder> builder,
break;
}
default: {
PanicCodeInfo(DataTypeInvalid,
fmt::format("unsupported data type {}",
fmt::underlying(data_type)));
PanicInfo(DataTypeInvalid,
fmt::format("unsupported data type {}", data_type));
}
}
}
@ -222,9 +221,9 @@ CreateArrowBuilder(DataType data_type) {
return std::make_shared<arrow::BinaryBuilder>();
}
default: {
PanicCodeInfo(DataTypeInvalid,
fmt::format("unsupported numeric data type {}",
fmt::underlying(data_type)));
PanicInfo(
DataTypeInvalid,
fmt::format("unsupported numeric data type {}", data_type));
}
}
}
@ -248,9 +247,9 @@ CreateArrowBuilder(DataType data_type, int dim) {
arrow::fixed_size_binary(dim * sizeof(float16)));
}
default: {
PanicCodeInfo(DataTypeInvalid,
fmt::format("unsupported vector data type {}",
fmt::underlying(data_type)));
PanicInfo(
DataTypeInvalid,
fmt::format("unsupported vector data type {}", data_type));
}
}
}
@ -288,9 +287,9 @@ CreateArrowSchema(DataType data_type) {
return arrow::schema({arrow::field("val", arrow::binary())});
}
default: {
PanicCodeInfo(DataTypeInvalid,
fmt::format("unsupported numeric data type {}",
fmt::underlying(data_type)));
PanicInfo(
DataTypeInvalid,
fmt::format("unsupported numeric data type {}", data_type));
}
}
}
@ -314,9 +313,9 @@ CreateArrowSchema(DataType data_type, int dim) {
"val", arrow::fixed_size_binary(dim * sizeof(float16)))});
}
default: {
PanicCodeInfo(DataTypeInvalid,
fmt::format("unsupported vector data type {}",
fmt::underlying(data_type)));
PanicInfo(
DataTypeInvalid,
fmt::format("unsupported vector data type {}", data_type));
}
}
}
@ -335,9 +334,8 @@ GetDimensionFromFileMetaData(const parquet::ColumnDescriptor* schema,
return schema->type_length() / sizeof(float16);
}
default:
PanicCodeInfo(DataTypeInvalid,
fmt::format("unsupported data type {}",
fmt::underlying(data_type)));
PanicInfo(DataTypeInvalid,
fmt::format("unsupported data type {}", data_type));
}
}
@ -362,9 +360,8 @@ GetDimensionFromArrowArray(std::shared_ptr<arrow::Array> data,
return array->byte_width() * 8;
}
default:
PanicCodeInfo(DataTypeInvalid,
fmt::format("unsupported data type {}",
fmt::underlying(data_type)));
PanicInfo(DataTypeInvalid,
fmt::format("unsupported data type {}", data_type));
}
}
@ -606,10 +603,9 @@ CreateChunkManager(const StorageConfig& storage_config) {
}
default: {
PanicCodeInfo(
ConfigInvalid,
fmt::format("unsupported storage_config.storage_type {}",
fmt::underlying(storage_type)));
PanicInfo(ConfigInvalid,
fmt::format("unsupported storage_config.storage_type {}",
fmt::underlying(storage_type)));
}
}
}

View File

@ -56,7 +56,7 @@ Distances(const float* base,
}
return res;
} else {
PanicCodeInfo(MetricTypeInvalid, "invalid metric type");
PanicInfo(MetricTypeInvalid, "invalid metric type");
}
}
@ -85,7 +85,7 @@ Ref(const float* base,
} else if (milvus::IsMetricType(metric, knowhere::metric::IP)) {
std::reverse(res.begin(), res.end());
} else {
PanicCodeInfo(MetricTypeInvalid, "invalid metric type");
PanicInfo(MetricTypeInvalid, "invalid metric type");
}
return GetOffsets(res, topk);
}

View File

@ -3982,7 +3982,7 @@ TEST(CApiTest, RetriveScalarFieldFromSealedSegmentWithIndex) {
break;
}
default: {
PanicCodeInfo(DataTypeInvalid, "not supported type");
PanicInfo(DataTypeInvalid, "not supported type");
}
}
}

View File

@ -762,7 +762,7 @@ TEST(Expr, TestUnaryRangeJson) {
break;
}
default: {
PanicCodeInfo(Unsupported, "unsupported range node");
PanicInfo(Unsupported, "unsupported range node");
}
}
@ -816,9 +816,7 @@ TEST(Expr, TestUnaryRangeJson) {
int_val3.set_int64_val(int64_t(3));
arr.add_array()->CopyFrom(int_val3);
std::vector<TestArrayCase> array_cases = {
{arr, {"array"}}
};
std::vector<TestArrayCase> array_cases = {{arr, {"array"}}};
for (const auto& testcase : array_cases) {
auto check = [&](OpType op) {
@ -830,11 +828,12 @@ TEST(Expr, TestUnaryRangeJson) {
for (auto& op : ops) {
RetrievePlanNode plan;
auto pointer = milvus::Json::pointer(testcase.nested_path);
plan.predicate_ = std::make_unique<UnaryRangeExprImpl<proto::plan::Array>>(
ColumnInfo(json_fid, DataType::JSON, testcase.nested_path),
op,
testcase.val,
proto::plan::GenericValue::ValCase::kArrayVal);
plan.predicate_ =
std::make_unique<UnaryRangeExprImpl<proto::plan::Array>>(
ColumnInfo(json_fid, DataType::JSON, testcase.nested_path),
op,
testcase.val,
proto::plan::GenericValue::ValCase::kArrayVal);
auto final = visitor.call_child(*plan.predicate_.value());
EXPECT_EQ(final.size(), N * num_iters);
@ -4111,9 +4110,7 @@ TEST(Expr, TestJsonContainsArray) {
{{sub_arr1, sub_arr2}, {"array2"}}};
for (auto& testcase : diff_testcases2) {
auto check = [&]() {
return true;
};
auto check = [&]() { return true; };
RetrievePlanNode plan;
auto pointer = milvus::Json::pointer(testcase.nested_path);
plan.predicate_ =
@ -4248,11 +4245,11 @@ TEST(Expr, TestJsonContainsArray) {
}
}
milvus::proto::plan::GenericValue generatedArrayWithFourDiffType(
int64_t int_val,
double float_val,
bool bool_val,
std::string string_val) {
milvus::proto::plan::GenericValue
generatedArrayWithFourDiffType(int64_t int_val,
double float_val,
bool bool_val,
std::string string_val) {
using namespace milvus;
proto::plan::GenericValue value;
@ -4312,11 +4309,15 @@ TEST(Expr, TestJsonContainsDiffTypeArray) {
proto::plan::GenericValue int_value;
int_value.set_int64_val(1);
auto diff_type_array1 = generatedArrayWithFourDiffType(1, 2.2, false, "abc");
auto diff_type_array2 = generatedArrayWithFourDiffType(1, 2.2, false, "def");
auto diff_type_array1 =
generatedArrayWithFourDiffType(1, 2.2, false, "abc");
auto diff_type_array2 =
generatedArrayWithFourDiffType(1, 2.2, false, "def");
auto diff_type_array3 = generatedArrayWithFourDiffType(1, 2.2, true, "abc");
auto diff_type_array4 = generatedArrayWithFourDiffType(1, 3.3, false, "abc");
auto diff_type_array5 = generatedArrayWithFourDiffType(2, 2.2, false, "abc");
auto diff_type_array4 =
generatedArrayWithFourDiffType(1, 3.3, false, "abc");
auto diff_type_array5 =
generatedArrayWithFourDiffType(2, 2.2, false, "abc");
std::vector<Testcase<proto::plan::GenericValue>> diff_testcases{
{{diff_type_array1, int_value}, {"array3"}, true},
@ -4327,9 +4328,7 @@ TEST(Expr, TestJsonContainsDiffTypeArray) {
};
for (auto& testcase : diff_testcases) {
auto check = [&]() {
return testcase.res;
};
auto check = [&]() { return testcase.res; };
RetrievePlanNode plan;
auto pointer = milvus::Json::pointer(testcase.nested_path);
plan.predicate_ =
@ -4355,9 +4354,7 @@ TEST(Expr, TestJsonContainsDiffTypeArray) {
}
for (auto& testcase : diff_testcases) {
auto check = [&]() {
return false;
};
auto check = [&]() { return false; };
RetrievePlanNode plan;
auto pointer = milvus::Json::pointer(testcase.nested_path);
plan.predicate_ =
@ -4433,10 +4430,13 @@ TEST(Expr, TestJsonContainsDiffType) {
proto::plan::GenericValue int_val2;
int_val2.set_int64_val(int64_t(1));
std::vector<Testcase<proto::plan::GenericValue>> diff_testcases{
{{int_val, bool_val, float_val, string_val}, {"diff_type_array"}, false},
{{string_val2, bool_val2, float_val2, int_val2}, {"diff_type_array"}, true},
{{int_val, bool_val, float_val, string_val},
{"diff_type_array"},
false},
{{string_val2, bool_val2, float_val2, int_val2},
{"diff_type_array"},
true},
};
for (auto& testcase : diff_testcases) {

View File

@ -115,7 +115,7 @@ struct GeneratedData {
target_field_data.vectors().float16_vector().data());
std::copy_n(src_data, len, ret.data());
} else {
PanicCodeInfo(Unsupported, "unsupported");
PanicInfo(Unsupported, "unsupported");
}
return std::move(ret);
@ -190,7 +190,7 @@ struct GeneratedData {
break;
}
default: {
PanicCodeInfo(Unsupported, "unsupported");
PanicInfo(Unsupported, "unsupported");
}
}
}
@ -206,7 +206,7 @@ struct GeneratedData {
}
}
PanicCodeInfo(FieldIDInvalid, "field id not find");
PanicInfo(FieldIDInvalid, "field id not find");
}
private:
@ -757,7 +757,7 @@ CreateFieldDataFromDataArray(ssize_t raw_count,
break;
}
default: {
PanicCodeInfo(Unsupported, "unsupported");
PanicInfo(Unsupported, "unsupported");
}
}
} else {
@ -828,7 +828,7 @@ CreateFieldDataFromDataArray(ssize_t raw_count,
break;
}
default: {
PanicCodeInfo(Unsupported, "unsupported");
PanicInfo(Unsupported, "unsupported");
}
}
}

View File

@ -237,6 +237,7 @@ func (BinaryExpr_BinaryOp) EnumDescriptor() ([]byte, []int) {
type GenericValue struct {
// Types that are valid to be assigned to Val:
//
// *GenericValue_BoolVal
// *GenericValue_Int64Val
// *GenericValue_FloatVal
@ -1297,6 +1298,7 @@ var xxx_messageInfo_AlwaysTrueExpr proto.InternalMessageInfo
type Expr struct {
// Types that are valid to be assigned to Expr:
//
// *Expr_TermExpr
// *Expr_UnaryExpr
// *Expr_BinaryExpr
@ -1668,6 +1670,7 @@ func (m *QueryPlanNode) GetLimit() int64 {
type PlanNode struct {
// Types that are valid to be assigned to Node:
//
// *PlanNode_VectorAnns
// *PlanNode_Predicates
// *PlanNode_Query

View File

@ -29,8 +29,9 @@ const _ = proto.ProtoPackageIsVersion3 // please upgrade the proto package
type InvalidateCollMetaCacheRequest struct {
// MsgType:
// DropCollection -> {meta cache, dml channels}
// Other -> {meta cache}
//
// DropCollection -> {meta cache, dml channels}
// Other -> {meta cache}
Base *commonpb.MsgBase `protobuf:"bytes,1,opt,name=base,proto3" json:"base,omitempty"`
DbName string `protobuf:"bytes,2,opt,name=db_name,json=dbName,proto3" json:"db_name,omitempty"`
CollectionName string `protobuf:"bytes,3,opt,name=collection_name,json=collectionName,proto3" json:"collection_name,omitempty"`

View File

@ -793,28 +793,28 @@ type RootCoordClient interface {
GetComponentStates(ctx context.Context, in *milvuspb.GetComponentStatesRequest, opts ...grpc.CallOption) (*milvuspb.ComponentStates, error)
GetTimeTickChannel(ctx context.Context, in *internalpb.GetTimeTickChannelRequest, opts ...grpc.CallOption) (*milvuspb.StringResponse, error)
GetStatisticsChannel(ctx context.Context, in *internalpb.GetStatisticsChannelRequest, opts ...grpc.CallOption) (*milvuspb.StringResponse, error)
//*
// *
// @brief This method is used to create collection
//
// @param CreateCollectionRequest, use to provide collection information to be created.
//
// @return Status
CreateCollection(ctx context.Context, in *milvuspb.CreateCollectionRequest, opts ...grpc.CallOption) (*commonpb.Status, error)
//*
// *
// @brief This method is used to delete collection.
//
// @param DropCollectionRequest, collection name is going to be deleted.
//
// @return Status
DropCollection(ctx context.Context, in *milvuspb.DropCollectionRequest, opts ...grpc.CallOption) (*commonpb.Status, error)
//*
// *
// @brief This method is used to test collection existence.
//
// @param HasCollectionRequest, collection name is going to be tested.
//
// @return BoolResponse
HasCollection(ctx context.Context, in *milvuspb.HasCollectionRequest, opts ...grpc.CallOption) (*milvuspb.BoolResponse, error)
//*
// *
// @brief This method is used to get collection schema.
//
// @param DescribeCollectionRequest, target collection name.
@ -825,28 +825,28 @@ type RootCoordClient interface {
CreateAlias(ctx context.Context, in *milvuspb.CreateAliasRequest, opts ...grpc.CallOption) (*commonpb.Status, error)
DropAlias(ctx context.Context, in *milvuspb.DropAliasRequest, opts ...grpc.CallOption) (*commonpb.Status, error)
AlterAlias(ctx context.Context, in *milvuspb.AlterAliasRequest, opts ...grpc.CallOption) (*commonpb.Status, error)
//*
// *
// @brief This method is used to list all collections.
//
// @return StringListResponse, collection name list
ShowCollections(ctx context.Context, in *milvuspb.ShowCollectionsRequest, opts ...grpc.CallOption) (*milvuspb.ShowCollectionsResponse, error)
AlterCollection(ctx context.Context, in *milvuspb.AlterCollectionRequest, opts ...grpc.CallOption) (*commonpb.Status, error)
//*
// *
// @brief This method is used to create partition
//
// @return Status
CreatePartition(ctx context.Context, in *milvuspb.CreatePartitionRequest, opts ...grpc.CallOption) (*commonpb.Status, error)
//*
// *
// @brief This method is used to drop partition
//
// @return Status
DropPartition(ctx context.Context, in *milvuspb.DropPartitionRequest, opts ...grpc.CallOption) (*commonpb.Status, error)
//*
// *
// @brief This method is used to test partition existence.
//
// @return BoolResponse
HasPartition(ctx context.Context, in *milvuspb.HasPartitionRequest, opts ...grpc.CallOption) (*milvuspb.BoolResponse, error)
//*
// *
// @brief This method is used to show partition information
//
// @param ShowPartitionRequest, target collection name.
@ -854,7 +854,7 @@ type RootCoordClient interface {
// @return StringListResponse
ShowPartitions(ctx context.Context, in *milvuspb.ShowPartitionsRequest, opts ...grpc.CallOption) (*milvuspb.ShowPartitionsResponse, error)
ShowPartitionsInternal(ctx context.Context, in *milvuspb.ShowPartitionsRequest, opts ...grpc.CallOption) (*milvuspb.ShowPartitionsResponse, error)
// rpc DescribeSegment(milvus.DescribeSegmentRequest) returns (milvus.DescribeSegmentResponse) {}
// rpc DescribeSegment(milvus.DescribeSegmentRequest) returns (milvus.DescribeSegmentResponse) {}
ShowSegments(ctx context.Context, in *milvuspb.ShowSegmentsRequest, opts ...grpc.CallOption) (*milvuspb.ShowSegmentsResponse, error)
AllocTimestamp(ctx context.Context, in *AllocTimestampRequest, opts ...grpc.CallOption) (*AllocTimestampResponse, error)
AllocID(ctx context.Context, in *AllocIDRequest, opts ...grpc.CallOption) (*AllocIDResponse, error)
@ -1327,28 +1327,28 @@ type RootCoordServer interface {
GetComponentStates(context.Context, *milvuspb.GetComponentStatesRequest) (*milvuspb.ComponentStates, error)
GetTimeTickChannel(context.Context, *internalpb.GetTimeTickChannelRequest) (*milvuspb.StringResponse, error)
GetStatisticsChannel(context.Context, *internalpb.GetStatisticsChannelRequest) (*milvuspb.StringResponse, error)
//*
// *
// @brief This method is used to create collection
//
// @param CreateCollectionRequest, use to provide collection information to be created.
//
// @return Status
CreateCollection(context.Context, *milvuspb.CreateCollectionRequest) (*commonpb.Status, error)
//*
// *
// @brief This method is used to delete collection.
//
// @param DropCollectionRequest, collection name is going to be deleted.
//
// @return Status
DropCollection(context.Context, *milvuspb.DropCollectionRequest) (*commonpb.Status, error)
//*
// *
// @brief This method is used to test collection existence.
//
// @param HasCollectionRequest, collection name is going to be tested.
//
// @return BoolResponse
HasCollection(context.Context, *milvuspb.HasCollectionRequest) (*milvuspb.BoolResponse, error)
//*
// *
// @brief This method is used to get collection schema.
//
// @param DescribeCollectionRequest, target collection name.
@ -1359,28 +1359,28 @@ type RootCoordServer interface {
CreateAlias(context.Context, *milvuspb.CreateAliasRequest) (*commonpb.Status, error)
DropAlias(context.Context, *milvuspb.DropAliasRequest) (*commonpb.Status, error)
AlterAlias(context.Context, *milvuspb.AlterAliasRequest) (*commonpb.Status, error)
//*
// *
// @brief This method is used to list all collections.
//
// @return StringListResponse, collection name list
ShowCollections(context.Context, *milvuspb.ShowCollectionsRequest) (*milvuspb.ShowCollectionsResponse, error)
AlterCollection(context.Context, *milvuspb.AlterCollectionRequest) (*commonpb.Status, error)
//*
// *
// @brief This method is used to create partition
//
// @return Status
CreatePartition(context.Context, *milvuspb.CreatePartitionRequest) (*commonpb.Status, error)
//*
// *
// @brief This method is used to drop partition
//
// @return Status
DropPartition(context.Context, *milvuspb.DropPartitionRequest) (*commonpb.Status, error)
//*
// *
// @brief This method is used to test partition existence.
//
// @return BoolResponse
HasPartition(context.Context, *milvuspb.HasPartitionRequest) (*milvuspb.BoolResponse, error)
//*
// *
// @brief This method is used to show partition information
//
// @param ShowPartitionRequest, target collection name.
@ -1388,7 +1388,7 @@ type RootCoordServer interface {
// @return StringListResponse
ShowPartitions(context.Context, *milvuspb.ShowPartitionsRequest) (*milvuspb.ShowPartitionsResponse, error)
ShowPartitionsInternal(context.Context, *milvuspb.ShowPartitionsRequest) (*milvuspb.ShowPartitionsResponse, error)
// rpc DescribeSegment(milvus.DescribeSegmentRequest) returns (milvus.DescribeSegmentResponse) {}
// rpc DescribeSegment(milvus.DescribeSegmentRequest) returns (milvus.DescribeSegmentResponse) {}
ShowSegments(context.Context, *milvuspb.ShowSegmentsRequest) (*milvuspb.ShowSegmentsResponse, error)
AllocTimestamp(context.Context, *AllocTimestampRequest) (*AllocTimestampResponse, error)
AllocID(context.Context, *AllocIDRequest) (*AllocIDResponse, error)