Ayelet Morris created CALCITE-2795:
--------------------------------------
Summary: New Avatica version doesn't support "list" type in query
Key: CALCITE-2795
URL: https://issues.apache.org/jira/browse/CALCITE-2795
Project: Calcite
Issue Type: Bug
Components: avatica
Affects Versions: 1.18.0, 1.17.0
Reporter: Ayelet Morris
I created a simple POJO that has an id and a list and created a simple select
query from it, I received the following exception, it seems that in previous
versions (we used avatica 1.9 with calcite 1.11 before this upgrade) the list
type was detected as "OTHER" type and the query worked, now it is marked as a
Scalar but somehow finds its way to the "array" type of the types switch, then
when trying to parse the column TYPE it fails (it doesn't even try to fetch the
list itself)
java.lang.RuntimeException: exception while executing [SELECT * FROM
TypeWithList]
at
org.apache.calcite.test.CalciteAssert$AssertQuery.returns(CalciteAssert.java:1458)
at
org.apache.calcite.test.CalciteAssert$AssertQuery.returns(CalciteAssert.java:1426)
at
org.apache.calcite.test.CalciteAssert$AssertQuery.returnsUnordered(CalciteAssert.java:1464)
at com.gigaspaces.jdbc.TypesTest.testSelectWithList(TypesTest.java:44)
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.internal.runners.statements.RunBefores.evaluate(RunBefores.java:26)
at
org.springframework.test.context.junit4.statements.RunBeforeTestMethodCallbacks.evaluate(RunBeforeTestMethodCallbacks.java:75)
at org.junit.internal.runners.statements.RunAfters.evaluate(RunAfters.java:27)
at
org.springframework.test.context.junit4.statements.RunAfterTestMethodCallbacks.evaluate(RunAfterTestMethodCallbacks.java:86)
at
org.springframework.test.context.junit4.statements.SpringRepeat.evaluate(SpringRepeat.java:84)
at org.junit.runners.ParentRunner.runLeaf(ParentRunner.java:325)
at
org.springframework.test.context.junit4.SpringJUnit4ClassRunner.runChild(SpringJUnit4ClassRunner.java:252)
at
org.springframework.test.context.junit4.SpringJUnit4ClassRunner.runChild(SpringJUnit4ClassRunner.java:94)
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.springframework.test.context.junit4.statements.RunBeforeTestClassCallbacks.evaluate(RunBeforeTestClassCallbacks.java:61)
at
org.springframework.test.context.junit4.statements.RunAfterTestClassCallbacks.evaluate(RunAfterTestClassCallbacks.java:70)
at org.junit.runners.ParentRunner.run(ParentRunner.java:363)
at
org.springframework.test.context.junit4.SpringJUnit4ClassRunner.run(SpringJUnit4ClassRunner.java:191)
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:47)
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.lang.RuntimeException: With materializationsEnabled=false,
limit=0
at org.apache.calcite.test.CalciteAssert.assertQuery(CalciteAssert.java:573)
at
org.apache.calcite.test.CalciteAssert$AssertQuery.returns(CalciteAssert.java:1450)
... 33 more
Caused by: java.sql.SQLException: Error while executing SQL "SELECT * FROM
TypeWithList": org.apache.calcite.avatica.ColumnMetaData$ScalarType cannot be
cast to org.apache.calcite.avatica.ColumnMetaData$ArrayType
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:163)
at
org.apache.calcite.avatica.AvaticaStatement.executeQuery(AvaticaStatement.java:227)
at org.apache.calcite.test.CalciteAssert.assertQuery(CalciteAssert.java:541)
... 34 more
Caused by: java.lang.ClassCastException:
org.apache.calcite.avatica.ColumnMetaData$ScalarType cannot be cast to
org.apache.calcite.avatica.ColumnMetaData$ArrayType
at
org.apache.calcite.avatica.util.AbstractCursor.createAccessor(AbstractCursor.java:190)
at
org.apache.calcite.avatica.util.AbstractCursor.createAccessor(AbstractCursor.java:84)
at
org.apache.calcite.avatica.util.AbstractCursor.createAccessors(AbstractCursor.java:74)
at
org.apache.calcite.avatica.AvaticaResultSet.execute(AvaticaResultSet.java:186)
at org.apache.calcite.jdbc.CalciteResultSet.execute(CalciteResultSet.java:64)
at org.apache.calcite.jdbc.CalciteResultSet.execute(CalciteResultSet.java:43)
at
org.apache.calcite.avatica.AvaticaConnection$1.execute(AvaticaConnection.java:667)
at
org.apache.calcite.jdbc.CalciteMetaImpl.prepareAndExecute(CalciteMetaImpl.java:566)
at
org.apache.calcite.avatica.AvaticaConnection.prepareAndExecuteInternal(AvaticaConnection.java:675)
at
org.apache.calcite.avatica.AvaticaStatement.executeInternal(AvaticaStatement.java:156)
... 36 more
--
This message was sent by Atlassian JIRA
(v7.6.3#76005)