Pentaho Analysis - Mondrian
  1. Pentaho Analysis - Mondrian
  2. MONDRIAN-897

ClassCastException in CrossJoinArgFactory.allArgsCheapToExpand when defining a NamedSet as another NamedSet

    Details

    • 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.
    • CI Build:
      bi-server-ee-MON33.zip , Sep 16, 2011 2:21:10 PM(#26)

      Description

      Have a query that looks something like:

      WITH
      MEMBER [Time].[Base] AS ([Time].[Epoch].[1297728000])
      MEMBER [Measures].[date] AS [Time].CurrentMember.Name
      MEMBER [Time].[Slicer] AS ([Time].[Epoch].[1298332800])
      SET [Available] AS FILTER([Dim].[Level].Members, CAST([Dim].CurrentMember.Key AS NUMERIC) > 0)
      SET [CrossRows] AS [Time].[Epoch].[1298332800]:[Time].[Epoch].[1298332800]
      SET [Filtered] AS FilteringUDF([Available], "condition")
      SET [Requested] AS [Filtered]
      SELECT

      { HEAD(CROSSJOIN([Requested], [CrossRows]), 10000) }

      ON ROWS,

      { [Measures].Members }

      ON COLUMNS
      FROM
      Our_Cube

      and get the following exception:

      Caused by: java.lang.ClassCastException: mondrian.mdx.NamedSetExpr cannot be cast to mondrian.mdx.ResolvedFunCall
      at mondrian.rolap.sql.CrossJoinArgFactory.allArgsCheapToExpand(CrossJoinArgFactory.java:936)
      at mondrian.rolap.sql.CrossJoinArgFactory.isCheapSet(CrossJoinArgFactory.java:926)
      at mondrian.rolap.sql.CrossJoinArgFactory.shouldExpandNonEmpty(CrossJoinArgFactory.java:920)
      at mondrian.rolap.sql.CrossJoinArgFactory.expandNonNative(CrossJoinArgFactory.java:898)
      at mondrian.rolap.sql.CrossJoinArgFactory.checkCrossJoin(CrossJoinArgFactory.java:345)
      at mondrian.rolap.RolapNativeCrossJoin.createEvaluator(RolapNativeCrossJoin.java:105)
      at mondrian.rolap.RolapNativeRegistry.createEvaluator(RolapNativeRegistry.java:56)
      at mondrian.rolap.RolapSchemaReader.getNativeSetEvaluator(RolapSchemaReader.java:612)
      at mondrian.olap.DelegatingSchemaReader.getNativeSetEvaluator(DelegatingSchemaReader.java:235)
      at mondrian.olap.fun.CrossJoinFunDef$BaseListCalc.evaluateList(CrossJoinFunDef.java:1168)
      at mondrian.olap.fun.HeadTailFunDef$1.evaluateList(HeadTailFunDef.java:65)
      at mondrian.calc.impl.AbstractListCalc.evaluateTupleList(AbstractListCalc.java:89)
      at mondrian.olap.fun.SetFunDef$TupleSetListCalc$1.evaluateVoid(SetFunDef.java:259)
      at mondrian.olap.fun.SetFunDef$TupleSetListCalc.evaluateTupleList(SetFunDef.java:298)
      at mondrian.calc.impl.AbstractExpCompiler$TupleListIterCalc.evaluateTupleIterable(AbstractExpCompiler.java:615)
      at mondrian.calc.impl.AbstractTupleIterCalc.evaluate(AbstractTupleIterCalc.java:52)
      at mondrian.rolap.RolapResult.executeAxis(RolapResult.java:732)
      at mondrian.rolap.RolapResult.evalLoad(RolapResult.java:575)
      at mondrian.rolap.RolapResult.loadMembers(RolapResult.java:541)
      at mondrian.rolap.RolapResult.<init>(RolapResult.java:273)
      at mondrian.rolap.RolapConnection.execute(RolapConnection.java:593)

      working on a new unit test for this issue now, but changing the "if (exp instanceof NamedSetExpr)" to "while (exp instanceof NamedSetExpr)" at the top of #allArgsCheapToExpand() seems to fix the problem and all existing unit tests pass. Will upload a diff w/ unit test once I have one put together.

      1. mondrian897.patch
        3 kB
        Joe Barnett
      2. pentaho.log
        913 kB
        Suhas Gururaja

        Activity

        Hide
        Julian Hyde added a comment -

        Is there a foodmart repro case?

        Show
        Julian Hyde added a comment - Is there a foodmart repro case?
        Hide
        Joe Barnett added a comment -

        attached patch includes a testcase that errors w/ ClassCastException before the change, and passes afterwards. Full test suite continues to pass, as well.

        Show
        Joe Barnett added a comment - attached patch includes a testcase that errors w/ ClassCastException before the change, and passes afterwards. Full test suite continues to pass, as well.
        Hide
        Luc Boudreau added a comment -

        Fixed in revision 14415.

        Show
        Luc Boudreau added a comment - Fixed in revision 14415.
        Hide
        Luc Boudreau added a comment -

        Repro path:

        This issue can be tested using the FoodMart schema and running the following query:

        WITH SET [CustomerSet] as

        {[Customers].[Canada].[BC].[Burnaby].[Alexandra Wellington], [Customers].[USA].[WA].[Tacoma].[Eric Coleman]}

        SET [InterestingCustomers] as [CustomerSet]
        SET [TimeRange] as

        {[Time].[1998].[Q1], [Time].[1998].[Q2]}

        SELECT

        {[Measures].[Store Sales]}

        ON COLUMNS,
        CrossJoin([InterestingCustomers], [TimeRange]) ON ROWS
        FROM [Sales]

        Show
        Luc Boudreau added a comment - Repro path: This issue can be tested using the FoodMart schema and running the following query: WITH SET [CustomerSet] as {[Customers].[Canada].[BC].[Burnaby].[Alexandra Wellington], [Customers].[USA].[WA].[Tacoma].[Eric Coleman]} SET [InterestingCustomers] as [CustomerSet] SET [TimeRange] as {[Time].[1998].[Q1], [Time].[1998].[Q2]} SELECT {[Measures].[Store Sales]} ON COLUMNS, CrossJoin( [InterestingCustomers] , [TimeRange] ) ON ROWS FROM [Sales]
        Hide
        Suhas Gururaja added a comment -

        Tested this issue on CI build dated Sep 16, 2011 2:21:10 PM (#26).

        Repro Path:

        1) Login to PUC.
        2) Click on File Menu-> New-> New Analysis.
        3) A new analysis will be opened.
        4) Select foormart sales cube.
        5) Copy and paste the following query:

        WITH SET [CustomerSet] as

        {[Customers].[Canada].[BC].[Burnaby].[Alexandra Wellington], [Customers].[USA].[WA].[Tacoma].[Eric Coleman]}


        SET [InterestingCustomers] as [CustomerSet]
        SET [TimeRange] as

        {[Time].[1998].[Q1], [Time].[1998].[Q2]}


        SELECT

        {[Measures].[Store Sales]}

        ON COLUMNS,
        CrossJoin([InterestingCustomers], [TimeRange]) ON ROWS
        FROM [Sales]

        6) Didn't find any exception reported in logs. Please find the attached log file.
        This issue is fixed.

        Show
        Suhas Gururaja added a comment - Tested this issue on CI build dated Sep 16, 2011 2:21:10 PM (#26). Repro Path: 1) Login to PUC. 2) Click on File Menu-> New-> New Analysis. 3) A new analysis will be opened. 4) Select foormart sales cube. 5) Copy and paste the following query: WITH SET [CustomerSet] as {[Customers].[Canada].[BC].[Burnaby].[Alexandra Wellington], [Customers].[USA].[WA].[Tacoma].[Eric Coleman]} SET [InterestingCustomers] as [CustomerSet] SET [TimeRange] as {[Time].[1998].[Q1], [Time].[1998].[Q2]} SELECT {[Measures].[Store Sales]} ON COLUMNS, CrossJoin( [InterestingCustomers] , [TimeRange] ) ON ROWS FROM [Sales] 6) Didn't find any exception reported in logs. Please find the attached log file. This issue is fixed.

          People

          • Assignee:
            Suhas Gururaja
            Reporter:
            Joe Barnett
          • Votes:
            1 Vote for this issue
            Watchers:
            1 Start watching this issue

            Dates

            • Created:
              Updated:
              Resolved: