gaoran10 opened a new pull request, #1006: URL: https://github.com/apache/pulsar-client-go/pull/1006
### Motivation The pulsar-client-go supports ProtoSchema based on the Avro format, users must provide the schema definition string when using struct schema(JSON, Avro, Proto), it's hard to use and we can't get the entire original proto definition. The difference between ProtoSchema and ProtoNativeSchema is the schema data, the ProtoNativeSchema will contain the entire original proto definition, and we can use the schema data of the ProtoNativeSchema to generate the corresponding Descriptor and get any field, we can leverage this feature in Pulsar SQL. The schema data of the ProtoNativeSchema follow the Pulsar [format](https://github.com/apache/pulsar/blob/master/pulsar-common/src/main/java/org/apache/pulsar/common/protocol/schema/ProtobufNativeSchemaData.java), we can generate JSON data for `ProtobufNativeSchemaData` as the schema data. ``` public class ProtobufNativeSchemaData { private byte[] fileDescriptorSet; private String rootMessageTypeName; private String rootFileDescriptorName; } ``` The field `fileDescriptorSet` is the serialized data of the message `FileDescriptorSet`, it contains all definition proto files data. ``` message FileDescriptorSet { repeated FileDescriptorProto file = 1; } ``` ``` message FileDescriptorProto { optional string name = 1; optional string package = 2; repeated string dependency = 3; repeated DescriptorProto message_type = 4; repeated EnumDescriptorProto enum_type = 5; repeated ServiceDescriptorProto service = 6; repeated FieldDescriptorProto extension = 7; optional FileOptions options = 8; optional SourceCodeInfo source_code_info = 9; repeated int32 public_dependency = 10; repeated int32 weak_dependency = 11; optional string syntax = 12; } ``` ### Modifications Add a new schema type `ProtoNative(20)`. Add ProtoNativeSchema. Add encode and decode methods for ProtoNativeSchema. ### Verifying this change Add an integration test to make sure the broker can deserialize the schema data of the ProtoNativeSchema. ### Does this pull request potentially affect one of the following parts: *If `yes` was chosen, please highlight the changes* - Dependencies (does it add or upgrade a dependency): (yes) - The public API: (yes) - The schema: (yes) - The default values of configurations: (no) - The wire protocol: (no) ### Documentation - Does this pull request introduce a new feature? (yes) - If yes, how is the feature documented? (not applicable / docs / GoDocs / not documented) - If a feature is not applicable for documentation, explain why? - If a feature is not documented yet in this PR, please create a followup issue for adding the documentation -- This is an automated message from the Apache Git Service. To respond to the message, please log on to GitHub and use the URL above to go to the specific comment. To unsubscribe, e-mail: [email protected] For queries about this service, please contact Infrastructure at: [email protected]
