mirror of
https://github.com/ClickHouse/ClickHouse.git
synced 2024-12-16 11:22:12 +00:00
737357418f
- Update after IFunction interfaces changes - move type checks into FunctionCountMatches::getReturnTypeImpl() - Use StringRef over String - Separate out logic for counting sub matches into separate helper - Do not copy other regular expression matches, only the first - Add some comments - Set is_no_capture, to avoid check for number of subpatterns - Add countMatchesCaseInsensitive() - Reguster functions in case-sensitive manner, since this is not SQL standard
30 lines
707 B
C++
30 lines
707 B
C++
#include "FunctionFactory.h"
|
|
#include "countMatches.h"
|
|
|
|
namespace
|
|
{
|
|
|
|
struct FunctionCountMatchesCaseSensitive
|
|
{
|
|
static constexpr auto name = "countMatches";
|
|
static constexpr bool case_insensitive = false;
|
|
};
|
|
struct FunctionCountMatchesCaseInsensitive
|
|
{
|
|
static constexpr auto name = "countMatchesCaseInsensitive";
|
|
static constexpr bool case_insensitive = true;
|
|
};
|
|
|
|
}
|
|
|
|
namespace DB
|
|
{
|
|
|
|
void registerFunctionCountMatches(FunctionFactory & factory)
|
|
{
|
|
factory.registerFunction<FunctionCountMatches<FunctionCountMatchesCaseSensitive>>(FunctionFactory::CaseSensitive);
|
|
factory.registerFunction<FunctionCountMatches<FunctionCountMatchesCaseInsensitive>>(FunctionFactory::CaseSensitive);
|
|
}
|
|
|
|
}
|