[
https://issues.apache.org/jira/browse/CALCITE-1863?page=com.atlassian.jira.plugin.system.issuetabpanels:comment-tabpanel&focusedCommentId=16076871#comment-16076871
]
Damjan Jovanovic commented on CALCITE-1863:
-------------------------------------------
It looks like I found another bug trying to make a test case :(
It happens whether I test with my patch or not.
{noformat}
testColumnTypes(org.apache.calcite.test.ReflectiveSchemaTest) Time elapsed:
0.396 sec <<< ERROR!
java.lang.RuntimeException: exception while executing [select count(*) as c
from "s"."everyTypes" as "a" full outer join "s"."everyTypes" as "b" on
"a"."primitiveBoolean"="b"."primitiveBoolean" where "a"."sqlTimestamp" <>
"b"."sqlTimestamp"]
at
org.apache.calcite.test.CalciteAssert$AssertQuery.returns(CalciteAssert.java:1270)
at
org.apache.calcite.test.CalciteAssert$AssertQuery.returns(CalciteAssert.java:1249)
at
org.apache.calcite.test.CalciteAssert$AssertQuery.returns(CalciteAssert.java:1213)
at
org.apache.calcite.test.ReflectiveSchemaTest.testColumnTypes(ReflectiveSchemaTest.java:298)
at sun.reflect.NativeMethodAccessorImpl.invoke0(Native Method)
at
sun.reflect.NativeMethodAccessorImpl.invoke(NativeMethodAccessorImpl.java:62)
at
sun.reflect.DelegatingMethodAccessorImpl.invoke(DelegatingMethodAccessorImpl.java:43)
at java.lang.reflect.Method.invoke(Method.java:498)
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.apache.maven.surefire.junitcore.pc.Scheduler$1.run(Scheduler.java:393)
at
java.util.concurrent.Executors$RunnableAdapter.call(Executors.java:511)
at java.util.concurrent.FutureTask.run(FutureTask.java:266)
at
java.util.concurrent.ThreadPoolExecutor.runWorker(ThreadPoolExecutor.java:1142)
at
java.util.concurrent.ThreadPoolExecutor$Worker.run(ThreadPoolExecutor.java:617)
at java.lang.Thread.run(Thread.java:745)
Caused by: java.lang.RuntimeException: With materializationsEnabled=false,
limit=0
at
org.apache.calcite.test.CalciteAssert.assertQuery(CalciteAssert.java:549)
at
org.apache.calcite.test.CalciteAssert$AssertQuery.returns(CalciteAssert.java:1266)
... 21 more
Caused by: java.sql.SQLException: Error while executing SQL "select count(*) as
c from "s"."everyTypes" as "a" full outer join "s"."everyTypes" as "b" on
"a"."primitiveBoolean"="b"."primitiveBoolean" where "a"."sqlTimestamp" <>
"b"."sqlTimestamp"": java.sql.Timestamp cannot be cast to java.lang.Long
at org.apache.calcite.avatica.Helper.createException(Helper.java:56)
at org.apache.calcite.avatica.Helper.createException(Helper.java:41)
at
org.apache.calcite.avatica.AvaticaStatement.executeInternal(AvaticaStatement.java:156)
at
org.apache.calcite.avatica.AvaticaStatement.executeQuery(AvaticaStatement.java:218)
at
org.apache.calcite.test.CalciteAssert.assertQuery(CalciteAssert.java:517)
... 22 more
Caused by: java.lang.ClassCastException: java.sql.Timestamp cannot be cast to
java.lang.Long
at Baz$6$1.moveNext(Unknown Source)
at
org.apache.calcite.linq4j.EnumerableDefaults.aggregate(EnumerableDefaults.java:116)
at
org.apache.calcite.linq4j.DefaultEnumerable.aggregate(DefaultEnumerable.java:107)
at Baz.bind(Unknown Source)
at
org.apache.calcite.jdbc.CalcitePrepare$CalciteSignature.enumerable(CalcitePrepare.java:335)
at
org.apache.calcite.jdbc.CalciteConnectionImpl.enumerable(CalciteConnectionImpl.java:294)
at
org.apache.calcite.jdbc.CalciteMetaImpl._createIterable(CalciteMetaImpl.java:559)
at
org.apache.calcite.jdbc.CalciteMetaImpl.createIterable(CalciteMetaImpl.java:550)
at
org.apache.calcite.avatica.AvaticaResultSet.execute(AvaticaResultSet.java:204)
at
org.apache.calcite.jdbc.CalciteResultSet.execute(CalciteResultSet.java:67)
at
org.apache.calcite.jdbc.CalciteResultSet.execute(CalciteResultSet.java:44)
at
org.apache.calcite.avatica.AvaticaConnection$1.execute(AvaticaConnection.java:630)
at
org.apache.calcite.jdbc.CalciteMetaImpl.prepareAndExecute(CalciteMetaImpl.java:607)
at
org.apache.calcite.avatica.AvaticaConnection.prepareAndExecuteInternal(AvaticaConnection.java:638)
at
org.apache.calcite.avatica.AvaticaStatement.executeInternal(AvaticaStatement.java:149)
... 24 more
{noformat}
> Timestamp "<>" operator compares box references instead of values
> -----------------------------------------------------------------
>
> Key: CALCITE-1863
> URL: https://issues.apache.org/jira/browse/CALCITE-1863
> Project: Calcite
> Issue Type: Bug
> Affects Versions: 1.12.0, 1.13.0
> Reporter: Damjan Jovanovic
> Assignee: Julian Hyde
>
> In MySQL:
> USE db;
> CREATE TABLE test(id INTEGER NOT NULL PRIMARY KEY, dt datetime NOT NULL);
> INSERT INTO test values (1, '2017-06-29 09:00:00');
> Then connect to it twice, and full outer join on the primary key where the
> timestamp is different:
> {code}
> Connection connection = DriverManager.getConnection("jdbc:calcite:", info);
> CalciteConnection calciteConnection =
> connection.unwrap(CalciteConnection.class);
> SchemaPlus rootSchema = calciteConnection.getRootSchema();
> JdbcSchema a = JdbcSchema.create(calciteConnection.getRootSchema(),
> "A", aDataSource, null, "db");
> rootSchema.add("A", a);
> JdbcSchema b = JdbcSchema.create(calciteConnection.getRootSchema(),
> "B", bDataSource, null, "db");
> rootSchema.add("B", b);
> PreparedStatement st = connection.prepareStatement(
> "SELECT * FROM A.test AS a FULL OUTER JOIN B.test AS b " +
> "ON a.id=b.id " +
> "WHERE a.dt <> b.dt");
> ResultSet results = st.executeQuery();
> {code}
> results now contains that row joined to itself, since the "dt" in WHERE
> tested as not equal to itself.
--
This message was sent by Atlassian JIRA
(v6.4.14#64029)