2017-04-01 09:19:00 +00:00
|
|
|
#include <Functions/FunctionFactory.h>
|
|
|
|
#include <Functions/FunctionsComparison.h>
|
2017-07-13 20:58:19 +00:00
|
|
|
#include <Common/typeid_cast.h>
|
2014-08-22 00:57:20 +00:00
|
|
|
|
|
|
|
namespace DB
|
|
|
|
{
|
|
|
|
|
|
|
|
void registerFunctionsComparison(FunctionFactory & factory)
|
|
|
|
{
|
2017-04-01 07:20:54 +00:00
|
|
|
factory.registerFunction<FunctionEquals>();
|
|
|
|
factory.registerFunction<FunctionNotEquals>();
|
|
|
|
factory.registerFunction<FunctionLess>();
|
|
|
|
factory.registerFunction<FunctionGreater>();
|
|
|
|
factory.registerFunction<FunctionLessOrEquals>();
|
|
|
|
factory.registerFunction<FunctionGreaterOrEquals>();
|
2014-08-22 00:57:20 +00:00
|
|
|
}
|
|
|
|
|
2016-08-05 12:30:56 +00:00
|
|
|
template <>
|
|
|
|
void FunctionComparison<EqualsOp, NameEquals>::executeTupleImpl(
|
2017-12-09 12:23:09 +00:00
|
|
|
Block & block, size_t result, const ColumnsWithTypeAndName & x, const ColumnsWithTypeAndName & y, size_t tuple_size)
|
2016-08-05 12:30:56 +00:00
|
|
|
{
|
2017-04-01 07:20:54 +00:00
|
|
|
return executeTupleEqualityImpl<FunctionComparison<EqualsOp, NameEquals>, FunctionAnd>(block, result, x, y, tuple_size);
|
2016-08-05 12:30:56 +00:00
|
|
|
}
|
|
|
|
|
|
|
|
template <>
|
|
|
|
void FunctionComparison<NotEqualsOp, NameNotEquals>::executeTupleImpl(
|
2017-12-09 12:23:09 +00:00
|
|
|
Block & block, size_t result, const ColumnsWithTypeAndName & x, const ColumnsWithTypeAndName & y, size_t tuple_size)
|
2016-08-05 12:30:56 +00:00
|
|
|
{
|
2017-04-01 07:20:54 +00:00
|
|
|
return executeTupleEqualityImpl<FunctionComparison<NotEqualsOp, NameNotEquals>, FunctionOr>(block, result, x, y, tuple_size);
|
2016-08-05 12:30:56 +00:00
|
|
|
}
|
|
|
|
|
|
|
|
template <>
|
|
|
|
void FunctionComparison<LessOp, NameLess>::executeTupleImpl(
|
2017-12-09 12:23:09 +00:00
|
|
|
Block & block, size_t result, const ColumnsWithTypeAndName & x, const ColumnsWithTypeAndName & y, size_t tuple_size)
|
2016-08-05 12:30:56 +00:00
|
|
|
{
|
2017-04-01 07:20:54 +00:00
|
|
|
return executeTupleLessGreaterImpl<
|
|
|
|
FunctionComparison<LessOp, NameLess>,
|
|
|
|
FunctionComparison<LessOp, NameLess>>(block, result, x, y, tuple_size);
|
2016-08-05 12:30:56 +00:00
|
|
|
}
|
|
|
|
|
|
|
|
template <>
|
|
|
|
void FunctionComparison<GreaterOp, NameGreater>::executeTupleImpl(
|
2017-12-09 12:23:09 +00:00
|
|
|
Block & block, size_t result, const ColumnsWithTypeAndName & x, const ColumnsWithTypeAndName & y, size_t tuple_size)
|
2016-08-05 12:30:56 +00:00
|
|
|
{
|
2017-04-01 07:20:54 +00:00
|
|
|
return executeTupleLessGreaterImpl<
|
|
|
|
FunctionComparison<GreaterOp, NameGreater>,
|
|
|
|
FunctionComparison<GreaterOp, NameGreater>>(block, result, x, y, tuple_size);
|
2016-08-05 12:30:56 +00:00
|
|
|
}
|
|
|
|
|
|
|
|
template <>
|
|
|
|
void FunctionComparison<LessOrEqualsOp, NameLessOrEquals>::executeTupleImpl(
|
2017-12-09 12:23:09 +00:00
|
|
|
Block & block, size_t result, const ColumnsWithTypeAndName & x, const ColumnsWithTypeAndName & y, size_t tuple_size)
|
2016-08-05 12:30:56 +00:00
|
|
|
{
|
2017-04-01 07:20:54 +00:00
|
|
|
return executeTupleLessGreaterImpl<
|
|
|
|
FunctionComparison<LessOp, NameLess>,
|
|
|
|
FunctionComparison<LessOrEqualsOp, NameLessOrEquals>>(block, result, x, y, tuple_size);
|
2016-08-05 12:30:56 +00:00
|
|
|
}
|
|
|
|
|
|
|
|
template <>
|
|
|
|
void FunctionComparison<GreaterOrEqualsOp, NameGreaterOrEquals>::executeTupleImpl(
|
2017-12-09 12:23:09 +00:00
|
|
|
Block & block, size_t result, const ColumnsWithTypeAndName & x, const ColumnsWithTypeAndName & y, size_t tuple_size)
|
2016-08-05 12:30:56 +00:00
|
|
|
{
|
2017-04-01 07:20:54 +00:00
|
|
|
return executeTupleLessGreaterImpl<
|
|
|
|
FunctionComparison<GreaterOp, NameGreater>,
|
|
|
|
FunctionComparison<GreaterOrEqualsOp, NameGreaterOrEquals>>(block, result, x, y, tuple_size);
|
2016-08-05 12:30:56 +00:00
|
|
|
}
|
|
|
|
|
2014-08-22 00:57:20 +00:00
|
|
|
}
|