mondrian.olap.MondrianException: Mondrian Error:Internal error: Error while executing query [with set [RM] as '[Gender].Members' select Reverse([RM]) ON COLUMNS from [Sales] ]

Pentaho BI Platform Tracking | Eric McDermid | 8 years ago
tip
Your exception is missing from the Samebug knowledge base.
Here are the best solutions we found on the Internet.
Click on the to mark the helpful solution and get rewards for you help.
  1. 0

    I have a UDF that worked in 2.4 but fails in 3.1.1 with a class cast exception. It expects args[0].evaluate(eval) to return a List, but in 3.1.1 it returns an anonymous iterable from mondrian.rolap.RolapNamedSetEvaluator instead, resulting in a class cast exception. This was originally mentioned in MONDRIAN-588, but I should have provided a better reproduction case. The following test can be added tpo testsrc/main/mondrian/test/UdfTest to demonstrate the problem on the Reverse function: public void testListUdfWithSetArgument() { TestContext tc = TestContext.create( null, null, null, null, "<UserDefinedFunction name=\"Reverse\" className=\"" + ReverseFunction.class.getName() + "\"/>\n", null); tc.assertQueryReturns( "with set [RM] as '[Gender].Members'\n" + "select Reverse([RM]) on 0\n" + "from [Sales]", "Axis #0:\n" + "{}\n" + "Axis #1:\n" + "{[Gender].[All Gender].[M]}\n" + "{[Gender].[All Gender].[F]}\n" + "{[Gender].[All Gender]}\n" + "Row #0: 135,215\n" + "Row #0: 131,558\n" + "Row #0: 266,773\n"); } The resulting error: mondrian.olap.MondrianException: Mondrian Error:Internal error: Error while executing query [with set [RM] as '[Gender].Members' select Reverse([RM]) ON COLUMNS from [Sales] ] at mondrian.resource.MondrianResource$_Def0.ex(MondrianResource.java:811) at mondrian.olap.Util.newInternal(Util.java:1466) at mondrian.olap.Util.newError(Util.java:1482) at mondrian.rolap.RolapConnection.execute(RolapConnection.java:592) at mondrian.test.TestContext.executeQuery(TestContext.java:488) at mondrian.test.TestContext.assertQueryReturns(TestContext.java:915) at mondrian.test.UdfTest.testListUdfWithSetArgument(UdfTest.java:774) at sun.reflect.NativeMethodAccessorImpl.invoke0(Native Method) at sun.reflect.NativeMethodAccessorImpl.invoke(NativeMethodAccessorImpl.java:39) at sun.reflect.DelegatingMethodAccessorImpl.invoke(DelegatingMethodAccessorImpl.java:25) at com.intellij.rt.execution.junit.JUnitStarter.main(JUnitStarter.java:40) Caused by: java.lang.ClassCastException: mondrian.rolap.RolapNamedSetEvaluator$1 at mondrian.test.UdfTest$ReverseFunction.execute(UdfTest.java:1063) at mondrian.olap.fun.UdfResolver$ListCalcImpl.evaluateList(UdfResolver.java:212) at mondrian.calc.impl.AbstractListCalc.evaluateMemberList(AbstractListCalc.java:84) at mondrian.calc.impl.AbstractExpCompiler$MemberListIterCalc.evaluateMemberIterable(AbstractExpCompiler.java:573) at mondrian.calc.impl.AbstractMemberIterCalc.evaluate(AbstractMemberIterCalc.java:52) at mondrian.rolap.RolapResult.executeAxis(RolapResult.java:745) at mondrian.rolap.RolapResult.evalLoad(RolapResult.java:588) at mondrian.rolap.RolapResult.loadMembers(RolapResult.java:554) at mondrian.rolap.RolapResult.<init>(RolapResult.java:268) at mondrian.rolap.RolapConnection.execute(RolapConnection.java:563) ... 19 more

    Pentaho BI Platform Tracking | 8 years ago | Eric McDermid
    mondrian.olap.MondrianException: Mondrian Error:Internal error: Error while executing query [with set [RM] as '[Gender].Members' select Reverse([RM]) ON COLUMNS from [Sales] ]
  2. 0

    I have a UDF that worked in 2.4 but fails in 3.1.1 with a class cast exception. It expects args[0].evaluate(eval) to return a List, but in 3.1.1 it returns an anonymous iterable from mondrian.rolap.RolapNamedSetEvaluator instead, resulting in a class cast exception. This was originally mentioned in MONDRIAN-588, but I should have provided a better reproduction case. The following test can be added tpo testsrc/main/mondrian/test/UdfTest to demonstrate the problem on the Reverse function: public void testListUdfWithSetArgument() { TestContext tc = TestContext.create( null, null, null, null, "<UserDefinedFunction name=\"Reverse\" className=\"" + ReverseFunction.class.getName() + "\"/>\n", null); tc.assertQueryReturns( "with set [RM] as '[Gender].Members'\n" + "select Reverse([RM]) on 0\n" + "from [Sales]", "Axis #0:\n" + "{}\n" + "Axis #1:\n" + "{[Gender].[All Gender].[M]}\n" + "{[Gender].[All Gender].[F]}\n" + "{[Gender].[All Gender]}\n" + "Row #0: 135,215\n" + "Row #0: 131,558\n" + "Row #0: 266,773\n"); } The resulting error: mondrian.olap.MondrianException: Mondrian Error:Internal error: Error while executing query [with set [RM] as '[Gender].Members' select Reverse([RM]) ON COLUMNS from [Sales] ] at mondrian.resource.MondrianResource$_Def0.ex(MondrianResource.java:811) at mondrian.olap.Util.newInternal(Util.java:1466) at mondrian.olap.Util.newError(Util.java:1482) at mondrian.rolap.RolapConnection.execute(RolapConnection.java:592) at mondrian.test.TestContext.executeQuery(TestContext.java:488) at mondrian.test.TestContext.assertQueryReturns(TestContext.java:915) at mondrian.test.UdfTest.testListUdfWithSetArgument(UdfTest.java:774) at sun.reflect.NativeMethodAccessorImpl.invoke0(Native Method) at sun.reflect.NativeMethodAccessorImpl.invoke(NativeMethodAccessorImpl.java:39) at sun.reflect.DelegatingMethodAccessorImpl.invoke(DelegatingMethodAccessorImpl.java:25) at com.intellij.rt.execution.junit.JUnitStarter.main(JUnitStarter.java:40) Caused by: java.lang.ClassCastException: mondrian.rolap.RolapNamedSetEvaluator$1 at mondrian.test.UdfTest$ReverseFunction.execute(UdfTest.java:1063) at mondrian.olap.fun.UdfResolver$ListCalcImpl.evaluateList(UdfResolver.java:212) at mondrian.calc.impl.AbstractListCalc.evaluateMemberList(AbstractListCalc.java:84) at mondrian.calc.impl.AbstractExpCompiler$MemberListIterCalc.evaluateMemberIterable(AbstractExpCompiler.java:573) at mondrian.calc.impl.AbstractMemberIterCalc.evaluate(AbstractMemberIterCalc.java:52) at mondrian.rolap.RolapResult.executeAxis(RolapResult.java:745) at mondrian.rolap.RolapResult.evalLoad(RolapResult.java:588) at mondrian.rolap.RolapResult.loadMembers(RolapResult.java:554) at mondrian.rolap.RolapResult.<init>(RolapResult.java:268) at mondrian.rolap.RolapConnection.execute(RolapConnection.java:563) ... 19 more

    Pentaho BI Platform Tracking | 8 years ago | Eric McDermid
    mondrian.olap.MondrianException: Mondrian Error:Internal error: Error while executing query [with set [RM] as '[Gender].Members' select Reverse([RM]) ON COLUMNS from [Sales] ]

    Root Cause Analysis

    1. java.lang.ClassCastException

      mondrian.rolap.RolapNamedSetEvaluator$1

      at mondrian.test.UdfTest$ReverseFunction.execute()
    2. mondrian.test
      UdfTest$ReverseFunction.execute
      1. mondrian.test.UdfTest$ReverseFunction.execute(UdfTest.java:1063)
      1 frame
    3. mondrian.olap.fun
      UdfResolver$ListCalcImpl.evaluateList
      1. mondrian.olap.fun.UdfResolver$ListCalcImpl.evaluateList(UdfResolver.java:212)
      1 frame
    4. mondrian.calc.impl
      AbstractMemberIterCalc.evaluate
      1. mondrian.calc.impl.AbstractListCalc.evaluateMemberList(AbstractListCalc.java:84)
      2. mondrian.calc.impl.AbstractExpCompiler$MemberListIterCalc.evaluateMemberIterable(AbstractExpCompiler.java:573)
      3. mondrian.calc.impl.AbstractMemberIterCalc.evaluate(AbstractMemberIterCalc.java:52)
      3 frames
    5. mondrian.rolap
      RolapConnection.execute
      1. mondrian.rolap.RolapResult.executeAxis(RolapResult.java:745)
      2. mondrian.rolap.RolapResult.evalLoad(RolapResult.java:588)
      3. mondrian.rolap.RolapResult.loadMembers(RolapResult.java:554)
      4. mondrian.rolap.RolapResult.<init>(RolapResult.java:268)
      5. mondrian.rolap.RolapConnection.execute(RolapConnection.java:563)
      5 frames
    6. mondrian.resource
      MondrianResource$_Def0.ex
      1. mondrian.resource.MondrianResource$_Def0.ex(MondrianResource.java:811)
      1 frame
    7. mondrian.olap
      Util.newError
      1. mondrian.olap.Util.newInternal(Util.java:1466)
      2. mondrian.olap.Util.newError(Util.java:1482)
      2 frames
    8. mondrian.rolap
      RolapConnection.execute
      1. mondrian.rolap.RolapConnection.execute(RolapConnection.java:592)
      1 frame
    9. mondrian.test
      UdfTest.testListUdfWithSetArgument
      1. mondrian.test.TestContext.executeQuery(TestContext.java:488)
      2. mondrian.test.TestContext.assertQueryReturns(TestContext.java:915)
      3. mondrian.test.UdfTest.testListUdfWithSetArgument(UdfTest.java:774)
      3 frames
    10. Java RT
      DelegatingMethodAccessorImpl.invoke
      1. sun.reflect.NativeMethodAccessorImpl.invoke0(Native Method)
      2. sun.reflect.NativeMethodAccessorImpl.invoke(NativeMethodAccessorImpl.java:39)
      3. sun.reflect.DelegatingMethodAccessorImpl.invoke(DelegatingMethodAccessorImpl.java:25)
      3 frames
    11. IDEA
      JUnitStarter.main
      1. com.intellij.rt.execution.junit.JUnitStarter.main(JUnitStarter.java:40)
      1 frame