From 977739a7cb319114d25efca9aea0bc7eeda9735c Mon Sep 17 00:00:00 2001 From: Ypatia Tsavliri Date: Wed, 1 Mar 2023 14:39:29 +0200 Subject: [PATCH 1/6] Add capnp model for label ranges --- .../serialization/posix/tiledb-rest.capnp.c++ | 186 ++++++- .../serialization/posix/tiledb-rest.capnp.h | 462 +++++++++++++++++- tiledb/sm/serialization/tiledb-rest.capnp | 19 + .../serialization/win32/tiledb-rest.capnp.c++ | 186 ++++++- .../serialization/win32/tiledb-rest.capnp.h | 462 +++++++++++++++++- 5 files changed, 1273 insertions(+), 42 deletions(-) diff --git a/tiledb/sm/serialization/posix/tiledb-rest.capnp.c++ b/tiledb/sm/serialization/posix/tiledb-rest.capnp.c++ index 1da4a50dc95..4987a039372 100644 --- a/tiledb/sm/serialization/posix/tiledb-rest.capnp.c++ +++ b/tiledb/sm/serialization/posix/tiledb-rest.capnp.c++ @@ -3299,17 +3299,96 @@ const ::capnp::_::RawSchema s_86cfc12d74ed4aa0 = { 0, 5, i_86cfc12d74ed4aa0, nullptr, nullptr, { &s_86cfc12d74ed4aa0, nullptr, nullptr, 0, 0, nullptr } }; #endif // !CAPNP_LITE -static const ::capnp::_::AlignedData<88> b_dba20dec138adac9 = { +static const ::capnp::_::AlignedData<65> b_f7aa276767b422e7 = { + { 0, 0, 0, 0, 5, 0, 6, 0, + 231, 34, 180, 103, 103, 39, 170, 247, + 18, 0, 0, 0, 1, 0, 1, 0, + 127, 216, 135, 181, 36, 146, 125, 181, + 2, 0, 7, 0, 0, 0, 0, 0, + 0, 0, 0, 0, 0, 0, 0, 0, + 21, 0, 0, 0, 50, 1, 0, 0, + 37, 0, 0, 0, 7, 0, 0, 0, + 0, 0, 0, 0, 0, 0, 0, 0, + 33, 0, 0, 0, 175, 0, 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, 76, 97, 98, 101, 108, 83, + 117, 98, 97, 114, 114, 97, 121, 82, + 97, 110, 103, 101, 115, 0, 0, 0, + 0, 0, 0, 0, 1, 0, 1, 0, + 12, 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, + 69, 0, 0, 0, 98, 0, 0, 0, + 0, 0, 0, 0, 0, 0, 0, 0, + 68, 0, 0, 0, 3, 0, 1, 0, + 80, 0, 0, 0, 2, 0, 1, 0, + 1, 0, 0, 0, 0, 0, 0, 0, + 0, 0, 1, 0, 1, 0, 0, 0, + 0, 0, 0, 0, 0, 0, 0, 0, + 77, 0, 0, 0, 42, 0, 0, 0, + 0, 0, 0, 0, 0, 0, 0, 0, + 72, 0, 0, 0, 3, 0, 1, 0, + 84, 0, 0, 0, 2, 0, 1, 0, + 2, 0, 0, 0, 1, 0, 0, 0, + 0, 0, 1, 0, 2, 0, 0, 0, + 0, 0, 0, 0, 0, 0, 0, 0, + 81, 0, 0, 0, 58, 0, 0, 0, + 0, 0, 0, 0, 0, 0, 0, 0, + 76, 0, 0, 0, 3, 0, 1, 0, + 88, 0, 0, 0, 2, 0, 1, 0, + 100, 105, 109, 101, 110, 115, 105, 111, + 110, 73, 100, 0, 0, 0, 0, 0, + 8, 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, + 8, 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, + 114, 97, 110, 103, 101, 115, 0, 0, + 16, 0, 0, 0, 0, 0, 0, 0, + 160, 74, 237, 116, 45, 193, 207, 134, + 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, } +}; +::capnp::word const* const bp_f7aa276767b422e7 = b_f7aa276767b422e7.words; +#if !CAPNP_LITE +static const ::capnp::_::RawSchema* const d_f7aa276767b422e7[] = { + &s_86cfc12d74ed4aa0, +}; +static const uint16_t m_f7aa276767b422e7[] = {0, 1, 2}; +static const uint16_t i_f7aa276767b422e7[] = {0, 1, 2}; +const ::capnp::_::RawSchema s_f7aa276767b422e7 = { + 0xf7aa276767b422e7, b_f7aa276767b422e7.words, 65, d_f7aa276767b422e7, m_f7aa276767b422e7, + 1, 3, i_f7aa276767b422e7, nullptr, nullptr, { &s_f7aa276767b422e7, nullptr, nullptr, 0, 0, nullptr } +}; +#endif // !CAPNP_LITE +static const ::capnp::_::AlignedData<142> b_dba20dec138adac9 = { { 0, 0, 0, 0, 5, 0, 6, 0, 201, 218, 138, 19, 236, 13, 162, 219, 18, 0, 0, 0, 1, 0, 0, 0, 127, 216, 135, 181, 36, 146, 125, 181, - 4, 0, 7, 0, 0, 0, 0, 0, + 6, 0, 7, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 21, 0, 0, 0, 218, 0, 0, 0, 33, 0, 0, 0, 7, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, - 29, 0, 0, 0, 231, 0, 0, 0, + 29, 0, 0, 0, 87, 1, 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, @@ -3317,35 +3396,49 @@ static const ::capnp::_::AlignedData<88> b_dba20dec138adac9 = { 112, 58, 83, 117, 98, 97, 114, 114, 97, 121, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 1, 0, 1, 0, - 16, 0, 0, 0, 3, 0, 4, 0, + 24, 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, - 97, 0, 0, 0, 58, 0, 0, 0, + 153, 0, 0, 0, 58, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, - 92, 0, 0, 0, 3, 0, 1, 0, - 104, 0, 0, 0, 2, 0, 1, 0, + 148, 0, 0, 0, 3, 0, 1, 0, + 160, 0, 0, 0, 2, 0, 1, 0, 1, 0, 0, 0, 1, 0, 0, 0, 0, 0, 1, 0, 1, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, - 101, 0, 0, 0, 58, 0, 0, 0, + 157, 0, 0, 0, 58, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, - 96, 0, 0, 0, 3, 0, 1, 0, - 124, 0, 0, 0, 2, 0, 1, 0, + 152, 0, 0, 0, 3, 0, 1, 0, + 180, 0, 0, 0, 2, 0, 1, 0, 2, 0, 0, 0, 2, 0, 0, 0, 0, 0, 1, 0, 2, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, - 121, 0, 0, 0, 50, 0, 0, 0, + 177, 0, 0, 0, 50, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, - 116, 0, 0, 0, 3, 0, 1, 0, - 128, 0, 0, 0, 2, 0, 1, 0, + 172, 0, 0, 0, 3, 0, 1, 0, + 184, 0, 0, 0, 2, 0, 1, 0, 3, 0, 0, 0, 3, 0, 0, 0, 0, 0, 1, 0, 3, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, - 125, 0, 0, 0, 146, 0, 0, 0, + 181, 0, 0, 0, 146, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, - 128, 0, 0, 0, 3, 0, 1, 0, - 156, 0, 0, 0, 2, 0, 1, 0, + 184, 0, 0, 0, 3, 0, 1, 0, + 212, 0, 0, 0, 2, 0, 1, 0, + 4, 0, 0, 0, 4, 0, 0, 0, + 0, 0, 1, 0, 4, 0, 0, 0, + 0, 0, 0, 0, 0, 0, 0, 0, + 209, 0, 0, 0, 98, 0, 0, 0, + 0, 0, 0, 0, 0, 0, 0, 0, + 208, 0, 0, 0, 3, 0, 1, 0, + 236, 0, 0, 0, 2, 0, 1, 0, + 5, 0, 0, 0, 5, 0, 0, 0, + 0, 0, 1, 0, 5, 0, 0, 0, + 0, 0, 0, 0, 0, 0, 0, 0, + 233, 0, 0, 0, 130, 0, 0, 0, + 0, 0, 0, 0, 0, 0, 0, 0, + 232, 0, 0, 0, 3, 0, 1, 0, + 60, 1, 0, 0, 2, 0, 1, 0, 108, 97, 121, 111, 117, 116, 0, 0, 12, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, @@ -3386,6 +3479,46 @@ static const ::capnp::_::AlignedData<88> b_dba20dec138adac9 = { 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 14, 0, 0, 0, 0, 0, 0, 0, + 0, 0, 0, 0, 0, 0, 0, 0, + 0, 0, 0, 0, 0, 0, 0, 0, + 108, 97, 98, 101, 108, 82, 97, 110, + 103, 101, 115, 0, 0, 0, 0, 0, + 14, 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, 3, 0, 1, 0, + 16, 0, 0, 0, 0, 0, 0, 0, + 231, 34, 180, 103, 103, 39, 170, 247, + 0, 0, 0, 0, 0, 0, 0, 0, + 0, 0, 0, 0, 0, 0, 0, 0, + 14, 0, 0, 0, 0, 0, 0, 0, + 0, 0, 0, 0, 0, 0, 0, 0, + 0, 0, 0, 0, 0, 0, 0, 0, + 97, 116, 116, 114, 105, 98, 117, 116, + 101, 82, 97, 110, 103, 101, 115, 0, + 16, 0, 0, 0, 0, 0, 0, 0, + 140, 113, 113, 174, 148, 193, 121, 241, + 0, 0, 0, 0, 0, 0, 0, 0, + 0, 0, 0, 0, 0, 0, 1, 0, + 1, 0, 0, 0, 31, 0, 0, 0, + 4, 0, 0, 0, 2, 0, 1, 0, + 140, 113, 113, 174, 148, 193, 121, 241, + 0, 0, 0, 0, 0, 0, 0, 0, + 1, 0, 0, 0, 39, 0, 0, 0, + 8, 0, 0, 0, 1, 0, 1, 0, + 1, 0, 0, 0, 0, 0, 0, 0, + 8, 0, 0, 0, 3, 0, 1, 0, + 1, 0, 0, 0, 0, 0, 0, 0, + 16, 0, 0, 0, 3, 0, 1, 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, + 16, 0, 0, 0, 0, 0, 0, 0, + 160, 74, 237, 116, 45, 193, 207, 134, + 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, } }; @@ -3394,12 +3527,17 @@ static const ::capnp::_::AlignedData<88> b_dba20dec138adac9 = { static const ::capnp::_::RawSchema* const d_dba20dec138adac9[] = { &s_86cfc12d74ed4aa0, &s_c7e036a11506a1a4, + &s_f179c194ae71718c, + &s_f7aa276767b422e7, +}; +static const uint16_t m_dba20dec138adac9[] = {5, 4, 0, 1, 3, 2}; +static const uint16_t i_dba20dec138adac9[] = {0, 1, 2, 3, 4, 5}; +KJ_CONSTEXPR(const) ::capnp::_::RawBrandedSchema::Dependency bd_dba20dec138adac9[] = { + { 16777221, ::tiledb::sm::serialization::capnp::Map< ::capnp::Text, ::tiledb::sm::serialization::capnp::SubarrayRanges>::_capnpPrivate::brand() }, }; -static const uint16_t m_dba20dec138adac9[] = {0, 1, 3, 2}; -static const uint16_t i_dba20dec138adac9[] = {0, 1, 2, 3}; const ::capnp::_::RawSchema s_dba20dec138adac9 = { - 0xdba20dec138adac9, b_dba20dec138adac9.words, 88, d_dba20dec138adac9, m_dba20dec138adac9, - 2, 4, i_dba20dec138adac9, nullptr, nullptr, { &s_dba20dec138adac9, nullptr, nullptr, 0, 0, nullptr } + 0xdba20dec138adac9, b_dba20dec138adac9.words, 142, d_dba20dec138adac9, m_dba20dec138adac9, + 4, 6, i_dba20dec138adac9, nullptr, nullptr, { &s_dba20dec138adac9, nullptr, bd_dba20dec138adac9, 0, sizeof(bd_dba20dec138adac9) / sizeof(bd_dba20dec138adac9[0]), nullptr } }; #endif // !CAPNP_LITE static const ::capnp::_::AlignedData<155> b_ff14003c70494585 = { @@ -8752,6 +8890,14 @@ constexpr ::capnp::Kind SubarrayRanges::_capnpPrivate::kind; constexpr ::capnp::_::RawSchema const* SubarrayRanges::_capnpPrivate::schema; #endif // !CAPNP_LITE +// LabelSubarrayRanges +constexpr uint16_t LabelSubarrayRanges::_capnpPrivate::dataWordSize; +constexpr uint16_t LabelSubarrayRanges::_capnpPrivate::pointerCount; +#if !CAPNP_LITE +constexpr ::capnp::Kind LabelSubarrayRanges::_capnpPrivate::kind; +constexpr ::capnp::_::RawSchema const* LabelSubarrayRanges::_capnpPrivate::schema; +#endif // !CAPNP_LITE + // Subarray constexpr uint16_t Subarray::_capnpPrivate::dataWordSize; constexpr uint16_t Subarray::_capnpPrivate::pointerCount; diff --git a/tiledb/sm/serialization/posix/tiledb-rest.capnp.h b/tiledb/sm/serialization/posix/tiledb-rest.capnp.h index b6ec22fe42a..07d8e52e56f 100644 --- a/tiledb/sm/serialization/posix/tiledb-rest.capnp.h +++ b/tiledb/sm/serialization/posix/tiledb-rest.capnp.h @@ -45,6 +45,7 @@ CAPNP_DECLARE_SCHEMA(bb80cdbc3f312934); CAPNP_DECLARE_SCHEMA(c7e036a11506a1a4); CAPNP_DECLARE_SCHEMA(8ba60147a0e6735e); CAPNP_DECLARE_SCHEMA(86cfc12d74ed4aa0); +CAPNP_DECLARE_SCHEMA(f7aa276767b422e7); CAPNP_DECLARE_SCHEMA(dba20dec138adac9); CAPNP_DECLARE_SCHEMA(ff14003c70494585); CAPNP_DECLARE_SCHEMA(f86b7bf97823250f); @@ -671,6 +672,23 @@ struct SubarrayRanges { }; }; +struct LabelSubarrayRanges { + LabelSubarrayRanges() = delete; + + class Reader; + class Builder; + class Pipeline; + + struct _capnpPrivate { + CAPNP_DECLARE_STRUCT_HEADER(f7aa276767b422e7, 1, 2) +#if !CAPNP_LITE + static constexpr ::capnp::_::RawBrandedSchema const* brand() { + return &schema->defaultBrand; + } +#endif // !CAPNP_LITE + }; +}; + struct Subarray { Subarray() = delete; @@ -679,7 +697,7 @@ struct Subarray { class Pipeline; struct _capnpPrivate { - CAPNP_DECLARE_STRUCT_HEADER(dba20dec138adac9, 0, 4) + CAPNP_DECLARE_STRUCT_HEADER(dba20dec138adac9, 0, 6) #if !CAPNP_LITE static constexpr ::capnp::_::RawBrandedSchema const* brand() { return &schema->defaultBrand; @@ -5875,6 +5893,128 @@ class SubarrayRanges::Pipeline { }; #endif // !CAPNP_LITE +class LabelSubarrayRanges::Reader { + public: + typedef LabelSubarrayRanges Reads; + + Reader() = default; + inline explicit Reader(::capnp::_::StructReader base) + : _reader(base) { + } + + inline ::capnp::MessageSize totalSize() const { + return _reader.totalSize().asPublic(); + } + +#if !CAPNP_LITE + inline ::kj::StringTree toString() const { + return ::capnp::_::structString(_reader, *_capnpPrivate::brand()); + } +#endif // !CAPNP_LITE + + inline ::uint32_t getDimensionId() const; + + inline bool hasName() const; + inline ::capnp::Text::Reader getName() const; + + inline bool hasRanges() const; + inline ::tiledb::sm::serialization::capnp::SubarrayRanges::Reader getRanges() + const; + + private: + ::capnp::_::StructReader _reader; + template + friend struct ::capnp::ToDynamic_; + template + friend struct ::capnp::_::PointerHelpers; + template + friend struct ::capnp::List; + friend class ::capnp::MessageBuilder; + friend class ::capnp::Orphanage; +}; + +class LabelSubarrayRanges::Builder { + public: + typedef LabelSubarrayRanges Builds; + + Builder() = delete; // Deleted to discourage incorrect usage. + // You can explicitly initialize to nullptr instead. + inline Builder(decltype(nullptr)) { + } + inline explicit Builder(::capnp::_::StructBuilder base) + : _builder(base) { + } + inline operator Reader() const { + return Reader(_builder.asReader()); + } + inline Reader asReader() const { + return *this; + } + + inline ::capnp::MessageSize totalSize() const { + return asReader().totalSize(); + } +#if !CAPNP_LITE + inline ::kj::StringTree toString() const { + return asReader().toString(); + } +#endif // !CAPNP_LITE + + inline ::uint32_t getDimensionId(); + inline void setDimensionId(::uint32_t value); + + 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(); + + inline bool hasRanges(); + inline ::tiledb::sm::serialization::capnp::SubarrayRanges::Builder + getRanges(); + inline void setRanges( + ::tiledb::sm::serialization::capnp::SubarrayRanges::Reader value); + inline ::tiledb::sm::serialization::capnp::SubarrayRanges::Builder + initRanges(); + inline void adoptRanges( + ::capnp::Orphan<::tiledb::sm::serialization::capnp::SubarrayRanges>&& + value); + inline ::capnp::Orphan<::tiledb::sm::serialization::capnp::SubarrayRanges> + disownRanges(); + + private: + ::capnp::_::StructBuilder _builder; + template + friend struct ::capnp::ToDynamic_; + friend class ::capnp::Orphanage; + template + friend struct ::capnp::_::PointerHelpers; +}; + +#if !CAPNP_LITE +class LabelSubarrayRanges::Pipeline { + public: + typedef LabelSubarrayRanges Pipelines; + + inline Pipeline(decltype(nullptr)) + : _typeless(nullptr) { + } + inline explicit Pipeline(::capnp::AnyPointer::Pipeline&& typeless) + : _typeless(kj::mv(typeless)) { + } + + inline ::tiledb::sm::serialization::capnp::SubarrayRanges::Pipeline + getRanges(); + + private: + ::capnp::AnyPointer::Pipeline _typeless; + friend class ::capnp::PipelineHook; + template + friend struct ::capnp::ToDynamic_; +}; +#endif // !CAPNP_LITE + class Subarray::Reader { public: typedef Subarray Reads; @@ -5910,6 +6050,18 @@ class Subarray::Reader { inline ::capnp::List<::uint32_t, ::capnp::Kind::PRIMITIVE>::Reader getRelevantFragments() const; + inline bool hasLabelRanges() const; + inline ::capnp::List< + ::tiledb::sm::serialization::capnp::LabelSubarrayRanges, + ::capnp::Kind::STRUCT>::Reader + getLabelRanges() const; + + inline bool hasAttributeRanges() const; + inline ::tiledb::sm::serialization::capnp::Map< + ::capnp::Text, + ::tiledb::sm::serialization::capnp::SubarrayRanges>::Reader + getAttributeRanges() const; + private: ::capnp::_::StructReader _reader; template @@ -6000,6 +6152,50 @@ class Subarray::Builder { inline ::capnp::Orphan<::capnp::List<::uint32_t, ::capnp::Kind::PRIMITIVE>> disownRelevantFragments(); + inline bool hasLabelRanges(); + inline ::capnp::List< + ::tiledb::sm::serialization::capnp::LabelSubarrayRanges, + ::capnp::Kind::STRUCT>::Builder + getLabelRanges(); + inline void setLabelRanges( + ::capnp::List< + ::tiledb::sm::serialization::capnp::LabelSubarrayRanges, + ::capnp::Kind::STRUCT>::Reader value); + inline ::capnp::List< + ::tiledb::sm::serialization::capnp::LabelSubarrayRanges, + ::capnp::Kind::STRUCT>::Builder + initLabelRanges(unsigned int size); + inline void adoptLabelRanges( + ::capnp::Orphan<::capnp::List< + ::tiledb::sm::serialization::capnp::LabelSubarrayRanges, + ::capnp::Kind::STRUCT>>&& value); + inline ::capnp::Orphan<::capnp::List< + ::tiledb::sm::serialization::capnp::LabelSubarrayRanges, + ::capnp::Kind::STRUCT>> + disownLabelRanges(); + + inline bool hasAttributeRanges(); + inline ::tiledb::sm::serialization::capnp::Map< + ::capnp::Text, + ::tiledb::sm::serialization::capnp::SubarrayRanges>::Builder + getAttributeRanges(); + inline void setAttributeRanges( + ::tiledb::sm::serialization::capnp::Map< + ::capnp::Text, + ::tiledb::sm::serialization::capnp::SubarrayRanges>::Reader value); + inline ::tiledb::sm::serialization::capnp::Map< + ::capnp::Text, + ::tiledb::sm::serialization::capnp::SubarrayRanges>::Builder + initAttributeRanges(); + inline void adoptAttributeRanges( + ::capnp::Orphan<::tiledb::sm::serialization::capnp::Map< + ::capnp::Text, + ::tiledb::sm::serialization::capnp::SubarrayRanges>>&& value); + inline ::capnp::Orphan<::tiledb::sm::serialization::capnp::Map< + ::capnp::Text, + ::tiledb::sm::serialization::capnp::SubarrayRanges>> + disownAttributeRanges(); + private: ::capnp::_::StructBuilder _builder; template @@ -6022,6 +6218,10 @@ class Subarray::Pipeline { } inline ::tiledb::sm::serialization::capnp::Stats::Pipeline getStats(); + inline ::tiledb::sm::serialization::capnp::Map< + ::capnp::Text, + ::tiledb::sm::serialization::capnp::SubarrayRanges>::Pipeline + getAttributeRanges(); private: ::capnp::AnyPointer::Pipeline _typeless; @@ -18517,6 +18717,115 @@ SubarrayRanges::Builder::disownBufferStartSizes() { _builder.getPointerField(::capnp::bounded<3>() * ::capnp::POINTERS)); } +inline ::uint32_t LabelSubarrayRanges::Reader::getDimensionId() const { + return _reader.getDataField<::uint32_t>( + ::capnp::bounded<0>() * ::capnp::ELEMENTS); +} + +inline ::uint32_t LabelSubarrayRanges::Builder::getDimensionId() { + return _builder.getDataField<::uint32_t>( + ::capnp::bounded<0>() * ::capnp::ELEMENTS); +} +inline void LabelSubarrayRanges::Builder::setDimensionId(::uint32_t value) { + _builder.setDataField<::uint32_t>( + ::capnp::bounded<0>() * ::capnp::ELEMENTS, value); +} + +inline bool LabelSubarrayRanges::Reader::hasName() const { + return !_reader.getPointerField(::capnp::bounded<0>() * ::capnp::POINTERS) + .isNull(); +} +inline bool LabelSubarrayRanges::Builder::hasName() { + return !_builder.getPointerField(::capnp::bounded<0>() * ::capnp::POINTERS) + .isNull(); +} +inline ::capnp::Text::Reader LabelSubarrayRanges::Reader::getName() const { + return ::capnp::_::PointerHelpers<::capnp::Text>::get( + _reader.getPointerField(::capnp::bounded<0>() * ::capnp::POINTERS)); +} +inline ::capnp::Text::Builder LabelSubarrayRanges::Builder::getName() { + return ::capnp::_::PointerHelpers<::capnp::Text>::get( + _builder.getPointerField(::capnp::bounded<0>() * ::capnp::POINTERS)); +} +inline void LabelSubarrayRanges::Builder::setName(::capnp::Text::Reader value) { + ::capnp::_::PointerHelpers<::capnp::Text>::set( + _builder.getPointerField(::capnp::bounded<0>() * ::capnp::POINTERS), + value); +} +inline ::capnp::Text::Builder LabelSubarrayRanges::Builder::initName( + unsigned int size) { + return ::capnp::_::PointerHelpers<::capnp::Text>::init( + _builder.getPointerField(::capnp::bounded<0>() * ::capnp::POINTERS), + size); +} +inline void LabelSubarrayRanges::Builder::adoptName( + ::capnp::Orphan<::capnp::Text>&& value) { + ::capnp::_::PointerHelpers<::capnp::Text>::adopt( + _builder.getPointerField(::capnp::bounded<0>() * ::capnp::POINTERS), + kj::mv(value)); +} +inline ::capnp::Orphan<::capnp::Text> +LabelSubarrayRanges::Builder::disownName() { + return ::capnp::_::PointerHelpers<::capnp::Text>::disown( + _builder.getPointerField(::capnp::bounded<0>() * ::capnp::POINTERS)); +} + +inline bool LabelSubarrayRanges::Reader::hasRanges() const { + return !_reader.getPointerField(::capnp::bounded<1>() * ::capnp::POINTERS) + .isNull(); +} +inline bool LabelSubarrayRanges::Builder::hasRanges() { + return !_builder.getPointerField(::capnp::bounded<1>() * ::capnp::POINTERS) + .isNull(); +} +inline ::tiledb::sm::serialization::capnp::SubarrayRanges::Reader +LabelSubarrayRanges::Reader::getRanges() const { + return ::capnp::_:: + PointerHelpers<::tiledb::sm::serialization::capnp::SubarrayRanges>::get( + _reader.getPointerField(::capnp::bounded<1>() * ::capnp::POINTERS)); +} +inline ::tiledb::sm::serialization::capnp::SubarrayRanges::Builder +LabelSubarrayRanges::Builder::getRanges() { + return ::capnp::_:: + PointerHelpers<::tiledb::sm::serialization::capnp::SubarrayRanges>::get( + _builder.getPointerField(::capnp::bounded<1>() * ::capnp::POINTERS)); +} +#if !CAPNP_LITE +inline ::tiledb::sm::serialization::capnp::SubarrayRanges::Pipeline +LabelSubarrayRanges::Pipeline::getRanges() { + return ::tiledb::sm::serialization::capnp::SubarrayRanges::Pipeline( + _typeless.getPointerField(1)); +} +#endif // !CAPNP_LITE +inline void LabelSubarrayRanges::Builder::setRanges( + ::tiledb::sm::serialization::capnp::SubarrayRanges::Reader value) { + ::capnp::_:: + PointerHelpers<::tiledb::sm::serialization::capnp::SubarrayRanges>::set( + _builder.getPointerField(::capnp::bounded<1>() * ::capnp::POINTERS), + value); +} +inline ::tiledb::sm::serialization::capnp::SubarrayRanges::Builder +LabelSubarrayRanges::Builder::initRanges() { + return ::capnp::_:: + PointerHelpers<::tiledb::sm::serialization::capnp::SubarrayRanges>::init( + _builder.getPointerField(::capnp::bounded<1>() * ::capnp::POINTERS)); +} +inline void LabelSubarrayRanges::Builder::adoptRanges( + ::capnp::Orphan<::tiledb::sm::serialization::capnp::SubarrayRanges>&& + value) { + ::capnp::_:: + PointerHelpers<::tiledb::sm::serialization::capnp::SubarrayRanges>::adopt( + _builder.getPointerField(::capnp::bounded<1>() * ::capnp::POINTERS), + kj::mv(value)); +} +inline ::capnp::Orphan<::tiledb::sm::serialization::capnp::SubarrayRanges> +LabelSubarrayRanges::Builder::disownRanges() { + return ::capnp::_::PointerHelpers< + ::tiledb::sm::serialization::capnp::SubarrayRanges>:: + disown( + _builder.getPointerField(::capnp::bounded<1>() * ::capnp::POINTERS)); +} + inline bool Subarray::Reader::hasLayout() const { return !_reader.getPointerField(::capnp::bounded<0>() * ::capnp::POINTERS) .isNull(); @@ -18735,6 +19044,157 @@ Subarray::Builder::disownRelevantFragments() { _builder.getPointerField(::capnp::bounded<3>() * ::capnp::POINTERS)); } +inline bool Subarray::Reader::hasLabelRanges() const { + return !_reader.getPointerField(::capnp::bounded<4>() * ::capnp::POINTERS) + .isNull(); +} +inline bool Subarray::Builder::hasLabelRanges() { + return !_builder.getPointerField(::capnp::bounded<4>() * ::capnp::POINTERS) + .isNull(); +} +inline ::capnp::List< + ::tiledb::sm::serialization::capnp::LabelSubarrayRanges, + ::capnp::Kind::STRUCT>::Reader +Subarray::Reader::getLabelRanges() const { + return ::capnp::_::PointerHelpers<::capnp::List< + ::tiledb::sm::serialization::capnp::LabelSubarrayRanges, + ::capnp::Kind::STRUCT>>::get(_reader + .getPointerField( + ::capnp::bounded<4>() * + ::capnp::POINTERS)); +} +inline ::capnp::List< + ::tiledb::sm::serialization::capnp::LabelSubarrayRanges, + ::capnp::Kind::STRUCT>::Builder +Subarray::Builder::getLabelRanges() { + return ::capnp::_::PointerHelpers<::capnp::List< + ::tiledb::sm::serialization::capnp::LabelSubarrayRanges, + ::capnp::Kind::STRUCT>>::get(_builder + .getPointerField( + ::capnp::bounded<4>() * + ::capnp::POINTERS)); +} +inline void Subarray::Builder::setLabelRanges( + ::capnp::List< + ::tiledb::sm::serialization::capnp::LabelSubarrayRanges, + ::capnp::Kind::STRUCT>::Reader value) { + ::capnp::_::PointerHelpers<::capnp::List< + ::tiledb::sm::serialization::capnp::LabelSubarrayRanges, + ::capnp::Kind::STRUCT>>:: + set(_builder.getPointerField(::capnp::bounded<4>() * ::capnp::POINTERS), + value); +} +inline ::capnp::List< + ::tiledb::sm::serialization::capnp::LabelSubarrayRanges, + ::capnp::Kind::STRUCT>::Builder +Subarray::Builder::initLabelRanges(unsigned int size) { + return ::capnp::_::PointerHelpers<::capnp::List< + ::tiledb::sm::serialization::capnp::LabelSubarrayRanges, + ::capnp::Kind::STRUCT>>:: + init( + _builder.getPointerField(::capnp::bounded<4>() * ::capnp::POINTERS), + size); +} +inline void Subarray::Builder::adoptLabelRanges( + ::capnp::Orphan<::capnp::List< + ::tiledb::sm::serialization::capnp::LabelSubarrayRanges, + ::capnp::Kind::STRUCT>>&& value) { + ::capnp::_::PointerHelpers<::capnp::List< + ::tiledb::sm::serialization::capnp::LabelSubarrayRanges, + ::capnp::Kind::STRUCT>>:: + adopt( + _builder.getPointerField(::capnp::bounded<4>() * ::capnp::POINTERS), + kj::mv(value)); +} +inline ::capnp::Orphan<::capnp::List< + ::tiledb::sm::serialization::capnp::LabelSubarrayRanges, + ::capnp::Kind::STRUCT>> +Subarray::Builder::disownLabelRanges() { + return ::capnp::_::PointerHelpers<::capnp::List< + ::tiledb::sm::serialization::capnp::LabelSubarrayRanges, + ::capnp::Kind::STRUCT>>::disown(_builder + .getPointerField( + ::capnp::bounded<4>() * + ::capnp::POINTERS)); +} + +inline bool Subarray::Reader::hasAttributeRanges() const { + return !_reader.getPointerField(::capnp::bounded<5>() * ::capnp::POINTERS) + .isNull(); +} +inline bool Subarray::Builder::hasAttributeRanges() { + return !_builder.getPointerField(::capnp::bounded<5>() * ::capnp::POINTERS) + .isNull(); +} +inline ::tiledb::sm::serialization::capnp::Map< + ::capnp::Text, + ::tiledb::sm::serialization::capnp::SubarrayRanges>::Reader +Subarray::Reader::getAttributeRanges() const { + return ::capnp::_::PointerHelpers<::tiledb::sm::serialization::capnp::Map< + ::capnp::Text, + ::tiledb::sm::serialization::capnp::SubarrayRanges>>:: + get(_reader.getPointerField(::capnp::bounded<5>() * ::capnp::POINTERS)); +} +inline ::tiledb::sm::serialization::capnp::Map< + ::capnp::Text, + ::tiledb::sm::serialization::capnp::SubarrayRanges>::Builder +Subarray::Builder::getAttributeRanges() { + return ::capnp::_::PointerHelpers<::tiledb::sm::serialization::capnp::Map< + ::capnp::Text, + ::tiledb::sm::serialization::capnp::SubarrayRanges>>:: + get(_builder.getPointerField(::capnp::bounded<5>() * ::capnp::POINTERS)); +} +#if !CAPNP_LITE +inline ::tiledb::sm::serialization::capnp::Map< + ::capnp::Text, + ::tiledb::sm::serialization::capnp::SubarrayRanges>::Pipeline +Subarray::Pipeline::getAttributeRanges() { + return ::tiledb::sm::serialization::capnp:: + Map<::capnp::Text, ::tiledb::sm::serialization::capnp::SubarrayRanges>:: + Pipeline(_typeless.getPointerField(5)); +} +#endif // !CAPNP_LITE +inline void Subarray::Builder::setAttributeRanges( + ::tiledb::sm::serialization::capnp::Map< + ::capnp::Text, + ::tiledb::sm::serialization::capnp::SubarrayRanges>::Reader value) { + ::capnp::_::PointerHelpers<::tiledb::sm::serialization::capnp::Map< + ::capnp::Text, + ::tiledb::sm::serialization::capnp::SubarrayRanges>>:: + set(_builder.getPointerField(::capnp::bounded<5>() * ::capnp::POINTERS), + value); +} +inline ::tiledb::sm::serialization::capnp::Map< + ::capnp::Text, + ::tiledb::sm::serialization::capnp::SubarrayRanges>::Builder +Subarray::Builder::initAttributeRanges() { + return ::capnp::_::PointerHelpers<::tiledb::sm::serialization::capnp::Map< + ::capnp::Text, + ::tiledb::sm::serialization::capnp::SubarrayRanges>>:: + init(_builder.getPointerField(::capnp::bounded<5>() * ::capnp::POINTERS)); +} +inline void Subarray::Builder::adoptAttributeRanges( + ::capnp::Orphan<::tiledb::sm::serialization::capnp::Map< + ::capnp::Text, + ::tiledb::sm::serialization::capnp::SubarrayRanges>>&& value) { + ::capnp::_::PointerHelpers<::tiledb::sm::serialization::capnp::Map< + ::capnp::Text, + ::tiledb::sm::serialization::capnp::SubarrayRanges>>:: + adopt( + _builder.getPointerField(::capnp::bounded<5>() * ::capnp::POINTERS), + kj::mv(value)); +} +inline ::capnp::Orphan<::tiledb::sm::serialization::capnp::Map< + ::capnp::Text, + ::tiledb::sm::serialization::capnp::SubarrayRanges>> +Subarray::Builder::disownAttributeRanges() { + return ::capnp::_::PointerHelpers<::tiledb::sm::serialization::capnp::Map< + ::capnp::Text, + ::tiledb::sm::serialization::capnp::SubarrayRanges>>:: + disown( + _builder.getPointerField(::capnp::bounded<5>() * ::capnp::POINTERS)); +} + inline bool SubarrayPartitioner::Reader::hasSubarray() const { return !_reader.getPointerField(::capnp::bounded<0>() * ::capnp::POINTERS) .isNull(); diff --git a/tiledb/sm/serialization/tiledb-rest.capnp b/tiledb/sm/serialization/tiledb-rest.capnp index 1bc39e76b20..2bbe496f2d3 100644 --- a/tiledb/sm/serialization/tiledb-rest.capnp +++ b/tiledb/sm/serialization/tiledb-rest.capnp @@ -397,6 +397,19 @@ struct SubarrayRanges { # The list of start sizes per range } +struct LabelSubarrayRanges { + # A set of label 1D ranges for a subarray + + dimensionId @0 :UInt32; + # Index of the dimension the label is attached to + + name @1 :Text; + # Name of the dimension label + + ranges @2 :SubarrayRanges; + # A set of 1D ranges for a subarray +} + struct Subarray { # A Subarray @@ -411,6 +424,12 @@ struct Subarray { relevantFragments @3 :List(UInt32); # Relevant fragments + + labelRanges @4 :List(LabelSubarrayRanges); + # List of 1D ranges for dimensions that have labels + + attributeRanges @5 :Map(Text, SubarrayRanges); + # List of 1D ranges for each attribute } struct SubarrayPartitioner { diff --git a/tiledb/sm/serialization/win32/tiledb-rest.capnp.c++ b/tiledb/sm/serialization/win32/tiledb-rest.capnp.c++ index 1da4a50dc95..4987a039372 100644 --- a/tiledb/sm/serialization/win32/tiledb-rest.capnp.c++ +++ b/tiledb/sm/serialization/win32/tiledb-rest.capnp.c++ @@ -3299,17 +3299,96 @@ const ::capnp::_::RawSchema s_86cfc12d74ed4aa0 = { 0, 5, i_86cfc12d74ed4aa0, nullptr, nullptr, { &s_86cfc12d74ed4aa0, nullptr, nullptr, 0, 0, nullptr } }; #endif // !CAPNP_LITE -static const ::capnp::_::AlignedData<88> b_dba20dec138adac9 = { +static const ::capnp::_::AlignedData<65> b_f7aa276767b422e7 = { + { 0, 0, 0, 0, 5, 0, 6, 0, + 231, 34, 180, 103, 103, 39, 170, 247, + 18, 0, 0, 0, 1, 0, 1, 0, + 127, 216, 135, 181, 36, 146, 125, 181, + 2, 0, 7, 0, 0, 0, 0, 0, + 0, 0, 0, 0, 0, 0, 0, 0, + 21, 0, 0, 0, 50, 1, 0, 0, + 37, 0, 0, 0, 7, 0, 0, 0, + 0, 0, 0, 0, 0, 0, 0, 0, + 33, 0, 0, 0, 175, 0, 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, 76, 97, 98, 101, 108, 83, + 117, 98, 97, 114, 114, 97, 121, 82, + 97, 110, 103, 101, 115, 0, 0, 0, + 0, 0, 0, 0, 1, 0, 1, 0, + 12, 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, + 69, 0, 0, 0, 98, 0, 0, 0, + 0, 0, 0, 0, 0, 0, 0, 0, + 68, 0, 0, 0, 3, 0, 1, 0, + 80, 0, 0, 0, 2, 0, 1, 0, + 1, 0, 0, 0, 0, 0, 0, 0, + 0, 0, 1, 0, 1, 0, 0, 0, + 0, 0, 0, 0, 0, 0, 0, 0, + 77, 0, 0, 0, 42, 0, 0, 0, + 0, 0, 0, 0, 0, 0, 0, 0, + 72, 0, 0, 0, 3, 0, 1, 0, + 84, 0, 0, 0, 2, 0, 1, 0, + 2, 0, 0, 0, 1, 0, 0, 0, + 0, 0, 1, 0, 2, 0, 0, 0, + 0, 0, 0, 0, 0, 0, 0, 0, + 81, 0, 0, 0, 58, 0, 0, 0, + 0, 0, 0, 0, 0, 0, 0, 0, + 76, 0, 0, 0, 3, 0, 1, 0, + 88, 0, 0, 0, 2, 0, 1, 0, + 100, 105, 109, 101, 110, 115, 105, 111, + 110, 73, 100, 0, 0, 0, 0, 0, + 8, 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, + 8, 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, + 114, 97, 110, 103, 101, 115, 0, 0, + 16, 0, 0, 0, 0, 0, 0, 0, + 160, 74, 237, 116, 45, 193, 207, 134, + 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, } +}; +::capnp::word const* const bp_f7aa276767b422e7 = b_f7aa276767b422e7.words; +#if !CAPNP_LITE +static const ::capnp::_::RawSchema* const d_f7aa276767b422e7[] = { + &s_86cfc12d74ed4aa0, +}; +static const uint16_t m_f7aa276767b422e7[] = {0, 1, 2}; +static const uint16_t i_f7aa276767b422e7[] = {0, 1, 2}; +const ::capnp::_::RawSchema s_f7aa276767b422e7 = { + 0xf7aa276767b422e7, b_f7aa276767b422e7.words, 65, d_f7aa276767b422e7, m_f7aa276767b422e7, + 1, 3, i_f7aa276767b422e7, nullptr, nullptr, { &s_f7aa276767b422e7, nullptr, nullptr, 0, 0, nullptr } +}; +#endif // !CAPNP_LITE +static const ::capnp::_::AlignedData<142> b_dba20dec138adac9 = { { 0, 0, 0, 0, 5, 0, 6, 0, 201, 218, 138, 19, 236, 13, 162, 219, 18, 0, 0, 0, 1, 0, 0, 0, 127, 216, 135, 181, 36, 146, 125, 181, - 4, 0, 7, 0, 0, 0, 0, 0, + 6, 0, 7, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 21, 0, 0, 0, 218, 0, 0, 0, 33, 0, 0, 0, 7, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, - 29, 0, 0, 0, 231, 0, 0, 0, + 29, 0, 0, 0, 87, 1, 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, @@ -3317,35 +3396,49 @@ static const ::capnp::_::AlignedData<88> b_dba20dec138adac9 = { 112, 58, 83, 117, 98, 97, 114, 114, 97, 121, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 1, 0, 1, 0, - 16, 0, 0, 0, 3, 0, 4, 0, + 24, 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, - 97, 0, 0, 0, 58, 0, 0, 0, + 153, 0, 0, 0, 58, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, - 92, 0, 0, 0, 3, 0, 1, 0, - 104, 0, 0, 0, 2, 0, 1, 0, + 148, 0, 0, 0, 3, 0, 1, 0, + 160, 0, 0, 0, 2, 0, 1, 0, 1, 0, 0, 0, 1, 0, 0, 0, 0, 0, 1, 0, 1, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, - 101, 0, 0, 0, 58, 0, 0, 0, + 157, 0, 0, 0, 58, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, - 96, 0, 0, 0, 3, 0, 1, 0, - 124, 0, 0, 0, 2, 0, 1, 0, + 152, 0, 0, 0, 3, 0, 1, 0, + 180, 0, 0, 0, 2, 0, 1, 0, 2, 0, 0, 0, 2, 0, 0, 0, 0, 0, 1, 0, 2, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, - 121, 0, 0, 0, 50, 0, 0, 0, + 177, 0, 0, 0, 50, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, - 116, 0, 0, 0, 3, 0, 1, 0, - 128, 0, 0, 0, 2, 0, 1, 0, + 172, 0, 0, 0, 3, 0, 1, 0, + 184, 0, 0, 0, 2, 0, 1, 0, 3, 0, 0, 0, 3, 0, 0, 0, 0, 0, 1, 0, 3, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, - 125, 0, 0, 0, 146, 0, 0, 0, + 181, 0, 0, 0, 146, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, - 128, 0, 0, 0, 3, 0, 1, 0, - 156, 0, 0, 0, 2, 0, 1, 0, + 184, 0, 0, 0, 3, 0, 1, 0, + 212, 0, 0, 0, 2, 0, 1, 0, + 4, 0, 0, 0, 4, 0, 0, 0, + 0, 0, 1, 0, 4, 0, 0, 0, + 0, 0, 0, 0, 0, 0, 0, 0, + 209, 0, 0, 0, 98, 0, 0, 0, + 0, 0, 0, 0, 0, 0, 0, 0, + 208, 0, 0, 0, 3, 0, 1, 0, + 236, 0, 0, 0, 2, 0, 1, 0, + 5, 0, 0, 0, 5, 0, 0, 0, + 0, 0, 1, 0, 5, 0, 0, 0, + 0, 0, 0, 0, 0, 0, 0, 0, + 233, 0, 0, 0, 130, 0, 0, 0, + 0, 0, 0, 0, 0, 0, 0, 0, + 232, 0, 0, 0, 3, 0, 1, 0, + 60, 1, 0, 0, 2, 0, 1, 0, 108, 97, 121, 111, 117, 116, 0, 0, 12, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, @@ -3386,6 +3479,46 @@ static const ::capnp::_::AlignedData<88> b_dba20dec138adac9 = { 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 14, 0, 0, 0, 0, 0, 0, 0, + 0, 0, 0, 0, 0, 0, 0, 0, + 0, 0, 0, 0, 0, 0, 0, 0, + 108, 97, 98, 101, 108, 82, 97, 110, + 103, 101, 115, 0, 0, 0, 0, 0, + 14, 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, 3, 0, 1, 0, + 16, 0, 0, 0, 0, 0, 0, 0, + 231, 34, 180, 103, 103, 39, 170, 247, + 0, 0, 0, 0, 0, 0, 0, 0, + 0, 0, 0, 0, 0, 0, 0, 0, + 14, 0, 0, 0, 0, 0, 0, 0, + 0, 0, 0, 0, 0, 0, 0, 0, + 0, 0, 0, 0, 0, 0, 0, 0, + 97, 116, 116, 114, 105, 98, 117, 116, + 101, 82, 97, 110, 103, 101, 115, 0, + 16, 0, 0, 0, 0, 0, 0, 0, + 140, 113, 113, 174, 148, 193, 121, 241, + 0, 0, 0, 0, 0, 0, 0, 0, + 0, 0, 0, 0, 0, 0, 1, 0, + 1, 0, 0, 0, 31, 0, 0, 0, + 4, 0, 0, 0, 2, 0, 1, 0, + 140, 113, 113, 174, 148, 193, 121, 241, + 0, 0, 0, 0, 0, 0, 0, 0, + 1, 0, 0, 0, 39, 0, 0, 0, + 8, 0, 0, 0, 1, 0, 1, 0, + 1, 0, 0, 0, 0, 0, 0, 0, + 8, 0, 0, 0, 3, 0, 1, 0, + 1, 0, 0, 0, 0, 0, 0, 0, + 16, 0, 0, 0, 3, 0, 1, 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, + 16, 0, 0, 0, 0, 0, 0, 0, + 160, 74, 237, 116, 45, 193, 207, 134, + 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, } }; @@ -3394,12 +3527,17 @@ static const ::capnp::_::AlignedData<88> b_dba20dec138adac9 = { static const ::capnp::_::RawSchema* const d_dba20dec138adac9[] = { &s_86cfc12d74ed4aa0, &s_c7e036a11506a1a4, + &s_f179c194ae71718c, + &s_f7aa276767b422e7, +}; +static const uint16_t m_dba20dec138adac9[] = {5, 4, 0, 1, 3, 2}; +static const uint16_t i_dba20dec138adac9[] = {0, 1, 2, 3, 4, 5}; +KJ_CONSTEXPR(const) ::capnp::_::RawBrandedSchema::Dependency bd_dba20dec138adac9[] = { + { 16777221, ::tiledb::sm::serialization::capnp::Map< ::capnp::Text, ::tiledb::sm::serialization::capnp::SubarrayRanges>::_capnpPrivate::brand() }, }; -static const uint16_t m_dba20dec138adac9[] = {0, 1, 3, 2}; -static const uint16_t i_dba20dec138adac9[] = {0, 1, 2, 3}; const ::capnp::_::RawSchema s_dba20dec138adac9 = { - 0xdba20dec138adac9, b_dba20dec138adac9.words, 88, d_dba20dec138adac9, m_dba20dec138adac9, - 2, 4, i_dba20dec138adac9, nullptr, nullptr, { &s_dba20dec138adac9, nullptr, nullptr, 0, 0, nullptr } + 0xdba20dec138adac9, b_dba20dec138adac9.words, 142, d_dba20dec138adac9, m_dba20dec138adac9, + 4, 6, i_dba20dec138adac9, nullptr, nullptr, { &s_dba20dec138adac9, nullptr, bd_dba20dec138adac9, 0, sizeof(bd_dba20dec138adac9) / sizeof(bd_dba20dec138adac9[0]), nullptr } }; #endif // !CAPNP_LITE static const ::capnp::_::AlignedData<155> b_ff14003c70494585 = { @@ -8752,6 +8890,14 @@ constexpr ::capnp::Kind SubarrayRanges::_capnpPrivate::kind; constexpr ::capnp::_::RawSchema const* SubarrayRanges::_capnpPrivate::schema; #endif // !CAPNP_LITE +// LabelSubarrayRanges +constexpr uint16_t LabelSubarrayRanges::_capnpPrivate::dataWordSize; +constexpr uint16_t LabelSubarrayRanges::_capnpPrivate::pointerCount; +#if !CAPNP_LITE +constexpr ::capnp::Kind LabelSubarrayRanges::_capnpPrivate::kind; +constexpr ::capnp::_::RawSchema const* LabelSubarrayRanges::_capnpPrivate::schema; +#endif // !CAPNP_LITE + // Subarray constexpr uint16_t Subarray::_capnpPrivate::dataWordSize; constexpr uint16_t Subarray::_capnpPrivate::pointerCount; diff --git a/tiledb/sm/serialization/win32/tiledb-rest.capnp.h b/tiledb/sm/serialization/win32/tiledb-rest.capnp.h index b6ec22fe42a..07d8e52e56f 100644 --- a/tiledb/sm/serialization/win32/tiledb-rest.capnp.h +++ b/tiledb/sm/serialization/win32/tiledb-rest.capnp.h @@ -45,6 +45,7 @@ CAPNP_DECLARE_SCHEMA(bb80cdbc3f312934); CAPNP_DECLARE_SCHEMA(c7e036a11506a1a4); CAPNP_DECLARE_SCHEMA(8ba60147a0e6735e); CAPNP_DECLARE_SCHEMA(86cfc12d74ed4aa0); +CAPNP_DECLARE_SCHEMA(f7aa276767b422e7); CAPNP_DECLARE_SCHEMA(dba20dec138adac9); CAPNP_DECLARE_SCHEMA(ff14003c70494585); CAPNP_DECLARE_SCHEMA(f86b7bf97823250f); @@ -671,6 +672,23 @@ struct SubarrayRanges { }; }; +struct LabelSubarrayRanges { + LabelSubarrayRanges() = delete; + + class Reader; + class Builder; + class Pipeline; + + struct _capnpPrivate { + CAPNP_DECLARE_STRUCT_HEADER(f7aa276767b422e7, 1, 2) +#if !CAPNP_LITE + static constexpr ::capnp::_::RawBrandedSchema const* brand() { + return &schema->defaultBrand; + } +#endif // !CAPNP_LITE + }; +}; + struct Subarray { Subarray() = delete; @@ -679,7 +697,7 @@ struct Subarray { class Pipeline; struct _capnpPrivate { - CAPNP_DECLARE_STRUCT_HEADER(dba20dec138adac9, 0, 4) + CAPNP_DECLARE_STRUCT_HEADER(dba20dec138adac9, 0, 6) #if !CAPNP_LITE static constexpr ::capnp::_::RawBrandedSchema const* brand() { return &schema->defaultBrand; @@ -5875,6 +5893,128 @@ class SubarrayRanges::Pipeline { }; #endif // !CAPNP_LITE +class LabelSubarrayRanges::Reader { + public: + typedef LabelSubarrayRanges Reads; + + Reader() = default; + inline explicit Reader(::capnp::_::StructReader base) + : _reader(base) { + } + + inline ::capnp::MessageSize totalSize() const { + return _reader.totalSize().asPublic(); + } + +#if !CAPNP_LITE + inline ::kj::StringTree toString() const { + return ::capnp::_::structString(_reader, *_capnpPrivate::brand()); + } +#endif // !CAPNP_LITE + + inline ::uint32_t getDimensionId() const; + + inline bool hasName() const; + inline ::capnp::Text::Reader getName() const; + + inline bool hasRanges() const; + inline ::tiledb::sm::serialization::capnp::SubarrayRanges::Reader getRanges() + const; + + private: + ::capnp::_::StructReader _reader; + template + friend struct ::capnp::ToDynamic_; + template + friend struct ::capnp::_::PointerHelpers; + template + friend struct ::capnp::List; + friend class ::capnp::MessageBuilder; + friend class ::capnp::Orphanage; +}; + +class LabelSubarrayRanges::Builder { + public: + typedef LabelSubarrayRanges Builds; + + Builder() = delete; // Deleted to discourage incorrect usage. + // You can explicitly initialize to nullptr instead. + inline Builder(decltype(nullptr)) { + } + inline explicit Builder(::capnp::_::StructBuilder base) + : _builder(base) { + } + inline operator Reader() const { + return Reader(_builder.asReader()); + } + inline Reader asReader() const { + return *this; + } + + inline ::capnp::MessageSize totalSize() const { + return asReader().totalSize(); + } +#if !CAPNP_LITE + inline ::kj::StringTree toString() const { + return asReader().toString(); + } +#endif // !CAPNP_LITE + + inline ::uint32_t getDimensionId(); + inline void setDimensionId(::uint32_t value); + + 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(); + + inline bool hasRanges(); + inline ::tiledb::sm::serialization::capnp::SubarrayRanges::Builder + getRanges(); + inline void setRanges( + ::tiledb::sm::serialization::capnp::SubarrayRanges::Reader value); + inline ::tiledb::sm::serialization::capnp::SubarrayRanges::Builder + initRanges(); + inline void adoptRanges( + ::capnp::Orphan<::tiledb::sm::serialization::capnp::SubarrayRanges>&& + value); + inline ::capnp::Orphan<::tiledb::sm::serialization::capnp::SubarrayRanges> + disownRanges(); + + private: + ::capnp::_::StructBuilder _builder; + template + friend struct ::capnp::ToDynamic_; + friend class ::capnp::Orphanage; + template + friend struct ::capnp::_::PointerHelpers; +}; + +#if !CAPNP_LITE +class LabelSubarrayRanges::Pipeline { + public: + typedef LabelSubarrayRanges Pipelines; + + inline Pipeline(decltype(nullptr)) + : _typeless(nullptr) { + } + inline explicit Pipeline(::capnp::AnyPointer::Pipeline&& typeless) + : _typeless(kj::mv(typeless)) { + } + + inline ::tiledb::sm::serialization::capnp::SubarrayRanges::Pipeline + getRanges(); + + private: + ::capnp::AnyPointer::Pipeline _typeless; + friend class ::capnp::PipelineHook; + template + friend struct ::capnp::ToDynamic_; +}; +#endif // !CAPNP_LITE + class Subarray::Reader { public: typedef Subarray Reads; @@ -5910,6 +6050,18 @@ class Subarray::Reader { inline ::capnp::List<::uint32_t, ::capnp::Kind::PRIMITIVE>::Reader getRelevantFragments() const; + inline bool hasLabelRanges() const; + inline ::capnp::List< + ::tiledb::sm::serialization::capnp::LabelSubarrayRanges, + ::capnp::Kind::STRUCT>::Reader + getLabelRanges() const; + + inline bool hasAttributeRanges() const; + inline ::tiledb::sm::serialization::capnp::Map< + ::capnp::Text, + ::tiledb::sm::serialization::capnp::SubarrayRanges>::Reader + getAttributeRanges() const; + private: ::capnp::_::StructReader _reader; template @@ -6000,6 +6152,50 @@ class Subarray::Builder { inline ::capnp::Orphan<::capnp::List<::uint32_t, ::capnp::Kind::PRIMITIVE>> disownRelevantFragments(); + inline bool hasLabelRanges(); + inline ::capnp::List< + ::tiledb::sm::serialization::capnp::LabelSubarrayRanges, + ::capnp::Kind::STRUCT>::Builder + getLabelRanges(); + inline void setLabelRanges( + ::capnp::List< + ::tiledb::sm::serialization::capnp::LabelSubarrayRanges, + ::capnp::Kind::STRUCT>::Reader value); + inline ::capnp::List< + ::tiledb::sm::serialization::capnp::LabelSubarrayRanges, + ::capnp::Kind::STRUCT>::Builder + initLabelRanges(unsigned int size); + inline void adoptLabelRanges( + ::capnp::Orphan<::capnp::List< + ::tiledb::sm::serialization::capnp::LabelSubarrayRanges, + ::capnp::Kind::STRUCT>>&& value); + inline ::capnp::Orphan<::capnp::List< + ::tiledb::sm::serialization::capnp::LabelSubarrayRanges, + ::capnp::Kind::STRUCT>> + disownLabelRanges(); + + inline bool hasAttributeRanges(); + inline ::tiledb::sm::serialization::capnp::Map< + ::capnp::Text, + ::tiledb::sm::serialization::capnp::SubarrayRanges>::Builder + getAttributeRanges(); + inline void setAttributeRanges( + ::tiledb::sm::serialization::capnp::Map< + ::capnp::Text, + ::tiledb::sm::serialization::capnp::SubarrayRanges>::Reader value); + inline ::tiledb::sm::serialization::capnp::Map< + ::capnp::Text, + ::tiledb::sm::serialization::capnp::SubarrayRanges>::Builder + initAttributeRanges(); + inline void adoptAttributeRanges( + ::capnp::Orphan<::tiledb::sm::serialization::capnp::Map< + ::capnp::Text, + ::tiledb::sm::serialization::capnp::SubarrayRanges>>&& value); + inline ::capnp::Orphan<::tiledb::sm::serialization::capnp::Map< + ::capnp::Text, + ::tiledb::sm::serialization::capnp::SubarrayRanges>> + disownAttributeRanges(); + private: ::capnp::_::StructBuilder _builder; template @@ -6022,6 +6218,10 @@ class Subarray::Pipeline { } inline ::tiledb::sm::serialization::capnp::Stats::Pipeline getStats(); + inline ::tiledb::sm::serialization::capnp::Map< + ::capnp::Text, + ::tiledb::sm::serialization::capnp::SubarrayRanges>::Pipeline + getAttributeRanges(); private: ::capnp::AnyPointer::Pipeline _typeless; @@ -18517,6 +18717,115 @@ SubarrayRanges::Builder::disownBufferStartSizes() { _builder.getPointerField(::capnp::bounded<3>() * ::capnp::POINTERS)); } +inline ::uint32_t LabelSubarrayRanges::Reader::getDimensionId() const { + return _reader.getDataField<::uint32_t>( + ::capnp::bounded<0>() * ::capnp::ELEMENTS); +} + +inline ::uint32_t LabelSubarrayRanges::Builder::getDimensionId() { + return _builder.getDataField<::uint32_t>( + ::capnp::bounded<0>() * ::capnp::ELEMENTS); +} +inline void LabelSubarrayRanges::Builder::setDimensionId(::uint32_t value) { + _builder.setDataField<::uint32_t>( + ::capnp::bounded<0>() * ::capnp::ELEMENTS, value); +} + +inline bool LabelSubarrayRanges::Reader::hasName() const { + return !_reader.getPointerField(::capnp::bounded<0>() * ::capnp::POINTERS) + .isNull(); +} +inline bool LabelSubarrayRanges::Builder::hasName() { + return !_builder.getPointerField(::capnp::bounded<0>() * ::capnp::POINTERS) + .isNull(); +} +inline ::capnp::Text::Reader LabelSubarrayRanges::Reader::getName() const { + return ::capnp::_::PointerHelpers<::capnp::Text>::get( + _reader.getPointerField(::capnp::bounded<0>() * ::capnp::POINTERS)); +} +inline ::capnp::Text::Builder LabelSubarrayRanges::Builder::getName() { + return ::capnp::_::PointerHelpers<::capnp::Text>::get( + _builder.getPointerField(::capnp::bounded<0>() * ::capnp::POINTERS)); +} +inline void LabelSubarrayRanges::Builder::setName(::capnp::Text::Reader value) { + ::capnp::_::PointerHelpers<::capnp::Text>::set( + _builder.getPointerField(::capnp::bounded<0>() * ::capnp::POINTERS), + value); +} +inline ::capnp::Text::Builder LabelSubarrayRanges::Builder::initName( + unsigned int size) { + return ::capnp::_::PointerHelpers<::capnp::Text>::init( + _builder.getPointerField(::capnp::bounded<0>() * ::capnp::POINTERS), + size); +} +inline void LabelSubarrayRanges::Builder::adoptName( + ::capnp::Orphan<::capnp::Text>&& value) { + ::capnp::_::PointerHelpers<::capnp::Text>::adopt( + _builder.getPointerField(::capnp::bounded<0>() * ::capnp::POINTERS), + kj::mv(value)); +} +inline ::capnp::Orphan<::capnp::Text> +LabelSubarrayRanges::Builder::disownName() { + return ::capnp::_::PointerHelpers<::capnp::Text>::disown( + _builder.getPointerField(::capnp::bounded<0>() * ::capnp::POINTERS)); +} + +inline bool LabelSubarrayRanges::Reader::hasRanges() const { + return !_reader.getPointerField(::capnp::bounded<1>() * ::capnp::POINTERS) + .isNull(); +} +inline bool LabelSubarrayRanges::Builder::hasRanges() { + return !_builder.getPointerField(::capnp::bounded<1>() * ::capnp::POINTERS) + .isNull(); +} +inline ::tiledb::sm::serialization::capnp::SubarrayRanges::Reader +LabelSubarrayRanges::Reader::getRanges() const { + return ::capnp::_:: + PointerHelpers<::tiledb::sm::serialization::capnp::SubarrayRanges>::get( + _reader.getPointerField(::capnp::bounded<1>() * ::capnp::POINTERS)); +} +inline ::tiledb::sm::serialization::capnp::SubarrayRanges::Builder +LabelSubarrayRanges::Builder::getRanges() { + return ::capnp::_:: + PointerHelpers<::tiledb::sm::serialization::capnp::SubarrayRanges>::get( + _builder.getPointerField(::capnp::bounded<1>() * ::capnp::POINTERS)); +} +#if !CAPNP_LITE +inline ::tiledb::sm::serialization::capnp::SubarrayRanges::Pipeline +LabelSubarrayRanges::Pipeline::getRanges() { + return ::tiledb::sm::serialization::capnp::SubarrayRanges::Pipeline( + _typeless.getPointerField(1)); +} +#endif // !CAPNP_LITE +inline void LabelSubarrayRanges::Builder::setRanges( + ::tiledb::sm::serialization::capnp::SubarrayRanges::Reader value) { + ::capnp::_:: + PointerHelpers<::tiledb::sm::serialization::capnp::SubarrayRanges>::set( + _builder.getPointerField(::capnp::bounded<1>() * ::capnp::POINTERS), + value); +} +inline ::tiledb::sm::serialization::capnp::SubarrayRanges::Builder +LabelSubarrayRanges::Builder::initRanges() { + return ::capnp::_:: + PointerHelpers<::tiledb::sm::serialization::capnp::SubarrayRanges>::init( + _builder.getPointerField(::capnp::bounded<1>() * ::capnp::POINTERS)); +} +inline void LabelSubarrayRanges::Builder::adoptRanges( + ::capnp::Orphan<::tiledb::sm::serialization::capnp::SubarrayRanges>&& + value) { + ::capnp::_:: + PointerHelpers<::tiledb::sm::serialization::capnp::SubarrayRanges>::adopt( + _builder.getPointerField(::capnp::bounded<1>() * ::capnp::POINTERS), + kj::mv(value)); +} +inline ::capnp::Orphan<::tiledb::sm::serialization::capnp::SubarrayRanges> +LabelSubarrayRanges::Builder::disownRanges() { + return ::capnp::_::PointerHelpers< + ::tiledb::sm::serialization::capnp::SubarrayRanges>:: + disown( + _builder.getPointerField(::capnp::bounded<1>() * ::capnp::POINTERS)); +} + inline bool Subarray::Reader::hasLayout() const { return !_reader.getPointerField(::capnp::bounded<0>() * ::capnp::POINTERS) .isNull(); @@ -18735,6 +19044,157 @@ Subarray::Builder::disownRelevantFragments() { _builder.getPointerField(::capnp::bounded<3>() * ::capnp::POINTERS)); } +inline bool Subarray::Reader::hasLabelRanges() const { + return !_reader.getPointerField(::capnp::bounded<4>() * ::capnp::POINTERS) + .isNull(); +} +inline bool Subarray::Builder::hasLabelRanges() { + return !_builder.getPointerField(::capnp::bounded<4>() * ::capnp::POINTERS) + .isNull(); +} +inline ::capnp::List< + ::tiledb::sm::serialization::capnp::LabelSubarrayRanges, + ::capnp::Kind::STRUCT>::Reader +Subarray::Reader::getLabelRanges() const { + return ::capnp::_::PointerHelpers<::capnp::List< + ::tiledb::sm::serialization::capnp::LabelSubarrayRanges, + ::capnp::Kind::STRUCT>>::get(_reader + .getPointerField( + ::capnp::bounded<4>() * + ::capnp::POINTERS)); +} +inline ::capnp::List< + ::tiledb::sm::serialization::capnp::LabelSubarrayRanges, + ::capnp::Kind::STRUCT>::Builder +Subarray::Builder::getLabelRanges() { + return ::capnp::_::PointerHelpers<::capnp::List< + ::tiledb::sm::serialization::capnp::LabelSubarrayRanges, + ::capnp::Kind::STRUCT>>::get(_builder + .getPointerField( + ::capnp::bounded<4>() * + ::capnp::POINTERS)); +} +inline void Subarray::Builder::setLabelRanges( + ::capnp::List< + ::tiledb::sm::serialization::capnp::LabelSubarrayRanges, + ::capnp::Kind::STRUCT>::Reader value) { + ::capnp::_::PointerHelpers<::capnp::List< + ::tiledb::sm::serialization::capnp::LabelSubarrayRanges, + ::capnp::Kind::STRUCT>>:: + set(_builder.getPointerField(::capnp::bounded<4>() * ::capnp::POINTERS), + value); +} +inline ::capnp::List< + ::tiledb::sm::serialization::capnp::LabelSubarrayRanges, + ::capnp::Kind::STRUCT>::Builder +Subarray::Builder::initLabelRanges(unsigned int size) { + return ::capnp::_::PointerHelpers<::capnp::List< + ::tiledb::sm::serialization::capnp::LabelSubarrayRanges, + ::capnp::Kind::STRUCT>>:: + init( + _builder.getPointerField(::capnp::bounded<4>() * ::capnp::POINTERS), + size); +} +inline void Subarray::Builder::adoptLabelRanges( + ::capnp::Orphan<::capnp::List< + ::tiledb::sm::serialization::capnp::LabelSubarrayRanges, + ::capnp::Kind::STRUCT>>&& value) { + ::capnp::_::PointerHelpers<::capnp::List< + ::tiledb::sm::serialization::capnp::LabelSubarrayRanges, + ::capnp::Kind::STRUCT>>:: + adopt( + _builder.getPointerField(::capnp::bounded<4>() * ::capnp::POINTERS), + kj::mv(value)); +} +inline ::capnp::Orphan<::capnp::List< + ::tiledb::sm::serialization::capnp::LabelSubarrayRanges, + ::capnp::Kind::STRUCT>> +Subarray::Builder::disownLabelRanges() { + return ::capnp::_::PointerHelpers<::capnp::List< + ::tiledb::sm::serialization::capnp::LabelSubarrayRanges, + ::capnp::Kind::STRUCT>>::disown(_builder + .getPointerField( + ::capnp::bounded<4>() * + ::capnp::POINTERS)); +} + +inline bool Subarray::Reader::hasAttributeRanges() const { + return !_reader.getPointerField(::capnp::bounded<5>() * ::capnp::POINTERS) + .isNull(); +} +inline bool Subarray::Builder::hasAttributeRanges() { + return !_builder.getPointerField(::capnp::bounded<5>() * ::capnp::POINTERS) + .isNull(); +} +inline ::tiledb::sm::serialization::capnp::Map< + ::capnp::Text, + ::tiledb::sm::serialization::capnp::SubarrayRanges>::Reader +Subarray::Reader::getAttributeRanges() const { + return ::capnp::_::PointerHelpers<::tiledb::sm::serialization::capnp::Map< + ::capnp::Text, + ::tiledb::sm::serialization::capnp::SubarrayRanges>>:: + get(_reader.getPointerField(::capnp::bounded<5>() * ::capnp::POINTERS)); +} +inline ::tiledb::sm::serialization::capnp::Map< + ::capnp::Text, + ::tiledb::sm::serialization::capnp::SubarrayRanges>::Builder +Subarray::Builder::getAttributeRanges() { + return ::capnp::_::PointerHelpers<::tiledb::sm::serialization::capnp::Map< + ::capnp::Text, + ::tiledb::sm::serialization::capnp::SubarrayRanges>>:: + get(_builder.getPointerField(::capnp::bounded<5>() * ::capnp::POINTERS)); +} +#if !CAPNP_LITE +inline ::tiledb::sm::serialization::capnp::Map< + ::capnp::Text, + ::tiledb::sm::serialization::capnp::SubarrayRanges>::Pipeline +Subarray::Pipeline::getAttributeRanges() { + return ::tiledb::sm::serialization::capnp:: + Map<::capnp::Text, ::tiledb::sm::serialization::capnp::SubarrayRanges>:: + Pipeline(_typeless.getPointerField(5)); +} +#endif // !CAPNP_LITE +inline void Subarray::Builder::setAttributeRanges( + ::tiledb::sm::serialization::capnp::Map< + ::capnp::Text, + ::tiledb::sm::serialization::capnp::SubarrayRanges>::Reader value) { + ::capnp::_::PointerHelpers<::tiledb::sm::serialization::capnp::Map< + ::capnp::Text, + ::tiledb::sm::serialization::capnp::SubarrayRanges>>:: + set(_builder.getPointerField(::capnp::bounded<5>() * ::capnp::POINTERS), + value); +} +inline ::tiledb::sm::serialization::capnp::Map< + ::capnp::Text, + ::tiledb::sm::serialization::capnp::SubarrayRanges>::Builder +Subarray::Builder::initAttributeRanges() { + return ::capnp::_::PointerHelpers<::tiledb::sm::serialization::capnp::Map< + ::capnp::Text, + ::tiledb::sm::serialization::capnp::SubarrayRanges>>:: + init(_builder.getPointerField(::capnp::bounded<5>() * ::capnp::POINTERS)); +} +inline void Subarray::Builder::adoptAttributeRanges( + ::capnp::Orphan<::tiledb::sm::serialization::capnp::Map< + ::capnp::Text, + ::tiledb::sm::serialization::capnp::SubarrayRanges>>&& value) { + ::capnp::_::PointerHelpers<::tiledb::sm::serialization::capnp::Map< + ::capnp::Text, + ::tiledb::sm::serialization::capnp::SubarrayRanges>>:: + adopt( + _builder.getPointerField(::capnp::bounded<5>() * ::capnp::POINTERS), + kj::mv(value)); +} +inline ::capnp::Orphan<::tiledb::sm::serialization::capnp::Map< + ::capnp::Text, + ::tiledb::sm::serialization::capnp::SubarrayRanges>> +Subarray::Builder::disownAttributeRanges() { + return ::capnp::_::PointerHelpers<::tiledb::sm::serialization::capnp::Map< + ::capnp::Text, + ::tiledb::sm::serialization::capnp::SubarrayRanges>>:: + disown( + _builder.getPointerField(::capnp::bounded<5>() * ::capnp::POINTERS)); +} + inline bool SubarrayPartitioner::Reader::hasSubarray() const { return !_reader.getPointerField(::capnp::bounded<0>() * ::capnp::POINTERS) .isNull(); From 6f849039f835ed0e02fed69305f06fc017b23826 Mon Sep 17 00:00:00 2001 From: Ypatia Tsavliri Date: Thu, 2 Mar 2023 10:25:24 +0200 Subject: [PATCH 2/6] Update subarray_from/to_capnp --- tiledb/sm/serialization/query.cc | 153 ++++++++++++++++++++++++------- tiledb/sm/subarray/subarray.cc | 71 ++++++++++---- tiledb/sm/subarray/subarray.h | 46 +++++++++- 3 files changed, 217 insertions(+), 53 deletions(-) diff --git a/tiledb/sm/serialization/query.cc b/tiledb/sm/serialization/query.cc index 19ab8e5a69f..310d0034d9a 100644 --- a/tiledb/sm/serialization/query.cc +++ b/tiledb/sm/serialization/query.cc @@ -137,12 +137,57 @@ Status stats_from_capnp( return Status::Ok(); } +void range_buffers_to_capnp( + const std::vector& ranges, + capnp::SubarrayRanges::Builder& range_builder) { + auto range_sizes = range_builder.initBufferSizes(ranges.size()); + auto range_start_sizes = range_builder.initBufferStartSizes(ranges.size()); + // This will copy all of the ranges into one large byte vector + // Future improvement is to do this in a zero copy manner + // (kj::ArrayBuilder?) + auto capnpVector = kj::Vector(); + uint64_t range_idx = 0; + for (auto& range : ranges) { + capnpVector.addAll(kj::ArrayPtr( + const_cast(reinterpret_cast(range.data())), + range.size())); + range_sizes.set(range_idx, range.size()); + range_start_sizes.set(range_idx, range.start_size()); + ++range_idx; + } + range_builder.setBuffer(capnpVector.asPtr()); +} + +std::vector range_buffers_from_capnp( + capnp::SubarrayRanges::Reader& range_reader) { + auto data_ptr = range_reader.getBuffer().asBytes(); + auto buffer_sizes = range_reader.getBufferSizes(); + auto buffer_start_sizes = range_reader.getBufferStartSizes(); + size_t range_count = buffer_sizes.size(); + std::vector ranges(range_count); + uint64_t offset = 0; + for (size_t j = 0; j < range_count; j++) { + uint64_t range_size = buffer_sizes[j]; + uint64_t range_start_size = buffer_start_sizes[j]; + if (range_start_size != 0) { + ranges[j] = + Range(data_ptr.begin() + offset, range_size, range_start_size); + } else { + ranges[j] = Range(data_ptr.begin() + offset, range_size); + } + offset += range_size; + } + + return ranges; +} + Status subarray_to_capnp( const ArraySchema& schema, const Subarray* subarray, capnp::Subarray::Builder* builder) { builder->setLayout(layout_str(subarray->layout())); + // Add ranges const uint32_t dim_num = subarray->dim_num(); auto ranges_builder = builder->initRanges(dim_num); for (uint32_t i = 0; i < dim_num; i++) { @@ -150,24 +195,49 @@ Status subarray_to_capnp( auto range_builder = ranges_builder[i]; const auto& ranges = subarray->ranges_for_dim(i); range_builder.setType(datatype_str(datatype)); - range_builder.setHasDefaultRange(subarray->is_default(i)); - auto range_sizes = range_builder.initBufferSizes(ranges.size()); - auto range_start_sizes = range_builder.initBufferStartSizes(ranges.size()); - // This will copy all of the ranges into one large byte vector - // Future improvement is to do this in a zero copy manner - // (kj::ArrayBuilder?) - auto capnpVector = kj::Vector(); - uint64_t range_idx = 0; - for (auto& range : ranges) { - capnpVector.addAll(kj::ArrayPtr( - const_cast(reinterpret_cast(range.data())), - range.size())); - range_sizes.set(range_idx, range.size()); - range_start_sizes.set(range_idx, range.start_size()); - ++range_idx; + range_buffers_to_capnp(ranges, range_builder); + } + + // Add label ranges + const auto label_ranges_num = subarray->label_ranges_num(); + if (label_ranges_num > 0) { + auto label_ranges_builder = builder->initLabelRanges(label_ranges_num); + auto label_id = 0; + for (uint32_t i = 0; i < dim_num; i++) { + if (subarray->has_label_ranges(i)) { + auto label_range_builder = label_ranges_builder[label_id++]; + // TODO: Consider throwing instead + assert(label_id < label_ranges_num); + label_range_builder.setDimensionId(i); + const auto& label_name = subarray->get_label_name(i); + label_range_builder.setName(label_name); + + auto range_builder = label_range_builder.initRanges(); + const auto datatype{schema.dimension_ptr(i)->type()}; + const auto& label_ranges = subarray->ranges_for_label(label_name); + range_builder.setType(datatype_str(datatype)); + // TODO: check with Julia if for dim lables is_implicitely_initialized_ + // is always false. Should I even set this here? + // range_builder.setHasDefaultRange(false); + range_buffers_to_capnp(label_ranges, range_builder); + } + } + } + + // Add attribute ranges + const auto& attr_ranges = subarray->get_attribute_ranges(); + if (attr_ranges.size() > 0) { + auto attribute_ranges_builder = builder->initAttributeRanges(); + auto entries_builder = + attribute_ranges_builder.initEntries(attr_ranges.size()); + size_t i = 0; + for (const auto& attr_range : attr_ranges) { + auto entry = entries_builder[i++]; + entry.setKey(attr_range.first); + auto attr_range_builder = entry.initValue(); + range_buffers_to_capnp(attr_range.second, attr_range_builder); } - range_builder.setBuffer(capnpVector.asPtr()); } // If stats object exists set its cap'n proto object @@ -202,23 +272,7 @@ Status subarray_from_capnp( auto data = range_reader.getBuffer(); auto data_ptr = data.asBytes(); if (range_reader.hasBufferSizes()) { - auto buffer_sizes = range_reader.getBufferSizes(); - auto buffer_start_sizes = range_reader.getBufferStartSizes(); - size_t range_count = buffer_sizes.size(); - std::vector ranges(range_count); - uint64_t offset = 0; - for (size_t j = 0; j < range_count; j++) { - uint64_t range_size = buffer_sizes[j]; - uint64_t range_start_size = buffer_start_sizes[j]; - if (range_start_size != 0) { - ranges[j] = - Range(data_ptr.begin() + offset, range_size, range_start_size); - } else { - ranges[j] = Range(data_ptr.begin() + offset, range_size); - } - offset += range_size; - } - + auto ranges = range_buffers_from_capnp(range_reader); RETURN_NOT_OK(subarray->set_ranges_for_dim(i, ranges)); // Set default indicator @@ -231,6 +285,39 @@ Status subarray_from_capnp( } } + if (reader.hasLabelRanges()) { + subarray->add_default_label_ranges(dim_num); + auto label_ranges_reader = reader.getLabelRanges(); + uint32_t label_num = label_ranges_reader.size(); + for (uint32_t i = 0; i < label_num; i++) { + auto label_range_reader = label_ranges_reader[i]; + auto dim_id = label_range_reader.getDimensionId(); + auto label_name = label_range_reader.getName(); + + // Deserialize ranges for this dim label + auto range_reader = label_range_reader.getRanges(); + auto ranges = range_buffers_from_capnp(range_reader); + + // Set ranges for this dim label on the subarray + subarray->set_label_ranges_for_dim(dim_id, label_name, ranges); + } + } + + if (reader.hasAttributeRanges()) { + std::unordered_map> attr_ranges; + auto attr_ranges_reader = reader.getAttributeRanges(); + if (attr_ranges_reader.hasEntries()) { + for (auto attr_ranges_entry : attr_ranges_reader.getEntries()) { + auto range_reader = attr_ranges_entry.getValue(); + attr_ranges[attr_ranges_entry.getKey()] = + range_buffers_from_capnp(range_reader); + } + } + + for (const auto& attr_range : attr_ranges) + subarray->set_attribute_ranges(attr_range.first, attr_range.second); + } + // If cap'n proto object has stats set it on c++ object if (reader.hasStats()) { stats::Stats* stats = subarray->stats(); diff --git a/tiledb/sm/subarray/subarray.cc b/tiledb/sm/subarray/subarray.cc index b897dbc1930..15f477c1c50 100644 --- a/tiledb/sm/subarray/subarray.cc +++ b/tiledb/sm/subarray/subarray.cc @@ -184,11 +184,11 @@ void Subarray::add_label_range( if (label_range_subset_[dim_idx].has_value()) { // A label range has already been set on this dimension. Do the following: // * Check this label is the same label that rangers were already set. - if (dim_label_ref.name() != label_range_subset_[dim_idx].value().name) { + if (dim_label_ref.name() != label_range_subset_[dim_idx].value().name_) { throw StatusException(Status_SubarrayError( "Cannot add label range; Dimension is already to set to use " "dimension label '" + - label_range_subset_[dim_idx].value().name)); + label_range_subset_[dim_idx].value().name_)); } } else { // A label range has not yet been set on this dimension. Do the following: @@ -215,7 +215,7 @@ void Subarray::add_label_range( // Restrict the range to the dimension domain and add. auto&& [error_status, oob_warning] = - label_range_subset_[dim_idx].value().ranges.add_range( + label_range_subset_[dim_idx].value().ranges_.add_range( range, read_range_oob_error); if (!error_status.ok()) { throw StatusException(Status_SubarrayError( @@ -588,7 +588,7 @@ const std::string& Subarray::get_label_name(const uint32_t dim_index) const { throw SubarrayStatusException( "Cannot get label name. No label ranges set."); } - return label_range_subset_[dim_index]->name; + return label_range_subset_[dim_index]->name_; } void Subarray::get_label_range( @@ -601,12 +601,12 @@ void Subarray::get_label_range( .dimension_label(label_name) .dimension_index(); if (!label_range_subset_[dim_idx].has_value() || - label_range_subset_[dim_idx].value().name != label_name) { + label_range_subset_[dim_idx].value().name_ != label_name) { throw StatusException(Status_SubarrayError( "Cannot get label range; No ranges set on dimension label '" + label_name + "'")); } - const auto& range = label_range_subset_[dim_idx].value().ranges[range_idx]; + const auto& range = label_range_subset_[dim_idx].value().ranges_[range_idx]; *start = range.start_fixed(); *end = range.end_fixed(); *stride = nullptr; @@ -618,8 +618,8 @@ void Subarray::get_label_range_num( .dimension_label(label_name) .dimension_index(); *range_num = (label_range_subset_[dim_idx].has_value() && - label_range_subset_[dim_idx].value().name == label_name) ? - label_range_subset_[dim_idx].value().ranges.num_ranges() : + label_range_subset_[dim_idx].value().name_ == label_name) ? + label_range_subset_[dim_idx].value().ranges_.num_ranges() : 0; } @@ -632,12 +632,12 @@ void Subarray::get_label_range_var( .dimension_label(label_name) .dimension_index(); if (!label_range_subset_[dim_idx].has_value() || - label_range_subset_[dim_idx].value().name != label_name) { + label_range_subset_[dim_idx].value().name_ != label_name) { throw StatusException(Status_SubarrayError( "Cannot get label range; No ranges set on dimension label '" + label_name + "'")); } - const auto& range = label_range_subset_[dim_idx].value().ranges[range_idx]; + const auto& range = label_range_subset_[dim_idx].value().ranges_[range_idx]; std::memcpy(start, range.start_str().data(), range.start_size()); std::memcpy(end, range.end_str().data(), range.end_size()); } @@ -651,12 +651,12 @@ void Subarray::get_label_range_var_size( .dimension_label(label_name) .dimension_index(); if (!label_range_subset_[dim_idx].has_value() || - label_range_subset_[dim_idx].value().name != label_name) { + label_range_subset_[dim_idx].value().name_ != label_name) { throw StatusException(Status_SubarrayError( "Cannot get label range size; No ranges set on dimension label '" + label_name + "'")); } - const auto& range = label_range_subset_[dim_idx].value().ranges[range_idx]; + const auto& range = label_range_subset_[dim_idx].value().ranges_[range_idx]; *start_size = range.start_size(); *end_size = range.end_size(); } @@ -1025,13 +1025,22 @@ bool Subarray::has_label_ranges() const { label_range_subset_.cbegin(), label_range_subset_.cend(), [](const auto& range_subset) { - return range_subset.has_value() && !range_subset->ranges.is_empty(); + return range_subset.has_value() && !range_subset->ranges_.is_empty(); }); } bool Subarray::has_label_ranges(const uint32_t dim_index) const { return label_range_subset_[dim_index].has_value() && - !label_range_subset_[dim_index]->ranges.is_empty(); + !label_range_subset_[dim_index]->ranges_.is_empty(); +} + +bool Subarray::label_ranges_num() const { + return std::count_if( + std::begin(label_range_subset_), + std::end(label_range_subset_), + [](const auto& range_subset) { + return range_subset.has_value() && !range_subset->ranges_.is_empty(); + }); } bool Subarray::is_default(uint32_t dim_index) const { @@ -1798,7 +1807,7 @@ const std::vector& Subarray::ranges_for_label( .dimension_label(label_name) .dimension_index(); if (!label_range_subset_[dim_idx].has_value() || - label_range_subset_[dim_idx].value().name != label_name) { + label_range_subset_[dim_idx].value().name_ != label_name) { throw StatusException(Status_SubarrayError( "Cannot get label ranges; No ranges set on dimension label '" + label_name + "'")); @@ -1820,6 +1829,24 @@ Status Subarray::set_ranges_for_dim( return Status::Ok(); } +// TODO: const in ranges was dropper because add_range expects non-const. See if +// a const add_range can be added instead +void Subarray::set_label_ranges_for_dim( + const uint32_t dim_idx, + const std::string& name, + std::vector& ranges) { + auto dim{array_->array_schema_latest().dimension_ptr(dim_idx)}; + label_range_subset_[dim_idx] = + LabelRangeSubset(name, dim->type(), coalesce_ranges_); + for (auto& range : ranges) { + // TODO: no idea if impl_ should be updated instead as in + // "add_range_unrestricted" + auto&& [error_status, oob_warning] = + label_range_subset_[dim_idx].value().ranges_.add_range(range); + throw_if_not_ok(error_status); + } +} + Status Subarray::split( unsigned splitting_dim, const ByteVecValue& splitting_value, @@ -2146,6 +2173,10 @@ void Subarray::add_default_ranges() { dim->type(), dim->domain(), true, coalesce_ranges_)); } is_default_.resize(dim_num, true); + add_default_label_ranges(dim_num); +} + +void Subarray::add_default_label_ranges(dimension_size_type dim_num) { label_range_subset_.clear(); label_range_subset_.resize(dim_num, nullopt); } @@ -3344,10 +3375,16 @@ template void Subarray::crop_to_tile( Subarray::LabelRangeSubset::LabelRangeSubset( const DimensionLabel& ref, bool coalesce_ranges) - : name{ref.name()} - , ranges{RangeSetAndSuperset( + : name_{ref.name()} + , ranges_{RangeSetAndSuperset( ref.label_type(), Range(), false, coalesce_ranges)} { } +Subarray::LabelRangeSubset::LabelRangeSubset( + const std::string& name, Datatype type, bool coalesce_ranges) + : name_{name} + , ranges_{RangeSetAndSuperset(type, Range(), false, coalesce_ranges)} { +} + } // namespace sm } // namespace tiledb diff --git a/tiledb/sm/subarray/subarray.h b/tiledb/sm/subarray/subarray.h index ce6d265efe4..77a3c2d105e 100644 --- a/tiledb/sm/subarray/subarray.h +++ b/tiledb/sm/subarray/subarray.h @@ -128,6 +128,14 @@ class Subarray { /* ********************************* */ /* PUBLIC DATA TYPES */ /* ********************************* */ + /** + * Size type for the number of dimensions of an array and for dimension + * indices. + * + * Note: This should be the same as `Domain::dimension_size_type`. We're + * not including `domain.h`, otherwise we'd use that definition here. + */ + using dimension_size_type = unsigned int; /** * Result size (in bytes) for an attribute/dimension used for @@ -431,6 +439,12 @@ class Subarray { const std::vector& get_attribute_ranges( const std::string& attr_name) const; + // TODO: add docstring + inline const std::unordered_map>& + get_attribute_ranges() const { + return attr_range_subset_; + } + /** * Returns the name of the dimension label at the dimension index. * @@ -935,6 +949,8 @@ class Subarray { */ bool has_label_ranges(const uint32_t dim_index) const; + bool label_ranges_num() const; + /** * Set default indicator for dimension subarray. Used by serialization only * @param dim_index @@ -1027,6 +1043,12 @@ class Subarray { */ Status set_ranges_for_dim(uint32_t dim_idx, const std::vector& ranges); + // TODO: add docstring + void set_label_ranges_for_dim( + const uint32_t dim_idx, + const std::string& name, + std::vector& ranges); + /** * Splits the subarray along the splitting dimension and value into * two new subarrays `r1` and `r2`. @@ -1190,6 +1212,14 @@ class Subarray { tuple> non_overlapping_ranges( ThreadPool* const compute_tp); + /** Returns if ranges are sorted. */ + inline bool coalesce_ranges() const { + return coalesce_ranges_; + } + + // TODO: docstring + void add_default_label_ranges(dimension_size_type dim_num); + private: /* ********************************* */ /* PRIVATE DATA TYPES */ @@ -1236,15 +1266,25 @@ class Subarray { */ LabelRangeSubset(const DimensionLabel& ref, bool coalesce_ranges = true); + /** + * Constructor + * + * @param ref Dimension label reference to the label this will contain + * ranges for. + * @param coalesce_ranges Set if ranges should be combined when adjacent. + */ + LabelRangeSubset( + const std::string& name, Datatype type, bool coalesce_ranges = true); + inline const std::vector& get_ranges() const { - return ranges.ranges(); + return ranges_.ranges(); } /** Name of the dimension label. */ - std::string name; + std::string name_; /** The ranges set on the dimension label. */ - RangeSetAndSuperset ranges; + RangeSetAndSuperset ranges_; }; /* ********************************* */ From 946b0b80b87965ec0792860ebd8162b3490aae1c Mon Sep 17 00:00:00 2001 From: Ypatia Tsavliri Date: Fri, 10 Mar 2023 17:01:52 +0200 Subject: [PATCH 3/6] Add test and fix problems --- .../test-capi-sparse-array-dimension-label.cc | 7 +++- test/support/src/serialization_wrappers.cc | 40 +++++++++++++++++-- test/support/src/serialization_wrappers.h | 10 +++++ tiledb/sm/serialization/query.cc | 11 +++-- tiledb/sm/serialization/query.h | 9 +++++ tiledb/sm/subarray/subarray.cc | 18 ++++----- tiledb/sm/subarray/subarray.h | 30 +++++++++++--- 7 files changed, 98 insertions(+), 27 deletions(-) diff --git a/test/src/test-capi-sparse-array-dimension-label.cc b/test/src/test-capi-sparse-array-dimension-label.cc index c7b90c2841a..cef7190cf17 100644 --- a/test/src/test-capi-sparse-array-dimension-label.cc +++ b/test/src/test-capi-sparse-array-dimension-label.cc @@ -31,7 +31,9 @@ * labels. */ +#include #include "test/support/src/helpers.h" +#include "test/support/src/serialization_wrappers.h" #include "test/support/src/vfs_helpers.h" #include "tiledb/api/c_api/context/context_api_internal.h" #include "tiledb/sm/c_api/tiledb.h" @@ -39,7 +41,6 @@ #include "tiledb/sm/c_api/tiledb_struct_def.h" #include "tiledb/sm/enums/encryption_type.h" -#include #include #include @@ -249,6 +250,10 @@ class SparseArrayExample1 : public TemporaryDirectoryFixture { ctx, subarray, "x", &ranges[2 * r], &ranges[2 * r + 1], nullptr)); } + if (serialize_) { + tiledb_subarray_serialize(ctx, array, &subarray); + } + // Define label buffer and size. std::vector label_data(expected_label_data.size()); uint64_t label_data_size{label_data.size() * sizeof(double)}; diff --git a/test/support/src/serialization_wrappers.cc b/test/support/src/serialization_wrappers.cc index ad8e7ff48e6..fa7dec6fc12 100644 --- a/test/support/src/serialization_wrappers.cc +++ b/test/support/src/serialization_wrappers.cc @@ -31,12 +31,19 @@ * through serialization. */ -#include -#include - #include "test/support/src/helpers.h" #include "tiledb/sm/c_api/tiledb.h" #include "tiledb/sm/c_api/tiledb_serialization.h" +#include "tiledb/sm/c_api/tiledb_struct_def.h" +#include "tiledb/sm/serialization/query.h" + +#ifdef TILEDB_SERIALIZATION +#include +#endif +#include +#include + +using namespace tiledb::sm; int tiledb_array_create_serialization_wrapper( tiledb_ctx_t* ctx, @@ -179,4 +186,29 @@ int tiledb_fragment_info_serialize( tiledb_buffer_free(&buffer); return rc; -} \ No newline at end of file +} + +void tiledb_subarray_serialize( + [[maybe_unused]] tiledb_ctx_t* ctx, + [[maybe_unused]] tiledb_array_t* array, + [[maybe_unused]] tiledb_subarray_t** subarray) { +#ifdef TILEDB_SERIALIZATION + // Serialize + ::capnp::MallocMessageBuilder message; + tiledb::sm::serialization::capnp::Subarray::Builder builder = + message.initRoot(); + tiledb_array_schema_t* array_schema = nullptr; + tiledb_array_get_schema(ctx, array, &array_schema); + REQUIRE(tiledb::sm::serialization::subarray_to_capnp( + *(array_schema->array_schema_), (*subarray)->subarray_, &builder) + .ok()); + // Deserialize + tiledb_subarray_t* deserialized_subarray; + tiledb::test::require_tiledb_ok( + ctx, tiledb_subarray_alloc(ctx, array, &deserialized_subarray)); + REQUIRE(tiledb::sm::serialization::subarray_from_capnp( + builder, deserialized_subarray->subarray_) + .ok()); + *subarray = deserialized_subarray; +#endif +} diff --git a/test/support/src/serialization_wrappers.h b/test/support/src/serialization_wrappers.h index 843271cb8eb..14debd965c2 100644 --- a/test/support/src/serialization_wrappers.h +++ b/test/support/src/serialization_wrappers.h @@ -128,4 +128,14 @@ int tiledb_fragment_info_serialize( tiledb_fragment_info_t* fragment_info_before_serialization, tiledb_fragment_info_t* fragment_info_deserialized, tiledb_serialization_type_t serialize_type); + +/** + * Return a subarray after serializing and deserializing it + * + * @param ctx tiledb context + * @param array the array the subarray belongs to + * @param subarray the subarray to serialize and deserialize + */ +void tiledb_subarray_serialize( + tiledb_ctx_t* ctx, tiledb_array_t* array, tiledb_subarray_t** subarray); #endif // TILEDB_TEST_SERIALIZATION_WRAPPERS_H \ No newline at end of file diff --git a/tiledb/sm/serialization/query.cc b/tiledb/sm/serialization/query.cc index 310d0034d9a..ac621e138fd 100644 --- a/tiledb/sm/serialization/query.cc +++ b/tiledb/sm/serialization/query.cc @@ -72,7 +72,6 @@ #include "tiledb/sm/serialization/fragment_metadata.h" #include "tiledb/sm/serialization/query.h" #include "tiledb/sm/storage_manager/storage_manager_declaration.h" -#include "tiledb/sm/subarray/subarray.h" #include "tiledb/sm/subarray/subarray_partitioner.h" using namespace tiledb::common; @@ -207,8 +206,11 @@ Status subarray_to_capnp( for (uint32_t i = 0; i < dim_num; i++) { if (subarray->has_label_ranges(i)) { auto label_range_builder = label_ranges_builder[label_id++]; - // TODO: Consider throwing instead - assert(label_id < label_ranges_num); + if (label_id > label_ranges_num) { + throw StatusException( + Status_SerializationError("Label id exceeds the total number of " + "label ranges for the subarray.")); + } label_range_builder.setDimensionId(i); const auto& label_name = subarray->get_label_name(i); label_range_builder.setName(label_name); @@ -217,9 +219,6 @@ Status subarray_to_capnp( const auto datatype{schema.dimension_ptr(i)->type()}; const auto& label_ranges = subarray->ranges_for_label(label_name); range_builder.setType(datatype_str(datatype)); - // TODO: check with Julia if for dim lables is_implicitely_initialized_ - // is always false. Should I even set this here? - // range_builder.setHasDefaultRange(false); range_buffers_to_capnp(label_ranges, range_builder); } } diff --git a/tiledb/sm/serialization/query.h b/tiledb/sm/serialization/query.h index 3bb6ab45aa0..8acff91c1bb 100644 --- a/tiledb/sm/serialization/query.h +++ b/tiledb/sm/serialization/query.h @@ -39,6 +39,7 @@ #include "tiledb/common/thread_pool.h" #include "tiledb/sm/query/query_condition.h" #include "tiledb/sm/storage_manager/storage_manager_declaration.h" +#include "tiledb/sm/subarray/subarray.h" #ifdef TILEDB_SERIALIZATION #include "tiledb/sm/serialization/tiledb-rest.h" @@ -232,6 +233,14 @@ Status condition_from_capnp( Status condition_to_capnp( const QueryCondition& condition, capnp::Condition::Builder* condition_builder); + +Status subarray_to_capnp( + const ArraySchema& schema, + const Subarray* subarray, + capnp::Subarray::Builder* builder); + +Status subarray_from_capnp( + const capnp::Subarray::Reader& reader, Subarray* subarray); #endif } // namespace serialization diff --git a/tiledb/sm/subarray/subarray.cc b/tiledb/sm/subarray/subarray.cc index 15f477c1c50..efd7493e44d 100644 --- a/tiledb/sm/subarray/subarray.cc +++ b/tiledb/sm/subarray/subarray.cc @@ -183,7 +183,7 @@ void Subarray::add_label_range( const auto dim_idx = dim_label_ref.dimension_index(); if (label_range_subset_[dim_idx].has_value()) { // A label range has already been set on this dimension. Do the following: - // * Check this label is the same label that rangers were already set. + // * Check this label is the same label that ranges were already set. if (dim_label_ref.name() != label_range_subset_[dim_idx].value().name_) { throw StatusException(Status_SubarrayError( "Cannot add label range; Dimension is already to set to use " @@ -1034,7 +1034,7 @@ bool Subarray::has_label_ranges(const uint32_t dim_index) const { !label_range_subset_[dim_index]->ranges_.is_empty(); } -bool Subarray::label_ranges_num() const { +int Subarray::label_ranges_num() const { return std::count_if( std::begin(label_range_subset_), std::end(label_range_subset_), @@ -1829,21 +1829,17 @@ Status Subarray::set_ranges_for_dim( return Status::Ok(); } -// TODO: const in ranges was dropper because add_range expects non-const. See if -// a const add_range can be added instead void Subarray::set_label_ranges_for_dim( const uint32_t dim_idx, const std::string& name, - std::vector& ranges) { + const std::vector& ranges) { auto dim{array_->array_schema_latest().dimension_ptr(dim_idx)}; label_range_subset_[dim_idx] = LabelRangeSubset(name, dim->type(), coalesce_ranges_); - for (auto& range : ranges) { - // TODO: no idea if impl_ should be updated instead as in - // "add_range_unrestricted" - auto&& [error_status, oob_warning] = - label_range_subset_[dim_idx].value().ranges_.add_range(range); - throw_if_not_ok(error_status); + for (const auto& range : ranges) { + throw_if_not_ok( + label_range_subset_[dim_idx].value().ranges_.add_range_unrestricted( + range)); } } diff --git a/tiledb/sm/subarray/subarray.h b/tiledb/sm/subarray/subarray.h index 77a3c2d105e..52637e52344 100644 --- a/tiledb/sm/subarray/subarray.h +++ b/tiledb/sm/subarray/subarray.h @@ -439,7 +439,9 @@ class Subarray { const std::vector& get_attribute_ranges( const std::string& attr_name) const; - // TODO: add docstring + /** + * Get all attribute ranges. + */ inline const std::unordered_map>& get_attribute_ranges() const { return attr_range_subset_; @@ -949,7 +951,10 @@ class Subarray { */ bool has_label_ranges(const uint32_t dim_index) const; - bool label_ranges_num() const; + /** + * Returns the number of dimensions that have label ranges set + */ + int label_ranges_num() const; /** * Set default indicator for dimension subarray. Used by serialization only @@ -1043,11 +1048,21 @@ class Subarray { */ Status set_ranges_for_dim(uint32_t dim_idx, const std::vector& ranges); - // TODO: add docstring + /** + * Directly sets the dimension label ranges for the given dimension index, + * making a deep copy. + * + * @param dim_idx Index of dimension to set + * @param name Name of the dimension label to set + * @param ranges `Range` vector that will be copied and set + * @return Status + * + * @note Intended for serialization only + */ void set_label_ranges_for_dim( const uint32_t dim_idx, const std::string& name, - std::vector& ranges); + const std::vector& ranges); /** * Splits the subarray along the splitting dimension and value into @@ -1217,7 +1232,12 @@ class Subarray { return coalesce_ranges_; } - // TODO: docstring + /** + * Initialize the label ranges vector to nullopt for every + * dimension + * + * @param dim_num Total number of dimensions of the schema + */ void add_default_label_ranges(dimension_size_type dim_num); private: From b0ddd662659ac58bd13e88b4e8863a8447e1e2ad Mon Sep 17 00:00:00 2001 From: Julia Dark Date: Mon, 20 Mar 2023 12:25:32 -0400 Subject: [PATCH 4/6] Add serialization tests for subarray --- .../test-capi-dense-array-dimension-label.cc | 17 ++ test/src/unit-ordered-dim-label-reader.cc | 190 +++++++++++++++++- 2 files changed, 206 insertions(+), 1 deletion(-) diff --git a/test/src/test-capi-dense-array-dimension-label.cc b/test/src/test-capi-dense-array-dimension-label.cc index 9cd5ed8564b..209936aa0dd 100644 --- a/test/src/test-capi-dense-array-dimension-label.cc +++ b/test/src/test-capi-dense-array-dimension-label.cc @@ -31,7 +31,9 @@ * labels. */ +#include #include "test/support/src/helpers.h" +#include "test/support/src/serialization_wrappers.h" #include "test/support/src/vfs_helpers.h" #include "tiledb/api/c_api/context/context_api_internal.h" #include "tiledb/sm/c_api/tiledb.h" @@ -142,6 +144,9 @@ class DenseArrayExample1 : public TemporaryDirectoryFixture { require_tiledb_ok(tiledb_subarray_alloc(ctx, array, &subarray)); require_tiledb_ok(tiledb_subarray_add_range( ctx, subarray, 0, &index_start, &index_end, nullptr)); + if (serialize_) { + tiledb_subarray_serialize(ctx, array, &subarray); + } // Create write query. tiledb_query_t* query; @@ -206,6 +211,10 @@ class DenseArrayExample1 : public TemporaryDirectoryFixture { require_tiledb_ok(tiledb_subarray_add_label_range( ctx, subarray, "x", &label_start, &label_end, nullptr)); + if (serialize_) { + tiledb_subarray_serialize(ctx, array, &subarray); + } + // Create write query. tiledb_query_t* query; require_tiledb_ok(tiledb_query_alloc(ctx, array, TILEDB_WRITE, &query)); @@ -258,6 +267,10 @@ class DenseArrayExample1 : public TemporaryDirectoryFixture { require_tiledb_ok(tiledb_subarray_add_range( ctx, subarray, 0, &index_domain_[0], &index_domain_[1], nullptr)); + if (serialize_) { + tiledb_subarray_serialize(ctx, array, &subarray); + } + // Define buffer and size values. std::vector label_data(4); uint64_t label_data_size{label_data.size() * sizeof(double)}; @@ -324,6 +337,10 @@ class DenseArrayExample1 : public TemporaryDirectoryFixture { ctx, subarray, "x", &ranges[2 * r], &ranges[2 * r + 1], nullptr)); } + if (serialize_) { + tiledb_subarray_serialize(ctx, array, &subarray); + } + // Define label buffer and size. std::vector label_data(expected_label_data.size()); uint64_t label_data_size{label_data.size() * sizeof(double)}; diff --git a/test/src/unit-ordered-dim-label-reader.cc b/test/src/unit-ordered-dim-label-reader.cc index 3885025add4..cbf4ebc7747 100644 --- a/test/src/unit-ordered-dim-label-reader.cc +++ b/test/src/unit-ordered-dim-label-reader.cc @@ -30,12 +30,12 @@ * Tests the ordered dimension label reader. */ -#include #include using namespace Catch::Matchers; #include #include +#include "test/support/src/serialization_wrappers.h" #include "tiledb/sm/c_api/tiledb_struct_def.h" #include "tiledb/sm/cpp_api/tiledb" #include "tiledb/sm/misc/constants.h" @@ -91,6 +91,11 @@ struct CPPOrderedDimLabelReaderFixedFx { Query query(ctx_, array, TILEDB_WRITE); Subarray subarray(ctx_, array); subarray.add_range(0, min_index, max_index); + if (serialize_) { + auto subarray_ptr = subarray.ptr().get(); + tiledb_subarray_serialize( + ctx_.ptr().get(), array.ptr().get(), &subarray_ptr); + } query.set_subarray(subarray) .set_layout(TILEDB_ROW_MAJOR) @@ -121,6 +126,11 @@ struct CPPOrderedDimLabelReaderFixedFx { Subarray subarray(ctx_, array); subarray.ptr()->subarray_->set_attribute_ranges("labels", input_ranges); + if (serialize_) { + auto subarray_ptr = subarray.ptr().get(); + tiledb_subarray_serialize( + ctx_.ptr().get(), array.ptr().get(), &subarray_ptr); + } query.ptr()->query_->set_dimension_label_ordered_read(increasing_labels_); query.set_data_buffer("index", index); @@ -162,6 +172,11 @@ struct CPPOrderedDimLabelReaderFixedFx { Subarray subarray(ctx_, array); subarray.ptr()->subarray_->set_attribute_ranges("labels", input_ranges); + if (serialize_) { + auto subarray_ptr = subarray.ptr().get(); + tiledb_subarray_serialize( + ctx_.ptr().get(), array.ptr().get(), &subarray_ptr); + } query.ptr()->query_->set_dimension_label_ordered_read( increasing_labels_); @@ -182,6 +197,7 @@ struct CPPOrderedDimLabelReaderFixedFx { int min_index_; int max_index_; bool increasing_labels_; + bool serialize_ = false; }; struct CPPOrderedDimLabelReaderFixedDoubleFx @@ -194,6 +210,10 @@ TEST_CASE_METHOD( CPPOrderedDimLabelReaderFixedDoubleFx, "Ordered dimension label reader: Invalid no ranges", "[ordered-dim-label-reader][invalid][no-ranges]") { +#ifdef TILEDB_SERIALIZATION + serialize_ = GENERATE(true, false); +#endif + write_labels(16, 25, {0.1, 0.2, 0.3, 0.4, 0.5, 0.6, 0.7, 0.8, 0.9, 1.0}); std::vector index(2); @@ -201,6 +221,11 @@ TEST_CASE_METHOD( Array array(ctx_, array_name, TILEDB_READ); Query query(ctx_, array, TILEDB_READ); Subarray subarray(ctx_, array); + if (serialize_) { + auto subarray_ptr = subarray.ptr().get(); + tiledb_subarray_serialize( + ctx_.ptr().get(), array.ptr().get(), &subarray_ptr); + } query.ptr()->query_->set_dimension_label_ordered_read(increasing_labels_); query.set_subarray(subarray); @@ -215,6 +240,9 @@ TEST_CASE_METHOD( CPPOrderedDimLabelReaderFixedDoubleFx, "Ordered dimension label reader: Invalid no buffers", "[ordered-dim-label-reader][invalid][no-buffers]") { +#ifdef TILEDB_SERIALIZATION + serialize_ = GENERATE(true, false); +#endif write_labels(16, 25, {0.1, 0.2, 0.3, 0.4, 0.5, 0.6, 0.7, 0.8, 0.9, 1.0}); Array array(ctx_, array_name, TILEDB_READ); @@ -227,6 +255,11 @@ TEST_CASE_METHOD( Subarray subarray(ctx_, array); subarray.ptr()->subarray_->set_attribute_ranges("labels", input_ranges); + if (serialize_) { + auto subarray_ptr = subarray.ptr().get(); + tiledb_subarray_serialize( + ctx_.ptr().get(), array.ptr().get(), &subarray_ptr); + } query.ptr()->query_->set_dimension_label_ordered_read(increasing_labels_); query.set_subarray(subarray); @@ -244,6 +277,9 @@ TEST_CASE_METHOD( CPPOrderedDimLabelReaderFixedDoubleFx, "Ordered dimension label reader: Invalid wrong buffer name", "[ordered-dim-label-reader][invalid][wrong-buffer-name]") { +#ifdef TILEDB_SERIALIZATION + serialize_ = GENERATE(true, false); +#endif write_labels(16, 25, {0.1, 0.2, 0.3, 0.4, 0.5, 0.6, 0.7, 0.8, 0.9, 1.0}); std::vector labels(2); @@ -258,6 +294,11 @@ TEST_CASE_METHOD( Subarray subarray(ctx_, array); subarray.ptr()->subarray_->set_attribute_ranges("labels", input_ranges); + if (serialize_) { + auto subarray_ptr = subarray.ptr().get(); + tiledb_subarray_serialize( + ctx_.ptr().get(), array.ptr().get(), &subarray_ptr); + } query.ptr()->query_->set_dimension_label_ordered_read(increasing_labels_); query.set_subarray(subarray); @@ -276,6 +317,9 @@ TEST_CASE_METHOD( CPPOrderedDimLabelReaderFixedDoubleFx, "Ordered dimension label reader: Invalid wrong buffer size", "[ordered-dim-label-reader][invalid][wrong-buffer-size]") { +#ifdef TILEDB_SERIALIZATION + serialize_ = GENERATE(true, false); +#endif write_labels(16, 25, {0.1, 0.2, 0.3, 0.4, 0.5, 0.6, 0.7, 0.8, 0.9, 1.0}); std::vector index(3); @@ -290,6 +334,11 @@ TEST_CASE_METHOD( Subarray subarray(ctx_, array); subarray.ptr()->subarray_->set_attribute_ranges("labels", input_ranges); + if (serialize_) { + auto subarray_ptr = subarray.ptr().get(); + tiledb_subarray_serialize( + ctx_.ptr().get(), array.ptr().get(), &subarray_ptr); + } query.ptr()->query_->set_dimension_label_ordered_read(increasing_labels_); query.set_subarray(subarray); @@ -308,6 +357,9 @@ TEST_CASE_METHOD( CPPOrderedDimLabelReaderFixedDoubleFx, "Ordered dimension label reader: Invalid ranges set", "[ordered-dim-label-reader][invalid][ranges-set]") { +#ifdef TILEDB_SERIALIZATION + serialize_ = GENERATE(true, false); +#endif write_labels(16, 25, {0.1, 0.2, 0.3, 0.4, 0.5, 0.6, 0.7, 0.8, 0.9, 1.0}); std::vector index(2); @@ -323,6 +375,11 @@ TEST_CASE_METHOD( Subarray subarray(ctx_, array); subarray.add_range(0, 1, 1); subarray.ptr()->subarray_->set_attribute_ranges("labels", input_ranges); + if (serialize_) { + auto subarray_ptr = subarray.ptr().get(); + tiledb_subarray_serialize( + ctx_.ptr().get(), array.ptr().get(), &subarray_ptr); + } query.ptr()->query_->set_dimension_label_ordered_read(increasing_labels_); query.set_subarray(subarray); @@ -341,6 +398,9 @@ TEST_CASE_METHOD( CPPOrderedDimLabelReaderFixedDoubleFx, "Ordered dimension label reader: Invalid no data", "[ordered-dim-label-reader][invalid][no-data]") { +#ifdef TILEDB_SERIALIZATION + serialize_ = GENERATE(true, false); +#endif Array array(ctx_, array_name, TILEDB_READ); Query query(ctx_, array, TILEDB_READ); @@ -351,6 +411,11 @@ TEST_CASE_METHOD( Subarray subarray(ctx_, array); subarray.ptr()->subarray_->set_attribute_ranges("labels", input_ranges); + if (serialize_) { + auto subarray_ptr = subarray.ptr().get(); + tiledb_subarray_serialize( + ctx_.ptr().get(), array.ptr().get(), &subarray_ptr); + } query.ptr()->query_->set_dimension_label_ordered_read(increasing_labels_); std::vector index(ranges.size()); @@ -369,6 +434,9 @@ TEST_CASE_METHOD( "Ordered dimension label reader: fixed double labels, single fragment, " "increasing", "[ordered-dim-label-reader][fixed][double][single-fragment][increasing]") { +#ifdef TILEDB_SERIALIZATION + serialize_ = GENERATE(true, false); +#endif write_labels(16, 25, {0.1, 0.2, 0.3, 0.4, 0.5, 0.6, 0.7, 0.8, 0.9, 1.0}); read_all_possible_labels(); } @@ -378,6 +446,9 @@ TEST_CASE_METHOD( "Ordered dimension label reader: fixed double labels, single fragment, " "decreasing", "[ordered-dim-label-reader][fixed][double][single-fragment][decreasing]") { +#ifdef TILEDB_SERIALIZATION + serialize_ = GENERATE(true, false); +#endif increasing_labels_ = false; write_labels(16, 25, {1.0, 0.9, 0.8, 0.7, 0.6, 0.5, 0.4, 0.3, 0.2, 0.1}); read_all_possible_labels(); @@ -389,6 +460,9 @@ TEST_CASE_METHOD( "increasing", "[ordered-dim-label-reader][fixed][double][multiple-fragments][" "increasing]") { +#ifdef TILEDB_SERIALIZATION + serialize_ = GENERATE(true, false); +#endif write_labels(16, 25, {0.1, 0.2, 0.3, 0.4, 0.5, 0.6, 0.7, 0.8, 0.9, 1.0}); write_labels(19, 22, {0.45, 0.55, 0.65, 0.75}); read_all_possible_labels(); @@ -400,6 +474,9 @@ TEST_CASE_METHOD( "decreasing", "[ordered-dim-label-reader][fixed][double][multiple-fragments][" "decreasing]") { +#ifdef TILEDB_SERIALIZATION + serialize_ = GENERATE(true, false); +#endif increasing_labels_ = false; write_labels(16, 25, {1.0, 0.9, 0.8, 0.7, 0.6, 0.5, 0.4, 0.3, 0.2, 0.1}); write_labels(19, 22, {0.75, 0.65, 0.55, 0.45}); @@ -411,6 +488,9 @@ TEST_CASE_METHOD( "Ordered dimension label reader: fixed double labels, lots of fragment, " "increasing", "[ordered-dim-label-reader][fixed][double][lots-of-fragment][increasing]") { +#ifdef TILEDB_SERIALIZATION + serialize_ = GENERATE(true, false); +#endif write_labels(16, 25, {0.1, 0.2, 0.3, 0.4, 0.5, 0.6, 0.7, 0.8, 0.9, 1.0}); write_labels(26, 35, {1.1, 1.2, 1.3, 1.4, 1.5, 1.6, 1.7, 1.8, 1.9, 2.0}); write_labels(36, 45, {2.1, 2.2, 2.3, 2.4, 2.5, 2.6, 2.7, 2.8, 2.9, 3.0}); @@ -423,6 +503,9 @@ TEST_CASE_METHOD( "Ordered dimension label reader: fixed double labels, lots of fragment, " "decreasing", "[ordered-dim-label-reader][fixed][double][lots-of-fragment][decreasing]") { +#ifdef TILEDB_SERIALIZATION + serialize_ = GENERATE(true, false); +#endif increasing_labels_ = false; write_labels(36, 45, {4.0, 3.9, 3.8, 3.7, 3.6, 3.5, 3.4, 3.3, 3.2, 3.1}); write_labels(46, 55, {3.0, 2.9, 2.8, 2.7, 2.6, 2.5, 2.4, 2.3, 2.2, 2.1}); @@ -435,6 +518,9 @@ TEST_CASE_METHOD( CPPOrderedDimLabelReaderFixedDoubleFx, "Ordered dimension label reader: fixed labels, empty range, increasing", "[ordered-dim-label-reader][fixed][double][empty-range][increasing]") { +#ifdef TILEDB_SERIALIZATION + serialize_ = GENERATE(true, false); +#endif write_labels(1, 4, {1.0, 2.0, 3.0, 4.0}); REQUIRE_THROWS_WITH( read_labels({2.1, 2.8}), @@ -451,6 +537,9 @@ TEST_CASE_METHOD( CPPOrderedDimLabelReaderFixedDoubleFx, "Ordered dimension label reader: fixed labels, empty range, decreasing", "[ordered-dim-label-reader][fixed][double][empty-range][decreasing]") { +#ifdef TILEDB_SERIALIZATION + serialize_ = GENERATE(true, false); +#endif increasing_labels_ = false; write_labels(1, 4, {4.0, 3.0, 2.0, 1.0}); std::vector ranges{2.1, 2.8}; @@ -470,6 +559,9 @@ TEST_CASE_METHOD( "Ordered dimension label reader: fixed int labels, single fragment, " "increasing", "[ordered-dim-label-reader][fixed][int][single-fragment][increasing]") { +#ifdef TILEDB_SERIALIZATION + serialize_ = GENERATE(true, false); +#endif write_labels(16, 25, {1, 3, 5, 7, 9, 11, 13, 15, 17, 19}); read_all_possible_labels(); } @@ -479,6 +571,9 @@ TEST_CASE_METHOD( "Ordered dimension label reader: fixed int labels, single fragment, " "decreasing", "[ordered-dim-label-reader][fixed][int][single-fragment][decreasing]") { +#ifdef TILEDB_SERIALIZATION + serialize_ = GENERATE(true, false); +#endif increasing_labels_ = false; write_labels(16, 25, {19, 17, 15, 13, 11, 9, 7, 5, 3, 1}); read_all_possible_labels(); @@ -490,6 +585,9 @@ TEST_CASE_METHOD( "increasing", "[ordered-dim-label-reader][fixed][int][multiple-fragments][" "increasing]") { +#ifdef TILEDB_SERIALIZATION + serialize_ = GENERATE(true, false); +#endif write_labels(16, 25, {10, 20, 30, 40, 50, 60, 70, 80, 90, 100}); write_labels(19, 22, {45, 55, 65, 75}); read_all_possible_labels(); @@ -501,6 +599,9 @@ TEST_CASE_METHOD( "decreasing", "[ordered-dim-label-reader][fixed][int][multiple-fragments][" "decreasing]") { +#ifdef TILEDB_SERIALIZATION + serialize_ = GENERATE(true, false); +#endif increasing_labels_ = false; write_labels(16, 25, {100, 90, 80, 70, 60, 50, 40, 30, 20, 10}); write_labels(19, 22, {75, 65, 55, 45}); @@ -513,6 +614,9 @@ TEST_CASE_METHOD( "binary search, increasing", "[ordered-dim-label-reader][fixed][int][boundary][binary-search][" "increasing]") { +#ifdef TILEDB_SERIALIZATION + serialize_ = GENERATE(true, false); +#endif write_labels(16, 25, {1, 2, 3, 4, 5, 6, 7, 8, 9, 10}); CHECK(read_labels({2, 3}) == std::vector({17, 18})); } @@ -523,6 +627,9 @@ TEST_CASE_METHOD( "binary search, decreasing", "[ordered-dim-label-reader][fixed][int][boundary][binary-search][" "decreasing]") { +#ifdef TILEDB_SERIALIZATION + serialize_ = GENERATE(true, false); +#endif increasing_labels_ = false; write_labels(16, 25, {10, 9, 8, 7, 6, 5, 4, 3, 2, 1}); CHECK(read_labels({8, 9}) == std::vector({17, 18})); @@ -534,6 +641,9 @@ TEST_CASE_METHOD( "tile search, increasing", "[ordered-dim-label-reader][fixed][int][boundary][tile-search][" "increasing]") { +#ifdef TILEDB_SERIALIZATION + serialize_ = GENERATE(true, false); +#endif write_labels(16, 25, {1, 2, 3, 4, 5, 6, 7, 8, 9, 10}); CHECK(read_labels({5, 6}) == std::vector({20, 21})); } @@ -544,6 +654,9 @@ TEST_CASE_METHOD( "tile search, decreasing", "[ordered-dim-label-reader][fixed][int][boundary][tile-search][" "decreasing]") { +#ifdef TILEDB_SERIALIZATION + serialize_ = GENERATE(true, false); +#endif increasing_labels_ = false; write_labels(16, 25, {10, 9, 8, 7, 6, 5, 4, 3, 2, 1}); CHECK(read_labels({5, 6}) == std::vector({20, 21})); @@ -604,6 +717,11 @@ struct CPPOrderedDimLabelReaderVarFx { Query query(ctx_, array, TILEDB_WRITE); Subarray subarray(ctx_, array); subarray.add_range(0, min_index, max_index); + if (serialize_) { + auto subarray_ptr = subarray.ptr().get(); + tiledb_subarray_serialize( + ctx_.ptr().get(), array.ptr().get(), &subarray_ptr); + } query.set_subarray(subarray) .set_layout(TILEDB_ROW_MAJOR) @@ -642,6 +760,11 @@ struct CPPOrderedDimLabelReaderVarFx { Subarray subarray(ctx_, array); subarray.ptr()->subarray_->set_attribute_ranges("labels", input_ranges); + if (serialize_) { + auto subarray_ptr = subarray.ptr().get(); + tiledb_subarray_serialize( + ctx_.ptr().get(), array.ptr().get(), &subarray_ptr); + } query.ptr()->query_->set_dimension_label_ordered_read(increasing_labels_); query.set_data_buffer("index", index); @@ -691,6 +814,11 @@ struct CPPOrderedDimLabelReaderVarFx { Subarray subarray(ctx_, array); subarray.ptr()->subarray_->set_attribute_ranges("labels", input_ranges); + if (serialize_) { + auto subarray_ptr = subarray.ptr().get(); + tiledb_subarray_serialize( + ctx_.ptr().get(), array.ptr().get(), &subarray_ptr); + } query.ptr()->query_->set_dimension_label_ordered_read( increasing_labels_); @@ -711,12 +839,16 @@ struct CPPOrderedDimLabelReaderVarFx { int min_index_; int max_index_; bool increasing_labels_; + bool serialize_ = false; }; TEST_CASE_METHOD( CPPOrderedDimLabelReaderVarFx, "Ordered dimension label reader: var labels, single fragment, increasing", "[ordered-dim-label-reader][var][single-fragment][increasing]") { +#ifdef TILEDB_SERIALIZATION + serialize_ = GENERATE(true, false); +#endif write_labels(16, 25, {0.1, 0.2, 0.3, 0.4, 0.5, 0.6, 0.7, 0.8, 0.9, 1.0}); read_all_possible_labels(); } @@ -725,6 +857,9 @@ TEST_CASE_METHOD( CPPOrderedDimLabelReaderVarFx, "Ordered dimension label reader: var labels, single fragment, decreasing", "[ordered-dim-label-reader][var][single-fragment][decreasing]") { +#ifdef TILEDB_SERIALIZATION + serialize_ = GENERATE(true, false); +#endif increasing_labels_ = false; write_labels(16, 25, {1.0, 0.9, 0.8, 0.7, 0.6, 0.5, 0.4, 0.3, 0.2, 0.1}); read_all_possible_labels(); @@ -735,6 +870,9 @@ TEST_CASE_METHOD( "Ordered dimension label reader: var labels, multiple fragments, " "increasing", "[ordered-dim-label-reader][var][multiple-fragments][increasing]") { +#ifdef TILEDB_SERIALIZATION + serialize_ = GENERATE(true, false); +#endif write_labels(16, 25, {0.1, 0.2, 0.3, 0.4, 0.5, 0.6, 0.7, 0.8, 0.9, 1.0}); write_labels(19, 22, {0.45, 0.55, 0.65, 0.75}); read_all_possible_labels(); @@ -745,6 +883,9 @@ TEST_CASE_METHOD( "Ordered dimension label reader: var labels, multiple fragments, " "decreasing", "[ordered-dim-label-reader][var][multiple-fragments][decreasing]") { +#ifdef TILEDB_SERIALIZATION + serialize_ = GENERATE(true, false); +#endif increasing_labels_ = false; write_labels(16, 25, {1.0, 0.9, 0.8, 0.7, 0.6, 0.5, 0.4, 0.3, 0.2, 0.1}); write_labels(19, 22, {0.75, 0.65, 0.55, 0.45}); @@ -755,6 +896,9 @@ TEST_CASE_METHOD( CPPOrderedDimLabelReaderVarFx, "Ordered dimension label reader: var labels, lots of fragment, increasing", "[ordered-dim-label-reader][var][lots-of-fragment][increasing]") { +#ifdef TILEDB_SERIALIZATION + serialize_ = GENERATE(true, false); +#endif write_labels(16, 25, {0.1, 0.2, 0.3, 0.4, 0.5, 0.6, 0.7, 0.8, 0.9, 1.0}); write_labels(26, 35, {1.1, 1.2, 1.3, 1.4, 1.5, 1.6, 1.7, 1.8, 1.9, 2.0}); write_labels(36, 45, {2.1, 2.2, 2.3, 2.4, 2.5, 2.6, 2.7, 2.8, 2.9, 3.0}); @@ -766,6 +910,9 @@ TEST_CASE_METHOD( CPPOrderedDimLabelReaderVarFx, "Ordered dimension label reader: var labels, lots of fragment, decreasing", "[ordered-dim-label-reader][var][lots-of-fragment][decreasing]") { +#ifdef TILEDB_SERIALIZATION + serialize_ = GENERATE(true, false); +#endif increasing_labels_ = false; write_labels(36, 45, {4.0, 3.9, 3.8, 3.7, 3.6, 3.5, 3.4, 3.3, 3.2, 3.1}); write_labels(46, 55, {3.0, 2.9, 2.8, 2.7, 2.6, 2.5, 2.4, 2.3, 2.2, 2.1}); @@ -779,6 +926,9 @@ TEST_CASE_METHOD( "Ordered dimension label reader: var labels, boundary conditions in binary " "search, increasing", "[ordered-dim-label-reader][var][boundary][binary-search][increasing]") { +#ifdef TILEDB_SERIALIZATION + serialize_ = GENERATE(true, false); +#endif write_labels(16, 25, {0.1, 0.2, 0.3, 0.4, 0.5, 0.6, 0.7, 0.8, 0.9, 1.0}); CHECK(read_labels({0.2, 0.3}) == std::vector({17, 18})); } @@ -788,6 +938,9 @@ TEST_CASE_METHOD( "Ordered dimension label reader: var labels, boundary conditions in binary " "search, decreasing", "[ordered-dim-label-reader][var][boundary][binary-search][decreasing]") { +#ifdef TILEDB_SERIALIZATION + serialize_ = GENERATE(true, false); +#endif increasing_labels_ = false; write_labels(16, 25, {1.0, 0.9, 0.8, 0.7, 0.6, 0.5, 0.4, 0.3, 0.2, 0.1}); CHECK(read_labels({0.8, 0.9}) == std::vector({17, 18})); @@ -798,6 +951,9 @@ TEST_CASE_METHOD( "Ordered dimension label reader: var labels, boundary conditions in tile " "search, increasing", "[ordered-dim-label-reader][var][boundary][tile-search][increasing]") { +#ifdef TILEDB_SERIALIZATION + serialize_ = GENERATE(true, false); +#endif write_labels(16, 25, {0.1, 0.2, 0.3, 0.4, 0.5, 0.6, 0.7, 0.8, 0.9, 1.0}); CHECK(read_labels({0.5, 0.6}) == std::vector({20, 21})); } @@ -807,6 +963,9 @@ TEST_CASE_METHOD( "Ordered dimension label reader: var labels, boundary conditions in tile " "search, decreasing", "[ordered-dim-label-reader][var][boundary][tile-search][decreasing]") { +#ifdef TILEDB_SERIALIZATION + serialize_ = GENERATE(true, false); +#endif increasing_labels_ = false; write_labels(16, 25, {1.0, 0.9, 0.8, 0.7, 0.6, 0.5, 0.4, 0.3, 0.2, 0.1}); CHECK(read_labels({0.5, 0.6}) == std::vector({20, 21})); @@ -816,6 +975,9 @@ TEST_CASE_METHOD( CPPOrderedDimLabelReaderVarFx, "Ordered dimension label reader: var labels, empty range, increasing", "[ordered-dim-label-reader][var][empty-range][increasing]") { +#ifdef TILEDB_SERIALIZATION + serialize_ = GENERATE(true, false); +#endif write_labels(1, 4, {1.0, 2.0, 3.0, 4.0}); REQUIRE_THROWS_WITH( read_labels({2.1, 2.8}), @@ -832,6 +994,9 @@ TEST_CASE_METHOD( CPPOrderedDimLabelReaderVarFx, "Ordered dimension label reader: var labels, empty range, decreasing", "[ordered-dim-label-reader][var][empty-range][decreasing]") { +#ifdef TILEDB_SERIALIZATION + serialize_ = GENERATE(true, false); +#endif increasing_labels_ = false; write_labels(1, 4, {4.0, 3.0, 2.0, 1.0}); std::vector ranges{2.1, 2.8}; @@ -850,6 +1015,9 @@ TEST_CASE_METHOD( CPPOrderedDimLabelReaderFixedDoubleFx, "Ordered dimension label reader: memory budget forcing internal loops", "[ordered-dim-label-reader][memory-budget]") { +#ifdef TILEDB_SERIALIZATION + serialize_ = GENERATE(true, false); +#endif // Budget should only allow to load one tile in memory. Config cfg; cfg.set("sm.mem.total_budget", "100"); @@ -872,6 +1040,11 @@ TEST_CASE_METHOD( Subarray subarray(ctx_, array); subarray.ptr()->subarray_->set_attribute_ranges("labels", input_ranges); + if (serialize_) { + auto subarray_ptr = subarray.ptr().get(); + tiledb_subarray_serialize( + ctx_.ptr().get(), array.ptr().get(), &subarray_ptr); + } query.ptr()->query_->set_dimension_label_ordered_read(increasing_labels_); query.set_data_buffer("index", index); @@ -896,6 +1069,9 @@ TEST_CASE_METHOD( CPPOrderedDimLabelReaderFixedDoubleFx, "Ordered dimension label reader: fixed labels, multiple ranges", "[ordered-dim-label-reader][fixed][double][multi-range]") { +#ifdef TILEDB_SERIALIZATION + serialize_ = GENERATE(true, false); +#endif write_labels(16, 25, {0.1, 0.2, 0.3, 0.4, 0.5, 0.6, 0.7, 0.8, 0.9, 1.0}); write_labels(26, 35, {1.1, 1.2, 1.3, 1.4, 1.5, 1.6, 1.7, 1.8, 1.9, 2.0}); auto index = read_labels({0.85, 1.25, 0.15, 0.75, 1.75, 2.05}); @@ -906,6 +1082,9 @@ TEST_CASE_METHOD( CPPOrderedDimLabelReaderFixedIntFx, "Ordered dimension label reader: fixed int labels, discountinuity", "[ordered-dim-label-reader][fixed][int][discountinuity]") { +#ifdef TILEDB_SERIALIZATION + serialize_ = GENERATE(true, false); +#endif SECTION("Test 1") { write_labels(16, 20, {1, 2, 3, 4, 5}); write_labels(22, 25, {7, 8, 9, 10}); @@ -925,6 +1104,9 @@ TEST_CASE_METHOD( CPPOrderedDimLabelReaderFixedIntFx, "Ordered dimension label reader: fixed int labels, out of order", "[ordered-dim-label-reader][fixed][int][out-of-order]") { +#ifdef TILEDB_SERIALIZATION + serialize_ = GENERATE(true, false); +#endif SECTION("Non tile aligned, overlapped 1") { write_labels(11, 20, {1, 2, 3, 4, 5, 6, 7, 8, 9, 10}); write_labels(15, 16, {3, 6}); @@ -1015,6 +1197,9 @@ TEST_CASE_METHOD( CPPOrderedDimLabelReaderFixedDoubleFx, "Ordered dimension label reader: fixed double labels, out of order", "[ordered-dim-label-reader][fixed][double][out-of-order]") { +#ifdef TILEDB_SERIALIZATION + serialize_ = GENERATE(true, false); +#endif SECTION("Non tile aligned, overlapped 1") { write_labels(11, 20, {0.1, 0.2, 0.3, 0.4, 0.5, 0.6, 0.7, 0.8, 0.9, 1.0}); write_labels(15, 16, {0.3, 0.6}); @@ -1107,6 +1292,9 @@ TEST_CASE_METHOD( CPPOrderedDimLabelReaderVarFx, "Ordered dimension label reader: var labels, out of order", "[ordered-dim-label-reader][var][out-of-order]") { +#ifdef TILEDB_SERIALIZATION + serialize_ = GENERATE(true, false); +#endif SECTION("Non tile aligned, overlapped 1") { write_labels(11, 20, {0.1, 0.2, 0.3, 0.4, 0.5, 0.6, 0.7, 0.8, 0.9, 1.0}); write_labels(15, 16, {0.3, 0.6}); From 8d11cab69956b3f29e16d340706890b6446488e1 Mon Sep 17 00:00:00 2001 From: Julia Dark Date: Wed, 5 Apr 2023 11:50:32 -0400 Subject: [PATCH 5/6] Fix doxygen comment --- tiledb/sm/subarray/subarray.h | 7 +++---- 1 file changed, 3 insertions(+), 4 deletions(-) diff --git a/tiledb/sm/subarray/subarray.h b/tiledb/sm/subarray/subarray.h index a6322cb0e1f..131f84cae81 100644 --- a/tiledb/sm/subarray/subarray.h +++ b/tiledb/sm/subarray/subarray.h @@ -1270,8 +1270,7 @@ class Subarray { /** * Constructor * - * @param ref Dimension label reference to the label this will contain - * ranges for. + * @param ref Dimension label the ranges will be set on. * @param coalesce_ranges Set if ranges should be combined when adjacent. */ LabelRangeSubset(const DimensionLabel& ref, bool coalesce_ranges = true); @@ -1279,8 +1278,8 @@ class Subarray { /** * Constructor * - * @param ref Dimension label reference to the label this will contain - * ranges for. + * @param name The name of the dimension label the ranges will be set on. + * @param type The type of the label the ranges will be set on. * @param coalesce_ranges Set if ranges should be combined when adjacent. */ LabelRangeSubset( From 545e4a63c3108f2349b7620296dd365fa9cf7d11 Mon Sep 17 00:00:00 2001 From: Julia Dark Date: Wed, 5 Apr 2023 12:16:35 -0400 Subject: [PATCH 6/6] Fix variable name chagne from bad merge --- tiledb/sm/subarray/subarray.cc | 12 ++++++------ 1 file changed, 6 insertions(+), 6 deletions(-) diff --git a/tiledb/sm/subarray/subarray.cc b/tiledb/sm/subarray/subarray.cc index b22b433fe09..d0a09fe1cdf 100644 --- a/tiledb/sm/subarray/subarray.cc +++ b/tiledb/sm/subarray/subarray.cc @@ -184,11 +184,11 @@ void Subarray::add_label_range( if (label_range_subset_[dim_idx].has_value()) { // A label range has already been set on this dimension. Do the following: // * Check this label is the same label that rangers were already set. - if (dim_label_ref.name() != label_range_subset_[dim_idx].value().name) { + if (dim_label_ref.name() != label_range_subset_[dim_idx].value().name_) { throw SubarrayStatusException( "[add_label_range] Dimension is already to set to use " "dimension label '" + - label_range_subset_[dim_idx].value().name + "'"); + label_range_subset_[dim_idx].value().name_ + "'"); } } else { // A label range has not yet been set on this dimension. Do the following: @@ -597,7 +597,7 @@ void Subarray::get_label_range( .dimension_label(label_name) .dimension_index(); if (!label_range_subset_[dim_idx].has_value() || - label_range_subset_[dim_idx].value().name != label_name) { + label_range_subset_[dim_idx].value().name_ != label_name) { throw SubarrayStatusException( "[get_label_range] No ranges set on dimension label '" + label_name + "'"); @@ -628,7 +628,7 @@ void Subarray::get_label_range_var( .dimension_label(label_name) .dimension_index(); if (!label_range_subset_[dim_idx].has_value() || - label_range_subset_[dim_idx].value().name != label_name) { + label_range_subset_[dim_idx].value().name_ != label_name) { throw SubarrayStatusException( "[get_label_range_var] No ranges set on dimension label '" + label_name + "'"); @@ -647,7 +647,7 @@ void Subarray::get_label_range_var_size( .dimension_label(label_name) .dimension_index(); if (!label_range_subset_[dim_idx].has_value() || - label_range_subset_[dim_idx].value().name != label_name) { + label_range_subset_[dim_idx].value().name_ != label_name) { throw SubarrayStatusException( "[get_label_range_var_size] No ranges set on dimension label '" + label_name + "'"); @@ -1747,7 +1747,7 @@ const std::vector& Subarray::ranges_for_label( .dimension_label(label_name) .dimension_index(); if (!label_range_subset_[dim_idx].has_value() || - label_range_subset_[dim_idx].value().name != label_name) { + label_range_subset_[dim_idx].value().name_ != label_name) { throw SubarrayStatusException( "[ranges_for_label] No ranges set on dimension label '" + label_name + "'");