Skip to content
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-1416051: JDBC ResultSet#getObject() throws an exception when deals with ARRAY column #1753

Closed
krocodl opened this issue May 14, 2024 · 5 comments
Assignees
Labels
bug status-fixed_awaiting_release The issue has been fixed, its PR merged, and now awaiting the next release cycle of the connector. status-triage_done Initial triage done, will be further handled by the driver team

Comments

@krocodl
Copy link

krocodl commented May 14, 2024

  1. What version of JDBC driver are you using?
    3.16.0

  2. What operating system and processor architecture are you using?
    MacOS

  3. What version of Java are you using?
    17

  4. 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)"

@krocodl krocodl added the bug label May 14, 2024
@github-actions github-actions bot changed the title JDBC ResultSet#getObject() throws an exception when deals with ARRAY column SNOW-1416051: JDBC ResultSet#getObject() throws an exception when deals with ARRAY column May 14, 2024
@krocodl
Copy link
Author

krocodl commented May 14, 2024

Before I used version 3.14.5 and it works fine.
The last not affected version is net.snowflake:snowflake-jdbc:3.15.0

@sfc-gh-wfateem sfc-gh-wfateem self-assigned this May 15, 2024
@sfc-gh-wfateem sfc-gh-wfateem added the status-triage Issue is under initial triage label May 15, 2024
@sfc-gh-wfateem
Copy link
Collaborator

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)?

@sfc-gh-wfateem sfc-gh-wfateem added status-triage_done Initial triage done, will be further handled by the driver team and removed status-triage Issue is under initial triage labels May 17, 2024
@sfc-gh-wfateem
Copy link
Collaborator

PR #1761 should address this issue.

@sfc-gh-wfateem sfc-gh-wfateem added the status-fixed_awaiting_release The issue has been fixed, its PR merged, and now awaiting the next release cycle of the connector. label May 22, 2024
@tczhao
Copy link

tczhao commented May 27, 2024

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?

@sfc-gh-dszmolka
Copy link
Contributor

fix released with May 2024 release cycle, version 3.16.1

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
bug status-fixed_awaiting_release The issue has been fixed, its PR merged, and now awaiting the next release cycle of the connector. status-triage_done Initial triage done, will be further handled by the driver team
Projects
None yet
Development

No branches or pull requests

4 participants