From 941cceda7fd0eac06c0cca4d86c7a5cef2c03955 Mon Sep 17 00:00:00 2001 From: FArthur-cmd <613623@mail.ru> Date: Tue, 30 Aug 2022 23:09:22 +0000 Subject: [PATCH] fix build --- contrib/annoy-cmake/CMakeLists.txt | 2 +- src/Storages/MergeTree/MergeTreeIndexAnnoy.cpp | 4 ++-- 2 files changed, 3 insertions(+), 3 deletions(-) diff --git a/contrib/annoy-cmake/CMakeLists.txt b/contrib/annoy-cmake/CMakeLists.txt index 4c2c2bf565f..f2535ba7fde 100644 --- a/contrib/annoy-cmake/CMakeLists.txt +++ b/contrib/annoy-cmake/CMakeLists.txt @@ -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() diff --git a/src/Storages/MergeTree/MergeTreeIndexAnnoy.cpp b/src/Storages/MergeTree/MergeTreeIndexAnnoy.cpp index 1e5309908c2..7e254088ce5 100644 --- a/src/Storages/MergeTree/MergeTreeIndexAnnoy.cpp +++ b/src/Storages/MergeTree/MergeTreeIndexAnnoy.cpp @@ -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(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(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) {