Skip to content

Commit b274c81

Browse files
committed
Fixed number rows validation
1 parent 21b4991 commit b274c81

File tree

2 files changed

+4
-3
lines changed

2 files changed

+4
-3
lines changed

ydb/core/fq/libs/row_dispatcher/json_parser.cpp

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -177,8 +177,8 @@ class TJsonParser::TImpl {
177177
}
178178
rowId++;
179179
}
180-
if (rowId < Buffer.NumberValues) {
181-
throw yexception() << "Failed to parse json messages, expected " << Buffer.NumberValues << " json rows but got " << rowId;
180+
if (rowId != Buffer.NumberValues) {
181+
throw yexception() << "Failed to parse json messages, expected " << Buffer.NumberValues << " json rows from offset " << Buffer.Offsets.front() << " but got " << rowId;
182182
}
183183

184184
for (size_t i = 0; i < Columns.size(); ++i) {

ydb/core/fq/libs/row_dispatcher/ut/json_parser_ut.cpp

Lines changed: 2 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -235,8 +235,9 @@ Y_UNIT_TEST_SUITE(TJsonParserTests) {
235235
}
236236

237237
Y_UNIT_TEST_F(ThrowExceptionByError, TFixture) {
238-
MakeParser({"a2", "a1"});
238+
MakeParser({"a"});
239239
UNIT_ASSERT_EXCEPTION_CONTAINS(PushToParser(42, R"(ydb)"), simdjson::simdjson_error, "INCORRECT_TYPE: The JSON element does not have the requested type.");
240+
UNIT_ASSERT_EXCEPTION_CONTAINS(PushToParser(42, R"({"a": "value1"} {"a": "value2"})"), yexception, "Failed to parse json messages, expected 1 json rows from offset 42 but got 2");
240241
}
241242
}
242243

0 commit comments

Comments
 (0)