Skip to content

Commit

Permalink
Revert "add pg types to TQueryPlan (ydb-platform#828)" (ydb-platform#850
Browse files Browse the repository at this point in the history
)

This reverts commit 3c0bb78.
  • Loading branch information
alexv-smirnov authored Jan 5, 2024
1 parent 791e95e commit 71e39db
Show file tree
Hide file tree
Showing 5 changed files with 13 additions and 35 deletions.
26 changes: 10 additions & 16 deletions ydb/core/kqp/opt/kqp_query_plan.cpp
Original file line number Diff line number Diff line change
Expand Up @@ -515,23 +515,17 @@ class TxPlanSerializer {
}

TString DescribeValue(const NKikimr::NClient::TValue& value) {
if (value.GetType().GetKind() == NKikimrMiniKQL::ETypeKind::Data) {
auto str = value.GetDataText();
switch (value.GetType().GetData().GetScheme()) {
case NScheme::NTypeIds::Utf8:
case NScheme::NTypeIds::Json:
case NScheme::NTypeIds::String:
case NScheme::NTypeIds::String4k:
case NScheme::NTypeIds::String2m:
return "«" + str + "»";
default:
return str;
}
}
if (value.GetType().GetKind() == NKikimrMiniKQL::ETypeKind::Pg) {
return value.GetPgText();
auto str = value.GetDataText();
switch (value.GetType().GetData().GetScheme()) {
case NScheme::NTypeIds::Utf8:
case NScheme::NTypeIds::Json:
case NScheme::NTypeIds::String:
case NScheme::NTypeIds::String4k:
case NScheme::NTypeIds::String2m:
return "«" + str + "»";
default:
return str;
}
Y_ENSURE(false, TStringBuilder() << "unexpected NKikimrMiniKQL::ETypeKind: " << ETypeKind_Name(value.GetType().GetKind()));
}

void Visit(const TKqpReadRangesSourceSettings& sourceSettings, TQueryPlanNode& planNode) {
Expand Down
4 changes: 3 additions & 1 deletion ydb/core/kqp/ut/opt/kqp_not_null_ut.cpp
Original file line number Diff line number Diff line change
Expand Up @@ -1653,6 +1653,8 @@ Y_UNIT_TEST_SUITE(KqpNotNullColumns) {
}
}

#if 0
// TODO: fix TxPlanSerializer with PG keys
Y_UNIT_TEST(SecondaryIndexWithNotNullDataColumnPg) {
auto settings = TKikimrSettings()
.SetWithSampleTables(false)
Expand Down Expand Up @@ -1757,7 +1759,7 @@ Y_UNIT_TEST_SUITE(KqpNotNullColumns) {
result.GetIssues().ToString());
}
}

#endif

Y_UNIT_TEST_TWIN(JoinBothTablesWithNotNullPk, StreamLookup) {
NKikimrConfig::TAppConfig appConfig;
Expand Down
15 changes: 0 additions & 15 deletions ydb/public/lib/value/value.cpp
Original file line number Diff line number Diff line change
@@ -1,7 +1,6 @@
#include "value.h"

#include <ydb/library/yql/public/decimal/yql_decimal.h>
#include <ydb/library/yql/parser/pg_wrapper/interface/type_desc.h>

#include <library/cpp/string_utils/base64/base64.h>

Expand Down Expand Up @@ -433,20 +432,6 @@ TString TValue::GetDataText() const {
return TStringBuilder() << "\"<unknown type " << Type.GetData().GetScheme() << ">\"";
}

TString TValue::GetPgText() const {
Y_ASSERT(Type.GetKind() == NKikimrMiniKQL::ETypeKind::Pg);
if (Value.HasNullFlagValue()) {
return TString("null");
}
if (Value.HasText()) {
return Value.GetText();
}
auto pgType = Type.GetPg();
auto convertResult = NPg::PgNativeTextFromNativeBinary(Value.GetBytes(), NPg::TypeDescFromPgTypeId(pgType.Getoid()));
Y_ENSURE(!convertResult.Error, convertResult.Error);
return convertResult.Str;
}

template <> TString TValue::GetTypeText<TFormatCxx>(const TFormatCxx& format) const {
switch(Type.GetKind()) {
case NKikimrMiniKQL::ETypeKind::Void:
Expand Down
2 changes: 0 additions & 2 deletions ydb/public/lib/value/value.h
Original file line number Diff line number Diff line change
Expand Up @@ -89,8 +89,6 @@ class TValue {
NScheme::TTypeId GetDataType() const;
// gets text representation of simple 'Data' types
TString GetDataText() const;
// gets text representation of 'Pg' types
TString GetPgText() const;
// returns text representation of value's type
template <typename Format> TString GetTypeText(const Format& format = Format()) const;
// returns text representation of value itself
Expand Down
1 change: 0 additions & 1 deletion ydb/public/lib/value/ya.make
Original file line number Diff line number Diff line change
Expand Up @@ -9,7 +9,6 @@ PEERDIR(
library/cpp/string_utils/base64
ydb/core/protos
ydb/library/mkql_proto/protos
ydb/library/yql/parser/pg_wrapper/interface
ydb/public/lib/scheme_types
ydb/public/sdk/cpp/client/ydb_value
)
Expand Down

0 comments on commit 71e39db

Please sign in to comment.