ClickHouse/src/Functions/meiliMatch.cpp

Ignoring revisions in .git-blame-ignore-revs. Click here to bypass and see the normal blame view.

50 lines
1.6 KiB
C++
Raw Normal View History

2021-12-28 09:23:39 +00:00
#include <Columns/ColumnsNumber.h>
#include <DataTypes/DataTypesNumber.h>
#include <Functions/FunctionFactory.h>
2022-05-11 22:42:34 +00:00
#include <Functions/IFunction.h>
#include <Interpreters/Context_fwd.h>
2021-12-28 09:23:39 +00:00
namespace DB
{
namespace
{
2022-05-11 22:42:34 +00:00
// This class is a stub for the meiliMatch function in the where section of the query,
// this function is used to pass parameters to the MeiliSearch storage engine
class FunctionMeiliMatch : public IFunction
2021-12-28 09:23:39 +00:00
{
2022-05-11 22:42:34 +00:00
public:
static constexpr auto name = "meiliMatch";
static FunctionPtr create(ContextPtr) { return std::make_shared<FunctionMeiliMatch>(); }
2021-12-28 09:23:39 +00:00
2022-05-11 22:42:34 +00:00
/// Get the function name.
String getName() const override { return name; }
2021-12-28 09:23:39 +00:00
2022-05-11 22:42:34 +00:00
bool isStateful() const override { return false; }
2021-12-28 09:23:39 +00:00
2022-05-11 22:42:34 +00:00
bool isSuitableForShortCircuitArgumentsExecution(const DataTypesWithConstInfo & /*arguments*/) const override { return false; }
2021-12-28 09:23:39 +00:00
2022-05-11 22:42:34 +00:00
size_t getNumberOfArguments() const override { return 0; }
2021-12-28 09:23:39 +00:00
2022-05-11 22:42:34 +00:00
bool isVariadic() const override { return true; }
2021-12-28 09:23:39 +00:00
2022-05-11 22:42:34 +00:00
bool isDeterministic() const override { return false; }
2021-12-28 09:23:39 +00:00
2022-05-11 22:42:34 +00:00
bool isDeterministicInScopeOfQuery() const override { return false; }
2021-12-28 09:23:39 +00:00
2022-05-11 22:42:34 +00:00
DataTypePtr getReturnTypeImpl(const DataTypes & /*arguments*/) const override { return std::make_shared<DataTypeUInt8>(); }
2021-12-28 09:23:39 +00:00
2022-05-11 22:42:34 +00:00
ColumnPtr executeImpl(const ColumnsWithTypeAndName &, const DataTypePtr &, size_t input_rows_count) const override
{
return ColumnUInt8::create(input_rows_count, 1u);
}
};
2021-12-28 09:23:39 +00:00
}
REGISTER_FUNCTION(MeiliMatch)
2021-12-28 09:23:39 +00:00
{
factory.registerFunction<FunctionMeiliMatch>();
}
}