mirror of
https://github.com/ClickHouse/ClickHouse.git
synced 2024-11-19 06:01:57 +00:00
77 lines
1.7 KiB
C++
77 lines
1.7 KiB
C++
#pragma once
|
|
|
|
#include <Columns/ColumnAggregateFunction.h>
|
|
#include <Columns/ColumnConst.h>
|
|
#include <Columns/ColumnString.h>
|
|
#include <Columns/ColumnTuple.h>
|
|
#include <Functions/IFunction.h>
|
|
#include <Functions/FunctionHelpers.h>
|
|
#include <DataTypes/NumberTraits.h>
|
|
#include <Interpreters/ExpressionActions.h>
|
|
|
|
|
|
namespace DB
|
|
{
|
|
|
|
class FunctionTuple : public IFunction
|
|
{
|
|
public:
|
|
static constexpr auto name = "tuple";
|
|
static FunctionPtr create(const Context & context);
|
|
|
|
String getName() const override
|
|
{
|
|
return name;
|
|
}
|
|
|
|
bool isVariadic() const override
|
|
{
|
|
return true;
|
|
}
|
|
|
|
size_t getNumberOfArguments() const override
|
|
{
|
|
return 0;
|
|
}
|
|
|
|
bool isInjective(const Block &) override
|
|
{
|
|
return true;
|
|
}
|
|
|
|
bool useDefaultImplementationForNulls() const override { return false; }
|
|
|
|
DataTypePtr getReturnTypeImpl(const DataTypes & arguments) const override;
|
|
|
|
void executeImpl(Block & block, const ColumnNumbers & arguments, size_t result) override;
|
|
};
|
|
|
|
|
|
/** Creates an array, multiplying the column (the first argument) by the number of elements in the array (the second argument).
|
|
* Used only as prerequisites for higher-order functions.
|
|
*/
|
|
class FunctionReplicate : public IFunction
|
|
{
|
|
public:
|
|
static constexpr auto name = "replicate";
|
|
static FunctionPtr create(const Context & context);
|
|
|
|
String getName() const override
|
|
{
|
|
return name;
|
|
}
|
|
|
|
size_t getNumberOfArguments() const override
|
|
{
|
|
return 2;
|
|
}
|
|
|
|
bool useDefaultImplementationForNulls() const override { return false; }
|
|
|
|
DataTypePtr getReturnTypeImpl(const DataTypes & arguments) const override;
|
|
|
|
void executeImpl(Block & block, const ColumnNumbers & arguments, size_t result) override;
|
|
};
|
|
|
|
}
|