提交 49f8080e 编写于 作者: P proller 提交者: alexey-milovidov

Small debud improvement

上级 f30841d5
......@@ -9,6 +9,8 @@
#include <DataTypes/IDataType.h>
#include <Functions/IFunction.h>
#include <Storages/IStorage.h>
#include <Interpreters/ExpressionAnalyzer.h>
#include <Parsers/IAST.h>
std::ostream & operator<<(std::ostream & stream, const DB::IBlockInputStream & what)
{
......@@ -80,14 +82,47 @@ std::ostream & operator<<(std::ostream & stream, const DB::IColumn & what)
return stream;
}
std::ostream & operator<<(std::ostream & stream, const DB::Connection::Packet & what) {
std::ostream & operator<<(std::ostream & stream, const DB::Connection::Packet & what)
{
stream << "Connection::Packet("
<< "type = " << what.type;
// types description: Core/Protocol.h
if (what.exception)
stream << "exception = " << what.exception.get();
//TODO: profile_info
// TODO: profile_info
stream << ") {" << what.block << "}";
return stream;
}
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{"
<< "hasAggregation="<<what.hasAggregation()
<< ", RequiredColumns=" << what.getRequiredColumns()
<< ", SubqueriesForSet=" << what.getSubqueriesForSets()
<< ", ExternalTables=" << what.getExternalTables()
// TODO
<< "}";
return stream;
}
......@@ -32,6 +32,17 @@ std::ostream & operator<<(std::ostream & stream, const DB::ColumnWithTypeAndName
namespace DB { class IColumn; }
std::ostream & operator<<(std::ostream & stream, const DB::IColumn & what);
namespace DB { struct SubqueryForSet; }
std::ostream & operator<<(std::ostream & stream, const DB::SubqueryForSet & what);
namespace DB { class IAST; }
std::ostream & operator<<(std::ostream & stream, const DB::IAST & what);
namespace DB { class ExpressionAnalyzer; }
std::ostream & operator<<(std::ostream & stream, const DB::ExpressionAnalyzer & what);
#include <Client/Connection.h>
std::ostream & operator<<(std::ostream & stream, const DB::Connection::Packet & what);
......
......@@ -12,7 +12,7 @@
#include <IO/ReadBufferFromString.h>
#include <Storages/IStorage.h>
#include <DataStreams/OneBlockInputStream.h>
#include <DataStreams/IProfilingBlockInputStream.h>
#include <Interpreters/executeQuery.h>
#include <Interpreters/Cluster.h>
......
......@@ -2845,7 +2845,7 @@ void ExpressionAnalyzer::collectJoinedColumns(NameSet & joined_columns, NamesAnd
}
Names ExpressionAnalyzer::getRequiredColumns()
Names ExpressionAnalyzer::getRequiredColumns() const
{
if (!unknown_required_columns.empty())
throw Exception("Unknown identifier: " + *unknown_required_columns.begin(), ErrorCodes::UNKNOWN_IDENTIFIER);
......
......@@ -83,7 +83,7 @@ public:
/** Get a set of columns that are enough to read from the table to evaluate the expression.
* Columns added from another table by JOIN are not counted.
*/
Names getRequiredColumns();
Names getRequiredColumns() const;
/** These methods allow you to build a chain of transformations over a block, that receives values in the desired sections of the query.
*
......@@ -127,7 +127,7 @@ public:
* That is, you need to call getSetsWithSubqueries after all calls of `append*` or `getActions`
* and create all the returned sets before performing the actions.
*/
SubqueriesForSets getSubqueriesForSets() { return subqueries_for_sets; }
SubqueriesForSets getSubqueriesForSets() const { return subqueries_for_sets; }
PreparedSets getPreparedSets() { return prepared_sets; }
......
......@@ -8,7 +8,6 @@
#include <Common/typeid_cast.h>
#include <DataStreams/IProfilingBlockInputStream.h>
#include <DataStreams/OneBlockInputStream.h>
#include <DataTypes/DataTypeArray.h>
#include <DataTypes/DataTypeTraits.h>
......
......@@ -1554,7 +1554,7 @@ void MergeTreeData::delayInsertIfNeeded(Poco::Event * until)
if (parts_count >= settings.parts_to_throw_insert)
{
ProfileEvents::increment(ProfileEvents::RejectedInserts);
throw Exception("Too much parts. Merges are processing significantly slower than inserts.", ErrorCodes::TOO_MUCH_PARTS);
throw Exception("Too much parts (" + toString(parts_count) + "). Merges are processing significantly slower than inserts.", ErrorCodes::TOO_MUCH_PARTS);
}
const size_t max_k = settings.parts_to_throw_insert - settings.parts_to_delay_insert; /// always > 0
......
......@@ -144,7 +144,7 @@ std::ostream & operator<<(std::ostream & stream, const std::chrono::time_point<c
template <typename T>
std::ostream & operator<<(std::ostream & stream, const std::shared_ptr<T> & what)
{
stream << "shared_ptr(use_count = " << what.use_count() << ") {";
stream << "shared_ptr("<< what.get() <<", use_count = " << what.use_count() << ") {";
if (what)
stream << *what;
else
......@@ -156,7 +156,7 @@ std::ostream & operator<<(std::ostream & stream, const std::shared_ptr<T> & what
template <typename T>
std::ostream & operator<<(std::ostream & stream, const std::unique_ptr<T> & what)
{
stream << "unique_ptr {";
stream << "unique_ptr("<< what.get() <<") {";
if (what)
stream << *what;
else
......
Markdown is supported
0% .
You are about to add 0 people to the discussion. Proceed with caution.
先完成此消息的编辑!
想要评论请 注册