Skip to content

Commit

Permalink
set_condition should not reset entire instance state
Browse files Browse the repository at this point in the history
  • Loading branch information
bkmartinjr committed Dec 11, 2024
1 parent cbfa704 commit a74447e
Show file tree
Hide file tree
Showing 3 changed files with 13 additions and 1 deletion.
2 changes: 1 addition & 1 deletion apis/python/src/tiledbsoma/managed_query.cc
Original file line number Diff line number Diff line change
Expand Up @@ -98,7 +98,7 @@ void load_managed_query(py::module& m) {
.ptr()
.get();
}
mq.reset();
mq.reset_columns();
mq.select_columns(column_names);

// Release python GIL after we're done accessing python
Expand Down
4 changes: 4 additions & 0 deletions libtiledbsoma/src/soma/managed_query.cc
Original file line number Diff line number Diff line change
Expand Up @@ -129,6 +129,10 @@ void ManagedQuery::select_columns(
}
}

void ManagedQuery::reset_columns() {
columns_.clear();
}

void ManagedQuery::setup_read() {
// If the query is complete, return so we do not submit it again
auto status = query_->query_status();
Expand Down
8 changes: 8 additions & 0 deletions libtiledbsoma/src/soma/managed_query.h
Original file line number Diff line number Diff line change
Expand Up @@ -135,12 +135,20 @@ class ManagedQuery {
* list of selected columns is empty. This prevents a `select_columns` call
* from changing an empty list (all columns) to a subset of columns.
*
* NB: you may only select a given column once. Selecting twice will generate
* an error in read_next.
*
* @param names Vector of column names
* @param if_not_empty Prevent changing an "empty" selection of all columns
*/
void select_columns(
const std::vector<std::string>& names, bool if_not_empty = false);

/**
* @brief Reset column selection to none, aka "all".
*/
void reset_columns();

/**
* @brief Returns the column names set by the query.
*
Expand Down

0 comments on commit a74447e

Please sign in to comment.