Skip to content
Merged
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
2 changes: 1 addition & 1 deletion test/src/unit-cppapi-partial-attribute-write.cc
Original file line number Diff line number Diff line change
Expand Up @@ -315,7 +315,7 @@ TEST_CASE_METHOD(
// Try to rewrite an attribute, will throw an exception.
CHECK_THROWS_WITH(
write_sparse_a1(*query, {8, 9, 10, 11, 12, 13, 14, 15}),
"[TileDB::Query] Error: Buffer a1 was already written");
"Query: Buffer a1 was already written");

write_sparse_a2(*query, {8, 9, 10, 11, 12, 13, 14, 15});

Expand Down
4 changes: 2 additions & 2 deletions test/src/unit-enumerations.cc
Original file line number Diff line number Diff line change
Expand Up @@ -2488,7 +2488,7 @@ TEST_CASE_METHOD(
ctx_.cancellation_source(),
ctx_.storage_manager(),
array);
throw_if_not_ok(q1.set_condition(qc1));
q1.set_condition(qc1);

Query q2(
ctx_.resources(),
Expand Down Expand Up @@ -2532,7 +2532,7 @@ TEST_CASE_METHOD(
ctx_.cancellation_source(),
ctx_.storage_manager(),
array);
throw_if_not_ok(q1.set_condition(qc3));
q1.set_condition(qc3);

Query q2(
ctx_.resources(),
Expand Down
4 changes: 1 addition & 3 deletions test/src/unit-sparse-global-order-reader.cc
Original file line number Diff line number Diff line change
Expand Up @@ -3603,9 +3603,7 @@ void CSparseGlobalOrderFx::run_execute(Instance& instance) {

if (instance.condition.has_value()) {
tiledb::sm::QueryCondition qc(instance.condition->get()->clone());
const auto rc =
query->query_->set_condition(qc); // SAFETY: this performs a deep copy
ASSERTER(rc.to_string() == "Ok");
query->query_->set_condition(qc); // SAFETY: this performs a deep copy
}

// Prepare output buffer
Expand Down
42 changes: 16 additions & 26 deletions tiledb/sm/c_api/tiledb.cc
Original file line number Diff line number Diff line change
Expand Up @@ -470,7 +470,7 @@ int32_t tiledb_query_set_data_buffer(
return TILEDB_ERR;

// Set attribute buffer
throw_if_not_ok(query->query_->set_data_buffer(name, buffer, buffer_size));
query->query_->set_data_buffer(name, buffer, buffer_size);

return TILEDB_OK;
}
Expand All @@ -485,8 +485,7 @@ int32_t tiledb_query_set_offsets_buffer(
return TILEDB_ERR;

// Set attribute buffer
throw_if_not_ok(query->query_->set_offsets_buffer(
name, buffer_offsets, buffer_offsets_size));
query->query_->set_offsets_buffer(name, buffer_offsets, buffer_offsets_size);

return TILEDB_OK;
}
Expand All @@ -501,8 +500,8 @@ int32_t tiledb_query_set_validity_buffer(
return TILEDB_ERR;

// Set attribute buffer
throw_if_not_ok(query->query_->set_validity_buffer(
name, buffer_validity, buffer_validity_size));
query->query_->set_validity_buffer(
name, buffer_validity, buffer_validity_size);

return TILEDB_OK;
}
Expand All @@ -518,7 +517,7 @@ int32_t tiledb_query_get_data_buffer(
return TILEDB_ERR;

// Get attribute buffer
throw_if_not_ok(query->query_->get_data_buffer(name, buffer, buffer_size));
std::tie(*buffer, *buffer_size) = query->query_->get_data_buffer(name);

return TILEDB_OK;
}
Expand All @@ -534,7 +533,7 @@ int32_t tiledb_query_get_offsets_buffer(
return TILEDB_ERR;

// Get attribute buffer
throw_if_not_ok(query->query_->get_offsets_buffer(name, buffer, buffer_size));
std::tie(*buffer, *buffer_size) = query->query_->get_offsets_buffer(name);

return TILEDB_OK;
}
Expand All @@ -550,8 +549,7 @@ int32_t tiledb_query_get_validity_buffer(
return TILEDB_ERR;

// Get attribute buffer
throw_if_not_ok(
query->query_->get_validity_buffer(name, buffer, buffer_size));
std::tie(*buffer, *buffer_size) = query->query_->get_validity_buffer(name);

return TILEDB_OK;
}
Expand All @@ -563,8 +561,7 @@ int32_t tiledb_query_set_layout(
return TILEDB_ERR;

// Set layout
throw_if_not_ok(
query->query_->set_layout(static_cast<tiledb::sm::Layout>(layout)));
query->query_->set_layout(static_cast<tiledb::sm::Layout>(layout));

return TILEDB_OK;
}
Expand All @@ -579,7 +576,7 @@ int32_t tiledb_query_set_condition(
return TILEDB_ERR;

// Set layout
throw_if_not_ok(query->query_->set_condition(*cond->query_condition_));
query->query_->set_condition(*cond->query_condition_);

return TILEDB_OK;
}
Expand All @@ -594,7 +591,7 @@ int32_t tiledb_query_finalize(tiledb_ctx_t* ctx, tiledb_query_t* query) {
return TILEDB_ERR;

// Flush query
throw_if_not_ok(query->query_->finalize());
query->query_->finalize();

return TILEDB_OK;
}
Expand All @@ -609,7 +606,7 @@ int32_t tiledb_query_submit_and_finalize(
if (sanity_check(ctx, query) == TILEDB_ERR)
return TILEDB_ERR;

throw_if_not_ok(query->query_->submit_and_finalize());
query->query_->submit_and_finalize();

return TILEDB_OK;
}
Expand All @@ -627,7 +624,7 @@ int32_t tiledb_query_submit(tiledb_ctx_t* ctx, tiledb_query_t* query) {
if (sanity_check(ctx, query) == TILEDB_ERR)
return TILEDB_ERR;

throw_if_not_ok(query->query_->submit());
query->query_->submit();

return TILEDB_OK;
}
Expand Down Expand Up @@ -786,7 +783,7 @@ int32_t tiledb_query_get_fragment_num(
if (sanity_check(ctx, query) == TILEDB_ERR)
return TILEDB_ERR;

throw_if_not_ok(query->query_->get_written_fragment_num(num));
*num = query->query_->get_written_fragment_num();

return TILEDB_OK;
}
Expand All @@ -799,7 +796,7 @@ int32_t tiledb_query_get_fragment_uri(
if (sanity_check(ctx, query) == TILEDB_ERR)
return TILEDB_ERR;

throw_if_not_ok(query->query_->get_written_fragment_uri(idx, uri));
*uri = query->query_->get_written_fragment_uri(idx).c_str();

return TILEDB_OK;
}
Expand All @@ -813,8 +810,7 @@ int32_t tiledb_query_get_fragment_timestamp_range(
if (sanity_check(ctx, query) == TILEDB_ERR)
return TILEDB_ERR;

throw_if_not_ok(
query->query_->get_written_fragment_timestamp_range(idx, t1, t2));
std::tie(*t1, *t2) = query->query_->get_written_fragment_timestamp_range(idx);

return TILEDB_OK;
}
Expand Down Expand Up @@ -855,13 +851,7 @@ int32_t tiledb_query_add_update_value(
return TILEDB_ERR;
}

// Add update value.
if (SAVE_ERROR_CATCH(
ctx,
query->query_->add_update_value(
field_name, update_value, update_value_size))) {
return TILEDB_ERR;
}
query->query_->add_update_value(field_name, update_value, update_value_size);

// Success
return TILEDB_OK;
Expand Down
46 changes: 23 additions & 23 deletions tiledb/sm/c_api/tiledb_filestore.cc
Original file line number Diff line number Diff line change
Expand Up @@ -263,7 +263,7 @@ int32_t tiledb_filestore_uri_import(
context.cancellation_source(),
context.storage_manager(),
array);
throw_if_not_ok(query.set_layout(tiledb::sm::Layout::GLOBAL_ORDER));
query.set_layout(tiledb::sm::Layout::GLOBAL_ORDER);
std::vector<std::byte> buffer(buffer_size);

tiledb::sm::Subarray subarray(
Expand All @@ -289,7 +289,7 @@ int32_t tiledb_filestore_uri_import(
context.cancellation_source(),
context.storage_manager(),
array);
throw_if_not_ok(query.set_layout(tiledb::sm::Layout::ROW_MAJOR));
query.set_layout(tiledb::sm::Layout::ROW_MAJOR);
tiledb::sm::Subarray subarray_cloud_fix(
array.get(), nullptr, context.resources().logger(), true);

Expand All @@ -299,11 +299,11 @@ int32_t tiledb_filestore_uri_import(
subarray_cloud_fix.add_range(0, std::move(subarray_range_cloud_fix));
query.set_subarray(subarray_cloud_fix);
uint64_t data_buff_len = end - start + 1;
throw_if_not_ok(query.set_data_buffer(
query.set_data_buffer(
tiledb::sm::constants::filestore_attribute_name,
buffer.data(),
&data_buff_len));
throw_if_not_ok(query.submit());
&data_buff_len);
query.submit();
};

auto read_wrapper =
Expand Down Expand Up @@ -336,11 +336,11 @@ int32_t tiledb_filestore_uri_import(
if (is_tiledb_uri) {
tiledb_cloud_fix(start_range, end_cloud_fix);
} else {
throw_if_not_ok(query.set_data_buffer(
query.set_data_buffer(
tiledb::sm::constants::filestore_attribute_name,
buffer.data(),
&query_buffer_len));
throw_if_not_ok(query.submit());
&query_buffer_len);
query.submit();
}

start_range += readlen;
Expand All @@ -355,7 +355,7 @@ int32_t tiledb_filestore_uri_import(

if (!is_tiledb_uri) {
// Dump the fragment on disk
throw_if_not_ok(query.finalize());
query.finalize();
}
throw_if_not_ok(vfs.close_file(tiledb::sm::URI(file_uri)));

Expand Down Expand Up @@ -422,7 +422,7 @@ int32_t tiledb_filestore_uri_export(
context.cancellation_source(),
context.storage_manager(),
array);
throw_if_not_ok(query.set_layout(tiledb::sm::Layout::ROW_MAJOR));
query.set_layout(tiledb::sm::Layout::ROW_MAJOR);
query.set_subarray(subarray);

// Cloud compatibility hack. Currently stored tiledb file arrays have a
Expand All @@ -435,17 +435,17 @@ int32_t tiledb_filestore_uri_export(
->attribute(tiledb::sm::constants::filestore_attribute_name)
->type();
if (attr_type == tiledb::sm::Datatype::UINT8) {
throw_if_not_ok(query.set_data_buffer(
query.set_data_buffer(
tiledb::sm::constants::filestore_attribute_name,
reinterpret_cast<uint8_t*>(data.data()),
&write_size));
&write_size);
} else {
throw_if_not_ok(query.set_data_buffer(
query.set_data_buffer(
tiledb::sm::constants::filestore_attribute_name,
data.data(),
&write_size));
&write_size);
}
throw_if_not_ok(query.submit());
query.submit();

vfs.write(
tiledb::sm::URI(file_uri),
Expand Down Expand Up @@ -528,7 +528,7 @@ int32_t tiledb_filestore_buffer_import(
context.cancellation_source(),
context.storage_manager(),
array);
throw_if_not_ok(query.set_layout(tiledb::sm::Layout::ROW_MAJOR));
query.set_layout(tiledb::sm::Layout::ROW_MAJOR);

tiledb::sm::Subarray subarray(
array.get(), nullptr, context.resources().logger(), true);
Expand All @@ -540,9 +540,9 @@ int32_t tiledb_filestore_buffer_import(

query.set_subarray(subarray);
uint64_t size_tmp = size;
throw_if_not_ok(query.set_data_buffer(
tiledb::sm::constants::filestore_attribute_name, buf, &size_tmp));
throw_if_not_ok(query.submit());
query.set_data_buffer(
tiledb::sm::constants::filestore_attribute_name, buf, &size_tmp);
query.submit();

throw_if_not_ok(array->close());

Expand Down Expand Up @@ -601,12 +601,12 @@ int32_t tiledb_filestore_buffer_export(
context.cancellation_source(),
context.storage_manager(),
array);
throw_if_not_ok(query.set_layout(tiledb::sm::Layout::ROW_MAJOR));
query.set_layout(tiledb::sm::Layout::ROW_MAJOR);
query.set_subarray(subarray);
uint64_t size_tmp = size;
throw_if_not_ok(query.set_data_buffer(
tiledb::sm::constants::filestore_attribute_name, buf, &size_tmp));
throw_if_not_ok(query.submit());
query.set_data_buffer(
tiledb::sm::constants::filestore_attribute_name, buf, &size_tmp);
query.submit();

throw_if_not_ok(array->close());

Expand Down
Loading
Loading