diff --git a/ydb/core/sys_view/common/schema.h b/ydb/core/sys_view/common/schema.h index e598f1e0d89c..dc6f9d6196b2 100644 --- a/ydb/core/sys_view/common/schema.h +++ b/ydb/core/sys_view/common/schema.h @@ -401,12 +401,7 @@ struct Schema : NIceDb::Schema { struct Activity : Column<13, NScheme::NTypeIds::Bool> {}; struct TierName : Column<14, NScheme::NTypeIds::Utf8> {}; - using TKey = TableKey< - PathId, - TabletId, - PortionId, - ChunkIdx - >; + using TKey = TableKey; using TColumns = TableColumns< PathId, Kind, diff --git a/ydb/core/tx/columnshard/columnshard__scan.cpp b/ydb/core/tx/columnshard/columnshard__scan.cpp index 2c98457913c6..43e5d0115d43 100644 --- a/ydb/core/tx/columnshard/columnshard__scan.cpp +++ b/ydb/core/tx/columnshard/columnshard__scan.cpp @@ -1,30 +1,33 @@ -#include "engines/reader/read_context.h" +#include "blobs_reader/actor.h" #include "blobs_reader/events.h" #include "blobs_reader/read_coordinator.h" -#include "blobs_reader/actor.h" +#include "engines/reader/read_context.h" #include "resource_subscriber/actor.h" -#include +#include +#include +#include +#include +#include #include -#include #include -#include +#include +#include #include #include -#include -#include -#include -#include -#include -#include +#include #include +#include #include + +#include #include #include +#include #include #include -#include -#include + +#include namespace NKikimr::NColumnShard { @@ -253,7 +256,7 @@ class TColumnShardScan : public TActorBootstrapped, NArrow::IR if (CurrentLastReadKey) { NOlap::NIndexedReader::TSortableBatchPosition pNew(result.GetLastReadKey(), 0, result.GetLastReadKey()->schema()->field_names(), {}, false); NOlap::NIndexedReader::TSortableBatchPosition pOld(CurrentLastReadKey, 0, CurrentLastReadKey->schema()->field_names(), {}, false); - AFL_VERIFY(pOld < pNew); + AFL_VERIFY(pOld < pNew)("old", pOld.DebugJson().GetStringRobust())("new", pNew.DebugJson().GetStringRobust()); } CurrentLastReadKey = result.GetLastReadKey(); @@ -656,6 +659,9 @@ PrepareStatsReadMetadata(ui64 tabletId, const NOlap::TReadDescription& read, con return out; } THashMap> portionsInUse; + const auto predStatSchema = [](const std::shared_ptr& l, const std::shared_ptr& r) { + return std::tuple(l->GetPathId(), l->GetPortionId()) < std::tuple(r->GetPathId(), r->GetPortionId()); + }; for (auto&& filter : read.PKRangesFilter) { const ui64 fromPathId = *filter.GetPredicateFrom().Get(0, 0, 1); const ui64 toPathId = *filter.GetPredicateTo().Get(0, 0, Max()); @@ -671,6 +677,7 @@ PrepareStatsReadMetadata(ui64 tabletId, const NOlap::TReadDescription& read, con } } } + std::sort(out->IndexPortions.begin(), out->IndexPortions.end(), predStatSchema); } else if (read.TableName.EndsWith(NOlap::TIndexInfo::STORE_INDEX_STATS_TABLE)) { auto pathInfos = logsIndex->GetTables(fromPathId, toPathId); for (auto&& pathInfo: pathInfos) { @@ -680,6 +687,7 @@ PrepareStatsReadMetadata(ui64 tabletId, const NOlap::TReadDescription& read, con } } } + std::sort(out->IndexPortions.begin(), out->IndexPortions.end(), predStatSchema); } } diff --git a/ydb/core/tx/columnshard/columnshard__stats_scan.cpp b/ydb/core/tx/columnshard/columnshard__stats_scan.cpp index af5486faed96..1b6ba0ff6871 100644 --- a/ydb/core/tx/columnshard/columnshard__stats_scan.cpp +++ b/ydb/core/tx/columnshard/columnshard__stats_scan.cpp @@ -77,7 +77,7 @@ void TStatsIterator::AppendStats(const std::vector(*builders[6], r->GetChunkIdx()); NArrow::Append(*builders[7], ReadMetadata->GetColumnNameDef(r->GetColumnId()).value_or("undefined")); NArrow::Append(*builders[8], r->GetColumnId()); - std::string blobIdString = r->BlobRange.ToString(); + std::string blobIdString = r->BlobRange.BlobId.ToStringLegacy(); NArrow::Append(*builders[9], blobIdString); NArrow::Append(*builders[10], r->BlobRange.Offset); NArrow::Append(*builders[11], r->BlobRange.Size);