Skip to content

Commit

Permalink
fix RawBytes counter (ydb-platform#14594)
Browse files Browse the repository at this point in the history
  • Loading branch information
swalrus1 authored Feb 15, 2025
1 parent e3bc3bd commit 709b413
Show file tree
Hide file tree
Showing 2 changed files with 21 additions and 1 deletion.
20 changes: 20 additions & 0 deletions ydb/core/kqp/ut/olap/kqp_olap_stats_ut.cpp
Original file line number Diff line number Diff line change
Expand Up @@ -3,6 +3,9 @@
#include <ydb/core/testlib/common_helper.h>
#include <ydb/core/tx/columnshard/hooks/testing/controller.h>

#include <ut/olap/helpers/get_value.h>
#include <ut/olap/helpers/query_executor.h>

namespace NKikimr {
namespace NKqp {

Expand Down Expand Up @@ -196,6 +199,23 @@ Y_UNIT_TEST_SUITE(KqpOlapStats) {
const auto& storeDescription = describeStoreResult.GetTableDescription();

UNIT_ASSERT_VALUES_EQUAL(2000, storeDescription.GetTableRows());

{
auto selectQuery = TString(R"(
SELECT
SUM(ColumnBlobBytes) AS BlobBytes,
SUM(ColumnRawBytes) AS RawBytes,
SUM(Rows) AS Rows,
COUNT(*) AS Portions
FROM `/Root/TableStoreTest/.sys/store_primary_index_portion_stats`
)");

auto client = testHelper.GetKikimr().GetTableClient();
auto rows = ExecuteScanQuery(client, selectQuery);
UNIT_ASSERT_VALUES_EQUAL(rows.size(), 1);
UNIT_ASSERT_VALUES_EQUAL(GetUint64(rows[0].at("Rows")), storeDescription.GetTableRows());
UNIT_ASSERT_VALUES_EQUAL(GetUint64(rows[0].at("BlobBytes")), storeDescription.GetTableSize());
}
}
}

Expand Down
2 changes: 1 addition & 1 deletion ydb/core/tx/columnshard/counters/portions.h
Original file line number Diff line number Diff line change
Expand Up @@ -55,7 +55,7 @@ class TSimplePortionsGroupInfo {
TSimplePortionsGroupInfo& operator+=(const TSimplePortionsGroupInfo& item) {
Blobs += item.Blobs;
BlobBytes += item.BlobBytes;
RawBytes += RawBytes + item.RawBytes;
RawBytes += item.RawBytes;
Count += item.Count;
RecordsCount += item.RecordsCount;
for (const auto& [channel, bytes] : item.BytesByChannel) {
Expand Down

0 comments on commit 709b413

Please sign in to comment.