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

Querying a cube results in a "Failed to parse query" stack trace because of role restrictions.

    Details

    • Type: Bug
    • Status: Closed
    • Severity: Medium
    • Resolution: Not a Bug
    • Affects Version/s: 3.5.0 Suite Release
    • Fix 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

      As a report designer, i only know the role of the current user i am passing into the mondrian connect string.
      I do not have an idea of what restrictions this role is applying to the cube. It might make the whole cube unaccessible.

      Therefor it is required that mondrian can return valid error codes, indicating that there is nothing wrong with the query itself, but that the result returned is an empty result set because of role restrictions in stead of a "Failed to parse query" stack trace.
      Resolution of case http://jira.pentaho.com/browse/PRD-2211 is unpossible without this.

      To test :
      Use the samples\Operational Reports\Top N Analysis.prpt to test
      It uses samples\steelwheels.mondrian.xml

      Copy the attached steelwheels.mondrian.xml file.
      I have added 2 roles, None= nothing is allowed, NoLimitations = there are no restrictions.
      I have added a default role to the schema. <Schema name="SteelWheels" defaultRole="None">

      If default role = NoLimitations everything works.
      If default role is None you get an error in stead of "no data".
      The error is also there if one of the hierarchies is hidden because of a role definition.

      org.pentaho.reporting.engine.classic.core.ReportDataFactoryException: Failed to create datasource:Mondrian Error:Failed to parse query 'with
      set [TopSelection] as
      'TopCount(FILTER([Customers].[All Customers].Children,[Measures].[Sales]>0), Parameter("TopCount", NUMERIC, 10, "Number of Customers to show"), [Measures].[Sales])'
      Member [Customers].[All Customers].[Total] as 'Sum([TopSelection])'
      Member [Customers].[All Customers].[Other Customers] as '[Customers].[All Customers] - [Customers].[Total]'
      select NON EMPTY

      {[Measures].[Sales],[Measures].[Quantity] } ON COLUMNS,
      { [TopSelection], [Customers].[All Customers].[Other Customers]} ON ROWS
      from [SteelWheelsSales]
      where
      (
      strToMember(Parameter("sLine", STRING, "[Product].[All Products].[Classic Cars]")),
      strToMember(Parameter("sMarket", STRING, "[Markets].[All Markets].[Japan]")),
      strToMember(Parameter("sYear", STRING, "[Time].[All Years].[2003]"))
      )
      '
      at org.pentaho.reporting.engine.classic.extensions.datasources.mondrian.AbstractMDXDataFactory.performQuery(AbstractMDXDataFactory.java:393)
      at org.pentaho.reporting.engine.classic.extensions.datasources.mondrian.BandedMDXDataFactory.queryData(BandedMDXDataFactory.java:54)
      at org.pentaho.reporting.ui.datasources.mondrian.MondrianPreviewWorker.run(MondrianPreviewWorker.java:98)
      at java.lang.Thread.run(Unknown Source)
      ParentException:
      mondrian.olap.MondrianException: Mondrian Error:Failed to parse query 'with
      set [TopSelection] as
      'TopCount(FILTER([Customers].[All Customers].Children,[Measures].[Sales]>0), Parameter("TopCount", NUMERIC, 10, "Number of Customers to show"), [Measures].[Sales])'
      Member [Customers].[All Customers].[Total] as 'Sum([TopSelection])'
      Member [Customers].[All Customers].[Other Customers] as '[Customers].[All Customers] - [Customers].[Total]'
      select NON EMPTY {[Measures].[Sales],[Measures].[Quantity] }

      ON COLUMNS,

      { [TopSelection], [Customers].[All Customers].[Other Customers]} ON ROWS
      from [SteelWheelsSales]
      where
      (
      strToMember(Parameter("sLine", STRING, "[Product].[All Products].[Classic Cars]")),
      strToMember(Parameter("sMarket", STRING, "[Markets].[All Markets].[Japan]")),
      strToMember(Parameter("sYear", STRING, "[Time].[All Years].[2003]"))
      )
      '
      at mondrian.resource.MondrianResource$_Def0.ex(MondrianResource.java:816)
      at mondrian.olap.ConnectionBase.parseQuery(ConnectionBase.java:137)
      at mondrian.olap.ConnectionBase.parseQuery(ConnectionBase.java:59)
      at org.pentaho.reporting.engine.classic.extensions.datasources.mondrian.AbstractMDXDataFactory.performQuery(AbstractMDXDataFactory.java:318)
      at org.pentaho.reporting.engine.classic.extensions.datasources.mondrian.BandedMDXDataFactory.queryData(BandedMDXDataFactory.java:54)
      at org.pentaho.reporting.ui.datasources.mondrian.MondrianPreviewWorker.run(MondrianPreviewWorker.java:98)
      at java.lang.Thread.run(Unknown Source)
      Caused by: mondrian.olap.MondrianException: Mondrian Error:Error while parsing MDX statement 'with
      set [TopSelection] as
      'TopCount(FILTER([Customers].[All Customers].Children,[Measures].[Sales]>0), Parameter("TopCount", NUMERIC, 10, "Number of Customers to show"), [Measures].[Sales])'
      Member [Customers].[All Customers].[Total] as 'Sum([TopSelection])'
      Member [Customers].[All Customers].[Other Customers] as '[Customers].[All Customers] - [Customers].[Total]'
      select NON EMPTY {[Measures].[Sales],[Measures].[Quantity] } ON COLUMNS,
      { [TopSelection], [Customers].[All Customers].[Other Customers]}

      ON ROWS
      from [SteelWheelsSales]
      where
      (
      strToMember(Parameter("sLine", STRING, "[Product].[All Products].[Classic Cars]")),
      strToMember(Parameter("sMarket", STRING, "[Markets].[All Markets].[Japan]")),
      strToMember(Parameter("sYear", STRING, "[Time].[All Years].[2003]"))
      )
      '
      at mondrian.resource.MondrianResource$_Def0.ex(MondrianResource.java:816)
      at mondrian.olap.Parser.parseInternal(Parser.java:777)
      at mondrian.olap.ConnectionBase.parseQuery(ConnectionBase.java:133)
      ... 5 more
      Caused by: mondrian.olap.MondrianException: Mondrian Error:MDX cube 'SteelWheelsSales' not found
      at mondrian.resource.MondrianResource$_Def0.ex(MondrianResource.java:813)
      at mondrian.olap.Util.lookupCube(Util.java:832)
      at mondrian.olap.Query.<init>(Query.java:187)
      at mondrian.olap.Parser.makeQuery(Parser.java:870)
      at mondrian.olap.CUP$Parser$actions.CUP$Parser$do_action(Parser.java:1764)
      at mondrian.olap.Parser.do_action(Parser.java:699)
      at java_cup.runtime.lr_parser.parse(lr_parser.java:569)
      at mondrian.olap.Parser.parseInternal(Parser.java:772)
      ... 6 more

        Attachments

          Activity

            People

            • Assignee:
              Unassigned
              Reporter:
              begunrom gunter rombauts
            • Votes:
              2 Vote for this issue
              Watchers:
              2 Start watching this issue

              Dates

              • Created:
                Updated:
                Resolved: