@@ -2580,6 +2580,60 @@ Y_UNIT_TEST_SUITE(KqpQuery) {
25802580 }
25812581 }
25822582
2583+ Y_UNIT_TEST_TWIN (UpdateThenDelete, UseSink) {
2584+ NKikimrConfig::TAppConfig appConfig;
2585+ appConfig.MutableTableServiceConfig ()->SetEnableOltpSink (UseSink);
2586+ auto settings = TKikimrSettings ()
2587+ .SetAppConfig (appConfig)
2588+ .SetWithSampleTables (true );
2589+
2590+ TKikimrRunner kikimr (settings);
2591+ auto client = kikimr.GetTableClient ();
2592+
2593+ {
2594+ const TString query = R"(
2595+ DECLARE $data AS List<Struct<
2596+ Key: String,
2597+ Value: String
2598+ >>;
2599+
2600+ UPSERT INTO KeyValue2 SELECT * FROM AS_TABLE($data);
2601+
2602+ DELETE FROM KeyValue2 ON SELECT * FROM KeyValue2 AS a LEFT ONLY JOIN AS_TABLE($data) AS b USING (Key);
2603+ )" ;
2604+
2605+ TTypeBuilder builder;
2606+ builder
2607+ .BeginStruct ()
2608+ .AddMember (" Key" , TTypeBuilder ().Primitive (NYdb::EPrimitiveType::String).Build ())
2609+ .AddMember (" Value" , TTypeBuilder ().Primitive (NYdb::EPrimitiveType::String).Build ())
2610+ .EndStruct ();
2611+
2612+ auto params = client.GetParamsBuilder ()
2613+ .AddParam (" $data" )
2614+ .EmptyList (builder.Build ())
2615+ .Build ()
2616+ .Build ();
2617+
2618+ auto session = client.CreateSession ().GetValueSync ().GetSession ();
2619+ auto result = session.ExecuteDataQuery (query, NYdb::NTable::TTxControl::BeginTx ().CommitTx (), std::move (params)).ExtractValueSync ();
2620+ UNIT_ASSERT_C (result.GetStatus () == NYdb::EStatus::SUCCESS, result.GetIssues ().ToString ());
2621+
2622+ }
2623+ {
2624+ const TString query = R"(
2625+ SELECT * FROM KeyValue2;
2626+ )" ;
2627+
2628+ auto session = client.CreateSession ().GetValueSync ().GetSession ();
2629+ auto result = session.ExecuteDataQuery (query, NYdb::NTable::TTxControl::BeginTx ().CommitTx ()).ExtractValueSync ();
2630+ UNIT_ASSERT_C (result.GetStatus () == NYdb::EStatus::SUCCESS, result.GetIssues ().ToString ());
2631+
2632+ Cerr << FormatResultSetYson (result.GetResultSet (0 )) << Endl;
2633+ UNIT_ASSERT_VALUES_EQUAL (0 , result.GetResultSet (0 ).RowsCount ());
2634+ }
2635+ }
2636+
25832637}
25842638
25852639} // namespace NKqp
0 commit comments