Uploaded image for project: 'Calcite'
  1. Calcite
  2. CALCITE-418 Finish implementation of Interpreter
  3. CALCITE-458

ArrayIndexOutOfBoundsException when using just a single column in interpreter

    XMLWordPrintableJSON

Details

    • Sub-task
    • Status: Closed
    • Major
    • Resolution: Fixed
    • 0.9.1-incubating
    • 1.0.0-incubating
    • None
    • None

    Description

      I've tried to alter where i=4 to where k=4 in ScannableTableTest.testPFTableRefusesFilter and it did fail.

        @Test public void testPFTableRefusesFilterSingleColumn() throws Exception {
          Connection connection =
              DriverManager.getConnection("jdbc:calcite:");
          OptiqConnection optiqConnection =
              connection.unwrap(OptiqConnection.class);
          SchemaPlus rootSchema = optiqConnection.getRootSchema();
          SchemaPlus schema = rootSchema.add("s", new AbstractSchema());
          final StringBuilder buf = new StringBuilder();
          schema.add("beatles2", new BeatlesProjectableFilterableTable(buf, false));
      
          // Now with an "uncooperative" filterable table that refuses to accept
          // filters.
          final Statement statement = connection.createStatement();
          ResultSet resultSet = statement.executeQuery(
              "select \"k\" from \"s\".\"beatles2\" where \"k\" = 4");
          // Not sure what the result should be
        }
      
      java.sql.SQLException: exception while executing query: 2
      	at net.hydromatic.avatica.Helper.createException(Helper.java:39)
      	at net.hydromatic.avatica.AvaticaConnection.executeQueryInternal(AvaticaConnection.java:406)
      	at net.hydromatic.avatica.AvaticaStatement.executeQueryInternal(AvaticaStatement.java:350)
      	at net.hydromatic.avatica.AvaticaStatement.executeQuery(AvaticaStatement.java:77)
      	at net.hydromatic.optiq.test.ScannableTableTest.testPFTableRefusesFilter(ScannableTableTest.java:210)
      	at sun.reflect.NativeMethodAccessorImpl.invoke0(Native Method)
      	at sun.reflect.NativeMethodAccessorImpl.invoke(NativeMethodAccessorImpl.java:62)
      	at sun.reflect.DelegatingMethodAccessorImpl.invoke(DelegatingMethodAccessorImpl.java:43)
      	at org.junit.runners.model.FrameworkMethod$1.runReflectiveCall(FrameworkMethod.java:47)
      	at org.junit.internal.runners.model.ReflectiveCallable.run(ReflectiveCallable.java:12)
      	at org.junit.runners.model.FrameworkMethod.invokeExplosively(FrameworkMethod.java:44)
      	at org.junit.internal.runners.statements.InvokeMethod.evaluate(InvokeMethod.java:17)
      	at org.junit.runners.ParentRunner.runLeaf(ParentRunner.java:271)
      	at org.junit.runners.BlockJUnit4ClassRunner.runChild(BlockJUnit4ClassRunner.java:70)
      	at org.junit.runners.BlockJUnit4ClassRunner.runChild(BlockJUnit4ClassRunner.java:50)
      	at org.junit.runners.ParentRunner$3.run(ParentRunner.java:238)
      	at org.junit.runners.ParentRunner$1.schedule(ParentRunner.java:63)
      	at org.junit.runners.ParentRunner.runChildren(ParentRunner.java:236)
      	at org.junit.runners.ParentRunner.access$000(ParentRunner.java:53)
      	at org.junit.runners.ParentRunner$2.evaluate(ParentRunner.java:229)
      	at org.junit.runners.ParentRunner.run(ParentRunner.java:309)
      	at org.junit.runner.JUnitCore.run(JUnitCore.java:160)
      	at com.intellij.junit4.JUnit4IdeaTestRunner.startRunnerWithArgs(JUnit4IdeaTestRunner.java:74)
      	at com.intellij.rt.execution.junit.JUnitStarter.prepareStreamsAndStart(JUnitStarter.java:211)
      	at com.intellij.rt.execution.junit.JUnitStarter.main(JUnitStarter.java:67)
      	at sun.reflect.NativeMethodAccessorImpl.invoke0(Native Method)
      	at sun.reflect.NativeMethodAccessorImpl.invoke(NativeMethodAccessorImpl.java:62)
      	at com.intellij.rt.execution.application.AppMain.main(AppMain.java:134)
      Caused by: java.lang.ArrayIndexOutOfBoundsException: 2
      	at net.hydromatic.optiq.impl.interpreter.Interpreter$3.execute(Interpreter.java:187)
      	at net.hydromatic.optiq.impl.interpreter.Interpreter$2$1.get(Interpreter.java:171)
      	at net.hydromatic.optiq.impl.interpreter.Interpreter$2.execute(Interpreter.java:124)
      	at net.hydromatic.optiq.impl.interpreter.FilterNode.run(FilterNode.java:41)
      	at net.hydromatic.optiq.impl.interpreter.Interpreter.start(Interpreter.java:91)
      	at net.hydromatic.optiq.impl.interpreter.Interpreter.enumerator(Interpreter.java:58)
      	at net.hydromatic.linq4j.EnumerableDefaults$6$1.<init>(EnumerableDefaults.java:1382)
      	at net.hydromatic.linq4j.EnumerableDefaults$6.enumerator(EnumerableDefaults.java:1381)
      	at net.hydromatic.optiq.jdbc.OptiqPrepare$PrepareResult.enumerator(OptiqPrepare.java:287)
      	at net.hydromatic.optiq.jdbc.OptiqPrepare$PrepareResult.createCursor(OptiqPrepare.java:251)
      	at net.hydromatic.optiq.jdbc.MetaImpl.createCursor(MetaImpl.java:616)
      	at net.hydromatic.avatica.AvaticaResultSet.execute(AvaticaResultSet.java:161)
      	at net.hydromatic.optiq.jdbc.OptiqResultSet.execute(OptiqResultSet.java:58)
      	at net.hydromatic.optiq.jdbc.OptiqResultSet.execute(OptiqResultSet.java:35)
      	at net.hydromatic.avatica.AvaticaConnection.executeQueryInternal(AvaticaConnection.java:404)
      	... 29 more

      Attachments

        Issue Links

          Activity

            People

              julianhyde Julian Hyde
              vladimirsitnikov Vladimir Sitnikov
              Votes:
              0 Vote for this issue
              Watchers:
              2 Start watching this issue

              Dates

                Created:
                Updated:
                Resolved: