aboutsummaryrefslogtreecommitdiffstats
diff options
context:
space:
mode:
authornadya73 <nadya73@yandex-team.com>2024-11-24 18:58:38 +0300
committernadya73 <nadya73@yandex-team.com>2024-11-24 19:08:37 +0300
commit71c22f4395d5ec749bba7d8a7dbe2f22ccbc62c4 (patch)
tree047fd459880c78d6baf672e86d78c69de61fb656
parent5acf22ceed3e35925e9de2a40960b79003a3d9bf (diff)
downloadydb-71c22f4395d5ec749bba7d8a7dbe2f22ccbc62c4.tar.gz
YT-22431: Fix build of yt/yt/client with system stl/protobuf and tstring_as_std_string
commit_hash:2078e5049de1cfa5e900f6d8ff5698f28e33290a
-rw-r--r--yt/yt/client/api/rpc_proxy/client_impl.cpp4
-rw-r--r--yt/yt/client/api/rpc_proxy/helpers.cpp2
-rw-r--r--yt/yt/client/chunk_client/read_limit.cpp2
-rw-r--r--yt/yt/client/table_client/helpers.cpp6
-rw-r--r--yt/yt/client/table_client/logical_type.cpp2
-rw-r--r--yt/yt/client/unittests/row_ut.cpp2
-rw-r--r--yt/yt/client/ypath/rich.cpp10
-rw-r--r--yt/yt/client/ypath/rich.h3
-rw-r--r--yt/yt/library/formats/arrow_parser.cpp2
-rw-r--r--yt/yt/library/formats/protobuf.cpp8
-rw-r--r--yt/yt/library/formats/protobuf_options.cpp16
11 files changed, 36 insertions, 21 deletions
diff --git a/yt/yt/client/api/rpc_proxy/client_impl.cpp b/yt/yt/client/api/rpc_proxy/client_impl.cpp
index f7397d2f37..0cc2734943 100644
--- a/yt/yt/client/api/rpc_proxy/client_impl.cpp
+++ b/yt/yt/client/api/rpc_proxy/client_impl.cpp
@@ -2453,8 +2453,8 @@ TFuture<TGetQueryTrackerInfoResult> TClient::GetQueryTrackerInfo(
return req->Invoke().Apply(BIND([] (const TApiServiceProxy::TRspGetQueryTrackerInfoPtr& rsp) {
return TGetQueryTrackerInfoResult{
- .QueryTrackerStage = rsp->query_tracker_stage(),
- .ClusterName = rsp->cluster_name(),
+ .QueryTrackerStage = FromProto<TString>(rsp->query_tracker_stage()),
+ .ClusterName = FromProto<TString>(rsp->cluster_name()),
.SupportedFeatures = TYsonString(rsp->supported_features()),
.AccessControlObjects = FromProto<std::vector<TString>>(rsp->access_control_objects()),
};
diff --git a/yt/yt/client/api/rpc_proxy/helpers.cpp b/yt/yt/client/api/rpc_proxy/helpers.cpp
index dba3286840..23be8d3bae 100644
--- a/yt/yt/client/api/rpc_proxy/helpers.cpp
+++ b/yt/yt/client/api/rpc_proxy/helpers.cpp
@@ -1319,7 +1319,7 @@ void FromProto(
const NProto::TMultiTablePartition& protoMultiTablePartition)
{
for (const auto& range : protoMultiTablePartition.table_ranges()) {
- multiTablePartition->TableRanges.emplace_back(NYPath::TRichYPath::Parse(range));
+ multiTablePartition->TableRanges.emplace_back(NYPath::TRichYPath::Parse(FromProto<TString>(range)));
}
if (protoMultiTablePartition.has_aggregate_statistics()) {
diff --git a/yt/yt/client/chunk_client/read_limit.cpp b/yt/yt/client/chunk_client/read_limit.cpp
index 5b1156e3c6..3d6b7fd6c5 100644
--- a/yt/yt/client/chunk_client/read_limit.cpp
+++ b/yt/yt/client/chunk_client/read_limit.cpp
@@ -240,7 +240,7 @@ void TLegacyReadLimit::InitMove(NProto::TReadLimit&& readLimit)
size_t TLegacyReadLimit::SpaceUsed() const
{
return sizeof(*this) +
- ReadLimit_.SpaceUsed() - sizeof(ReadLimit_) +
+ ReadLimit_.SpaceUsedLong() - sizeof(ReadLimit_) +
Key_.GetSpaceUsed() - sizeof(Key_);
}
diff --git a/yt/yt/client/table_client/helpers.cpp b/yt/yt/client/table_client/helpers.cpp
index eaadc83330..d068f910b4 100644
--- a/yt/yt/client/table_client/helpers.cpp
+++ b/yt/yt/client/table_client/helpers.cpp
@@ -828,7 +828,7 @@ void UnversionedValueToProtobufImpl(
THROW_ERROR_EXCEPTION("Cannot parse a protobuf message from %Qlv",
unversionedValue.Type);
}
- TString wireBytes;
+ TProtobufString wireBytes;
StringOutputStream outputStream(&wireBytes);
TProtobufWriterOptions options;
options.UnknownYsonFieldModeResolver = TProtobufWriterOptions::CreateConstantUnknownYsonFieldModeResolver(EUnknownYsonFieldsMode::Keep);
@@ -992,7 +992,7 @@ void UnversionedValueToListImpl(
std::unique_ptr<IYsonConsumer> Underlying_;
int Depth_ = 0;
- TString WireBytes_;
+ TProtobufString WireBytes_;
StringOutputStream OutputStream_;
@@ -1301,7 +1301,7 @@ void UnversionedValueToMapImpl(
std::unique_ptr<IYsonConsumer> Underlying_;
int Depth_ = 0;
- TString WireBytes_;
+ TProtobufString WireBytes_;
StringOutputStream OutputStream_;
diff --git a/yt/yt/client/table_client/logical_type.cpp b/yt/yt/client/table_client/logical_type.cpp
index 4845e37210..5d9a5f75b6 100644
--- a/yt/yt/client/table_client/logical_type.cpp
+++ b/yt/yt/client/table_client/logical_type.cpp
@@ -1193,7 +1193,7 @@ void FromProto(TLogicalTypePtr* logicalType, const NProto::TLogicalType& protoLo
case NProto::TLogicalType::TypeCase::kTagged: {
TLogicalTypePtr element;
FromProto(&element, protoLogicalType.tagged().element());
- *logicalType = TaggedLogicalType(protoLogicalType.tagged().tag(), std::move(element));
+ *logicalType = TaggedLogicalType(FromProto<TString>(protoLogicalType.tagged().tag()), std::move(element));
return;
}
case NProto::TLogicalType::TypeCase::TYPE_NOT_SET:
diff --git a/yt/yt/client/unittests/row_ut.cpp b/yt/yt/client/unittests/row_ut.cpp
index 00eba96742..faca0c90f5 100644
--- a/yt/yt/client/unittests/row_ut.cpp
+++ b/yt/yt/client/unittests/row_ut.cpp
@@ -16,7 +16,7 @@ namespace {
void CheckSerialize(TUnversionedRow original)
{
- auto serialized = NYT::ToProto<TString>(original);
+ auto serialized = NYT::ToProto<TProtobufString>(original);
auto deserialized = NYT::FromProto<TUnversionedOwningRow>(serialized);
ASSERT_EQ(original, deserialized);
diff --git a/yt/yt/client/ypath/rich.cpp b/yt/yt/client/ypath/rich.cpp
index 717194f64b..494d8b420c 100644
--- a/yt/yt/client/ypath/rich.cpp
+++ b/yt/yt/client/ypath/rich.cpp
@@ -753,6 +753,16 @@ void FromProto(TRichYPath* path, const TString& protoPath)
*path = TRichYPath::Parse(protoPath);
}
+void ToProto(std::string* protoPath, const TRichYPath& path)
+{
+ *protoPath = ConvertToString(path, EYsonFormat::Binary);
+}
+
+void FromProto(TRichYPath* path, const std::string& protoPath)
+{
+ *path = TRichYPath::Parse(TString(protoPath));
+}
+
////////////////////////////////////////////////////////////////////////////////
const std::vector<TString>& GetWellKnownRichYPathAttributes()
diff --git a/yt/yt/client/ypath/rich.h b/yt/yt/client/ypath/rich.h
index 75335b7606..2f48937895 100644
--- a/yt/yt/client/ypath/rich.h
+++ b/yt/yt/client/ypath/rich.h
@@ -193,6 +193,9 @@ void Deserialize(TRichYPath& richPath, NYson::TYsonPullParserCursor* cursor);
void ToProto(TString* protoPath, const TRichYPath& path);
void FromProto(TRichYPath* path, const TString& protoPath);
+void ToProto(std::string* protoPath, const TRichYPath& path);
+void FromProto(TRichYPath* path, const std::string& protoPath);
+
////////////////////////////////////////////////////////////////////////////////
const std::vector<TString>& GetWellKnownRichYPathAttributes();
diff --git a/yt/yt/library/formats/arrow_parser.cpp b/yt/yt/library/formats/arrow_parser.cpp
index e248240fd6..c3c169352b 100644
--- a/yt/yt/library/formats/arrow_parser.cpp
+++ b/yt/yt/library/formats/arrow_parser.cpp
@@ -11,6 +11,8 @@
#include <library/cpp/yt/memory/chunked_output_stream.h>
+#include <util/generic/buffer.h>
+
#include <util/stream/buffer.h>
#include <contrib/libs/apache/arrow/cpp/src/arrow/api.h>
diff --git a/yt/yt/library/formats/protobuf.cpp b/yt/yt/library/formats/protobuf.cpp
index a710bf9e61..d3e087101f 100644
--- a/yt/yt/library/formats/protobuf.cpp
+++ b/yt/yt/library/formats/protobuf.cpp
@@ -121,7 +121,7 @@ public:
void AddError(
int line,
::google::protobuf::io::ColumnNumber column,
- const TString& message) override
+ const TProtobufString& message) override
{
if (std::ssize(Errors_) < ErrorCountLimit) {
Errors_.push_back(TError("%v", message)
@@ -145,11 +145,11 @@ class TDescriptorPoolErrorCollector
{
public:
void AddError(
- const TString& fileName,
- const TString& elementName,
+ const TProtobufString& fileName,
+ const TProtobufString& elementName,
const Message* /*descriptor*/,
DescriptorPool::ErrorCollector::ErrorLocation /*location*/,
- const TString& message) override
+ const TProtobufString& message) override
{
if (std::ssize(Errors_) < ErrorCountLimit) {
Errors_.push_back(TError("%v", message)
diff --git a/yt/yt/library/formats/protobuf_options.cpp b/yt/yt/library/formats/protobuf_options.cpp
index 8828c46371..c30474c418 100644
--- a/yt/yt/library/formats/protobuf_options.cpp
+++ b/yt/yt/library/formats/protobuf_options.cpp
@@ -95,7 +95,7 @@ TOneofOption OneofFlagToOption(EWrapperOneofFlag::Enum flag)
Y_ABORT();
}
-TString OptionToFieldFlagName(TFieldOption option)
+TProtobufString OptionToFieldFlagName(TFieldOption option)
{
using EFlag = EWrapperFieldFlag;
struct TVisitor
@@ -165,7 +165,7 @@ TString OptionToFieldFlagName(TFieldOption option)
return EWrapperFieldFlag_Enum_Name(std::visit(TVisitor(), option));
}
-TString OptionToMessageFlagName(TMessageOption option)
+TProtobufString OptionToMessageFlagName(TMessageOption option)
{
using EFlag = EWrapperMessageFlag;
struct TVisitor
@@ -185,7 +185,7 @@ TString OptionToMessageFlagName(TMessageOption option)
return EWrapperMessageFlag_Enum_Name(std::visit(TVisitor(), option));
}
-TString OptionToOneofFlagName(TOneofOption option)
+TProtobufString OptionToOneofFlagName(TOneofOption option)
{
using EFlag = EWrapperOneofFlag;
struct TVisitor
@@ -430,12 +430,12 @@ TProtobufOneofOptions GetOneofOptions(
auto variantFieldName = oneofDescriptor->options().GetExtension(variant_field_name);
switch (options.Mode) {
case EProtobufOneofMode::SeparateFields:
- if (variantFieldName) {
+ if (!variantFieldName.empty()) {
ythrow yexception() << "\"variant_field_name\" requires (NYT.oneof_flags) = VARIANT";
}
break;
case EProtobufOneofMode::Variant:
- if (variantFieldName) {
+ if (!variantFieldName.empty()) {
options.VariantFieldName = variantFieldName;
} else {
options.VariantFieldName = oneofDescriptor->name();
@@ -462,13 +462,13 @@ TString GetColumnName(const FieldDescriptor* field)
const auto& options = field->options();
const auto columnName = options.GetExtension(column_name);
if (!columnName.empty()) {
- return columnName;
+ return TString(columnName);
}
const auto keyColumnName = options.GetExtension(key_column_name);
if (!keyColumnName.empty()) {
- return keyColumnName;
+ return TString(keyColumnName);
}
- return field->name();
+ return TString(field->name());
}
void ValidateProtobufType(const FieldDescriptor* fieldDescriptor, ESpecialProtobufType protobufType)