Skip to content

Commit e712056

Browse files
committed
Checking that total rows is OK
1 parent 33648df commit e712056

File tree

2 files changed

+10
-3
lines changed

2 files changed

+10
-3
lines changed

ut/client_ut.cpp

Lines changed: 5 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -118,9 +118,10 @@ TEST_P(ClientCase, LowCardinality) {
118118
block.AppendColumn("lc", lc);
119119
client_->Insert("test_clickhouse_cpp.low_cardinality", block);
120120

121+
size_t total_rows = 0;
121122
client_->Select("SELECT lc FROM test_clickhouse_cpp.low_cardinality",
122-
[&data](const Block& block)
123-
{
123+
[&total_rows, &data](const Block& block) {
124+
total_rows += block.GetRowCount();
124125
if (block.GetRowCount() == 0) {
125126
return;
126127
}
@@ -134,6 +135,8 @@ TEST_P(ClientCase, LowCardinality) {
134135
}
135136
}
136137
);
138+
139+
ASSERT_EQ(total_rows, data.size());
137140
}
138141

139142
TEST_P(ClientCase, Generic) {

ut/performance_tests.cpp

Lines changed: 5 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -197,10 +197,12 @@ TYPED_TEST_P(ColumnPerformanceTest, InsertAndSelect) {
197197
}
198198

199199
{
200+
size_t total_rows = 0;
200201
Timer timer;
201202
Timer::DurationType inner_loop_duration{0};
202-
client.Select("SELECT " + column_name + " FROM " + table_name, [&inner_loop_duration](const Block & block) {
203+
client.Select("SELECT " + column_name + " FROM " + table_name, [&total_rows, &inner_loop_duration](const Block & block) {
203204
Timer timer;
205+
total_rows += block.GetRowCount();
204206
if (block.GetRowCount() == 0) {
205207
return;
206208
}
@@ -214,6 +216,8 @@ TYPED_TEST_P(ColumnPerformanceTest, InsertAndSelect) {
214216

215217
auto elapsed = timer.Elapsed() - inner_loop_duration;
216218
std::cerr << "SELECT:\t" << elapsed << std::endl;
219+
220+
ASSERT_EQ(total_rows, ITEMS_COUNT);
217221
}
218222
}
219223

0 commit comments

Comments
 (0)