snowflakedb/snowflake-jdbc

SNOW-1504369: Time value regression after 3.13.31

Closed this issue · 3 comments

Please answer these questions before submitting your issue.
In order to accurately debug the issue this information is required. Thanks!

  1. What version of JDBC driver are you using?
    3.13.30 vs 3.13.34 [31]

  2. What operating system and processor architecture are you using?
    Win11/Talend studio

  3. What version of Java are you using?
    11/17

  4. What did you do?

    If possible, provide a recipe for reproducing the error.
    A complete runnable program is good.

Create a table with TIME column
Insert value 00:00:44 and do the plain select via jdbc driver (ResultSet::getTime)

with 3.13.30 it's 44580 for me and starting from 3.13.31 it's -10755420

  1. What did you expect to see?
    value is the same
    What should have happened and what happened instead?
    value has changed

I did some research and it seems it's starting from #1383
Before BigIntToTimeConverter returned a UTC time value with timezone, and after it's already the timezoned value for java.sql.Time

The deactivation of useSessionTimezone flag might help but would affect other columns' values.

Hi @dmytro-sylaiev,

Thank you for opening this issue. I checked out the main branch and tried to reproduce what you're seeing with the following code:

    connection = getConnection();
    statement = connection.createStatement();
    statement.executeQuery("Alter session set JDBC_USE_SESSION_TIMEZONE=false");
    statement.executeQuery("CREATE OR REPLACE TABLE T_TIME(time_col TIME)");
    statement.executeQuery("INSERT INTO T_TIME VALUES('00:00:44')");
    ResultSet resultSet = statement.executeQuery("Select time_col from T_TIME");
    Time t = Time.valueOf("00:00:44");
    resultSet.next();
    Time result_t = resultSet.getTime(1);
    assertEquals(t, result_t);

That test passes, so I'm not observing the same issue you are.

What is the TIMEZONE parameter set to in Snowflake at your end?

show parameters like 'timezone';

Have you tested this with JDBC driver version 3.16.1?

Hey @dmytro-sylaiev,

Did you get the chance to look over my last comment?

I'm going to close this issue since there are no updates. If you still need help with this then please feel free to reopen this issue again with more information.