diff options
| author | chertus <[email protected]> | 2022-12-28 21:08:16 +0300 |
|---|---|---|
| committer | chertus <[email protected]> | 2022-12-28 21:08:16 +0300 |
| commit | 28a89470b388d97ecddfaddee9ea521b8a8d900f (patch) | |
| tree | 5438136cf2a77e816a5384d4575e7099f6a7b95b | |
| parent | bbacf69a08eb0e0462465b1d8dacf55b7594da32 (diff) | |
fix SSA over stats sys view
| -rw-r--r-- | ydb/core/kqp/ut/olap/kqp_olap_ut.cpp | 93 | ||||
| -rw-r--r-- | ydb/core/tx/columnshard/columnshard__scan.cpp | 3 | ||||
| -rw-r--r-- | ydb/core/tx/columnshard/columnshard__stats_scan.h | 10 |
3 files changed, 53 insertions, 53 deletions
diff --git a/ydb/core/kqp/ut/olap/kqp_olap_ut.cpp b/ydb/core/kqp/ut/olap/kqp_olap_ut.cpp index d01dad2a96c..24b562b3122 100644 --- a/ydb/core/kqp/ut/olap/kqp_olap_ut.cpp +++ b/ydb/core/kqp/ut/olap/kqp_olap_ut.cpp @@ -2635,28 +2635,27 @@ Y_UNIT_TEST_SUITE(KqpOlap) { UNIT_ASSERT_VALUES_EQUAL(GetUint64(rows[2].at("PathId")), 3); } - // Uncomment when KIKIMR-16655 will be fixed - // { - // auto selectQuery = TString(R"( - // SELECT - // PathId, - // SUM(Rows) as rows, - // SUM(Bytes) as bytes, - // SUM(RawBytes) as bytes_raw, - // SUM(Portions) as portions, - // SUM(Blobs) as blobs - // FROM `/Root/olapStore/.sys/store_primary_index_stats` - // WHERE - // PathId == UInt64("3") AND Kind < UInt32("4") - // GROUP BY PathId - // ORDER BY rows DESC - // LIMIT 10 - // )"); - - // auto rows = ExecuteScanQuery(tableClient, selectQuery); - // UNIT_ASSERT_VALUES_EQUAL(rows.size(), 1ull); - // UNIT_ASSERT_VALUES_EQUAL(GetUint64(rows[0].at("PathId")), 3); - // } + { + auto selectQuery = TString(R"( + SELECT + PathId, + SUM(Rows) as rows, + SUM(Bytes) as bytes, + SUM(RawBytes) as bytes_raw, + SUM(Portions) as portions, + SUM(Blobs) as blobs + FROM `/Root/olapStore/.sys/store_primary_index_stats` + WHERE + PathId == UInt64("3") AND Kind < UInt32("4") + GROUP BY PathId + ORDER BY rows DESC + LIMIT 10 + )"); + + auto rows = ExecuteScanQuery(tableClient, selectQuery); + UNIT_ASSERT_VALUES_EQUAL(rows.size(), 1ull); + UNIT_ASSERT_VALUES_EQUAL(GetUint64(rows[0].at("PathId")), 3); + } { auto selectQuery = TString(R"( @@ -2681,17 +2680,16 @@ Y_UNIT_TEST_SUITE(KqpOlap) { UNIT_ASSERT_VALUES_EQUAL(GetUint64(rows[1].at("PathId")), 4); } - // Uncomment when KIKIMR-16655 will be fixed - // { - // auto selectQuery = TString(R"( - // SELECT count(*) - // FROM `/Root/olapStore/.sys/store_primary_index_stats` - // )"); + { + auto selectQuery = TString(R"( + SELECT count(*) + FROM `/Root/olapStore/.sys/store_primary_index_stats` + )"); - // auto rows = ExecuteScanQuery(tableClient, selectQuery); - // // 3 Tables with 3 Shards each and 4 KindId-s of stats - // UNIT_ASSERT_VALUES_EQUAL(GetUint64(rows[0].at("column0")), 3*3*numKinds); - // } + auto rows = ExecuteScanQuery(tableClient, selectQuery); + // 3 Tables with 3 Shards each and 4 KindId-s of stats + UNIT_ASSERT_VALUES_EQUAL(GetUint64(rows[0].at("column0")), 3*3*numKinds); + } { auto selectQuery = TString(R"( @@ -2708,22 +2706,21 @@ Y_UNIT_TEST_SUITE(KqpOlap) { UNIT_ASSERT_GE(GetUint64(rows[0].at("column2")), 3ull); } - // Uncomment when KIKIMR-16655 will be fixed - // { - // auto selectQuery = TString(R"( - // SELECT PathId, count(*), sum(Rows), sum(Bytes), sum(RawBytes) - // FROM `/Root/olapStore/.sys/store_primary_index_stats` - // GROUP BY PathId - // ORDER BY PathId - // )"); - - // auto rows = ExecuteScanQuery(tableClient, selectQuery); - // UNIT_ASSERT_VALUES_EQUAL(rows.size(), 3ull); - // for (ui64 pathId = 3, row = 0; pathId <= 5; ++pathId, ++row) { - // UNIT_ASSERT_VALUES_EQUAL(GetUint64(rows[row].at("PathId")), pathId); - // UNIT_ASSERT_VALUES_EQUAL(GetUint64(rows[row].at("column1")), 3*numKinds); - // } - // } + { + auto selectQuery = TString(R"( + SELECT PathId, count(*), sum(Rows), sum(Bytes), sum(RawBytes) + FROM `/Root/olapStore/.sys/store_primary_index_stats` + GROUP BY PathId + ORDER BY PathId + )"); + + auto rows = ExecuteScanQuery(tableClient, selectQuery); + UNIT_ASSERT_VALUES_EQUAL(rows.size(), 3ull); + for (ui64 pathId = 3, row = 0; pathId <= 5; ++pathId, ++row) { + UNIT_ASSERT_VALUES_EQUAL(GetUint64(rows[row].at("PathId")), pathId); + UNIT_ASSERT_VALUES_EQUAL(GetUint64(rows[row].at("column1")), 3*numKinds); + } + } } Y_UNIT_TEST(PredicatePushdownWithParameters) { diff --git a/ydb/core/tx/columnshard/columnshard__scan.cpp b/ydb/core/tx/columnshard/columnshard__scan.cpp index a942dbee54a..e4c57a60121 100644 --- a/ydb/core/tx/columnshard/columnshard__scan.cpp +++ b/ydb/core/tx/columnshard/columnshard__scan.cpp @@ -200,7 +200,8 @@ private: LOG_DEBUG_S(*TlsActivationContext, NKikimrServices::TX_COLUMNSHARD_SCAN, "Scan " << ScanActorId << " producing result: got ready result" << " txId: " << TxId << " scanId: " << ScanId << " gen: " << ScanGen << " table: " << TablePath - << " blob (" << numColumns << " columns, " << numRows << " rows)"); + << " blob (" << numColumns << " columns, " << numRows << " rows)" + << " format: " << NKikimrTxDataShard::EScanDataFormat_Name(DataFormat)); switch (DataFormat) { case NKikimrTxDataShard::EScanDataFormat::UNSPECIFIED: diff --git a/ydb/core/tx/columnshard/columnshard__stats_scan.h b/ydb/core/tx/columnshard/columnshard__stats_scan.h index 31d4e3e29c4..c31df229a78 100644 --- a/ydb/core/tx/columnshard/columnshard__stats_scan.h +++ b/ydb/core/tx/columnshard/columnshard__stats_scan.h @@ -60,13 +60,15 @@ public: // Leave only requested columns auto resultBatch = NArrow::ExtractColumns(batch, ResultSchema); + NOlap::TPartialReadResult out{ + .ResultBatch = std::move(resultBatch), + .LastReadKey = std::move(lastKey) + }; + if (ReadMetadata->Program) { - auto status = ApplyProgram(batch, ReadMetadata->Program->Steps, NArrow::GetCustomExecContext()); + auto status = ApplyProgram(out.ResultBatch, ReadMetadata->Program->Steps, NArrow::GetCustomExecContext()); Y_VERIFY_S(status.ok(), status.message()); } - - NOlap::TPartialReadResult out{std::move(resultBatch), std::move(lastKey)}; - return out; } |
