mirror of https://github.com/milvus-io/milvus.git
Remove unnecessary bitset flip in Search and Query (#17387)
Signed-off-by: bigsheeper <yihao.dai@zilliz.com>pull/17404/head
parent
a2d2ad88bd
commit
9f786dd752
|
@ -92,11 +92,11 @@ ExecPlanNodeVisitor::VectorVisitorImpl(VectorPlanNode& node) {
|
|||
BitsetType bitset_holder;
|
||||
if (node.predicate_.has_value()) {
|
||||
bitset_holder = ExecExprVisitor(*segment, active_count, timestamp_).call_child(*node.predicate_.value());
|
||||
bitset_holder.flip();
|
||||
} else {
|
||||
bitset_holder.resize(active_count, true);
|
||||
bitset_holder.resize(active_count, false);
|
||||
}
|
||||
segment->mask_with_timestamps(bitset_holder, timestamp_);
|
||||
bitset_holder.flip();
|
||||
|
||||
segment->mask_with_delete(bitset_holder, active_count, timestamp_);
|
||||
BitsetView final_view = bitset_holder;
|
||||
|
@ -123,10 +123,10 @@ ExecPlanNodeVisitor::visit(RetrievePlanNode& node) {
|
|||
BitsetType bitset_holder;
|
||||
if (node.predicate_ != nullptr) {
|
||||
bitset_holder = ExecExprVisitor(*segment, active_count, timestamp_).call_child(*(node.predicate_));
|
||||
bitset_holder.flip();
|
||||
}
|
||||
|
||||
segment->mask_with_timestamps(bitset_holder, timestamp_);
|
||||
bitset_holder.flip();
|
||||
|
||||
segment->mask_with_delete(bitset_holder, active_count, timestamp_);
|
||||
BitsetView final_view = bitset_holder;
|
||||
|
|
|
@ -775,19 +775,19 @@ SegmentSealedImpl::mask_with_timestamps(BitsetType& bitset_chunk, Timestamp time
|
|||
|
||||
// range == (size_, size_) and size_ is this->timestamps_.size().
|
||||
// it means these data are all useful, we don't need to update bitset_chunk.
|
||||
// It can be thought of as an AND operation with another bitmask that is all 1s, but it is not necessary to do so.
|
||||
// It can be thought of as an OR operation with another bitmask that is all 0s, but it is not necessary to do so.
|
||||
if (range.first == range.second && range.first == timestamps_data.size()) {
|
||||
// just skip
|
||||
return;
|
||||
}
|
||||
// range == (0, 0). it means these data can not be used, directly set bitset_chunk to all 0s.
|
||||
// It can be thought of as an AND operation with another bitmask that is all 0s.
|
||||
// range == (0, 0). it means these data can not be used, directly set bitset_chunk to all 1s.
|
||||
// It can be thought of as an OR operation with another bitmask that is all 1s.
|
||||
if (range.first == range.second && range.first == 0) {
|
||||
bitset_chunk.reset();
|
||||
bitset_chunk.set();
|
||||
return;
|
||||
}
|
||||
auto mask = TimestampIndex::GenerateBitset(timestamp, range, timestamps_data.data(), timestamps_data.size());
|
||||
bitset_chunk &= mask;
|
||||
bitset_chunk |= mask;
|
||||
}
|
||||
|
||||
} // namespace milvus::segcore
|
||||
|
|
|
@ -72,10 +72,10 @@ TimestampIndex::GenerateBitset(Timestamp query_timestamp,
|
|||
Assert(beg < end);
|
||||
BitsetType bitset;
|
||||
bitset.reserve(size);
|
||||
bitset.resize(beg, true);
|
||||
bitset.resize(size, false);
|
||||
bitset.resize(beg, false);
|
||||
bitset.resize(size, true);
|
||||
for (int64_t i = beg; i < end; ++i) {
|
||||
bitset[i] = timestamps[i] <= query_timestamp;
|
||||
bitset[i] = timestamps[i] > query_timestamp;
|
||||
}
|
||||
return bitset;
|
||||
}
|
||||
|
|
Loading…
Reference in New Issue