mirror of https://github.com/milvus-io/milvus.git
fix: pass active count to query context instead of timestamp (#29541)
#29319 Signed-off-by: luzhang <luzhang@zilliz.com> Co-authored-by: luzhang <luzhang@zilliz.com>pull/29610/head
parent
ae640e7c80
commit
79c417b14e
|
@ -174,6 +174,7 @@ class QueryContext : public Context {
|
|||
public:
|
||||
QueryContext(const std::string& query_id,
|
||||
const milvus::segcore::SegmentInternalInterface* segment,
|
||||
int64_t active_count,
|
||||
milvus::Timestamp timestamp,
|
||||
std::shared_ptr<QueryConfig> query_config =
|
||||
std::make_shared<QueryConfig>(),
|
||||
|
@ -183,6 +184,7 @@ class QueryContext : public Context {
|
|||
: Context(ContextScope::QUERY),
|
||||
query_id_(query_id),
|
||||
segment_(segment),
|
||||
active_count_(active_count),
|
||||
query_timestamp_(timestamp),
|
||||
query_config_(query_config),
|
||||
executor_(executor) {
|
||||
|
@ -218,6 +220,11 @@ class QueryContext : public Context {
|
|||
return query_timestamp_;
|
||||
}
|
||||
|
||||
int64_t
|
||||
get_active_count() {
|
||||
return active_count_;
|
||||
}
|
||||
|
||||
private:
|
||||
folly::Executor* executor_;
|
||||
//folly::Executor::KeepAlive<> executor_keepalive_;
|
||||
|
@ -227,6 +234,8 @@ class QueryContext : public Context {
|
|||
|
||||
// current segment that query execute in
|
||||
const milvus::segcore::SegmentInternalInterface* segment_;
|
||||
// num rows for current query
|
||||
int64_t active_count_;
|
||||
// timestamp this query generate
|
||||
milvus::Timestamp query_timestamp_;
|
||||
};
|
||||
|
|
|
@ -21,8 +21,8 @@ namespace exec {
|
|||
|
||||
void
|
||||
PhyAlwaysTrueExpr::Eval(EvalCtx& context, VectorPtr& result) {
|
||||
int64_t real_batch_size = current_pos_ + batch_size_ >= num_rows_
|
||||
? num_rows_ - current_pos_
|
||||
int64_t real_batch_size = current_pos_ + batch_size_ >= active_count_
|
||||
? active_count_ - current_pos_
|
||||
: batch_size_;
|
||||
|
||||
if (real_batch_size == 0) {
|
||||
|
|
|
@ -34,12 +34,12 @@ class PhyAlwaysTrueExpr : public Expr {
|
|||
const std::shared_ptr<const milvus::expr::AlwaysTrueExpr>& expr,
|
||||
const std::string& name,
|
||||
const segcore::SegmentInternalInterface* segment,
|
||||
Timestamp query_timestamp,
|
||||
int64_t active_count,
|
||||
int64_t batch_size)
|
||||
: Expr(DataType::BOOL, std::move(input), name),
|
||||
expr_(expr),
|
||||
active_count_(active_count),
|
||||
batch_size_(batch_size) {
|
||||
num_rows_ = segment->get_active_count(query_timestamp);
|
||||
}
|
||||
|
||||
void
|
||||
|
@ -47,7 +47,7 @@ class PhyAlwaysTrueExpr : public Expr {
|
|||
|
||||
private:
|
||||
std::shared_ptr<const milvus::expr::AlwaysTrueExpr> expr_;
|
||||
int64_t num_rows_;
|
||||
int64_t active_count_;
|
||||
int64_t current_pos_{0};
|
||||
int64_t batch_size_;
|
||||
};
|
||||
|
|
|
@ -171,13 +171,13 @@ class PhyBinaryArithOpEvalRangeExpr : public SegmentExpr {
|
|||
expr,
|
||||
const std::string& name,
|
||||
const segcore::SegmentInternalInterface* segment,
|
||||
Timestamp query_timestamp,
|
||||
int64_t active_count,
|
||||
int64_t batch_size)
|
||||
: SegmentExpr(std::move(input),
|
||||
name,
|
||||
segment,
|
||||
expr->column_.field_id_,
|
||||
query_timestamp,
|
||||
active_count,
|
||||
batch_size),
|
||||
expr_(expr) {
|
||||
}
|
||||
|
|
|
@ -136,8 +136,8 @@ PhyBinaryRangeFilterExpr::PreCheckOverflow(HighPrecisionType& val1,
|
|||
val1 = GetValueFromProto<HighPrecisionType>(expr_->lower_val_);
|
||||
val2 = GetValueFromProto<HighPrecisionType>(expr_->upper_val_);
|
||||
auto get_next_overflow_batch = [this]() -> ColumnVectorPtr {
|
||||
int64_t batch_size = overflow_check_pos_ + batch_size_ >= num_rows_
|
||||
? num_rows_ - overflow_check_pos_
|
||||
int64_t batch_size = overflow_check_pos_ + batch_size_ >= active_count_
|
||||
? active_count_ - overflow_check_pos_
|
||||
: batch_size_;
|
||||
overflow_check_pos_ += batch_size;
|
||||
if (cached_overflow_res_ != nullptr &&
|
||||
|
|
|
@ -169,13 +169,13 @@ class PhyBinaryRangeFilterExpr : public SegmentExpr {
|
|||
const std::shared_ptr<const milvus::expr::BinaryRangeFilterExpr>& expr,
|
||||
const std::string& name,
|
||||
const segcore::SegmentInternalInterface* segment,
|
||||
Timestamp query_timestamp,
|
||||
int64_t active_count,
|
||||
int64_t batch_size)
|
||||
: SegmentExpr(std::move(input),
|
||||
name,
|
||||
segment,
|
||||
expr->column_.field_id_,
|
||||
query_timestamp,
|
||||
active_count,
|
||||
batch_size),
|
||||
expr_(expr) {
|
||||
}
|
||||
|
|
|
@ -32,8 +32,9 @@ PhyCompareFilterExpr::GetNextBatchSize() {
|
|||
segment_->type() == SegmentType::Growing
|
||||
? current_chunk_id_ * size_per_chunk_ + current_chunk_pos_
|
||||
: current_chunk_pos_;
|
||||
return current_rows + batch_size_ >= num_rows_ ? num_rows_ - current_rows
|
||||
: batch_size_;
|
||||
return current_rows + batch_size_ >= active_count_
|
||||
? active_count_ - current_rows
|
||||
: batch_size_;
|
||||
}
|
||||
|
||||
template <typename T>
|
||||
|
@ -127,7 +128,7 @@ PhyCompareFilterExpr::ExecCompareExprDispatcher(OpType op) {
|
|||
for (int64_t chunk_id = current_chunk_id_; chunk_id < num_chunk_;
|
||||
++chunk_id) {
|
||||
auto chunk_size = chunk_id == num_chunk_ - 1
|
||||
? num_rows_ - chunk_id * size_per_chunk_
|
||||
? active_count_ - chunk_id * size_per_chunk_
|
||||
: size_per_chunk_;
|
||||
auto left = GetChunkData(expr_->left_data_type_,
|
||||
expr_->left_field_id_,
|
||||
|
|
|
@ -72,22 +72,21 @@ class PhyCompareFilterExpr : public Expr {
|
|||
const std::shared_ptr<const milvus::expr::CompareExpr>& expr,
|
||||
const std::string& name,
|
||||
const segcore::SegmentInternalInterface* segment,
|
||||
Timestamp query_timestamp,
|
||||
int64_t active_count,
|
||||
int64_t batch_size)
|
||||
: Expr(DataType::BOOL, std::move(input), name),
|
||||
left_field_(expr->left_field_id_),
|
||||
right_field_(expr->right_field_id_),
|
||||
segment_(segment),
|
||||
query_timestamp_(query_timestamp),
|
||||
active_count_(active_count),
|
||||
batch_size_(batch_size),
|
||||
expr_(expr) {
|
||||
is_left_indexed_ = segment_->HasIndex(left_field_);
|
||||
is_right_indexed_ = segment_->HasIndex(right_field_);
|
||||
num_rows_ = segment_->get_active_count(query_timestamp_);
|
||||
size_per_chunk_ = segment_->size_per_chunk();
|
||||
num_chunk_ = is_left_indexed_
|
||||
? segment_->num_chunk_index(expr_->left_field_id_)
|
||||
: segment_->num_chunk_data(expr_->left_field_id_);
|
||||
size_per_chunk_ = segment_->size_per_chunk();
|
||||
: upper_div(active_count_, size_per_chunk_);
|
||||
AssertInfo(
|
||||
batch_size_ > 0,
|
||||
fmt::format("expr batch size should greater than zero, but now: {}",
|
||||
|
@ -117,11 +116,14 @@ class PhyCompareFilterExpr : public Expr {
|
|||
auto left_chunk = segment_->chunk_data<T>(left_field_, i);
|
||||
auto right_chunk = segment_->chunk_data<U>(right_field_, i);
|
||||
auto data_pos = (i == current_chunk_id_) ? current_chunk_pos_ : 0;
|
||||
auto size = (i == (num_chunk_ - 1))
|
||||
? (segment_->type() == SegmentType::Growing
|
||||
? num_rows_ % size_per_chunk_ - data_pos
|
||||
: num_rows_ - data_pos)
|
||||
: size_per_chunk_ - data_pos;
|
||||
auto size =
|
||||
(i == (num_chunk_ - 1))
|
||||
? (segment_->type() == SegmentType::Growing
|
||||
? (active_count_ % size_per_chunk_ == 0
|
||||
? size_per_chunk_ - data_pos
|
||||
: active_count_ % size_per_chunk_ - data_pos)
|
||||
: active_count_ - data_pos)
|
||||
: size_per_chunk_ - data_pos;
|
||||
|
||||
if (processed_size + size >= batch_size_) {
|
||||
size = batch_size_ - processed_size;
|
||||
|
@ -171,14 +173,13 @@ class PhyCompareFilterExpr : public Expr {
|
|||
const FieldId right_field_;
|
||||
bool is_left_indexed_;
|
||||
bool is_right_indexed_;
|
||||
int64_t num_rows_{0};
|
||||
int64_t active_count_{0};
|
||||
int64_t num_chunk_{0};
|
||||
int64_t current_chunk_id_{0};
|
||||
int64_t current_chunk_pos_{0};
|
||||
int64_t size_per_chunk_{0};
|
||||
|
||||
const segcore::SegmentInternalInterface* segment_;
|
||||
Timestamp query_timestamp_;
|
||||
int64_t batch_size_;
|
||||
std::shared_ptr<const milvus::expr::CompareExpr> expr_;
|
||||
};
|
||||
|
|
|
@ -41,13 +41,13 @@ class PhyExistsFilterExpr : public SegmentExpr {
|
|||
const std::shared_ptr<const milvus::expr::ExistsExpr>& expr,
|
||||
const std::string& name,
|
||||
const segcore::SegmentInternalInterface* segment,
|
||||
Timestamp query_timestamp,
|
||||
int64_t active_count,
|
||||
int64_t batch_size)
|
||||
: SegmentExpr(std::move(input),
|
||||
name,
|
||||
segment,
|
||||
expr->column_.field_id_,
|
||||
query_timestamp,
|
||||
active_count,
|
||||
batch_size),
|
||||
expr_(expr) {
|
||||
}
|
||||
|
|
|
@ -162,7 +162,7 @@ CompileExpression(const expr::TypedExprPtr& expr,
|
|||
casted_expr,
|
||||
"PhyUnaryRangeFilterExpr",
|
||||
context->get_segment(),
|
||||
context->get_query_timestamp(),
|
||||
context->get_active_count(),
|
||||
context->query_config()->get_expr_batch_size());
|
||||
} else if (auto casted_expr = std::dynamic_pointer_cast<
|
||||
const milvus::expr::LogicalUnaryExpr>(expr)) {
|
||||
|
@ -175,6 +175,7 @@ CompileExpression(const expr::TypedExprPtr& expr,
|
|||
casted_expr,
|
||||
"PhyTermFilterExpr",
|
||||
context->get_segment(),
|
||||
context->get_active_count(),
|
||||
context->get_query_timestamp(),
|
||||
context->query_config()->get_expr_batch_size());
|
||||
} else if (auto casted_expr = std::dynamic_pointer_cast<
|
||||
|
@ -198,7 +199,7 @@ CompileExpression(const expr::TypedExprPtr& expr,
|
|||
casted_expr,
|
||||
"PhyBinaryRangeFilterExpr",
|
||||
context->get_segment(),
|
||||
context->get_query_timestamp(),
|
||||
context->get_active_count(),
|
||||
context->query_config()->get_expr_batch_size());
|
||||
} else if (auto casted_expr = std::dynamic_pointer_cast<
|
||||
const milvus::expr::AlwaysTrueExpr>(expr)) {
|
||||
|
@ -207,7 +208,7 @@ CompileExpression(const expr::TypedExprPtr& expr,
|
|||
casted_expr,
|
||||
"PhyAlwaysTrueExpr",
|
||||
context->get_segment(),
|
||||
context->get_query_timestamp(),
|
||||
context->get_active_count(),
|
||||
context->query_config()->get_expr_batch_size());
|
||||
} else if (auto casted_expr = std::dynamic_pointer_cast<
|
||||
const milvus::expr::BinaryArithOpEvalRangeExpr>(expr)) {
|
||||
|
@ -216,7 +217,7 @@ CompileExpression(const expr::TypedExprPtr& expr,
|
|||
casted_expr,
|
||||
"PhyBinaryArithOpEvalRangeExpr",
|
||||
context->get_segment(),
|
||||
context->get_query_timestamp(),
|
||||
context->get_active_count(),
|
||||
context->query_config()->get_expr_batch_size());
|
||||
} else if (auto casted_expr =
|
||||
std::dynamic_pointer_cast<const milvus::expr::CompareExpr>(
|
||||
|
@ -226,7 +227,7 @@ CompileExpression(const expr::TypedExprPtr& expr,
|
|||
casted_expr,
|
||||
"PhyCompareFilterExpr",
|
||||
context->get_segment(),
|
||||
context->get_query_timestamp(),
|
||||
context->get_active_count(),
|
||||
context->query_config()->get_expr_batch_size());
|
||||
} else if (auto casted_expr =
|
||||
std::dynamic_pointer_cast<const milvus::expr::ExistsExpr>(
|
||||
|
@ -236,7 +237,7 @@ CompileExpression(const expr::TypedExprPtr& expr,
|
|||
casted_expr,
|
||||
"PhyExistsFilterExpr",
|
||||
context->get_segment(),
|
||||
context->get_query_timestamp(),
|
||||
context->get_active_count(),
|
||||
context->query_config()->get_expr_batch_size());
|
||||
} else if (auto casted_expr = std::dynamic_pointer_cast<
|
||||
const milvus::expr::JsonContainsExpr>(expr)) {
|
||||
|
@ -245,7 +246,7 @@ CompileExpression(const expr::TypedExprPtr& expr,
|
|||
casted_expr,
|
||||
"PhyJsonContainsFilterExpr",
|
||||
context->get_segment(),
|
||||
context->get_query_timestamp(),
|
||||
context->get_active_count(),
|
||||
context->query_config()->get_expr_batch_size());
|
||||
}
|
||||
return result;
|
||||
|
|
|
@ -83,14 +83,13 @@ class SegmentExpr : public Expr {
|
|||
const std::string& name,
|
||||
const segcore::SegmentInternalInterface* segment,
|
||||
const FieldId& field_id,
|
||||
Timestamp query_timestamp,
|
||||
int64_t active_count,
|
||||
int64_t batch_size)
|
||||
: Expr(DataType::BOOL, std::move(input), name),
|
||||
segment_(segment),
|
||||
field_id_(field_id),
|
||||
query_timestamp_(query_timestamp),
|
||||
active_count_(active_count),
|
||||
batch_size_(batch_size) {
|
||||
num_rows_ = segment_->get_active_count(query_timestamp_);
|
||||
size_per_chunk_ = segment_->size_per_chunk();
|
||||
AssertInfo(
|
||||
batch_size_ > 0,
|
||||
|
@ -115,7 +114,7 @@ class SegmentExpr : public Expr {
|
|||
if (is_index_mode_) {
|
||||
num_index_chunk_ = segment_->num_chunk_index(field_id_);
|
||||
} else {
|
||||
num_data_chunk_ = segment_->num_chunk_data(field_id_);
|
||||
num_data_chunk_ = upper_div(active_count_, size_per_chunk_);
|
||||
}
|
||||
}
|
||||
|
||||
|
@ -126,8 +125,8 @@ class SegmentExpr : public Expr {
|
|||
auto current_chunk_pos =
|
||||
is_index_mode_ ? current_index_chunk_pos_ : current_data_chunk_pos_;
|
||||
auto current_rows = current_chunk * size_per_chunk_ + current_chunk_pos;
|
||||
return current_rows + batch_size_ >= num_rows_
|
||||
? num_rows_ - current_rows
|
||||
return current_rows + batch_size_ >= active_count_
|
||||
? active_count_ - current_rows
|
||||
: batch_size_;
|
||||
}
|
||||
|
||||
|
@ -143,11 +142,14 @@ class SegmentExpr : public Expr {
|
|||
for (size_t i = current_data_chunk_; i < num_data_chunk_; i++) {
|
||||
auto data_pos =
|
||||
(i == current_data_chunk_) ? current_data_chunk_pos_ : 0;
|
||||
auto size = (i == (num_data_chunk_ - 1))
|
||||
? (segment_->type() == SegmentType::Growing
|
||||
? num_rows_ % size_per_chunk_ - data_pos
|
||||
: num_rows_ - data_pos)
|
||||
: size_per_chunk_ - data_pos;
|
||||
auto size =
|
||||
(i == (num_data_chunk_ - 1))
|
||||
? (segment_->type() == SegmentType::Growing
|
||||
? (active_count_ % size_per_chunk_ == 0
|
||||
? size_per_chunk_ - data_pos
|
||||
: active_count_ % size_per_chunk_ - data_pos)
|
||||
: active_count_ - data_pos)
|
||||
: size_per_chunk_ - data_pos;
|
||||
|
||||
size = std::min(size, batch_size_ - processed_size);
|
||||
|
||||
|
@ -229,7 +231,6 @@ class SegmentExpr : public Expr {
|
|||
const FieldId field_id_;
|
||||
bool is_pk_field_{false};
|
||||
DataType pk_type_;
|
||||
Timestamp query_timestamp_;
|
||||
int64_t batch_size_;
|
||||
|
||||
// State indicate position that expr computing at
|
||||
|
@ -237,7 +238,7 @@ class SegmentExpr : public Expr {
|
|||
bool is_index_mode_{false};
|
||||
bool is_data_mode_{false};
|
||||
|
||||
int64_t num_rows_{0};
|
||||
int64_t active_count_{0};
|
||||
int64_t num_data_chunk_{0};
|
||||
int64_t num_index_chunk_{0};
|
||||
int64_t current_data_chunk_{0};
|
||||
|
|
|
@ -34,13 +34,13 @@ class PhyJsonContainsFilterExpr : public SegmentExpr {
|
|||
const std::shared_ptr<const milvus::expr::JsonContainsExpr>& expr,
|
||||
const std::string& name,
|
||||
const segcore::SegmentInternalInterface* segment,
|
||||
Timestamp query_timestamp,
|
||||
int64_t active_count,
|
||||
int64_t batch_size)
|
||||
: SegmentExpr(std::move(input),
|
||||
name,
|
||||
segment,
|
||||
expr->column_.field_id_,
|
||||
query_timestamp,
|
||||
active_count,
|
||||
batch_size),
|
||||
expr_(expr) {
|
||||
}
|
||||
|
|
|
@ -130,7 +130,7 @@ PhyTermFilterExpr::CanSkipSegment() {
|
|||
// using skip index to help skipping this segment
|
||||
if (segment_->type() == SegmentType::Sealed &&
|
||||
skip_index.CanSkipBinaryRange<T>(field_id_, 0, min, max, true, true)) {
|
||||
cached_bits_.resize(num_rows_, false);
|
||||
cached_bits_.resize(active_count_, false);
|
||||
cached_offsets_ = std::make_shared<ColumnVector>(DataType::INT64, 0);
|
||||
cached_offsets_inited_ = true;
|
||||
return true;
|
||||
|
@ -169,7 +169,7 @@ PhyTermFilterExpr::InitPkCacheOffset() {
|
|||
|
||||
auto [uids, seg_offsets] =
|
||||
segment_->search_ids(*id_array, query_timestamp_);
|
||||
cached_bits_.resize(num_rows_, false);
|
||||
cached_bits_.resize(active_count_, false);
|
||||
cached_offsets_ =
|
||||
std::make_shared<ColumnVector>(DataType::INT64, seg_offsets.size());
|
||||
int64_t* cached_offsets_ptr = (int64_t*)cached_offsets_->GetRawData();
|
||||
|
@ -188,9 +188,10 @@ PhyTermFilterExpr::ExecPkTermImpl() {
|
|||
InitPkCacheOffset();
|
||||
}
|
||||
|
||||
auto real_batch_size = current_data_chunk_pos_ + batch_size_ >= num_rows_
|
||||
? num_rows_ - current_data_chunk_pos_
|
||||
: batch_size_;
|
||||
auto real_batch_size =
|
||||
current_data_chunk_pos_ + batch_size_ >= active_count_
|
||||
? active_count_ - current_data_chunk_pos_
|
||||
: batch_size_;
|
||||
|
||||
if (real_batch_size == 0) {
|
||||
return nullptr;
|
||||
|
|
|
@ -66,15 +66,17 @@ class PhyTermFilterExpr : public SegmentExpr {
|
|||
const std::shared_ptr<const milvus::expr::TermFilterExpr>& expr,
|
||||
const std::string& name,
|
||||
const segcore::SegmentInternalInterface* segment,
|
||||
Timestamp query_timestamp,
|
||||
int64_t active_count,
|
||||
milvus::Timestamp timestamp,
|
||||
int64_t batch_size)
|
||||
: SegmentExpr(std::move(input),
|
||||
name,
|
||||
segment,
|
||||
expr->column_.field_id_,
|
||||
query_timestamp,
|
||||
active_count,
|
||||
batch_size),
|
||||
expr_(expr) {
|
||||
expr_(expr),
|
||||
query_timestamp_(timestamp) {
|
||||
}
|
||||
|
||||
void
|
||||
|
@ -129,6 +131,7 @@ class PhyTermFilterExpr : public SegmentExpr {
|
|||
|
||||
private:
|
||||
std::shared_ptr<const milvus::expr::TermFilterExpr> expr_;
|
||||
milvus::Timestamp query_timestamp_;
|
||||
// If expr is like "pk in (..)", can use pk index to optimize
|
||||
bool cached_offsets_inited_{false};
|
||||
ColumnVectorPtr cached_offsets_;
|
||||
|
|
|
@ -439,9 +439,10 @@ PhyUnaryRangeFilterExpr::PreCheckOverflow() {
|
|||
int64_t val = GetValueFromProto<int64_t>(expr_->val_);
|
||||
|
||||
if (milvus::query::out_of_range<T>(val)) {
|
||||
int64_t batch_size = overflow_check_pos_ + batch_size_ >= num_rows_
|
||||
? num_rows_ - overflow_check_pos_
|
||||
: batch_size_;
|
||||
int64_t batch_size =
|
||||
overflow_check_pos_ + batch_size_ >= active_count_
|
||||
? active_count_ - overflow_check_pos_
|
||||
: batch_size_;
|
||||
overflow_check_pos_ += batch_size;
|
||||
if (cached_overflow_res_ != nullptr &&
|
||||
cached_overflow_res_->size() == batch_size) {
|
||||
|
@ -583,9 +584,14 @@ PhyUnaryRangeFilterExpr::ExecRangeVisitorImplForData() {
|
|||
ProcessDataChunks<T>(execute_sub_batch, skip_index_func, res, val);
|
||||
AssertInfo(processed_size == real_batch_size,
|
||||
"internal error: expr processed rows {} not equal "
|
||||
"expect batch size {}",
|
||||
"expect batch size {}, related params[active_count:{}, "
|
||||
"current_data_chunk:{}, num_data_chunk:{}, current_data_pos:{}]",
|
||||
processed_size,
|
||||
real_batch_size);
|
||||
real_batch_size,
|
||||
active_count_,
|
||||
current_data_chunk_,
|
||||
num_data_chunk_,
|
||||
current_data_chunk_pos_);
|
||||
return res_vec;
|
||||
}
|
||||
|
||||
|
|
|
@ -171,13 +171,13 @@ class PhyUnaryRangeFilterExpr : public SegmentExpr {
|
|||
const std::shared_ptr<const milvus::expr::UnaryRangeFilterExpr>& expr,
|
||||
const std::string& name,
|
||||
const segcore::SegmentInternalInterface* segment,
|
||||
Timestamp query_timestamp,
|
||||
int64_t active_count,
|
||||
int64_t batch_size)
|
||||
: SegmentExpr(std::move(input),
|
||||
name,
|
||||
segment,
|
||||
expr->column_.field_id_,
|
||||
query_timestamp,
|
||||
active_count,
|
||||
batch_size),
|
||||
expr_(expr) {
|
||||
}
|
||||
|
|
|
@ -32,8 +32,7 @@ FilterBits::FilterBits(
|
|||
std::vector<expr::TypedExprPtr> filters;
|
||||
filters.emplace_back(filter->filter());
|
||||
exprs_ = std::make_unique<ExprSet>(filters, exec_context);
|
||||
need_process_rows_ = query_context->get_segment()->get_active_count(
|
||||
query_context->get_query_timestamp());
|
||||
need_process_rows_ = query_context->get_active_count();
|
||||
num_processed_rows_ = 0;
|
||||
}
|
||||
|
||||
|
|
|
@ -101,6 +101,7 @@ class ExecPlanNodeVisitor : public PlanNodeVisitor {
|
|||
ExecuteExprNodeInternal(
|
||||
const std::shared_ptr<milvus::plan::PlanNode>& plannode,
|
||||
const milvus::segcore::SegmentInternalInterface* segment,
|
||||
int64_t active_count,
|
||||
BitsetType& result,
|
||||
bool& cache_offset_getted,
|
||||
std::vector<int64_t>& cache_offset);
|
||||
|
@ -108,11 +109,16 @@ class ExecPlanNodeVisitor : public PlanNodeVisitor {
|
|||
void
|
||||
ExecuteExprNode(const std::shared_ptr<milvus::plan::PlanNode>& plannode,
|
||||
const milvus::segcore::SegmentInternalInterface* segment,
|
||||
int64_t active_count,
|
||||
BitsetType& result) {
|
||||
bool get_cache_offset;
|
||||
std::vector<int64_t> cache_offsets;
|
||||
ExecuteExprNodeInternal(
|
||||
plannode, segment, result, get_cache_offset, cache_offsets);
|
||||
ExecuteExprNodeInternal(plannode,
|
||||
segment,
|
||||
active_count,
|
||||
result,
|
||||
get_cache_offset,
|
||||
cache_offsets);
|
||||
}
|
||||
|
||||
private:
|
||||
|
|
|
@ -74,15 +74,19 @@ void
|
|||
ExecPlanNodeVisitor::ExecuteExprNodeInternal(
|
||||
const std::shared_ptr<milvus::plan::PlanNode>& plannode,
|
||||
const milvus::segcore::SegmentInternalInterface* segment,
|
||||
int64_t active_count,
|
||||
BitsetType& bitset_holder,
|
||||
bool& cache_offset_getted,
|
||||
std::vector<int64_t>& cache_offset) {
|
||||
bitset_holder.clear();
|
||||
LOG_INFO("plannode: {}", plannode->ToString());
|
||||
LOG_INFO("plannode: {}, active_count: {}, timestamp: {}",
|
||||
plannode->ToString(),
|
||||
active_count,
|
||||
timestamp_);
|
||||
auto plan = plan::PlanFragment(plannode);
|
||||
// TODO: get query id from proxy
|
||||
auto query_context = std::make_shared<milvus::exec::QueryContext>(
|
||||
DEAFULT_QUERY_ID, segment, timestamp_);
|
||||
DEAFULT_QUERY_ID, segment, active_count, timestamp_);
|
||||
|
||||
auto task =
|
||||
milvus::exec::Task::Create(DEFAULT_TASK_ID, plan, 0, query_context);
|
||||
|
@ -113,7 +117,6 @@ ExecPlanNodeVisitor::ExecuteExprNodeInternal(
|
|||
// If get empty cached offsets. mean no record hits in this segment
|
||||
// no need to get next batch.
|
||||
if (cache_offset_vec->size() == 0) {
|
||||
auto active_count = segment->get_active_count(timestamp_);
|
||||
bitset_holder.resize(active_count);
|
||||
task->RequestCancel();
|
||||
break;
|
||||
|
@ -161,7 +164,8 @@ ExecPlanNodeVisitor::VectorVisitorImpl(VectorPlanNode& node) {
|
|||
std::unique_ptr<BitsetType> bitset_holder;
|
||||
if (node.filter_plannode_.has_value()) {
|
||||
BitsetType expr_res;
|
||||
ExecuteExprNode(node.filter_plannode_.value(), segment, expr_res);
|
||||
ExecuteExprNode(
|
||||
node.filter_plannode_.value(), segment, active_count, expr_res);
|
||||
bitset_holder = std::make_unique<BitsetType>(expr_res);
|
||||
bitset_holder->flip();
|
||||
} else {
|
||||
|
@ -233,6 +237,7 @@ ExecPlanNodeVisitor::visit(RetrievePlanNode& node) {
|
|||
if (node.filter_plannode_.has_value()) {
|
||||
ExecuteExprNodeInternal(node.filter_plannode_.value(),
|
||||
segment,
|
||||
active_count,
|
||||
bitset_holder,
|
||||
get_cache_offset,
|
||||
cache_offsets);
|
||||
|
|
|
@ -55,7 +55,7 @@ TEST(Expr, AlwaysTrue) {
|
|||
BitsetType final;
|
||||
std::shared_ptr<milvus::plan::PlanNode> plan =
|
||||
std::make_shared<plan::FilterBitsNode>(DEFAULT_PLANNODE_ID, expr);
|
||||
visitor.ExecuteExprNode(plan, seg_promote, final);
|
||||
visitor.ExecuteExprNode(plan, seg_promote, N * num_iters, final);
|
||||
EXPECT_EQ(final.size(), N * num_iters);
|
||||
|
||||
for (int i = 0; i < N * num_iters; ++i) {
|
||||
|
|
|
@ -606,8 +606,10 @@ TEST(Expr, TestArrayRange) {
|
|||
auto plan =
|
||||
CreateSearchPlanByExpr(*schema, plan_str.data(), plan_str.size());
|
||||
BitsetType final;
|
||||
visitor.ExecuteExprNode(
|
||||
plan->plan_node_->filter_plannode_.value(), seg_promote, final);
|
||||
visitor.ExecuteExprNode(plan->plan_node_->filter_plannode_.value(),
|
||||
seg_promote,
|
||||
N * num_iters,
|
||||
final);
|
||||
EXPECT_EQ(final.size(), N * num_iters);
|
||||
|
||||
for (int i = 0; i < N * num_iters; ++i) {
|
||||
|
@ -724,8 +726,10 @@ TEST(Expr, TestArrayEqual) {
|
|||
auto plan =
|
||||
CreateSearchPlanByExpr(*schema, plan_str.data(), plan_str.size());
|
||||
BitsetType final;
|
||||
visitor.ExecuteExprNode(
|
||||
plan->plan_node_->filter_plannode_.value(), seg_promote, final);
|
||||
visitor.ExecuteExprNode(plan->plan_node_->filter_plannode_.value(),
|
||||
seg_promote,
|
||||
N * num_iters,
|
||||
final);
|
||||
EXPECT_EQ(final.size(), N * num_iters);
|
||||
|
||||
for (int i = 0; i < N * num_iters; ++i) {
|
||||
|
@ -924,7 +928,7 @@ TEST(Expr, TestArrayContains) {
|
|||
BitsetType final;
|
||||
auto plan =
|
||||
std::make_shared<plan::FilterBitsNode>(DEFAULT_PLANNODE_ID, expr);
|
||||
visitor.ExecuteExprNode(plan, seg_promote, final);
|
||||
visitor.ExecuteExprNode(plan, seg_promote, N * num_iters, final);
|
||||
std::cout << "cost"
|
||||
<< std::chrono::duration_cast<std::chrono::microseconds>(
|
||||
std::chrono::steady_clock::now() - start)
|
||||
|
@ -978,7 +982,7 @@ TEST(Expr, TestArrayContains) {
|
|||
BitsetType final;
|
||||
auto plan =
|
||||
std::make_shared<plan::FilterBitsNode>(DEFAULT_PLANNODE_ID, expr);
|
||||
visitor.ExecuteExprNode(plan, seg_promote, final);
|
||||
visitor.ExecuteExprNode(plan, seg_promote, N * num_iters, final);
|
||||
std::cout << "cost"
|
||||
<< std::chrono::duration_cast<std::chrono::microseconds>(
|
||||
std::chrono::steady_clock::now() - start)
|
||||
|
@ -1022,7 +1026,7 @@ TEST(Expr, TestArrayContains) {
|
|||
BitsetType final;
|
||||
auto plan =
|
||||
std::make_shared<plan::FilterBitsNode>(DEFAULT_PLANNODE_ID, expr);
|
||||
visitor.ExecuteExprNode(plan, seg_promote, final);
|
||||
visitor.ExecuteExprNode(plan, seg_promote, N * num_iters, final);
|
||||
std::cout << "cost"
|
||||
<< std::chrono::duration_cast<std::chrono::microseconds>(
|
||||
std::chrono::steady_clock::now() - start)
|
||||
|
@ -1076,7 +1080,7 @@ TEST(Expr, TestArrayContains) {
|
|||
BitsetType final;
|
||||
auto plan =
|
||||
std::make_shared<plan::FilterBitsNode>(DEFAULT_PLANNODE_ID, expr);
|
||||
visitor.ExecuteExprNode(plan, seg_promote, final);
|
||||
visitor.ExecuteExprNode(plan, seg_promote, N * num_iters, final);
|
||||
std::cout << "cost"
|
||||
<< std::chrono::duration_cast<std::chrono::microseconds>(
|
||||
std::chrono::steady_clock::now() - start)
|
||||
|
@ -1121,7 +1125,7 @@ TEST(Expr, TestArrayContains) {
|
|||
BitsetType final;
|
||||
auto plan =
|
||||
std::make_shared<plan::FilterBitsNode>(DEFAULT_PLANNODE_ID, expr);
|
||||
visitor.ExecuteExprNode(plan, seg_promote, final);
|
||||
visitor.ExecuteExprNode(plan, seg_promote, N * num_iters, final);
|
||||
std::cout << "cost"
|
||||
<< std::chrono::duration_cast<std::chrono::microseconds>(
|
||||
std::chrono::steady_clock::now() - start)
|
||||
|
@ -1173,7 +1177,7 @@ TEST(Expr, TestArrayContains) {
|
|||
BitsetType final;
|
||||
auto plan =
|
||||
std::make_shared<plan::FilterBitsNode>(DEFAULT_PLANNODE_ID, expr);
|
||||
visitor.ExecuteExprNode(plan, seg_promote, final);
|
||||
visitor.ExecuteExprNode(plan, seg_promote, N * num_iters, final);
|
||||
std::cout << "cost"
|
||||
<< std::chrono::duration_cast<std::chrono::microseconds>(
|
||||
std::chrono::steady_clock::now() - start)
|
||||
|
@ -1737,8 +1741,10 @@ TEST(Expr, TestArrayBinaryArith) {
|
|||
auto plan =
|
||||
CreateSearchPlanByExpr(*schema, plan_str.data(), plan_str.size());
|
||||
BitsetType final;
|
||||
visitor.ExecuteExprNode(
|
||||
plan->plan_node_->filter_plannode_.value(), seg_promote, final);
|
||||
visitor.ExecuteExprNode(plan->plan_node_->filter_plannode_.value(),
|
||||
seg_promote,
|
||||
N * num_iters,
|
||||
final);
|
||||
EXPECT_EQ(final.size(), N * num_iters);
|
||||
|
||||
for (int i = 0; i < N * num_iters; ++i) {
|
||||
|
@ -1827,7 +1833,7 @@ TEST(Expr, TestArrayStringMatch) {
|
|||
BitsetType final;
|
||||
auto plan =
|
||||
std::make_shared<plan::FilterBitsNode>(DEFAULT_PLANNODE_ID, expr);
|
||||
visitor.ExecuteExprNode(plan, seg_promote, final);
|
||||
visitor.ExecuteExprNode(plan, seg_promote, N * num_iters, final);
|
||||
std::cout << "cost"
|
||||
<< std::chrono::duration_cast<std::chrono::microseconds>(
|
||||
std::chrono::steady_clock::now() - start)
|
||||
|
@ -2036,8 +2042,10 @@ TEST(Expr, TestArrayInTerm) {
|
|||
auto plan =
|
||||
CreateSearchPlanByExpr(*schema, plan_str.data(), plan_str.size());
|
||||
BitsetType final;
|
||||
visitor.ExecuteExprNode(
|
||||
plan->plan_node_->filter_plannode_.value(), seg_promote, final);
|
||||
visitor.ExecuteExprNode(plan->plan_node_->filter_plannode_.value(),
|
||||
seg_promote,
|
||||
N * num_iters,
|
||||
final);
|
||||
EXPECT_EQ(final.size(), N * num_iters);
|
||||
|
||||
for (int i = 0; i < N * num_iters; ++i) {
|
||||
|
@ -2126,7 +2134,7 @@ TEST(Expr, TestTermInArray) {
|
|||
BitsetType final;
|
||||
auto plan =
|
||||
std::make_shared<plan::FilterBitsNode>(DEFAULT_PLANNODE_ID, expr);
|
||||
visitor.ExecuteExprNode(plan, seg_promote, final);
|
||||
visitor.ExecuteExprNode(plan, seg_promote, N * num_iters, final);
|
||||
std::cout << "cost"
|
||||
<< std::chrono::duration_cast<std::chrono::microseconds>(
|
||||
std::chrono::steady_clock::now() - start)
|
||||
|
|
|
@ -126,6 +126,7 @@ TEST_F(TaskTest, UnaryExpr) {
|
|||
auto query_context = std::make_shared<milvus::exec::QueryContext>(
|
||||
"test1",
|
||||
segment_.get(),
|
||||
1000000,
|
||||
MAX_TIMESTAMP,
|
||||
std::make_shared<milvus::exec::QueryConfig>(
|
||||
std::unordered_map<std::string, std::string>{}));
|
||||
|
@ -169,6 +170,7 @@ TEST_F(TaskTest, LogicalExpr) {
|
|||
auto query_context = std::make_shared<milvus::exec::QueryContext>(
|
||||
"test1",
|
||||
segment_.get(),
|
||||
1000000,
|
||||
MAX_TIMESTAMP,
|
||||
std::make_shared<milvus::exec::QueryConfig>(
|
||||
std::unordered_map<std::string, std::string>{}));
|
||||
|
@ -191,7 +193,7 @@ TEST_F(TaskTest, LogicalExpr) {
|
|||
EXPECT_EQ(num_rows, num_rows_);
|
||||
}
|
||||
|
||||
TEST(CompileInputs, and) {
|
||||
TEST_F(TaskTest, CompileInputs_and) {
|
||||
using namespace milvus;
|
||||
using namespace milvus::query;
|
||||
using namespace milvus::segcore;
|
||||
|
@ -199,7 +201,6 @@ TEST(CompileInputs, and) {
|
|||
auto vec_fid = schema->AddDebugField(
|
||||
"fakevec", DataType::VECTOR_FLOAT, 16, knowhere::metric::L2);
|
||||
auto int64_fid = schema->AddDebugField("int64", DataType::INT64);
|
||||
auto seg = CreateSealedSegment(schema);
|
||||
proto::plan::GenericValue val;
|
||||
val.set_int64_val(10);
|
||||
// expr: (int64_fid < 10 and int64_fid < 10) and (int64_fid < 10 and int64_fid < 10)
|
||||
|
@ -226,7 +227,7 @@ TEST(CompileInputs, and) {
|
|||
auto expr7 = std::make_shared<expr::LogicalBinaryExpr>(
|
||||
expr::LogicalBinaryExpr::OpType::And, expr3, expr6);
|
||||
auto query_context = std::make_shared<milvus::exec::QueryContext>(
|
||||
DEAFULT_QUERY_ID, seg.get(), MAX_TIMESTAMP);
|
||||
DEAFULT_QUERY_ID, segment_.get(), 1000000, MAX_TIMESTAMP);
|
||||
auto exprs = milvus::exec::CompileInputs(expr7, query_context.get(), {});
|
||||
EXPECT_EQ(exprs.size(), 4);
|
||||
for (int i = 0; i < exprs.size(); ++i) {
|
||||
|
@ -235,7 +236,7 @@ TEST(CompileInputs, and) {
|
|||
}
|
||||
}
|
||||
|
||||
TEST(CompileInputs, or_with_and) {
|
||||
TEST_F(TaskTest, CompileInputs_or_with_and) {
|
||||
using namespace milvus;
|
||||
using namespace milvus::query;
|
||||
using namespace milvus::segcore;
|
||||
|
@ -243,7 +244,6 @@ TEST(CompileInputs, or_with_and) {
|
|||
auto vec_fid = schema->AddDebugField(
|
||||
"fakevec", DataType::VECTOR_FLOAT, 16, knowhere::metric::L2);
|
||||
auto int64_fid = schema->AddDebugField("int64", DataType::INT64);
|
||||
auto seg = CreateSealedSegment(schema);
|
||||
proto::plan::GenericValue val;
|
||||
val.set_int64_val(10);
|
||||
{
|
||||
|
@ -269,7 +269,7 @@ TEST(CompileInputs, or_with_and) {
|
|||
auto expr6 = std::make_shared<expr::LogicalBinaryExpr>(
|
||||
expr::LogicalBinaryExpr::OpType::And, expr1, expr2);
|
||||
auto query_context = std::make_shared<milvus::exec::QueryContext>(
|
||||
DEAFULT_QUERY_ID, seg.get(), MAX_TIMESTAMP);
|
||||
DEAFULT_QUERY_ID, segment_.get(), 1000000, MAX_TIMESTAMP);
|
||||
auto expr7 = std::make_shared<expr::LogicalBinaryExpr>(
|
||||
expr::LogicalBinaryExpr::OpType::Or, expr3, expr6);
|
||||
auto exprs =
|
||||
|
@ -303,7 +303,7 @@ TEST(CompileInputs, or_with_and) {
|
|||
auto expr6 = std::make_shared<expr::LogicalBinaryExpr>(
|
||||
expr::LogicalBinaryExpr::OpType::And, expr1, expr2);
|
||||
auto query_context = std::make_shared<milvus::exec::QueryContext>(
|
||||
DEAFULT_QUERY_ID, seg.get(), MAX_TIMESTAMP);
|
||||
DEAFULT_QUERY_ID, segment_.get(), 1000000, MAX_TIMESTAMP);
|
||||
auto expr7 = std::make_shared<expr::LogicalBinaryExpr>(
|
||||
expr::LogicalBinaryExpr::OpType::Or, expr3, expr6);
|
||||
auto exprs =
|
||||
|
@ -340,7 +340,7 @@ TEST(CompileInputs, or_with_and) {
|
|||
auto expr6 = std::make_shared<expr::LogicalBinaryExpr>(
|
||||
expr::LogicalBinaryExpr::OpType::And, expr1, expr2);
|
||||
auto query_context = std::make_shared<milvus::exec::QueryContext>(
|
||||
DEAFULT_QUERY_ID, seg.get(), MAX_TIMESTAMP);
|
||||
DEAFULT_QUERY_ID, segment_.get(), 1000000, MAX_TIMESTAMP);
|
||||
auto expr7 = std::make_shared<expr::LogicalBinaryExpr>(
|
||||
expr::LogicalBinaryExpr::OpType::And, expr3, expr6);
|
||||
auto exprs =
|
||||
|
|
|
@ -512,8 +512,10 @@ TEST(Expr, TestRange) {
|
|||
CreateSearchPlanByExpr(*schema, plan_str.data(), plan_str.size());
|
||||
query::ExecPlanNodeVisitor visitor(*seg_promote, MAX_TIMESTAMP);
|
||||
BitsetType final;
|
||||
visitor.ExecuteExprNode(
|
||||
plan->plan_node_->filter_plannode_.value(), seg_promote, final);
|
||||
visitor.ExecuteExprNode(plan->plan_node_->filter_plannode_.value(),
|
||||
seg_promote,
|
||||
N * num_iters,
|
||||
final);
|
||||
EXPECT_EQ(final.size(), N * num_iters);
|
||||
|
||||
for (int i = 0; i < N * num_iters; ++i) {
|
||||
|
@ -602,7 +604,7 @@ TEST(Expr, TestBinaryRangeJSON) {
|
|||
plan.filter_plannode_ =
|
||||
std::make_shared<plan::FilterBitsNode>(DEFAULT_PLANNODE_ID, expr);
|
||||
visitor.ExecuteExprNode(
|
||||
plan.filter_plannode_.value(), seg_promote, final);
|
||||
plan.filter_plannode_.value(), seg_promote, N * num_iters, final);
|
||||
EXPECT_EQ(final.size(), N * num_iters);
|
||||
|
||||
for (int i = 0; i < N * num_iters; ++i) {
|
||||
|
@ -680,7 +682,7 @@ TEST(Expr, TestExistsJson) {
|
|||
plan.filter_plannode_ =
|
||||
std::make_shared<plan::FilterBitsNode>(DEFAULT_PLANNODE_ID, expr);
|
||||
visitor.ExecuteExprNode(
|
||||
plan.filter_plannode_.value(), seg_promote, final);
|
||||
plan.filter_plannode_.value(), seg_promote, N * num_iters, final);
|
||||
EXPECT_EQ(final.size(), N * num_iters);
|
||||
|
||||
for (int i = 0; i < N * num_iters; ++i) {
|
||||
|
@ -822,7 +824,7 @@ TEST(Expr, TestUnaryRangeJson) {
|
|||
BitsetType final;
|
||||
auto plan = std::make_shared<plan::FilterBitsNode>(
|
||||
DEFAULT_PLANNODE_ID, expr);
|
||||
visitor.ExecuteExprNode(plan, seg_promote, final);
|
||||
visitor.ExecuteExprNode(plan, seg_promote, N * num_iters, final);
|
||||
EXPECT_EQ(final.size(), N * num_iters);
|
||||
EXPECT_EQ(final.size(), N * num_iters);
|
||||
|
||||
|
@ -885,7 +887,7 @@ TEST(Expr, TestUnaryRangeJson) {
|
|||
BitsetType final;
|
||||
auto plan = std::make_shared<plan::FilterBitsNode>(
|
||||
DEFAULT_PLANNODE_ID, expr);
|
||||
visitor.ExecuteExprNode(plan, seg_promote, final);
|
||||
visitor.ExecuteExprNode(plan, seg_promote, N * num_iters, final);
|
||||
EXPECT_EQ(final.size(), N * num_iters);
|
||||
|
||||
for (int i = 0; i < N * num_iters; ++i) {
|
||||
|
@ -958,7 +960,7 @@ TEST(Expr, TestTermJson) {
|
|||
BitsetType final;
|
||||
auto plan =
|
||||
std::make_shared<plan::FilterBitsNode>(DEFAULT_PLANNODE_ID, expr);
|
||||
visitor.ExecuteExprNode(plan, seg_promote, final);
|
||||
visitor.ExecuteExprNode(plan, seg_promote, N * num_iters, final);
|
||||
EXPECT_EQ(final.size(), N * num_iters);
|
||||
|
||||
for (int i = 0; i < N * num_iters; ++i) {
|
||||
|
@ -1083,8 +1085,10 @@ TEST(Expr, TestTerm) {
|
|||
auto plan =
|
||||
CreateSearchPlanByExpr(*schema, plan_str.data(), plan_str.size());
|
||||
BitsetType final;
|
||||
visitor.ExecuteExprNode(
|
||||
plan->plan_node_->filter_plannode_.value(), seg_promote, final);
|
||||
visitor.ExecuteExprNode(plan->plan_node_->filter_plannode_.value(),
|
||||
seg_promote,
|
||||
N * num_iters,
|
||||
final);
|
||||
EXPECT_EQ(final.size(), N * num_iters);
|
||||
|
||||
for (int i = 0; i < N * num_iters; ++i) {
|
||||
|
@ -1199,8 +1203,10 @@ TEST(Expr, TestCompare) {
|
|||
auto plan =
|
||||
CreateSearchPlanByExpr(*schema, plan_str.data(), plan_str.size());
|
||||
BitsetType final;
|
||||
visitor.ExecuteExprNode(
|
||||
plan->plan_node_->filter_plannode_.value(), seg_promote, final);
|
||||
visitor.ExecuteExprNode(plan->plan_node_->filter_plannode_.value(),
|
||||
seg_promote,
|
||||
N * num_iters,
|
||||
final);
|
||||
EXPECT_EQ(final.size(), N * num_iters);
|
||||
|
||||
for (int i = 0; i < N * num_iters; ++i) {
|
||||
|
@ -1300,7 +1306,7 @@ TEST(Expr, TestCompareWithScalarIndex) {
|
|||
// std::cout << ShowPlanNodeVisitor().call_child(*plan->plan_node_) << std::endl;
|
||||
BitsetType final;
|
||||
visitor.ExecuteExprNode(
|
||||
plan->plan_node_->filter_plannode_.value(), seg.get(), final);
|
||||
plan->plan_node_->filter_plannode_.value(), seg.get(), N, final);
|
||||
EXPECT_EQ(final.size(), N);
|
||||
|
||||
for (int i = 0; i < N; ++i) {
|
||||
|
@ -1444,25 +1450,25 @@ TEST(Expr, TestCompareExpr) {
|
|||
BitsetType final;
|
||||
auto plan =
|
||||
std::make_shared<plan::FilterBitsNode>(DEFAULT_PLANNODE_ID, expr);
|
||||
visitor.ExecuteExprNode(plan, seg.get(), final);
|
||||
visitor.ExecuteExprNode(plan, seg.get(), N, final);
|
||||
expr = build_expr(DataType::INT8);
|
||||
plan = std::make_shared<plan::FilterBitsNode>(DEFAULT_PLANNODE_ID, expr);
|
||||
visitor.ExecuteExprNode(plan, seg.get(), final);
|
||||
visitor.ExecuteExprNode(plan, seg.get(), N, final);
|
||||
expr = build_expr(DataType::INT16);
|
||||
plan = std::make_shared<plan::FilterBitsNode>(DEFAULT_PLANNODE_ID, expr);
|
||||
visitor.ExecuteExprNode(plan, seg.get(), final);
|
||||
visitor.ExecuteExprNode(plan, seg.get(), N, final);
|
||||
expr = build_expr(DataType::INT32);
|
||||
plan = std::make_shared<plan::FilterBitsNode>(DEFAULT_PLANNODE_ID, expr);
|
||||
visitor.ExecuteExprNode(plan, seg.get(), final);
|
||||
visitor.ExecuteExprNode(plan, seg.get(), N, final);
|
||||
expr = build_expr(DataType::INT64);
|
||||
plan = std::make_shared<plan::FilterBitsNode>(DEFAULT_PLANNODE_ID, expr);
|
||||
visitor.ExecuteExprNode(plan, seg.get(), final);
|
||||
visitor.ExecuteExprNode(plan, seg.get(), N, final);
|
||||
expr = build_expr(DataType::FLOAT);
|
||||
plan = std::make_shared<plan::FilterBitsNode>(DEFAULT_PLANNODE_ID, expr);
|
||||
visitor.ExecuteExprNode(plan, seg.get(), final);
|
||||
visitor.ExecuteExprNode(plan, seg.get(), N, final);
|
||||
expr = build_expr(DataType::DOUBLE);
|
||||
plan = std::make_shared<plan::FilterBitsNode>(DEFAULT_PLANNODE_ID, expr);
|
||||
visitor.ExecuteExprNode(plan, seg.get(), final);
|
||||
visitor.ExecuteExprNode(plan, seg.get(), N, final);
|
||||
std::cout << "end compare test" << std::endl;
|
||||
}
|
||||
|
||||
|
@ -1773,7 +1779,7 @@ TEST(Expr, test_term_pk) {
|
|||
BitsetType final;
|
||||
auto plan =
|
||||
std::make_shared<plan::FilterBitsNode>(DEFAULT_PLANNODE_ID, expr);
|
||||
visitor.ExecuteExprNode(plan, seg.get(), final);
|
||||
visitor.ExecuteExprNode(plan, seg.get(), N, final);
|
||||
EXPECT_EQ(final.size(), N);
|
||||
for (int i = 0; i < 10; ++i) {
|
||||
EXPECT_EQ(final[i], true);
|
||||
|
@ -1790,7 +1796,7 @@ TEST(Expr, test_term_pk) {
|
|||
expr = std::make_shared<expr::TermFilterExpr>(
|
||||
expr::ColumnInfo(int64_fid, DataType::INT64), retrieve_ints);
|
||||
plan = std::make_shared<plan::FilterBitsNode>(DEFAULT_PLANNODE_ID, expr);
|
||||
visitor.ExecuteExprNode(plan, seg.get(), final);
|
||||
visitor.ExecuteExprNode(plan, seg.get(), N, final);
|
||||
EXPECT_EQ(final.size(), N);
|
||||
for (int i = 0; i < N; ++i) {
|
||||
EXPECT_EQ(final[i], false);
|
||||
|
@ -1840,7 +1846,7 @@ TEST(Expr, TestSealedSegmentGetBatchSize) {
|
|||
EXEC_EVAL_EXPR_BATCH_SIZE = batch_size;
|
||||
auto plan = plan::PlanFragment(plan_node);
|
||||
auto query_context = std::make_shared<milvus::exec::QueryContext>(
|
||||
"query id", seg.get(), MAX_TIMESTAMP);
|
||||
"query id", seg.get(), N, MAX_TIMESTAMP);
|
||||
|
||||
auto task =
|
||||
milvus::exec::Task::Create("task_expr", plan, 0, query_context);
|
||||
|
@ -1899,7 +1905,7 @@ TEST(Expr, TestGrowingSegmentGetBatchSize) {
|
|||
EXEC_EVAL_EXPR_BATCH_SIZE = batch_size;
|
||||
auto plan = plan::PlanFragment(plan_node);
|
||||
auto query_context = std::make_shared<milvus::exec::QueryContext>(
|
||||
"query id", seg.get(), MAX_TIMESTAMP);
|
||||
"query id", seg.get(), N, MAX_TIMESTAMP);
|
||||
|
||||
auto task =
|
||||
milvus::exec::Task::Create("task_expr", plan, 0, query_context);
|
||||
|
@ -1987,7 +1993,7 @@ TEST(Expr, TestUnaryBenchTest) {
|
|||
int64_t all_cost = 0;
|
||||
for (int i = 0; i < 10; i++) {
|
||||
auto start = std::chrono::steady_clock::now();
|
||||
visitor.ExecuteExprNode(plan, seg.get(), final);
|
||||
visitor.ExecuteExprNode(plan, seg.get(), N, final);
|
||||
all_cost += std::chrono::duration_cast<std::chrono::microseconds>(
|
||||
std::chrono::steady_clock::now() - start)
|
||||
.count();
|
||||
|
@ -2071,7 +2077,7 @@ TEST(Expr, TestBinaryRangeBenchTest) {
|
|||
int64_t all_cost = 0;
|
||||
for (int i = 0; i < 10; i++) {
|
||||
auto start = std::chrono::steady_clock::now();
|
||||
visitor.ExecuteExprNode(plan, seg.get(), final);
|
||||
visitor.ExecuteExprNode(plan, seg.get(), N, final);
|
||||
all_cost += std::chrono::duration_cast<std::chrono::microseconds>(
|
||||
std::chrono::steady_clock::now() - start)
|
||||
.count();
|
||||
|
@ -2149,7 +2155,7 @@ TEST(Expr, TestLogicalUnaryBenchTest) {
|
|||
int64_t all_cost = 0;
|
||||
for (int i = 0; i < 50; i++) {
|
||||
auto start = std::chrono::steady_clock::now();
|
||||
visitor.ExecuteExprNode(plan, seg.get(), final);
|
||||
visitor.ExecuteExprNode(plan, seg.get(), N, final);
|
||||
all_cost += std::chrono::duration_cast<std::chrono::microseconds>(
|
||||
std::chrono::steady_clock::now() - start)
|
||||
.count();
|
||||
|
@ -2237,7 +2243,7 @@ TEST(Expr, TestBinaryLogicalBenchTest) {
|
|||
int64_t all_cost = 0;
|
||||
for (int i = 0; i < 50; i++) {
|
||||
auto start = std::chrono::steady_clock::now();
|
||||
visitor.ExecuteExprNode(plan, seg.get(), final);
|
||||
visitor.ExecuteExprNode(plan, seg.get(), N, final);
|
||||
all_cost += std::chrono::duration_cast<std::chrono::microseconds>(
|
||||
std::chrono::steady_clock::now() - start)
|
||||
.count();
|
||||
|
@ -2321,7 +2327,7 @@ TEST(Expr, TestBinaryArithOpEvalRangeBenchExpr) {
|
|||
int64_t all_cost = 0;
|
||||
for (int i = 0; i < 50; i++) {
|
||||
auto start = std::chrono::steady_clock::now();
|
||||
visitor.ExecuteExprNode(plan, seg.get(), final);
|
||||
visitor.ExecuteExprNode(plan, seg.get(), N, final);
|
||||
all_cost += std::chrono::duration_cast<std::chrono::microseconds>(
|
||||
std::chrono::steady_clock::now() - start)
|
||||
.count();
|
||||
|
@ -2398,7 +2404,7 @@ TEST(Expr, TestCompareExprBenchTest) {
|
|||
int64_t all_cost = 0;
|
||||
for (int i = 0; i < 10; i++) {
|
||||
auto start = std::chrono::steady_clock::now();
|
||||
visitor.ExecuteExprNode(plan, seg.get(), final);
|
||||
visitor.ExecuteExprNode(plan, seg.get(), N, final);
|
||||
all_cost += std::chrono::duration_cast<std::chrono::microseconds>(
|
||||
std::chrono::steady_clock::now() - start)
|
||||
.count();
|
||||
|
@ -2563,7 +2569,7 @@ TEST(Expr, TestRefactorExprs) {
|
|||
std::make_shared<plan::FilterBitsNode>(DEFAULT_PLANNODE_ID, expr);
|
||||
std::cout << "start test" << std::endl;
|
||||
auto start = std::chrono::steady_clock::now();
|
||||
visitor.ExecuteExprNode(plan, seg.get(), final);
|
||||
visitor.ExecuteExprNode(plan, seg.get(), N, final);
|
||||
std::cout << n << "cost: "
|
||||
<< std::chrono::duration_cast<std::chrono::microseconds>(
|
||||
std::chrono::steady_clock::now() - start)
|
||||
|
@ -2668,7 +2674,7 @@ TEST(Expr, TestCompareWithScalarIndexMaris) {
|
|||
// std::cout << ShowPlanNodeVisitor().call_child(*plan->plan_node_) << std::endl;
|
||||
BitsetType final;
|
||||
visitor.ExecuteExprNode(
|
||||
plan->plan_node_->filter_plannode_.value(), seg.get(), final);
|
||||
plan->plan_node_->filter_plannode_.value(), seg.get(), N, final);
|
||||
EXPECT_EQ(final.size(), N);
|
||||
|
||||
for (int i = 0; i < N; ++i) {
|
||||
|
@ -3018,8 +3024,10 @@ TEST(Expr, TestBinaryArithOpEvalRange) {
|
|||
auto plan =
|
||||
CreateSearchPlanByExpr(*schema, plan_str.data(), plan_str.size());
|
||||
BitsetType final;
|
||||
visitor.ExecuteExprNode(
|
||||
plan->plan_node_->filter_plannode_.value(), seg_promote, final);
|
||||
visitor.ExecuteExprNode(plan->plan_node_->filter_plannode_.value(),
|
||||
seg_promote,
|
||||
N * num_iters,
|
||||
final);
|
||||
EXPECT_EQ(final.size(), N * num_iters);
|
||||
|
||||
for (int i = 0; i < N * num_iters; ++i) {
|
||||
|
@ -3125,7 +3133,7 @@ TEST(Expr, TestBinaryArithOpEvalRangeJSON) {
|
|||
BitsetType final;
|
||||
auto plan =
|
||||
std::make_shared<plan::FilterBitsNode>(DEFAULT_PLANNODE_ID, expr);
|
||||
visitor.ExecuteExprNode(plan, seg_promote, final);
|
||||
visitor.ExecuteExprNode(plan, seg_promote, N * num_iters, final);
|
||||
EXPECT_EQ(final.size(), N * num_iters);
|
||||
|
||||
for (int i = 0; i < N * num_iters; ++i) {
|
||||
|
@ -3218,7 +3226,7 @@ TEST(Expr, TestBinaryArithOpEvalRangeJSONFloat) {
|
|||
BitsetType final;
|
||||
auto plan =
|
||||
std::make_shared<plan::FilterBitsNode>(DEFAULT_PLANNODE_ID, expr);
|
||||
visitor.ExecuteExprNode(plan, seg_promote, final);
|
||||
visitor.ExecuteExprNode(plan, seg_promote, N * num_iters, final);
|
||||
EXPECT_EQ(final.size(), N * num_iters);
|
||||
|
||||
for (int i = 0; i < N * num_iters; ++i) {
|
||||
|
@ -3260,7 +3268,7 @@ TEST(Expr, TestBinaryArithOpEvalRangeJSONFloat) {
|
|||
BitsetType final;
|
||||
auto plan =
|
||||
std::make_shared<plan::FilterBitsNode>(DEFAULT_PLANNODE_ID, expr);
|
||||
visitor.ExecuteExprNode(plan, seg_promote, final);
|
||||
visitor.ExecuteExprNode(plan, seg_promote, N * num_iters, final);
|
||||
EXPECT_EQ(final.size(), N * num_iters);
|
||||
|
||||
for (int i = 0; i < N * num_iters; ++i) {
|
||||
|
@ -3562,7 +3570,7 @@ TEST(Expr, TestBinaryArithOpEvalRangeWithScalarSortIndex) {
|
|||
|
||||
BitsetType final;
|
||||
visitor.ExecuteExprNode(
|
||||
plan->plan_node_->filter_plannode_.value(), seg_promote, final);
|
||||
plan->plan_node_->filter_plannode_.value(), seg_promote, N, final);
|
||||
EXPECT_EQ(final.size(), N);
|
||||
|
||||
for (int i = 0; i < N; ++i) {
|
||||
|
@ -3762,8 +3770,10 @@ TEST(Expr, TestUnaryRangeWithJSON) {
|
|||
*schema, unary_plan.data(), unary_plan.size());
|
||||
|
||||
BitsetType final;
|
||||
visitor.ExecuteExprNode(
|
||||
plan->plan_node_->filter_plannode_.value(), seg_promote, final);
|
||||
visitor.ExecuteExprNode(plan->plan_node_->filter_plannode_.value(),
|
||||
seg_promote,
|
||||
N * num_iters,
|
||||
final);
|
||||
EXPECT_EQ(final.size(), N * num_iters);
|
||||
|
||||
for (int i = 0; i < N * num_iters; ++i) {
|
||||
|
@ -3941,8 +3951,10 @@ TEST(Expr, TestTermWithJSON) {
|
|||
*schema, unary_plan.data(), unary_plan.size());
|
||||
|
||||
BitsetType final;
|
||||
visitor.ExecuteExprNode(
|
||||
plan->plan_node_->filter_plannode_.value(), seg_promote, final);
|
||||
visitor.ExecuteExprNode(plan->plan_node_->filter_plannode_.value(),
|
||||
seg_promote,
|
||||
N * num_iters,
|
||||
final);
|
||||
EXPECT_EQ(final.size(), N * num_iters);
|
||||
|
||||
for (int i = 0; i < N * num_iters; ++i) {
|
||||
|
@ -4094,8 +4106,10 @@ TEST(Expr, TestExistsWithJSON) {
|
|||
*schema, unary_plan.data(), unary_plan.size());
|
||||
|
||||
BitsetType final;
|
||||
visitor.ExecuteExprNode(
|
||||
plan->plan_node_->filter_plannode_.value(), seg_promote, final);
|
||||
visitor.ExecuteExprNode(plan->plan_node_->filter_plannode_.value(),
|
||||
seg_promote,
|
||||
N * num_iters,
|
||||
final);
|
||||
EXPECT_EQ(final.size(), N * num_iters);
|
||||
|
||||
for (int i = 0; i < N * num_iters; ++i) {
|
||||
|
@ -4194,7 +4208,7 @@ TEST(Expr, TestTermInFieldJson) {
|
|||
auto plan =
|
||||
std::make_shared<plan::FilterBitsNode>(DEFAULT_PLANNODE_ID, expr);
|
||||
auto start = std::chrono::steady_clock::now();
|
||||
visitor.ExecuteExprNode(plan, seg_promote, final);
|
||||
visitor.ExecuteExprNode(plan, seg_promote, N * num_iters, final);
|
||||
// std::cout << "cost"
|
||||
// << std::chrono::duration_cast<std::chrono::microseconds>(
|
||||
// std::chrono::steady_clock::now() - start)
|
||||
|
@ -4242,7 +4256,7 @@ TEST(Expr, TestTermInFieldJson) {
|
|||
auto plan =
|
||||
std::make_shared<plan::FilterBitsNode>(DEFAULT_PLANNODE_ID, expr);
|
||||
auto start = std::chrono::steady_clock::now();
|
||||
visitor.ExecuteExprNode(plan, seg_promote, final);
|
||||
visitor.ExecuteExprNode(plan, seg_promote, N * num_iters, final);
|
||||
std::cout << "cost"
|
||||
<< std::chrono::duration_cast<std::chrono::microseconds>(
|
||||
std::chrono::steady_clock::now() - start)
|
||||
|
@ -4290,7 +4304,7 @@ TEST(Expr, TestTermInFieldJson) {
|
|||
auto plan =
|
||||
std::make_shared<plan::FilterBitsNode>(DEFAULT_PLANNODE_ID, expr);
|
||||
auto start = std::chrono::steady_clock::now();
|
||||
visitor.ExecuteExprNode(plan, seg_promote, final);
|
||||
visitor.ExecuteExprNode(plan, seg_promote, N * num_iters, final);
|
||||
std::cout << "cost"
|
||||
<< std::chrono::duration_cast<std::chrono::microseconds>(
|
||||
std::chrono::steady_clock::now() - start)
|
||||
|
@ -4338,7 +4352,7 @@ TEST(Expr, TestTermInFieldJson) {
|
|||
auto plan =
|
||||
std::make_shared<plan::FilterBitsNode>(DEFAULT_PLANNODE_ID, expr);
|
||||
auto start = std::chrono::steady_clock::now();
|
||||
visitor.ExecuteExprNode(plan, seg_promote, final);
|
||||
visitor.ExecuteExprNode(plan, seg_promote, N * num_iters, final);
|
||||
std::cout << "cost"
|
||||
<< std::chrono::duration_cast<std::chrono::microseconds>(
|
||||
std::chrono::steady_clock::now() - start)
|
||||
|
@ -4562,7 +4576,7 @@ TEST(Expr, TestJsonContainsAny) {
|
|||
auto plan =
|
||||
std::make_shared<plan::FilterBitsNode>(DEFAULT_PLANNODE_ID, expr);
|
||||
auto start = std::chrono::steady_clock::now();
|
||||
visitor.ExecuteExprNode(plan, seg_promote, final);
|
||||
visitor.ExecuteExprNode(plan, seg_promote, N * num_iters, final);
|
||||
std::cout << "cost"
|
||||
<< std::chrono::duration_cast<std::chrono::microseconds>(
|
||||
std::chrono::steady_clock::now() - start)
|
||||
|
@ -4611,7 +4625,7 @@ TEST(Expr, TestJsonContainsAny) {
|
|||
auto plan =
|
||||
std::make_shared<plan::FilterBitsNode>(DEFAULT_PLANNODE_ID, expr);
|
||||
auto start = std::chrono::steady_clock::now();
|
||||
visitor.ExecuteExprNode(plan, seg_promote, final);
|
||||
visitor.ExecuteExprNode(plan, seg_promote, N * num_iters, final);
|
||||
std::cout << "cost"
|
||||
<< std::chrono::duration_cast<std::chrono::microseconds>(
|
||||
std::chrono::steady_clock::now() - start)
|
||||
|
@ -4660,7 +4674,7 @@ TEST(Expr, TestJsonContainsAny) {
|
|||
auto plan =
|
||||
std::make_shared<plan::FilterBitsNode>(DEFAULT_PLANNODE_ID, expr);
|
||||
auto start = std::chrono::steady_clock::now();
|
||||
visitor.ExecuteExprNode(plan, seg_promote, final);
|
||||
visitor.ExecuteExprNode(plan, seg_promote, N * num_iters, final);
|
||||
std::cout << "cost"
|
||||
<< std::chrono::duration_cast<std::chrono::microseconds>(
|
||||
std::chrono::steady_clock::now() - start)
|
||||
|
@ -4709,7 +4723,7 @@ TEST(Expr, TestJsonContainsAny) {
|
|||
auto plan =
|
||||
std::make_shared<plan::FilterBitsNode>(DEFAULT_PLANNODE_ID, expr);
|
||||
auto start = std::chrono::steady_clock::now();
|
||||
visitor.ExecuteExprNode(plan, seg_promote, final);
|
||||
visitor.ExecuteExprNode(plan, seg_promote, N * num_iters, final);
|
||||
std::cout << "cost"
|
||||
<< std::chrono::duration_cast<std::chrono::microseconds>(
|
||||
std::chrono::steady_clock::now() - start)
|
||||
|
@ -4791,7 +4805,7 @@ TEST(Expr, TestJsonContainsAll) {
|
|||
auto plan =
|
||||
std::make_shared<plan::FilterBitsNode>(DEFAULT_PLANNODE_ID, expr);
|
||||
auto start = std::chrono::steady_clock::now();
|
||||
visitor.ExecuteExprNode(plan, seg_promote, final);
|
||||
visitor.ExecuteExprNode(plan, seg_promote, N * num_iters, final);
|
||||
std::cout << "cost"
|
||||
<< std::chrono::duration_cast<std::chrono::microseconds>(
|
||||
std::chrono::steady_clock::now() - start)
|
||||
|
@ -4847,7 +4861,7 @@ TEST(Expr, TestJsonContainsAll) {
|
|||
auto plan =
|
||||
std::make_shared<plan::FilterBitsNode>(DEFAULT_PLANNODE_ID, expr);
|
||||
auto start = std::chrono::steady_clock::now();
|
||||
visitor.ExecuteExprNode(plan, seg_promote, final);
|
||||
visitor.ExecuteExprNode(plan, seg_promote, N * num_iters, final);
|
||||
std::cout << "cost"
|
||||
<< std::chrono::duration_cast<std::chrono::microseconds>(
|
||||
std::chrono::steady_clock::now() - start)
|
||||
|
@ -4903,7 +4917,7 @@ TEST(Expr, TestJsonContainsAll) {
|
|||
auto plan =
|
||||
std::make_shared<plan::FilterBitsNode>(DEFAULT_PLANNODE_ID, expr);
|
||||
auto start = std::chrono::steady_clock::now();
|
||||
visitor.ExecuteExprNode(plan, seg_promote, final);
|
||||
visitor.ExecuteExprNode(plan, seg_promote, N * num_iters, final);
|
||||
std::cout << "cost"
|
||||
<< std::chrono::duration_cast<std::chrono::microseconds>(
|
||||
std::chrono::steady_clock::now() - start)
|
||||
|
@ -4957,7 +4971,7 @@ TEST(Expr, TestJsonContainsAll) {
|
|||
auto plan =
|
||||
std::make_shared<plan::FilterBitsNode>(DEFAULT_PLANNODE_ID, expr);
|
||||
auto start = std::chrono::steady_clock::now();
|
||||
visitor.ExecuteExprNode(plan, seg_promote, final);
|
||||
visitor.ExecuteExprNode(plan, seg_promote, N * num_iters, final);
|
||||
std::cout << "cost"
|
||||
<< std::chrono::duration_cast<std::chrono::microseconds>(
|
||||
std::chrono::steady_clock::now() - start)
|
||||
|
@ -5067,7 +5081,7 @@ TEST(Expr, TestJsonContainsArray) {
|
|||
std::make_shared<plan::FilterBitsNode>(DEFAULT_PLANNODE_ID, expr);
|
||||
BitsetType final;
|
||||
auto start = std::chrono::steady_clock::now();
|
||||
visitor.ExecuteExprNode(plan, seg_promote, final);
|
||||
visitor.ExecuteExprNode(plan, seg_promote, N * num_iters, final);
|
||||
std::cout << "cost"
|
||||
<< std::chrono::duration_cast<std::chrono::microseconds>(
|
||||
std::chrono::steady_clock::now() - start)
|
||||
|
@ -5100,7 +5114,7 @@ TEST(Expr, TestJsonContainsArray) {
|
|||
std::make_shared<plan::FilterBitsNode>(DEFAULT_PLANNODE_ID, expr);
|
||||
BitsetType final;
|
||||
auto start = std::chrono::steady_clock::now();
|
||||
visitor.ExecuteExprNode(plan, seg_promote, final);
|
||||
visitor.ExecuteExprNode(plan, seg_promote, N * num_iters, final);
|
||||
std::cout << "cost"
|
||||
<< std::chrono::duration_cast<std::chrono::microseconds>(
|
||||
std::chrono::steady_clock::now() - start)
|
||||
|
@ -5152,7 +5166,7 @@ TEST(Expr, TestJsonContainsArray) {
|
|||
std::make_shared<plan::FilterBitsNode>(DEFAULT_PLANNODE_ID, expr);
|
||||
BitsetType final;
|
||||
auto start = std::chrono::steady_clock::now();
|
||||
visitor.ExecuteExprNode(plan, seg_promote, final);
|
||||
visitor.ExecuteExprNode(plan, seg_promote, N * num_iters, final);
|
||||
std::cout << "cost"
|
||||
<< std::chrono::duration_cast<std::chrono::microseconds>(
|
||||
std::chrono::steady_clock::now() - start)
|
||||
|
@ -5181,7 +5195,7 @@ TEST(Expr, TestJsonContainsArray) {
|
|||
std::make_shared<plan::FilterBitsNode>(DEFAULT_PLANNODE_ID, expr);
|
||||
BitsetType final;
|
||||
auto start = std::chrono::steady_clock::now();
|
||||
visitor.ExecuteExprNode(plan, seg_promote, final);
|
||||
visitor.ExecuteExprNode(plan, seg_promote, N * num_iters, final);
|
||||
std::cout << "cost"
|
||||
<< std::chrono::duration_cast<std::chrono::microseconds>(
|
||||
std::chrono::steady_clock::now() - start)
|
||||
|
@ -5235,7 +5249,7 @@ TEST(Expr, TestJsonContainsArray) {
|
|||
std::make_shared<plan::FilterBitsNode>(DEFAULT_PLANNODE_ID, expr);
|
||||
BitsetType final;
|
||||
auto start = std::chrono::steady_clock::now();
|
||||
visitor.ExecuteExprNode(plan, seg_promote, final);
|
||||
visitor.ExecuteExprNode(plan, seg_promote, N * num_iters, final);
|
||||
std::cout << "cost"
|
||||
<< std::chrono::duration_cast<std::chrono::microseconds>(
|
||||
std::chrono::steady_clock::now() - start)
|
||||
|
@ -5265,7 +5279,7 @@ TEST(Expr, TestJsonContainsArray) {
|
|||
std::make_shared<plan::FilterBitsNode>(DEFAULT_PLANNODE_ID, expr);
|
||||
BitsetType final;
|
||||
auto start = std::chrono::steady_clock::now();
|
||||
visitor.ExecuteExprNode(plan, seg_promote, final);
|
||||
visitor.ExecuteExprNode(plan, seg_promote, N * num_iters, final);
|
||||
std::cout << "cost"
|
||||
<< std::chrono::duration_cast<std::chrono::microseconds>(
|
||||
std::chrono::steady_clock::now() - start)
|
||||
|
@ -5375,7 +5389,7 @@ TEST(Expr, TestJsonContainsDiffTypeArray) {
|
|||
auto plan =
|
||||
std::make_shared<plan::FilterBitsNode>(DEFAULT_PLANNODE_ID, expr);
|
||||
auto start = std::chrono::steady_clock::now();
|
||||
visitor.ExecuteExprNode(plan, seg_promote, final);
|
||||
visitor.ExecuteExprNode(plan, seg_promote, N * num_iters, final);
|
||||
std::cout << "cost"
|
||||
<< std::chrono::duration_cast<std::chrono::microseconds>(
|
||||
std::chrono::steady_clock::now() - start)
|
||||
|
@ -5402,7 +5416,7 @@ TEST(Expr, TestJsonContainsDiffTypeArray) {
|
|||
auto plan =
|
||||
std::make_shared<plan::FilterBitsNode>(DEFAULT_PLANNODE_ID, expr);
|
||||
auto start = std::chrono::steady_clock::now();
|
||||
visitor.ExecuteExprNode(plan, seg_promote, final);
|
||||
visitor.ExecuteExprNode(plan, seg_promote, N * num_iters, final);
|
||||
std::cout << "cost"
|
||||
<< std::chrono::duration_cast<std::chrono::microseconds>(
|
||||
std::chrono::steady_clock::now() - start)
|
||||
|
@ -5487,7 +5501,7 @@ TEST(Expr, TestJsonContainsDiffType) {
|
|||
auto plan =
|
||||
std::make_shared<plan::FilterBitsNode>(DEFAULT_PLANNODE_ID, expr);
|
||||
auto start = std::chrono::steady_clock::now();
|
||||
visitor.ExecuteExprNode(plan, seg_promote, final);
|
||||
visitor.ExecuteExprNode(plan, seg_promote, N * num_iters, final);
|
||||
std::cout << "cost"
|
||||
<< std::chrono::duration_cast<std::chrono::microseconds>(
|
||||
std::chrono::steady_clock::now() - start)
|
||||
|
@ -5513,7 +5527,7 @@ TEST(Expr, TestJsonContainsDiffType) {
|
|||
auto plan =
|
||||
std::make_shared<plan::FilterBitsNode>(DEFAULT_PLANNODE_ID, expr);
|
||||
auto start = std::chrono::steady_clock::now();
|
||||
visitor.ExecuteExprNode(plan, seg_promote, final);
|
||||
visitor.ExecuteExprNode(plan, seg_promote, N * num_iters, final);
|
||||
std::cout << "cost"
|
||||
<< std::chrono::duration_cast<std::chrono::microseconds>(
|
||||
std::chrono::steady_clock::now() - start)
|
||||
|
|
|
@ -624,8 +624,10 @@ binary_arith_op_eval_range_expr: <
|
|||
CreateSearchPlanByExpr(*schema, plan_str.data(), plan_str.size());
|
||||
query::ExecPlanNodeVisitor visitor(*seg_promote, MAX_TIMESTAMP);
|
||||
BitsetType final;
|
||||
visitor.ExecuteExprNode(
|
||||
plan->plan_node_->filter_plannode_.value(), seg_promote, final);
|
||||
visitor.ExecuteExprNode(plan->plan_node_->filter_plannode_.value(),
|
||||
seg_promote,
|
||||
N * num_iters,
|
||||
final);
|
||||
EXPECT_EQ(final.size(), N * num_iters);
|
||||
|
||||
for (int i = 0; i < N * num_iters; ++i) {
|
||||
|
|
|
@ -329,8 +329,10 @@ TEST(StringExpr, Term) {
|
|||
auto plan = ProtoParser(*schema).CreatePlan(*plan_proto);
|
||||
query::ExecPlanNodeVisitor visitor(*seg_promote, MAX_TIMESTAMP);
|
||||
BitsetType final;
|
||||
visitor.ExecuteExprNode(
|
||||
plan->plan_node_->filter_plannode_.value(), seg_promote, final);
|
||||
visitor.ExecuteExprNode(plan->plan_node_->filter_plannode_.value(),
|
||||
seg_promote,
|
||||
N * num_iters,
|
||||
final);
|
||||
EXPECT_EQ(final.size(), N * num_iters);
|
||||
|
||||
for (int i = 0; i < N * num_iters; ++i) {
|
||||
|
@ -443,8 +445,10 @@ TEST(StringExpr, Compare) {
|
|||
auto plan = ProtoParser(*schema).CreatePlan(*plan_proto);
|
||||
query::ExecPlanNodeVisitor visitor(*seg_promote, MAX_TIMESTAMP);
|
||||
BitsetType final;
|
||||
visitor.ExecuteExprNode(
|
||||
plan->plan_node_->filter_plannode_.value(), seg_promote, final);
|
||||
visitor.ExecuteExprNode(plan->plan_node_->filter_plannode_.value(),
|
||||
seg_promote,
|
||||
N * num_iters,
|
||||
final);
|
||||
EXPECT_EQ(final.size(), N * num_iters);
|
||||
|
||||
for (int i = 0; i < N * num_iters; ++i) {
|
||||
|
@ -540,8 +544,10 @@ TEST(StringExpr, UnaryRange) {
|
|||
auto plan = ProtoParser(*schema).CreatePlan(*plan_proto);
|
||||
query::ExecPlanNodeVisitor visitor(*seg_promote, MAX_TIMESTAMP);
|
||||
BitsetType final;
|
||||
visitor.ExecuteExprNode(
|
||||
plan->plan_node_->filter_plannode_.value(), seg_promote, final);
|
||||
visitor.ExecuteExprNode(plan->plan_node_->filter_plannode_.value(),
|
||||
seg_promote,
|
||||
N * num_iters,
|
||||
final);
|
||||
EXPECT_EQ(final.size(), N * num_iters);
|
||||
|
||||
for (int i = 0; i < N * num_iters; ++i) {
|
||||
|
@ -655,8 +661,10 @@ TEST(StringExpr, BinaryRange) {
|
|||
auto plan = ProtoParser(*schema).CreatePlan(*plan_proto);
|
||||
query::ExecPlanNodeVisitor visitor(*seg_promote, MAX_TIMESTAMP);
|
||||
BitsetType final;
|
||||
visitor.ExecuteExprNode(
|
||||
plan->plan_node_->filter_plannode_.value(), seg_promote, final);
|
||||
visitor.ExecuteExprNode(plan->plan_node_->filter_plannode_.value(),
|
||||
seg_promote,
|
||||
N * num_iters,
|
||||
final);
|
||||
EXPECT_EQ(final.size(), N * num_iters);
|
||||
|
||||
for (int i = 0; i < N * num_iters; ++i) {
|
||||
|
|
Loading…
Reference in New Issue