diff --git a/test/src/unit-capi-nullable.cc b/test/src/unit-capi-nullable.cc index bd93abc576a..4d45d7e6ef6 100644 --- a/test/src/unit-capi-nullable.cc +++ b/test/src/unit-capi-nullable.cc @@ -33,6 +33,7 @@ #include #include "test/support/src/helpers.h" #include "test/support/src/temporary_local_directory.h" +#include "test/support/src/vfs_helpers.h" #include "tiledb/api/c_api/vfs/vfs_api_internal.h" #include "tiledb/sm/c_api/tiledb.h" #include "tiledb/sm/enums/array_type.h" @@ -48,12 +49,6 @@ using namespace tiledb::test; class NullableArrayFx { public: - // Serialization parameters - bool serialize_ = false; - bool refactored_query_v2_ = false; - // Buffers to allocate on server side for serialized queries - ServerQueryBuffers server_buffers_; - struct test_dim_t { test_dim_t( const string& name, @@ -200,8 +195,7 @@ class NullableArrayFx { const void* subarray); }; -NullableArrayFx::NullableArrayFx() - : serialize_(false) { +NullableArrayFx::NullableArrayFx() { // Create a config. tiledb_config_t* config = nullptr; tiledb_error_t* error = nullptr; @@ -224,7 +218,11 @@ NullableArrayFx::~NullableArrayFx() { } const string NullableArrayFx::array_path(const string& array_name) { - return temp_dir_.path() + array_name; + if (vfs_test_get_fs_vec()[0]->is_rest()) { + return "tiledb://unit/" + temp_dir_.path() + array_name; + } else { + return temp_dir_.path() + array_name; + } } void NullableArrayFx::create_array( @@ -410,13 +408,11 @@ void NullableArrayFx::write( } // Submit query - rc = submit_query_wrapper( - ctx_, - array_path(array_name), - &query, - server_buffers_, - serialize_, - refactored_query_v2_); + if (layout != TILEDB_GLOBAL_ORDER) { + rc = tiledb_query_submit(ctx_, query); + } else { + rc = tiledb_query_submit_and_finalize(ctx_, query); + } REQUIRE(rc == TILEDB_OK); // Clean up @@ -517,13 +513,7 @@ void NullableArrayFx::read( REQUIRE(rc == TILEDB_OK); // Submit query - rc = submit_query_wrapper( - ctx_, - array_path(array_name), - &query, - server_buffers_, - serialize_, - refactored_query_v2_); + rc = tiledb_query_submit(ctx_, query); REQUIRE(rc == TILEDB_OK); // Clean up @@ -851,17 +841,7 @@ void NullableArrayFx::do_2d_nullable_test( TEST_CASE_METHOD( NullableArrayFx, "C API: Test 2D array with nullable attributes", - "[capi][2d][nullable]") { - SECTION("no serialization") { - serialize_ = false; - } -#ifdef TILEDB_SERIALIZATION - SECTION("serialization enabled") { - serialize_ = true; - refactored_query_v2_ = GENERATE(true, false); - } -#endif - + "[capi][2d][nullable][rest]") { // Define the attributes. vector attrs; attrs.emplace_back("a1", TILEDB_INT32, 1, true); diff --git a/test/src/unit-capi-serialized_queries.cc b/test/src/unit-capi-serialized_queries.cc index be67e818703..1700c13b139 100644 --- a/test/src/unit-capi-serialized_queries.cc +++ b/test/src/unit-capi-serialized_queries.cc @@ -32,6 +32,7 @@ #include #include "test/support/src/helpers.h" +#include "test/support/src/vfs_helpers.h" #include "tiledb/common/common.h" #include "tiledb/sm/c_api/tiledb.h" #include "tiledb/sm/c_api/tiledb_serialization.h" @@ -54,23 +55,8 @@ using namespace tiledb; using ResultSetType = std::map; -using tiledb::test::ServerQueryBuffers; -using tiledb::test::submit_query_wrapper; - namespace { -#ifdef _WIN32 -static const char PATH_SEPARATOR = '\\'; -static std::string current_dir() { - return sm::Win::current_dir(); -} -#else -static const char PATH_SEPARATOR = '/'; -static std::string current_dir() { - return sm::Posix::current_dir(); -} -#endif - template bool check_result(const T a, const T b, size_t start, size_t end) { auto a_exp = T(a.begin() + start, a.begin() + end); @@ -99,34 +85,15 @@ bool check_result( } struct SerializationFx { - const std::string tmpdir = "serialization_test_dir"; - const std::string array_name = "testarray"; - const std::string array_uri = - current_dir() + PATH_SEPARATOR + tmpdir + "/" + array_name; - + test::VFSTestSetup vfs_test_setup_; + tiledb_ctx_t* ctx_; Context ctx; - VFS vfs; - - // Serialization parameters - bool serialize_ = true; - bool refactored_query_v2_ = false; - bool finalize_ = false; - // Buffers to allocate on server side for serialized queries - tiledb::test::ServerQueryBuffers server_buffers_; + const std::string array_uri; SerializationFx() - : vfs(ctx) { - if (vfs.is_dir(tmpdir)) - vfs.remove_dir(tmpdir); - vfs.create_dir(tmpdir); - if (!vfs.is_dir(tmpdir)) - std::cerr << "'created' but not finding dir '" << tmpdir << "'" - << std::endl; - } - - ~SerializationFx() { - if (vfs.is_dir(tmpdir)) - vfs.remove_dir(tmpdir); + : ctx_{vfs_test_setup_.ctx_c} + , ctx{vfs_test_setup_.ctx()} + , array_uri{vfs_test_setup_.array_uri("testarray")} { } static void check_read_stats(const Query& query) { @@ -218,15 +185,7 @@ struct SerializationFx { query.set_offsets_buffer("a3", a3_offsets); // Submit query - auto rc = submit_query_wrapper( - ctx, - array_uri, - &query, - server_buffers_, - serialize_, - refactored_query_v2_, - finalize_); - REQUIRE(rc == TILEDB_OK); + query.submit(); // The deserialized query should also include the write stats check_write_stats(query); @@ -268,23 +227,15 @@ struct SerializationFx { query.set_offsets_buffer("a3", a3_offsets); // Submit query - auto rc = submit_query_wrapper( - ctx, - array_uri, - &query, - server_buffers_, - serialize_, - refactored_query_v2_, - finalize_); - REQUIRE(rc == TILEDB_OK); + query.submit(); // The deserialized query should also include the write stats check_write_stats(query); } void write_sparse_array() { - std::vector coords = {1, 1, 2, 2, 3, 3, 4, 4, 5, 5, - 6, 6, 7, 7, 8, 8, 9, 9, 10, 10}; + std::vector d1 = {1, 2, 3, 4, 5, 6, 7, 8, 9, 10}; + std::vector d2 = {1, 2, 3, 4, 5, 6, 7, 8, 9, 10}; std::vector a1; std::vector a2; std::vector a2_nullable; @@ -308,7 +259,8 @@ struct SerializationFx { Array array(ctx, array_uri, TILEDB_WRITE); Query query(ctx, array); query.set_layout(TILEDB_UNORDERED); - query.set_coordinates(coords); + query.set_data_buffer("d1", d1); + query.set_data_buffer("d2", d2); query.set_data_buffer("a1", a1); query.set_data_buffer("a2", a2); query.set_validity_buffer("a2", a2_nullable); @@ -316,15 +268,7 @@ struct SerializationFx { query.set_offsets_buffer("a3", a3_offsets); // Submit query - auto rc = submit_query_wrapper( - ctx, - array_uri, - &query, - server_buffers_, - serialize_, - refactored_query_v2_, - finalize_); - REQUIRE(rc == TILEDB_OK); + query.submit(); // The deserialized query should also include the write stats check_write_stats(query); @@ -341,15 +285,7 @@ struct SerializationFx { query.set_condition(qc); // Submit query - auto rc = submit_query_wrapper( - ctx, - array_uri, - &query, - server_buffers_, - serialize_, - refactored_query_v2_, - finalize_); - REQUIRE(rc == TILEDB_OK); + query.submit(); // The deserialized query should also include the delete stats check_delete_stats(query); @@ -392,15 +328,7 @@ struct SerializationFx { query.set_offsets_buffer("a3", a3_offsets); // Submit query - auto rc = submit_query_wrapper( - ctx, - array_uri, - &query, - server_buffers_, - serialize_, - refactored_query_v2_, - finalize_); - REQUIRE(rc == TILEDB_OK); + query.submit(); // The deserialized query should also include the write stats check_write_stats(query); @@ -412,8 +340,7 @@ struct SerializationFx { TEST_CASE_METHOD( SerializationFx, "Query serialization, dense", - "[query][dense][serialization]") { - refactored_query_v2_ = GENERATE(true, false); + "[query][dense][serialization][rest]") { create_array(TILEDB_DENSE); auto expected_results = write_dense_array(); @@ -435,15 +362,7 @@ TEST_CASE_METHOD( query.set_offsets_buffer("a3", a3_offsets); // Submit query - auto rc = submit_query_wrapper( - ctx, - array_uri, - &query, - server_buffers_, - serialize_, - refactored_query_v2_, - finalize_); - REQUIRE(rc == TILEDB_OK); + query.submit(); // The deserialized query should also include the read stats check_read_stats(query); @@ -485,15 +404,7 @@ TEST_CASE_METHOD( query.set_condition(condition); // Submit query - auto rc = submit_query_wrapper( - ctx, - array_uri, - &query, - server_buffers_, - serialize_, - refactored_query_v2_, - finalize_); - REQUIRE(rc == TILEDB_OK); + query.submit(); // The deserialized query should also include the read stats check_read_stats(query); @@ -551,15 +462,7 @@ TEST_CASE_METHOD( query.set_offsets_buffer("a3", a3_offsets); // Submit query - auto rc = submit_query_wrapper( - ctx, - array_uri, - &query, - server_buffers_, - serialize_, - refactored_query_v2_, - finalize_); - REQUIRE(rc == TILEDB_OK); + query.submit(); // The deserialized query should also include the read stats check_read_stats(query); @@ -607,15 +510,7 @@ TEST_CASE_METHOD( // Submit initial query. set_buffers(query); - auto rc = submit_query_wrapper( - ctx, - array_uri, - &query, - server_buffers_, - serialize_, - refactored_query_v2_, - finalize_); - REQUIRE(rc == TILEDB_OK); + query.submit(); // The deserialized query should also include the read stats check_read_stats(query); REQUIRE(query.query_status() == Query::Status::INCOMPLETE); @@ -629,15 +524,7 @@ TEST_CASE_METHOD( // Reset buffers, serialize and resubmit set_buffers(query); - rc = submit_query_wrapper( - ctx, - array_uri, - &query, - server_buffers_, - serialize_, - refactored_query_v2_, - finalize_); - REQUIRE(rc == TILEDB_OK); + query.submit(); // The deserialized query should also include the read stats check_read_stats(query); @@ -653,15 +540,7 @@ TEST_CASE_METHOD( // Reset buffers, serialize and resubmit set_buffers(query); - rc = submit_query_wrapper( - ctx, - array_uri, - &query, - server_buffers_, - serialize_, - refactored_query_v2_, - finalize_); - REQUIRE(rc == TILEDB_OK); + query.submit(); // The deserialized query should also include the read stats check_read_stats(query); @@ -680,15 +559,13 @@ TEST_CASE_METHOD( TEST_CASE_METHOD( SerializationFx, "Query serialization, sparse", - "[query][sparse][serialization]") { - refactored_query_v2_ = GENERATE(true, false); + "[query][sparse][serialization][rest]") { create_array(TILEDB_SPARSE); write_sparse_array(); SECTION("- Read all") { Array array(ctx, array_uri, TILEDB_READ); Query query(ctx, array); - std::vector coords(1000); std::vector a1(1000); std::vector a2(1000); std::vector a2_nullable(1000); @@ -697,7 +574,6 @@ TEST_CASE_METHOD( std::vector subarray = {1, 10, 1, 10}; query.set_subarray(subarray); - query.set_coordinates(coords); query.set_data_buffer("a1", a1); query.set_data_buffer("a2", a2); query.set_validity_buffer("a2", a2_nullable); @@ -705,15 +581,7 @@ TEST_CASE_METHOD( query.set_offsets_buffer("a3", a3_offsets); // Submit query - auto rc = submit_query_wrapper( - ctx, - array_uri, - &query, - server_buffers_, - serialize_, - refactored_query_v2_, - finalize_); - REQUIRE(rc == TILEDB_OK); + query.submit(); // The deserialized query should also include the read stats check_read_stats(query); @@ -732,8 +600,7 @@ TEST_CASE_METHOD( TEST_CASE_METHOD( SerializationFx, "Query serialization, sparse, old client", - "[query][sparse][serialization][old-client]") { - refactored_query_v2_ = GENERATE(true, false); + "[query][sparse][serialization][old-client][rest]") { create_array(TILEDB_SPARSE); write_sparse_array(); @@ -745,7 +612,6 @@ TEST_CASE_METHOD( SECTION("- Read all") { Array array(ctx_client, array_uri, TILEDB_READ); Query query(ctx_client, array); - std::vector coords(1000); std::vector a1(1000); std::vector a2(1000); std::vector a2_nullable(1000); @@ -755,7 +621,6 @@ TEST_CASE_METHOD( query.set_layout(TILEDB_GLOBAL_ORDER); query.set_subarray(subarray); - query.set_coordinates(coords); query.set_data_buffer("a1", a1); query.set_data_buffer("a2", a2); query.set_validity_buffer("a2", a2_nullable); @@ -763,15 +628,7 @@ TEST_CASE_METHOD( query.set_offsets_buffer("a3", a3_offsets); // Submit query - auto rc = submit_query_wrapper( - ctx, - array_uri, - &query, - server_buffers_, - serialize_, - refactored_query_v2_, - finalize_); - REQUIRE(rc == TILEDB_OK); + query.submit(); // The deserialized query should also include the read stats check_read_stats(query); @@ -791,7 +648,6 @@ TEST_CASE_METHOD( SerializationFx, "Query serialization, split coords, sparse", "[query][sparse][serialization][split-coords]") { - refactored_query_v2_ = GENERATE(true, false); create_array(TILEDB_SPARSE); write_sparse_array_split_coords(); @@ -815,15 +671,7 @@ TEST_CASE_METHOD( query.set_offsets_buffer("a3", a3_offsets); // Submit query - auto rc = submit_query_wrapper( - ctx, - array_uri, - &query, - server_buffers_, - serialize_, - refactored_query_v2_, - finalize_); - REQUIRE(rc == TILEDB_OK); + query.submit(); // The deserialized query should also include the read stats check_read_stats(query); @@ -843,8 +691,7 @@ TEST_CASE_METHOD( TEST_CASE_METHOD( SerializationFx, "Query serialization, dense ranges", - "[query][dense][serialization]") { - refactored_query_v2_ = GENERATE(true, false); + "[query][dense][serialization][rest]") { create_array(TILEDB_DENSE); write_dense_array_ranges(); @@ -867,15 +714,7 @@ TEST_CASE_METHOD( query.set_offsets_buffer("a3", a3_offsets); // Submit query - auto rc = submit_query_wrapper( - ctx, - array_uri, - &query, - server_buffers_, - serialize_, - refactored_query_v2_, - finalize_); - REQUIRE(rc == TILEDB_OK); + query.submit(); // The deserialized query should also include the read stats check_read_stats(query); @@ -909,15 +748,7 @@ TEST_CASE_METHOD( query.set_offsets_buffer("a3", a3_offsets); // Submit query - auto rc = submit_query_wrapper( - ctx, - array_uri, - &query, - server_buffers_, - serialize_, - refactored_query_v2_, - finalize_); - REQUIRE(rc == TILEDB_OK); + query.submit(); // The deserialized query should also include the read stats check_read_stats(query); @@ -955,15 +786,7 @@ TEST_CASE_METHOD( // Submit initial query. set_buffers(query); // Submit query - auto rc = submit_query_wrapper( - ctx, - array_uri, - &query, - server_buffers_, - serialize_, - refactored_query_v2_, - finalize_); - REQUIRE(rc == TILEDB_OK); + query.submit(); // The deserialized query should also include the read stats check_read_stats(query); REQUIRE(query.query_status() == Query::Status::INCOMPLETE); @@ -978,15 +801,7 @@ TEST_CASE_METHOD( // Reset buffers, serialize and resubmit set_buffers(query); // Submit query - rc = submit_query_wrapper( - ctx, - array_uri, - &query, - server_buffers_, - serialize_, - refactored_query_v2_, - finalize_); - REQUIRE(rc == TILEDB_OK); + query.submit(); // The deserialized query should also include the read stats check_read_stats(query); @@ -1001,15 +816,7 @@ TEST_CASE_METHOD( // Reset buffers, serialize and resubmit set_buffers(query); // Submit query - rc = submit_query_wrapper( - ctx, - array_uri, - &query, - server_buffers_, - serialize_, - refactored_query_v2_, - finalize_); - REQUIRE(rc == TILEDB_OK); + query.submit(); // The deserialized query should also include the read stats check_read_stats(query); @@ -1028,8 +835,7 @@ TEST_CASE_METHOD( TEST_CASE_METHOD( SerializationFx, "Query serialization, sparse delete", - "[query][sparse][delete][serialization]") { - refactored_query_v2_ = GENERATE(true, false); + "[query][sparse][delete][serialization][rest]") { create_array(TILEDB_SPARSE); write_sparse_array(); write_sparse_delete(); @@ -1037,7 +843,6 @@ TEST_CASE_METHOD( SECTION("- Read all") { Array array(ctx, array_uri, TILEDB_READ); Query query(ctx, array); - std::vector coords(1000); std::vector a1(1000); std::vector a2(1000); std::vector a2_nullable(1000); @@ -1046,7 +851,6 @@ TEST_CASE_METHOD( std::vector subarray = {1, 10, 1, 10}; query.set_subarray(subarray); - query.set_coordinates(coords); query.set_data_buffer("a1", a1); query.set_data_buffer("a2", a2); query.set_validity_buffer("a2", a2_nullable); @@ -1054,15 +858,7 @@ TEST_CASE_METHOD( query.set_offsets_buffer("a3", a3_offsets); // Submit query - auto rc = submit_query_wrapper( - ctx, - array_uri, - &query, - server_buffers_, - serialize_, - refactored_query_v2_, - finalize_); - REQUIRE(rc == TILEDB_OK); + query.submit(); // The deserialized query should also include the read stats check_read_stats(query); @@ -1081,17 +877,7 @@ TEST_CASE_METHOD( TEST_CASE_METHOD( SerializationFx, "Global order writes serialization", - "[global-order-write][serialization][dense]") { - SECTION("no serialization") { - serialize_ = false; - } -#ifdef TILEDB_SERIALIZATION - SECTION("serialization enabled global order write") { - serialize_ = true; - refactored_query_v2_ = GENERATE(true, false); - } -#endif - + "[global-order-write][serialization][dense][rest]") { uint64_t tile_extent = 2; ArraySchema schema(ctx, TILEDB_DENSE); Domain domain(ctx); @@ -1150,29 +936,13 @@ TEST_CASE_METHOD( begin += chunk_size; end = std::min(last_space_tile, end + chunk_size); - // Simulate REST submit() if (begin < end) { - submit_query_wrapper( - ctx, - array_uri, - &query, - server_buffers_, - serialize_, - refactored_query_v2_, - false); + query.submit(); } } // Submit query - auto rc = submit_query_wrapper( - ctx, - array_uri, - &query, - server_buffers_, - serialize_, - refactored_query_v2_); - REQUIRE(rc == TILEDB_OK); - + query.submit_and_finalize(); REQUIRE(query.query_status() == Query::Status::COMPLETE); // Read and validate results @@ -1195,14 +965,7 @@ TEST_CASE_METHOD( query.set_offsets_buffer( "a3", a3_result_offsets.data(), a3_result_offsets.size()); - auto rc = submit_query_wrapper( - ctx, - array_uri, - &query, - server_buffers_, - serialize_, - refactored_query_v2_); - REQUIRE(rc == TILEDB_OK); + query.submit(); REQUIRE(query.query_status() == Query::Status::COMPLETE); for (uint64_t i = 0; i < ncells; ++i) { @@ -1224,13 +987,7 @@ TEST_CASE_METHOD( SerializationFx, "Derialization of a var size read query correctly resets original buffer " "sizes", - "[capi][query][serialization][reset-buffers]") { -#ifndef TILEDB_SERIALIZATION - // Only makes sense in serialization - return; -#endif - refactored_query_v2_ = GENERATE(true, false); - + "[capi][query][serialization][reset-buffers][rest]") { create_array(TILEDB_SPARSE); write_sparse_array(); @@ -1251,16 +1008,7 @@ TEST_CASE_METHOD( set_buffers(); Query::Status status; do { - int rc = submit_query_wrapper( - ctx, - array_uri, - &query, - server_buffers_, - true, - refactored_query_v2_, - false); - REQUIRE(rc == TILEDB_OK); - + query.submit(); status = query.query_status(); } while (status == Query::Status::INCOMPLETE); diff --git a/test/src/unit-capi-serialized_queries_using_subarray.cc b/test/src/unit-capi-serialized_queries_using_subarray.cc index a8d6499212b..923868efcac 100644 --- a/test/src/unit-capi-serialized_queries_using_subarray.cc +++ b/test/src/unit-capi-serialized_queries_using_subarray.cc @@ -35,6 +35,7 @@ #include #include "test/support/src/helpers.h" +#include "test/support/src/vfs_helpers.h" #include "tiledb/sm/c_api/tiledb_serialization.h" #include "tiledb/sm/c_api/tiledb_struct_def.h" #include "tiledb/sm/cpp_api/tiledb" @@ -60,18 +61,6 @@ using tiledb::test::submit_query_wrapper; namespace { -#ifdef _WIN32 -static const char PATH_SEPARATOR = '\\'; -static std::string current_dir() { - return sm::Win::current_dir(); -} -#else -static const char PATH_SEPARATOR = '/'; -static std::string current_dir() { - return sm::Posix::current_dir(); -} -#endif - template bool check_result(const T a, const T b, size_t start, size_t end) { auto a_exp = T(a.begin() + start, a.begin() + end); @@ -100,34 +89,15 @@ bool check_result( } struct SerializationFx { - const std::string tmpdir = "serialization_test_dir"; - const std::string array_name = "testarray"; - const std::string array_uri = - current_dir() + PATH_SEPARATOR + tmpdir + "/" + array_name; - + test::VFSTestSetup vfs_test_setup_; + tiledb_ctx_t* ctx_; Context ctx; - VFS vfs; - - // Serialization parameters - bool serialize_ = true; - bool refactored_query_v2_ = false; - bool finalize_ = false; - // Buffers to allocate on server side for serialized queries - tiledb::test::ServerQueryBuffers server_buffers_; + const std::string array_uri; SerializationFx() - : vfs(ctx) { - if (vfs.is_dir(tmpdir)) - vfs.remove_dir(tmpdir); - vfs.create_dir(tmpdir); - if (!vfs.is_dir(tmpdir)) - std::cerr << "'created' but not finding dir '" << tmpdir << "'" - << std::endl; - } - - ~SerializationFx() { - if (vfs.is_dir(tmpdir)) - vfs.remove_dir(tmpdir); + : ctx_{vfs_test_setup_.ctx_c} + , ctx{vfs_test_setup_.ctx()} + , array_uri{vfs_test_setup_.array_uri("testarray")} { } static void check_read_stats(const Query& query) { @@ -226,15 +196,7 @@ struct SerializationFx { query.set_offsets_buffer("a3", a3_offsets); // Submit query - auto rc = submit_query_wrapper( - ctx, - array_uri, - &query, - server_buffers_, - serialize_, - refactored_query_v2_, - finalize_); - REQUIRE(rc == TILEDB_OK); + query.submit(); // The deserialized query should also include the write stats check_write_stats(query); @@ -278,20 +240,12 @@ struct SerializationFx { query.set_offsets_buffer("a3", a3_offsets); // Submit query - auto rc = submit_query_wrapper( - ctx, - array_uri, - &query, - server_buffers_, - serialize_, - refactored_query_v2_, - finalize_); - REQUIRE(rc == TILEDB_OK); + query.submit(); } void write_sparse_array() { - std::vector coords = {1, 1, 2, 2, 3, 3, 4, 4, 5, 5, - 6, 6, 7, 7, 8, 8, 9, 9, 10, 10}; + std::vector d1 = {1, 2, 3, 4, 5, 6, 7, 8, 9, 10}; + std::vector d2 = {1, 2, 3, 4, 5, 6, 7, 8, 9, 10}; std::vector a1; std::vector a2; std::vector a2_nullable; @@ -315,7 +269,8 @@ struct SerializationFx { Array array(ctx, array_uri, TILEDB_WRITE); Query query(ctx, array); query.set_layout(TILEDB_UNORDERED); - query.set_coordinates(coords); + query.set_data_buffer("d1", d1); + query.set_data_buffer("d2", d2); query.set_data_buffer("a1", a1); query.set_data_buffer("a2", a2); query.set_validity_buffer("a2", a2_nullable); @@ -323,15 +278,7 @@ struct SerializationFx { query.set_offsets_buffer("a3", a3_offsets); // Submit query - auto rc = submit_query_wrapper( - ctx, - array_uri, - &query, - server_buffers_, - serialize_, - refactored_query_v2_, - finalize_); - REQUIRE(rc == TILEDB_OK); + query.submit(); } void write_sparse_array_split_coords() { @@ -371,15 +318,7 @@ struct SerializationFx { query.set_offsets_buffer("a3", a3_offsets); // Submit query - auto rc = submit_query_wrapper( - ctx, - array_uri, - &query, - server_buffers_, - serialize_, - refactored_query_v2_, - finalize_); - REQUIRE(rc == TILEDB_OK); + query.submit(); } }; @@ -388,8 +327,7 @@ struct SerializationFx { TEST_CASE_METHOD( SerializationFx, "subarray - Query serialization, dense", - "[query][dense][serialization]") { - refactored_query_v2_ = GENERATE(true, false); + "[query][dense][serialization][rest][new]") { create_array(TILEDB_DENSE); auto expected_results = write_dense_array(); check_subarray_stats(2, 2); @@ -417,15 +355,7 @@ TEST_CASE_METHOD( check_subarray_stats(3, 3); // Submit query - auto rc = submit_query_wrapper( - ctx, - array_uri, - &query, - server_buffers_, - serialize_, - refactored_query_v2_, - finalize_); - REQUIRE(rc == TILEDB_OK); + query.submit(); REQUIRE(query.query_status() == Query::Status::COMPLETE); // Check stats after serialization @@ -465,15 +395,7 @@ TEST_CASE_METHOD( query.set_condition(condition); // Submit query - auto rc = submit_query_wrapper( - ctx, - array_uri, - &query, - server_buffers_, - serialize_, - refactored_query_v2_, - finalize_); - REQUIRE(rc == TILEDB_OK); + query.submit(); REQUIRE(query.query_status() == Query::Status::COMPLETE); // The deserialized query should also include the write stats @@ -535,15 +457,7 @@ TEST_CASE_METHOD( query.set_offsets_buffer("a3", a3_offsets); // Submit query - auto rc = submit_query_wrapper( - ctx, - array_uri, - &query, - server_buffers_, - serialize_, - refactored_query_v2_, - finalize_); - REQUIRE(rc == TILEDB_OK); + query.submit(); REQUIRE(query.query_status() == Query::Status::COMPLETE); check_subarray_stats(5, 5); @@ -578,15 +492,7 @@ TEST_CASE_METHOD( // Submit initial query. set_buffers(query); - auto rc = submit_query_wrapper( - ctx, - array_uri, - &query, - server_buffers_, - serialize_, - refactored_query_v2_, - finalize_); - REQUIRE(rc == TILEDB_OK); + query.submit(); check_subarray_stats(5, 5); REQUIRE(query.query_status() == Query::Status::INCOMPLETE); @@ -599,15 +505,7 @@ TEST_CASE_METHOD( // Reset buffers, serialize and resubmit set_buffers(query); - rc = submit_query_wrapper( - ctx, - array_uri, - &query, - server_buffers_, - serialize_, - refactored_query_v2_, - finalize_); - REQUIRE(rc == TILEDB_OK); + query.submit(); check_subarray_stats(7, 7); REQUIRE(query.query_status() == Query::Status::INCOMPLETE); @@ -620,15 +518,7 @@ TEST_CASE_METHOD( // Reset buffers, serialize and resubmit set_buffers(query); - rc = submit_query_wrapper( - ctx, - array_uri, - &query, - server_buffers_, - serialize_, - refactored_query_v2_, - finalize_); - REQUIRE(rc == TILEDB_OK); + query.submit(); check_subarray_stats(9, 9); REQUIRE(query.query_status() == Query::Status::COMPLETE); @@ -644,15 +534,13 @@ TEST_CASE_METHOD( TEST_CASE_METHOD( SerializationFx, "subarray - Query serialization, sparse", - "[query][sparse][serialization]") { - refactored_query_v2_ = GENERATE(true, false); + "[query][sparse][serialization][rest][new]") { create_array(TILEDB_SPARSE); write_sparse_array(); SECTION("- Read all") { Array array(ctx, array_uri, TILEDB_READ); Query query(ctx, array); - std::vector coords(1000); std::vector a1(1000); std::vector a2(1000); std::vector a2_nullable(1000); @@ -664,7 +552,6 @@ TEST_CASE_METHOD( cppapi_subarray.set_subarray(subarray); query.set_subarray(cppapi_subarray); - query.set_coordinates(coords); query.set_data_buffer("a1", a1); query.set_data_buffer("a2", a2); query.set_validity_buffer("a2", a2_nullable); @@ -672,15 +559,7 @@ TEST_CASE_METHOD( query.set_offsets_buffer("a3", a3_offsets); // Submit query - auto rc = submit_query_wrapper( - ctx, - array_uri, - &query, - server_buffers_, - serialize_, - refactored_query_v2_, - finalize_); - REQUIRE(rc == TILEDB_OK); + query.submit(); REQUIRE(query.query_status() == Query::Status::COMPLETE); auto result_el = query.result_buffer_elements_nullable(); @@ -696,7 +575,6 @@ TEST_CASE_METHOD( SerializationFx, "subarray - Query serialization, split coords, sparse", "[query][sparse][serialization][split-coords]") { - refactored_query_v2_ = GENERATE(true, false); create_array(TILEDB_SPARSE); write_sparse_array_split_coords(); @@ -722,15 +600,7 @@ TEST_CASE_METHOD( query.set_offsets_buffer("a3", a3_offsets); // Submit query - auto rc = submit_query_wrapper( - ctx, - array_uri, - &query, - server_buffers_, - serialize_, - refactored_query_v2_, - finalize_); - REQUIRE(rc == TILEDB_OK); + query.submit(); REQUIRE(query.query_status() == Query::Status::COMPLETE); auto result_el = query.result_buffer_elements_nullable(); @@ -746,8 +616,7 @@ TEST_CASE_METHOD( TEST_CASE_METHOD( SerializationFx, "subarray - Query serialization, dense ranges", - "[query][dense][serialization]") { - refactored_query_v2_ = GENERATE(true, false); + "[query][dense][serialization][rest][new]") { create_array(TILEDB_DENSE); write_dense_array_ranges(); @@ -772,15 +641,7 @@ TEST_CASE_METHOD( query.set_offsets_buffer("a3", a3_offsets); // Submit query - auto rc = submit_query_wrapper( - ctx, - array_uri, - &query, - server_buffers_, - serialize_, - refactored_query_v2_, - finalize_); - REQUIRE(rc == TILEDB_OK); + query.submit(); REQUIRE(query.query_status() == Query::Status::COMPLETE); auto result_el = query.result_buffer_elements_nullable(); @@ -812,15 +673,7 @@ TEST_CASE_METHOD( query.set_offsets_buffer("a3", a3_offsets); // Submit query - auto rc = submit_query_wrapper( - ctx, - array_uri, - &query, - server_buffers_, - serialize_, - refactored_query_v2_, - finalize_); - REQUIRE(rc == TILEDB_OK); + query.submit(); REQUIRE(query.query_status() == Query::Status::COMPLETE); auto result_el = query.result_buffer_elements_nullable(); @@ -855,15 +708,7 @@ TEST_CASE_METHOD( // Submit initial query. set_buffers(query); - auto rc = submit_query_wrapper( - ctx, - array_uri, - &query, - server_buffers_, - serialize_, - refactored_query_v2_, - finalize_); - REQUIRE(rc == TILEDB_OK); + query.submit(); REQUIRE(query.query_status() == Query::Status::INCOMPLETE); auto result_el = query.result_buffer_elements_nullable(); @@ -876,15 +721,7 @@ TEST_CASE_METHOD( // Reset buffers, serialize and resubmit set_buffers(query); // Submit query - rc = submit_query_wrapper( - ctx, - array_uri, - &query, - server_buffers_, - serialize_, - refactored_query_v2_, - finalize_); - REQUIRE(rc == TILEDB_OK); + query.submit(); REQUIRE(query.query_status() == Query::Status::INCOMPLETE); result_el = query.result_buffer_elements_nullable(); @@ -897,15 +734,7 @@ TEST_CASE_METHOD( // Reset buffers, serialize and resubmit set_buffers(query); // Submit query - rc = submit_query_wrapper( - ctx, - array_uri, - &query, - server_buffers_, - serialize_, - refactored_query_v2_, - finalize_); - REQUIRE(rc == TILEDB_OK); + query.submit(); REQUIRE(query.query_status() == Query::Status::COMPLETE); result_el = query.result_buffer_elements_nullable();