Skip to content

Commit 7fa3e00

Browse files
fixes
1 parent a4353f8 commit 7fa3e00

File tree

1 file changed

+18
-6
lines changed

1 file changed

+18
-6
lines changed

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

Lines changed: 18 additions & 6 deletions
Original file line numberDiff line numberDiff line change
@@ -28,6 +28,7 @@ Y_UNIT_TEST_SUITE(KqpOlapSysView) {
2828
auto selectQuery = TString(R"(
2929
SELECT PathId, Kind, TabletId, Sum(Rows) as Rows
3030
FROM `/Root/olapStore/.sys/store_primary_index_portion_stats`
31+
WHERE Activity == 1
3132
GROUP BY PathId, Kind, TabletId
3233
ORDER BY TabletId, Kind, PathId
3334
)");
@@ -61,13 +62,14 @@ Y_UNIT_TEST_SUITE(KqpOlapSysView) {
6162
WriteTestData(kikimr, "/Root/olapStore/olapTable_1", 0, 1000000 + i * 10000, 1000);
6263
WriteTestData(kikimr, "/Root/olapStore/olapTable_2", 0, 1000000 + i * 10000, 2000);
6364
}
64-
csController->WaitCompactions(TDuration::Seconds(10));
65+
csController->WaitCompactions(TDuration::Seconds(5));
6566

6667
auto tableClient = kikimr.GetTableClient();
6768
{
6869
auto selectQuery = TString(R"(
6970
SELECT PathId, Kind, TabletId
7071
FROM `/Root/olapStore/olapTable_1/.sys/primary_index_stats`
72+
WHERE Activity = 1
7173
GROUP BY PathId, TabletId, Kind
7274
ORDER BY PathId, TabletId, Kind
7375
)");
@@ -82,6 +84,7 @@ Y_UNIT_TEST_SUITE(KqpOlapSysView) {
8284
auto selectQuery = TString(R"(
8385
SELECT PathId, Kind, TabletId
8486
FROM `/Root/olapStore/olapTable_2/.sys/primary_index_stats`
87+
WHERE Activity = 1
8588
GROUP BY PathId, TabletId, Kind
8689
ORDER BY PathId, TabletId, Kind
8790
)");
@@ -168,10 +171,10 @@ Y_UNIT_TEST_SUITE(KqpOlapSysView) {
168171
helper.ExecuteSchemeQuery("ALTER OBJECT `/Root/olapStore` (TYPE TABLESTORE) SET (ACTION=ALTER_COLUMN, NAME=field, `SERIALIZER.CLASS_NAME`=`ARROW_SERIALIZER`, `COMPRESSION.TYPE`=`zstd`);");
169172
csController->WaitCompactions(TDuration::Seconds(10));
170173
}
171-
const ui64 rawBytesUnpack = rawBytesUnpack1PK - rawBytesPK1;
172-
const ui64 bytesUnpack = bytesUnpack1PK - bytesPK1;
173-
const ui64 rawBytesPack = rawBytesPackAndUnpack2PK - rawBytesUnpack1PK - rawBytesPK1;
174-
const ui64 bytesPack = bytesPackAndUnpack2PK - bytesUnpack1PK - bytesPK1;
174+
const i64 rawBytesUnpack = rawBytesUnpack1PK - rawBytesPK1;
175+
const i64 bytesUnpack = bytesUnpack1PK - bytesPK1;
176+
const i64 rawBytesPack = rawBytesPackAndUnpack2PK - rawBytesUnpack1PK - rawBytesPK1;
177+
const i64 bytesPack = bytesPackAndUnpack2PK - bytesUnpack1PK - bytesPK1;
175178
TStringBuilder result;
176179
result << "unpacked data: " << rawBytesUnpack << " / " << bytesUnpack << Endl;
177180
result << "packed data: " << rawBytesPack << " / " << bytesPack << Endl;
@@ -308,6 +311,7 @@ Y_UNIT_TEST_SUITE(KqpOlapSysView) {
308311
helper.ExecuteSchemeQuery("ALTER OBJECT `/Root/olapStore` (TYPE TABLESTORE) SET (ACTION=UPSERT_INDEX, NAME=pk_int_max, TYPE=MAX, FEATURES=`{\"column_name\" : \"pk_int\"}`);");
309312
helper.ExecuteSchemeQuery("ALTER OBJECT `/Root/olapStore` (TYPE TABLESTORE) SET (ACTION=UPSERT_OPTIONS, SCHEME_NEED_ACTUALIZATION=`true`);");
310313
csController->WaitActualization(TDuration::Seconds(40));
314+
csController->WaitCompactions(TDuration::Seconds(5));
311315
{
312316
ui64 rawBytes2;
313317
ui64 bytes2;
@@ -316,7 +320,7 @@ Y_UNIT_TEST_SUITE(KqpOlapSysView) {
316320
AFL_VERIFY(bytes2 < bytes1 * 0.5)("f1", bytes1)("f2", bytes2);
317321
std::vector<NJson::TJsonValue> stats;
318322
helper.GetStats(stats, true);
319-
AFL_VERIFY(stats.size() == 3);
323+
AFL_VERIFY(stats.size() == 3)("count", stats.size());
320324
for (auto&& i : stats) {
321325
AFL_VERIFY(i.IsArray());
322326
AFL_VERIFY(i.GetArraySafe().size() == 1);
@@ -396,6 +400,7 @@ Y_UNIT_TEST_SUITE(KqpOlapSysView) {
396400
auto selectQuery = TString(R"(
397401
SELECT SUM(BlobRangeSize) as Bytes, SUM(Rows) as Rows, PathId, TabletId
398402
FROM `/Root/olapStore/.sys/store_primary_index_stats`
403+
WHERE Activity == 1
399404
GROUP BY PathId, TabletId
400405
ORDER BY Bytes
401406
)");
@@ -409,6 +414,7 @@ Y_UNIT_TEST_SUITE(KqpOlapSysView) {
409414
auto selectQuery = TString(R"(
410415
SELECT Sum(Rows) as Rows, Kind, Sum(ColumnRawBytes) as RawBytes, PathId
411416
FROM `/Root/olapStore/.sys/store_primary_index_portion_stats`
417+
WHERE Activity == 1
412418
GROUP BY Kind, PathId
413419
ORDER BY PathId, Kind, Rows
414420
)");
@@ -529,6 +535,7 @@ Y_UNIT_TEST_SUITE(KqpOlapSysView) {
529535
auto selectQuery = TString(R"(
530536
SELECT PathId, Kind, TabletId, Sum(BlobRangeSize) as Bytes
531537
FROM `/Root/olapStore/.sys/store_primary_index_stats`
538+
WHERE Activity == 1
532539
GROUP BY PathId, Kind, TabletId
533540
ORDER BY PathId, Kind, TabletId;
534541
)");
@@ -542,6 +549,7 @@ Y_UNIT_TEST_SUITE(KqpOlapSysView) {
542549
auto selectQuery = TString(R"(
543550
SELECT PathId, Kind, TabletId, Sum(BlobRangeSize) as Bytes
544551
FROM `/Root/olapStore/.sys/store_primary_index_stats`
552+
WHERE Activity == 1
545553
GROUP BY PathId, Kind, TabletId
546554
ORDER BY PathId, Kind, TabletId;
547555
)");
@@ -569,6 +577,7 @@ Y_UNIT_TEST_SUITE(KqpOlapSysView) {
569577
SELECT PathId, Kind, TabletId
570578
FROM `/Root/olapStore/.sys/store_primary_index_stats`
571579
WHERE Kind IN ('SPLIT_COMPACTED', 'INACTIVE', 'EVICTED', 'INSERTED')
580+
AND Activity == 1
572581
GROUP BY PathId, Kind, TabletId
573582
ORDER BY PathId, Kind, TabletId;
574583
)");
@@ -700,6 +709,7 @@ Y_UNIT_TEST_SUITE(KqpOlapSysView) {
700709
auto selectQuery = TString(R"(
701710
SELECT PathId, TabletId, Kind
702711
FROM `/Root/olapStore/.sys/store_primary_index_stats`
712+
WHERE Activity == 1
703713
GROUP BY PathId, TabletId, Kind
704714
)");
705715

@@ -715,6 +725,7 @@ Y_UNIT_TEST_SUITE(KqpOlapSysView) {
715725
count(distinct(Kind)) as KindsCount,
716726
count(distinct(TabletId)) as TabletsCount
717727
FROM `/Root/olapStore/.sys/store_primary_index_stats`
728+
WHERE Activity == 1
718729
)");
719730

720731
auto rows = ExecuteScanQuery(tableClient, selectQuery);
@@ -727,6 +738,7 @@ Y_UNIT_TEST_SUITE(KqpOlapSysView) {
727738
auto selectQuery = TString(R"(
728739
SELECT PathId, count(*), sum(Rows), sum(BlobRangeSize), sum(RawBytes)
729740
FROM `/Root/olapStore/.sys/store_primary_index_stats`
741+
WHERE Activity == 1
730742
GROUP BY PathId
731743
ORDER BY PathId
732744
)");

0 commit comments

Comments
 (0)