mirror of https://github.com/milvus-io/milvus.git
feat: Support knowhere trace using OpenTelemetry (#30750)
Issue: #21508 Signed-off-by: Yudong Cai <yudong.cai@zilliz.com>pull/30887/head
parent
a4f3e01a3a
commit
8a219e0102
|
|
@ -18,8 +18,10 @@
|
||||||
|
|
||||||
#include <memory>
|
#include <memory>
|
||||||
|
|
||||||
|
#include "common/Tracer.h"
|
||||||
#include "common/Types.h"
|
#include "common/Types.h"
|
||||||
#include "knowhere/config.h"
|
#include "knowhere/config.h"
|
||||||
|
|
||||||
namespace milvus {
|
namespace milvus {
|
||||||
|
|
||||||
struct SearchInfo {
|
struct SearchInfo {
|
||||||
|
|
@ -29,6 +31,7 @@ struct SearchInfo {
|
||||||
MetricType metric_type_;
|
MetricType metric_type_;
|
||||||
knowhere::Json search_params_;
|
knowhere::Json search_params_;
|
||||||
std::optional<FieldId> group_by_field_id_;
|
std::optional<FieldId> group_by_field_id_;
|
||||||
|
tracer::TraceContext trace_ctx_;
|
||||||
};
|
};
|
||||||
|
|
||||||
using SearchInfoPtr = std::shared_ptr<SearchInfo>;
|
using SearchInfoPtr = std::shared_ptr<SearchInfo>;
|
||||||
|
|
|
||||||
|
|
@ -8,20 +8,22 @@
|
||||||
// Unless required by applicable law or agreed to in writing, software distributed under the License
|
// Unless required by applicable law or agreed to in writing, software distributed under the License
|
||||||
// is distributed on an "AS IS" BASIS, WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express
|
// is distributed on an "AS IS" BASIS, WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express
|
||||||
// or implied. See the License for the specific language governing permissions and limitations under the License
|
// or implied. See the License for the specific language governing permissions and limitations under the License
|
||||||
#include "log/Log.h"
|
|
||||||
#include "Tracer.h"
|
#include "Tracer.h"
|
||||||
|
#include "log/Log.h"
|
||||||
|
|
||||||
#include <utility>
|
#include <utility>
|
||||||
|
|
||||||
#include "opentelemetry/exporters/ostream/span_exporter_factory.h"
|
|
||||||
#include "opentelemetry/exporters/jaeger/jaeger_exporter_factory.h"
|
#include "opentelemetry/exporters/jaeger/jaeger_exporter_factory.h"
|
||||||
|
#include "opentelemetry/exporters/ostream/span_exporter_factory.h"
|
||||||
#include "opentelemetry/exporters/otlp/otlp_grpc_exporter_factory.h"
|
#include "opentelemetry/exporters/otlp/otlp_grpc_exporter_factory.h"
|
||||||
#include "opentelemetry/sdk/trace/samplers/always_on.h"
|
|
||||||
#include "opentelemetry/sdk/trace/batch_span_processor_factory.h"
|
|
||||||
#include "opentelemetry/sdk/trace/tracer_provider_factory.h"
|
|
||||||
#include "opentelemetry/sdk/trace/sampler.h"
|
|
||||||
#include "opentelemetry/sdk/trace/samplers/parent.h"
|
|
||||||
#include "opentelemetry/sdk/resource/resource.h"
|
#include "opentelemetry/sdk/resource/resource.h"
|
||||||
|
#include "opentelemetry/sdk/trace/batch_span_processor_factory.h"
|
||||||
|
#include "opentelemetry/sdk/trace/sampler.h"
|
||||||
|
#include "opentelemetry/sdk/trace/samplers/always_on.h"
|
||||||
|
#include "opentelemetry/sdk/trace/samplers/parent.h"
|
||||||
|
#include "opentelemetry/sdk/trace/tracer_provider_factory.h"
|
||||||
|
#include "opentelemetry/sdk/version/version.h"
|
||||||
#include "opentelemetry/trace/span_context.h"
|
#include "opentelemetry/trace/span_context.h"
|
||||||
#include "opentelemetry/trace/span_metadata.h"
|
#include "opentelemetry/trace/span_metadata.h"
|
||||||
|
|
||||||
|
|
@ -41,20 +43,20 @@ static std::shared_ptr<trace::TracerProvider> noop_trace_provider =
|
||||||
std::make_shared<opentelemetry::trace::NoopTracerProvider>();
|
std::make_shared<opentelemetry::trace::NoopTracerProvider>();
|
||||||
|
|
||||||
void
|
void
|
||||||
initTelementry(TraceConfig* config) {
|
initTelemetry(const TraceConfig& cfg) {
|
||||||
std::unique_ptr<opentelemetry::sdk::trace::SpanExporter> exporter;
|
std::unique_ptr<opentelemetry::sdk::trace::SpanExporter> exporter;
|
||||||
if (config->exporter == "stdout") {
|
if (cfg.exporter == "stdout") {
|
||||||
exporter = ostream::OStreamSpanExporterFactory::Create();
|
exporter = ostream::OStreamSpanExporterFactory::Create();
|
||||||
} else if (config->exporter == "jaeger") {
|
} else if (cfg.exporter == "jaeger") {
|
||||||
auto opts = jaeger::JaegerExporterOptions{};
|
auto opts = jaeger::JaegerExporterOptions{};
|
||||||
opts.transport_format = jaeger::TransportFormat::kThriftHttp;
|
opts.transport_format = jaeger::TransportFormat::kThriftHttp;
|
||||||
opts.endpoint = config->jaegerURL;
|
opts.endpoint = cfg.jaegerURL;
|
||||||
exporter = jaeger::JaegerExporterFactory::Create(opts);
|
exporter = jaeger::JaegerExporterFactory::Create(opts);
|
||||||
LOG_INFO("init jaeger exporter, endpoint:", opts.endpoint);
|
LOG_INFO("init jaeger exporter, endpoint:", opts.endpoint);
|
||||||
} else if (config->exporter == "otlp") {
|
} else if (cfg.exporter == "otlp") {
|
||||||
auto opts = otlp::OtlpGrpcExporterOptions{};
|
auto opts = otlp::OtlpGrpcExporterOptions{};
|
||||||
opts.endpoint = config->otlpEndpoint;
|
opts.endpoint = cfg.otlpEndpoint;
|
||||||
opts.use_ssl_credentials = config->oltpSecure;
|
opts.use_ssl_credentials = cfg.oltpSecure;
|
||||||
exporter = otlp::OtlpGrpcExporterFactory::Create(opts);
|
exporter = otlp::OtlpGrpcExporterFactory::Create(opts);
|
||||||
LOG_INFO("init otlp exporter, endpoint:", opts.endpoint);
|
LOG_INFO("init otlp exporter, endpoint:", opts.endpoint);
|
||||||
} else {
|
} else {
|
||||||
|
|
@ -64,8 +66,8 @@ initTelementry(TraceConfig* config) {
|
||||||
if (enable_trace) {
|
if (enable_trace) {
|
||||||
auto processor = trace_sdk::BatchSpanProcessorFactory::Create(
|
auto processor = trace_sdk::BatchSpanProcessorFactory::Create(
|
||||||
std::move(exporter), {});
|
std::move(exporter), {});
|
||||||
resource::ResourceAttributes attributes = {{"service.name", "segcore"},
|
resource::ResourceAttributes attributes = {
|
||||||
{"NodeID", config->nodeID}};
|
{"service.name", TRACE_SERVICE_SEGCORE}, {"NodeID", cfg.nodeID}};
|
||||||
auto resource = resource::Resource::Create(attributes);
|
auto resource = resource::Resource::Create(attributes);
|
||||||
auto sampler = std::make_unique<trace_sdk::ParentBasedSampler>(
|
auto sampler = std::make_unique<trace_sdk::ParentBasedSampler>(
|
||||||
std::make_shared<trace_sdk::AlwaysOnSampler>());
|
std::make_shared<trace_sdk::AlwaysOnSampler>());
|
||||||
|
|
@ -81,7 +83,8 @@ initTelementry(TraceConfig* config) {
|
||||||
std::shared_ptr<trace::Tracer>
|
std::shared_ptr<trace::Tracer>
|
||||||
GetTracer() {
|
GetTracer() {
|
||||||
auto provider = trace::Provider::GetTracerProvider();
|
auto provider = trace::Provider::GetTracerProvider();
|
||||||
return provider->GetTracer("segcore", OPENTELEMETRY_SDK_VERSION);
|
return provider->GetTracer(TRACE_SERVICE_SEGCORE,
|
||||||
|
OPENTELEMETRY_SDK_VERSION);
|
||||||
}
|
}
|
||||||
|
|
||||||
std::shared_ptr<trace::Span>
|
std::shared_ptr<trace::Span>
|
||||||
|
|
@ -89,14 +92,13 @@ StartSpan(const std::string& name, TraceContext* parentCtx) {
|
||||||
trace::StartSpanOptions opts;
|
trace::StartSpanOptions opts;
|
||||||
if (enable_trace && parentCtx != nullptr && parentCtx->traceID != nullptr &&
|
if (enable_trace && parentCtx != nullptr && parentCtx->traceID != nullptr &&
|
||||||
parentCtx->spanID != nullptr) {
|
parentCtx->spanID != nullptr) {
|
||||||
if (isEmptyID(parentCtx->traceID, trace::TraceId::kSize) ||
|
if (EmptyTraceID(parentCtx) || EmptySpanID(parentCtx)) {
|
||||||
isEmptyID(parentCtx->spanID, trace::SpanId::kSize)) {
|
|
||||||
return noop_trace_provider->GetTracer("noop")->StartSpan("noop");
|
return noop_trace_provider->GetTracer("noop")->StartSpan("noop");
|
||||||
}
|
}
|
||||||
opts.parent = trace::SpanContext(
|
opts.parent = trace::SpanContext(
|
||||||
trace::TraceId({parentCtx->traceID, trace::TraceId::kSize}),
|
trace::TraceId({parentCtx->traceID, trace::TraceId::kSize}),
|
||||||
trace::SpanId({parentCtx->spanID, trace::SpanId::kSize}),
|
trace::SpanId({parentCtx->spanID, trace::SpanId::kSize}),
|
||||||
trace::TraceFlags(parentCtx->flag),
|
trace::TraceFlags(parentCtx->traceFlags),
|
||||||
true);
|
true);
|
||||||
}
|
}
|
||||||
return GetTracer()->StartSpan(name, opts);
|
return GetTracer()->StartSpan(name, opts);
|
||||||
|
|
@ -118,7 +120,7 @@ CloseRootSpan() {
|
||||||
}
|
}
|
||||||
|
|
||||||
void
|
void
|
||||||
AddEvent(std::string event_label) {
|
AddEvent(const std::string& event_label) {
|
||||||
if (enable_trace && local_span != nullptr) {
|
if (enable_trace && local_span != nullptr) {
|
||||||
local_span->AddEvent(event_label);
|
local_span->AddEvent(event_label);
|
||||||
}
|
}
|
||||||
|
|
@ -126,12 +128,44 @@ AddEvent(std::string event_label) {
|
||||||
|
|
||||||
bool
|
bool
|
||||||
isEmptyID(const uint8_t* id, int length) {
|
isEmptyID(const uint8_t* id, int length) {
|
||||||
for (int i = 0; i < length; i++) {
|
if (id != nullptr) {
|
||||||
if (id[i] != 0) {
|
for (int i = 0; i < length; i++) {
|
||||||
return false;
|
if (id[i] != 0) {
|
||||||
|
return false;
|
||||||
|
}
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
return true;
|
return true;
|
||||||
}
|
}
|
||||||
|
|
||||||
|
bool
|
||||||
|
EmptyTraceID(const TraceContext* ctx) {
|
||||||
|
return isEmptyID(ctx->traceID, trace::TraceId::kSize);
|
||||||
|
}
|
||||||
|
|
||||||
|
bool
|
||||||
|
EmptySpanID(const TraceContext* ctx) {
|
||||||
|
return isEmptyID(ctx->spanID, trace::SpanId::kSize);
|
||||||
|
}
|
||||||
|
|
||||||
|
std::string
|
||||||
|
GetTraceIDAsStr(const TraceContext* ctx) {
|
||||||
|
if (ctx != nullptr && !EmptyTraceID(ctx)) {
|
||||||
|
return std::string((char*)ctx->traceID,
|
||||||
|
opentelemetry::trace::TraceId::kSize);
|
||||||
|
} else {
|
||||||
|
return std::string();
|
||||||
|
}
|
||||||
|
}
|
||||||
|
|
||||||
|
std::string
|
||||||
|
GetSpanIDAsStr(const TraceContext* ctx) {
|
||||||
|
if (ctx != nullptr && !EmptySpanID(ctx)) {
|
||||||
|
return std::string((char*)ctx->spanID,
|
||||||
|
opentelemetry::trace::SpanId::kSize);
|
||||||
|
} else {
|
||||||
|
return std::string();
|
||||||
|
}
|
||||||
|
}
|
||||||
|
|
||||||
} // namespace milvus::tracer
|
} // namespace milvus::tracer
|
||||||
|
|
|
||||||
|
|
@ -14,9 +14,10 @@
|
||||||
#include <memory>
|
#include <memory>
|
||||||
#include <string>
|
#include <string>
|
||||||
|
|
||||||
#include "opentelemetry/sdk/version/version.h"
|
|
||||||
#include "opentelemetry/trace/provider.h"
|
#include "opentelemetry/trace/provider.h"
|
||||||
|
|
||||||
|
#define TRACE_SERVICE_SEGCORE "segcore"
|
||||||
|
|
||||||
namespace milvus::tracer {
|
namespace milvus::tracer {
|
||||||
|
|
||||||
struct TraceConfig {
|
struct TraceConfig {
|
||||||
|
|
@ -30,14 +31,14 @@ struct TraceConfig {
|
||||||
};
|
};
|
||||||
|
|
||||||
struct TraceContext {
|
struct TraceContext {
|
||||||
const uint8_t* traceID;
|
const uint8_t* traceID = nullptr;
|
||||||
const uint8_t* spanID;
|
const uint8_t* spanID = nullptr;
|
||||||
uint8_t flag;
|
uint8_t traceFlags = 0;
|
||||||
};
|
};
|
||||||
namespace trace = opentelemetry::trace;
|
namespace trace = opentelemetry::trace;
|
||||||
|
|
||||||
void
|
void
|
||||||
initTelementry(TraceConfig* config);
|
initTelemetry(const TraceConfig& cfg);
|
||||||
|
|
||||||
std::shared_ptr<trace::Tracer>
|
std::shared_ptr<trace::Tracer>
|
||||||
GetTracer();
|
GetTracer();
|
||||||
|
|
@ -52,9 +53,18 @@ void
|
||||||
CloseRootSpan();
|
CloseRootSpan();
|
||||||
|
|
||||||
void
|
void
|
||||||
AddEvent(std::string event_label);
|
AddEvent(const std::string& event_label);
|
||||||
|
|
||||||
bool
|
bool
|
||||||
isEmptyID(const uint8_t* id, const int length);
|
EmptyTraceID(const TraceContext* ctx);
|
||||||
|
|
||||||
|
bool
|
||||||
|
EmptySpanID(const TraceContext* ctx);
|
||||||
|
|
||||||
|
std::string
|
||||||
|
GetTraceIDAsStr(const TraceContext* ctx);
|
||||||
|
|
||||||
|
std::string
|
||||||
|
GetSpanIDAsStr(const TraceContext* ctx);
|
||||||
|
|
||||||
} // namespace milvus::tracer
|
} // namespace milvus::tracer
|
||||||
|
|
|
||||||
|
|
@ -88,8 +88,8 @@ InitTrace(CTraceConfig* config) {
|
||||||
config->nodeID};
|
config->nodeID};
|
||||||
std::call_once(
|
std::call_once(
|
||||||
traceFlag,
|
traceFlag,
|
||||||
[](milvus::tracer::TraceConfig* c) {
|
[](const milvus::tracer::TraceConfig& c) {
|
||||||
milvus::tracer::initTelementry(c);
|
milvus::tracer::initTelemetry(c);
|
||||||
},
|
},
|
||||||
&traceConfig);
|
traceConfig);
|
||||||
}
|
}
|
||||||
|
|
|
||||||
|
|
@ -104,7 +104,7 @@ typedef struct CTraceConfig {
|
||||||
typedef struct CTraceContext {
|
typedef struct CTraceContext {
|
||||||
const uint8_t* traceID;
|
const uint8_t* traceID;
|
||||||
const uint8_t* spanID;
|
const uint8_t* spanID;
|
||||||
uint8_t flag;
|
uint8_t traceFlags;
|
||||||
} CTraceContext;
|
} CTraceContext;
|
||||||
|
|
||||||
typedef struct CNewSegmentResult {
|
typedef struct CNewSegmentResult {
|
||||||
|
|
|
||||||
|
|
@ -16,14 +16,14 @@
|
||||||
|
|
||||||
#pragma once
|
#pragma once
|
||||||
|
|
||||||
|
#include <fmt/core.h>
|
||||||
#include <memory>
|
#include <memory>
|
||||||
#include <string>
|
#include <string>
|
||||||
#include <vector>
|
#include <vector>
|
||||||
|
|
||||||
#include <fmt/core.h>
|
|
||||||
|
|
||||||
#include "common/Schema.h"
|
#include "common/Schema.h"
|
||||||
#include "common/Types.h"
|
#include "common/Types.h"
|
||||||
|
#include "common/Utils.h"
|
||||||
#include "pb/plan.pb.h"
|
#include "pb/plan.pb.h"
|
||||||
|
|
||||||
namespace milvus {
|
namespace milvus {
|
||||||
|
|
@ -73,7 +73,7 @@ struct ColumnInfo {
|
||||||
return fmt::format("[FieldId:{}, data_type:{}, nested_path:{}]",
|
return fmt::format("[FieldId:{}, data_type:{}, nested_path:{}]",
|
||||||
std::to_string(field_id_.get()),
|
std::to_string(field_id_.get()),
|
||||||
data_type_,
|
data_type_,
|
||||||
milvus::Join(nested_path_, ","));
|
milvus::Join<std::string>(nested_path_, ","));
|
||||||
}
|
}
|
||||||
};
|
};
|
||||||
|
|
||||||
|
|
|
||||||
|
|
@ -324,10 +324,7 @@ VectorDiskAnnIndex<T>::Query(const DatasetPtr dataset,
|
||||||
auto num_queries = dataset->GetRows();
|
auto num_queries = dataset->GetRows();
|
||||||
auto topk = search_info.topk_;
|
auto topk = search_info.topk_;
|
||||||
|
|
||||||
knowhere::Json search_config = search_info.search_params_;
|
knowhere::Json search_config = PrepareSearchParams(search_info);
|
||||||
|
|
||||||
search_config[knowhere::meta::TOPK] = topk;
|
|
||||||
search_config[knowhere::meta::METRIC_TYPE] = GetMetricType();
|
|
||||||
|
|
||||||
if (GetIndexType() == knowhere::IndexEnum::INDEX_DISKANN) {
|
if (GetIndexType() == knowhere::IndexEnum::INDEX_DISKANN) {
|
||||||
// set search list size
|
// set search list size
|
||||||
|
|
|
||||||
|
|
@ -112,6 +112,27 @@ class VectorIndex : public IndexBase {
|
||||||
err_msg);
|
err_msg);
|
||||||
}
|
}
|
||||||
|
|
||||||
|
knowhere::Json
|
||||||
|
PrepareSearchParams(const SearchInfo& search_info) const {
|
||||||
|
knowhere::Json search_cfg = search_info.search_params_;
|
||||||
|
|
||||||
|
search_cfg[knowhere::meta::METRIC_TYPE] = search_info.metric_type_;
|
||||||
|
search_cfg[knowhere::meta::TOPK] = search_info.topk_;
|
||||||
|
|
||||||
|
// save trace context into search conf
|
||||||
|
if (search_info.trace_ctx_.traceID != nullptr &&
|
||||||
|
search_info.trace_ctx_.spanID != nullptr) {
|
||||||
|
search_cfg[knowhere::meta::TRACE_ID] =
|
||||||
|
tracer::GetTraceIDAsStr(&search_info.trace_ctx_);
|
||||||
|
search_cfg[knowhere::meta::SPAN_ID] =
|
||||||
|
tracer::GetSpanIDAsStr(&search_info.trace_ctx_);
|
||||||
|
search_cfg[knowhere::meta::TRACE_FLAGS] =
|
||||||
|
search_info.trace_ctx_.traceFlags;
|
||||||
|
}
|
||||||
|
|
||||||
|
return search_cfg;
|
||||||
|
}
|
||||||
|
|
||||||
private:
|
private:
|
||||||
MetricType metric_type_;
|
MetricType metric_type_;
|
||||||
int64_t dim_;
|
int64_t dim_;
|
||||||
|
|
|
||||||
|
|
@ -26,6 +26,7 @@
|
||||||
#include <unordered_map>
|
#include <unordered_map>
|
||||||
#include <unordered_set>
|
#include <unordered_set>
|
||||||
|
|
||||||
|
#include "common/Tracer.h"
|
||||||
#include "common/Types.h"
|
#include "common/Types.h"
|
||||||
#include "common/type_c.h"
|
#include "common/type_c.h"
|
||||||
#include "fmt/format.h"
|
#include "fmt/format.h"
|
||||||
|
|
@ -540,12 +541,10 @@ VectorMemIndex<T>::Query(const DatasetPtr dataset,
|
||||||
// "Metric type of field index isn't the same with search info");
|
// "Metric type of field index isn't the same with search info");
|
||||||
|
|
||||||
auto num_queries = dataset->GetRows();
|
auto num_queries = dataset->GetRows();
|
||||||
knowhere::Json search_conf = search_info.search_params_;
|
knowhere::Json search_conf = PrepareSearchParams(search_info);
|
||||||
auto topk = search_info.topk_;
|
auto topk = search_info.topk_;
|
||||||
// TODO :: check dim of search data
|
// TODO :: check dim of search data
|
||||||
auto final = [&] {
|
auto final = [&] {
|
||||||
search_conf[knowhere::meta::TOPK] = topk;
|
|
||||||
search_conf[knowhere::meta::METRIC_TYPE] = GetMetricType();
|
|
||||||
auto index_type = GetIndexType();
|
auto index_type = GetIndexType();
|
||||||
if (CheckKeyInConfig(search_conf, RADIUS)) {
|
if (CheckKeyInConfig(search_conf, RADIUS)) {
|
||||||
if (CheckKeyInConfig(search_conf, RANGE_FILTER)) {
|
if (CheckKeyInConfig(search_conf, RANGE_FILTER)) {
|
||||||
|
|
|
||||||
|
|
@ -12,17 +12,18 @@
|
||||||
#include <string>
|
#include <string>
|
||||||
#include <vector>
|
#include <vector>
|
||||||
|
|
||||||
|
#include "SearchBruteForce.h"
|
||||||
|
#include "SubSearchResult.h"
|
||||||
#include "common/Consts.h"
|
#include "common/Consts.h"
|
||||||
#include "common/EasyAssert.h"
|
#include "common/EasyAssert.h"
|
||||||
#include "common/RangeSearchHelper.h"
|
#include "common/RangeSearchHelper.h"
|
||||||
#include "common/Utils.h"
|
#include "common/Utils.h"
|
||||||
#include "common/Tracer.h"
|
#include "common/Tracer.h"
|
||||||
#include "SearchBruteForce.h"
|
|
||||||
#include "SubSearchResult.h"
|
|
||||||
#include "knowhere/comp/brute_force.h"
|
#include "knowhere/comp/brute_force.h"
|
||||||
#include "knowhere/comp/index_param.h"
|
#include "knowhere/comp/index_param.h"
|
||||||
#include "knowhere/index_node.h"
|
#include "knowhere/index_node.h"
|
||||||
#include "log/Log.h"
|
#include "log/Log.h"
|
||||||
|
|
||||||
namespace milvus::query {
|
namespace milvus::query {
|
||||||
|
|
||||||
void
|
void
|
||||||
|
|
@ -41,11 +42,32 @@ CheckBruteForceSearchParam(const FieldMeta& field,
|
||||||
"[BruteForceSearch] Data type and metric type miss-match");
|
"[BruteForceSearch] Data type and metric type miss-match");
|
||||||
}
|
}
|
||||||
|
|
||||||
|
knowhere::Json
|
||||||
|
PrepareBFSearchParams(const SearchInfo& search_info) {
|
||||||
|
knowhere::Json search_cfg = search_info.search_params_;
|
||||||
|
|
||||||
|
search_cfg[knowhere::meta::METRIC_TYPE] = search_info.metric_type_;
|
||||||
|
search_cfg[knowhere::meta::TOPK] = search_info.topk_;
|
||||||
|
|
||||||
|
// save trace context into search conf
|
||||||
|
if (search_info.trace_ctx_.traceID != nullptr &&
|
||||||
|
search_info.trace_ctx_.spanID != nullptr) {
|
||||||
|
search_cfg[knowhere::meta::TRACE_ID] =
|
||||||
|
tracer::GetTraceIDAsStr(&search_info.trace_ctx_);
|
||||||
|
search_cfg[knowhere::meta::SPAN_ID] =
|
||||||
|
tracer::GetSpanIDAsStr(&search_info.trace_ctx_);
|
||||||
|
search_cfg[knowhere::meta::TRACE_FLAGS] =
|
||||||
|
search_info.trace_ctx_.traceFlags;
|
||||||
|
}
|
||||||
|
|
||||||
|
return search_cfg;
|
||||||
|
}
|
||||||
|
|
||||||
SubSearchResult
|
SubSearchResult
|
||||||
BruteForceSearch(const dataset::SearchDataset& dataset,
|
BruteForceSearch(const dataset::SearchDataset& dataset,
|
||||||
const void* chunk_data_raw,
|
const void* chunk_data_raw,
|
||||||
int64_t chunk_rows,
|
int64_t chunk_rows,
|
||||||
const knowhere::Json& conf,
|
const SearchInfo& search_info,
|
||||||
const BitsetView& bitset,
|
const BitsetView& bitset,
|
||||||
DataType data_type) {
|
DataType data_type) {
|
||||||
SubSearchResult sub_result(dataset.num_queries,
|
SubSearchResult sub_result(dataset.num_queries,
|
||||||
|
|
@ -58,40 +80,35 @@ BruteForceSearch(const dataset::SearchDataset& dataset,
|
||||||
|
|
||||||
auto base_dataset = knowhere::GenDataSet(chunk_rows, dim, chunk_data_raw);
|
auto base_dataset = knowhere::GenDataSet(chunk_rows, dim, chunk_data_raw);
|
||||||
auto query_dataset = knowhere::GenDataSet(nq, dim, dataset.query_data);
|
auto query_dataset = knowhere::GenDataSet(nq, dim, dataset.query_data);
|
||||||
auto config = knowhere::Json{
|
auto search_cfg = PrepareBFSearchParams(search_info);
|
||||||
{knowhere::meta::METRIC_TYPE, dataset.metric_type},
|
|
||||||
{knowhere::meta::DIM, dim},
|
|
||||||
{knowhere::meta::TOPK, topk},
|
|
||||||
};
|
|
||||||
|
|
||||||
sub_result.mutable_seg_offsets().resize(nq * topk);
|
sub_result.mutable_seg_offsets().resize(nq * topk);
|
||||||
sub_result.mutable_distances().resize(nq * topk);
|
sub_result.mutable_distances().resize(nq * topk);
|
||||||
|
|
||||||
if (conf.contains(RADIUS)) {
|
if (search_cfg.contains(RADIUS)) {
|
||||||
config[RADIUS] = conf[RADIUS].get<float>();
|
if (search_cfg.contains(RANGE_FILTER)) {
|
||||||
if (conf.contains(RANGE_FILTER)) {
|
CheckRangeSearchParam(search_cfg[RADIUS],
|
||||||
config[RANGE_FILTER] = conf[RANGE_FILTER].get<float>();
|
search_cfg[RANGE_FILTER],
|
||||||
CheckRangeSearchParam(
|
search_info.metric_type_);
|
||||||
config[RADIUS], config[RANGE_FILTER], dataset.metric_type);
|
|
||||||
}
|
}
|
||||||
knowhere::expected<knowhere::DataSetPtr> res;
|
knowhere::expected<knowhere::DataSetPtr> res;
|
||||||
if (data_type == DataType::VECTOR_FLOAT) {
|
if (data_type == DataType::VECTOR_FLOAT) {
|
||||||
res = knowhere::BruteForce::RangeSearch<float>(
|
res = knowhere::BruteForce::RangeSearch<float>(
|
||||||
base_dataset, query_dataset, config, bitset);
|
base_dataset, query_dataset, search_cfg, bitset);
|
||||||
} else if (data_type == DataType::VECTOR_FLOAT16) {
|
} else if (data_type == DataType::VECTOR_FLOAT16) {
|
||||||
res = knowhere::BruteForce::RangeSearch<float16>(
|
res = knowhere::BruteForce::RangeSearch<float16>(
|
||||||
base_dataset, query_dataset, config, bitset);
|
base_dataset, query_dataset, search_cfg, bitset);
|
||||||
} else if (data_type == DataType::VECTOR_BFLOAT16) {
|
} else if (data_type == DataType::VECTOR_BFLOAT16) {
|
||||||
res = knowhere::BruteForce::RangeSearch<bfloat16>(
|
res = knowhere::BruteForce::RangeSearch<bfloat16>(
|
||||||
base_dataset, query_dataset, config, bitset);
|
base_dataset, query_dataset, search_cfg, bitset);
|
||||||
} else if (data_type == DataType::VECTOR_BINARY) {
|
} else if (data_type == DataType::VECTOR_BINARY) {
|
||||||
res = knowhere::BruteForce::RangeSearch<uint8_t>(
|
res = knowhere::BruteForce::RangeSearch<uint8_t>(
|
||||||
base_dataset, query_dataset, config, bitset);
|
base_dataset, query_dataset, search_cfg, bitset);
|
||||||
}
|
}
|
||||||
milvus::tracer::AddEvent("knowhere_finish_BruteForce_RangeSearch");
|
milvus::tracer::AddEvent("knowhere_finish_BruteForce_RangeSearch");
|
||||||
if (!res.has_value()) {
|
if (!res.has_value()) {
|
||||||
PanicInfo(KnowhereError,
|
PanicInfo(KnowhereError,
|
||||||
"failed to range search: {}: {}",
|
"Brute force range search fail: {}, {}",
|
||||||
KnowhereStatusString(res.error()),
|
KnowhereStatusString(res.error()),
|
||||||
res.what());
|
res.what());
|
||||||
}
|
}
|
||||||
|
|
@ -110,7 +127,7 @@ BruteForceSearch(const dataset::SearchDataset& dataset,
|
||||||
query_dataset,
|
query_dataset,
|
||||||
sub_result.mutable_seg_offsets().data(),
|
sub_result.mutable_seg_offsets().data(),
|
||||||
sub_result.mutable_distances().data(),
|
sub_result.mutable_distances().data(),
|
||||||
config,
|
search_cfg,
|
||||||
bitset);
|
bitset);
|
||||||
} else if (data_type == DataType::VECTOR_FLOAT16) {
|
} else if (data_type == DataType::VECTOR_FLOAT16) {
|
||||||
stat = knowhere::BruteForce::SearchWithBuf<float16>(
|
stat = knowhere::BruteForce::SearchWithBuf<float16>(
|
||||||
|
|
@ -118,7 +135,7 @@ BruteForceSearch(const dataset::SearchDataset& dataset,
|
||||||
query_dataset,
|
query_dataset,
|
||||||
sub_result.mutable_seg_offsets().data(),
|
sub_result.mutable_seg_offsets().data(),
|
||||||
sub_result.mutable_distances().data(),
|
sub_result.mutable_distances().data(),
|
||||||
config,
|
search_cfg,
|
||||||
bitset);
|
bitset);
|
||||||
} else if (data_type == DataType::VECTOR_BFLOAT16) {
|
} else if (data_type == DataType::VECTOR_BFLOAT16) {
|
||||||
stat = knowhere::BruteForce::SearchWithBuf<bfloat16>(
|
stat = knowhere::BruteForce::SearchWithBuf<bfloat16>(
|
||||||
|
|
@ -126,7 +143,7 @@ BruteForceSearch(const dataset::SearchDataset& dataset,
|
||||||
query_dataset,
|
query_dataset,
|
||||||
sub_result.mutable_seg_offsets().data(),
|
sub_result.mutable_seg_offsets().data(),
|
||||||
sub_result.mutable_distances().data(),
|
sub_result.mutable_distances().data(),
|
||||||
config,
|
search_cfg,
|
||||||
bitset);
|
bitset);
|
||||||
} else if (data_type == DataType::VECTOR_BINARY) {
|
} else if (data_type == DataType::VECTOR_BINARY) {
|
||||||
stat = knowhere::BruteForce::SearchWithBuf<uint8_t>(
|
stat = knowhere::BruteForce::SearchWithBuf<uint8_t>(
|
||||||
|
|
@ -134,14 +151,14 @@ BruteForceSearch(const dataset::SearchDataset& dataset,
|
||||||
query_dataset,
|
query_dataset,
|
||||||
sub_result.mutable_seg_offsets().data(),
|
sub_result.mutable_seg_offsets().data(),
|
||||||
sub_result.mutable_distances().data(),
|
sub_result.mutable_distances().data(),
|
||||||
config,
|
search_cfg,
|
||||||
bitset);
|
bitset);
|
||||||
}
|
}
|
||||||
milvus::tracer::AddEvent("knowhere_finish_BruteForce_SearchWithBuf");
|
milvus::tracer::AddEvent("knowhere_finish_BruteForce_SearchWithBuf");
|
||||||
if (stat != knowhere::Status::success) {
|
if (stat != knowhere::Status::success) {
|
||||||
throw SegcoreError(
|
throw SegcoreError(
|
||||||
KnowhereError,
|
KnowhereError,
|
||||||
"invalid metric type, " + KnowhereStatusString(stat));
|
"Brute force search fail: " + KnowhereStatusString(stat));
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
sub_result.round_values();
|
sub_result.round_values();
|
||||||
|
|
@ -152,13 +169,14 @@ SubSearchResult
|
||||||
BruteForceSearchIterators(const dataset::SearchDataset& dataset,
|
BruteForceSearchIterators(const dataset::SearchDataset& dataset,
|
||||||
const void* chunk_data_raw,
|
const void* chunk_data_raw,
|
||||||
int64_t chunk_rows,
|
int64_t chunk_rows,
|
||||||
const knowhere::Json& conf,
|
const SearchInfo& search_info,
|
||||||
const BitsetView& bitset,
|
const BitsetView& bitset,
|
||||||
DataType data_type) {
|
DataType data_type) {
|
||||||
auto nq = dataset.num_queries;
|
auto nq = dataset.num_queries;
|
||||||
auto dim = dataset.dim;
|
auto dim = dataset.dim;
|
||||||
auto base_dataset = knowhere::GenDataSet(chunk_rows, dim, chunk_data_raw);
|
auto base_dataset = knowhere::GenDataSet(chunk_rows, dim, chunk_data_raw);
|
||||||
auto query_dataset = knowhere::GenDataSet(nq, dim, dataset.query_data);
|
auto query_dataset = knowhere::GenDataSet(nq, dim, dataset.query_data);
|
||||||
|
auto search_cfg = PrepareBFSearchParams(search_info);
|
||||||
|
|
||||||
knowhere::expected<
|
knowhere::expected<
|
||||||
std::vector<std::shared_ptr<knowhere::IndexNode::iterator>>>
|
std::vector<std::shared_ptr<knowhere::IndexNode::iterator>>>
|
||||||
|
|
@ -166,15 +184,15 @@ BruteForceSearchIterators(const dataset::SearchDataset& dataset,
|
||||||
switch (data_type) {
|
switch (data_type) {
|
||||||
case DataType::VECTOR_FLOAT:
|
case DataType::VECTOR_FLOAT:
|
||||||
iterators_val = knowhere::BruteForce::AnnIterator<float>(
|
iterators_val = knowhere::BruteForce::AnnIterator<float>(
|
||||||
base_dataset, query_dataset, conf, bitset);
|
base_dataset, query_dataset, search_cfg, bitset);
|
||||||
break;
|
break;
|
||||||
case DataType::VECTOR_FLOAT16:
|
case DataType::VECTOR_FLOAT16:
|
||||||
iterators_val = knowhere::BruteForce::AnnIterator<float16>(
|
iterators_val = knowhere::BruteForce::AnnIterator<float16>(
|
||||||
base_dataset, query_dataset, conf, bitset);
|
base_dataset, query_dataset, search_cfg, bitset);
|
||||||
break;
|
break;
|
||||||
case DataType::VECTOR_BFLOAT16:
|
case DataType::VECTOR_BFLOAT16:
|
||||||
iterators_val = knowhere::BruteForce::AnnIterator<bfloat16>(
|
iterators_val = knowhere::BruteForce::AnnIterator<bfloat16>(
|
||||||
base_dataset, query_dataset, conf, bitset);
|
base_dataset, query_dataset, search_cfg, bitset);
|
||||||
break;
|
break;
|
||||||
default:
|
default:
|
||||||
PanicInfo(ErrorCode::Unsupported,
|
PanicInfo(ErrorCode::Unsupported,
|
||||||
|
|
|
||||||
|
|
@ -27,7 +27,7 @@ SubSearchResult
|
||||||
BruteForceSearch(const dataset::SearchDataset& dataset,
|
BruteForceSearch(const dataset::SearchDataset& dataset,
|
||||||
const void* chunk_data_raw,
|
const void* chunk_data_raw,
|
||||||
int64_t chunk_rows,
|
int64_t chunk_rows,
|
||||||
const knowhere::Json& conf,
|
const SearchInfo& search_info,
|
||||||
const BitsetView& bitset,
|
const BitsetView& bitset,
|
||||||
DataType data_type);
|
DataType data_type);
|
||||||
|
|
||||||
|
|
@ -35,7 +35,7 @@ SubSearchResult
|
||||||
BruteForceSearchIterators(const dataset::SearchDataset& dataset,
|
BruteForceSearchIterators(const dataset::SearchDataset& dataset,
|
||||||
const void* chunk_data_raw,
|
const void* chunk_data_raw,
|
||||||
int64_t chunk_rows,
|
int64_t chunk_rows,
|
||||||
const knowhere::Json& conf,
|
const SearchInfo& search_info,
|
||||||
const BitsetView& bitset,
|
const BitsetView& bitset,
|
||||||
DataType data_type);
|
DataType data_type);
|
||||||
|
|
||||||
|
|
|
||||||
|
|
@ -111,7 +111,7 @@ SearchOnGrowing(const segcore::SegmentGrowingImpl& segment,
|
||||||
auto sub_qr = BruteForceSearchIterators(search_dataset,
|
auto sub_qr = BruteForceSearchIterators(search_dataset,
|
||||||
chunk_data,
|
chunk_data,
|
||||||
size_per_chunk,
|
size_per_chunk,
|
||||||
info.search_params_,
|
info,
|
||||||
sub_view,
|
sub_view,
|
||||||
data_type);
|
data_type);
|
||||||
final_qr.merge(sub_qr);
|
final_qr.merge(sub_qr);
|
||||||
|
|
@ -119,7 +119,7 @@ SearchOnGrowing(const segcore::SegmentGrowingImpl& segment,
|
||||||
auto sub_qr = BruteForceSearch(search_dataset,
|
auto sub_qr = BruteForceSearch(search_dataset,
|
||||||
chunk_data,
|
chunk_data,
|
||||||
size_per_chunk,
|
size_per_chunk,
|
||||||
info.search_params_,
|
info,
|
||||||
sub_view,
|
sub_view,
|
||||||
data_type);
|
data_type);
|
||||||
|
|
||||||
|
|
|
||||||
|
|
@ -90,22 +90,13 @@ SearchOnSealed(const Schema& schema,
|
||||||
auto data_type = field.get_data_type();
|
auto data_type = field.get_data_type();
|
||||||
CheckBruteForceSearchParam(field, search_info);
|
CheckBruteForceSearchParam(field, search_info);
|
||||||
if (search_info.group_by_field_id_.has_value()) {
|
if (search_info.group_by_field_id_.has_value()) {
|
||||||
auto sub_qr = BruteForceSearchIterators(dataset,
|
auto sub_qr = BruteForceSearchIterators(
|
||||||
vec_data,
|
dataset, vec_data, row_count, search_info, bitset, data_type);
|
||||||
row_count,
|
|
||||||
search_info.search_params_,
|
|
||||||
bitset,
|
|
||||||
data_type);
|
|
||||||
result.AssembleChunkVectorIterators(
|
result.AssembleChunkVectorIterators(
|
||||||
num_queries, 1, -1, sub_qr.chunk_iterators());
|
num_queries, 1, -1, sub_qr.chunk_iterators());
|
||||||
} else {
|
} else {
|
||||||
auto sub_qr = BruteForceSearch(dataset,
|
auto sub_qr = BruteForceSearch(
|
||||||
vec_data,
|
dataset, vec_data, row_count, search_info, bitset, data_type);
|
||||||
row_count,
|
|
||||||
search_info.search_params_,
|
|
||||||
bitset,
|
|
||||||
data_type);
|
|
||||||
|
|
||||||
result.distances_ = std::move(sub_qr.mutable_distances());
|
result.distances_ = std::move(sub_qr.mutable_distances());
|
||||||
result.seg_offsets_ = std::move(sub_qr.mutable_seg_offsets());
|
result.seg_offsets_ = std::move(sub_qr.mutable_seg_offsets());
|
||||||
}
|
}
|
||||||
|
|
|
||||||
|
|
@ -226,7 +226,7 @@ AppendIndexV2(CTraceContext c_trace, CLoadIndexInfo c_load_index_info) {
|
||||||
index_info.index_engine_version = engine_version;
|
index_info.index_engine_version = engine_version;
|
||||||
|
|
||||||
auto ctx = milvus::tracer::TraceContext{
|
auto ctx = milvus::tracer::TraceContext{
|
||||||
c_trace.traceID, c_trace.spanID, c_trace.flag};
|
c_trace.traceID, c_trace.spanID, c_trace.traceFlags};
|
||||||
auto span = milvus::tracer::StartSpan("SegCoreLoadIndex", &ctx);
|
auto span = milvus::tracer::StartSpan("SegCoreLoadIndex", &ctx);
|
||||||
milvus::tracer::SetRootSpan(span);
|
milvus::tracer::SetRootSpan(span);
|
||||||
|
|
||||||
|
|
|
||||||
|
|
@ -9,6 +9,8 @@
|
||||||
// is distributed on an "AS IS" BASIS, WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express
|
// is distributed on an "AS IS" BASIS, WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express
|
||||||
// or implied. See the License for the specific language governing permissions and limitations under the License
|
// or implied. See the License for the specific language governing permissions and limitations under the License
|
||||||
|
|
||||||
|
#pragma once
|
||||||
|
|
||||||
#ifdef __cplusplus
|
#ifdef __cplusplus
|
||||||
extern "C" {
|
extern "C" {
|
||||||
#endif
|
#endif
|
||||||
|
|
@ -25,13 +27,13 @@ typedef void* CRetrievePlan;
|
||||||
|
|
||||||
// Note: serialized_expr_plan is of binary format
|
// Note: serialized_expr_plan is of binary format
|
||||||
CStatus
|
CStatus
|
||||||
CreateSearchPlanByExpr(CCollection col,
|
CreateSearchPlanByExpr(CCollection c_col,
|
||||||
const void* serialized_expr_plan,
|
const void* serialized_expr_plan,
|
||||||
const int64_t size,
|
const int64_t size,
|
||||||
CSearchPlan* res_plan);
|
CSearchPlan* res_plan);
|
||||||
|
|
||||||
CStatus
|
CStatus
|
||||||
ParsePlaceholderGroup(CSearchPlan plan,
|
ParsePlaceholderGroup(CSearchPlan c_plan,
|
||||||
const void* placeholder_group_blob,
|
const void* placeholder_group_blob,
|
||||||
const int64_t blob_size,
|
const int64_t blob_size,
|
||||||
CPlaceholderGroup* res_placeholder_group);
|
CPlaceholderGroup* res_placeholder_group);
|
||||||
|
|
|
||||||
|
|
@ -82,10 +82,10 @@ DeleteSearchResult(CSearchResult search_result) {
|
||||||
}
|
}
|
||||||
|
|
||||||
CStatus
|
CStatus
|
||||||
Search(CSegmentInterface c_segment,
|
Search(CTraceContext c_trace,
|
||||||
|
CSegmentInterface c_segment,
|
||||||
CSearchPlan c_plan,
|
CSearchPlan c_plan,
|
||||||
CPlaceholderGroup c_placeholder_group,
|
CPlaceholderGroup c_placeholder_group,
|
||||||
CTraceContext c_trace,
|
|
||||||
uint64_t timestamp,
|
uint64_t timestamp,
|
||||||
CSearchResult* result) {
|
CSearchResult* result) {
|
||||||
try {
|
try {
|
||||||
|
|
@ -93,10 +93,16 @@ Search(CSegmentInterface c_segment,
|
||||||
auto plan = (milvus::query::Plan*)c_plan;
|
auto plan = (milvus::query::Plan*)c_plan;
|
||||||
auto phg_ptr = reinterpret_cast<const milvus::query::PlaceholderGroup*>(
|
auto phg_ptr = reinterpret_cast<const milvus::query::PlaceholderGroup*>(
|
||||||
c_placeholder_group);
|
c_placeholder_group);
|
||||||
auto ctx = milvus::tracer::TraceContext{
|
|
||||||
c_trace.traceID, c_trace.spanID, c_trace.flag};
|
// save trace context into search_info
|
||||||
auto span = milvus::tracer::StartSpan("SegCoreSearch", &ctx);
|
auto& trace_ctx = plan->plan_node_->search_info_.trace_ctx_;
|
||||||
|
trace_ctx.traceID = c_trace.traceID;
|
||||||
|
trace_ctx.spanID = c_trace.spanID;
|
||||||
|
trace_ctx.traceFlags = c_trace.traceFlags;
|
||||||
|
|
||||||
|
auto span = milvus::tracer::StartSpan("SegCoreSearch", &trace_ctx);
|
||||||
milvus::tracer::SetRootSpan(span);
|
milvus::tracer::SetRootSpan(span);
|
||||||
|
|
||||||
auto search_result = segment->Search(plan, phg_ptr, timestamp);
|
auto search_result = segment->Search(plan, phg_ptr, timestamp);
|
||||||
if (!milvus::PositivelyRelated(
|
if (!milvus::PositivelyRelated(
|
||||||
plan->plan_node_->search_info_.metric_type_)) {
|
plan->plan_node_->search_info_.metric_type_)) {
|
||||||
|
|
@ -119,9 +125,9 @@ DeleteRetrieveResult(CRetrieveResult* retrieve_result) {
|
||||||
}
|
}
|
||||||
|
|
||||||
CStatus
|
CStatus
|
||||||
Retrieve(CSegmentInterface c_segment,
|
Retrieve(CTraceContext c_trace,
|
||||||
|
CSegmentInterface c_segment,
|
||||||
CRetrievePlan c_plan,
|
CRetrievePlan c_plan,
|
||||||
CTraceContext c_trace,
|
|
||||||
uint64_t timestamp,
|
uint64_t timestamp,
|
||||||
CRetrieveResult* result,
|
CRetrieveResult* result,
|
||||||
int64_t limit_size) {
|
int64_t limit_size) {
|
||||||
|
|
@ -130,9 +136,10 @@ Retrieve(CSegmentInterface c_segment,
|
||||||
static_cast<milvus::segcore::SegmentInterface*>(c_segment);
|
static_cast<milvus::segcore::SegmentInterface*>(c_segment);
|
||||||
auto plan = static_cast<const milvus::query::RetrievePlan*>(c_plan);
|
auto plan = static_cast<const milvus::query::RetrievePlan*>(c_plan);
|
||||||
|
|
||||||
auto ctx = milvus::tracer::TraceContext{
|
auto trace_ctx = milvus::tracer::TraceContext{
|
||||||
c_trace.traceID, c_trace.spanID, c_trace.flag};
|
c_trace.traceID, c_trace.spanID, c_trace.traceFlags};
|
||||||
auto span = milvus::tracer::StartSpan("SegCoreRetrieve", &ctx);
|
auto span = milvus::tracer::StartSpan("SegCoreRetrieve", &trace_ctx);
|
||||||
|
milvus::tracer::SetRootSpan(span);
|
||||||
|
|
||||||
auto retrieve_result = segment->Retrieve(plan, timestamp, limit_size);
|
auto retrieve_result = segment->Retrieve(plan, timestamp, limit_size);
|
||||||
|
|
||||||
|
|
|
||||||
|
|
@ -44,10 +44,10 @@ void
|
||||||
DeleteSearchResult(CSearchResult search_result);
|
DeleteSearchResult(CSearchResult search_result);
|
||||||
|
|
||||||
CStatus
|
CStatus
|
||||||
Search(CSegmentInterface c_segment,
|
Search(CTraceContext c_trace,
|
||||||
|
CSegmentInterface c_segment,
|
||||||
CSearchPlan c_plan,
|
CSearchPlan c_plan,
|
||||||
CPlaceholderGroup c_placeholder_group,
|
CPlaceholderGroup c_placeholder_group,
|
||||||
CTraceContext c_trace,
|
|
||||||
uint64_t timestamp,
|
uint64_t timestamp,
|
||||||
CSearchResult* result);
|
CSearchResult* result);
|
||||||
|
|
||||||
|
|
@ -55,9 +55,9 @@ void
|
||||||
DeleteRetrieveResult(CRetrieveResult* retrieve_result);
|
DeleteRetrieveResult(CRetrieveResult* retrieve_result);
|
||||||
|
|
||||||
CStatus
|
CStatus
|
||||||
Retrieve(CSegmentInterface c_segment,
|
Retrieve(CTraceContext c_trace,
|
||||||
|
CSegmentInterface c_segment,
|
||||||
CRetrievePlan c_plan,
|
CRetrievePlan c_plan,
|
||||||
CTraceContext c_trace,
|
|
||||||
uint64_t timestamp,
|
uint64_t timestamp,
|
||||||
CRetrieveResult* result,
|
CRetrieveResult* result,
|
||||||
int64_t limit_size);
|
int64_t limit_size);
|
||||||
|
|
|
||||||
|
|
@ -17,7 +17,10 @@
|
||||||
#include <chrono>
|
#include <chrono>
|
||||||
|
|
||||||
#include "common/Types.h"
|
#include "common/Types.h"
|
||||||
|
#include "expr/ITypeExpr.h"
|
||||||
|
#include "index/IndexFactory.h"
|
||||||
#include "pb/plan.pb.h"
|
#include "pb/plan.pb.h"
|
||||||
|
#include "plan/PlanNode.h"
|
||||||
#include "query/Expr.h"
|
#include "query/Expr.h"
|
||||||
#include "query/ExprImpl.h"
|
#include "query/ExprImpl.h"
|
||||||
#include "query/Plan.h"
|
#include "query/Plan.h"
|
||||||
|
|
@ -26,14 +29,12 @@
|
||||||
#include "segcore/SegmentGrowingImpl.h"
|
#include "segcore/SegmentGrowingImpl.h"
|
||||||
#include "simdjson/padded_string.h"
|
#include "simdjson/padded_string.h"
|
||||||
#include "test_utils/DataGen.h"
|
#include "test_utils/DataGen.h"
|
||||||
#include "index/IndexFactory.h"
|
|
||||||
#include "expr/ITypeExpr.h"
|
using namespace milvus;
|
||||||
#include "plan/PlanNode.h"
|
using namespace milvus::query;
|
||||||
|
using namespace milvus::segcore;
|
||||||
|
|
||||||
TEST(Expr, TestArrayRange) {
|
TEST(Expr, TestArrayRange) {
|
||||||
using namespace milvus;
|
|
||||||
using namespace milvus::query;
|
|
||||||
using namespace milvus::segcore;
|
|
||||||
std::vector<std::tuple<std::string,
|
std::vector<std::tuple<std::string,
|
||||||
std::string,
|
std::string,
|
||||||
std::function<bool(milvus::Array & array)>>>
|
std::function<bool(milvus::Array & array)>>>
|
||||||
|
|
@ -622,9 +623,6 @@ TEST(Expr, TestArrayRange) {
|
||||||
}
|
}
|
||||||
|
|
||||||
TEST(Expr, TestArrayEqual) {
|
TEST(Expr, TestArrayEqual) {
|
||||||
using namespace milvus;
|
|
||||||
using namespace milvus::query;
|
|
||||||
using namespace milvus::segcore;
|
|
||||||
std::vector<
|
std::vector<
|
||||||
std::tuple<std::string, std::function<bool(std::vector<int64_t>)>>>
|
std::tuple<std::string, std::function<bool(std::vector<int64_t>)>>>
|
||||||
testcases = {
|
testcases = {
|
||||||
|
|
@ -746,10 +744,6 @@ TEST(Expr, TestArrayEqual) {
|
||||||
}
|
}
|
||||||
|
|
||||||
TEST(Expr, PraseArrayContainsExpr) {
|
TEST(Expr, PraseArrayContainsExpr) {
|
||||||
using namespace milvus;
|
|
||||||
using namespace milvus::query;
|
|
||||||
using namespace milvus::segcore;
|
|
||||||
|
|
||||||
std::vector<const char*> raw_plans{
|
std::vector<const char*> raw_plans{
|
||||||
R"(vector_anns:<
|
R"(vector_anns:<
|
||||||
field_id:100
|
field_id:100
|
||||||
|
|
@ -835,10 +829,6 @@ struct ArrayTestcase {
|
||||||
};
|
};
|
||||||
|
|
||||||
TEST(Expr, TestArrayContains) {
|
TEST(Expr, TestArrayContains) {
|
||||||
using namespace milvus;
|
|
||||||
using namespace milvus::query;
|
|
||||||
using namespace milvus::segcore;
|
|
||||||
|
|
||||||
auto schema = std::make_shared<Schema>();
|
auto schema = std::make_shared<Schema>();
|
||||||
auto i64_fid = schema->AddDebugField("id", DataType::INT64);
|
auto i64_fid = schema->AddDebugField("id", DataType::INT64);
|
||||||
auto int_array_fid =
|
auto int_array_fid =
|
||||||
|
|
@ -1198,10 +1188,6 @@ TEST(Expr, TestArrayContains) {
|
||||||
}
|
}
|
||||||
|
|
||||||
TEST(Expr, TestArrayBinaryArith) {
|
TEST(Expr, TestArrayBinaryArith) {
|
||||||
using namespace milvus;
|
|
||||||
using namespace milvus::query;
|
|
||||||
using namespace milvus::segcore;
|
|
||||||
|
|
||||||
auto schema = std::make_shared<Schema>();
|
auto schema = std::make_shared<Schema>();
|
||||||
auto i64_fid = schema->AddDebugField("id", DataType::INT64);
|
auto i64_fid = schema->AddDebugField("id", DataType::INT64);
|
||||||
auto int_array_fid =
|
auto int_array_fid =
|
||||||
|
|
@ -1765,10 +1751,6 @@ struct UnaryRangeTestcase {
|
||||||
};
|
};
|
||||||
|
|
||||||
TEST(Expr, TestArrayStringMatch) {
|
TEST(Expr, TestArrayStringMatch) {
|
||||||
using namespace milvus;
|
|
||||||
using namespace milvus::query;
|
|
||||||
using namespace milvus::segcore;
|
|
||||||
|
|
||||||
auto schema = std::make_shared<Schema>();
|
auto schema = std::make_shared<Schema>();
|
||||||
auto i64_fid = schema->AddDebugField("id", DataType::INT64);
|
auto i64_fid = schema->AddDebugField("id", DataType::INT64);
|
||||||
auto string_array_fid = schema->AddDebugField(
|
auto string_array_fid = schema->AddDebugField(
|
||||||
|
|
@ -1850,10 +1832,6 @@ TEST(Expr, TestArrayStringMatch) {
|
||||||
}
|
}
|
||||||
|
|
||||||
TEST(Expr, TestArrayInTerm) {
|
TEST(Expr, TestArrayInTerm) {
|
||||||
using namespace milvus;
|
|
||||||
using namespace milvus::query;
|
|
||||||
using namespace milvus::segcore;
|
|
||||||
|
|
||||||
auto schema = std::make_shared<Schema>();
|
auto schema = std::make_shared<Schema>();
|
||||||
auto i64_fid = schema->AddDebugField("id", DataType::INT64);
|
auto i64_fid = schema->AddDebugField("id", DataType::INT64);
|
||||||
auto long_array_fid =
|
auto long_array_fid =
|
||||||
|
|
@ -2057,10 +2035,6 @@ TEST(Expr, TestArrayInTerm) {
|
||||||
}
|
}
|
||||||
|
|
||||||
TEST(Expr, TestTermInArray) {
|
TEST(Expr, TestTermInArray) {
|
||||||
using namespace milvus;
|
|
||||||
using namespace milvus::query;
|
|
||||||
using namespace milvus::segcore;
|
|
||||||
|
|
||||||
auto schema = std::make_shared<Schema>();
|
auto schema = std::make_shared<Schema>();
|
||||||
auto i64_fid = schema->AddDebugField("id", DataType::INT64);
|
auto i64_fid = schema->AddDebugField("id", DataType::INT64);
|
||||||
auto long_array_fid =
|
auto long_array_fid =
|
||||||
|
|
|
||||||
|
|
@ -130,10 +130,13 @@ class TestFloatSearchBruteForce : public ::testing::Test {
|
||||||
// ASSERT_ANY_THROW(BruteForceSearch(dataset, base.data(), nb, bitset_view));
|
// ASSERT_ANY_THROW(BruteForceSearch(dataset, base.data(), nb, bitset_view));
|
||||||
return;
|
return;
|
||||||
}
|
}
|
||||||
|
SearchInfo search_info;
|
||||||
|
search_info.topk_ = topk;
|
||||||
|
search_info.metric_type_ = metric_type;
|
||||||
auto result = BruteForceSearch(dataset,
|
auto result = BruteForceSearch(dataset,
|
||||||
base.data(),
|
base.data(),
|
||||||
nb,
|
nb,
|
||||||
knowhere::Json(),
|
search_info,
|
||||||
bitset_view,
|
bitset_view,
|
||||||
DataType::VECTOR_FLOAT);
|
DataType::VECTOR_FLOAT);
|
||||||
for (int i = 0; i < nq; i++) {
|
for (int i = 0; i < nq; i++) {
|
||||||
|
|
|
||||||
|
|
@ -13,18 +13,18 @@
|
||||||
#include <boost/format.hpp>
|
#include <boost/format.hpp>
|
||||||
#include <regex>
|
#include <regex>
|
||||||
|
|
||||||
|
#include "index/IndexFactory.h"
|
||||||
|
#include "knowhere/comp/brute_force.h"
|
||||||
#include "pb/plan.pb.h"
|
#include "pb/plan.pb.h"
|
||||||
|
#include "pb/schema.pb.h"
|
||||||
|
#include "query/Plan.h"
|
||||||
#include "segcore/segcore_init_c.h"
|
#include "segcore/segcore_init_c.h"
|
||||||
#include "segcore/SegmentSealed.h"
|
#include "segcore/SegmentSealed.h"
|
||||||
#include "segcore/SegmentSealedImpl.h"
|
#include "segcore/SegmentSealedImpl.h"
|
||||||
#include "pb/schema.pb.h"
|
|
||||||
#include "test_utils/DataGen.h"
|
#include "test_utils/DataGen.h"
|
||||||
#include "index/IndexFactory.h"
|
|
||||||
#include "query/Plan.h"
|
|
||||||
#include "knowhere/comp/brute_force.h"
|
|
||||||
|
|
||||||
using namespace milvus::segcore;
|
|
||||||
using namespace milvus;
|
using namespace milvus;
|
||||||
|
using namespace milvus::segcore;
|
||||||
namespace pb = milvus::proto;
|
namespace pb = milvus::proto;
|
||||||
|
|
||||||
std::shared_ptr<float[]>
|
std::shared_ptr<float[]>
|
||||||
|
|
|
||||||
|
|
@ -46,8 +46,9 @@
|
||||||
namespace chrono = std::chrono;
|
namespace chrono = std::chrono;
|
||||||
|
|
||||||
using namespace milvus;
|
using namespace milvus;
|
||||||
using namespace milvus::segcore;
|
|
||||||
using namespace milvus::index;
|
using namespace milvus::index;
|
||||||
|
using namespace milvus::segcore;
|
||||||
|
using namespace milvus::tracer;
|
||||||
using namespace knowhere;
|
using namespace knowhere;
|
||||||
using milvus::index::VectorIndex;
|
using milvus::index::VectorIndex;
|
||||||
using milvus::segcore::LoadIndexInfo;
|
using milvus::segcore::LoadIndexInfo;
|
||||||
|
|
@ -57,14 +58,23 @@ namespace {
|
||||||
const int64_t ROW_COUNT = 10 * 1000;
|
const int64_t ROW_COUNT = 10 * 1000;
|
||||||
const int64_t BIAS = 4200;
|
const int64_t BIAS = 4200;
|
||||||
|
|
||||||
|
CStatus
|
||||||
|
CSearch(CSegmentInterface c_segment,
|
||||||
|
CSearchPlan c_plan,
|
||||||
|
CPlaceholderGroup c_placeholder_group,
|
||||||
|
uint64_t timestamp,
|
||||||
|
CSearchResult* result) {
|
||||||
|
return Search(
|
||||||
|
{}, c_segment, c_plan, c_placeholder_group, timestamp, result);
|
||||||
|
}
|
||||||
|
|
||||||
CStatus
|
CStatus
|
||||||
CRetrieve(CSegmentInterface c_segment,
|
CRetrieve(CSegmentInterface c_segment,
|
||||||
CRetrievePlan c_plan,
|
CRetrievePlan c_plan,
|
||||||
CTraceContext c_trace,
|
|
||||||
uint64_t timestamp,
|
uint64_t timestamp,
|
||||||
CRetrieveResult* result) {
|
CRetrieveResult* result) {
|
||||||
return Retrieve(
|
return Retrieve(
|
||||||
c_segment, c_plan, c_trace, timestamp, result, DEFAULT_MAX_OUTPUT_SIZE);
|
{}, c_segment, c_plan, timestamp, result, DEFAULT_MAX_OUTPUT_SIZE);
|
||||||
}
|
}
|
||||||
|
|
||||||
const char*
|
const char*
|
||||||
|
|
@ -675,7 +685,7 @@ TEST(CApiTest, MultiDeleteGrowingSegment) {
|
||||||
auto max_ts = dataset.timestamps_[N - 1] + 10;
|
auto max_ts = dataset.timestamps_[N - 1] + 10;
|
||||||
|
|
||||||
CRetrieveResult retrieve_result;
|
CRetrieveResult retrieve_result;
|
||||||
res = CRetrieve(segment, plan.get(), {}, max_ts, &retrieve_result);
|
res = CRetrieve(segment, plan.get(), max_ts, &retrieve_result);
|
||||||
ASSERT_EQ(res.error_code, Success);
|
ASSERT_EQ(res.error_code, Success);
|
||||||
auto query_result = std::make_unique<proto::segcore::RetrieveResults>();
|
auto query_result = std::make_unique<proto::segcore::RetrieveResults>();
|
||||||
auto suc = query_result->ParseFromArray(retrieve_result.proto_blob,
|
auto suc = query_result->ParseFromArray(retrieve_result.proto_blob,
|
||||||
|
|
@ -696,7 +706,7 @@ TEST(CApiTest, MultiDeleteGrowingSegment) {
|
||||||
retrive_pks);
|
retrive_pks);
|
||||||
plan->plan_node_->filter_plannode_ =
|
plan->plan_node_->filter_plannode_ =
|
||||||
std::make_shared<plan::FilterBitsNode>(DEFAULT_PLANNODE_ID, term_expr);
|
std::make_shared<plan::FilterBitsNode>(DEFAULT_PLANNODE_ID, term_expr);
|
||||||
res = CRetrieve(segment, plan.get(), {}, max_ts, &retrieve_result);
|
res = CRetrieve(segment, plan.get(), max_ts, &retrieve_result);
|
||||||
ASSERT_EQ(res.error_code, Success);
|
ASSERT_EQ(res.error_code, Success);
|
||||||
suc = query_result->ParseFromArray(retrieve_result.proto_blob,
|
suc = query_result->ParseFromArray(retrieve_result.proto_blob,
|
||||||
retrieve_result.proto_size);
|
retrieve_result.proto_size);
|
||||||
|
|
@ -721,7 +731,7 @@ TEST(CApiTest, MultiDeleteGrowingSegment) {
|
||||||
ASSERT_EQ(del_res.error_code, Success);
|
ASSERT_EQ(del_res.error_code, Success);
|
||||||
|
|
||||||
// retrieve pks in {2}
|
// retrieve pks in {2}
|
||||||
res = CRetrieve(segment, plan.get(), {}, max_ts, &retrieve_result);
|
res = CRetrieve(segment, plan.get(), max_ts, &retrieve_result);
|
||||||
ASSERT_EQ(res.error_code, Success);
|
ASSERT_EQ(res.error_code, Success);
|
||||||
suc = query_result->ParseFromArray(retrieve_result.proto_blob,
|
suc = query_result->ParseFromArray(retrieve_result.proto_blob,
|
||||||
retrieve_result.proto_size);
|
retrieve_result.proto_size);
|
||||||
|
|
@ -787,7 +797,7 @@ TEST(CApiTest, MultiDeleteSealedSegment) {
|
||||||
auto max_ts = dataset.timestamps_[N - 1] + 10;
|
auto max_ts = dataset.timestamps_[N - 1] + 10;
|
||||||
|
|
||||||
CRetrieveResult retrieve_result;
|
CRetrieveResult retrieve_result;
|
||||||
auto res = CRetrieve(segment, plan.get(), {}, max_ts, &retrieve_result);
|
auto res = CRetrieve(segment, plan.get(), max_ts, &retrieve_result);
|
||||||
ASSERT_EQ(res.error_code, Success);
|
ASSERT_EQ(res.error_code, Success);
|
||||||
auto query_result = std::make_unique<proto::segcore::RetrieveResults>();
|
auto query_result = std::make_unique<proto::segcore::RetrieveResults>();
|
||||||
auto suc = query_result->ParseFromArray(retrieve_result.proto_blob,
|
auto suc = query_result->ParseFromArray(retrieve_result.proto_blob,
|
||||||
|
|
@ -808,7 +818,7 @@ TEST(CApiTest, MultiDeleteSealedSegment) {
|
||||||
retrive_pks);
|
retrive_pks);
|
||||||
plan->plan_node_->filter_plannode_ =
|
plan->plan_node_->filter_plannode_ =
|
||||||
std::make_shared<plan::FilterBitsNode>(DEFAULT_PLANNODE_ID, term_expr);
|
std::make_shared<plan::FilterBitsNode>(DEFAULT_PLANNODE_ID, term_expr);
|
||||||
res = CRetrieve(segment, plan.get(), {}, max_ts, &retrieve_result);
|
res = CRetrieve(segment, plan.get(), max_ts, &retrieve_result);
|
||||||
ASSERT_EQ(res.error_code, Success);
|
ASSERT_EQ(res.error_code, Success);
|
||||||
suc = query_result->ParseFromArray(retrieve_result.proto_blob,
|
suc = query_result->ParseFromArray(retrieve_result.proto_blob,
|
||||||
retrieve_result.proto_size);
|
retrieve_result.proto_size);
|
||||||
|
|
@ -833,7 +843,7 @@ TEST(CApiTest, MultiDeleteSealedSegment) {
|
||||||
ASSERT_EQ(del_res.error_code, Success);
|
ASSERT_EQ(del_res.error_code, Success);
|
||||||
|
|
||||||
// retrieve pks in {2}
|
// retrieve pks in {2}
|
||||||
res = CRetrieve(segment, plan.get(), {}, max_ts, &retrieve_result);
|
res = CRetrieve(segment, plan.get(), max_ts, &retrieve_result);
|
||||||
ASSERT_EQ(res.error_code, Success);
|
ASSERT_EQ(res.error_code, Success);
|
||||||
suc = query_result->ParseFromArray(retrieve_result.proto_blob,
|
suc = query_result->ParseFromArray(retrieve_result.proto_blob,
|
||||||
retrieve_result.proto_size);
|
retrieve_result.proto_size);
|
||||||
|
|
@ -906,7 +916,7 @@ TEST(CApiTest, DeleteRepeatedPksFromGrowingSegment) {
|
||||||
|
|
||||||
CRetrieveResult retrieve_result;
|
CRetrieveResult retrieve_result;
|
||||||
res = CRetrieve(
|
res = CRetrieve(
|
||||||
segment, plan.get(), {}, dataset.timestamps_[N - 1], &retrieve_result);
|
segment, plan.get(), dataset.timestamps_[N - 1], &retrieve_result);
|
||||||
ASSERT_EQ(res.error_code, Success);
|
ASSERT_EQ(res.error_code, Success);
|
||||||
auto query_result = std::make_unique<proto::segcore::RetrieveResults>();
|
auto query_result = std::make_unique<proto::segcore::RetrieveResults>();
|
||||||
auto suc = query_result->ParseFromArray(retrieve_result.proto_blob,
|
auto suc = query_result->ParseFromArray(retrieve_result.proto_blob,
|
||||||
|
|
@ -934,7 +944,7 @@ TEST(CApiTest, DeleteRepeatedPksFromGrowingSegment) {
|
||||||
|
|
||||||
// retrieve pks in {1, 2, 3}
|
// retrieve pks in {1, 2, 3}
|
||||||
res = CRetrieve(
|
res = CRetrieve(
|
||||||
segment, plan.get(), {}, dataset.timestamps_[N - 1], &retrieve_result);
|
segment, plan.get(), dataset.timestamps_[N - 1], &retrieve_result);
|
||||||
ASSERT_EQ(res.error_code, Success);
|
ASSERT_EQ(res.error_code, Success);
|
||||||
|
|
||||||
query_result = std::make_unique<proto::segcore::RetrieveResults>();
|
query_result = std::make_unique<proto::segcore::RetrieveResults>();
|
||||||
|
|
@ -987,7 +997,7 @@ TEST(CApiTest, DeleteRepeatedPksFromSealedSegment) {
|
||||||
|
|
||||||
CRetrieveResult retrieve_result;
|
CRetrieveResult retrieve_result;
|
||||||
auto res = CRetrieve(
|
auto res = CRetrieve(
|
||||||
segment, plan.get(), {}, dataset.timestamps_[N - 1], &retrieve_result);
|
segment, plan.get(), dataset.timestamps_[N - 1], &retrieve_result);
|
||||||
ASSERT_EQ(res.error_code, Success);
|
ASSERT_EQ(res.error_code, Success);
|
||||||
auto query_result = std::make_unique<proto::segcore::RetrieveResults>();
|
auto query_result = std::make_unique<proto::segcore::RetrieveResults>();
|
||||||
auto suc = query_result->ParseFromArray(retrieve_result.proto_blob,
|
auto suc = query_result->ParseFromArray(retrieve_result.proto_blob,
|
||||||
|
|
@ -1016,7 +1026,7 @@ TEST(CApiTest, DeleteRepeatedPksFromSealedSegment) {
|
||||||
|
|
||||||
// retrieve pks in {1, 2, 3}
|
// retrieve pks in {1, 2, 3}
|
||||||
res = CRetrieve(
|
res = CRetrieve(
|
||||||
segment, plan.get(), {}, dataset.timestamps_[N - 1], &retrieve_result);
|
segment, plan.get(), dataset.timestamps_[N - 1], &retrieve_result);
|
||||||
ASSERT_EQ(res.error_code, Success);
|
ASSERT_EQ(res.error_code, Success);
|
||||||
|
|
||||||
query_result = std::make_unique<proto::segcore::RetrieveResults>();
|
query_result = std::make_unique<proto::segcore::RetrieveResults>();
|
||||||
|
|
@ -1097,7 +1107,7 @@ TEST(CApiTest, InsertSamePkAfterDeleteOnGrowingSegment) {
|
||||||
|
|
||||||
CRetrieveResult retrieve_result;
|
CRetrieveResult retrieve_result;
|
||||||
res = CRetrieve(
|
res = CRetrieve(
|
||||||
segment, plan.get(), {}, dataset.timestamps_[N - 1], &retrieve_result);
|
segment, plan.get(), dataset.timestamps_[N - 1], &retrieve_result);
|
||||||
ASSERT_EQ(res.error_code, Success);
|
ASSERT_EQ(res.error_code, Success);
|
||||||
auto query_result = std::make_unique<proto::segcore::RetrieveResults>();
|
auto query_result = std::make_unique<proto::segcore::RetrieveResults>();
|
||||||
auto suc = query_result->ParseFromArray(retrieve_result.proto_blob,
|
auto suc = query_result->ParseFromArray(retrieve_result.proto_blob,
|
||||||
|
|
@ -1122,7 +1132,7 @@ TEST(CApiTest, InsertSamePkAfterDeleteOnGrowingSegment) {
|
||||||
|
|
||||||
// retrieve pks in {1, 2, 3}, timestamp = 19
|
// retrieve pks in {1, 2, 3}, timestamp = 19
|
||||||
res = CRetrieve(
|
res = CRetrieve(
|
||||||
segment, plan.get(), {}, dataset.timestamps_[N - 1], &retrieve_result);
|
segment, plan.get(), dataset.timestamps_[N - 1], &retrieve_result);
|
||||||
ASSERT_EQ(res.error_code, Success);
|
ASSERT_EQ(res.error_code, Success);
|
||||||
|
|
||||||
query_result = std::make_unique<proto::segcore::RetrieveResults>();
|
query_result = std::make_unique<proto::segcore::RetrieveResults>();
|
||||||
|
|
@ -1194,7 +1204,7 @@ TEST(CApiTest, InsertSamePkAfterDeleteOnSealedSegment) {
|
||||||
|
|
||||||
CRetrieveResult retrieve_result;
|
CRetrieveResult retrieve_result;
|
||||||
auto res = CRetrieve(
|
auto res = CRetrieve(
|
||||||
segment, plan.get(), {}, dataset.timestamps_[N - 1], &retrieve_result);
|
segment, plan.get(), dataset.timestamps_[N - 1], &retrieve_result);
|
||||||
ASSERT_EQ(res.error_code, Success);
|
ASSERT_EQ(res.error_code, Success);
|
||||||
auto query_result = std::make_unique<proto::segcore::RetrieveResults>();
|
auto query_result = std::make_unique<proto::segcore::RetrieveResults>();
|
||||||
auto suc = query_result->ParseFromArray(retrieve_result.proto_blob,
|
auto suc = query_result->ParseFromArray(retrieve_result.proto_blob,
|
||||||
|
|
@ -1263,12 +1273,12 @@ TEST(CApiTest, SearchTest) {
|
||||||
|
|
||||||
CSearchResult search_result;
|
CSearchResult search_result;
|
||||||
auto res =
|
auto res =
|
||||||
Search(segment, plan, placeholderGroup, {}, ts_offset, &search_result);
|
CSearch(segment, plan, placeholderGroup, ts_offset, &search_result);
|
||||||
ASSERT_EQ(res.error_code, Success);
|
ASSERT_EQ(res.error_code, Success);
|
||||||
|
|
||||||
CSearchResult search_result2;
|
CSearchResult search_result2;
|
||||||
auto res2 =
|
auto res2 =
|
||||||
Search(segment, plan, placeholderGroup, {}, ts_offset, &search_result2);
|
CSearch(segment, plan, placeholderGroup, ts_offset, &search_result2);
|
||||||
ASSERT_EQ(res2.error_code, Success);
|
ASSERT_EQ(res2.error_code, Success);
|
||||||
|
|
||||||
DeleteSearchPlan(plan);
|
DeleteSearchPlan(plan);
|
||||||
|
|
@ -1332,12 +1342,11 @@ TEST(CApiTest, SearchTestWithExpr) {
|
||||||
dataset.timestamps_.push_back(1);
|
dataset.timestamps_.push_back(1);
|
||||||
|
|
||||||
CSearchResult search_result;
|
CSearchResult search_result;
|
||||||
auto res = Search(segment,
|
auto res = CSearch(segment,
|
||||||
plan,
|
plan,
|
||||||
placeholderGroup,
|
placeholderGroup,
|
||||||
{},
|
dataset.timestamps_[0],
|
||||||
dataset.timestamps_[0],
|
&search_result);
|
||||||
&search_result);
|
|
||||||
ASSERT_EQ(res.error_code, Success);
|
ASSERT_EQ(res.error_code, Success);
|
||||||
|
|
||||||
DeleteSearchPlan(plan);
|
DeleteSearchPlan(plan);
|
||||||
|
|
@ -1392,7 +1401,7 @@ TEST(CApiTest, RetrieveTestWithExpr) {
|
||||||
|
|
||||||
CRetrieveResult retrieve_result;
|
CRetrieveResult retrieve_result;
|
||||||
auto res = CRetrieve(
|
auto res = CRetrieve(
|
||||||
segment, plan.get(), {}, dataset.timestamps_[0], &retrieve_result);
|
segment, plan.get(), dataset.timestamps_[0], &retrieve_result);
|
||||||
ASSERT_EQ(res.error_code, Success);
|
ASSERT_EQ(res.error_code, Success);
|
||||||
|
|
||||||
DeleteRetrievePlan(plan.release());
|
DeleteRetrievePlan(plan.release());
|
||||||
|
|
@ -1621,7 +1630,7 @@ TEST(CApiTest, ReduceNullResult) {
|
||||||
auto slice_topKs = std::vector<int64_t>{1};
|
auto slice_topKs = std::vector<int64_t>{1};
|
||||||
std::vector<CSearchResult> results;
|
std::vector<CSearchResult> results;
|
||||||
CSearchResult res;
|
CSearchResult res;
|
||||||
status = Search(segment, plan, placeholderGroup, {}, 1L << 63, &res);
|
status = CSearch(segment, plan, placeholderGroup, 1L << 63, &res);
|
||||||
ASSERT_EQ(status.error_code, Success);
|
ASSERT_EQ(status.error_code, Success);
|
||||||
results.push_back(res);
|
results.push_back(res);
|
||||||
CSearchResultDataBlobs cSearchResultData;
|
CSearchResultDataBlobs cSearchResultData;
|
||||||
|
|
@ -1708,11 +1717,11 @@ TEST(CApiTest, ReduceRemoveDuplicates) {
|
||||||
auto slice_topKs = std::vector<int64_t>{topK / 2, topK};
|
auto slice_topKs = std::vector<int64_t>{topK / 2, topK};
|
||||||
std::vector<CSearchResult> results;
|
std::vector<CSearchResult> results;
|
||||||
CSearchResult res1, res2;
|
CSearchResult res1, res2;
|
||||||
status = Search(
|
status = CSearch(
|
||||||
segment, plan, placeholderGroup, {}, dataset.timestamps_[0], &res1);
|
segment, plan, placeholderGroup, dataset.timestamps_[0], &res1);
|
||||||
ASSERT_EQ(status.error_code, Success);
|
ASSERT_EQ(status.error_code, Success);
|
||||||
status = Search(
|
status = CSearch(
|
||||||
segment, plan, placeholderGroup, {}, dataset.timestamps_[0], &res2);
|
segment, plan, placeholderGroup, dataset.timestamps_[0], &res2);
|
||||||
ASSERT_EQ(status.error_code, Success);
|
ASSERT_EQ(status.error_code, Success);
|
||||||
results.push_back(res1);
|
results.push_back(res1);
|
||||||
results.push_back(res2);
|
results.push_back(res2);
|
||||||
|
|
@ -1741,14 +1750,14 @@ TEST(CApiTest, ReduceRemoveDuplicates) {
|
||||||
auto slice_topKs = std::vector<int64_t>{topK / 2, topK, topK};
|
auto slice_topKs = std::vector<int64_t>{topK / 2, topK, topK};
|
||||||
std::vector<CSearchResult> results;
|
std::vector<CSearchResult> results;
|
||||||
CSearchResult res1, res2, res3;
|
CSearchResult res1, res2, res3;
|
||||||
status = Search(
|
status = CSearch(
|
||||||
segment, plan, placeholderGroup, {}, dataset.timestamps_[0], &res1);
|
segment, plan, placeholderGroup, dataset.timestamps_[0], &res1);
|
||||||
ASSERT_EQ(status.error_code, Success);
|
ASSERT_EQ(status.error_code, Success);
|
||||||
status = Search(
|
status = CSearch(
|
||||||
segment, plan, placeholderGroup, {}, dataset.timestamps_[0], &res2);
|
segment, plan, placeholderGroup, dataset.timestamps_[0], &res2);
|
||||||
ASSERT_EQ(status.error_code, Success);
|
ASSERT_EQ(status.error_code, Success);
|
||||||
status = Search(
|
status = CSearch(
|
||||||
segment, plan, placeholderGroup, {}, dataset.timestamps_[0], &res3);
|
segment, plan, placeholderGroup, dataset.timestamps_[0], &res3);
|
||||||
ASSERT_EQ(status.error_code, Success);
|
ASSERT_EQ(status.error_code, Success);
|
||||||
results.push_back(res1);
|
results.push_back(res1);
|
||||||
results.push_back(res2);
|
results.push_back(res2);
|
||||||
|
|
@ -1865,11 +1874,11 @@ testReduceSearchWithExpr(int N,
|
||||||
std::vector<CSearchResult> results;
|
std::vector<CSearchResult> results;
|
||||||
CSearchResult res1;
|
CSearchResult res1;
|
||||||
CSearchResult res2;
|
CSearchResult res2;
|
||||||
auto res = Search(
|
auto res = CSearch(
|
||||||
segment, plan, placeholderGroup, {}, dataset.timestamps_[N - 1], &res1);
|
segment, plan, placeholderGroup, dataset.timestamps_[N - 1], &res1);
|
||||||
ASSERT_EQ(res.error_code, Success);
|
ASSERT_EQ(res.error_code, Success);
|
||||||
res = Search(
|
res = CSearch(
|
||||||
segment, plan, placeholderGroup, {}, dataset.timestamps_[N - 1], &res2);
|
segment, plan, placeholderGroup, dataset.timestamps_[N - 1], &res2);
|
||||||
ASSERT_EQ(res.error_code, Success);
|
ASSERT_EQ(res.error_code, Success);
|
||||||
results.push_back(res1);
|
results.push_back(res1);
|
||||||
results.push_back(res2);
|
results.push_back(res2);
|
||||||
|
|
@ -2104,12 +2113,11 @@ TEST(CApiTest, Indexing_Without_Predicate) {
|
||||||
Timestamp timestmap = 10000000;
|
Timestamp timestmap = 10000000;
|
||||||
|
|
||||||
CSearchResult c_search_result_on_smallIndex;
|
CSearchResult c_search_result_on_smallIndex;
|
||||||
auto res_before_load_index = Search(segment,
|
auto res_before_load_index = CSearch(segment,
|
||||||
plan,
|
plan,
|
||||||
placeholderGroup,
|
placeholderGroup,
|
||||||
{},
|
timestmap,
|
||||||
timestmap,
|
&c_search_result_on_smallIndex);
|
||||||
&c_search_result_on_smallIndex);
|
|
||||||
ASSERT_EQ(res_before_load_index.error_code, Success);
|
ASSERT_EQ(res_before_load_index.error_code, Success);
|
||||||
|
|
||||||
// load index to segment
|
// load index to segment
|
||||||
|
|
@ -2165,12 +2173,11 @@ TEST(CApiTest, Indexing_Without_Predicate) {
|
||||||
sealed_segment->LoadIndex(*(LoadIndexInfo*)c_load_index_info);
|
sealed_segment->LoadIndex(*(LoadIndexInfo*)c_load_index_info);
|
||||||
|
|
||||||
CSearchResult c_search_result_on_bigIndex;
|
CSearchResult c_search_result_on_bigIndex;
|
||||||
auto res_after_load_index = Search(sealed_segment.get(),
|
auto res_after_load_index = CSearch(sealed_segment.get(),
|
||||||
plan,
|
plan,
|
||||||
placeholderGroup,
|
placeholderGroup,
|
||||||
{},
|
timestmap,
|
||||||
timestmap,
|
&c_search_result_on_bigIndex);
|
||||||
&c_search_result_on_bigIndex);
|
|
||||||
ASSERT_EQ(res_after_load_index.error_code, Success);
|
ASSERT_EQ(res_after_load_index.error_code, Success);
|
||||||
|
|
||||||
auto search_result_on_raw_index_json =
|
auto search_result_on_raw_index_json =
|
||||||
|
|
@ -2255,12 +2262,11 @@ TEST(CApiTest, Indexing_Expr_Without_Predicate) {
|
||||||
Timestamp timestamp = 10000000;
|
Timestamp timestamp = 10000000;
|
||||||
|
|
||||||
CSearchResult c_search_result_on_smallIndex;
|
CSearchResult c_search_result_on_smallIndex;
|
||||||
auto res_before_load_index = Search(segment,
|
auto res_before_load_index = CSearch(segment,
|
||||||
plan,
|
plan,
|
||||||
placeholderGroup,
|
placeholderGroup,
|
||||||
{},
|
timestamp,
|
||||||
timestamp,
|
&c_search_result_on_smallIndex);
|
||||||
&c_search_result_on_smallIndex);
|
|
||||||
ASSERT_EQ(res_before_load_index.error_code, Success);
|
ASSERT_EQ(res_before_load_index.error_code, Success);
|
||||||
|
|
||||||
// load index to segment
|
// load index to segment
|
||||||
|
|
@ -2317,12 +2323,11 @@ TEST(CApiTest, Indexing_Expr_Without_Predicate) {
|
||||||
sealed_segment->LoadIndex(*(LoadIndexInfo*)c_load_index_info);
|
sealed_segment->LoadIndex(*(LoadIndexInfo*)c_load_index_info);
|
||||||
|
|
||||||
CSearchResult c_search_result_on_bigIndex;
|
CSearchResult c_search_result_on_bigIndex;
|
||||||
auto res_after_load_index = Search(sealed_segment.get(),
|
auto res_after_load_index = CSearch(sealed_segment.get(),
|
||||||
plan,
|
plan,
|
||||||
placeholderGroup,
|
placeholderGroup,
|
||||||
{},
|
timestamp,
|
||||||
timestamp,
|
&c_search_result_on_bigIndex);
|
||||||
&c_search_result_on_bigIndex);
|
|
||||||
ASSERT_EQ(res_after_load_index.error_code, Success);
|
ASSERT_EQ(res_after_load_index.error_code, Success);
|
||||||
|
|
||||||
auto search_result_on_raw_index_json =
|
auto search_result_on_raw_index_json =
|
||||||
|
|
@ -2435,12 +2440,11 @@ TEST(CApiTest, Indexing_With_float_Predicate_Range) {
|
||||||
Timestamp timestamp = 10000000;
|
Timestamp timestamp = 10000000;
|
||||||
|
|
||||||
CSearchResult c_search_result_on_smallIndex;
|
CSearchResult c_search_result_on_smallIndex;
|
||||||
auto res_before_load_index = Search(segment,
|
auto res_before_load_index = CSearch(segment,
|
||||||
plan,
|
plan,
|
||||||
placeholderGroup,
|
placeholderGroup,
|
||||||
{},
|
timestamp,
|
||||||
timestamp,
|
&c_search_result_on_smallIndex);
|
||||||
&c_search_result_on_smallIndex);
|
|
||||||
ASSERT_EQ(res_before_load_index.error_code, Success);
|
ASSERT_EQ(res_before_load_index.error_code, Success);
|
||||||
|
|
||||||
// load index to segment
|
// load index to segment
|
||||||
|
|
@ -2497,12 +2501,11 @@ TEST(CApiTest, Indexing_With_float_Predicate_Range) {
|
||||||
sealed_segment->LoadIndex(*(LoadIndexInfo*)c_load_index_info);
|
sealed_segment->LoadIndex(*(LoadIndexInfo*)c_load_index_info);
|
||||||
|
|
||||||
CSearchResult c_search_result_on_bigIndex;
|
CSearchResult c_search_result_on_bigIndex;
|
||||||
auto res_after_load_index = Search(sealed_segment.get(),
|
auto res_after_load_index = CSearch(sealed_segment.get(),
|
||||||
plan,
|
plan,
|
||||||
placeholderGroup,
|
placeholderGroup,
|
||||||
{},
|
timestamp,
|
||||||
timestamp,
|
&c_search_result_on_bigIndex);
|
||||||
&c_search_result_on_bigIndex);
|
|
||||||
ASSERT_EQ(res_after_load_index.error_code, Success);
|
ASSERT_EQ(res_after_load_index.error_code, Success);
|
||||||
|
|
||||||
auto search_result_on_bigIndex = (SearchResult*)c_search_result_on_bigIndex;
|
auto search_result_on_bigIndex = (SearchResult*)c_search_result_on_bigIndex;
|
||||||
|
|
@ -2617,12 +2620,11 @@ TEST(CApiTest, Indexing_Expr_With_float_Predicate_Range) {
|
||||||
Timestamp timestamp = 10000000;
|
Timestamp timestamp = 10000000;
|
||||||
|
|
||||||
CSearchResult c_search_result_on_smallIndex;
|
CSearchResult c_search_result_on_smallIndex;
|
||||||
auto res_before_load_index = Search(segment,
|
auto res_before_load_index = CSearch(segment,
|
||||||
plan,
|
plan,
|
||||||
placeholderGroup,
|
placeholderGroup,
|
||||||
{},
|
timestamp,
|
||||||
timestamp,
|
&c_search_result_on_smallIndex);
|
||||||
&c_search_result_on_smallIndex);
|
|
||||||
ASSERT_EQ(res_before_load_index.error_code, Success);
|
ASSERT_EQ(res_before_load_index.error_code, Success);
|
||||||
|
|
||||||
// load index to segment
|
// load index to segment
|
||||||
|
|
@ -2679,12 +2681,11 @@ TEST(CApiTest, Indexing_Expr_With_float_Predicate_Range) {
|
||||||
sealed_segment->LoadIndex(*(LoadIndexInfo*)c_load_index_info);
|
sealed_segment->LoadIndex(*(LoadIndexInfo*)c_load_index_info);
|
||||||
|
|
||||||
CSearchResult c_search_result_on_bigIndex;
|
CSearchResult c_search_result_on_bigIndex;
|
||||||
auto res_after_load_index = Search(sealed_segment.get(),
|
auto res_after_load_index = CSearch(sealed_segment.get(),
|
||||||
plan,
|
plan,
|
||||||
placeholderGroup,
|
placeholderGroup,
|
||||||
{},
|
timestamp,
|
||||||
timestamp,
|
&c_search_result_on_bigIndex);
|
||||||
&c_search_result_on_bigIndex);
|
|
||||||
ASSERT_EQ(res_after_load_index.error_code, Success);
|
ASSERT_EQ(res_after_load_index.error_code, Success);
|
||||||
|
|
||||||
auto search_result_on_bigIndex = (SearchResult*)c_search_result_on_bigIndex;
|
auto search_result_on_bigIndex = (SearchResult*)c_search_result_on_bigIndex;
|
||||||
|
|
@ -2791,12 +2792,11 @@ TEST(CApiTest, Indexing_With_float_Predicate_Term) {
|
||||||
Timestamp timestamp = 10000000;
|
Timestamp timestamp = 10000000;
|
||||||
|
|
||||||
CSearchResult c_search_result_on_smallIndex;
|
CSearchResult c_search_result_on_smallIndex;
|
||||||
auto res_before_load_index = Search(segment,
|
auto res_before_load_index = CSearch(segment,
|
||||||
plan,
|
plan,
|
||||||
placeholderGroup,
|
placeholderGroup,
|
||||||
{},
|
timestamp,
|
||||||
timestamp,
|
&c_search_result_on_smallIndex);
|
||||||
&c_search_result_on_smallIndex);
|
|
||||||
ASSERT_EQ(res_before_load_index.error_code, Success);
|
ASSERT_EQ(res_before_load_index.error_code, Success);
|
||||||
|
|
||||||
// load index to segment
|
// load index to segment
|
||||||
|
|
@ -2853,12 +2853,11 @@ TEST(CApiTest, Indexing_With_float_Predicate_Term) {
|
||||||
sealed_segment->LoadIndex(*(LoadIndexInfo*)c_load_index_info);
|
sealed_segment->LoadIndex(*(LoadIndexInfo*)c_load_index_info);
|
||||||
|
|
||||||
CSearchResult c_search_result_on_bigIndex;
|
CSearchResult c_search_result_on_bigIndex;
|
||||||
auto res_after_load_index = Search(sealed_segment.get(),
|
auto res_after_load_index = CSearch(sealed_segment.get(),
|
||||||
plan,
|
plan,
|
||||||
placeholderGroup,
|
placeholderGroup,
|
||||||
{},
|
timestamp,
|
||||||
timestamp,
|
&c_search_result_on_bigIndex);
|
||||||
&c_search_result_on_bigIndex);
|
|
||||||
ASSERT_EQ(res_after_load_index.error_code, Success);
|
ASSERT_EQ(res_after_load_index.error_code, Success);
|
||||||
|
|
||||||
auto search_result_on_bigIndex = (SearchResult*)c_search_result_on_bigIndex;
|
auto search_result_on_bigIndex = (SearchResult*)c_search_result_on_bigIndex;
|
||||||
|
|
@ -2966,12 +2965,11 @@ TEST(CApiTest, Indexing_Expr_With_float_Predicate_Term) {
|
||||||
Timestamp timestamp = 10000000;
|
Timestamp timestamp = 10000000;
|
||||||
|
|
||||||
CSearchResult c_search_result_on_smallIndex;
|
CSearchResult c_search_result_on_smallIndex;
|
||||||
auto res_before_load_index = Search(segment,
|
auto res_before_load_index = CSearch(segment,
|
||||||
plan,
|
plan,
|
||||||
placeholderGroup,
|
placeholderGroup,
|
||||||
{},
|
timestamp,
|
||||||
timestamp,
|
&c_search_result_on_smallIndex);
|
||||||
&c_search_result_on_smallIndex);
|
|
||||||
ASSERT_EQ(res_before_load_index.error_code, Success);
|
ASSERT_EQ(res_before_load_index.error_code, Success);
|
||||||
|
|
||||||
// load index to segment
|
// load index to segment
|
||||||
|
|
@ -3028,12 +3026,11 @@ TEST(CApiTest, Indexing_Expr_With_float_Predicate_Term) {
|
||||||
sealed_segment->LoadIndex(*(LoadIndexInfo*)c_load_index_info);
|
sealed_segment->LoadIndex(*(LoadIndexInfo*)c_load_index_info);
|
||||||
|
|
||||||
CSearchResult c_search_result_on_bigIndex;
|
CSearchResult c_search_result_on_bigIndex;
|
||||||
auto res_after_load_index = Search(sealed_segment.get(),
|
auto res_after_load_index = CSearch(sealed_segment.get(),
|
||||||
plan,
|
plan,
|
||||||
placeholderGroup,
|
placeholderGroup,
|
||||||
{},
|
timestamp,
|
||||||
timestamp,
|
&c_search_result_on_bigIndex);
|
||||||
&c_search_result_on_bigIndex);
|
|
||||||
ASSERT_EQ(res_after_load_index.error_code, Success);
|
ASSERT_EQ(res_after_load_index.error_code, Success);
|
||||||
|
|
||||||
auto search_result_on_bigIndex = (SearchResult*)c_search_result_on_bigIndex;
|
auto search_result_on_bigIndex = (SearchResult*)c_search_result_on_bigIndex;
|
||||||
|
|
@ -3147,12 +3144,11 @@ TEST(CApiTest, Indexing_With_binary_Predicate_Range) {
|
||||||
Timestamp timestamp = 10000000;
|
Timestamp timestamp = 10000000;
|
||||||
|
|
||||||
CSearchResult c_search_result_on_smallIndex;
|
CSearchResult c_search_result_on_smallIndex;
|
||||||
auto res_before_load_index = Search(segment,
|
auto res_before_load_index = CSearch(segment,
|
||||||
plan,
|
plan,
|
||||||
placeholderGroup,
|
placeholderGroup,
|
||||||
{},
|
timestamp,
|
||||||
timestamp,
|
&c_search_result_on_smallIndex);
|
||||||
&c_search_result_on_smallIndex);
|
|
||||||
ASSERT_EQ(res_before_load_index.error_code, Success);
|
ASSERT_EQ(res_before_load_index.error_code, Success);
|
||||||
|
|
||||||
// load index to segment
|
// load index to segment
|
||||||
|
|
@ -3210,12 +3206,11 @@ TEST(CApiTest, Indexing_With_binary_Predicate_Range) {
|
||||||
sealed_segment->LoadIndex(*(LoadIndexInfo*)c_load_index_info);
|
sealed_segment->LoadIndex(*(LoadIndexInfo*)c_load_index_info);
|
||||||
|
|
||||||
CSearchResult c_search_result_on_bigIndex;
|
CSearchResult c_search_result_on_bigIndex;
|
||||||
auto res_after_load_index = Search(sealed_segment.get(),
|
auto res_after_load_index = CSearch(sealed_segment.get(),
|
||||||
plan,
|
plan,
|
||||||
placeholderGroup,
|
placeholderGroup,
|
||||||
{},
|
timestamp,
|
||||||
timestamp,
|
&c_search_result_on_bigIndex);
|
||||||
&c_search_result_on_bigIndex);
|
|
||||||
ASSERT_EQ(res_after_load_index.error_code, Success);
|
ASSERT_EQ(res_after_load_index.error_code, Success);
|
||||||
|
|
||||||
auto search_result_on_bigIndex = (SearchResult*)c_search_result_on_bigIndex;
|
auto search_result_on_bigIndex = (SearchResult*)c_search_result_on_bigIndex;
|
||||||
|
|
@ -3329,12 +3324,11 @@ TEST(CApiTest, Indexing_Expr_With_binary_Predicate_Range) {
|
||||||
Timestamp timestamp = 10000000;
|
Timestamp timestamp = 10000000;
|
||||||
|
|
||||||
CSearchResult c_search_result_on_smallIndex;
|
CSearchResult c_search_result_on_smallIndex;
|
||||||
auto res_before_load_index = Search(segment,
|
auto res_before_load_index = CSearch(segment,
|
||||||
plan,
|
plan,
|
||||||
placeholderGroup,
|
placeholderGroup,
|
||||||
{},
|
timestamp,
|
||||||
timestamp,
|
&c_search_result_on_smallIndex);
|
||||||
&c_search_result_on_smallIndex);
|
|
||||||
ASSERT_TRUE(res_before_load_index.error_code == Success)
|
ASSERT_TRUE(res_before_load_index.error_code == Success)
|
||||||
<< res_before_load_index.error_msg;
|
<< res_before_load_index.error_msg;
|
||||||
|
|
||||||
|
|
@ -3392,12 +3386,11 @@ TEST(CApiTest, Indexing_Expr_With_binary_Predicate_Range) {
|
||||||
sealed_segment->LoadIndex(*(LoadIndexInfo*)c_load_index_info);
|
sealed_segment->LoadIndex(*(LoadIndexInfo*)c_load_index_info);
|
||||||
|
|
||||||
CSearchResult c_search_result_on_bigIndex;
|
CSearchResult c_search_result_on_bigIndex;
|
||||||
auto res_after_load_index = Search(sealed_segment.get(),
|
auto res_after_load_index = CSearch(sealed_segment.get(),
|
||||||
plan,
|
plan,
|
||||||
placeholderGroup,
|
placeholderGroup,
|
||||||
{},
|
timestamp,
|
||||||
timestamp,
|
&c_search_result_on_bigIndex);
|
||||||
&c_search_result_on_bigIndex);
|
|
||||||
ASSERT_EQ(res_after_load_index.error_code, Success);
|
ASSERT_EQ(res_after_load_index.error_code, Success);
|
||||||
|
|
||||||
auto search_result_on_bigIndex = (SearchResult*)c_search_result_on_bigIndex;
|
auto search_result_on_bigIndex = (SearchResult*)c_search_result_on_bigIndex;
|
||||||
|
|
@ -3506,12 +3499,11 @@ TEST(CApiTest, Indexing_With_binary_Predicate_Term) {
|
||||||
Timestamp timestamp = 10000000;
|
Timestamp timestamp = 10000000;
|
||||||
|
|
||||||
CSearchResult c_search_result_on_smallIndex;
|
CSearchResult c_search_result_on_smallIndex;
|
||||||
auto res_before_load_index = Search(segment,
|
auto res_before_load_index = CSearch(segment,
|
||||||
plan,
|
plan,
|
||||||
placeholderGroup,
|
placeholderGroup,
|
||||||
{},
|
timestamp,
|
||||||
timestamp,
|
&c_search_result_on_smallIndex);
|
||||||
&c_search_result_on_smallIndex);
|
|
||||||
ASSERT_EQ(res_before_load_index.error_code, Success);
|
ASSERT_EQ(res_before_load_index.error_code, Success);
|
||||||
|
|
||||||
// load index to segment
|
// load index to segment
|
||||||
|
|
@ -3568,12 +3560,11 @@ TEST(CApiTest, Indexing_With_binary_Predicate_Term) {
|
||||||
sealed_segment->LoadIndex(*(LoadIndexInfo*)c_load_index_info);
|
sealed_segment->LoadIndex(*(LoadIndexInfo*)c_load_index_info);
|
||||||
|
|
||||||
CSearchResult c_search_result_on_bigIndex;
|
CSearchResult c_search_result_on_bigIndex;
|
||||||
auto res_after_load_index = Search(sealed_segment.get(),
|
auto res_after_load_index = CSearch(sealed_segment.get(),
|
||||||
plan,
|
plan,
|
||||||
placeholderGroup,
|
placeholderGroup,
|
||||||
{},
|
timestamp,
|
||||||
timestamp,
|
&c_search_result_on_bigIndex);
|
||||||
&c_search_result_on_bigIndex);
|
|
||||||
ASSERT_EQ(res_after_load_index.error_code, Success);
|
ASSERT_EQ(res_after_load_index.error_code, Success);
|
||||||
|
|
||||||
std::vector<CSearchResult> results;
|
std::vector<CSearchResult> results;
|
||||||
|
|
@ -3704,12 +3695,11 @@ TEST(CApiTest, Indexing_Expr_With_binary_Predicate_Term) {
|
||||||
Timestamp timestamp = 10000000;
|
Timestamp timestamp = 10000000;
|
||||||
|
|
||||||
CSearchResult c_search_result_on_smallIndex;
|
CSearchResult c_search_result_on_smallIndex;
|
||||||
auto res_before_load_index = Search(segment,
|
auto res_before_load_index = CSearch(segment,
|
||||||
plan,
|
plan,
|
||||||
placeholderGroup,
|
placeholderGroup,
|
||||||
{},
|
timestamp,
|
||||||
timestamp,
|
&c_search_result_on_smallIndex);
|
||||||
&c_search_result_on_smallIndex);
|
|
||||||
ASSERT_EQ(res_before_load_index.error_code, Success);
|
ASSERT_EQ(res_before_load_index.error_code, Success);
|
||||||
|
|
||||||
// load index to segment
|
// load index to segment
|
||||||
|
|
@ -3766,12 +3756,11 @@ TEST(CApiTest, Indexing_Expr_With_binary_Predicate_Term) {
|
||||||
sealed_segment->LoadIndex(*(LoadIndexInfo*)c_load_index_info);
|
sealed_segment->LoadIndex(*(LoadIndexInfo*)c_load_index_info);
|
||||||
|
|
||||||
CSearchResult c_search_result_on_bigIndex;
|
CSearchResult c_search_result_on_bigIndex;
|
||||||
auto res_after_load_index = Search(sealed_segment.get(),
|
auto res_after_load_index = CSearch(sealed_segment.get(),
|
||||||
plan,
|
plan,
|
||||||
placeholderGroup,
|
placeholderGroup,
|
||||||
{},
|
timestamp,
|
||||||
timestamp,
|
&c_search_result_on_bigIndex);
|
||||||
&c_search_result_on_bigIndex);
|
|
||||||
ASSERT_EQ(res_after_load_index.error_code, Success);
|
ASSERT_EQ(res_after_load_index.error_code, Success);
|
||||||
|
|
||||||
std::vector<CSearchResult> results;
|
std::vector<CSearchResult> results;
|
||||||
|
|
@ -3964,12 +3953,11 @@ TEST(CApiTest, SealedSegment_search_float_Predicate_Range) {
|
||||||
sealed_segment->LoadIndex(*(LoadIndexInfo*)c_load_index_info);
|
sealed_segment->LoadIndex(*(LoadIndexInfo*)c_load_index_info);
|
||||||
|
|
||||||
CSearchResult c_search_result_on_bigIndex;
|
CSearchResult c_search_result_on_bigIndex;
|
||||||
auto res_after_load_index = Search(sealed_segment.get(),
|
auto res_after_load_index = CSearch(sealed_segment.get(),
|
||||||
plan,
|
plan,
|
||||||
placeholderGroup,
|
placeholderGroup,
|
||||||
{},
|
timestamp,
|
||||||
timestamp,
|
&c_search_result_on_bigIndex);
|
||||||
&c_search_result_on_bigIndex);
|
|
||||||
ASSERT_EQ(res_after_load_index.error_code, Success);
|
ASSERT_EQ(res_after_load_index.error_code, Success);
|
||||||
|
|
||||||
auto search_result_on_bigIndex = (SearchResult*)c_search_result_on_bigIndex;
|
auto search_result_on_bigIndex = (SearchResult*)c_search_result_on_bigIndex;
|
||||||
|
|
@ -4047,14 +4035,14 @@ TEST(CApiTest, SealedSegment_search_without_predicates) {
|
||||||
std::vector<CPlaceholderGroup> placeholderGroups;
|
std::vector<CPlaceholderGroup> placeholderGroups;
|
||||||
placeholderGroups.push_back(placeholderGroup);
|
placeholderGroups.push_back(placeholderGroup);
|
||||||
CSearchResult search_result;
|
CSearchResult search_result;
|
||||||
auto res = Search(
|
auto res = CSearch(
|
||||||
segment, plan, placeholderGroup, {}, N + ts_offset, &search_result);
|
segment, plan, placeholderGroup, N + ts_offset, &search_result);
|
||||||
std::cout << res.error_msg << std::endl;
|
std::cout << res.error_msg << std::endl;
|
||||||
ASSERT_EQ(res.error_code, Success);
|
ASSERT_EQ(res.error_code, Success);
|
||||||
|
|
||||||
CSearchResult search_result2;
|
CSearchResult search_result2;
|
||||||
auto res2 = Search(
|
auto res2 = CSearch(
|
||||||
segment, plan, placeholderGroup, {}, N + ts_offset, &search_result2);
|
segment, plan, placeholderGroup, N + ts_offset, &search_result2);
|
||||||
ASSERT_EQ(res2.error_code, Success);
|
ASSERT_EQ(res2.error_code, Success);
|
||||||
|
|
||||||
DeleteSearchPlan(plan);
|
DeleteSearchPlan(plan);
|
||||||
|
|
@ -4203,12 +4191,11 @@ TEST(CApiTest, SealedSegment_search_float_With_Expr_Predicate_Range) {
|
||||||
}
|
}
|
||||||
|
|
||||||
CSearchResult c_search_result_on_bigIndex;
|
CSearchResult c_search_result_on_bigIndex;
|
||||||
auto res_after_load_index = Search(segment,
|
auto res_after_load_index = CSearch(segment,
|
||||||
plan,
|
plan,
|
||||||
placeholderGroup,
|
placeholderGroup,
|
||||||
{},
|
timestamp,
|
||||||
timestamp,
|
&c_search_result_on_bigIndex);
|
||||||
&c_search_result_on_bigIndex);
|
|
||||||
ASSERT_EQ(res_after_load_index.error_code, Success);
|
ASSERT_EQ(res_after_load_index.error_code, Success);
|
||||||
|
|
||||||
auto search_result_on_bigIndex = (SearchResult*)c_search_result_on_bigIndex;
|
auto search_result_on_bigIndex = (SearchResult*)c_search_result_on_bigIndex;
|
||||||
|
|
@ -4403,7 +4390,7 @@ TEST(CApiTest, RetriveScalarFieldFromSealedSegmentWithIndex) {
|
||||||
|
|
||||||
CRetrieveResult retrieve_result;
|
CRetrieveResult retrieve_result;
|
||||||
res = CRetrieve(
|
res = CRetrieve(
|
||||||
segment, plan.get(), {}, raw_data.timestamps_[N - 1], &retrieve_result);
|
segment, plan.get(), raw_data.timestamps_[N - 1], &retrieve_result);
|
||||||
ASSERT_EQ(res.error_code, Success);
|
ASSERT_EQ(res.error_code, Success);
|
||||||
auto query_result = std::make_unique<proto::segcore::RetrieveResults>();
|
auto query_result = std::make_unique<proto::segcore::RetrieveResults>();
|
||||||
auto suc = query_result->ParseFromArray(retrieve_result.proto_blob,
|
auto suc = query_result->ParseFromArray(retrieve_result.proto_blob,
|
||||||
|
|
@ -4505,7 +4492,7 @@ TEST(CApiTest, RANGE_SEARCH_WITH_RADIUS_WHEN_IP) {
|
||||||
|
|
||||||
CSearchResult search_result;
|
CSearchResult search_result;
|
||||||
auto res =
|
auto res =
|
||||||
Search(segment, plan, placeholderGroup, {}, ts_offset, &search_result);
|
CSearch(segment, plan, placeholderGroup, ts_offset, &search_result);
|
||||||
ASSERT_EQ(res.error_code, Success);
|
ASSERT_EQ(res.error_code, Success);
|
||||||
|
|
||||||
DeleteSearchPlan(plan);
|
DeleteSearchPlan(plan);
|
||||||
|
|
@ -4570,7 +4557,7 @@ TEST(CApiTest, RANGE_SEARCH_WITH_RADIUS_AND_RANGE_FILTER_WHEN_IP) {
|
||||||
|
|
||||||
CSearchResult search_result;
|
CSearchResult search_result;
|
||||||
auto res =
|
auto res =
|
||||||
Search(segment, plan, placeholderGroup, {}, ts_offset, &search_result);
|
CSearch(segment, plan, placeholderGroup, ts_offset, &search_result);
|
||||||
ASSERT_EQ(res.error_code, Success);
|
ASSERT_EQ(res.error_code, Success);
|
||||||
|
|
||||||
DeleteSearchPlan(plan);
|
DeleteSearchPlan(plan);
|
||||||
|
|
@ -4634,7 +4621,7 @@ TEST(CApiTest, RANGE_SEARCH_WITH_RADIUS_WHEN_L2) {
|
||||||
|
|
||||||
CSearchResult search_result;
|
CSearchResult search_result;
|
||||||
auto res =
|
auto res =
|
||||||
Search(segment, plan, placeholderGroup, {}, ts_offset, &search_result);
|
CSearch(segment, plan, placeholderGroup, ts_offset, &search_result);
|
||||||
ASSERT_EQ(res.error_code, Success);
|
ASSERT_EQ(res.error_code, Success);
|
||||||
|
|
||||||
DeleteSearchPlan(plan);
|
DeleteSearchPlan(plan);
|
||||||
|
|
@ -4698,7 +4685,7 @@ TEST(CApiTest, RANGE_SEARCH_WITH_RADIUS_AND_RANGE_FILTER_WHEN_L2) {
|
||||||
|
|
||||||
CSearchResult search_result;
|
CSearchResult search_result;
|
||||||
auto res =
|
auto res =
|
||||||
Search(segment, plan, placeholderGroup, {}, ts_offset, &search_result);
|
CSearch(segment, plan, placeholderGroup, ts_offset, &search_result);
|
||||||
ASSERT_EQ(res.error_code, Success);
|
ASSERT_EQ(res.error_code, Success);
|
||||||
|
|
||||||
DeleteSearchPlan(plan);
|
DeleteSearchPlan(plan);
|
||||||
|
|
@ -4922,12 +4909,11 @@ TEST(CApiTest, Indexing_Without_Predicate_float16) {
|
||||||
Timestamp timestmap = 10000000;
|
Timestamp timestmap = 10000000;
|
||||||
|
|
||||||
CSearchResult c_search_result_on_smallIndex;
|
CSearchResult c_search_result_on_smallIndex;
|
||||||
auto res_before_load_index = Search(segment,
|
auto res_before_load_index = CSearch(segment,
|
||||||
plan,
|
plan,
|
||||||
placeholderGroup,
|
placeholderGroup,
|
||||||
{},
|
timestmap,
|
||||||
timestmap,
|
&c_search_result_on_smallIndex);
|
||||||
&c_search_result_on_smallIndex);
|
|
||||||
ASSERT_EQ(res_before_load_index.error_code, Success);
|
ASSERT_EQ(res_before_load_index.error_code, Success);
|
||||||
|
|
||||||
// load index to segment
|
// load index to segment
|
||||||
|
|
@ -4983,12 +4969,11 @@ TEST(CApiTest, Indexing_Without_Predicate_float16) {
|
||||||
sealed_segment->DropFieldData(FieldId(100));
|
sealed_segment->DropFieldData(FieldId(100));
|
||||||
sealed_segment->LoadIndex(*(LoadIndexInfo*)c_load_index_info);
|
sealed_segment->LoadIndex(*(LoadIndexInfo*)c_load_index_info);
|
||||||
CSearchResult c_search_result_on_bigIndex;
|
CSearchResult c_search_result_on_bigIndex;
|
||||||
auto res_after_load_index = Search(sealed_segment.get(),
|
auto res_after_load_index = CSearch(sealed_segment.get(),
|
||||||
plan,
|
plan,
|
||||||
placeholderGroup,
|
placeholderGroup,
|
||||||
{},
|
timestmap,
|
||||||
timestmap,
|
&c_search_result_on_bigIndex);
|
||||||
&c_search_result_on_bigIndex);
|
|
||||||
ASSERT_EQ(res_after_load_index.error_code, Success);
|
ASSERT_EQ(res_after_load_index.error_code, Success);
|
||||||
|
|
||||||
auto search_result_on_raw_index_json =
|
auto search_result_on_raw_index_json =
|
||||||
|
|
@ -5074,12 +5059,11 @@ TEST(CApiTest, Indexing_Without_Predicate_bfloat16) {
|
||||||
Timestamp timestmap = 10000000;
|
Timestamp timestmap = 10000000;
|
||||||
|
|
||||||
CSearchResult c_search_result_on_smallIndex;
|
CSearchResult c_search_result_on_smallIndex;
|
||||||
auto res_before_load_index = Search(segment,
|
auto res_before_load_index = CSearch(segment,
|
||||||
plan,
|
plan,
|
||||||
placeholderGroup,
|
placeholderGroup,
|
||||||
{},
|
timestmap,
|
||||||
timestmap,
|
&c_search_result_on_smallIndex);
|
||||||
&c_search_result_on_smallIndex);
|
|
||||||
ASSERT_EQ(res_before_load_index.error_code, Success);
|
ASSERT_EQ(res_before_load_index.error_code, Success);
|
||||||
|
|
||||||
// load index to segment
|
// load index to segment
|
||||||
|
|
@ -5135,12 +5119,11 @@ TEST(CApiTest, Indexing_Without_Predicate_bfloat16) {
|
||||||
sealed_segment->DropFieldData(FieldId(100));
|
sealed_segment->DropFieldData(FieldId(100));
|
||||||
sealed_segment->LoadIndex(*(LoadIndexInfo*)c_load_index_info);
|
sealed_segment->LoadIndex(*(LoadIndexInfo*)c_load_index_info);
|
||||||
CSearchResult c_search_result_on_bigIndex;
|
CSearchResult c_search_result_on_bigIndex;
|
||||||
auto res_after_load_index = Search(sealed_segment.get(),
|
auto res_after_load_index = CSearch(sealed_segment.get(),
|
||||||
plan,
|
plan,
|
||||||
placeholderGroup,
|
placeholderGroup,
|
||||||
{},
|
timestmap,
|
||||||
timestmap,
|
&c_search_result_on_bigIndex);
|
||||||
&c_search_result_on_bigIndex);
|
|
||||||
ASSERT_EQ(res_after_load_index.error_code, Success);
|
ASSERT_EQ(res_after_load_index.error_code, Success);
|
||||||
|
|
||||||
auto search_result_on_raw_index_json =
|
auto search_result_on_raw_index_json =
|
||||||
|
|
@ -5215,7 +5198,7 @@ TEST(CApiTest, RANGE_SEARCH_WITH_RADIUS_AND_RANGE_FILTER_WHEN_IP_FLOAT16) {
|
||||||
|
|
||||||
CSearchResult search_result;
|
CSearchResult search_result;
|
||||||
auto res =
|
auto res =
|
||||||
Search(segment, plan, placeholderGroup, {}, ts_offset, &search_result);
|
CSearch(segment, plan, placeholderGroup, ts_offset, &search_result);
|
||||||
ASSERT_EQ(res.error_code, Success);
|
ASSERT_EQ(res.error_code, Success);
|
||||||
|
|
||||||
DeleteSearchPlan(plan);
|
DeleteSearchPlan(plan);
|
||||||
|
|
@ -5280,7 +5263,7 @@ TEST(CApiTest, RANGE_SEARCH_WITH_RADIUS_AND_RANGE_FILTER_WHEN_IP_BFLOAT16) {
|
||||||
|
|
||||||
CSearchResult search_result;
|
CSearchResult search_result;
|
||||||
auto res =
|
auto res =
|
||||||
Search(segment, plan, placeholderGroup, {}, ts_offset, &search_result);
|
CSearch(segment, plan, placeholderGroup, ts_offset, &search_result);
|
||||||
ASSERT_EQ(res.error_code, Success);
|
ASSERT_EQ(res.error_code, Success);
|
||||||
|
|
||||||
DeleteSearchPlan(plan);
|
DeleteSearchPlan(plan);
|
||||||
|
|
|
||||||
|
|
@ -35,11 +35,12 @@
|
||||||
#include "exec/expression/Expr.h"
|
#include "exec/expression/Expr.h"
|
||||||
#include "exec/Task.h"
|
#include "exec/Task.h"
|
||||||
|
|
||||||
|
using namespace milvus;
|
||||||
|
using namespace milvus::query;
|
||||||
|
using namespace milvus::segcore;
|
||||||
|
|
||||||
TEST(Expr, Range) {
|
TEST(Expr, Range) {
|
||||||
SUCCEED();
|
SUCCEED();
|
||||||
using namespace milvus;
|
|
||||||
using namespace milvus::query;
|
|
||||||
using namespace milvus::segcore;
|
|
||||||
// std::string dsl_string = R"({
|
// std::string dsl_string = R"({
|
||||||
// "bool": {
|
// "bool": {
|
||||||
// "must": [
|
// "must": [
|
||||||
|
|
@ -121,9 +122,6 @@ TEST(Expr, Range) {
|
||||||
|
|
||||||
TEST(Expr, RangeBinary) {
|
TEST(Expr, RangeBinary) {
|
||||||
SUCCEED();
|
SUCCEED();
|
||||||
using namespace milvus;
|
|
||||||
using namespace milvus::query;
|
|
||||||
using namespace milvus::segcore;
|
|
||||||
// std::string dsl_string = R"({
|
// std::string dsl_string = R"({
|
||||||
// "bool": {
|
// "bool": {
|
||||||
// "must": [
|
// "must": [
|
||||||
|
|
@ -204,9 +202,6 @@ TEST(Expr, RangeBinary) {
|
||||||
|
|
||||||
TEST(Expr, InvalidRange) {
|
TEST(Expr, InvalidRange) {
|
||||||
SUCCEED();
|
SUCCEED();
|
||||||
using namespace milvus;
|
|
||||||
using namespace milvus::query;
|
|
||||||
using namespace milvus::segcore;
|
|
||||||
// std::string dsl_string = R"(
|
// std::string dsl_string = R"(
|
||||||
// {
|
// {
|
||||||
// "bool": {
|
// "bool": {
|
||||||
|
|
@ -283,9 +278,6 @@ TEST(Expr, InvalidRange) {
|
||||||
}
|
}
|
||||||
|
|
||||||
TEST(Expr, ShowExecutor) {
|
TEST(Expr, ShowExecutor) {
|
||||||
using namespace milvus;
|
|
||||||
using namespace milvus::query;
|
|
||||||
using namespace milvus::segcore;
|
|
||||||
auto node = std::make_unique<FloatVectorANNS>();
|
auto node = std::make_unique<FloatVectorANNS>();
|
||||||
auto schema = std::make_shared<Schema>();
|
auto schema = std::make_shared<Schema>();
|
||||||
auto metric_type = knowhere::metric::L2;
|
auto metric_type = knowhere::metric::L2;
|
||||||
|
|
@ -308,9 +300,6 @@ TEST(Expr, ShowExecutor) {
|
||||||
}
|
}
|
||||||
|
|
||||||
TEST(Expr, TestRange) {
|
TEST(Expr, TestRange) {
|
||||||
using namespace milvus;
|
|
||||||
using namespace milvus::query;
|
|
||||||
using namespace milvus::segcore;
|
|
||||||
std::vector<std::tuple<std::string, std::function<bool(int)>>> testcases = {
|
std::vector<std::tuple<std::string, std::function<bool(int)>>> testcases = {
|
||||||
{R"(binary_range_expr: <
|
{R"(binary_range_expr: <
|
||||||
column_info: <
|
column_info: <
|
||||||
|
|
@ -529,10 +518,6 @@ TEST(Expr, TestRange) {
|
||||||
}
|
}
|
||||||
|
|
||||||
TEST(Expr, TestBinaryRangeJSON) {
|
TEST(Expr, TestBinaryRangeJSON) {
|
||||||
using namespace milvus;
|
|
||||||
using namespace milvus::query;
|
|
||||||
using namespace milvus::segcore;
|
|
||||||
|
|
||||||
struct Testcase {
|
struct Testcase {
|
||||||
bool lower_inclusive;
|
bool lower_inclusive;
|
||||||
bool upper_inclusive;
|
bool upper_inclusive;
|
||||||
|
|
@ -632,10 +617,6 @@ TEST(Expr, TestBinaryRangeJSON) {
|
||||||
}
|
}
|
||||||
|
|
||||||
TEST(Expr, TestExistsJson) {
|
TEST(Expr, TestExistsJson) {
|
||||||
using namespace milvus;
|
|
||||||
using namespace milvus::query;
|
|
||||||
using namespace milvus::segcore;
|
|
||||||
|
|
||||||
struct Testcase {
|
struct Testcase {
|
||||||
std::vector<std::string> nested_path;
|
std::vector<std::string> nested_path;
|
||||||
};
|
};
|
||||||
|
|
@ -727,10 +708,6 @@ GetValueFromProto(const milvus::proto::plan::GenericValue& value_proto) {
|
||||||
};
|
};
|
||||||
|
|
||||||
TEST(Expr, TestUnaryRangeJson) {
|
TEST(Expr, TestUnaryRangeJson) {
|
||||||
using namespace milvus;
|
|
||||||
using namespace milvus::query;
|
|
||||||
using namespace milvus::segcore;
|
|
||||||
|
|
||||||
struct Testcase {
|
struct Testcase {
|
||||||
int64_t val;
|
int64_t val;
|
||||||
std::vector<std::string> nested_path;
|
std::vector<std::string> nested_path;
|
||||||
|
|
@ -900,10 +877,6 @@ TEST(Expr, TestUnaryRangeJson) {
|
||||||
}
|
}
|
||||||
|
|
||||||
TEST(Expr, TestTermJson) {
|
TEST(Expr, TestTermJson) {
|
||||||
using namespace milvus;
|
|
||||||
using namespace milvus::query;
|
|
||||||
using namespace milvus::segcore;
|
|
||||||
|
|
||||||
struct Testcase {
|
struct Testcase {
|
||||||
std::vector<int64_t> term;
|
std::vector<int64_t> term;
|
||||||
std::vector<std::string> nested_path;
|
std::vector<std::string> nested_path;
|
||||||
|
|
@ -975,9 +948,6 @@ TEST(Expr, TestTermJson) {
|
||||||
}
|
}
|
||||||
|
|
||||||
TEST(Expr, TestTerm) {
|
TEST(Expr, TestTerm) {
|
||||||
using namespace milvus;
|
|
||||||
using namespace milvus::query;
|
|
||||||
using namespace milvus::segcore;
|
|
||||||
auto vec_2k_3k = [] {
|
auto vec_2k_3k = [] {
|
||||||
std::string buf;
|
std::string buf;
|
||||||
for (int i = 2000; i < 3000; ++i) {
|
for (int i = 2000; i < 3000; ++i) {
|
||||||
|
|
@ -1102,9 +1072,6 @@ TEST(Expr, TestTerm) {
|
||||||
}
|
}
|
||||||
|
|
||||||
TEST(Expr, TestCompare) {
|
TEST(Expr, TestCompare) {
|
||||||
using namespace milvus;
|
|
||||||
using namespace milvus::query;
|
|
||||||
using namespace milvus::segcore;
|
|
||||||
std::vector<std::tuple<std::string, std::function<bool(int, int64_t)>>>
|
std::vector<std::tuple<std::string, std::function<bool(int, int64_t)>>>
|
||||||
testcases = {
|
testcases = {
|
||||||
{R"(LessThan)", [](int a, int64_t b) { return a < b; }},
|
{R"(LessThan)", [](int a, int64_t b) { return a < b; }},
|
||||||
|
|
@ -1222,9 +1189,6 @@ TEST(Expr, TestCompare) {
|
||||||
}
|
}
|
||||||
|
|
||||||
TEST(Expr, TestCompareWithScalarIndex) {
|
TEST(Expr, TestCompareWithScalarIndex) {
|
||||||
using namespace milvus;
|
|
||||||
using namespace milvus::query;
|
|
||||||
using namespace milvus::segcore;
|
|
||||||
std::vector<std::tuple<std::string, std::function<bool(int, int64_t)>>>
|
std::vector<std::tuple<std::string, std::function<bool(int, int64_t)>>>
|
||||||
testcases = {
|
testcases = {
|
||||||
{R"(LessThan)", [](int a, int64_t b) { return a < b; }},
|
{R"(LessThan)", [](int a, int64_t b) { return a < b; }},
|
||||||
|
|
@ -1321,9 +1285,6 @@ TEST(Expr, TestCompareWithScalarIndex) {
|
||||||
}
|
}
|
||||||
|
|
||||||
TEST(Expr, TestCompareExpr) {
|
TEST(Expr, TestCompareExpr) {
|
||||||
using namespace milvus;
|
|
||||||
using namespace milvus::query;
|
|
||||||
using namespace milvus::segcore;
|
|
||||||
auto schema = std::make_shared<Schema>();
|
auto schema = std::make_shared<Schema>();
|
||||||
auto vec_fid = schema->AddDebugField(
|
auto vec_fid = schema->AddDebugField(
|
||||||
"fakevec", DataType::VECTOR_FLOAT, 16, knowhere::metric::L2);
|
"fakevec", DataType::VECTOR_FLOAT, 16, knowhere::metric::L2);
|
||||||
|
|
@ -1473,9 +1434,6 @@ TEST(Expr, TestCompareExpr) {
|
||||||
}
|
}
|
||||||
|
|
||||||
TEST(Expr, TestMultiLogicalExprsOptimization) {
|
TEST(Expr, TestMultiLogicalExprsOptimization) {
|
||||||
using namespace milvus;
|
|
||||||
using namespace milvus::query;
|
|
||||||
using namespace milvus::segcore;
|
|
||||||
auto schema = std::make_shared<Schema>();
|
auto schema = std::make_shared<Schema>();
|
||||||
auto vec_fid = schema->AddDebugField(
|
auto vec_fid = schema->AddDebugField(
|
||||||
"fakevec", DataType::VECTOR_FLOAT, 16, knowhere::metric::L2);
|
"fakevec", DataType::VECTOR_FLOAT, 16, knowhere::metric::L2);
|
||||||
|
|
@ -1562,9 +1520,6 @@ TEST(Expr, TestMultiLogicalExprsOptimization) {
|
||||||
}
|
}
|
||||||
|
|
||||||
TEST(Expr, TestExprs) {
|
TEST(Expr, TestExprs) {
|
||||||
using namespace milvus;
|
|
||||||
using namespace milvus::query;
|
|
||||||
using namespace milvus::segcore;
|
|
||||||
auto schema = std::make_shared<Schema>();
|
auto schema = std::make_shared<Schema>();
|
||||||
auto vec_fid = schema->AddDebugField(
|
auto vec_fid = schema->AddDebugField(
|
||||||
"fakevec", DataType::VECTOR_FLOAT, 16, knowhere::metric::L2);
|
"fakevec", DataType::VECTOR_FLOAT, 16, knowhere::metric::L2);
|
||||||
|
|
@ -1737,9 +1692,6 @@ TEST(Expr, TestExprs) {
|
||||||
}
|
}
|
||||||
|
|
||||||
TEST(Expr, test_term_pk) {
|
TEST(Expr, test_term_pk) {
|
||||||
using namespace milvus;
|
|
||||||
using namespace milvus::query;
|
|
||||||
using namespace milvus::segcore;
|
|
||||||
auto schema = std::make_shared<Schema>();
|
auto schema = std::make_shared<Schema>();
|
||||||
schema->AddField(FieldName("Timestamp"), FieldId(1), DataType::INT64);
|
schema->AddField(FieldName("Timestamp"), FieldId(1), DataType::INT64);
|
||||||
auto vec_fid = schema->AddDebugField(
|
auto vec_fid = schema->AddDebugField(
|
||||||
|
|
@ -1804,9 +1756,6 @@ TEST(Expr, test_term_pk) {
|
||||||
}
|
}
|
||||||
|
|
||||||
TEST(Expr, TestSealedSegmentGetBatchSize) {
|
TEST(Expr, TestSealedSegmentGetBatchSize) {
|
||||||
using namespace milvus;
|
|
||||||
using namespace milvus::query;
|
|
||||||
using namespace milvus::segcore;
|
|
||||||
auto schema = std::make_shared<Schema>();
|
auto schema = std::make_shared<Schema>();
|
||||||
auto vec_fid = schema->AddDebugField(
|
auto vec_fid = schema->AddDebugField(
|
||||||
"fakevec", DataType::VECTOR_FLOAT, 16, knowhere::metric::L2);
|
"fakevec", DataType::VECTOR_FLOAT, 16, knowhere::metric::L2);
|
||||||
|
|
@ -1869,9 +1818,6 @@ TEST(Expr, TestSealedSegmentGetBatchSize) {
|
||||||
}
|
}
|
||||||
|
|
||||||
TEST(Expr, TestGrowingSegmentGetBatchSize) {
|
TEST(Expr, TestGrowingSegmentGetBatchSize) {
|
||||||
using namespace milvus;
|
|
||||||
using namespace milvus::query;
|
|
||||||
using namespace milvus::segcore;
|
|
||||||
auto schema = std::make_shared<Schema>();
|
auto schema = std::make_shared<Schema>();
|
||||||
auto vec_fid = schema->AddDebugField(
|
auto vec_fid = schema->AddDebugField(
|
||||||
"fakevec", DataType::VECTOR_FLOAT, 16, knowhere::metric::L2);
|
"fakevec", DataType::VECTOR_FLOAT, 16, knowhere::metric::L2);
|
||||||
|
|
@ -1928,9 +1874,6 @@ TEST(Expr, TestGrowingSegmentGetBatchSize) {
|
||||||
}
|
}
|
||||||
|
|
||||||
TEST(Expr, TestConjuctExpr) {
|
TEST(Expr, TestConjuctExpr) {
|
||||||
using namespace milvus;
|
|
||||||
using namespace milvus::query;
|
|
||||||
using namespace milvus::segcore;
|
|
||||||
auto schema = std::make_shared<Schema>();
|
auto schema = std::make_shared<Schema>();
|
||||||
auto vec_fid = schema->AddDebugField(
|
auto vec_fid = schema->AddDebugField(
|
||||||
"fakevec", DataType::VECTOR_FLOAT, 16, knowhere::metric::L2);
|
"fakevec", DataType::VECTOR_FLOAT, 16, knowhere::metric::L2);
|
||||||
|
|
@ -1999,9 +1942,6 @@ TEST(Expr, TestConjuctExpr) {
|
||||||
}
|
}
|
||||||
|
|
||||||
TEST(Expr, TestUnaryBenchTest) {
|
TEST(Expr, TestUnaryBenchTest) {
|
||||||
using namespace milvus;
|
|
||||||
using namespace milvus::query;
|
|
||||||
using namespace milvus::segcore;
|
|
||||||
auto schema = std::make_shared<Schema>();
|
auto schema = std::make_shared<Schema>();
|
||||||
auto vec_fid = schema->AddDebugField(
|
auto vec_fid = schema->AddDebugField(
|
||||||
"fakevec", DataType::VECTOR_FLOAT, 16, knowhere::metric::L2);
|
"fakevec", DataType::VECTOR_FLOAT, 16, knowhere::metric::L2);
|
||||||
|
|
@ -2074,9 +2014,6 @@ TEST(Expr, TestUnaryBenchTest) {
|
||||||
}
|
}
|
||||||
|
|
||||||
TEST(Expr, TestBinaryRangeBenchTest) {
|
TEST(Expr, TestBinaryRangeBenchTest) {
|
||||||
using namespace milvus;
|
|
||||||
using namespace milvus::query;
|
|
||||||
using namespace milvus::segcore;
|
|
||||||
auto schema = std::make_shared<Schema>();
|
auto schema = std::make_shared<Schema>();
|
||||||
auto vec_fid = schema->AddDebugField(
|
auto vec_fid = schema->AddDebugField(
|
||||||
"fakevec", DataType::VECTOR_FLOAT, 16, knowhere::metric::L2);
|
"fakevec", DataType::VECTOR_FLOAT, 16, knowhere::metric::L2);
|
||||||
|
|
@ -2158,9 +2095,6 @@ TEST(Expr, TestBinaryRangeBenchTest) {
|
||||||
}
|
}
|
||||||
|
|
||||||
TEST(Expr, TestLogicalUnaryBenchTest) {
|
TEST(Expr, TestLogicalUnaryBenchTest) {
|
||||||
using namespace milvus;
|
|
||||||
using namespace milvus::query;
|
|
||||||
using namespace milvus::segcore;
|
|
||||||
auto schema = std::make_shared<Schema>();
|
auto schema = std::make_shared<Schema>();
|
||||||
auto vec_fid = schema->AddDebugField(
|
auto vec_fid = schema->AddDebugField(
|
||||||
"fakevec", DataType::VECTOR_FLOAT, 16, knowhere::metric::L2);
|
"fakevec", DataType::VECTOR_FLOAT, 16, knowhere::metric::L2);
|
||||||
|
|
@ -2236,9 +2170,6 @@ TEST(Expr, TestLogicalUnaryBenchTest) {
|
||||||
}
|
}
|
||||||
|
|
||||||
TEST(Expr, TestBinaryLogicalBenchTest) {
|
TEST(Expr, TestBinaryLogicalBenchTest) {
|
||||||
using namespace milvus;
|
|
||||||
using namespace milvus::query;
|
|
||||||
using namespace milvus::segcore;
|
|
||||||
auto schema = std::make_shared<Schema>();
|
auto schema = std::make_shared<Schema>();
|
||||||
auto vec_fid = schema->AddDebugField(
|
auto vec_fid = schema->AddDebugField(
|
||||||
"fakevec", DataType::VECTOR_FLOAT, 16, knowhere::metric::L2);
|
"fakevec", DataType::VECTOR_FLOAT, 16, knowhere::metric::L2);
|
||||||
|
|
@ -2324,9 +2255,6 @@ TEST(Expr, TestBinaryLogicalBenchTest) {
|
||||||
}
|
}
|
||||||
|
|
||||||
TEST(Expr, TestBinaryArithOpEvalRangeBenchExpr) {
|
TEST(Expr, TestBinaryArithOpEvalRangeBenchExpr) {
|
||||||
using namespace milvus;
|
|
||||||
using namespace milvus::query;
|
|
||||||
using namespace milvus::segcore;
|
|
||||||
auto schema = std::make_shared<Schema>();
|
auto schema = std::make_shared<Schema>();
|
||||||
auto vec_fid = schema->AddDebugField(
|
auto vec_fid = schema->AddDebugField(
|
||||||
"fakevec", DataType::VECTOR_FLOAT, 16, knowhere::metric::L2);
|
"fakevec", DataType::VECTOR_FLOAT, 16, knowhere::metric::L2);
|
||||||
|
|
@ -2408,9 +2336,6 @@ TEST(Expr, TestBinaryArithOpEvalRangeBenchExpr) {
|
||||||
}
|
}
|
||||||
|
|
||||||
TEST(Expr, TestCompareExprBenchTest) {
|
TEST(Expr, TestCompareExprBenchTest) {
|
||||||
using namespace milvus;
|
|
||||||
using namespace milvus::query;
|
|
||||||
using namespace milvus::segcore;
|
|
||||||
auto schema = std::make_shared<Schema>();
|
auto schema = std::make_shared<Schema>();
|
||||||
auto vec_fid = schema->AddDebugField(
|
auto vec_fid = schema->AddDebugField(
|
||||||
"fakevec", DataType::VECTOR_FLOAT, 16, knowhere::metric::L2);
|
"fakevec", DataType::VECTOR_FLOAT, 16, knowhere::metric::L2);
|
||||||
|
|
@ -2485,9 +2410,6 @@ TEST(Expr, TestCompareExprBenchTest) {
|
||||||
}
|
}
|
||||||
|
|
||||||
TEST(Expr, TestRefactorExprs) {
|
TEST(Expr, TestRefactorExprs) {
|
||||||
using namespace milvus;
|
|
||||||
using namespace milvus::query;
|
|
||||||
using namespace milvus::segcore;
|
|
||||||
auto schema = std::make_shared<Schema>();
|
auto schema = std::make_shared<Schema>();
|
||||||
auto vec_fid = schema->AddDebugField(
|
auto vec_fid = schema->AddDebugField(
|
||||||
"fakevec", DataType::VECTOR_FLOAT, 16, knowhere::metric::L2);
|
"fakevec", DataType::VECTOR_FLOAT, 16, knowhere::metric::L2);
|
||||||
|
|
@ -2658,9 +2580,6 @@ TEST(Expr, TestRefactorExprs) {
|
||||||
}
|
}
|
||||||
|
|
||||||
TEST(Expr, TestCompareWithScalarIndexMaris) {
|
TEST(Expr, TestCompareWithScalarIndexMaris) {
|
||||||
using namespace milvus;
|
|
||||||
using namespace milvus::query;
|
|
||||||
using namespace milvus::segcore;
|
|
||||||
std::vector<
|
std::vector<
|
||||||
std::tuple<std::string, std::function<bool(std::string, std::string)>>>
|
std::tuple<std::string, std::function<bool(std::string, std::string)>>>
|
||||||
testcases = {
|
testcases = {
|
||||||
|
|
@ -2760,9 +2679,6 @@ TEST(Expr, TestCompareWithScalarIndexMaris) {
|
||||||
}
|
}
|
||||||
|
|
||||||
TEST(Expr, TestBinaryArithOpEvalRange) {
|
TEST(Expr, TestBinaryArithOpEvalRange) {
|
||||||
using namespace milvus;
|
|
||||||
using namespace milvus::query;
|
|
||||||
using namespace milvus::segcore;
|
|
||||||
std::vector<std::tuple<std::string, std::function<bool(int)>, DataType>>
|
std::vector<std::tuple<std::string, std::function<bool(int)>, DataType>>
|
||||||
testcases = {
|
testcases = {
|
||||||
// Add test cases for BinaryArithOpEvalRangeExpr EQ of various data types
|
// Add test cases for BinaryArithOpEvalRangeExpr EQ of various data types
|
||||||
|
|
@ -3136,10 +3052,6 @@ TEST(Expr, TestBinaryArithOpEvalRange) {
|
||||||
}
|
}
|
||||||
|
|
||||||
TEST(Expr, TestBinaryArithOpEvalRangeJSON) {
|
TEST(Expr, TestBinaryArithOpEvalRangeJSON) {
|
||||||
using namespace milvus;
|
|
||||||
using namespace milvus::query;
|
|
||||||
using namespace milvus::segcore;
|
|
||||||
|
|
||||||
struct Testcase {
|
struct Testcase {
|
||||||
int64_t right_operand;
|
int64_t right_operand;
|
||||||
int64_t value;
|
int64_t value;
|
||||||
|
|
@ -3229,10 +3141,6 @@ TEST(Expr, TestBinaryArithOpEvalRangeJSON) {
|
||||||
}
|
}
|
||||||
|
|
||||||
TEST(Expr, TestBinaryArithOpEvalRangeJSONFloat) {
|
TEST(Expr, TestBinaryArithOpEvalRangeJSONFloat) {
|
||||||
using namespace milvus;
|
|
||||||
using namespace milvus::query;
|
|
||||||
using namespace milvus::segcore;
|
|
||||||
|
|
||||||
struct Testcase {
|
struct Testcase {
|
||||||
double right_operand;
|
double right_operand;
|
||||||
double value;
|
double value;
|
||||||
|
|
@ -3359,9 +3267,6 @@ TEST(Expr, TestBinaryArithOpEvalRangeJSONFloat) {
|
||||||
}
|
}
|
||||||
|
|
||||||
TEST(Expr, TestBinaryArithOpEvalRangeWithScalarSortIndex) {
|
TEST(Expr, TestBinaryArithOpEvalRangeWithScalarSortIndex) {
|
||||||
using namespace milvus;
|
|
||||||
using namespace milvus::query;
|
|
||||||
using namespace milvus::segcore;
|
|
||||||
std::vector<std::tuple<std::string, std::function<bool(int)>, DataType>>
|
std::vector<std::tuple<std::string, std::function<bool(int)>, DataType>>
|
||||||
testcases = {
|
testcases = {
|
||||||
// Add test cases for BinaryArithOpEvalRangeExpr EQ of various data types
|
// Add test cases for BinaryArithOpEvalRangeExpr EQ of various data types
|
||||||
|
|
@ -3678,9 +3583,6 @@ TEST(Expr, TestBinaryArithOpEvalRangeWithScalarSortIndex) {
|
||||||
}
|
}
|
||||||
|
|
||||||
TEST(Expr, TestUnaryRangeWithJSON) {
|
TEST(Expr, TestUnaryRangeWithJSON) {
|
||||||
using namespace milvus;
|
|
||||||
using namespace milvus::query;
|
|
||||||
using namespace milvus::segcore;
|
|
||||||
std::vector<
|
std::vector<
|
||||||
std::tuple<std::string,
|
std::tuple<std::string,
|
||||||
std::function<bool(
|
std::function<bool(
|
||||||
|
|
@ -3881,9 +3783,6 @@ TEST(Expr, TestUnaryRangeWithJSON) {
|
||||||
}
|
}
|
||||||
|
|
||||||
TEST(Expr, TestTermWithJSON) {
|
TEST(Expr, TestTermWithJSON) {
|
||||||
using namespace milvus;
|
|
||||||
using namespace milvus::query;
|
|
||||||
using namespace milvus::segcore;
|
|
||||||
std::vector<
|
std::vector<
|
||||||
std::tuple<std::string,
|
std::tuple<std::string,
|
||||||
std::function<bool(
|
std::function<bool(
|
||||||
|
|
@ -4062,9 +3961,6 @@ TEST(Expr, TestTermWithJSON) {
|
||||||
}
|
}
|
||||||
|
|
||||||
TEST(Expr, TestExistsWithJSON) {
|
TEST(Expr, TestExistsWithJSON) {
|
||||||
using namespace milvus;
|
|
||||||
using namespace milvus::query;
|
|
||||||
using namespace milvus::segcore;
|
|
||||||
std::vector<std::tuple<std::string, std::function<bool(bool)>, DataType>>
|
std::vector<std::tuple<std::string, std::function<bool(bool)>, DataType>>
|
||||||
testcases = {
|
testcases = {
|
||||||
{R"()", [](bool v) { return v; }, DataType::BOOL},
|
{R"()", [](bool v) { return v; }, DataType::BOOL},
|
||||||
|
|
@ -4225,10 +4121,6 @@ struct Testcase {
|
||||||
};
|
};
|
||||||
|
|
||||||
TEST(Expr, TestTermInFieldJson) {
|
TEST(Expr, TestTermInFieldJson) {
|
||||||
using namespace milvus;
|
|
||||||
using namespace milvus::query;
|
|
||||||
using namespace milvus::segcore;
|
|
||||||
|
|
||||||
auto schema = std::make_shared<Schema>();
|
auto schema = std::make_shared<Schema>();
|
||||||
auto i64_fid = schema->AddDebugField("id", DataType::INT64);
|
auto i64_fid = schema->AddDebugField("id", DataType::INT64);
|
||||||
auto json_fid = schema->AddDebugField("json", DataType::JSON);
|
auto json_fid = schema->AddDebugField("json", DataType::JSON);
|
||||||
|
|
@ -4445,10 +4337,6 @@ TEST(Expr, TestTermInFieldJson) {
|
||||||
}
|
}
|
||||||
|
|
||||||
TEST(Expr, PraseJsonContainsExpr) {
|
TEST(Expr, PraseJsonContainsExpr) {
|
||||||
using namespace milvus;
|
|
||||||
using namespace milvus::query;
|
|
||||||
using namespace milvus::segcore;
|
|
||||||
|
|
||||||
std::vector<const char*> raw_plans{
|
std::vector<const char*> raw_plans{
|
||||||
R"(vector_anns:<
|
R"(vector_anns:<
|
||||||
field_id:100
|
field_id:100
|
||||||
|
|
@ -4592,10 +4480,6 @@ TEST(Expr, PraseJsonContainsExpr) {
|
||||||
}
|
}
|
||||||
|
|
||||||
TEST(Expr, TestJsonContainsAny) {
|
TEST(Expr, TestJsonContainsAny) {
|
||||||
using namespace milvus;
|
|
||||||
using namespace milvus::query;
|
|
||||||
using namespace milvus::segcore;
|
|
||||||
|
|
||||||
auto schema = std::make_shared<Schema>();
|
auto schema = std::make_shared<Schema>();
|
||||||
auto i64_fid = schema->AddDebugField("id", DataType::INT64);
|
auto i64_fid = schema->AddDebugField("id", DataType::INT64);
|
||||||
auto json_fid = schema->AddDebugField("json", DataType::JSON);
|
auto json_fid = schema->AddDebugField("json", DataType::JSON);
|
||||||
|
|
@ -4816,10 +4700,6 @@ TEST(Expr, TestJsonContainsAny) {
|
||||||
}
|
}
|
||||||
|
|
||||||
TEST(Expr, TestJsonContainsAll) {
|
TEST(Expr, TestJsonContainsAll) {
|
||||||
using namespace milvus;
|
|
||||||
using namespace milvus::query;
|
|
||||||
using namespace milvus::segcore;
|
|
||||||
|
|
||||||
auto schema = std::make_shared<Schema>();
|
auto schema = std::make_shared<Schema>();
|
||||||
auto i64_fid = schema->AddDebugField("id", DataType::INT64);
|
auto i64_fid = schema->AddDebugField("id", DataType::INT64);
|
||||||
auto json_fid = schema->AddDebugField("json", DataType::JSON);
|
auto json_fid = schema->AddDebugField("json", DataType::JSON);
|
||||||
|
|
@ -5064,10 +4944,6 @@ TEST(Expr, TestJsonContainsAll) {
|
||||||
}
|
}
|
||||||
|
|
||||||
TEST(Expr, TestJsonContainsArray) {
|
TEST(Expr, TestJsonContainsArray) {
|
||||||
using namespace milvus;
|
|
||||||
using namespace milvus::query;
|
|
||||||
using namespace milvus::segcore;
|
|
||||||
|
|
||||||
auto schema = std::make_shared<Schema>();
|
auto schema = std::make_shared<Schema>();
|
||||||
auto i64_fid = schema->AddDebugField("id", DataType::INT64);
|
auto i64_fid = schema->AddDebugField("id", DataType::INT64);
|
||||||
auto json_fid = schema->AddDebugField("json", DataType::JSON);
|
auto json_fid = schema->AddDebugField("json", DataType::JSON);
|
||||||
|
|
@ -5371,8 +5247,6 @@ generatedArrayWithFourDiffType(int64_t int_val,
|
||||||
double float_val,
|
double float_val,
|
||||||
bool bool_val,
|
bool bool_val,
|
||||||
std::string string_val) {
|
std::string string_val) {
|
||||||
using namespace milvus;
|
|
||||||
|
|
||||||
proto::plan::GenericValue value;
|
proto::plan::GenericValue value;
|
||||||
proto::plan::Array diff_type_array;
|
proto::plan::Array diff_type_array;
|
||||||
diff_type_array.set_same_type(false);
|
diff_type_array.set_same_type(false);
|
||||||
|
|
@ -5397,10 +5271,6 @@ generatedArrayWithFourDiffType(int64_t int_val,
|
||||||
}
|
}
|
||||||
|
|
||||||
TEST(Expr, TestJsonContainsDiffTypeArray) {
|
TEST(Expr, TestJsonContainsDiffTypeArray) {
|
||||||
using namespace milvus;
|
|
||||||
using namespace milvus::query;
|
|
||||||
using namespace milvus::segcore;
|
|
||||||
|
|
||||||
auto schema = std::make_shared<Schema>();
|
auto schema = std::make_shared<Schema>();
|
||||||
auto i64_fid = schema->AddDebugField("id", DataType::INT64);
|
auto i64_fid = schema->AddDebugField("id", DataType::INT64);
|
||||||
auto json_fid = schema->AddDebugField("json", DataType::JSON);
|
auto json_fid = schema->AddDebugField("json", DataType::JSON);
|
||||||
|
|
@ -5503,10 +5373,6 @@ TEST(Expr, TestJsonContainsDiffTypeArray) {
|
||||||
}
|
}
|
||||||
|
|
||||||
TEST(Expr, TestJsonContainsDiffType) {
|
TEST(Expr, TestJsonContainsDiffType) {
|
||||||
using namespace milvus;
|
|
||||||
using namespace milvus::query;
|
|
||||||
using namespace milvus::segcore;
|
|
||||||
|
|
||||||
auto schema = std::make_shared<Schema>();
|
auto schema = std::make_shared<Schema>();
|
||||||
auto i64_fid = schema->AddDebugField("id", DataType::INT64);
|
auto i64_fid = schema->AddDebugField("id", DataType::INT64);
|
||||||
auto json_fid = schema->AddDebugField("json", DataType::JSON);
|
auto json_fid = schema->AddDebugField("json", DataType::JSON);
|
||||||
|
|
|
||||||
|
|
@ -43,19 +43,18 @@
|
||||||
#include "test_utils/AssertUtils.h"
|
#include "test_utils/AssertUtils.h"
|
||||||
#include "test_utils/DataGen.h"
|
#include "test_utils/DataGen.h"
|
||||||
|
|
||||||
using namespace milvus::segcore;
|
|
||||||
using namespace milvus;
|
using namespace milvus;
|
||||||
using namespace milvus::index;
|
using namespace milvus::index;
|
||||||
|
using namespace milvus::query;
|
||||||
|
using namespace milvus::segcore;
|
||||||
using namespace knowhere;
|
using namespace knowhere;
|
||||||
|
|
||||||
using milvus::index::VectorIndex;
|
using milvus::index::VectorIndex;
|
||||||
using milvus::segcore::LoadIndexInfo;
|
using milvus::segcore::LoadIndexInfo;
|
||||||
|
|
||||||
const int64_t ROW_COUNT = 100 * 1000;
|
const int64_t ROW_COUNT = 100 * 1000;
|
||||||
|
|
||||||
// TEST(Float16, Insert) {
|
// TEST(Float16, Insert) {
|
||||||
// using namespace milvus;
|
|
||||||
// using namespace milvus::query;
|
|
||||||
// using namespace milvus::segcore;
|
|
||||||
// int64_t N = ROW_COUNT;
|
// int64_t N = ROW_COUNT;
|
||||||
// constexpr int64_t size_per_chunk = 32 * 1024;
|
// constexpr int64_t size_per_chunk = 32 * 1024;
|
||||||
// auto schema = std::make_shared<Schema>();
|
// auto schema = std::make_shared<Schema>();
|
||||||
|
|
@ -93,9 +92,6 @@ const int64_t ROW_COUNT = 100 * 1000;
|
||||||
// }
|
// }
|
||||||
|
|
||||||
TEST(Float16, ShowExecutor) {
|
TEST(Float16, ShowExecutor) {
|
||||||
using namespace milvus::query;
|
|
||||||
using namespace milvus::segcore;
|
|
||||||
using namespace milvus;
|
|
||||||
auto metric_type = knowhere::metric::L2;
|
auto metric_type = knowhere::metric::L2;
|
||||||
auto node = std::make_unique<Float16VectorANNS>();
|
auto node = std::make_unique<Float16VectorANNS>();
|
||||||
auto schema = std::make_shared<Schema>();
|
auto schema = std::make_shared<Schema>();
|
||||||
|
|
@ -116,9 +112,6 @@ TEST(Float16, ShowExecutor) {
|
||||||
}
|
}
|
||||||
|
|
||||||
TEST(Float16, ExecWithoutPredicateFlat) {
|
TEST(Float16, ExecWithoutPredicateFlat) {
|
||||||
using namespace milvus::query;
|
|
||||||
using namespace milvus::segcore;
|
|
||||||
using namespace milvus;
|
|
||||||
auto schema = std::make_shared<Schema>();
|
auto schema = std::make_shared<Schema>();
|
||||||
auto vec_fid = schema->AddDebugField(
|
auto vec_fid = schema->AddDebugField(
|
||||||
"fakevec", DataType::VECTOR_FLOAT16, 32, knowhere::metric::L2);
|
"fakevec", DataType::VECTOR_FLOAT16, 32, knowhere::metric::L2);
|
||||||
|
|
@ -260,8 +253,6 @@ TEST(Float16, RetrieveEmpty) {
|
||||||
}
|
}
|
||||||
|
|
||||||
TEST(Float16, ExecWithPredicate) {
|
TEST(Float16, ExecWithPredicate) {
|
||||||
using namespace milvus::query;
|
|
||||||
using namespace milvus::segcore;
|
|
||||||
auto schema = std::make_shared<Schema>();
|
auto schema = std::make_shared<Schema>();
|
||||||
schema->AddDebugField(
|
schema->AddDebugField(
|
||||||
"fakevec", DataType::VECTOR_FLOAT16, 16, knowhere::metric::L2);
|
"fakevec", DataType::VECTOR_FLOAT16, 16, knowhere::metric::L2);
|
||||||
|
|
@ -320,9 +311,6 @@ TEST(Float16, ExecWithPredicate) {
|
||||||
}
|
}
|
||||||
|
|
||||||
// TEST(BFloat16, Insert) {
|
// TEST(BFloat16, Insert) {
|
||||||
// using namespace milvus;
|
|
||||||
// using namespace milvus::query;
|
|
||||||
// using namespace milvus::segcore;
|
|
||||||
// int64_t N = ROW_COUNT;
|
// int64_t N = ROW_COUNT;
|
||||||
// constexpr int64_t size_per_chunk = 32 * 1024;
|
// constexpr int64_t size_per_chunk = 32 * 1024;
|
||||||
// auto schema = std::make_shared<Schema>();
|
// auto schema = std::make_shared<Schema>();
|
||||||
|
|
@ -360,9 +348,6 @@ TEST(Float16, ExecWithPredicate) {
|
||||||
// }
|
// }
|
||||||
|
|
||||||
TEST(BFloat16, ShowExecutor) {
|
TEST(BFloat16, ShowExecutor) {
|
||||||
using namespace milvus::query;
|
|
||||||
using namespace milvus::segcore;
|
|
||||||
using namespace milvus;
|
|
||||||
auto metric_type = knowhere::metric::L2;
|
auto metric_type = knowhere::metric::L2;
|
||||||
auto node = std::make_unique<BFloat16VectorANNS>();
|
auto node = std::make_unique<BFloat16VectorANNS>();
|
||||||
auto schema = std::make_shared<Schema>();
|
auto schema = std::make_shared<Schema>();
|
||||||
|
|
@ -383,9 +368,6 @@ TEST(BFloat16, ShowExecutor) {
|
||||||
}
|
}
|
||||||
|
|
||||||
TEST(BFloat16, ExecWithoutPredicateFlat) {
|
TEST(BFloat16, ExecWithoutPredicateFlat) {
|
||||||
using namespace milvus::query;
|
|
||||||
using namespace milvus::segcore;
|
|
||||||
using namespace milvus;
|
|
||||||
auto schema = std::make_shared<Schema>();
|
auto schema = std::make_shared<Schema>();
|
||||||
auto vec_fid = schema->AddDebugField(
|
auto vec_fid = schema->AddDebugField(
|
||||||
"fakevec", DataType::VECTOR_BFLOAT16, 32, knowhere::metric::L2);
|
"fakevec", DataType::VECTOR_BFLOAT16, 32, knowhere::metric::L2);
|
||||||
|
|
@ -524,8 +506,6 @@ TEST(BFloat16, RetrieveEmpty) {
|
||||||
}
|
}
|
||||||
|
|
||||||
TEST(BFloat16, ExecWithPredicate) {
|
TEST(BFloat16, ExecWithPredicate) {
|
||||||
using namespace milvus::query;
|
|
||||||
using namespace milvus::segcore;
|
|
||||||
auto schema = std::make_shared<Schema>();
|
auto schema = std::make_shared<Schema>();
|
||||||
schema->AddDebugField(
|
schema->AddDebugField(
|
||||||
"fakevec", DataType::VECTOR_BFLOAT16, 16, knowhere::metric::L2);
|
"fakevec", DataType::VECTOR_BFLOAT16, 16, knowhere::metric::L2);
|
||||||
|
|
|
||||||
|
|
@ -11,18 +11,19 @@
|
||||||
|
|
||||||
#include <gtest/gtest.h>
|
#include <gtest/gtest.h>
|
||||||
#include "common/Schema.h"
|
#include "common/Schema.h"
|
||||||
#include "segcore/SegmentSealedImpl.h"
|
|
||||||
#include "test_utils/DataGen.h"
|
|
||||||
#include "query/Plan.h"
|
#include "query/Plan.h"
|
||||||
#include "segcore/segment_c.h"
|
#include "segcore/SegmentSealedImpl.h"
|
||||||
#include "segcore/reduce_c.h"
|
#include "segcore/reduce_c.h"
|
||||||
#include "test_utils/c_api_test_utils.h"
|
|
||||||
#include "segcore/plan_c.h"
|
#include "segcore/plan_c.h"
|
||||||
|
#include "segcore/segment_c.h"
|
||||||
|
#include "test_utils/DataGen.h"
|
||||||
|
#include "test_utils/c_api_test_utils.h"
|
||||||
|
|
||||||
using namespace milvus;
|
using namespace milvus;
|
||||||
using namespace milvus::segcore;
|
|
||||||
using namespace milvus::query;
|
using namespace milvus::query;
|
||||||
|
using namespace milvus::segcore;
|
||||||
using namespace milvus::storage;
|
using namespace milvus::storage;
|
||||||
|
using namespace milvus::tracer;
|
||||||
|
|
||||||
const char* METRICS_TYPE = "metric_type";
|
const char* METRICS_TYPE = "metric_type";
|
||||||
|
|
||||||
|
|
@ -604,10 +605,10 @@ TEST(GroupBY, Reduce) {
|
||||||
CSearchResult c_search_res_1;
|
CSearchResult c_search_res_1;
|
||||||
CSearchResult c_search_res_2;
|
CSearchResult c_search_res_2;
|
||||||
auto status =
|
auto status =
|
||||||
Search(c_segment_1, c_plan, c_ph_group, {}, 1L << 63, &c_search_res_1);
|
Search({}, c_segment_1, c_plan, c_ph_group, 1L << 63, &c_search_res_1);
|
||||||
ASSERT_EQ(status.error_code, Success);
|
ASSERT_EQ(status.error_code, Success);
|
||||||
status =
|
status =
|
||||||
Search(c_segment_2, c_plan, c_ph_group, {}, 1L << 63, &c_search_res_2);
|
Search({}, c_segment_2, c_plan, c_ph_group, 1L << 63, &c_search_res_2);
|
||||||
ASSERT_EQ(status.error_code, Success);
|
ASSERT_EQ(status.error_code, Success);
|
||||||
std::vector<CSearchResult> results;
|
std::vector<CSearchResult> results;
|
||||||
results.push_back(c_search_res_1);
|
results.push_back(c_search_res_1);
|
||||||
|
|
|
||||||
|
|
@ -12,14 +12,14 @@
|
||||||
#include <gtest/gtest.h>
|
#include <gtest/gtest.h>
|
||||||
|
|
||||||
#include "pb/plan.pb.h"
|
#include "pb/plan.pb.h"
|
||||||
|
#include "pb/schema.pb.h"
|
||||||
|
#include "query/Plan.h"
|
||||||
#include "segcore/SegmentGrowing.h"
|
#include "segcore/SegmentGrowing.h"
|
||||||
#include "segcore/SegmentGrowingImpl.h"
|
#include "segcore/SegmentGrowingImpl.h"
|
||||||
#include "pb/schema.pb.h"
|
|
||||||
#include "test_utils/DataGen.h"
|
#include "test_utils/DataGen.h"
|
||||||
#include "query/Plan.h"
|
|
||||||
|
|
||||||
using namespace milvus::segcore;
|
|
||||||
using namespace milvus;
|
using namespace milvus;
|
||||||
|
using namespace milvus::segcore;
|
||||||
namespace pb = milvus::proto;
|
namespace pb = milvus::proto;
|
||||||
|
|
||||||
TEST(GrowingIndex, Correctness) {
|
TEST(GrowingIndex, Correctness) {
|
||||||
|
|
|
||||||
|
|
@ -173,10 +173,14 @@ TEST(Indexing, BinaryBruteForce) {
|
||||||
query_data //
|
query_data //
|
||||||
};
|
};
|
||||||
|
|
||||||
|
SearchInfo search_info;
|
||||||
|
search_info.topk_ = topk;
|
||||||
|
search_info.round_decimal_ = round_decimal;
|
||||||
|
search_info.metric_type_ = metric_type;
|
||||||
auto sub_result = query::BruteForceSearch(search_dataset,
|
auto sub_result = query::BruteForceSearch(search_dataset,
|
||||||
bin_vec.data(),
|
bin_vec.data(),
|
||||||
N,
|
N,
|
||||||
knowhere::Json(),
|
search_info,
|
||||||
nullptr,
|
nullptr,
|
||||||
DataType::VECTOR_BINARY);
|
DataType::VECTOR_BINARY);
|
||||||
|
|
||||||
|
|
|
||||||
|
|
@ -9,13 +9,11 @@
|
||||||
// is distributed on an "AS IS" BASIS, WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express
|
// is distributed on an "AS IS" BASIS, WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express
|
||||||
// or implied. See the License for the specific language governing permissions and limitations under the License
|
// or implied. See the License for the specific language governing permissions and limitations under the License
|
||||||
|
|
||||||
#include <boost/format.hpp>
|
|
||||||
#include <gtest/gtest.h>
|
#include <gtest/gtest.h>
|
||||||
#include <cstdint>
|
#include <cstdint>
|
||||||
#include <memory>
|
#include <memory>
|
||||||
#include <regex>
|
#include <regex>
|
||||||
#include <vector>
|
#include <vector>
|
||||||
#include <chrono>
|
|
||||||
|
|
||||||
#include "common/Types.h"
|
#include "common/Types.h"
|
||||||
#include "query/Expr.h"
|
#include "query/Expr.h"
|
||||||
|
|
@ -25,10 +23,10 @@
|
||||||
#include "test_utils/DataGen.h"
|
#include "test_utils/DataGen.h"
|
||||||
|
|
||||||
using namespace milvus;
|
using namespace milvus;
|
||||||
|
using namespace milvus::query;
|
||||||
|
using namespace milvus::segcore;
|
||||||
|
|
||||||
TEST(Expr, IntegerOverflow) {
|
TEST(Expr, IntegerOverflow) {
|
||||||
using namespace milvus::query;
|
|
||||||
using namespace milvus::segcore;
|
|
||||||
std::vector<std::tuple<std::string, std::function<bool(int8_t)>>> testcases = {
|
std::vector<std::tuple<std::string, std::function<bool(int8_t)>>> testcases = {
|
||||||
/////////////////////////////////////////////////////////// term
|
/////////////////////////////////////////////////////////// term
|
||||||
{
|
{
|
||||||
|
|
|
||||||
|
|
@ -77,8 +77,6 @@ TEST(Query, ParsePlaceholderGroup) {
|
||||||
}
|
}
|
||||||
|
|
||||||
TEST(Query, ExecWithPredicateLoader) {
|
TEST(Query, ExecWithPredicateLoader) {
|
||||||
using namespace milvus::query;
|
|
||||||
using namespace milvus::segcore;
|
|
||||||
auto schema = std::make_shared<Schema>();
|
auto schema = std::make_shared<Schema>();
|
||||||
schema->AddDebugField(
|
schema->AddDebugField(
|
||||||
"fakevec", DataType::VECTOR_FLOAT, 16, knowhere::metric::L2);
|
"fakevec", DataType::VECTOR_FLOAT, 16, knowhere::metric::L2);
|
||||||
|
|
@ -161,8 +159,6 @@ TEST(Query, ExecWithPredicateLoader) {
|
||||||
}
|
}
|
||||||
|
|
||||||
TEST(Query, ExecWithPredicateSmallN) {
|
TEST(Query, ExecWithPredicateSmallN) {
|
||||||
using namespace milvus::query;
|
|
||||||
using namespace milvus::segcore;
|
|
||||||
auto schema = std::make_shared<Schema>();
|
auto schema = std::make_shared<Schema>();
|
||||||
schema->AddDebugField(
|
schema->AddDebugField(
|
||||||
"fakevec", DataType::VECTOR_FLOAT, 7, knowhere::metric::L2);
|
"fakevec", DataType::VECTOR_FLOAT, 7, knowhere::metric::L2);
|
||||||
|
|
@ -222,8 +218,6 @@ TEST(Query, ExecWithPredicateSmallN) {
|
||||||
}
|
}
|
||||||
|
|
||||||
TEST(Query, ExecWithPredicate) {
|
TEST(Query, ExecWithPredicate) {
|
||||||
using namespace milvus::query;
|
|
||||||
using namespace milvus::segcore;
|
|
||||||
auto schema = std::make_shared<Schema>();
|
auto schema = std::make_shared<Schema>();
|
||||||
schema->AddDebugField(
|
schema->AddDebugField(
|
||||||
"fakevec", DataType::VECTOR_FLOAT, 16, knowhere::metric::L2);
|
"fakevec", DataType::VECTOR_FLOAT, 16, knowhere::metric::L2);
|
||||||
|
|
@ -306,8 +300,6 @@ TEST(Query, ExecWithPredicate) {
|
||||||
}
|
}
|
||||||
|
|
||||||
TEST(Query, ExecTerm) {
|
TEST(Query, ExecTerm) {
|
||||||
using namespace milvus::query;
|
|
||||||
using namespace milvus::segcore;
|
|
||||||
auto schema = std::make_shared<Schema>();
|
auto schema = std::make_shared<Schema>();
|
||||||
schema->AddDebugField(
|
schema->AddDebugField(
|
||||||
"fakevec", DataType::VECTOR_FLOAT, 16, knowhere::metric::L2);
|
"fakevec", DataType::VECTOR_FLOAT, 16, knowhere::metric::L2);
|
||||||
|
|
@ -365,8 +357,6 @@ TEST(Query, ExecTerm) {
|
||||||
}
|
}
|
||||||
|
|
||||||
TEST(Query, ExecEmpty) {
|
TEST(Query, ExecEmpty) {
|
||||||
using namespace milvus::query;
|
|
||||||
using namespace milvus::segcore;
|
|
||||||
auto schema = std::make_shared<Schema>();
|
auto schema = std::make_shared<Schema>();
|
||||||
schema->AddDebugField("age", DataType::FLOAT);
|
schema->AddDebugField("age", DataType::FLOAT);
|
||||||
schema->AddDebugField(
|
schema->AddDebugField(
|
||||||
|
|
@ -406,8 +396,6 @@ TEST(Query, ExecEmpty) {
|
||||||
}
|
}
|
||||||
|
|
||||||
TEST(Query, ExecWithoutPredicateFlat) {
|
TEST(Query, ExecWithoutPredicateFlat) {
|
||||||
using namespace milvus::query;
|
|
||||||
using namespace milvus::segcore;
|
|
||||||
auto schema = std::make_shared<Schema>();
|
auto schema = std::make_shared<Schema>();
|
||||||
schema->AddDebugField("fakevec", DataType::VECTOR_FLOAT, 16, std::nullopt);
|
schema->AddDebugField("fakevec", DataType::VECTOR_FLOAT, 16, std::nullopt);
|
||||||
schema->AddDebugField("age", DataType::FLOAT);
|
schema->AddDebugField("age", DataType::FLOAT);
|
||||||
|
|
@ -448,8 +436,6 @@ TEST(Query, ExecWithoutPredicateFlat) {
|
||||||
}
|
}
|
||||||
|
|
||||||
TEST(Query, ExecWithoutPredicate) {
|
TEST(Query, ExecWithoutPredicate) {
|
||||||
using namespace milvus::query;
|
|
||||||
using namespace milvus::segcore;
|
|
||||||
auto schema = std::make_shared<Schema>();
|
auto schema = std::make_shared<Schema>();
|
||||||
schema->AddDebugField(
|
schema->AddDebugField(
|
||||||
"fakevec", DataType::VECTOR_FLOAT, 16, knowhere::metric::L2);
|
"fakevec", DataType::VECTOR_FLOAT, 16, knowhere::metric::L2);
|
||||||
|
|
@ -704,8 +690,6 @@ TEST(Query, FillSegment) {
|
||||||
}
|
}
|
||||||
|
|
||||||
TEST(Query, ExecWithPredicateBinary) {
|
TEST(Query, ExecWithPredicateBinary) {
|
||||||
using namespace milvus::query;
|
|
||||||
using namespace milvus::segcore;
|
|
||||||
auto schema = std::make_shared<Schema>();
|
auto schema = std::make_shared<Schema>();
|
||||||
auto vec_fid = schema->AddDebugField(
|
auto vec_fid = schema->AddDebugField(
|
||||||
"fakevec", DataType::VECTOR_BINARY, 512, knowhere::metric::JACCARD);
|
"fakevec", DataType::VECTOR_BINARY, 512, knowhere::metric::JACCARD);
|
||||||
|
|
|
||||||
|
|
@ -9,32 +9,32 @@
|
||||||
// is distributed on an "AS IS" BASIS, WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express
|
// is distributed on an "AS IS" BASIS, WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express
|
||||||
// or implied. See the License for the specific language governing permissions and limitations under the License
|
// or implied. See the License for the specific language governing permissions and limitations under the License
|
||||||
|
|
||||||
#include <gtest/gtest.h>
|
|
||||||
#include <boost/format.hpp>
|
#include <boost/format.hpp>
|
||||||
|
#include <gtest/gtest.h>
|
||||||
|
|
||||||
#include "common/Types.h"
|
#include "common/Types.h"
|
||||||
#include "segcore/SegmentSealedImpl.h"
|
#include "common/Tracer.h"
|
||||||
#include "test_utils/DataGen.h"
|
|
||||||
#include "test_utils/storage_test_utils.h"
|
|
||||||
#include "index/IndexFactory.h"
|
#include "index/IndexFactory.h"
|
||||||
#include "storage/Util.h"
|
|
||||||
#include "knowhere/version.h"
|
#include "knowhere/version.h"
|
||||||
|
#include "segcore/SegmentSealedImpl.h"
|
||||||
#include "storage/ChunkCacheSingleton.h"
|
#include "storage/ChunkCacheSingleton.h"
|
||||||
#include "storage/RemoteChunkManagerSingleton.h"
|
|
||||||
#include "storage/MinioChunkManager.h"
|
#include "storage/MinioChunkManager.h"
|
||||||
|
#include "storage/RemoteChunkManagerSingleton.h"
|
||||||
|
#include "storage/Util.h"
|
||||||
|
#include "test_utils/DataGen.h"
|
||||||
#include "test_utils/indexbuilder_test_utils.h"
|
#include "test_utils/indexbuilder_test_utils.h"
|
||||||
|
#include "test_utils/storage_test_utils.h"
|
||||||
|
|
||||||
using namespace milvus;
|
using namespace milvus;
|
||||||
using namespace milvus::query;
|
using namespace milvus::query;
|
||||||
using namespace milvus::segcore;
|
using namespace milvus::segcore;
|
||||||
|
|
||||||
using milvus::segcore::LoadIndexInfo;
|
using milvus::segcore::LoadIndexInfo;
|
||||||
|
|
||||||
const int64_t ROW_COUNT = 10 * 1000;
|
const int64_t ROW_COUNT = 10 * 1000;
|
||||||
const int64_t BIAS = 4200;
|
const int64_t BIAS = 4200;
|
||||||
|
|
||||||
TEST(Sealed, without_predicate) {
|
TEST(Sealed, without_predicate) {
|
||||||
using namespace milvus::query;
|
|
||||||
using namespace milvus::segcore;
|
|
||||||
auto schema = std::make_shared<Schema>();
|
auto schema = std::make_shared<Schema>();
|
||||||
auto dim = 16;
|
auto dim = 16;
|
||||||
auto topK = 5;
|
auto topK = 5;
|
||||||
|
|
@ -143,8 +143,6 @@ TEST(Sealed, without_predicate) {
|
||||||
}
|
}
|
||||||
|
|
||||||
TEST(Sealed, with_predicate) {
|
TEST(Sealed, with_predicate) {
|
||||||
using namespace milvus::query;
|
|
||||||
using namespace milvus::segcore;
|
|
||||||
auto schema = std::make_shared<Schema>();
|
auto schema = std::make_shared<Schema>();
|
||||||
auto dim = 16;
|
auto dim = 16;
|
||||||
auto topK = 5;
|
auto topK = 5;
|
||||||
|
|
@ -259,8 +257,6 @@ TEST(Sealed, with_predicate) {
|
||||||
}
|
}
|
||||||
|
|
||||||
TEST(Sealed, with_predicate_filter_all) {
|
TEST(Sealed, with_predicate_filter_all) {
|
||||||
using namespace milvus::query;
|
|
||||||
using namespace milvus::segcore;
|
|
||||||
auto schema = std::make_shared<Schema>();
|
auto schema = std::make_shared<Schema>();
|
||||||
auto dim = 16;
|
auto dim = 16;
|
||||||
auto topK = 5;
|
auto topK = 5;
|
||||||
|
|
|
||||||
|
|
@ -9,23 +9,26 @@
|
||||||
// is distributed on an "AS IS" BASIS, WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express
|
// is distributed on an "AS IS" BASIS, WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express
|
||||||
// or implied. See the License for the specific language governing permissions and limitations under the License
|
// or implied. See the License for the specific language governing permissions and limitations under the License
|
||||||
|
|
||||||
|
#include <boost/format.hpp>
|
||||||
#include <gtest/gtest.h>
|
#include <gtest/gtest.h>
|
||||||
#include <memory>
|
#include <memory>
|
||||||
#include <boost/format.hpp>
|
|
||||||
#include <regex>
|
#include <regex>
|
||||||
|
|
||||||
|
#include "common/Tracer.h"
|
||||||
#include "pb/plan.pb.h"
|
#include "pb/plan.pb.h"
|
||||||
#include "query/Expr.h"
|
#include "query/Expr.h"
|
||||||
#include "query/generated/PlanNodeVisitor.h"
|
#include "query/PlanProto.h"
|
||||||
|
#include "query/SearchBruteForce.h"
|
||||||
|
#include "query/Utils.h"
|
||||||
#include "query/generated/ExecExprVisitor.h"
|
#include "query/generated/ExecExprVisitor.h"
|
||||||
|
#include "query/generated/PlanNodeVisitor.h"
|
||||||
#include "segcore/SegmentGrowingImpl.h"
|
#include "segcore/SegmentGrowingImpl.h"
|
||||||
#include "test_utils/DataGen.h"
|
#include "test_utils/DataGen.h"
|
||||||
#include "test_utils/GenExprProto.h"
|
#include "test_utils/GenExprProto.h"
|
||||||
#include "query/PlanProto.h"
|
|
||||||
#include "query/Utils.h"
|
|
||||||
#include "query/SearchBruteForce.h"
|
|
||||||
|
|
||||||
using namespace milvus;
|
using namespace milvus;
|
||||||
|
using namespace milvus::query;
|
||||||
|
using namespace milvus::segcore;
|
||||||
|
|
||||||
namespace {
|
namespace {
|
||||||
auto
|
auto
|
||||||
|
|
@ -237,9 +240,6 @@ GenStrPKSchema() {
|
||||||
} // namespace
|
} // namespace
|
||||||
|
|
||||||
TEST(StringExpr, Term) {
|
TEST(StringExpr, Term) {
|
||||||
using namespace milvus::query;
|
|
||||||
using namespace milvus::segcore;
|
|
||||||
|
|
||||||
auto schema = GenTestSchema();
|
auto schema = GenTestSchema();
|
||||||
const auto& fvec_meta = schema->operator[](FieldName("fvec"));
|
const auto& fvec_meta = schema->operator[](FieldName("fvec"));
|
||||||
const auto& str_meta = schema->operator[](FieldName("str"));
|
const auto& str_meta = schema->operator[](FieldName("str"));
|
||||||
|
|
@ -301,9 +301,6 @@ TEST(StringExpr, Term) {
|
||||||
}
|
}
|
||||||
|
|
||||||
TEST(StringExpr, Compare) {
|
TEST(StringExpr, Compare) {
|
||||||
using namespace milvus::query;
|
|
||||||
using namespace milvus::segcore;
|
|
||||||
|
|
||||||
auto schema = GenTestSchema();
|
auto schema = GenTestSchema();
|
||||||
const auto& fvec_meta = schema->operator[](FieldName("fvec"));
|
const auto& fvec_meta = schema->operator[](FieldName("fvec"));
|
||||||
const auto& str_meta = schema->operator[](FieldName("str"));
|
const auto& str_meta = schema->operator[](FieldName("str"));
|
||||||
|
|
@ -419,9 +416,6 @@ TEST(StringExpr, Compare) {
|
||||||
}
|
}
|
||||||
|
|
||||||
TEST(StringExpr, UnaryRange) {
|
TEST(StringExpr, UnaryRange) {
|
||||||
using namespace milvus::query;
|
|
||||||
using namespace milvus::segcore;
|
|
||||||
|
|
||||||
auto schema = GenTestSchema();
|
auto schema = GenTestSchema();
|
||||||
const auto& fvec_meta = schema->operator[](FieldName("fvec"));
|
const auto& fvec_meta = schema->operator[](FieldName("fvec"));
|
||||||
const auto& str_meta = schema->operator[](FieldName("str"));
|
const auto& str_meta = schema->operator[](FieldName("str"));
|
||||||
|
|
@ -518,9 +512,6 @@ TEST(StringExpr, UnaryRange) {
|
||||||
}
|
}
|
||||||
|
|
||||||
TEST(StringExpr, BinaryRange) {
|
TEST(StringExpr, BinaryRange) {
|
||||||
using namespace milvus::query;
|
|
||||||
using namespace milvus::segcore;
|
|
||||||
|
|
||||||
auto schema = GenTestSchema();
|
auto schema = GenTestSchema();
|
||||||
const auto& fvec_meta = schema->operator[](FieldName("fvec"));
|
const auto& fvec_meta = schema->operator[](FieldName("fvec"));
|
||||||
const auto& str_meta = schema->operator[](FieldName("str"));
|
const auto& str_meta = schema->operator[](FieldName("str"));
|
||||||
|
|
@ -636,9 +627,6 @@ TEST(StringExpr, BinaryRange) {
|
||||||
}
|
}
|
||||||
|
|
||||||
TEST(AlwaysTrueStringPlan, SearchWithOutputFields) {
|
TEST(AlwaysTrueStringPlan, SearchWithOutputFields) {
|
||||||
using namespace milvus::query;
|
|
||||||
using namespace milvus::segcore;
|
|
||||||
|
|
||||||
auto schema = GenStrPKSchema();
|
auto schema = GenStrPKSchema();
|
||||||
const auto& fvec_meta = schema->operator[](FieldName("fvec"));
|
const auto& fvec_meta = schema->operator[](FieldName("fvec"));
|
||||||
const auto& str_meta = schema->operator[](FieldName("str"));
|
const auto& str_meta = schema->operator[](FieldName("str"));
|
||||||
|
|
@ -671,18 +659,24 @@ TEST(AlwaysTrueStringPlan, SearchWithOutputFields) {
|
||||||
|
|
||||||
std::vector<const PlaceholderGroup*> ph_group_arr = {ph_group.get()};
|
std::vector<const PlaceholderGroup*> ph_group_arr = {ph_group.get()};
|
||||||
|
|
||||||
|
MetricType metric_type = knowhere::metric::L2;
|
||||||
query::dataset::SearchDataset search_dataset{
|
query::dataset::SearchDataset search_dataset{
|
||||||
knowhere::metric::L2, //
|
metric_type, //
|
||||||
num_queries, //
|
num_queries, //
|
||||||
topk, //
|
topk, //
|
||||||
round_decimal,
|
round_decimal,
|
||||||
dim, //
|
dim, //
|
||||||
query_ptr //
|
query_ptr //
|
||||||
};
|
};
|
||||||
|
|
||||||
|
SearchInfo search_info;
|
||||||
|
search_info.topk_ = topk;
|
||||||
|
search_info.round_decimal_ = round_decimal;
|
||||||
|
search_info.metric_type_ = metric_type;
|
||||||
auto sub_result = BruteForceSearch(search_dataset,
|
auto sub_result = BruteForceSearch(search_dataset,
|
||||||
vec_col.data(),
|
vec_col.data(),
|
||||||
N,
|
N,
|
||||||
knowhere::Json(),
|
search_info,
|
||||||
nullptr,
|
nullptr,
|
||||||
DataType::VECTOR_FLOAT);
|
DataType::VECTOR_FLOAT);
|
||||||
|
|
||||||
|
|
@ -708,9 +702,6 @@ TEST(AlwaysTrueStringPlan, SearchWithOutputFields) {
|
||||||
}
|
}
|
||||||
|
|
||||||
TEST(AlwaysTrueStringPlan, QueryWithOutputFields) {
|
TEST(AlwaysTrueStringPlan, QueryWithOutputFields) {
|
||||||
using namespace milvus::query;
|
|
||||||
using namespace milvus::segcore;
|
|
||||||
|
|
||||||
auto schema = GenStrPKSchema();
|
auto schema = GenStrPKSchema();
|
||||||
const auto& fvec_meta = schema->operator[](FieldName("fvec"));
|
const auto& fvec_meta = schema->operator[](FieldName("fvec"));
|
||||||
const auto& str_meta = schema->operator[](FieldName("str"));
|
const auto& str_meta = schema->operator[](FieldName("str"));
|
||||||
|
|
|
||||||
|
|
@ -25,7 +25,7 @@ TEST(Tracer, Init) {
|
||||||
auto config = std::make_shared<TraceConfig>();
|
auto config = std::make_shared<TraceConfig>();
|
||||||
config->exporter = "stdout";
|
config->exporter = "stdout";
|
||||||
config->nodeID = 1;
|
config->nodeID = 1;
|
||||||
initTelementry(config.get());
|
initTelemetry(*config);
|
||||||
auto span = StartSpan("test");
|
auto span = StartSpan("test");
|
||||||
Assert(span->IsRecording());
|
Assert(span->IsRecording());
|
||||||
|
|
||||||
|
|
@ -33,7 +33,7 @@ TEST(Tracer, Init) {
|
||||||
config->exporter = "jaeger";
|
config->exporter = "jaeger";
|
||||||
config->jaegerURL = "http://localhost:14268/api/traces";
|
config->jaegerURL = "http://localhost:14268/api/traces";
|
||||||
config->nodeID = 1;
|
config->nodeID = 1;
|
||||||
initTelementry(config.get());
|
initTelemetry(*config);
|
||||||
span = StartSpan("test");
|
span = StartSpan("test");
|
||||||
Assert(span->IsRecording());
|
Assert(span->IsRecording());
|
||||||
}
|
}
|
||||||
|
|
@ -42,28 +42,13 @@ TEST(Tracer, Span) {
|
||||||
auto config = std::make_shared<TraceConfig>();
|
auto config = std::make_shared<TraceConfig>();
|
||||||
config->exporter = "stdout";
|
config->exporter = "stdout";
|
||||||
config->nodeID = 1;
|
config->nodeID = 1;
|
||||||
initTelementry(config.get());
|
initTelemetry(*config);
|
||||||
|
|
||||||
auto ctx = std::make_shared<TraceContext>();
|
auto ctx = std::make_shared<TraceContext>();
|
||||||
ctx->traceID = new uint8_t[16]{0x01,
|
ctx->traceID = new uint8_t[16]{0x01, 0x23, 0x45, 0x67, 0x89, 0xab, 0xcd, 0xef,
|
||||||
0x23,
|
0xfe, 0xdc, 0xba, 0x98, 0x76, 0x54, 0x32, 0x10};
|
||||||
0x45,
|
ctx->spanID = new uint8_t[8]{0x01, 0x23, 0x45, 0x67, 0x89, 0xab, 0xcd, 0xef};
|
||||||
0x67,
|
ctx->traceFlags = 1;
|
||||||
0x89,
|
|
||||||
0xab,
|
|
||||||
0xcd,
|
|
||||||
0xef,
|
|
||||||
0xfe,
|
|
||||||
0xdc,
|
|
||||||
0xba,
|
|
||||||
0x98,
|
|
||||||
0x76,
|
|
||||||
0x54,
|
|
||||||
0x32,
|
|
||||||
0x10};
|
|
||||||
ctx->spanID =
|
|
||||||
new uint8_t[8]{0x01, 0x23, 0x45, 0x67, 0x89, 0xab, 0xcd, 0xef};
|
|
||||||
ctx->flag = 1;
|
|
||||||
auto span = StartSpan("test", ctx.get());
|
auto span = StartSpan("test", ctx.get());
|
||||||
|
|
||||||
Assert(span->GetContext().trace_id() == trace::TraceId({ctx->traceID, 16}));
|
Assert(span->GetContext().trace_id() == trace::TraceId({ctx->traceID, 16}));
|
||||||
|
|
|
||||||
|
|
@ -214,9 +214,9 @@ func (li *LoadIndexInfo) appendIndexData(ctx context.Context, indexKeys []string
|
||||||
traceID := span.SpanContext().TraceID()
|
traceID := span.SpanContext().TraceID()
|
||||||
spanID := span.SpanContext().SpanID()
|
spanID := span.SpanContext().SpanID()
|
||||||
traceCtx := C.CTraceContext{
|
traceCtx := C.CTraceContext{
|
||||||
traceID: (*C.uint8_t)(unsafe.Pointer(&traceID[0])),
|
traceID: (*C.uint8_t)(unsafe.Pointer(&traceID[0])),
|
||||||
spanID: (*C.uint8_t)(unsafe.Pointer(&spanID[0])),
|
spanID: (*C.uint8_t)(unsafe.Pointer(&spanID[0])),
|
||||||
flag: C.uchar(span.SpanContext().TraceFlags()),
|
traceFlags: (C.uint8_t)(span.SpanContext().TraceFlags()),
|
||||||
}
|
}
|
||||||
|
|
||||||
status = C.AppendIndexV2(traceCtx, li.cLoadIndexInfo)
|
status = C.AppendIndexV2(traceCtx, li.cLoadIndexInfo)
|
||||||
|
|
|
||||||
|
|
@ -476,9 +476,9 @@ func (s *LocalSegment) Search(ctx context.Context, searchReq *SearchRequest) (*S
|
||||||
traceID := span.SpanContext().TraceID()
|
traceID := span.SpanContext().TraceID()
|
||||||
spanID := span.SpanContext().SpanID()
|
spanID := span.SpanContext().SpanID()
|
||||||
traceCtx := C.CTraceContext{
|
traceCtx := C.CTraceContext{
|
||||||
traceID: (*C.uint8_t)(unsafe.Pointer(&traceID[0])),
|
traceID: (*C.uint8_t)(unsafe.Pointer(&traceID[0])),
|
||||||
spanID: (*C.uint8_t)(unsafe.Pointer(&spanID[0])),
|
spanID: (*C.uint8_t)(unsafe.Pointer(&spanID[0])),
|
||||||
flag: C.uchar(span.SpanContext().TraceFlags()),
|
traceFlags: (C.uint8_t)(span.SpanContext().TraceFlags()),
|
||||||
}
|
}
|
||||||
|
|
||||||
hasIndex := s.ExistIndex(searchReq.searchFieldID)
|
hasIndex := s.ExistIndex(searchReq.searchFieldID)
|
||||||
|
|
@ -489,10 +489,10 @@ func (s *LocalSegment) Search(ctx context.Context, searchReq *SearchRequest) (*S
|
||||||
var status C.CStatus
|
var status C.CStatus
|
||||||
GetSQPool().Submit(func() (any, error) {
|
GetSQPool().Submit(func() (any, error) {
|
||||||
tr := timerecord.NewTimeRecorder("cgoSearch")
|
tr := timerecord.NewTimeRecorder("cgoSearch")
|
||||||
status = C.Search(s.ptr,
|
status = C.Search(traceCtx,
|
||||||
|
s.ptr,
|
||||||
searchReq.plan.cSearchPlan,
|
searchReq.plan.cSearchPlan,
|
||||||
searchReq.cPlaceholderGroup,
|
searchReq.cPlaceholderGroup,
|
||||||
traceCtx,
|
|
||||||
C.uint64_t(searchReq.mvccTimestamp),
|
C.uint64_t(searchReq.mvccTimestamp),
|
||||||
&searchResult.cSearchResult,
|
&searchResult.cSearchResult,
|
||||||
)
|
)
|
||||||
|
|
@ -530,9 +530,9 @@ func (s *LocalSegment) Retrieve(ctx context.Context, plan *RetrievePlan) (*segco
|
||||||
traceID := span.SpanContext().TraceID()
|
traceID := span.SpanContext().TraceID()
|
||||||
spanID := span.SpanContext().SpanID()
|
spanID := span.SpanContext().SpanID()
|
||||||
traceCtx := C.CTraceContext{
|
traceCtx := C.CTraceContext{
|
||||||
traceID: (*C.uint8_t)(unsafe.Pointer(&traceID[0])),
|
traceID: (*C.uint8_t)(unsafe.Pointer(&traceID[0])),
|
||||||
spanID: (*C.uint8_t)(unsafe.Pointer(&spanID[0])),
|
spanID: (*C.uint8_t)(unsafe.Pointer(&spanID[0])),
|
||||||
flag: C.uchar(span.SpanContext().TraceFlags()),
|
traceFlags: (C.uint8_t)(span.SpanContext().TraceFlags()),
|
||||||
}
|
}
|
||||||
|
|
||||||
maxLimitSize := paramtable.Get().QuotaConfig.MaxOutputSize.GetAsInt64()
|
maxLimitSize := paramtable.Get().QuotaConfig.MaxOutputSize.GetAsInt64()
|
||||||
|
|
@ -541,9 +541,9 @@ func (s *LocalSegment) Retrieve(ctx context.Context, plan *RetrievePlan) (*segco
|
||||||
GetSQPool().Submit(func() (any, error) {
|
GetSQPool().Submit(func() (any, error) {
|
||||||
ts := C.uint64_t(plan.Timestamp)
|
ts := C.uint64_t(plan.Timestamp)
|
||||||
tr := timerecord.NewTimeRecorder("cgoRetrieve")
|
tr := timerecord.NewTimeRecorder("cgoRetrieve")
|
||||||
status = C.Retrieve(s.ptr,
|
status = C.Retrieve(traceCtx,
|
||||||
|
s.ptr,
|
||||||
plan.cRetrievePlan,
|
plan.cRetrievePlan,
|
||||||
traceCtx,
|
|
||||||
ts,
|
ts,
|
||||||
&retrieveResult.cRetrieveResult,
|
&retrieveResult.cRetrieveResult,
|
||||||
C.int64_t(maxLimitSize))
|
C.int64_t(maxLimitSize))
|
||||||
|
|
|
||||||
Loading…
Reference in New Issue