Skip to content

Commit

Permalink
[C++] fixing zero size lookup chunk size for the C++ Re-indexer (#2062)
Browse files Browse the repository at this point in the history
Co-authored-by: Behnam Robatmili <[email protected]>
  • Loading branch information
github-actions[bot] and beroy authored Jan 25, 2024
1 parent 1082e39 commit e8ddd19
Show file tree
Hide file tree
Showing 2 changed files with 27 additions and 2 deletions.
26 changes: 24 additions & 2 deletions apis/python/tests/test_indexer.py
Original file line number Diff line number Diff line change
Expand Up @@ -171,8 +171,30 @@ def indexer_test_pass(keys: np.array, lookups: np.array):
"pass": True,
},
{
"keys": [1, 2, 3, 4, 5, 2**63 - 1],
"lookups": [i for i in range(2**63 - 1000, 2**63 - 1)],
"keys": [i for i in range(1, 10000)],
"lookups": [
525,
1293,
1805,
5802,
7636,
7754,
7791,
7957,
7959,
8067,
8340,
8736,
8806,
9329,
9377,
9653,
],
"pass": True,
},
{
"keys": [i for i in range(1, 10000)],
"lookups": [i for i in range(1, 10000)],
"pass": True,
},
]
Expand Down
3 changes: 3 additions & 0 deletions libtiledbsoma/src/reindexer/reindexer.cc
Original file line number Diff line number Diff line change
Expand Up @@ -111,6 +111,9 @@ void IntIndexer::lookup(const int64_t* keys, int64_t* results, int size) {
std::vector<tiledbsoma::ThreadPool::Task> tasks;

size_t thread_chunk_size = size / tiledb_thread_pool_->concurrency_level();
if (thread_chunk_size == 0) {
thread_chunk_size = 1;
}

for (size_t i = 0; i < size_t(size); i += thread_chunk_size) {
size_t start = i;
Expand Down

0 comments on commit e8ddd19

Please sign in to comment.