All,

I am trying to use Calcite with MySQL as a backend storage but I keep
getting exceptions when attempting to query a table. Here are the details
of my setup:

- I have checked out calcite-0.9.1-incubating
- running Ubuntu 12.04 with MySQL 5.5
- the mysql.json model I am using has been attached to this e-mail

I am able to list all tables in the MySQL instance (I've loaded up the
TPC-H tables) but when I attempt to query any individual one, I get into
trouble. Here are the steps I perform once sqlline fires up:

sqlline version 1.1.7
sqlline> !verbose
verbose: on
sqlline> !connect jdbc:calcite:model=mysql.json root rootpass
Connecting to jdbc:calcite:model=mysql.json
Connected to: Calcite (version 0.9.1-incubating)
Driver: Calcite JDBC Driver (version 0.9.1-incubating)
Autocommit status: true
Transaction isolation: TRANSACTION_REPEATABLE_READ
0: jdbc:calcite:model=mysql.json> !tables
+-----------+-------------+------------+------------+---------+----------+------------+-----------+---------------------------+----------------+
| TABLE_CAT | TABLE_SCHEM | TABLE_NAME | TABLE_TYPE | REMARKS | TYPE_CAT |
TYPE_SCHEM | TYPE_NAME | SELF_REFERENCING_COL_NAME | REF_GENERATION |
+-----------+-------------+------------+------------+---------+----------+------------+-----------+---------------------------+----------------+
| null      | metadata    | COLUMNS    | SYSTEM_TABLE | null    | null
| null       | null      | null                      | null           |
| null      | metadata    | TABLES     | SYSTEM_TABLE | null    | null
| null       | null      | null                      | null           |
| null      | tpch        | customer   | TABLE      | null    | null     |
null       | null      | null                      | null           |
| null      | tpch        | lineitem   | TABLE      | null    | null     |
null       | null      | null                      | null           |
| null      | tpch        | nation     | TABLE      | null    | null     |
null       | null      | null                      | null           |
| null      | tpch        | orders     | TABLE      | null    | null     |
null       | null      | null                      | null           |
| null      | tpch        | part       | TABLE      | null    | null     |
null       | null      | null                      | null           |
| null      | tpch        | partsupp   | TABLE      | null    | null     |
null       | null      | null                      | null           |
| null      | tpch        | region     | TABLE      | null    | null     |
null       | null      | null                      | null           |
| null      | tpch        | supplier   | TABLE      | null    | null     |
null       | null      | null                      | null           |
+-----------+-------------+------------+------------+---------+----------+------------+-----------+---------------------------+----------------+
0: jdbc:calcite:model=mysql.json> select * from nation;
Nov 13, 2014 2:57:56 PM org.eigenbase.sql.validate.SqlValidatorException
<init>
SEVERE: org.eigenbase.sql.validate.SqlValidatorException: Table 'NATION'
not found
Nov 13, 2014 2:57:56 PM org.eigenbase.util.EigenbaseException <init>
SEVERE: org.eigenbase.util.EigenbaseContextException: From line 1, column
15 to line 1, column 20: Table 'NATION' not found
Error: while executing SQL: select * from nation (state=,code=0)
java.sql.SQLException: while executing SQL: select * from nation
        at net.hydromatic.avatica.Helper.createException(Helper.java:39)
        at
net.hydromatic.avatica.AvaticaStatement.execute(AvaticaStatement.java:70)
        at sqlline.Commands.execute(Commands.java:822)
        at sqlline.Commands.sql(Commands.java:732)
        at sqlline.SqlLine.dispatch(SqlLine.java:808)
        at sqlline.SqlLine.begin(SqlLine.java:681)
        at sqlline.SqlLine.start(SqlLine.java:398)
        at sqlline.SqlLine.main(SqlLine.java:292)
Caused by: org.eigenbase.util.EigenbaseContextException: From line 1,
column 15 to line 1, column 20: Table 'NATION' not found
        at sun.reflect.NativeConstructorAccessorImpl.newInstance0(Native
Method)
        at
sun.reflect.NativeConstructorAccessorImpl.newInstance(NativeConstructorAccessorImpl.java:57)
        at
sun.reflect.DelegatingConstructorAccessorImpl.newInstance(DelegatingConstructorAccessorImpl.java:45)
        at java.lang.reflect.Constructor.newInstance(Constructor.java:526)
        at
org.eigenbase.resource.Resources$ExInstWithCause.ex(Resources.java:348)
        at org.eigenbase.sql.SqlUtil.newContextException(SqlUtil.java:671)
        at org.eigenbase.sql.SqlUtil.newContextException(SqlUtil.java:659)
        at
org.eigenbase.sql.validate.SqlValidatorImpl.newValidationError(SqlValidatorImpl.java:3551)
        at
org.eigenbase.sql.validate.IdentifierNamespace.validateImpl(IdentifierNamespace.java:76)
        at
org.eigenbase.sql.validate.AbstractNamespace.validate(AbstractNamespace.java:84)
        at
org.eigenbase.sql.validate.SqlValidatorImpl.validateNamespace(SqlValidatorImpl.java:747)
        at
org.eigenbase.sql.validate.SqlValidatorImpl.validateQuery(SqlValidatorImpl.java:736)
        at
org.eigenbase.sql.validate.SqlValidatorImpl.validateFrom(SqlValidatorImpl.java:2599)
        at
org.eigenbase.sql.validate.SqlValidatorImpl.validateFrom(SqlValidatorImpl.java:2584)
        at
org.eigenbase.sql.validate.SqlValidatorImpl.validateSelect(SqlValidatorImpl.java:2802)
        at
org.eigenbase.sql.validate.SelectNamespace.validateImpl(SelectNamespace.java:59)
        at
org.eigenbase.sql.validate.AbstractNamespace.validate(AbstractNamespace.java:84)
        at
org.eigenbase.sql.validate.SqlValidatorImpl.validateNamespace(SqlValidatorImpl.java:747)
        at
org.eigenbase.sql.validate.SqlValidatorImpl.validateQuery(SqlValidatorImpl.java:736)
        at org.eigenbase.sql.SqlSelect.validate(SqlSelect.java:207)
        at
org.eigenbase.sql.validate.SqlValidatorImpl.validateScopedExpression(SqlValidatorImpl.java:710)
        at
org.eigenbase.sql.validate.SqlValidatorImpl.validate(SqlValidatorImpl.java:426)
        at
org.eigenbase.sql2rel.SqlToRelConverter.convertQuery(SqlToRelConverter.java:406)
        at net.hydromatic.optiq.prepare.Prepare.prepareSql(Prepare.java:211)
        at net.hydromatic.optiq.prepare.Prepare.prepareSql(Prepare.java:178)
        at
net.hydromatic.optiq.prepare.OptiqPrepareImpl.prepare2_(OptiqPrepareImpl.java:412)
        at
net.hydromatic.optiq.prepare.OptiqPrepareImpl.prepare_(OptiqPrepareImpl.java:318)
        at
net.hydromatic.optiq.prepare.OptiqPrepareImpl.prepareSql(OptiqPrepareImpl.java:287)
        at
net.hydromatic.optiq.jdbc.OptiqConnectionImpl.parseQuery(OptiqConnectionImpl.java:170)
        at net.hydromatic.optiq.jdbc.MetaImpl.prepare(MetaImpl.java:617)
        at
net.hydromatic.avatica.AvaticaStatement.execute(AvaticaStatement.java:67)
        ... 6 more
Caused by: org.eigenbase.sql.validate.SqlValidatorException: Table 'NATION'
not found
        at sun.reflect.NativeConstructorAccessorImpl.newInstance0(Native
Method)
        at
sun.reflect.NativeConstructorAccessorImpl.newInstance(NativeConstructorAccessorImpl.java:57)
        at
sun.reflect.DelegatingConstructorAccessorImpl.newInstance(DelegatingConstructorAccessorImpl.java:45)
        at java.lang.reflect.Constructor.newInstance(Constructor.java:526)
        at
org.eigenbase.resource.Resources$ExInstWithCause.ex(Resources.java:348)
        at org.eigenbase.resource.Resources$ExInst.ex(Resources.java:457)
        ... 32 more


Am I missing something? Any and all help is greatly appreciated!

--Anton

Attachment: mysql.json
Description: application/json

Reply via email to