diff --git a/.github/workflows/build-windows.yml b/.github/workflows/build-windows.yml index be68ea10d08..3ade1275949 100644 --- a/.github/workflows/build-windows.yml +++ b/.github/workflows/build-windows.yml @@ -227,7 +227,7 @@ jobs: } # CMake exits with non-0 status if there are any warnings during the build, so - cmake --build $env:BUILD_BUILDDIRECTORY -j --target tiledb_unit unit_vfs tiledb_regression all_link_complete --config $CMakeBuildType + cmake --build $env:BUILD_BUILDDIRECTORY -j --target tiledb_unit unit_vfs tiledb_regression --config $CMakeBuildType if ($env:TILEDB_AZURE -eq "ON") { if($env.TILEDB_USE_CUSTOM_NODE_JS) { diff --git a/CMakeLists.txt b/CMakeLists.txt index f6b692f80df..5681f16d705 100644 --- a/CMakeLists.txt +++ b/CMakeLists.txt @@ -337,7 +337,10 @@ list(APPEND TILEDB_C_API_RELATIVE_HEADERS "${CMAKE_SOURCE_DIR}/tiledb/api/c_api/object/object_api_external.h" "${CMAKE_SOURCE_DIR}/tiledb/api/c_api/query/query_api_enum.h" "${CMAKE_SOURCE_DIR}/tiledb/api/c_api/query/query_api_external.h" + "${CMAKE_SOURCE_DIR}/tiledb/api/c_api/query/query_api_external_experimental.h" "${CMAKE_SOURCE_DIR}/tiledb/api/c_api/query_aggregate/query_aggregate_api_external_experimental.h" + "${CMAKE_SOURCE_DIR}/tiledb/api/c_api/query_condition/query_condition_api_external.h" + "${CMAKE_SOURCE_DIR}/tiledb/api/c_api/query_condition/query_condition_api_external_experimental.h" "${CMAKE_SOURCE_DIR}/tiledb/api/c_api/query_field/query_field_api_external_experimental.h" "${CMAKE_SOURCE_DIR}/tiledb/api/c_api/query_plan/query_plan_api_external_experimental.h" "${CMAKE_SOURCE_DIR}/tiledb/api/c_api/string/string_api_external.h" @@ -483,32 +486,13 @@ if(TILEDB_TESTS) endif() # ------------------------------------------------------- -# Accumulators for object libraries and unit tests +# Accumulators for unit tests # ------------------------------------------------------- # -# All link-completeness targets from object libraries are aggregated onto a -# single target. -# -# 1. Before any subdirectories are added: -# a) Declare a target for all link-completeness checks. It's a phantom target -# having only dependencies and with no build actions of its own. -# b) Declare an accumulator for link-completeness targets. -# 2. For each object library within the various subdirectories, add a -# link-completeness target, either -# a) manually, as an explicit dependency of the `all_link_complete` target. -# b) automatically, as an implicit part of an object library environment. -# The environment puts the link-completess target into the accumulator. -# 3. After all the subdirectories are added: -# a) The list of all targets from the accumulator is added as a dependency -# of `all_link_complete`. -# -# All unit tests are similarly aggregated onto the target `all_unit_tests`. +# All unit tests are aggregated onto the target `all_unit_tests`. # include(accumulator) -add_custom_target(all_link_complete) -define_accumulator(object_library_compile_targets) - define_accumulator(unit_test_targets) # # This is the legacy position of this target declaration; it should appear in @@ -592,14 +576,6 @@ if (TILEDB_TESTS) ) endif() -# ------------------------------------------------------- -# -# All the compile-targets from object library definitions are dependencies of -# the `all_link_complete` phantom target. -# -retrieve_from(Compile_Targets ACCUMULATOR object_library_compile_targets) -add_dependencies(all_link_complete ${Compile_Targets}) - ########################################################### # Uninstall ########################################################### diff --git a/cmake/object_library.cmake b/cmake/object_library.cmake index 31f340ce0ef..68cf28786e6 100644 --- a/cmake/object_library.cmake +++ b/cmake/object_library.cmake @@ -184,20 +184,6 @@ macro(TileDB_Environment_object_library_end) # #target_link_libraries(${TileDB_Environment_object_library_end_Library} PUBLIC configuration_definitions) - # Compile test - add_executable(${TileDB_Environment_object_library_end_Compile} EXCLUDE_FROM_ALL) - target_link_libraries(${TileDB_Environment_object_library_end_Compile} PRIVATE ${TileDB_Environment_object_library_end_Library}) - # Link assert since it is used everywhere (good) - target_link_libraries(${TileDB_Environment_object_library_end_Compile} PRIVATE assert) - # There must be a file named `test/compile__main.cc` for each object library. - # TODO: Add explicit check for missing `..._main.cc` file. - target_sources(${TileDB_Environment_object_library_end_Compile} PRIVATE - test/${TileDB_Environment_object_library_end_Compile}_main.cc $ - ) - # Append the current link-complete compile target to the complete list of them - put_into(ACCUMULATOR object_library_compile_targets LIST ${TileDB_Environment_object_library_end_Compile}) - # ---------------------------------- - message(${TileDB_Environment_object_library_end_Log_Level} "<<< object-library conclude end <<<") endmacro() diff --git a/cmake/unit_test.cmake b/cmake/unit_test.cmake index f2aa1d222d6..e4800cc60ac 100644 --- a/cmake/unit_test.cmake +++ b/cmake/unit_test.cmake @@ -186,7 +186,7 @@ macro(TileDB_Environment_unit_test_end) WORKING_DIRECTORY ${CMAKE_CURRENT_SOURCE_DIR} ) - # Append the current link-complete compile target to the complete list of them + # Append the current unit test target to the complete list of them put_into(ACCUMULATOR unit_test_targets LIST ${TileDB_Environment_unit_test_end_Unit_Test}) # ---------------------------------- diff --git a/scripts/ci/build_libtiledb.sh b/scripts/ci/build_libtiledb.sh index 4da6d130582..73ccda2ac2c 100644 --- a/scripts/ci/build_libtiledb.sh +++ b/scripts/ci/build_libtiledb.sh @@ -35,4 +35,4 @@ cmake --build . -j4 --target install ls -la -cmake --build . -j4 --target tiledb_unit unit_vfs tiledb_regression all_link_complete +cmake --build . -j4 --target tiledb_unit unit_vfs tiledb_regression diff --git a/test/src/test-capi-dimension-label.cc b/test/src/test-capi-dimension-label.cc index dd94fc9878b..87b4cda543a 100644 --- a/test/src/test-capi-dimension-label.cc +++ b/test/src/test-capi-dimension-label.cc @@ -34,6 +34,7 @@ #include "test/support/src/vfs_helpers.h" #include "tiledb/api/c_api/array_schema/array_schema_api_internal.h" #include "tiledb/api/c_api/context/context_api_internal.h" +#include "tiledb/sm/array_schema/dimension.h" #include "tiledb/sm/c_api/tiledb.h" #include "tiledb/sm/c_api/tiledb_experimental.h" #include "tiledb/sm/c_api/tiledb_struct_def.h" diff --git a/test/src/test-cppapi-aggregates.cc b/test/src/test-cppapi-aggregates.cc index 7e5436b2305..8279180ea03 100644 --- a/test/src/test-cppapi-aggregates.cc +++ b/test/src/test-cppapi-aggregates.cc @@ -31,7 +31,7 @@ */ #include "test/support/src/helpers.h" -#include "tiledb/sm/c_api/tiledb_struct_def.h" +#include "tiledb/api/c_api/query/query_api_internal.h" #include "tiledb/sm/cpp_api/tiledb" #include "tiledb/sm/cpp_api/tiledb_experimental" #include "tiledb/sm/query/readers/aggregators/count_aggregator.h" @@ -2188,7 +2188,7 @@ TEST_CASE_METHOD( // first attribute get a var size overflow, which should not impact // the results of the second attribute as we don't request data for // the second attribute. - query.ptr()->query_->add_aggregator_to_default_channel( + query.ptr()->query()->add_aggregator_to_default_channel( "NullCount2", std::make_shared< tiledb::sm::NullCountAggregator>(tiledb::sm::FieldInfo( @@ -2331,7 +2331,7 @@ TEST_CASE_METHOD( // Add another aggregator on the second attribute. We will make this // attribute get a var size overflow, which should impact the result // of the first one hence throw an exception. - query.ptr()->query_->add_aggregator_to_default_channel( + query.ptr()->query()->add_aggregator_to_default_channel( "NullCount2", std::make_shared< tiledb::sm::NullCountAggregator>(tiledb::sm::FieldInfo( diff --git a/test/src/test-cppapi-dense-array-dimension-label.cc b/test/src/test-cppapi-dense-array-dimension-label.cc index c45c4db3c5e..b34c83b7cb0 100644 --- a/test/src/test-cppapi-dense-array-dimension-label.cc +++ b/test/src/test-cppapi-dense-array-dimension-label.cc @@ -34,7 +34,7 @@ #include "test/support/src/helpers.h" #include "test/support/src/vfs_helpers.h" -#include "tiledb/sm/c_api/tiledb_struct_def.h" +#include "tiledb/api/c_api/query/query_api_internal.h" #include "tiledb/sm/cpp_api/tiledb" #include "tiledb/sm/cpp_api/tiledb_experimental" @@ -587,10 +587,10 @@ TEST_CASE( query.set_layout(TILEDB_ROW_MAJOR).set_subarray(subarray); // Check the query subarray was updated with expected dimension ranges. - CHECK(query.ptr()->query_->subarray()->range_num() == 0); + CHECK(query.ptr()->query()->subarray()->range_num() == 0); query.submit(); - CHECK(query.ptr()->query_->subarray()->range_num() == 1); + CHECK(query.ptr()->query()->subarray()->range_num() == 1); CHECK( - query.ptr()->query_->subarray()->ranges_for_dim(0) == + query.ptr()->query()->subarray()->ranges_for_dim(0) == expected_subarray.ptr()->ranges_for_dim(0)); } diff --git a/test/src/unit-Reader.cc b/test/src/unit-Reader.cc index e942baa1189..3c6f8b25f87 100644 --- a/test/src/unit-Reader.cc +++ b/test/src/unit-Reader.cc @@ -43,6 +43,7 @@ #include "tiledb/sm/enums/encryption_type.h" #include "tiledb/sm/misc/types.h" #include "tiledb/sm/query/legacy/reader.h" +#include "tiledb/sm/query/query_state.h" #include "tiledb/type/range/range.h" #ifdef _WIN32 diff --git a/test/src/unit-capi-serialized_queries.cc b/test/src/unit-capi-serialized_queries.cc index 4f4ac434008..2aaa6a4cdc3 100644 --- a/test/src/unit-capi-serialized_queries.cc +++ b/test/src/unit-capi-serialized_queries.cc @@ -33,10 +33,10 @@ #include #include "test/support/src/helpers.h" #include "test/support/src/vfs_helpers.h" +#include "tiledb/api/c_api/query/query_api_internal.h" #include "tiledb/common/common.h" #include "tiledb/sm/c_api/tiledb.h" #include "tiledb/sm/c_api/tiledb_serialization.h" -#include "tiledb/sm/c_api/tiledb_struct_def.h" #include "tiledb/sm/cpp_api/tiledb" #include "tiledb/sm/query/legacy/reader.h" #include "tiledb/sm/query/writers/writer_base.h" @@ -97,7 +97,7 @@ struct SerializationFx { } static void check_read_stats(const Query& query) { - auto stats = ((sm::WriterBase*)query.ptr()->query_->strategy())->stats(); + auto stats = ((sm::WriterBase*)query.ptr()->query()->strategy())->stats(); REQUIRE(stats != nullptr); auto counters = stats->counters(); REQUIRE(counters != nullptr); @@ -107,7 +107,7 @@ struct SerializationFx { } static void check_write_stats(const Query& query) { - auto stats = ((sm::Reader*)query.ptr()->query_->strategy())->stats(); + auto stats = ((sm::Reader*)query.ptr()->query()->strategy())->stats(); REQUIRE(stats != nullptr); auto counters = stats->counters(); REQUIRE(counters != nullptr); @@ -130,7 +130,7 @@ struct SerializationFx { } static void check_delete_stats(const Query& query) { - auto stats = ((sm::Reader*)query.ptr()->query_->strategy())->stats(); + auto stats = ((sm::Reader*)query.ptr()->query()->strategy())->stats(); REQUIRE(stats != nullptr); auto counters = stats->counters(); REQUIRE(counters != nullptr); diff --git a/test/src/unit-capi-update-queries.cc b/test/src/unit-capi-update-queries.cc index e9ef4cec8d8..2fd3ca10428 100644 --- a/test/src/unit-capi-update-queries.cc +++ b/test/src/unit-capi-update-queries.cc @@ -33,9 +33,9 @@ #include "test/support/src/vfs_helpers.h" #include "test/support/tdb_catch.h" #include "tiledb/api/c_api/array/array_api_internal.h" +#include "tiledb/api/c_api/query/query_api_internal.h" #include "tiledb/sm/c_api/tiledb.h" #include "tiledb/sm/c_api/tiledb_experimental.h" -#include "tiledb/sm/c_api/tiledb_struct_def.h" #ifdef _WIN32 #include "tiledb/sm/filesystem/path_win.h" #include "tiledb/sm/filesystem/win.h" @@ -220,7 +220,7 @@ TEST_CASE_METHOD( // Check the update value. CHECK_THROWS( - query->query_->update_values()[0].check(array->array_schema_latest())); + query->query()->update_values()[0].check(array->array_schema_latest())); // Clean up. tiledb_query_free(&query); diff --git a/test/src/unit-cppapi-deletes.cc b/test/src/unit-cppapi-deletes.cc index d0b83a36f08..526106e7c20 100644 --- a/test/src/unit-cppapi-deletes.cc +++ b/test/src/unit-cppapi-deletes.cc @@ -36,10 +36,10 @@ #include "test/support/src/vfs_helpers.h" #include "tiledb/api/c_api/array/array_api_internal.h" #include "tiledb/api/c_api/context/context_api_internal.h" +#include "tiledb/api/c_api/query_condition/query_condition_api_internal.h" #include "tiledb/common/stdx_string.h" #include "tiledb/sm/array/array_directory.h" #include "tiledb/sm/array/array_operations.h" -#include "tiledb/sm/c_api/tiledb_struct_def.h" #include "tiledb/sm/cpp_api/group.h" #include "tiledb/sm/cpp_api/tiledb" #include "tiledb/sm/enums/encryption_type.h" @@ -396,7 +396,7 @@ void DeletesFx::check_delete_conditions( for (uint64_t i = 0; i < qcs.size(); i++) { // Compare to negated condition. - auto cmp = qcs[i].ptr()->query_condition_->negated_condition(); + auto cmp = qcs[i].ptr()->query_condition()->negated_condition(); CHECK(tiledb::test::ast_equal(delete_conditions.at(i).ast(), cmp.ast())); } diff --git a/test/src/unit-cppapi-max-fragment-size.cc b/test/src/unit-cppapi-max-fragment-size.cc index a5d5f883153..07798ab3e35 100644 --- a/test/src/unit-cppapi-max-fragment-size.cc +++ b/test/src/unit-cppapi-max-fragment-size.cc @@ -41,11 +41,11 @@ #include "test/support/src/vfs_helpers.h" #include "tiledb/api/c_api/array_schema/array_schema_api_internal.h" #include "tiledb/api/c_api/fragment_info/fragment_info_api_internal.h" +#include "tiledb/api/c_api/query/query_api_internal.h" #include "tiledb/api/c_api/subarray/subarray_api_internal.h" #include "tiledb/common/arithmetic.h" #include "tiledb/common/scoped_executor.h" #include "tiledb/common/stdx_string.h" -#include "tiledb/sm/c_api/tiledb_struct_def.h" #include "tiledb/sm/cpp_api/tiledb" #include "tiledb/sm/misc/constants.h" #include "tiledb/sm/query/writers/global_order_writer.h" @@ -96,7 +96,7 @@ struct CPPMaxFragmentSizeFx { Query query(ctx_, array, TILEDB_WRITE); // Set the maximum size for the fragments. - query.ptr().get()->query_->set_fragment_size(fragment_size); + query.ptr().get()->query()->set_fragment_size(fragment_size); query.set_layout(TILEDB_GLOBAL_ORDER); // Perform writes of the requested sizes. @@ -173,7 +173,7 @@ struct CPPMaxFragmentSizeFx { Query query(ctx_, array, TILEDB_WRITE); // Set the maximum size for the fragments. - query.ptr().get()->query_->set_fragment_size(fragment_size); + query.ptr().get()->query()->set_fragment_size(fragment_size); query.set_layout(TILEDB_GLOBAL_ORDER); // Perform writes of the requested sizes. @@ -504,7 +504,7 @@ TEST_CASE( Query query(ctx, array); // Set our max fragment size to force fragment writes - query.ptr()->query_->set_fragment_size(1080000); + query.ptr()->query()->set_fragment_size(1080000); query.set_layout(TILEDB_GLOBAL_ORDER).set_data_buffer("dim", data); @@ -618,7 +618,7 @@ instance_dense_global_order( Query query(ctx, array, TILEDB_WRITE); query.set_layout(TILEDB_GLOBAL_ORDER); query.set_subarray(sub); - query.ptr().get()->query_->set_fragment_size(max_fragment_size); + query.ptr().get()->query()->set_fragment_size(max_fragment_size); smsubarray = sub.ptr()->subarray()->ndrange(0); @@ -666,7 +666,7 @@ instance_dense_global_order( templates::query::num_cells(attributes, cursor)); const auto w = dynamic_cast( - query.ptr()->query_->strategy()); + query.ptr()->query()->strategy()); ASSERTER(w); const auto g = w->get_global_state(); ASSERTER(g); diff --git a/test/src/unit-cppapi-metadata.cc b/test/src/unit-cppapi-metadata.cc index ae237a0f6d1..7c87d7ede04 100644 --- a/test/src/unit-cppapi-metadata.cc +++ b/test/src/unit-cppapi-metadata.cc @@ -50,6 +50,7 @@ #include #include #include +#include #include using namespace tiledb; diff --git a/test/src/unit-cppapi-query-condition-enumerations.cc b/test/src/unit-cppapi-query-condition-enumerations.cc index fbc37457b1e..0aad05d71b2 100644 --- a/test/src/unit-cppapi-query-condition-enumerations.cc +++ b/test/src/unit-cppapi-query-condition-enumerations.cc @@ -38,7 +38,7 @@ #include "test/support/src/ast_helpers.h" #include "test/support/tdb_catch.h" #include "tiledb/api/c_api/array/array_api_internal.h" -#include "tiledb/sm/c_api/tiledb_struct_def.h" +#include "tiledb/api/c_api/query_condition/query_condition_api_internal.h" #include "tiledb/sm/cpp_api/tiledb" #include "tiledb/sm/cpp_api/tiledb_experimental" #include "tiledb/sm/serialization/query.h" @@ -546,7 +546,7 @@ TEST_CASE_METHOD( auto qc = QueryCondition::create(ctx_, "cell_type", std::string("fish"), TILEDB_NE); - auto core_qc = qc.ptr().get()->query_condition_; + auto core_qc = qc.ptr().get()->query_condition(); core_qc->rewrite_for_schema(core_array->array_schema_latest()); auto matcher = Catch::Matchers::ContainsSubstring( @@ -569,7 +569,7 @@ TEST_CASE_METHOD( auto qc = QueryCondition::create(ctx_, "cell_type", std::string("fish"), TILEDB_EQ); - auto core_qc = qc.ptr().get()->query_condition_; + auto core_qc = qc.ptr().get()->query_condition(); core_qc->rewrite_for_schema(core_array->array_schema_latest()); auto matcher = Catch::Matchers::ContainsSubstring( @@ -1120,10 +1120,10 @@ QueryCondition CPPQueryConditionEnumerationFx::serialize_deserialize_qc( using namespace tiledb::sm::serialization; using Condition = tiledb::sm::serialization::capnp::Condition; - auto qc_ptr = qc.ptr().get()->query_condition_; + auto qc_ptr = qc.ptr().get()->query_condition(); QueryCondition ret(ctx_); - auto ret_ptr = ret.ptr().get()->query_condition_; + auto ret_ptr = ret.ptr().get()->query_condition(); // Serialize the query condition. ::capnp::MallocMessageBuilder message; @@ -1163,7 +1163,7 @@ void CPPQueryConditionEnumerationFx::validate_query_condition( core_array->load_all_enumerations(); auto qc = creator(ctx_); - auto core_qc = qc.ptr().get()->query_condition_; + auto core_qc = qc.ptr().get()->query_condition(); core_qc->rewrite_for_schema(core_array->array_schema_latest()); REQUIRE(core_qc->check(core_array->array_schema_latest()).ok()); diff --git a/test/src/unit-cppapi-query-condition-sets.cc b/test/src/unit-cppapi-query-condition-sets.cc index 95e15ba2310..ad2d8195991 100644 --- a/test/src/unit-cppapi-query-condition-sets.cc +++ b/test/src/unit-cppapi-query-condition-sets.cc @@ -34,7 +34,7 @@ #include "test/support/src/vfs_helpers.h" #include "test/support/tdb_catch.h" #include "tiledb/api/c_api/array/array_api_internal.h" -#include "tiledb/sm/c_api/tiledb_struct_def.h" +#include "tiledb/api/c_api/query_condition/query_condition_api_internal.h" #include "tiledb/sm/cpp_api/tiledb" #include "tiledb/sm/cpp_api/tiledb_experimental" #include "tiledb/sm/serialization/query.h" @@ -763,7 +763,7 @@ void CPPQueryConditionFx::check_read( qc = serialize_deserialize_qc(qc); } - auto core_qc = qc.ptr().get()->query_condition_; + auto core_qc = qc.ptr().get()->query_condition(); throw_if_not_ok(core_qc->check(array.ptr().get()->array_schema_latest())); query.set_condition(qc) @@ -947,10 +947,10 @@ QueryCondition CPPQueryConditionFx::serialize_deserialize_qc( using namespace tiledb::sm::serialization; using Condition = tiledb::sm::serialization::capnp::Condition; - auto qc_ptr = qc.ptr().get()->query_condition_; + auto qc_ptr = qc.ptr().get()->query_condition(); QueryCondition ret(ctx_); - auto ret_ptr = ret.ptr().get()->query_condition_; + auto ret_ptr = ret.ptr().get()->query_condition(); // Serialize the query condition. ::capnp::MallocMessageBuilder message; diff --git a/test/src/unit-cppapi-subarray.cc b/test/src/unit-cppapi-subarray.cc index ea6a83910ba..06dec993366 100644 --- a/test/src/unit-cppapi-subarray.cc +++ b/test/src/unit-cppapi-subarray.cc @@ -34,7 +34,7 @@ #include "test/support/src/helpers.h" #include "test/support/src/serialization_wrappers.h" #include "test/support/src/vfs_helpers.h" -#include "tiledb/sm/c_api/tiledb_struct_def.h" +#include "tiledb/api/c_api/query/query_api_internal.h" #include "tiledb/sm/cpp_api/tiledb" using namespace tiledb; @@ -1369,7 +1369,7 @@ TEST_CASE( query.submit(); // Validate subarray ranges against expected values - auto subarray_ptr = *(query.ptr()->query_->subarray()); + auto subarray_ptr = *(query.ptr()->query()->subarray()); check_subarray(subarray_ptr, expected_ranges); // Clean up diff --git a/test/src/unit-cppapi-update-queries.cc b/test/src/unit-cppapi-update-queries.cc index 0a60ca03007..3017c9d0055 100644 --- a/test/src/unit-cppapi-update-queries.cc +++ b/test/src/unit-cppapi-update-queries.cc @@ -35,9 +35,10 @@ #include "test/support/src/helpers.h" #include "tiledb/api/c_api/array/array_api_internal.h" #include "tiledb/api/c_api/context/context_api_internal.h" +#include "tiledb/api/c_api/query/query_api_internal.h" +#include "tiledb/api/c_api/query_condition/query_condition_api_internal.h" #include "tiledb/sm/array/array_directory.h" #include "tiledb/sm/array/array_operations.h" -#include "tiledb/sm/c_api/tiledb_struct_def.h" #include "tiledb/sm/cpp_api/tiledb" #include "tiledb/sm/cpp_api/tiledb_experimental" #include "tiledb/sm/enums/encryption_type.h" @@ -213,7 +214,7 @@ void UpdatesFx::check_update_conditions( for (uint64_t i = 0; i < qcs.size(); i++) { // Compare to negated condition. - auto cmp = qcs[i].ptr()->query_condition_->negated_condition(); + auto cmp = qcs[i].ptr()->query_condition()->negated_condition(); CHECK(tiledb::test::ast_equal(conditions.at(i).ast(), cmp.ast())); auto& loaded_update_values = update_values.at(i); for (uint64_t j = 0; j < uvs[i].size(); j++) { @@ -265,7 +266,7 @@ TEST_CASE("C++ API: Test setting an update value", "[cppapi][updates]") { QueryExperimental::add_update_value_to_query( ctx, query, "a", &val, sizeof(val)); - query.ptr()->query_->update_values()[0].check( + query.ptr()->query()->update_values()[0].check( array.ptr()->array_schema_latest()); array.close(); diff --git a/test/src/unit-ctx.cc b/test/src/unit-ctx.cc index 29db09a4f5f..b82d59e4b8f 100644 --- a/test/src/unit-ctx.cc +++ b/test/src/unit-ctx.cc @@ -37,6 +37,7 @@ #include "tiledb/api/c_api/context/context_api_internal.h" #include "tiledb/sm/c_api/tiledb_struct_def.h" #include "tiledb/sm/cpp_api/tiledb" +#include "tiledb/sm/rest/rest_client_remote.h" #include #include diff --git a/test/src/unit-dense-reader.cc b/test/src/unit-dense-reader.cc index 7dbd91cc143..312464ac078 100644 --- a/test/src/unit-dense-reader.cc +++ b/test/src/unit-dense-reader.cc @@ -31,9 +31,9 @@ */ #include "test/support/src/helpers.h" +#include "tiledb/api/c_api/query/query_api_internal.h" #include "tiledb/common/common.h" #include "tiledb/sm/c_api/tiledb.h" -#include "tiledb/sm/c_api/tiledb_struct_def.h" #include "tiledb/sm/query/query_buffer.h" #include "tiledb/sm/query/readers/dense_reader.h" @@ -532,7 +532,7 @@ void CDenseFx::read( // Check the internal loop count against expected value. if (rc == TILEDB_OK) { - auto stats = ((DenseReader*)query->query_->strategy())->stats(); + auto stats = ((DenseReader*)query->query()->strategy())->stats(); REQUIRE(stats != nullptr); auto counters = stats->counters(); REQUIRE(counters != nullptr); @@ -654,7 +654,7 @@ void CDenseFx::read_strings( if (rc == TILEDB_OK) { // Check the internal loop count against expected value. - auto stats = ((DenseReader*)query->query_->strategy())->stats(); + auto stats = ((DenseReader*)query->query()->strategy())->stats(); REQUIRE(stats != nullptr); auto counters = stats->counters(); REQUIRE(counters != nullptr); @@ -824,7 +824,7 @@ void CDenseFx::read_fixed_strings( if (rc == TILEDB_OK) { // Check the internal loop count against expected value. - auto stats = ((DenseReader*)query->query_->strategy())->stats(); + auto stats = ((DenseReader*)query->query()->strategy())->stats(); REQUIRE(stats != nullptr); auto counters = stats->counters(); REQUIRE(counters != nullptr); diff --git a/test/src/unit-ordered-dim-label-reader.cc b/test/src/unit-ordered-dim-label-reader.cc index 8313cd80416..31100614175 100644 --- a/test/src/unit-ordered-dim-label-reader.cc +++ b/test/src/unit-ordered-dim-label-reader.cc @@ -36,7 +36,7 @@ using namespace Catch::Matchers; #include #include #include "test/support/src/serialization_wrappers.h" -#include "tiledb/sm/c_api/tiledb_struct_def.h" +#include "tiledb/api/c_api/query/query_api_internal.h" #include "tiledb/sm/cpp_api/tiledb" #include "tiledb/sm/misc/constants.h" #include "tiledb/sm/query/readers/ordered_dim_label_reader.h" @@ -133,7 +133,7 @@ struct CPPOrderedDimLabelReaderFixedFx { ctx_.ptr().get(), array.ptr().get(), &subarray_ptr); } - query.ptr()->query_->set_dimension_label_ordered_read(increasing_labels_); + query.ptr()->query()->set_dimension_label_ordered_read(increasing_labels_); query.set_data_buffer("index", index); query.set_subarray(subarray); query.submit(); @@ -180,7 +180,7 @@ struct CPPOrderedDimLabelReaderFixedFx { ctx_.ptr().get(), array.ptr().get(), &subarray_ptr); } - query.ptr()->query_->set_dimension_label_ordered_read( + query.ptr()->query()->set_dimension_label_ordered_read( increasing_labels_); query.set_data_buffer("index", index); query.set_subarray(subarray); @@ -229,7 +229,7 @@ TEST_CASE_METHOD( ctx_.ptr().get(), array.ptr().get(), &subarray_ptr); } - query.ptr()->query_->set_dimension_label_ordered_read(increasing_labels_); + query.ptr()->query()->set_dimension_label_ordered_read(increasing_labels_); query.set_subarray(subarray); query.set_data_buffer("index", index); @@ -263,7 +263,7 @@ TEST_CASE_METHOD( ctx_.ptr().get(), array.ptr().get(), &subarray_ptr); } - query.ptr()->query_->set_dimension_label_ordered_read(increasing_labels_); + query.ptr()->query()->set_dimension_label_ordered_read(increasing_labels_); query.set_subarray(subarray); REQUIRE_THROWS_WITH( @@ -302,7 +302,7 @@ TEST_CASE_METHOD( ctx_.ptr().get(), array.ptr().get(), &subarray_ptr); } - query.ptr()->query_->set_dimension_label_ordered_read(increasing_labels_); + query.ptr()->query()->set_dimension_label_ordered_read(increasing_labels_); query.set_subarray(subarray); query.set_data_buffer("labels", labels); @@ -342,7 +342,7 @@ TEST_CASE_METHOD( ctx_.ptr().get(), array.ptr().get(), &subarray_ptr); } - query.ptr()->query_->set_dimension_label_ordered_read(increasing_labels_); + query.ptr()->query()->set_dimension_label_ordered_read(increasing_labels_); query.set_subarray(subarray); query.set_data_buffer("index", index); @@ -383,7 +383,7 @@ TEST_CASE_METHOD( ctx_.ptr().get(), array.ptr().get(), &subarray_ptr); } - query.ptr()->query_->set_dimension_label_ordered_read(increasing_labels_); + query.ptr()->query()->set_dimension_label_ordered_read(increasing_labels_); query.set_subarray(subarray); query.set_data_buffer("index", index); @@ -419,7 +419,7 @@ TEST_CASE_METHOD( ctx_.ptr().get(), array.ptr().get(), &subarray_ptr); } - query.ptr()->query_->set_dimension_label_ordered_read(increasing_labels_); + query.ptr()->query()->set_dimension_label_ordered_read(increasing_labels_); std::vector index(ranges.size()); query.set_data_buffer("index", index); query.set_subarray(subarray); @@ -784,7 +784,7 @@ struct CPPOrderedDimLabelReaderVarFx { ctx_.ptr().get(), array.ptr().get(), &subarray_ptr); } - query.ptr()->query_->set_dimension_label_ordered_read(increasing_labels_); + query.ptr()->query()->set_dimension_label_ordered_read(increasing_labels_); query.set_data_buffer("index", index); query.set_subarray(subarray); query.submit(); @@ -838,7 +838,7 @@ struct CPPOrderedDimLabelReaderVarFx { ctx_.ptr().get(), array.ptr().get(), &subarray_ptr); } - query.ptr()->query_->set_dimension_label_ordered_read( + query.ptr()->query()->set_dimension_label_ordered_read( increasing_labels_); query.set_data_buffer("index", index); query.set_subarray(subarray); @@ -1064,7 +1064,7 @@ TEST_CASE_METHOD( ctx_.ptr().get(), array.ptr().get(), &subarray_ptr); } - query.ptr()->query_->set_dimension_label_ordered_read(increasing_labels_); + query.ptr()->query()->set_dimension_label_ordered_read(increasing_labels_); query.set_data_buffer("index", index); query.set_subarray(subarray); query.submit(); @@ -1074,7 +1074,7 @@ TEST_CASE_METHOD( // Check the internal loop count against expected value. auto stats = - ((sm::OrderedDimLabelReader*)query.ptr()->query_->strategy())->stats(); + ((sm::OrderedDimLabelReader*)query.ptr()->query()->strategy())->stats(); REQUIRE(stats != nullptr); auto counters = stats->counters(); REQUIRE(counters != nullptr); diff --git a/test/src/unit-request-handlers.cc b/test/src/unit-request-handlers.cc index 97be686385d..4f249a3a0cf 100644 --- a/test/src/unit-request-handlers.cc +++ b/test/src/unit-request-handlers.cc @@ -38,10 +38,10 @@ #include "tiledb/api/c_api/array_schema_evolution/array_schema_evolution_api_internal.h" #include "tiledb/api/c_api/buffer/buffer_api_internal.h" #include "tiledb/api/c_api/context/context_api_internal.h" +#include "tiledb/api/c_api/query/query_api_internal.h" #include "tiledb/api/c_api/string/string_api_internal.h" #include "tiledb/sm/array_schema/enumeration.h" #include "tiledb/sm/c_api/tiledb_serialization.h" -#include "tiledb/sm/c_api/tiledb_struct_def.h" #include "tiledb/sm/cpp_api/tiledb" #include "tiledb/sm/cpp_api/tiledb_experimental" #include "tiledb/sm/crypto/encryption_key.h" @@ -302,7 +302,7 @@ TEST_CASE_METHOD( REQUIRE(tiledb_query_get_plan(ctx, query, &query_plan) == TILEDB_OK); // Call handler to get query plan via serialized req/deserialized response - auto query_plan_ser_deser = call_handler(stype, *query->query_); + auto query_plan_ser_deser = call_handler(stype, *query->query()); // Compare the two query plans REQUIRE(query_plan->view() == query_plan_ser_deser.dump_json()); @@ -482,12 +482,12 @@ shared_ptr HandleLoadArraySchemaRequestFx::schema_add_attribute( auto attr = tiledb::Attribute::create(ctx, attr_name); ase.add_attribute(attr); // Evolve and update the original schema member variable. - schema_ = ase.ptr()->array_schema_evolution_->evolve_schema(schema_); + schema_ = ase.ptr()->array_schema_evolution()->evolve_schema(schema_); // Apply the schema evolution. Array::evolve_array_schema( this->ctx_.resources(), this->uri_, - ase.ptr()->array_schema_evolution_, + ase.ptr()->array_schema_evolution().get(), this->enc_key_); // Return the new evolved schema for validation. diff --git a/test/src/unit-sparse-global-order-reader.cc b/test/src/unit-sparse-global-order-reader.cc index c8c54cbff40..fdb683ae21b 100644 --- a/test/src/unit-sparse-global-order-reader.cc +++ b/test/src/unit-sparse-global-order-reader.cc @@ -38,8 +38,8 @@ #include "test/support/src/helpers.h" #include "test/support/src/vfs_helpers.h" #include "tiledb/api/c_api/array/array_api_internal.h" +#include "tiledb/api/c_api/query/query_api_internal.h" #include "tiledb/sm/c_api/tiledb.h" -#include "tiledb/sm/c_api/tiledb_struct_def.h" #include "tiledb/sm/cpp_api/tiledb" #include "tiledb/sm/enums/datatype.h" #include "tiledb/sm/misc/comparators.h" @@ -2534,7 +2534,7 @@ TEST_CASE_METHOD( // Check the internal loop count against expected value. auto stats = - ((sm::SparseGlobalOrderReader*)query->query_->strategy()) + ((sm::SparseGlobalOrderReader*)query->query()->strategy()) ->stats(); REQUIRE(stats != nullptr); auto counters = stats->counters(); @@ -3603,7 +3603,7 @@ void CSparseGlobalOrderFx::run_execute(Instance& instance) { if (instance.condition.has_value()) { tiledb::sm::QueryCondition qc(instance.condition->get()->clone()); - query->query_->set_condition(qc); // SAFETY: this performs a deep copy + query->query()->set_condition(qc); // SAFETY: this performs a deep copy } // Prepare output buffer diff --git a/test/src/unit-sparse-unordered-with-dups-reader.cc b/test/src/unit-sparse-unordered-with-dups-reader.cc index 7833e139298..6ac5c9439ad 100644 --- a/test/src/unit-sparse-unordered-with-dups-reader.cc +++ b/test/src/unit-sparse-unordered-with-dups-reader.cc @@ -32,10 +32,10 @@ #include "test/support/src/helpers.h" #include "tiledb/api/c_api/array/array_api_internal.h" +#include "tiledb/api/c_api/query/query_api_internal.h" #include "tiledb/common/common.h" #include "tiledb/common/memory_tracker.h" #include "tiledb/sm/c_api/tiledb.h" -#include "tiledb/sm/c_api/tiledb_struct_def.h" #include "tiledb/sm/query/query_buffer.h" #include "tiledb/sm/query/readers/sparse_index_reader_base.h" #include "tiledb/sm/query/readers/sparse_unordered_with_dups_reader.h" @@ -1029,7 +1029,7 @@ TEST_CASE_METHOD( // This is needed to simulate the remote server environment where updating // the config of a query that has already been submitted is only allowed. // This is set during deserialization on the remote server. - query->query_->set_remote_query(); + query->query()->set_remote_query(); rc = tiledb_query_set_config(ctx_, query, config); REQUIRE(rc == TILEDB_OK); @@ -1157,7 +1157,7 @@ TEST_CASE_METHOD( // Check the internal loop count against expected value. auto stats = - ((SparseUnorderedWithDupsReader*)query->query_->strategy()) + ((SparseUnorderedWithDupsReader*)query->query()->strategy()) ->stats(); REQUIRE(stats != nullptr); auto counters = stats->counters(); @@ -1271,7 +1271,7 @@ TEST_CASE_METHOD( // Check the internal loop count against expected value. auto stats = - ((SparseUnorderedWithDupsReader*)query->query_->strategy()) + ((SparseUnorderedWithDupsReader*)query->query()->strategy()) ->stats(); REQUIRE(stats != nullptr); auto counters = stats->counters(); diff --git a/test/support/test/compile_mem_helpers_main.cc b/test/support/test/compile_mem_helpers_main.cc deleted file mode 100644 index df5adeb2dc5..00000000000 --- a/test/support/test/compile_mem_helpers_main.cc +++ /dev/null @@ -1,34 +0,0 @@ -/** - * @file test/support/test/compile_mem_helpers_main.cc - * - * @section LICENSE - * - * The MIT License - * - * @copyright Copyright (c) 2023 TileDB, Inc. - * - * Permission is hereby granted, free of charge, to any person obtaining a copy - * of this software and associated documentation files (the "Software"), to deal - * in the Software without restriction, including without limitation the rights - * to use, copy, modify, merge, publish, distribute, sublicense, and/or sell - * copies of the Software, and to permit persons to whom the Software is - * furnished to do so, subject to the following conditions: - * - * The above copyright notice and this permission notice shall be included in - * all copies or substantial portions of the Software. - * - * THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR - * IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY, - * FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL THE - * AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER - * LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM, - * OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN - * THE SOFTWARE. - */ - -#include "../src/mem_helpers.h" - -int main() { - tiledb::test::get_test_memory_tracker(); - return 0; -} diff --git a/test/support/test/compile_tdb_catch_main.cc b/test/support/test/compile_tdb_catch_main.cc deleted file mode 100644 index a3a228a912f..00000000000 --- a/test/support/test/compile_tdb_catch_main.cc +++ /dev/null @@ -1,34 +0,0 @@ -/** - * @file test/support/test/compile_tdb_catch_main.cc - * - * @section LICENSE - * - * The MIT License - * - * @copyright Copyright (c) 2023 TileDB, Inc. - * - * Permission is hereby granted, free of charge, to any person obtaining a copy - * of this software and associated documentation files (the "Software"), to deal - * in the Software without restriction, including without limitation the rights - * to use, copy, modify, merge, publish, distribute, sublicense, and/or sell - * copies of the Software, and to permit persons to whom the Software is - * furnished to do so, subject to the following conditions: - * - * The above copyright notice and this permission notice shall be included in - * all copies or substantial portions of the Software. - * - * THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR - * IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY, - * FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL THE - * AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER - * LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM, - * OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN - * THE SOFTWARE. - */ - -#include "../tdb_catch_prng.h" - -int main() { - PRNGSeederFromCatch(nullptr); - return 0; -} diff --git a/tiledb/api/c_api/CMakeLists.txt b/tiledb/api/c_api/CMakeLists.txt index 4407ffb8e9e..4ffe15eccf2 100644 --- a/tiledb/api/c_api/CMakeLists.txt +++ b/tiledb/api/c_api/CMakeLists.txt @@ -106,6 +106,9 @@ add_subdirectory(domain) # `attribute`: depends on `filter_list`, `datatype` add_subdirectory(attribute) +# `array_schema_evolution`: depends on `array_schema`, `attribute`, `enumeration`, `current_domain`, `buffer` +add_subdirectory(array_schema_evolution) + # `group`: depends on `config`, `context` add_subdirectory(group) @@ -118,10 +121,10 @@ add_subdirectory(object) # `profile`: no dependencies add_subdirectory(profile) -# NOTE: Only the tiledb_query_type_t enum has been migrated -# to the new C API layout. -# -# `query`: no dependencies yet but will have some +# `query_condition`: no dependencies +add_subdirectory(query_condition) + +# `query`: depends on `query_condition` add_subdirectory(query) # `subarray`: depends on `context` diff --git a/tiledb/api/c_api/array/array_api.cc b/tiledb/api/c_api/array/array_api.cc index 56bf2e375fe..c0b04f31efa 100644 --- a/tiledb/api/c_api/array/array_api.cc +++ b/tiledb/api/c_api/array/array_api.cc @@ -624,7 +624,8 @@ capi_return_t tiledb_array_evolve( tiledb_ctx_t* ctx, const char* array_uri, tiledb_array_schema_evolution_t* array_schema_evolution) { - ensure_array_schema_evolution_is_valid(array_schema_evolution); + ensure_handle_is_valid(ctx); + ensure_handle_is_valid(array_schema_evolution); // Create key tiledb::sm::EncryptionKey key; @@ -635,7 +636,7 @@ capi_return_t tiledb_array_evolve( tiledb::sm::Array::evolve_array_schema( ctx->resources(), URI(array_uri, URI::must_be_valid), - array_schema_evolution->array_schema_evolution_, + array_schema_evolution->array_schema_evolution().get(), key); // Success diff --git a/tiledb/api/c_api/array/array_api_external.h b/tiledb/api/c_api/array/array_api_external.h index 72c38281082..30762423771 100644 --- a/tiledb/api/c_api/array/array_api_external.h +++ b/tiledb/api/c_api/array/array_api_external.h @@ -36,7 +36,6 @@ #include "../api_external_common.h" #include "../array_schema/array_schema_api_external.h" #include "../context/context_api_external.h" -#include "../query/query_api_external.h" #ifdef __cplusplus extern "C" { @@ -53,6 +52,18 @@ typedef enum { #undef TILEDB_ENCRYPTION_TYPE_ENUM } tiledb_encryption_type_t; +/** TileDB query type. */ +typedef enum { +/** Helper macro for defining query type enums. */ +#define TILEDB_QUERY_TYPE_ENUM(id) TILEDB_##id +// Use token-pasting _CONCAT_ID version for precarious symbols +// (such as DELETE, see `query_api_enum.h`) +#define TILEDB_QUERY_TYPE_ENUM_CONCAT_ID(id, id2) TILEDB_##id##id2 +#include "tiledb/api/c_api/query/query_api_enum.h" +#undef TILEDB_QUERY_TYPE_ENUM +#undef TILEDB_QUERY_TYPE_ENUM_CONCAT_ID +} tiledb_query_type_t; + /** * Returns a string representation of the given encryption type. * diff --git a/tiledb/api/c_api/array/test/compile_capi_array_stub_main.cc b/tiledb/api/c_api/array/test/compile_capi_array_stub_main.cc deleted file mode 100644 index 8907a6f43e3..00000000000 --- a/tiledb/api/c_api/array/test/compile_capi_array_stub_main.cc +++ /dev/null @@ -1,35 +0,0 @@ -/** - * @file - * tiledb/api/c_api/array/test/compile_capi_array_stub_main.cc - * - * @section LICENSE - * - * The MIT License - * - * @copyright Copyright (c) 2024 TileDB, Inc. - * - * Permission is hereby granted, free of charge, to any person obtaining a copy - * of this software and associated documentation files (the "Software"), to deal - * in the Software without restriction, including without limitation the rights - * to use, copy, modify, merge, publish, distribute, sublicense, and/or sell - * copies of the Software, and to permit persons to whom the Software is - * furnished to do so, subject to the following conditions: - * - * The above copyright notice and this permission notice shall be included in - * all copies or substantial portions of the Software. - * - * THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR - * IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY, - * FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL THE - * AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER - * LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM, - * OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN - * THE SOFTWARE. - */ - -#include "../array_api_external.h" - -int main() { - tiledb_array_schema_load(nullptr, nullptr, nullptr); - return 0; -} diff --git a/tiledb/api/c_api/array/test/unit_capi_array.cc b/tiledb/api/c_api/array/test/unit_capi_array.cc index e244801a41b..14411c3de10 100644 --- a/tiledb/api/c_api/array/test/unit_capi_array.cc +++ b/tiledb/api/c_api/array/test/unit_capi_array.cc @@ -1297,7 +1297,8 @@ TEST_CASE( TEST_CASE("C API: tiledb_array_evolve argument validation", "[capi][array]") { capi_return_t rc; ordinary_array_without_schema x{}; - tiledb_array_schema_evolution_t schema_evo; + tiledb_array_schema_evolution_t schema_evo{ + shared_ptr()}; /* * No "success" section here; too much overhead to set up. * This test cannot yet invoke tiledb_array_schema_evolution_alloc without diff --git a/tiledb/api/c_api/array_schema/test/compile_capi_array_schema_stub_main.cc b/tiledb/api/c_api/array_schema/test/compile_capi_array_schema_stub_main.cc deleted file mode 100644 index 588594caa46..00000000000 --- a/tiledb/api/c_api/array_schema/test/compile_capi_array_schema_stub_main.cc +++ /dev/null @@ -1,35 +0,0 @@ -/** - * @file - * tiledb/api/c_api/array_schema/test/compile_capi_array_schema_stub_main.cc - * - * @section LICENSE - * - * The MIT License - * - * @copyright Copyright (c) 2024 TileDB, Inc. - * - * Permission is hereby granted, free of charge, to any person obtaining a copy - * of this software and associated documentation files (the "Software"), to deal - * in the Software without restriction, including without limitation the rights - * to use, copy, modify, merge, publish, distribute, sublicense, and/or sell - * copies of the Software, and to permit persons to whom the Software is - * furnished to do so, subject to the following conditions: - * - * The above copyright notice and this permission notice shall be included in - * all copies or substantial portions of the Software. - * - * THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR - * IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY, - * FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL THE - * AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER - * LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM, - * OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN - * THE SOFTWARE. - */ - -#include "../array_schema_api_external.h" - -int main() { - tiledb_array_schema_add_attribute(nullptr, nullptr, nullptr); - return 0; -} diff --git a/tiledb/api/c_api/array_schema_evolution/CMakeLists.txt b/tiledb/api/c_api/array_schema_evolution/CMakeLists.txt new file mode 100644 index 00000000000..14f7f83cee6 --- /dev/null +++ b/tiledb/api/c_api/array_schema_evolution/CMakeLists.txt @@ -0,0 +1,42 @@ +# +# tiledb/api/c_api/array_schema_evolution/CMakeLists.txt +# +# The MIT License +# +# Copyright (c) 2024 TileDB, Inc. +# +# Permission is hereby granted, free of charge, to any person obtaining a copy +# of this software and associated documentation files (the "Software"), to deal +# in the Software without restriction, including without limitation the rights +# to use, copy, modify, merge, publish, distribute, sublicense, and/or sell +# copies of the Software, and to permit persons to whom the Software is +# furnished to do so, subject to the following conditions: +# +# The above copyright notice and this permission notice shall be included in +# all copies or substantial portions of the Software. +# +# THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR +# IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY, +# FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL THE +# AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER +# LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM, +# OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN +# THE SOFTWARE. +# + +include(common NO_POLICY_SCOPE) +include(object_library) + +list(APPEND SOURCES + array_schema_evolution_api.cc +) +gather_sources(${SOURCES}) + +commence(object_library capi_array_schema_evolution_stub) + this_target_sources(${SOURCES}) + this_target_link_libraries(export) + this_target_object_libraries(array_schema capi_context_stub capi_attribute_stub capi_enumeration_stub capi_current_domain capi_buffer_stub) +conclude(object_library) + +# TODO: Add array schema evolution C API tests. +# add_test_subdirectory() diff --git a/tiledb/api/c_api/array_schema_evolution/array_schema_evolution_api.cc b/tiledb/api/c_api/array_schema_evolution/array_schema_evolution_api.cc new file mode 100644 index 00000000000..6b2a9545956 --- /dev/null +++ b/tiledb/api/c_api/array_schema_evolution/array_schema_evolution_api.cc @@ -0,0 +1,243 @@ +/** + * @file tiledb/api/c_api/array_schema_evolution/array_schema_evolution_api.cc + * + * @section LICENSE + * + * The MIT License + * + * @copyright Copyright (c) 2024 TileDB, Inc. + * + * Permission is hereby granted, free of charge, to any person obtaining a copy + * of this software and associated documentation files (the "Software"), to deal + * in the Software without restriction, including without limitation the rights + * to use, copy, modify, merge, publish, distribute, sublicense, and/or sell + * copies of the Software, and to permit persons to whom the Software is + * furnished to do so, subject to the following conditions: + * + * The above copyright notice and this permission notice shall be included in + * all copies or substantial portions of the Software. + * + * THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR + * IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY, + * FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL THE + * AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER + * LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM, + * OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN + * THE SOFTWARE. + * + * @section DESCRIPTION + * + * This file defines C API functions for the array schema evolution section. + */ + +#include "array_schema_evolution_api_experimental.h" +#include "array_schema_evolution_api_internal.h" + +#include "tiledb/api/c_api/attribute/attribute_api_internal.h" +#include "tiledb/api/c_api/buffer/buffer_api_internal.h" +#include "tiledb/api/c_api/current_domain/current_domain_api_internal.h" +#include "tiledb/api/c_api/enumeration/enumeration_api_internal.h" +#include "tiledb/api/c_api_support/c_api_support.h" +#include "tiledb/common/memory_tracker.h" +#include "tiledb/sm/c_api/api_argument_validator.h" +#include "tiledb/sm/serialization/array_schema_evolution.h" + +namespace tiledb::api { + +/* ********************************* */ +/* SCHEMA EVOLUTION */ +/* ********************************* */ + +capi_return_t tiledb_array_schema_evolution_alloc( + tiledb_ctx_t* ctx, + tiledb_array_schema_evolution_t** array_schema_evolution) { + ensure_output_pointer_is_valid(array_schema_evolution); + auto memory_tracker = ctx->resources().create_memory_tracker(); + memory_tracker->set_type(sm::MemoryTrackerType::SCHEMA_EVOLUTION); + *array_schema_evolution = + make_handle(memory_tracker); + return TILEDB_OK; +} + +void tiledb_array_schema_evolution_free( + tiledb_array_schema_evolution_t** array_schema_evolution) { + ensure_output_pointer_is_valid(array_schema_evolution); + ensure_handle_is_valid(*array_schema_evolution); + break_handle(*array_schema_evolution); +} + +int32_t tiledb_array_schema_evolution_add_attribute( + tiledb_array_schema_evolution_t* array_schema_evolution, + tiledb_attribute_t* attr) { + ensure_handle_is_valid(array_schema_evolution); + ensure_attribute_is_valid(attr); + array_schema_evolution->array_schema_evolution()->add_attribute( + attr->copy_attribute()); + + return TILEDB_OK; +} + +int32_t tiledb_array_schema_evolution_drop_attribute( + tiledb_array_schema_evolution_t* array_schema_evolution, + const char* attribute_name) { + ensure_handle_is_valid(array_schema_evolution); + + array_schema_evolution->array_schema_evolution()->drop_attribute( + attribute_name); + return TILEDB_OK; +} + +capi_return_t tiledb_array_schema_evolution_add_enumeration( + tiledb_array_schema_evolution_t* array_schema_evolution, + tiledb_enumeration_t* enumeration) { + ensure_handle_is_valid(array_schema_evolution); + ensure_enumeration_is_valid(enumeration); + + auto enmr = enumeration->copy(); + array_schema_evolution->array_schema_evolution()->add_enumeration(enmr); + + return TILEDB_OK; +} + +capi_return_t tiledb_array_schema_evolution_extend_enumeration( + tiledb_array_schema_evolution_t* array_schema_evolution, + tiledb_enumeration_t* enumeration) { + ensure_handle_is_valid(array_schema_evolution); + ensure_enumeration_is_valid(enumeration); + + auto enmr = enumeration->copy(); + array_schema_evolution->array_schema_evolution()->extend_enumeration(enmr); + + return TILEDB_OK; +} + +capi_return_t tiledb_array_schema_evolution_drop_enumeration( + tiledb_array_schema_evolution_t* array_schema_evolution, + const char* enmr_name) { + ensure_handle_is_valid(array_schema_evolution); + + if (enmr_name == nullptr) { + return TILEDB_ERR; + } + + array_schema_evolution->array_schema_evolution()->drop_enumeration(enmr_name); + + return TILEDB_OK; +} + +capi_return_t tiledb_array_schema_evolution_expand_current_domain( + tiledb_array_schema_evolution_t* array_schema_evolution, + tiledb_current_domain_t* expanded_domain) { + ensure_handle_is_valid(array_schema_evolution); + ensure_handle_is_valid(expanded_domain); + + array_schema_evolution->array_schema_evolution()->expand_current_domain( + expanded_domain->current_domain()); + + return TILEDB_OK; +} + +int32_t tiledb_array_schema_evolution_set_timestamp_range( + tiledb_array_schema_evolution_t* array_schema_evolution, + uint64_t lo, + uint64_t hi) { + ensure_handle_is_valid(array_schema_evolution); + + array_schema_evolution->array_schema_evolution()->set_timestamp_range( + {lo, hi}); + return TILEDB_OK; +} + +} // namespace tiledb::api + +using tiledb::api::api_entry_void; +using tiledb::api::api_entry_with_context; +template +constexpr auto api_entry = tiledb::api::api_entry_context; + +/* ********************************* */ +/* SCHEMA EVOLUTION */ +/* ********************************* */ + +CAPI_INTERFACE( + array_schema_evolution_alloc, + tiledb_ctx_t* ctx, + tiledb_array_schema_evolution_t** array_schema_evolution) { + return api_entry_with_context< + tiledb::api::tiledb_array_schema_evolution_alloc>( + ctx, array_schema_evolution); +} + +CAPI_INTERFACE_VOID( + array_schema_evolution_free, + tiledb_array_schema_evolution_t** array_schema_evolution) { + return api_entry_void( + array_schema_evolution); +} + +CAPI_INTERFACE( + array_schema_evolution_add_attribute, + tiledb_ctx_t* ctx, + tiledb_array_schema_evolution_t* array_schema_evolution, + tiledb_attribute_t* attr) { + return api_entry( + ctx, array_schema_evolution, attr); +} + +CAPI_INTERFACE( + array_schema_evolution_drop_attribute, + tiledb_ctx_t* ctx, + tiledb_array_schema_evolution_t* array_schema_evolution, + const char* attribute_name) { + return api_entry( + ctx, array_schema_evolution, attribute_name); +} + +CAPI_INTERFACE( + array_schema_evolution_add_enumeration, + tiledb_ctx_t* ctx, + tiledb_array_schema_evolution_t* array_schema_evolution, + tiledb_enumeration_t* enmr) { + return api_entry( + ctx, array_schema_evolution, enmr); +} + +CAPI_INTERFACE( + array_schema_evolution_extend_enumeration, + tiledb_ctx_t* ctx, + tiledb_array_schema_evolution_t* array_schema_evolution, + tiledb_enumeration_t* enmr) { + return api_entry< + tiledb::api::tiledb_array_schema_evolution_extend_enumeration>( + ctx, array_schema_evolution, enmr); +} + +CAPI_INTERFACE( + array_schema_evolution_drop_enumeration, + tiledb_ctx_t* ctx, + tiledb_array_schema_evolution_t* array_schema_evolution, + const char* enumeration_name) { + return api_entry( + ctx, array_schema_evolution, enumeration_name); +} + +CAPI_INTERFACE( + array_schema_evolution_expand_current_domain, + tiledb_ctx_t* ctx, + tiledb_array_schema_evolution_t* array_schema_evolution, + tiledb_current_domain_t* expanded_domain) { + return api_entry< + tiledb::api::tiledb_array_schema_evolution_expand_current_domain>( + ctx, array_schema_evolution, expanded_domain); +} + +CAPI_INTERFACE( + array_schema_evolution_set_timestamp_range, + tiledb_ctx_t* ctx, + tiledb_array_schema_evolution_t* array_schema_evolution, + uint64_t lo, + uint64_t hi) { + return api_entry< + tiledb::api::tiledb_array_schema_evolution_set_timestamp_range>( + ctx, array_schema_evolution, lo, hi); +} diff --git a/tiledb/api/c_api/array_schema_evolution/array_schema_evolution_api_experimental.h b/tiledb/api/c_api/array_schema_evolution/array_schema_evolution_api_experimental.h index 7a301a5d672..7c833b7deee 100644 --- a/tiledb/api/c_api/array_schema_evolution/array_schema_evolution_api_experimental.h +++ b/tiledb/api/c_api/array_schema_evolution/array_schema_evolution_api_experimental.h @@ -1,5 +1,6 @@ /** - * @file tiledb/api/c_api/array_schema/array_schema_evolution_api_experimental.h + * @file + * tiledb/api/c_api/array_schema_evolution/array_schema_evolution_api_experimental.h * * @section LICENSE * @@ -35,6 +36,10 @@ #define TILEDB_CAPI_ARRAY_SCHEMA_EVOLUTION_EXPERIMENTAL_H #include "../api_external_common.h" +#include "../attribute/attribute_api_external.h" +#include "../context/context_api_external.h" +#include "../current_domain/current_domain_api_external_experimental.h" +#include "../enumeration/enumeration_api_experimental.h" #ifdef __cplusplus extern "C" { @@ -43,6 +48,240 @@ extern "C" { /** C API carrier for a TileDB array schema evolution */ typedef struct tiledb_array_schema_evolution_t tiledb_array_schema_evolution_t; +/** + * Creates a TileDB schema evolution object. + * + * **Example:** + * + * @code{.c} + * tiledb_array_schema_evolution_t* array_schema_evolution; + * tiledb_array_schema_evolution_alloc(ctx, &array_schema_evolution); + * @endcode + * + * @param ctx The TileDB context. + * @param array_schema_evolution The TileDB schema evolution to be created. + * @return `TILEDB_OK` for success and `TILEDB_OOM` or `TILEDB_ERR` for error. + */ +TILEDB_EXPORT int32_t tiledb_array_schema_evolution_alloc( + tiledb_ctx_t* ctx, + tiledb_array_schema_evolution_t** array_schema_evolution) TILEDB_NOEXCEPT; + +/** + * Destroys an array schema evolution, freeing associated memory. + * + * **Example:** + * + * @code{.c} + * tiledb_array_schema_evolution_free(&array_schema_evolution); + * @endcode + * + * @param array_schema_evolution The array schema evolution to be destroyed. + */ +TILEDB_EXPORT void tiledb_array_schema_evolution_free( + tiledb_array_schema_evolution_t** array_schema_evolution) TILEDB_NOEXCEPT; + +/** + * Adds an attribute to an array schema evolution. + * + * **Example:** + * + * @code{.c} + * tiledb_attribute_t* attr; + * tiledb_attribute_alloc(ctx, "my_attr", TILEDB_INT32, &attr); + * tiledb_array_schema_evolution_add_attribute(ctx, array_schema_evolution, + * attr); + * @endcode + * + * @param[in] ctx The TileDB context. + * @param[in] array_schema_evolution The schema evolution. + * @param[in] attribute The attribute to be added. + * @return `TILEDB_OK` for success and `TILEDB_ERR` for error. + */ +TILEDB_EXPORT int32_t tiledb_array_schema_evolution_add_attribute( + tiledb_ctx_t* ctx, + tiledb_array_schema_evolution_t* array_schema_evolution, + tiledb_attribute_t* attribute) TILEDB_NOEXCEPT; + +/** + * Drops an attribute to an array schema evolution. + * + * **Example:** + * + * @code{.c} + * const char* attribute_name="a1"; + * tiledb_array_schema_evolution_drop_attribute(ctx, array_schema_evolution, + * attribute_name); + * @endcode + * + * @param ctx The TileDB context. + * @param array_schema_evolution The schema evolution. + * @param attribute_name The name of the attribute to be dropped. + * @return `TILEDB_OK` for success and `TILEDB_ERR` for error. + */ +TILEDB_EXPORT int32_t tiledb_array_schema_evolution_drop_attribute( + tiledb_ctx_t* ctx, + tiledb_array_schema_evolution_t* array_schema_evolution, + const char* attribute_name) TILEDB_NOEXCEPT; + +/** + * Adds an enumeration to an array schema evolution. + * + * **Example:** + * + * @code{.c} + * tiledb_enumeration_t* enmr; + * void* data = get_data(); + * uint64_t data_size = get_data_size(); + * tiledb_enumeration_alloc( + * ctx, + * TILEDB_INT64, + * cell_val_num, + * FALSE, + * data, + * data_size, + * nullptr, + * 0, + * &enumeration); + * tiledb_array_schema_evolution_add_enumeration(ctx, array_schema_evolution, + * enmr); + * @endcode + * + * @param ctx The TileDB context. + * @param array_schema_evolution The schema evolution. + * @param enumeration The enumeration to be added. + * @return `TILEDB_OK` for success and `TILEDB_ERR` for error. + */ +TILEDB_EXPORT capi_return_t tiledb_array_schema_evolution_add_enumeration( + tiledb_ctx_t* ctx, + tiledb_array_schema_evolution_t* array_schema_evolution, + tiledb_enumeration_t* enumeration) TILEDB_NOEXCEPT; + +/** + * Extends an enumeration during array schema evolution. + * + * **Example:** + * + * @code{.c} + * tiledb_enumeration_t* original_enmr = get_existing_enumeration(); + * const void* data = get_new_data(); + * uint64_t data_size = get_new_data_size(); + * tiledb_enumeration_t* new_enmr; + * tiledb_enumeration_extend( + * ctx, + * original_enmr, + * data, + * data_size, + * nullptr, + * 0, + * &new_enmr); + * tiledb_array_schema_evolution_extend_enumeration( + * ctx, + * array_schema_evolution, + * new_enmr); + * @endcode + * + * @param ctx The TileDB context. + * @param array_schema_evolution The schema evolution. + * @param enumeration The enumeration to be extended. This should be the result + * of a call to tiledb_enumeration_extend. + * @return `TILEDB_OK` for success and `TILEDB_ERR` for error. + */ +TILEDB_EXPORT capi_return_t tiledb_array_schema_evolution_extend_enumeration( + tiledb_ctx_t* ctx, + tiledb_array_schema_evolution_t* array_schema_evolution, + tiledb_enumeration_t* enumeration) TILEDB_NOEXCEPT; + +/** + * Drops an enumeration from an array schema evolution. + * + * **Example:** + * + * @code{.c} + * const char* enumeration_name = "enumeration_1"; + * tiledb_array_schema_evolution_drop_enumeration(ctx, array_schema_evolution, + * enumeration_name); + * @endcode + * + * @param ctx The TileDB context. + * @param array_schema_evolution The schema evolution. + * @param enumeration_name The name of the enumeration to be dropped. + * @return `TILEDB_OK` for success and `TILEDB_ERR` for error. + */ +TILEDB_EXPORT capi_return_t tiledb_array_schema_evolution_drop_enumeration( + tiledb_ctx_t* ctx, + tiledb_array_schema_evolution_t* array_schema_evolution, + const char* enumeration_name) TILEDB_NOEXCEPT; + +/** + * Sets timestamp range in an array schema evolution + * This function sets the output timestamp of the committed array schema after + * evolution. The lo and hi values are currently required to be the same or else + * an error is thrown. + * + * **Example:** + * + * @code{.c} + * uint64_t timestamp = tiledb_timestamp_now_ms(); + * tiledb_array_schema_evolution_set_timestamp_range(ctx, + * array_schema_evolution, timestamp, timestamp); + * @endcode + * + * @param ctx The TileDB context. + * @param array_schema_evolution The schema evolution. + * @param lo The lower bound of timestamp range. + * @param hi The upper bound of timestamp range, it must euqal to the lower + * bound. + * @return `TILEDB_OK` for success and `TILEDB_ERR` for error. + */ +TILEDB_EXPORT int32_t tiledb_array_schema_evolution_set_timestamp_range( + tiledb_ctx_t* ctx, + tiledb_array_schema_evolution_t* array_schema_evolution, + uint64_t lo, + uint64_t hi) TILEDB_NOEXCEPT; + +/** + * Expands the current domain during array schema evolution. + * TileDB will enforce that the new current domain is expanding + * on the current one and not contracting during `tiledb_array_evolve`. + * + * **Example:** + * + * @code{.c} + * tiledb_current_domain_t *new_domain; + * tiledb_current_domain_create(ctx, &new_domain); + * tiledb_ndrectangle_t *ndr; + * tiledb_ndrectangle_alloc(ctx, domain, &ndr); + * + * tiledb_range_t range; + * range.min = &expanded_min; + * range.min_size = sizeof(expanded_min); + * range.max = &expanded_max; + * range.max_size = sizeof(expanded_max); + * tiledb_ndrectangle_set_range_for_name(ctx, ndr, "dim1", &range); + * tiledb_ndrectangle_set_range_for_name(ctx, ndr, "dim2", &range); + * + * tiledb_current_domain_set_ndrectangle(new_domain, ndr); + * + * tiledb_array_schema_evolution_expand_current_domain(ctx, + * array_schema_evolution, new_domain); + * + * tiledb_array_evolve(ctx, array_uri, array_schema_evolution); + * + * tiledb_ndrectangle_free(&ndr); + * tiledb_current_domain_free(&new_domain); + * + * @endcode + * + * @param ctx The TileDB context. + * @param array_schema_evolution The schema evolution. + * @param expanded_domain The current domain we want to expand the schema to. + * @return `TILEDB_OK` for success and `TILEDB_ERR` for error. + */ +TILEDB_EXPORT capi_return_t tiledb_array_schema_evolution_expand_current_domain( + tiledb_ctx_t* ctx, + tiledb_array_schema_evolution_t* array_schema_evolution, + tiledb_current_domain_t* expanded_domain) TILEDB_NOEXCEPT; + #ifdef __cplusplus } #endif diff --git a/tiledb/api/c_api/array_schema_evolution/array_schema_evolution_api_internal.h b/tiledb/api/c_api/array_schema_evolution/array_schema_evolution_api_internal.h index b7ec8a6c958..2697d48fce3 100644 --- a/tiledb/api/c_api/array_schema_evolution/array_schema_evolution_api_internal.h +++ b/tiledb/api/c_api/array_schema_evolution/array_schema_evolution_api_internal.h @@ -37,43 +37,35 @@ #include "array_schema_evolution_api_experimental.h" -#include "tiledb/api/c_api/context/context_api_internal.h" +#include "tiledb/api/c_api_support/handle/handle.h" #include "tiledb/common/common.h" #include "tiledb/sm/array_schema/array_schema_evolution.h" /** Handle `struct` for API array schema evolution objects. */ -struct tiledb_array_schema_evolution_t { - tiledb::sm::ArraySchemaEvolution* array_schema_evolution_ = nullptr; -}; +struct tiledb_array_schema_evolution_t : public tiledb::api::CAPIHandle { + /** Type name */ + static constexpr std::string_view object_type_name{"array_schema_evolution"}; -namespace tiledb::api { + private: + shared_ptr array_schema_evolution_; -inline int32_t sanity_check( - tiledb_ctx_t* ctx, - const tiledb_array_schema_evolution_t* schema_evolution) { - if (schema_evolution == nullptr || - schema_evolution->array_schema_evolution_ == nullptr) { - auto st = Status_Error("Invalid TileDB array schema evolution object"); - LOG_STATUS_NO_RETURN_VALUE(st); - save_error(ctx, st); - return TILEDB_ERR; + public: + explicit tiledb_array_schema_evolution_t( + shared_ptr memory_tracker) + : array_schema_evolution_( + make_shared( + HERE(), memory_tracker)) { } - return TILEDB_OK; -} -/** - * Returns after successfully validating an array schema evolution. - * - * @param schema_evolution Possibly-valid pointer to an array schema evolution - */ -inline void ensure_array_schema_evolution_is_valid( - const tiledb_array_schema_evolution_t* schema_evolution) { - if (schema_evolution == nullptr || - schema_evolution->array_schema_evolution_ == nullptr) { - throw CAPIException("Invalid TileDB array schema evolution object"); + explicit tiledb_array_schema_evolution_t( + shared_ptr ase) + : array_schema_evolution_(ase) { } -} -} // namespace tiledb::api + [[nodiscard]] shared_ptr + array_schema_evolution() const { + return array_schema_evolution_; + } +}; #endif // TILEDB_CAPI_ARRAY_SCHEMA_EVOLUTION_INTERNAL_H diff --git a/tiledb/api/c_api/attribute/test/compile_capi_attribute_stub_main.cc b/tiledb/api/c_api/attribute/test/compile_capi_attribute_stub_main.cc deleted file mode 100644 index 1b1deaf0a99..00000000000 --- a/tiledb/api/c_api/attribute/test/compile_capi_attribute_stub_main.cc +++ /dev/null @@ -1,49 +0,0 @@ -/** - * @file tiledb/api/c_api/attribute/test/compile_capi_attribute_stub_main.cc - * - * @section LICENSE - * - * The MIT License - * - * @copyright Copyright (c) 2023 TileDB, Inc. - * - * Permission is hereby granted, free of charge, to any person obtaining a copy - * of this software and associated documentation files (the "Software"), to deal - * in the Software without restriction, including without limitation the rights - * to use, copy, modify, merge, publish, distribute, sublicense, and/or sell - * copies of the Software, and to permit persons to whom the Software is - * furnished to do so, subject to the following conditions: - * - * The above copyright notice and this permission notice shall be included in - * all copies or substantial portions of the Software. - * - * THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR - * IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY, - * FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL THE - * AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER - * LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM, - * OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN - * THE SOFTWARE. - */ - -#include -#include "../attribute_api_internal.h" - -/* - * We're using an argument to a function and a call to a member function to - * ensure linkage. - */ -void validate_nullable(tiledb_attribute_handle_t* attr) { - if (!attr) { - throw std::runtime_error("nope"); - } - auto n{attr->nullable()}; - if (n != 0 && n != 1) { - throw std::runtime_error("attribute has nullable value neither 0 nor 1"); - } -} - -int main() { - validate_nullable(nullptr); - return 0; -} diff --git a/tiledb/api/c_api/buffer/test/compile_capi_buffer_stub_main.cc b/tiledb/api/c_api/buffer/test/compile_capi_buffer_stub_main.cc deleted file mode 100644 index 78223932a5d..00000000000 --- a/tiledb/api/c_api/buffer/test/compile_capi_buffer_stub_main.cc +++ /dev/null @@ -1,35 +0,0 @@ -/** - * @file tiledb/api/c_api/buffer/test/compile_capi_buffer_main.cc - * - * @section LICENSE - * - * The MIT License - * - * @copyright Copyright (c) 2022 TileDB, Inc. - * - * Permission is hereby granted, free of charge, to any person obtaining a copy - * of this software and associated documentation files (the "Software"), to deal - * in the Software without restriction, including without limitation the rights - * to use, copy, modify, merge, publish, distribute, sublicense, and/or sell - * copies of the Software, and to permit persons to whom the Software is - * furnished to do so, subject to the following conditions: - * - * The above copyright notice and this permission notice shall be included in - * all copies or substantial portions of the Software. - * - * THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR - * IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY, - * FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL THE - * AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER - * LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM, - * OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN - * THE SOFTWARE. - */ - -#include "../buffer_api_external.h" - -int main() { - tiledb_buffer_t* buf = nullptr; - tiledb_buffer_alloc(nullptr, &buf); - return 0; -} diff --git a/tiledb/api/c_api/buffer_list/test/compile_capi_buffer_list_stub_main.cc b/tiledb/api/c_api/buffer_list/test/compile_capi_buffer_list_stub_main.cc deleted file mode 100644 index d4b5ea52889..00000000000 --- a/tiledb/api/c_api/buffer_list/test/compile_capi_buffer_list_stub_main.cc +++ /dev/null @@ -1,35 +0,0 @@ -/** - * @file tiledb/api/c_api/buffer_list/test/compile_capi_buffer_list_main.cc - * - * @section LICENSE - * - * The MIT License - * - * @copyright Copyright (c) 2023 TileDB, Inc. - * - * Permission is hereby granted, free of charge, to any person obtaining a copy - * of this software and associated documentation files (the "Software"), to deal - * in the Software without restriction, including without limitation the rights - * to use, copy, modify, merge, publish, distribute, sublicense, and/or sell - * copies of the Software, and to permit persons to whom the Software is - * furnished to do so, subject to the following conditions: - * - * The above copyright notice and this permission notice shall be included in - * all copies or substantial portions of the Software. - * - * THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR - * IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY, - * FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL THE - * AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER - * LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM, - * OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN - * THE SOFTWARE. - */ - -#include "../buffer_list_api_external.h" - -int main() { - tiledb_buffer_list_t* buffer_list = nullptr; - tiledb_buffer_list_alloc(nullptr, &buffer_list); - return 0; -} diff --git a/tiledb/api/c_api/config/test/compile_capi_config_stub_main.cc b/tiledb/api/c_api/config/test/compile_capi_config_stub_main.cc deleted file mode 100644 index 156bd44ea3f..00000000000 --- a/tiledb/api/c_api/config/test/compile_capi_config_stub_main.cc +++ /dev/null @@ -1,34 +0,0 @@ -/** - * @file tiledb/api/c_api/config/test/compile_capi_config_main.cc - * - * @section LICENSE - * - * The MIT License - * - * @copyright Copyright (c) 2022 TileDB, Inc. - * - * Permission is hereby granted, free of charge, to any person obtaining a copy - * of this software and associated documentation files (the "Software"), to deal - * in the Software without restriction, including without limitation the rights - * to use, copy, modify, merge, publish, distribute, sublicense, and/or sell - * copies of the Software, and to permit persons to whom the Software is - * furnished to do so, subject to the following conditions: - * - * The above copyright notice and this permission notice shall be included in - * all copies or substantial portions of the Software. - * - * THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR - * IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY, - * FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL THE - * AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER - * LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM, - * OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN - * THE SOFTWARE. - */ - -#include "../config_api_internal.h" - -int main() { - (void)sizeof(tiledb_config_handle_t); - return 0; -} diff --git a/tiledb/api/c_api/context/test/compile_capi_context_stub_main.cc b/tiledb/api/c_api/context/test/compile_capi_context_stub_main.cc deleted file mode 100644 index 4322ee15eee..00000000000 --- a/tiledb/api/c_api/context/test/compile_capi_context_stub_main.cc +++ /dev/null @@ -1,34 +0,0 @@ -/** - * @file tiledb/api/c_api/context/test/compile_capi_context_main.cc - * - * @section LICENSE - * - * The MIT License - * - * @copyright Copyright (c) 2022 TileDB, Inc. - * - * Permission is hereby granted, free of charge, to any person obtaining a copy - * of this software and associated documentation files (the "Software"), to deal - * in the Software without restriction, including without limitation the rights - * to use, copy, modify, merge, publish, distribute, sublicense, and/or sell - * copies of the Software, and to permit persons to whom the Software is - * furnished to do so, subject to the following conditions: - * - * The above copyright notice and this permission notice shall be included in - * all copies or substantial portions of the Software. - * - * THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR - * IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY, - * FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL THE - * AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER - * LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM, - * OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN - * THE SOFTWARE. - */ - -#include "../context_api_internal.h" - -int main() { - (void)sizeof(tiledb_ctx_handle_t); - return 0; -} diff --git a/tiledb/api/c_api/current_domain/test/compile_capi_current_domain_main.cc b/tiledb/api/c_api/current_domain/test/compile_capi_current_domain_main.cc deleted file mode 100644 index 49780995b2c..00000000000 --- a/tiledb/api/c_api/current_domain/test/compile_capi_current_domain_main.cc +++ /dev/null @@ -1,41 +0,0 @@ -/** - * @file - * tiledb/api/c_api/current_domain/test/compile_capi_current_domain_main.cc - * - * @section LICENSE - * - * The MIT License - * - * @copyright Copyright (c) 2024 TileDB, Inc. - * - * Permission is hereby granted, free of charge, to any person obtaining a copy - * of this software and associated documentation files (the "Software"), to deal - * in the Software without restriction, including without limitation the rights - * to use, copy, modify, merge, publish, distribute, sublicense, and/or sell - * copies of the Software, and to permit persons to whom the Software is - * furnished to do so, subject to the following conditions: - * - * The above copyright notice and this permission notice shall be included in - * all copies or substantial portions of the Software. - * - * THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR - * IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY, - * FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL THE - * AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER - * LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM, - * OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN - * THE SOFTWARE. - */ - -#include "../current_domain_api_external_experimental.h" - -int main() { - tiledb_current_domain_create(nullptr, nullptr); - tiledb_current_domain_free(nullptr); - tiledb_current_domain_set_ndrectangle(nullptr, nullptr, nullptr); - tiledb_current_domain_get_ndrectangle(nullptr, nullptr, nullptr); - tiledb_current_domain_get_is_empty(nullptr, nullptr, nullptr); - tiledb_current_domain_get_type(nullptr, nullptr, nullptr); - - return 0; -} diff --git a/tiledb/api/c_api/data_order/test/compile_capi_data_order_main.cc b/tiledb/api/c_api/data_order/test/compile_capi_data_order_main.cc deleted file mode 100644 index 70207ed50cf..00000000000 --- a/tiledb/api/c_api/data_order/test/compile_capi_data_order_main.cc +++ /dev/null @@ -1,34 +0,0 @@ -/** - * @file tiledb/api/c_api/data_order/test/compile_capi_data_order_main.cc - * - * @section LICENSE - * - * The MIT License - * - * @copyright Copyright (c) 2023 TileDB, Inc. - * - * Permission is hereby granted, free of charge, to any person obtaining a copy - * of this software and associated documentation files (the "Software"), to deal - * in the Software without restriction, including without limitation the rights - * to use, copy, modify, merge, publish, distribute, sublicense, and/or sell - * copies of the Software, and to permit persons to whom the Software is - * furnished to do so, subject to the following conditions: - * - * The above copyright notice and this permission notice shall be included in - * all copies or substantial portions of the Software. - * - * THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR - * IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY, - * FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL THE - * AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER - * LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM, - * OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN - * THE SOFTWARE. - */ - -#include "../data_order_api_external.h" - -int main() { - tiledb_data_order_to_str(TILEDB_UNORDERED_DATA, nullptr); - return 0; -} diff --git a/tiledb/api/c_api/datatype/test/compile_capi_datatype_main.cc b/tiledb/api/c_api/datatype/test/compile_capi_datatype_main.cc deleted file mode 100644 index f340a0f197d..00000000000 --- a/tiledb/api/c_api/datatype/test/compile_capi_datatype_main.cc +++ /dev/null @@ -1,34 +0,0 @@ -/** - * @file tiledb/api/c_api/datatype/test/compile_capi_datatype_main.cc - * - * @section LICENSE - * - * The MIT License - * - * @copyright Copyright (c) 2022 TileDB, Inc. - * - * Permission is hereby granted, free of charge, to any person obtaining a copy - * of this software and associated documentation files (the "Software"), to deal - * in the Software without restriction, including without limitation the rights - * to use, copy, modify, merge, publish, distribute, sublicense, and/or sell - * copies of the Software, and to permit persons to whom the Software is - * furnished to do so, subject to the following conditions: - * - * The above copyright notice and this permission notice shall be included in - * all copies or substantial portions of the Software. - * - * THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR - * IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY, - * FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL THE - * AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER - * LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM, - * OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN - * THE SOFTWARE. - */ - -#include "../datatype_api_external.h" - -int main() { - tiledb_datatype_to_str(TILEDB_INT32, nullptr); - return 0; -} diff --git a/tiledb/api/c_api/dimension/test/compile_capi_dimension_stub_main.cc b/tiledb/api/c_api/dimension/test/compile_capi_dimension_stub_main.cc deleted file mode 100644 index d106ef1a5b1..00000000000 --- a/tiledb/api/c_api/dimension/test/compile_capi_dimension_stub_main.cc +++ /dev/null @@ -1,35 +0,0 @@ -/** - * @file tiledb/api/c_api/dimension/test/compile_capi_dimension_main.cc - * - * @section LICENSE - * - * The MIT License - * - * @copyright Copyright (c) 2023 TileDB, Inc. - * - * Permission is hereby granted, free of charge, to any person obtaining a copy - * of this software and associated documentation files (the "Software"), to deal - * in the Software without restriction, including without limitation the rights - * to use, copy, modify, merge, publish, distribute, sublicense, and/or sell - * copies of the Software, and to permit persons to whom the Software is - * furnished to do so, subject to the following conditions: - * - * The above copyright notice and this permission notice shall be included in - * all copies or substantial portions of the Software. - * - * THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR - * IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY, - * FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL THE - * AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER - * LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM, - * OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN - * THE SOFTWARE. - */ - -#include "../dimension_api_internal.h" - -int main() { - std::string name("foo"); - tiledb_dimension_handle_t x{name, tiledb::sm::Datatype::UINT32, nullptr}; - return 0; -} diff --git a/tiledb/api/c_api/dimension_label/test/compile_capi_dimension_label_stub_main.cc b/tiledb/api/c_api/dimension_label/test/compile_capi_dimension_label_stub_main.cc deleted file mode 100644 index f82c1434e36..00000000000 --- a/tiledb/api/c_api/dimension_label/test/compile_capi_dimension_label_stub_main.cc +++ /dev/null @@ -1,36 +0,0 @@ -/** - * @file - * tiledb/api/c_api/dimension_label/test/compile_capi_dimension_label_main.cc - * - * @section LICENSE - * - * The MIT License - * - * @copyright Copyright (c) 2023 TileDB, Inc. - * - * Permission is hereby granted, free of charge, to any person obtaining a copy - * of this software and associated documentation files (the "Software"), to deal - * in the Software without restriction, including without limitation the rights - * to use, copy, modify, merge, publish, distribute, sublicense, and/or sell - * copies of the Software, and to permit persons to whom the Software is - * furnished to do so, subject to the following conditions: - * - * The above copyright notice and this permission notice shall be included in - * all copies or substantial portions of the Software. - * - * THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR - * IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY, - * FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL THE - * AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER - * LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM, - * OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN - * THE SOFTWARE. - */ - -#include "../dimension_label_api_internal.h" - -int main() { - // any function will drag in the whole library - tiledb::api::ensure_dimension_label_is_valid(nullptr); - return 0; -} diff --git a/tiledb/api/c_api/domain/test/compile_capi_domain_stub_main.cc b/tiledb/api/c_api/domain/test/compile_capi_domain_stub_main.cc deleted file mode 100644 index 6b6a726109e..00000000000 --- a/tiledb/api/c_api/domain/test/compile_capi_domain_stub_main.cc +++ /dev/null @@ -1,34 +0,0 @@ -/** - * @file tiledb/api/c_api/domain/test/compile_capi_domain_stub_main.cc - * - * @section LICENSE - * - * The MIT License - * - * @copyright Copyright (c) 2023 TileDB, Inc. - * - * Permission is hereby granted, free of charge, to any person obtaining a copy - * of this software and associated documentation files (the "Software"), to deal - * in the Software without restriction, including without limitation the rights - * to use, copy, modify, merge, publish, distribute, sublicense, and/or sell - * copies of the Software, and to permit persons to whom the Software is - * furnished to do so, subject to the following conditions: - * - * The above copyright notice and this permission notice shall be included in - * all copies or substantial portions of the Software. - * - * THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR - * IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY, - * FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL THE - * AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER - * LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM, - * OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN - * THE SOFTWARE. - */ - -#include "../domain_api_internal.h" - -int main() { - tiledb_domain_handle_t x{shared_ptr()}; - return 0; -} diff --git a/tiledb/api/c_api/enumeration/test/compile_capi_enumeration_stub_main.cc b/tiledb/api/c_api/enumeration/test/compile_capi_enumeration_stub_main.cc deleted file mode 100644 index d06771a9343..00000000000 --- a/tiledb/api/c_api/enumeration/test/compile_capi_enumeration_stub_main.cc +++ /dev/null @@ -1,47 +0,0 @@ -/** - * @file tiledb/api/c_api/enumeration/test/compile_capi_enumeration_stub_main.cc - * - * @section LICENSE - * - * The MIT License - * - * @copyright Copyright (c) 2023 TileDB, Inc. - * - * Permission is hereby granted, free of charge, to any person obtaining a copy - * of this software and associated documentation files (the "Software"), to deal - * in the Software without restriction, including without limitation the rights - * to use, copy, modify, merge, publish, distribute, sublicense, and/or sell - * copies of the Software, and to permit persons to whom the Software is - * furnished to do so, subject to the following conditions: - * - * The above copyright notice and this permission notice shall be included in - * all copies or substantial portions of the Software. - * - * THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR - * IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY, - * FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL THE - * AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER - * LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM, - * OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN - * THE SOFTWARE. - */ - -#include "../enumeration_api_internal.h" -#include "tiledb/sm/enums/datatype.h" - -int main() { - try { - tiledb_enumeration_handle_t e{ - "fooo", - tiledb::sm::Datatype::INT32, - 1, - 0, - nullptr, - 0, - nullptr, - 0, - nullptr}; - } catch (...) { - } - return 0; -} diff --git a/tiledb/api/c_api/error/test/compile_capi_error_main.cc b/tiledb/api/c_api/error/test/compile_capi_error_main.cc deleted file mode 100644 index ce456437964..00000000000 --- a/tiledb/api/c_api/error/test/compile_capi_error_main.cc +++ /dev/null @@ -1,34 +0,0 @@ -/** - * @file tiledb/api/c_api/error/test/compile_capi_error_main.cc - * - * @section LICENSE - * - * The MIT License - * - * @copyright Copyright (c) 2022 TileDB, Inc. - * - * Permission is hereby granted, free of charge, to any person obtaining a copy - * of this software and associated documentation files (the "Software"), to deal - * in the Software without restriction, including without limitation the rights - * to use, copy, modify, merge, publish, distribute, sublicense, and/or sell - * copies of the Software, and to permit persons to whom the Software is - * furnished to do so, subject to the following conditions: - * - * The above copyright notice and this permission notice shall be included in - * all copies or substantial portions of the Software. - * - * THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR - * IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY, - * FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL THE - * AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER - * LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM, - * OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN - * THE SOFTWARE. - */ - -#include "../error_api_internal.h" - -int main() { - (void)sizeof(tiledb_error_handle_t); - return 0; -} diff --git a/tiledb/api/c_api/filesystem/test/compile_capi_filesystem_main.cc b/tiledb/api/c_api/filesystem/test/compile_capi_filesystem_main.cc deleted file mode 100644 index af2cc72032c..00000000000 --- a/tiledb/api/c_api/filesystem/test/compile_capi_filesystem_main.cc +++ /dev/null @@ -1,34 +0,0 @@ -/** - * @file tiledb/api/c_api/filesystem/test/compile_capi_filesystem_main.cc - * - * @section LICENSE - * - * The MIT License - * - * @copyright Copyright (c) 2022 TileDB, Inc. - * - * Permission is hereby granted, free of charge, to any person obtaining a copy - * of this software and associated documentation files (the "Software"), to deal - * in the Software without restriction, including without limitation the rights - * to use, copy, modify, merge, publish, distribute, sublicense, and/or sell - * copies of the Software, and to permit persons to whom the Software is - * furnished to do so, subject to the following conditions: - * - * The above copyright notice and this permission notice shall be included in - * all copies or substantial portions of the Software. - * - * THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR - * IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY, - * FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL THE - * AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER - * LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM, - * OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN - * THE SOFTWARE. - */ - -#include "../filesystem_api_external.h" - -int main() { - tiledb_filesystem_to_str(TILEDB_MEMFS, nullptr); - return 0; -} diff --git a/tiledb/api/c_api/filter/test/compile_capi_filter_stub_main.cc b/tiledb/api/c_api/filter/test/compile_capi_filter_stub_main.cc deleted file mode 100644 index e59b6d233a5..00000000000 --- a/tiledb/api/c_api/filter/test/compile_capi_filter_stub_main.cc +++ /dev/null @@ -1,34 +0,0 @@ -/** - * @file tiledb/api/c_api/filter/test/compile_capi_filter_main.cc - * - * @section LICENSE - * - * The MIT License - * - * @copyright Copyright (c) 2022 TileDB, Inc. - * - * Permission is hereby granted, free of charge, to any person obtaining a copy - * of this software and associated documentation files (the "Software"), to deal - * in the Software without restriction, including without limitation the rights - * to use, copy, modify, merge, publish, distribute, sublicense, and/or sell - * copies of the Software, and to permit persons to whom the Software is - * furnished to do so, subject to the following conditions: - * - * The above copyright notice and this permission notice shall be included in - * all copies or substantial portions of the Software. - * - * THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR - * IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY, - * FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL THE - * AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER - * LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM, - * OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN - * THE SOFTWARE. - */ - -#include "../filter_api_external.h" - -int main() { - tiledb_filter_free(nullptr); - return 0; -} diff --git a/tiledb/api/c_api/filter_list/test/compile_capi_filter_list_stub_main.cc b/tiledb/api/c_api/filter_list/test/compile_capi_filter_list_stub_main.cc deleted file mode 100644 index e61a564ace1..00000000000 --- a/tiledb/api/c_api/filter_list/test/compile_capi_filter_list_stub_main.cc +++ /dev/null @@ -1,34 +0,0 @@ -/** - * @file tiledb/api/c_api/filter/test/compile_capi_filter_main.cc - * - * @section LICENSE - * - * The MIT License - * - * @copyright Copyright (c) 2022 TileDB, Inc. - * - * Permission is hereby granted, free of charge, to any person obtaining a copy - * of this software and associated documentation files (the "Software"), to deal - * in the Software without restriction, including without limitation the rights - * to use, copy, modify, merge, publish, distribute, sublicense, and/or sell - * copies of the Software, and to permit persons to whom the Software is - * furnished to do so, subject to the following conditions: - * - * The above copyright notice and this permission notice shall be included in - * all copies or substantial portions of the Software. - * - * THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR - * IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY, - * FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL THE - * AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER - * LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM, - * OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN - * THE SOFTWARE. - */ - -#include "../filter_list_api_internal.h" - -int main() { - (void)sizeof(tiledb_filter_list_handle_t); - return 0; -} diff --git a/tiledb/api/c_api/fragment_info/test/compile_capi_fragment_info_stub_main.cc b/tiledb/api/c_api/fragment_info/test/compile_capi_fragment_info_stub_main.cc deleted file mode 100644 index 56068031f71..00000000000 --- a/tiledb/api/c_api/fragment_info/test/compile_capi_fragment_info_stub_main.cc +++ /dev/null @@ -1,35 +0,0 @@ -/** - * @file - * tiledb/api/c_api/fragment_info/test/compile_capi_fragment_info_stub_main.cc - * - * @section LICENSE - * - * The MIT License - * - * @copyright Copyright (c) 2024 TileDB, Inc. - * - * Permission is hereby granted, free of charge, to any person obtaining a copy - * of this software and associated documentation files (the "Software"), to deal - * in the Software without restriction, including without limitation the rights - * to use, copy, modify, merge, publish, distribute, sublicense, and/or sell - * copies of the Software, and to permit persons to whom the Software is - * furnished to do so, subject to the following conditions: - * - * The above copyright notice and this permission notice shall be included in - * all copies or substantial portions of the Software. - * - * THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR - * IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY, - * FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL THE - * AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER - * LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM, - * OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN - * THE SOFTWARE. - */ - -#include "../fragment_info_api_external.h" - -int main() { - tiledb_fragment_info_load(nullptr, nullptr); - return 0; -} diff --git a/tiledb/api/c_api/group/CMakeLists.txt b/tiledb/api/c_api/group/CMakeLists.txt index 23b78ebd97c..097be8c0891 100644 --- a/tiledb/api/c_api/group/CMakeLists.txt +++ b/tiledb/api/c_api/group/CMakeLists.txt @@ -25,6 +25,7 @@ # include(common NO_POLICY_SCOPE) +include(object_library) list(APPEND SOURCES group_api.cc @@ -34,9 +35,8 @@ gather_sources(${SOURCES}) # # Object library for other units to depend upon # -# Maturity Note: We can't make a proper group unit library until we've -# removed its dependence on StorageManager. -# -add_library(capi_group OBJECT EXCLUDE_FROM_ALL ${SOURCES}) -target_link_libraries(capi_group PUBLIC export) -target_link_libraries(capi_group PUBLIC baseline $) +commence(object_library capi_group) + this_target_sources(${SOURCES}) + this_target_link_libraries(export) + this_target_object_libraries(baseline) +conclude(object_library) diff --git a/tiledb/api/c_api/group/test/compile_capi_group_main.cc b/tiledb/api/c_api/group/test/compile_capi_group_main.cc deleted file mode 100644 index cce021eeea7..00000000000 --- a/tiledb/api/c_api/group/test/compile_capi_group_main.cc +++ /dev/null @@ -1,34 +0,0 @@ -/** - * @file tiledb/api/c_api/group/test/compile_capi_group_main.cc - * - * @section LICENSE - * - * The MIT License - * - * @copyright Copyright (c) 2022 TileDB, Inc. - * - * Permission is hereby granted, free of charge, to any person obtaining a copy - * of this software and associated documentation files (the "Software"), to deal - * in the Software without restriction, including without limitation the rights - * to use, copy, modify, merge, publish, distribute, sublicense, and/or sell - * copies of the Software, and to permit persons to whom the Software is - * furnished to do so, subject to the following conditions: - * - * The above copyright notice and this permission notice shall be included in - * all copies or substantial portions of the Software. - * - * THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR - * IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY, - * FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL THE - * AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER - * LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM, - * OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN - * THE SOFTWARE. - */ - -#include "../group_api_external.h" - -int main() { - tiledb_group_alloc(nullptr, nullptr, nullptr); - return 0; -} diff --git a/tiledb/api/c_api/ndrectangle/test/compile_capi_ndrectangle_main.cc b/tiledb/api/c_api/ndrectangle/test/compile_capi_ndrectangle_main.cc deleted file mode 100644 index ad3c4013519..00000000000 --- a/tiledb/api/c_api/ndrectangle/test/compile_capi_ndrectangle_main.cc +++ /dev/null @@ -1,40 +0,0 @@ -/** - * @file tiledb/api/c_api/ndrectangle/test/compile_capi_ndrectangle_main.cc - * - * @section LICENSE - * - * The MIT License - * - * @copyright Copyright (c) 2024 TileDB, Inc. - * - * Permission is hereby granted, free of charge, to any person obtaining a copy - * of this software and associated documentation files (the "Software"), to deal - * in the Software without restriction, including without limitation the rights - * to use, copy, modify, merge, publish, distribute, sublicense, and/or sell - * copies of the Software, and to permit persons to whom the Software is - * furnished to do so, subject to the following conditions: - * - * The above copyright notice and this permission notice shall be included in - * all copies or substantial portions of the Software. - * - * THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR - * IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY, - * FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL THE - * AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER - * LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM, - * OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN - * THE SOFTWARE. - */ - -#include "../ndrectangle_api_external_experimental.h" - -int main() { - tiledb_ndrectangle_alloc(nullptr, nullptr, nullptr); - tiledb_ndrectangle_free(nullptr); - tiledb_ndrectangle_get_range_from_name(nullptr, nullptr, nullptr, nullptr); - tiledb_ndrectangle_get_range(nullptr, nullptr, 0, nullptr); - tiledb_ndrectangle_set_range_for_name(nullptr, nullptr, nullptr, nullptr); - tiledb_ndrectangle_set_range(nullptr, nullptr, 0, nullptr); - - return 0; -} diff --git a/tiledb/api/c_api/object/CMakeLists.txt b/tiledb/api/c_api/object/CMakeLists.txt index f4b230aefd5..8034a0f6eb1 100644 --- a/tiledb/api/c_api/object/CMakeLists.txt +++ b/tiledb/api/c_api/object/CMakeLists.txt @@ -25,6 +25,7 @@ # include(common NO_POLICY_SCOPE) +include(object_library) list(APPEND SOURCES object_api.cc @@ -32,20 +33,12 @@ list(APPEND SOURCES gather_sources(${SOURCES}) # -# Incomplete object library for object APIs. Moving the rest of -# the object API implementations over is blocked by the dependency -# on StorageManager that would require us to link the entire library -# for this to work. -# -# Maturity Warning: `capi_object` can't be a full object library unit the -# `StorageManager` dependency is removed. Note that the test-compile is -# absent. This is the reason that it hasn't been converted to use the -# `object_library` environment for CMake. -# -add_library(capi_object OBJECT EXCLUDE_FROM_ALL ${SOURCES}) -target_link_libraries(capi_object PUBLIC export) -target_link_libraries(capi_object PUBLIC baseline $) -target_link_libraries(capi_object PUBLIC constants $) -target_link_libraries(capi_object PUBLIC exception_wrapper $) +# Object library for object APIs. +# +commence(object_library capi_object) + this_target_sources(${SOURCES}) + this_target_link_libraries(export) + this_target_object_libraries(baseline constants exception_wrapper) +conclude(object_library) add_test_subdirectory() diff --git a/tiledb/api/c_api/object/test/compile_capi_object_main.cc b/tiledb/api/c_api/object/test/compile_capi_object_main.cc deleted file mode 100644 index a0760804bab..00000000000 --- a/tiledb/api/c_api/object/test/compile_capi_object_main.cc +++ /dev/null @@ -1,34 +0,0 @@ -/** - * @file tiledb/api/c_api/object/test/compile_capi_object_main.cc - * - * @section LICENSE - * - * The MIT License - * - * @copyright Copyright (c) 2022 TileDB, Inc. - * - * Permission is hereby granted, free of charge, to any person obtaining a copy - * of this software and associated documentation files (the "Software"), to deal - * in the Software without restriction, including without limitation the rights - * to use, copy, modify, merge, publish, distribute, sublicense, and/or sell - * copies of the Software, and to permit persons to whom the Software is - * furnished to do so, subject to the following conditions: - * - * The above copyright notice and this permission notice shall be included in - * all copies or substantial portions of the Software. - * - * THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR - * IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY, - * FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL THE - * AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER - * LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM, - * OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN - * THE SOFTWARE. - */ - -#include "../object_api_external.h" - -int main() { - tiledb_object_type_to_str(TILEDB_GROUP, nullptr); - return 0; -} diff --git a/tiledb/api/c_api/profile/test/compile_capi_profile_main.cc b/tiledb/api/c_api/profile/test/compile_capi_profile_main.cc deleted file mode 100644 index 30dd455999d..00000000000 --- a/tiledb/api/c_api/profile/test/compile_capi_profile_main.cc +++ /dev/null @@ -1,34 +0,0 @@ -/** - * @file tiledb/api/c_api/profile/test/compile_capi_profile_main.cc - * - * @section LICENSE - * - * The MIT License - * - * @copyright Copyright (c) 2025 TileDB, Inc. - * - * Permission is hereby granted, free of charge, to any person obtaining a copy - * of this software and associated documentation files (the "Software"), to deal - * in the Software without restriction, including without limitation the rights - * to use, copy, modify, merge, publish, distribute, sublicense, and/or sell - * copies of the Software, and to permit persons to whom the Software is - * furnished to do so, subject to the following conditions: - * - * The above copyright notice and this permission notice shall be included in - * all copies or substantial portions of the Software. - * - * THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR - * IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY, - * FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL THE - * AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER - * LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM, - * OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN - * THE SOFTWARE. - */ - -#include "../profile_api_experimental.h" - -int main() { - tiledb_profile_alloc(nullptr, nullptr, nullptr, nullptr); - return 0; -} diff --git a/tiledb/api/c_api/query/query_api.cc b/tiledb/api/c_api/query/query_api.cc index 496bec15014..ebb1ff35e96 100644 --- a/tiledb/api/c_api/query/query_api.cc +++ b/tiledb/api/c_api/query/query_api.cc @@ -5,7 +5,7 @@ * * The MIT License * - * @copyright Copyright (c) 2022 TileDB, Inc. + * @copyright Copyright (c) 2022-2024 TileDB, Inc. * * Permission is hereby granted, free of charge, to any person obtaining a copy * of this software and associated documentation files (the "Software"), to deal @@ -30,8 +30,14 @@ * This file defines the query section of the C API for TileDB. */ -#include "query_api_external.h" +#include "query_api_external_experimental.h" +#include "query_api_internal.h" +#include "tiledb/api/c_api/array/array_api_internal.h" +#include "tiledb/api/c_api/config/config_api_internal.h" +#include "tiledb/api/c_api/query_condition/query_condition_api_internal.h" +#include "tiledb/api/c_api/subarray/subarray_api_internal.h" #include "tiledb/api/c_api_support/c_api_support.h" +#include "tiledb/sm/c_api/tiledb_struct_def.h" #include "tiledb/sm/enums/query_type.h" namespace tiledb::api { @@ -53,9 +59,360 @@ int32_t tiledb_query_type_from_str( return TILEDB_OK; } +capi_return_t tiledb_query_alloc( + tiledb_ctx_t* ctx, + tiledb_array_t* array, + tiledb_query_type_t query_type, + tiledb_query_t** query) { + ensure_array_is_valid(array); + ensure_output_pointer_is_valid(query); + + if (!array->is_open()) { + throw CAPIStatusException("Cannot create query; Input array is not open"); + } + + tiledb::sm::QueryType array_query_type = array->get_query_type(); + if (query_type != static_cast(array_query_type)) { + throw CAPIStatusException( + "Cannot create query; Array query type does not match declared query " + "type: (" + + std::string(tiledb::sm::query_type_str(array_query_type)) + " != " + + std::string(tiledb::sm::query_type_str( + static_cast(query_type))) + + ")"); + } + + *query = make_handle( + ctx->resources(), + ctx->cancellation_source(), + ctx->storage_manager(), + array->array()); + return TILEDB_OK; +} + +capi_return_t tiledb_query_get_stats(tiledb_query_t* query, char** stats_json) { + ensure_query_is_valid(query); + + if (stats_json == nullptr) { + throw CAPIStatusException("Pointer to stats_json may not be NULL"); + } + + const std::string str = query->query()->stats()->dump(2, 0); + + *stats_json = static_cast(std::malloc(str.size() + 1)); + if (*stats_json == nullptr) { + throw CAPIStatusException( + "Failed to allocate stats string; Memory allocation failed"); + } + + std::memcpy(*stats_json, str.data(), str.size()); + (*stats_json)[str.size()] = '\0'; + + return TILEDB_OK; +} + +capi_return_t tiledb_query_set_config( + tiledb_query_t* query, tiledb_config_t* config) { + ensure_query_is_valid(query); + ensure_config_is_valid(config); + query->query()->set_config(config->config()); + return TILEDB_OK; +} + +capi_return_t tiledb_query_get_config( + tiledb_query_t* query, tiledb_config_t** config) { + ensure_query_is_valid(query); + ensure_output_pointer_is_valid(config); + *config = make_handle(query->query()->config()); + return TILEDB_OK; +} + +capi_return_t tiledb_query_set_subarray_t( + tiledb_query_t* query, const tiledb_subarray_t* subarray) { + ensure_query_is_valid(query); + ensure_subarray_is_valid(subarray); + query->query()->set_subarray(*subarray->subarray()); + return TILEDB_OK; +} + +capi_return_t tiledb_query_set_data_buffer( + tiledb_query_t* query, + const char* name, + void* buffer, + uint64_t* buffer_size) { + ensure_query_is_valid(query); + query->query()->set_data_buffer(name, buffer, buffer_size); + return TILEDB_OK; +} + +capi_return_t tiledb_query_set_offsets_buffer( + tiledb_query_t* query, + const char* name, + uint64_t* buffer_offsets, + uint64_t* buffer_offsets_size) { + ensure_query_is_valid(query); + query->query()->set_offsets_buffer(name, buffer_offsets, buffer_offsets_size); + return TILEDB_OK; +} + +capi_return_t tiledb_query_set_validity_buffer( + tiledb_query_t* query, + const char* name, + uint8_t* buffer_validity, + uint64_t* buffer_validity_size) { + ensure_query_is_valid(query); + query->query()->set_validity_buffer( + name, buffer_validity, buffer_validity_size); + return TILEDB_OK; +} + +capi_return_t tiledb_query_get_data_buffer( + tiledb_query_t* query, + const char* name, + void** buffer, + uint64_t** buffer_size) { + ensure_query_is_valid(query); + std::tie(*buffer, *buffer_size) = query->query()->get_data_buffer(name); + return TILEDB_OK; +} + +capi_return_t tiledb_query_get_offsets_buffer( + tiledb_query_t* query, + const char* name, + uint64_t** buffer, + uint64_t** buffer_size) { + ensure_query_is_valid(query); + std::tie(*buffer, *buffer_size) = query->query()->get_offsets_buffer(name); + return TILEDB_OK; +} + +capi_return_t tiledb_query_get_validity_buffer( + tiledb_query_t* query, + const char* name, + uint8_t** buffer, + uint64_t** buffer_size) { + ensure_query_is_valid(query); + std::tie(*buffer, *buffer_size) = query->query()->get_validity_buffer(name); + return TILEDB_OK; +} + +capi_return_t tiledb_query_set_layout( + tiledb_query_t* query, tiledb_layout_t layout) { + ensure_query_is_valid(query); + query->query()->set_layout(static_cast(layout)); + return TILEDB_OK; +} + +capi_return_t tiledb_query_set_condition( + tiledb_query_t* query, const tiledb_query_condition_t* cond) { + ensure_query_is_valid(query); + ensure_handle_is_valid(cond); + query->query()->set_condition(*cond->query_condition()); + return TILEDB_OK; +} + +capi_return_t tiledb_query_finalize(tiledb_query_t* query) { + if (query == nullptr) { + return TILEDB_OK; + } + ensure_query_is_valid(query); + query->query()->finalize(); + return TILEDB_OK; +} + +capi_return_t tiledb_query_submit_and_finalize(tiledb_query_t* query) { + if (query == nullptr) { + return TILEDB_OK; + } + ensure_query_is_valid(query); + query->query()->submit_and_finalize(); + return TILEDB_OK; +} + +void tiledb_query_free(tiledb_query_t** query) { + ensure_output_pointer_is_valid(query); + ensure_handle_is_valid(*query); + break_handle(*query); +} + +capi_return_t tiledb_query_submit(tiledb_query_t* query) { + ensure_query_is_valid(query); + query->query()->submit(); + return TILEDB_OK; +} + +capi_return_t tiledb_query_has_results( + tiledb_query_t* query, int32_t* has_results) { + ensure_query_is_valid(query); + *has_results = query->query()->has_results(); + return TILEDB_OK; +} + +capi_return_t tiledb_query_get_status( + tiledb_query_t* query, tiledb_query_status_t* status) { + ensure_query_is_valid(query); + *status = (tiledb_query_status_t)query->query()->status(); + return TILEDB_OK; +} + +capi_return_t tiledb_query_get_type( + tiledb_query_t* query, tiledb_query_type_t* query_type) { + ensure_query_is_valid(query); + *query_type = static_cast(query->query()->type()); + return TILEDB_OK; +} + +capi_return_t tiledb_query_get_layout( + tiledb_query_t* query, tiledb_layout_t* query_layout) { + ensure_query_is_valid(query); + *query_layout = static_cast(query->query()->layout()); + return TILEDB_OK; +} + +capi_return_t tiledb_query_get_array( + tiledb_query_t* query, tiledb_array_t** array) { + ensure_query_is_valid(query); + ensure_output_pointer_is_valid(array); + *array = make_handle(query->query()->array_shared()); + return TILEDB_OK; +} + +capi_return_t tiledb_query_get_est_result_size( + const tiledb_query_t* query, const char* name, uint64_t* size) { + ensure_query_is_valid(query); + auto field_name{to_string_view<"field name">(name)}; + if (size == nullptr) { + throw CAPIStatusException("Pointer to size may not be NULL"); + } + auto est_size{query->query()->get_est_result_size_fixed_nonnull(field_name)}; + *size = est_size.fixed_; + return TILEDB_OK; +} + +capi_return_t tiledb_query_get_est_result_size_var( + const tiledb_query_t* query, + const char* name, + uint64_t* size_off, + uint64_t* size_val) { + ensure_query_is_valid(query); + auto field_name{to_string_view<"field name">(name)}; + if (size_off == nullptr) { + throw CAPIStatusException("Pointer to offset size may not be NULL"); + } + if (size_val == nullptr) { + throw CAPIStatusException("Pointer to value size may not be NULL"); + } + auto est_size{ + query->query()->get_est_result_size_variable_nonnull(field_name)}; + *size_off = est_size.fixed_; + *size_val = est_size.variable_; + return TILEDB_OK; +} + +capi_return_t tiledb_query_get_est_result_size_nullable( + const tiledb_query_t* query, + const char* name, + uint64_t* size_val, + uint64_t* size_validity) { + ensure_query_is_valid(query); + auto field_name{to_string_view<"field name">(name)}; + if (size_val == nullptr) { + throw CAPIStatusException("Pointer to value size may not be NULL"); + } + if (size_validity == nullptr) { + throw CAPIStatusException("Pointer to validity size may not be NULL"); + } + auto est_size{query->query()->get_est_result_size_fixed_nullable(field_name)}; + *size_val = est_size.fixed_; + *size_validity = est_size.validity_; + return TILEDB_OK; +} + +capi_return_t tiledb_query_get_est_result_size_var_nullable( + const tiledb_query_t* query, + const char* name, + uint64_t* size_off, + uint64_t* size_val, + uint64_t* size_validity) { + ensure_query_is_valid(query); + auto field_name{to_string_view<"field name">(name)}; + if (size_off == nullptr) { + throw CAPIStatusException("Pointer to offset size may not be NULL"); + } + if (size_val == nullptr) { + throw CAPIStatusException("Pointer to value size may not be NULL"); + } + if (size_validity == nullptr) { + throw CAPIStatusException("Pointer to validity size may not be NULL"); + } + auto est_size{ + query->query()->get_est_result_size_variable_nullable(field_name)}; + *size_off = est_size.fixed_; + *size_val = est_size.variable_; + *size_validity = est_size.validity_; + return TILEDB_OK; +} + +capi_return_t tiledb_query_get_fragment_num( + const tiledb_query_t* query, uint32_t* num) { + ensure_query_is_valid(query); + *num = query->query()->get_written_fragment_num(); + return TILEDB_OK; +} + +capi_return_t tiledb_query_get_fragment_uri( + const tiledb_query_t* query, uint64_t idx, const char** uri) { + ensure_query_is_valid(query); + *uri = query->query()->get_written_fragment_uri(idx).c_str(); + return TILEDB_OK; +} + +capi_return_t tiledb_query_get_fragment_timestamp_range( + const tiledb_query_t* query, uint64_t idx, uint64_t* t1, uint64_t* t2) { + ensure_query_is_valid(query); + std::tie(*t1, *t2) = + query->query()->get_written_fragment_timestamp_range(idx); + return TILEDB_OK; +} + +capi_return_t tiledb_query_get_subarray_t( + const tiledb_query_t* query, tiledb_subarray_t** subarray) { + ensure_query_is_valid(query); + ensure_output_pointer_is_valid(subarray); + *subarray = make_handle(*(query->query()->subarray())); + return TILEDB_OK; +} + +int32_t tiledb_query_get_relevant_fragment_num( + const tiledb_query_t* query, uint64_t* relevant_fragment_num) { + ensure_query_is_valid(query); + *relevant_fragment_num = query->query() + ->subarray() + ->relevant_fragments() + .relevant_fragments_size(); + + return TILEDB_OK; +} + +int32_t tiledb_query_add_update_value( + tiledb_query_t* query, + const char* field_name, + const void* update_value, + uint64_t update_value_size) { + ensure_query_is_valid(query); + query->query()->add_update_value(field_name, update_value, update_value_size); + + // Success + return TILEDB_OK; +} + } // namespace tiledb::api using tiledb::api::api_entry_plain; +using tiledb::api::api_entry_void; +using tiledb::api::api_entry_with_context; +template +constexpr auto api_entry = tiledb::api::api_entry_context; CAPI_INTERFACE( query_type_to_str, tiledb_query_type_t query_type, const char** str) { @@ -68,3 +425,289 @@ CAPI_INTERFACE( return api_entry_plain( str, query_type); } + +CAPI_INTERFACE( + query_alloc, + tiledb_ctx_t* ctx, + tiledb_array_t* array, + tiledb_query_type_t query_type, + tiledb_query_t** query) { + return api_entry_with_context( + ctx, array, query_type, query); +} + +CAPI_INTERFACE( + query_get_stats, + tiledb_ctx_t* ctx, + tiledb_query_t* query, + char** stats_json) { + return api_entry(ctx, query, stats_json); +} + +CAPI_INTERFACE( + query_set_config, + tiledb_ctx_t* ctx, + tiledb_query_t* query, + tiledb_config_t* config) { + return api_entry(ctx, query, config); +} + +CAPI_INTERFACE( + query_get_config, + tiledb_ctx_t* ctx, + tiledb_query_t* query, + tiledb_config_t** config) { + return api_entry(ctx, query, config); +} + +CAPI_INTERFACE( + query_set_subarray_t, + tiledb_ctx_t* ctx, + tiledb_query_t* query, + const tiledb_subarray_t* subarray) { + return api_entry( + ctx, query, subarray); +} + +CAPI_INTERFACE( + query_set_data_buffer, + tiledb_ctx_t* ctx, + tiledb_query_t* query, + const char* name, + void* buffer, + uint64_t* buffer_size) { + return api_entry( + ctx, query, name, buffer, buffer_size); +} + +CAPI_INTERFACE( + query_set_offsets_buffer, + tiledb_ctx_t* ctx, + tiledb_query_t* query, + const char* name, + uint64_t* buffer, + uint64_t* buffer_size) { + return api_entry( + ctx, query, name, buffer, buffer_size); +} + +CAPI_INTERFACE( + query_set_validity_buffer, + tiledb_ctx_t* ctx, + tiledb_query_t* query, + const char* name, + uint8_t* buffer, + uint64_t* buffer_size) { + return api_entry( + ctx, query, name, buffer, buffer_size); +} + +CAPI_INTERFACE( + query_get_data_buffer, + tiledb_ctx_t* ctx, + tiledb_query_t* query, + const char* name, + void** buffer, + uint64_t** buffer_size) { + return api_entry( + ctx, query, name, buffer, buffer_size); +} + +CAPI_INTERFACE( + query_get_offsets_buffer, + tiledb_ctx_t* ctx, + tiledb_query_t* query, + const char* name, + uint64_t** buffer, + uint64_t** buffer_size) { + return api_entry( + ctx, query, name, buffer, buffer_size); +} + +CAPI_INTERFACE( + query_get_validity_buffer, + tiledb_ctx_t* ctx, + tiledb_query_t* query, + const char* name, + uint8_t** buffer, + uint64_t** buffer_size) { + return api_entry( + ctx, query, name, buffer, buffer_size); +} + +CAPI_INTERFACE( + query_set_layout, + tiledb_ctx_t* ctx, + tiledb_query_t* query, + tiledb_layout_t layout) { + return api_entry(ctx, query, layout); +} + +CAPI_INTERFACE( + query_set_condition, + tiledb_ctx_t* ctx, + tiledb_query_t* query, + const tiledb_query_condition_t* cond) { + return api_entry(ctx, query, cond); +} + +CAPI_INTERFACE(query_finalize, tiledb_ctx_t* ctx, tiledb_query_t* query) { + return api_entry(ctx, query); +} + +CAPI_INTERFACE( + query_submit_and_finalize, tiledb_ctx_t* ctx, tiledb_query_t* query) { + return api_entry(ctx, query); +} + +CAPI_INTERFACE_VOID(query_free, tiledb_query_t** query) { + return api_entry_void(query); +} + +CAPI_INTERFACE(query_submit, tiledb_ctx_t* ctx, tiledb_query_t* query) { + return api_entry(ctx, query); +} + +CAPI_INTERFACE( + query_has_results, + tiledb_ctx_t* ctx, + tiledb_query_t* query, + int32_t* has_results) { + return api_entry( + ctx, query, has_results); +} + +CAPI_INTERFACE( + query_get_status, + tiledb_ctx_t* ctx, + tiledb_query_t* query, + tiledb_query_status_t* status) { + return api_entry(ctx, query, status); +} + +CAPI_INTERFACE( + query_get_type, + tiledb_ctx_t* ctx, + tiledb_query_t* query, + tiledb_query_type_t* query_type) { + return api_entry(ctx, query, query_type); +} + +CAPI_INTERFACE( + query_get_layout, + tiledb_ctx_t* ctx, + tiledb_query_t* query, + tiledb_layout_t* query_layout) { + return api_entry( + ctx, query, query_layout); +} + +CAPI_INTERFACE( + query_get_array, + tiledb_ctx_t* ctx, + tiledb_query_t* query, + tiledb_array_t** array) { + return api_entry(ctx, query, array); +} + +CAPI_INTERFACE( + query_get_est_result_size, + tiledb_ctx_t* ctx, + const tiledb_query_t* query, + const char* name, + uint64_t* size) { + return api_entry( + ctx, query, name, size); +} + +CAPI_INTERFACE( + query_get_est_result_size_var, + tiledb_ctx_t* ctx, + const tiledb_query_t* query, + const char* name, + uint64_t* size_off, + uint64_t* size_val) { + return api_entry( + ctx, query, name, size_off, size_val); +} + +CAPI_INTERFACE( + query_get_est_result_size_nullable, + tiledb_ctx_t* ctx, + const tiledb_query_t* query, + const char* name, + uint64_t* size_val, + uint64_t* size_validity) { + return api_entry( + ctx, query, name, size_val, size_validity); +} + +CAPI_INTERFACE( + query_get_est_result_size_var_nullable, + tiledb_ctx_t* ctx, + const tiledb_query_t* query, + const char* name, + uint64_t* size_off, + uint64_t* size_val, + uint64_t* size_validity) { + return api_entry( + ctx, query, name, size_off, size_val, size_validity); +} + +CAPI_INTERFACE( + query_get_fragment_num, + tiledb_ctx_t* ctx, + const tiledb_query_t* query, + uint32_t* num) { + return api_entry(ctx, query, num); +} + +CAPI_INTERFACE( + query_get_fragment_uri, + tiledb_ctx_t* ctx, + const tiledb_query_t* query, + uint64_t idx, + const char** uri) { + return api_entry( + ctx, query, idx, uri); +} + +CAPI_INTERFACE( + query_get_fragment_timestamp_range, + tiledb_ctx_t* ctx, + const tiledb_query_t* query, + uint64_t idx, + uint64_t* t1, + uint64_t* t2) { + return api_entry( + ctx, query, idx, t1, t2); +} + +CAPI_INTERFACE( + query_get_subarray_t, + tiledb_ctx_t* ctx, + const tiledb_query_t* query, + tiledb_subarray_t** subarray) { + return api_entry( + ctx, query, subarray); +} + +CAPI_INTERFACE( + query_get_relevant_fragment_num, + tiledb_ctx_t* ctx, + const tiledb_query_t* query, + uint64_t* relevant_fragment_num) { + return api_entry( + ctx, query, relevant_fragment_num); +} + +CAPI_INTERFACE( + query_add_update_value, + tiledb_ctx_t* ctx, + tiledb_query_t* query, + const char* field_name, + const void* update_value, + uint64_t update_value_size) { + return api_entry( + ctx, query, field_name, update_value, update_value_size); +} diff --git a/tiledb/api/c_api/query/query_api_external.h b/tiledb/api/c_api/query/query_api_external.h index e305f8c05af..f963de9a0da 100644 --- a/tiledb/api/c_api/query/query_api_external.h +++ b/tiledb/api/c_api/query/query_api_external.h @@ -34,24 +34,27 @@ #define TILEDB_CAPI_QUERY_API_EXTERNAL_H #include "../api_external_common.h" +#include "../array/array_api_external.h" +#include "../array_schema/array_schema_api_external.h" +#include "../config/config_api_external.h" +#include "../context/context_api_external.h" +#include "../query_condition/query_condition_api_external.h" +#include "../subarray/subarray_api_external.h" #ifdef __cplusplus extern "C" { #endif -typedef struct tiledb_query_t tiledb_query_t; +/** A TileDB query object. */ +typedef struct tiledb_query_handle_t tiledb_query_t; -/** TileDB query type. */ +/** Query status. */ typedef enum { -/** Helper macro for defining query type enums. */ -#define TILEDB_QUERY_TYPE_ENUM(id) TILEDB_##id -// Use token-pasting _CONCAT_ID version for precarious symbols -// (such as DELETE, see `query_api_enum.h`) -#define TILEDB_QUERY_TYPE_ENUM_CONCAT_ID(id, id2) TILEDB_##id##id2 -#include "tiledb/api/c_api/query/query_api_enum.h" -#undef TILEDB_QUERY_TYPE_ENUM -#undef TILEDB_QUERY_TYPE_ENUM_CONCAT_ID -} tiledb_query_type_t; +/** Helper macro for defining query status enums. */ +#define TILEDB_QUERY_STATUS_ENUM(id) TILEDB_##id +#include "tiledb/sm/c_api/tiledb_enum.h" +#undef TILEDB_QUERY_STATUS_ENUM +} tiledb_query_status_t; /** * Returns a string representation of the given query type. @@ -73,6 +76,803 @@ TILEDB_EXPORT capi_return_t tiledb_query_type_to_str( TILEDB_EXPORT capi_return_t tiledb_query_type_from_str( const char* str, tiledb_query_type_t* query_type) TILEDB_NOEXCEPT; +/** + * Creates a TileDB query object. Note that the query object is associated + * with a specific array object. The query type (read or write) is inferred + * from the array object, which was opened with a specific query type. + * + * **Example:** + * + * @code{.c} + * tiledb_array_t* array; + * tiledb_array_alloc(ctx, "file:///my_array", &array); + * tiledb_array_open(ctx, array, TILEDB_WRITE); + * tiledb_query_t* query; + * tiledb_query_alloc(ctx, array, TILEDB_WRITE, &query); + * @endcode + * + * @param ctx The TileDB context. + * @param query The query object to be created. + * @param array An opened array object. + * @param query_type The query type. This must comply with the query type + * `array` was opened. + * @return `TILEDB_OK` for success and `TILEDB_OOM` or `TILEDB_ERR` for error. + */ +TILEDB_EXPORT int32_t tiledb_query_alloc( + tiledb_ctx_t* ctx, + tiledb_array_t* array, + tiledb_query_type_t query_type, + tiledb_query_t** query) TILEDB_NOEXCEPT; + +/** + * Retrieves the stats from a Query. + * + * **Example:** + * + * @code{.c} + * char* stats_json; + * tiledb_query_get_stats(ctx, query, &stats_json); + * // Use the string + * tiledb_stats_free_str(&stats_json); + * @endcode + * + * @param ctx The TileDB context. + * @param query The query object. + * @param stats_json The output json. The caller takes ownership + * of the c-string and must free it using tiledb_stats_free_str(). + * @return `TILEDB_OK` for success and `TILEDB_OOM` or `TILEDB_ERR` for error. + */ +TILEDB_EXPORT int32_t tiledb_query_get_stats( + tiledb_ctx_t* ctx, + tiledb_query_t* query, + char** stats_json) TILEDB_NOEXCEPT; + +/** + * Set the query config + * + * Setting the query config will also set the subarray configuration in order to + * maintain existing behavior. If you wish the subarray to have a different + * configuration than the query, set it after calling tiledb_query_set_config. + * + * Setting the configuration with this function overrides the following + * Query-level parameters only: + * + * - `sm.memory_budget` + * - `sm.memory_budget_var` + * - `sm.var_offsets.mode` + * - `sm.var_offsets.extra_element` + * - `sm.var_offsets.bitsize` + * - `sm.check_coord_dups` + * - `sm.check_coord_oob` + * - `sm.check_global_order` + * - `sm.dedup_coords` + */ +TILEDB_EXPORT int32_t tiledb_query_set_config( + tiledb_ctx_t* ctx, + tiledb_query_t* query, + tiledb_config_t* config) TILEDB_NOEXCEPT; + +/** + * Retrieves the config from a Query. + * + * **Example:** + * + * @code{.c} + * tiledb_config_t* config; + * tiledb_query_get_config(ctx, vfs, &config); + * // Make sure to free the retrieved config + * @endcode + * + * @param ctx The TileDB context. + * @param query The query object. + * @param config The config to be retrieved. + * @return `TILEDB_OK` for success and `TILEDB_OOM` or `TILEDB_ERR` for error. + */ +TILEDB_EXPORT int32_t tiledb_query_get_config( + tiledb_ctx_t* ctx, + tiledb_query_t* query, + tiledb_config_t** config) TILEDB_NOEXCEPT; + +/** + * Indicates that the query will write or read a subarray, and provides + * the appropriate information. + * + * **Example:** + * + * The following sets a 2D subarray [0,10], [20, 30] to the query. + * + * @code{.c} + * tiledb_subarray_t *subarray; + * tiledb_subarray_alloc(ctx, array, &subarray); + * uint64_t subarray_v[] = { 0, 10, 20, 30}; + * tiledb_subarray_set_subarray(ctx, subarray, subarray_v); + * tiledb_query_set_subarray_t(ctx, query, subarray); + * @endcode + * + * @param ctx The TileDB context. + * @param query The TileDB query. + * @param subarray The subarray by which the array read/write will be + * constrained. For the case of writes, this is meaningful only + * for dense arrays. + * @return `TILEDB_OK` for success or `TILEDB_ERR` for error. + * + * @note This will error if the query is already initialized. + * + * @note This will error for writes to sparse arrays. + */ +TILEDB_EXPORT int32_t tiledb_query_set_subarray_t( + tiledb_ctx_t* ctx, + tiledb_query_t* query, + const tiledb_subarray_t* subarray) TILEDB_NOEXCEPT; + +/** + * Sets the buffer for an attribute/dimension to a query, which will + * either hold the values to be written (if it is a write query), or will hold + * the results from a read query. + * + * The caller owns the `buffer` provided and is responsible for freeing the + * memory associated with it. For writes, the buffer holds values to be written + * which can be freed at any time after query completion. For reads, the buffer + * is allocated by the caller and will contain data read by the query after + * completion. The freeing of this memory is up to the caller once they are done + * referencing the read data. + * + * **Example:** + * + * @code{.c} + * int32_t a1[100]; + * uint64_t a1_size = sizeof(a1); + * tiledb_query_set_data_buffer(ctx, query, "a1", a1, &a1_size); + * @endcode + * + * @param ctx The TileDB context. + * @param query The TileDB query. + * @param name The attribute/dimension to set the buffer for. Note that + * zipped coordinates have special name `TILEDB_COORDS`. + * @param buffer The buffer that either have the input data to be written, + * or will hold the data to be read. + * @param buffer_size In the case of writes, this is the size of `buffer` + * in bytes. In the case of reads, this initially contains the allocated + * size of `buffer`, but after the termination of the query + * it will contain the size of the useful (read) data in `buffer`. + * @return `TILEDB_OK` for success and `TILEDB_ERR` for error. + */ +TILEDB_EXPORT int32_t tiledb_query_set_data_buffer( + tiledb_ctx_t* ctx, + tiledb_query_t* query, + const char* name, + void* buffer, + uint64_t* buffer_size) TILEDB_NOEXCEPT; + +/** + * Sets the starting offsets of each cell value in the data buffer. + * + * The caller owns the `buffer` provided and is responsible for freeing the + * memory associated with it. For writes, the buffer holds offsets to be written + * which can be freed at any time after query completion. For reads, the buffer + * is allocated by the caller and will contain offset data read by the query + * after completion. The freeing of this memory is up to the caller once they + * are done referencing the read data. + * + * **Example:** + * + * @code{.c} + * uint64_t a1[100]; + * uint64_t a1_size = sizeof(a1); + * tiledb_query_set_offsets_buffer(ctx, query, "a1", a1, &a1_size); + * @endcode + * + * @param ctx The TileDB context. + * @param query The TileDB query. + * @param name The attribute/dimension to set the buffer for. Note that + * zipped coordinates have special name `TILEDB_COORDS`. + * @param buffer This buffer holds the starting offsets + * of each cell value in `buffer_val`. + * @param buffer_size In the case of writes, it is the size of `buffer_off` + * in bytes. In the case of reads, this initially contains the allocated + * size of `buffer_off`, but after the *end of the query* + * (`tiledb_query_submit`) it will contain the size of the useful (read) + * data in `buffer_off`. + * @return `TILEDB_OK` for success and `TILEDB_ERR` for error. + */ +TILEDB_EXPORT int32_t tiledb_query_set_offsets_buffer( + tiledb_ctx_t* ctx, + tiledb_query_t* query, + const char* name, + uint64_t* buffer, + uint64_t* buffer_size) TILEDB_NOEXCEPT; + +/** + * Sets the validity byte map that has exactly one value for each value in the + * data buffer. + * + * The caller owns the `buffer` provided and is responsible for freeing the + * memory associated with it. For writes, the buffer holds validity values to be + * written which can be freed at any time after query completion. For reads, the + * buffer is allocated by the caller and will contain the validity map read by + * the query after completion. The freeing of this memory is up to the caller + * once they are done referencing the read data. + * + * **Example:** + * + * @code{.c} + * uint8_t a1[100]; + * uint64_t a1_size = sizeof(a1); + * tiledb_query_set_validity_buffer(ctx, query, "a1", a1, &a1_size); + * @endcode + * + * @param ctx The TileDB context. + * @param query The TileDB query. + * @param name The attribute/dimension to set the buffer for. Note that + * zipped coordinates have special name `TILEDB_COORDS`. + * @param buffer The validity byte map that has exactly + * one value for each value in `buffer`. + * @param buffer_size In the case of writes, this is the + * size of `buffer_validity_bytemap` in bytes. In the case of reads, + * this initially contains the allocated size of `buffer_validity_bytemap`, + * but after the termination of the query it will contain the size of the + * useful (read) data in `buffer_validity_bytemap`. + * @return `TILEDB_OK` for success and `TILEDB_ERR` for error. + */ +TILEDB_EXPORT int32_t tiledb_query_set_validity_buffer( + tiledb_ctx_t* ctx, + tiledb_query_t* query, + const char* name, + uint8_t* buffer, + uint64_t* buffer_size) TILEDB_NOEXCEPT; + +/** + * Gets the buffer of a fixed-sized attribute/dimension from a query. If the + * buffer has not been set, then `buffer` is set to `nullptr`. + * + * **Example:** + * + * @code{.c} + * int* a1; + * uint64_t* a1_size; + * tiledb_query_get_data_buffer(ctx, query, "a1", &a1, &a1_size); + * @endcode + * + * @param ctx The TileDB context. + * @param query The TileDB query. + * @param name The attribute/dimension to get the buffer for. Note that the + * zipped coordinates have special name `TILEDB_COORDS`. + * @param buffer The buffer to retrieve. + * @param buffer_size A pointer to the size of the buffer. Note that this is + * a double pointer and returns the original variable address from + * `set_buffer`. + * @return `TILEDB_OK` for success and `TILEDB_ERR` for error. + */ +TILEDB_EXPORT int32_t tiledb_query_get_data_buffer( + tiledb_ctx_t* ctx, + tiledb_query_t* query, + const char* name, + void** buffer, + uint64_t** buffer_size) TILEDB_NOEXCEPT; + +/** + * Gets the starting offsets of each cell value in the data buffer. + * + * **Example:** + * + * @code{.c} + * int* a1; + * uint64_t* a1_size; + * tiledb_query_get_offsets_buffer(ctx, query, "a1", &a1, &a1_size); + * @endcode + * + * @param ctx The TileDB context. + * @param query The TileDB query. + * @param name The attribute/dimension to get the buffer for. Note that the + * zipped coordinates have special name `TILEDB_COORDS`. + * @param buffer The buffer to retrieve. + * @param buffer_size A pointer to the size of the buffer. Note that this is + * a double pointer and returns the original variable address from + * `set_buffer`. + * @return `TILEDB_OK` for success and `TILEDB_ERR` for error. + */ +TILEDB_EXPORT int32_t tiledb_query_get_offsets_buffer( + tiledb_ctx_t* ctx, + tiledb_query_t* query, + const char* name, + uint64_t** buffer, + uint64_t** buffer_size) TILEDB_NOEXCEPT; + +/** + * Gets the validity byte map that has exactly one value for each value in the + * data buffer. + * + * **Example:** + * + * @code{.c} + * int* a1; + * uint64_t* a1_size; + * tiledb_query_get_validity_buffer(ctx, query, "a1", &a1, &a1_size); + * @endcode + * + * @param ctx The TileDB context. + * @param query The TileDB query. + * @param name The attribute/dimension to get the buffer for. Note that the + * zipped coordinates have special name `TILEDB_COORDS`. + * @param buffer The buffer to retrieve. + * @param buffer_size A pointer to the size of the buffer. Note that this is + * a double pointer and returns the original variable address from + * `set_buffer`. + * @return `TILEDB_OK` for success and `TILEDB_ERR` for error. + */ +TILEDB_EXPORT int32_t tiledb_query_get_validity_buffer( + tiledb_ctx_t* ctx, + tiledb_query_t* query, + const char* name, + uint8_t** buffer, + uint64_t** buffer_size) TILEDB_NOEXCEPT; + +/** + * Sets the layout of the cells to be written or read. + * + * **Example:** + * + * @code{.c} + * tiledb_query_set_layout(ctx, query, TILEDB_ROW_MAJOR); + * @endcode + * + * @param ctx The TileDB context. + * @param query The TileDB query. + * @param layout For a write query, this specifies the order of the cells + * provided by the user in the buffers. For a read query, this specifies + * the order of the cells that will be retrieved as results and stored + * in the user buffers. The layout can be one of the following: + * - `TILEDB_COL_MAJOR`: + * This means column-major order with respect to the subarray. + * - `TILEDB_ROW_MAJOR`: + * This means row-major order with respect to the subarray. + * - `TILEDB_GLOBAL_ORDER`: + * This means that cells are stored or retrieved in the array global + * cell order. + * - `TILEDB_UNORDERED`: + * This is applicable only to reads and writes for sparse arrays, or for + * sparse writes to dense arrays. For writes, it specifies that the cells + * are unordered and, hence, TileDB must sort the cells in the global cell + * order prior to writing. For reads, TileDB will return the cells without + * any particular order, which will often lead to better performance. + * * @return `TILEDB_OK` for success and `TILEDB_ERR` for error. + */ +TILEDB_EXPORT int32_t tiledb_query_set_layout( + tiledb_ctx_t* ctx, + tiledb_query_t* query, + tiledb_layout_t layout) TILEDB_NOEXCEPT; + +/** + * Sets the query condition to be applied on a read. + * + * **Example:** + * + * @code{.c} + * tiledb_query_condition_t* query_condition; + * tiledb_query_condition_alloc(ctx, &query_condition); + * uint32_t value = 5; + * tiledb_query_condition_init( + * ctx, query_condition, "longitude", &value, sizeof(value), TILEDB_LT); + * tiledb_query_set_condition(ctx, query, query_condition); + * @endcode + * + * @param ctx The TileDB context. + * @param query The TileDB query. + * @param cond The TileDB query condition. + */ +TILEDB_EXPORT int32_t tiledb_query_set_condition( + tiledb_ctx_t* ctx, + tiledb_query_t* query, + const tiledb_query_condition_t* cond) TILEDB_NOEXCEPT; + +/** + * Flushes all internal state of a query object and finalizes the query. + * This is applicable only to global layout writes. It has no effect for + * any other query type. + * + * **Example:** + * + * @code{.c} + * tiledb_query_t* query; + * // ... Your code here ... // + * tiledb_query_finalize(ctx, query); + * @endcode + * + * @param ctx The TileDB context. + * @param query The query object to be flushed. + * @return `TILEDB_OK` for success and `TILEDB_ERR` for error. + */ +TILEDB_EXPORT int32_t +tiledb_query_finalize(tiledb_ctx_t* ctx, tiledb_query_t* query) TILEDB_NOEXCEPT; + +/** + * Submits and finalizes the query. + * This is applicable only to global layout writes. The function will + * error out if called on a query with non global layout. + * Its purpose is to submit the final chunk (partial or full tile) in + * a global order write query. + * `tiledb_query_submit_and_finalize` drops the tile alignment restriction + * of the buffers (i.e. compared to the regular global layout submit call) + * given the last chunk of a global order write is most frequently smaller + * in size than a tile. + * + * **Example:** + * + * @code{.c} + * tiledb_query_t* query; + * while (stop_condition) { + * tiledb_query_set_buffer(ctx, query, attr, tile_aligned_buffer, &size); + * tiledb_query_submit(ctx, query); + * } + * tiledb_query_set_buffer(ctx, query, attr, final_chunk, &size); + * tiledb_query_submit_and_finalize(ctx, query); + * @endcode + * + * @param ctx The TileDB context. + * @param query The query object to be flushed. + * @return `TILEDB_OK` for success and `TILEDB_ERR` for error. + */ +TILEDB_EXPORT int32_t tiledb_query_submit_and_finalize( + tiledb_ctx_t* ctx, tiledb_query_t* query) TILEDB_NOEXCEPT; + +/** + * Frees a TileDB query object. + * + * **Example:** + * + * @code{.c} + * tiledb_query_free(&query); + * @endcode + * + * @param query The query object to be deleted. + */ +TILEDB_EXPORT void tiledb_query_free(tiledb_query_t** query) TILEDB_NOEXCEPT; + +/** + * Submits a TileDB query. + * + * **Example:** + * + * @code{.c} + * tiledb_query_submit(ctx, query); + * @endcode + * + * @param ctx The TileDB context. + * @param query The query to be submitted. + * @return `TILEDB_OK` for success and `TILEDB_ERR` for error. + * + * @note `tiledb_query_finalize` must be invoked after finish writing in + * global layout (via repeated invocations of `tiledb_query_submit`), + * in order to flush any internal state. + * + * @note For the case of reads, if the returned status is `TILEDB_INCOMPLETE`, + * TileDB could not fit the entire result in the user's buffers. In this + * case, the user should consume the read results (if any), optionally + * reset the buffers with `tiledb_query_set_buffer`, and then resubmit the + * query until the status becomes `TILEDB_COMPLETED`. If all buffer sizes + * after the termination of this function become 0, then this means that + * **no** useful data was read into the buffers, implying that larger + * buffers are needed for the query to proceed. In this case, the users + * must reallocate their buffers (increasing their size), reset the buffers + * with `tiledb_query_set_buffer`, and resubmit the query. + */ +TILEDB_EXPORT int32_t +tiledb_query_submit(tiledb_ctx_t* ctx, tiledb_query_t* query) TILEDB_NOEXCEPT; + +/** + * Checks if the query has returned any results. Applicable only to + * read queries; it sets `has_results` to `0 in the case of writes. + * + * **Example:** + * + * @code{.c} + * int32_t has_results; + * tiledb_query_has_results(ctx, query, &has_results); + * @endcode + * + * @param ctx The TileDB context. + * @param query The query. + * @param has_results Set to `1` if the query returned results and `0` + * otherwise. + * @return `TILEDB_OK` upon success, and `TILEDB_ERR` upon error. + */ +TILEDB_EXPORT int32_t tiledb_query_has_results( + tiledb_ctx_t* ctx, + tiledb_query_t* query, + int32_t* has_results) TILEDB_NOEXCEPT; + +/** + * Retrieves the status of a query. + * + * **Example:** + * + * @code{.c} + * tiledb_query_status_t status; + * tiledb_query_get_status(ctx, query, &status); + * @endcode + * + * @param ctx The TileDB context. + * @param query The query. + * @param status The query status to be retrieved. + * @return `TILEDB_OK` upon success, and `TILEDB_ERR` upon error. + */ +TILEDB_EXPORT int32_t tiledb_query_get_status( + tiledb_ctx_t* ctx, + tiledb_query_t* query, + tiledb_query_status_t* status) TILEDB_NOEXCEPT; + +/** + * Retrieves the query type. + * + * **Example:** + * + * @code{.c} + * tiledb_query_type_t query_type; + * tiledb_query_get_status(ctx, query, &query_type); + * @endcode + * + * @param ctx The TileDB context. + * @param query The query. + * @param query_type The query type to be retrieved. + * @return `TILEDB_OK` upon success, and `TILEDB_ERR` upon error. + */ +TILEDB_EXPORT int32_t tiledb_query_get_type( + tiledb_ctx_t* ctx, + tiledb_query_t* query, + tiledb_query_type_t* query_type) TILEDB_NOEXCEPT; + +/** + * Retrieves the query layout. + * + * **Example:** + * + * @code{.c} + * tiledb_layout_t query_layout; + * tiledb_query_get_layout(ctx, query, &query_layout); + * @endcode + * + * @param ctx The TileDB context. + * @param query The query. + * @param query_layout The query layout to be retrieved. + * @return `TILEDB_OK` upon success, and `TILEDB_ERR` upon error. + */ +TILEDB_EXPORT int32_t tiledb_query_get_layout( + tiledb_ctx_t* ctx, + tiledb_query_t* query, + tiledb_layout_t* query_layout) TILEDB_NOEXCEPT; + +/** + * Retrieves the query array. + * + * **Example:** + * + * @code{.c} + * tiledb_array_t* array; + * tiledb_query_get_array(ctx, query, &array); + * @endcode + * + * @param ctx The TileDB context. + * @param query The query. + * @param array The query array to be retrieved. + * @return `TILEDB_OK` upon success, and `TILEDB_ERR` upon error. + */ +TILEDB_EXPORT int32_t tiledb_query_get_array( + tiledb_ctx_t* ctx, + tiledb_query_t* query, + tiledb_array_t** array) TILEDB_NOEXCEPT; + +/** + * Retrieves the estimated result size for a fixed-sized attribute/dimension. + * This is an estimate and may not be sufficient to read all results for the + * requested range, in particular for sparse arrays or array with + * var-length attributes. + * Query status must be checked and resubmitted if not complete. + * + * **Example:** + * + * @code{.c} + * uint64_t size; + * tiledb_query_get_est_result_size(ctx, query, "a", &size); + * @endcode + * + * @param ctx The TileDB context + * @param query The query. + * @param name The attribute/dimension name. + * @param size The size (in bytes) to be retrieved. + * @return `TILEDB_OK` for success and `TILEDB_ERR` for error. + */ +TILEDB_EXPORT int32_t tiledb_query_get_est_result_size( + tiledb_ctx_t* ctx, + const tiledb_query_t* query, + const char* name, + uint64_t* size) TILEDB_NOEXCEPT; + +/** + * Retrieves the estimated result size for a var-sized attribute/dimension. + * This is an estimate and may not be sufficient to read all results for the + * requested range, for sparse arrays or any array with + * var-length attributes. + * Query status must be checked and resubmitted if not complete. + * + * **Example:** + * + * @code{.c} + * uint64_t size_off, size_val; + * tiledb_query_get_est_result_size_var( + * ctx, query, "a", &size_off, &size_val); + * @endcode + * + * @param ctx The TileDB context + * @param query The query. + * @param name The attribute/dimension name. + * @param size_off The size of the offsets (in bytes) to be retrieved. + * @param size_val The size of the values (in bytes) to be retrieved. + * @return `TILEDB_OK` for success and `TILEDB_ERR` for error. + */ +TILEDB_EXPORT int32_t tiledb_query_get_est_result_size_var( + tiledb_ctx_t* ctx, + const tiledb_query_t* query, + const char* name, + uint64_t* size_off, + uint64_t* size_val) TILEDB_NOEXCEPT; + +/** + * Retrieves the estimated result size for a fixed-sized, nullable attribute. + * This is an estimate and may not be sufficient to read all results for the + * requested range, for sparse arrays or any array with + * var-length attributes. + * Query status must be checked and resubmitted if not complete. + * + * **Example:** + * + * @code{.c} + * uint64_t size_val; + * uint64_t size_validity; + * tiledb_query_get_est_result_size_nullable(ctx, query, "a", &size_val, + * &size_validity); + * @endcode + * + * @param ctx The TileDB context + * @param query The query. + * @param name The attribute name. + * @param size_val The size of the values (in bytes) to be retrieved. + * @param size_validity The size of the validity values (in bytes) to be + * retrieved. + * @return `TILEDB_OK` for success and `TILEDB_ERR` for error. + */ +TILEDB_EXPORT int32_t tiledb_query_get_est_result_size_nullable( + tiledb_ctx_t* ctx, + const tiledb_query_t* query, + const char* name, + uint64_t* size_val, + uint64_t* size_validity) TILEDB_NOEXCEPT; + +/** + * Retrieves the estimated result size for a var-sized, nullable attribute. + * + * **Example:** + * + * @code{.c} + * uint64_t size_off, size_val, size_validity; + * tiledb_query_get_est_result_size_var_nullable( + * ctx, query, "a", &size_off, &size_val, &size_validity); + * @endcode + * + * @param ctx The TileDB context + * @param query The query. + * @param name The attribute name. + * @param size_off The size of the offsets (in bytes) to be retrieved. + * @param size_val The size of the values (in bytes) to be retrieved. + * @param size_validity The size of the validity values (in bytes) to be + * retrieved. + * @return `TILEDB_OK` for success and `TILEDB_ERR` for error. + */ +TILEDB_EXPORT int32_t tiledb_query_get_est_result_size_var_nullable( + tiledb_ctx_t* ctx, + const tiledb_query_t* query, + const char* name, + uint64_t* size_off, + uint64_t* size_val, + uint64_t* size_validity) TILEDB_NOEXCEPT; + +/** + * Retrieves the number of written fragments. Applicable only to WRITE + * queries. + * + * **Example:** + * + * @code{.c} + * uint32_t num; + * tiledb_query_get_fragment_num(ctx, query, &num); + * @endcode + * + * @param ctx The TileDB context + * @param query The query. + * @param num The number of written fragments to be retrieved. + * @return `TILEDB_OK` for success and `TILEDB_ERR` for error. + */ +TILEDB_EXPORT int32_t tiledb_query_get_fragment_num( + tiledb_ctx_t* ctx, + const tiledb_query_t* query, + uint32_t* num) TILEDB_NOEXCEPT; + +/** + * Retrieves the URI of the written fragment with the input index. Applicable + * only to WRITE queries. + * + * **Example:** + * + * @code{.c} + * const char* uri; + * tiledb_query_get_fragment_uri( + * ctx, query, 0, &uri); + * @endcode + * + * @param ctx The TileDB context + * @param query The query. + * @param idx The index of the written fragment. + * @param uri The URI of the written fragment to be returned. + * @return `TILEDB_OK` for success and `TILEDB_ERR` for error. + * + * @note Make sure to make a copy of `uri` after its retrieval, as the + * constant pointer may be updated internally as new fragments + * are being written. + */ +TILEDB_EXPORT int32_t tiledb_query_get_fragment_uri( + tiledb_ctx_t* ctx, + const tiledb_query_t* query, + uint64_t idx, + const char** uri) TILEDB_NOEXCEPT; + +/** + * Retrieves the timestamp range of the written fragment with the input index. + * Applicable only to WRITE queries. + * + * **Example:** + * + * @code{.c} + * uint64_t t1, t2; + * tiledb_query_get_fragment_timestamp_range( + * ctx, query, 0, &t1, &t2); + * @endcode + * + * @param ctx The TileDB context + * @param query The query. + * @param idx The index of the written fragment. + * @param t1 The start value of the timestamp range of the + * written fragment to be returned. + * @param t2 The end value of the timestamp range of the + * written fragment to be returned. + * @return `TILEDB_OK` for success and `TILEDB_ERR` for error. + */ +TILEDB_EXPORT int32_t tiledb_query_get_fragment_timestamp_range( + tiledb_ctx_t* ctx, + const tiledb_query_t* query, + uint64_t idx, + uint64_t* t1, + uint64_t* t2) TILEDB_NOEXCEPT; + +/** + * Return a TileDB subarray object from the given query. + * + * **Example:** + * + * @code{.c} + * tiledb_subarray_t* subarray; + * tiledb_query_get_subarray_t(array, &subarray); + * @endcode + * + * @param ctx The TileDB context. + * @param query An open Query object. + * @param subarray The retrieved subarray object if available. + * @return `TILEDB_OK` for success or `TILEDB_OOM` or `TILEDB_ERR` for error. + */ +TILEDB_EXPORT +int32_t tiledb_query_get_subarray_t( + tiledb_ctx_t* ctx, + const tiledb_query_t* query, + tiledb_subarray_t** subarray) TILEDB_NOEXCEPT; + #ifdef __cplusplus } #endif diff --git a/tiledb/api/c_api/query/query_api_external_experimental.h b/tiledb/api/c_api/query/query_api_external_experimental.h new file mode 100644 index 00000000000..ab50edfc494 --- /dev/null +++ b/tiledb/api/c_api/query/query_api_external_experimental.h @@ -0,0 +1,134 @@ +/** + * @file tiledb/api/c_api/query/query_api_external_experimental.h + * + * @section LICENSE + * + * The MIT License + * + * @copyright Copyright (c) 2026 TileDB, Inc. + * + * Permission is hereby granted, free of charge, to any person obtaining a copy + * of this software and associated documentation files (the "Software"), to deal + * in the Software without restriction, including without limitation the rights + * to use, copy, modify, merge, publish, distribute, sublicense, and/or sell + * copies of the Software, and to permit persons to whom the Software is + * furnished to do so, subject to the following conditions: + * + * The above copyright notice and this permission notice shall be included in + * all copies or substantial portions of the Software. + * + * THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR + * IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY, + * FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL THE + * AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER + * LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM, + * OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN + * THE SOFTWARE. + * + * @section DESCRIPTION + * + * This file declares experimental C API for TileDB queries. + */ + +#ifndef TILEDB_CAPI_QUERY_API_EXTERNAL_EXPERIMENTAL_H +#define TILEDB_CAPI_QUERY_API_EXTERNAL_EXPERIMENTAL_H + +#include "query_api_external.h" + +#ifdef __cplusplus +extern "C" { +#endif + +/* ********************************* */ +/* QUERY */ +/* ********************************* */ + +/** + * Adds a query update values to be applied on an update. + * + * **Example:** + * + * @code{.c} + * uint32_t value = 5; + * tiledb_query_add_update_value( + * ctx, query, "longitude", &value, sizeof(value), &update_value); + * @endcode + * + * @param ctx The TileDB context. + * @param query The TileDB query. + * @param field_name The attribute name. + * @param update_value The value to set. + * @param update_value_size The byte size of `update_value`. + */ +TILEDB_EXPORT int32_t tiledb_query_add_update_value( + tiledb_ctx_t* ctx, + tiledb_query_t* query, + const char* field_name, + const void* update_value, + uint64_t update_value_size) TILEDB_NOEXCEPT; + +/** + * Get the number of relevant fragments from the subarray. Should only be + * called after size estimation was asked for. + * + * @param ctx The TileDB context. + * @param query The query to get the data fron. + * @param relevant_fragment_num Variable to receive the number of relevant + * fragments. + * @return `TILEDB_OK` for success and `TILEDB_ERR` for error. + * + * @note Should only be called after size estimation was run. + */ +TILEDB_EXPORT int32_t tiledb_query_get_relevant_fragment_num( + tiledb_ctx_t* ctx, + const tiledb_query_t* query, + uint64_t* relevant_fragment_num) TILEDB_NOEXCEPT; + +/* ********************************* */ +/* QUERY STATUS DETAILS */ +/* ********************************* */ + +/** TileDB query status details type. */ +typedef enum { +/** Helper macro for defining status details type enums. */ +#define TILEDB_QUERY_STATUS_DETAILS_ENUM(id) TILEDB_##id +#include "tiledb_enum.h" +#undef TILEDB_QUERY_STATUS_DETAILS_ENUM +} tiledb_query_status_details_reason_t; + +/** This should move to c_api/tiledb_struct_defs.h when stabilized */ +typedef struct tiledb_experimental_query_status_details_t { + tiledb_query_status_details_reason_t + incomplete_reason; ///< Reason enum for the incomplete query. +} tiledb_query_status_details_t; + +/** + * Get extended query status details. + * + * The contained enumeration tiledb_query_status_details_reason_t + * indicates extended information about a returned query status + * in order to allow improved client-side handling of buffers and + * potential resubmissions. + * + * **Example:** + * + * @code{.c} + * tiledb_query_status_details_t status_details; + * tiledb_query_get_status_details(ctx, query, &status_details); + * @endcode + * + * @param ctx The TileDB context. + * @param query The query from which to retrieve status details. + * @param status_details The tiledb_query_status_details_t struct. + * @return `TILEDB_OK` for success and `TILEDB_ERR` for error. + */ +TILEDB_EXPORT int32_t tiledb_query_get_status_details( + tiledb_ctx_t* ctx, + tiledb_query_t* query, + tiledb_query_status_details_t* status_details) TILEDB_NOEXCEPT; + +#ifdef __cplusplus +} +#endif + +#endif // TILEDB_CAPI_QUERY_API_EXTERNAL_EXPERIMENTAL_H diff --git a/tiledb/api/c_api/query/query_api_internal.h b/tiledb/api/c_api/query/query_api_internal.h index 404c2bfae8a..c80bc718e90 100644 --- a/tiledb/api/c_api/query/query_api_internal.h +++ b/tiledb/api/c_api/query/query_api_internal.h @@ -1,11 +1,11 @@ /** - * @file tiledb/api/c_api/query_aggregate/query_aggregate_api_internal.h + * @file tiledb/api/c_api/query/query_api_internal.h * * @section LICENSE * * The MIT License * - * @copyright Copyright (c) 2023 TileDB, Inc. + * @copyright Copyright (c) 2023-2024 TileDB, Inc. * * Permission is hereby granted, free of charge, to any person obtaining a copy * of this software and associated documentation files (the "Software"), to deal @@ -33,22 +33,57 @@ #ifndef TILEDB_CAPI_QUERY_INTERNAL_H #define TILEDB_CAPI_QUERY_INTERNAL_H +#include "query_api_external.h" + #include "tiledb/api/c_api_support/handle/handle.h" -#include "tiledb/sm/c_api/tiledb_struct_def.h" +#include "tiledb/common/common.h" #include "tiledb/sm/enums/query_status.h" +#include "tiledb/sm/query/query.h" + +/** Handle `struct` for API query objects. */ +struct tiledb_query_handle_t : public tiledb::api::CAPIHandle { + /** Type name */ + static constexpr std::string_view object_type_name{"query"}; + + private: + shared_ptr query_; + + public: + /** + * Constructor for creating a new query. + */ + tiledb_query_handle_t( + tiledb::sm::ContextResources& resources, + tiledb::sm::CancellationSource cancellation_source, + tiledb::sm::StorageManager* storage_manager, + shared_ptr array) + : query_(make_shared( + HERE(), resources, cancellation_source, storage_manager, array)) { + } + + /** + * Constructor from an existing shared_ptr. + */ + explicit tiledb_query_handle_t(shared_ptr query) + : query_(query) { + } + + /** Returns a raw pointer to the underlying Query. */ + [[nodiscard]] tiledb::sm::Query* query() const { + return query_.get(); + } +}; namespace tiledb::api { /** * Validation function for a TileDB query - * Throws in case the argument or its internal state is nullptr + * Throws in case the argument is nullptr * * @param query A C api query pointer */ -inline void ensure_query_is_valid(tiledb_query_t* query) { - if (!query || !query->query_) { - throw CAPIStatusException("argument `query` may not be nullptr"); - } +inline void ensure_query_is_valid(const tiledb_query_t* query) { + ensure_handle_is_valid(query); } /** @@ -72,8 +107,7 @@ inline void ensure_query_is_not_initialized(const tiledb::sm::Query& query) { */ inline void ensure_query_is_not_initialized(tiledb_query_t* query) { ensure_query_is_valid(query); - // Indirection safe because previous statement will throw otherwise - ensure_query_is_not_initialized(*query->query_); + ensure_query_is_not_initialized(*query->query()); } } // namespace tiledb::api diff --git a/tiledb/api/c_api/query/test/CMakeLists.txt b/tiledb/api/c_api/query/test/CMakeLists.txt index 6dd18b072b3..13ba0c848c4 100644 --- a/tiledb/api/c_api/query/test/CMakeLists.txt +++ b/tiledb/api/c_api/query/test/CMakeLists.txt @@ -28,5 +28,8 @@ include(unit_test) commence(unit_test capi_query_type) this_target_sources(unit_capi_query_type.cc) + # We link to the test support library to get TILEDB_CORE_OBJECTS. + # TODO: Remove when query gets componentized into its own object library. + this_target_link_libraries(tiledb_test_support_lib) this_target_object_libraries(capi_query) conclude(unit_test) diff --git a/tiledb/api/c_api/query/test/compile_capi_query_main.cc b/tiledb/api/c_api/query/test/compile_capi_query_main.cc deleted file mode 100644 index 109759f6922..00000000000 --- a/tiledb/api/c_api/query/test/compile_capi_query_main.cc +++ /dev/null @@ -1,34 +0,0 @@ -/** - * @file tiledb/api/c_api/query/test/compile_capi_query_main.cc - * - * @section LICENSE - * - * The MIT License - * - * @copyright Copyright (c) 2022 TileDB, Inc. - * - * Permission is hereby granted, free of charge, to any person obtaining a copy - * of this software and associated documentation files (the "Software"), to deal - * in the Software without restriction, including without limitation the rights - * to use, copy, modify, merge, publish, distribute, sublicense, and/or sell - * copies of the Software, and to permit persons to whom the Software is - * furnished to do so, subject to the following conditions: - * - * The above copyright notice and this permission notice shall be included in - * all copies or substantial portions of the Software. - * - * THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR - * IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY, - * FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL THE - * AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER - * LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM, - * OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN - * THE SOFTWARE. - */ - -#include "../query_api_external.h" - -int main() { - tiledb_query_type_to_str(TILEDB_READ, nullptr); - return 0; -} diff --git a/tiledb/api/c_api/query_aggregate/CMakeLists.txt b/tiledb/api/c_api/query_aggregate/CMakeLists.txt index a1b605fb1ea..b63be5c67ab 100644 --- a/tiledb/api/c_api/query_aggregate/CMakeLists.txt +++ b/tiledb/api/c_api/query_aggregate/CMakeLists.txt @@ -24,6 +24,7 @@ # THE SOFTWARE. # include(common NO_POLICY_SCOPE) +include(object_library) list(APPEND SOURCES query_aggregate_api.cc @@ -33,13 +34,10 @@ gather_sources(${SOURCES}) # # Object library for C API query_aggregate # -# Maturity: -# This object library does not link standalone. There's no corresponding -# `query_aggregate` object library to link to, since at present nothing -# involving query is able to link standalone. -# -add_library(capi_query_aggregate OBJECT EXCLUDE_FROM_ALL ${SOURCES}) -target_link_libraries(capi_query_aggregate PUBLIC export) -target_link_libraries(capi_query_aggregate PUBLIC baseline $) +commence(object_library capi_query_aggregate) + this_target_sources(${SOURCES}) + this_target_link_libraries(export) + this_target_object_libraries(baseline) +conclude(object_library) add_test_subdirectory() diff --git a/tiledb/api/c_api/query_aggregate/query_aggregate_api.cc b/tiledb/api/c_api/query_aggregate/query_aggregate_api.cc index 5baccb98844..cfad35ff090 100644 --- a/tiledb/api/c_api/query_aggregate/query_aggregate_api.cc +++ b/tiledb/api/c_api/query_aggregate/query_aggregate_api.cc @@ -162,7 +162,7 @@ capi_return_t tiledb_query_get_default_channel( ensure_query_is_valid(query); ensure_output_pointer_is_valid(channel); *channel = make_handle( - query->query_->default_channel()); + query->query()->default_channel()); return TILEDB_OK; } @@ -179,7 +179,7 @@ capi_return_t tiledb_create_unary_aggregate( ensure_output_pointer_is_valid(operation); ensure_input_field_is_valid(input_field_name, op->name()); std::string field_name(input_field_name); - auto& schema = query->query_->array_schema(); + auto& schema = query->query()->array_schema(); // Getting the field errors if there is no input_field_name associated with // the query. diff --git a/tiledb/api/c_api/query_aggregate/query_aggregate_api_internal.h b/tiledb/api/c_api/query_aggregate/query_aggregate_api_internal.h index 1b50d2b901c..e0c86004184 100644 --- a/tiledb/api/c_api/query_aggregate/query_aggregate_api_internal.h +++ b/tiledb/api/c_api/query_aggregate/query_aggregate_api_internal.h @@ -34,9 +34,9 @@ #ifndef TILEDB_CAPI_QUERY_AGGREGATE_INTERNAL_H #define TILEDB_CAPI_QUERY_AGGREGATE_INTERNAL_H +#include "tiledb/api/c_api/query/query_api_internal.h" #include "tiledb/api/c_api_support/argument_validation.h" #include "tiledb/api/c_api_support/handle/handle.h" -#include "tiledb/sm/c_api/tiledb_struct_def.h" #include "tiledb/sm/query/query.h" #include "tiledb/sm/query/readers/aggregators/operation.h" #include "tiledb/sm/query/readers/aggregators/query_channel.h" diff --git a/tiledb/api/c_api/query_aggregate/test/compile_capi_query_aggregate_main.cc b/tiledb/api/c_api/query_aggregate/test/compile_capi_query_aggregate_main.cc deleted file mode 100644 index dfcce9e3c4b..00000000000 --- a/tiledb/api/c_api/query_aggregate/test/compile_capi_query_aggregate_main.cc +++ /dev/null @@ -1,46 +0,0 @@ -/** - * @file - * tiledb/api/c_api/query_aggregate/test/compile_capi_query_aggregate_main.cc - * - * @section LICENSE - * - * The MIT License - * - * @copyright Copyright (c) 2023 TileDB, Inc. - * - * Permission is hereby granted, free of charge, to any person obtaining a copy - * of this software and associated documentation files (the "Software"), to deal - * in the Software without restriction, including without limitation the rights - * to use, copy, modify, merge, publish, distribute, sublicense, and/or sell - * copies of the Software, and to permit persons to whom the Software is - * furnished to do so, subject to the following conditions: - * - * The above copyright notice and this permission notice shall be included in - * all copies or substantial portions of the Software. - * - * THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR - * IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY, - * FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL THE - * AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER - * LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM, - * OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN - * THE SOFTWARE. - */ - -#include "../query_aggregate_api_external_experimental.h" - -int main() { - tiledb_query_get_default_channel(nullptr, nullptr, nullptr); - tiledb_create_unary_aggregate(nullptr, nullptr, nullptr, nullptr, nullptr); - tiledb_channel_apply_aggregate(nullptr, nullptr, nullptr, nullptr); - (void)tiledb_channel_operator_sum; - (void)tiledb_aggregate_count; - tiledb_channel_operator_sum_get(nullptr, nullptr); - tiledb_channel_operator_min_get(nullptr, nullptr); - tiledb_channel_operator_max_get(nullptr, nullptr); - tiledb_aggregate_count_get(nullptr, nullptr); - tiledb_aggregate_free(nullptr, nullptr); - tiledb_query_channel_free(nullptr, nullptr); - - return 0; -} diff --git a/tiledb/api/c_api/query_condition/CMakeLists.txt b/tiledb/api/c_api/query_condition/CMakeLists.txt new file mode 100644 index 00000000000..481f697c5af --- /dev/null +++ b/tiledb/api/c_api/query_condition/CMakeLists.txt @@ -0,0 +1,39 @@ +# +# tiledb/api/c_api/query_condition/CMakeLists.txt +# +# The MIT License +# +# Copyright (c) 2026 TileDB, Inc. +# +# Permission is hereby granted, free of charge, to any person obtaining a copy +# of this software and associated documentation files (the "Software"), to deal +# in the Software without restriction, including without limitation the rights +# to use, copy, modify, merge, publish, distribute, sublicense, and/or sell +# copies of the Software, and to permit persons to whom the Software is +# furnished to do so, subject to the following conditions: +# +# The above copyright notice and this permission notice shall be included in +# all copies or substantial portions of the Software. +# +# THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR +# IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY, +# FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL THE +# AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER +# LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM, +# OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN +# THE SOFTWARE. +# + +include(common NO_POLICY_SCOPE) +include(object_library) + +list(APPEND SOURCES + query_condition_api.cc +) +gather_sources(${SOURCES}) + +commence(object_library capi_query_condition) + this_target_sources(${SOURCES}) + this_target_link_libraries(export) + this_target_object_libraries(baseline constants exception_wrapper) +conclude(object_library) diff --git a/tiledb/api/c_api/query_condition/query_condition_api.cc b/tiledb/api/c_api/query_condition/query_condition_api.cc new file mode 100644 index 00000000000..e1469618dad --- /dev/null +++ b/tiledb/api/c_api/query_condition/query_condition_api.cc @@ -0,0 +1,222 @@ +/** + * @file tiledb/api/c_api/query_condition/query_condition_api.cc + * + * @section LICENSE + * + * The MIT License + * + * @copyright Copyright (c) 2026 TileDB, Inc. + * + * Permission is hereby granted, free of charge, to any person obtaining a copy + * of this software and associated documentation files (the "Software"), to deal + * in the Software without restriction, including without limitation the rights + * to use, copy, modify, merge, publish, distribute, sublicense, and/or sell + * copies of the Software, and to permit persons to whom the Software is + * furnished to do so, subject to the following conditions: + * + * The above copyright notice and this permission notice shall be included in + * all copies or substantial portions of the Software. + * + * THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR + * IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY, + * FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL THE + * AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER + * LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM, + * OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN + * THE SOFTWARE. + * + * @section DESCRIPTION + * + * This file defines the query condition section of the C API for TileDB. + */ + +#include "query_condition_api_external.h" +#include "query_condition_api_external_experimental.h" +#include "query_condition_api_internal.h" +#include "tiledb/api/c_api_support/c_api_support.h" +#include "tiledb/sm/c_api/api_argument_validator.h" +#include "tiledb/sm/query/query_condition.h" + +#include + +namespace tiledb::api { + +/* ****************************** */ +/* QUERY CONDITION */ +/* ****************************** */ + +int32_t tiledb_query_condition_alloc(tiledb_query_condition_t** const cond) { + *cond = make_handle(); + return TILEDB_OK; +} + +capi_return_t tiledb_query_condition_alloc_set_membership( + const char* field_name, + const void* data, + uint64_t data_size, + const void* offsets, + uint64_t offsets_size, + tiledb_query_condition_op_t op, + tiledb_query_condition_t** cond) { + // Validate input arguments. The data, data_size, offsets, and offsets_size, + // and op arguments are validated in the QueryCondition constructor so + // there's no need to validate them here. + if (field_name == nullptr) { + throw api::CAPIStatusException( + "QueryCondition field name must not be nullptr"); + } + ensure_output_pointer_is_valid(cond); + + // Create QueryCondition object + *cond = make_handle( + std::in_place, + field_name, + data, + data_size, + offsets, + offsets_size, + static_cast(op)); + return TILEDB_OK; +} + +void tiledb_query_condition_free(tiledb_query_condition_t** cond) { + break_handle(*cond); +} + +int32_t tiledb_query_condition_init( + tiledb_query_condition_t* const cond, + const char* const attribute_name, + const void* const condition_value, + const uint64_t condition_value_size, + const tiledb_query_condition_op_t op) { + ensure_handle_is_valid(cond); + + // Initialize the QueryCondition object + throw_if_not_ok(cond->query_condition()->init( + std::string(attribute_name), + condition_value, + condition_value_size, + static_cast(op))); + + return TILEDB_OK; +} + +int32_t tiledb_query_condition_combine( + const tiledb_query_condition_t* const left_cond, + const tiledb_query_condition_t* const right_cond, + const tiledb_query_condition_combination_op_t combination_op, + tiledb_query_condition_t** const combined_cond) { + // Sanity check + ensure_handle_is_valid(left_cond); + ensure_handle_is_valid(right_cond); + ensure_output_pointer_is_valid(combined_cond); + + // Create the combined QueryCondition object + auto combined_cond_obj = make_shared(HERE()); + + if (combination_op == TILEDB_NOT) { + throw_if_not_ok( + left_cond->query_condition()->negate(combined_cond_obj.get())); + } else { + throw_if_not_ok(left_cond->query_condition()->combine( + *right_cond->query_condition(), + static_cast(combination_op), + combined_cond_obj.get())); + } + + *combined_cond = + make_handle(combined_cond_obj); + return TILEDB_OK; +} + +int32_t tiledb_query_condition_negate( + const tiledb_query_condition_t* const cond, + tiledb_query_condition_t** const negated_cond) { + return api::tiledb_query_condition_combine( + cond, nullptr, TILEDB_NOT, negated_cond); +} + +capi_return_t tiledb_query_condition_set_use_enumeration( + const tiledb_query_condition_t* cond, int use_enumeration) { + ensure_handle_is_valid(cond); + cond->query_condition()->set_use_enumeration( + use_enumeration != 0 ? true : false); + return TILEDB_OK; +} + +} // namespace tiledb::api + +using tiledb::api::api_entry_context; +using tiledb::api::api_entry_void; +template +constexpr auto api_entry = tiledb::api::api_entry_context; + +/* ****************************** */ +/* QUERY CONDITION */ +/* ****************************** */ + +CAPI_INTERFACE( + query_condition_alloc, + tiledb_ctx_t* const ctx, + tiledb_query_condition_t** const cond) { + return api_entry(ctx, cond); +} + +CAPI_INTERFACE( + query_condition_alloc_set_membership, + tiledb_ctx_t* ctx, + const char* field_name, + const void* data, + uint64_t data_size, + const void* offsets, + uint64_t offsets_size, + tiledb_query_condition_op_t op, + tiledb_query_condition_t** cond) { + return api_entry( + ctx, field_name, data, data_size, offsets, offsets_size, op, cond); +} + +CAPI_INTERFACE_VOID(query_condition_free, tiledb_query_condition_t** cond) { + return api_entry_void(cond); +} + +CAPI_INTERFACE( + query_condition_init, + tiledb_ctx_t* const ctx, + tiledb_query_condition_t* const cond, + const char* const attribute_name, + const void* const condition_value, + const uint64_t condition_value_size, + const tiledb_query_condition_op_t op) { + return api_entry( + ctx, cond, attribute_name, condition_value, condition_value_size, op); +} + +CAPI_INTERFACE( + query_condition_combine, + tiledb_ctx_t* const ctx, + const tiledb_query_condition_t* const left_cond, + const tiledb_query_condition_t* const right_cond, + const tiledb_query_condition_combination_op_t combination_op, + tiledb_query_condition_t** const combined_cond) { + return api_entry( + ctx, left_cond, right_cond, combination_op, combined_cond); +} + +CAPI_INTERFACE( + query_condition_negate, + tiledb_ctx_t* const ctx, + const tiledb_query_condition_t* const cond, + tiledb_query_condition_t** const negated_cond) { + return api_entry( + ctx, cond, negated_cond); +} + +CAPI_INTERFACE( + query_condition_set_use_enumeration, + tiledb_ctx_t* const ctx, + const tiledb_query_condition_t* const cond, + int use_enumeration) { + return api_entry( + ctx, cond, use_enumeration); +} diff --git a/tiledb/api/c_api/query_condition/query_condition_api_external.h b/tiledb/api/c_api/query_condition/query_condition_api_external.h new file mode 100644 index 00000000000..cf12e9ffbd9 --- /dev/null +++ b/tiledb/api/c_api/query_condition/query_condition_api_external.h @@ -0,0 +1,256 @@ +/** + * @file tiledb/api/c_api/query_condition/query_condition_api_external.h + * + * @section LICENSE + * + * The MIT License + * + * @copyright Copyright (c) 2026 TileDB, Inc. + * + * Permission is hereby granted, free of charge, to any person obtaining a copy + * of this software and associated documentation files (the "Software"), to deal + * in the Software without restriction, including without limitation the rights + * to use, copy, modify, merge, publish, distribute, sublicense, and/or sell + * copies of the Software, and to permit persons to whom the Software is + * furnished to do so, subject to the following conditions: + * + * The above copyright notice and this permission notice shall be included in + * all copies or substantial portions of the Software. + * + * THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR + * IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY, + * FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL THE + * AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER + * LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM, + * OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN + * THE SOFTWARE. + * + * @section DESCRIPTION + * + * This file declares the query condition C API for TileDB. + */ + +#ifndef TILEDB_CAPI_QUERY_CONDITION_API_EXTERNAL_H +#define TILEDB_CAPI_QUERY_CONDITION_API_EXTERNAL_H + +#include "../api_external_common.h" +#include "../context/context_api_external.h" + +#ifdef __cplusplus +extern "C" { +#endif + +/* ****************************** */ +/* TILEDB ENUMS */ +/* ****************************** */ + +/** Query condition operator. */ +typedef enum { + /** Less-than operator */ + TILEDB_LT = 0, + /** Less-than-or-equal operator */ + TILEDB_LE = 1, + /** Greater-than operator */ + TILEDB_GT = 2, + /** Greater-than-or-equal operator */ + TILEDB_GE = 3, + /** Equal operator */ + TILEDB_EQ = 4, + /** Not-equal operator */ + TILEDB_NE = 5, + /** IN set membership operator. */ + TILEDB_IN = 6, + /** NOT IN set membership operator. */ + TILEDB_NOT_IN = 7, +} tiledb_query_condition_op_t; + +/** Query condition combination operator. */ +typedef enum { +/** Helper macro for defining query condition combination operator enums. */ +#define TILEDB_QUERY_CONDITION_COMBINATION_OP_ENUM(id) TILEDB_##id +#include "tiledb/sm/c_api/tiledb_enum.h" +#undef TILEDB_QUERY_CONDITION_COMBINATION_OP_ENUM +} tiledb_query_condition_combination_op_t; + +/* ********************************* */ +/* TILEDB TYPES */ +/* ********************************* */ + +/** A TileDB query condition object. */ +typedef struct tiledb_query_condition_handle_t tiledb_query_condition_t; + +/* ****************************** */ +/* QUERY CONDITION */ +/* ****************************** */ + +/** + * Allocates a TileDB query condition object. + * + * **Example:** + * + * @code{.c} + * tiledb_query_condition_t* query_condition; + * tiledb_query_condition_alloc(ctx, &query_condition); + * @endcode + * + * @param ctx The TileDB context. + * @param cond The allocated query condition object. + * @return `TILEDB_OK` for success and `TILEDB_OOM` or `TILEDB_ERR` for error. + */ +TILEDB_EXPORT int32_t tiledb_query_condition_alloc( + tiledb_ctx_t* ctx, tiledb_query_condition_t** cond) TILEDB_NOEXCEPT; + +/** + * Frees a TileDB query condition object. + * + * **Example:** + * + * @code{.c} + * uint32_t value = 5; + * tiledb_query_condition_t* query_condition; + * tiledb_query_condition_alloc( + * ctx, "longitude", &value, sizeof(value), TILEDB_LT, &query_condition); + * tiledb_query_set_condition(ctx, query, query_condition); + * tiledb_query_submit(ctx, query); + * tiledb_query_condition_free(&query_condition); + * @endcode + * + * @param cond The query condition object to be freed. + */ +TILEDB_EXPORT void tiledb_query_condition_free(tiledb_query_condition_t** cond) + TILEDB_NOEXCEPT; + +/** + * Initializes a TileDB query condition object. + * + * **Example:** + * + * @code{.c} + * tiledb_query_condition_t* query_condition; + * tiledb_query_condition_alloc(ctx, &query_condition); + * + * uint32_t value = 5; + * tiledb_query_condition_init( + * ctx, query_condition, "longitude", &value, sizeof(value), TILEDB_LT); + * @endcode + * + * @param ctx The TileDB context. + * @param cond The allocated query condition object. + * @param attribute_name The attribute name. + * @param condition_value The value to compare against an attribute value. + * @param condition_value_size The byte size of `condition_value`. + * @param op The comparison operator. + * @return `TILEDB_OK` for success and `TILEDB_ERR` for error. + */ +TILEDB_EXPORT int32_t tiledb_query_condition_init( + tiledb_ctx_t* ctx, + tiledb_query_condition_t* cond, + const char* attribute_name, + const void* condition_value, + uint64_t condition_value_size, + tiledb_query_condition_op_t op) TILEDB_NOEXCEPT; + +/** + * Combines two query condition objects into a newly allocated + * condition. Does not mutate or free the input condition objects. + * + * **Example:** + * + * @code{.c} + * tiledb_query_condition_t* query_condition_1; + * tiledb_query_condition_alloc(ctx, &query_condition_1); + * uint32_t value_1 = 5; + * tiledb_query_condition_init( + * ctx, + * query_condition_1, + * "longitude", + * &value_1, + * sizeof(value_1), + * TILEDB_LT); + * + * tiledb_query_condition_t* query_condition_2; + * tiledb_query_condition_alloc(ctx, &query_condition_2); + * uint32_t value_2 = 20; + * tiledb_query_condition_init( + * ctx, + * query_condition_2, + * "latitude", + * &value_2, + * sizeof(value_2), + * TILEDB_GE); + * + * tiledb_query_condition_t* query_condition_3; + * tiledb_query_condition_combine( + * ctx, query_condition_1, query_condition_2, TILEDB_AND, &query_condition_3); + * + * tiledb_query_condition_free(&query_condition_1); + * tiledb_query_condition_free(&query_condition_2); + * + * tiledb_query_set_condition(ctx, query, query_condition_3); + * tiledb_query_submit(ctx, query); + * tiledb_query_condition_free(&query_condition_3); + * @endcode + * + * @param[in] ctx The TileDB context. + * @param[in] left_cond The first input condition. + * @param[in] right_cond The second input condition. + * @param[in] combination_op The combination operation. + * @param[out] combined_cond The output condition holder. + * @return `TILEDB_OK` for success and `TILEDB_OOM` or `TILEDB_ERR` for error. + */ +TILEDB_EXPORT int32_t tiledb_query_condition_combine( + tiledb_ctx_t* ctx, + const tiledb_query_condition_t* left_cond, + const tiledb_query_condition_t* right_cond, + tiledb_query_condition_combination_op_t combination_op, + tiledb_query_condition_t** combined_cond) TILEDB_NOEXCEPT; + +/** + * Create a query condition representing a negation of the input query + * condition. Currently this is performed by applying De Morgan's theorem + * recursively to the query condition's internal representation. + * + * **Example:** + * + * @code{.c} + * tiledb_query_condition_t* query_condition_1; + * tiledb_query_condition_alloc(ctx, &query_condition_1); + * uint32_t value_1 = 5; + * tiledb_query_condition_init( + * ctx, + * query_condition_1, + * "longitude", + * &value_1, + * sizeof(value_1), + * TILEDB_LT); + * + * tiledb_query_condition_t* query_condition_2; + * tiledb_query_condition_negate( + * ctx, + * query_condition_1, + * &query_condition_2); + * + * tiledb_query_condition_free(&query_condition_1); + * + * tiledb_query_set_condition(ctx, query, query_condition_2); + * tiledb_query_submit(ctx, query); + * tiledb_query_condition_free(&query_condition_2); + * @endcode + * + * @param[in] ctx The TileDB context. + * @param[in] left_cond The first input condition. + * @param[in] right_cond The second input condition. + * @param[in] combination_op The combination operation. + * @param[out] combined_cond The output condition holder. + * @return `TILEDB_OK` for success and `TILEDB_OOM` or `TILEDB_ERR` for error. + */ +TILEDB_EXPORT int32_t tiledb_query_condition_negate( + tiledb_ctx_t* ctx, + const tiledb_query_condition_t* cond, + tiledb_query_condition_t** negated_cond) TILEDB_NOEXCEPT; + +#ifdef __cplusplus +} +#endif + +#endif // TILEDB_CAPI_QUERY_CONDITION_API_EXTERNAL_H diff --git a/tiledb/api/c_api/query_condition/query_condition_api_external_experimental.h b/tiledb/api/c_api/query_condition/query_condition_api_external_experimental.h new file mode 100644 index 00000000000..d2066eca11b --- /dev/null +++ b/tiledb/api/c_api/query_condition/query_condition_api_external_experimental.h @@ -0,0 +1,117 @@ +/** + * @file tiledb/api/c_api/query_condition/query_condition_api_external_experimental.h + * + * @section LICENSE + * + * The MIT License + * + * @copyright Copyright (c) 2026 TileDB, Inc. + * + * Permission is hereby granted, free of charge, to any person obtaining a copy + * of this software and associated documentation files (the "Software"), to deal + * in the Software without restriction, including without limitation the rights + * to use, copy, modify, merge, publish, distribute, sublicense, and/or sell + * copies of the Software, and to permit persons to whom the Software is + * furnished to do so, subject to the following conditions: + * + * The above copyright notice and this permission notice shall be included in + * all copies or substantial portions of the Software. + * + * THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR + * IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY, + * FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL THE + * AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER + * LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM, + * OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN + * THE SOFTWARE. + * + * @section DESCRIPTION + * + * This file declares experimental query condition C API for TileDB. + */ + +#ifndef TILEDB_CAPI_QUERY_CONDITION_API_EXPERIMENTAL_H +#define TILEDB_CAPI_QUERY_CONDITION_API_EXPERIMENTAL_H + +#include "query_condition_api_external.h" + +#ifdef __cplusplus +extern "C" { +#endif + +/* ********************************* */ +/* QUERY CONDITION */ +/* ********************************* */ + +/** + * Initializes a TileDB query condition set membership object. + * + * **Example:** + * + * @code{.c} + * tiledb_query_condition_t* cond + * tiledb_query_condition_alloc_set_membership( + * ctx, + * "some_name", + * data, + * data_size, + * offsets, + * offsets_size, + * TILEDB_QUERY_CONDITION_OP_IN, + * &cond); + * @endcode + * + * @param ctx The TileDB context. + * @param field_name The field name. + * @param data A pointer to the set member data. + * @param data_size The length of the data buffer. + * @param offsets A pointer to the array of offsets of members. + * @param offsets_size The length of the offsets array in bytes. + * @param op The set membership operator to use. + * @param cond The allocated query condition object. + * @return `TILEDB_OK` for success and `TILEDB_ERR` for error. + */ +TILEDB_EXPORT capi_return_t tiledb_query_condition_alloc_set_membership( + tiledb_ctx_t* ctx, + const char* field_name, + const void* data, + uint64_t data_size, + const void* offsets, + uint64_t offests_size, + tiledb_query_condition_op_t op, + tiledb_query_condition_t** cond) TILEDB_NOEXCEPT; + +/** + * Disable the use of enumerations on the given QueryCondition + * + * **Example:** + * + * @code{.c} + * tiledb_query_condition_t* query_condition; + * tiledb_query_condition_alloc(ctx, &query_condition); + * uint32_t value = 5; + * tiledb_query_condition_init( + * ctx, + * query_condition, + * "longitude", + * &value, + * sizeof(value), + * TILEDB_LT); + * tiledb_query_condition_set_use_enumeration(ctx, query_condition, 0); + * @endcode + * + * @param[in] ctx The TileDB context. + * @param[in] cond The query condition + * @param[in] use_enumeration Non-zero to use the associated enumeration + * @return `TILEDB_OK` for success and `TILEDB_ERR` for error. + */ +TILEDB_EXPORT int32_t tiledb_query_condition_set_use_enumeration( + tiledb_ctx_t* ctx, + const tiledb_query_condition_t* cond, + int use_enumeration) TILEDB_NOEXCEPT; + +#ifdef __cplusplus +} +#endif + +#endif // TILEDB_CAPI_QUERY_CONDITION_API_EXPERIMENTAL_H diff --git a/tiledb/api/c_api/query_condition/query_condition_api_internal.h b/tiledb/api/c_api/query_condition/query_condition_api_internal.h new file mode 100644 index 00000000000..c02fabcf104 --- /dev/null +++ b/tiledb/api/c_api/query_condition/query_condition_api_internal.h @@ -0,0 +1,84 @@ +/** + * @file tiledb/api/c_api/query_condition/query_condition_api_internal.h + * + * @section LICENSE + * + * The MIT License + * + * @copyright Copyright (c) 2026 TileDB, Inc. + * + * Permission is hereby granted, free of charge, to any person obtaining a copy + * of this software and associated documentation files (the "Software"), to deal + * in the Software without restriction, including without limitation the rights + * to use, copy, modify, merge, publish, distribute, sublicense, and/or sell + * copies of the Software, and to permit persons to whom the Software is + * furnished to do so, subject to the following conditions: + * + * The above copyright notice and this permission notice shall be included in + * all copies or substantial portions of the Software. + * + * THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR + * IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY, + * FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL THE + * AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER + * LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM, + * OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN + * THE SOFTWARE. + * + * @section DESCRIPTION + * + * This file declares the internal query condition section of the C API for + * TileDB. + */ + +#ifndef TILEDB_CAPI_QUERY_CONDITION_INTERNAL_H +#define TILEDB_CAPI_QUERY_CONDITION_INTERNAL_H + +#include "query_condition_api_external.h" + +#include "tiledb/api/c_api_support/handle/handle.h" +#include "tiledb/common/common.h" +#include "tiledb/sm/enums/query_status.h" +#include "tiledb/sm/query/query.h" + +/** Handle `struct` for API query objects. */ +struct tiledb_query_condition_handle_t : public tiledb::api::CAPIHandle { + /** Type name */ + static constexpr std::string_view object_type_name{"query_condition"}; + + private: + shared_ptr query_condition_; + + public: + /** + * Constructs a blank query condition handle. + */ + tiledb_query_condition_handle_t() + : query_condition_(make_shared(HERE())) { + } + + /** + * Constructs a query condition handle from a shared pointer to an existing + * internal query condition object. + */ + tiledb_query_condition_handle_t( + shared_ptr query_condition) + : query_condition_(query_condition) { + } + + /** + * Constructs a query condition handle from an internal query condition object + * constructed in-place. + */ + tiledb_query_condition_handle_t(std::in_place_t, auto&&... args) + : query_condition_(make_shared( + HERE(), std::forward(args)...)) { + } + + /** Returns a raw pointer to the underlying QueryCondition. */ + [[nodiscard]] tiledb::sm::QueryCondition* query_condition() const { + return query_condition_.get(); + } +}; + +#endif diff --git a/tiledb/api/c_api/query_field/CMakeLists.txt b/tiledb/api/c_api/query_field/CMakeLists.txt index 4773223acc6..c267ab999af 100644 --- a/tiledb/api/c_api/query_field/CMakeLists.txt +++ b/tiledb/api/c_api/query_field/CMakeLists.txt @@ -24,16 +24,8 @@ # THE SOFTWARE. # -# The object library `capi_query_field` cannot be linked standalone at the -# present time. It depends upon member functions of `class Query`, which does -# not yet have a standalone object library of its own. Without such a -# dependency, `capi_query_field` would have to link (essentially) the whole -# library to get a complete executable. -# -# It is against policy to use the `object_library` environment to define object -# libraries that cannot stand alone. Therefore this definition is directly in -# CMake and does not include a link-completeness target. include(common NO_POLICY_SCOPE) +include(object_library) list(APPEND SOURCES query_field_api.cc @@ -43,11 +35,10 @@ gather_sources(${SOURCES}) # # Object library for C API query_field # -# Maturity Note: object library `capi_query_field` cannot be linked stand-alone -# at present. -# -add_library(capi_query_field OBJECT EXCLUDE_FROM_ALL ${SOURCES}) -target_link_libraries(capi_query_field PUBLIC export) -target_link_libraries(capi_query_field PUBLIC baseline $) +commence(object_library capi_query_field) + this_target_sources(${SOURCES}) + this_target_link_libraries(export) + this_target_object_libraries(baseline) +conclude(object_library) add_test_subdirectory() diff --git a/tiledb/api/c_api/query_field/query_field_api.cc b/tiledb/api/c_api/query_field/query_field_api.cc index bac13f05c2a..15781c4acf5 100644 --- a/tiledb/api/c_api/query_field/query_field_api.cc +++ b/tiledb/api/c_api/query_field/query_field_api.cc @@ -51,7 +51,7 @@ tiledb_field_origin_t FieldFromAggregate::origin() { tiledb_query_field_handle_t::tiledb_query_field_handle_t( tiledb_query_t* query, const char* field_name) - : query_(query->query_) + : query_(query->query()) , field_name_(field_name) { bool is_aggregate{false}; if (field_name_ == tiledb::sm::constants::coords) { diff --git a/tiledb/api/c_api/query_field/query_field_api_internal.h b/tiledb/api/c_api/query_field/query_field_api_internal.h index 74598326843..544c3d05026 100644 --- a/tiledb/api/c_api/query_field/query_field_api_internal.h +++ b/tiledb/api/c_api/query_field/query_field_api_internal.h @@ -33,10 +33,10 @@ #ifndef TILEDB_CAPI_QUERY_FIELD_INTERNAL_H #define TILEDB_CAPI_QUERY_FIELD_INTERNAL_H +#include "tiledb/api/c_api/query/query_api_internal.h" #include "tiledb/api/c_api/query_aggregate/query_aggregate_api_internal.h" #include "tiledb/api/c_api/query_field/query_field_api_external_experimental.h" #include "tiledb/api/c_api_support/handle/handle.h" -#include "tiledb/sm/c_api/tiledb_struct_def.h" #include "tiledb/sm/query/query.h" class FieldOrigin { diff --git a/tiledb/api/c_api/query_field/test/compile_capi_query_field_main.cc b/tiledb/api/c_api/query_field/test/compile_capi_query_field_main.cc deleted file mode 100644 index 821a8814f8f..00000000000 --- a/tiledb/api/c_api/query_field/test/compile_capi_query_field_main.cc +++ /dev/null @@ -1,41 +0,0 @@ -/** - * @file - * tiledb/api/c_api/query_field/test/compile_capi_query_field_main.cc - * - * @section LICENSE - * - * The MIT License - * - * @copyright Copyright (c) 2023 TileDB, Inc. - * - * Permission is hereby granted, free of charge, to any person obtaining a copy - * of this software and associated documentation files (the "Software"), to deal - * in the Software without restriction, including without limitation the rights - * to use, copy, modify, merge, publish, distribute, sublicense, and/or sell - * copies of the Software, and to permit persons to whom the Software is - * furnished to do so, subject to the following conditions: - * - * The above copyright notice and this permission notice shall be included in - * all copies or substantial portions of the Software. - * - * THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR - * IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY, - * FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL THE - * AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER - * LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM, - * OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN - * THE SOFTWARE. - */ - -#include "../query_field_api_external_experimental.h" - -int main() { - tiledb_query_get_field(nullptr, nullptr, nullptr, nullptr); - tiledb_query_field_free(nullptr, nullptr); - tiledb_field_datatype(nullptr, nullptr, nullptr); - tiledb_field_cell_val_num(nullptr, nullptr, nullptr); - tiledb_field_origin(nullptr, nullptr, nullptr); - tiledb_field_channel(nullptr, nullptr, nullptr); - - return 1; -} diff --git a/tiledb/api/c_api/query_plan/CMakeLists.txt b/tiledb/api/c_api/query_plan/CMakeLists.txt index 1707c98120e..ef98d8f475e 100644 --- a/tiledb/api/c_api/query_plan/CMakeLists.txt +++ b/tiledb/api/c_api/query_plan/CMakeLists.txt @@ -24,6 +24,7 @@ # THE SOFTWARE. # include(common NO_POLICY_SCOPE) +include(object_library) list(APPEND SOURCES query_plan_api.cc @@ -33,13 +34,10 @@ gather_sources(${SOURCES}) # # Object library for C API query plan # -# Maturity: -# This object library cannot link standalone because `query_plan` cannot link -# standalone. -# -add_library(capi_query_plan OBJECT EXCLUDE_FROM_ALL ${SOURCES}) -target_link_libraries(capi_query_plan PUBLIC export) -target_link_libraries(capi_query_plan PUBLIC baseline $) -target_link_libraries(capi_query_plan PUBLIC query_plan $) +commence(object_library capi_query_plan) + this_target_sources(${SOURCES}) + this_target_link_libraries(export) + this_target_object_libraries(baseline query_plan) +conclude(object_library) add_test_subdirectory() diff --git a/tiledb/api/c_api/query_plan/query_plan_api.cc b/tiledb/api/c_api/query_plan/query_plan_api.cc index fe90ee0c8d5..abd9c184d07 100644 --- a/tiledb/api/c_api/query_plan/query_plan_api.cc +++ b/tiledb/api/c_api/query_plan/query_plan_api.cc @@ -32,8 +32,8 @@ #include "../string/string_api_internal.h" #include "query_plan_api_external_experimental.h" +#include "tiledb/api/c_api/query/query_api_internal.h" #include "tiledb/api/c_api_support/c_api_support.h" -#include "tiledb/sm/c_api/tiledb_struct_def.h" #include "tiledb/sm/query_plan/query_plan.h" @@ -48,7 +48,7 @@ capi_return_t tiledb_query_get_plan( throw CAPIStatusException("argument `query` may not be nullptr"); } - sm::QueryPlan plan(*query->query_); + sm::QueryPlan plan(*query->query()); *rv = make_handle(plan.dump_json()); return TILEDB_OK; diff --git a/tiledb/api/c_api/query_plan/test/compile_capi_query_plan_main.cc b/tiledb/api/c_api/query_plan/test/compile_capi_query_plan_main.cc deleted file mode 100644 index 7cf30f2012a..00000000000 --- a/tiledb/api/c_api/query_plan/test/compile_capi_query_plan_main.cc +++ /dev/null @@ -1,34 +0,0 @@ -/** - * @file tiledb/api/c_api/query_plan/test/compile_capi_query_plan_main.cc - * - * @section LICENSE - * - * The MIT License - * - * @copyright Copyright (c) 2023 TileDB, Inc. - * - * Permission is hereby granted, free of charge, to any person obtaining a copy - * of this software and associated documentation files (the "Software"), to deal - * in the Software without restriction, including without limitation the rights - * to use, copy, modify, merge, publish, distribute, sublicense, and/or sell - * copies of the Software, and to permit persons to whom the Software is - * furnished to do so, subject to the following conditions: - * - * The above copyright notice and this permission notice shall be included in - * all copies or substantial portions of the Software. - * - * THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR - * IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY, - * FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL THE - * AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER - * LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM, - * OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN - * THE SOFTWARE. - */ - -#include "../query_plan_api_external_experimental.h" - -int main() { - tiledb_query_get_plan(nullptr, nullptr, nullptr); - return 0; -} diff --git a/tiledb/api/c_api/string/test/compile_capi_string_main.cc b/tiledb/api/c_api/string/test/compile_capi_string_main.cc deleted file mode 100644 index f3977902be3..00000000000 --- a/tiledb/api/c_api/string/test/compile_capi_string_main.cc +++ /dev/null @@ -1,37 +0,0 @@ -/** - * @file tiledb/api/c_api/string/test/compile_capi_string_main.cc - * - * @section LICENSE - * - * The MIT License - * - * @copyright Copyright (c) 2022 TileDB, Inc. - * - * Permission is hereby granted, free of charge, to any person obtaining a copy - * of this software and associated documentation files (the "Software"), to deal - * in the Software without restriction, including without limitation the rights - * to use, copy, modify, merge, publish, distribute, sublicense, and/or sell - * copies of the Software, and to permit persons to whom the Software is - * furnished to do so, subject to the following conditions: - * - * The above copyright notice and this permission notice shall be included in - * all copies or substantial portions of the Software. - * - * THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR - * IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY, - * FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL THE - * AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER - * LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM, - * OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN - * THE SOFTWARE. - */ - -#include "../string_api_internal.h" - -using namespace tiledb::api; - -int main() { - auto x{make_handle("foo")}; - break_handle(x); - return 0; -} diff --git a/tiledb/api/c_api/subarray/test/compile_capi_subarray_stub_main.cc b/tiledb/api/c_api/subarray/test/compile_capi_subarray_stub_main.cc deleted file mode 100644 index b5cf6f809f7..00000000000 --- a/tiledb/api/c_api/subarray/test/compile_capi_subarray_stub_main.cc +++ /dev/null @@ -1,35 +0,0 @@ -/** - * @file - * tiledb/api/c_api/subarray/test/compile_capi_subarray_stub_main.cc - * - * @section LICENSE - * - * The MIT License - * - * @copyright Copyright (c) 2024 TileDB, Inc. - * - * Permission is hereby granted, free of charge, to any person obtaining a copy - * of this software and associated documentation files (the "Software"), to deal - * in the Software without restriction, including without limitation the rights - * to use, copy, modify, merge, publish, distribute, sublicense, and/or sell - * copies of the Software, and to permit persons to whom the Software is - * furnished to do so, subject to the following conditions: - * - * The above copyright notice and this permission notice shall be included in - * all copies or substantial portions of the Software. - * - * THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR - * IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY, - * FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL THE - * AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER - * LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM, - * OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN - * THE SOFTWARE. - */ - -#include "../subarray_api_external.h" - -int main() { - tiledb_subarray_set_config(nullptr, nullptr, nullptr); - return 0; -} diff --git a/tiledb/api/c_api/vfs/test/compile_capi_vfs_main.cc b/tiledb/api/c_api/vfs/test/compile_capi_vfs_main.cc deleted file mode 100644 index 3ca2b324b0f..00000000000 --- a/tiledb/api/c_api/vfs/test/compile_capi_vfs_main.cc +++ /dev/null @@ -1,35 +0,0 @@ -/** - * @file tiledb/api/c_api/vfs/test/compile_capi_vfs_main.cc - * - * @section LICENSE - * - * The MIT License - * - * @copyright Copyright (c) 2022 TileDB, Inc. - * - * Permission is hereby granted, free of charge, to any person obtaining a copy - * of this software and associated documentation files (the "Software"), to deal - * in the Software without restriction, including without limitation the rights - * to use, copy, modify, merge, publish, distribute, sublicense, and/or sell - * copies of the Software, and to permit persons to whom the Software is - * furnished to do so, subject to the following conditions: - * - * The above copyright notice and this permission notice shall be included in - * all copies or substantial portions of the Software. - * - * THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR - * IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY, - * FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL THE - * AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER - * LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM, - * OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN - * THE SOFTWARE. - */ - -#include "../vfs_api_external.h" - -int main() { - tiledb_vfs_alloc(nullptr, nullptr, nullptr); - tiledb_vfs_fh_free(nullptr); - return 0; -} diff --git a/tiledb/api/c_api_support/cpp_string/test/compile_capi_support_cpp_string_main.cc b/tiledb/api/c_api_support/cpp_string/test/compile_capi_support_cpp_string_main.cc deleted file mode 100644 index ab10f39881e..00000000000 --- a/tiledb/api/c_api_support/cpp_string/test/compile_capi_support_cpp_string_main.cc +++ /dev/null @@ -1,41 +0,0 @@ -/* - * @file - * tiledb/api/c_api_support/cpp_string/test/compile_capi_support_cpp_string_main.cc - * - * @section LICENSE - * - * The MIT License - * - * @copyright Copyright (c) 2024 TileDB, Inc. - * - * Permission is hereby granted, free of charge, to any person obtaining a copy - * of this software and associated documentation files (the "Software"), to deal - * in the Software without restriction, including without limitation the rights - * to use, copy, modify, merge, publish, distribute, sublicense, and/or sell - * copies of the Software, and to permit persons to whom the Software is - * furnished to do so, subject to the following conditions: - * - * The above copyright notice and this permission notice shall be included in - * all copies or substantial portions of the Software. - * - * THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR - * IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY, - * FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL THE - * AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER - * LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM, - * OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN - * THE SOFTWARE. - * - * @section DESCRIPTION - * - */ - -#include "../cpp_string.h" - -int main() { - auto sv{tiledb::api::to_string_view<"a">("")}; - if (sv.data() == nullptr) { - return 1; - } - return 0; -} diff --git a/tiledb/api/c_api_support/exception_wrapper/test/compile_exception_wrapper_main.cc b/tiledb/api/c_api_support/exception_wrapper/test/compile_exception_wrapper_main.cc deleted file mode 100644 index 88d40af1a31..00000000000 --- a/tiledb/api/c_api_support/exception_wrapper/test/compile_exception_wrapper_main.cc +++ /dev/null @@ -1,36 +0,0 @@ -/** - * @file c_api_support/exception_wrapper/test/compile_exception_wrapper_main.cc - * - * @section LICENSE - * - * The MIT License - * - * @copyright Copyright (c) 2023 TileDB, Inc. - * - * Permission is hereby granted, free of charge, to any person obtaining a copy - * of this software and associated documentation files (the "Software"), to deal - * in the Software without restriction, including without limitation the rights - * to use, copy, modify, merge, publish, distribute, sublicense, and/or sell - * copies of the Software, and to permit persons to whom the Software is - * furnished to do so, subject to the following conditions: - * - * The above copyright notice and this permission notice shall be included in - * all copies or substantial portions of the Software. - * - * THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR - * IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY, - * FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL THE - * AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER - * LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM, - * OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN - * THE SOFTWARE. - */ - -#include "../exception_wrapper.h" - -int main() { - tiledb::api::detail::ErrorTreeStdException x{std::runtime_error("")}; - tiledb::api::detail::ETVisitorStdException v{}; - x.visit(v); - return 1; -} diff --git a/tiledb/api/c_api_support/handle/CMakeLists.txt b/tiledb/api/c_api_support/handle/CMakeLists.txt index 2905402741b..b7052818856 100644 --- a/tiledb/api/c_api_support/handle/CMakeLists.txt +++ b/tiledb/api/c_api_support/handle/CMakeLists.txt @@ -25,12 +25,16 @@ # include(common NO_POLICY_SCOPE) +include(object_library) + list(APPEND SOURCES handle.cc ) gather_sources(${SOURCES}) -add_library(handle OBJECT EXCLUDE_FROM_ALL handle.cc) -target_link_libraries(handle PUBLIC baseline $) +commence(object_library handle) + this_target_sources(handle.cc) + this_target_object_libraries(baseline) +conclude(object_library) add_test_subdirectory() diff --git a/tiledb/common/algorithm/test/compile_algorithm_main.cc b/tiledb/common/algorithm/test/compile_algorithm_main.cc deleted file mode 100644 index 57aab5bd7a7..00000000000 --- a/tiledb/common/algorithm/test/compile_algorithm_main.cc +++ /dev/null @@ -1,34 +0,0 @@ -/** - * @file compile_algorithm_main.cc - * - * @section LICENSE - * - * The MIT License - * - * @copyright Copyright (c) 2025 TileDB, Inc. - * - * Permission is hereby granted, free of charge, to any person obtaining a copy - * of this software and associated documentation files (the "Software"), to deal - * in the Software without restriction, including without limitation the rights - * to use, copy, modify, merge, publish, distribute, sublicense, and/or sell - * copies of the Software, and to permit persons to whom the Software is - * furnished to do so, subject to the following conditions: - * - * The above copyright notice and this permission notice shall be included in - * all copies or substantial portions of the Software. - * - * THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR - * IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY, - * FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL THE - * AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER - * LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM, - * OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN - * THE SOFTWARE. - */ - -#include "../parallel_merge.h" - -int main() { - (void)sizeof(tiledb::algorithm::ParallelMergeOptions); - return 0; -} diff --git a/tiledb/common/filesystem/test/compile_home_directory_main.cc b/tiledb/common/filesystem/test/compile_home_directory_main.cc deleted file mode 100644 index 0a1b1cb02f9..00000000000 --- a/tiledb/common/filesystem/test/compile_home_directory_main.cc +++ /dev/null @@ -1,36 +0,0 @@ -/** - * @file compile_home_directory_main.cc - * - * @section LICENSE - * - * The MIT License - * - * @copyright Copyright (c) 2025 TileDB, Inc. - * - * Permission is hereby granted, free of charge, to any person obtaining a copy - * of this software and associated documentation files (the "Software"), to deal - * in the Software without restriction, including without limitation the rights - * to use, copy, modify, merge, publish, distribute, sublicense, and/or sell - * copies of the Software, and to permit persons to whom the Software is - * furnished to do so, subject to the following conditions: - * - * The above copyright notice and this permission notice shall be included in - * all copies or substantial portions of the Software. - * - * THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR - * IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY, - * FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL THE - * AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER - * LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM, - * OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN - * THE SOFTWARE. - */ - -#include "../home_directory.h" - -using namespace tiledb::common::filesystem; - -int main() { - (void)home_directory(); - return 0; -} diff --git a/tiledb/common/random/test/compile_seedable_global_PRNG_main.cc b/tiledb/common/random/test/compile_seedable_global_PRNG_main.cc deleted file mode 100644 index fc063c80e1e..00000000000 --- a/tiledb/common/random/test/compile_seedable_global_PRNG_main.cc +++ /dev/null @@ -1,38 +0,0 @@ -/** - * @file tiledb/common/random/test/compile_seedable_global_PRNG_main.cc - * - * @section LICENSE - * - * The MIT License - * - * @copyright Copyright (c) 2023 TileDB, Inc. - * - * Permission is hereby granted, free of charge, to any person obtaining a copy - * of this software and associated documentation files (the "Software"), to deal - * in the Software without restriction, including without limitation the rights - * to use, copy, modify, merge, publish, distribute, sublicense, and/or sell - * copies of the Software, and to permit persons to whom the Software is - * furnished to do so, subject to the following conditions: - * - * The above copyright notice and this permission notice shall be included in - * all copies or substantial portions of the Software. - * - * THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR - * IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY, - * FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL THE - * AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER - * LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM, - * OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN - * THE SOFTWARE. - */ - -#include "../prng.h" -#include "../seeder.h" - -using namespace tiledb::common; - -int main() { - (void)PRNG::get(); - (void)Seeder::get(); - return 0; -} diff --git a/tiledb/common/test/compile_assert_main.cc b/tiledb/common/test/compile_assert_main.cc deleted file mode 100644 index 261ea182403..00000000000 --- a/tiledb/common/test/compile_assert_main.cc +++ /dev/null @@ -1,36 +0,0 @@ -/** - * @file compile_baseline_main.cc - * - * @section LICENSE - * - * The MIT License - * - * @copyright Copyright (c) 2021 TileDB, Inc. - * - * Permission is hereby granted, free of charge, to any person obtaining a copy - * of this software and associated documentation files (the "Software"), to deal - * in the Software without restriction, including without limitation the rights - * to use, copy, modify, merge, publish, distribute, sublicense, and/or sell - * copies of the Software, and to permit persons to whom the Software is - * furnished to do so, subject to the following conditions: - * - * The above copyright notice and this permission notice shall be included in - * all copies or substantial portions of the Software. - * - * THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR - * IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY, - * FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL THE - * AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER - * LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM, - * OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN - * THE SOFTWARE. - */ - -#include "../assert.h" - -int main(int, char**) { - volatile bool i = 0; - iassert(i == 0, "Fatal error: i = {}", i); - passert(i == 0, "Fatal error: i = {}", i); - return 0; -} diff --git a/tiledb/common/test/compile_baseline_main.cc b/tiledb/common/test/compile_baseline_main.cc deleted file mode 100644 index e3c62d731f7..00000000000 --- a/tiledb/common/test/compile_baseline_main.cc +++ /dev/null @@ -1,44 +0,0 @@ -/** - * @file compile_baseline_main.cc - * - * @section LICENSE - * - * The MIT License - * - * @copyright Copyright (c) 2021 TileDB, Inc. - * - * Permission is hereby granted, free of charge, to any person obtaining a copy - * of this software and associated documentation files (the "Software"), to deal - * in the Software without restriction, including without limitation the rights - * to use, copy, modify, merge, publish, distribute, sublicense, and/or sell - * copies of the Software, and to permit persons to whom the Software is - * furnished to do so, subject to the following conditions: - * - * The above copyright notice and this permission notice shall be included in - * all copies or substantial portions of the Software. - * - * THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR - * IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY, - * FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL THE - * AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER - * LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM, - * OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN - * THE SOFTWARE. - */ - -#include "../dynamic_memory/dynamic_memory.h" -#include "../governor/governor.h" -#include "../heap_memory.h" -#include "../heap_profiler.h" -#include "../logger.h" -#include "../status.h" - -using namespace tiledb::common; - -int main() { - auto n = - sizeof(Logger) + sizeof(Status) + sizeof(Governor) + sizeof(HeapProfiler); - tdb_free(tdb_malloc(n)); - auto p = make_shared(HERE(), n); - return 0; -} diff --git a/tiledb/common/test/compile_stringx_main.cc b/tiledb/common/test/compile_stringx_main.cc deleted file mode 100644 index fe84ec5518c..00000000000 --- a/tiledb/common/test/compile_stringx_main.cc +++ /dev/null @@ -1,34 +0,0 @@ -/** - * @file compile_stringx_main.cc - * - * @section LICENSE - * - * The MIT License - * - * @copyright Copyright (c) 2021 TileDB, Inc. - * - * Permission is hereby granted, free of charge, to any person obtaining a copy - * of this software and associated documentation files (the "Software"), to deal - * in the Software without restriction, including without limitation the rights - * to use, copy, modify, merge, publish, distribute, sublicense, and/or sell - * copies of the Software, and to permit persons to whom the Software is - * furnished to do so, subject to the following conditions: - * - * The above copyright notice and this permission notice shall be included in - * all copies or substantial portions of the Software. - * - * THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR - * IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY, - * FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL THE - * AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER - * LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM, - * OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN - * THE SOFTWARE. - */ - -#include "../stdx_string.h" - -int main() { - (void)tiledb::stdx::string::common_prefix_size("", ""); - return 0; -} diff --git a/tiledb/common/thread_pool/test/compile_thread_pool_main.cc b/tiledb/common/thread_pool/test/compile_thread_pool_main.cc deleted file mode 100644 index f0ee3476dca..00000000000 --- a/tiledb/common/thread_pool/test/compile_thread_pool_main.cc +++ /dev/null @@ -1,34 +0,0 @@ -/** - * @file compile_thread_pool_main.cc - * - * @section LICENSE - * - * The MIT License - * - * @copyright Copyright (c) 2021 TileDB, Inc. - * - * Permission is hereby granted, free of charge, to any person obtaining a copy - * of this software and associated documentation files (the "Software"), to deal - * in the Software without restriction, including without limitation the rights - * to use, copy, modify, merge, publish, distribute, sublicense, and/or sell - * copies of the Software, and to permit persons to whom the Software is - * furnished to do so, subject to the following conditions: - * - * The above copyright notice and this permission notice shall be included in - * all copies or substantial portions of the Software. - * - * THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR - * IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY, - * FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL THE - * AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER - * LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM, - * OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN - * THE SOFTWARE. - */ - -#include "../thread_pool.h" - -int main() { - (void)sizeof(tiledb::common::ThreadPool); - return 0; -} diff --git a/tiledb/common/types/test/compile_datum_main.cc b/tiledb/common/types/test/compile_datum_main.cc deleted file mode 100644 index 0594c169e6d..00000000000 --- a/tiledb/common/types/test/compile_datum_main.cc +++ /dev/null @@ -1,36 +0,0 @@ -/** - * @file compile_untyped_datum_main.cc - * - * @section LICENSE - * - * The MIT License - * - * @copyright Copyright (c) 2021 TileDB, Inc. - * - * Permission is hereby granted, free of charge, to any person obtaining a copy - * of this software and associated documentation files (the "Software"), to deal - * in the Software without restriction, including without limitation the rights - * to use, copy, modify, merge, publish, distribute, sublicense, and/or sell - * copies of the Software, and to permit persons to whom the Software is - * furnished to do so, subject to the following conditions: - * - * The above copyright notice and this permission notice shall be included in - * all copies or substantial portions of the Software. - * - * THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR - * IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY, - * FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL THE - * AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER - * LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM, - * OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN - * THE SOFTWARE. - */ - -#include "../dynamic_typed_datum.h" -#include "../untyped_datum.h" - -int main() { - (void)sizeof(tiledb::common::UntypedDatumView); - (void)sizeof(tiledb::common::DynamicTypedDatumView); - return 0; -} diff --git a/tiledb/platform/test/compile_cert_file_main.cc b/tiledb/platform/test/compile_cert_file_main.cc deleted file mode 100644 index a3e652de6ba..00000000000 --- a/tiledb/platform/test/compile_cert_file_main.cc +++ /dev/null @@ -1,34 +0,0 @@ -/** - * @file compile_cert_file_main.cc - * - * @section LICENSE - * - * The MIT License - * - * @copyright Copyright (c) 2023 TileDB, Inc. - * - * Permission is hereby granted, free of charge, to any person obtaining a copy - * of this software and associated documentation files (the "Software"), to deal - * in the Software without restriction, including without limitation the rights - * to use, copy, modify, merge, publish, distribute, sublicense, and/or sell - * copies of the Software, and to permit persons to whom the Software is - * furnished to do so, subject to the following conditions: - * - * The above copyright notice and this permission notice shall be included in - * all copies or substantial portions of the Software. - * - * THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR - * IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY, - * FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL THE - * AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER - * LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM, - * OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN - * THE SOFTWARE. - */ - -#include "../cert_file.h" - -int main() { - tiledb::platform::PlatformCertFile::get(); - return 0; -} diff --git a/tiledb/platform/test/compile_platform_main.cc b/tiledb/platform/test/compile_platform_main.cc deleted file mode 100644 index ad3da617411..00000000000 --- a/tiledb/platform/test/compile_platform_main.cc +++ /dev/null @@ -1,38 +0,0 @@ -/** - * @file compile_platfrom_main.cc - * - * @section LICENSE - * - * The MIT License - * - * @copyright Copyright (c) 2021 TileDB, Inc. - * - * Permission is hereby granted, free of charge, to any person obtaining a copy - * of this software and associated documentation files (the "Software"), to deal - * in the Software without restriction, including without limitation the rights - * to use, copy, modify, merge, publish, distribute, sublicense, and/or sell - * copies of the Software, and to permit persons to whom the Software is - * furnished to do so, subject to the following conditions: - * - * The above copyright notice and this permission notice shall be included in - * all copies or substantial portions of the Software. - * - * THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR - * IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY, - * FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL THE - * AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER - * LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM, - * OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN - * THE SOFTWARE. - */ - -#include "../platform.h" - -int main() { - // PJD: We really don't like using sizeof to prove linkage, but - // in this particular case there's actually nothing to link - // against. If/when we add more to platform.h we'll want to - // update this test as soon as something is linkable. - (void)sizeof(tiledb::platform::is_os_linux); - return 0; -} diff --git a/tiledb/sm/array/test/compile_array_directory_main.cc b/tiledb/sm/array/test/compile_array_directory_main.cc deleted file mode 100644 index 4d8deac7ecf..00000000000 --- a/tiledb/sm/array/test/compile_array_directory_main.cc +++ /dev/null @@ -1,45 +0,0 @@ -/** - * @file compile_array_directory_main.cc - * - * @section LICENSE - * - * The MIT License - * - * @copyright Copyright (c) 2022-2024 TileDB, Inc. - * - * Permission is hereby granted, free of charge, to any person obtaining a copy - * of this software and associated documentation files (the "Software"), to deal - * in the Software without restriction, including without limitation the rights - * to use, copy, modify, merge, publish, distribute, sublicense, and/or sell - * copies of the Software, and to permit persons to whom the Software is - * furnished to do so, subject to the following conditions: - * - * The above copyright notice and this permission notice shall be included in - * all copies or substantial portions of the Software. - * - * THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR - * IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY, - * FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL THE - * AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER - * LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM, - * OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN - * THE SOFTWARE. - */ - -#include "../array_directory.h" - -#include "tiledb/common/logger.h" -#include "tiledb/sm/storage_manager/context_resources.h" - -using namespace tiledb::sm; - -int main() { - Config config; - auto logger = make_shared(HERE(), "foo"); - ContextResources resources(config, logger, 1, 1, ""); - - ArrayDirectory x(resources, URI{}); - (void)x.loaded(); - - return 0; -} diff --git a/tiledb/sm/array/test/compile_array_main.cc b/tiledb/sm/array/test/compile_array_main.cc deleted file mode 100644 index 0b387ccf3ff..00000000000 --- a/tiledb/sm/array/test/compile_array_main.cc +++ /dev/null @@ -1,46 +0,0 @@ -/** - * @file compile_array_main.cc - * - * @section LICENSE - * - * The MIT License - * - * @copyright Copyright (c) 2024 TileDB, Inc. - * - * Permission is hereby granted, free of charge, to any person obtaining a copy - * of this software and associated documentation files (the "Software"), to deal - * in the Software without restriction, including without limitation the rights - * to use, copy, modify, merge, publish, distribute, sublicense, and/or sell - * copies of the Software, and to permit persons to whom the Software is - * furnished to do so, subject to the following conditions: - * - * The above copyright notice and this permission notice shall be included in - * all copies or substantial portions of the Software. - * - * THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR - * IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY, - * FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL THE - * AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER - * LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM, - * OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN - * THE SOFTWARE. - */ - -#include "../array.h" - -#include "tiledb/common/logger.h" -#include "tiledb/sm/storage_manager/context_resources.h" - -using namespace tiledb::sm; - -int main() { - Config config; - auto logger = make_shared(HERE(), "foo"); - ContextResources resources(config, logger, 1, 1, ""); - - Array array(resources, URI{}); - - (void)array.is_empty(); - - return 0; -} diff --git a/tiledb/sm/array_schema/test/compile_array_schema_main.cc b/tiledb/sm/array_schema/test/compile_array_schema_main.cc deleted file mode 100644 index eb1d5f91631..00000000000 --- a/tiledb/sm/array_schema/test/compile_array_schema_main.cc +++ /dev/null @@ -1,63 +0,0 @@ -/** - * @file compile_array_schema_main.cc - * - * @section LICENSE - * - * The MIT License - * - * @copyright Copyright (c) 2022-2024 TileDB, Inc. - * - * Permission is hereby granted, free of charge, to any person obtaining a copy - * of this software and associated documentation files (the "Software"), to deal - * in the Software without restriction, including without limitation the rights - * to use, copy, modify, merge, publish, distribute, sublicense, and/or sell - * copies of the Software, and to permit persons to whom the Software is - * furnished to do so, subject to the following conditions: - * - * The above copyright notice and this permission notice shall be included in - * all copies or substantial portions of the Software. - * - * THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR - * IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY, - * FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL THE - * AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER - * LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM, - * OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN - * THE SOFTWARE. - */ - -#include "../array_schema.h" -#include "../array_schema_evolution.h" -#include "../dimension_label.h" - -#include "tiledb/common/memory_tracker.h" -#include "tiledb/sm/enums/array_type.h" -#include "tiledb/sm/enums/data_order.h" - -using namespace tiledb::sm; - -int main() { - MemoryTrackerManager mem; - auto mem_tracker = mem.create_tracker(); - - ArraySchema schema(ArrayType::DENSE, mem_tracker); - (void)schema.allows_dups(); - - ArraySchemaEvolution schema_evolution(mem_tracker); - (void)schema_evolution.attribute_names_to_add(); - - DimensionLabel dim_label( - 0, - "", - URI{}, - "", - DataOrder::UNORDERED_DATA, - Datatype::INT32, - 0, - make_shared(HERE(), schema), - false, - false); - (void)dim_label.is_external(); - - return 0; -} diff --git a/tiledb/sm/array_schema/test/compile_array_schema_operations_main.cc b/tiledb/sm/array_schema/test/compile_array_schema_operations_main.cc deleted file mode 100644 index 525d54c18dc..00000000000 --- a/tiledb/sm/array_schema/test/compile_array_schema_operations_main.cc +++ /dev/null @@ -1,45 +0,0 @@ -/** - * @file compile_array_schema_operations_main.cc - * - * @section LICENSE - * - * The MIT License - * - * @copyright Copyright (c) 2024 TileDB, Inc. - * - * Permission is hereby granted, free of charge, to any person obtaining a copy - * of this software and associated documentation files (the "Software"), to deal - * in the Software without restriction, including without limitation the rights - * to use, copy, modify, merge, publish, distribute, sublicense, and/or sell - * copies of the Software, and to permit persons to whom the Software is - * furnished to do so, subject to the following conditions: - * - * The above copyright notice and this permission notice shall be included in - * all copies or substantial portions of the Software. - * - * THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR - * IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY, - * FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL THE - * AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER - * LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM, - * OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN - * THE SOFTWARE. - */ - -#include "../array_schema_operations.h" - -#include "tiledb/common/logger.h" -#include "tiledb/sm/crypto/encryption_key.h" -#include "tiledb/sm/storage_manager/context_resources.h" - -using namespace tiledb::sm; - -int main() { - Config config; - auto logger = make_shared(HERE(), "foo"); - ContextResources resources(config, logger, 1, 1, ""); - EncryptionKey key; - - store_array_schema(resources, nullptr, key); - return 0; -} diff --git a/tiledb/sm/array_schema/test/compile_attribute_main.cc b/tiledb/sm/array_schema/test/compile_attribute_main.cc deleted file mode 100644 index 2697028066c..00000000000 --- a/tiledb/sm/array_schema/test/compile_attribute_main.cc +++ /dev/null @@ -1,34 +0,0 @@ -/** - * @file compile_attribute_main.cc - * - * @section LICENSE - * - * The MIT License - * - * @copyright Copyright (c) 2021 TileDB, Inc. - * - * Permission is hereby granted, free of charge, to any person obtaining a copy - * of this software and associated documentation files (the "Software"), to deal - * in the Software without restriction, including without limitation the rights - * to use, copy, modify, merge, publish, distribute, sublicense, and/or sell - * copies of the Software, and to permit persons to whom the Software is - * furnished to do so, subject to the following conditions: - * - * The above copyright notice and this permission notice shall be included in - * all copies or substantial portions of the Software. - * - * THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR - * IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY, - * FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL THE - * AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER - * LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM, - * OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN - * THE SOFTWARE. - */ - -#include "../attribute.h" - -int main() { - (void)sizeof(tiledb::sm::Attribute); - return 0; -} diff --git a/tiledb/sm/array_schema/test/compile_current_domain_main.cc b/tiledb/sm/array_schema/test/compile_current_domain_main.cc deleted file mode 100644 index 0b2ab467ed1..00000000000 --- a/tiledb/sm/array_schema/test/compile_current_domain_main.cc +++ /dev/null @@ -1,37 +0,0 @@ -/** - * @file compile_current_domain_main.cc - * - * @section LICENSE - * - * The MIT License - * - * @copyright Copyright (c) 2024 TileDB, Inc. - * - * Permission is hereby granted, free of charge, to any person obtaining a copy - * of this software and associated documentation files (the "Software"), to deal - * in the Software without restriction, including without limitation the rights - * to use, copy, modify, merge, publish, distribute, sublicense, and/or sell - * copies of the Software, and to permit persons to whom the Software is - * furnished to do so, subject to the following conditions: - * - * The above copyright notice and this permission notice shall be included in - * all copies or substantial portions of the Software. - * - * THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR - * IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY, - * FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL THE - * AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER - * LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM, - * OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN - * THE SOFTWARE. - */ - -#include "tiledb/sm/array_schema/current_domain.h" - -int main(int, char*[]) { - try { - tiledb::sm::CurrentDomain(nullptr, 0); - } catch (...) { - } - return 0; -} diff --git a/tiledb/sm/array_schema/test/compile_dimension_main.cc b/tiledb/sm/array_schema/test/compile_dimension_main.cc deleted file mode 100644 index 84784bc36de..00000000000 --- a/tiledb/sm/array_schema/test/compile_dimension_main.cc +++ /dev/null @@ -1,34 +0,0 @@ -/** - * @file compile_dimension_main.cc - * - * @section LICENSE - * - * The MIT License - * - * @copyright Copyright (c) 2021 TileDB, Inc. - * - * Permission is hereby granted, free of charge, to any person obtaining a copy - * of this software and associated documentation files (the "Software"), to deal - * in the Software without restriction, including without limitation the rights - * to use, copy, modify, merge, publish, distribute, sublicense, and/or sell - * copies of the Software, and to permit persons to whom the Software is - * furnished to do so, subject to the following conditions: - * - * The above copyright notice and this permission notice shall be included in - * all copies or substantial portions of the Software. - * - * THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR - * IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY, - * FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL THE - * AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER - * LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM, - * OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN - * THE SOFTWARE. - */ - -#include "../dimension.h" - -int main() { - (void)sizeof(tiledb::sm::Dimension); - return 0; -} diff --git a/tiledb/sm/array_schema/test/compile_domain_main.cc b/tiledb/sm/array_schema/test/compile_domain_main.cc deleted file mode 100644 index 2d06c8da1d3..00000000000 --- a/tiledb/sm/array_schema/test/compile_domain_main.cc +++ /dev/null @@ -1,34 +0,0 @@ -/** - * @file compile_domain_main.cc - * - * @section LICENSE - * - * The MIT License - * - * @copyright Copyright (c) 2021-2022 TileDB, Inc. - * - * Permission is hereby granted, free of charge, to any person obtaining a copy - * of this software and associated documentation files (the "Software"), to deal - * in the Software without restriction, including without limitation the rights - * to use, copy, modify, merge, publish, distribute, sublicense, and/or sell - * copies of the Software, and to permit persons to whom the Software is - * furnished to do so, subject to the following conditions: - * - * The above copyright notice and this permission notice shall be included in - * all copies or substantial portions of the Software. - * - * THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR - * IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY, - * FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL THE - * AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER - * LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM, - * OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN - * THE SOFTWARE. - */ - -#include "../domain.h" - -int main() { - (void)sizeof(tiledb::sm::Domain); - return 0; -} diff --git a/tiledb/sm/array_schema/test/compile_enumeration_main.cc b/tiledb/sm/array_schema/test/compile_enumeration_main.cc deleted file mode 100644 index e8ce6f2ae9c..00000000000 --- a/tiledb/sm/array_schema/test/compile_enumeration_main.cc +++ /dev/null @@ -1,47 +0,0 @@ -/** - * @file compile_enumeration_main.cc - * - * @section LICENSE - * - * The MIT License - * - * @copyright Copyright (c) 2023 TileDB, Inc. - * - * Permission is hereby granted, free of charge, to any person obtaining a copy - * of this software and associated documentation files (the "Software"), to deal - * in the Software without restriction, including without limitation the rights - * to use, copy, modify, merge, publish, distribute, sublicense, and/or sell - * copies of the Software, and to permit persons to whom the Software is - * furnished to do so, subject to the following conditions: - * - * The above copyright notice and this permission notice shall be included in - * all copies or substantial portions of the Software. - * - * THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR - * IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY, - * FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL THE - * AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER - * LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM, - * OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN - * THE SOFTWARE. - */ - -#include "tiledb/sm/array_schema/enumeration.h" -#include "tiledb/sm/enums/datatype.h" - -int main(int, char*[]) { - try { - tiledb::sm::Enumeration::create( - "foo", - tiledb::sm::Datatype::INT32, - 1, - false, - nullptr, - 0, - nullptr, - 0, - nullptr); - } catch (...) { - } - return 0; -} diff --git a/tiledb/sm/array_schema/test/compile_ndrectangle_main.cc b/tiledb/sm/array_schema/test/compile_ndrectangle_main.cc deleted file mode 100644 index d33ddd34f2f..00000000000 --- a/tiledb/sm/array_schema/test/compile_ndrectangle_main.cc +++ /dev/null @@ -1,37 +0,0 @@ -/** - * @file compile_ndrectangle_main.cc - * - * @section LICENSE - * - * The MIT License - * - * @copyright Copyright (c) 2024 TileDB, Inc. - * - * Permission is hereby granted, free of charge, to any person obtaining a copy - * of this software and associated documentation files (the "Software"), to deal - * in the Software without restriction, including without limitation the rights - * to use, copy, modify, merge, publish, distribute, sublicense, and/or sell - * copies of the Software, and to permit persons to whom the Software is - * furnished to do so, subject to the following conditions: - * - * The above copyright notice and this permission notice shall be included in - * all copies or substantial portions of the Software. - * - * THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR - * IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY, - * FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL THE - * AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER - * LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM, - * OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN - * THE SOFTWARE. - */ - -#include "tiledb/sm/array_schema/ndrectangle.h" - -int main(int, char*[]) { - try { - tiledb::sm::NDRectangle(nullptr, nullptr); - } catch (...) { - } - return 0; -} diff --git a/tiledb/sm/buffer/test/compile_buffer_list_main.cc b/tiledb/sm/buffer/test/compile_buffer_list_main.cc deleted file mode 100644 index e3a7c7a2ec4..00000000000 --- a/tiledb/sm/buffer/test/compile_buffer_list_main.cc +++ /dev/null @@ -1,35 +0,0 @@ -/** - * @file compile_buffer_list_main.cc - * - * @section LICENSE - * - * The MIT License - * - * @copyright Copyright (c) 2023 TileDB, Inc. - * - * Permission is hereby granted, free of charge, to any person obtaining a copy - * of this software and associated documentation files (the "Software"), to deal - * in the Software without restriction, including without limitation the rights - * to use, copy, modify, merge, publish, distribute, sublicense, and/or sell - * copies of the Software, and to permit persons to whom the Software is - * furnished to do so, subject to the following conditions: - * - * The above copyright notice and this permission notice shall be included in - * all copies or substantial portions of the Software. - * - * THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR - * IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY, - * FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL THE - * AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER - * LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM, - * OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN - * THE SOFTWARE. - */ - -#include "../buffer.h" -#include "../buffer_list.h" - -int main() { - tiledb::sm::BufferList(nullptr); - return 0; -} diff --git a/tiledb/sm/buffer/test/compile_buffer_main.cc b/tiledb/sm/buffer/test/compile_buffer_main.cc deleted file mode 100644 index 4e2fc6c00c4..00000000000 --- a/tiledb/sm/buffer/test/compile_buffer_main.cc +++ /dev/null @@ -1,34 +0,0 @@ -/** - * @file compile_buffer_main.cc - * - * @section LICENSE - * - * The MIT License - * - * @copyright Copyright (c) 2023 TileDB, Inc. - * - * Permission is hereby granted, free of charge, to any person obtaining a copy - * of this software and associated documentation files (the "Software"), to deal - * in the Software without restriction, including without limitation the rights - * to use, copy, modify, merge, publish, distribute, sublicense, and/or sell - * copies of the Software, and to permit persons to whom the Software is - * furnished to do so, subject to the following conditions: - * - * The above copyright notice and this permission notice shall be included in - * all copies or substantial portions of the Software. - * - * THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR - * IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY, - * FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL THE - * AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER - * LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM, - * OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN - * THE SOFTWARE. - */ - -#include "../buffer.h" - -int main() { - tiledb::sm::Buffer(); - return 0; -} diff --git a/tiledb/sm/c_api/api_argument_validator.h b/tiledb/sm/c_api/api_argument_validator.h index 7eab1523119..c99b96ed43c 100644 --- a/tiledb/sm/c_api/api_argument_validator.h +++ b/tiledb/sm/c_api/api_argument_validator.h @@ -45,7 +45,7 @@ /* ********************************* */ inline int32_t sanity_check(tiledb_ctx_t* ctx, const tiledb_query_t* query) { - if (query == nullptr || query->query_ == nullptr) { + if (query == nullptr) { auto st = Status_Error("Invalid TileDB query object"); LOG_STATUS_NO_RETURN_VALUE(st); save_error(ctx, st); @@ -54,29 +54,6 @@ inline int32_t sanity_check(tiledb_ctx_t* ctx, const tiledb_query_t* query) { return TILEDB_OK; } -inline int32_t sanity_check( - tiledb_ctx_t* ctx, const tiledb_query_condition_t* cond) { - if (cond == nullptr || cond->query_condition_ == nullptr) { - auto st = Status_Error("Invalid TileDB query condition object"); - LOG_STATUS_NO_RETURN_VALUE(st); - save_error(ctx, st); - return TILEDB_ERR; - } - return TILEDB_OK; -} - -inline int32_t sanity_check( - tiledb_ctx_t* ctx, const tiledb_consolidation_plan_t* consolidation_plan) { - if (consolidation_plan == nullptr || - consolidation_plan->consolidation_plan_ == nullptr) { - auto st = Status_Error("Invalid TileDB consolidation plan object"); - LOG_STATUS_NO_RETURN_VALUE(st); - save_error(ctx, st); - return TILEDB_ERR; - } - return TILEDB_OK; -} - /** * Helper macro similar to save_error() that catches all exceptions when * executing 'stmt'. diff --git a/tiledb/sm/c_api/tiledb.cc b/tiledb/sm/c_api/tiledb.cc index 8e7e3c72180..1ffde3e18ca 100644 --- a/tiledb/sm/c_api/tiledb.cc +++ b/tiledb/sm/c_api/tiledb.cc @@ -50,6 +50,7 @@ #include "tiledb/api/c_api/error/error_api_internal.h" #include "tiledb/api/c_api/filter_list/filter_list_api_internal.h" #include "tiledb/api/c_api/fragment_info/fragment_info_api_internal.h" +#include "tiledb/api/c_api/query/query_api_internal.h" #include "tiledb/api/c_api/string/string_api_internal.h" #include "tiledb/api/c_api/subarray/subarray_api_internal.h" #include "tiledb/api/c_api_support/c_api_support.h" @@ -77,8 +78,6 @@ #include "tiledb/sm/misc/tdb_time.h" #include "tiledb/sm/object/object.h" #include "tiledb/sm/object/object_iter.h" -#include "tiledb/sm/query/query.h" -#include "tiledb/sm/query/query_condition.h" #include "tiledb/sm/rest/rest_client.h" #include "tiledb/sm/serialization/array.h" #include "tiledb/sm/serialization/array_schema.h" @@ -184,873 +183,6 @@ capi_return_t tiledb_as_built_dump(tiledb_string_t** out) { return TILEDB_OK; } -/* ********************************* */ -/* SCHEMA EVOLUTION */ -/* ********************************* */ - -int32_t tiledb_array_schema_evolution_alloc( - tiledb_ctx_t* ctx, - tiledb_array_schema_evolution_t** array_schema_evolution) { - // Sanity check - - // Create schema evolution struct - *array_schema_evolution = new (std::nothrow) tiledb_array_schema_evolution_t; - if (*array_schema_evolution == nullptr) { - auto st = - Status_Error("Failed to allocate TileDB array schema evolution object"); - LOG_STATUS_NO_RETURN_VALUE(st); - save_error(ctx, st); - return TILEDB_OOM; - } - - // Create a new SchemaEvolution object - auto memory_tracker = ctx->resources().create_memory_tracker(); - memory_tracker->set_type(sm::MemoryTrackerType::SCHEMA_EVOLUTION); - (*array_schema_evolution)->array_schema_evolution_ = - new (std::nothrow) tiledb::sm::ArraySchemaEvolution(memory_tracker); - if ((*array_schema_evolution)->array_schema_evolution_ == nullptr) { - delete *array_schema_evolution; - *array_schema_evolution = nullptr; - auto st = - Status_Error("Failed to allocate TileDB array schema evolution object"); - LOG_STATUS_NO_RETURN_VALUE(st); - save_error(ctx, st); - return TILEDB_OOM; - } - - // Success - return TILEDB_OK; -} - -void tiledb_array_schema_evolution_free( - tiledb_array_schema_evolution_t** array_schema_evolution) { - if (array_schema_evolution != nullptr && *array_schema_evolution != nullptr) { - delete (*array_schema_evolution)->array_schema_evolution_; - delete *array_schema_evolution; - *array_schema_evolution = nullptr; - } -} - -int32_t tiledb_array_schema_evolution_add_attribute( - tiledb_ctx_t* ctx, - tiledb_array_schema_evolution_t* array_schema_evolution, - tiledb_attribute_t* attr) { - if (sanity_check(ctx, array_schema_evolution) == TILEDB_ERR) { - return TILEDB_ERR; - } - ensure_attribute_is_valid(attr); - array_schema_evolution->array_schema_evolution_->add_attribute( - attr->copy_attribute()); - - return TILEDB_OK; -} - -int32_t tiledb_array_schema_evolution_drop_attribute( - tiledb_ctx_t* ctx, - tiledb_array_schema_evolution_t* array_schema_evolution, - const char* attribute_name) { - if (sanity_check(ctx, array_schema_evolution) == TILEDB_ERR) - return TILEDB_ERR; - - array_schema_evolution->array_schema_evolution_->drop_attribute( - attribute_name); - return TILEDB_OK; -} - -capi_return_t tiledb_array_schema_evolution_add_enumeration( - tiledb_ctx_t* ctx, - tiledb_array_schema_evolution_t* array_schema_evolution, - tiledb_enumeration_t* enumeration) { - if (sanity_check(ctx, array_schema_evolution) == TILEDB_ERR) { - return TILEDB_ERR; - } - - api::ensure_enumeration_is_valid(enumeration); - - auto enmr = enumeration->copy(); - array_schema_evolution->array_schema_evolution_->add_enumeration(enmr); - - return TILEDB_OK; -} - -capi_return_t tiledb_array_schema_evolution_extend_enumeration( - tiledb_ctx_t* ctx, - tiledb_array_schema_evolution_t* array_schema_evolution, - tiledb_enumeration_t* enumeration) { - if (sanity_check(ctx, array_schema_evolution) == TILEDB_ERR) { - return TILEDB_ERR; - } - - api::ensure_enumeration_is_valid(enumeration); - - auto enmr = enumeration->copy(); - array_schema_evolution->array_schema_evolution_->extend_enumeration(enmr); - - return TILEDB_OK; -} - -capi_return_t tiledb_array_schema_evolution_drop_enumeration( - tiledb_ctx_t* ctx, - tiledb_array_schema_evolution_t* array_schema_evolution, - const char* enmr_name) { - if (sanity_check(ctx, array_schema_evolution) == TILEDB_ERR) { - return TILEDB_ERR; - } - - if (enmr_name == nullptr) { - return TILEDB_ERR; - } - - array_schema_evolution->array_schema_evolution_->drop_enumeration(enmr_name); - - return TILEDB_OK; -} - -capi_return_t tiledb_array_schema_evolution_expand_current_domain( - tiledb_ctx_t* ctx, - tiledb_array_schema_evolution_t* array_schema_evolution, - tiledb_current_domain_t* expanded_domain) { - if (sanity_check(ctx, array_schema_evolution) == TILEDB_ERR) { - return TILEDB_ERR; - } - - api::ensure_handle_is_valid(expanded_domain); - - array_schema_evolution->array_schema_evolution_->expand_current_domain( - expanded_domain->current_domain()); - - return TILEDB_OK; -} - -int32_t tiledb_array_schema_evolution_set_timestamp_range( - tiledb_ctx_t* ctx, - tiledb_array_schema_evolution_t* array_schema_evolution, - uint64_t lo, - uint64_t hi) { - if (sanity_check(ctx, array_schema_evolution) == TILEDB_ERR) - return TILEDB_ERR; - - array_schema_evolution->array_schema_evolution_->set_timestamp_range( - {lo, hi}); - return TILEDB_OK; -} - -/* ****************************** */ -/* QUERY */ -/* ****************************** */ - -int32_t tiledb_query_alloc( - tiledb_ctx_t* ctx, - tiledb_array_t* array, - tiledb_query_type_t query_type, - tiledb_query_t** query) { - ensure_array_is_valid(array); - - // Error if array is not open - if (!array->is_open()) { - auto st = Status_Error("Cannot create query; Input array is not open"); - *query = nullptr; - LOG_STATUS_NO_RETURN_VALUE(st); - save_error(ctx, st); - return TILEDB_ERR; - } - - // Error if the query type and array query type do not match - tiledb::sm::QueryType array_query_type; - try { - array_query_type = array->get_query_type(); - } catch (StatusException& e) { - return TILEDB_ERR; - } - - if (query_type != static_cast(array_query_type)) { - std::stringstream errmsg; - errmsg << "Cannot create query; " - << "Array query type does not match declared query type: " - << "(" << query_type_str(array_query_type) << " != " - << tiledb::sm::query_type_str( - static_cast(query_type)) - << ")"; - *query = nullptr; - auto st = Status_Error(errmsg.str()); - LOG_STATUS_NO_RETURN_VALUE(st); - save_error(ctx, st); - return TILEDB_ERR; - } - - // Create query struct - *query = new (std::nothrow) tiledb_query_t; - if (*query == nullptr) { - auto st = Status_Error( - "Failed to allocate TileDB query object; Memory allocation failed"); - LOG_STATUS_NO_RETURN_VALUE(st); - save_error(ctx, st); - return TILEDB_OOM; - } - - // Create query - (*query)->query_ = new (std::nothrow) tiledb::sm::Query( - ctx->resources(), - ctx->cancellation_source(), - ctx->storage_manager(), - array->array()); - if ((*query)->query_ == nullptr) { - auto st = Status_Error( - "Failed to allocate TileDB query object; Memory allocation failed"); - delete *query; - *query = nullptr; - LOG_STATUS_NO_RETURN_VALUE(st); - save_error(ctx, st); - return TILEDB_OOM; - } - - // Success - return TILEDB_OK; -} - -int32_t tiledb_query_get_stats( - tiledb_ctx_t* ctx, tiledb_query_t* query, char** stats_json) { - if (sanity_check(ctx, query) == TILEDB_ERR) - return TILEDB_ERR; - - if (stats_json == nullptr) - return TILEDB_ERR; - - const std::string str = query->query_->stats()->dump(2, 0); - - *stats_json = static_cast(std::malloc(str.size() + 1)); - if (*stats_json == nullptr) - return TILEDB_ERR; - - std::memcpy(*stats_json, str.data(), str.size()); - (*stats_json)[str.size()] = '\0'; - - return TILEDB_OK; -} - -int32_t tiledb_query_set_config( - tiledb_ctx_t* ctx, tiledb_query_t* query, tiledb_config_t* config) { - // Sanity check - if (sanity_check(ctx, query) == TILEDB_ERR) - return TILEDB_ERR; - api::ensure_config_is_valid(config); - query->query_->set_config(config->config()); - return TILEDB_OK; -} - -int32_t tiledb_query_get_config( - tiledb_ctx_t* ctx, tiledb_query_t* query, tiledb_config_t** config) { - if (sanity_check(ctx, query) == TILEDB_ERR) - return TILEDB_ERR; - api::ensure_output_pointer_is_valid(config); - *config = make_handle(query->query_->config()); - return TILEDB_OK; -} - -int32_t tiledb_query_set_subarray_t( - tiledb_ctx_t* ctx, - tiledb_query_t* query, - const tiledb_subarray_t* subarray) { - // Sanity check - if (sanity_check(ctx, query) == TILEDB_ERR) { - return TILEDB_ERR; - } - ensure_subarray_is_valid(subarray); - query->query_->set_subarray(*subarray->subarray()); - return TILEDB_OK; -} - -int32_t tiledb_query_set_data_buffer( - tiledb_ctx_t* ctx, - tiledb_query_t* query, - const char* name, - void* buffer, - uint64_t* buffer_size) { // Sanity check - if (sanity_check(ctx, query) == TILEDB_ERR) - return TILEDB_ERR; - - // Set attribute buffer - query->query_->set_data_buffer(name, buffer, buffer_size); - - return TILEDB_OK; -} - -int32_t tiledb_query_set_offsets_buffer( - tiledb_ctx_t* ctx, - tiledb_query_t* query, - const char* name, - uint64_t* buffer_offsets, - uint64_t* buffer_offsets_size) { // Sanity check - if (sanity_check(ctx, query) == TILEDB_ERR) - return TILEDB_ERR; - - // Set attribute buffer - query->query_->set_offsets_buffer(name, buffer_offsets, buffer_offsets_size); - - return TILEDB_OK; -} - -int32_t tiledb_query_set_validity_buffer( - tiledb_ctx_t* ctx, - tiledb_query_t* query, - const char* name, - uint8_t* buffer_validity, - uint64_t* buffer_validity_size) { // Sanity check - if (sanity_check(ctx, query) == TILEDB_ERR) - return TILEDB_ERR; - - // Set attribute buffer - query->query_->set_validity_buffer( - name, buffer_validity, buffer_validity_size); - - return TILEDB_OK; -} - -int32_t tiledb_query_get_data_buffer( - tiledb_ctx_t* ctx, - tiledb_query_t* query, - const char* name, - void** buffer, - uint64_t** buffer_size) { - // Sanity check - if (sanity_check(ctx, query) == TILEDB_ERR) - return TILEDB_ERR; - - // Get attribute buffer - std::tie(*buffer, *buffer_size) = query->query_->get_data_buffer(name); - - return TILEDB_OK; -} - -int32_t tiledb_query_get_offsets_buffer( - tiledb_ctx_t* ctx, - tiledb_query_t* query, - const char* name, - uint64_t** buffer, - uint64_t** buffer_size) { - // Sanity check - if (sanity_check(ctx, query) == TILEDB_ERR) - return TILEDB_ERR; - - // Get attribute buffer - std::tie(*buffer, *buffer_size) = query->query_->get_offsets_buffer(name); - - return TILEDB_OK; -} - -int32_t tiledb_query_get_validity_buffer( - tiledb_ctx_t* ctx, - tiledb_query_t* query, - const char* name, - uint8_t** buffer, - uint64_t** buffer_size) { - // Sanity check - if (sanity_check(ctx, query) == TILEDB_ERR) - return TILEDB_ERR; - - // Get attribute buffer - std::tie(*buffer, *buffer_size) = query->query_->get_validity_buffer(name); - - return TILEDB_OK; -} - -int32_t tiledb_query_set_layout( - tiledb_ctx_t* ctx, tiledb_query_t* query, tiledb_layout_t layout) { - // Sanity check - if (sanity_check(ctx, query) == TILEDB_ERR) - return TILEDB_ERR; - - // Set layout - query->query_->set_layout(static_cast(layout)); - - return TILEDB_OK; -} - -int32_t tiledb_query_set_condition( - tiledb_ctx_t* const ctx, - tiledb_query_t* const query, - const tiledb_query_condition_t* const cond) { - // Sanity check - if (sanity_check(ctx, query) == TILEDB_ERR || - sanity_check(ctx, cond) == TILEDB_ERR) - return TILEDB_ERR; - - // Set layout - query->query_->set_condition(*cond->query_condition_); - - return TILEDB_OK; -} - -int32_t tiledb_query_finalize(tiledb_ctx_t* ctx, tiledb_query_t* query) { - // Trivial case - if (query == nullptr) - return TILEDB_OK; - - // Sanity check - if (sanity_check(ctx, query) == TILEDB_ERR) - return TILEDB_ERR; - - // Flush query - query->query_->finalize(); - - return TILEDB_OK; -} - -int32_t tiledb_query_submit_and_finalize( - tiledb_ctx_t* ctx, tiledb_query_t* query) { - // Trivial case - if (query == nullptr) - return TILEDB_OK; - - // Sanity check - if (sanity_check(ctx, query) == TILEDB_ERR) - return TILEDB_ERR; - - query->query_->submit_and_finalize(); - - return TILEDB_OK; -} - -void tiledb_query_free(tiledb_query_t** query) { - if (query != nullptr && *query != nullptr) { - delete (*query)->query_; - delete *query; - *query = nullptr; - } -} - -int32_t tiledb_query_submit(tiledb_ctx_t* ctx, tiledb_query_t* query) { - // Sanity checks - if (sanity_check(ctx, query) == TILEDB_ERR) - return TILEDB_ERR; - - query->query_->submit(); - - return TILEDB_OK; -} - -int32_t tiledb_query_has_results( - tiledb_ctx_t* ctx, tiledb_query_t* query, int32_t* has_results) { - // Sanity check - if (sanity_check(ctx, query) == TILEDB_ERR) - return TILEDB_ERR; - - *has_results = query->query_->has_results(); - - return TILEDB_OK; -} - -int32_t tiledb_query_get_status( - tiledb_ctx_t* ctx, tiledb_query_t* query, tiledb_query_status_t* status) { - // Sanity check - if (sanity_check(ctx, query) == TILEDB_ERR) - return TILEDB_ERR; - - *status = (tiledb_query_status_t)query->query_->status(); - - return TILEDB_OK; -} - -int32_t tiledb_query_get_type( - tiledb_ctx_t* ctx, tiledb_query_t* query, tiledb_query_type_t* query_type) { - // Sanity check - if (sanity_check(ctx, query) == TILEDB_ERR) - return TILEDB_ERR; - - *query_type = static_cast(query->query_->type()); - - return TILEDB_OK; -} - -int32_t tiledb_query_get_layout( - tiledb_ctx_t* ctx, tiledb_query_t* query, tiledb_layout_t* query_layout) { - // Sanity check - if (sanity_check(ctx, query) == TILEDB_ERR) - return TILEDB_ERR; - - *query_layout = static_cast(query->query_->layout()); - - return TILEDB_OK; -} - -int32_t tiledb_query_get_array( - tiledb_ctx_t* ctx, tiledb_query_t* query, tiledb_array_t** array) { - // Sanity check - if (sanity_check(ctx, query) == TILEDB_ERR) - return TILEDB_ERR; - - // Allocate an array object, taken from the query's array. - *array = make_handle(query->query_->array_shared()); - - return TILEDB_OK; -} - -int32_t tiledb_query_get_est_result_size( - tiledb_ctx_t* ctx, - const tiledb_query_t* query, - const char* name, - uint64_t* size) { - if (sanity_check(ctx, query) == TILEDB_ERR) { - return TILEDB_ERR; - } - auto field_name{to_string_view<"field name">(name)}; - if (size == nullptr) { - throw CAPIStatusException("Pointer to size may not be NULL"); - } - auto est_size{query->query_->get_est_result_size_fixed_nonnull(field_name)}; - *size = est_size.fixed_; - return TILEDB_OK; -} - -int32_t tiledb_query_get_est_result_size_var( - tiledb_ctx_t* ctx, - const tiledb_query_t* query, - const char* name, - uint64_t* size_off, - uint64_t* size_val) { - if (sanity_check(ctx, query) == TILEDB_ERR) { - return TILEDB_ERR; - } - auto field_name{to_string_view<"field name">(name)}; - if (size_off == nullptr) { - throw CAPIStatusException("Pointer to offset size may not be NULL"); - } - if (size_val == nullptr) { - throw CAPIStatusException("Pointer to value size may not be NULL"); - } - - auto est_size{ - query->query_->get_est_result_size_variable_nonnull(field_name)}; - *size_off = est_size.fixed_; - *size_val = est_size.variable_; - - return TILEDB_OK; -} - -int32_t tiledb_query_get_est_result_size_nullable( - tiledb_ctx_t* ctx, - const tiledb_query_t* query, - const char* name, - uint64_t* size_val, - uint64_t* size_validity) { - if (sanity_check(ctx, query) == TILEDB_ERR) { - return TILEDB_ERR; - } - auto field_name{to_string_view<"field name">(name)}; - if (size_val == nullptr) { - throw CAPIStatusException("Pointer to value size may not be NULL"); - } - if (size_validity == nullptr) { - throw CAPIStatusException("Pointer to validity size may not be NULL"); - } - - auto est_size{query->query_->get_est_result_size_fixed_nullable(field_name)}; - *size_val = est_size.fixed_; - *size_validity = est_size.validity_; - return TILEDB_OK; -} - -int32_t tiledb_query_get_est_result_size_var_nullable( - tiledb_ctx_t* ctx, - const tiledb_query_t* query, - const char* name, - uint64_t* size_off, - uint64_t* size_val, - uint64_t* size_validity) { - if (sanity_check(ctx, query) == TILEDB_ERR) { - return TILEDB_ERR; - } - auto field_name{to_string_view<"field name">(name)}; - if (size_off == nullptr) { - throw CAPIStatusException("Pointer to offset size may not be NULL"); - } - if (size_val == nullptr) { - throw CAPIStatusException("Pointer to value size may not be NULL"); - } - if (size_validity == nullptr) { - throw CAPIStatusException("Pointer to validity size may not be NULL"); - } - auto est_size{ - query->query_->get_est_result_size_variable_nullable(field_name)}; - *size_off = est_size.fixed_; - *size_val = est_size.variable_; - *size_validity = est_size.validity_; - return TILEDB_OK; -} - -int32_t tiledb_query_get_fragment_num( - tiledb_ctx_t* ctx, const tiledb_query_t* query, uint32_t* num) { - if (sanity_check(ctx, query) == TILEDB_ERR) - return TILEDB_ERR; - - *num = query->query_->get_written_fragment_num(); - - return TILEDB_OK; -} - -int32_t tiledb_query_get_fragment_uri( - tiledb_ctx_t* ctx, - const tiledb_query_t* query, - uint64_t idx, - const char** uri) { - if (sanity_check(ctx, query) == TILEDB_ERR) - return TILEDB_ERR; - - *uri = query->query_->get_written_fragment_uri(idx).c_str(); - - return TILEDB_OK; -} - -int32_t tiledb_query_get_fragment_timestamp_range( - tiledb_ctx_t* ctx, - const tiledb_query_t* query, - uint64_t idx, - uint64_t* t1, - uint64_t* t2) { - if (sanity_check(ctx, query) == TILEDB_ERR) - return TILEDB_ERR; - - std::tie(*t1, *t2) = query->query_->get_written_fragment_timestamp_range(idx); - - return TILEDB_OK; -} - -int32_t tiledb_query_get_subarray_t( - tiledb_ctx_t* ctx, - const tiledb_query_t* query, - tiledb_subarray_t** subarray) { - if (sanity_check(ctx, query) == TILEDB_ERR) { - return TILEDB_ERR; - } - ensure_output_pointer_is_valid(subarray); - *subarray = make_handle(*(query->query_->subarray())); - return TILEDB_OK; -} - -int32_t tiledb_query_get_relevant_fragment_num( - tiledb_ctx_t* ctx, - const tiledb_query_t* query, - uint64_t* relevant_fragment_num) { - if (sanity_check(ctx, query) == TILEDB_ERR) - return TILEDB_ERR; - - *relevant_fragment_num = - query->query_->subarray()->relevant_fragments().relevant_fragments_size(); - - return TILEDB_OK; -} - -int32_t tiledb_query_add_update_value( - tiledb_ctx_t* ctx, - tiledb_query_t* query, - const char* field_name, - const void* update_value, - uint64_t update_value_size) { - // Sanity check - if (sanity_check(ctx, query) == TILEDB_ERR) { - return TILEDB_ERR; - } - - query->query_->add_update_value(field_name, update_value, update_value_size); - - // Success - return TILEDB_OK; -} - -/* ****************************** */ -/* QUERY CONDITION */ -/* ****************************** */ - -int32_t tiledb_query_condition_alloc( - tiledb_ctx_t* const ctx, tiledb_query_condition_t** const cond) { - // Create query condition struct - *cond = new (std::nothrow) tiledb_query_condition_t; - if (*cond == nullptr) { - auto st = Status_Error( - "Failed to create TileDB query condition object; Memory allocation " - "error"); - LOG_STATUS_NO_RETURN_VALUE(st); - save_error(ctx, st); - return TILEDB_OOM; - } - - // Create QueryCondition object - (*cond)->query_condition_ = new (std::nothrow) tiledb::sm::QueryCondition(); - if ((*cond)->query_condition_ == nullptr) { - auto st = Status_Error("Failed to allocate TileDB query condition object"); - LOG_STATUS_NO_RETURN_VALUE(st); - save_error(ctx, st); - delete *cond; - *cond = nullptr; - return TILEDB_OOM; - } - - // Success - return TILEDB_OK; -} - -capi_return_t tiledb_query_condition_alloc_set_membership( - const char* field_name, - const void* data, - uint64_t data_size, - const void* offsets, - uint64_t offsets_size, - tiledb_query_condition_op_t op, - tiledb_query_condition_t** cond) { - // Validate input arguments. The data, data_size, offsets, and offsets_size, - // and op arguments are validated in the QueryCondition constructor so - // there's no need to validate them here. - if (field_name == nullptr) { - throw api::CAPIStatusException( - "QueryCondition field name must not be nullptr"); - } - ensure_output_pointer_is_valid(cond); - - // Create query condition struct - *cond = new tiledb_query_condition_t; - if (*cond == nullptr) { - throw api::CAPIStatusException( - "Failed to create TileDB query condition " - "object; Memory allocation error"); - } - - // Create QueryCondition object - (*cond)->query_condition_ = new tiledb::sm::QueryCondition( - field_name, - data, - data_size, - offsets, - offsets_size, - static_cast(op)); - if ((*cond)->query_condition_ == nullptr) { - delete *cond; - throw api::CAPIStatusException( - "Failed to allocate TileDB query condition object"); - } - - return TILEDB_OK; -} - -void tiledb_query_condition_free(tiledb_query_condition_t** cond) { - if (cond != nullptr && *cond != nullptr) { - delete (*cond)->query_condition_; - delete *cond; - *cond = nullptr; - } -} - -int32_t tiledb_query_condition_init( - tiledb_ctx_t* const ctx, - tiledb_query_condition_t* const cond, - const char* const attribute_name, - const void* const condition_value, - const uint64_t condition_value_size, - const tiledb_query_condition_op_t op) { - if (sanity_check(ctx, cond) == TILEDB_ERR) { - return TILEDB_ERR; - } - - // Initialize the QueryCondition object - auto st = cond->query_condition_->init( - std::string(attribute_name), - condition_value, - condition_value_size, - static_cast(op)); - if (!st.ok()) { - LOG_STATUS_NO_RETURN_VALUE(st); - save_error(ctx, st); - return TILEDB_ERR; - } - - // Success - return TILEDB_OK; -} - -int32_t tiledb_query_condition_combine( - tiledb_ctx_t* const ctx, - const tiledb_query_condition_t* const left_cond, - const tiledb_query_condition_t* const right_cond, - const tiledb_query_condition_combination_op_t combination_op, - tiledb_query_condition_t** const combined_cond) { - // Sanity check - if (sanity_check(ctx, left_cond) == TILEDB_ERR || - (combination_op != TILEDB_NOT && - sanity_check(ctx, right_cond) == TILEDB_ERR) || - (combination_op == TILEDB_NOT && right_cond != nullptr)) - return TILEDB_ERR; - - // Create the combined query condition struct - *combined_cond = new (std::nothrow) tiledb_query_condition_t; - if (*combined_cond == nullptr) { - auto st = Status_Error( - "Failed to create TileDB query condition object; Memory allocation " - "error"); - LOG_STATUS_NO_RETURN_VALUE(st); - save_error(ctx, st); - return TILEDB_OOM; - } - - // Create the combined QueryCondition object - (*combined_cond)->query_condition_ = - new (std::nothrow) tiledb::sm::QueryCondition(); - if ((*combined_cond)->query_condition_ == nullptr) { - auto st = Status_Error("Failed to allocate TileDB query condition object"); - LOG_STATUS_NO_RETURN_VALUE(st); - save_error(ctx, st); - delete *combined_cond; - *combined_cond = nullptr; - return TILEDB_OOM; - } - - if (combination_op == TILEDB_NOT) { - if (SAVE_ERROR_CATCH( - ctx, - left_cond->query_condition_->negate( - static_cast( - combination_op), - (*combined_cond)->query_condition_))) { - delete (*combined_cond)->query_condition_; - delete *combined_cond; - return TILEDB_ERR; - } - } else { - if (SAVE_ERROR_CATCH( - ctx, - left_cond->query_condition_->combine( - *right_cond->query_condition_, - static_cast( - combination_op), - (*combined_cond)->query_condition_))) { - delete (*combined_cond)->query_condition_; - delete *combined_cond; - return TILEDB_ERR; - } - } - - return TILEDB_OK; -} - -int32_t tiledb_query_condition_negate( - tiledb_ctx_t* const ctx, - const tiledb_query_condition_t* const cond, - tiledb_query_condition_t** const negated_cond) { - return api::tiledb_query_condition_combine( - ctx, cond, nullptr, TILEDB_NOT, negated_cond); -} - -capi_return_t tiledb_query_condition_set_use_enumeration( - tiledb_ctx_t* ctx, - const tiledb_query_condition_t* cond, - int use_enumeration) { - if (sanity_check(ctx, cond) == TILEDB_ERR) { - return TILEDB_ERR; - } - - cond->query_condition_->set_use_enumeration( - use_enumeration != 0 ? true : false); - return TILEDB_OK; -} - /* ****************************** */ /* ARRAY */ /* ****************************** */ @@ -1545,9 +677,7 @@ int32_t tiledb_serialize_array_schema_evolution( tiledb_serialization_type_t serialize_type, int32_t client_side, tiledb_buffer_t** buffer) { - // Sanity check - if (sanity_check(ctx, array_schema_evolution) == TILEDB_ERR) - return TILEDB_ERR; + ensure_handle_is_valid(array_schema_evolution); auto buf = make_handle( ctx->resources().serialization_memory_tracker()); @@ -1555,7 +685,7 @@ int32_t tiledb_serialize_array_schema_evolution( if (SAVE_ERROR_CATCH( ctx, tiledb::sm::serialization::array_schema_evolution_serialize( - array_schema_evolution->array_schema_evolution_, + array_schema_evolution->array_schema_evolution().get(), (tiledb::sm::SerializationType)serialize_type, buf->buffer(), client_side))) { @@ -1574,35 +704,27 @@ int32_t tiledb_deserialize_array_schema_evolution( tiledb_serialization_type_t serialize_type, int32_t, tiledb_array_schema_evolution_t** array_schema_evolution) { - // Sanity check - api::ensure_buffer_is_valid(buffer); - - // Create array schema struct - *array_schema_evolution = new (std::nothrow) tiledb_array_schema_evolution_t; - if (*array_schema_evolution == nullptr) { - auto st = - Status_Error("Failed to allocate TileDB array schema evolution object"); - LOG_STATUS_NO_RETURN_VALUE(st); - save_error(ctx, st); - return TILEDB_OOM; - } + ensure_output_pointer_is_valid(array_schema_evolution); auto memory_tracker = ctx->resources().create_memory_tracker(); memory_tracker->set_type(sm::MemoryTrackerType::SCHEMA_EVOLUTION); + tiledb::sm::ArraySchemaEvolution* ase_raw = nullptr; if (SAVE_ERROR_CATCH( ctx, tiledb::sm::serialization::array_schema_evolution_deserialize( - &((*array_schema_evolution)->array_schema_evolution_), + &ase_raw, ctx->config(), (tiledb::sm::SerializationType)serialize_type, buffer->buffer(), memory_tracker))) { - delete *array_schema_evolution; - *array_schema_evolution = nullptr; return TILEDB_ERR; } + tdb_unique_ptr owned_ase(ase_raw); + *array_schema_evolution = make_handle( + shared_ptr(std::move(owned_ase))); + return TILEDB_OK; } @@ -1623,7 +745,7 @@ int32_t tiledb_serialize_query( if (SAVE_ERROR_CATCH( ctx, tiledb::sm::serialization::query_serialize( - query->query_, + query->query(), (tiledb::sm::SerializationType)serialize_type, client_side == 1, (*buffer_list)->buffer_list()))) { @@ -1651,7 +773,7 @@ int32_t tiledb_deserialize_query( (tiledb::sm::SerializationType)serialize_type, client_side == 1, nullptr, - query->query_, + query->query(), &ctx->resources().compute_tp(), ctx->resources().serialization_memory_tracker())); @@ -1690,29 +812,12 @@ int32_t tiledb_deserialize_query_and_array( throw; } - // Create query struct - *query = new (std::nothrow) tiledb_query_t; - if (*query == nullptr) { - break_handle(*array); - throw CAPIException( - "Failed to deserialize query and array; " - "TileDB query object allocation failed."); - } - // Create query - (*query)->query_ = new (std::nothrow) tiledb::sm::Query( + *query = make_handle( ctx->resources(), ctx->cancellation_source(), ctx->storage_manager(), (*array)->array()); - if ((*query)->query_ == nullptr) { - delete *query; - *query = nullptr; - break_handle(*array); - throw CAPIException( - "Failed to deserialize query and array; " - "TileDB query object allocation failed."); - } try { throw_if_not_ok(tiledb::sm::serialization::query_deserialize( @@ -1720,12 +825,11 @@ int32_t tiledb_deserialize_query_and_array( (tiledb::sm::SerializationType)serialize_type, client_side == 1, nullptr, - (*query)->query_, + (*query)->query(), &ctx->resources().compute_tp(), ctx->resources().serialization_memory_tracker())); } catch (...) { - delete *query; - *query = nullptr; + break_handle(*query); break_handle(*array); throw; } @@ -1954,7 +1058,7 @@ int32_t tiledb_serialize_query_est_result_sizes( if (SAVE_ERROR_CATCH( ctx, tiledb::sm::serialization::query_est_result_size_serialize( - query->query_, + query->query(), (tiledb::sm::SerializationType)serialize_type, client_side == 1, buf->buffer()))) { @@ -1980,7 +1084,7 @@ int32_t tiledb_deserialize_query_est_result_sizes( api::ensure_buffer_is_valid(buffer); throw_if_not_ok(tiledb::sm::serialization::query_est_result_size_deserialize( - query->query_, + query->query(), (tiledb::sm::SerializationType)serialize_type, client_side == 1, buffer->buffer())); @@ -2294,128 +1398,70 @@ int32_t tiledb_query_get_status_details( // Currently only one detailed reason. Retrieve it and set to user struct. tiledb_query_status_details_reason_t incomplete_reason = - (tiledb_query_status_details_reason_t) - query->query_->status_incomplete_reason(); + (tiledb_query_status_details_reason_t)query->query() + ->status_incomplete_reason(); status->incomplete_reason = incomplete_reason; return TILEDB_OK; } int32_t tiledb_consolidation_plan_create_with_mbr( - tiledb_ctx_t* ctx, tiledb_array_t* array, uint64_t fragment_size, tiledb_consolidation_plan_t** consolidation_plan) { ensure_array_is_valid(array); + ensure_output_pointer_is_valid(consolidation_plan); - // Create consolidation plan struct - *consolidation_plan = new (std::nothrow) tiledb_consolidation_plan_t; - if (*consolidation_plan == nullptr) { - auto st = Status_Error( - "Failed to create TileDB consolidation plan object; Memory allocation " - "error"); - LOG_STATUS_NO_RETURN_VALUE(st); - save_error(ctx, st); - return TILEDB_OOM; - } - - // Allocate a consolidation plan object - try { - (*consolidation_plan)->consolidation_plan_ = - make_shared( - HERE(), array->array(), fragment_size); - } catch (std::bad_alloc&) { - auto st = Status_Error( - "Failed to create TileDB consolidation plan object; Memory allocation " - "error"); - delete *consolidation_plan; - *consolidation_plan = nullptr; - LOG_STATUS_NO_RETURN_VALUE(st); - save_error(ctx, st); - return TILEDB_OOM; - } + *consolidation_plan = make_handle( + std::in_place, array->array(), fragment_size); return TILEDB_OK; } void tiledb_consolidation_plan_free( tiledb_consolidation_plan_t** consolidation_plan) { - if (consolidation_plan != nullptr && *consolidation_plan != nullptr) { - delete *consolidation_plan; - *consolidation_plan = nullptr; - } + break_handle(*consolidation_plan); } int32_t tiledb_consolidation_plan_get_num_nodes( - tiledb_ctx_t* ctx, - tiledb_consolidation_plan_t* consolidation_plan, - uint64_t* num_nodes) { - if (sanity_check(ctx, consolidation_plan) == TILEDB_ERR) { - return TILEDB_ERR; - } + tiledb_consolidation_plan_t* consolidation_plan, uint64_t* num_nodes) { + ensure_handle_is_valid(consolidation_plan); - *num_nodes = consolidation_plan->consolidation_plan_->get_num_nodes(); + *num_nodes = consolidation_plan->consolidation_plan().get_num_nodes(); return TILEDB_OK; } int32_t tiledb_consolidation_plan_get_num_fragments( - tiledb_ctx_t* ctx, tiledb_consolidation_plan_t* consolidation_plan, uint64_t node_index, - uint64_t* num_fragments) { - if (sanity_check(ctx, consolidation_plan) == TILEDB_ERR) { - return TILEDB_ERR; - } + uint64_t* num_fragments) { + ensure_handle_is_valid(consolidation_plan); - try { - *num_fragments = - consolidation_plan->consolidation_plan_->get_num_fragments(node_index); - } catch (StatusException& e) { - auto st = Status_Error(e.what()); - LOG_STATUS_NO_RETURN_VALUE(st); - save_error(ctx, st); - return TILEDB_ERR; - } + *num_fragments = + consolidation_plan->consolidation_plan().get_num_fragments(node_index); return TILEDB_OK; } int32_t tiledb_consolidation_plan_get_fragment_uri( - tiledb_ctx_t* ctx, tiledb_consolidation_plan_t* consolidation_plan, uint64_t node_index, uint64_t fragment_index, const char** uri) { - if (sanity_check(ctx, consolidation_plan) == TILEDB_ERR) { - return TILEDB_ERR; - } + ensure_handle_is_valid(consolidation_plan); - try { - *uri = consolidation_plan->consolidation_plan_->get_fragment_uri( - node_index, fragment_index); - } catch (StatusException& e) { - auto st = Status_Error(e.what()); - LOG_STATUS_NO_RETURN_VALUE(st); - save_error(ctx, st); - return TILEDB_ERR; - } + *uri = consolidation_plan->consolidation_plan().get_fragment_uri( + node_index, fragment_index); return TILEDB_OK; } int32_t tiledb_consolidation_plan_dump_json_str( - tiledb_ctx_t* ctx, - const tiledb_consolidation_plan_t* consolidation_plan, - char** out) { - if (out == nullptr) { - return TILEDB_ERR; - } - - if (sanity_check(ctx, consolidation_plan) == TILEDB_ERR) { - return TILEDB_ERR; - } + const tiledb_consolidation_plan_t* consolidation_plan, char** out) { + ensure_handle_is_valid(consolidation_plan); + ensure_output_pointer_is_valid(out); - std::string str = consolidation_plan->consolidation_plan_->dump(); + std::string str = consolidation_plan->consolidation_plan().dump(); *out = static_cast(std::malloc(str.size() + 1)); if (*out == nullptr) { @@ -2550,457 +1596,6 @@ CAPI_INTERFACE(as_built_dump, tiledb_string_t** out) { return api_entry_plain(out); } -/* ********************************* */ -/* SCHEMA EVOLUTION */ -/* ********************************* */ - -CAPI_INTERFACE( - array_schema_evolution_alloc, - tiledb_ctx_t* ctx, - tiledb_array_schema_evolution_t** array_schema_evolution) { - return api_entry( - ctx, array_schema_evolution); -} - -CAPI_INTERFACE_VOID( - array_schema_evolution_free, - tiledb_array_schema_evolution_t** array_schema_evolution) { - return api_entry_void( - array_schema_evolution); -} - -CAPI_INTERFACE( - array_schema_evolution_add_attribute, - tiledb_ctx_t* ctx, - tiledb_array_schema_evolution_t* array_schema_evolution, - tiledb_attribute_t* attr) { - return api_entry( - ctx, array_schema_evolution, attr); -} - -CAPI_INTERFACE( - array_schema_evolution_drop_attribute, - tiledb_ctx_t* ctx, - tiledb_array_schema_evolution_t* array_schema_evolution, - const char* attribute_name) { - return api_entry( - ctx, array_schema_evolution, attribute_name); -} - -CAPI_INTERFACE( - array_schema_evolution_add_enumeration, - tiledb_ctx_t* ctx, - tiledb_array_schema_evolution_t* array_schema_evolution, - tiledb_enumeration_t* enmr) { - return api_entry( - ctx, array_schema_evolution, enmr); -} - -CAPI_INTERFACE( - array_schema_evolution_extend_enumeration, - tiledb_ctx_t* ctx, - tiledb_array_schema_evolution_t* array_schema_evolution, - tiledb_enumeration_t* enmr) { - return api_entry< - tiledb::api::tiledb_array_schema_evolution_extend_enumeration>( - ctx, array_schema_evolution, enmr); -} - -CAPI_INTERFACE( - array_schema_evolution_drop_enumeration, - tiledb_ctx_t* ctx, - tiledb_array_schema_evolution_t* array_schema_evolution, - const char* enumeration_name) { - return api_entry( - ctx, array_schema_evolution, enumeration_name); -} - -CAPI_INTERFACE( - array_schema_evolution_expand_current_domain, - tiledb_ctx_t* ctx, - tiledb_array_schema_evolution_t* array_schema_evolution, - tiledb_current_domain_t* expanded_domain) { - return api_entry< - tiledb::api::tiledb_array_schema_evolution_expand_current_domain>( - ctx, array_schema_evolution, expanded_domain); -} - -CAPI_INTERFACE( - array_schema_evolution_set_timestamp_range, - tiledb_ctx_t* ctx, - tiledb_array_schema_evolution_t* array_schema_evolution, - uint64_t lo, - uint64_t hi) { - return api_entry< - tiledb::api::tiledb_array_schema_evolution_set_timestamp_range>( - ctx, array_schema_evolution, lo, hi); -} - -/* ****************************** */ -/* QUERY */ -/* ****************************** */ - -CAPI_INTERFACE( - query_alloc, - tiledb_ctx_t* ctx, - tiledb_array_t* array, - tiledb_query_type_t query_type, - tiledb_query_t** query) { - return api_entry( - ctx, array, query_type, query); -} - -CAPI_INTERFACE( - query_get_stats, - tiledb_ctx_t* ctx, - tiledb_query_t* query, - char** stats_json) { - return api_entry(ctx, query, stats_json); -} - -CAPI_INTERFACE( - query_set_config, - tiledb_ctx_t* ctx, - tiledb_query_t* query, - tiledb_config_t* config) { - return api_entry(ctx, query, config); -} - -CAPI_INTERFACE( - query_get_config, - tiledb_ctx_t* ctx, - tiledb_query_t* query, - tiledb_config_t** config) { - return api_entry(ctx, query, config); -} - -CAPI_INTERFACE( - query_set_subarray_t, - tiledb_ctx_t* ctx, - tiledb_query_t* query, - const tiledb_subarray_t* subarray) { - return api_entry( - ctx, query, subarray); -} - -CAPI_INTERFACE( - query_set_data_buffer, - tiledb_ctx_t* ctx, - tiledb_query_t* query, - const char* name, - void* buffer, - uint64_t* buffer_size) { - return api_entry( - ctx, query, name, buffer, buffer_size); -} - -CAPI_INTERFACE( - query_set_offsets_buffer, - tiledb_ctx_t* ctx, - tiledb_query_t* query, - const char* name, - uint64_t* buffer_offsets, - uint64_t* buffer_offsets_size) { - return api_entry( - ctx, query, name, buffer_offsets, buffer_offsets_size); -} - -CAPI_INTERFACE( - query_set_validity_buffer, - tiledb_ctx_t* ctx, - tiledb_query_t* query, - const char* name, - uint8_t* buffer_validity, - uint64_t* buffer_validity_size) { - return api_entry( - ctx, query, name, buffer_validity, buffer_validity_size); -} - -CAPI_INTERFACE( - query_get_data_buffer, - tiledb_ctx_t* ctx, - tiledb_query_t* query, - const char* name, - void** buffer, - uint64_t** buffer_size) { - return api_entry( - ctx, query, name, buffer, buffer_size); -} - -CAPI_INTERFACE( - query_get_offsets_buffer, - tiledb_ctx_t* ctx, - tiledb_query_t* query, - const char* name, - uint64_t** buffer, - uint64_t** buffer_size) { - return api_entry( - ctx, query, name, buffer, buffer_size); -} - -CAPI_INTERFACE( - query_get_validity_buffer, - tiledb_ctx_t* ctx, - tiledb_query_t* query, - const char* name, - uint8_t** buffer, - uint64_t** buffer_size) { - return api_entry( - ctx, query, name, buffer, buffer_size); -} - -CAPI_INTERFACE( - query_set_layout, - tiledb_ctx_t* ctx, - tiledb_query_t* query, - tiledb_layout_t layout) { - return api_entry(ctx, query, layout); -} - -CAPI_INTERFACE( - query_set_condition, - tiledb_ctx_t* const ctx, - tiledb_query_t* const query, - const tiledb_query_condition_t* const cond) { - return api_entry(ctx, query, cond); -} - -CAPI_INTERFACE(query_finalize, tiledb_ctx_t* ctx, tiledb_query_t* query) { - return api_entry(ctx, query); -} - -CAPI_INTERFACE( - query_submit_and_finalize, tiledb_ctx_t* ctx, tiledb_query_t* query) { - return api_entry(ctx, query); -} - -CAPI_INTERFACE_VOID(query_free, tiledb_query_t** query) { - return api_entry_void(query); -} - -CAPI_INTERFACE(query_submit, tiledb_ctx_t* ctx, tiledb_query_t* query) { - return api_entry(ctx, query); -} - -CAPI_INTERFACE( - query_has_results, - tiledb_ctx_t* ctx, - tiledb_query_t* query, - int32_t* has_results) { - return api_entry( - ctx, query, has_results); -} - -CAPI_INTERFACE( - query_get_status, - tiledb_ctx_t* ctx, - tiledb_query_t* query, - tiledb_query_status_t* status) { - return api_entry(ctx, query, status); -} - -CAPI_INTERFACE( - query_get_type, - tiledb_ctx_t* ctx, - tiledb_query_t* query, - tiledb_query_type_t* query_type) { - return api_entry(ctx, query, query_type); -} - -CAPI_INTERFACE( - query_get_layout, - tiledb_ctx_t* ctx, - tiledb_query_t* query, - tiledb_layout_t* query_layout) { - return api_entry( - ctx, query, query_layout); -} - -CAPI_INTERFACE( - query_get_array, - tiledb_ctx_t* ctx, - tiledb_query_t* query, - tiledb_array_t** array) { - return api_entry(ctx, query, array); -} - -CAPI_INTERFACE( - query_get_est_result_size, - tiledb_ctx_t* ctx, - const tiledb_query_t* query, - const char* name, - uint64_t* size) { - return api_entry( - ctx, query, name, size); -} - -CAPI_INTERFACE( - query_get_est_result_size_var, - tiledb_ctx_t* ctx, - const tiledb_query_t* query, - const char* name, - uint64_t* size_off, - uint64_t* size_val) { - return api_entry( - ctx, query, name, size_off, size_val); -} - -CAPI_INTERFACE( - query_get_est_result_size_nullable, - tiledb_ctx_t* ctx, - const tiledb_query_t* query, - const char* name, - uint64_t* size_val, - uint64_t* size_validity) { - return api_entry( - ctx, query, name, size_val, size_validity); -} - -CAPI_INTERFACE( - query_get_est_result_size_var_nullable, - tiledb_ctx_t* ctx, - const tiledb_query_t* query, - const char* name, - uint64_t* size_off, - uint64_t* size_val, - uint64_t* size_validity) { - return api_entry( - ctx, query, name, size_off, size_val, size_validity); -} - -CAPI_INTERFACE( - query_get_fragment_num, - tiledb_ctx_t* ctx, - const tiledb_query_t* query, - uint32_t* num) { - return api_entry(ctx, query, num); -} - -CAPI_INTERFACE( - query_get_fragment_uri, - tiledb_ctx_t* ctx, - const tiledb_query_t* query, - uint64_t idx, - const char** uri) { - return api_entry( - ctx, query, idx, uri); -} - -CAPI_INTERFACE( - query_get_fragment_timestamp_range, - tiledb_ctx_t* ctx, - const tiledb_query_t* query, - uint64_t idx, - uint64_t* t1, - uint64_t* t2) { - return api_entry( - ctx, query, idx, t1, t2); -} - -CAPI_INTERFACE( - query_get_subarray_t, - tiledb_ctx_t* ctx, - const tiledb_query_t* query, - tiledb_subarray_t** subarray) { - return api_entry( - ctx, query, subarray); -} - -CAPI_INTERFACE( - query_get_relevant_fragment_num, - tiledb_ctx_t* ctx, - const tiledb_query_t* query, - uint64_t* relevant_fragment_num) { - return api_entry( - ctx, query, relevant_fragment_num); -} - -/* ****************************** */ -/* QUERY CONDITION */ -/* ****************************** */ - -CAPI_INTERFACE( - query_condition_alloc, - tiledb_ctx_t* const ctx, - tiledb_query_condition_t** const cond) { - return api_entry(ctx, cond); -} - -CAPI_INTERFACE( - query_condition_alloc_set_membership, - tiledb_ctx_t* ctx, - const char* field_name, - const void* data, - uint64_t data_size, - const void* offsets, - uint64_t offsets_size, - tiledb_query_condition_op_t op, - tiledb_query_condition_t** cond) { - return api_entry_context< - tiledb::api::tiledb_query_condition_alloc_set_membership>( - ctx, field_name, data, data_size, offsets, offsets_size, op, cond); -} - -CAPI_INTERFACE_VOID(query_condition_free, tiledb_query_condition_t** cond) { - return api_entry_void(cond); -} - -CAPI_INTERFACE( - query_condition_init, - tiledb_ctx_t* const ctx, - tiledb_query_condition_t* const cond, - const char* const attribute_name, - const void* const condition_value, - const uint64_t condition_value_size, - const tiledb_query_condition_op_t op) { - return api_entry( - ctx, cond, attribute_name, condition_value, condition_value_size, op); -} - -CAPI_INTERFACE( - query_condition_combine, - tiledb_ctx_t* const ctx, - const tiledb_query_condition_t* const left_cond, - const tiledb_query_condition_t* const right_cond, - const tiledb_query_condition_combination_op_t combination_op, - tiledb_query_condition_t** const combined_cond) { - return api_entry( - ctx, left_cond, right_cond, combination_op, combined_cond); -} - -CAPI_INTERFACE( - query_condition_negate, - tiledb_ctx_t* const ctx, - const tiledb_query_condition_t* const cond, - tiledb_query_condition_t** const negated_cond) { - return api_entry( - ctx, cond, negated_cond); -} - -CAPI_INTERFACE( - query_condition_set_use_enumeration, - tiledb_ctx_t* const ctx, - const tiledb_query_condition_t* const cond, - int use_enumeration) { - return api_entry( - ctx, cond, use_enumeration); -} - -/* ****************************** */ -/* UPDATE CONDITION */ -/* ****************************** */ - -CAPI_INTERFACE( - query_add_update_value, - tiledb_ctx_t* ctx, - tiledb_query_t* query, - const char* field_name, - const void* update_value, - uint64_t update_value_size) { - return api_entry( - ctx, query, field_name, update_value, update_value_size); -} - /* ****************************** */ /* ARRAY CONSOLIDATION */ /* ****************************** */ @@ -3556,7 +2151,8 @@ CAPI_INTERFACE( tiledb_array_t* array, uint64_t fragment_size, tiledb_consolidation_plan_t** consolidation_plan) { - return api_entry( + return api_entry_context< + tiledb::api::tiledb_consolidation_plan_create_with_mbr>( ctx, array, fragment_size, consolidation_plan); } @@ -3571,7 +2167,8 @@ CAPI_INTERFACE( tiledb_ctx_t* ctx, tiledb_consolidation_plan_t* consolidation_plan, uint64_t* num_nodes) { - return api_entry( + return api_entry_context< + tiledb::api::tiledb_consolidation_plan_get_num_nodes>( ctx, consolidation_plan, num_nodes); } @@ -3581,7 +2178,8 @@ CAPI_INTERFACE( tiledb_consolidation_plan_t* consolidation_plan, uint64_t node_index, uint64_t* num_fragments) { - return api_entry( + return api_entry_context< + tiledb::api::tiledb_consolidation_plan_get_num_fragments>( ctx, consolidation_plan, node_index, num_fragments); } @@ -3592,7 +2190,8 @@ CAPI_INTERFACE( uint64_t node_index, uint64_t fragment_index, const char** uri) { - return api_entry( + return api_entry_context< + tiledb::api::tiledb_consolidation_plan_get_fragment_uri>( ctx, consolidation_plan, node_index, fragment_index, uri); } @@ -3601,7 +2200,8 @@ CAPI_INTERFACE( tiledb_ctx_t* ctx, const tiledb_consolidation_plan_t* consolidation_plan, char** out) { - return api_entry( + return api_entry_context< + tiledb::api::tiledb_consolidation_plan_dump_json_str>( ctx, consolidation_plan, out); } diff --git a/tiledb/sm/c_api/tiledb.h b/tiledb/sm/c_api/tiledb.h index 030469efbe2..4fba56dee79 100644 --- a/tiledb/sm/c_api/tiledb.h +++ b/tiledb/sm/c_api/tiledb.h @@ -75,6 +75,7 @@ #include "tiledb/api/c_api/group/group_api_external.h" #include "tiledb/api/c_api/object/object_api_external.h" #include "tiledb/api/c_api/query/query_api_external.h" +#include "tiledb/api/c_api/query_condition/query_condition_api_external.h" #include "tiledb/api/c_api/string/string_api_external.h" #include "tiledb/api/c_api/subarray/subarray_api_external.h" #include "tiledb/api/c_api/vfs/vfs_api_external.h" @@ -90,42 +91,6 @@ extern "C" { /* TILEDB ENUMS */ /* ****************************** */ -/** Query status. */ -typedef enum { -/** Helper macro for defining query status enums. */ -#define TILEDB_QUERY_STATUS_ENUM(id) TILEDB_##id -#include "tiledb_enum.h" -#undef TILEDB_QUERY_STATUS_ENUM -} tiledb_query_status_t; - -/** Query condition operator. */ -typedef enum { - /** Less-than operator */ - TILEDB_LT = 0, - /** Less-than-or-equal operator */ - TILEDB_LE = 1, - /** Greater-than operator */ - TILEDB_GT = 2, - /** Greater-than-or-equal operator */ - TILEDB_GE = 3, - /** Equal operator */ - TILEDB_EQ = 4, - /** Not-equal operator */ - TILEDB_NE = 5, - /** IN set membership operator. */ - TILEDB_IN = 6, - /** NOT IN set membership operator. */ - TILEDB_NOT_IN = 7, -} tiledb_query_condition_op_t; - -/** Query condition combination operator. */ -typedef enum { -/** Helper macro for defining query condition combination operator enums. */ -#define TILEDB_QUERY_CONDITION_COMBINATION_OP_ENUM(id) TILEDB_##id -#include "tiledb_enum.h" -#undef TILEDB_QUERY_CONDITION_COMBINATION_OP_ENUM -} tiledb_query_condition_combination_op_t; - /** MIME Type. */ typedef enum { /** Helper macro for defining MimeType enums. */ @@ -215,982 +180,8 @@ TILEDB_EXPORT void tiledb_version(int32_t* major, int32_t* minor, int32_t* rev) /* TILEDB TYPES */ /* ********************************* */ -/** A TileDB query condition object. */ -typedef struct tiledb_query_condition_t tiledb_query_condition_t; - /** A consolidation plan object. */ -typedef struct tiledb_consolidation_plan_t tiledb_consolidation_plan_t; - -/* ********************************* */ -/* QUERY */ -/* ********************************* */ - -/** - * Creates a TileDB query object. Note that the query object is associated - * with a specific array object. The query type (read or write) is inferred - * from the array object, which was opened with a specific query type. - * - * **Example:** - * - * @code{.c} - * tiledb_array_t* array; - * tiledb_array_alloc(ctx, "file:///my_array", &array); - * tiledb_array_open(ctx, array, TILEDB_WRITE); - * tiledb_query_t* query; - * tiledb_query_alloc(ctx, array, TILEDB_WRITE, &query); - * @endcode - * - * @param ctx The TileDB context. - * @param query The query object to be created. - * @param array An opened array object. - * @param query_type The query type. This must comply with the query type - * `array` was opened. - * @return `TILEDB_OK` for success and `TILEDB_OOM` or `TILEDB_ERR` for error. - */ -TILEDB_EXPORT int32_t tiledb_query_alloc( - tiledb_ctx_t* ctx, - tiledb_array_t* array, - tiledb_query_type_t query_type, - tiledb_query_t** query) TILEDB_NOEXCEPT; - -/** - * Retrieves the stats from a Query. - * - * **Example:** - * - * @code{.c} - * char* stats_json; - * tiledb_query_get_stats(ctx, query, &stats_json); - * // Use the string - * tiledb_stats_free_str(&stats_json); - * @endcode - * - * @param ctx The TileDB context. - * @param query The query object. - * @param stats_json The output json. The caller takes ownership - * of the c-string and must free it using tiledb_stats_free_str(). - * @return `TILEDB_OK` for success and `TILEDB_OOM` or `TILEDB_ERR` for error. - */ -TILEDB_EXPORT int32_t tiledb_query_get_stats( - tiledb_ctx_t* ctx, - tiledb_query_t* query, - char** stats_json) TILEDB_NOEXCEPT; - -/** - * Set the query config - * - * Setting the query config will also set the subarray configuration in order to - * maintain existing behavior. If you wish the subarray to have a different - * configuration than the query, set it after calling tiledb_query_set_config. - * - * Setting the configuration with this function overrides the following - * Query-level parameters only: - * - * - `sm.memory_budget` - * - `sm.memory_budget_var` - * - `sm.var_offsets.mode` - * - `sm.var_offsets.extra_element` - * - `sm.var_offsets.bitsize` - * - `sm.check_coord_dups` - * - `sm.check_coord_oob` - * - `sm.check_global_order` - * - `sm.dedup_coords` - */ -TILEDB_EXPORT int32_t tiledb_query_set_config( - tiledb_ctx_t* ctx, - tiledb_query_t* query, - tiledb_config_t* config) TILEDB_NOEXCEPT; - -/** - * Retrieves the config from a Query. - * - * **Example:** - * - * @code{.c} - * tiledb_config_t* config; - * tiledb_query_get_config(ctx, vfs, &config); - * // Make sure to free the retrieved config - * @endcode - * - * @param ctx The TileDB context. - * @param query The query object. - * @param config The config to be retrieved. - * @return `TILEDB_OK` for success and `TILEDB_OOM` or `TILEDB_ERR` for error. - */ -TILEDB_EXPORT int32_t tiledb_query_get_config( - tiledb_ctx_t* ctx, - tiledb_query_t* query, - tiledb_config_t** config) TILEDB_NOEXCEPT; - -/** - * Indicates that the query will write or read a subarray, and provides - * the appropriate information. - * - * **Example:** - * - * The following sets a 2D subarray [0,10], [20, 30] to the query. - * - * @code{.c} - * tiledb_subarray_t *subarray; - * tiledb_subarray_alloc(ctx, array, &subarray); - * uint64_t subarray_v[] = { 0, 10, 20, 30}; - * tiledb_subarray_set_subarray(ctx, subarray, subarray_v); - * tiledb_query_set_subarray_t(ctx, query, subarray); - * @endcode - * - * @param ctx The TileDB context. - * @param query The TileDB query. - * @param subarray The subarray by which the array read/write will be - * constrained. For the case of writes, this is meaningful only - * for dense arrays. - * @return `TILEDB_OK` for success or `TILEDB_ERR` for error. - * - * @note This will error if the query is already initialized. - * - * @note This will error for writes to sparse arrays. - */ -TILEDB_EXPORT int32_t tiledb_query_set_subarray_t( - tiledb_ctx_t* ctx, - tiledb_query_t* query, - const tiledb_subarray_t* subarray) TILEDB_NOEXCEPT; - -/** - * Sets the buffer for an attribute/dimension to a query, which will - * either hold the values to be written (if it is a write query), or will hold - * the results from a read query. - * - * The caller owns the `buffer` provided and is responsible for freeing the - * memory associated with it. For writes, the buffer holds values to be written - * which can be freed at any time after query completion. For reads, the buffer - * is allocated by the caller and will contain data read by the query after - * completion. The freeing of this memory is up to the caller once they are done - * referencing the read data. - * - * **Example:** - * - * @code{.c} - * int32_t a1[100]; - * uint64_t a1_size = sizeof(a1); - * tiledb_query_set_data_buffer(ctx, query, "a1", a1, &a1_size); - * @endcode - * - * @param ctx The TileDB context. - * @param query The TileDB query. - * @param name The attribute/dimension to set the buffer for. Note that - * zipped coordinates have special name `TILEDB_COORDS`. - * @param buffer The buffer that either have the input data to be written, - * or will hold the data to be read. - * @param buffer_size In the case of writes, this is the size of `buffer` - * in bytes. In the case of reads, this initially contains the allocated - * size of `buffer`, but after the termination of the query - * it will contain the size of the useful (read) data in `buffer`. - * @return `TILEDB_OK` for success and `TILEDB_ERR` for error. - */ -TILEDB_EXPORT int32_t tiledb_query_set_data_buffer( - tiledb_ctx_t* ctx, - tiledb_query_t* query, - const char* name, - void* buffer, - uint64_t* buffer_size) TILEDB_NOEXCEPT; - -/** - * Sets the starting offsets of each cell value in the data buffer. - * - * The caller owns the `buffer` provided and is responsible for freeing the - * memory associated with it. For writes, the buffer holds offsets to be written - * which can be freed at any time after query completion. For reads, the buffer - * is allocated by the caller and will contain offset data read by the query - * after completion. The freeing of this memory is up to the caller once they - * are done referencing the read data. - * - * **Example:** - * - * @code{.c} - * uint64_t a1[100]; - * uint64_t a1_size = sizeof(a1); - * tiledb_query_set_offsets_buffer(ctx, query, "a1", a1, &a1_size); - * @endcode - * - * @param ctx The TileDB context. - * @param query The TileDB query. - * @param name The attribute/dimension to set the buffer for. Note that - * zipped coordinates have special name `TILEDB_COORDS`. - * @param buffer This buffer holds the starting offsets - * of each cell value in `buffer_val`. - * @param buffer_size In the case of writes, it is the size of `buffer_off` - * in bytes. In the case of reads, this initially contains the allocated - * size of `buffer_off`, but after the *end of the query* - * (`tiledb_query_submit`) it will contain the size of the useful (read) - * data in `buffer_off`. - * @return `TILEDB_OK` for success and `TILEDB_ERR` for error. - */ -TILEDB_EXPORT int32_t tiledb_query_set_offsets_buffer( - tiledb_ctx_t* ctx, - tiledb_query_t* query, - const char* name, - uint64_t* buffer, - uint64_t* buffer_size) TILEDB_NOEXCEPT; - -/** - * Sets the validity byte map that has exactly one value for each value in the - * data buffer. - * - * The caller owns the `buffer` provided and is responsible for freeing the - * memory associated with it. For writes, the buffer holds validity values to be - * written which can be freed at any time after query completion. For reads, the - * buffer is allocated by the caller and will contain the validity map read by - * the query after completion. The freeing of this memory is up to the caller - * once they are done referencing the read data. - * - * **Example:** - * - * @code{.c} - * uint8_t a1[100]; - * uint64_t a1_size = sizeof(a1); - * tiledb_query_set_validity_buffer(ctx, query, "a1", a1, &a1_size); - * @endcode - * - * @param ctx The TileDB context. - * @param query The TileDB query. - * @param name The attribute/dimension to set the buffer for. Note that - * zipped coordinates have special name `TILEDB_COORDS`. - * @param buffer The validity byte map that has exactly - * one value for each value in `buffer`. - * @param buffer_size In the case of writes, this is the - * size of `buffer_validity_bytemap` in bytes. In the case of reads, - * this initially contains the allocated size of `buffer_validity_bytemap`, - * but after the termination of the query it will contain the size of the - * useful (read) data in `buffer_validity_bytemap`. - * @return `TILEDB_OK` for success and `TILEDB_ERR` for error. - */ -TILEDB_EXPORT int32_t tiledb_query_set_validity_buffer( - tiledb_ctx_t* ctx, - tiledb_query_t* query, - const char* name, - uint8_t* buffer, - uint64_t* buffer_size) TILEDB_NOEXCEPT; - -/** - * Gets the buffer of a fixed-sized attribute/dimension from a query. If the - * buffer has not been set, then `buffer` is set to `nullptr`. - * - * **Example:** - * - * @code{.c} - * int* a1; - * uint64_t* a1_size; - * tiledb_query_get_data_buffer(ctx, query, "a1", &a1, &a1_size); - * @endcode - * - * @param ctx The TileDB context. - * @param query The TileDB query. - * @param name The attribute/dimension to get the buffer for. Note that the - * zipped coordinates have special name `TILEDB_COORDS`. - * @param buffer The buffer to retrieve. - * @param buffer_size A pointer to the size of the buffer. Note that this is - * a double pointer and returns the original variable address from - * `set_buffer`. - * @return `TILEDB_OK` for success and `TILEDB_ERR` for error. - */ -TILEDB_EXPORT int32_t tiledb_query_get_data_buffer( - tiledb_ctx_t* ctx, - tiledb_query_t* query, - const char* name, - void** buffer, - uint64_t** buffer_size) TILEDB_NOEXCEPT; - -/** - * Gets the starting offsets of each cell value in the data buffer. - * - * **Example:** - * - * @code{.c} - * int* a1; - * uint64_t* a1_size; - * tiledb_query_get_offsets_buffer(ctx, query, "a1", &a1, &a1_size); - * @endcode - * - * @param ctx The TileDB context. - * @param query The TileDB query. - * @param name The attribute/dimension to get the buffer for. Note that the - * zipped coordinates have special name `TILEDB_COORDS`. - * @param buffer The buffer to retrieve. - * @param buffer_size A pointer to the size of the buffer. Note that this is - * a double pointer and returns the original variable address from - * `set_buffer`. - * @return `TILEDB_OK` for success and `TILEDB_ERR` for error. - */ -TILEDB_EXPORT int32_t tiledb_query_get_offsets_buffer( - tiledb_ctx_t* ctx, - tiledb_query_t* query, - const char* name, - uint64_t** buffer, - uint64_t** buffer_size) TILEDB_NOEXCEPT; - -/** - * Gets the validity byte map that has exactly one value for each value in the - * data buffer. - * - * **Example:** - * - * @code{.c} - * int* a1; - * uint64_t* a1_size; - * tiledb_query_get_validity_buffer(ctx, query, "a1", &a1, &a1_size); - * @endcode - * - * @param ctx The TileDB context. - * @param query The TileDB query. - * @param name The attribute/dimension to get the buffer for. Note that the - * zipped coordinates have special name `TILEDB_COORDS`. - * @param buffer The buffer to retrieve. - * @param buffer_size A pointer to the size of the buffer. Note that this is - * a double pointer and returns the original variable address from - * `set_buffer`. - * @return `TILEDB_OK` for success and `TILEDB_ERR` for error. - */ -TILEDB_EXPORT int32_t tiledb_query_get_validity_buffer( - tiledb_ctx_t* ctx, - tiledb_query_t* query, - const char* name, - uint8_t** buffer, - uint64_t** buffer_size) TILEDB_NOEXCEPT; - -/** - * Sets the layout of the cells to be written or read. - * - * **Example:** - * - * @code{.c} - * tiledb_query_set_layout(ctx, query, TILEDB_ROW_MAJOR); - * @endcode - * - * @param ctx The TileDB context. - * @param query The TileDB query. - * @param layout For a write query, this specifies the order of the cells - * provided by the user in the buffers. For a read query, this specifies - * the order of the cells that will be retrieved as results and stored - * in the user buffers. The layout can be one of the following: - * - `TILEDB_COL_MAJOR`: - * This means column-major order with respect to the subarray. - * - `TILEDB_ROW_MAJOR`: - * This means row-major order with respect to the subarray. - * - `TILEDB_GLOBAL_ORDER`: - * This means that cells are stored or retrieved in the array global - * cell order. - * - `TILEDB_UNORDERED`: - * This is applicable only to reads and writes for sparse arrays, or for - * sparse writes to dense arrays. For writes, it specifies that the cells - * are unordered and, hence, TileDB must sort the cells in the global cell - * order prior to writing. For reads, TileDB will return the cells without - * any particular order, which will often lead to better performance. - * * @return `TILEDB_OK` for success and `TILEDB_ERR` for error. - */ -TILEDB_EXPORT int32_t tiledb_query_set_layout( - tiledb_ctx_t* ctx, - tiledb_query_t* query, - tiledb_layout_t layout) TILEDB_NOEXCEPT; - -/** - * Sets the query condition to be applied on a read. - * - * **Example:** - * - * @code{.c} - * tiledb_query_condition_t* query_condition; - * tiledb_query_condition_alloc(ctx, &query_condition); - * uint32_t value = 5; - * tiledb_query_condition_init( - * ctx, query_condition, "longitude", &value, sizeof(value), TILEDB_LT); - * tiledb_query_set_condition(ctx, query, query_condition); - * @endcode - * - * @param ctx The TileDB context. - * @param query The TileDB query. - * @param cond The TileDB query condition. - */ -TILEDB_EXPORT int32_t tiledb_query_set_condition( - tiledb_ctx_t* ctx, - tiledb_query_t* query, - const tiledb_query_condition_t* cond) TILEDB_NOEXCEPT; - -/** - * Flushes all internal state of a query object and finalizes the query. - * This is applicable only to global layout writes. It has no effect for - * any other query type. - * - * **Example:** - * - * @code{.c} - * tiledb_query_t* query; - * // ... Your code here ... // - * tiledb_query_finalize(ctx, query); - * @endcode - * - * @param ctx The TileDB context. - * @param query The query object to be flushed. - * @return `TILEDB_OK` for success and `TILEDB_ERR` for error. - */ -TILEDB_EXPORT int32_t -tiledb_query_finalize(tiledb_ctx_t* ctx, tiledb_query_t* query) TILEDB_NOEXCEPT; - -/** - * Submits and finalizes the query. - * This is applicable only to global layout writes. The function will - * error out if called on a query with non global layout. - * Its purpose is to submit the final chunk (partial or full tile) in - * a global order write query. - * `tiledb_query_submit_and_finalize` drops the tile alignment restriction - * of the buffers (i.e. compared to the regular global layout submit call) - * given the last chunk of a global order write is most frequently smaller - * in size than a tile. - * - * **Example:** - * - * @code{.c} - * tiledb_query_t* query; - * while (stop_condition) { - * tiledb_query_set_buffer(ctx, query, attr, tile_aligned_buffer, &size); - * tiledb_query_submit(ctx, query); - * } - * tiledb_query_set_buffer(ctx, query, attr, final_chunk, &size); - * tiledb_query_submit_and_finalize(ctx, query); - * @endcode - * - * @param ctx The TileDB context. - * @param query The query object to be flushed. - * @return `TILEDB_OK` for success and `TILEDB_ERR` for error. - */ -TILEDB_EXPORT int32_t tiledb_query_submit_and_finalize( - tiledb_ctx_t* ctx, tiledb_query_t* query) TILEDB_NOEXCEPT; - -/** - * Frees a TileDB query object. - * - * **Example:** - * - * @code{.c} - * tiledb_query_free(&query); - * @endcode - * - * @param query The query object to be deleted. - */ -TILEDB_EXPORT void tiledb_query_free(tiledb_query_t** query) TILEDB_NOEXCEPT; - -/** - * Submits a TileDB query. - * - * **Example:** - * - * @code{.c} - * tiledb_query_submit(ctx, query); - * @endcode - * - * @param ctx The TileDB context. - * @param query The query to be submitted. - * @return `TILEDB_OK` for success and `TILEDB_ERR` for error. - * - * @note `tiledb_query_finalize` must be invoked after finish writing in - * global layout (via repeated invocations of `tiledb_query_submit`), - * in order to flush any internal state. - * - * @note For the case of reads, if the returned status is `TILEDB_INCOMPLETE`, - * TileDB could not fit the entire result in the user's buffers. In this - * case, the user should consume the read results (if any), optionally - * reset the buffers with `tiledb_query_set_buffer`, and then resubmit the - * query until the status becomes `TILEDB_COMPLETED`. If all buffer sizes - * after the termination of this function become 0, then this means that - * **no** useful data was read into the buffers, implying that larger - * buffers are needed for the query to proceed. In this case, the users - * must reallocate their buffers (increasing their size), reset the buffers - * with `tiledb_query_set_buffer`, and resubmit the query. - */ -TILEDB_EXPORT int32_t -tiledb_query_submit(tiledb_ctx_t* ctx, tiledb_query_t* query) TILEDB_NOEXCEPT; - -/** - * Checks if the query has returned any results. Applicable only to - * read queries; it sets `has_results` to `0 in the case of writes. - * - * **Example:** - * - * @code{.c} - * int32_t has_results; - * tiledb_query_has_results(ctx, query, &has_results); - * @endcode - * - * @param ctx The TileDB context. - * @param query The query. - * @param has_results Set to `1` if the query returned results and `0` - * otherwise. - * @return `TILEDB_OK` upon success, and `TILEDB_ERR` upon error. - */ -TILEDB_EXPORT int32_t tiledb_query_has_results( - tiledb_ctx_t* ctx, - tiledb_query_t* query, - int32_t* has_results) TILEDB_NOEXCEPT; - -/** - * Retrieves the status of a query. - * - * **Example:** - * - * @code{.c} - * tiledb_query_status_t status; - * tiledb_query_get_status(ctx, query, &status); - * @endcode - * - * @param ctx The TileDB context. - * @param query The query. - * @param status The query status to be retrieved. - * @return `TILEDB_OK` upon success, and `TILEDB_ERR` upon error. - */ -TILEDB_EXPORT int32_t tiledb_query_get_status( - tiledb_ctx_t* ctx, - tiledb_query_t* query, - tiledb_query_status_t* status) TILEDB_NOEXCEPT; - -/** - * Retrieves the query type. - * - * **Example:** - * - * @code{.c} - * tiledb_query_type_t query_type; - * tiledb_query_get_status(ctx, query, &query_type); - * @endcode - * - * @param ctx The TileDB context. - * @param query The query. - * @param query_type The query type to be retrieved. - * @return `TILEDB_OK` upon success, and `TILEDB_ERR` upon error. - */ -TILEDB_EXPORT int32_t tiledb_query_get_type( - tiledb_ctx_t* ctx, - tiledb_query_t* query, - tiledb_query_type_t* query_type) TILEDB_NOEXCEPT; - -/** - * Retrieves the query layout. - * - * **Example:** - * - * @code{.c} - * tiledb_layout_t query_layout; - * tiledb_query_get_layout(ctx, query, &query_layout); - * @endcode - * - * @param ctx The TileDB context. - * @param query The query. - * @param query_layout The query layout to be retrieved. - * @return `TILEDB_OK` upon success, and `TILEDB_ERR` upon error. - */ -TILEDB_EXPORT int32_t tiledb_query_get_layout( - tiledb_ctx_t* ctx, - tiledb_query_t* query, - tiledb_layout_t* query_layout) TILEDB_NOEXCEPT; - -/** - * Retrieves the query array. - * - * **Example:** - * - * @code{.c} - * tiledb_array_t* array; - * tiledb_query_get_array(ctx, query, &array); - * @endcode - * - * @param ctx The TileDB context. - * @param query The query. - * @param array The query array to be retrieved. - * @return `TILEDB_OK` upon success, and `TILEDB_ERR` upon error. - */ -TILEDB_EXPORT int32_t tiledb_query_get_array( - tiledb_ctx_t* ctx, - tiledb_query_t* query, - tiledb_array_t** array) TILEDB_NOEXCEPT; - -/** - * Retrieves the estimated result size for a fixed-sized attribute/dimension. - * This is an estimate and may not be sufficient to read all results for the - * requested range, in particular for sparse arrays or array with - * var-length attributes. - * Query status must be checked and resubmitted if not complete. - * - * **Example:** - * - * @code{.c} - * uint64_t size; - * tiledb_query_get_est_result_size(ctx, query, "a", &size); - * @endcode - * - * @param ctx The TileDB context - * @param query The query. - * @param name The attribute/dimension name. - * @param size The size (in bytes) to be retrieved. - * @return `TILEDB_OK` for success and `TILEDB_ERR` for error. - */ -TILEDB_EXPORT int32_t tiledb_query_get_est_result_size( - tiledb_ctx_t* ctx, - const tiledb_query_t* query, - const char* name, - uint64_t* size) TILEDB_NOEXCEPT; - -/** - * Retrieves the estimated result size for a var-sized attribute/dimension. - * This is an estimate and may not be sufficient to read all results for the - * requested range, for sparse arrays or any array with - * var-length attributes. - * Query status must be checked and resubmitted if not complete. - * - * **Example:** - * - * @code{.c} - * uint64_t size_off, size_val; - * tiledb_query_get_est_result_size_var( - * ctx, query, "a", &size_off, &size_val); - * @endcode - * - * @param ctx The TileDB context - * @param query The query. - * @param name The attribute/dimension name. - * @param size_off The size of the offsets (in bytes) to be retrieved. - * @param size_val The size of the values (in bytes) to be retrieved. - * @return `TILEDB_OK` for success and `TILEDB_ERR` for error. - */ -TILEDB_EXPORT int32_t tiledb_query_get_est_result_size_var( - tiledb_ctx_t* ctx, - const tiledb_query_t* query, - const char* name, - uint64_t* size_off, - uint64_t* size_val) TILEDB_NOEXCEPT; - -/** - * Retrieves the estimated result size for a fixed-sized, nullable attribute. - * This is an estimate and may not be sufficient to read all results for the - * requested range, for sparse arrays or any array with - * var-length attributes. - * Query status must be checked and resubmitted if not complete. - * - * **Example:** - * - * @code{.c} - * uint64_t size_val; - * uint64_t size_validity; - * tiledb_query_get_est_result_size_nullable(ctx, query, "a", &size_val, - * &size_validity); - * @endcode - * - * @param ctx The TileDB context - * @param query The query. - * @param name The attribute name. - * @param size_val The size of the values (in bytes) to be retrieved. - * @param size_validity The size of the validity values (in bytes) to be - * retrieved. - * @return `TILEDB_OK` for success and `TILEDB_ERR` for error. - */ -TILEDB_EXPORT int32_t tiledb_query_get_est_result_size_nullable( - tiledb_ctx_t* ctx, - const tiledb_query_t* query, - const char* name, - uint64_t* size_val, - uint64_t* size_validity) TILEDB_NOEXCEPT; - -/** - * Retrieves the estimated result size for a var-sized, nullable attribute. - * - * **Example:** - * - * @code{.c} - * uint64_t size_off, size_val, size_validity; - * tiledb_query_get_est_result_size_var_nullable( - * ctx, query, "a", &size_off, &size_val, &size_validity); - * @endcode - * - * @param ctx The TileDB context - * @param query The query. - * @param name The attribute name. - * @param size_off The size of the offsets (in bytes) to be retrieved. - * @param size_val The size of the values (in bytes) to be retrieved. - * @param size_validity The size of the validity values (in bytes) to be - * retrieved. - * @return `TILEDB_OK` for success and `TILEDB_ERR` for error. - */ -TILEDB_EXPORT int32_t tiledb_query_get_est_result_size_var_nullable( - tiledb_ctx_t* ctx, - const tiledb_query_t* query, - const char* name, - uint64_t* size_off, - uint64_t* size_val, - uint64_t* size_validity) TILEDB_NOEXCEPT; - -/** - * Retrieves the number of written fragments. Applicable only to WRITE - * queries. - * - * **Example:** - * - * @code{.c} - * uint32_t num; - * tiledb_query_get_fragment_num(ctx, query, &num); - * @endcode - * - * @param ctx The TileDB context - * @param query The query. - * @param num The number of written fragments to be retrieved. - * @return `TILEDB_OK` for success and `TILEDB_ERR` for error. - */ -TILEDB_EXPORT int32_t tiledb_query_get_fragment_num( - tiledb_ctx_t* ctx, - const tiledb_query_t* query, - uint32_t* num) TILEDB_NOEXCEPT; - -/** - * Retrieves the URI of the written fragment with the input index. Applicable - * only to WRITE queries. - * - * **Example:** - * - * @code{.c} - * const char* uri; - * tiledb_query_get_fragment_uri( - * ctx, query, 0, &uri); - * @endcode - * - * @param ctx The TileDB context - * @param query The query. - * @param idx The index of the written fragment. - * @param uri The URI of the written fragment to be returned. - * @return `TILEDB_OK` for success and `TILEDB_ERR` for error. - * - * @note Make sure to make a copy of `uri` after its retrieval, as the - * constant pointer may be updated internally as new fragments - * are being written. - */ -TILEDB_EXPORT int32_t tiledb_query_get_fragment_uri( - tiledb_ctx_t* ctx, - const tiledb_query_t* query, - uint64_t idx, - const char** uri) TILEDB_NOEXCEPT; - -/** - * Retrieves the timestamp range of the written fragment with the input index. - * Applicable only to WRITE queries. - * - * **Example:** - * - * @code{.c} - * uint64_t t1, t2; - * tiledb_query_get_fragment_timestamp_range( - * ctx, query, 0, &t1, &t2); - * @endcode - * - * @param ctx The TileDB context - * @param query The query. - * @param idx The index of the written fragment. - * @param t1 The start value of the timestamp range of the - * written fragment to be returned. - * @param t2 The end value of the timestamp range of the - * written fragment to be returned. - * @return `TILEDB_OK` for success and `TILEDB_ERR` for error. - */ -TILEDB_EXPORT int32_t tiledb_query_get_fragment_timestamp_range( - tiledb_ctx_t* ctx, - const tiledb_query_t* query, - uint64_t idx, - uint64_t* t1, - uint64_t* t2) TILEDB_NOEXCEPT; - -/** - * Return a TileDB subarray object from the given query. - * - * **Example:** - * - * @code{.c} - * tiledb_subarray_t* subarray; - * tiledb_query_get_subarray_t(array, &subarray); - * @endcode - * - * @param ctx The TileDB context. - * @param query An open Query object. - * @param subarray The retrieved subarray object if available. - * @return `TILEDB_OK` for success or `TILEDB_OOM` or `TILEDB_ERR` for error. - */ -TILEDB_EXPORT -int32_t tiledb_query_get_subarray_t( - tiledb_ctx_t* ctx, - const tiledb_query_t* query, - tiledb_subarray_t** subarray) TILEDB_NOEXCEPT; - -/* ****************************** */ -/* QUERY CONDITION */ -/* ****************************** */ - -/** - * Allocates a TileDB query condition object. - * - * **Example:** - * - * @code{.c} - * tiledb_query_condition_t* query_condition; - * tiledb_query_condition_alloc(ctx, &query_condition); - * @endcode - * - * @param ctx The TileDB context. - * @param cond The allocated query condition object. - * @return `TILEDB_OK` for success and `TILEDB_OOM` or `TILEDB_ERR` for error. - */ -TILEDB_EXPORT int32_t tiledb_query_condition_alloc( - tiledb_ctx_t* ctx, tiledb_query_condition_t** cond) TILEDB_NOEXCEPT; - -/** - * Frees a TileDB query condition object. - * - * **Example:** - * - * @code{.c} - * uint32_t value = 5; - * tiledb_query_condition_t* query_condition; - * tiledb_query_condition_alloc( - * ctx, "longitude", &value, sizeof(value), TILEDB_LT, &query_condition); - * tiledb_query_set_condition(ctx, query, query_condition); - * tiledb_query_submit(ctx, query); - * tiledb_query_condition_free(&query_condition); - * @endcode - * - * @param cond The query condition object to be freed. - */ -TILEDB_EXPORT void tiledb_query_condition_free(tiledb_query_condition_t** cond) - TILEDB_NOEXCEPT; - -/** - * Initializes a TileDB query condition object. - * - * **Example:** - * - * @code{.c} - * tiledb_query_condition_t* query_condition; - * tiledb_query_condition_alloc(ctx, &query_condition); - * - * uint32_t value = 5; - * tiledb_query_condition_init( - * ctx, query_condition, "longitude", &value, sizeof(value), TILEDB_LT); - * @endcode - * - * @param ctx The TileDB context. - * @param cond The allocated query condition object. - * @param attribute_name The attribute name. - * @param condition_value The value to compare against an attribute value. - * @param condition_value_size The byte size of `condition_value`. - * @param op The comparison operator. - * @return `TILEDB_OK` for success and `TILEDB_ERR` for error. - */ -TILEDB_EXPORT int32_t tiledb_query_condition_init( - tiledb_ctx_t* ctx, - tiledb_query_condition_t* cond, - const char* attribute_name, - const void* condition_value, - uint64_t condition_value_size, - tiledb_query_condition_op_t op) TILEDB_NOEXCEPT; - -/** - * Combines two query condition objects into a newly allocated - * condition. Does not mutate or free the input condition objects. - * - * **Example:** - * - * @code{.c} - * tiledb_query_condition_t* query_condition_1; - * tiledb_query_condition_alloc(ctx, &query_condition_1); - * uint32_t value_1 = 5; - * tiledb_query_condition_init( - * ctx, - * query_condition_1, - * "longitude", - * &value_1, - * sizeof(value_1), - * TILEDB_LT); - * - * tiledb_query_condition_t* query_condition_2; - * tiledb_query_condition_alloc(ctx, &query_condition_2); - * uint32_t value_2 = 20; - * tiledb_query_condition_init( - * ctx, - * query_condition_2, - * "latitude", - * &value_2, - * sizeof(value_2), - * TILEDB_GE); - * - * tiledb_query_condition_t* query_condition_3; - * tiledb_query_condition_combine( - * ctx, query_condition_1, query_condition_2, TILEDB_AND, &query_condition_3); - * - * tiledb_query_condition_free(&query_condition_1); - * tiledb_query_condition_free(&query_condition_2); - * - * tiledb_query_set_condition(ctx, query, query_condition_3); - * tiledb_query_submit(ctx, query); - * tiledb_query_condition_free(&query_condition_3); - * @endcode - * - * @param[in] ctx The TileDB context. - * @param[in] left_cond The first input condition. - * @param[in] right_cond The second input condition. - * @param[in] combination_op The combination operation. - * @param[out] combined_cond The output condition holder. - * @return `TILEDB_OK` for success and `TILEDB_OOM` or `TILEDB_ERR` for error. - */ -TILEDB_EXPORT int32_t tiledb_query_condition_combine( - tiledb_ctx_t* ctx, - const tiledb_query_condition_t* left_cond, - const tiledb_query_condition_t* right_cond, - tiledb_query_condition_combination_op_t combination_op, - tiledb_query_condition_t** combined_cond) TILEDB_NOEXCEPT; - -/** - * Create a query condition representing a negation of the input query - * condition. Currently this is performed by applying De Morgan's theorem - * recursively to the query condition's internal representation. - * - * **Example:** - * - * @code{.c} - * tiledb_query_condition_t* query_condition_1; - * tiledb_query_condition_alloc(ctx, &query_condition_1); - * uint32_t value_1 = 5; - * tiledb_query_condition_init( - * ctx, - * query_condition_1, - * "longitude", - * &value_1, - * sizeof(value_1), - * TILEDB_LT); - * - * tiledb_query_condition_t* query_condition_2; - * tiledb_query_condition_negate( - * ctx, - * query_condition_1, - * &query_condition_2); - * - * tiledb_query_condition_free(&query_condition_1); - * - * tiledb_query_set_condition(ctx, query, query_condition_2); - * tiledb_query_submit(ctx, query); - * tiledb_query_condition_free(&query_condition_2); - * @endcode - * - * @param[in] ctx The TileDB context. - * @param[in] left_cond The first input condition. - * @param[in] right_cond The second input condition. - * @param[in] combination_op The combination operation. - * @param[out] combined_cond The output condition holder. - * @return `TILEDB_OK` for success and `TILEDB_OOM` or `TILEDB_ERR` for error. - */ -TILEDB_EXPORT int32_t tiledb_query_condition_negate( - tiledb_ctx_t* ctx, - const tiledb_query_condition_t* cond, - tiledb_query_condition_t** negated_cond) TILEDB_NOEXCEPT; +typedef struct tiledb_consolidation_plan_handle_t tiledb_consolidation_plan_t; /* ********************************* */ /* ARRAY CONSOLIDATION */ diff --git a/tiledb/sm/c_api/tiledb_experimental.h b/tiledb/sm/c_api/tiledb_experimental.h index 73c3321168b..7a082d331af 100644 --- a/tiledb/sm/c_api/tiledb_experimental.h +++ b/tiledb/sm/c_api/tiledb_experimental.h @@ -48,7 +48,9 @@ #include "tiledb/api/c_api/enumeration/enumeration_api_experimental.h" #include "tiledb/api/c_api/fragment_info/fragment_info_api_experimental.h" #include "tiledb/api/c_api/profile/profile_api_experimental.h" +#include "tiledb/api/c_api/query/query_api_external_experimental.h" #include "tiledb/api/c_api/query_aggregate/query_aggregate_api_external_experimental.h" +#include "tiledb/api/c_api/query_condition/query_condition_api_external_experimental.h" #include "tiledb/api/c_api/query_field/query_field_api_external_experimental.h" #include "tiledb/api/c_api/query_plan/query_plan_api_external_experimental.h" #include "tiledb/api/c_api/subarray/subarray_api_experimental.h" @@ -103,399 +105,6 @@ tiledb_log_warn(tiledb_ctx_t* ctx, const char* message) TILEDB_NOEXCEPT; TILEDB_EXPORT capi_return_t tiledb_as_built_dump(tiledb_string_t** out) TILEDB_NOEXCEPT; -/** - * Creates a TileDB schema evolution object. - * - * **Example:** - * - * @code{.c} - * tiledb_array_schema_evolution_t* array_schema_evolution; - * tiledb_array_schema_evolution_alloc(ctx, &array_schema_evolution); - * @endcode - * - * @param ctx The TileDB context. - * @param array_schema_evolution The TileDB schema evolution to be created. - * @return `TILEDB_OK` for success and `TILEDB_OOM` or `TILEDB_ERR` for error. - */ -TILEDB_EXPORT int32_t tiledb_array_schema_evolution_alloc( - tiledb_ctx_t* ctx, - tiledb_array_schema_evolution_t** array_schema_evolution) TILEDB_NOEXCEPT; - -/** - * Destroys an array schema evolution, freeing associated memory. - * - * **Example:** - * - * @code{.c} - * tiledb_array_schema_evolution_free(&array_schema_evolution); - * @endcode - * - * @param array_schema_evolution The array schema evolution to be destroyed. - */ -TILEDB_EXPORT void tiledb_array_schema_evolution_free( - tiledb_array_schema_evolution_t** array_schema_evolution) TILEDB_NOEXCEPT; - -/** - * Adds an attribute to an array schema evolution. - * - * **Example:** - * - * @code{.c} - * tiledb_attribute_t* attr; - * tiledb_attribute_alloc(ctx, "my_attr", TILEDB_INT32, &attr); - * tiledb_array_schema_evolution_add_attribute(ctx, array_schema_evolution, - * attr); - * @endcode - * - * @param[in] ctx The TileDB context. - * @param[in] array_schema_evolution The schema evolution. - * @param[in] attribute The attribute to be added. - * @return `TILEDB_OK` for success and `TILEDB_ERR` for error. - */ -TILEDB_EXPORT int32_t tiledb_array_schema_evolution_add_attribute( - tiledb_ctx_t* ctx, - tiledb_array_schema_evolution_t* array_schema_evolution, - tiledb_attribute_t* attribute) TILEDB_NOEXCEPT; - -/** - * Drops an attribute to an array schema evolution. - * - * **Example:** - * - * @code{.c} - * const char* attribute_name="a1"; - * tiledb_array_schema_evolution_drop_attribute(ctx, array_schema_evolution, - * attribute_name); - * @endcode - * - * @param ctx The TileDB context. - * @param array_schema_evolution The schema evolution. - * @param attribute_name The name of the attribute to be dropped. - * @return `TILEDB_OK` for success and `TILEDB_ERR` for error. - */ -TILEDB_EXPORT int32_t tiledb_array_schema_evolution_drop_attribute( - tiledb_ctx_t* ctx, - tiledb_array_schema_evolution_t* array_schema_evolution, - const char* attribute_name) TILEDB_NOEXCEPT; - -/** - * Adds an enumeration to an array schema evolution. - * - * **Example:** - * - * @code{.c} - * tiledb_enumeration_t* enmr; - * void* data = get_data(); - * uint64_t data_size = get_data_size(); - * tiledb_enumeration_alloc( - * ctx, - * TILEDB_INT64, - * cell_val_num, - * FALSE, - * data, - * data_size, - * nullptr, - * 0, - * &enumeration); - * tiledb_array_schema_evolution_add_enumeration(ctx, array_schema_evolution, - * enmr); - * @endcode - * - * @param ctx The TileDB context. - * @param array_schema_evolution The schema evolution. - * @param enumeration The enumeration to be added. - * @return `TILEDB_OK` for success and `TILEDB_ERR` for error. - */ -TILEDB_EXPORT capi_return_t tiledb_array_schema_evolution_add_enumeration( - tiledb_ctx_t* ctx, - tiledb_array_schema_evolution_t* array_schema_evolution, - tiledb_enumeration_t* enumeration) TILEDB_NOEXCEPT; - -/** - * Extends an enumeration during array schema evolution. - * - * **Example:** - * - * @code{.c} - * tiledb_enumeration_t* original_enmr = get_existing_enumeration(); - * const void* data = get_new_data(); - * uint64_t data_size = get_new_data_size(); - * tiledb_enumeration_t* new_enmr; - * tiledb_enumeration_extend( - * ctx, - * original_enmr, - * data, - * data_size, - * nullptr, - * 0, - * &new_enmr); - * tiledb_array_schema_evolution_extend_enumeration( - * ctx, - * array_schema_evolution, - * new_enmr); - * @endcode - * - * @param ctx The TileDB context. - * @param array_schema_evolution The schema evolution. - * @param enumeration The enumeration to be extended. This should be the result - * of a call to tiledb_enumeration_extend. - * @return `TILEDB_OK` for success and `TILEDB_ERR` for error. - */ -TILEDB_EXPORT capi_return_t tiledb_array_schema_evolution_extend_enumeration( - tiledb_ctx_t* ctx, - tiledb_array_schema_evolution_t* array_schema_evolution, - tiledb_enumeration_t* enumeration) TILEDB_NOEXCEPT; - -/** - * Drops an enumeration from an array schema evolution. - * - * **Example:** - * - * @code{.c} - * const char* enumeration_name = "enumeration_1"; - * tiledb_array_schema_evolution_drop_enumeration(ctx, array_schema_evolution, - * enumeration_name); - * @endcode - * - * @param ctx The TileDB context. - * @param array_schema_evolution The schema evolution. - * @param enumeration_name The name of the enumeration to be dropped. - * @return `TILEDB_OK` for success and `TILEDB_ERR` for error. - */ -TILEDB_EXPORT capi_return_t tiledb_array_schema_evolution_drop_enumeration( - tiledb_ctx_t* ctx, - tiledb_array_schema_evolution_t* array_schema_evolution, - const char* enumeration_name) TILEDB_NOEXCEPT; - -/** - * Sets timestamp range in an array schema evolution - * This function sets the output timestamp of the committed array schema after - * evolution. The lo and hi values are currently required to be the same or else - * an error is thrown. - * - * **Example:** - * - * @code{.c} - * uint64_t timestamp = tiledb_timestamp_now_ms(); - * tiledb_array_schema_evolution_set_timestamp_range(ctx, - * array_schema_evolution, timestamp, timestamp); - * @endcode - * - * @param ctx The TileDB context. - * @param array_schema_evolution The schema evolution. - * @param lo The lower bound of timestamp range. - * @param hi The upper bound of timestamp range, it must euqal to the lower - * bound. - * @return `TILEDB_OK` for success and `TILEDB_ERR` for error. - */ -TILEDB_EXPORT int32_t tiledb_array_schema_evolution_set_timestamp_range( - tiledb_ctx_t* ctx, - tiledb_array_schema_evolution_t* array_schema_evolution, - uint64_t lo, - uint64_t hi) TILEDB_NOEXCEPT; - -/** - * Expands the current domain during array schema evolution. - * TileDB will enforce that the new current domain is expanding - * on the current one and not contracting during `tiledb_array_evolve`. - * - * **Example:** - * - * @code{.c} - * tiledb_current_domain_t *new_domain; - * tiledb_current_domain_create(ctx, &new_domain); - * tiledb_ndrectangle_t *ndr; - * tiledb_ndrectangle_alloc(ctx, domain, &ndr); - * - * tiledb_range_t range; - * range.min = &expanded_min; - * range.min_size = sizeof(expanded_min); - * range.max = &expanded_max; - * range.max_size = sizeof(expanded_max); - * tiledb_ndrectangle_set_range_for_name(ctx, ndr, "dim1", &range); - * tiledb_ndrectangle_set_range_for_name(ctx, ndr, "dim2", &range); - * - * tiledb_current_domain_set_ndrectangle(new_domain, ndr); - * - * tiledb_array_schema_evolution_expand_current_domain(ctx, - * array_schema_evolution, new_domain); - * - * tiledb_array_evolve(ctx, array_uri, array_schema_evolution); - * - * tiledb_ndrectangle_free(&ndr); - * tiledb_current_domain_free(&new_domain); - * - * @endcode - * - * @param ctx The TileDB context. - * @param array_schema_evolution The schema evolution. - * @param expanded_domain The current domain we want to expand the schema to. - * @return `TILEDB_OK` for success and `TILEDB_ERR` for error. - */ -TILEDB_EXPORT capi_return_t tiledb_array_schema_evolution_expand_current_domain( - tiledb_ctx_t* ctx, - tiledb_array_schema_evolution_t* array_schema_evolution, - tiledb_current_domain_t* expanded_domain) TILEDB_NOEXCEPT; - -/* ********************************* */ -/* QUERY */ -/* ********************************* */ - -/** - * Adds a query update values to be applied on an update. - * - * **Example:** - * - * @code{.c} - * uint32_t value = 5; - * tiledb_query_add_update_value( - * ctx, query, "longitude", &value, sizeof(value), &update_value); - * @endcode - * - * @param ctx The TileDB context. - * @param query The TileDB query. - * @param field_name The attribute name. - * @param update_value The value to set. - * @param update_value_size The byte size of `update_value`. - */ -TILEDB_EXPORT int32_t tiledb_query_add_update_value( - tiledb_ctx_t* ctx, - tiledb_query_t* query, - const char* field_name, - const void* update_value, - uint64_t update_value_size) TILEDB_NOEXCEPT; - -/** - * Get the number of relevant fragments from the subarray. Should only be - * called after size estimation was asked for. - * - * @param ctx The TileDB context. - * @param query The query to get the data fron. - * @param relevant_fragment_num Variable to receive the number of relevant - * fragments. - * @return `TILEDB_OK` for success and `TILEDB_ERR` for error. - * - * @note Should only be called after size estimation was run. - */ -TILEDB_EXPORT int32_t tiledb_query_get_relevant_fragment_num( - tiledb_ctx_t* ctx, - const tiledb_query_t* query, - uint64_t* relevant_fragment_num) TILEDB_NOEXCEPT; - -/* ********************************* */ -/* QUERY CONDITION */ -/* ********************************* */ - -/** - * Initializes a TileDB query condition set membership object. - * - * **Example:** - * - * @code{.c} - * tiledb_query_condition_t* cond - * tiledb_query_condition_alloc_set_membership( - * ctx, - * "some_name", - * data, - * data_size, - * offsets, - * offsets_size, - * TILEDB_QUERY_CONDITION_OP_IN, - * &cond); - * @endcode - * - * @param ctx The TileDB context. - * @param field_name The field name. - * @param data A pointer to the set member data. - * @param data_size The length of the data buffer. - * @param offsets A pointer to the array of offsets of members. - * @param offsets_size The length of the offsets array in bytes. - * @param op The set membership operator to use. - * @param cond The allocated query condition object. - * @return `TILEDB_OK` for success and `TILEDB_ERR` for error. - */ -TILEDB_EXPORT capi_return_t tiledb_query_condition_alloc_set_membership( - tiledb_ctx_t* ctx, - const char* field_name, - const void* data, - uint64_t data_size, - const void* offsets, - uint64_t offests_size, - tiledb_query_condition_op_t op, - tiledb_query_condition_t** cond) TILEDB_NOEXCEPT; - -/** - * Disable the use of enumerations on the given QueryCondition - * - * **Example:** - * - * @code{.c} - * tiledb_query_condition_t* query_condition; - * tiledb_query_condition_alloc(ctx, &query_condition); - * uint32_t value = 5; - * tiledb_query_condition_init( - * ctx, - * query_condition, - * "longitude", - * &value, - * sizeof(value), - * TILEDB_LT); - * tiledb_query_condition_set_use_enumeration(ctx, query_condition, 0); - * @endcode - * - * @param[in] ctx The TileDB context. - * @param[in] cond The query condition - * @param[in] use_enumeration Non-zero to use the associated enumeration - * @return `TILEDB_OK` for success and `TILEDB_ERR` for error. - */ -TILEDB_EXPORT int32_t tiledb_query_condition_set_use_enumeration( - tiledb_ctx_t* ctx, - const tiledb_query_condition_t* cond, - int use_enumeration) TILEDB_NOEXCEPT; - -/* ********************************* */ -/* QUERY STATUS DETAILS */ -/* ********************************* */ - -/** TileDB query status details type. */ -typedef enum { -/** Helper macro for defining status details type enums. */ -#define TILEDB_QUERY_STATUS_DETAILS_ENUM(id) TILEDB_##id -#include "tiledb_enum.h" -#undef TILEDB_QUERY_STATUS_DETAILS_ENUM -} tiledb_query_status_details_reason_t; - -/** This should move to c_api/tiledb_struct_defs.h when stabilized */ -typedef struct tiledb_experimental_query_status_details_t { - tiledb_query_status_details_reason_t - incomplete_reason; ///< Reason enum for the incomplete query. -} tiledb_query_status_details_t; - -/** - * Get extended query status details. - * - * The contained enumeration tiledb_query_status_details_reason_t - * indicates extended information about a returned query status - * in order to allow improved client-side handling of buffers and - * potential resubmissions. - * - * **Example:** - * - * @code{.c} - * tiledb_query_status_details_t status_details; - * tiledb_query_get_status_details(ctx, query, &status_details); - * @endcode - * - * @param ctx The TileDB context. - * @param query The query from which to retrieve status details. - * @param status_details The tiledb_query_status_details_t struct. - * @return `TILEDB_OK` for success and `TILEDB_ERR` for error. - */ -TILEDB_EXPORT int32_t tiledb_query_get_status_details( - tiledb_ctx_t* ctx, - tiledb_query_t* query, - tiledb_query_status_details_t* status_details) TILEDB_NOEXCEPT; - /* ********************************* */ /* CONTEXT */ /* ********************************* */ diff --git a/tiledb/sm/c_api/tiledb_struct_def.h b/tiledb/sm/c_api/tiledb_struct_def.h index d6a106bb276..212f0037a9e 100644 --- a/tiledb/sm/c_api/tiledb_struct_def.h +++ b/tiledb/sm/c_api/tiledb_struct_def.h @@ -35,26 +35,29 @@ #define TILEDB_C_API_STRUCT_DEF_H #include "tiledb/api/c_api_support/handle/handle.h" -#include "tiledb/sm/array_schema/array_schema.h" -#include "tiledb/sm/buffer/buffer_list.h" #include "tiledb/sm/consolidation_plan/consolidation_plan.h" -#include "tiledb/sm/filesystem/vfs_file_handle.h" -#include "tiledb/sm/group/group.h" -#include "tiledb/sm/query/query.h" -#include "tiledb/sm/query/query_condition.h" -#include "tiledb/sm/query/update_value.h" -#include "tiledb/sm/storage_manager/context.h" - -struct tiledb_query_t { - tiledb::sm::Query* query_ = nullptr; -}; -struct tiledb_query_condition_t { - tiledb::sm::QueryCondition* query_condition_ = nullptr; -}; +struct tiledb_consolidation_plan_handle_t : public tiledb::api::CAPIHandle { + /** Type name */ + static constexpr std::string_view object_type_name{"consolidation_plan"}; -struct tiledb_consolidation_plan_t { + private: shared_ptr consolidation_plan_ = nullptr; + + public: + tiledb_consolidation_plan_handle_t( + shared_ptr consolidation_plan) + : consolidation_plan_(consolidation_plan) { + } + + tiledb_consolidation_plan_handle_t(std::in_place_t, auto&&... args) + : consolidation_plan_(make_shared( + HERE(), std::forward(args)...)) { + } + + const tiledb::sm::ConsolidationPlan& consolidation_plan() const { + return *consolidation_plan_; + } }; #endif diff --git a/tiledb/sm/compressors/test/compile_compressors_main.cc b/tiledb/sm/compressors/test/compile_compressors_main.cc deleted file mode 100644 index 9cd586af2c1..00000000000 --- a/tiledb/sm/compressors/test/compile_compressors_main.cc +++ /dev/null @@ -1,46 +0,0 @@ -/** - * @file compile_filter_main.cc - * - * @section LICENSE - * - * The MIT License - * - * @copyright Copyright (c) 2021-2022 TileDB, Inc. - * - * Permission is hereby granted, free of charge, to any person obtaining a copy - * of this software and associated documentation files (the "Software"), to deal - * in the Software without restriction, including without limitation the rights - * to use, copy, modify, merge, publish, distribute, sublicense, and/or sell - * copies of the Software, and to permit persons to whom the Software is - * furnished to do so, subject to the following conditions: - * - * The above copyright notice and this permission notice shall be included in - * all copies or substantial portions of the Software. - * - * THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR - * IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY, - * FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL THE - * AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER - * LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM, - * OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN - * THE SOFTWARE. - */ - -#include "../bzip_compressor.h" -#include "../dd_compressor.h" -#include "../dict_compressor.h" -#include "../gzip_compressor.h" -#include "../lz4_compressor.h" -#include "../rle_compressor.h" -#include "../zstd_compressor.h" - -int main() { - (void)sizeof(tiledb::sm::BZip); - (void)sizeof(tiledb::sm::DoubleDelta); - (void)sizeof(tiledb::sm::DictEncoding); - (void)sizeof(tiledb::sm::GZip); - (void)sizeof(tiledb::sm::LZ4); - (void)sizeof(tiledb::sm::RLE); - (void)sizeof(tiledb::sm::ZStd); - return 0; -} diff --git a/tiledb/sm/config/test/compile_config_main.cc b/tiledb/sm/config/test/compile_config_main.cc deleted file mode 100644 index 389fb5a0884..00000000000 --- a/tiledb/sm/config/test/compile_config_main.cc +++ /dev/null @@ -1,34 +0,0 @@ -/** - * @file compile_config_main.cc - * - * @section LICENSE - * - * The MIT License - * - * @copyright Copyright (c) 2021 TileDB, Inc. - * - * Permission is hereby granted, free of charge, to any person obtaining a copy - * of this software and associated documentation files (the "Software"), to deal - * in the Software without restriction, including without limitation the rights - * to use, copy, modify, merge, publish, distribute, sublicense, and/or sell - * copies of the Software, and to permit persons to whom the Software is - * furnished to do so, subject to the following conditions: - * - * The above copyright notice and this permission notice shall be included in - * all copies or substantial portions of the Software. - * - * THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR - * IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY, - * FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL THE - * AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER - * LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM, - * OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN - * THE SOFTWARE. - */ - -#include "../config.h" - -int main() { - (void)sizeof(tiledb::sm::Config); - return 0; -} diff --git a/tiledb/sm/crypto/test/compile_tiledb_crypto_main.cc b/tiledb/sm/crypto/test/compile_tiledb_crypto_main.cc deleted file mode 100644 index a323158613c..00000000000 --- a/tiledb/sm/crypto/test/compile_tiledb_crypto_main.cc +++ /dev/null @@ -1,34 +0,0 @@ -/** - * @file compile_crypto_main.cc - * - * @section LICENSE - * - * The MIT License - * - * @copyright Copyright (c) 2021 TileDB, Inc. - * - * Permission is hereby granted, free of charge, to any person obtaining a copy - * of this software and associated documentation files (the "Software"), to deal - * in the Software without restriction, including without limitation the rights - * to use, copy, modify, merge, publish, distribute, sublicense, and/or sell - * copies of the Software, and to permit persons to whom the Software is - * furnished to do so, subject to the following conditions: - * - * The above copyright notice and this permission notice shall be included in - * all copies or substantial portions of the Software. - * - * THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR - * IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY, - * FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL THE - * AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER - * LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM, - * OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN - * THE SOFTWARE. - */ - -#include "../crypto.h" - -int main() { - (void)tiledb::sm::Crypto::md5(nullptr, nullptr); - return 0; -} diff --git a/tiledb/sm/filesystem/test/compile_vfs_main.cc b/tiledb/sm/filesystem/test/compile_vfs_main.cc deleted file mode 100644 index a96833eaf25..00000000000 --- a/tiledb/sm/filesystem/test/compile_vfs_main.cc +++ /dev/null @@ -1,39 +0,0 @@ -/** - * @file compile_filesystem_main.cc - * - * @section LICENSE - * - * The MIT License - * - * @copyright Copyright (c) 2021 TileDB, Inc. - * - * Permission is hereby granted, free of charge, to any person obtaining a copy - * of this software and associated documentation files (the "Software"), to deal - * in the Software without restriction, including without limitation the rights - * to use, copy, modify, merge, publish, distribute, sublicense, and/or sell - * copies of the Software, and to permit persons to whom the Software is - * furnished to do so, subject to the following conditions: - * - * The above copyright notice and this permission notice shall be included in - * all copies or substantial portions of the Software. - * - * THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR - * IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY, - * FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL THE - * AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER - * LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM, - * OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN - * THE SOFTWARE. - */ - -#include "../vfs.h" -#include "tiledb/common/logger.h" - -int main() { - static tiledb::sm::stats::Stats stats("test"); - static tiledb::common::Logger logger("test"); - ThreadPool compute_tp(4); - ThreadPool io_tp(4); - tiledb::sm::VFS x{&stats, &logger, &compute_tp, &io_tp, tiledb::sm::Config{}}; - return 0; -} diff --git a/tiledb/sm/filter/CMakeLists.txt b/tiledb/sm/filter/CMakeLists.txt index 148901237b8..3acee1760ae 100644 --- a/tiledb/sm/filter/CMakeLists.txt +++ b/tiledb/sm/filter/CMakeLists.txt @@ -99,16 +99,6 @@ conclude(object_library) # # `webp_filter` object library. # -#add_library(webp_filter OBJECT EXCLUDE_FROM_ALL webp_filter.cc) -#target_link_libraries(webp_filter PUBLIC filter $) -#target_link_libraries(webp_filter PUBLIC misc_types $) -#target_link_libraries(webp_filter PUBLIC tile $) -#if(TILEDB_WEBP) -# target_compile_definitions(webp_filter PUBLIC -DTILEDB_WEBP) -# find_package(WebP REQUIRED) -# target_link_libraries(webp_filter PRIVATE WebP::webp) -#endif() - commence(object_library webp_filter) this_target_sources(webp_filter.cc) this_target_object_libraries(filter misc_types tile) @@ -119,13 +109,6 @@ commence(object_library webp_filter) endif() conclude(object_library) -# -# Test-compile of object library ensures link-completeness. -# -#add_executable(compile_webp_filter EXCLUDE_FROM_ALL) -#target_link_libraries(compile_webp_filter PRIVATE webp_filter) -#target_sources(compile_webp_filter PRIVATE test/compile_webp_filter_main.cc) - # # `all_filters` object library # diff --git a/tiledb/sm/filter/test/compile_all_filters_main.cc b/tiledb/sm/filter/test/compile_all_filters_main.cc deleted file mode 100644 index e4465679dfe..00000000000 --- a/tiledb/sm/filter/test/compile_all_filters_main.cc +++ /dev/null @@ -1,39 +0,0 @@ -/** - * @file compile_all_filters_main.cc - * - * @section LICENSE - * - * The MIT License - * - * @copyright Copyright (c) 2021 TileDB, Inc. - * - * Permission is hereby granted, free of charge, to any person obtaining a copy - * of this software and associated documentation files (the "Software"), to deal - * in the Software without restriction, including without limitation the rights - * to use, copy, modify, merge, publish, distribute, sublicense, and/or sell - * copies of the Software, and to permit persons to whom the Software is - * furnished to do so, subject to the following conditions: - * - * The above copyright notice and this permission notice shall be included in - * all copies or substantial portions of the Software. - * - * THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR - * IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY, - * FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL THE - * AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER - * LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM, - * OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN - * THE SOFTWARE. - */ - -#include "../filter_create.h" - -int main() { - using namespace tiledb::sm; - - (void)sizeof(tiledb::sm::FilterCreate); - (void)static_cast (*)( - Deserializer& deserializer, const uint32_t version, Datatype datatype)>( - tiledb::sm::FilterCreate::deserialize); - return 0; -} diff --git a/tiledb/sm/filter/test/compile_bitshuffle_filter_main.cc b/tiledb/sm/filter/test/compile_bitshuffle_filter_main.cc deleted file mode 100644 index b15df254811..00000000000 --- a/tiledb/sm/filter/test/compile_bitshuffle_filter_main.cc +++ /dev/null @@ -1,34 +0,0 @@ -/** - * @file compile_bitshuffle_filter_main.cc - * - * @section LICENSE - * - * The MIT License - * - * @copyright Copyright (c) 2021 TileDB, Inc. - * - * Permission is hereby granted, free of charge, to any person obtaining a copy - * of this software and associated documentation files (the "Software"), to deal - * in the Software without restriction, including without limitation the rights - * to use, copy, modify, merge, publish, distribute, sublicense, and/or sell - * copies of the Software, and to permit persons to whom the Software is - * furnished to do so, subject to the following conditions: - * - * The above copyright notice and this permission notice shall be included in - * all copies or substantial portions of the Software. - * - * THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR - * IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY, - * FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL THE - * AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER - * LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM, - * OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN - * THE SOFTWARE. - */ - -#include "../bitshuffle_filter.h" - -int main() { - (void)sizeof(tiledb::sm::BitshuffleFilter); - return 0; -} diff --git a/tiledb/sm/filter/test/compile_byteshuffle_filter_main.cc b/tiledb/sm/filter/test/compile_byteshuffle_filter_main.cc deleted file mode 100644 index 6ec7b06857f..00000000000 --- a/tiledb/sm/filter/test/compile_byteshuffle_filter_main.cc +++ /dev/null @@ -1,34 +0,0 @@ -/** - * @file compile_byteshuffle_filter_main.cc - * - * @section LICENSE - * - * The MIT License - * - * @copyright Copyright (c) 2021 TileDB, Inc. - * - * Permission is hereby granted, free of charge, to any person obtaining a copy - * of this software and associated documentation files (the "Software"), to deal - * in the Software without restriction, including without limitation the rights - * to use, copy, modify, merge, publish, distribute, sublicense, and/or sell - * copies of the Software, and to permit persons to whom the Software is - * furnished to do so, subject to the following conditions: - * - * The above copyright notice and this permission notice shall be included in - * all copies or substantial portions of the Software. - * - * THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR - * IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY, - * FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL THE - * AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER - * LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM, - * OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN - * THE SOFTWARE. - */ - -#include "../byteshuffle_filter.h" - -int main() { - (void)sizeof(tiledb::sm::ByteshuffleFilter); - return 0; -} diff --git a/tiledb/sm/filter/test/compile_checksum_filters_main.cc b/tiledb/sm/filter/test/compile_checksum_filters_main.cc deleted file mode 100644 index cd2679370ec..00000000000 --- a/tiledb/sm/filter/test/compile_checksum_filters_main.cc +++ /dev/null @@ -1,36 +0,0 @@ -/** - * @file compile_checksum_filters_main.cc - * - * @section LICENSE - * - * The MIT License - * - * @copyright Copyright (c) 2021 TileDB, Inc. - * - * Permission is hereby granted, free of charge, to any person obtaining a copy - * of this software and associated documentation files (the "Software"), to deal - * in the Software without restriction, including without limitation the rights - * to use, copy, modify, merge, publish, distribute, sublicense, and/or sell - * copies of the Software, and to permit persons to whom the Software is - * furnished to do so, subject to the following conditions: - * - * The above copyright notice and this permission notice shall be included in - * all copies or substantial portions of the Software. - * - * THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR - * IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY, - * FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL THE - * AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER - * LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM, - * OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN - * THE SOFTWARE. - */ - -#include "../checksum_md5_filter.h" -#include "../checksum_sha256_filter.h" - -int main() { - (void)sizeof(tiledb::sm::ChecksumMD5Filter); - (void)sizeof(tiledb::sm::ChecksumSHA256Filter); - return 0; -} diff --git a/tiledb/sm/filter/test/compile_compression_filter_main.cc b/tiledb/sm/filter/test/compile_compression_filter_main.cc deleted file mode 100644 index f0f8c69ce22..00000000000 --- a/tiledb/sm/filter/test/compile_compression_filter_main.cc +++ /dev/null @@ -1,34 +0,0 @@ -/** - * @file compile_compression_filter_main.cc - * - * @section LICENSE - * - * The MIT License - * - * @copyright Copyright (c) 2021 TileDB, Inc. - * - * Permission is hereby granted, free of charge, to any person obtaining a copy - * of this software and associated documentation files (the "Software"), to deal - * in the Software without restriction, including without limitation the rights - * to use, copy, modify, merge, publish, distribute, sublicense, and/or sell - * copies of the Software, and to permit persons to whom the Software is - * furnished to do so, subject to the following conditions: - * - * The above copyright notice and this permission notice shall be included in - * all copies or substantial portions of the Software. - * - * THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR - * IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY, - * FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL THE - * AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER - * LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM, - * OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN - * THE SOFTWARE. - */ - -#include "../compression_filter.h" - -int main() { - (void)sizeof(tiledb::sm::CompressionFilter); - return 0; -} diff --git a/tiledb/sm/filter/test/compile_encryption_filters_main.cc b/tiledb/sm/filter/test/compile_encryption_filters_main.cc deleted file mode 100644 index 33bb7a5bbef..00000000000 --- a/tiledb/sm/filter/test/compile_encryption_filters_main.cc +++ /dev/null @@ -1,34 +0,0 @@ -/** - * @file compile_encryption_filters_main.cc - * - * @section LICENSE - * - * The MIT License - * - * @copyright Copyright (c) 2021 TileDB, Inc. - * - * Permission is hereby granted, free of charge, to any person obtaining a copy - * of this software and associated documentation files (the "Software"), to deal - * in the Software without restriction, including without limitation the rights - * to use, copy, modify, merge, publish, distribute, sublicense, and/or sell - * copies of the Software, and to permit persons to whom the Software is - * furnished to do so, subject to the following conditions: - * - * The above copyright notice and this permission notice shall be included in - * all copies or substantial portions of the Software. - * - * THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR - * IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY, - * FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL THE - * AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER - * LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM, - * OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN - * THE SOFTWARE. - */ - -#include "../encryption_aes256gcm_filter.h" - -int main() { - (void)sizeof(tiledb::sm::EncryptionAES256GCMFilter); - return 0; -} diff --git a/tiledb/sm/filter/test/compile_filter_main.cc b/tiledb/sm/filter/test/compile_filter_main.cc deleted file mode 100644 index a9af572494f..00000000000 --- a/tiledb/sm/filter/test/compile_filter_main.cc +++ /dev/null @@ -1,34 +0,0 @@ -/** - * @file compile_filter_main.cc - * - * @section LICENSE - * - * The MIT License - * - * @copyright Copyright (c) 2021 TileDB, Inc. - * - * Permission is hereby granted, free of charge, to any person obtaining a copy - * of this software and associated documentation files (the "Software"), to deal - * in the Software without restriction, including without limitation the rights - * to use, copy, modify, merge, publish, distribute, sublicense, and/or sell - * copies of the Software, and to permit persons to whom the Software is - * furnished to do so, subject to the following conditions: - * - * The above copyright notice and this permission notice shall be included in - * all copies or substantial portions of the Software. - * - * THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR - * IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY, - * FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL THE - * AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER - * LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM, - * OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN - * THE SOFTWARE. - */ - -#include "../filter.h" - -int main() { - (void)sizeof(tiledb::sm::Filter); - return 0; -} diff --git a/tiledb/sm/filter/test/compile_filter_pipeline_main.cc b/tiledb/sm/filter/test/compile_filter_pipeline_main.cc deleted file mode 100644 index 0675c0099bf..00000000000 --- a/tiledb/sm/filter/test/compile_filter_pipeline_main.cc +++ /dev/null @@ -1,34 +0,0 @@ -/** - * @file compile_filter_pipeline_main.cc - * - * @section LICENSE - * - * The MIT License - * - * @copyright Copyright (c) 2021 TileDB, Inc. - * - * Permission is hereby granted, free of charge, to any person obtaining a copy - * of this software and associated documentation files (the "Software"), to deal - * in the Software without restriction, including without limitation the rights - * to use, copy, modify, merge, publish, distribute, sublicense, and/or sell - * copies of the Software, and to permit persons to whom the Software is - * furnished to do so, subject to the following conditions: - * - * The above copyright notice and this permission notice shall be included in - * all copies or substantial portions of the Software. - * - * THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR - * IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY, - * FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL THE - * AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER - * LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM, - * OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN - * THE SOFTWARE. - */ - -#include "../filter_pipeline.h" - -int main() { - (void)sizeof(tiledb::sm::FilterPipeline); - return 0; -} diff --git a/tiledb/sm/filter/test/compile_float_scaling_filter_main.cc b/tiledb/sm/filter/test/compile_float_scaling_filter_main.cc deleted file mode 100644 index e7702bf1fb9..00000000000 --- a/tiledb/sm/filter/test/compile_float_scaling_filter_main.cc +++ /dev/null @@ -1,34 +0,0 @@ -/** - * @file compile_float_scaling_filter_main.cc - * - * @section LICENSE - * - * The MIT License - * - * @copyright Copyright (c) 2022 TileDB, Inc. - * - * Permission is hereby granted, free of charge, to any person obtaining a copy - * of this software and associated documentation files (the "Software"), to deal - * in the Software without restriction, including without limitation the rights - * to use, copy, modify, merge, publish, distribute, sublicense, and/or sell - * copies of the Software, and to permit persons to whom the Software is - * furnished to do so, subject to the following conditions: - * - * The above copyright notice and this permission notice shall be included in - * all copies or substantial portions of the Software. - * - * THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR - * IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY, - * FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL THE - * AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER - * LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM, - * OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN - * THE SOFTWARE. - */ - -#include "../float_scaling_filter.h" - -int main() { - (void)sizeof(tiledb::sm::FloatScalingFilter); - return 0; -} diff --git a/tiledb/sm/filter/test/compile_webp_filter_main.cc b/tiledb/sm/filter/test/compile_webp_filter_main.cc deleted file mode 100644 index 77f9933c562..00000000000 --- a/tiledb/sm/filter/test/compile_webp_filter_main.cc +++ /dev/null @@ -1,34 +0,0 @@ -/** - * @file compile_webp_filter_main.cc - * - * @section LICENSE - * - * The MIT License - * - * @copyright Copyright (c) 2022 TileDB, Inc. - * - * Permission is hereby granted, free of charge, to any person obtaining a copy - * of this software and associated documentation files (the "Software"), to deal - * in the Software without restriction, including without limitation the rights - * to use, copy, modify, merge, publish, distribute, sublicense, and/or sell - * copies of the Software, and to permit persons to whom the Software is - * furnished to do so, subject to the following conditions: - * - * The above copyright notice and this permission notice shall be included in - * all copies or substantial portions of the Software. - * - * THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR - * IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY, - * FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL THE - * AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER - * LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM, - * OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN - * THE SOFTWARE. - */ - -#include "tiledb/sm/filter/webp_filter.h" - -int main() { - (void)sizeof(tiledb::sm::WebpFilter); - return 0; -} diff --git a/tiledb/sm/filter/test/compile_xor_filter_main.cc b/tiledb/sm/filter/test/compile_xor_filter_main.cc deleted file mode 100644 index 73239c20a49..00000000000 --- a/tiledb/sm/filter/test/compile_xor_filter_main.cc +++ /dev/null @@ -1,34 +0,0 @@ -/** - * @file compile_xor_filter_main.cc - * - * @section LICENSE - * - * The MIT License - * - * @copyright Copyright (c) 2022 TileDB, Inc. - * - * Permission is hereby granted, free of charge, to any person obtaining a copy - * of this software and associated documentation files (the "Software"), to deal - * in the Software without restriction, including without limitation the rights - * to use, copy, modify, merge, publish, distribute, sublicense, and/or sell - * copies of the Software, and to permit persons to whom the Software is - * furnished to do so, subject to the following conditions: - * - * The above copyright notice and this permission notice shall be included in - * all copies or substantial portions of the Software. - * - * THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR - * IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY, - * FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL THE - * AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER - * LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM, - * OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN - * THE SOFTWARE. - */ - -#include "../xor_filter.h" - -int main() { - (void)sizeof(tiledb::sm::XORFilter); - return 0; -} diff --git a/tiledb/sm/fragment/test/compile_fragment_identifier_main.cc b/tiledb/sm/fragment/test/compile_fragment_identifier_main.cc deleted file mode 100644 index f82d408ba35..00000000000 --- a/tiledb/sm/fragment/test/compile_fragment_identifier_main.cc +++ /dev/null @@ -1,40 +0,0 @@ -/** - * @file compile_fragment_identifier_main.cc - * - * @section LICENSE - * - * The MIT License - * - * @copyright Copyright (c) 2024 TileDB, Inc. - * - * Permission is hereby granted, free of charge, to any person obtaining a copy - * of this software and associated documentation files (the "Software"), to deal - * in the Software without restriction, including without limitation the rights - * to use, copy, modify, merge, publish, distribute, sublicense, and/or sell - * copies of the Software, and to permit persons to whom the Software is - * furnished to do so, subject to the following conditions: - * - * The above copyright notice and this permission notice shall be included in - * all copies or substantial portions of the Software. - * - * THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR - * IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY, - * FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL THE - * AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER - * LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM, - * OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN - * THE SOFTWARE. - */ - -#include "../fragment_identifier.h" - -using namespace tiledb::sm; - -int main() { - FragmentID x(URI{}); - (void)x.name(); - (void)x.timestamp_range(); - (void)x.name_version(); - (void)x.array_format_version(); - return 0; -} diff --git a/tiledb/sm/fragment/test/compile_fragment_metadata_main.cc b/tiledb/sm/fragment/test/compile_fragment_metadata_main.cc deleted file mode 100644 index defa05aee45..00000000000 --- a/tiledb/sm/fragment/test/compile_fragment_metadata_main.cc +++ /dev/null @@ -1,64 +0,0 @@ -/** - * @file compile_fragment_metadata_main.cc - * - * @section LICENSE - * - * The MIT License - * - * @copyright Copyright (c) 2024 TileDB, Inc. - * - * Permission is hereby granted, free of charge, to any person obtaining a copy - * of this software and associated documentation files (the "Software"), to deal - * in the Software without restriction, including without limitation the rights - * to use, copy, modify, merge, publish, distribute, sublicense, and/or sell - * copies of the Software, and to permit persons to whom the Software is - * furnished to do so, subject to the following conditions: - * - * The above copyright notice and this permission notice shall be included in - * all copies or substantial portions of the Software. - * - * THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR - * IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY, - * FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL THE - * AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER - * LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM, - * OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN - * THE SOFTWARE. - */ - -#include "../fragment_info.h" -#include "../fragment_metadata.h" -#include "../loaded_fragment_metadata.h" -#include "../ondemand_fragment_metadata.h" -#include "../v1v2preloaded_fragment_metadata.h" - -#include "tiledb/common/logger.h" -#include "tiledb/sm/crypto/encryption_key.h" -#include "tiledb/sm/storage_manager/context_resources.h" - -using namespace tiledb::sm; - -int main() { - Config config; - auto logger = make_shared(HERE(), "foo"); - ContextResources resources(config, logger, 1, 1, ""); - - FragmentInfo info(URI{}, resources); - (void)info.fragment_num(); - - FragmentMetadata meta(&resources, resources.ephemeral_memory_tracker(), 22); - (void)meta.cell_num(); - - LoadedFragmentMetadata* loaded = meta.loaded_metadata(); - (void)loaded->free_tile_offsets(); - - EncryptionKey key; - OndemandFragmentMetadata ondemand(meta, resources.ephemeral_memory_tracker()); - (void)ondemand.load_rtree(key); - - V1V2PreloadedFragmentMetadata v1v2( - meta, resources.ephemeral_memory_tracker()); - (void)v1v2.load_rtree(key); - - return 0; -} diff --git a/tiledb/sm/group/CMakeLists.txt b/tiledb/sm/group/CMakeLists.txt index 68e6e08f777..5f05ebd9e0e 100644 --- a/tiledb/sm/group/CMakeLists.txt +++ b/tiledb/sm/group/CMakeLists.txt @@ -25,29 +25,12 @@ # include(common NO_POLICY_SCOPE) +include(object_library) # # `group` object library # -# This object library does not support independent linkage at present. It has -# a dependency on `StorageManager`, which at present is incapable of being -# linked standalone. As a result, this library is not defined with -# `commence(object_library)`, since that mandates a link-completeness test. -# -add_library(group OBJECT EXCLUDE_FROM_ALL group_directory.cc group.cc group_details.cc group_details_v1.cc group_details_v2.cc group_member.cc group_member_v1.cc group_member_v2.cc) -target_link_libraries(group PUBLIC baseline $) -target_link_libraries(group PUBLIC buffer $) -target_link_libraries(group PUBLIC object $) - -# -# Test-compile of object library ensures link-completeness -# -add_executable(compile_group EXCLUDE_FROM_ALL) - -# TODO: fix linkage of compile_group -#add_dependencies(all_link_complete compile_group) - -target_link_libraries(compile_group PRIVATE group) -target_sources(compile_group PRIVATE - test/compile_group_main.cc $ -) +commence(object_library group) + this_target_sources(group_directory.cc group.cc group_details.cc group_details_v1.cc group_details_v2.cc group_member.cc group_member_v1.cc group_member_v2.cc) + this_target_object_libraries(baseline buffer object) +conclude(object_library) diff --git a/tiledb/sm/group/test/compile_group_main.cc b/tiledb/sm/group/test/compile_group_main.cc deleted file mode 100644 index 1549b189c98..00000000000 --- a/tiledb/sm/group/test/compile_group_main.cc +++ /dev/null @@ -1,34 +0,0 @@ -/** - * @file compile_group_main.cc - * - * @section LICENSE - * - * The MIT License - * - * @copyright Copyright (c) 2021 TileDB, Inc. - * - * Permission is hereby granted, free of charge, to any person obtaining a copy - * of this software and associated documentation files (the "Software"), to deal - * in the Software without restriction, including without limitation the rights - * to use, copy, modify, merge, publish, distribute, sublicense, and/or sell - * copies of the Software, and to permit persons to whom the Software is - * furnished to do so, subject to the following conditions: - * - * The above copyright notice and this permission notice shall be included in - * all copies or substantial portions of the Software. - * - * THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR - * IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY, - * FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL THE - * AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER - * LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM, - * OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN - * THE SOFTWARE. - */ - -#include "../group.h" - -int main() { - (void)sizeof(tiledb::sm::GroupDetails); - return 0; -} diff --git a/tiledb/sm/metadata/test/compile_metadata_main.cc b/tiledb/sm/metadata/test/compile_metadata_main.cc deleted file mode 100644 index 7233c396c70..00000000000 --- a/tiledb/sm/metadata/test/compile_metadata_main.cc +++ /dev/null @@ -1,34 +0,0 @@ -/** - * @file compile_metadata_main.cc - * - * @section LICENSE - * - * The MIT License - * - * @copyright Copyright (c) 2021 TileDB, Inc. - * - * Permission is hereby granted, free of charge, to any person obtaining a copy - * of this software and associated documentation files (the "Software"), to deal - * in the Software without restriction, including without limitation the rights - * to use, copy, modify, merge, publish, distribute, sublicense, and/or sell - * copies of the Software, and to permit persons to whom the Software is - * furnished to do so, subject to the following conditions: - * - * The above copyright notice and this permission notice shall be included in - * all copies or substantial portions of the Software. - * - * THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR - * IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY, - * FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL THE - * AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER - * LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM, - * OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN - * THE SOFTWARE. - */ - -#include "../metadata.h" - -int main() { - (void)sizeof(tiledb::sm::Metadata); - return 0; -} diff --git a/tiledb/sm/misc/test/compile_cancelable_tasks_main.cc b/tiledb/sm/misc/test/compile_cancelable_tasks_main.cc deleted file mode 100644 index 3e6cb217993..00000000000 --- a/tiledb/sm/misc/test/compile_cancelable_tasks_main.cc +++ /dev/null @@ -1,34 +0,0 @@ -/** - * @file compile_uri_main.cc - * - * @section LICENSE - * - * The MIT License - * - * @copyright Copyright (c) 2021 TileDB, Inc. - * - * Permission is hereby granted, free of charge, to any person obtaining a copy - * of this software and associated documentation files (the "Software"), to deal - * in the Software without restriction, including without limitation the rights - * to use, copy, modify, merge, publish, distribute, sublicense, and/or sell - * copies of the Software, and to permit persons to whom the Software is - * furnished to do so, subject to the following conditions: - * - * The above copyright notice and this permission notice shall be included in - * all copies or substantial portions of the Software. - * - * THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR - * IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY, - * FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL THE - * AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER - * LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM, - * OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN - * THE SOFTWARE. - */ - -#include "../cancelable_tasks.h" - -int main() { - (void)sizeof(tiledb::sm::CancelableTasks); - return 0; -} diff --git a/tiledb/sm/misc/test/compile_constants_main.cc b/tiledb/sm/misc/test/compile_constants_main.cc deleted file mode 100644 index 090ef78137f..00000000000 --- a/tiledb/sm/misc/test/compile_constants_main.cc +++ /dev/null @@ -1,34 +0,0 @@ -/** - * @file compile_constants_main.cc - * - * @section LICENSE - * - * The MIT License - * - * @copyright Copyright (c) 2021 TileDB, Inc. - * - * Permission is hereby granted, free of charge, to any person obtaining a copy - * of this software and associated documentation files (the "Software"), to deal - * in the Software without restriction, including without limitation the rights - * to use, copy, modify, merge, publish, distribute, sublicense, and/or sell - * copies of the Software, and to permit persons to whom the Software is - * furnished to do so, subject to the following conditions: - * - * The above copyright notice and this permission notice shall be included in - * all copies or substantial portions of the Software. - * - * THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR - * IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY, - * FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL THE - * AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER - * LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM, - * OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN - * THE SOFTWARE. - */ - -#include "../constants.h" - -int main() { - (void)tiledb::sm::constants::var_size; - return 0; -} diff --git a/tiledb/sm/misc/test/compile_math_main.cc b/tiledb/sm/misc/test/compile_math_main.cc deleted file mode 100644 index 12962766ba6..00000000000 --- a/tiledb/sm/misc/test/compile_math_main.cc +++ /dev/null @@ -1,34 +0,0 @@ -/** - * @file compile_math_main.cc - * - * @section LICENSE - * - * The MIT License - * - * @copyright Copyright (c) 2021 TileDB, Inc. - * - * Permission is hereby granted, free of charge, to any person obtaining a copy - * of this software and associated documentation files (the "Software"), to deal - * in the Software without restriction, including without limitation the rights - * to use, copy, modify, merge, publish, distribute, sublicense, and/or sell - * copies of the Software, and to permit persons to whom the Software is - * furnished to do so, subject to the following conditions: - * - * The above copyright notice and this permission notice shall be included in - * all copies or substantial portions of the Software. - * - * THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR - * IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY, - * FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL THE - * AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER - * LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM, - * OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN - * THE SOFTWARE. - */ - -#include "../tdb_math.h" - -int main() { - (void)tiledb::sm::utils::math::ceil(1, 1); - return 0; -} diff --git a/tiledb/sm/misc/test/compile_misc_types_main.cc b/tiledb/sm/misc/test/compile_misc_types_main.cc deleted file mode 100644 index 9b3cd61451f..00000000000 --- a/tiledb/sm/misc/test/compile_misc_types_main.cc +++ /dev/null @@ -1,35 +0,0 @@ -/** - * @file compile_misc_types_main.cc - * - * @section LICENSE - * - * The MIT License - * - * @copyright Copyright (c) 2021 TileDB, Inc. - * - * Permission is hereby granted, free of charge, to any person obtaining a copy - * of this software and associated documentation files (the "Software"), to deal - * in the Software without restriction, including without limitation the rights - * to use, copy, modify, merge, publish, distribute, sublicense, and/or sell - * copies of the Software, and to permit persons to whom the Software is - * furnished to do so, subject to the following conditions: - * - * The above copyright notice and this permission notice shall be included in - * all copies or substantial portions of the Software. - * - * THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR - * IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY, - * FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL THE - * AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER - * LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM, - * OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN - * THE SOFTWARE. - */ - -#include -#include "../types.h" - -int main() { - (void)&tiledb::sm::ByteVecValue::rvalue_as; - return 0; -} diff --git a/tiledb/sm/misc/test/compile_parse_argument_main.cc b/tiledb/sm/misc/test/compile_parse_argument_main.cc deleted file mode 100644 index 0c9d028140d..00000000000 --- a/tiledb/sm/misc/test/compile_parse_argument_main.cc +++ /dev/null @@ -1,35 +0,0 @@ -/** - * @file compile_constants_main.cc - * - * @section LICENSE - * - * The MIT License - * - * @copyright Copyright (c) 2021 TileDB, Inc. - * - * Permission is hereby granted, free of charge, to any person obtaining a copy - * of this software and associated documentation files (the "Software"), to deal - * in the Software without restriction, including without limitation the rights - * to use, copy, modify, merge, publish, distribute, sublicense, and/or sell - * copies of the Software, and to permit persons to whom the Software is - * furnished to do so, subject to the following conditions: - * - * The above copyright notice and this permission notice shall be included in - * all copies or substantial portions of the Software. - * - * THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR - * IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY, - * FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL THE - * AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER - * LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM, - * OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN - * THE SOFTWARE. - */ - -#include "../parse_argument.h" - -int main() { - int x; - (void)tiledb::sm::utils::parse::convert("0", &x); - return 0; -} diff --git a/tiledb/sm/misc/test/compile_rectangle_main.cc b/tiledb/sm/misc/test/compile_rectangle_main.cc deleted file mode 100644 index fccba9858b5..00000000000 --- a/tiledb/sm/misc/test/compile_rectangle_main.cc +++ /dev/null @@ -1,36 +0,0 @@ -/** - * @file compile_rectangle_main.cc - * - * @section LICENSE - * - * The MIT License - * - * @copyright Copyright (c) 2024 TileDB, Inc. - * - * Permission is hereby granted, free of charge, to any person obtaining a copy - * of this software and associated documentation files (the "Software"), to deal - * in the Software without restriction, including without limitation the rights - * to use, copy, modify, merge, publish, distribute, sublicense, and/or sell - * copies of the Software, and to permit persons to whom the Software is - * furnished to do so, subject to the following conditions: - * - * The above copyright notice and this permission notice shall be included in - * all copies or substantial portions of the Software. - * - * THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR - * IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY, - * FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL THE - * AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER - * LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM, - * OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN - * THE SOFTWARE. - */ - -#include "../rectangle.h" - -int main() { - const auto x = 0; - const auto y = 0; - (void)tiledb::sm::rectangle::overlap(&x, &y, 0); - return 0; -} diff --git a/tiledb/sm/misc/test/compile_time_main.cc b/tiledb/sm/misc/test/compile_time_main.cc deleted file mode 100644 index 0b4ab8fd25c..00000000000 --- a/tiledb/sm/misc/test/compile_time_main.cc +++ /dev/null @@ -1,34 +0,0 @@ -/** - * @file compile_time_main.cc - * - * @section LICENSE - * - * The MIT License - * - * @copyright Copyright (c) 2021 TileDB, Inc. - * - * Permission is hereby granted, free of charge, to any person obtaining a copy - * of this software and associated documentation files (the "Software"), to deal - * in the Software without restriction, including without limitation the rights - * to use, copy, modify, merge, publish, distribute, sublicense, and/or sell - * copies of the Software, and to permit persons to whom the Software is - * furnished to do so, subject to the following conditions: - * - * The above copyright notice and this permission notice shall be included in - * all copies or substantial portions of the Software. - * - * THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR - * IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY, - * FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL THE - * AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER - * LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM, - * OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN - * THE SOFTWARE. - */ - -#include "../tdb_time.h" - -int main() { - (void)tiledb::sm::utils::time::timestamp_now_ms(); - return 0; -} diff --git a/tiledb/sm/object/test/compile_object_main.cc b/tiledb/sm/object/test/compile_object_main.cc deleted file mode 100644 index 3d3cfd7d0ab..00000000000 --- a/tiledb/sm/object/test/compile_object_main.cc +++ /dev/null @@ -1,43 +0,0 @@ -/** - * @file compile_object_main.cc - * - * @section LICENSE - * - * The MIT License - * - * @copyright Copyright (c) 2024 TileDB, Inc. - * - * Permission is hereby granted, free of charge, to any person obtaining a copy - * of this software and associated documentation files (the "Software"), to deal - * in the Software without restriction, including without limitation the rights - * to use, copy, modify, merge, publish, distribute, sublicense, and/or sell - * copies of the Software, and to permit persons to whom the Software is - * furnished to do so, subject to the following conditions: - * - * The above copyright notice and this permission notice shall be included in - * all copies or substantial portions of the Software. - * - * THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR - * IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY, - * FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL THE - * AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER - * LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM, - * OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN - * THE SOFTWARE. - */ - -#include "../object.h" - -#include "tiledb/common/logger.h" -#include "tiledb/sm/storage_manager/context_resources.h" - -using namespace tiledb::sm; - -int main() { - Config config; - auto logger = make_shared(HERE(), "foo"); - ContextResources resources(config, logger, 1, 1, ""); - object_move(resources, "old_path", "new_path"); - - return 0; -} diff --git a/tiledb/sm/query/ast/test/compile_query_ast_main.cc b/tiledb/sm/query/ast/test/compile_query_ast_main.cc deleted file mode 100644 index 8e730e5a905..00000000000 --- a/tiledb/sm/query/ast/test/compile_query_ast_main.cc +++ /dev/null @@ -1,36 +0,0 @@ -/** - * @file compile_ast_main.cc - * - * @section LICENSE - * - * The MIT License - * - * @copyright Copyright (c) 2022 TileDB, Inc. - * - * Permission is hereby granted, free of charge, to any person obtaining a copy - * of this software and associated documentation files (the "Software"), to deal - * in the Software without restriction, including without limitation the rights - * to use, copy, modify, merge, publish, distribute, sublicense, and/or sell - * copies of the Software, and to permit persons to whom the Software is - * furnished to do so, subject to the following conditions: - * - * The above copyright notice and this permission notice shall be included in - * all copies or substantial portions of the Software. - * - * THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR - * IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY, - * FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL THE - * AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER - * LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM, - * OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN - * THE SOFTWARE. - */ - -#include "../query_ast.h" - -int main() { - (void)sizeof(tiledb::sm::ASTNode); - (void)sizeof(tiledb::sm::ASTNodeVal); - (void)sizeof(tiledb::sm::ASTNodeExpr); - return 0; -} diff --git a/tiledb/sm/query/query_condition.cc b/tiledb/sm/query/query_condition.cc index cd0be2bf5d5..42ff7ada359 100644 --- a/tiledb/sm/query/query_condition.cc +++ b/tiledb/sm/query/query_condition.cc @@ -217,15 +217,7 @@ Status QueryCondition::combine( return Status::Ok(); } -Status QueryCondition::negate( - QueryConditionCombinationOp combination_op, - QueryCondition* combined_cond) const { - if (combination_op != QueryConditionCombinationOp::NOT) { - return Status_QueryConditionError( - "Cannot negate query condition; Only the 'NOT' " - "combination op is supported in this function."); - } - +Status QueryCondition::negate(QueryCondition* combined_cond) const { combined_cond->field_names_.clear(); combined_cond->enumeration_field_names_.clear(); combined_cond->tree_ = this->tree_->get_negated_tree(); diff --git a/tiledb/sm/query/query_condition.h b/tiledb/sm/query/query_condition.h index 0d9e827c4eb..ccc9b6eed3b 100644 --- a/tiledb/sm/query/query_condition.h +++ b/tiledb/sm/query/query_condition.h @@ -244,9 +244,7 @@ class QueryCondition { * @param combined_cond Where the negated condition is stored. * @return Status */ - Status negate( - QueryConditionCombinationOp combination_op, - QueryCondition* combined_cond) const; + Status negate(QueryCondition* combined_cond) const; /** * Returns true if this condition does not have any nodes in the AST diff --git a/tiledb/sm/query/readers/aggregators/test/compile_aggregators_main.cc b/tiledb/sm/query/readers/aggregators/test/compile_aggregators_main.cc deleted file mode 100644 index 87402f9a651..00000000000 --- a/tiledb/sm/query/readers/aggregators/test/compile_aggregators_main.cc +++ /dev/null @@ -1,129 +0,0 @@ -/** - * @file compile_aggregators_main.cc - * - * @section LICENSE - * - * The MIT License - * - * @copyright Copyright (c) 2023 TileDB, Inc. - * - * Permission is hereby granted, free of charge, to any person obtaining a copy - * of this software and associated documentation files (the "Software"), to deal - * in the Software without restriction, including without limitation the rights - * to use, copy, modify, merge, publish, distribute, sublicense, and/or sell - * copies of the Software, and to permit persons to whom the Software is - * furnished to do so, subject to the following conditions: - * - * The above copyright notice and this permission notice shall be included in - * all copies or substantial portions of the Software. - * - * THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR - * IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY, - * FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL THE - * AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER - * LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM, - * OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN - * THE SOFTWARE. - */ - -#include "../count_aggregator.h" -#include "../field_info.h" -#include "../min_max_aggregator.h" -#include "../sum_aggregator.h" - -int main() { - tiledb::sm::CountAggregator(); - - tiledb::sm::MeanAggregator(tiledb::sm::FieldInfo( - "Mean", false, false, 1, tiledb::sm::Datatype::UINT8)); - tiledb::sm::MeanAggregator(tiledb::sm::FieldInfo( - "Mean", false, false, 1, tiledb::sm::Datatype::UINT8)); - tiledb::sm::MeanAggregator(tiledb::sm::FieldInfo( - "Mean", false, false, 1, tiledb::sm::Datatype::UINT8)); - tiledb::sm::MeanAggregator(tiledb::sm::FieldInfo( - "Mean", false, false, 1, tiledb::sm::Datatype::UINT8)); - tiledb::sm::MeanAggregator(tiledb::sm::FieldInfo( - "Mean", false, false, 1, tiledb::sm::Datatype::UINT8)); - tiledb::sm::MeanAggregator(tiledb::sm::FieldInfo( - "Mean", false, false, 1, tiledb::sm::Datatype::UINT8)); - tiledb::sm::MeanAggregator(tiledb::sm::FieldInfo( - "Mean", false, false, 1, tiledb::sm::Datatype::UINT8)); - tiledb::sm::MeanAggregator(tiledb::sm::FieldInfo( - "Mean", false, false, 1, tiledb::sm::Datatype::UINT8)); - tiledb::sm::MeanAggregator(tiledb::sm::FieldInfo( - "Mean", false, false, 1, tiledb::sm::Datatype::UINT8)); - tiledb::sm::MeanAggregator(tiledb::sm::FieldInfo( - "Mean", false, false, 1, tiledb::sm::Datatype::UINT8)); - - tiledb::sm::MinAggregator(tiledb::sm::FieldInfo( - "MinMax", false, false, 1, tiledb::sm::Datatype::UINT8)); - tiledb::sm::MinAggregator(tiledb::sm::FieldInfo( - "MinMax", false, false, 1, tiledb::sm::Datatype::UINT8)); - tiledb::sm::MinAggregator(tiledb::sm::FieldInfo( - "MinMax", false, false, 1, tiledb::sm::Datatype::UINT8)); - tiledb::sm::MinAggregator(tiledb::sm::FieldInfo( - "MinMax", false, false, 1, tiledb::sm::Datatype::UINT8)); - tiledb::sm::MinAggregator(tiledb::sm::FieldInfo( - "MinMax", false, false, 1, tiledb::sm::Datatype::UINT8)); - tiledb::sm::MinAggregator(tiledb::sm::FieldInfo( - "MinMax", false, false, 1, tiledb::sm::Datatype::UINT8)); - tiledb::sm::MinAggregator(tiledb::sm::FieldInfo( - "MinMax", false, false, 1, tiledb::sm::Datatype::UINT8)); - tiledb::sm::MinAggregator(tiledb::sm::FieldInfo( - "MinMax", false, false, 1, tiledb::sm::Datatype::UINT8)); - tiledb::sm::MinAggregator(tiledb::sm::FieldInfo( - "MinMax", false, false, 1, tiledb::sm::Datatype::UINT8)); - tiledb::sm::MinAggregator(tiledb::sm::FieldInfo( - "MinMax", false, false, 1, tiledb::sm::Datatype::UINT8)); - tiledb::sm::MinAggregator(tiledb::sm::FieldInfo( - "MinMax", false, false, 1, tiledb::sm::Datatype::UINT8)); - - tiledb::sm::MaxAggregator(tiledb::sm::FieldInfo( - "MinMax", false, false, 1, tiledb::sm::Datatype::UINT8)); - tiledb::sm::MaxAggregator(tiledb::sm::FieldInfo( - "MinMax", false, false, 1, tiledb::sm::Datatype::UINT8)); - tiledb::sm::MaxAggregator(tiledb::sm::FieldInfo( - "MinMax", false, false, 1, tiledb::sm::Datatype::UINT8)); - tiledb::sm::MaxAggregator(tiledb::sm::FieldInfo( - "MinMax", false, false, 1, tiledb::sm::Datatype::UINT8)); - tiledb::sm::MaxAggregator(tiledb::sm::FieldInfo( - "MinMax", false, false, 1, tiledb::sm::Datatype::UINT8)); - tiledb::sm::MaxAggregator(tiledb::sm::FieldInfo( - "MinMax", false, false, 1, tiledb::sm::Datatype::UINT8)); - tiledb::sm::MaxAggregator(tiledb::sm::FieldInfo( - "MinMax", false, false, 1, tiledb::sm::Datatype::UINT8)); - tiledb::sm::MaxAggregator(tiledb::sm::FieldInfo( - "MinMax", false, false, 1, tiledb::sm::Datatype::UINT8)); - tiledb::sm::MaxAggregator(tiledb::sm::FieldInfo( - "MinMax", false, false, 1, tiledb::sm::Datatype::UINT8)); - tiledb::sm::MaxAggregator(tiledb::sm::FieldInfo( - "MinMax", false, false, 1, tiledb::sm::Datatype::UINT8)); - tiledb::sm::MaxAggregator(tiledb::sm::FieldInfo( - "MinMax", false, false, 1, tiledb::sm::Datatype::UINT8)); - - tiledb::sm::NullCountAggregator(tiledb::sm::FieldInfo( - "NullCount", false, false, 1, tiledb::sm::Datatype::UINT8)); - - tiledb::sm::SumAggregator(tiledb::sm::FieldInfo( - "Sum", false, false, 1, tiledb::sm::Datatype::UINT8)); - tiledb::sm::SumAggregator(tiledb::sm::FieldInfo( - "Sum", false, false, 1, tiledb::sm::Datatype::UINT8)); - tiledb::sm::SumAggregator(tiledb::sm::FieldInfo( - "Sum", false, false, 1, tiledb::sm::Datatype::UINT8)); - tiledb::sm::SumAggregator(tiledb::sm::FieldInfo( - "Sum", false, false, 1, tiledb::sm::Datatype::UINT8)); - tiledb::sm::SumAggregator(tiledb::sm::FieldInfo( - "Sum", false, false, 1, tiledb::sm::Datatype::UINT8)); - tiledb::sm::SumAggregator(tiledb::sm::FieldInfo( - "Sum", false, false, 1, tiledb::sm::Datatype::UINT8)); - tiledb::sm::SumAggregator(tiledb::sm::FieldInfo( - "Sum", false, false, 1, tiledb::sm::Datatype::UINT8)); - tiledb::sm::SumAggregator(tiledb::sm::FieldInfo( - "Sum", false, false, 1, tiledb::sm::Datatype::UINT8)); - tiledb::sm::SumAggregator(tiledb::sm::FieldInfo( - "Sum", false, false, 1, tiledb::sm::Datatype::UINT8)); - tiledb::sm::SumAggregator(tiledb::sm::FieldInfo( - "Sum", false, false, 1, tiledb::sm::Datatype::UINT8)); - - return 0; -} diff --git a/tiledb/sm/query_plan/CMakeLists.txt b/tiledb/sm/query_plan/CMakeLists.txt index 7d282cc24f6..27b6a3b9609 100644 --- a/tiledb/sm/query_plan/CMakeLists.txt +++ b/tiledb/sm/query_plan/CMakeLists.txt @@ -24,17 +24,14 @@ # THE SOFTWARE. # include(common NO_POLICY_SCOPE) +include(object_library) # # Object library for query plan # -# Maturity: -# This library cannot link standalone because it depends upon `class Query`. -# This class is at present unable to be part of a standalone object library. -# Note that the unit test for this module links in the whole library. -# -add_library(query_plan OBJECT EXCLUDE_FROM_ALL query_plan.cc) -target_link_libraries(query_plan PUBLIC baseline $) -target_link_libraries(query_plan PUBLIC buffer $) +commence(object_library query_plan) + this_target_sources(query_plan.cc) + this_target_object_libraries(baseline buffer) +conclude(object_library) add_test_subdirectory() diff --git a/tiledb/sm/query_plan/test/compile_query_plan_main.cc b/tiledb/sm/query_plan/test/compile_query_plan_main.cc deleted file mode 100644 index 3efd0fd3ef6..00000000000 --- a/tiledb/sm/query_plan/test/compile_query_plan_main.cc +++ /dev/null @@ -1,34 +0,0 @@ -/** - * @file compile_query_plan_main.cc - * - * @section LICENSE - * - * The MIT License - * - * @copyright Copyright (c) 2021 TileDB, Inc. - * - * Permission is hereby granted, free of charge, to any person obtaining a copy - * of this software and associated documentation files (the "Software"), to deal - * in the Software without restriction, including without limitation the rights - * to use, copy, modify, merge, publish, distribute, sublicense, and/or sell - * copies of the Software, and to permit persons to whom the Software is - * furnished to do so, subject to the following conditions: - * - * The above copyright notice and this permission notice shall be included in - * all copies or substantial portions of the Software. - * - * THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR - * IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY, - * FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL THE - * AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER - * LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM, - * OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN - * THE SOFTWARE. - */ - -#include "../query_plan.h" - -int main() { - (void)sizeof(tiledb::sm::QueryPlan); - return 0; -} diff --git a/tiledb/sm/rest/test/compile_rest_client_main.cc b/tiledb/sm/rest/test/compile_rest_client_main.cc deleted file mode 100644 index ce3618a12f5..00000000000 --- a/tiledb/sm/rest/test/compile_rest_client_main.cc +++ /dev/null @@ -1,38 +0,0 @@ -/** - * @file tiledb/sm/rest/test/compile_rest_client_main.cc - * - * @section LICENSE - * - * The MIT License - * - * @copyright Copyright (c) 2024 TileDB, Inc. - * - * Permission is hereby granted, free of charge, to any person obtaining a copy - * of this software and associated documentation files (the "Software"), to deal - * in the Software without restriction, including without limitation the rights - * to use, copy, modify, merge, publish, distribute, sublicense, and/or sell - * copies of the Software, and to permit persons to whom the Software is - * furnished to do so, subject to the following conditions: - * - * The above copyright notice and this permission notice shall be included in - * all copies or substantial portions of the Software. - * - * THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR - * IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY, - * FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL THE - * AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER - * LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM, - * OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN - * THE SOFTWARE. - */ - -#include "../rest_client.h" - -int main() { - /* - * Even though the factory has a default constructor, it's enough to pull - * in the object code for `class RestClient` itself. - */ - [[maybe_unused]] tiledb::sm::RestClientFactory x{}; - return 0; -} diff --git a/tiledb/sm/rest/test/compile_rest_profile_main.cc b/tiledb/sm/rest/test/compile_rest_profile_main.cc deleted file mode 100644 index c0911156a83..00000000000 --- a/tiledb/sm/rest/test/compile_rest_profile_main.cc +++ /dev/null @@ -1,34 +0,0 @@ -/** - * @file tiledb/sm/rest/test/compile_rest_profile_main.cc - * - * @section LICENSE - * - * The MIT License - * - * @copyright Copyright (c) 2025 TileDB, Inc. - * - * Permission is hereby granted, free of charge, to any person obtaining a copy - * of this software and associated documentation files (the "Software"), to deal - * in the Software without restriction, including without limitation the rights - * to use, copy, modify, merge, publish, distribute, sublicense, and/or sell - * copies of the Software, and to permit persons to whom the Software is - * furnished to do so, subject to the following conditions: - * - * The above copyright notice and this permission notice shall be included in - * all copies or substantial portions of the Software. - * - * THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR - * IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY, - * FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL THE - * AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER - * LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM, - * OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN - * THE SOFTWARE. - */ - -#include "../rest_profile.h" - -int main() { - [[maybe_unused]] tiledb::sm::RestProfile x{}; - return 0; -} diff --git a/tiledb/sm/rtree/test/compile_rtree_main.cc b/tiledb/sm/rtree/test/compile_rtree_main.cc deleted file mode 100644 index f1f30d98cb9..00000000000 --- a/tiledb/sm/rtree/test/compile_rtree_main.cc +++ /dev/null @@ -1,34 +0,0 @@ -/** - * @file compile_rtree_main.cc - * - * @section LICENSE - * - * The MIT License - * - * @copyright Copyright (c) 2022 TileDB, Inc. - * - * Permission is hereby granted, free of charge, to any person obtaining a copy - * of this software and associated documentation files (the "Software"), to deal - * in the Software without restriction, including without limitation the rights - * to use, copy, modify, merge, publish, distribute, sublicense, and/or sell - * copies of the Software, and to permit persons to whom the Software is - * furnished to do so, subject to the following conditions: - * - * The above copyright notice and this permission notice shall be included in - * all copies or substantial portions of the Software. - * - * THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR - * IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY, - * FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL THE - * AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER - * LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM, - * OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN - * THE SOFTWARE. - */ - -#include "../rtree.h" - -int main() { - tiledb::sm::RTree x{nullptr, 0, nullptr}; - return 0; -} diff --git a/tiledb/sm/stats/test/compile_stats_main.cc b/tiledb/sm/stats/test/compile_stats_main.cc deleted file mode 100644 index 22ef30ac6bf..00000000000 --- a/tiledb/sm/stats/test/compile_stats_main.cc +++ /dev/null @@ -1,34 +0,0 @@ -/** - * @file compile_stats_main.cc - * - * @section LICENSE - * - * The MIT License - * - * @copyright Copyright (c) 2021 TileDB, Inc. - * - * Permission is hereby granted, free of charge, to any person obtaining a copy - * of this software and associated documentation files (the "Software"), to deal - * in the Software without restriction, including without limitation the rights - * to use, copy, modify, merge, publish, distribute, sublicense, and/or sell - * copies of the Software, and to permit persons to whom the Software is - * furnished to do so, subject to the following conditions: - * - * The above copyright notice and this permission notice shall be included in - * all copies or substantial portions of the Software. - * - * THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR - * IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY, - * FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL THE - * AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER - * LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM, - * OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN - * THE SOFTWARE. - */ - -#include "../stats.h" - -int main() { - (void)sizeof(tiledb::sm::stats::Stats); - return 0; -} diff --git a/tiledb/sm/storage_manager/test/compile_context_resources_main.cc b/tiledb/sm/storage_manager/test/compile_context_resources_main.cc deleted file mode 100644 index f67ed40750f..00000000000 --- a/tiledb/sm/storage_manager/test/compile_context_resources_main.cc +++ /dev/null @@ -1,35 +0,0 @@ -/** - * @file compile_context_resources_main.cc - * - * @section LICENSE - * - * The MIT License - * - * @copyright Copyright (c) 2023 TileDB, Inc. - * - * Permission is hereby granted, free of charge, to any person obtaining a copy - * of this software and associated documentation files (the "Software"), to deal - * in the Software without restriction, including without limitation the rights - * to use, copy, modify, merge, publish, distribute, sublicense, and/or sell - * copies of the Software, and to permit persons to whom the Software is - * furnished to do so, subject to the following conditions: - * - * The above copyright notice and this permission notice shall be included in - * all copies or substantial portions of the Software. - * - * THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR - * IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY, - * FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL THE - * AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER - * LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM, - * OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN - * THE SOFTWARE. - */ - -#include "../context_resources.h" - -int main() { - tiledb::sm::Config config{}; - tiledb::sm::ContextResources(config, nullptr, 0, 0, ""); - return 0; -} diff --git a/tiledb/sm/subarray/test/compile_range_subset_main.cc b/tiledb/sm/subarray/test/compile_range_subset_main.cc deleted file mode 100644 index dd0fa576ec4..00000000000 --- a/tiledb/sm/subarray/test/compile_range_subset_main.cc +++ /dev/null @@ -1,34 +0,0 @@ -/** - * @file compile_range_subset_main.cc - * - * @section license - * - * the mit license - * - * @copyright copyright (c) 2022 tiledb, inc. - * - * permission is hereby granted, free of charge, to any person obtaining a copy - * of this software and associated documentation files (the "software"), to deal - * in the software without restriction, including without limitation the rights - * to use, copy, modify, merge, publish, distribute, sublicense, and/or sell - * copies of the software, and to permit persons to whom the software is - * furnished to do so, subject to the following conditions: - * - * the above copyright notice and this permission notice shall be included in - * all copies or substantial portions of the software. - * - * the software is provided "as is", without warranty of any kind, express or - * implied, including but not limited to the warranties of merchantability, - * fitness for a particular purpose and noninfringement. in no event shall the - * authors or copyright holders be liable for any claim, damages or other - * liability, whether in an action of contract, tort or otherwise, arising from, - * out of or in connection with the software or the use or other dealings in - * the software. - */ - -#include "../range_subset.h" - -int main() { - (void)sizeof(tiledb::sm::RangeSetAndSuperset); - return 0; -} diff --git a/tiledb/sm/subarray/test/compile_subarray_main.cc b/tiledb/sm/subarray/test/compile_subarray_main.cc deleted file mode 100644 index 55d64a86136..00000000000 --- a/tiledb/sm/subarray/test/compile_subarray_main.cc +++ /dev/null @@ -1,45 +0,0 @@ -/** - * @file compile_subarray_main.cc - * - * @section LICENSE - * - * The MIT License - * - * @copyright Copyright (c) 2024 TileDB, Inc. - * - * Permission is hereby granted, free of charge, to any person obtaining a copy - * of this software and associated documentation files (the "Software"), to deal - * in the Software without restriction, including without limitation the rights - * to use, copy, modify, merge, publish, distribute, sublicense, and/or sell - * copies of the Software, and to permit persons to whom the Software is - * furnished to do so, subject to the following conditions: - * - * The above copyright notice and this permission notice shall be included in - * all copies or substantial portions of the Software. - * - * THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR - * IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY, - * FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL THE - * AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER - * LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM, - * OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN - * THE SOFTWARE. - */ - -#include "../relevant_fragment_generator.h" -#include "../subarray.h" -#include "../subarray_tile_overlap.h" - -using namespace tiledb::sm; - -int main() { - Subarray subarray; - RelevantFragmentGenerator rfg( - subarray.array(), subarray, const_cast(&subarray.stats())); - (void)rfg.update_range_coords(subarray.subarray_tile_overlap()); - - SubarrayTileOverlap subarray_tile_overlap; - subarray_tile_overlap.clear(); - - return 0; -} diff --git a/tiledb/sm/tile/test/compile_generic_tile_io_main.cc b/tiledb/sm/tile/test/compile_generic_tile_io_main.cc deleted file mode 100644 index ba8bdecd944..00000000000 --- a/tiledb/sm/tile/test/compile_generic_tile_io_main.cc +++ /dev/null @@ -1,40 +0,0 @@ -/** - * @file compile_generic_tile_io_main.cc - * - * @section LICENSE - * - * The MIT License - * - * @copyright Copyright (c) 2021 TileDB, Inc. - * - * Permission is hereby granted, free of charge, to any person obtaining a copy - * of this software and associated documentation files (the "Software"), to deal - * in the Software without restriction, including without limitation the rights - * to use, copy, modify, merge, publish, distribute, sublicense, and/or sell - * copies of the Software, and to permit persons to whom the Software is - * furnished to do so, subject to the following conditions: - * - * The above copyright notice and this permission notice shall be included in - * all copies or substantial portions of the Software. - * - * THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR - * IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY, - * FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL THE - * AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER - * LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM, - * OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN - * THE SOFTWARE. - */ - -#include "tiledb/sm/filesystem/uri.h" -#include "tiledb/sm/storage_manager/context_resources.h" -#include "tiledb/sm/tile/generic_tile_io.h" - -using namespace tiledb::sm; - -int main() { - Config config{}; - ContextResources resources{config, nullptr, 1, 1, ""}; - GenericTileIO::read_generic_tile_header(resources, URI(), 0); - return 0; -} diff --git a/tiledb/sm/tile/test/compile_tile_main.cc b/tiledb/sm/tile/test/compile_tile_main.cc deleted file mode 100644 index 1b8ed29b021..00000000000 --- a/tiledb/sm/tile/test/compile_tile_main.cc +++ /dev/null @@ -1,34 +0,0 @@ -/** - * @file compile_tile_main.cc - * - * @section LICENSE - * - * The MIT License - * - * @copyright Copyright (c) 2021 TileDB, Inc. - * - * Permission is hereby granted, free of charge, to any person obtaining a copy - * of this software and associated documentation files (the "Software"), to deal - * in the Software without restriction, including without limitation the rights - * to use, copy, modify, merge, publish, distribute, sublicense, and/or sell - * copies of the Software, and to permit persons to whom the Software is - * furnished to do so, subject to the following conditions: - * - * The above copyright notice and this permission notice shall be included in - * all copies or substantial portions of the Software. - * - * THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR - * IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY, - * FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL THE - * AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER - * LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM, - * OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN - * THE SOFTWARE. - */ - -#include "../tile.h" - -int main() { - (void)sizeof(tiledb::sm::Tile); - return 0; -} diff --git a/tiledb/sm/tile/test/compile_writer_tile_main.cc b/tiledb/sm/tile/test/compile_writer_tile_main.cc deleted file mode 100644 index 4c61eebb48b..00000000000 --- a/tiledb/sm/tile/test/compile_writer_tile_main.cc +++ /dev/null @@ -1,50 +0,0 @@ -/** - * @file compile_writer_tile_main.cc - * - * @section LICENSE - * - * The MIT License - * - * @copyright Copyright (c) 2024 TileDB, Inc. - * - * Permission is hereby granted, free of charge, to any person obtaining a copy - * of this software and associated documentation files (the "Software"), to deal - * in the Software without restriction, including without limitation the rights - * to use, copy, modify, merge, publish, distribute, sublicense, and/or sell - * copies of the Software, and to permit persons to whom the Software is - * furnished to do so, subject to the following conditions: - * - * The above copyright notice and this permission notice shall be included in - * all copies or substantial portions of the Software. - * - * THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR - * IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY, - * FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL THE - * AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER - * LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM, - * OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN - * THE SOFTWARE. - */ - -#include "../tile_metadata_generator.h" -#include "../writer_tile_tuple.h" - -#include "tiledb/common/memory_tracker.h" -#include "tiledb/sm/enums/array_type.h" - -using namespace tiledb::sm; - -int main() { - MemoryTrackerManager mem; - auto mem_tracker = mem.create_tracker(); - ArraySchema schema(ArrayType::DENSE, mem_tracker); - - WriterTileTuple writer( - schema, 0, false, false, 0, Datatype::ANY, mem_tracker); - (void)writer.var_size(); - - TileMetadataGenerator generator(Datatype::ANY, false, false, 0, 0); - (void)generator.process_full_tile(writer); - - return 0; -} diff --git a/tiledb/storage_format/uri/test/compile_uri_format_main.cc b/tiledb/storage_format/uri/test/compile_uri_format_main.cc deleted file mode 100644 index adca02dc03e..00000000000 --- a/tiledb/storage_format/uri/test/compile_uri_format_main.cc +++ /dev/null @@ -1,43 +0,0 @@ -/** - * @file compile_uri_format_main.cc - * - * @section LICENSE - * - * The MIT License - * - * @copyright Copyright (c) 2022-2024 TileDB, Inc. - * - * Permission is hereby granted, free of charge, to any person obtaining a copy - * of this software and associated documentation files (the "Software"), to deal - * in the Software without restriction, including without limitation the rights - * to use, copy, modify, merge, publish, distribute, sublicense, and/or sell - * copies of the Software, and to permit persons to whom the Software is - * furnished to do so, subject to the following conditions: - * - * The above copyright notice and this permission notice shall be included in - * all copies or substantial portions of the Software. - * - * THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR - * IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY, - * FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL THE - * AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER - * LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM, - * OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN - * THE SOFTWARE. - */ - -#include "../generate_uri.h" -#include "../parse_uri.h" - -using namespace tiledb::storage_format; -using namespace tiledb::sm::utils::parse; - -int main() { - (void)generate_timestamped_name(1, 2, 1); - (void)generate_timestamped_name(1, 1); - (void)generate_consolidated_fragment_name( - tiledb::sm::URI{}, tiledb::sm::URI{}, 1); - - (void)is_element_of(tiledb::sm::URI{}, tiledb::sm::URI{}); - return 0; -} diff --git a/tiledb/type/range/test/compile_range_main.cc b/tiledb/type/range/test/compile_range_main.cc deleted file mode 100644 index 1b4997220b8..00000000000 --- a/tiledb/type/range/test/compile_range_main.cc +++ /dev/null @@ -1,34 +0,0 @@ -/** - * @file compile_range_main.cc - * - * @section LICENSE - * - * The MIT License - * - * @copyright Copyright (c) 2021 TileDB, Inc. - * - * Permission is hereby granted, free of charge, to any person obtaining a copy - * of this software and associated documentation files (the "Software"), to deal - * in the Software without restriction, including without limitation the rights - * to use, copy, modify, merge, publish, distribute, sublicense, and/or sell - * copies of the Software, and to permit persons to whom the Software is - * furnished to do so, subject to the following conditions: - * - * The above copyright notice and this permission notice shall be included in - * all copies or substantial portions of the Software. - * - * THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR - * IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY, - * FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL THE - * AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER - * LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM, - * OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN - * THE SOFTWARE. - */ - -#include "../range.h" - -int main() { - (void)sizeof(tiledb::type::Range); - return 0; -}