mirror of
https://github.com/ClickHouse/ClickHouse.git
synced 2024-11-24 00:22:29 +00:00
Rename file to MergeTreeIndexUSearch.h/cpp
This commit is contained in:
parent
f420006e09
commit
42644bfbf5
@ -1,6 +1,6 @@
|
||||
#ifdef ENABLE_USEARCH
|
||||
|
||||
#include <Storages/MergeTree/MergeTreeIndexHnsw.h>
|
||||
#include <Storages/MergeTree/MergeTreeIndexUSearch.h>
|
||||
|
||||
#include <Columns/ColumnArray.h>
|
||||
#include <Common/typeid_cast.h>
|
||||
@ -25,7 +25,6 @@ namespace ErrorCodes
|
||||
extern const int LOGICAL_ERROR;
|
||||
}
|
||||
|
||||
|
||||
template <unum::usearch::metric_kind_t Metric>
|
||||
USearchIndexWithSerialization<Metric>::USearchIndexWithSerialization(size_t dimensions)
|
||||
: Base(Base::make(unum::usearch::metric_punned_t(dimensions, Metric)))
|
||||
@ -64,17 +63,24 @@ size_t USearchIndexWithSerialization<Metric>::getDimensions() const
|
||||
return Base::dimensions();
|
||||
}
|
||||
|
||||
|
||||
template <unum::usearch::metric_kind_t Metric>
|
||||
MergeTreeIndexGranuleUSearch<Metric>::MergeTreeIndexGranuleUSearch(const String & index_name_, const Block & index_sample_block_)
|
||||
: index_name(index_name_), index_sample_block(index_sample_block_), index(nullptr)
|
||||
MergeTreeIndexGranuleUSearch<Metric>::MergeTreeIndexGranuleUSearch(
|
||||
const String & index_name_,
|
||||
const Block & index_sample_block_)
|
||||
: index_name(index_name_)
|
||||
, index_sample_block(index_sample_block_)
|
||||
, index(nullptr)
|
||||
{
|
||||
}
|
||||
|
||||
template <unum::usearch::metric_kind_t Metric>
|
||||
MergeTreeIndexGranuleUSearch<Metric>::MergeTreeIndexGranuleUSearch(
|
||||
const String & index_name_, const Block & index_sample_block_, USearchIndexWithSerializationPtr<Metric> index_)
|
||||
: index_name(index_name_), index_sample_block(index_sample_block_), index(std::move(index_))
|
||||
const String & index_name_,
|
||||
const Block & index_sample_block_,
|
||||
USearchIndexWithSerializationPtr<Metric> index_)
|
||||
: index_name(index_name_)
|
||||
, index_sample_block(index_sample_block_)
|
||||
, index(std::move(index_))
|
||||
{
|
||||
}
|
||||
|
||||
@ -97,8 +103,11 @@ void MergeTreeIndexGranuleUSearch<Metric>::deserializeBinary(ReadBuffer & istr,
|
||||
}
|
||||
|
||||
template <unum::usearch::metric_kind_t Metric>
|
||||
MergeTreeIndexAggregatorUSearch<Metric>::MergeTreeIndexAggregatorUSearch(const String & index_name_, const Block & index_sample_block_)
|
||||
: index_name(index_name_), index_sample_block(index_sample_block_)
|
||||
MergeTreeIndexAggregatorUSearch<Metric>::MergeTreeIndexAggregatorUSearch(
|
||||
const String & index_name_,
|
||||
const Block & index_sample_block_)
|
||||
: index_name(index_name_)
|
||||
, index_sample_block(index_sample_block_)
|
||||
{
|
||||
}
|
||||
|
||||
@ -191,10 +200,13 @@ void MergeTreeIndexAggregatorUSearch<Metric>::update(const Block & block, size_t
|
||||
*pos += rows_read;
|
||||
}
|
||||
|
||||
|
||||
MergeTreeIndexConditionUSearch::MergeTreeIndexConditionUSearch(
|
||||
const IndexDescription & /*index_description*/, const SelectQueryInfo & query, const String & distance_function_, ContextPtr context)
|
||||
: ann_condition(query, context), distance_function(distance_function_)
|
||||
const IndexDescription & /*index_description*/,
|
||||
const SelectQueryInfo & query,
|
||||
const String & distance_function_,
|
||||
ContextPtr context)
|
||||
: ann_condition(query, context)
|
||||
, distance_function(distance_function_)
|
||||
{
|
||||
}
|
||||
|
||||
@ -265,11 +277,11 @@ std::vector<size_t> MergeTreeIndexConditionUSearch::getUsefulRangesImpl(MergeTre
|
||||
}
|
||||
|
||||
MergeTreeIndexUSearch::MergeTreeIndexUSearch(const IndexDescription & index_, const String & distance_function_)
|
||||
: IMergeTreeIndex(index_), distance_function(distance_function_)
|
||||
: IMergeTreeIndex(index_)
|
||||
, distance_function(distance_function_)
|
||||
{
|
||||
}
|
||||
|
||||
|
||||
MergeTreeIndexGranulePtr MergeTreeIndexUSearch::createIndexGranule() const
|
||||
{
|
||||
if (distance_function == DISTANCE_FUNCTION_L2)
|
||||
@ -356,6 +368,7 @@ void usearchIndexValidator(const IndexDescription & index, bool /* attach */)
|
||||
else
|
||||
throw_unsupported_underlying_column_exception();
|
||||
}
|
||||
|
||||
}
|
||||
|
||||
#endif
|
@ -28,8 +28,7 @@ template <unum::usearch::metric_kind_t Metric>
|
||||
struct MergeTreeIndexGranuleUSearch final : public IMergeTreeIndexGranule
|
||||
{
|
||||
MergeTreeIndexGranuleUSearch(const String & index_name_, const Block & index_sample_block_);
|
||||
MergeTreeIndexGranuleUSearch(
|
||||
const String & index_name_, const Block & index_sample_block_, USearchIndexWithSerializationPtr<Metric> index_);
|
||||
MergeTreeIndexGranuleUSearch(const String & index_name_, const Block & index_sample_block_, USearchIndexWithSerializationPtr<Metric> index_);
|
||||
|
||||
~MergeTreeIndexGranuleUSearch() override = default;
|
||||
|
||||
@ -62,8 +61,7 @@ struct MergeTreeIndexAggregatorUSearch final : IMergeTreeIndexAggregator
|
||||
class MergeTreeIndexConditionUSearch final : public IMergeTreeIndexConditionApproximateNearestNeighbor
|
||||
{
|
||||
public:
|
||||
MergeTreeIndexConditionUSearch(
|
||||
const IndexDescription & index_description, const SelectQueryInfo & query, const String & distance_function, ContextPtr context);
|
||||
MergeTreeIndexConditionUSearch(const IndexDescription & index_description, const SelectQueryInfo & query, const String & distance_function, ContextPtr context);
|
||||
|
||||
~MergeTreeIndexConditionUSearch() override = default;
|
||||
|
||||
@ -101,3 +99,4 @@ private:
|
||||
}
|
||||
|
||||
#endif
|
||||
|
Loading…
Reference in New Issue
Block a user