Skip to content

Commit

Permalink
Fixes
Browse files Browse the repository at this point in the history
  • Loading branch information
shnikd committed May 13, 2024
1 parent c5e759d commit 8f67607
Show file tree
Hide file tree
Showing 4 changed files with 34 additions and 1 deletion.
4 changes: 3 additions & 1 deletion ydb/core/tx/schemeshard/schemeshard_info_types.cpp
Original file line number Diff line number Diff line change
Expand Up @@ -290,7 +290,9 @@ TTableInfo::TAlterDataPtr TTableInfo::CreateAlterData(

const TTableInfo::TColumn& sourceColumn = source->Columns[colId];
if (sourceColumn.PType.GetTypeId() == NScheme::NTypeIds::Int64) {
errStr = Sprintf("Sequence value type '%s' must be equal to the column type '%s'", sourceColumn.GetType().data());
errStr = Sprintf(
"Sequence value type '%s' must be equal to the column type '%s'", "Int64",
NScheme::TypeName(sourceColumn.PType, sourceColumn.PTypeMod).c_str());
return nullptr;
}

Expand Down
6 changes: 6 additions & 0 deletions ydb/core/tx/schemeshard/ut_helpers/ls_checks.cpp
Original file line number Diff line number Diff line change
Expand Up @@ -819,6 +819,12 @@ TCheckFunc IndexDataColumns(const TVector<TString>& dataColumnNames) {
};
}

TCheckFunc SequenceName(const TString& name) {
return [=] (const NKikimrScheme::TEvDescribeSchemeResult& record) {
UNIT_ASSERT_VALUES_EQUAL(record.GetPathDescription().GetSequenceDescription().GetName(), name);
};
}

TCheckFunc SequenceIncrement(i64 increment) {
return [=] (const NKikimrScheme::TEvDescribeSchemeResult& record) {
UNIT_ASSERT_VALUES_EQUAL(record.GetPathDescription().GetSequenceDescription().GetIncrement(), increment);
Expand Down
1 change: 1 addition & 0 deletions ydb/core/tx/schemeshard/ut_helpers/ls_checks.h
Original file line number Diff line number Diff line change
Expand Up @@ -138,6 +138,7 @@ namespace NLs {
TCheckFunc IndexKeys(const TVector<TString>& keyNames);
TCheckFunc IndexDataColumns(const TVector<TString>& dataColumnNames);

TCheckFunc SequenceName(const TString& name);
TCheckFunc SequenceIncrement(i64 increment);
TCheckFunc SequenceMaxValue(i64 maxValue);
TCheckFunc SequenceMinValue(i64 minValue);
Expand Down
24 changes: 24 additions & 0 deletions ydb/core/tx/schemeshard/ut_sequence/ut_sequence.cpp
Original file line number Diff line number Diff line change
Expand Up @@ -508,5 +508,29 @@ Y_UNIT_TEST_SUITE(TSequence) {
}
)");
env.TestWaitNotification(runtime, txId);

auto table = DescribePath(runtime, "/MyRoot/Table")
.GetPathDescription()
.GetTable();

for (const auto& column: table.GetColumns()) {
if (column.GetName() == "value") {
UNIT_ASSERT(column.HasDefaultFromSequence());
UNIT_ASSERT_VALUES_EQUAL(column.GetDefaultFromSequence(), "/MyRoot/seq");

TestDescribeResult(DescribePath(runtime, column.GetDefaultFromSequence()),
{
NLs::SequenceIncrement(2),
NLs::SequenceMinValue(2),
NLs::SequenceCache(1),
NLs::SequenceStartValue(2),
NLs::SequenceCycle(true),
NLs::SequenceMaxValue(100),
NLs::SequenceIncrement("seq"),
}
);
break;
}
}
}
} // Y_UNIT_TEST_SUITE(TSequence)

0 comments on commit 8f67607

Please sign in to comment.