diff --git a/ydb/core/kqp/gateway/behaviour/tablestore/operations/drop_index.cpp b/ydb/core/kqp/gateway/behaviour/tablestore/operations/drop_index.cpp new file mode 100644 index 000000000000..99a76a39d5db --- /dev/null +++ b/ydb/core/kqp/gateway/behaviour/tablestore/operations/drop_index.cpp @@ -0,0 +1,21 @@ +#include "drop_index.h" +#include + +namespace NKikimr::NKqp { + +TConclusionStatus TDropIndexOperation::DoDeserialize(NYql::TObjectSettingsImpl::TFeaturesExtractor& features) { + { + auto fValue = features.Extract("NAME"); + if (!fValue) { + return TConclusionStatus::Fail("can't find parameter NAME"); + } + IndexName = *fValue; + } + return TConclusionStatus::Success(); +} + +void TDropIndexOperation::DoSerializeScheme(NKikimrSchemeOp::TAlterColumnTableSchema& schemaData) const { + *schemaData.AddDropIndexes() = IndexName; +} + +} diff --git a/ydb/core/kqp/gateway/behaviour/tablestore/operations/drop_index.h b/ydb/core/kqp/gateway/behaviour/tablestore/operations/drop_index.h new file mode 100644 index 000000000000..e263df8f2e48 --- /dev/null +++ b/ydb/core/kqp/gateway/behaviour/tablestore/operations/drop_index.h @@ -0,0 +1,19 @@ +#include "abstract.h" + +namespace NKikimr::NKqp { + +class TDropIndexOperation : public ITableStoreOperation { + static TString GetTypeName() { + return "DROP_INDEX"; + } + + static inline auto Registrator = TFactory::TRegistrator(GetTypeName()); +private: + TString IndexName; +public: + TConclusionStatus DoDeserialize(NYql::TObjectSettingsImpl::TFeaturesExtractor& features) override; + void DoSerializeScheme(NKikimrSchemeOp::TAlterColumnTableSchema& schemaData) const override; +}; + +} + diff --git a/ydb/core/kqp/gateway/behaviour/tablestore/operations/ya.make b/ydb/core/kqp/gateway/behaviour/tablestore/operations/ya.make index 6e186d5f4f3b..08467f55d565 100644 --- a/ydb/core/kqp/gateway/behaviour/tablestore/operations/ya.make +++ b/ydb/core/kqp/gateway/behaviour/tablestore/operations/ya.make @@ -6,6 +6,7 @@ SRCS( GLOBAL alter_column.cpp GLOBAL drop_column.cpp GLOBAL upsert_index.cpp + GLOBAL drop_index.cpp ) PEERDIR( diff --git a/ydb/core/kqp/ut/olap/kqp_olap_ut.cpp b/ydb/core/kqp/ut/olap/kqp_olap_ut.cpp index 0e37f751979b..c5de31b63bb7 100644 --- a/ydb/core/kqp/ut/olap/kqp_olap_ut.cpp +++ b/ydb/core/kqp/ut/olap/kqp_olap_ut.cpp @@ -1357,8 +1357,7 @@ Y_UNIT_TEST_SUITE(KqpOlap) { } Y_UNIT_TEST(IndexesModificationError) { - auto settings = TKikimrSettings() - .SetWithSampleTables(false); + auto settings = TKikimrSettings().SetWithSampleTables(false); TKikimrRunner kikimr(settings); TLocalHelper(kikimr).CreateTestOlapTable(); @@ -1408,6 +1407,13 @@ Y_UNIT_TEST_SUITE(KqpOlap) { UNIT_ASSERT_VALUES_EQUAL_C(alterResult.GetStatus(), EStatus::SUCCESS, alterResult.GetIssues().ToString()); } + { + auto alterQuery = TStringBuilder() << "ALTER OBJECT `/Root/olapStore` (TYPE TABLESTORE) SET (ACTION=DROP_INDEX, NAME=index_uid);"; + auto session = tableClient.CreateSession().GetValueSync().GetSession(); + auto alterResult = session.ExecuteSchemeQuery(alterQuery).GetValueSync(); + UNIT_ASSERT_VALUES_EQUAL_C(alterResult.GetStatus(), EStatus::SUCCESS, alterResult.GetIssues().ToString()); + } + } Y_UNIT_TEST(PushdownFilter) { diff --git a/ydb/core/sys_view/common/schema.h b/ydb/core/sys_view/common/schema.h index dc6f9d6196b2..a23a48d71f82 100644 --- a/ydb/core/sys_view/common/schema.h +++ b/ydb/core/sys_view/common/schema.h @@ -394,14 +394,15 @@ struct Schema : NIceDb::Schema { struct PortionId: Column<6, NScheme::NTypeIds::Uint64> {}; struct ChunkIdx : Column<7, NScheme::NTypeIds::Uint64> {}; struct ColumnName: Column<8, NScheme::NTypeIds::Utf8> {}; - struct InternalColumnId : Column<9, NScheme::NTypeIds::Uint32> {}; + struct InternalEntityId : Column<9, NScheme::NTypeIds::Uint32> {}; struct BlobId : Column<10, NScheme::NTypeIds::Utf8> {}; struct BlobRangeOffset : Column<11, NScheme::NTypeIds::Uint64> {}; struct BlobRangeSize : Column<12, NScheme::NTypeIds::Uint64> {}; struct Activity : Column<13, NScheme::NTypeIds::Bool> {}; - struct TierName : Column<14, NScheme::NTypeIds::Utf8> {}; + struct TierName: Column<14, NScheme::NTypeIds::Utf8> {}; + struct EntityType: Column<15, NScheme::NTypeIds::Utf8> {}; - using TKey = TableKey; + using TKey = TableKey; using TColumns = TableColumns< PathId, Kind, @@ -411,12 +412,13 @@ struct Schema : NIceDb::Schema { PortionId, ChunkIdx, ColumnName, - InternalColumnId, + InternalEntityId, BlobId, BlobRangeOffset, BlobRangeSize, Activity, - TierName + TierName, + EntityType >; }; diff --git a/ydb/core/tx/columnshard/columnshard__stats_scan.cpp b/ydb/core/tx/columnshard/columnshard__stats_scan.cpp index 1b6ba0ff6871..c7b189983a38 100644 --- a/ydb/core/tx/columnshard/columnshard__stats_scan.cpp +++ b/ydb/core/tx/columnshard/columnshard__stats_scan.cpp @@ -59,31 +59,63 @@ void TStatsIterator::ApplyRangePredicates(std::shared_ptr& b } void TStatsIterator::AppendStats(const std::vector>& builders, const NOlap::TPortionInfo& portion) { - std::vector records; - for (auto&& r: portion.Records) { - records.emplace_back(&r); - } - if (Reverse) { - std::reverse(records.begin(), records.end()); + { + std::vector records; + for (auto&& r : portion.Records) { + records.emplace_back(&r); + } + if (Reverse) { + std::reverse(records.begin(), records.end()); + } + for (auto&& r : records) { + NArrow::Append(*builders[0], portion.GetPathId()); + const std::string prod = ::ToString(portion.GetMeta().Produced); + NArrow::Append(*builders[1], prod); + NArrow::Append(*builders[2], ReadMetadata->TabletId); + NArrow::Append(*builders[3], r->GetMeta().GetNumRowsVerified()); + NArrow::Append(*builders[4], r->GetMeta().GetRawBytesVerified()); + NArrow::Append(*builders[5], portion.GetPortionId()); + NArrow::Append(*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.BlobId.ToStringLegacy(); + NArrow::Append(*builders[9], blobIdString); + NArrow::Append(*builders[10], r->BlobRange.Offset); + NArrow::Append(*builders[11], r->BlobRange.Size); + NArrow::Append(*builders[12], !portion.HasRemoveSnapshot() || ReadMetadata->GetRequestSnapshot() < portion.GetRemoveSnapshot()); + std::string strTierName(portion.GetMeta().GetTierName().data(), portion.GetMeta().GetTierName().size()); + NArrow::Append(*builders[13], strTierName); + NArrow::Append(*builders[14], "COLUMN"); + } } - for (auto&& r: records) { - NArrow::Append(*builders[0], portion.GetPathId()); - const std::string prod = ::ToString(portion.GetMeta().Produced); - NArrow::Append(*builders[1], prod); - NArrow::Append(*builders[2], ReadMetadata->TabletId); - NArrow::Append(*builders[3], r->GetMeta().GetNumRowsVerified()); - NArrow::Append(*builders[4], r->GetMeta().GetRawBytesVerified()); - NArrow::Append(*builders[5], portion.GetPortionId()); - NArrow::Append(*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.BlobId.ToStringLegacy(); - NArrow::Append(*builders[9], blobIdString); - NArrow::Append(*builders[10], r->BlobRange.Offset); - NArrow::Append(*builders[11], r->BlobRange.Size); - NArrow::Append(*builders[12], !portion.HasRemoveSnapshot() || ReadMetadata->GetRequestSnapshot() < portion.GetRemoveSnapshot()); - std::string strTierName(portion.GetMeta().GetTierName().data(), portion.GetMeta().GetTierName().size()); - NArrow::Append(*builders[13], strTierName); + { + std::vector indexes; + for (auto&& r : portion.GetIndexes()) { + indexes.emplace_back(&r); + } + if (Reverse) { + std::reverse(indexes.begin(), indexes.end()); + } + for (auto&& r : indexes) { + NArrow::Append(*builders[0], portion.GetPathId()); + const std::string prod = ::ToString(portion.GetMeta().Produced); + NArrow::Append(*builders[1], prod); + NArrow::Append(*builders[2], ReadMetadata->TabletId); + NArrow::Append(*builders[3], r->GetRecordsCount()); + NArrow::Append(*builders[4], r->GetRawBytes()); + NArrow::Append(*builders[5], portion.GetPortionId()); + NArrow::Append(*builders[6], r->GetChunkIdx()); + NArrow::Append(*builders[7], ReadMetadata->GetEntityName(r->GetIndexId()).value_or("undefined")); + NArrow::Append(*builders[8], r->GetIndexId()); + std::string blobIdString = r->GetBlobRange().BlobId.ToStringLegacy(); + NArrow::Append(*builders[9], blobIdString); + NArrow::Append(*builders[10], r->GetBlobRange().Offset); + NArrow::Append(*builders[11], r->GetBlobRange().Size); + NArrow::Append(*builders[12], !portion.HasRemoveSnapshot() || ReadMetadata->GetRequestSnapshot() < portion.GetRemoveSnapshot()); + std::string strTierName(portion.GetMeta().GetTierName().data(), portion.GetMeta().GetTierName().size()); + NArrow::Append(*builders[13], strTierName); + NArrow::Append(*builders[14], "INDEX"); + } } } diff --git a/ydb/core/tx/columnshard/columnshard_schema.h b/ydb/core/tx/columnshard/columnshard_schema.h index d7fbdf27d50b..1690fa0bfec7 100644 --- a/ydb/core/tx/columnshard/columnshard_schema.h +++ b/ydb/core/tx/columnshard/columnshard_schema.h @@ -299,9 +299,10 @@ struct Schema : NIceDb::Schema { struct Offset: Column<6, NScheme::NTypeIds::Uint32> {}; struct Size: Column<7, NScheme::NTypeIds::Uint32> {}; struct RecordsCount: Column<8, NScheme::NTypeIds::Uint32> {}; + struct RawBytes: Column<9, NScheme::NTypeIds::Uint64> {}; using TKey = TableKey; - using TColumns = TableColumns; + using TColumns = TableColumns; }; using TTables = SchemaTables< @@ -620,15 +621,17 @@ class TIndexChunkLoadContext { YDB_READONLY_DEF(TBlobRange, BlobRange); TChunkAddress Address; const ui32 RecordsCount; + const ui32 RawBytes; public: TIndexChunk BuildIndexChunk() const { - return TIndexChunk(Address.GetColumnId(), Address.GetChunkIdx(), RecordsCount, BlobRange); + return TIndexChunk(Address.GetColumnId(), Address.GetChunkIdx(), RecordsCount, RawBytes, BlobRange); } template TIndexChunkLoadContext(const TSource& rowset, const IBlobGroupSelector* dsGroupSelector) : Address(rowset.template GetValue(), rowset.template GetValue()) , RecordsCount(rowset.template GetValue()) + , RawBytes(rowset.template GetValue()) { AFL_VERIFY(Address.GetColumnId())("event", "incorrect address")("address", Address.DebugString()); TString strBlobId = rowset.template GetValue(); diff --git a/ydb/core/tx/columnshard/engines/db_wrapper.cpp b/ydb/core/tx/columnshard/engines/db_wrapper.cpp index 20d5989e939b..838a082af52d 100644 --- a/ydb/core/tx/columnshard/engines/db_wrapper.cpp +++ b/ydb/core/tx/columnshard/engines/db_wrapper.cpp @@ -102,7 +102,9 @@ void TDbWrapper::WriteIndex(const TPortionInfo& portion, const TIndexChunk& row) db.Table().Key(portion.GetPathId(), portion.GetPortionId(), row.GetIndexId(), row.GetChunkIdx()).Update( NIceDb::TUpdate(row.GetBlobRange().BlobId.SerializeBinary()), NIceDb::TUpdate(row.GetBlobRange().Offset), - NIceDb::TUpdate(row.GetBlobRange().Size) + NIceDb::TUpdate(row.GetBlobRange().Size), + NIceDb::TUpdate(row.GetRecordsCount()), + NIceDb::TUpdate(row.GetRawBytes()) ); } diff --git a/ydb/core/tx/columnshard/engines/portions/column_record.h b/ydb/core/tx/columnshard/engines/portions/column_record.h index a56197774c43..219e6f8b5316 100644 --- a/ydb/core/tx/columnshard/engines/portions/column_record.h +++ b/ydb/core/tx/columnshard/engines/portions/column_record.h @@ -21,13 +21,15 @@ class TIndexChunk { YDB_READONLY(ui32, IndexId, 0); YDB_READONLY(ui32, ChunkIdx, 0); YDB_READONLY(ui32, RecordsCount, 0); + YDB_READONLY(ui32, RawBytes, 0); YDB_READONLY_DEF(TBlobRange, BlobRange); public: - TIndexChunk(const ui32 indexId, const ui32 chunkIdx, const ui32 recordsCount, const TBlobRange& blobRange) + TIndexChunk(const ui32 indexId, const ui32 chunkIdx, const ui32 recordsCount, const ui64 rawBytes, const TBlobRange& blobRange) : IndexId(indexId) , ChunkIdx(chunkIdx) , RecordsCount(recordsCount) + , RawBytes(rawBytes) , BlobRange(blobRange) { } diff --git a/ydb/core/tx/columnshard/engines/reader/read_metadata.h b/ydb/core/tx/columnshard/engines/reader/read_metadata.h index 4b0580a6bbcd..13358c0586df 100644 --- a/ydb/core/tx/columnshard/engines/reader/read_metadata.h +++ b/ydb/core/tx/columnshard/engines/reader/read_metadata.h @@ -265,7 +265,7 @@ struct TReadStatsMetadata : public TReadMetadataBase, public std::enable_shared_ const TSnapshot& GetRequestSnapshot() const { return RequestSnapshot; } - std::optional GetColumnNameDef(const ui32 columnId) const { + std::optional GetColumnNameDef(const ui32 columnId) const { if (!ResultIndexSchema) { return {}; } @@ -276,6 +276,17 @@ struct TReadStatsMetadata : public TReadMetadataBase, public std::enable_shared_ return f->name(); } + std::optional GetEntityName(const ui32 entityId) const { + if (!ResultIndexSchema) { + return {}; + } + auto result = ResultIndexSchema->GetIndexInfo().GetColumnNameOptional(entityId); + if (!!result) { + return result; + } + return ResultIndexSchema->GetIndexInfo().GetIndexNameOptional(entityId); + } + explicit TReadStatsMetadata(ui64 tabletId, const ESorting sorting, const TProgramContainer& ssaProgram, const std::shared_ptr& schema, const TSnapshot& requestSnapshot) : TBase(sorting, ssaProgram) , RequestSnapshot(requestSnapshot) diff --git a/ydb/core/tx/columnshard/engines/scheme/index_info.h b/ydb/core/tx/columnshard/engines/scheme/index_info.h index b4293f6078fd..44d15cc375d9 100644 --- a/ydb/core/tx/columnshard/engines/scheme/index_info.h +++ b/ydb/core/tx/columnshard/engines/scheme/index_info.h @@ -116,6 +116,29 @@ struct TIndexInfo : public NTable::TScheme::TTableSchema { TColumnSaver GetColumnSaver(const ui32 columnId, const TSaverContext& context) const; std::shared_ptr GetColumnLoaderOptional(const ui32 columnId) const; std::shared_ptr GetColumnLoaderVerified(const ui32 columnId) const; + std::optional GetColumnNameOptional(const ui32 columnId) const { + auto f = GetColumnFieldOptional(columnId); + if (!f) { + return {}; + } + return f->name(); + } + + NIndexes::TIndexMetaContainer GetIndexOptional(const ui32 indexId) const { + auto it = Indexes.find(indexId); + if (it == Indexes.end()) { + return NIndexes::TIndexMetaContainer(); + } + return it->second; + } + + std::optional GetIndexNameOptional(const ui32 indexId) const { + auto meta = GetIndexOptional(indexId); + if (!meta) { + return {}; + } + return meta->GetIndexName(); + } void AppendIndexes(std::map>>& originalData) const { for (auto&& i : Indexes) { diff --git a/ydb/core/tx/columnshard/engines/scheme/indexes/abstract/constructor.h b/ydb/core/tx/columnshard/engines/scheme/indexes/abstract/constructor.h index d8c820cffa2c..e6fe22e3f273 100644 --- a/ydb/core/tx/columnshard/engines/scheme/indexes/abstract/constructor.h +++ b/ydb/core/tx/columnshard/engines/scheme/indexes/abstract/constructor.h @@ -16,7 +16,7 @@ namespace NKikimr::NOlap::NIndexes { class IIndexMetaConstructor { protected: virtual TConclusionStatus DoDeserializeFromJson(const NJson::TJsonValue& jsonInfo) = 0; - virtual std::shared_ptr DoCreateIndexMeta(const ui32 indexId, const NSchemeShard::TOlapSchema& currentSchema, NSchemeShard::IErrorCollector& errors) const = 0; + virtual std::shared_ptr DoCreateIndexMeta(const ui32 indexId, const TString& indexName, const NSchemeShard::TOlapSchema& currentSchema, NSchemeShard::IErrorCollector& errors) const = 0; virtual TConclusionStatus DoDeserializeFromProto(const NKikimrSchemeOp::TOlapIndexRequested& proto) = 0; virtual void DoSerializeToProto(NKikimrSchemeOp::TOlapIndexRequested& proto) const = 0; public: @@ -29,8 +29,8 @@ class IIndexMetaConstructor { return DoDeserializeFromJson(jsonInfo); } - std::shared_ptr CreateIndexMeta(const ui32 indexId, const NSchemeShard::TOlapSchema& currentSchema, NSchemeShard::IErrorCollector& errors) const { - return DoCreateIndexMeta(indexId, currentSchema, errors); + std::shared_ptr CreateIndexMeta(const ui32 indexId, const TString& indexName, const NSchemeShard::TOlapSchema& currentSchema, NSchemeShard::IErrorCollector& errors) const { + return DoCreateIndexMeta(indexId, indexName, currentSchema, errors); } TConclusionStatus DeserializeFromProto(const NKikimrSchemeOp::TOlapIndexRequested& proto) { diff --git a/ydb/core/tx/columnshard/engines/scheme/indexes/abstract/meta.cpp b/ydb/core/tx/columnshard/engines/scheme/indexes/abstract/meta.cpp index 4debc30257d6..77e9430ed953 100644 --- a/ydb/core/tx/columnshard/engines/scheme/indexes/abstract/meta.cpp +++ b/ydb/core/tx/columnshard/engines/scheme/indexes/abstract/meta.cpp @@ -5,11 +5,12 @@ #include #include #include +#include namespace NKikimr::NOlap::NIndexes { void TPortionIndexChunk::DoAddIntoPortion(const TBlobRange& bRange, TPortionInfo& portionInfo) const { - portionInfo.AddIndex(TIndexChunk(GetEntityId(), GetChunkIdx(), RecordsCount, bRange)); + portionInfo.AddIndex(TIndexChunk(GetEntityId(), GetChunkIdx(), RecordsCount, RawBytes, bRange)); } std::shared_ptr TIndexByColumns::DoBuildIndex(const ui32 indexId, std::map>>& data, const TIndexInfo& indexInfo) const { @@ -27,7 +28,7 @@ std::shared_ptr TIndexByColumns::DoBuildIndex TChunkedBatchReader reader(std::move(columnReaders)); std::shared_ptr indexBatch = DoBuildIndexImpl(reader); const TString indexData = TColumnSaver(nullptr, Serializer).Apply(indexBatch); - return std::make_shared(indexId, recordsCount, indexData); + return std::make_shared(indexId, recordsCount, NArrow::GetBatchDataSize(indexBatch), indexData); } bool TIndexByColumns::DoDeserializeFromProto(const NKikimrSchemeOp::TOlapIndexDescription& /*proto*/) { @@ -35,8 +36,8 @@ bool TIndexByColumns::DoDeserializeFromProto(const NKikimrSchemeOp::TOlapIndexDe return true; } -TIndexByColumns::TIndexByColumns(const ui32 indexId, const std::set& columnIds) - : TBase(indexId) +TIndexByColumns::TIndexByColumns(const ui32 indexId, const TString& indexName, const std::set& columnIds) + : TBase(indexId, indexName) , ColumnIds(columnIds) { Serializer = std::make_shared(arrow::ipc::IpcWriteOptions::Defaults()); diff --git a/ydb/core/tx/columnshard/engines/scheme/indexes/abstract/meta.h b/ydb/core/tx/columnshard/engines/scheme/indexes/abstract/meta.h index 28d8825cb10d..9966d4ee31ef 100644 --- a/ydb/core/tx/columnshard/engines/scheme/indexes/abstract/meta.h +++ b/ydb/core/tx/columnshard/engines/scheme/indexes/abstract/meta.h @@ -26,6 +26,7 @@ namespace NKikimr::NOlap::NIndexes { class IIndexMeta { private: + YDB_READONLY_DEF(TString, IndexName); YDB_READONLY(ui32, IndexId, 0); protected: virtual std::shared_ptr DoBuildIndex(const ui32 indexId, std::map>>& data, const TIndexInfo& indexInfo) const = 0; @@ -39,8 +40,9 @@ class IIndexMeta { using TProto = NKikimrSchemeOp::TOlapIndexDescription; IIndexMeta() = default; - IIndexMeta(const ui32 indexId) - : IndexId(indexId) + IIndexMeta(const ui32 indexId, const TString& indexName) + : IndexName(indexName) + , IndexId(indexId) { } @@ -68,12 +70,16 @@ class IIndexMeta { bool DeserializeFromProto(const NKikimrSchemeOp::TOlapIndexDescription& proto) { IndexId = proto.GetId(); AFL_VERIFY(IndexId); + IndexName = proto.GetName(); + AFL_VERIFY(IndexName); return DoDeserializeFromProto(proto); } void SerializeToProto(NKikimrSchemeOp::TOlapIndexDescription& proto) const { AFL_VERIFY(IndexId); proto.SetId(IndexId); + AFL_VERIFY(IndexName); + proto.SetName(IndexName); return DoSerializeToProto(proto); } @@ -96,6 +102,7 @@ class TPortionIndexChunk: public IPortionDataChunk { private: using TBase = IPortionDataChunk; const ui32 RecordsCount; + const ui64 RawBytes; const TString Data; protected: virtual const TString& DoGetData() const override { @@ -121,9 +128,10 @@ class TPortionIndexChunk: public IPortionDataChunk { } virtual void DoAddIntoPortion(const TBlobRange& bRange, TPortionInfo& portionInfo) const override; public: - TPortionIndexChunk(const ui32 entityId, const ui32 recordsCount, const TString& data) + TPortionIndexChunk(const ui32 entityId, const ui32 recordsCount, const ui64 rawBytes, const TString& data) : TBase(entityId, 0) , RecordsCount(recordsCount) + , RawBytes(rawBytes) , Data(data) { } @@ -145,7 +153,7 @@ class TIndexByColumns: public IIndexMeta { public: TIndexByColumns() = default; - TIndexByColumns(const ui32 indexId, const std::set& columnIds); + TIndexByColumns(const ui32 indexId, const TString& indexName, const std::set& columnIds); }; } // namespace NKikimr::NOlap::NIndexes \ No newline at end of file diff --git a/ydb/core/tx/columnshard/engines/scheme/indexes/bloom/constructor.cpp b/ydb/core/tx/columnshard/engines/scheme/indexes/bloom/constructor.cpp index 4ea787eb7d94..9a464f67d595 100644 --- a/ydb/core/tx/columnshard/engines/scheme/indexes/bloom/constructor.cpp +++ b/ydb/core/tx/columnshard/engines/scheme/indexes/bloom/constructor.cpp @@ -5,7 +5,7 @@ namespace NKikimr::NOlap::NIndexes { -std::shared_ptr TBloomIndexConstructor::DoCreateIndexMeta(const ui32 indexId, const NSchemeShard::TOlapSchema& currentSchema, NSchemeShard::IErrorCollector& errors) const { +std::shared_ptr TBloomIndexConstructor::DoCreateIndexMeta(const ui32 indexId, const TString& indexName, const NSchemeShard::TOlapSchema& currentSchema, NSchemeShard::IErrorCollector& errors) const { std::set columnIds; for (auto&& i : ColumnNames) { auto* columnInfo = currentSchema.GetColumns().GetByName(i); @@ -15,7 +15,7 @@ std::shared_ptr TBloomIndexConstructor::Do } AFL_VERIFY(columnIds.emplace(columnInfo->GetId()).second); } - return std::make_shared(indexId, columnIds, FalsePositiveProbability); + return std::make_shared(indexId, indexName, columnIds, FalsePositiveProbability); } NKikimr::TConclusionStatus TBloomIndexConstructor::DoDeserializeFromJson(const NJson::TJsonValue& jsonInfo) { diff --git a/ydb/core/tx/columnshard/engines/scheme/indexes/bloom/constructor.h b/ydb/core/tx/columnshard/engines/scheme/indexes/bloom/constructor.h index 0aeb4dd9809c..1801027416bf 100644 --- a/ydb/core/tx/columnshard/engines/scheme/indexes/bloom/constructor.h +++ b/ydb/core/tx/columnshard/engines/scheme/indexes/bloom/constructor.h @@ -12,7 +12,7 @@ class TBloomIndexConstructor: public IIndexMetaConstructor { double FalsePositiveProbability = 0.1; static inline auto Registrator = TFactory::TRegistrator(GetClassNameStatic()); protected: - virtual std::shared_ptr DoCreateIndexMeta(const ui32 indexId, const NSchemeShard::TOlapSchema& currentSchema, NSchemeShard::IErrorCollector& errors) const override; + virtual std::shared_ptr DoCreateIndexMeta(const ui32 indexId, const TString& indexName, const NSchemeShard::TOlapSchema& currentSchema, NSchemeShard::IErrorCollector& errors) const override; virtual TConclusionStatus DoDeserializeFromJson(const NJson::TJsonValue& jsonInfo) override; diff --git a/ydb/core/tx/columnshard/engines/scheme/indexes/bloom/meta.h b/ydb/core/tx/columnshard/engines/scheme/indexes/bloom/meta.h index b077c6cfc6fe..274833e0b33b 100644 --- a/ydb/core/tx/columnshard/engines/scheme/indexes/bloom/meta.h +++ b/ydb/core/tx/columnshard/engines/scheme/indexes/bloom/meta.h @@ -54,8 +54,8 @@ class TBloomIndexMeta: public TIndexByColumns { public: TBloomIndexMeta() = default; - TBloomIndexMeta(const ui32 indexId, const std::set& columnIds, const double fpProbability) - : TBase(indexId, columnIds) + TBloomIndexMeta(const ui32 indexId, const TString& indexName, std::set& columnIds, const double fpProbability) + : TBase(indexId, indexName, columnIds) , FalsePositiveProbability(fpProbability) { Initialize(); } diff --git a/ydb/core/tx/schemeshard/olap/indexes/schema.cpp b/ydb/core/tx/schemeshard/olap/indexes/schema.cpp index 81aa18edff5a..4275e883711d 100644 --- a/ydb/core/tx/schemeshard/olap/indexes/schema.cpp +++ b/ydb/core/tx/schemeshard/olap/indexes/schema.cpp @@ -22,7 +22,7 @@ bool TOlapIndexSchema::ApplyUpdate(const TOlapSchema& currentSchema, const TOlap errors.AddError("different index classes: " + upsert.GetIndexConstructor().GetClassName() + " vs " + IndexMeta.GetClassName()); return false; } - auto object = upsert.GetIndexConstructor()->CreateIndexMeta(GetId(), currentSchema, errors); + auto object = upsert.GetIndexConstructor()->CreateIndexMeta(GetId(), GetName(), currentSchema, errors); if (!object) { return false; } @@ -44,7 +44,7 @@ bool TOlapIndexesDescription::ApplyUpdate(const TOlapSchema& currentSchema, cons } } else { const ui32 id = nextEntityId++; - auto meta = index.GetIndexConstructor()->CreateIndexMeta(id, currentSchema, errors); + auto meta = index.GetIndexConstructor()->CreateIndexMeta(id, index.GetName(), currentSchema, errors); if (!meta) { return false; }