-
Notifications
You must be signed in to change notification settings - Fork 223
New issue
Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.
By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.
Already on GitHub? Sign in to your account
Error encoding map[string]float64 while schema is a map #36
Comments
You are completely correct. It's not terribly convenient, and this library should do better, although I'm not entirely certain how it should be modified to make it a better experience. A few options that float to mind (pun intended...):
|
Ideally I think users generally would want something close to the built-in JSON package Honestly the current interface isn't very for people to work with. I'd suggest that you and your team can consider supporting the following use cases:
Right now goavro is very strict on data types and users have to traverse object tree in parallel with schema themselves before sending *goavro.Record to Encoder, especially when dealing with nested records or nested arrays, etc. Although not convenient, I would say it's still the best open source Go Avro library I could find so far. I hope eventually it can match with the json package though, which is very flexible and lenient. |
The newer version of this library properly handles this case. Please give it a try: https://github.com/karrick/goavro
} |
I attempted to encode a field with
map[string]float64
type while schema for that field is:{"type": "map", "values": "double"}
And I got the following error:
It seems that
goavro
only supportsmap[string]interface{}
, but that's not always convenient. On the contrary, if map value isfloat64
we know that all values fit schema thus there is no need to check individual map values which might be slightly more efficient.The text was updated successfully, but these errors were encountered: