@@ -154,6 +154,58 @@ Y_UNIT_TEST_SUITE(KqpRbo) {
154154 }
155155 }
156156
157+ Y_UNIT_TEST (FilterYql) {
158+ NKikimrConfig::TAppConfig appConfig;
159+ appConfig.MutableTableServiceConfig ()->SetEnableNewRBO (true );
160+ TKikimrRunner kikimr (NKqp::TKikimrSettings (appConfig).SetWithSampleTables (false ));
161+ auto db = kikimr.GetTableClient ();
162+ auto session = db.CreateSession ().GetValueSync ().GetSession ();
163+
164+ session.ExecuteSchemeQuery (R"(
165+ CREATE TABLE `/Root/foo` (
166+ id Int64 NOT NULL,
167+ name String,
168+ primary key(id)
169+ );
170+ )" ).GetValueSync ();
171+
172+ NYdb::TValueBuilder rows;
173+ rows.BeginList ();
174+ for (size_t i = 0 ; i < 10 ; ++i) {
175+ rows.AddListItem ()
176+ .BeginStruct ()
177+ .AddMember (" id" ).Int64 (i)
178+ .AddMember (" name" ).String (std::to_string (i) + " _name" )
179+ .EndStruct ();
180+ }
181+ rows.EndList ();
182+
183+ auto resultUpsert = db.BulkUpsert (" /Root/foo" , rows.Build ()).GetValueSync ();
184+ UNIT_ASSERT_C (resultUpsert.IsSuccess (), resultUpsert.GetIssues ().ToString ());
185+
186+ db = kikimr.GetTableClient ();
187+ auto session2 = db.CreateSession ().GetValueSync ().GetSession ();
188+
189+ std::vector<std::string> queries = {
190+ R"(
191+ PRAGMA TablePathPrefix='/Root';
192+ PRAGMA YqlSelect = 'force';
193+ SELECT id as id2 FROM foo WHERE name != '3_name';
194+ )"
195+ };
196+
197+ std::vector<std::string> results = {
198+ R"( [["0"];["1"];["2"];["4"];["5"];["6"];["7"];["8"];["9"]])" ,
199+ };
200+
201+ for (ui32 i = 0 ; i < queries.size (); ++i) {
202+ const auto &query = queries[i];
203+ auto result = session2.ExecuteDataQuery (query, TTxControl::BeginTx ().CommitTx ()).GetValueSync ();
204+ UNIT_ASSERT_C (result.IsSuccess (), result.GetIssues ().ToString ());
205+ UNIT_ASSERT_VALUES_EQUAL (FormatResultSetYson (result.GetResultSet (0 )), results[i]);
206+ }
207+ }
208+
157209 Y_UNIT_TEST (ConstantFolding) {
158210 NKikimrConfig::TAppConfig appConfig;
159211 appConfig.MutableTableServiceConfig ()->SetEnableNewRBO (true );
0 commit comments