Skip to content

Commit a0302d5

Browse files
committed
Fixed GCC-7 build
1 parent cf3f322 commit a0302d5

File tree

4 files changed

+46
-37
lines changed

4 files changed

+46
-37
lines changed

ut/Column_ut.cpp

Lines changed: 2 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -164,6 +164,7 @@ TYPED_TEST(GenericColumnTest, Slice) {
164164

165165
TYPED_TEST(GenericColumnTest, CloneEmpty) {
166166
auto [column, values] = this->MakeColumnWithValues(100);
167+
EXPECT_EQ(values.size(), column->Size());
167168

168169
auto clone_untyped = column->CloneEmpty();
169170
// Check that type matches
@@ -175,6 +176,7 @@ TYPED_TEST(GenericColumnTest, CloneEmpty) {
175176

176177
TYPED_TEST(GenericColumnTest, Clear) {
177178
auto [column, values] = this->MakeColumnWithValues(100);
179+
EXPECT_EQ(values.size(), column->Size());
178180

179181
column->Clear();
180182
EXPECT_EQ(0u, column->Size());

ut/client_ut.cpp

Lines changed: 1 addition & 12 deletions
Original file line numberDiff line numberDiff line change
@@ -12,17 +12,6 @@
1212

1313
using namespace clickhouse;
1414

15-
namespace clickhouse {
16-
std::ostream & operator<<(std::ostream & ostr, const ServerInfo & server_info) {
17-
return ostr << server_info.name << "/" << server_info.display_name
18-
<< " ver "
19-
<< server_info.version_major << "."
20-
<< server_info.version_minor << "."
21-
<< server_info.version_patch
22-
<< " (" << server_info.revision << ")";
23-
}
24-
}
25-
2615
namespace {
2716

2817
uint64_t versionNumber(
@@ -1013,7 +1002,7 @@ ColumnRef RoundtripColumnValues(Client& client, ColumnRef expected) {
10131002
result->Append(b[0]);
10141003
});
10151004

1016-
EXPECT_EQ(expected->Type(), result->Type());
1005+
EXPECT_EQ(expected->GetType(), result->GetType());
10171006
EXPECT_EQ(expected->Size(), result->Size());
10181007
return result;
10191008
}

ut/utils.cpp

Lines changed: 36 additions & 23 deletions
Original file line numberDiff line numberDiff line change
@@ -1,6 +1,7 @@
11
#include "utils.h"
22

33
#include <clickhouse/block.h>
4+
#include <clickhouse/client.h>
45
#include <clickhouse/columns/column.h>
56
#include <clickhouse/columns/array.h>
67
#include <clickhouse/columns/date.h>
@@ -154,28 +155,6 @@ std::ostream & operator<<(std::ostream & ostr, const ColumnValue& v) {
154155

155156
}
156157

157-
std::ostream& operator<<(std::ostream & ostr, const Block & block) {
158-
if (block.GetRowCount() == 0 || block.GetColumnCount() == 0)
159-
return ostr;
160-
161-
for (size_t col = 0; col < block.GetColumnCount(); ++col) {
162-
const auto & c = block[col];
163-
ostr << c->GetType().GetName() << " [";
164-
165-
for (size_t row = 0; row < block.GetRowCount(); ++row) {
166-
printColumnValue(c, row, ostr);
167-
if (row != block.GetRowCount() - 1)
168-
ostr << ", ";
169-
}
170-
ostr << "]";
171-
172-
if (col != block.GetColumnCount() - 1)
173-
ostr << "\n";
174-
}
175-
176-
return ostr;
177-
}
178-
179158
std::ostream& operator<<(std::ostream & ostr, const PrettyPrintBlock & pretty_print_block) {
180159
// Pretty-print block:
181160
// - names of each column
@@ -249,7 +228,41 @@ std::ostream& operator<<(std::ostream& ostr, const in6_addr& addr) {
249228
return ostr << ip_str;
250229
}
251230

252-
std::ostream& operator<<(std::ostream & ostr, const clickhouse::Type & type) {
231+
namespace clickhouse {
232+
233+
std::ostream& operator<<(std::ostream & ostr, const Block & block) {
234+
if (block.GetRowCount() == 0 || block.GetColumnCount() == 0)
235+
return ostr;
236+
237+
for (size_t col = 0; col < block.GetColumnCount(); ++col) {
238+
const auto & c = block[col];
239+
ostr << c->GetType().GetName() << " [";
240+
241+
for (size_t row = 0; row < block.GetRowCount(); ++row) {
242+
printColumnValue(c, row, ostr);
243+
if (row != block.GetRowCount() - 1)
244+
ostr << ", ";
245+
}
246+
ostr << "]";
247+
248+
if (col != block.GetColumnCount() - 1)
249+
ostr << "\n";
250+
}
251+
252+
return ostr;
253+
}
254+
255+
std::ostream& operator<<(std::ostream & ostr, const Type & type) {
253256
return ostr << type.GetName();
254257
}
255258

259+
std::ostream & operator<<(std::ostream & ostr, const ServerInfo & server_info) {
260+
return ostr << server_info.name << "/" << server_info.display_name
261+
<< " ver "
262+
<< server_info.version_major << "."
263+
<< server_info.version_minor << "."
264+
<< server_info.version_patch
265+
<< " (" << server_info.revision << ")";
266+
}
267+
268+
}

ut/utils.h

Lines changed: 7 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -20,6 +20,7 @@
2020
namespace clickhouse {
2121
class Block;
2222
class Type;
23+
struct ServerInfo;
2324
}
2425

2526
template <typename ResultType = std::string>
@@ -93,9 +94,13 @@ struct PrettyPrintBlock {
9394
const clickhouse::Block & block;
9495
};
9596

96-
std::ostream& operator<<(std::ostream & ostr, const clickhouse::Block & block);
97+
namespace clickhouse {
98+
std::ostream& operator<<(std::ostream & ostr, const Block & block);
99+
std::ostream& operator<<(std::ostream & ostr, const Type & type);
100+
std::ostream & operator<<(std::ostream & ostr, const ServerInfo & server_info);
101+
}
102+
97103
std::ostream& operator<<(std::ostream & ostr, const PrettyPrintBlock & block);
98-
std::ostream& operator<<(std::ostream & ostr, const clickhouse::Type & type);
99104
std::ostream& operator<<(std::ostream& ostr, const in_addr& addr);
100105
std::ostream& operator<<(std::ostream& ostr, const in6_addr& addr);
101106

0 commit comments

Comments
 (0)