Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Fix DUMP debug. #7500

Merged
merged 1 commit into from
Oct 29, 2019
Merged
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Jump to
Jump to file
Failed to load files.
Diff view
Diff view
18 changes: 6 additions & 12 deletions dbms/src/Core/iostream_debug_helpers.cpp
Original file line number Diff line number Diff line change
Expand Up @@ -18,15 +18,17 @@

namespace DB
{
std::ostream & operator<<(std::ostream & stream, const IBlockInputStream & what)

template <>
std::ostream & operator<< <Field>(std::ostream & stream, const Field & what)
{
stream << "IBlockInputStream(name = " << what.getName() << ")";
stream << applyVisitor(FieldVisitorDump(), what);
return stream;
}

std::ostream & operator<<(std::ostream & stream, const Field & what)
std::ostream & operator<<(std::ostream & stream, const IBlockInputStream & what)
{
stream << applyVisitor(FieldVisitorDump(), what);
stream << "IBlockInputStream(name = " << what.getName() << ")";
return stream;
}

Expand Down Expand Up @@ -102,14 +104,6 @@ std::ostream & operator<<(std::ostream & stream, const Connection::Packet & what
return stream;
}

std::ostream & operator<<(std::ostream & stream, const IAST & what)
{
stream << "IAST{";
what.dumpTree(stream);
stream << "}";
return stream;
}

std::ostream & operator<<(std::ostream & stream, const ExpressionAction & what)
{
stream << "ExpressionAction(" << what.toString() << ")";
Expand Down
16 changes: 5 additions & 11 deletions dbms/src/Core/iostream_debug_helpers.h
Original file line number Diff line number Diff line change
Expand Up @@ -7,18 +7,15 @@
namespace DB
{

// Used to disable implicit casting for certain overloaded types such as Field, which leads to
// overload resolution ambiguity.
template <typename T> struct Dumpable;
template <typename T>
std::ostream & operator<<(std::ostream & stream, const typename Dumpable<T>::Type & what);
// Use template to disable implicit casting for certain overloaded types such as Field, which leads
// to overload resolution ambiguity.
class Field;
template <typename T, typename U = std::enable_if_t<std::is_same_v<T, Field>>>
std::ostream & operator<<(std::ostream & stream, const T & what);

class IBlockInputStream;
std::ostream & operator<<(std::ostream & stream, const IBlockInputStream & what);

class Field;
template <> struct Dumpable<Field> { using Type = Field; };

struct NameAndTypePair;
std::ostream & operator<<(std::ostream & stream, const NameAndTypePair & what);

Expand All @@ -43,9 +40,6 @@ std::ostream & operator<<(std::ostream & stream, const ColumnWithTypeAndName & w
class IColumn;
std::ostream & operator<<(std::ostream & stream, const IColumn & what);

class IAST;
std::ostream & operator<<(std::ostream & stream, const IAST & what);

std::ostream & operator<<(std::ostream & stream, const Connection::Packet & what);

struct ExpressionAction;
Expand Down
9 changes: 9 additions & 0 deletions dbms/src/Parsers/iostream_debug_helpers.cpp
Original file line number Diff line number Diff line change
@@ -1,4 +1,5 @@
#include "iostream_debug_helpers.h"
#include <Parsers/IAST.h>
#include <Parsers/IParser.h>
#include <Parsers/Lexer.h>
#include <Parsers/TokenIterator.h>
Expand All @@ -20,4 +21,12 @@ std::ostream & operator<<(std::ostream & stream, const Expected & what)
return stream;
}

std::ostream & operator<<(std::ostream & stream, const IAST & what)
{
stream << "IAST{";
what.dumpTree(stream);
stream << "}";
return stream;
}

}
3 changes: 3 additions & 0 deletions dbms/src/Parsers/iostream_debug_helpers.h
Original file line number Diff line number Diff line change
Expand Up @@ -9,6 +9,9 @@ std::ostream & operator<<(std::ostream & stream, const Token & what);
struct Expected;
std::ostream & operator<<(std::ostream & stream, const Expected & what);

class IAST;
std::ostream & operator<<(std::ostream & stream, const IAST & what);

}

#include <Core/iostream_debug_helpers.h>