mirror of
https://github.com/ClickHouse/ClickHouse.git
synced 2024-11-22 15:42:02 +00:00
add makeASTFunction factory-function. #[NETR-12739]
This commit is contained in:
parent
142d0a49c0
commit
cee035439e
@ -1,6 +1,7 @@
|
||||
#pragma once
|
||||
|
||||
#include <DB/Parsers/ASTWithAlias.h>
|
||||
#include <DB/Parsers/ASTExpressionList.h>
|
||||
#include <DB/Functions/IFunction.h>
|
||||
#include <DB/AggregateFunctions/IAggregateFunction.h>
|
||||
#include <DB/IO/WriteBufferFromString.h>
|
||||
@ -81,4 +82,20 @@ public:
|
||||
}
|
||||
};
|
||||
|
||||
|
||||
template <typename... Args>
|
||||
ASTPtr makeASTFunction(const String & name, Args &&... args)
|
||||
{
|
||||
const auto function = new ASTFunction{};
|
||||
ASTPtr result{function};
|
||||
|
||||
function->name = name;
|
||||
function->arguments = new ASTExpressionList{};
|
||||
function->children.push_back(function->arguments);
|
||||
|
||||
function->arguments->children = { std::forward<Args>(args)... };
|
||||
|
||||
return result;
|
||||
}
|
||||
|
||||
}
|
||||
|
Loading…
Reference in New Issue
Block a user