Skip to content

Commit

Permalink
KIKIMR-20778: Тест на лаг обновления данных через bulk_upsert (ydb-pl…
Browse files Browse the repository at this point in the history
  • Loading branch information
iddqdex authored Jan 18, 2024
1 parent 63fd598 commit 9e04a3a
Showing 1 changed file with 39 additions and 1 deletion.
40 changes: 39 additions & 1 deletion ydb/core/kqp/ut/olap/kqp_olap_ut.cpp
Original file line number Diff line number Diff line change
Expand Up @@ -534,8 +534,9 @@ Y_UNIT_TEST_SUITE(KqpOlap) {
void WriteTestData(TKikimrRunner& kikimr, TString testTable, ui64 pathIdBegin, ui64 tsBegin, size_t rowCount, bool withSomeNulls = false) {
UNIT_ASSERT(testTable != "/Root/benchTable"); // TODO: check schema instead
TLocalHelper lHelper(kikimr);
if (withSomeNulls)
if (withSomeNulls) {
lHelper.WithSomeNulls();
}
auto batch = lHelper.TestArrowBatch(pathIdBegin, tsBegin, rowCount);
lHelper.SendDataViaActorSystem(testTable, batch);
}
Expand Down Expand Up @@ -5292,6 +5293,43 @@ Y_UNIT_TEST_SUITE(KqpOlap) {
testHelper.ReadData("SELECT * FROM `/Root/ColumnTableTest` WHERE id=2", "[[2;\"test_res_2\";#;[\"val1\"]]]");
}

Y_UNIT_TEST(BulkUpsertUpdate) {
TKikimrSettings runnerSettings;
runnerSettings.WithSampleTables = false;
auto csController = NYDBTest::TControllers::RegisterCSControllerGuard<NYDBTest::NColumnShard::TController>();
TTestHelper testHelper(runnerSettings);

TVector<TTestHelper::TColumnSchema> schema = {
TTestHelper::TColumnSchema().SetName("id").SetType(NScheme::NTypeIds::Int64).SetNullable(false),
TTestHelper::TColumnSchema().SetName("value").SetType(NScheme::NTypeIds::Int32).SetNullable(false),
};

TTestHelper::TColumnTable testTable;
testTable.SetName("/Root/ColumnTableTest").SetPrimaryKey({ "id" }).SetSharding({ "id" }).SetSchema(schema);
testHelper.CreateTable(testTable);
{
TTestHelper::TUpdatesBuilder tableInserter(testTable.GetArrowSchema(schema));
tableInserter.AddRow().Add(1).Add(10);
testHelper.BulkUpsert(testTable, tableInserter);
}
while (csController->GetIndexations().Val() < 1) {
Cout << "Wait indexation..." << Endl;
Sleep(TDuration::Seconds(2));
}
testHelper.ReadData("SELECT value FROM `/Root/ColumnTableTest` WHERE id = 1", "[[10]]");
{
TTestHelper::TUpdatesBuilder tableInserter(testTable.GetArrowSchema(schema));
tableInserter.AddRow().Add(1).Add(110);
testHelper.BulkUpsert(testTable, tableInserter);
}
testHelper.ReadData("SELECT value FROM `/Root/ColumnTableTest` WHERE id = 1", "[[110]]");
while (csController->GetIndexations().Val() < 2) {
Cout << "Wait indexation..." << Endl;
Sleep(TDuration::Seconds(2));
}
testHelper.ReadData("SELECT value FROM `/Root/ColumnTableTest` WHERE id = 1", "[[110]]");
}

}

} // namespace NKqp
Expand Down

0 comments on commit 9e04a3a

Please sign in to comment.