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

Get "java.lang.Double cannot be cast to java.lang.Long" error when Top-N metris data type is BigInt

    XMLWordPrintableJSON

Details

    • Bug
    • Status: Closed
    • Major
    • Resolution: Fixed
    • v1.5.0
    • v1.5.1
    • None
    • None

    Description

      Create a cube whose top-n metrics's column data type is BigInt; The cube is built successfully, then send a top-n query, like:

      select entity_id, sum(price) a from fact_table where cal_dt > '2015-01-01' group by entity_id order by a desc limit 10
      Get error ""java.lang.Double cannot be cast to java.lang.Long";

      Then try to use CAST but still get the error:
      select entity_id, cast(sum(price) as DECIMAL(9,2)) a from fact_table where cal_dt > '2015-01-01' group by entity_id order by a desc limit 10

      In kylin.log:

      Caused by: java.lang.ClassCastException: java.lang.Double cannot be cast to java.lang.Long
              at Baz$4.apply(Unknown Source)
              at Baz$4.apply(Unknown Source)
              at Baz$4.apply(Unknown Source)
              at org.apache.calcite.linq4j.EnumerableDefaults.groupBy_(EnumerableDefaults.java:825)
              at org.apache.calcite.linq4j.EnumerableDefaults.groupBy(EnumerableDefaults.java:754)
              at org.apache.calcite.linq4j.DefaultEnumerable.groupBy(DefaultEnumerable.java:302)
              at Baz.bind(Unknown Source)
              at org.apache.calcite.jdbc.CalcitePrepare$CalciteSignature.enumerable(CalcitePrepare.java:326)
              at org.apache.calcite.jdbc.CalciteConnectionImpl.enumerable(CalciteConnectionImpl.java:281)
              at org.apache.calcite.jdbc.CalciteMetaImpl._createIterable(CalciteMetaImpl.java:545)
              at org.apache.calcite.jdbc.CalciteMetaImpl.createIterable(CalciteMetaImpl.java:536)
              at org.apache.calcite.avatica.AvaticaResultSet.execute(AvaticaResultSet.java:187)
              at org.apache.calcite.jdbc.CalciteResultSet.execute(CalciteResultSet.java:65)
              at org.apache.calcite.jdbc.CalciteResultSet.execute(CalciteResultSet.java:44)
              at org.apache.calcite.avatica.AvaticaConnection$1.execute(AvaticaConnection.java:566)
              at org.apache.calcite.jdbc.CalciteMetaImpl.prepareAndExecute(CalciteMetaImpl.java:578)
              at org.apache.calcite.avatica.AvaticaConnection.prepareAndExecuteInternal(AvaticaConnection.java:571)
              at org.apache.calcite.avatica.AvaticaStatement.executeInternal(AvaticaStatement.java:135)
              ... 79 more
      

      Attachments

        Activity

          People

            shaofengshi Shao Feng Shi
            shaofengshi Shao Feng Shi
            Votes:
            0 Vote for this issue
            Watchers:
            2 Start watching this issue

            Dates

              Created:
              Updated:
              Resolved: