Julian Hyde created OPTIQ-317:
---------------------------------

             Summary: ClassCastException reading from MySQL TINYINT(4) column
                 Key: OPTIQ-317
                 URL: https://issues.apache.org/jira/browse/OPTIQ-317
             Project: optiq
          Issue Type: Bug
            Reporter: Julian Hyde
            Assignee: Julian Hyde


Reading from a TINYINT(4) column in a MySQL table, accessed via the JDBC 
adapter, we an exception:

{code:sql}
create table t2 (x tinyint(4), y int);
insert into t2 values (1, 1);
select "x" from "t2";
{code}

{quote}
Caused by: java.lang.RuntimeException: Error while executing command 
net.hydromatic.optiq.tools.SqlRun$CheckResultCommand@1dde4cb2
        at 
net.hydromatic.optiq.tools.SqlRun$CompositeCommand.execute(SqlRun.java:679)
        at net.hydromatic.optiq.tools.SqlRun.execute(SqlRun.java:103)
        ... 28 more
Caused by: java.lang.ClassCastException: java.lang.Integer cannot be cast to 
java.lang.Byte
        at Baz$1$1.current(Unknown Source)
        at 
net.hydromatic.optiq.runtime.ObjectEnumeratorCursor$ObjectEnumeratorGetter.getObject(ObjectEnumeratorCursor.java:60)
        at 
net.hydromatic.optiq.runtime.AbstractCursor$AccessorImpl.getObject(AbstractCursor.java:280)
        at 
net.hydromatic.optiq.runtime.AbstractCursor$AccessorImpl.getString(AbstractCursor.java:223)
        at 
net.hydromatic.avatica.AvaticaResultSet.getString(AvaticaResultSet.java:205)
{quote}

A different exception if the table has just one column.

{code:sql}
create table t1 (x tinyint(4));
insert into t1 values (1);
select "x" from "t1";
{code}

{quote}
> Caused by: java.lang.ClassCastException: [Ljava.lang.Object; cannot be cast 
> to java.lang.Comparable
>       at 
> net.hydromatic.optiq.impl.clone.ColumnLoader.load(ColumnLoader.java:215)
>       at 
> net.hydromatic.optiq.impl.clone.ColumnLoader.<init>(ColumnLoader.java:103)
{quote}




--
This message was sent by Atlassian JIRA
(v6.2#6252)

Reply via email to