From 5c1ef736d144cbcdeeeaa4923390f37b5fd0f1bf Mon Sep 17 00:00:00 2001 From: XanthosXanthopoulos Date: Thu, 21 Nov 2024 14:14:05 +0200 Subject: [PATCH 01/11] Add concrete class wrapper for TileDB attribute --- libtiledbsoma/src/soma/soma_attribute.cc | 66 ++++++++++++++ libtiledbsoma/src/soma/soma_attribute.h | 108 +++++++++++++++++++++++ 2 files changed, 174 insertions(+) create mode 100644 libtiledbsoma/src/soma/soma_attribute.cc create mode 100644 libtiledbsoma/src/soma/soma_attribute.h diff --git a/libtiledbsoma/src/soma/soma_attribute.cc b/libtiledbsoma/src/soma/soma_attribute.cc new file mode 100644 index 0000000000..6ca08e3798 --- /dev/null +++ b/libtiledbsoma/src/soma/soma_attribute.cc @@ -0,0 +1,66 @@ +#include "soma_attribute.h" + +namespace tiledbsoma { +std::shared_ptr SOMAAttribute::create( + std::shared_ptr ctx, + ArrowSchema* schema, + std::string_view type_metadata, + PlatformConfig platform_config) { + auto attribute = ArrowAdapter::tiledb_attribute_from_arrow_schema( + ctx, schema, type_metadata, platform_config); + + return std::make_shared( + SOMAAttribute(attribute.first, attribute.second)); +} + +void SOMAAttribute::_set_dim_points( + const std::unique_ptr&, + const SOMAContext&, + const std::any&) const { + throw TileDBSOMAError(std::format( + "[SOMAAttribute] Column with name {} is not an index column", name())); +} + +void SOMAAttribute::_set_dim_ranges( + const std::unique_ptr&, + const SOMAContext&, + const std::any&) const { + throw TileDBSOMAError(std::format( + "[SOMAAttribute] Column with name {} is not an index column", name())); +} + +void SOMAAttribute::_set_current_domain_slot( + NDRectangle&, const std::vector&) const { + throw TileDBSOMAError(std::format( + "[SOMAAttribute] Column with name {} is not an index column", name())); +} + +std::any SOMAAttribute::_core_domain_slot() const { + throw TileDBSOMAError(std::format( + "[SOMAAttribute] Column with name {} is not an index column", name())); +} + +std::any SOMAAttribute::_non_empty_domain_slot(Array&) const { + throw TileDBSOMAError(std::format( + "[SOMAAttribute] Column with name {} is not an index column", name())); +} + +std::any SOMAAttribute::_core_current_domain_slot( + const SOMAContext&, Array&) const { + throw TileDBSOMAError(std::format( + "[SOMAAttribute] Column with name {} is not an index column", name())); +} + +ArrowArray* SOMAAttribute::arrow_domain_slot( + const SOMAContext&, Array&, enum Domainish) const { + throw TileDBSOMAError(std::format( + "[SOMAAttribute] Column with name {} is not an index column", name())); +} + +ArrowSchema* SOMAAttribute::arrow_schema_slot( + const SOMAContext& ctx, Array& array) { + return ArrowAdapter::arrow_schema_from_tiledb_attribute( + attribute, *ctx.tiledb_ctx(), array) + .release(); +} +} // namespace tiledbsoma diff --git a/libtiledbsoma/src/soma/soma_attribute.h b/libtiledbsoma/src/soma/soma_attribute.h new file mode 100644 index 0000000000..ef8a5d5146 --- /dev/null +++ b/libtiledbsoma/src/soma/soma_attribute.h @@ -0,0 +1,108 @@ +#ifndef SOMA_ATTRIBUTE_H +#define SOMA_ATTRIBUTE_H + +#include +#include + +#include +#include "soma_column.h" + +namespace tiledbsoma { +using namespace tiledb; + +class SOMAAttribute : public virtual SOMAColumn { + public: + /** + * Create a ``SOMAAttribute`` shared pointer from an arrow schema + */ + static std::shared_ptr create( + std::shared_ptr ctx, + ArrowSchema* schema, + std::string_view type_metadata, + PlatformConfig platform_config); + + SOMAAttribute( + Attribute attribute, + std::optional enumeration = std::nullopt) + : attribute(attribute) + , enumeration(enumeration) { + } + + virtual inline std::string name() const { + return attribute.name(); + } + + virtual inline bool isIndexColumn() const { + return false; + } + + inline virtual void select_columns( + const std::unique_ptr& query, + bool if_not_empty = false) const override { + query->select_columns(std::vector({attribute.name()}), if_not_empty); + }; + + inline soma_column_datatype_t type() const { + return soma_column_datatype_t::SOMA_COLUMN_ATTRIBUTE; + } + + inline std::optional domain_type() const { + return std::nullopt; + } + + inline std::optional data_type() const { + return attribute.type(); + } + + inline std::optional> tiledb_dimensions() { + return std::nullopt; + } + + inline std::optional> tiledb_attributes() { + return std::vector({attribute}); + } + + inline virtual std::optional> + tiledb_enumerations() { + if (!enumeration.has_value()) { + return std::nullopt; + } + + return std::vector({enumeration.value()}); + } + + virtual ArrowArray* arrow_domain_slot( + const SOMAContext& ctx, + Array& array, + enum Domainish kind) const override; + + virtual ArrowSchema* arrow_schema_slot( + const SOMAContext& ctx, Array& array) override; + + private: + virtual void _set_dim_points( + const std::unique_ptr& query, + const SOMAContext& ctx, + const std::any& points) const; + + virtual void _set_dim_ranges( + const std::unique_ptr& query, + const SOMAContext& ctx, + const std::any& ranges) const; + + virtual void _set_current_domain_slot( + NDRectangle& rectangle, const std::vector& domain) const; + + virtual std::any _core_domain_slot() const; + + virtual std::any _non_empty_domain_slot(Array& array) const; + + virtual std::any _core_current_domain_slot( + const SOMAContext& ctx, Array& array) const; + + Attribute attribute; + std::optional enumeration; +}; +} // namespace tiledbsoma + +#endif \ No newline at end of file From 382a1ef81788c02b352846730af6efa6b942a689 Mon Sep 17 00:00:00 2001 From: XanthosXanthopoulos Date: Thu, 21 Nov 2024 15:34:47 +0200 Subject: [PATCH 02/11] Misc fixes --- libtiledbsoma/src/soma/soma_attribute.h | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/libtiledbsoma/src/soma/soma_attribute.h b/libtiledbsoma/src/soma/soma_attribute.h index ef8a5d5146..60258cc567 100644 --- a/libtiledbsoma/src/soma/soma_attribute.h +++ b/libtiledbsoma/src/soma/soma_attribute.h @@ -36,7 +36,7 @@ class SOMAAttribute : public virtual SOMAColumn { return false; } - inline virtual void select_columns( + virtual inline void select_columns( const std::unique_ptr& query, bool if_not_empty = false) const override { query->select_columns(std::vector({attribute.name()}), if_not_empty); From 9d8fd42b627de52f89690a6ff5963c72cc9ca38f Mon Sep 17 00:00:00 2001 From: XanthosXanthopoulos Date: Fri, 22 Nov 2024 18:19:30 +0200 Subject: [PATCH 03/11] Add missing `override` --- libtiledbsoma/src/soma/soma_attribute.h | 34 ++++++++++++++----------- 1 file changed, 19 insertions(+), 15 deletions(-) diff --git a/libtiledbsoma/src/soma/soma_attribute.h b/libtiledbsoma/src/soma/soma_attribute.h index 60258cc567..27ba21dfb2 100644 --- a/libtiledbsoma/src/soma/soma_attribute.h +++ b/libtiledbsoma/src/soma/soma_attribute.h @@ -28,11 +28,11 @@ class SOMAAttribute : public virtual SOMAColumn { , enumeration(enumeration) { } - virtual inline std::string name() const { + virtual inline std::string name() const override { return attribute.name(); } - virtual inline bool isIndexColumn() const { + virtual inline bool isIndexColumn() const override { return false; } @@ -42,28 +42,31 @@ class SOMAAttribute : public virtual SOMAColumn { query->select_columns(std::vector({attribute.name()}), if_not_empty); }; - inline soma_column_datatype_t type() const { + virtual inline soma_column_datatype_t type() const override { return soma_column_datatype_t::SOMA_COLUMN_ATTRIBUTE; } - inline std::optional domain_type() const { + virtual inline std::optional domain_type() + const override { return std::nullopt; } - inline std::optional data_type() const { + virtual inline std::optional data_type() const override { return attribute.type(); } - inline std::optional> tiledb_dimensions() { + virtual inline std::optional> tiledb_dimensions() + override { return std::nullopt; } - inline std::optional> tiledb_attributes() { + virtual inline std::optional> tiledb_attributes() + override { return std::vector({attribute}); } - inline virtual std::optional> - tiledb_enumerations() { + virtual inline std::optional> tiledb_enumerations() + override { if (!enumeration.has_value()) { return std::nullopt; } @@ -83,22 +86,23 @@ class SOMAAttribute : public virtual SOMAColumn { virtual void _set_dim_points( const std::unique_ptr& query, const SOMAContext& ctx, - const std::any& points) const; + const std::any& points) const override; virtual void _set_dim_ranges( const std::unique_ptr& query, const SOMAContext& ctx, - const std::any& ranges) const; + const std::any& ranges) const override; virtual void _set_current_domain_slot( - NDRectangle& rectangle, const std::vector& domain) const; + NDRectangle& rectangle, + const std::vector& domain) const override; - virtual std::any _core_domain_slot() const; + virtual std::any _core_domain_slot() const override; - virtual std::any _non_empty_domain_slot(Array& array) const; + virtual std::any _non_empty_domain_slot(Array& array) const override; virtual std::any _core_current_domain_slot( - const SOMAContext& ctx, Array& array) const; + const SOMAContext& ctx, Array& array) const override; Attribute attribute; std::optional enumeration; From 3499930448a7575e9bd98efe596c1833862ab888 Mon Sep 17 00:00:00 2001 From: XanthosXanthopoulos Date: Sun, 24 Nov 2024 18:20:58 +0200 Subject: [PATCH 04/11] Remove current_domain flag --- libtiledbsoma/test/unit_soma_column.cc | 5 +++++ 1 file changed, 5 insertions(+) diff --git a/libtiledbsoma/test/unit_soma_column.cc b/libtiledbsoma/test/unit_soma_column.cc index 6a12bafe02..9680b58d9f 100644 --- a/libtiledbsoma/test/unit_soma_column.cc +++ b/libtiledbsoma/test/unit_soma_column.cc @@ -314,6 +314,11 @@ TEST_CASE_METHOD( std::make_shared(SOMADimension(dimension))); } + for (size_t i = 0; i < sdf->tiledb_schema()->attribute_num(); ++i) { + columns.push_back(std::make_shared( + SOMAAttribute(sdf->tiledb_schema()->attribute(i)))); + } + CurrentDomain current_domain = sdf->get_current_domain_for_test(); REQUIRE(!current_domain.is_empty()); From 29e09a3844f3123105d5ad84480f0efa9e38005d Mon Sep 17 00:00:00 2001 From: XanthosXanthopoulos Date: Fri, 6 Dec 2024 14:27:20 +0200 Subject: [PATCH 05/11] Replace string_view with string when returning column name, add current domain checks, replace vector with span when selecting points --- libtiledbsoma/src/soma/soma_attribute.cc | 47 +++++++++++++++++++----- libtiledbsoma/src/soma/soma_attribute.h | 9 ++++- 2 files changed, 46 insertions(+), 10 deletions(-) diff --git a/libtiledbsoma/src/soma/soma_attribute.cc b/libtiledbsoma/src/soma/soma_attribute.cc index 6ca08e3798..b9d91985de 100644 --- a/libtiledbsoma/src/soma/soma_attribute.cc +++ b/libtiledbsoma/src/soma/soma_attribute.cc @@ -18,7 +18,9 @@ void SOMAAttribute::_set_dim_points( const SOMAContext&, const std::any&) const { throw TileDBSOMAError(std::format( - "[SOMAAttribute] Column with name {} is not an index column", name())); + "[SOMAAttribute][_set_dim_points] Column with name {} is not an index " + "column", + name())); } void SOMAAttribute::_set_dim_ranges( @@ -26,35 +28,62 @@ void SOMAAttribute::_set_dim_ranges( const SOMAContext&, const std::any&) const { throw TileDBSOMAError(std::format( - "[SOMAAttribute] Column with name {} is not an index column", name())); + "[SOMAAttribute][_set_dim_ranges] Column with name {} is not an index " + "column", + name())); } void SOMAAttribute::_set_current_domain_slot( - NDRectangle&, const std::vector&) const { + NDRectangle&, std::span) const { throw TileDBSOMAError(std::format( - "[SOMAAttribute] Column with name {} is not an index column", name())); + "[SOMAAttribute][_set_current_domain_slot] Column with name {} is not " + "an index column", + name())); } +std::pair SOMAAttribute::_can_set_current_domain_slot( + std::optional&, std::span) const { + throw TileDBSOMAError(std::format( + "[SOMAAttribute][_set_current_domain_slot] Column with name {} is not " + "an index column", + name())); +}; + std::any SOMAAttribute::_core_domain_slot() const { throw TileDBSOMAError(std::format( - "[SOMAAttribute] Column with name {} is not an index column", name())); + "[SOMAAttribute][_core_domain_slot] Column with name {} is not an " + "index column", + name())); } std::any SOMAAttribute::_non_empty_domain_slot(Array&) const { throw TileDBSOMAError(std::format( - "[SOMAAttribute] Column with name {} is not an index column", name())); + "[SOMAAttribute][_non_empty_domain_slot] Column with name {} is not an " + "index column", + name())); } std::any SOMAAttribute::_core_current_domain_slot( const SOMAContext&, Array&) const { throw TileDBSOMAError(std::format( - "[SOMAAttribute] Column with name {} is not an index column", name())); + "[SOMAAttribute][_core_current_domain_slot] Column with name {} is not " + "an index column", + name())); +} + +std::any SOMAAttribute::_core_current_domain_slot(NDRectangle&) const { + throw TileDBSOMAError(std::format( + "[SOMAAttribute][_core_current_domain_slot] Column with name {} is not " + "an index column", + name())); } ArrowArray* SOMAAttribute::arrow_domain_slot( const SOMAContext&, Array&, enum Domainish) const { throw TileDBSOMAError(std::format( - "[SOMAAttribute] Column with name {} is not an index column", name())); + "[SOMAAttribute][arrow_domain_slot] Column with name {} is not an " + "index column", + name())); } ArrowSchema* SOMAAttribute::arrow_schema_slot( @@ -63,4 +92,4 @@ ArrowSchema* SOMAAttribute::arrow_schema_slot( attribute, *ctx.tiledb_ctx(), array) .release(); } -} // namespace tiledbsoma +} // namespace tiledbsoma \ No newline at end of file diff --git a/libtiledbsoma/src/soma/soma_attribute.h b/libtiledbsoma/src/soma/soma_attribute.h index 27ba21dfb2..01dcc83256 100644 --- a/libtiledbsoma/src/soma/soma_attribute.h +++ b/libtiledbsoma/src/soma/soma_attribute.h @@ -95,7 +95,11 @@ class SOMAAttribute : public virtual SOMAColumn { virtual void _set_current_domain_slot( NDRectangle& rectangle, - const std::vector& domain) const override; + std::span domain) const override; + + virtual std::pair _can_set_current_domain_slot( + std::optional& rectangle, + std::span new_domain) const override; virtual std::any _core_domain_slot() const override; @@ -104,6 +108,9 @@ class SOMAAttribute : public virtual SOMAColumn { virtual std::any _core_current_domain_slot( const SOMAContext& ctx, Array& array) const override; + virtual std::any _core_current_domain_slot( + NDRectangle& ndrect) const override; + Attribute attribute; std::optional enumeration; }; From b48cf9d13d0a94b293082ae7c49d3e32b2baba42 Mon Sep 17 00:00:00 2001 From: XanthosXanthopoulos Date: Thu, 12 Dec 2024 12:06:17 +0200 Subject: [PATCH 06/11] Update CMake files --- libtiledbsoma/src/CMakeLists.txt | 2 ++ libtiledbsoma/src/tiledbsoma/tiledbsoma | 1 + 2 files changed, 3 insertions(+) diff --git a/libtiledbsoma/src/CMakeLists.txt b/libtiledbsoma/src/CMakeLists.txt index 834be63bd1..dfe101e988 100644 --- a/libtiledbsoma/src/CMakeLists.txt +++ b/libtiledbsoma/src/CMakeLists.txt @@ -34,6 +34,7 @@ add_library(TILEDB_SOMA_OBJECTS OBJECT ${CMAKE_CURRENT_SOURCE_DIR}/soma/soma_group.cc ${CMAKE_CURRENT_SOURCE_DIR}/soma/soma_object.cc ${CMAKE_CURRENT_SOURCE_DIR}/soma/soma_column.cc + ${CMAKE_CURRENT_SOURCE_DIR}/soma/soma_attribute.cc ${CMAKE_CURRENT_SOURCE_DIR}/soma/soma_dimension.cc ${CMAKE_CURRENT_SOURCE_DIR}/soma/soma_collection.cc ${CMAKE_CURRENT_SOURCE_DIR}/soma/soma_experiment.cc @@ -209,6 +210,7 @@ install(FILES ${CMAKE_CURRENT_SOURCE_DIR}/soma/soma_array.h ${CMAKE_CURRENT_SOURCE_DIR}/soma/soma_group.h ${CMAKE_CURRENT_SOURCE_DIR}/soma/soma_column.h + ${CMAKE_CURRENT_SOURCE_DIR}/soma/soma_attribute.h ${CMAKE_CURRENT_SOURCE_DIR}/soma/soma_dimension.h ${CMAKE_CURRENT_SOURCE_DIR}/soma/soma_collection.h ${CMAKE_CURRENT_SOURCE_DIR}/soma/soma_dataframe.h diff --git a/libtiledbsoma/src/tiledbsoma/tiledbsoma b/libtiledbsoma/src/tiledbsoma/tiledbsoma index cfb3ab8243..8dda098f30 100644 --- a/libtiledbsoma/src/tiledbsoma/tiledbsoma +++ b/libtiledbsoma/src/tiledbsoma/tiledbsoma @@ -50,6 +50,7 @@ #include "soma/soma_array.h" #include "soma/soma_collection.h" #include "soma/soma_column.h" +#include "soma/soma_attribute.h" #include "soma/soma_dimension.h" #include "soma/soma_dataframe.h" #include "soma/soma_group.h" From 79784f8aa703b03387f0a8c64d8ef533086e1f13 Mon Sep 17 00:00:00 2001 From: XanthosXanthopoulos Date: Fri, 13 Dec 2024 17:01:05 +0200 Subject: [PATCH 07/11] Add description and license --- libtiledbsoma/src/soma/soma_attribute.cc | 32 ++++++++++++++++++++++ libtiledbsoma/src/soma/soma_attribute.h | 35 ++++++++++++++++++++++++ 2 files changed, 67 insertions(+) diff --git a/libtiledbsoma/src/soma/soma_attribute.cc b/libtiledbsoma/src/soma/soma_attribute.cc index b9d91985de..deaa083ef2 100644 --- a/libtiledbsoma/src/soma/soma_attribute.cc +++ b/libtiledbsoma/src/soma/soma_attribute.cc @@ -1,3 +1,35 @@ +/** + * @file soma_attribute.cc + * + * @section LICENSE + * + * The MIT License + * + * @copyright Copyright (c) 2024 TileDB, Inc. + * + * Permission is hereby granted, free of charge, to any person obtaining a copy + * of this software and associated documentation files (the "Software"), to deal + * in the Software without restriction, including without limitation the rights + * to use, copy, modify, merge, publish, distribute, sublicense, and/or sell + * copies of the Software, and to permit persons to whom the Software is + * furnished to do so, subject to the following conditions: + * + * The above copyright notice and this permission notice shall be included in + * all copies or substantial portions of the Software. + * + * THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR + * IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY, + * FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL THE + * AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER + * LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM, + * OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN + * THE SOFTWARE. + * + * @section DESCRIPTION + * + * This file defines the SOMAAttribute class. + */ + #include "soma_attribute.h" namespace tiledbsoma { diff --git a/libtiledbsoma/src/soma/soma_attribute.h b/libtiledbsoma/src/soma/soma_attribute.h index 01dcc83256..77db963c0f 100644 --- a/libtiledbsoma/src/soma/soma_attribute.h +++ b/libtiledbsoma/src/soma/soma_attribute.h @@ -1,3 +1,38 @@ +/** + * @file soma_attribute.h + * + * @section LICENSE + * + * The MIT License + * + * @copyright Copyright (c) 2024 TileDB, Inc. + * + * Permission is hereby granted, free of charge, to any person obtaining a copy + * of this software and associated documentation files (the "Software"), to deal + * in the Software without restriction, including without limitation the rights + * to use, copy, modify, merge, publish, distribute, sublicense, and/or sell + * copies of the Software, and to permit persons to whom the Software is + * furnished to do so, subject to the following conditions: + * + * The above copyright notice and this permission notice shall be included in + * all copies or substantial portions of the Software. + * + * THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR + * IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY, + * FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL THE + * AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER + * LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM, + * OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN + * THE SOFTWARE. + * + * @section DESCRIPTION + * + * This file defines the SOMAAttribute class. SOMAAttribute extends SOMAColumn + * and wraps a TileDB Attribute and optionally an enumeration associated with + * the attribute. The purpose of this class is to provide a common interface + * identical to TileDB dimensions and composite columns. + */ + #ifndef SOMA_ATTRIBUTE_H #define SOMA_ATTRIBUTE_H From 6cc202e788a1946e07f3b920a3799abfc702d6bd Mon Sep 17 00:00:00 2001 From: XanthosXanthopoulos Date: Tue, 31 Dec 2024 16:08:05 +0200 Subject: [PATCH 08/11] Address review comments --- libtiledbsoma/src/soma/soma_attribute.h | 4 ++-- 1 file changed, 2 insertions(+), 2 deletions(-) diff --git a/libtiledbsoma/src/soma/soma_attribute.h b/libtiledbsoma/src/soma/soma_attribute.h index 77db963c0f..d1528f28d9 100644 --- a/libtiledbsoma/src/soma/soma_attribute.h +++ b/libtiledbsoma/src/soma/soma_attribute.h @@ -45,10 +45,10 @@ namespace tiledbsoma { using namespace tiledb; -class SOMAAttribute : public virtual SOMAColumn { +class SOMAAttribute : public SOMAColumn { public: /** - * Create a ``SOMAAttribute`` shared pointer from an arrow schema + * Create a ``SOMAAttribute`` shared pointer from an Arrow schema */ static std::shared_ptr create( std::shared_ptr ctx, From 2d85ff4a058a3e81252224ba059b69044b50ca82 Mon Sep 17 00:00:00 2001 From: XanthosXanthopoulos Date: Thu, 2 Jan 2025 13:36:14 +0200 Subject: [PATCH 09/11] Comply with C.128 --- libtiledbsoma/src/soma/soma_attribute.h | 42 +++++++++++-------------- 1 file changed, 19 insertions(+), 23 deletions(-) diff --git a/libtiledbsoma/src/soma/soma_attribute.h b/libtiledbsoma/src/soma/soma_attribute.h index d1528f28d9..8d12f0a3a6 100644 --- a/libtiledbsoma/src/soma/soma_attribute.h +++ b/libtiledbsoma/src/soma/soma_attribute.h @@ -63,44 +63,41 @@ class SOMAAttribute : public SOMAColumn { , enumeration(enumeration) { } - virtual inline std::string name() const override { + inline std::string name() const override { return attribute.name(); } - virtual inline bool isIndexColumn() const override { + inline bool isIndexColumn() const override { return false; } - virtual inline void select_columns( + inline void select_columns( const std::unique_ptr& query, bool if_not_empty = false) const override { query->select_columns(std::vector({attribute.name()}), if_not_empty); }; - virtual inline soma_column_datatype_t type() const override { + inline soma_column_datatype_t type() const override { return soma_column_datatype_t::SOMA_COLUMN_ATTRIBUTE; } - virtual inline std::optional domain_type() - const override { + inline std::optional domain_type() const override { return std::nullopt; } - virtual inline std::optional data_type() const override { + inline std::optional data_type() const override { return attribute.type(); } - virtual inline std::optional> tiledb_dimensions() - override { + inline std::optional> tiledb_dimensions() override { return std::nullopt; } - virtual inline std::optional> tiledb_attributes() - override { + inline std::optional> tiledb_attributes() override { return std::vector({attribute}); } - virtual inline std::optional> tiledb_enumerations() + inline std::optional> tiledb_enumerations() override { if (!enumeration.has_value()) { return std::nullopt; @@ -109,42 +106,41 @@ class SOMAAttribute : public SOMAColumn { return std::vector({enumeration.value()}); } - virtual ArrowArray* arrow_domain_slot( + ArrowArray* arrow_domain_slot( const SOMAContext& ctx, Array& array, enum Domainish kind) const override; - virtual ArrowSchema* arrow_schema_slot( + ArrowSchema* arrow_schema_slot( const SOMAContext& ctx, Array& array) override; private: - virtual void _set_dim_points( + void _set_dim_points( const std::unique_ptr& query, const SOMAContext& ctx, const std::any& points) const override; - virtual void _set_dim_ranges( + void _set_dim_ranges( const std::unique_ptr& query, const SOMAContext& ctx, const std::any& ranges) const override; - virtual void _set_current_domain_slot( + void _set_current_domain_slot( NDRectangle& rectangle, std::span domain) const override; - virtual std::pair _can_set_current_domain_slot( + std::pair _can_set_current_domain_slot( std::optional& rectangle, std::span new_domain) const override; - virtual std::any _core_domain_slot() const override; + std::any _core_domain_slot() const override; - virtual std::any _non_empty_domain_slot(Array& array) const override; + std::any _non_empty_domain_slot(Array& array) const override; - virtual std::any _core_current_domain_slot( + std::any _core_current_domain_slot( const SOMAContext& ctx, Array& array) const override; - virtual std::any _core_current_domain_slot( - NDRectangle& ndrect) const override; + std::any _core_current_domain_slot(NDRectangle& ndrect) const override; Attribute attribute; std::optional enumeration; From 89e50af088843ebc137742e461d31b7ae937805a Mon Sep 17 00:00:00 2001 From: XanthosXanthopoulos <38084549+XanthosXanthopoulos@users.noreply.github.com> Date: Thu, 2 Jan 2025 18:54:14 +0200 Subject: [PATCH 10/11] Update libtiledbsoma/src/soma/soma_attribute.cc Co-authored-by: Julia Dark <24235303+jp-dark@users.noreply.github.com> --- libtiledbsoma/src/soma/soma_attribute.cc | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/libtiledbsoma/src/soma/soma_attribute.cc b/libtiledbsoma/src/soma/soma_attribute.cc index deaa083ef2..49e834124f 100644 --- a/libtiledbsoma/src/soma/soma_attribute.cc +++ b/libtiledbsoma/src/soma/soma_attribute.cc @@ -5,7 +5,7 @@ * * The MIT License * - * @copyright Copyright (c) 2024 TileDB, Inc. + * @copyright Copyright (c) 2024-2025 TileDB, Inc. * * Permission is hereby granted, free of charge, to any person obtaining a copy * of this software and associated documentation files (the "Software"), to deal From 3faefd9df8fe3bacc596d2616689f135263ce3d8 Mon Sep 17 00:00:00 2001 From: XanthosXanthopoulos <38084549+XanthosXanthopoulos@users.noreply.github.com> Date: Thu, 2 Jan 2025 18:54:25 +0200 Subject: [PATCH 11/11] Update libtiledbsoma/src/soma/soma_attribute.h Co-authored-by: Julia Dark <24235303+jp-dark@users.noreply.github.com> --- libtiledbsoma/src/soma/soma_attribute.h | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/libtiledbsoma/src/soma/soma_attribute.h b/libtiledbsoma/src/soma/soma_attribute.h index 8d12f0a3a6..57bb90748f 100644 --- a/libtiledbsoma/src/soma/soma_attribute.h +++ b/libtiledbsoma/src/soma/soma_attribute.h @@ -5,7 +5,7 @@ * * The MIT License * - * @copyright Copyright (c) 2024 TileDB, Inc. + * @copyright Copyright (c) 2024-2025 TileDB, Inc. * * Permission is hereby granted, free of charge, to any person obtaining a copy * of this software and associated documentation files (the "Software"), to deal