You are viewing a plain text version of this content. The canonical link for it is here.
Posted to dev@calcite.apache.org by Muhammad Gelbana <m....@gmail.com> on 2019/06/21 19:47:19 UTC

Avatica java.sql.Date offset calculation bug

The java docs says that the calculated timezone offset needs to be *added*
[1] while avatica *subtracts* it [2].

I even saw this happening multiple times in the same class which makes me
think, is this actually a bug or not ?
I'm facing a case supporting that this is a bug and the javadocs supports
the same too.

[1]
https://docs.oracle.com/javase/8/docs/api/java/util/TimeZone.html#getOffset-long-
[2]
https://github.com/apache/calcite-avatica/blob/96507bfe737f2188c16dec9d16d5e8b502df231f/core/src/main/java/org/apache/calcite/avatica/util/AbstractCursor.java#L1047

Thanks,
Gelbana

Re: Avatica java.sql.Date offset calculation bug

Posted by Julian Hyde <jh...@gmail.com>.
We are adhering to the JDBC specification. Many people find it confusing and counterintuitive. You are not alone.

I have explained several times over the years. 

Look at the tests for that method and similar methods, and read the commits and JIRA cases that added that code. 

Julian

> On Jun 21, 2019, at 12:47, Muhammad Gelbana <m....@gmail.com> wrote:
> 
> The java docs says that the calculated timezone offset needs to be *added*
> [1] while avatica *subtracts* it [2].
> 
> I even saw this happening multiple times in the same class which makes me
> think, is this actually a bug or not ?
> I'm facing a case supporting that this is a bug and the javadocs supports
> the same too.
> 
> [1]
> https://docs.oracle.com/javase/8/docs/api/java/util/TimeZone.html#getOffset-long-
> [2]
> https://github.com/apache/calcite-avatica/blob/96507bfe737f2188c16dec9d16d5e8b502df231f/core/src/main/java/org/apache/calcite/avatica/util/AbstractCursor.java#L1047
> 
> Thanks,
> Gelbana

Re: Avatica java.sql.Date offset calculation bug

Posted by Julian Hyde <jh...@gmail.com>.
We are adhering to the JDBC specification. Many people find it confusing and counterintuitive. You are not alone.

I have explained several times over the years. 

Look at the tests for that method and similar methods, and read the commits and JIRA cases that added that code. 

Julian

> On Jun 21, 2019, at 12:47, Muhammad Gelbana <m....@gmail.com> wrote:
> 
> The java docs says that the calculated timezone offset needs to be *added*
> [1] while avatica *subtracts* it [2].
> 
> I even saw this happening multiple times in the same class which makes me
> think, is this actually a bug or not ?
> I'm facing a case supporting that this is a bug and the javadocs supports
> the same too.
> 
> [1]
> https://docs.oracle.com/javase/8/docs/api/java/util/TimeZone.html#getOffset-long-
> [2]
> https://github.com/apache/calcite-avatica/blob/96507bfe737f2188c16dec9d16d5e8b502df231f/core/src/main/java/org/apache/calcite/avatica/util/AbstractCursor.java#L1047
> 
> Thanks,
> Gelbana