Skip to content

Commit 56fbcfc

Browse files
authored
Revert "Support PG types in CDC (#9337)" (#9526)
1 parent 8d954a5 commit 56fbcfc

File tree

6 files changed

+6
-41
lines changed

6 files changed

+6
-41
lines changed

ydb/core/tx/datashard/change_record_cdc_serializer.cpp

Lines changed: 2 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -182,7 +182,8 @@ class TJsonSerializer: public TBaseSerializer {
182182
case NScheme::NTypeIds::Yson:
183183
return YsonToJson(cell.AsBuf());
184184
case NScheme::NTypeIds::Pg:
185-
return NJson::TJsonValue(PgToString(cell.AsBuf(), type));
185+
// TODO: support pg types
186+
Y_ABORT("pg types are not supported");
186187
case NScheme::NTypeIds::Uuid:
187188
return NJson::TJsonValue(NUuid::UuidBytesToString(cell.Data()));
188189
default:

ydb/core/tx/datashard/change_sender_cdc_stream.cpp

Lines changed: 2 additions & 8 deletions
Original file line numberDiff line numberDiff line change
@@ -9,7 +9,6 @@
99
#include <ydb/core/persqueue/partition_key_range/partition_key_range.h>
1010
#include <ydb/core/persqueue/writer/source_id_encoding.h>
1111
#include <ydb/core/persqueue/writer/writer.h>
12-
#include <ydb/core/scheme/protos/type_info.pb.h>
1312
#include <ydb/core/tx/scheme_cache/helpers.h>
1413
#include <ydb/core/tx/scheme_cache/scheme_cache.h>
1514
#include <ydb/library/actors/core/actor_bootstrapped.h>
@@ -620,13 +619,8 @@ class TCdcChangeSenderMain
620619

621620
schema.reserve(pqConfig.PartitionKeySchemaSize());
622621
for (const auto& keySchema : pqConfig.GetPartitionKeySchema()) {
623-
if (keySchema.GetTypeId() == NScheme::NTypeIds::Pg) {
624-
schema.push_back(NScheme::TTypeInfo(
625-
keySchema.GetTypeId(),
626-
NPg::TypeDescFromPgTypeId(keySchema.GetTypeInfo().GetPgTypeId())));
627-
} else {
628-
schema.push_back(NScheme::TTypeInfo(keySchema.GetTypeId()));
629-
}
622+
// TODO: support pg types
623+
schema.push_back(NScheme::TTypeInfo(keySchema.GetTypeId()));
630624
}
631625

632626
TSet<TPQPartitionInfo, TPQPartitionInfo::TLess> partitions(schema);

ydb/core/tx/datashard/datashard_ut_change_exchange.cpp

Lines changed: 1 addition & 24 deletions
Original file line numberDiff line numberDiff line change
@@ -838,9 +838,7 @@ Y_UNIT_TEST_SUITE(Cdc) {
838838
.SetEnableChangefeedDebeziumJsonFormat(true)
839839
.SetEnableTopicMessageMeta(true)
840840
.SetEnableChangefeedInitialScan(true)
841-
.SetEnableUuidAsPrimaryKey(true)
842-
.SetEnableTablePgTypes(true)
843-
.SetEnablePgSyntax(true);
841+
.SetEnableUuidAsPrimaryKey(true);
844842

845843
Server = new TServer(settings);
846844
if (useRealThreads) {
@@ -1974,13 +1972,6 @@ Y_UNIT_TEST_SUITE(Cdc) {
19741972
{"datetime64_value", "Datetime64", false, false},
19751973
{"timestamp64_value", "Timestamp64", false, false},
19761974
{"interval64_value", "Interval64", false, false},
1977-
{"pgint2_value", "pgint2", false, false},
1978-
{"pgint4_value", "pgint4", false, false},
1979-
{"pgint8_value", "pgint8", false, false},
1980-
{"pgfloat4_value", "pgfloat4", false, false},
1981-
{"pgfloat8_value", "pgfloat8", false, false},
1982-
{"pgbytea_value", "pgbytea", false, false},
1983-
{"pgtext_value", "pgtext", false, false},
19841975
});
19851976
TopicRunner::Read(table, Updates(NKikimrSchemeOp::ECdcStreamFormatJson), {
19861977
R"(UPSERT INTO `/Root/Table` (key, int32_value) VALUES (1, -100500);)",
@@ -2006,13 +1997,6 @@ Y_UNIT_TEST_SUITE(Cdc) {
20061997
R"(UPSERT INTO `/Root/Table` (key, datetime64_value) VALUES (21, CAST(1597235696 AS Datetime64));)",
20071998
R"(UPSERT INTO `/Root/Table` (key, timestamp64_value) VALUES (22, CAST(1597235696123456 AS Timestamp64));)",
20081999
R"(UPSERT INTO `/Root/Table` (key, interval64_value) VALUES (23, CAST(-300500 AS Interval64));)",
2009-
R"(UPSERT INTO `/Root/Table` (key, pgint2_value) VALUES (24, -42ps);)",
2010-
R"(UPSERT INTO `/Root/Table` (key, pgint4_value) VALUES (25, -420p);)",
2011-
R"(UPSERT INTO `/Root/Table` (key, pgint8_value) VALUES (26, -4200pb);)",
2012-
R"(UPSERT INTO `/Root/Table` (key, pgfloat4_value) VALUES (27, 3.1415pf4);)",
2013-
R"(UPSERT INTO `/Root/Table` (key, pgfloat8_value) VALUES (28, 2.718pf8);)",
2014-
R"(UPSERT INTO `/Root/Table` (key, pgbytea_value) VALUES (29, 'lorem "ipsum"'pb);)",
2015-
R"(UPSERT INTO `/Root/Table` (key, pgtext_value) VALUES (30, 'lorem "ipsum"'p);)",
20162000
}, {
20172001
R"({"key":[1],"update":{"int32_value":-100500}})",
20182002
R"({"key":[2],"update":{"uint32_value":100500}})",
@@ -2037,13 +2021,6 @@ Y_UNIT_TEST_SUITE(Cdc) {
20372021
R"({"key":[21],"update":{"datetime64_value":1597235696}})",
20382022
R"({"key":[22],"update":{"timestamp64_value":1597235696123456}})",
20392023
R"({"key":[23],"update":{"interval64_value":-300500}})",
2040-
R"({"key":[24],"update":{"pgint2_value":"-42"}})",
2041-
R"({"key":[25],"update":{"pgint4_value":"-420"}})",
2042-
R"({"key":[26],"update":{"pgint8_value":"-4200"}})",
2043-
R"({"key":[27],"update":{"pgfloat4_value":"3.1415"}})",
2044-
R"({"key":[28],"update":{"pgfloat8_value":"2.718"}})",
2045-
R"({"key":[29],"update":{"pgbytea_value":"\\x6c6f72656d2022697073756d22"}})",
2046-
R"({"key":[30],"update":{"pgtext_value":"lorem \"ipsum\""}})",
20472024
});
20482025
}
20492026

ydb/core/tx/datashard/export_common.cpp

Lines changed: 0 additions & 6 deletions
Original file line numberDiff line numberDiff line change
@@ -113,12 +113,6 @@ TString DyNumberToString(TStringBuf data) {
113113
return result;
114114
}
115115

116-
TString PgToString(TStringBuf data, const NScheme::TTypeInfo& typeInfo) {
117-
const NPg::TConvertResult& pgResult = NPg::PgNativeTextFromNativeBinary(data, typeInfo.GetPgTypeDesc());
118-
Y_ABORT_UNLESS(pgResult.Error.Empty());
119-
return pgResult.Str;
120-
}
121-
122116
bool DecimalToStream(const std::pair<ui64, i64>& loHi, IOutputStream& out, TString& err) {
123117
Y_UNUSED(err);
124118
using namespace NYql::NDecimal;

ydb/core/tx/datashard/export_common.h

Lines changed: 0 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -41,7 +41,6 @@ TMaybe<Ydb::Scheme::ModifyPermissionsRequest> GenYdbPermissions(
4141

4242
TString DecimalToString(const std::pair<ui64, i64>& loHi);
4343
TString DyNumberToString(TStringBuf data);
44-
TString PgToString(TStringBuf data, const NScheme::TTypeInfo& typeInfo);
4544
bool DecimalToStream(const std::pair<ui64, i64>& loHi, IOutputStream& out, TString& err);
4645
bool DyNumberToStream(TStringBuf data, IOutputStream& out, TString& err);
4746
bool PgToStream(TStringBuf data, const NScheme::TTypeInfo& typeInfo, IOutputStream& out, TString& err);

ydb/core/tx/datashard/ut_change_exchange/ya.make

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -23,7 +23,7 @@ PEERDIR(
2323
library/cpp/regex/pcre
2424
library/cpp/svnversion
2525
ydb/core/kqp/ut/common
26-
ydb/core/testlib/pg
26+
ydb/core/testlib/default
2727
ydb/core/tx
2828
ydb/library/yql/public/udf/service/exception_policy
2929
ydb/public/lib/yson_value

0 commit comments

Comments
 (0)