You are viewing a plain text version of this content. The canonical link for it is here.
Posted to dev@kylin.apache.org by "Luke Han (JIRA)" <ji...@apache.org> on 2015/07/21 09:39:06 UTC

[jira] [Resolved] (KYLIN-819) Fix necessary ColumnMetaData order for Calcite (Optic)

     [ https://issues.apache.org/jira/browse/KYLIN-819?page=com.atlassian.jira.plugin.system.issuetabpanels:all-tabpanel ]

Luke Han resolved KYLIN-819.
----------------------------
    Resolution: Fixed

> Fix necessary ColumnMetaData order for Calcite (Optic)
> ------------------------------------------------------
>
>                 Key: KYLIN-819
>                 URL: https://issues.apache.org/jira/browse/KYLIN-819
>             Project: Kylin
>          Issue Type: Bug
>          Components: Driver - JDBC
>    Affects Versions: v0.7.1
>            Reporter: Sébastien Jelsch
>            Assignee: liyang
>             Fix For: v0.7.2
>
>         Attachments: KYLIN-819-Fix-necessary-ColumnMetaData-order.patch
>
>
> The following code
> {code}
> Class.forName("org.apache.kylin.jdbc.Driver");
>     
> Connection con = DriverManager.getConnection("jdbc:kylin://localhost:7070/simple_project", "admin", "KYLIN");
> DatabaseMetaData dmd = con.getMetaData();
> ResultSet result = dmd.getColumns(null, null, "SIMPLE_FACT", "%");
> while(result.next()) {
>   System.out.println("dataType: "+ result.getInt(5));
> }
> {code}
> results in the following error message:
> {noformat}
> Exception in thread "main" java.lang.RuntimeException: cannot convert to long (net.hydromatic.optiq.runtime.AbstractCursor$StringAccessor@16107cce)
>   at net.hydromatic.optiq.runtime.AbstractCursor$AccessorImpl.cannotConvert(AbstractCursor.java:287)
>   at net.hydromatic.optiq.runtime.AbstractCursor$AccessorImpl.getLong(AbstractCursor.java:243)
>   at net.hydromatic.optiq.runtime.AbstractCursor$AccessorImpl.getInt(AbstractCursor.java:239)
>   at net.hydromatic.avatica.AvaticaResultSet.getInt(AvaticaResultSet.java:220)
>   at org.mustangore.kylin.KylinConnection.newConnection(KylinConnection.java:32)
>   at org.mustangore.kylin.KylinConnection.main(KylinConnection.java:20)
> {noformat}
> Tried with apache-calcite-0.9.1 and apache-calcite-0.9.2 .
> *Reason and fix*
> SQLTypeMap uses HasMap, but Calcite (Optic) needs specific order. So using _LinkedHashMap_ fixes this issue.



--
This message was sent by Atlassian JIRA
(v6.3.4#6332)