2013-05-08 09:52:02 +00:00
|
|
|
|
#pragma once
|
|
|
|
|
|
|
|
|
|
#include <DB/Columns/IColumnDummy.h>
|
2013-05-24 10:49:19 +00:00
|
|
|
|
#include <DB/Interpreters/ExpressionActions.h>
|
2013-05-08 09:52:02 +00:00
|
|
|
|
|
|
|
|
|
|
|
|
|
|
namespace DB
|
|
|
|
|
{
|
|
|
|
|
|
|
|
|
|
/** Столбец, содержащий лямбда-выражение.
|
|
|
|
|
* Ведёт себя как столбец-константа. Содержит выражение, но не входные или выходные данные.
|
|
|
|
|
*/
|
2014-06-04 01:00:09 +00:00
|
|
|
|
class ColumnExpression final : public IColumnDummy
|
2013-05-08 09:52:02 +00:00
|
|
|
|
{
|
|
|
|
|
public:
|
2013-05-24 10:49:19 +00:00
|
|
|
|
ColumnExpression(size_t s_, ExpressionActionsPtr expression_, const NamesAndTypes & arguments_, DataTypePtr return_type_, std::string return_name_)
|
2013-05-27 14:02:55 +00:00
|
|
|
|
: IColumnDummy(s_), expression(expression_), arguments(arguments_), return_type(return_type_), return_name(return_name_) {}
|
2013-05-08 09:52:02 +00:00
|
|
|
|
|
2013-06-11 16:21:25 +00:00
|
|
|
|
ColumnExpression(size_t s_, ExpressionActionsPtr expression_, const NamesAndTypesList & arguments_, DataTypePtr return_type_, std::string return_name_)
|
|
|
|
|
: IColumnDummy(s_), expression(expression_), arguments(arguments_.begin(), arguments_.end()), return_type(return_type_), return_name(return_name_) {}
|
|
|
|
|
|
2013-05-08 09:52:02 +00:00
|
|
|
|
std::string getName() const { return "ColumnExpression"; }
|
2013-05-24 10:49:19 +00:00
|
|
|
|
ColumnPtr cloneDummy(size_t s_) const { return new ColumnExpression(s_, expression, arguments, return_type, return_name); }
|
2013-05-08 09:52:02 +00:00
|
|
|
|
|
2013-06-05 10:34:59 +00:00
|
|
|
|
const ExpressionActionsPtr & getExpression() const { return expression; }
|
2013-05-08 09:52:02 +00:00
|
|
|
|
const DataTypePtr & getReturnType() const { return return_type; }
|
2013-05-20 15:42:57 +00:00
|
|
|
|
const std::string & getReturnName() const { return return_name; }
|
2013-05-08 09:52:02 +00:00
|
|
|
|
|
2013-06-20 12:27:33 +00:00
|
|
|
|
const NamesAndTypes & getArguments() const { return arguments; }
|
|
|
|
|
|
|
|
|
|
Names getArgumentNames() const
|
|
|
|
|
{
|
|
|
|
|
Names res(arguments.size());
|
|
|
|
|
for (size_t i = 0; i < arguments.size(); ++i)
|
|
|
|
|
res[i] = arguments[i].first;
|
|
|
|
|
return res;
|
|
|
|
|
}
|
|
|
|
|
|
2013-05-08 09:52:02 +00:00
|
|
|
|
private:
|
2013-05-27 14:02:55 +00:00
|
|
|
|
ExpressionActionsPtr expression;
|
2013-05-08 09:52:02 +00:00
|
|
|
|
NamesAndTypes arguments;
|
|
|
|
|
DataTypePtr return_type;
|
2013-05-20 15:42:57 +00:00
|
|
|
|
std::string return_name;
|
2013-05-08 09:52:02 +00:00
|
|
|
|
};
|
|
|
|
|
|
|
|
|
|
}
|