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

Method array_create_wrapper

test/src/unit-capi-string_dims.cc:278–337  ·  view source on GitHub ↗

Source from the content-addressed store, hash-verified

276}
277
278int StringDimsFx::array_create_wrapper(
279 const std::string& path, tiledb_array_schema_t* array_schema) {
280#ifndef TILEDB_SERIALIZATION
281 return tiledb_array_create(ctx_, path.c_str(), array_schema);
282#endif
283
284 if (!serialize_) {
285 return tiledb_array_create(ctx_, path.c_str(), array_schema);
286 }
287
288 // Serialize the array
289 tiledb_buffer_t* buff;
290 REQUIRE(
291 tiledb_serialize_array_schema(
292 ctx_,
293 array_schema,
294 (tiledb_serialization_type_t)tiledb::sm::SerializationType::CAPNP,
295 1,
296 &buff) == TILEDB_OK);
297
298 // Load array schema from the rest server
299 tiledb_array_schema_t* new_array_schema = nullptr;
300 REQUIRE(
301 tiledb_deserialize_array_schema(
302 ctx_,
303 buff,
304 (tiledb_serialization_type_t)tiledb::sm::SerializationType::CAPNP,
305 0,
306 &new_array_schema) == TILEDB_OK);
307
308 // Create array from new schema
309 int rc = tiledb_array_create(ctx_, path.c_str(), new_array_schema);
310
311 // Serialize the new array schema and deserialize into the original array
312 // schema.
313 tiledb_buffer_t* buff2;
314 tiledb_array_schema_t* new_array_schema2 = nullptr;
315 REQUIRE(
316 tiledb_serialize_array_schema(
317 ctx_,
318 new_array_schema,
319 (tiledb_serialization_type_t)tiledb::sm::SerializationType::CAPNP,
320 0,
321 &buff2) == TILEDB_OK);
322 REQUIRE(
323 tiledb_deserialize_array_schema(
324 ctx_,
325 buff2,
326 (tiledb_serialization_type_t)tiledb::sm::SerializationType::CAPNP,
327 1,
328 &new_array_schema2) == TILEDB_OK);
329
330 // Clean up.
331 tiledb_array_schema_free(&new_array_schema);
332 tiledb_array_schema_free(&new_array_schema2);
333 tiledb_buffer_free(&buff);
334 tiledb_buffer_free(&buff2);
335

Callers

nothing calls this directly

Calls 6

tiledb_array_createFunction · 0.85
tiledb_array_schema_freeFunction · 0.85
tiledb_buffer_freeFunction · 0.85
c_strMethod · 0.80

Tested by

no test coverage detected