fix build

This commit is contained in:
FArthur-cmd 2022-08-30 23:09:22 +00:00
parent dadc29fb73
commit 941cceda7f
2 changed files with 3 additions and 3 deletions

View File

@ -1,6 +1,6 @@
option(ENABLE_ANNOY "Enable Annoy index support" ${ENABLE_LIBRARIES})
if (NOT ENABLE_ANNOY)
if ((NOT ENABLE_ANNOY) OR (SANITIZE STREQUAL "undefined"))
message (STATUS "Not using annoy")
return()
endif()

View File

@ -143,7 +143,7 @@ void MergeTreeIndexAggregatorAnnoy::update(const Block & block, size_t * pos, si
{
const auto & data = column_array->getData();
const auto & array = typeid_cast<const ColumnFloat32&>(data).getData();
if (array.size() == 0)
if (array.empty())
throw Exception(ErrorCodes::LOGICAL_ERROR, "Array have 0 rows, but {} expected", rows_read);
const auto & offsets = column_array->getOffsets();
size_t num_rows = offsets.size();
@ -159,7 +159,7 @@ void MergeTreeIndexAggregatorAnnoy::update(const Block & block, size_t * pos, si
}
index = std::make_shared<AnnoyIndex>(size);
index->add_item(index->get_n_items(), &array[0]);
index->add_item(index->get_n_items(), array.data());
/// add all rows from 1 to num_rows - 1 (this is the same as the beginning of the last element)
for (size_t current_row = 0; current_row < num_rows; ++current_row)
{