@@ -140,26 +140,55 @@ Y_UNIT_TEST_SUITE(KqpQueryService) {
140140 auto kikimr = DefaultKikimrRunner ();
141141 auto db = kikimr.GetQueryClient ();
142142
143- auto it = db.StreamExecuteQuery (R"(
144- SELECT Key, Value2 FROM TwoShard WHERE Value2 > 0;
145- )" , TTxControl::BeginTx ().CommitTx ()).ExtractValueSync ();
146- UNIT_ASSERT_C (it.IsSuccess (), it.GetIssues ().ToString ());
143+ {
144+ auto it = db.StreamExecuteQuery (R"(
145+ SELECT Key, Value2 FROM TwoShard WHERE Value2 > 0;
146+ )" , TTxControl::BeginTx ().CommitTx ()).ExtractValueSync ();
147+ UNIT_ASSERT_C (it.IsSuccess (), it.GetIssues ().ToString ());
148+
149+ ui64 count = 0 ;
150+ for (;;) {
151+ auto streamPart = it.ReadNext ().GetValueSync ();
152+ if (!streamPart.IsSuccess ()) {
153+ UNIT_ASSERT_C (streamPart.EOS (), streamPart.GetIssues ().ToString ());
154+ break ;
155+ }
147156
148- ui64 count = 0 ;
149- for (;;) {
150- auto streamPart = it.ReadNext ().GetValueSync ();
151- if (!streamPart.IsSuccess ()) {
152- UNIT_ASSERT_C (streamPart.EOS (), streamPart.GetIssues ().ToString ());
153- break ;
157+ if (streamPart.HasResultSet ()) {
158+ auto resultSet = streamPart.ExtractResultSet ();
159+ count += resultSet.RowsCount ();
160+ }
154161 }
155162
156- if (streamPart.HasResultSet ()) {
157- auto resultSet = streamPart.ExtractResultSet ();
158- count += resultSet.RowsCount ();
159- }
163+ UNIT_ASSERT_VALUES_EQUAL (count, 2 );
160164 }
161165
162- UNIT_ASSERT_VALUES_EQUAL (count, 2 );
166+ {
167+ auto it = db.StreamExecuteQuery (R"(
168+ SELECT Key, Value2 FROM TwoShard WHERE false ORDER BY Key > 0;
169+ )" , TTxControl::BeginTx ().CommitTx ()).ExtractValueSync ();
170+ UNIT_ASSERT_C (it.IsSuccess (), it.GetIssues ().ToString ());
171+
172+ ui32 rsCount = 0 ;
173+ ui32 columns = 0 ;
174+ for (;;) {
175+ auto streamPart = it.ReadNext ().GetValueSync ();
176+ if (!streamPart.IsSuccess ()) {
177+ UNIT_ASSERT_C (streamPart.EOS (), streamPart.GetIssues ().ToString ());
178+ break ;
179+ }
180+
181+ if (streamPart.HasResultSet ()) {
182+ auto resultSet = streamPart.ExtractResultSet ();
183+ columns = resultSet.ColumnsCount ();
184+ CompareYson (R"( [])" , FormatResultSetYson (resultSet));
185+ rsCount++;
186+ }
187+ }
188+
189+ UNIT_ASSERT_VALUES_EQUAL (rsCount, 1 );
190+ UNIT_ASSERT_VALUES_EQUAL (columns, 2 );
191+ }
163192 }
164193
165194 void CheckQueryResult (TExecuteQueryResult result) {
0 commit comments