Skip to content

Commit

Permalink
Array Schema should serialize name in cap'n proto
Browse files Browse the repository at this point in the history
The cap'n proto serialization should include the array schema name. This
allows completeness when building the array schema object and use in the
array_schemas_all unordered_map after deserialization.
  • Loading branch information
Shelnutt2 committed Dec 20, 2021
1 parent ba28f56 commit 61e89a1
Show file tree
Hide file tree
Showing 8 changed files with 232 additions and 91 deletions.
4 changes: 4 additions & 0 deletions tiledb/sm/array_schema/array_schema.cc
Expand Up @@ -637,6 +637,10 @@ void ArraySchema::set_array_uri(const URI& array_uri) {
array_uri_ = array_uri;
}

void ArraySchema::set_name(const std::string& name) {
name_ = name;
}

void ArraySchema::set_capacity(uint64_t capacity) {
capacity_ = capacity;
}
Expand Down
3 changes: 3 additions & 0 deletions tiledb/sm/array_schema/array_schema.h
Expand Up @@ -335,6 +335,9 @@ class ArraySchema {
/** Returns the schema name. If it is not set, will returns error status. */
Status get_name(std::string* name) const;

/** Set the schema name. */
void set_name(const std::string& name);

/** Generates a new array schema URI. */
Status generate_uri();

Expand Down
7 changes: 6 additions & 1 deletion tiledb/sm/serialization/array_schema.cc
Expand Up @@ -432,7 +432,7 @@ Status domain_from_capnp(
}

Status array_schema_to_capnp(
const ArraySchema* array_schema,
ArraySchema* array_schema,
capnp::ArraySchema::Builder* array_schema_builder,
const bool client_side) {
if (array_schema == nullptr)
Expand All @@ -442,6 +442,8 @@ Status array_schema_to_capnp(
// Only set the URI if client side
if (client_side)
array_schema_builder->setUri(array_schema->array_uri().to_string());

array_schema_builder->setName(array_schema->name());
auto v = kj::heapArray<int32_t>(1);
v[0] = array_schema->version();
array_schema_builder->setVersion(v);
Expand Down Expand Up @@ -506,6 +508,9 @@ Status array_schema_from_capnp(
if (schema_reader.hasUri())
(*array_schema)->set_array_uri(URI(schema_reader.getUri().cStr()));

if (schema_reader.hasName())
(*array_schema)->set_name(schema_reader.getName().cStr());

(*array_schema)->set_cell_order(layout);
(*array_schema)->set_capacity(schema_reader.getCapacity());
(*array_schema)->set_allows_dups(schema_reader.getAllowsDuplicates());
Expand Down
103 changes: 59 additions & 44 deletions tiledb/sm/serialization/posix/tiledb-rest.capnp.c++
Expand Up @@ -424,109 +424,116 @@ const ::capnp::_::RawSchema s_a45730f57e0460b4 = {
0, 4, i_a45730f57e0460b4, nullptr, nullptr, { &s_a45730f57e0460b4, nullptr, nullptr, 0, 0, nullptr }
};
#endif // !CAPNP_LITE
static const ::capnp::_::AlignedData<219> b_d71de32f98e296fe = {
static const ::capnp::_::AlignedData<234> b_d71de32f98e296fe = {
{ 0, 0, 0, 0, 5, 0, 6, 0,
254, 150, 226, 152, 47, 227, 29, 215,
18, 0, 0, 0, 1, 0, 2, 0,
127, 216, 135, 181, 36, 146, 125, 181,
10, 0, 7, 0, 0, 0, 0, 0,
11, 0, 7, 0, 0, 0, 0, 0,
0, 0, 0, 0, 0, 0, 0, 0,
21, 0, 0, 0, 242, 0, 0, 0,
33, 0, 0, 0, 7, 0, 0, 0,
0, 0, 0, 0, 0, 0, 0, 0,
29, 0, 0, 0, 167, 2, 0, 0,
29, 0, 0, 0, 223, 2, 0, 0,
0, 0, 0, 0, 0, 0, 0, 0,
0, 0, 0, 0, 0, 0, 0, 0,
116, 105, 108, 101, 100, 98, 45, 114,
101, 115, 116, 46, 99, 97, 112, 110,
112, 58, 65, 114, 114, 97, 121, 83,
99, 104, 101, 109, 97, 0, 0, 0,
0, 0, 0, 0, 1, 0, 1, 0,
48, 0, 0, 0, 3, 0, 4, 0,
52, 0, 0, 0, 3, 0, 4, 0,
0, 0, 0, 0, 0, 0, 0, 0,
0, 0, 1, 0, 0, 0, 0, 0,
0, 0, 0, 0, 0, 0, 0, 0,
65, 1, 0, 0, 82, 0, 0, 0,
93, 1, 0, 0, 82, 0, 0, 0,
0, 0, 0, 0, 0, 0, 0, 0,
64, 1, 0, 0, 3, 0, 1, 0,
76, 1, 0, 0, 2, 0, 1, 0,
92, 1, 0, 0, 3, 0, 1, 0,
104, 1, 0, 0, 2, 0, 1, 0,
1, 0, 0, 0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0, 0,
148, 1, 0, 0, 3, 0, 1, 0,
176, 1, 0, 0, 2, 0, 1, 0,
176, 1, 0, 0, 3, 0, 1, 0,
204, 1, 0, 0, 2, 0, 1, 0,
10, 0, 0, 0, 64, 0, 0, 0,
0, 0, 1, 0, 10, 0, 0, 0,
0, 0, 0, 0, 0, 0, 0, 0,
173, 1, 0, 0, 138, 0, 0, 0,
201, 1, 0, 0, 138, 0, 0, 0,
0, 0, 0, 0, 0, 0, 0, 0,
176, 1, 0, 0, 3, 0, 1, 0,
188, 1, 0, 0, 2, 0, 1, 0,
204, 1, 0, 0, 3, 0, 1, 0,
216, 1, 0, 0, 2, 0, 1, 0,
11, 0, 0, 0, 9, 0, 0, 0,
0, 0, 1, 0, 11, 0, 0, 0,
0, 0, 0, 0, 0, 0, 0, 0,
185, 1, 0, 0, 186, 0, 0, 0,
213, 1, 0, 0, 186, 0, 0, 0,
0, 0, 0, 0, 0, 0, 0, 0,
188, 1, 0, 0, 3, 0, 1, 0,
200, 1, 0, 0, 2, 0, 1, 0,
216, 1, 0, 0, 3, 0, 1, 0,
228, 1, 0, 0, 2, 0, 1, 0,
12, 0, 0, 0, 10, 0, 0, 0,
0, 0, 1, 0, 12, 0, 0, 0,
0, 0, 0, 0, 0, 0, 0, 0,
225, 1, 0, 0, 42, 0, 0, 0,
0, 0, 0, 0, 0, 0, 0, 0,
220, 1, 0, 0, 3, 0, 1, 0,
232, 1, 0, 0, 2, 0, 1, 0,
97, 114, 114, 97, 121, 84, 121, 112,
101, 0, 0, 0, 0, 0, 0, 0,
12, 0, 0, 0, 0, 0, 0, 0,
Expand Down Expand Up @@ -642,6 +649,14 @@ static const ::capnp::_::AlignedData<219> b_d71de32f98e296fe = {
0, 0, 0, 0, 0, 0, 0, 0,
0, 0, 0, 0, 0, 0, 0, 0,
16, 0, 0, 0, 0, 0, 0, 0,
0, 0, 0, 0, 0, 0, 0, 0,
0, 0, 0, 0, 0, 0, 0, 0,
110, 97, 109, 101, 0, 0, 0, 0,
12, 0, 0, 0, 0, 0, 0, 0,
0, 0, 0, 0, 0, 0, 0, 0,
0, 0, 0, 0, 0, 0, 0, 0,
0, 0, 0, 0, 0, 0, 0, 0,
12, 0, 0, 0, 0, 0, 0, 0,
0, 0, 0, 0, 0, 0, 0, 0,
0, 0, 0, 0, 0, 0, 0, 0, }
};
Expand All @@ -652,11 +667,11 @@ static const ::capnp::_::RawSchema* const d_d71de32f98e296fe[] = {
&s_bc4583f733eac4f5,
&s_de030f447664754c,
};
static const uint16_t m_d71de32f98e296fe[] = {10, 0, 1, 2, 3, 4, 5, 6, 7, 8, 11, 9};
static const uint16_t i_d71de32f98e296fe[] = {0, 1, 2, 3, 4, 5, 6, 7, 8, 9, 10, 11};
static const uint16_t m_d71de32f98e296fe[] = {10, 0, 1, 2, 3, 4, 5, 12, 6, 7, 8, 11, 9};
static const uint16_t i_d71de32f98e296fe[] = {0, 1, 2, 3, 4, 5, 6, 7, 8, 9, 10, 11, 12};
const ::capnp::_::RawSchema s_d71de32f98e296fe = {
0xd71de32f98e296fe, b_d71de32f98e296fe.words, 219, d_d71de32f98e296fe, m_d71de32f98e296fe,
3, 12, i_d71de32f98e296fe, nullptr, nullptr, { &s_d71de32f98e296fe, nullptr, nullptr, 0, 0, nullptr }
0xd71de32f98e296fe, b_d71de32f98e296fe.words, 234, d_d71de32f98e296fe, m_d71de32f98e296fe,
3, 13, i_d71de32f98e296fe, nullptr, nullptr, { &s_d71de32f98e296fe, nullptr, nullptr, 0, 0, nullptr }
};
#endif // !CAPNP_LITE
static const ::capnp::_::AlignedData<60> b_a1b81d67548230d4 = {
Expand Down
50 changes: 49 additions & 1 deletion tiledb/sm/serialization/posix/tiledb-rest.capnp.h
Expand Up @@ -149,7 +149,7 @@ struct ArraySchema {
class Pipeline;

struct _capnpPrivate {
CAPNP_DECLARE_STRUCT_HEADER(d71de32f98e296fe, 2, 10)
CAPNP_DECLARE_STRUCT_HEADER(d71de32f98e296fe, 2, 11)
#if !CAPNP_LITE
static constexpr ::capnp::_::RawBrandedSchema const* brand() {
return &schema->defaultBrand;
Expand Down Expand Up @@ -1629,6 +1629,9 @@ class ArraySchema::Reader {
inline ::tiledb::sm::serialization::capnp::FilterPipeline::Reader
getValidityFilterPipeline() const;

inline bool hasName() const;
inline ::capnp::Text::Reader getName() const;

private:
::capnp::_::StructReader _reader;
template <typename, ::capnp::Kind>
Expand Down Expand Up @@ -1785,6 +1788,13 @@ class ArraySchema::Builder {
inline ::capnp::Orphan<::tiledb::sm::serialization::capnp::FilterPipeline>
disownValidityFilterPipeline();

inline bool hasName();
inline ::capnp::Text::Builder getName();
inline void setName(::capnp::Text::Reader value);
inline ::capnp::Text::Builder initName(unsigned int size);
inline void adoptName(::capnp::Orphan<::capnp::Text>&& value);
inline ::capnp::Orphan<::capnp::Text> disownName();

private:
::capnp::_::StructBuilder _builder;
template <typename, ::capnp::Kind>
Expand Down Expand Up @@ -9106,6 +9116,44 @@ ArraySchema::Builder::disownValidityFilterPipeline() {
_builder.getPointerField(::capnp::bounded<9>() * ::capnp::POINTERS));
}

inline bool ArraySchema::Reader::hasName() const {
return !_reader.getPointerField(::capnp::bounded<10>() * ::capnp::POINTERS)
.isNull();
}
inline bool ArraySchema::Builder::hasName() {
return !_builder.getPointerField(::capnp::bounded<10>() * ::capnp::POINTERS)
.isNull();
}
inline ::capnp::Text::Reader ArraySchema::Reader::getName() const {
return ::capnp::_::PointerHelpers<::capnp::Text>::get(
_reader.getPointerField(::capnp::bounded<10>() * ::capnp::POINTERS));
}
inline ::capnp::Text::Builder ArraySchema::Builder::getName() {
return ::capnp::_::PointerHelpers<::capnp::Text>::get(
_builder.getPointerField(::capnp::bounded<10>() * ::capnp::POINTERS));
}
inline void ArraySchema::Builder::setName(::capnp::Text::Reader value) {
::capnp::_::PointerHelpers<::capnp::Text>::set(
_builder.getPointerField(::capnp::bounded<10>() * ::capnp::POINTERS),
value);
}
inline ::capnp::Text::Builder ArraySchema::Builder::initName(
unsigned int size) {
return ::capnp::_::PointerHelpers<::capnp::Text>::init(
_builder.getPointerField(::capnp::bounded<10>() * ::capnp::POINTERS),
size);
}
inline void ArraySchema::Builder::adoptName(
::capnp::Orphan<::capnp::Text>&& value) {
::capnp::_::PointerHelpers<::capnp::Text>::adopt(
_builder.getPointerField(::capnp::bounded<10>() * ::capnp::POINTERS),
kj::mv(value));
}
inline ::capnp::Orphan<::capnp::Text> ArraySchema::Builder::disownName() {
return ::capnp::_::PointerHelpers<::capnp::Text>::disown(
_builder.getPointerField(::capnp::bounded<10>() * ::capnp::POINTERS));
}

inline bool ArraySchemaEvolution::Reader::hasAttributesToDrop() const {
return !_reader.getPointerField(::capnp::bounded<0>() * ::capnp::POINTERS)
.isNull();
Expand Down
3 changes: 3 additions & 0 deletions tiledb/sm/serialization/tiledb-rest.capnp
Expand Up @@ -79,6 +79,9 @@ struct ArraySchema {

validityFilterPipeline @11 :FilterPipeline;
# Type of compression for validity buffers (enum)

name @12 :Text;
# name of array schema
}

struct ArraySchemaEvolution {
Expand Down

0 comments on commit 61e89a1

Please sign in to comment.