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>
|
|
|
|
#include <Storages/IStorage.h>
|
2017-10-13 17:47:59 +00:00
|
|
|
#include <Interpreters/ExpressionAnalyzer.h>
|
|
|
|
#include <Parsers/IAST.h>
|
2017-04-28 18:57:26 +00:00
|
|
|
|
2017-04-26 02:50:03 +00:00
|
|
|
std::ostream & operator<<(std::ostream & stream, const DB::IBlockInputStream & what)
|
|
|
|
{
|
|
|
|
stream << "IBlockInputStream(id = " << what.getID() << ", name = " << what.getName() << ")";
|
|
|
|
//what.dumpTree(stream); // todo: set const
|
|
|
|
return stream;
|
|
|
|
}
|
|
|
|
|
2017-04-28 18:57:26 +00:00
|
|
|
std::ostream & operator<<(std::ostream & stream, const DB::Field & what)
|
2017-04-26 02:50:03 +00:00
|
|
|
{
|
2017-04-28 18:57:26 +00:00
|
|
|
stream << "Field(type = " << what.getTypeName() << ")";
|
2017-04-26 02:50:03 +00:00
|
|
|
return stream;
|
|
|
|
}
|
|
|
|
|
2017-04-28 18:57:26 +00:00
|
|
|
std::ostream & operator<<(std::ostream & stream, const DB::NameAndTypePair & what)
|
2017-04-26 02:50:03 +00:00
|
|
|
{
|
2017-04-28 18:57:26 +00:00
|
|
|
stream << "NameAndTypePair(name = " << what.name << ", type = " << what.type << ")";
|
2017-04-26 02:50:03 +00:00
|
|
|
return stream;
|
|
|
|
}
|
|
|
|
|
|
|
|
std::ostream & operator<<(std::ostream & stream, const DB::IDataType & what)
|
|
|
|
{
|
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;
|
|
|
|
}
|
|
|
|
|
|
|
|
std::ostream & operator<<(std::ostream & stream, const DB::IStorage & what)
|
|
|
|
{
|
2017-04-28 21:17:52 +00:00
|
|
|
stream << "IStorage(name = " << what.getName() << ", tableName = " << what.getTableName() << ") {"
|
2017-05-12 21:28:22 +00:00
|
|
|
<< what.getColumnsList().toString()
|
2017-04-28 21:17:52 +00:00
|
|
|
<< "}";
|
2017-04-26 02:50:03 +00:00
|
|
|
// isRemote supportsSampling supportsFinal supportsPrewhere supportsParallelReplicas
|
|
|
|
return stream;
|
|
|
|
}
|
|
|
|
|
2017-12-01 19:34:51 +00:00
|
|
|
std::ostream & operator<<(std::ostream & stream, const DB::TableStructureReadLock &)
|
2017-04-26 02:50:03 +00:00
|
|
|
{
|
|
|
|
stream << "TableStructureReadLock()";
|
|
|
|
return stream;
|
|
|
|
}
|
2017-04-28 18:57:26 +00:00
|
|
|
|
|
|
|
std::ostream & operator<<(std::ostream & stream, const DB::IFunction & what)
|
|
|
|
{
|
|
|
|
stream << "IFunction(name = " << what.getName() << ", variadic = " << what.isVariadic() << ", args = " << what.getNumberOfArguments()
|
|
|
|
<< ")";
|
|
|
|
return stream;
|
|
|
|
}
|
|
|
|
|
|
|
|
std::ostream & operator<<(std::ostream & stream, const DB::Block & what)
|
|
|
|
{
|
2017-04-28 21:17:52 +00:00
|
|
|
stream << "Block("
|
2017-05-12 21:28:22 +00:00
|
|
|
<< "size = " << what.getColumns().size()
|
2017-06-22 15:57:37 +00:00
|
|
|
<< "){" << what.dumpStructure() << "}";
|
2017-04-28 18:57:26 +00:00
|
|
|
return stream;
|
|
|
|
}
|
|
|
|
|
2017-12-17 10:14:12 +00:00
|
|
|
|
|
|
|
#include <Common/COWPtr.h>
|
|
|
|
|
|
|
|
template <typename T>
|
|
|
|
std::ostream & printCOWPtr(std::ostream & stream, const typename COWPtr<T>::Ptr & what)
|
2017-04-28 18:57:26 +00:00
|
|
|
{
|
2017-12-17 10:14:12 +00:00
|
|
|
stream << "COWPtr::Ptr(" << what.get();
|
|
|
|
if (what)
|
|
|
|
stream << ", use_count = " << what->use_count();
|
|
|
|
stream << ") {";
|
|
|
|
if (what)
|
|
|
|
stream << *what;
|
|
|
|
else
|
|
|
|
stream << "nullptr";
|
|
|
|
stream << "}";
|
2017-04-28 18:57:26 +00:00
|
|
|
return stream;
|
|
|
|
}
|
|
|
|
|
2017-12-17 10:14:12 +00:00
|
|
|
|
|
|
|
std::ostream & operator<<(std::ostream & stream, const DB::ColumnWithTypeAndName & what)
|
|
|
|
{
|
|
|
|
stream << "ColumnWithTypeAndName(name = " << what.name << ", type = " << what.type << ", column = ";
|
|
|
|
return printCOWPtr<DB::IColumn>(stream, what.column) << ")";
|
|
|
|
}
|
|
|
|
|
2017-04-28 18:57:26 +00:00
|
|
|
std::ostream & operator<<(std::ostream & stream, const DB::IColumn & what)
|
|
|
|
{
|
2017-12-17 10:14:12 +00:00
|
|
|
stream << "IColumn(" << what.dumpStructure() << ")";
|
2017-04-28 18:57:26 +00:00
|
|
|
return stream;
|
|
|
|
}
|
2017-06-22 15:57:37 +00:00
|
|
|
|
2017-10-13 17:47:59 +00:00
|
|
|
std::ostream & operator<<(std::ostream & stream, const DB::Connection::Packet & what)
|
|
|
|
{
|
2017-06-22 15:57:37 +00:00
|
|
|
stream << "Connection::Packet("
|
|
|
|
<< "type = " << what.type;
|
|
|
|
// types description: Core/Protocol.h
|
|
|
|
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-10-13 17:47:59 +00:00
|
|
|
std::ostream & operator<<(std::ostream & stream, const DB::SubqueryForSet & what)
|
|
|
|
{
|
|
|
|
stream << "SubqueryForSet(source = " << what.source
|
|
|
|
<< ", source_sample = " << what.source_sample
|
|
|
|
// TODO: << ", set = " << what.set << ", join = " << what.join
|
|
|
|
<< ", table = " << what.table
|
|
|
|
<< ")";
|
|
|
|
return stream;
|
|
|
|
}
|
|
|
|
|
|
|
|
std::ostream & operator<<(std::ostream & stream, const DB::IAST & what)
|
|
|
|
{
|
|
|
|
stream << "IAST("
|
|
|
|
<< "query_string = " << what.query_string
|
|
|
|
<<"){";
|
|
|
|
what.dumpTree(stream);
|
|
|
|
stream << "}";
|
|
|
|
return stream;
|
|
|
|
}
|
|
|
|
|
|
|
|
std::ostream & operator<<(std::ostream & stream, const DB::ExpressionAnalyzer & what)
|
|
|
|
{
|
|
|
|
stream << "ExpressionAnalyzer{"
|
2017-12-17 10:14:12 +00:00
|
|
|
<< "hasAggregation=" << what.hasAggregation()
|
2017-10-13 17:47:59 +00:00
|
|
|
<< ", RequiredColumns=" << what.getRequiredColumns()
|
|
|
|
<< ", SubqueriesForSet=" << what.getSubqueriesForSets()
|
|
|
|
<< ", ExternalTables=" << what.getExternalTables()
|
|
|
|
// TODO
|
|
|
|
<< "}";
|
|
|
|
return stream;
|
|
|
|
}
|
|
|
|
|