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

JdbcSchema gives NullPointerException on non-standard column type

    Details

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

      Connected to: MySQL (version 5.5.43-0ubuntu0.14.04.1-log)
      Driver: MySQL-AB JDBC Driver (version mysql-connector-java-5.1.13 ( Revision: ${bzr.revision-id} ))
      MySQL sample database "sakila"

      Description

      09:06 ~$ sqlline.calcite.mysql 
      issuing: !connect jdbc:calcite:model=inline:{"version":1.0,"defaultSchema":"mysql","schemas":[{"name":"mysql","type":"jdbc","jdbcUrl":"jdbc:mysql://XXX/sakila","jdbcUser":"XXX","jdbcPassword":"XXX"}]} '' '' org.apache.calcite.jdbc.Driver
      Connecting to jdbc:calcite:model=inline:{"version":1.0,"defaultSchema":"mysql","schemas":[{"name":"mysql","type":"jdbc","jdbcUrl":"jdbc:mysql://XXX/sakila","jdbcUser":"XXX","jdbcPassword":"XXX"}]}
      Connected to: Calcite (version 1.3.0-incubating-SNAPSHOT)
      Driver: Calcite JDBC Driver (version 1.3.0-incubating-SNAPSHOT)
      Autocommit status: true
      Transaction isolation: TRANSACTION_READ_UNCOMMITTED
      sqlline version 1.0.1 by Marc Prud'hommeaux
      0: jdbc:calcite:model=inline:{"version":1.0,"> !tables
      +------------+--------------+-------------------------+---------------+----------+-----------+-------------+------------+-------------+
      | TABLE_CAT  | TABLE_SCHEM  |       TABLE_NAME        |  TABLE_TYPE   | REMARKS  | TYPE_CAT  | TYPE_SCHEM  | TYPE_NAME  | SELF_REFERE |
      +------------+--------------+-------------------------+---------------+----------+-----------+-------------+------------+-------------+
      |            | metadata     | COLUMNS                 | SYSTEM_TABLE  |          |           |             |            |             |
      |            | metadata     | TABLES                  | SYSTEM_TABLE  |          |           |             |            |             |
      |            | mysql        | actor                   | TABLE         |          |           |             |            |             |
      |            | mysql        | actor_info              | VIEW          |          |           |             |            |             |
      |            | mysql        | address                 | TABLE         |          |           |             |            |             |
      |            | mysql        | category                | TABLE         |          |           |             |            |             |
      |            | mysql        | city                    | TABLE         |          |           |             |            |             |
      |            | mysql        | country                 | TABLE         |          |           |             |            |             |
      |            | mysql        | customer                | TABLE         |          |           |             |            |             |
      |            | mysql        | customer_list           | VIEW          |          |           |             |            |             |
      |            | mysql        | film                    | TABLE         |          |           |             |            |             |
      |            | mysql        | film_actor              | TABLE         |          |           |             |            |             |
      |            | mysql        | film_category           | TABLE         |          |           |             |            |             |
      |            | mysql        | film_list               | VIEW          |          |           |             |            |             |
      |            | mysql        | film_text               | TABLE         |          |           |             |            |             |
      |            | mysql        | inventory               | TABLE         |          |           |             |            |             |
      |            | mysql        | language                | TABLE         |          |           |             |            |             |
      |            | mysql        | payment                 | TABLE         |          |           |             |            |             |
      |            | mysql        | rental                  | TABLE         |          |           |             |            |             |
      |            | mysql        | sales_by_film_category  | VIEW          |          |           |             |            |             |
      |            | mysql        | sales_by_store          | VIEW          |          |           |             |            |             |
      |            | mysql        | staff                   | TABLE         |          |           |             |            |             |
      |            | mysql        | staff_list              | VIEW          |          |           |             |            |             |
      |            | mysql        | store                   | TABLE         |          |           |             |            |             |
      +------------+--------------+-------------------------+---------------+----------+-----------+-------------+------------+-------------+
      0: jdbc:calcite:model=inline:{"version":1.0,"> !columns country
      +------------+--------------+-------------+--------------+------------+---------------------------------------------------------------+
      | TABLE_CAT  | TABLE_SCHEM  | TABLE_NAME  | COLUMN_NAME  | DATA_TYPE  |                                      TYPE_NAME                |
      +------------+--------------+-------------+--------------+------------+---------------------------------------------------------------+
      |            | mysql        | country     | country_id   | 5          | SMALLINT NOT NULL                                             |
      |            | mysql        | country     | country      | 12         | VARCHAR(50) CHARACTER SET "ISO-8859-1" COLLATE "ISO-8859-1$en |
      |            | mysql        | country     | last_update  | 93         | TIMESTAMP(0) NOT NULL                                         |
      +------------+--------------+-------------+--------------+------------+---------------------------------------------------------------+
      0: jdbc:calcite:model=inline:{"version":1.0,"> !columns film   
      Error: exception while executing query: null (state=,code=0)
      java.sql.SQLException: exception while executing query: null
      	at org.apache.calcite.avatica.Helper.createException(Helper.java:41)
      	at org.apache.calcite.avatica.AvaticaConnection.executeQueryInternal(AvaticaConnection.java:432)
      	at org.apache.calcite.avatica.AvaticaConnection.createResultSet(AvaticaConnection.java:485)
      	at org.apache.calcite.avatica.AvaticaDatabaseMetaData.getColumns(AvaticaDatabaseMetaData.java:621)
      	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:497)
      	at sqlline.SqlLine$Reflector.invoke(Unknown Source)
      	at sqlline.SqlLine$Commands.metadata(Unknown Source)
      	at sqlline.SqlLine$Commands.columns(Unknown Source)
      	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:497)
      	at sqlline.SqlLine$ReflectiveCommandHandler.execute(Unknown Source)
      	at sqlline.SqlLine.dispatch(Unknown Source)
      	at sqlline.SqlLine.begin(Unknown Source)
      	at sqlline.SqlLine.mainWithInputRedirection(Unknown Source)
      	at sqlline.SqlLine.main(Unknown Source)
      Caused by: java.lang.NullPointerException
      	at org.apache.calcite.adapter.jdbc.JdbcSchema.sqlType(JdbcSchema.java:291)
      	at org.apache.calcite.adapter.jdbc.JdbcSchema.getRelDataType(JdbcSchema.java:280)
      	at org.apache.calcite.adapter.jdbc.JdbcSchema.getRelDataType(JdbcSchema.java:245)
      	at org.apache.calcite.adapter.jdbc.JdbcTable.getRowType(JdbcTable.java:98)
      	at org.apache.calcite.jdbc.CalciteMetaImpl.columns(CalciteMetaImpl.java:474)
      	at org.apache.calcite.jdbc.CalciteMetaImpl$6.apply(CalciteMetaImpl.java:323)
      	at org.apache.calcite.jdbc.CalciteMetaImpl$6.apply(CalciteMetaImpl.java:321)
      	at org.apache.calcite.linq4j.EnumerableDefaults$8$1.moveNext(EnumerableDefaults.java:1680)
      	at org.apache.calcite.linq4j.EnumerableDefaults$17$1.moveNext(EnumerableDefaults.java:2337)
      	at org.apache.calcite.linq4j.Linq4j$EnumeratorIterator.<init>(Linq4j.java:677)
      	at org.apache.calcite.linq4j.Linq4j.enumeratorIterator(Linq4j.java:103)
      	at org.apache.calcite.linq4j.AbstractEnumerable.iterator(AbstractEnumerable.java:33)
      	at org.apache.calcite.linq4j.Linq4j$IterableEnumerable.iterator(Linq4j.java:551)
      	at org.apache.calcite.avatica.MetaImpl.createCursor(MetaImpl.java:93)
      	at org.apache.calcite.avatica.AvaticaResultSet.execute(AvaticaResultSet.java:187)
      	at org.apache.calcite.jdbc.CalciteResultSet.execute(CalciteResultSet.java:63)
      	at org.apache.calcite.jdbc.CalciteResultSet.execute(CalciteResultSet.java:42)
      	at org.apache.calcite.avatica.AvaticaConnection.executeQueryInternal(AvaticaConnection.java:430)
      	... 18 more
      

        Attachments

          Activity

            People

            • Assignee:
              julianhyde Julian Hyde
              Reporter:
              mprudhom Marc Prud'hommeaux
            • Votes:
              0 Vote for this issue
              Watchers:
              3 Start watching this issue

              Dates

              • Created:
                Updated:
                Resolved: