-
Notifications
You must be signed in to change notification settings - Fork 99
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
go/adbc/driver/snowflake: improved support for decimal128 types #1242
Comments
@zeroshade would these be primarily upstream issues? |
In at least one case, the column is typed as NUMBER(18, 2) and the array returned from Snowflake is typed as INT64. Obviously, INT64 values aren't guaranteed to fit into a NUMBER(18, 2) so the conversion code fails early. But it happens that all the values returned from Snowflake in that array do actually fit. |
In the case of hitting https://github.com/apache/arrow/blob/c49e24273160ac1ce195f02dbd14acd7d0f6945e/go/arrow/compute/internal/kernels/helpers.go#L592 it should only hit that if we're actually hitting the case where the value itself falls outside the range (since it should only error by actually checking that the value didn't fit), but for the early failure due to the scale and precision I guess we can add an option upstream to allow a consumer to request it to bypass that validation and let it just assume that everything will fit? I'm not sure how I feel about that and I wish that snowflake would just return the correct type in the first place, but I doubt we'd be able to convince them to change how they return the data.... |
Right. I tried adding the logic below to check whether
|
There's a fair amount of logic in https://github.com/snowflakedb/gosnowflake/blob/master/converter.go which simply isn't reflected in the ADBC driver. Specifically, Snowflake will use lower-precision integer types to return lower-precision decimal values e.g. a decimal(9, 2) could be returned as an Arrow int32 and would need to be widened and not just converted as-is. This affects both the high-precision and low-precision code paths. I can take a look at addressing this, but it will be the first time I've written Go ;). |
I'm currently travelling for a conference and unable to dedicate time to attempting to fix this directly myself. But if you want to take a stab at addressing it I'll happily review the code next week! |
I've been looking at this intermittently over the weekend and trying to pick up some Go by looking at a simpler issue first. I know what needs to be done mechanically, but I'm still trying to figure out how the compute kernels work and whether I can pass a custom function instead of relying on a predefined kernel as I think that the functionality this needs is a bit too specialized to justify putting into Arrow itself (and don't want to wait for a new Arrow release). |
In the Arrow Documentation https://pkg.go.dev/github.com/apache/arrow/go/[email protected]/arrow/compute#example-package-CustomFunction provides an example on constructing, registering, and calling a custom function through the compute package. That should help, feel free to reach out to me if you need any more assistance. |
…MBER columns (apache#1267) Fixes apache#1242.
We are still having issues with decimals even with high precision enabled. Consider the following scenarios:
When this table is queried, the error from https://github.com/apache/arrow/blob/2628d495ca99a892dca50019f4e72f087dc5aac7/go/arrow/compute/internal/kernels/numeric_cast.go#L230 is hit, because COL18 has a precision+scale value of less than 19 (per https://github.com/apache/arrow/blob/c49e24273160ac1ce195f02dbd14acd7d0f6945e/go/arrow/compute/internal/kernels/helpers.go#L701).
The other scenario is:
When this table is queried, https://github.com/apache/arrow/blob/c49e24273160ac1ce195f02dbd14acd7d0f6945e/go/arrow/compute/internal/kernels/helpers.go#L592 is hit and cannot return values.
The text was updated successfully, but these errors were encountered: