Skip to content

Commit

Permalink
store valid bitset and add test in not expr
Browse files Browse the repository at this point in the history
Signed-off-by: lixinguo <xinguo.li@zilliz.com>
  • Loading branch information
lixinguo committed Aug 27, 2024
1 parent 9457977 commit 32a8013
Show file tree
Hide file tree
Showing 19 changed files with 1,079 additions and 251 deletions.
26 changes: 24 additions & 2 deletions internal/core/src/common/Vector.h
Original file line number Diff line number Diff line change
Expand Up @@ -19,6 +19,8 @@
#include <memory>
#include <string>

#include "EasyAssert.h"
#include "Types.h"
#include "common/FieldData.h"

namespace milvus {
Expand Down Expand Up @@ -50,6 +52,7 @@ class BaseVector {
protected:
DataType type_kind_;
size_t length_;
// todo: use null_count to skip some bitset operate
std::optional<size_t> null_count_;
};

Expand All @@ -65,8 +68,8 @@ class ColumnVector final : public BaseVector {
size_t length,
std::optional<size_t> null_count = std::nullopt)
: BaseVector(data_type, length, null_count) {
//todo: support null expr
values_ = InitScalarFieldData(data_type, false, length);
valid_values_ = InitScalarFieldData(data_type, false, length);
}

// ColumnVector(FixedVector<bool>&& data)
Expand All @@ -75,22 +78,40 @@ class ColumnVector final : public BaseVector {
// std::make_shared<FieldData<bool>>(DataType::BOOL, std::move(data));
// }

// // the size is the number of bits
// ColumnVector(TargetBitmap&& bitmap)
// : BaseVector(DataType::INT8, bitmap.size()) {
// values_ = std::make_shared<FieldDataImpl<uint8_t, false>>(
// bitmap.size(), DataType::INT8, false, std::move(bitmap).into());
// }

// the size is the number of bits
ColumnVector(TargetBitmap&& bitmap)
ColumnVector(TargetBitmap&& bitmap, TargetBitmap&& valid_bitmap)

Check warning on line 89 in internal/core/src/common/Vector.h

View check run for this annotation

Codecov / codecov/patch

internal/core/src/common/Vector.h#L89

Added line #L89 was not covered by tests
: BaseVector(DataType::INT8, bitmap.size()) {
values_ = std::make_shared<FieldDataImpl<uint8_t, false>>(
bitmap.size(), DataType::INT8, false, std::move(bitmap).into());
valid_values_ = std::make_shared<FieldDataImpl<uint8_t, false>>(
bitmap.size(),
DataType::INT8,
false,
TargetBitmap(valid_bitmap.size()).into());

Check warning on line 97 in internal/core/src/common/Vector.h

View check run for this annotation

Codecov / codecov/patch

internal/core/src/common/Vector.h#L93-L97

Added lines #L93 - L97 were not covered by tests
}

virtual ~ColumnVector() override {
values_.reset();
valid_values_.reset();

Check warning on line 102 in internal/core/src/common/Vector.h

View check run for this annotation

Codecov / codecov/patch

internal/core/src/common/Vector.h#L102

Added line #L102 was not covered by tests
}

void*
GetRawData() {
return values_->Data();
}

void*
GetValidRawData() {
return valid_values_->Data();

Check warning on line 112 in internal/core/src/common/Vector.h

View check run for this annotation

Codecov / codecov/patch

internal/core/src/common/Vector.h#L111-L112

Added lines #L111 - L112 were not covered by tests
}

template <typename As>
const As*
RawAsValues() const {
Expand All @@ -99,6 +120,7 @@ class ColumnVector final : public BaseVector {

private:
FieldDataPtr values_;
FieldDataPtr valid_values_;
};

using ColumnVectorPtr = std::shared_ptr<ColumnVector>;
Expand Down
6 changes: 4 additions & 2 deletions internal/core/src/exec/expression/AlwaysTrueExpr.cpp
Original file line number Diff line number Diff line change
Expand Up @@ -31,11 +31,13 @@ PhyAlwaysTrueExpr::Eval(EvalCtx& context, VectorPtr& result) {
return;
}

auto res_vec =
std::make_shared<ColumnVector>(TargetBitmap(real_batch_size));
auto res_vec = std::make_shared<ColumnVector>(
TargetBitmap(real_batch_size), TargetBitmap(real_batch_size));

Check warning on line 35 in internal/core/src/exec/expression/AlwaysTrueExpr.cpp

View check run for this annotation

Codecov / codecov/patch

internal/core/src/exec/expression/AlwaysTrueExpr.cpp#L34-L35

Added lines #L34 - L35 were not covered by tests
TargetBitmapView res(res_vec->GetRawData(), real_batch_size);
TargetBitmapView valid_res(res_vec->GetValidRawData(), real_batch_size);

Check warning on line 37 in internal/core/src/exec/expression/AlwaysTrueExpr.cpp

View check run for this annotation

Codecov / codecov/patch

internal/core/src/exec/expression/AlwaysTrueExpr.cpp#L37

Added line #L37 was not covered by tests

res.set();
valid_res.set();

Check warning on line 40 in internal/core/src/exec/expression/AlwaysTrueExpr.cpp

View check run for this annotation

Codecov / codecov/patch

internal/core/src/exec/expression/AlwaysTrueExpr.cpp#L40

Added line #L40 was not covered by tests

result = res_vec;
current_pos_ += real_batch_size;
Expand Down
310 changes: 262 additions & 48 deletions internal/core/src/exec/expression/BinaryArithOpEvalRangeExpr.cpp

Large diffs are not rendered by default.

Original file line number Diff line number Diff line change
Expand Up @@ -101,7 +101,8 @@ struct ArithOpElementFunc {
size_t size,
HighPrecisonType val,
HighPrecisonType right_operand,
TargetBitmapView res) {
TargetBitmapView res,
TargetBitmapView valid_res) {
/*
// This is the original code, kept here for the documentation purposes
for (int i = 0; i < size; ++i) {
Expand Down Expand Up @@ -287,6 +288,7 @@ struct ArithOpElementFunc {
}
continue;
}
valid_res[right] = false;
execute_sub_batch(
src + left, right - left, val, right_operand, res + left);
left = right;
Expand Down
66 changes: 40 additions & 26 deletions internal/core/src/exec/expression/BinaryRangeExpr.cpp
Original file line number Diff line number Diff line change
Expand Up @@ -15,6 +15,7 @@
// limitations under the License.

#include "BinaryRangeExpr.h"
#include <utility>

#include "query/Utils.h"

Expand Down Expand Up @@ -150,8 +151,12 @@ PhyBinaryRangeFilterExpr::PreCheckOverflow(HighPrecisionType& val1,
cached_overflow_res_->size() == batch_size) {
return cached_overflow_res_;
}
auto res = std::make_shared<ColumnVector>(TargetBitmap(batch_size));
return res;
auto valid_res = ProcessChunksForValid<T>(is_index_mode_);
auto res_vec = std::make_shared<ColumnVector>(TargetBitmap(batch_size),

Check warning on line 155 in internal/core/src/exec/expression/BinaryRangeExpr.cpp

View check run for this annotation

Codecov / codecov/patch

internal/core/src/exec/expression/BinaryRangeExpr.cpp#L154-L155

Added lines #L154 - L155 were not covered by tests
std::move(valid_res));
cached_overflow_res_ = res_vec;

Check warning on line 157 in internal/core/src/exec/expression/BinaryRangeExpr.cpp

View check run for this annotation

Codecov / codecov/patch

internal/core/src/exec/expression/BinaryRangeExpr.cpp#L157

Added line #L157 was not covered by tests

return res_vec;

Check warning on line 159 in internal/core/src/exec/expression/BinaryRangeExpr.cpp

View check run for this annotation

Codecov / codecov/patch

internal/core/src/exec/expression/BinaryRangeExpr.cpp#L159

Added line #L159 was not covered by tests
};

if constexpr (std::is_integral_v<T> && !std::is_same_v<bool, T>) {
Expand Down Expand Up @@ -207,12 +212,12 @@ PhyBinaryRangeFilterExpr::ExecRangeVisitorImplForIndex() {
func(index_ptr, val1, val2, lower_inclusive, upper_inclusive));
};
auto res = ProcessIndexChunks<T>(execute_sub_batch, val1, val2);
AssertInfo(res.size() == real_batch_size,
AssertInfo(res->size() == real_batch_size,

Check warning on line 215 in internal/core/src/exec/expression/BinaryRangeExpr.cpp

View check run for this annotation

Codecov / codecov/patch

internal/core/src/exec/expression/BinaryRangeExpr.cpp#L215

Added line #L215 was not covered by tests
"internal error: expr processed rows {} not equal "
"expect batch size {}",
res.size(),
res->size(),
real_batch_size);
return std::make_shared<ColumnVector>(std::move(res));
return res;

Check warning on line 220 in internal/core/src/exec/expression/BinaryRangeExpr.cpp

View check run for this annotation

Codecov / codecov/patch

internal/core/src/exec/expression/BinaryRangeExpr.cpp#L220

Added line #L220 was not covered by tests
}

template <typename T>
Expand Down Expand Up @@ -240,29 +245,32 @@ PhyBinaryRangeFilterExpr::ExecRangeVisitorImplForData() {
PreCheckOverflow<T>(val1, val2, lower_inclusive, upper_inclusive)) {
return res;
}
auto res_vec =
std::make_shared<ColumnVector>(TargetBitmap(real_batch_size));
auto res_vec = std::make_shared<ColumnVector>(
TargetBitmap(real_batch_size), TargetBitmap(real_batch_size));

Check warning on line 249 in internal/core/src/exec/expression/BinaryRangeExpr.cpp

View check run for this annotation

Codecov / codecov/patch

internal/core/src/exec/expression/BinaryRangeExpr.cpp#L248-L249

Added lines #L248 - L249 were not covered by tests
TargetBitmapView res(res_vec->GetRawData(), real_batch_size);
TargetBitmapView valid_res(res_vec->GetValidRawData(), real_batch_size);
valid_res.set();

Check warning on line 252 in internal/core/src/exec/expression/BinaryRangeExpr.cpp

View check run for this annotation

Codecov / codecov/patch

internal/core/src/exec/expression/BinaryRangeExpr.cpp#L251-L252

Added lines #L251 - L252 were not covered by tests

auto execute_sub_batch = [lower_inclusive, upper_inclusive](
const T* data,
const bool* valid_data,
const int size,
TargetBitmapView res,
TargetBitmapView valid_res,
HighPrecisionType val1,
HighPrecisionType val2) {
if (lower_inclusive && upper_inclusive) {
BinaryRangeElementFunc<T, true, true> func;
func(val1, val2, data, valid_data, size, res);
func(val1, val2, data, valid_data, size, res, valid_res);

Check warning on line 264 in internal/core/src/exec/expression/BinaryRangeExpr.cpp

View check run for this annotation

Codecov / codecov/patch

internal/core/src/exec/expression/BinaryRangeExpr.cpp#L264

Added line #L264 was not covered by tests
} else if (lower_inclusive && !upper_inclusive) {
BinaryRangeElementFunc<T, true, false> func;
func(val1, val2, data, valid_data, size, res);
func(val1, val2, data, valid_data, size, res, valid_res);

Check warning on line 267 in internal/core/src/exec/expression/BinaryRangeExpr.cpp

View check run for this annotation

Codecov / codecov/patch

internal/core/src/exec/expression/BinaryRangeExpr.cpp#L267

Added line #L267 was not covered by tests
} else if (!lower_inclusive && upper_inclusive) {
BinaryRangeElementFunc<T, false, true> func;
func(val1, val2, data, valid_data, size, res);
func(val1, val2, data, valid_data, size, res, valid_res);

Check warning on line 270 in internal/core/src/exec/expression/BinaryRangeExpr.cpp

View check run for this annotation

Codecov / codecov/patch

internal/core/src/exec/expression/BinaryRangeExpr.cpp#L270

Added line #L270 was not covered by tests
} else {
BinaryRangeElementFunc<T, false, false> func;
func(val1, val2, data, valid_data, size, res);
func(val1, val2, data, valid_data, size, res, valid_res);

Check warning on line 273 in internal/core/src/exec/expression/BinaryRangeExpr.cpp

View check run for this annotation

Codecov / codecov/patch

internal/core/src/exec/expression/BinaryRangeExpr.cpp#L273

Added line #L273 was not covered by tests
}
};
auto skip_index_func =
Expand All @@ -283,7 +291,7 @@ PhyBinaryRangeFilterExpr::ExecRangeVisitorImplForData() {
}
};
int64_t processed_size = ProcessDataChunks<T>(
execute_sub_batch, skip_index_func, res, val1, val2);
execute_sub_batch, skip_index_func, res, valid_res, val1, val2);
AssertInfo(processed_size == real_batch_size,
"internal error: expr processed rows {} not equal "
"expect batch size {}",
Expand All @@ -302,9 +310,11 @@ PhyBinaryRangeFilterExpr::ExecRangeVisitorImplForJson() {
if (real_batch_size == 0) {
return nullptr;
}
auto res_vec =
std::make_shared<ColumnVector>(TargetBitmap(real_batch_size));
auto res_vec = std::make_shared<ColumnVector>(
TargetBitmap(real_batch_size), TargetBitmap(real_batch_size));

Check warning on line 314 in internal/core/src/exec/expression/BinaryRangeExpr.cpp

View check run for this annotation

Codecov / codecov/patch

internal/core/src/exec/expression/BinaryRangeExpr.cpp#L313-L314

Added lines #L313 - L314 were not covered by tests
TargetBitmapView res(res_vec->GetRawData(), real_batch_size);
TargetBitmapView valid_res(res_vec->GetValidRawData(), real_batch_size);
valid_res.set();

Check warning on line 317 in internal/core/src/exec/expression/BinaryRangeExpr.cpp

View check run for this annotation

Codecov / codecov/patch

internal/core/src/exec/expression/BinaryRangeExpr.cpp#L316-L317

Added lines #L316 - L317 were not covered by tests

bool lower_inclusive = expr_->lower_inclusive_;
bool upper_inclusive = expr_->upper_inclusive_;
Expand All @@ -317,24 +327,25 @@ PhyBinaryRangeFilterExpr::ExecRangeVisitorImplForJson() {
const bool* valid_data,
const int size,
TargetBitmapView res,
TargetBitmapView valid_res,
ValueType val1,
ValueType val2) {
if (lower_inclusive && upper_inclusive) {
BinaryRangeElementFuncForJson<ValueType, true, true> func;
func(val1, val2, pointer, data, valid_data, size, res);
func(val1, val2, pointer, data, valid_data, size, res, valid_res);

Check warning on line 335 in internal/core/src/exec/expression/BinaryRangeExpr.cpp

View check run for this annotation

Codecov / codecov/patch

internal/core/src/exec/expression/BinaryRangeExpr.cpp#L335

Added line #L335 was not covered by tests
} else if (lower_inclusive && !upper_inclusive) {
BinaryRangeElementFuncForJson<ValueType, true, false> func;
func(val1, val2, pointer, data, valid_data, size, res);
func(val1, val2, pointer, data, valid_data, size, res, valid_res);

Check warning on line 338 in internal/core/src/exec/expression/BinaryRangeExpr.cpp

View check run for this annotation

Codecov / codecov/patch

internal/core/src/exec/expression/BinaryRangeExpr.cpp#L338

Added line #L338 was not covered by tests
} else if (!lower_inclusive && upper_inclusive) {
BinaryRangeElementFuncForJson<ValueType, false, true> func;
func(val1, val2, pointer, data, valid_data, size, res);
func(val1, val2, pointer, data, valid_data, size, res, valid_res);

Check warning on line 341 in internal/core/src/exec/expression/BinaryRangeExpr.cpp

View check run for this annotation

Codecov / codecov/patch

internal/core/src/exec/expression/BinaryRangeExpr.cpp#L341

Added line #L341 was not covered by tests
} else {
BinaryRangeElementFuncForJson<ValueType, false, false> func;
func(val1, val2, pointer, data, valid_data, size, res);
func(val1, val2, pointer, data, valid_data, size, res, valid_res);

Check warning on line 344 in internal/core/src/exec/expression/BinaryRangeExpr.cpp

View check run for this annotation

Codecov / codecov/patch

internal/core/src/exec/expression/BinaryRangeExpr.cpp#L344

Added line #L344 was not covered by tests
}
};
int64_t processed_size = ProcessDataChunks<milvus::Json>(
execute_sub_batch, std::nullptr_t{}, res, val1, val2);
execute_sub_batch, std::nullptr_t{}, res, valid_res, val1, val2);
AssertInfo(processed_size == real_batch_size,
"internal error: expr processed rows {} not equal "
"expect batch size {}",
Expand All @@ -353,9 +364,11 @@ PhyBinaryRangeFilterExpr::ExecRangeVisitorImplForArray() {
if (real_batch_size == 0) {
return nullptr;
}
auto res_vec =
std::make_shared<ColumnVector>(TargetBitmap(real_batch_size));
auto res_vec = std::make_shared<ColumnVector>(
TargetBitmap(real_batch_size), TargetBitmap(real_batch_size));

Check warning on line 368 in internal/core/src/exec/expression/BinaryRangeExpr.cpp

View check run for this annotation

Codecov / codecov/patch

internal/core/src/exec/expression/BinaryRangeExpr.cpp#L367-L368

Added lines #L367 - L368 were not covered by tests
TargetBitmapView res(res_vec->GetRawData(), real_batch_size);
TargetBitmapView valid_res(res_vec->GetValidRawData(), real_batch_size);
valid_res.set();

Check warning on line 371 in internal/core/src/exec/expression/BinaryRangeExpr.cpp

View check run for this annotation

Codecov / codecov/patch

internal/core/src/exec/expression/BinaryRangeExpr.cpp#L370-L371

Added lines #L370 - L371 were not covered by tests

bool lower_inclusive = expr_->lower_inclusive_;
bool upper_inclusive = expr_->upper_inclusive_;
Expand All @@ -371,25 +384,26 @@ PhyBinaryRangeFilterExpr::ExecRangeVisitorImplForArray() {
const bool* valid_data,
const int size,
TargetBitmapView res,
TargetBitmapView valid_res,
ValueType val1,
ValueType val2,
int index) {
if (lower_inclusive && upper_inclusive) {
BinaryRangeElementFuncForArray<ValueType, true, true> func;
func(val1, val2, index, data, valid_data, size, res);
func(val1, val2, index, data, valid_data, size, res, valid_res);

Check warning on line 393 in internal/core/src/exec/expression/BinaryRangeExpr.cpp

View check run for this annotation

Codecov / codecov/patch

internal/core/src/exec/expression/BinaryRangeExpr.cpp#L393

Added line #L393 was not covered by tests
} else if (lower_inclusive && !upper_inclusive) {
BinaryRangeElementFuncForArray<ValueType, true, false> func;
func(val1, val2, index, data, valid_data, size, res);
func(val1, val2, index, data, valid_data, size, res, valid_res);

Check warning on line 396 in internal/core/src/exec/expression/BinaryRangeExpr.cpp

View check run for this annotation

Codecov / codecov/patch

internal/core/src/exec/expression/BinaryRangeExpr.cpp#L396

Added line #L396 was not covered by tests
} else if (!lower_inclusive && upper_inclusive) {
BinaryRangeElementFuncForArray<ValueType, false, true> func;
func(val1, val2, index, data, valid_data, size, res);
func(val1, val2, index, data, valid_data, size, res, valid_res);

Check warning on line 399 in internal/core/src/exec/expression/BinaryRangeExpr.cpp

View check run for this annotation

Codecov / codecov/patch

internal/core/src/exec/expression/BinaryRangeExpr.cpp#L399

Added line #L399 was not covered by tests
} else {
BinaryRangeElementFuncForArray<ValueType, false, false> func;
func(val1, val2, index, data, valid_data, size, res);
func(val1, val2, index, data, valid_data, size, res, valid_res);

Check warning on line 402 in internal/core/src/exec/expression/BinaryRangeExpr.cpp

View check run for this annotation

Codecov / codecov/patch

internal/core/src/exec/expression/BinaryRangeExpr.cpp#L402

Added line #L402 was not covered by tests
}
};
int64_t processed_size = ProcessDataChunks<milvus::ArrayView>(
execute_sub_batch, std::nullptr_t{}, res, val1, val2, index);
execute_sub_batch, std::nullptr_t{}, res, valid_res, val1, val2, index);
AssertInfo(processed_size == real_batch_size,
"internal error: expr processed rows {} not equal "
"expect batch size {}",
Expand Down
16 changes: 10 additions & 6 deletions internal/core/src/exec/expression/BinaryRangeExpr.h
Original file line number Diff line number Diff line change
Expand Up @@ -40,7 +40,8 @@ struct BinaryRangeElementFunc {
const T* src,
const bool* valid_data,
size_t n,
TargetBitmapView res) {
TargetBitmapView res,
TargetBitmapView valid_res) {
auto execute_sub_batch = [](T val1,

Check warning on line 45 in internal/core/src/exec/expression/BinaryRangeExpr.h

View check run for this annotation

Codecov / codecov/patch

internal/core/src/exec/expression/BinaryRangeExpr.h#L45

Added line #L45 was not covered by tests
T val2,
const T* src,
Expand Down Expand Up @@ -79,6 +80,7 @@ struct BinaryRangeElementFunc {
}
continue;
}
valid_res[right] = false;
execute_sub_batch(
val1, val2, src + left, right - left, res + left);
left = right;
Expand All @@ -91,8 +93,8 @@ struct BinaryRangeElementFunc {
#define BinaryRangeJSONCompare(cmp) \
do { \
if (valid_data && !valid_data[i]) { \
res[i] = false; \
continue; \
res[i] = valid_res[i] = false; \
break; \
} \
auto x = src[i].template at<GetType>(pointer); \
if (x.error()) { \
Expand Down Expand Up @@ -123,7 +125,8 @@ struct BinaryRangeElementFuncForJson {
const milvus::Json* src,
const bool* valid_data,
size_t n,
TargetBitmapView res) {
TargetBitmapView res,
TargetBitmapView valid_res) {
for (size_t i = 0; i < n; ++i) {
if constexpr (lower_inclusive && upper_inclusive) {
BinaryRangeJSONCompare(val1 <= value && value <= val2);
Expand All @@ -150,10 +153,11 @@ struct BinaryRangeElementFuncForArray {
const milvus::ArrayView* src,
const bool* valid_data,
size_t n,
TargetBitmapView res) {
TargetBitmapView res,
TargetBitmapView valid_res) {
for (size_t i = 0; i < n; ++i) {
if (valid_data && !valid_data[i]) {
res[i] = false;
res[i] = valid_res[i] = false;
continue;

Check warning on line 161 in internal/core/src/exec/expression/BinaryRangeExpr.h

View check run for this annotation

Codecov / codecov/patch

internal/core/src/exec/expression/BinaryRangeExpr.h#L159-L161

Added lines #L159 - L161 were not covered by tests
}
if constexpr (lower_inclusive && upper_inclusive) {
Expand Down
15 changes: 10 additions & 5 deletions internal/core/src/exec/expression/CompareExpr.cpp
Original file line number Diff line number Diff line change
Expand Up @@ -146,9 +146,11 @@ PhyCompareFilterExpr::ExecCompareExprDispatcher(OpType op) {
return nullptr;
}

auto res_vec =
std::make_shared<ColumnVector>(TargetBitmap(real_batch_size));
auto res_vec = std::make_shared<ColumnVector>(
TargetBitmap(real_batch_size), TargetBitmap(real_batch_size));

Check warning on line 150 in internal/core/src/exec/expression/CompareExpr.cpp

View check run for this annotation

Codecov / codecov/patch

internal/core/src/exec/expression/CompareExpr.cpp#L149-L150

Added lines #L149 - L150 were not covered by tests
TargetBitmapView res(res_vec->GetRawData(), real_batch_size);
TargetBitmapView valid_res(res_vec->GetValidRawData(), real_batch_size);
valid_res.set();

Check warning on line 153 in internal/core/src/exec/expression/CompareExpr.cpp

View check run for this annotation

Codecov / codecov/patch

internal/core/src/exec/expression/CompareExpr.cpp#L152-L153

Added lines #L152 - L153 were not covered by tests

auto left_data_barrier = segment_->num_chunk_data(expr_->left_field_id_);
auto right_data_barrier = segment_->num_chunk_data(expr_->right_field_id_);
Expand All @@ -173,6 +175,7 @@ PhyCompareFilterExpr::ExecCompareExprDispatcher(OpType op) {
++i) {
if (!left(i).has_value() || !right(i).has_value()) {
res[processed_rows] = false;
valid_res[processed_rows] = false;

Check warning on line 178 in internal/core/src/exec/expression/CompareExpr.cpp

View check run for this annotation

Codecov / codecov/patch

internal/core/src/exec/expression/CompareExpr.cpp#L176-L178

Added lines #L176 - L178 were not covered by tests
} else {
res[processed_rows] = boost::apply_visitor(

Check warning on line 180 in internal/core/src/exec/expression/CompareExpr.cpp

View check run for this annotation

Codecov / codecov/patch

internal/core/src/exec/expression/CompareExpr.cpp#L180

Added line #L180 was not covered by tests
milvus::query::Relational<decltype(op)>{},
Expand Down Expand Up @@ -294,9 +297,11 @@ PhyCompareFilterExpr::ExecCompareRightType() {
return nullptr;
}

auto res_vec =
std::make_shared<ColumnVector>(TargetBitmap(real_batch_size));
auto res_vec = std::make_shared<ColumnVector>(
TargetBitmap(real_batch_size), TargetBitmap(real_batch_size));

Check warning on line 301 in internal/core/src/exec/expression/CompareExpr.cpp

View check run for this annotation

Codecov / codecov/patch

internal/core/src/exec/expression/CompareExpr.cpp#L300-L301

Added lines #L300 - L301 were not covered by tests
TargetBitmapView res(res_vec->GetRawData(), real_batch_size);
TargetBitmapView valid_res(res_vec->GetValidRawData(), real_batch_size);
valid_res.set();

Check warning on line 304 in internal/core/src/exec/expression/CompareExpr.cpp

View check run for this annotation

Codecov / codecov/patch

internal/core/src/exec/expression/CompareExpr.cpp#L303-L304

Added lines #L303 - L304 were not covered by tests

auto expr_type = expr_->op_type_;
auto execute_sub_batch = [expr_type](const T* left,
Expand Down Expand Up @@ -343,7 +348,7 @@ PhyCompareFilterExpr::ExecCompareRightType() {
}
};
int64_t processed_size =
ProcessBothDataChunks<T, U>(execute_sub_batch, res);
ProcessBothDataChunks<T, U>(execute_sub_batch, res, valid_res);

Check warning on line 351 in internal/core/src/exec/expression/CompareExpr.cpp

View check run for this annotation

Codecov / codecov/patch

internal/core/src/exec/expression/CompareExpr.cpp#L351

Added line #L351 was not covered by tests
AssertInfo(processed_size == real_batch_size,
"internal error: expr processed rows {} not equal "
"expect batch size {}",
Expand Down
Loading

0 comments on commit 32a8013

Please sign in to comment.