2011-11-07 01:15:37 +00:00
|
|
|
|
#pragma once
|
|
|
|
|
|
2017-03-07 18:57:15 +00:00
|
|
|
|
#include <DB/Columns/ColumnAggregateFunction.h>
|
2011-11-07 01:15:37 +00:00
|
|
|
|
#include <DB/Columns/ColumnConst.h>
|
2017-03-07 18:57:15 +00:00
|
|
|
|
#include <DB/Columns/ColumnString.h>
|
2012-08-23 18:43:57 +00:00
|
|
|
|
#include <DB/Columns/ColumnTuple.h>
|
2011-11-07 01:15:37 +00:00
|
|
|
|
#include <DB/Functions/IFunction.h>
|
2016-09-16 22:00:30 +00:00
|
|
|
|
#include <DB/Functions/NumberTraits.h>
|
2015-05-04 17:52:19 +00:00
|
|
|
|
#include <DB/Interpreters/ExpressionActions.h>
|
2017-01-14 09:00:19 +00:00
|
|
|
|
|
2016-01-11 21:46:36 +00:00
|
|
|
|
|
2017-03-10 13:13:32 +00:00
|
|
|
|
namespace DB
|
2014-09-23 15:28:21 +00:00
|
|
|
|
{
|
2017-03-10 13:13:32 +00:00
|
|
|
|
class FunctionTuple : public IFunction
|
2013-12-17 13:49:21 +00:00
|
|
|
|
{
|
|
|
|
|
public:
|
2017-03-10 13:13:32 +00:00
|
|
|
|
static constexpr auto name = "tuple";
|
2017-03-07 18:57:15 +00:00
|
|
|
|
static FunctionPtr create(const Context & context);
|
2014-11-12 17:23:26 +00:00
|
|
|
|
|
2015-10-11 23:36:45 +00:00
|
|
|
|
String getName() const override
|
2013-12-17 13:49:21 +00:00
|
|
|
|
{
|
2014-11-12 17:23:26 +00:00
|
|
|
|
return name;
|
2013-12-17 13:49:21 +00:00
|
|
|
|
}
|
|
|
|
|
|
2017-03-10 13:13:32 +00:00
|
|
|
|
bool isVariadic() const override
|
2016-08-17 13:38:33 +00:00
|
|
|
|
{
|
|
|
|
|
return true;
|
|
|
|
|
}
|
|
|
|
|
|
2017-03-07 18:57:15 +00:00
|
|
|
|
size_t getNumberOfArguments() const override
|
2011-11-07 01:15:37 +00:00
|
|
|
|
{
|
2017-03-10 13:13:32 +00:00
|
|
|
|
return 0;
|
2012-07-15 23:13:08 +00:00
|
|
|
|
}
|
|
|
|
|
|
2017-03-10 13:13:32 +00:00
|
|
|
|
bool isInjective(const Block &) override
|
2016-12-30 05:13:14 +00:00
|
|
|
|
{
|
|
|
|
|
return true;
|
|
|
|
|
}
|
|
|
|
|
|
|
|
|
|
bool hasSpecialSupportForNulls() const override
|
|
|
|
|
{
|
|
|
|
|
return true;
|
|
|
|
|
}
|
|
|
|
|
|
2017-03-07 18:57:15 +00:00
|
|
|
|
DataTypePtr getReturnTypeImpl(const DataTypes & arguments) const override;
|
2012-08-03 19:40:08 +00:00
|
|
|
|
|
2017-03-07 18:57:15 +00:00
|
|
|
|
void executeImpl(Block & block, const ColumnNumbers & arguments, size_t result) override;
|
2012-08-03 19:40:08 +00:00
|
|
|
|
};
|
|
|
|
|
|
2012-08-23 18:05:31 +00:00
|
|
|
|
|
2017-03-10 13:13:32 +00:00
|
|
|
|
/** Создаёт массив, размножая столбец (первый аргумент) по количеству элементов в массиве (втором аргументе).
|
|
|
|
|
* Используется только в качестве prerequisites для функций высшего порядка.
|
|
|
|
|
*/
|
|
|
|
|
class FunctionReplicate : public IFunction
|
2012-08-23 18:05:31 +00:00
|
|
|
|
{
|
|
|
|
|
public:
|
2017-03-10 13:13:32 +00:00
|
|
|
|
static constexpr auto name = "replicate";
|
2017-03-07 18:57:15 +00:00
|
|
|
|
static FunctionPtr create(const Context & context);
|
2014-06-26 00:58:14 +00:00
|
|
|
|
|
2015-10-11 23:36:45 +00:00
|
|
|
|
String getName() const override
|
2012-08-23 18:05:31 +00:00
|
|
|
|
{
|
2014-11-12 17:23:26 +00:00
|
|
|
|
return name;
|
2012-08-23 18:05:31 +00:00
|
|
|
|
}
|
|
|
|
|
|
2017-03-07 18:57:15 +00:00
|
|
|
|
size_t getNumberOfArguments() const override
|
2012-08-23 18:05:31 +00:00
|
|
|
|
{
|
2017-03-07 18:57:15 +00:00
|
|
|
|
return 2;
|
2012-08-23 18:05:31 +00:00
|
|
|
|
}
|
|
|
|
|
|
2017-03-07 18:57:15 +00:00
|
|
|
|
DataTypePtr getReturnTypeImpl(const DataTypes & arguments) const override;
|
2016-07-10 05:50:09 +00:00
|
|
|
|
|
2017-03-07 18:57:15 +00:00
|
|
|
|
void executeImpl(Block & block, const ColumnNumbers & arguments, size_t result) override;
|
2012-08-23 18:43:57 +00:00
|
|
|
|
};
|
2011-11-07 01:15:37 +00:00
|
|
|
|
}
|