Skip to content

Commit b0aecbd

Browse files
valid query
1 parent 9f3244b commit b0aecbd

File tree

3 files changed

+15
-7
lines changed

3 files changed

+15
-7
lines changed

tests/integration/bulk_upsert_simple_it/bulk_upsert.cpp

Lines changed: 5 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -1,7 +1,5 @@
11
#include "bulk_upsert.h"
22

3-
#include <src/library/getopt/last_getopt.h>
4-
53
#include <filesystem>
64

75
static constexpr size_t BATCH_SIZE = 1000;
@@ -144,6 +142,11 @@ TStatistic Select(TTableClient& client, const std::string& path) {
144142
uint64_t sumHost = 0;
145143
uint64_t rowCount = 0;
146144

145+
if (parser.ColumnsCount() != 3 || parser.RowsCount() != 1) {
146+
throw TYdbErrorException(TStatus(EStatus::GENERIC_ERROR,
147+
{NYql::TIssue("The number of columns should be: 3.\nThe number of rows should be: 1")}));
148+
}
149+
147150
if (parser.TryNextRow()) {
148151
sumApp = *parser.ColumnParser("column0").GetOptionalInt64();
149152
sumHost = *parser.ColumnParser("column1").GetOptionalInt64();

tests/integration/bulk_upsert_simple_it/bulk_upsert.h

Lines changed: 1 addition & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -2,6 +2,7 @@
22

33
#include <ydb-cpp-sdk/client/driver/driver.h>
44
#include <ydb-cpp-sdk/client/table/table.h>
5+
#include <src/library/getopt/last_getopt.h>
56

67
using namespace NYdb;
78
using namespace NYdb::NTable;

tests/integration/bulk_upsert_simple_it/main.cpp

Lines changed: 9 additions & 5 deletions
Original file line numberDiff line numberDiff line change
@@ -36,11 +36,15 @@ TEST(Integration, BulkUpsert) {
3636
}
3737
}
3838

39-
auto [sumApp, sumHost, rowCount] = Select(client, path);
40-
41-
EXPECT_EQ(rowCount, correctRowCount);
42-
EXPECT_EQ(sumApp, correctSumApp);
43-
EXPECT_EQ(sumHost, correctSumHost);
39+
try {
40+
auto [sumApp, sumHost, rowCount] = Select(client, path);
41+
EXPECT_EQ(rowCount, correctRowCount);
42+
EXPECT_EQ(sumApp, correctSumApp);
43+
EXPECT_EQ(sumHost, correctSumHost);
44+
} catch (const TYdbErrorException& e) {
45+
driver.Stop(true);
46+
FAIL() << "Execution failed due to fatal error:\nStatus: " << ToString(e.Status.GetStatus()) << std::endl << e.Status.GetIssues().ToString();
47+
}
4448

4549
DropTable(client, path);
4650
driver.Stop(true);

0 commit comments

Comments
 (0)