SNOW-1416051: JDBC ResultSet#getObject() throws an exception when deals with ARRAY column
Closed this issue · 5 comments
-
What version of JDBC driver are you using?
3.16.0 -
What operating system and processor architecture are you using?
MacOS -
What version of Java are you using?
17 -
What did you do?
create or replace table test(ID NUMBER(38,0), A_ARRAY ARRAY);
insert into test (id, a_array) select 1, ARRAY_CONSTRUCT(1,2,3)
select * from test where id=1
Process the JDBC ResultSet, including operation rs.getObject(index)
java.sql.SQLException: net.snowflake.client.core.SFException: Feature unsupported: data type: 2003., sql state = 0A000
at net.snowflake.client.jdbc.SnowflakeUtil.mapSFExceptionToSQLException(SnowflakeUtil.java:851)
at net.snowflake.client.jdbc.SnowflakeResultSetV1.getObject(SnowflakeResultSetV1.java:269)
at com.zaxxer.hikari.pool.HikariProxyResultSet.getObject(HikariProxyResultSet.java)
The original exception:
e = {SFException@5370} "net.snowflake.client.core.SFException: Feature unsupported: data type: 2003., sql state = 0A000"
cause = null
queryId = null
sqlState = "0A000"
vendorCode = 200035
params = {Object[1]@5375}
backtrace = {Object[6]@5376}
detailMessage = "Feature unsupported: data type: 2003."
Throwable.cause = {SFException@5370} "net.snowflake.client.core.SFException: Feature unsupported: data type: 2003., sql state = 0A000"
stackTrace = {StackTraceElement[77]@5382}
0 = {StackTraceElement@5384} "net.snowflake.client.core.SFJsonResultSet.getObject(SFJsonResultSet.java:96)"
1 = {StackTraceElement@5385} "net.snowflake.client.jdbc.SnowflakeResultSetV1.lambda$getObject$0(SnowflakeResultSetV1.java:269)"
2 = {StackTraceElement@5386} "net.snowflake.client.jdbc.SnowflakeUtil.mapSFExceptionToSQLException(SnowflakeUtil.java:849)"
3 = {StackTraceElement@5387} "net.snowflake.client.jdbc.SnowflakeResultSetV1.getObject(SnowflakeResultSetV1.java:269)"
4 = {StackTraceElement@5388} "com.zaxxer.hikari.pool.HikariProxyResultSet.getObject(HikariProxyResultSet.java)"
Before I used version 3.14.5 and it works fine.
The last not affected version is net.snowflake:snowflake-jdbc:3.15.0
Hi @krocodl,
I'm planning to take a closer look at this soon. I just find it strange that this was even working in the past. If you take a look here, this is where the mapping of data types takes place, and that's based on the metadata for the ResultSet. For an Array column that would be data type 2003 (Array). That wouldn't match any of the cases defined in that switch clause, but support for Array was instead added later on as you can see here.
I think one of the points of interest is in this line here.
Out of curiosity, what do you get when you call rs.getArray(index)
as opposed to rs.getObject(index)
?
PR #1761 should address this issue.
Hi @sfc-gh-wfateem ,
I saw in comment the next release is planned towards the end of May.
Would you include the fix for this issue please?
fix released with May 2024 release cycle, version 3.16.1