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

Count with ExcludeEmpty throws an exception when the cube does not have a factCountMeasure

    Details

    • Type: Bug Bug
    • Status: Closed
    • Priority: Severe Severe
    • Resolution: Fixed
    • Affects Version/s: 3.2.0 GA (3.6.0 GA Suite Release)
    • 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

      Count with ExcludeEmpty throws an exception when the cube does not have a factCountMeasure. In foodmart, it will succeed on Sales but fail on Warehouse. This was introduced in changelist 13397. See differences in FunUtil.count and RolapEvaluator.currentIsEmpty

      public void testCountExcludeEmptyOnCubeWithNoCountFacts() {
      assertQueryReturns(
      "WITH "
      + " MEMBER [Measures].[count] AS '"
      + " COUNT([Store Type].[Store Type].MEMBERS, EXCLUDEEMPTY)'"
      + " SELECT "
      + "

      {[Measures].[count]} ON AXIS(0)"
      + " FROM [Warehouse]",
      "Axis #0:\n"
      + "{}\n"
      + "Axis #1:\n"
      + "{[Measures].[count]}

      \n"
      + "Row #0: 5\n"
      );
      }

      Caused by: java.lang.NullPointerException
      at mondrian.rolap.RolapEvaluator.setContext(RolapEvaluator.java:398)
      at mondrian.rolap.RolapEvaluator.push(RolapEvaluator.java:296)
      at mondrian.rolap.RolapEvaluator.currentIsEmpty(RolapEvaluator.java:221)
      at mondrian.olap.fun.FunUtil.count(FunUtil.java:1463)
      at mondrian.olap.fun.CountFunDef$1.evaluateInteger(CountFunDef.java:58)
      at mondrian.calc.impl.AbstractIntegerCalc.evaluate(AbstractIntegerCalc.java:46)
      at mondrian.rolap.RolapEvaluator.evaluateCurrent(RolapEvaluator.java:500)
      at mondrian.rolap.RolapResult.executeStripe(RolapResult.java:902)
      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:607)
      ... 25 more

        Activity

        Hide
        Julian Hyde added a comment -

        Oops. Yes, I caused that one.

        Is it possible to figure out whether a cell is empty without using a fact-count measure? I don't think it is. In which case, how did we do it all these years?

        A fact-count measure is so useful that I think mondrian should automatically create an invisible measure for any cube that doesn't have one. It's useful for writeback (aka scenarios) and for computing avg.

        Show
        Julian Hyde added a comment - Oops. Yes, I caused that one. Is it possible to figure out whether a cell is empty without using a fact-count measure? I don't think it is. In which case, how did we do it all these years? A fact-count measure is so useful that I think mondrian should automatically create an invisible measure for any cube that doesn't have one. It's useful for writeback (aka scenarios) and for computing avg.
        Hide
        Kurtis Walker added a comment -

        Julian,
        Any idea when you'll be able to work on this? Can I revert the changes in the count function? This is holding us up from integrating all the recent changes into our product.

        Show
        Kurtis Walker added a comment - Julian, Any idea when you'll be able to work on this? Can I revert the changes in the count function? This is holding us up from integrating all the recent changes into our product.
        Hide
        Julian Hyde added a comment -

        Fixed in change 13506. Will be in 3.2.0.

        If cube does not have a count measure, mondrian implicitly creates [Measures].[Fact Count]. It is marked not-visible.

        Show
        Julian Hyde added a comment - Fixed in change 13506. Will be in 3.2.0. If cube does not have a count measure, mondrian implicitly creates [Measures] . [Fact Count] . It is marked not-visible.
        Hide
        Kurtis Walker added a comment -

        The fix works for any base cube, but not for virtual cubes. Change the test to run against [Warehouse and Sales] and the same exception will be thrown

        Show
        Kurtis Walker added a comment - The fix works for any base cube, but not for virtual cubes. Change the test to run against [Warehouse and Sales] and the same exception will be thrown
        Hide
        Julian Hyde added a comment -

        Fixed in change 13598.

        Show
        Julian Hyde added a comment - Fixed in change 13598.

          People

          • Assignee:
            Julian Hyde
            Reporter:
            Kurtis Walker
          • Votes:
            0 Vote for this issue
            Watchers:
            1 Start watching this issue

            Dates

            • Created:
              Updated:
              Resolved: