[GitHub] [pulsar] codelipenghui commented on pull request #9895: Implement Schema#OBJECT - support for Consumer

Sun, 14 Mar 2021 07:02:25 -0700


codelipenghui commented on pull request #9895:
URL: https://github.com/apache/pulsar/pull/9895#issuecomment-798913224


   > GenericRecord itself is a general purpose keyvalue dictionary, and using 
it to represent primitive types, arrays, KeyValue objects... is not intuitive 
and it will also require lots of plumbing and adapters
   
   Yes, Looks a little weird. But with this approach, we don't need to 
introduce a new schema which is very similar to AUTO_CONSUME schema. This makes 
it difficult for users to decide whether to use AUTO_CONSUME schema or OBJECT 
schema. And use OBJECT schema also can achieve AUTO_CONSUME. From the 
perspective of schema API, we really need to consider it carefully.
   
   The AUTO_CONSUME schema wants to deal with consuming any messages from the 
topic. The data of the topic can be the struct data and primary data. So, the 
AUTO_CONSUME schema should able to deal with the primary schema. The problem is 
we are returning the `GenericRecord` which looks more like better dealing with 
structured data, not primary data. So the essential problem is the definition 
of the `GenericRecord`, not the `AUTO_CONSUME` schema.
   
   In my opinion, the OBJECT schema will bring more complexity to the Pulsar 
Schema, 2 schema types want to deal with the same problem. The `GenericRecord` 
maybe not a good name, If we have to make trade-offs, I prefer the 
GenericRecord approach. Take a step back, why `GenericRecord` can't deal with 
the primary types? 


----------------------------------------------------------------
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.

For queries about this service, please contact Infrastructure at:
[email protected]


Reply via email to