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

ClassCastException for arrays with date/time/timestamp elements

    XMLWordPrintableJSON

    Details

    • Type: Bug
    • Status: Open
    • Priority: Major
    • Resolution: Unresolved
    • Affects Version/s: avatica-1.17.0
    • Fix Version/s: None
    • Component/s: avatica
    • Labels:
      None

      Description

      cases to reproduce

      select array[current_date];
      select array[cast('1900-1-1' as date)];
      select array[current_timestamp];
      select array[current_time];
      

      each query fails with ClassCastException mentioned below.
      It seems the reason is that date/time/timestamp could be both int/long and java_sql_*.

      class java.sql.Date cannot be cast to class java.lang.Number (java.sql.Date is in module java.sql of loader 'platform'; java.lang.Number is in module java.base of loader 'bootstrap')
      java.lang.ClassCastException: class java.sql.Date cannot be cast to class java.lang.Number (java.sql.Date is in module java.sql of loader 'platform'; java.lang.Number is in module java.base of loader 'bootstrap')
      	at org.apache.calcite.avatica.util.AbstractCursor$NumberAccessor.getNumber(AbstractCursor.java:722)
      	at org.apache.calcite.avatica.util.AbstractCursor$DateFromNumberAccessor.getString(AbstractCursor.java:928)
      	at org.apache.calcite.avatica.util.ArrayImpl.toString(ArrayImpl.java:62)
      	at org.apache.calcite.avatica.util.AbstractCursor$ArrayAccessor.getString(AbstractCursor.java:1365)
      	at org.apache.calcite.avatica.AvaticaResultSet.getString(AvaticaResultSet.java:239)
      

        Attachments

          Activity

            People

            • Assignee:
              Unassigned
              Reporter:
              Sergey Nuyanzin Sergey Nuyanzin
            • Votes:
              0 Vote for this issue
              Watchers:
              1 Start watching this issue

              Dates

              • Created:
                Updated:

                Time Tracking

                Estimated:
                Original Estimate - Not Specified
                Not Specified
                Remaining:
                Remaining Estimate - 0h
                0h
                Logged:
                Time Spent - 10m
                10m