2011-11-07 01:15:37 +00:00
|
|
|
#pragma once
|
|
|
|
|
2017-04-01 09:19:00 +00:00
|
|
|
#include <Columns/ColumnAggregateFunction.h>
|
|
|
|
#include <Columns/ColumnConst.h>
|
|
|
|
#include <Columns/ColumnString.h>
|
|
|
|
#include <Columns/ColumnTuple.h>
|
|
|
|
#include <Functions/IFunction.h>
|
2017-07-21 06:35:58 +00:00
|
|
|
#include <Functions/FunctionHelpers.h>
|
2017-06-13 04:45:30 +00:00
|
|
|
#include <DataTypes/NumberTraits.h>
|
2017-04-01 09:19:00 +00:00
|
|
|
#include <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-04-19 03:35:11 +00:00
|
|
|
|
2017-03-10 13:13:32 +00:00
|
|
|
class FunctionTuple : public IFunction
|
2013-12-17 13:49:21 +00:00
|
|
|
{
|
|
|
|
public:
|
2017-04-01 07:20:54 +00:00
|
|
|
static constexpr auto name = "tuple";
|
|
|
|
static FunctionPtr create(const Context & context);
|
2014-11-12 17:23:26 +00:00
|
|
|
|
2017-04-01 07:20:54 +00:00
|
|
|
String getName() const override
|
|
|
|
{
|
|
|
|
return name;
|
|
|
|
}
|
2013-12-17 13:49:21 +00:00
|
|
|
|
2017-04-01 07:20:54 +00:00
|
|
|
bool isVariadic() const override
|
|
|
|
{
|
|
|
|
return true;
|
|
|
|
}
|
2016-08-17 13:38:33 +00:00
|
|
|
|
2017-04-01 07:20:54 +00:00
|
|
|
size_t getNumberOfArguments() const override
|
|
|
|
{
|
|
|
|
return 0;
|
|
|
|
}
|
2012-07-15 23:13:08 +00:00
|
|
|
|
2017-04-01 07:20:54 +00:00
|
|
|
bool isInjective(const Block &) override
|
|
|
|
{
|
|
|
|
return true;
|
|
|
|
}
|
2016-12-30 05:13:14 +00:00
|
|
|
|
2017-07-24 01:00:31 +00:00
|
|
|
bool useDefaultImplementationForNulls() const override { return false; }
|
2016-12-30 05:13:14 +00:00
|
|
|
|
2017-04-01 07:20:54 +00:00
|
|
|
DataTypePtr getReturnTypeImpl(const DataTypes & arguments) const override;
|
2012-08-03 19:40:08 +00:00
|
|
|
|
2017-04-01 07:20:54 +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-05-13 22:19:04 +00:00
|
|
|
/** 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.
|
2017-03-10 13:13:32 +00:00
|
|
|
*/
|
|
|
|
class FunctionReplicate : public IFunction
|
2012-08-23 18:05:31 +00:00
|
|
|
{
|
|
|
|
public:
|
2017-04-01 07:20:54 +00:00
|
|
|
static constexpr auto name = "replicate";
|
|
|
|
static FunctionPtr create(const Context & context);
|
2014-06-26 00:58:14 +00:00
|
|
|
|
2017-04-01 07:20:54 +00:00
|
|
|
String getName() const override
|
|
|
|
{
|
|
|
|
return name;
|
|
|
|
}
|
2012-08-23 18:05:31 +00:00
|
|
|
|
2017-04-01 07:20:54 +00:00
|
|
|
size_t getNumberOfArguments() const override
|
|
|
|
{
|
|
|
|
return 2;
|
|
|
|
}
|
2012-08-23 18:05:31 +00:00
|
|
|
|
2017-07-24 01:00:31 +00:00
|
|
|
bool useDefaultImplementationForNulls() const override { return false; }
|
2017-04-19 03:35:11 +00:00
|
|
|
|
2017-04-01 07:20:54 +00:00
|
|
|
DataTypePtr getReturnTypeImpl(const DataTypes & arguments) const override;
|
2016-07-10 05:50:09 +00:00
|
|
|
|
2017-04-01 07:20:54 +00:00
|
|
|
void executeImpl(Block & block, const ColumnNumbers & arguments, size_t result) override;
|
2012-08-23 18:43:57 +00:00
|
|
|
};
|
2017-04-19 03:35:11 +00:00
|
|
|
|
2011-11-07 01:15:37 +00:00
|
|
|
}
|