Uploaded image for project: 'Kylin'
  1. Kylin
  2. KYLIN-819

Fix necessary ColumnMetaData order for Calcite (Optic)

    XMLWordPrintableJSON

Details

    • Bug
    • Status: Closed
    • Major
    • Resolution: Fixed
    • v0.7.1
    • v0.7.2
    • Driver - JDBC
    • 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.

      Attachments

        Activity

          People

            liyang.gmt8@gmail.com liyang
            mustangore Sébastien Jelsch
            Votes:
            0 Vote for this issue
            Watchers:
            3 Start watching this issue

            Dates

              Created:
              Updated:
              Resolved: