Skip to content

Commit eff85c8

Browse files
committedMar 15, 2025
GH-45807: [C++] introduce compatiblity with protobuf 30
This version of protobuf has switched a few interface types from `std::string` to `std::string_view` and therefore introcuces some breaking changes in the code. Fix these by applying appropriate casts. Link: https://protobuf.dev/support/migration/#v30 Signed-off-by: Christian Heusel <christian@heusel.eu>
1 parent 69682cd commit eff85c8

File tree

3 files changed

+4
-4
lines changed

3 files changed

+4
-4
lines changed
 

‎cpp/src/arrow/engine/substrait/expression_internal.cc

+1-1
Original file line numberDiff line numberDiff line change
@@ -142,7 +142,7 @@ std::string EnumToString(int value, const google::protobuf::EnumDescriptor* desc
142142
if (value_desc == nullptr) {
143143
return "unknown";
144144
}
145-
return value_desc->name();
145+
return std::string(value_desc->name());
146146
}
147147

148148
Result<compute::Expression> FromProto(const substrait::Expression::ReferenceSegment* ref,

‎cpp/src/arrow/engine/substrait/serde.cc

+2-2
Original file line numberDiff line numberDiff line change
@@ -62,8 +62,8 @@ Status ParseFromBufferImpl(const Buffer& buf, const std::string& full_name,
6262
template <typename Message>
6363
Result<Message> ParseFromBuffer(const Buffer& buf) {
6464
Message message;
65-
ARROW_RETURN_NOT_OK(
66-
ParseFromBufferImpl(buf, Message::descriptor()->full_name(), &message));
65+
ARROW_RETURN_NOT_OK(ParseFromBufferImpl(
66+
buf, std::string(Message::descriptor()->full_name()), &message));
6767
return message;
6868
}
6969

‎cpp/src/arrow/engine/substrait/util_internal.cc

+1-1
Original file line numberDiff line numberDiff line change
@@ -30,7 +30,7 @@ std::string EnumToString(int value, const google::protobuf::EnumDescriptor& desc
3030
if (value_desc == nullptr) {
3131
return "unknown";
3232
}
33-
return value_desc->name();
33+
return std::string(value_desc->name());
3434
}
3535

3636
std::unique_ptr<substrait::Version> CreateVersion() {

0 commit comments

Comments
 (0)