2017-04-26 02:50:03 +00:00
|
|
|
#include "iostream_debug_helpers.h"
|
|
|
|
|
|
|
|
#include <iostream>
|
2019-11-15 16:34:43 +00:00
|
|
|
#include <Client/Connection.h>
|
2017-04-28 18:57:26 +00:00
|
|
|
#include <Core/Block.h>
|
2017-04-28 19:50:42 +00:00
|
|
|
#include <Core/ColumnWithTypeAndName.h>
|
2017-04-28 18:57:26 +00:00
|
|
|
#include <Core/Field.h>
|
|
|
|
#include <Core/NamesAndTypes.h>
|
2017-04-26 02:50:03 +00:00
|
|
|
#include <DataStreams/IBlockInputStream.h>
|
2017-04-28 18:57:26 +00:00
|
|
|
#include <DataTypes/IDataType.h>
|
|
|
|
#include <Functions/IFunction.h>
|
2019-02-27 22:18:58 +00:00
|
|
|
#include <IO/WriteBufferFromOStream.h>
|
2017-10-13 17:47:59 +00:00
|
|
|
#include <Interpreters/ExpressionAnalyzer.h>
|
2019-05-25 11:03:12 +00:00
|
|
|
#include <Interpreters/ExpressionActions.h>
|
2017-10-13 17:47:59 +00:00
|
|
|
#include <Parsers/IAST.h>
|
2019-02-27 22:18:58 +00:00
|
|
|
#include <Storages/IStorage.h>
|
2019-04-19 20:21:17 +00:00
|
|
|
#include <Common/COW.h>
|
2019-02-27 22:18:58 +00:00
|
|
|
#include <Common/FieldVisitors.h>
|
2018-04-05 16:43:39 +00:00
|
|
|
|
2017-12-20 16:42:18 +00:00
|
|
|
namespace DB
|
|
|
|
{
|
2019-10-28 05:42:51 +00:00
|
|
|
|
|
|
|
template <>
|
|
|
|
std::ostream & operator<< <Field>(std::ostream & stream, const Field & what)
|
2017-04-26 02:50:03 +00:00
|
|
|
{
|
2019-10-28 05:42:51 +00:00
|
|
|
stream << applyVisitor(FieldVisitorDump(), what);
|
2017-04-26 02:50:03 +00:00
|
|
|
return stream;
|
|
|
|
}
|
|
|
|
|
2019-10-28 05:42:51 +00:00
|
|
|
std::ostream & operator<<(std::ostream & stream, const IBlockInputStream & what)
|
2017-04-26 02:50:03 +00:00
|
|
|
{
|
2019-10-28 05:42:51 +00:00
|
|
|
stream << "IBlockInputStream(name = " << what.getName() << ")";
|
2017-04-26 02:50:03 +00:00
|
|
|
return stream;
|
|
|
|
}
|
|
|
|
|
2017-12-25 21:57:29 +00:00
|
|
|
std::ostream & operator<<(std::ostream & stream, const NameAndTypePair & what)
|
2017-04-26 02:50:03 +00:00
|
|
|
{
|
2017-12-25 21:57:29 +00:00
|
|
|
stream << "NameAndTypePair(name = " << what.name << ", type = " << what.type << ")";
|
2017-04-26 02:50:03 +00:00
|
|
|
return stream;
|
|
|
|
}
|
|
|
|
|
2017-12-20 16:42:18 +00:00
|
|
|
std::ostream & operator<<(std::ostream & stream, const IDataType & what)
|
2017-04-26 02:50:03 +00:00
|
|
|
{
|
2017-12-17 10:14:12 +00:00
|
|
|
stream << "IDataType(name = " << what.getName() << ", default = " << what.getDefault() << ")";
|
2017-04-26 02:50:03 +00:00
|
|
|
return stream;
|
|
|
|
}
|
|
|
|
|
2017-12-20 16:42:18 +00:00
|
|
|
std::ostream & operator<<(std::ostream & stream, const IStorage & what)
|
2017-04-26 02:50:03 +00:00
|
|
|
{
|
2019-12-10 20:47:05 +00:00
|
|
|
auto table_id = what.getStorageID();
|
|
|
|
stream << "IStorage(name = " << what.getName() << ", tableName = " << table_id.table_name << ") {"
|
2020-06-17 16:39:58 +00:00
|
|
|
<< what.getInMemoryMetadataPtr()->getColumns().getAllPhysical().toString() << "}";
|
2017-04-26 02:50:03 +00:00
|
|
|
return stream;
|
|
|
|
}
|
|
|
|
|
2020-06-18 16:10:47 +00:00
|
|
|
std::ostream & operator<<(std::ostream & stream, const TableLockHolder &)
|
2017-04-26 02:50:03 +00:00
|
|
|
{
|
|
|
|
stream << "TableStructureReadLock()";
|
|
|
|
return stream;
|
|
|
|
}
|
2017-04-28 18:57:26 +00:00
|
|
|
|
2019-12-08 21:06:37 +00:00
|
|
|
std::ostream & operator<<(std::ostream & stream, const IFunctionOverloadResolver & what)
|
2017-04-28 18:57:26 +00:00
|
|
|
{
|
2019-02-27 22:18:58 +00:00
|
|
|
stream << "IFunction(name = " << what.getName() << ", variadic = " << what.isVariadic() << ", args = " << what.getNumberOfArguments()
|
|
|
|
<< ")";
|
2017-04-28 18:57:26 +00:00
|
|
|
return stream;
|
|
|
|
}
|
|
|
|
|
2017-12-20 16:42:18 +00:00
|
|
|
std::ostream & operator<<(std::ostream & stream, const Block & what)
|
2017-04-28 18:57:26 +00:00
|
|
|
{
|
2017-04-28 21:17:52 +00:00
|
|
|
stream << "Block("
|
2019-02-27 22:18:58 +00:00
|
|
|
<< "num_columns = " << what.columns() << "){" << what.dumpStructure() << "}";
|
2017-04-28 18:57:26 +00:00
|
|
|
return stream;
|
|
|
|
}
|
|
|
|
|
2017-12-20 16:42:18 +00:00
|
|
|
std::ostream & operator<<(std::ostream & stream, const ColumnWithTypeAndName & what)
|
2017-12-17 10:14:12 +00:00
|
|
|
{
|
2019-05-25 11:03:12 +00:00
|
|
|
stream << "ColumnWithTypeAndName(name = " << what.name << ", type = " << *what.type << ", column = ";
|
2018-04-06 04:46:18 +00:00
|
|
|
return dumpValue(stream, what.column) << ")";
|
2017-12-17 10:14:12 +00:00
|
|
|
}
|
|
|
|
|
2017-12-20 16:42:18 +00:00
|
|
|
std::ostream & operator<<(std::ostream & stream, const IColumn & what)
|
2017-04-28 18:57:26 +00:00
|
|
|
{
|
2017-12-17 10:14:12 +00:00
|
|
|
stream << "IColumn(" << what.dumpStructure() << ")";
|
2019-02-27 22:18:58 +00:00
|
|
|
stream << "{";
|
|
|
|
for (size_t i = 0; i < what.size(); ++i)
|
|
|
|
{
|
|
|
|
if (i)
|
|
|
|
stream << ", ";
|
2019-03-28 18:17:44 +00:00
|
|
|
stream << applyVisitor(FieldVisitorDump(), what[i]);
|
2019-02-27 22:18:58 +00:00
|
|
|
}
|
|
|
|
stream << "}";
|
|
|
|
|
2017-04-28 18:57:26 +00:00
|
|
|
return stream;
|
|
|
|
}
|
2017-06-22 15:57:37 +00:00
|
|
|
|
2019-11-15 16:34:43 +00:00
|
|
|
std::ostream & operator<<(std::ostream & stream, const Packet & what)
|
2017-10-13 17:47:59 +00:00
|
|
|
{
|
2019-11-15 16:34:43 +00:00
|
|
|
stream << "Packet("
|
2019-02-27 22:18:58 +00:00
|
|
|
<< "type = " << what.type;
|
|
|
|
// types description: Core/Protocol.h
|
2017-06-22 15:57:37 +00:00
|
|
|
if (what.exception)
|
|
|
|
stream << "exception = " << what.exception.get();
|
2017-10-13 17:47:59 +00:00
|
|
|
// TODO: profile_info
|
2017-06-22 15:57:37 +00:00
|
|
|
stream << ") {" << what.block << "}";
|
|
|
|
return stream;
|
|
|
|
}
|
|
|
|
|
2019-05-25 11:03:12 +00:00
|
|
|
std::ostream & operator<<(std::ostream & stream, const ExpressionAction & what)
|
|
|
|
{
|
|
|
|
stream << "ExpressionAction(" << what.toString() << ")";
|
|
|
|
return stream;
|
|
|
|
}
|
|
|
|
|
|
|
|
std::ostream & operator<<(std::ostream & stream, const ExpressionActions & what)
|
|
|
|
{
|
|
|
|
stream << "ExpressionActions(" << what.dumpActions() << ")";
|
|
|
|
return stream;
|
|
|
|
}
|
|
|
|
|
2020-07-22 17:13:05 +00:00
|
|
|
std::ostream & operator<<(std::ostream & stream, const TreeRewriterResult & what)
|
2019-05-25 11:03:12 +00:00
|
|
|
{
|
|
|
|
stream << "SyntaxAnalyzerResult{";
|
|
|
|
stream << "storage=" << what.storage << "; ";
|
|
|
|
if (!what.source_columns.empty())
|
|
|
|
{
|
|
|
|
stream << "source_columns=";
|
|
|
|
dumpValue(stream, what.source_columns);
|
|
|
|
stream << "; ";
|
|
|
|
}
|
|
|
|
if (!what.aliases.empty())
|
|
|
|
{
|
|
|
|
stream << "aliases=";
|
|
|
|
dumpValue(stream, what.aliases);
|
|
|
|
stream << "; ";
|
|
|
|
}
|
|
|
|
if (!what.array_join_result_to_source.empty())
|
|
|
|
{
|
|
|
|
stream << "array_join_result_to_source=";
|
|
|
|
dumpValue(stream, what.array_join_result_to_source);
|
|
|
|
stream << "; ";
|
|
|
|
}
|
|
|
|
if (!what.array_join_alias_to_name.empty())
|
|
|
|
{
|
|
|
|
stream << "array_join_alias_to_name=";
|
|
|
|
dumpValue(stream, what.array_join_alias_to_name);
|
|
|
|
stream << "; ";
|
|
|
|
}
|
|
|
|
if (!what.array_join_name_to_alias.empty())
|
|
|
|
{
|
|
|
|
stream << "array_join_name_to_alias=";
|
|
|
|
dumpValue(stream, what.array_join_name_to_alias);
|
|
|
|
stream << "; ";
|
|
|
|
}
|
|
|
|
stream << "rewrite_subqueries=" << what.rewrite_subqueries << "; ";
|
|
|
|
stream << "}";
|
|
|
|
|
|
|
|
return stream;
|
|
|
|
}
|
|
|
|
|
2017-12-20 16:42:18 +00:00
|
|
|
}
|