Skip to content

Commit

Permalink
PG types: replace Y_ABORT_UNLESS with yexception
Browse files Browse the repository at this point in the history
  • Loading branch information
azevaykin committed May 24, 2024
1 parent 5cb09f9 commit 8ed03a8
Showing 1 changed file with 10 additions and 6 deletions.
16 changes: 10 additions & 6 deletions ydb/core/client/server/msgbus_server_db.cpp
Original file line number Diff line number Diff line change
Expand Up @@ -395,8 +395,10 @@ class TServerDbOperation : public TActorBootstrapped<TServerDbOperation<Interfac
keyColumns.reserve(keys.size());
for (const NTxProxy::TTableColumnInfo* key : keys) {
NJson::TJsonValue jsonKey;
// TODO: support pg types
Y_ABORT_UNLESS(key->PType.GetTypeId() != NScheme::NTypeIds::Pg, "pg types are not supported");

if (key->PType.GetTypeId() == NScheme::NTypeIds::Pg)
throw yexception() << "pg types are not supported";

if (jsonWhere.GetValue(key->Name, &jsonKey)) {
keyColumns.emplace_back(NewDataLiteral(pgmBuilder, jsonKey, key->PType.GetTypeId()));
} else {
Expand Down Expand Up @@ -453,8 +455,9 @@ class TServerDbOperation : public TActorBootstrapped<TServerDbOperation<Interfac
NMiniKQL::TTableRangeOptions tableRangeOptions = pgmBuilder.GetDefaultTableRangeOptions();
TVector<NMiniKQL::TRuntimeNode> keyFromColumns = keyColumns;
for (size_t i = keyColumns.size(); i < keyTypes.size(); ++i) {
// TODO: support pg types
Y_ABORT_UNLESS(keyTypes[i].GetTypeId() != NScheme::NTypeIds::Pg, "pg types are not supported");
if (keyTypes[i].GetTypeId() == NScheme::NTypeIds::Pg)
throw yexception() << "pg types are not supported";

keyFromColumns.emplace_back(pgmBuilder.NewEmptyOptionalDataLiteral(keyTypes[i].GetTypeId()));
}
tableRangeOptions.ToColumns = keyColumns;
Expand All @@ -470,9 +473,10 @@ class TServerDbOperation : public TActorBootstrapped<TServerDbOperation<Interfac
for (auto itVal = jsonMap.begin(); itVal != jsonMap.end(); ++itVal) {
auto itCol = columnByName.find(itVal->first);
if (itCol != columnByName.end()) {
if (itCol->second->PType.GetTypeId() == NScheme::NTypeIds::Pg)
throw yexception() << "pg types are not supported";

auto update = pgmBuilder.GetUpdateRowBuilder();
// TODO: support pg types
Y_ABORT_UNLESS(itCol->second->PType.GetTypeId() != NScheme::NTypeIds::Pg, "pg types are not supported");
update.SetColumn(itCol->second->Id, itCol->second->PType, pgmBuilder.NewOptional(NewDataLiteral(pgmBuilder, itVal->second, itCol->second->PType.GetTypeId())));
pgmReturn = pgmBuilder.Append(pgmReturn, pgmBuilder.UpdateRow(tableInfo.TableId, keyTypes, keyColumns, update));
} else {
Expand Down

0 comments on commit 8ed03a8

Please sign in to comment.