Uploaded image for project: 'Calcite'
  1. Calcite
  2. CALCITE-647

Avatica cursor type cast for number cause exception in AvaticaResultSet

    XMLWordPrintableJSON

    Details

    • Type: Bug
    • Status: Closed
    • Priority: Major
    • Resolution: Duplicate
    • Affects Version/s: 1.1.0-incubating
    • Fix Version/s: 1.3.0-incubating
    • Component/s: None
    • Labels:

      Description

      After the result are deserialized from JSON on remote side, the object is not with it's original type, forcing casing of box type Long on Integer raise exception.

      For all box number, it will type cast to Number and extract using the Number method instead.

      2015-03-26 15:49:48,154 [Thread-10] ERROR net.sourceforge.squirrel_sql.fw.sql.ResultSetReader - Error reading column data, column index = 3
      java.lang.ClassCastException: java.lang.Integer incompatible with java.lang.Long
      at org.apache.calcite.avatica.util.AbstractCursor$LongAccessor.getLong(AbstractCursor.java:483)
      at org.apache.calcite.avatica.AvaticaResultSet.getLong(AvaticaResultSet.java:252)
      at net.sourceforge.squirrel_sql.fw.datasetviewer.cellcomponent.DataTypeLong.readResultSet(DataTypeLong.java:365)
      at net.sourceforge.squirrel_sql.fw.datasetviewer.cellcomponent.CellComponentFactory.readResultSet(CellComponentFactory.java:488)
      at net.sourceforge.squirrel_sql.fw.sql.ResultSetReader.doContentTabRead(ResultSetReader.java:613)
      at net.sourceforge.squirrel_sql.fw.sql.ResultSetReader.readRow(ResultSetReader.java:184)
      at net.sourceforge.squirrel_sql.fw.datasetviewer.ResultSetDataSet.createRow(ResultSetDataSet.java:237)
      at net.sourceforge.squirrel_sql.fw.datasetviewer.ResultSetDataSet._setResultSet(ResultSetDataSet.java:203)
      at net.sourceforge.squirrel_sql.fw.datasetviewer.ResultSetDataSet.setSqlExecutionTabResultSet(ResultSetDataSet.java:126)
      at net.sourceforge.squirrel_sql.client.session.mainpanel.SQLExecutionHandler.sqlResultSetAvailable(SQLExecutionHandler.java:410)
      at net.sourceforge.squirrel_sql.client.session.SQLExecuterTask.processResultSet(SQLExecuterTask.java:542)
      at net.sourceforge.squirrel_sql.client.session.SQLExecuterTask.processQuery(SQLExecuterTask.java:407)
      at net.sourceforge.squirrel_sql.client.session.SQLExecuterTask.run(SQLExecuterTask.java:205)
      at net.sourceforge.squirrel_sql.fw.util.TaskExecuter.run(TaskExecuter.java:82)
      at java.lang.Thread.run(Thread.java:853)

        Attachments

        1. CALCITE-647-cursor-numberTypeCast.patch
          7 kB
          Xavier FH Leong
        2. CALCITE-647-binary-codec-02.patch
          6 kB
          Xavier FH Leong
        3. CALCITE-647-binary-codec-04.patch
          2 kB
          Xavier FH Leong

          Issue Links

            Activity

              People

              • Assignee:
                julianhyde Julian Hyde
                Reporter:
                xhoong Xavier FH Leong
              • Votes:
                0 Vote for this issue
                Watchers:
                3 Start watching this issue

                Dates

                • Created:
                  Updated:
                  Resolved: