You are viewing a plain text version of this content. The canonical link for it is here.
Posted to commits@pulsar.apache.org by GitBox <gi...@apache.org> on 2022/06/07 16:44:57 UTC

[GitHub] [pulsar-client-go] gavrilyuc2 opened a new issue, #786: upgrade linkedin/goavro to v2.11.1

gavrilyuc2 opened a new issue, #786:
URL: https://github.com/apache/pulsar-client-go/issues/786

   <img width="1297" alt="image" src="https://user-images.githubusercontent.com/87661819/172437396-d66bbb06-a70e-4db4-ac13-421e0ed883d6.png">
   


-- 
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: commits-unsubscribe@pulsar.apache.org.apache.org

For queries about this service, please contact Infrastructure at:
users@infra.apache.org


[GitHub] [pulsar-client-go] zzzming commented on issue #786: [BUG] upgrade linkedin/goavro to v2.11.1

Posted by GitBox <gi...@apache.org>.
zzzming commented on issue #786:
URL: https://github.com/apache/pulsar-client-go/issues/786#issuecomment-1163603356

   @gavrilyuc2 This is not a bug. Upgrading to linkedin/goavro 2.11 would not fix it. (I tried)
   
   In the Avro schema, the gender type is a union. Union in goavro is actually very well documented at https://github.com/linkedin/goavro#translating-from-avro-to-go-data
   Here is the exact description how the library is encoding a union
   ```
   Because of encoding rules for Avro unions, when an union's value is null, a simple Go nil is returned. However when an union's value is non-nil, a Go map[string]interface{} with a single key is returned for the union. The map's single key is the Avro type name and its value is the datum's value.
   ```
   The means you need to declare the data structure as the following.
   `type UserPulsarMessage struct {
   	FirstName string                 `json:"firstName"`
   	LastName  string                 `json:"lastName"`
   	Gender    map[string]interface{} `json:"gender"`
   }`
   Gender has to be a map according to the README. The value is initialized as 
   `Gender:    map[string]interface{}{"string": "male"}, ` or `Gender: nil` 
   
   There is the exact same discussion about how union is represented in goavro.
   
   I hope this helps. Please close this issue.


-- 
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: commits-unsubscribe@pulsar.apache.org

For queries about this service, please contact Infrastructure at:
users@infra.apache.org


[GitHub] [pulsar-client-go] gavrilyuc2 commented on issue #786: [BUG] upgrade linkedin/goavro to v2.11.1

Posted by GitBox <gi...@apache.org>.
gavrilyuc2 commented on issue #786:
URL: https://github.com/apache/pulsar-client-go/issues/786#issuecomment-1173961286

   What about [this package](https://github.com/hamba/avro)?
   
   I think it will be right for simple union types because I have a problem with using `map[string]interface{}` type with other (python and go producers with consumers) and for producing messages it will be ok, but for consuming messages we have an error like that I wrote before.
   
   But if I use [this package](https://github.com/hamba/avro) I don't see this error.


-- 
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: commits-unsubscribe@pulsar.apache.org

For queries about this service, please contact Infrastructure at:
users@infra.apache.org