Skip to content

Commit

Permalink
fix restart test
Browse files Browse the repository at this point in the history
  • Loading branch information
vsian committed Dec 13, 2024
1 parent 59c6547 commit 870cf96
Show file tree
Hide file tree
Showing 2 changed files with 12 additions and 7 deletions.
14 changes: 7 additions & 7 deletions python/restart_test/test_memidx.py
Original file line number Diff line number Diff line change
Expand Up @@ -340,7 +340,7 @@ def check(rows):

part3()

@pytest.mark.skip(reason="bug")
# @pytest.mark.skip(reason="bug")
def test_mem_bmp(self, infinity_runner: InfinityRunner):
config1 = "test/data/config/restart_test/test_memidx/1.toml"
config2 = "test/data/config/restart_test/test_memidx/2.toml"
Expand Down Expand Up @@ -391,26 +391,26 @@ def part2(infinity_obj):
time.sleep(5)
db_obj = infinity_obj.get_database("default_db")
table_obj = db_obj.get_table("test_mem_bmp")
data_dict, data_type_dict = table_obj.output(["count(*)"]).to_result()
data_dict, data_type_dict, _ = table_obj.output(["count(*)"]).to_result()
# print(data_dict)
assert data_dict["count(star)"] == [35]

data_dict, data_type_dict = (
data_dict, data_type_dict, _ = (
table_obj.output(["c1"])
.match_sparse("c2", query_vector, "ip", 8)
.to_result()
)
assert data_dict["c1"] == [4, 4, 4, 4, 4, 4, 4, 2]

data_dict, data_type_dict = table_obj.output(["count(*)"]).to_result()
data_dict, data_type_dict, _ = table_obj.output(["count(*)"]).to_result()
# print(data_dict)
assert data_dict["count(star)"] == [35]

for i in range(3):
table_obj.insert(test_data)
time.sleep(5)

data_dict, data_type_dict = (
data_dict, data_type_dict, _ = (
table_obj.output(["c1"])
.match_sparse("c2", query_vector, "ip", 11)
.to_result()
Expand All @@ -429,14 +429,14 @@ def part3(infinity_obj):
table_obj = db_obj.get_table("test_mem_bmp")

def check():
data_dict, data_type_dict = (
data_dict, data_type_dict, _ = (
table_obj.output(["c1"])
.match_sparse("c2", query_vector, "ip", 11)
.to_result()
)
assert data_dict["c1"] == [4, 4, 4, 4, 4, 4, 4, 4, 4, 4, 2]

data_dict, data_type_dict = table_obj.output(["count(*)"]).to_result()
data_dict, data_type_dict, _ = table_obj.output(["count(*)"]).to_result()
assert data_dict["count(star)"] == [50]

check()
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -533,12 +533,17 @@ void PhysicalMatchSparseScan::ExecuteInnerT(DistFunc *dist_func,
const auto [chunk_index_entries, memory_index_entry] = segment_index_entry->GetBMPIndexSnapshot();
for (SizeT query_id = 0; query_id < query_n; ++query_id) {
for (auto chunk_index_entry : chunk_index_entries) {
if (!chunk_index_entry->CheckVisible(txn)) {
continue;
}
BufferHandle buffer_handle = chunk_index_entry->GetIndex();
const auto *bmp_index = reinterpret_cast<const AbstractBMP *>(buffer_handle.GetData());
bmp_search(*bmp_index, query_id, false, filter);
LOG_TRACE(fmt::format("Search Match Sparse in chunk {}", chunk_index_entry->encode()));
}
if (memory_index_entry.get() != nullptr) {
bmp_search(memory_index_entry->get(), query_id, true, filter);
LOG_TRACE(fmt::format("Search Match Sparse in mem index of {}", segment_index_entry->encode()));
}
}
};
Expand Down

0 comments on commit 870cf96

Please sign in to comment.