mirror of
https://github.com/ClickHouse/ClickHouse.git
synced 2024-11-21 23:21:59 +00:00
try to add spotify-annoy
This commit is contained in:
parent
dd1df58559
commit
4a9fbdf4dc
3
.gitmodules
vendored
3
.gitmodules
vendored
@ -262,3 +262,6 @@
|
||||
[submodule "contrib/minizip-ng"]
|
||||
path = contrib/minizip-ng
|
||||
url = https://github.com/zlib-ng/minizip-ng
|
||||
[submodule "contrib/spotify-annoy"]
|
||||
path = contrib/spotify-annoy
|
||||
url = https://github.com/spotify/annoy.git
|
||||
|
1
contrib/CMakeLists.txt
vendored
1
contrib/CMakeLists.txt
vendored
@ -89,6 +89,7 @@ add_contrib (protobuf-cmake protobuf)
|
||||
add_contrib (openldap-cmake openldap)
|
||||
add_contrib (grpc-cmake grpc)
|
||||
add_contrib (msgpack-c-cmake msgpack-c)
|
||||
add_contrib (spotify-annoy-cmake spotify-annoy)
|
||||
|
||||
if (ENABLE_FUZZING)
|
||||
add_contrib (libprotobuf-mutator-cmake libprotobuf-mutator)
|
||||
|
1
contrib/spotify-annoy
vendored
Submodule
1
contrib/spotify-annoy
vendored
Submodule
@ -0,0 +1 @@
|
||||
Subproject commit 6f6b0c84ab413337eb4d2e850a4cba637f52ccbc
|
16
contrib/spotify-annoy-cmake/CMakeLists.txt
Normal file
16
contrib/spotify-annoy-cmake/CMakeLists.txt
Normal file
@ -0,0 +1,16 @@
|
||||
cmake_minimum_required(VERSION 3.14)
|
||||
|
||||
add_library(SpotifyAnnoy INTERFACE)
|
||||
|
||||
set(SPOTIFY_ANNOY_PROJECT_DIR "${ClickHouse_SOURCE_DIR}/contrib/sporify-annoy")
|
||||
set(SPOTIFY_ANNOY_SOURCE_DIR "${SPOTIFY_ANNOY_PROJECT_DIR}/src")
|
||||
set(SPOTIFY_ANNOY_INCLUDE_DIR ${SPOTIFY_ANNOY_PROJECT_DIR}/include/annoy)
|
||||
|
||||
file(MAKE_DIRECTORY ${SPOTIFY_ANNOY_INCLUDE_DIR})
|
||||
foreach (HEADER annoylib.h kissrandom.h mman.h)
|
||||
file(COPY ${SPOTIFY_ANNOY_PROJECT_DIR}/src/${HEADER} DESTINATION ${SPOTIFY_ANNOY_INCLUDE_DIR})
|
||||
endforeach()
|
||||
|
||||
target_include_directories(SpotifyAnnoy INTERFACE include/)
|
||||
|
||||
add_library(ch::contrib::spotify-annoy ALIAS SpotifyAnnoy)
|
@ -522,6 +522,7 @@ if (TARGET ch_contrib::rapidjson)
|
||||
endif()
|
||||
|
||||
dbms_target_link_libraries(PUBLIC ch_contrib::consistent_hashing)
|
||||
dbms_target_link_libraries(PUBLIC ch_contrib::spotify-annoy)
|
||||
|
||||
include ("${ClickHouse_SOURCE_DIR}/cmake/add_check.cmake")
|
||||
|
||||
|
21
src/Storages/MergeTree/MergeTreeIndexSimpleSpotifyAnnoy.cpp
Normal file
21
src/Storages/MergeTree/MergeTreeIndexSimpleSpotifyAnnoy.cpp
Normal file
@ -0,0 +1,21 @@
|
||||
#include <Storages/MergeTree/MergeTreeIndexSimpleHnsw.h>
|
||||
|
||||
namespace DB
|
||||
{
|
||||
|
||||
namespace ErrorCodes
|
||||
{
|
||||
extern const int LOGICAL_ERROR;
|
||||
}
|
||||
|
||||
|
||||
MergeTreeIndexGranuleSimpleHnsw::MergeTreeIndexGranuleSimpleHnsw(const String & index_name_, const Block & index_sample_block_)
|
||||
: index_name(index_name_)
|
||||
, index_sample_block(index_sample_block_)
|
||||
{}
|
||||
|
||||
|
||||
void MergeTreeIndexGranuleMinMax::serializeBinary(WriteBuffer & /*ostr*/) const{}
|
||||
|
||||
void MergeTreeIndexGranuleMinMax::deserializeBinary(ReadBuffer & /*istr*/, MergeTreeIndexVersion /*version*/){}
|
||||
}
|
31
src/Storages/MergeTree/MergeTreeIndexSimpleSpotifyAnnoy.h
Normal file
31
src/Storages/MergeTree/MergeTreeIndexSimpleSpotifyAnnoy.h
Normal file
@ -0,0 +1,31 @@
|
||||
#pragma once
|
||||
|
||||
#include <Storages/MergeTree/MergeTreeIndices.h>
|
||||
#include <Storages/MergeTree/MergeTreeData.h>
|
||||
#include <Storages/MergeTree/KeyCondition.h>
|
||||
#include "Storages/MergeTree/MergeTreeIndexMinMax.h"
|
||||
|
||||
#include <memory>
|
||||
#include "object.h"
|
||||
|
||||
#include <spotify-annoy>
|
||||
|
||||
namespace DB
|
||||
{
|
||||
|
||||
struct MergeTreeIndexGranuleSimpleSpotifyAnnoy final : public IMergeTreeIndexGranule
|
||||
{
|
||||
MergeTreeIndexGranuleSimpleSpotifyAnnoy(const String & index_name_, const Block & index_sample_block_);
|
||||
~MergeTreeIndexGranuleSimpleSpotifyAnnoy() override = default;
|
||||
|
||||
void serializeBinary(WriteBuffer & ostr) const override;
|
||||
void deserializeBinary(ReadBuffer & istr, MergeTreeIndexVersion version) override;
|
||||
|
||||
bool empty() const override { return true; }
|
||||
|
||||
String index_name;
|
||||
Block index_sample_block;
|
||||
similarity::ObjectVector batch_data;
|
||||
};
|
||||
|
||||
}
|
Loading…
Reference in New Issue
Block a user