2017-04-26 02:50:03 +00:00
|
|
|
#include "iostream_debug_helpers.h"
|
|
|
|
|
|
|
|
#include <iostream>
|
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>
|
|
|
|
#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
|
|
|
|
{
|
|
|
|
std::ostream & operator<<(std::ostream & stream, const IBlockInputStream & what)
|
2017-04-26 02:50:03 +00:00
|
|
|
{
|
2018-02-18 03:46:18 +00:00
|
|
|
stream << "IBlockInputStream(name = " << what.getName() << ")";
|
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 Field & what)
|
2017-04-26 02:50:03 +00:00
|
|
|
{
|
2018-04-05 16:43:39 +00:00
|
|
|
stream << applyVisitor(FieldVisitorDump(), what);
|
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
|
|
|
{
|
2017-04-28 21:17:52 +00:00
|
|
|
stream << "IStorage(name = " << what.getName() << ", tableName = " << what.getTableName() << ") {"
|
2019-02-27 22:18:58 +00:00
|
|
|
<< what.getColumns().getAllPhysical().toString() << "}";
|
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 TableStructureReadLock &)
|
2017-04-26 02:50:03 +00:00
|
|
|
{
|
|
|
|
stream << "TableStructureReadLock()";
|
|
|
|
return stream;
|
|
|
|
}
|
2017-04-28 18:57:26 +00:00
|
|
|
|
2018-02-06 19:34:53 +00:00
|
|
|
std::ostream & operator<<(std::ostream & stream, const IFunctionBuilder & 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
|
|
|
{
|
|
|
|
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
|
|
|
|
2017-12-20 16:42:18 +00:00
|
|
|
std::ostream & operator<<(std::ostream & stream, const Connection::Packet & what)
|
2017-10-13 17:47:59 +00:00
|
|
|
{
|
2017-06-22 15:57:37 +00:00
|
|
|
stream << "Connection::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;
|
|
|
|
}
|
|
|
|
|
2017-12-20 16:42:18 +00:00
|
|
|
std::ostream & operator<<(std::ostream & stream, const IAST & what)
|
2017-10-13 17:47:59 +00:00
|
|
|
{
|
2018-02-26 03:37:08 +00:00
|
|
|
stream << "IAST{";
|
2017-10-13 17:47:59 +00:00
|
|
|
what.dumpTree(stream);
|
|
|
|
stream << "}";
|
|
|
|
return stream;
|
|
|
|
}
|
|
|
|
|
2017-12-20 16:42:18 +00:00
|
|
|
}
|