Details
-
Bug
-
Status: Closed
-
Major
-
Resolution: Fixed
-
v0.7.1
-
None
-
Important
Description
The following 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)); }
results in the following error message:
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)
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.