Skip to content

Commit

Permalink
[c++] Correct results_complete (#1816) (#1831)
Browse files Browse the repository at this point in the history
* After setting `results_complete = false` for incomplete queries, the
  variable was not updated to `true` once it completed

Co-authored-by: nguyenv <[email protected]>
  • Loading branch information
github-actions[bot] and nguyenv authored Oct 25, 2023
1 parent 243563b commit 9625db2
Show file tree
Hide file tree
Showing 2 changed files with 3 additions and 5 deletions.
2 changes: 2 additions & 0 deletions libtiledbsoma/src/soma/managed_query.cc
Original file line number Diff line number Diff line change
Expand Up @@ -176,6 +176,8 @@ std::shared_ptr<ArrayBuffers> ManagedQuery::submit_read() {
// complete.
if (status == Query::Status::INCOMPLETE) {
results_complete_ = false;
} else if (status == Query::Status::COMPLETE) {
results_complete_ = true;
}

// Update ColumnBuffer size to match query results
Expand Down
6 changes: 1 addition & 5 deletions libtiledbsoma/test/test_soma_array.py
Original file line number Diff line number Diff line change
Expand Up @@ -77,14 +77,10 @@ def test_soma_array_var_x_data():
# The := "walrus" operator is really the appropriate thing here, but alas, is not
# supported in Python 3.7 which we do wish to preserve compatibility with.
# while arrow_table := sr.read_next():
while True:
while not sr.results_complete():
arrow_table = sr.read_next()
if not arrow_table:
break
total_num_rows += arrow_table.num_rows

# test that all results are not present in the arrow table (incomplete queries)
assert not sr.results_complete()
assert total_num_rows == 4848644


Expand Down

0 comments on commit 9625db2

Please sign in to comment.