Skip to content

Commit

Permalink
v2.18.3
Browse files Browse the repository at this point in the history
  • Loading branch information
eddelbuettel committed Dec 13, 2023
1 parent 29541b0 commit 165d5b0
Show file tree
Hide file tree
Showing 36 changed files with 89 additions and 172 deletions.
3 changes: 3 additions & 0 deletions include/tiledb/api/c_api/api_external_common.h
Original file line number Diff line number Diff line change
Expand Up @@ -156,6 +156,9 @@ TILEDB_EXPORT capi_status_t tiledb_status_code(capi_return_t x);
* Invalid error argument would prevent errors from being reported correctly.
*/
#define TILEDB_INVALID_ERROR (-4)

/** Default compression level */
#define TILEDB_COMPRESSION_FILTER_DEFAULT_LEVEL (-30000)
/**@}*/

#ifdef __cplusplus
Expand Down
9 changes: 4 additions & 5 deletions include/tiledb/api/c_api/config/config_api_external.h
Original file line number Diff line number Diff line change
Expand Up @@ -164,14 +164,9 @@ TILEDB_EXPORT void tiledb_config_free(tiledb_config_t** config) TILEDB_NOEXCEPT;
* (since the resulting fragment is dense). <br>
* **Default**: 1.0
* - `sm.consolidation.buffer_size` <br>
* Deprecated. Prefer `sm.consolidation.total_buffer_size` instead.
* The size (in bytes) of the attribute buffers used during
* consolidation. <br>
* **Default**: 50,000,000
* - `sm.consolidation.total_buffer_size` <br>
* The size (in bytes) of all attribute buffers used during
* consolidation. <br>
* **Default**: 2,147,483,648
* - `sm.consolidation.max_fragment_size` <br>
* **Experimental** <br>
* The size (in bytes) of the maximum on-disk fragment size that will be
Expand Down Expand Up @@ -561,6 +556,10 @@ TILEDB_EXPORT void tiledb_config_free(tiledb_config_t** config) TILEDB_NOEXCEPT;
* from config files with support for web tokens, commonly used by EKS/ECS).
* **Default**: auto
* <br>
* - `vfs.s3.install_sigpipe_handler` <br>
* When set to `true`, the S3 SDK uses a handler that ignores SIGPIPE
* signals.
* **Default**: "true"
* - `vfs.hdfs.name_node_uri"` <br>
* Name node for HDFS. <br>
* **Default**: ""
Expand Down
2 changes: 1 addition & 1 deletion include/tiledb/api/c_api/group/group_api_external.h
Original file line number Diff line number Diff line change
Expand Up @@ -56,7 +56,7 @@ typedef struct tiledb_group_handle_t tiledb_group_t;
* @param group_uri The group URI.
* @return `TILEDB_OK` for success and `TILEDB_ERR` for error.
*/
TILEDB_EXPORT capi_return_t
TILEDB_DEPRECATED_EXPORT capi_return_t
tiledb_group_create(tiledb_ctx_t* ctx, const char* group_uri) TILEDB_NOEXCEPT;

#ifdef __cplusplus
Expand Down
95 changes: 9 additions & 86 deletions include/tiledb/api/c_api/group/group_api_external_experimental.h
Original file line number Diff line number Diff line change
Expand Up @@ -404,8 +404,7 @@ TILEDB_EXPORT capi_return_t tiledb_group_get_member_count(
tiledb_ctx_t* ctx, tiledb_group_t* group, uint64_t* count) TILEDB_NOEXCEPT;

/**
* Get a member of a group by index and details of group.
* Deprecated, use \p tiledb_group_get_member_by_index_v2 instead.
* Get a member of a group by index and details of group
*
* **Example:**
*
Expand All @@ -429,12 +428,14 @@ TILEDB_EXPORT capi_return_t tiledb_group_get_member_count(
* @param ctx The TileDB context.
* @param group An group opened in READ mode.
* @param index index of member to fetch
* @param uri URI of member.
* @param uri URI of member, The caller takes ownership
* of the c-string.
* @param type type of member
* @param name name of member. NULL if name was not set
* @param name name of member, The caller takes ownership
* of the c-string. NULL if name was not set
* @return `TILEDB_OK` for success and `TILEDB_ERR` for error.
*/
TILEDB_DEPRECATED_EXPORT capi_return_t tiledb_group_get_member_by_index(
TILEDB_EXPORT capi_return_t tiledb_group_get_member_by_index(
tiledb_ctx_t* ctx,
tiledb_group_t* group,
uint64_t index,
Expand All @@ -451,46 +452,6 @@ TILEDB_DEPRECATED_EXPORT capi_return_t tiledb_group_get_member_by_index(
* tiledb_group_t* group;
* tiledb_group_alloc(ctx, "s3://tiledb_bucket/my_group", &group);
* tiledb_group_open(ctx, group, TILEDB_WRITE);
* tiledb_group_add_member(ctx, group, "s3://tiledb_bucket/my_array");
* tiledb_group_add_member(ctx, group, "s3://tiledb_bucket/my_group_2");
*
* tiledb_group_close(ctx, group);
* tiledb_group_open(ctx, group, TILEDB_READ);
* tiledb_string_t *uri, *name;
* tiledb_object_t type;
* tiledb_group_get_member_by_index_v2(ctx, group, 0, &uri, &type, &name);
*
* tiledb_string_free(uri);
* tiledb_string_free(name);
*
* @endcode
*
* @param ctx The TileDB context.
* @param group An group opened in READ mode.
* @param index index of member to fetch
* @param uri Handle to the URI of the member.
* @param type type of member
* @param name Handle to the name of the member. NULL if name was not set
* @return `TILEDB_OK` for success and `TILEDB_ERR` for error.
*/
TILEDB_EXPORT capi_return_t tiledb_group_get_member_by_index_v2(
tiledb_ctx_t* ctx,
tiledb_group_t* group,
uint64_t index,
tiledb_string_t** uri,
tiledb_object_t* type,
tiledb_string_t** name) TILEDB_NOEXCEPT;

/**
* Get a member of a group by name and details of group.
* Deprecated, use \p tiledb_group_get_member_by_name_v2.
*
* **Example:**
*
* @code{.c}
* tiledb_group_t* group;
* tiledb_group_alloc(ctx, "s3://tiledb_bucket/my_group", &group);
* tiledb_group_open(ctx, group, TILEDB_WRITE);
* tiledb_group_add_member(ctx, group, "s3://tiledb_bucket/my_array", "array1");
* tiledb_group_add_member(ctx, group, "s3://tiledb_bucket/my_group_2",
* "group2");
Expand All @@ -508,56 +469,18 @@ TILEDB_EXPORT capi_return_t tiledb_group_get_member_by_index_v2(
* @param ctx The TileDB context.
* @param group An group opened in READ mode.
* @param name name of member to fetch
* @param uri URI of member
* @param uri URI of member, The caller takes ownership
* of the c-string.
* @param type type of member
* @return `TILEDB_OK` for success and `TILEDB_ERR` for error.
*/
TILEDB_DEPRECATED_EXPORT capi_return_t tiledb_group_get_member_by_name(
TILEDB_EXPORT capi_return_t tiledb_group_get_member_by_name(
tiledb_ctx_t* ctx,
tiledb_group_t* group,
const char* name,
char** uri,
tiledb_object_t* type) TILEDB_NOEXCEPT;

/**
* Get a member of a group by name and details of group.
*
* **Example:**
*
* @code{.c}
* tiledb_group_t* group;
* tiledb_group_alloc(ctx, "s3://tiledb_bucket/my_group", &group);
* tiledb_group_open(ctx, group, TILEDB_WRITE);
* tiledb_group_add_member(ctx, group, "s3://tiledb_bucket/my_array", "array1");
* tiledb_group_add_member(ctx, group, "s3://tiledb_bucket/my_group_2",
* "group2");
*
* tiledb_group_close(ctx, group);
* tiledb_group_open(ctx, group, TILEDB_READ);
* tilledb_string_t *uri;
* tiledb_object_t type;
* tiledb_group_get_member_by_name(ctx, group, "array1", &uri, &type);
*
* tiledb_string_free(uri);
*
* @endcode
*
* @param ctx The TileDB context.
* @param group An group opened in READ mode.
* @param name name of member to fetch
* @param uri Handle to the URI of the member.
* @param type type of member
* @return `TILEDB_OK` for success and `TILEDB_ERR` for error.
*/
TILEDB_EXPORT capi_return_t tiledb_group_get_member_by_name_v2(
tiledb_ctx_t* ctx,
tiledb_group_t* group,
const char* name,
tiledb_string_t** uri,
tiledb_object_t* type) TILEDB_NOEXCEPT;

/* (clang format was butchering the tiledb_group_add_member() calls) */
/* clang-format off */
/**
* Get a member of a group by name and relative characteristic of that name
*
Expand Down
9 changes: 4 additions & 5 deletions include/tiledb/config.h
Original file line number Diff line number Diff line change
Expand Up @@ -340,14 +340,9 @@ class Config {
* (since the resulting fragments is dense). <br>
* **Default**: 1.0
* - `sm.consolidation.buffer_size` <br>
* Deprecated. Prefer `sm.consolidation.total_buffer_size` instead.
* The size (in bytes) of the attribute buffers used during
* consolidation. <br>
* **Default**: 50,000,000
* - `sm.consolidation.total_buffer_size` <br>
* The size (in bytes) of all attribute buffers used during
* consolidation. <br>
* **Default**: 2,147,483,648
* - `sm.consolidation.max_fragment_size` <br>
* **Experimental** <br>
* The size (in bytes) of the maximum on-disk fragment size that will be
Expand Down Expand Up @@ -739,6 +734,10 @@ class Config {
* from config files with support for web tokens, commonly used by EKS/ECS).
* **Default**: auto
* <br>
* - `vfs.s3.install_sigpipe_handler` <br>
* When set to `true`, the S3 SDK uses a handler that ignores SIGPIPE
* signals.
* **Default**: "true"
* - `vfs.hdfs.name_node_uri"` <br>
* Name node for HDFS. <br>
* **Default**: ""
Expand Down
7 changes: 7 additions & 0 deletions include/tiledb/deleter.h
Original file line number Diff line number Diff line change
Expand Up @@ -149,6 +149,13 @@ class Deleter {
tiledb_consolidation_plan_free(&p);
}

void operator()(tiledb_string_t* p) const {
capi_status_t result = tiledb_status(tiledb_string_free(&p));
if (result != TILEDB_OK) {
log_warn("Could not free string; Error code: " + std::to_string(result));
}
}

void operator()(tiledb_query_channel_t* p) const {
tiledb_query_channel_free(ctx_->ptr().get(), &p);
}
Expand Down
94 changes: 36 additions & 58 deletions include/tiledb/filter.h
Original file line number Diff line number Diff line change
Expand Up @@ -33,43 +33,13 @@
#ifndef TILEDB_CPP_API_FILTER_H
#define TILEDB_CPP_API_FILTER_H

#include "exception.h"
#include "tiledb.h"
#include "type.h"

#include <iostream>
#include <string>

namespace tiledb {

template <typename Expected, typename Actual>
class FilterOptionTypeError : public TypeError {
public:
FilterOptionTypeError(tiledb_filter_option_t option)
: TypeError(
"Cannot set filter option '" + option_name(option) +
"' with type '" + tiledb::impl::type_to_tiledb<Actual>().name +
"'; Option value must be '" +
tiledb::impl::type_to_tiledb<Expected>().name + "'.") {
}

FilterOptionTypeError(
tiledb_filter_option_t option, const std::string& alternate_type)
: TypeError(
"Cannot set filter option '" + option_name(option) +
"' with type '" + tiledb::impl::type_to_tiledb<Actual>().name +
"'; Option value must be '" + alternate_type + "' or '" +
tiledb::impl::type_to_tiledb<Expected>().name + "'.") {
}

private:
static std::string option_name(tiledb_filter_option_t option) {
const char* option_name;
tiledb_filter_option_to_str(option, &option_name);
return {option_name};
}
};

/**
* Represents a filter. A filter is used to transform attribute data e.g.
* with compression, delta encoding, etc.
Expand Down Expand Up @@ -365,59 +335,67 @@ class Filter {
template <typename T>
void option_value_typecheck(tiledb_filter_option_t option) {
std::string type_name = tiledb::impl::type_to_tiledb<T>().name;
const char* option_name;
tiledb_filter_option_to_str(option, &option_name);
switch (option) {
case TILEDB_COMPRESSION_LEVEL:
if constexpr (!std::is_same_v<int32_t, T>) {
throw FilterOptionTypeError<int32_t, T>(option);
}
if constexpr (!std::is_same_v<int32_t, T>)
throw std::invalid_argument(
"Cannot set option with type '" + type_name +
"'; Option value must be int32_t.");
break;
case TILEDB_BIT_WIDTH_MAX_WINDOW:
case TILEDB_POSITIVE_DELTA_MAX_WINDOW:
if constexpr (!std::is_same_v<uint32_t, T>) {
throw FilterOptionTypeError<uint32_t, T>(option);
}
if constexpr (!std::is_same_v<uint32_t, T>)
throw std::invalid_argument(
"Cannot set option with type '" + type_name +
"'; Option value must be uint32_t.");
break;
case TILEDB_SCALE_FLOAT_BYTEWIDTH:
if constexpr (!std::is_same_v<uint64_t, T>) {
throw FilterOptionTypeError<uint64_t, T>(option);
}
if constexpr (!std::is_same_v<uint64_t, T>)
throw std::invalid_argument(
"Cannot set option with type '" + type_name +
"'; Option value must be uint64_t.");
break;
case TILEDB_SCALE_FLOAT_FACTOR:
case TILEDB_SCALE_FLOAT_OFFSET:
if constexpr (!std::is_same_v<double, T>) {
throw FilterOptionTypeError<double, T>(option);
}
if constexpr (!std::is_same_v<double, T>)
throw std::invalid_argument(
"Cannot set option with type '" + type_name +
"'; Option value must be double.");
break;
case TILEDB_WEBP_QUALITY:
if constexpr (!std::is_same_v<float, T>) {
throw FilterOptionTypeError<float, T>(option);
}
if constexpr (!std::is_same_v<float, T>)
throw std::invalid_argument(
"Cannot set option with type '" + type_name +
"'; Option value must be float.");
break;
case TILEDB_WEBP_INPUT_FORMAT:
if constexpr (
!std::is_same_v<uint8_t, T> &&
!std::is_same_v<tiledb_filter_webp_format_t, T>) {
throw FilterOptionTypeError<uint8_t, T>(
option, "tiledb_filter_webp_format_t");
}
!std::is_same_v<tiledb_filter_webp_format_t, T>)
throw std::invalid_argument(
"Cannot set option with type '" + type_name +
"'; Option value must be tiledb_filter_webp_format_t or "
"uint8_t.");
break;
case TILEDB_WEBP_LOSSLESS:
if constexpr (!std::is_same_v<uint8_t, T>) {
throw FilterOptionTypeError<uint8_t, T>(option);
}
if constexpr (!std::is_same_v<uint8_t, T>)
throw std::invalid_argument(
"Cannot set option with type '" + type_name +
"'; Option value must be uint8_t.");
break;
case TILEDB_COMPRESSION_REINTERPRET_DATATYPE:
if constexpr (
!std::is_same_v<uint8_t, T> &&
!std::is_same_v<tiledb_datatype_t, T>) {
throw FilterOptionTypeError<uint8_t, T>(option, "tiledb_datatype_t");
}
!std::is_same_v<tiledb_datatype_t, T>)
throw std::invalid_argument(
"Cannot set option with type '" + type_name +
"'; Option value must be tiledb_datatype_t or uint8_t.");
break;
default: {
const char* option_str;
tiledb_filter_option_to_str(option, &option_str);
throw std::invalid_argument(
"Invalid filter option '" + std::string(option_name) + "'");
"Invalid option '" + std::string(option_str) + "'");
}
}
}
Expand Down
8 changes: 6 additions & 2 deletions include/tiledb/fragment_info.h
Original file line number Diff line number Diff line change
Expand Up @@ -34,7 +34,6 @@
#define TILEDB_CPP_API_FRAGMENT_INFO_H

#include "array_schema.h"
#include "capi_string.h"
#include "context.h"
#include "deleter.h"
#include "exception.h"
Expand Down Expand Up @@ -98,7 +97,12 @@ class FragmentInfo {
tiledb_string_t* name;
ctx.handle_error(tiledb_fragment_info_get_fragment_name_v2(
ctx.ptr().get(), fragment_info_.get(), fid, &name));
return impl::convert_to_string(&name).value();
auto name_ptr =
std::unique_ptr<tiledb_string_t, tiledb::impl::Deleter>(name);
const char* name_c;
size_t length;
ctx.handle_error(tiledb_string_view(name_ptr.get(), &name_c, &length));
return std::string(name_c, length);
}

/**
Expand Down
Loading

0 comments on commit 165d5b0

Please sign in to comment.