Skip to content

Commit f84be6c

Browse files
bekadavis9KiterLuc
andauthored
ArraySchema CAPI Handle. (#5225)
`ArraySchema` CAPI Handle. [sc-51832] --- TYPE: C_API DESC: `ArraySchema` CAPI Handle. --------- Co-authored-by: KiterLuc <[email protected]>
1 parent 5b92634 commit f84be6c

40 files changed

+3466
-1821
lines changed

CMakeLists.txt

Lines changed: 7 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -286,6 +286,12 @@ endif()
286286

287287
list(APPEND TILEDB_C_API_RELATIVE_HEADERS
288288
"${CMAKE_SOURCE_DIR}/tiledb/api/c_api/api_external_common.h"
289+
"${CMAKE_SOURCE_DIR}/tiledb/api/c_api/array/array_api_external.h"
290+
"${CMAKE_SOURCE_DIR}/tiledb/api/c_api/array_schema/array_schema_api_deprecated.h"
291+
"${CMAKE_SOURCE_DIR}/tiledb/api/c_api/array_schema/array_schema_api_experimental.h"
292+
"${CMAKE_SOURCE_DIR}/tiledb/api/c_api/array_schema/array_schema_api_external.h"
293+
"${CMAKE_SOURCE_DIR}/tiledb/api/c_api/array_schema/array_type_enum.h"
294+
"${CMAKE_SOURCE_DIR}/tiledb/api/c_api/array_schema/layout_enum.h"
289295
"${CMAKE_SOURCE_DIR}/tiledb/api/c_api/attribute/attribute_api_external.h"
290296
"${CMAKE_SOURCE_DIR}/tiledb/api/c_api/attribute/attribute_api_external_experimental.h"
291297
"${CMAKE_SOURCE_DIR}/tiledb/api/c_api/buffer/buffer_api_external.h"
@@ -521,6 +527,7 @@ if (TILEDB_TESTS)
521527
# C API basics
522528
add_dependencies(tests unit_capi_config unit_capi_context)
523529
add_dependencies(tests unit_capi_array)
530+
add_dependencies(tests unit_capi_array_schema)
524531
add_dependencies(tests unit_capi_buffer)
525532
add_dependencies(tests unit_capi_buffer_list)
526533
add_dependencies(tests unit_capi_data_order)

test/src/test-capi-array-write-ordered-attr-fixed.cc

Lines changed: 4 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -5,7 +5,7 @@
55
*
66
* The MIT License
77
*
8-
* @copyright Copyright (c) 2022 TileDB Inc.
8+
* @copyright Copyright (c) 2022-2024 TileDB Inc.
99
*
1010
* Permission is hereby granted, free of charge, to any person obtaining a copy
1111
* of this software and associated documentation files (the "Software"), to deal
@@ -37,6 +37,8 @@ using namespace Catch::Matchers;
3737
#include <test/support/src/helpers.h>
3838
#include <test/support/src/vfs_helpers.h>
3939
#include <test/support/tdb_catch.h>
40+
#include "tiledb/api/c_api/array_schema/array_schema_api_internal.h"
41+
#include "tiledb/api/c_api/attribute/attribute_api_internal.h"
4042
#include "tiledb/sm/array_schema/array_schema.h"
4143
#include "tiledb/sm/array_schema/attribute.h"
4244
#include "tiledb/sm/c_api/tiledb.h"
@@ -74,7 +76,7 @@ struct FixedOrderedAttributeArrayFixture {
7476
// Define the attribute: skip C-API since ordered attributes aren't
7577
// exposed in the C-API yet.
7678
auto attr = make_shared<sm::Attribute>(HERE(), "a", type, 1, order);
77-
auto st = schema->array_schema_->add_attribute(attr);
79+
auto st = schema->add_attribute(attr);
7880
REQUIRE(st.ok());
7981

8082
// Create the array and clean-up.

test/src/test-capi-array-write-ordered-attr-var.cc

Lines changed: 4 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -5,7 +5,7 @@
55
*
66
* The MIT License
77
*
8-
* @copyright Copyright (c) 2022 TileDB Inc.
8+
* @copyright Copyright (c) 2022-2024 TileDB Inc.
99
*
1010
* Permission is hereby granted, free of charge, to any person obtaining a copy
1111
* of this software and associated documentation files (the "Software"), to deal
@@ -37,6 +37,8 @@ using namespace Catch::Matchers;
3737
#include <test/support/src/helpers.h>
3838
#include <test/support/src/vfs_helpers.h>
3939
#include <test/support/tdb_catch.h>
40+
#include "tiledb/api/c_api/array_schema/array_schema_api_internal.h"
41+
#include "tiledb/api/c_api/attribute/attribute_api_internal.h"
4042
#include "tiledb/sm/array_schema/array_schema.h"
4143
#include "tiledb/sm/array_schema/attribute.h"
4244
#include "tiledb/sm/c_api/tiledb.h"
@@ -75,7 +77,7 @@ struct VarOrderedAttributeArrayFixture {
7577
// exposed in the C-API yet.
7678
auto attr = make_shared<sm::Attribute>(
7779
HERE(), "a", Datatype::STRING_ASCII, constants::var_num, order);
78-
auto st = schema->array_schema_->add_attribute(attr);
80+
auto st = schema->add_attribute(attr);
7981
REQUIRE(st.ok());
8082

8183
// Create the array and clean-up.

test/src/test-capi-dimension-label.cc

Lines changed: 6 additions & 6 deletions
Original file line numberDiff line numberDiff line change
@@ -5,7 +5,7 @@
55
*
66
* The MIT License
77
*
8-
* @copyright Copyright (c) 2022 TileDB, Inc.
8+
* @copyright Copyright (c) 2022-2024 TileDB, Inc.
99
*
1010
* Permission is hereby granted, free of charge, to any person obtaining a copy
1111
* of this software and associated documentation files (the "Software"), to deal
@@ -32,6 +32,7 @@
3232

3333
#include "test/support/src/helpers.h"
3434
#include "test/support/src/vfs_helpers.h"
35+
#include "tiledb/api/c_api/array_schema/array_schema_api_internal.h"
3536
#include "tiledb/api/c_api/context/context_api_internal.h"
3637
#include "tiledb/sm/c_api/tiledb.h"
3738
#include "tiledb/sm/c_api/tiledb_experimental.h"
@@ -359,7 +360,7 @@ TEST_CASE_METHOD(
359360

360361
// Check array schema and number of dimension labels.
361362
require_tiledb_ok(tiledb_array_schema_check(ctx, array_schema));
362-
auto dim_label_num = array_schema->array_schema_->dim_label_num();
363+
auto dim_label_num = array_schema->dim_label_num();
363364
REQUIRE(dim_label_num == 1);
364365

365366
// Create array
@@ -384,10 +385,9 @@ TEST_CASE_METHOD(
384385
tiledb_array_schema_t* loaded_dim_label_array_schema{nullptr};
385386
require_tiledb_ok(tiledb_array_schema_load(
386387
ctx, dim_label_uri, &loaded_dim_label_array_schema));
387-
uint64_t loaded_tile_extent{
388-
loaded_dim_label_array_schema->array_schema_->dimension_ptr(0)
389-
->tile_extent()
390-
.rvalue_as<uint64_t>()};
388+
uint64_t loaded_tile_extent{loaded_dim_label_array_schema->dimension_ptr(0)
389+
->tile_extent()
390+
.rvalue_as<uint64_t>()};
391391
REQUIRE(tile_extent == loaded_tile_extent);
392392
tiledb_array_schema_free(&loaded_dim_label_array_schema);
393393
}

test/src/test-capi-subarray-labels.cc

Lines changed: 3 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -5,7 +5,7 @@
55
*
66
* The MIT License
77
*
8-
* @copyright Copyright (c) 2022 TileDB, Inc.
8+
* @copyright Copyright (c) 2022-2024 TileDB, Inc.
99
*
1010
* Permission is hereby granted, free of charge, to any person obtaining a copy
1111
* of this software and associated documentation files (the "Software"), to deal
@@ -32,6 +32,7 @@
3232

3333
#include "test/support/src/helpers.h"
3434
#include "test/support/src/vfs_helpers.h"
35+
#include "tiledb/api/c_api/array_schema/array_schema_api_internal.h"
3536
#include "tiledb/api/c_api/context/context_api_internal.h"
3637
#include "tiledb/sm/c_api/tiledb.h"
3738
#include "tiledb/sm/c_api/tiledb_experimental.h"
@@ -103,7 +104,7 @@ class SampleLabelledArrayTestFixture : public TemporaryDirectoryFixture {
103104

104105
// Check array schema and number of dimension labels.
105106
require_tiledb_ok(tiledb_array_schema_check(ctx, array_schema));
106-
auto dim_label_num = array_schema->array_schema_->dim_label_num();
107+
auto dim_label_num = array_schema->dim_label_num();
107108
REQUIRE(dim_label_num == 2);
108109

109110
// Create array and free array schema.

test/src/unit-capi-array.cc

Lines changed: 2 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -44,6 +44,8 @@
4444
#else
4545
#include "tiledb/sm/filesystem/posix.h"
4646
#endif
47+
#include "tiledb/api/c_api/array_schema/array_schema_api_external.h"
48+
#include "tiledb/api/c_api/array_schema/array_schema_api_internal.h"
4749
#include "tiledb/api/c_api/buffer/buffer_api_internal.h"
4850
#include "tiledb/api/c_api/context/context_api_internal.h"
4951
#include "tiledb/common/stdx_string.h"

test/src/unit-capi-enum_values.cc

Lines changed: 2 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -5,7 +5,7 @@
55
*
66
* The MIT License
77
*
8-
* @copyright Copyright (c) 2017-2022 TileDB Inc.
8+
* @copyright Copyright (c) 2017-2024 TileDB Inc.
99
* @copyright Copyright (c) 2016 MIT and Intel Corporation
1010
*
1111
* Permission is hereby granted, free of charge, to any person obtaining a copy
@@ -32,6 +32,7 @@
3232
*/
3333

3434
#include <test/support/tdb_catch.h>
35+
#include "tiledb/api/c_api/array_schema/array_schema_api_external.h"
3536
#include "tiledb/sm/c_api/tiledb.h"
3637
#include "tiledb/sm/enums/filter_type.h"
3738

test/src/unit-cppapi-schema-evolution.cc

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -5,7 +5,7 @@
55
*
66
* The MIT License
77
*
8-
* @copyright Copyright (c) 2023 TileDB Inc.
8+
* @copyright Copyright (c) 2023-2024 TileDB Inc.
99
*
1010
* Permission is hereby granted, free of charge, to any person obtaining a copy
1111
* of this software and associated documentation files (the "Software"), to deal

test/support/src/serialization_wrappers.cc

Lines changed: 3 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -5,7 +5,7 @@
55
*
66
* The MIT License
77
*
8-
* @copyright Copyright (c) 2022 TileDB, Inc.
8+
* @copyright Copyright (c) 2022-2024 TileDB, Inc.
99
*
1010
* Permission is hereby granted, free of charge, to any person obtaining a copy
1111
* of this software and associated documentation files (the "Software"), to deal
@@ -32,6 +32,7 @@
3232
*/
3333

3434
#include "test/support/src/helpers.h"
35+
#include "tiledb/api/c_api/array_schema/array_schema_api_internal.h"
3536
#include "tiledb/sm/c_api/tiledb.h"
3637
#include "tiledb/sm/c_api/tiledb_serialization.h"
3738
#include "tiledb/sm/c_api/tiledb_struct_def.h"
@@ -206,7 +207,7 @@ void tiledb_subarray_serialize(
206207
tiledb_array_schema_t* array_schema = nullptr;
207208
tiledb_array_get_schema(ctx, array, &array_schema);
208209
REQUIRE(tiledb::sm::serialization::subarray_to_capnp(
209-
*(array_schema->array_schema_), (*subarray)->subarray_, &builder)
210+
*(array_schema->array_schema()), (*subarray)->subarray_, &builder)
210211
.ok());
211212
// Deserialize
212213
tiledb_subarray_t* deserialized_subarray;

tiledb/api/c_api/CMakeLists.txt

Lines changed: 4 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -3,7 +3,7 @@
33
#
44
# The MIT License
55
#
6-
# Copyright (c) 2022-2023 TileDB, Inc.
6+
# Copyright (c) 2022-2024 TileDB, Inc.
77
#
88
# Permission is hereby granted, free of charge, to any person obtaining a copy
99
# of this software and associated documentation files (the "Software"), to deal
@@ -52,6 +52,9 @@ target_include_directories(export INTERFACE ${TILEDB_SOURCE_ROOT}/tiledb/sm/c_ap
5252
# `array`: no dependencies
5353
add_subdirectory(array)
5454

55+
# `array_schema`: depends on `context`
56+
add_subdirectory(array_schema)
57+
5558
# `buffer`: no dependencies
5659
add_subdirectory(buffer)
5760

0 commit comments

Comments
 (0)