Skip to content

Commit

Permalink
Add array uri to tiledb_array_deserialize (#4961)
Browse files Browse the repository at this point in the history
[sc-47129

](https://app.shortcut.com/tiledb-inc/story/47129/add-array-uri-to-tiledb-array-deserialize
)
Today `tiledb_array_deserialize` is using a hardcoded uri name
(`"deserialized_array"`) , whereas `tiledb_deserialize_query_and_array`
is requiring the actual `array_uri` as an argument. The former is
problematic for wrapping those calls in python, so this ticket is aiming
to unify the two to both receive the `array_uri` as input. (history on
why this is needed here:
https://app.shortcut.com/tiledb-inc/story/47139/investigate-if-core-serialization-apis-could-be-used-externally-to-pass-cache-open-arrays)

There's no backward compatibility issue here as this is a
deserialization function only called by REST Server, so we don't need to
keep both versions of `tiledb_array_deserialize`.

That said, the REST-CI tests that run based on latest dev on Core and
latest master in Cloud-REST will break after this change. We will handle
this by adapting the REST-CI script to patch temporarily Cloud-REST
master with the needed change and remove when 2.24 is released
TileDB-Inc/TileDB-Internal#27 . Another idea was
to maintain both flavors until the release is ready to go out and then
remove but C doesn't support overloading functions.

Future work to track:  #4961

---
TYPE: IMPROVEMENT
DESC: Add array uri to tiledb_array_deserialize
  • Loading branch information
ypatia authored and KiterLuc committed Jun 19, 2024
1 parent 152093b commit 6465f0a
Show file tree
Hide file tree
Showing 3 changed files with 15 additions and 3 deletions.
8 changes: 7 additions & 1 deletion test/support/src/serialization_wrappers.cc
Original file line number Diff line number Diff line change
Expand Up @@ -141,7 +141,13 @@ int array_serialize_wrapper(
REQUIRE(rc == TILEDB_OK);

// Load array from the rest server
rc = tiledb_deserialize_array(ctx, buff, serialize_type, 0, new_array);
rc = tiledb_deserialize_array(
ctx,
buff,
serialize_type,
0,
array->array_->array_uri().c_str(),
new_array);
REQUIRE(rc == TILEDB_OK);

// Clean up.
Expand Down
6 changes: 4 additions & 2 deletions tiledb/sm/c_api/tiledb.cc
Original file line number Diff line number Diff line change
Expand Up @@ -3396,6 +3396,7 @@ int32_t tiledb_deserialize_array(
const tiledb_buffer_t* buffer,
tiledb_serialization_type_t serialize_type,
int32_t,
const char* array_uri,
tiledb_array_t** array) {
// Sanity check

Expand All @@ -3411,7 +3412,7 @@ int32_t tiledb_deserialize_array(
}

// Check array URI
auto uri = tiledb::sm::URI("deserialized_array");
auto uri = tiledb::sm::URI(array_uri);
if (uri.is_invalid()) {
auto st = Status_Error("Failed to create TileDB array object; Invalid URI");
delete *array;
Expand Down Expand Up @@ -6950,9 +6951,10 @@ CAPI_INTERFACE(
const tiledb_buffer_t* buffer,
tiledb_serialization_type_t serialize_type,
int32_t client_side,
const char* array_uri,
tiledb_array_t** array) {
return api_entry<tiledb::api::tiledb_deserialize_array>(
ctx, buffer, serialize_type, client_side, array);
ctx, buffer, serialize_type, client_side, array_uri, array);
}

CAPI_INTERFACE(
Expand Down
4 changes: 4 additions & 0 deletions tiledb/sm/c_api/tiledb_serialization.h
Original file line number Diff line number Diff line change
Expand Up @@ -28,6 +28,8 @@
* @section DESCRIPTION
*
* This file declares the TileDB C API for serialization.
* APIs defined in this header are currently unstable and subject to breaking
* changes between minor releases.
*/

#ifndef TILEDB_SERIALIZATION_H
Expand Down Expand Up @@ -106,6 +108,7 @@ TILEDB_EXPORT int32_t tiledb_serialize_array(
* @param client_side Allows to specify different behavior depending on who is
* serializing, the client (1) or the Cloud server (0). This is sometimes needed
* since they are both using the same Core library APIs for serialization.
* @param array_uri uri of the array to deserialize.
* @param array Will be set to a newly allocated array.
* @return `TILEDB_OK` for success and `TILEDB_ERR` for error.
*/
Expand All @@ -114,6 +117,7 @@ TILEDB_EXPORT int32_t tiledb_deserialize_array(
const tiledb_buffer_t* buffer,
tiledb_serialization_type_t serialize_type,
int32_t client_side,
const char* array_uri,
tiledb_array_t** array) TILEDB_NOEXCEPT;

/**
Expand Down

0 comments on commit 6465f0a

Please sign in to comment.