RTrim the explain string before splitting on newlines

Reviewers: teon.banek, mtomic

Reviewed By: mtomic

Subscribers: pullbot

Differential Revision: https://phabricator.memgraph.io/D1620
This commit is contained in:
Lovro Lugovic 2018-10-01 11:11:42 +02:00
parent 6894e2aef8
commit 8fb7ccf6c9
2 changed files with 4 additions and 4 deletions

View File

@ -4008,7 +4008,7 @@ class ExplainCursor : public Cursor {
: printed_plan_rows_([&dba, &self]() {
std::stringstream stream;
self.pretty_print_(dba, self.input().get(), &stream);
return utils::Split(stream.str(), "\n");
return utils::Split(utils::RTrim(stream.str()), "\n");
}()),
print_it_(printed_plan_rows_.begin()),
output_symbol_(output_symbol) {}

View File

@ -186,7 +186,7 @@ inline std::string Join(const std::vector<std::string> &strings,
/**
* Replaces all occurences of <match> in <src> with <replacement>.
*/
// TODO: This could be implemented much more efficient.
// TODO: This could be implemented much more efficiently.
inline std::string Replace(std::string src, const std::string &match,
const std::string &replacement) {
for (size_t pos = src.find(match); pos != std::string::npos;
@ -226,7 +226,7 @@ inline std::vector<std::string> Split(const std::string &src,
}
/**
* Split string by delimeter, from right to left, and return vector of results.
* Split string by delimiter, from right to left, and return vector of results.
* For example, RSplit("a.b.c.", ".", 1) results in {"a.b", "c"}.
*
* @param src - The string to split.
@ -260,7 +260,7 @@ inline std::vector<std::string> RSplit(const std::string &src,
/**
* Split string by whitespace and return vector of results.
* Runs of consecutive whitespace are regarded as a single delimiter.
* Additionally, the result will not contain empty strings at the start of end
* Additionally, the result will not contain empty strings at the start or end
* as if the string was trimmed before splitting.
*/
inline std::vector<std::string> Split(const std::string &src) {