You are viewing a plain text version of this content. The canonical link for it is here.
Posted to issues@calcite.apache.org by "Kang Wang (JIRA)" <ji...@apache.org> on 2017/07/01 14:37:00 UTC
[jira] [Commented] (CALCITE-1866) dateTime FLOOR to HOUR cause
MySQL connector throw SQLException
[ https://issues.apache.org/jira/browse/CALCITE-1866?page=com.atlassian.jira.plugin.system.issuetabpanels:comment-tabpanel&focusedCommentId=16071269#comment-16071269 ]
Kang Wang commented on CALCITE-1866:
------------------------------------
I tried to use [MariaDB4j |https://github.com/vorburger/MariaDB4j] with JUnit.
We start a temp db server with MariaDB4j, then we can test MySQL dialect SQLs.
But I am not sure if this is a good solution for Calcite, How to test sql dialect of some other DB?
> dateTime FLOOR to HOUR cause MySQL connector throw SQLException
> ---------------------------------------------------------------
>
> Key: CALCITE-1866
> URL: https://issues.apache.org/jira/browse/CALCITE-1866
> Project: Calcite
> Issue Type: Bug
> Components: core
> Affects Versions: 1.14.0
> Environment: MySQL 5.6.34
> mysql-connector-java.jar:5.1.39
> Calcite 1.14.0-SNAPSHOT
> Reporter: Kang Wang
> Assignee: Julian Hyde
> Priority: Minor
> Labels: easyfix
> Fix For: 1.14.0
>
> Original Estimate: 1h
> Remaining Estimate: 1h
>
> I execute the sql "select FLOOR(trade_time TO HOUR) ..."
> then I get the ResultSet, if time hour is less than 10, I get the following exception:
> ------
> java.lang.RuntimeException: java.sql.SQLException: Bad format for Timestamp '2017-06-30 7:00:00' in column 1.
> at Baz$1$1.apply(Unknown Source)
> at org.apache.calcite.runtime.ResultSetEnumerable$ResultSetEnumerator.current(ResultSetEnumerable.java:187)
> at org.apache.calcite.linq4j.Linq4j$EnumeratorIterator.next(Linq4j.java:672)
> at org.apache.calcite.avatica.util.IteratorCursor.next(IteratorCursor.java:46)
> at org.apache.calcite.avatica.AvaticaResultSet.next(AvaticaResultSet.java:239)
> at TestCalcite.test028_jdbc(TestCalcite.java:75)
> at sun.reflect.NativeMethodAccessorImpl.invoke0(Native Method)
> at sun.reflect.NativeMethodAccessorImpl.invoke(NativeMethodAccessorImpl.java:57)
> at sun.reflect.DelegatingMethodAccessorImpl.invoke(DelegatingMethodAccessorImpl.java:43)
> at java.lang.reflect.Method.invoke(Method.java:606)
> at org.junit.runners.model.FrameworkMethod$1.runReflectiveCall(FrameworkMethod.java:50)
> at org.junit.internal.runners.model.ReflectiveCallable.run(ReflectiveCallable.java:12)
> at org.junit.runners.model.FrameworkMethod.invokeExplosively(FrameworkMethod.java:47)
> at org.junit.internal.runners.statements.InvokeMethod.evaluate(InvokeMethod.java:17)
> at org.junit.runners.ParentRunner.runLeaf(ParentRunner.java:325)
> at org.junit.runners.BlockJUnit4ClassRunner.runChild(BlockJUnit4ClassRunner.java:78)
> at org.junit.runners.BlockJUnit4ClassRunner.runChild(BlockJUnit4ClassRunner.java:57)
> at org.junit.runners.ParentRunner$3.run(ParentRunner.java:290)
> at org.junit.runners.ParentRunner$1.schedule(ParentRunner.java:71)
> at org.junit.runners.ParentRunner.runChildren(ParentRunner.java:288)
> at org.junit.runners.ParentRunner.access$000(ParentRunner.java:58)
> at org.junit.runners.ParentRunner$2.evaluate(ParentRunner.java:268)
> at org.junit.runners.ParentRunner.run(ParentRunner.java:363)
> at org.junit.runners.Suite.runChild(Suite.java:128)
> at org.junit.runners.Suite.runChild(Suite.java:27)
> at org.junit.runners.ParentRunner$3.run(ParentRunner.java:290)
> at org.junit.runners.ParentRunner$1.schedule(ParentRunner.java:71)
> at org.junit.runners.ParentRunner.runChildren(ParentRunner.java:288)
> at org.junit.runners.ParentRunner.access$000(ParentRunner.java:58)
> at org.junit.runners.ParentRunner$2.evaluate(ParentRunner.java:268)
> at org.junit.runners.ParentRunner.run(ParentRunner.java:363)
> at org.junit.runner.JUnitCore.run(JUnitCore.java:137)
> at com.intellij.junit4.JUnit4IdeaTestRunner.startRunnerWithArgs(JUnit4IdeaTestRunner.java:68)
> at com.intellij.rt.execution.junit.IdeaTestRunner$Repeater.startRunnerWithArgs(IdeaTestRunner.java:51)
> at com.intellij.rt.execution.junit.JUnitStarter.prepareStreamsAndStart(JUnitStarter.java:242)
> at com.intellij.rt.execution.junit.JUnitStarter.main(JUnitStarter.java:70)
> Caused by: java.sql.SQLException: Bad format for Timestamp '2017-06-30 7:00:00' in column 1.
> at com.mysql.jdbc.ResultSetRow.getTimestampFast(ResultSetRow.java:1157)
> at com.mysql.jdbc.ByteArrayRow.getTimestampFast(ByteArrayRow.java:130)
> at com.mysql.jdbc.ResultSetImpl.getTimestampInternal(ResultSetImpl.java:5946)
> at com.mysql.jdbc.ResultSetImpl.getTimestamp(ResultSetImpl.java:5616)
> at org.apache.commons.dbcp.DelegatingResultSet.getTimestamp(DelegatingResultSet.java:250)
> at org.apache.commons.dbcp.DelegatingResultSet.getTimestamp(DelegatingResultSet.java:250)
> ... 36 more
--
This message was sent by Atlassian JIRA
(v6.4.14#64029)