-
Notifications
You must be signed in to change notification settings - Fork 221
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
Add support for custom logical type conversions to TextualFromNative
#253
Comments
This and the preceding issue #252 will require some more thinking over here. It sounds like its functionally beneficial in that it helps preserve the scale and precision information from the incoming data. Is this upstream java change required by the specs and implemented in the apache avro java library or is it an enhancement created by the Benthos project? |
I don't know if / which spec document covers it, but the Java AVRO implementation exposes Unfortunately, right now, I think the only way to enable this specific conversion is to write my own implementation of |
@mihaitodor i'd be happy to see your contribution to solve these two issues, if you still have the enthusiasm to get that going! Thanks |
Cool! Do you mean this one and #252? Happy to put some time into it. For this one, I think adding some extra API function(s) might suffice, but for #252 I think the best thing to do is a breaking change along with a major version bump, if you agree that the current behaviour isn't what the spec demands. |
Yes I was thinking of #252. They seem related and if you know the subject it would be great if you would do both of them. I do think the version bump on the other issue (#252) is appropriate. I think it would be best for me to cut a new version with the recent commits, and then a subsequent version with the bump to pull in this breaking change from #252. So I guess the priority is this issue here #253 and then a version release, and then #252 and version bump. |
Hi @mihaitodor, I'm not clear from the comments if this is waiting on me or not. Its been 5 months. It looks like the most recent release is after this, so I must have done the "new version with the recent commits". Is there any interest in getting these two tickets going? |
Hey @xmcqueen, thanks for following up and reminding me to post an update! I started digging into this one, but it ended up a bit more involved than I expected and I had to put it on pause... #252 should be a small code change + test updates, assuming you folks are still fine with a breaking change and a major version bump. After that's done, I guess this one (#253) can be implemented separately by exposing some extra API method without breaking any existing API. WDYT? Long term, I'd like to see both of these issues addressed, but do let me know if yourself or anyone else is interested in tackling them in the next few months. Otherwise, I'll get to them, since some new users are going to have issues with adopting this sooner or later... |
Great, let's see if we get any other opinions. A breaking change sounds scary to me, though I know we will clearly indicate it with a major version bump. I'll go post in the other ticket (#252) |
The good news is that people will need to import |
While trying to replicate the Snowflake Kafka Connector functionality using Benthos, I noticed that in Java they are adding
genericData.addLogicalTypeConversion(new Conversions.DecimalConversion())
in addition to the implicit conversions when converting AVRO to JSON. I believe this is done such that abytes
type with logical typedecimal
can be transformed in a way which preserves some information about the scale and precision. For example, the following Java code:outputs
{"pos_0_33333333": 0.33}
, while this Go code:outputs
{"pos_0_33333333":{"bytes.decimal":"!"}}
. While this might be more intuitive, a consumer loses any information on precision and scale. It also exhibits the issue raised in #252 regardingbytes.decimal
vsbytes
.Note: There are other converters which can be added in Java, but this Snowflake connector only uses this
DecimalConversion
.Would there be any interest to support this functionality? I'm happy to put in the work to write the new code with unit tests and whatever is needed for it, but I'd like to know what your thoughts are on this first and maybe how you'd expect the API to be extended for this purpose. Maybe adding an extra method on the codec, like
AddLogicalTypeConversion
?The text was updated successfully, but these errors were encountered: