-
Notifications
You must be signed in to change notification settings - Fork 170
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
SNOW-165204: BigDecimal specified as java.sql.Types.BIGINT #252
Comments
It's also worth noting that all values in this particular column are at the upper or lower extremes of |
I've been encouraging my users to work around this issue by casting to a string in the SQL query and parsing back to an arbitrary precision integer number (like a Java BigInteger) downstream as needed.
But I think setting JDBC_TREAT_DECIMAL_AS_INT to false (default is true) would resolve this and get the behavior that JDBC expects. Otherwise, as you mention, @daniel-smith have you experimented with that setting? I don't know why it defaults to true, which doesn't seem like it would pass a JDBC compliance test. |
This slipped under my radar. I'll review this in the coming days. |
This isn't an issue. We had to add the parameter JDBC_TREAT_DECIMAL_AS_INT to help in these kinds of situations. The issue is that when you have a NUMBER column with 0 scale, i.e. NUMBER(38,0) you can store very large values in the column in Snowflake. The column metadata for the NUMBER column is java SQL type BIGINT, which as pointed out by @daniel-smith according to the JDBC specs, should map to a Java long. Values like 5204557519631944020283414925144879961 will obviously fail if you try to use the getLong method. There's not a whole lot we can do on the driver's side other than offer you the option to decide what column type is used in the metadata to represent a NUMBER column. By setting the parameter |
closing this issue per above comment, but please do comment if you need further assistance. |
We have a table with a column of type
NUMBER(38,0)
. When querying the table with JDBC,getColumnType
for this column from the metadata returnsjava.sql.Types.BIGINT
, which I understand is intended for 64-bit integers (i.e.long
). Going byBIGINT
and attempting to retrieve large values viagetLong
understandably results in an exception:Retrieving values for this column via
getObject
yields types ofBigDecimal
, which I understand should be represented with eitherjava.sql.Types.NUMERIC
orjava.sql.Types.DECIMAL
.The text was updated successfully, but these errors were encountered: