Skip to content

Commit

Permalink
fix AddressSanitizer: FPE, fix incorrect type in create()
Browse files Browse the repository at this point in the history
  • Loading branch information
jparismorgan committed Oct 16, 2024
1 parent 3f26ae4 commit 70c0f0f
Show file tree
Hide file tree
Showing 2 changed files with 13 additions and 7 deletions.
2 changes: 1 addition & 1 deletion apis/python/src/tiledb/vector_search/ingestion.py
Original file line number Diff line number Diff line change
Expand Up @@ -3070,7 +3070,7 @@ def consolidate_and_vacuum(
uri=index_group_uri,
dimensions=dimensions,
vector_type=vector_type,
num_subspaces=num_subspaces,
num_subspaces=int(num_subspaces),
partitions=partitions,
config=config,
storage_version=storage_version,
Expand Down
18 changes: 12 additions & 6 deletions src/include/index/ivf_pq_group.h
Original file line number Diff line number Diff line change
Expand Up @@ -77,6 +77,16 @@ class ivf_pq_group : public base_index_group<index_type> {
int32_t tile_size{0};
tiledb_filter_type_t default_compression;

int32_t compute_tile_size() const {
if (this->get_dimensions() == 0) {
return (int32_t)(tile_size_bytes /
sizeof(typename index_type::feature_type) / 100);
}
return (int32_t)(tile_size_bytes /
sizeof(typename index_type::feature_type) /
this->get_dimensions());
}

public:
ivf_pq_group(
const tiledb::Context& ctx,
Expand All @@ -103,9 +113,7 @@ class ivf_pq_group : public base_index_group<index_type> {

// If we are creating a new group, we set these before load().
if (rw == TILEDB_WRITE) {
tile_size = (int32_t)(tile_size_bytes /
sizeof(typename index_type::feature_type) /
this->get_dimensions());
tile_size = compute_tile_size();
default_compression = string_to_filter(
storage_formats[this->version_]["default_attr_filters"]);
}
Expand All @@ -116,9 +124,7 @@ class ivf_pq_group : public base_index_group<index_type> {

// Else if we are reading a group, we set these after load().
if (rw == TILEDB_READ) {
tile_size = (int32_t)(tile_size_bytes /
sizeof(typename index_type::feature_type) /
this->get_dimensions());
tile_size = compute_tile_size();
default_compression = string_to_filter(
storage_formats[this->version_]["default_attr_filters"]);
}
Expand Down

0 comments on commit 70c0f0f

Please sign in to comment.