Update protobuf to v25.1

The new version deprecates `syntax()` and makes it inaccessible. Instead, the
attributes corresponding to a feature should be used. This commit addresses
this.
This commit is contained in:
Mikhail Koviazin 2023-12-13 08:21:43 +07:00
parent 4fd64a696b
commit 11371e886c
No known key found for this signature in database
GPG Key ID: 0EEAA1BF0787792F
4 changed files with 9 additions and 19 deletions

@ -1 +1 @@
Subproject commit 0862007f6ca1f5723c58f10f0ca34f3f25a63b2e
Subproject commit 0fae801fb4785175a4481aae1c0f721700e7bd99

View File

@ -305,12 +305,16 @@ set(libprotoc_files
${protobuf_source_dir}/src/google/protobuf/compiler/retention.cc
${protobuf_source_dir}/src/google/protobuf/compiler/ruby/ruby_generator.cc
${protobuf_source_dir}/src/google/protobuf/compiler/rust/accessors/accessors.cc
${protobuf_source_dir}/src/google/protobuf/compiler/rust/accessors/singular_bytes.cc
${protobuf_source_dir}/src/google/protobuf/compiler/rust/accessors/singular_message.cc
${protobuf_source_dir}/src/google/protobuf/compiler/rust/accessors/singular_scalar.cc
${protobuf_source_dir}/src/google/protobuf/compiler/rust/accessors/singular_string.cc
${protobuf_source_dir}/src/google/protobuf/compiler/rust/accessors/unsupported_field.cc
${protobuf_source_dir}/src/google/protobuf/compiler/rust/context.cc
${protobuf_source_dir}/src/google/protobuf/compiler/rust/generator.cc
${protobuf_source_dir}/src/google/protobuf/compiler/rust/message.cc
${protobuf_source_dir}/src/google/protobuf/compiler/rust/naming.cc
${protobuf_source_dir}/src/google/protobuf/compiler/rust/oneof.cc
${protobuf_source_dir}/src/google/protobuf/compiler/rust/relative_path.cc
${protobuf_source_dir}/src/google/protobuf/compiler/subprocess.cc
${protobuf_source_dir}/src/google/protobuf/compiler/zip_writer.cc
)

View File

@ -53,7 +53,6 @@ namespace ErrorCodes
{
extern const int NO_COLUMNS_SERIALIZED_TO_PROTOBUF_FIELDS;
extern const int MULTIPLE_COLUMNS_SERIALIZED_TO_SAME_PROTOBUF_FIELD;
extern const int NO_COLUMN_SERIALIZED_TO_REQUIRED_PROTOBUF_FIELD;
extern const int DATA_TYPE_INCOMPATIBLE_WITH_PROTOBUF_FIELD;
extern const int PROTOBUF_FIELD_NOT_REPEATED;
extern const int PROTOBUF_BAD_CAST;
@ -140,7 +139,7 @@ namespace
return false;
if (google_wrappers_special_treatment && isGoogleWrapperField(field_descriptor))
return false;
return field_descriptor.message_type() || (field_descriptor.file()->syntax() == google::protobuf::FileDescriptor::SYNTAX_PROTO3);
return field_descriptor.message_type() || !field_descriptor.has_presence();
}
// Should we pack repeated values while storing them.
@ -170,7 +169,7 @@ namespace
}
if (field_descriptor.options().has_packed())
return field_descriptor.options().packed();
return field_descriptor.file()->syntax() == google::protobuf::FileDescriptor::SYNTAX_PROTO3;
return field_descriptor.is_packed();
}
WriteBuffer & writeIndent(WriteBuffer & out, size_t size) { return out << String(size * 4, ' '); }
@ -3445,19 +3444,6 @@ namespace
}
}
/// Check that we've found matching columns for all the required fields.
if ((message_descriptor.file()->syntax() == google::protobuf::FileDescriptor::SYNTAX_PROTO2)
&& reader_or_writer.writer)
{
for (int i : collections::range(message_descriptor.field_count()))
{
const auto & field_descriptor = *message_descriptor.field(i);
if (field_descriptor.is_required() && !field_descriptors_in_use.count(&field_descriptor))
throw Exception(ErrorCodes::NO_COLUMN_SERIALIZED_TO_REQUIRED_PROTOBUF_FIELD, "Field {} is required to be set",
quoteString(field_descriptor.full_name()));
}
}
if (field_descs.empty())
return nullptr;