mirror of
https://github.com/ClickHouse/ClickHouse.git
synced 2024-12-16 11:22:12 +00:00
70d1adfe4b
* save format string for NetException * format exceptions * format exceptions 2 * format exceptions 3 * format exceptions 4 * format exceptions 5 * format exceptions 6 * fix * format exceptions 7 * format exceptions 8 * Update MergeTreeIndexGin.cpp * Update AggregateFunctionMap.cpp * Update AggregateFunctionMap.cpp * fix
44 lines
1.6 KiB
C++
44 lines
1.6 KiB
C++
#include <Functions/FunctionFactory.h>
|
|
#include <Functions/FunctionsStringArray.h>
|
|
|
|
namespace DB
|
|
{
|
|
namespace ErrorCodes
|
|
{
|
|
extern const int ILLEGAL_TYPE_OF_ARGUMENT;
|
|
extern const int NUMBER_OF_ARGUMENTS_DOESNT_MATCH;
|
|
}
|
|
|
|
DataTypePtr FunctionArrayStringConcat::getReturnTypeImpl(const DataTypes & arguments) const
|
|
{
|
|
if (arguments.size() != 1 && arguments.size() != 2)
|
|
throw Exception(ErrorCodes::NUMBER_OF_ARGUMENTS_DOESNT_MATCH,
|
|
"Number of arguments for function {} doesn't match: passed {}, should be 1 or 2.",
|
|
getName(), arguments.size());
|
|
|
|
const DataTypeArray * array_type = checkAndGetDataType<DataTypeArray>(arguments[0].get());
|
|
if (!array_type)
|
|
throw Exception(ErrorCodes::ILLEGAL_TYPE_OF_ARGUMENT, "First argument for function {} must be an array.", getName());
|
|
|
|
if (arguments.size() == 2 && !isString(arguments[1]))
|
|
throw Exception(ErrorCodes::ILLEGAL_TYPE_OF_ARGUMENT, "Second argument for function {} must be constant string.", getName());
|
|
|
|
return std::make_shared<DataTypeString>();
|
|
}
|
|
|
|
REGISTER_FUNCTION(StringArray)
|
|
{
|
|
factory.registerFunction<FunctionExtractAll>();
|
|
|
|
factory.registerFunction<FunctionSplitByAlpha>();
|
|
factory.registerAlias("splitByAlpha", FunctionSplitByAlpha::name);
|
|
factory.registerFunction<FunctionSplitByNonAlpha>();
|
|
factory.registerFunction<FunctionSplitByWhitespace>();
|
|
factory.registerFunction<FunctionSplitByChar>();
|
|
factory.registerFunction<FunctionSplitByString>();
|
|
factory.registerFunction<FunctionSplitByRegexp>();
|
|
factory.registerFunction<FunctionArrayStringConcat>();
|
|
}
|
|
|
|
}
|