Uploaded image for project: 'Calcite'
  1. Calcite
  2. CALCITE-3557

ResultSet.getObject throws ClassCastException when accessing a MULTISET or ARRAY value inside a MULTISET

    XMLWordPrintableJSON

Details

    Description

      // JdbcTest
      @Test public void testNestedMultiset() {
          CalciteAssert.that()
              .query("select multiset[ARRAY[1, 2], ARRAY[3, 4]]")
              .returns("EXPR$0=[[1, 2], [3, 4]]\n");
      
          CalciteAssert.that()
              .query("select multiset[multiset[1, 2], multiset[3, 4]]")
              .returns("EXPR$0=[[1, 2], [3, 4]]\n");
        }
      

      Got

      java.lang.ClassCastException: [Ljava.lang.Object; cannot be cast to java.lang.Integer
      
      	at org.apache.calcite.avatica.util.AbstractCursor$IntAccessor.getInt(AbstractCursor.java:541)
      	at org.apache.calcite.avatica.util.AbstractCursor$ArrayAccessor.convertValue(AbstractCursor.java:1318)
      	at org.apache.calcite.avatica.util.AbstractCursor$ArrayAccessor.getObject(AbstractCursor.java:1299)
      	at org.apache.calcite.avatica.util.AbstractCursor$ArrayAccessor.getArray(AbstractCursor.java:1352)
      	at org.apache.calcite.avatica.util.AbstractCursor$ArrayAccessor.convertValue(AbstractCursor.java:1326)
      	at org.apache.calcite.avatica.util.AbstractCursor$ArrayAccessor.getObject(AbstractCursor.java:1299)
      	at org.apache.calcite.avatica.util.AbstractCursor$ArrayAccessor.getArray(AbstractCursor.java:1352)
      	at org.apache.calcite.avatica.AvaticaSite.get(AvaticaSite.java:305)
      	at org.apache.calcite.avatica.AvaticaResultSet.getObject(AvaticaResultSet.java:393)
      	at org.apache.calcite.test.CalciteAssert$ResultSetFormatter.rowToString(CalciteAssert.java:1978)
      	at org.apache.calcite.test.CalciteAssert$ResultSetFormatter.resultSet(CalciteAssert.java:1966)
      	at org.apache.calcite.test.CalciteAssert.lambda$checkResult$2(CalciteAssert.java:303)
      	at org.apache.calcite.test.CalciteAssert.assertQuery(CalciteAssert.java:544)
      	at org.apache.calcite.test.CalciteAssert$AssertQuery.lambda$returns$1(CalciteAssert.java:1514)
      	at org.apache.calcite.test.CalciteAssert$AssertQuery.withConnection(CalciteAssert.java:1446)
      	at org.apache.calcite.test.CalciteAssert$AssertQuery.returns(CalciteAssert.java:1512)
      	at org.apache.calcite.test.CalciteAssert$AssertQuery.returns(CalciteAssert.java:1495)
      	at org.apache.calcite.test.CalciteAssert$AssertQuery.returns(CalciteAssert.java:1458)
      	at org.apache.calcite.test.JdbcTest.testNestedMultiset(JdbcTest.java:2057)
      	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.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.junit.IdeaTestRunner$Repeater.startRunnerWithArgs(IdeaTestRunner.java:33)
      	at com.intellij.rt.junit.JUnitStarter.prepareStreamsAndStart(JUnitStarter.java:230)
      	at com.intellij.rt.junit.JUnitStarter.main(JUnitStarter.java:58)
      	Suppressed: org.apache.calcite.util.TestUtil$ExtraInformation: With materializationsEnabled=false, limit=0, sql=select multiset[multiset[1, 2], multiset[3, 4]]
      		at org.apache.calcite.util.TestUtil.rethrow(TestUtil.java:268)
      		at org.apache.calcite.test.CalciteAssert.assertQuery(CalciteAssert.java:560)
      		... 28 more
      

      Attachments

        1. image-2021-12-25-18-06-21-066.png
          966 kB
          Jiajun Xie
        2. image-2022-01-23-17-16-54-076.png
          994 kB
          Jiajun Xie
        3. screenshot-1.png
          756 kB
          Jiajun Xie

        Activity

          People

            jiajunbernoulli Jiajun Xie
            yanlin-Lynn Wang Yanlin
            Votes:
            0 Vote for this issue
            Watchers:
            5 Start watching this issue

            Dates

              Created:
              Updated:
              Resolved:

              Time Tracking

                Estimated:
                Original Estimate - Not Specified
                Not Specified
                Remaining:
                Remaining Estimate - 0h
                0h
                Logged:
                Time Spent - 1h
                1h