mirror of
https://github.com/ClickHouse/ClickHouse.git
synced 2024-11-28 02:21:59 +00:00
Fixes after review
This commit is contained in:
parent
93cf734b57
commit
6386e83953
@ -43,7 +43,7 @@ ColumnsWithTypeAndName FunctionNode::getArgumentColumns() const
|
||||
argument.type = arg->getResultType();
|
||||
if (auto * constant = arg->as<ConstantNode>())
|
||||
argument.column = argument.type->createColumnConst(1, constant->getValue());
|
||||
argument_columns.push_back(argument);
|
||||
argument_columns.push_back(std::move(argument));
|
||||
}
|
||||
return argument_columns;
|
||||
}
|
||||
|
@ -5,9 +5,9 @@
|
||||
#include <Analyzer/ConstantValue.h>
|
||||
#include <Analyzer/IQueryTreeNode.h>
|
||||
#include <Analyzer/ListNode.h>
|
||||
#include <Common/typeid_cast.h>
|
||||
#include <Core/ColumnsWithTypeAndName.h>
|
||||
#include <Core/IResolvedFunction.h>
|
||||
#include <Common/typeid_cast.h>
|
||||
#include <Functions/IFunction.h>
|
||||
|
||||
namespace DB
|
||||
|
@ -59,7 +59,7 @@ class ValidationChecker : public InDepthQueryTreeVisitor<ValidationChecker>
|
||||
if (!function->isResolved())
|
||||
throw Exception(ErrorCodes::LOGICAL_ERROR,
|
||||
"Function {} is not resolved after running {} pass",
|
||||
function->toAST()->dumpTree(), pass_name);
|
||||
function->toAST()->formatForErrorMessage(), pass_name);
|
||||
}
|
||||
|
||||
public:
|
||||
|
@ -33,6 +33,35 @@ namespace ErrorCodes
|
||||
extern const int BAD_ARGUMENTS;
|
||||
}
|
||||
|
||||
namespace
|
||||
{
|
||||
|
||||
std::pair<ColumnsWithTypeAndName, bool> getFunctionArguments(const ActionsDAG::NodeRawConstPtrs & children)
|
||||
{
|
||||
size_t num_arguments = children.size();
|
||||
|
||||
bool all_const = true;
|
||||
ColumnsWithTypeAndName arguments(num_arguments);
|
||||
|
||||
for (size_t i = 0; i < num_arguments; ++i)
|
||||
{
|
||||
const auto & child = *children[i];
|
||||
|
||||
ColumnWithTypeAndName argument;
|
||||
argument.column = child.column;
|
||||
argument.type = child.result_type;
|
||||
argument.name = child.result_name;
|
||||
|
||||
if (!argument.column || !isColumnConst(*argument.column))
|
||||
all_const = false;
|
||||
|
||||
arguments[i] = std::move(argument);
|
||||
}
|
||||
return { std::move(arguments), all_const };
|
||||
}
|
||||
|
||||
}
|
||||
|
||||
void ActionsDAG::Node::toTree(JSONBuilder::JSONMap & map) const
|
||||
{
|
||||
map.add("Node Type", magic_enum::enum_name(type));
|
||||
@ -250,30 +279,6 @@ const ActionsDAG::Node & ActionsDAG::addFunctionImpl(
|
||||
return addNode(std::move(node));
|
||||
}
|
||||
|
||||
std::pair<ColumnsWithTypeAndName, bool> ActionsDAG::getFunctionArguments(const NodeRawConstPtrs & children)
|
||||
{
|
||||
size_t num_arguments = children.size();
|
||||
|
||||
bool all_const = true;
|
||||
ColumnsWithTypeAndName arguments(num_arguments);
|
||||
|
||||
for (size_t i = 0; i < num_arguments; ++i)
|
||||
{
|
||||
const auto & child = *children[i];
|
||||
|
||||
ColumnWithTypeAndName argument;
|
||||
argument.column = child.column;
|
||||
argument.type = child.result_type;
|
||||
argument.name = child.result_name;
|
||||
|
||||
if (!argument.column || !isColumnConst(*argument.column))
|
||||
all_const = false;
|
||||
|
||||
arguments[i] = std::move(argument);
|
||||
}
|
||||
return { std::move(arguments), all_const };
|
||||
}
|
||||
|
||||
const ActionsDAG::Node & ActionsDAG::findInOutputs(const std::string & name) const
|
||||
{
|
||||
if (const auto * node = tryFindInOutputs(name))
|
||||
|
@ -358,8 +358,6 @@ private:
|
||||
std::string result_name,
|
||||
bool all_const);
|
||||
|
||||
static std::pair<ColumnsWithTypeAndName, bool> getFunctionArguments(const NodeRawConstPtrs & children);
|
||||
|
||||
#if USE_EMBEDDED_COMPILER
|
||||
void compileFunctions(size_t min_count_to_compile_expression, const std::unordered_set<const Node *> & lazy_executed_nodes = {});
|
||||
#endif
|
||||
|
Loading…
Reference in New Issue
Block a user