From 634f886740460d9e8eec8ad15b9fcc87024aad89 Mon Sep 17 00:00:00 2001 From: John Kerl Date: Tue, 10 Dec 2024 17:39:48 -0500 Subject: [PATCH] [c++] Fix upgrade-shape for dataframes with non-standard dimensions --- libtiledbsoma/src/soma/soma_array.cc | 202 +++++++++++++-------------- 1 file changed, 101 insertions(+), 101 deletions(-) diff --git a/libtiledbsoma/src/soma/soma_array.cc b/libtiledbsoma/src/soma/soma_array.cc index e25958b460..339f207a49 100644 --- a/libtiledbsoma/src/soma/soma_array.cc +++ b/libtiledbsoma/src/soma/soma_array.cc @@ -29,10 +29,10 @@ * This file defines the SOMAArray class. */ -#include "soma_array.h" #include #include "../utils/logger.h" #include "../utils/util.h" +#include "soma_array.h" #include @@ -1039,107 +1039,107 @@ void SOMAArray::_set_soma_joinid_shape_helper( } ndrect.set_range(dim_name, 0, newshape - 1); continue; + } - switch (dim.type()) { - case TILEDB_STRING_ASCII: - case TILEDB_STRING_UTF8: - case TILEDB_CHAR: - case TILEDB_GEOM_WKB: - case TILEDB_GEOM_WKT: - // See comments in soma_array.h. - ndrect.set_range(dim_name, "", "\x7f"); - break; - - case TILEDB_INT8: - ndrect.set_range( - dim_name, - dim.domain().first, - dim.domain().second); - break; - case TILEDB_BOOL: - case TILEDB_UINT8: - ndrect.set_range( - dim_name, - dim.domain().first, - dim.domain().second); - break; - case TILEDB_INT16: - ndrect.set_range( - dim_name, - dim.domain().first, - dim.domain().second); - break; - case TILEDB_UINT16: - ndrect.set_range( - dim_name, - dim.domain().first, - dim.domain().second); - break; - case TILEDB_INT32: - ndrect.set_range( - dim_name, - dim.domain().first, - dim.domain().second); - break; - case TILEDB_UINT32: - ndrect.set_range( - dim_name, - dim.domain().first, - dim.domain().second); - break; - case TILEDB_INT64: - case TILEDB_DATETIME_YEAR: - case TILEDB_DATETIME_MONTH: - case TILEDB_DATETIME_WEEK: - case TILEDB_DATETIME_DAY: - case TILEDB_DATETIME_HR: - case TILEDB_DATETIME_MIN: - case TILEDB_DATETIME_SEC: - case TILEDB_DATETIME_MS: - case TILEDB_DATETIME_US: - case TILEDB_DATETIME_NS: - case TILEDB_DATETIME_PS: - case TILEDB_DATETIME_FS: - case TILEDB_DATETIME_AS: - case TILEDB_TIME_HR: - case TILEDB_TIME_MIN: - case TILEDB_TIME_SEC: - case TILEDB_TIME_MS: - case TILEDB_TIME_US: - case TILEDB_TIME_NS: - case TILEDB_TIME_PS: - case TILEDB_TIME_FS: - case TILEDB_TIME_AS: - ndrect.set_range( - dim_name, - dim.domain().first, - dim.domain().second); - break; - case TILEDB_UINT64: - ndrect.set_range( - dim_name, - dim.domain().first, - dim.domain().second); - break; - case TILEDB_FLOAT32: - ndrect.set_range( - dim_name, - dim.domain().first, - dim.domain().second); - break; - case TILEDB_FLOAT64: - ndrect.set_range( - dim_name, - dim.domain().first, - dim.domain().second); - break; - default: - throw TileDBSOMAError(std::format( - "{}: internal error: unhandled type {} for {}.", - function_name_for_messages, - tiledb::impl::type_to_str(dim.type()), - dim_name)); - } + switch (dim.type()) { + case TILEDB_STRING_ASCII: + case TILEDB_STRING_UTF8: + case TILEDB_CHAR: + case TILEDB_GEOM_WKB: + case TILEDB_GEOM_WKT: + // See comments in soma_array.h. + ndrect.set_range(dim_name, "", "\x7f"); + break; + + case TILEDB_INT8: + ndrect.set_range( + dim_name, + dim.domain().first, + dim.domain().second); + break; + case TILEDB_BOOL: + case TILEDB_UINT8: + ndrect.set_range( + dim_name, + dim.domain().first, + dim.domain().second); + break; + case TILEDB_INT16: + ndrect.set_range( + dim_name, + dim.domain().first, + dim.domain().second); + break; + case TILEDB_UINT16: + ndrect.set_range( + dim_name, + dim.domain().first, + dim.domain().second); + break; + case TILEDB_INT32: + ndrect.set_range( + dim_name, + dim.domain().first, + dim.domain().second); + break; + case TILEDB_UINT32: + ndrect.set_range( + dim_name, + dim.domain().first, + dim.domain().second); + break; + case TILEDB_INT64: + case TILEDB_DATETIME_YEAR: + case TILEDB_DATETIME_MONTH: + case TILEDB_DATETIME_WEEK: + case TILEDB_DATETIME_DAY: + case TILEDB_DATETIME_HR: + case TILEDB_DATETIME_MIN: + case TILEDB_DATETIME_SEC: + case TILEDB_DATETIME_MS: + case TILEDB_DATETIME_US: + case TILEDB_DATETIME_NS: + case TILEDB_DATETIME_PS: + case TILEDB_DATETIME_FS: + case TILEDB_DATETIME_AS: + case TILEDB_TIME_HR: + case TILEDB_TIME_MIN: + case TILEDB_TIME_SEC: + case TILEDB_TIME_MS: + case TILEDB_TIME_US: + case TILEDB_TIME_NS: + case TILEDB_TIME_PS: + case TILEDB_TIME_FS: + case TILEDB_TIME_AS: + ndrect.set_range( + dim_name, + dim.domain().first, + dim.domain().second); + break; + case TILEDB_UINT64: + ndrect.set_range( + dim_name, + dim.domain().first, + dim.domain().second); + break; + case TILEDB_FLOAT32: + ndrect.set_range( + dim_name, + dim.domain().first, + dim.domain().second); + break; + case TILEDB_FLOAT64: + ndrect.set_range( + dim_name, + dim.domain().first, + dim.domain().second); + break; + default: + throw TileDBSOMAError(std::format( + "{}: internal error: unhandled type {} for {}.", + function_name_for_messages, + tiledb::impl::type_to_str(dim.type()), + dim_name)); } }