Skip to content

Commit

Permalink
Moved commit "Restore indexes from backup with the original partition…
Browse files Browse the repository at this point in the history
…ing" from ydb repo
  • Loading branch information
jepett0 authored and Gazizonoki committed Aug 26, 2024
1 parent 5c4dfb9 commit 3654a3d
Show file tree
Hide file tree
Showing 2 changed files with 16 additions and 1 deletion.
2 changes: 2 additions & 0 deletions include/ydb-cpp-sdk/client/table/table.h
Original file line number Diff line number Diff line change
Expand Up @@ -640,6 +640,7 @@ class TTableDescription {
// common
void AddSecondaryIndex(const std::string& indexName, EIndexType type, const std::vector<std::string>& indexColumns);
void AddSecondaryIndex(const std::string& indexName, EIndexType type, const std::vector<std::string>& indexColumns, const std::vector<std::string>& dataColumns);
void AddSecondaryIndex(const TIndexDescription& indexDescription);
// sync
void AddSyncSecondaryIndex(const std::string& indexName, const std::vector<std::string>& indexColumns);
void AddSyncSecondaryIndex(const std::string& indexName, const std::vector<std::string>& indexColumns, const std::vector<std::string>& dataColumns);
Expand Down Expand Up @@ -853,6 +854,7 @@ class TTableBuilder {
TTableBuilder& SetPrimaryKeyColumn(const std::string& primaryKeyColumn);

// common
TTableBuilder& AddSecondaryIndex(const TIndexDescription& indexDescription);
TTableBuilder& AddSecondaryIndex(const std::string& indexName, EIndexType type, const std::vector<std::string>& indexColumns, const std::vector<std::string>& dataColumns);
TTableBuilder& AddSecondaryIndex(const std::string& indexName, EIndexType type, const std::vector<std::string>& indexColumns);
TTableBuilder& AddSecondaryIndex(const std::string& indexName, EIndexType type, const std::string& indexColumn);
Expand Down
15 changes: 14 additions & 1 deletion src/client/table/table.cpp
Original file line number Diff line number Diff line change
Expand Up @@ -469,6 +469,10 @@ class TTableDescription::TImpl {
Indexes_.emplace_back(TIndexDescription(indexName, type, indexColumns, dataColumns));
}

void AddSecondaryIndex(const TIndexDescription& indexDescription) {
Indexes_.emplace_back(indexDescription);
}

void AddVectorIndex(const std::string& indexName, EIndexType type, const std::vector<std::string>& indexColumns, const TVectorIndexSettings& vectorIndexSettings) {
Indexes_.emplace_back(TIndexDescription(indexName, type, indexColumns, {}, {}, vectorIndexSettings));
}
Expand Down Expand Up @@ -750,6 +754,10 @@ void TTableDescription::AddSecondaryIndex(const std::string& indexName, EIndexTy
Impl_->AddSecondaryIndex(indexName, type, indexColumns, dataColumns);
}

void TTableDescription::AddSecondaryIndex(const TIndexDescription& indexDescription) {
Impl_->AddSecondaryIndex(indexDescription);
}

void TTableDescription::AddSyncSecondaryIndex(const std::string& indexName, const std::vector<std::string>& indexColumns) {
AddSecondaryIndex(indexName, EIndexType::GlobalSync, indexColumns);
}
Expand Down Expand Up @@ -1174,6 +1182,11 @@ TTableBuilder& TTableBuilder::SetPrimaryKeyColumn(const std::string& primaryKeyC
return *this;
}

TTableBuilder& TTableBuilder::AddSecondaryIndex(const TIndexDescription& indexDescription) {
TableDescription_.AddSecondaryIndex(indexDescription);
return *this;
}

TTableBuilder& TTableBuilder::AddSecondaryIndex(const std::string& indexName, EIndexType type, const std::vector<std::string>& indexColumns, const std::vector<std::string>& dataColumns) {
TableDescription_.AddSecondaryIndex(indexName, type, indexColumns, dataColumns);
return *this;
Expand Down Expand Up @@ -2377,7 +2390,7 @@ TVectorIndexSettings TVectorIndexSettings::FromProto(const TProto& proto) {
default:
return {};
}
};
};

return {
.Metric = metricFromProto(proto),
Expand Down

0 comments on commit 3654a3d

Please sign in to comment.