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

Adding a table to the root schema causes breakage in OptiqPrepareImpl

    Details

    • Type: Bug
    • Status: Closed
    • Priority: Major
    • Resolution: Fixed
    • Affects Version/s: None
    • Fix Version/s: None
    • Component/s: None
    • Labels:

      Description

      I tried an even simpler version of the optiq-csv example. I ended up not implementing my own Schema, just a table instead. When I add the table to the root schema and no longer prefix it with a schema name the SQL parsing breaks and I get a stack trace like below.

      My table is very simple, column A is a string and column B is an integer.
      Query:

      ```
      select A, SUM(B) from SAMPLE group by A
      ```

      I'll try to attach the source for my test case.

      ```
      java.lang.IndexOutOfBoundsException: Index: 2, Size: 2
      at java.util.ArrayList.rangeCheck(ArrayList.java:604)
      at java.util.ArrayList.get(ArrayList.java:382)
      at net.hydromatic.optiq.prepare.OptiqPrepareImpl.getColumnMetaDataList(OptiqPrepareImpl.java:376)
      at net.hydromatic.optiq.prepare.OptiqPrepareImpl.prepare2_(OptiqPrepareImpl.java:330)
      at net.hydromatic.optiq.prepare.OptiqPrepareImpl.prepare_(OptiqPrepareImpl.java:219)
      at net.hydromatic.optiq.prepare.OptiqPrepareImpl.prepareSql(OptiqPrepareImpl.java:189)
      at net.hydromatic.optiq.jdbc.OptiqStatement.parseQuery(OptiqStatement.java:404)
      at net.hydromatic.optiq.jdbc.OptiqStatement.executeQuery(OptiqStatement.java:80)
      at net.hydromatic.optiq.test.TableInRootSchemaTest.testAddingTableInRootSchema(TableInRootSchemaTest.java:57)
      ...
      ```

      ---------------- Imported from GitHub ----------------
      Url: https://github.com/julianhyde/optiq/issues/85
      Created by: knut-forkalsrud
      Labels:
      Created at: Thu Nov 21 09:08:46 CET 2013
      State: closed

        Activity

        Hide
        github-import GitHub Import added a comment -

        [Date: Thu Nov 21 09:39:15 CET 2013, Author: knut-forkalsrud]

        The case in point is in fact in the otiq-csv repository rather than this repository (optiq).
        I committed the test case in my forked version: https://github.com/knut-forkalsrud/optiq-csv/commit/c9c8ce67be49e15a1b5b41a1411df408b1083f4d

        The code is modeled after the first code sample in the readme file for optiq.

        To summarize, if I add the table directly in the root schema it fails. If i create a dummy schema and prefix the table name with the schema name it works.

        ```
        MapSchema schema = MapSchema.create(optiqConnection.getRootSchema(), "BAZ");
        ```

        Show
        github-import GitHub Import added a comment - [Date: Thu Nov 21 09:39:15 CET 2013, Author: knut-forkalsrud ] The case in point is in fact in the otiq-csv repository rather than this repository (optiq). I committed the test case in my forked version: https://github.com/knut-forkalsrud/optiq-csv/commit/c9c8ce67be49e15a1b5b41a1411df408b1083f4d The code is modeled after the first code sample in the readme file for optiq. To summarize, if I add the table directly in the root schema it fails. If i create a dummy schema and prefix the table name with the schema name it works. ``` MapSchema schema = MapSchema.create(optiqConnection.getRootSchema(), "BAZ"); ```

          People

          • Assignee:
            Unassigned
            Reporter:
            github-import GitHub Import
          • Votes:
            0 Vote for this issue
            Watchers:
            0 Start watching this issue

            Dates

            • Created:
              Updated:
              Resolved:

              Development