Browse Source

[yt/cpp/mapreduce]Fix build with system protoc, std::string and system stl

Fix build with system protoc, std::string and system stl
8b5b81b2d7855f6b0dcb4bb0583a6408e5b7d3f7
nadya73 7 months ago
parent
commit
cb13057a00

+ 4 - 4
contrib/libs/apache/orc/c++/src/Reader.cc

@@ -565,7 +565,7 @@ namespace orc {
     mutableFooter->CopyFrom(*footer);
     tail.set_file_length(fileLength);
     tail.set_postscript_length(postscriptLength);
-    TString result;
+    TProtoStringType result;
     if (!tail.SerializeToString(&result)) {
       throw ParseError("Failed to serialize file tail");
     }
@@ -691,7 +691,7 @@ namespace orc {
 
   std::string ReaderImpl::getMetadataValue(const std::string& key) const {
     for (int i = 0; i < footer->metadata_size(); ++i) {
-      if (footer->metadata(i).name() == TString(key)) {
+      if (footer->metadata(i).name() == TProtoStringType(key)) {
         return footer->metadata(i).value();
       }
     }
@@ -741,7 +741,7 @@ namespace orc {
 
   bool ReaderImpl::hasMetadataValue(const std::string& key) const {
     for (int i = 0; i < footer->metadata_size(); ++i) {
-      if (footer->metadata(i).name() == TString(key)) {
+      if (footer->metadata(i).name() == TProtoStringType(key)) {
         return true;
       }
     }
@@ -1367,7 +1367,7 @@ namespace orc {
     if (serializedFooter.length() != 0) {
       // Parse the file tail from the serialized one.
       proto::FileTail tail;
-      if (!tail.ParseFromString(TString(serializedFooter))) {
+      if (!tail.ParseFromString(TProtoStringType(serializedFooter))) {
         throw ParseError("Failed to parse the file tail from string");
       }
       contents->postscript = std::make_unique<proto::PostScript>(tail.postscript());

+ 7 - 5
contrib/libs/apache/orc/c++/src/Statistics.hh

@@ -27,6 +27,8 @@
 #include "Timezone.hh"
 #include "TypeImpl.hh"
 
+#include <util/generic/string.h>
+
 namespace orc {
 
   /**
@@ -711,14 +713,14 @@ namespace orc {
 
       proto::DecimalStatistics* decStats = pbStats.mutable_decimal_statistics();
       if (_stats.hasMinimum()) {
-        decStats->set_minimum(TString(_stats.getMinimum().toString(true)));
-        decStats->set_maximum(TString(_stats.getMaximum().toString(true)));
+        decStats->set_minimum(TProtoStringType(_stats.getMinimum().toString(true)));
+        decStats->set_maximum(TProtoStringType(_stats.getMaximum().toString(true)));
       } else {
         decStats->clear_minimum();
         decStats->clear_maximum();
       }
       if (_stats.hasSum()) {
-        decStats->set_sum(TString(_stats.getSum().toString(true)));
+        decStats->set_sum(TProtoStringType(_stats.getSum().toString(true)));
       } else {
         decStats->clear_sum();
       }
@@ -1225,8 +1227,8 @@ namespace orc {
 
       proto::StringStatistics* strStats = pbStats.mutable_string_statistics();
       if (_stats.hasMinimum()) {
-        strStats->set_minimum(TString(_stats.getMinimum()));
-        strStats->set_maximum(TString(_stats.getMaximum()));
+        strStats->set_minimum(TProtoStringType(_stats.getMinimum()));
+        strStats->set_maximum(TProtoStringType(_stats.getMaximum()));
       } else {
         strStats->clear_minimum();
         strStats->clear_maximum();

+ 6 - 6
contrib/libs/apache/orc/c++/src/Writer.cc

@@ -429,8 +429,8 @@ namespace orc {
 
   void WriterImpl::addUserMetadata(const std::string& name, const std::string& value) {
     proto::UserMetadataItem* userMetadataItem = fileFooter.add_metadata();
-    userMetadataItem->set_name(TString(name));
-    userMetadataItem->set_value(TString(value));
+    userMetadataItem->set_name(TProtoStringType(name));
+    userMetadataItem->set_value(TProtoStringType(value));
   }
 
   void WriterImpl::init() {
@@ -510,7 +510,7 @@ namespace orc {
       *stripeFooter.add_columns() = encodings[i];
     }
 
-    stripeFooter.set_writer_timezone(TString(options.getTimezoneName()));
+    stripeFooter.set_writer_timezone(TProtoStringType(options.getTimezoneName()));
 
     // add stripe statistics to metadata
     proto::StripeStatistics* stripeStats = metadata.add_stripe_stats();
@@ -679,8 +679,8 @@ namespace orc {
     for (auto& key : t.getAttributeKeys()) {
       const auto& value = t.getAttributeValue(key);
       auto protoAttr = protoType.add_attributes();
-      protoAttr->set_key(TString(key));
-      protoAttr->set_value(TString(value));
+      protoAttr->set_key(TProtoStringType(key));
+      protoAttr->set_value(TProtoStringType(value));
     }
 
     int pos = static_cast<int>(index);
@@ -689,7 +689,7 @@ namespace orc {
     for (uint64_t i = 0; i < t.getSubtypeCount(); ++i) {
       // only add subtypes' field names if this type is STRUCT
       if (t.getKind() == STRUCT) {
-        footer.mutable_types(pos)->add_field_names(TString(t.getFieldName(i)));
+        footer.mutable_types(pos)->add_field_names(TProtoStringType(t.getFieldName(i)));
       }
       footer.mutable_types(pos)->add_subtypes(++index);
       buildFooterType(*t.getSubtype(i), footer, index);

+ 5 - 3
contrib/libs/apache/orc/c++/src/sargs/PredicateLeaf.cc

@@ -26,6 +26,8 @@
 #include <sstream>
 #include <type_traits>
 
+#include <util/generic/string.h>
+
 namespace orc {
 
   PredicateLeaf::PredicateLeaf(Operator op, PredicateDataType type, const std::string& colName,
@@ -495,11 +497,11 @@ namespace orc {
     return result;
   }
 
-  static std::vector<TString> literal2String(const std::vector<Literal>& values) {
-    std::vector<TString> result;
+  static std::vector<TProtoStringType> literal2String(const std::vector<Literal>& values) {
+    std::vector<TProtoStringType> result;
     std::for_each(values.cbegin(), values.cend(), [&](const Literal& val) {
       if (!val.isNull()) {
-        result.emplace_back(TString(val.getString()));
+        result.emplace_back(TProtoStringType(val.getString()));
       }
     });
     return result;

+ 1 - 1
library/cpp/protobuf/dynamic_prototype/ya.make

@@ -6,7 +6,7 @@ SRCS(
 )
 
 PEERDIR(
-    contrib/libs/protobuf
+    library/cpp/protobuf/runtime
 )
 
 END()

+ 1 - 1
library/cpp/protobuf/json/ya.make

@@ -14,8 +14,8 @@ SRCS(
 )
 
 PEERDIR(
-    contrib/libs/protobuf
     library/cpp/json
+    library/cpp/protobuf/runtime
     library/cpp/protobuf/util
     library/cpp/protobuf/json/proto
     library/cpp/string_utils/relaxed_escaper

+ 9 - 0
library/cpp/protobuf/runtime/ya.make

@@ -0,0 +1,9 @@
+LIBRARY()
+
+IF (USE_VANILLA_PROTOC)
+    PEERDIR(contrib/libs/protobuf_std)
+ELSE()
+    PEERDIR(contrib/libs/protobuf)
+ENDIF()
+
+END()

+ 1 - 1
library/cpp/protobuf/yql/ya.make

@@ -6,10 +6,10 @@ SRCS(
 )
 
 PEERDIR(
-    contrib/libs/protobuf
     library/cpp/json
     library/cpp/protobuf/dynamic_prototype
     library/cpp/protobuf/json
+    library/cpp/protobuf/runtime
     library/cpp/string_utils/base64
 )
 

+ 1 - 1
library/cpp/tdigest/ya.make

@@ -6,7 +6,7 @@ SRCS(
 )
 
 PEERDIR(
-    contrib/libs/protobuf
+    library/cpp/protobuf/runtime
 )
 
 END()

+ 13 - 0
library/python/protobuf/runtime/ya.make

@@ -0,0 +1,13 @@
+PY23_LIBRARY()
+
+IF (USE_VANILLA_PROTOC AND NOT PYTHON2)
+    PEERDIR(
+        contrib/python/protobuf_std
+    )
+ELSE()
+    PEERDIR(
+        contrib/python/protobuf
+    )
+ENDIF()
+
+END()

Some files were not shown because too many files changed in this diff