mirror of
https://github.com/ClickHouse/ClickHouse.git
synced 2024-12-16 11:22:12 +00:00
103 lines
2.0 KiB
C++
103 lines
2.0 KiB
C++
#include <Interpreters/AggregateDescription.h>
|
|
#include <Common/FieldVisitors.h>
|
|
#include <IO/Operators.h>
|
|
|
|
namespace DB
|
|
{
|
|
|
|
void AggregateDescription::explain(WriteBuffer & out, size_t indent) const
|
|
{
|
|
String prefix(indent, ' ');
|
|
|
|
out << prefix << column_name << '\n';
|
|
|
|
auto dump_params = [&](const Array & arr)
|
|
{
|
|
bool first = true;
|
|
for (const auto & param : arr)
|
|
{
|
|
if (!first)
|
|
out << ", ";
|
|
|
|
first = false;
|
|
|
|
out << applyVisitor(FieldVisitorToString(), param);
|
|
}
|
|
};
|
|
|
|
if (function)
|
|
{
|
|
/// Double whitespace is intentional.
|
|
out << prefix << " Function: " << function->getName();
|
|
|
|
const auto & params = function->getParameters();
|
|
if (!params.empty())
|
|
{
|
|
out << "(";
|
|
dump_params(params);
|
|
out << ")";
|
|
}
|
|
|
|
out << "(";
|
|
|
|
bool first = true;
|
|
for (const auto & type : function->getArgumentTypes())
|
|
{
|
|
if (!first)
|
|
out << ", ";
|
|
first = false;
|
|
|
|
out << type->getName();
|
|
}
|
|
|
|
out << ") → " << function->getReturnType()->getName() << "\n";
|
|
}
|
|
else
|
|
out << prefix << " Function: nullptr\n";
|
|
|
|
if (!parameters.empty())
|
|
{
|
|
out << prefix << " Parameters: ";
|
|
dump_params(parameters);
|
|
out << '\n';
|
|
}
|
|
|
|
out << prefix << " Arguments: ";
|
|
|
|
if (argument_names.empty())
|
|
out << "none\n";
|
|
else
|
|
{
|
|
bool first = true;
|
|
for (const auto & arg : argument_names)
|
|
{
|
|
if (!first)
|
|
out << ", ";
|
|
first = false;
|
|
|
|
out << arg;
|
|
}
|
|
out << "\n";
|
|
}
|
|
|
|
out << prefix << " Argument positions: ";
|
|
|
|
if (arguments.empty())
|
|
out << "none\n";
|
|
else
|
|
{
|
|
bool first = true;
|
|
for (auto arg : arguments)
|
|
{
|
|
if (!first)
|
|
out << ", ";
|
|
first = false;
|
|
|
|
out << arg;
|
|
}
|
|
out << '\n';
|
|
}
|
|
}
|
|
|
|
}
|