Skip to content

Commit

Permalink
[c++] Some use_current_domain unit-test/feature-flag teardown, part…
Browse files Browse the repository at this point in the history
… 2/n (#3370)
  • Loading branch information
johnkerl authored Nov 22, 2024
1 parent 8461b0a commit 78741e3
Show file tree
Hide file tree
Showing 2 changed files with 9 additions and 19 deletions.
21 changes: 6 additions & 15 deletions libtiledbsoma/src/utils/arrow_adapter.cc
Original file line number Diff line number Diff line change
Expand Up @@ -1005,8 +1005,7 @@ ArraySchema ArrowAdapter::tiledb_schema_from_arrow_schema(
"",
"",
platform_config);
dims.insert({dim.first.name(), dim.first});
use_current_domain &= dim.second;
dims.insert({dim.name(), dim});
isattr = false;
}

Expand Down Expand Up @@ -1166,7 +1165,7 @@ ArraySchema ArrowAdapter::tiledb_schema_from_arrow_schema(
return schema;
}

std::pair<Dimension, bool> ArrowAdapter::tiledb_dimension_from_arrow_schema(
Dimension ArrowAdapter::tiledb_dimension_from_arrow_schema(
std::shared_ptr<Context> ctx,
ArrowSchema* schema,
ArrowArray* array,
Expand All @@ -1175,8 +1174,6 @@ std::pair<Dimension, bool> ArrowAdapter::tiledb_dimension_from_arrow_schema(
std::string prefix,
std::string suffix,
PlatformConfig platform_config) {
bool use_current_domain = true;

auto type = ArrowAdapter::to_tiledb_format(schema->format, type_metadata);

if (ArrowAdapter::arrow_is_var_length_type(schema->format)) {
Expand All @@ -1200,7 +1197,7 @@ std::pair<Dimension, bool> ArrowAdapter::tiledb_dimension_from_arrow_schema(
auto dim = ArrowAdapter::_create_dim(type, col_name, buff, ctx);
dim.set_filter_list(filter_list);

return {dim, use_current_domain};
return dim;
}

std::pair<Attribute, std::optional<Enumeration>>
Expand Down Expand Up @@ -1826,14 +1823,13 @@ ArrowArray* ArrowAdapter::_get_and_check_column(
return child;
}

bool ArrowAdapter::_set_spatial_dimensions(
void ArrowAdapter::_set_spatial_dimensions(
std::map<std::string, Dimension>& dims,
const ArrowTable& spatial_column_info,
std::string_view type_metadata,
std::string soma_type,
std::shared_ptr<Context> ctx,
PlatformConfig platform_config) {
bool use_current_domain = true;
if (type_metadata.compare("WKB") != 0) {
throw TileDBSOMAError(std::format(
"ArrowAdapter::tiledb_attribute_from_arrow_schema: "
Expand Down Expand Up @@ -1864,14 +1860,9 @@ bool ArrowAdapter::_set_spatial_dimensions(
"__max",
platform_config);

dims.insert({min_dim.first.name(), min_dim.first});
dims.insert({max_dim.first.name(), max_dim.first});

use_current_domain &= min_dim.second;
use_current_domain &= max_dim.second;
dims.insert({min_dim.name(), min_dim});
dims.insert({max_dim.name(), max_dim});
}

return use_current_domain;
}

} // namespace tiledbsoma
7 changes: 3 additions & 4 deletions libtiledbsoma/src/utils/arrow_adapter.h
Original file line number Diff line number Diff line change
Expand Up @@ -265,10 +265,9 @@ class ArrowAdapter {
/**
* @brief Get a TileDB dimension from an Arrow schema.
*
* @return std::pair<Dimension, bool> The TileDB dimension with a boolean
* flag indicating whether or not the dimension uses `current domain`.
* @return std::pair<Dimension, bool> The TileDB dimension.
*/
static std::pair<Dimension, bool> tiledb_dimension_from_arrow_schema(
static Dimension tiledb_dimension_from_arrow_schema(
std::shared_ptr<Context> ctx,
ArrowSchema* schema,
ArrowArray* array,
Expand Down Expand Up @@ -780,7 +779,7 @@ class ArrowAdapter {
int64_t column_index,
int64_t expected_n_buffers);

static bool _set_spatial_dimensions(
static void _set_spatial_dimensions(
std::map<std::string, Dimension>& dims,
const ArrowTable& spatial_column_info,
std::string_view type_metadata,
Expand Down

0 comments on commit 78741e3

Please sign in to comment.