Skip to content

Commit d05ff45

Browse files
authored
add test for describe table store (#1030)
* add test
1 parent 26e1923 commit d05ff45

File tree

1 file changed

+45
-0
lines changed

1 file changed

+45
-0
lines changed

ydb/core/kqp/ut/olap/kqp_olap_stats_ut.cpp

+45
Original file line numberDiff line numberDiff line change
@@ -152,6 +152,51 @@ Y_UNIT_TEST_SUITE(KqpOlapStats) {
152152
UNIT_ASSERT_VALUES_EQUAL(t + inserted_rows, description.GetTableRows());
153153
}
154154
}
155+
156+
Y_UNIT_TEST(DescibeTableStore) {
157+
auto csController = NYDBTest::TControllers::RegisterCSControllerGuard<TOlapStatsController>();
158+
159+
TKikimrSettings runnerSettings;
160+
runnerSettings.WithSampleTables = false;
161+
162+
TTestHelper testHelper(runnerSettings);
163+
164+
TTestHelper::TColumnTableStore testTableStore;
165+
166+
testTableStore.SetName("/Root/TableStoreTest").SetPrimaryKey({"id"}).SetSchema(schema);
167+
testHelper.CreateTable(testTableStore);
168+
169+
Tests::NCommon::TLoggerInit(testHelper.GetKikimr()).SetPriority(NActors::NLog::PRI_DEBUG).Initialize();
170+
171+
for (size_t t = 0; t < 2; t++) {
172+
TTestHelper::TColumnTable testTable;
173+
testTable.SetName("/Root/TableStoreTest/ColumnTableTest_" + std::to_string(t))
174+
.SetPrimaryKey({"id"})
175+
.SetSharding({"id"})
176+
.SetSchema(schema);
177+
testHelper.CreateTable(testTable);
178+
179+
TTestHelper::TUpdatesBuilder tableInserter(testTable.GetArrowSchema(schema));
180+
for (size_t i = 0; i < inserted_rows; i++) {
181+
tableInserter.AddRow()
182+
.Add(i + t * tables_in_store)
183+
.Add("test_res_" + std::to_string(i + t * tables_in_store))
184+
.AddNull();
185+
}
186+
testHelper.InsertData(testTable, tableInserter);
187+
}
188+
189+
Sleep(TDuration::Seconds(10));
190+
191+
auto settings = TDescribeTableSettings().WithTableStatistics(true);
192+
193+
auto describeStoreResult =
194+
testHelper.GetSession().DescribeTable("/Root/TableStoreTest/", settings).GetValueSync();
195+
UNIT_ASSERT_C(describeStoreResult.IsSuccess(), describeStoreResult.GetIssues().ToString());
196+
const auto& storeDescription = describeStoreResult.GetTableDescription();
197+
198+
UNIT_ASSERT_VALUES_EQUAL(2000, storeDescription.GetTableRows());
199+
}
155200
}
156201

157202
} // namespace NKqp

0 commit comments

Comments
 (0)