Fix abtesting build

This commit is contained in:
alesapin 2020-07-29 14:00:04 +03:00
parent 3a0d44b5b9
commit d52f67d24e
7 changed files with 51 additions and 8 deletions

20
cmake/find/stats.cmake Normal file
View File

@ -0,0 +1,20 @@
option(ENABLE_STATS "Enalbe StatsLib library" ${ENABLE_LIBRARIES})
if (ENABLE_STATS)
if (NOT EXISTS "${ClickHouse_SOURCE_DIR}/contrib/stats")
message (WARNING "submodule contrib/stats is missing. to fix try run: \n git submodule update --init --recursive")
set (ENABLE_STATS 0)
set (USE_STATS 0)
elseif (NOT EXISTS "${ClickHouse_SOURCE_DIR}/contrib/gcem")
message (WARNING "submodule contrib/gcem is missing. to fix try run: \n git submodule update --init --recursive")
set (ENABLE_STATS 0)
set (USE_STATS 0)
else()
set(STATS_INCLUDE_DIR ${ClickHouse_SOURCE_DIR}/contrib/stats/include)
set(GCEM_INCLUDE_DIR ${ClickHouse_SOURCE_DIR}/contrib/gcem/include)
set (USE_STATS 1)
endif()
endif()
message (STATUS "Using stats=${USE_STATS} : ${STATS_INCLUDE_DIR}")
message (STATUS "Using gcem=${USE_STATS}: ${GCEM_INCLUDE_DIR}")

View File

@ -306,6 +306,8 @@ if (USE_SENTRY)
endif()
add_subdirectory (fmtlib-cmake)
add_subdirectory (stats-cmake)
add_subdirectory (gcem)
if (USE_STATS)
add_subdirectory (stats-cmake)
add_subdirectory (gcem)
endif()

View File

@ -1,6 +1,5 @@
# The stats is a header-only library of probability density functions,
# The stats is a header-only library of probability density functions,
# cumulative distribution functions, quantile functions, and random sampling methods.
set(STATS_INCLUDE_DIR ${ClickHouse_SOURCE_DIR}/contrib/stats/include)
set(GCEM_INCLUDE_DIR ${ClickHouse_SOURCE_DIR}/contrib/gcem/include)

View File

@ -12,4 +12,5 @@
#cmakedefine01 USE_CASSANDRA
#cmakedefine01 USE_SENTRY
#cmakedefine01 USE_GRPC
#cmakedefine01 USE_STATS
#cmakedefine01 CLICKHOUSE_SPLIT_BINARY

View File

@ -112,4 +112,6 @@ target_link_libraries(clickhouse_functions PRIVATE clickhouse_functions_url)
add_subdirectory(array)
target_link_libraries(clickhouse_functions PRIVATE clickhouse_functions_array)
target_link_libraries(clickhouse_functions PRIVATE stats)
if (USE_STATS)
target_link_libraries(clickhouse_functions PRIVATE stats)
endif()

View File

@ -1,4 +1,6 @@
#if !defined(ARCADIA_BUILD)
#include <Functions/abtesting.h>
#if !defined(ARCADIA_BUILD) && USE_STATS
#include <math.h>
#include <sstream>
@ -9,7 +11,6 @@
#include <Columns/ColumnsNumber.h>
#include <Functions/FunctionFactory.h>
#include <Functions/FunctionHelpers.h>
#include <Functions/abtesting.h>
#include <IO/WriteHelpers.h>
#include <IO/WriteBufferFromOStream.h>
@ -304,4 +305,17 @@ void registerFunctionBayesAB(FunctionFactory & factory)
}
#else
namespace DB
{
class FunctionFactory;
void registerFunctionBayesAB(FunctionFactory & /* factory */)
{
}
}
#endif

View File

@ -1,6 +1,10 @@
#if !defined(ARCADIA_BUILD)
#pragma once
#include <Common/config.h>
#if !defined(ARCADIA_BUILD) && USE_STATS
#include <iostream>
#include <vector>
#include <algorithm>
@ -28,4 +32,5 @@ Variants bayesian_ab_test(String distribution, PODArray<Float64> & xs, PODArray<
String convertToJson(const PODArray<String> & variant_names, const Variants & variants);
}
#endif