Skip to content

Commit 3654a3d

Browse files
jepett0Gazizonoki
authored andcommitted
Moved commit "Restore indexes from backup with the original partitioning" from ydb repo
1 parent 5c4dfb9 commit 3654a3d

File tree

2 files changed

+16
-1
lines changed

2 files changed

+16
-1
lines changed

include/ydb-cpp-sdk/client/table/table.h

Lines changed: 2 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -640,6 +640,7 @@ class TTableDescription {
640640
// common
641641
void AddSecondaryIndex(const std::string& indexName, EIndexType type, const std::vector<std::string>& indexColumns);
642642
void AddSecondaryIndex(const std::string& indexName, EIndexType type, const std::vector<std::string>& indexColumns, const std::vector<std::string>& dataColumns);
643+
void AddSecondaryIndex(const TIndexDescription& indexDescription);
643644
// sync
644645
void AddSyncSecondaryIndex(const std::string& indexName, const std::vector<std::string>& indexColumns);
645646
void AddSyncSecondaryIndex(const std::string& indexName, const std::vector<std::string>& indexColumns, const std::vector<std::string>& dataColumns);
@@ -853,6 +854,7 @@ class TTableBuilder {
853854
TTableBuilder& SetPrimaryKeyColumn(const std::string& primaryKeyColumn);
854855

855856
// common
857+
TTableBuilder& AddSecondaryIndex(const TIndexDescription& indexDescription);
856858
TTableBuilder& AddSecondaryIndex(const std::string& indexName, EIndexType type, const std::vector<std::string>& indexColumns, const std::vector<std::string>& dataColumns);
857859
TTableBuilder& AddSecondaryIndex(const std::string& indexName, EIndexType type, const std::vector<std::string>& indexColumns);
858860
TTableBuilder& AddSecondaryIndex(const std::string& indexName, EIndexType type, const std::string& indexColumn);

src/client/table/table.cpp

Lines changed: 14 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -469,6 +469,10 @@ class TTableDescription::TImpl {
469469
Indexes_.emplace_back(TIndexDescription(indexName, type, indexColumns, dataColumns));
470470
}
471471

472+
void AddSecondaryIndex(const TIndexDescription& indexDescription) {
473+
Indexes_.emplace_back(indexDescription);
474+
}
475+
472476
void AddVectorIndex(const std::string& indexName, EIndexType type, const std::vector<std::string>& indexColumns, const TVectorIndexSettings& vectorIndexSettings) {
473477
Indexes_.emplace_back(TIndexDescription(indexName, type, indexColumns, {}, {}, vectorIndexSettings));
474478
}
@@ -750,6 +754,10 @@ void TTableDescription::AddSecondaryIndex(const std::string& indexName, EIndexTy
750754
Impl_->AddSecondaryIndex(indexName, type, indexColumns, dataColumns);
751755
}
752756

757+
void TTableDescription::AddSecondaryIndex(const TIndexDescription& indexDescription) {
758+
Impl_->AddSecondaryIndex(indexDescription);
759+
}
760+
753761
void TTableDescription::AddSyncSecondaryIndex(const std::string& indexName, const std::vector<std::string>& indexColumns) {
754762
AddSecondaryIndex(indexName, EIndexType::GlobalSync, indexColumns);
755763
}
@@ -1174,6 +1182,11 @@ TTableBuilder& TTableBuilder::SetPrimaryKeyColumn(const std::string& primaryKeyC
11741182
return *this;
11751183
}
11761184

1185+
TTableBuilder& TTableBuilder::AddSecondaryIndex(const TIndexDescription& indexDescription) {
1186+
TableDescription_.AddSecondaryIndex(indexDescription);
1187+
return *this;
1188+
}
1189+
11771190
TTableBuilder& TTableBuilder::AddSecondaryIndex(const std::string& indexName, EIndexType type, const std::vector<std::string>& indexColumns, const std::vector<std::string>& dataColumns) {
11781191
TableDescription_.AddSecondaryIndex(indexName, type, indexColumns, dataColumns);
11791192
return *this;
@@ -2377,7 +2390,7 @@ TVectorIndexSettings TVectorIndexSettings::FromProto(const TProto& proto) {
23772390
default:
23782391
return {};
23792392
}
2380-
};
2393+
};
23812394

23822395
return {
23832396
.Metric = metricFromProto(proto),

0 commit comments

Comments
 (0)