ClickHouse/src/Functions/replicate.h

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

45 lines
1.2 KiB
C++
Raw Normal View History

2021-02-05 11:41:44 +00:00
#pragma once
2021-05-17 07:30:42 +00:00
#include <Functions/IFunction.h>
#include <Interpreters/Context_fwd.h>
2021-02-05 11:41:44 +00:00
namespace DB
{
2021-02-10 12:45:39 +00:00
/// Creates an array, multiplying the column (the first argument) by the number of elements in the array (the second argument).
/// Function may accept more then two arguments. If so, the first array with non-empty offsets is chosen.
2021-02-05 11:41:44 +00:00
class FunctionReplicate : public IFunction
{
public:
static constexpr auto name = "replicate";
2021-06-01 12:20:52 +00:00
static FunctionPtr create(ContextPtr)
2021-02-05 11:41:44 +00:00
{
return std::make_shared<FunctionReplicate>();
}
String getName() const override
{
return name;
}
size_t getNumberOfArguments() const override
{
return 0;
}
bool isVariadic() const override { return true; }
2021-06-22 16:21:23 +00:00
bool isSuitableForShortCircuitArgumentsExecution(const DataTypesWithConstInfo & /*arguments*/) const override { return true; }
2021-02-05 11:41:44 +00:00
bool useDefaultImplementationForNulls() const override { return false; }
bool useDefaultImplementationForLowCardinalityColumns() const override { return false; }
2021-02-05 11:41:44 +00:00
DataTypePtr getReturnTypeImpl(const DataTypes & arguments) const override;
ColumnPtr executeImpl(const ColumnsWithTypeAndName & arguments, const DataTypePtr &, size_t) const override;
};
}