Skip to content

Commit

Permalink
alter columns for many columns in time (#12378)
Browse files Browse the repository at this point in the history
  • Loading branch information
ivanmorozov333 authored Dec 9, 2024
1 parent 717a5a0 commit 45bb606
Showing 1 changed file with 18 additions and 14 deletions.
Original file line number Diff line number Diff line change
@@ -1,4 +1,6 @@
#include "alter_column.h"
#include <util/string/vector.h>
#include <util/string/split.h>

namespace NKikimr::NKqp::NColumnshard {

Expand Down Expand Up @@ -38,20 +40,22 @@ TConclusionStatus TAlterColumnOperation::DoDeserialize(NYql::TObjectSettingsImpl
}

void TAlterColumnOperation::DoSerializeScheme(NKikimrSchemeOp::TAlterColumnTableSchema& schemaData) const {
auto* column = schemaData.AddAlterColumns();
column->SetName(ColumnName);
if (StorageId && !!*StorageId) {
column->SetStorageId(*StorageId);
}
if (!!Serializer) {
Serializer.SerializeToProto(*column->MutableSerializer());
}
if (!!AccessorConstructor) {
*column->MutableDataAccessorConstructor() = AccessorConstructor.SerializeToProto();
}
*column->MutableDictionaryEncoding() = DictionaryEncodingDiff.SerializeToProto();
if (DefaultValue) {
column->SetDefaultValue(*DefaultValue);
for (auto&& i : StringSplitter(ColumnName).SplitBySet(", ").SkipEmpty().ToList<TString>()) {
auto* column = schemaData.AddAlterColumns();
column->SetName(i);
if (StorageId && !!*StorageId) {
column->SetStorageId(*StorageId);
}
if (!!Serializer) {
Serializer.SerializeToProto(*column->MutableSerializer());
}
if (!!AccessorConstructor) {
*column->MutableDataAccessorConstructor() = AccessorConstructor.SerializeToProto();
}
*column->MutableDictionaryEncoding() = DictionaryEncodingDiff.SerializeToProto();
if (DefaultValue) {
column->SetDefaultValue(*DefaultValue);
}
}
}

Expand Down

0 comments on commit 45bb606

Please sign in to comment.