File tree 5 files changed +35
-13
lines changed
5 files changed +35
-13
lines changed Original file line number Diff line number Diff line change @@ -515,17 +515,23 @@ class TxPlanSerializer {
515
515
}
516
516
517
517
TString DescribeValue (const NKikimr::NClient::TValue& value) {
518
- auto str = value.GetDataText ();
519
- switch (value.GetType ().GetData ().GetScheme ()) {
520
- case NScheme::NTypeIds::Utf8:
521
- case NScheme::NTypeIds::Json:
522
- case NScheme::NTypeIds::String:
523
- case NScheme::NTypeIds::String4k:
524
- case NScheme::NTypeIds::String2m:
525
- return " «" + str + " »" ;
526
- default :
527
- return str;
518
+ if (value.GetType ().GetKind () == NKikimrMiniKQL::ETypeKind::Data) {
519
+ auto str = value.GetDataText ();
520
+ switch (value.GetType ().GetData ().GetScheme ()) {
521
+ case NScheme::NTypeIds::Utf8:
522
+ case NScheme::NTypeIds::Json:
523
+ case NScheme::NTypeIds::String:
524
+ case NScheme::NTypeIds::String4k:
525
+ case NScheme::NTypeIds::String2m:
526
+ return " «" + str + " »" ;
527
+ default :
528
+ return str;
529
+ }
530
+ }
531
+ if (value.GetType ().GetKind () == NKikimrMiniKQL::ETypeKind::Pg) {
532
+ return value.GetPgText ();
528
533
}
534
+ Y_ENSURE (false , TStringBuilder () << " unexpected NKikimrMiniKQL::ETypeKind" << ETypeKind_Name (value.GetType ().GetKind ()));
529
535
}
530
536
531
537
void Visit (const TKqpReadRangesSourceSettings& sourceSettings, TQueryPlanNode& planNode) {
Original file line number Diff line number Diff line change @@ -1653,8 +1653,6 @@ Y_UNIT_TEST_SUITE(KqpNotNullColumns) {
1653
1653
}
1654
1654
}
1655
1655
1656
- #if 0
1657
- // TODO: fix TxPlanSerializer with PG keys
1658
1656
Y_UNIT_TEST (SecondaryIndexWithNotNullDataColumnPg) {
1659
1657
auto settings = TKikimrSettings ()
1660
1658
.SetWithSampleTables (false )
@@ -1759,7 +1757,7 @@ Y_UNIT_TEST_SUITE(KqpNotNullColumns) {
1759
1757
result.GetIssues ().ToString ());
1760
1758
}
1761
1759
}
1762
- # endif
1760
+
1763
1761
1764
1762
Y_UNIT_TEST_TWIN (JoinBothTablesWithNotNullPk, StreamLookup) {
1765
1763
NKikimrConfig::TAppConfig appConfig;
Original file line number Diff line number Diff line change 1
1
#include " value.h"
2
2
3
3
#include < ydb/library/yql/public/decimal/yql_decimal.h>
4
+ #include < ydb/library/yql/parser/pg_wrapper/interface/type_desc.h>
4
5
5
6
#include < library/cpp/string_utils/base64/base64.h>
6
7
@@ -432,6 +433,20 @@ TString TValue::GetDataText() const {
432
433
return TStringBuilder () << " \" <unknown type " << Type.GetData ().GetScheme () << " >\" " ;
433
434
}
434
435
436
+ TString TValue::GetPgText () const {
437
+ Y_ASSERT (Type.GetKind () == NKikimrMiniKQL::ETypeKind::Pg);
438
+ if (Value.HasNullFlagValue ()) {
439
+ return TString (" null" );
440
+ }
441
+ if (Value.HasText ()) {
442
+ return Value.GetText ();
443
+ }
444
+ auto pgType = Type.GetPg ();
445
+ auto convertResult = NPg::PgNativeTextFromNativeBinary (Value.GetBytes (), NPg::TypeDescFromPgTypeId (pgType.Getoid ()));
446
+ Y_ENSURE (!convertResult.Error , convertResult.Error );
447
+ return convertResult.Str ;
448
+ }
449
+
435
450
template <> TString TValue::GetTypeText<TFormatCxx>(const TFormatCxx& format) const {
436
451
switch (Type.GetKind ()) {
437
452
case NKikimrMiniKQL::ETypeKind::Void:
Original file line number Diff line number Diff line change @@ -89,6 +89,8 @@ class TValue {
89
89
NScheme::TTypeId GetDataType () const ;
90
90
// gets text representation of simple 'Data' types
91
91
TString GetDataText () const ;
92
+ // gets text representation of 'Pg' types
93
+ TString GetPgText () const ;
92
94
// returns text representation of value's type
93
95
template <typename Format> TString GetTypeText (const Format& format = Format()) const ;
94
96
// returns text representation of value itself
Original file line number Diff line number Diff line change 9
9
library/cpp/string_utils/base64
10
10
ydb/core/protos
11
11
ydb/library/mkql_proto/protos
12
+ ydb/library/yql/parser/pg_wrapper/interface
12
13
ydb/public/lib/scheme_types
13
14
ydb/public/sdk/cpp/client/ydb_value
14
15
)
You can’t perform that action at this time.
0 commit comments