diff --git a/.gitmodules b/.gitmodules index 75338652f01..4df7798e1e7 100644 --- a/.gitmodules +++ b/.gitmodules @@ -234,4 +234,3 @@ [submodule "contrib/s2geometry"] path = contrib/s2geometry url = https://github.com/ClickHouse-Extras/s2geometry.git - branch = master diff --git a/src/Functions/S2CapContains.cpp b/src/Functions/S2CapContains.cpp index 1c4a0444c90..b79bb6a7af4 100644 --- a/src/Functions/S2CapContains.cpp +++ b/src/Functions/S2CapContains.cpp @@ -47,33 +47,37 @@ public: size_t number_of_arguments = arguments.size(); if (number_of_arguments != 3) { - throw Exception("Number of arguments for function " + getName() + " doesn't match: passed " - + toString(number_of_arguments) + ", should be 3", - ErrorCodes::NUMBER_OF_ARGUMENTS_DOESNT_MATCH); + throw Exception(ErrorCodes::NUMBER_OF_ARGUMENTS_DOESNT_MATCH, + "Number of arguments for function {} doesn't match: passed {}, should be 3", + getName(), + toString(number_of_arguments)); } const auto * arg = arguments[0].get(); if (!WhichDataType(arg).isUInt64()) { throw Exception( - fmt::format("Illegal type {} of argument {} of function {}. Must be UInt64", arg->getName(), 1, getName()), - ErrorCodes::ILLEGAL_TYPE_OF_ARGUMENT); + ErrorCodes::ILLEGAL_TYPE_OF_ARGUMENT, + "Illegal type {} of argument {} of function {}. Must be UInt64", + arg->getName(), 1, getName()); } arg = arguments[1].get(); if (!WhichDataType(arg).isFloat64()) { throw Exception( - "Illegal type " + arg->getName() + " of argument " + std::to_string(2) + " of function " + getName() + ". Must be Float64", - ErrorCodes::ILLEGAL_TYPE_OF_ARGUMENT); + ErrorCodes::ILLEGAL_TYPE_OF_ARGUMENT, + "Illegal type {} of argument {} of function {}. Must be Float64", + arg->getName(), 2, getName()); } arg = arguments[2].get(); if (!WhichDataType(arg).isUInt64()) { throw Exception( - "Illegal type " + arg->getName() + " of argument " + std::to_string(3) + " of function " + getName() + ". Must be UInt64", - ErrorCodes::ILLEGAL_TYPE_OF_ARGUMENT); + ErrorCodes::ILLEGAL_TYPE_OF_ARGUMENT, + "Illegal type {} of argument {} of function {}. Must be UInt64", + arg->getName(), 3, getName()); } return std::make_shared(); diff --git a/src/Functions/S2RectIntersection.cpp b/src/Functions/S2RectIntersection.cpp index c4f7dc0baa8..c9404a70fc6 100644 --- a/src/Functions/S2RectIntersection.cpp +++ b/src/Functions/S2RectIntersection.cpp @@ -1,4 +1,8 @@ -#include "config_functions.h" +#if !defined(ARCADIA_BUILD) +# include "config_functions.h" +#endif + +#if USE_S2_GEOMETRY #include #include @@ -49,41 +53,46 @@ public: size_t number_of_arguments = arguments.size(); if (number_of_arguments != 4) { - throw Exception("Number of arguments for function " + getName() + " doesn't match: passed " - + toString(number_of_arguments) + ", should be 4", - ErrorCodes::NUMBER_OF_ARGUMENTS_DOESNT_MATCH); + throw Exception( + ErrorCodes::NUMBER_OF_ARGUMENTS_DOESNT_MATCH, + "Number of arguments for function {} doesn't match: passed {}, should be 4", + getName(), number_of_arguments); } const auto * arg = arguments[0].get(); if (!WhichDataType(arg).isUInt64()) { throw Exception( - "Illegal type " + arg->getName() + " of argument " + std::to_string(1) + " of function " + getName() + ". Must be UInt64", - ErrorCodes::ILLEGAL_TYPE_OF_ARGUMENT); + ErrorCodes::ILLEGAL_TYPE_OF_ARGUMENT, + "Illegal type {} of argument {} of function {}. Must be UInt64", + arg->getName(), 1, getName()); } arg = arguments[1].get(); if (!WhichDataType(arg).isUInt64()) { throw Exception( - "Illegal type " + arg->getName() + " of argument " + std::to_string(2) + " of function " + getName() + ". Must be UInt64", - ErrorCodes::ILLEGAL_TYPE_OF_ARGUMENT); + ErrorCodes::ILLEGAL_TYPE_OF_ARGUMENT, + "Illegal type {} of argument {} of function {}. Must be UInt64", + arg->getName(), 2, getName()); } arg = arguments[2].get(); if (!WhichDataType(arg).isUInt64()) { throw Exception( - "Illegal type " + arg->getName() + " of argument " + std::to_string(3) + " of function " + getName() + ". Must be UInt64", - ErrorCodes::ILLEGAL_TYPE_OF_ARGUMENT); + ErrorCodes::ILLEGAL_TYPE_OF_ARGUMENT, + "Illegal type {} of argument {} of function {}. Must be UInt64", + arg->getName(), 3, getName()); } arg = arguments[3].get(); if (!WhichDataType(arg).isUInt64()) { throw Exception( - "Illegal type " + arg->getName() + " of argument " + std::to_string(4) + " of function " + getName() + ". Must be UInt64", - ErrorCodes::ILLEGAL_TYPE_OF_ARGUMENT); + ErrorCodes::ILLEGAL_TYPE_OF_ARGUMENT, + "Illegal type {} of argument {} of function {}. Must be UInt64", + arg->getName(), 4, getName()); } DataTypePtr element = std::make_shared(); @@ -142,3 +151,5 @@ void registerFunctionS2RectIntersection(FunctionFactory & factory) } + +#endif diff --git a/src/Functions/S2RectUnion.cpp b/src/Functions/S2RectUnion.cpp index 17860bc1e9b..54fc0d727a0 100644 --- a/src/Functions/S2RectUnion.cpp +++ b/src/Functions/S2RectUnion.cpp @@ -49,41 +49,46 @@ public: size_t number_of_arguments = arguments.size(); if (number_of_arguments != 4) { - throw Exception("Number of arguments for function " + getName() + " doesn't match: passed " - + toString(number_of_arguments) + ", should be 4", - ErrorCodes::NUMBER_OF_ARGUMENTS_DOESNT_MATCH); + throw Exception( + ErrorCodes::NUMBER_OF_ARGUMENTS_DOESNT_MATCH, + "Number of arguments for function {} doesn't match: passed {}, should be 4", + getName(), number_of_arguments); } const auto * arg = arguments[0].get(); if (!WhichDataType(arg).isUInt64()) { throw Exception( - "Illegal type " + arg->getName() + " of argument " + std::to_string(1) + " of function " + getName() + ". Must be UInt64", - ErrorCodes::ILLEGAL_TYPE_OF_ARGUMENT); + ErrorCodes::ILLEGAL_TYPE_OF_ARGUMENT, + "Illegal type {} of argument {} of function {}. Must be UInt64", + arg->getName(), 1, getName()); } arg = arguments[1].get(); if (!WhichDataType(arg).isUInt64()) { throw Exception( - "Illegal type " + arg->getName() + " of argument " + std::to_string(2) + " of function " + getName() + ". Must be UInt64", - ErrorCodes::ILLEGAL_TYPE_OF_ARGUMENT); + ErrorCodes::ILLEGAL_TYPE_OF_ARGUMENT, + "Illegal type {} of argument {} of function {}. Must be UInt64", + arg->getName(), 2, getName()); } arg = arguments[2].get(); if (!WhichDataType(arg).isUInt64()) { throw Exception( - "Illegal type " + arg->getName() + " of argument " + std::to_string(3) + " of function " + getName() + ". Must be UInt64", - ErrorCodes::ILLEGAL_TYPE_OF_ARGUMENT); + ErrorCodes::ILLEGAL_TYPE_OF_ARGUMENT, + "Illegal type {} of argument {} of function {}. Must be UInt64", + arg->getName(), 3, getName()); } arg = arguments[3].get(); if (!WhichDataType(arg).isUInt64()) { throw Exception( - "Illegal type " + arg->getName() + " of argument " + std::to_string(4) + " of function " + getName() + ". Must be UInt64", - ErrorCodes::ILLEGAL_TYPE_OF_ARGUMENT); + ErrorCodes::ILLEGAL_TYPE_OF_ARGUMENT, + "Illegal type {} of argument {} of function {}. Must be UInt64", + arg->getName(), 4, getName()); } DataTypePtr element = std::make_shared(); diff --git a/src/Functions/S2ToGeo.cpp b/src/Functions/S2ToGeo.cpp index 73f455b38db..dcf708d334c 100644 --- a/src/Functions/S2ToGeo.cpp +++ b/src/Functions/S2ToGeo.cpp @@ -49,17 +49,19 @@ public: size_t number_of_arguments = arguments.size(); if (number_of_arguments != 1) { - throw Exception("Number of arguments for function " + getName() + " doesn't match: passed " - + toString(number_of_arguments) + ", should be 2", - ErrorCodes::NUMBER_OF_ARGUMENTS_DOESNT_MATCH); + throw Exception( + ErrorCodes::NUMBER_OF_ARGUMENTS_DOESNT_MATCH, + "Number of arguments for function {} doesn't match: passed {}, should be 2", + getName(), number_of_arguments); } const auto * arg = arguments[0].get(); if (!WhichDataType(arg).isUInt64()) { throw Exception( - "Illegal type " + arg->getName() + " of argument " + std::to_string(1) + " of function " + getName() + ". Must be Float64", - ErrorCodes::ILLEGAL_TYPE_OF_ARGUMENT); + ErrorCodes::ILLEGAL_TYPE_OF_ARGUMENT, + "Illegal type {} of argument {} of function {}. Must be Float64", + arg->getName(), 1, getName()); } DataTypePtr element = std::make_shared(); diff --git a/src/Functions/radiansToS2.cpp b/src/Functions/radiansToS2.cpp index 2b6a03c4afa..9ff8e27dee9 100644 --- a/src/Functions/radiansToS2.cpp +++ b/src/Functions/radiansToS2.cpp @@ -47,24 +47,27 @@ public: size_t number_of_arguments = arguments.size(); if (number_of_arguments != 2) { - throw Exception("Number of arguments for function " + getName() + " doesn't match: passed " - + toString(number_of_arguments) + ", should be 2", - ErrorCodes::NUMBER_OF_ARGUMENTS_DOESNT_MATCH); + throw Exception( + ErrorCodes::NUMBER_OF_ARGUMENTS_DOESNT_MATCH, + "Number of arguments for function {} doesn't match: passed {}, should be 2", + getName(), number_of_arguments); } const auto * arg = arguments[0].get(); if (!WhichDataType(arg).isFloat64()) { throw Exception( - "Illegal type " + arg->getName() + " of argument " + std::to_string(1) + " of function " + getName() + ". Must be Float64", - ErrorCodes::ILLEGAL_TYPE_OF_ARGUMENT); + ErrorCodes::ILLEGAL_TYPE_OF_ARGUMENT, + "Illegal type {} of argument {} of function {}. Must be Float64", + arg->getName(), 1, getName()); } arg = arguments[1].get(); if (!WhichDataType(arg).isFloat64()) { throw Exception( - "Illegal type " + arg->getName() + " of argument " + std::to_string(2) + " of function " + getName() + ". Must be Float64", - ErrorCodes::ILLEGAL_TYPE_OF_ARGUMENT); + ErrorCodes::ILLEGAL_TYPE_OF_ARGUMENT, + "Illegal type {} of argument {} of function {}. Must be Float64", + arg->getName(), 2, getName()); } return std::make_shared(); diff --git a/src/Functions/registerFunctionsGeo.cpp b/src/Functions/registerFunctionsGeo.cpp index 2fcbb3f20db..e1ba1515871 100644 --- a/src/Functions/registerFunctionsGeo.cpp +++ b/src/Functions/registerFunctionsGeo.cpp @@ -42,6 +42,7 @@ void registerFunctionH3ToString(FunctionFactory &); void registerFunctionH3HexAreaM2(FunctionFactory &); #endif +#if USE_S2_GEOMETRY void registerFunctionDegreesToS2(FunctionFactory &); void registerFunctionRadiansToS2(FunctionFactory &); void registerFunctionS2GetNeighbors(FunctionFactory &); @@ -53,6 +54,7 @@ void registerFunctionS2RectAdd(FunctionFactory &); void registerFunctionS2RectContains(FunctionFactory &); void registerFunctionS2RectUnion(FunctionFactory &); void registerFunctionS2RectIntersection(FunctionFactory &); +#endif void registerFunctionsGeo(FunctionFactory & factory) @@ -92,6 +94,7 @@ void registerFunctionsGeo(FunctionFactory & factory) registerFunctionH3HexAreaM2(factory); #endif +#if USE_S2_GEOMETRY registerFunctionDegreesToS2(factory); registerFunctionRadiansToS2(factory); registerFunctionS2GetNeighbors(factory); @@ -103,6 +106,7 @@ void registerFunctionsGeo(FunctionFactory & factory) registerFunctionS2RectContains(factory); registerFunctionS2RectUnion(factory); registerFunctionS2RectIntersection(factory); +#endif } }