Skip to content

Commit f810c16

Browse files
committed
Fix build attempt 5
1 parent 9c411b5 commit f810c16

File tree

2 files changed

+13
-12
lines changed

2 files changed

+13
-12
lines changed

ut/columns_ut.cpp

+2-1
Original file line numberDiff line numberDiff line change
@@ -12,13 +12,14 @@
1212
#include <clickhouse/columns/ip6.h>
1313
#include <clickhouse/base/input.h>
1414
#include <clickhouse/base/output.h>
15+
#include <clickhouse/base/socket.h> // for ipv4-ipv6 platform-specific stuff
1516

1617
#include <gtest/gtest.h>
1718
#include "utils.h"
1819

1920
#include <string_view>
21+
#include <sstream>
2022

21-
#include <clickhouse/base/socket.h> // for ipv4-ipv6 platform-specific stuff
2223

2324
// only compare PODs of equal size this way
2425
template <typename L, typename R, typename

ut/utils.cpp

+11-11
Original file line numberDiff line numberDiff line change
@@ -13,6 +13,7 @@
1313
#include <clickhouse/base/socket.h> // for ipv4-ipv6 platform-specific stuff
1414

1515
#include <iomanip>
16+
#include <sstream>
1617

1718
namespace {
1819
using namespace clickhouse;
@@ -46,9 +47,9 @@ bool doPrintValue(const ColumnRef & c, const size_t row, std::ostream & ostr) {
4647
return false;
4748
}
4849

49-
template <>
50-
bool doPrintValue<ColumnEnum8>(const ColumnRef & c, const size_t row, std::ostream & ostr) {
51-
if (const auto & casted_c = c->As<ColumnEnum8>()) {
50+
template <typename ColumnEnumType>
51+
bool doPrintEnumValue(const ColumnRef & c, const size_t row, std::ostream & ostr) {
52+
if (const auto & casted_c = c->As<ColumnEnumType>()) {
5253
// via temporary stream to preserve fill and alignment of the ostr
5354
std::stringstream sstr;
5455
sstr << casted_c->NameAt(row) << " (" << static_cast<int64_t>(casted_c->At(row)) << ")";
@@ -58,15 +59,14 @@ bool doPrintValue<ColumnEnum8>(const ColumnRef & c, const size_t row, std::ostre
5859
return false;
5960
}
6061

62+
template <>
63+
bool doPrintValue<ColumnEnum8>(const ColumnRef & c, const size_t row, std::ostream & ostr) {
64+
return doPrintEnumValue<ColumnEnum8>(c, row, ostr);
65+
}
66+
6167
template <>
6268
bool doPrintValue<ColumnEnum16>(const ColumnRef & c, const size_t row, std::ostream & ostr) {
63-
if (const auto & casted_c = c->As<ColumnEnum16>()) {
64-
std::stringstream sstr;
65-
sstr << casted_c->NameAt(row) << " (" << static_cast<int64_t>(casted_c->At(row)) << ")";
66-
ostr << sstr.str();
67-
return true;
68-
}
69-
return false;
69+
return doPrintEnumValue<ColumnEnum16>(c, row, ostr);
7070
}
7171

7272
std::ostream & printColumnValue(const ColumnRef& c, const size_t row, std::ostream & ostr) {
@@ -152,7 +152,7 @@ std::ostream& operator<<(std::ostream & ostr, const PrettyPrintBlock & pretty_pr
152152
sstr << cross << std::setw(width + 2) << std::setfill(vertical_bar) << vertical_bar;
153153
}
154154
sstr << cross;
155-
const auto split_line = sstr.str();
155+
const std::string split_line(sstr.str());
156156

157157
ostr << split_line << std::endl;
158158
// column name

0 commit comments

Comments
 (0)