Uploaded image for project: 'Pentaho Analysis - Mondrian'
  1. Pentaho Analysis - Mondrian
  2. MONDRIAN-852

Using the generate command, cast and calculated measures causes ClassCastException

    Details

    • Type: Bug
    • Status: Closed
    • Severity: Medium
    • Resolution: Fixed
    • Affects Version/s: None
    • Component/s: None
    • Labels:
      None
    • Notice:
      When an issue is open, the "Fix Version/s" field conveys a target, not necessarily a commitment. When an issue is closed, the "Fix Version/s" field conveys the version that the issue was fixed in.

      Description

      Using the following sample:

      with
      member [Measures].[Tom1] as '[Measures].[Quantity]+[Measures].[Sales]'

      set spark1 as '([Time].[2005].[QTR1].[Jan].Lag(13.0) : [Time].[2005].[QTR1].[Jan].Lag(0.0))'
      member [Time].[Past 13 weeks] as 'Generate([spark1], CAST(([Measures].CurrentMember + 0.0) AS String), ", ")'
      select

      {[Time].[Past 13 weeks]} ON COLUMNS,
      {[Measures].[Quantity], [Measures].[Tom1]} ON ROWS
      from [SteelWheelsSales]


      The Tom1 Measure throws a ClassCastException when you use it, but removing the calculation from the calculated member(just referencing a Measure) it suddenly starts working.

      Caused by: mondrian.olap.MondrianException: Mondrian Error:Internal error: Error while executing query [with member [Measures].[Tom1] as '([Measures].[Quantity] / [Measures].[Sales])'
      set spark1 as '([Time].[2005].[QTR1].[Jan].Lag(13.0) : [Time].[2005].[QTR1].[Jan].Lag(0.0))'
      member [Time].[Past 13 weeks] as 'Generate([spark1], CAST(([Measures].CurrentMember + 0.0) AS String), ", ")'
      select {[Time].[Past 13 weeks]}

      ON COLUMNS,

      {[Measures].[Quantity], [Measures].[Tom1]}

      ON ROWS
      from [SteelWheelsSales]
      ]
      at mondrian.resource.MondrianResource$_Def0.ex(MondrianResource.java:826)
      at mondrian.olap.Util.newInternal(Util.java:1490)
      at mondrian.olap.Util.newError(Util.java:1506)
      at mondrian.rolap.RolapConnection.execute(RolapConnection.java:622)
      at com.tonbeller.jpivot.mondrian.MondrianModel.getResult(MondrianModel.java:279)
      ... 70 more
      Caused by: java.lang.ClassCastException: java.lang.String cannot be cast to java.lang.Number
      at mondrian.calc.impl.GenericCalc.evaluateDouble(GenericCalc.java:73)
      at mondrian.olap.fun.BuiltinFunTable$48$2.evaluateDouble(BuiltinFunTable.java:1522)
      at mondrian.calc.impl.AbstractDoubleCalc.evaluate(AbstractDoubleCalc.java:45)
      at mondrian.rolap.RolapEvaluator.evaluateCurrent(RolapEvaluator.java:511)
      at mondrian.rolap.RolapResult.executeStripe(RolapResult.java:902)
      at mondrian.rolap.RolapResult.executeStripe(RolapResult.java:1040)
      at mondrian.rolap.RolapResult.executeStripe(RolapResult.java:1040)
      at mondrian.rolap.RolapResult.executeBody(RolapResult.java:798)
      at mondrian.rolap.RolapResult.<init>(RolapResult.java:416)
      at mondrian.rolap.RolapConnection.execute(RolapConnection.java:593)
      ... 71 more

        Attachments

          Activity

            People

            • Assignee:
              sgururaja Suhas Gururaja
              Reporter:
              bugg_tb Tom Barber
            • Votes:
              0 Vote for this issue
              Watchers:
              0 Start watching this issue

              Dates

              • Created:
                Updated:
                Resolved: