MCPcopy Create free account
hub / github.com/TileDB-Inc/TileDB / tiledb_array_create

Function tiledb_array_create

tiledb/api/c_api/array/array_api.cc:116–164  ·  view source on GitHub ↗

Source from the content-addressed store, hash-verified

114}
115
116capi_return_t tiledb_array_create(
117 tiledb_ctx_t* ctx,
118 const char* array_uri,
119 const tiledb_array_schema_t* array_schema) {
120 ensure_array_schema_is_valid(array_schema);
121
122 tiledb::sm::URI uri(array_uri, URI::must_be_valid);
123 if (uri.is_tiledb()) {
124 auto& rest_client = ctx->context().rest_client();
125 if (rest_client.rest_legacy()) {
126 throw_if_not_ok(rest_client.post_array_schema_to_rest(
127 uri, *(array_schema->array_schema())));
128 } else {
129 rest_client.post_array_create_to_rest(
130 uri, *(array_schema->array_schema()));
131 }
132 } else {
133 // Create key
134 tiledb::sm::EncryptionKey key;
135 throw_if_not_ok(
136 key.set_key(tiledb::sm::EncryptionType::NO_ENCRYPTION, nullptr, 0));
137 // Create the array
138 tiledb::sm::Array::create(
139 ctx->resources(), uri, array_schema->array_schema(), key);
140
141 // Create any dimension labels in the array.
142 for (tiledb::sm::ArraySchema::dimension_label_size_type ilabel{0};
143 ilabel < array_schema->dim_label_num();
144 ++ilabel) {
145 // Get dimension label information and define URI and name.
146 const auto& dim_label_ref = array_schema->dimension_label(ilabel);
147 if (dim_label_ref.is_external())
148 continue;
149 if (!dim_label_ref.has_schema()) {
150 throw CAPIException(
151 "Failed to create array. Dimension labels that are "
152 "not external must have a schema.");
153 }
154
155 // Create the dimension label array with the same key.
156 tiledb::sm::Array::create(
157 ctx->resources(),
158 dim_label_ref.uri(uri),
159 dim_label_ref.schema(),
160 key);
161 }
162 }
163 return TILEDB_OK;
164}
165
166capi_return_t tiledb_array_open(
167 tiledb_array_t* array, tiledb_query_type_t query_type) {

Callers 15

create_sparse_arrayMethod · 0.85
unit_capi_array.ccFile · 0.85
create_sparse_arrayMethod · 0.85
create_dense_arrayMethod · 0.85
ordinary_arrayMethod · 0.85
createMethod · 0.85
create_arrayMethod · 0.85
create_arrayMethod · 0.85
create_arrayMethod · 0.85
create_arrayMethod · 0.85
create_arrayMethod · 0.85
create_arrayMethod · 0.85

Calls 15

throw_if_not_okFunction · 0.85
CAPIExceptionClass · 0.85
is_tiledbMethod · 0.80
resourcesMethod · 0.80
dimension_labelMethod · 0.80
is_externalMethod · 0.80
has_schemaMethod · 0.80
rest_clientMethod · 0.45
contextMethod · 0.45
rest_legacyMethod · 0.45

Tested by 5

create_sparse_arrayMethod · 0.68
create_sparse_arrayMethod · 0.68
create_dense_arrayMethod · 0.68
ordinary_arrayMethod · 0.68
create_arrayMethod · 0.68