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

Predicate references RolapStar.Column when used in AggStar

    Details

    • Type: Bug
    • Status: Closed
    • Severity: Medium
    • Resolution: Incomplete
    • Affects Version/s: None
    • 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

      A StarColumnPredicate references RolapStar.Column when used in an AggStar. The result is that the incorrect SQL is generated.

      For example, set Bug.<thisbug>Fixed=true and run mondrian.rolap.FastBatchingCellReaderTest.testAggregateDistinctCount3 with aggregates enabled, and you get the following error.

      mondrian.olap.MondrianException: Mondrian Error:Internal error: Error while loading segment; sql=[select "store"."store_state" as "c0", "agg_c_14_sales_fact_1997"."the_year" as "c1", "agg_c_14_sales_fact_1997"."quarter" as "c2", sum("agg_c_14_sales_fact_1997"."unit_sales") as "m0" from "store" "store", "agg_c_14_sales_fact_1997" "agg_c_14_sales_fact_1997" where "agg_c_14_sales_fact_1997"."store_id" = "store"."store_id" and "store"."store_state" = 'CA' and "time_by_day"."the_year" = 1997 and "time_by_day"."quarter" in ('Q1', 'Q2') group by "store"."store_state", "agg_c_14_sales_fact_1997"."the_year", "agg_c_14_sales_fact_1997"."quarter"]
      at mondrian.resource.MondrianResource$_Def0.ex(MondrianResource.java:755)
      at mondrian.olap.Util.newInternal(Util.java:1104)
      at mondrian.olap.Util.newError(Util.java:1120)
      at mondrian.rolap.SqlStatement.handle(SqlStatement.java:208)
      at mondrian.rolap.SqlStatement.execute(SqlStatement.java:138)
      at mondrian.rolap.RolapUtil.executeQuery(RolapUtil.java:284)
      at mondrian.rolap.RolapUtil.executeQuery(RolapUtil.java:245)
      at mondrian.rolap.agg.SegmentLoader.createExecuteSql(SegmentLoader.java:337)
      at mondrian.rolap.agg.SegmentLoader.load(SegmentLoader.java:74)
      ...

      Note that "time_by_day"."quarter" occurs in the query. This column from the regular star schema is used in a predicate, but the predicate should have been translated to refer to columns in the AggStar.

      One way to fix this would do the long-deferred unification of RolapStar and AggStar. The class AggStar.Table.Column would go away, so predicates in an AggStar query could legimately refer to RolapStar.Column objects.

        Activity

        Hide
        importer Mondrian Importer User added a comment -
        {jhyde}, 08/04/2007: IP, Artifact Created: 66.92.12.96 | {jhyde}

        , 08/04/2007: IP, Comment Added: 66.92.12.96

        Show
        importer Mondrian Importer User added a comment - {jhyde}, 08/04/2007: IP, Artifact Created: 66.92.12.96 | {jhyde} , 08/04/2007: IP, Comment Added: 66.92.12.96
        Hide
        importer Mondrian Importer User added a comment -
        {jhyde}

        , 08/04/2007: Logged In: YES
        user_id=312935
        Originator: YES

        By the way, the code to reproduce this is not yet checked in. Should be in today or tomorrow.

        I suppose this is an architectural issue rather than a bug, because I was able to create a workaround in the code I am writing. It showed up as I added more kinds of predicates (e.g. AND and OR of predicates, necessary to make aggregation work over complex calculated members) and I was able to work around it by cloning every predicate with a fake column just before converting it to SQL. The workaround will do for mondrian-2.4, but it's really just papering over the cracks.

        It is a manifestation of the problem we've known about for some time: that AggStar and RolapStar should be unified.

        Show
        importer Mondrian Importer User added a comment - {jhyde} , 08/04/2007: Logged In: YES user_id=312935 Originator: YES By the way, the code to reproduce this is not yet checked in. Should be in today or tomorrow. I suppose this is an architectural issue rather than a bug, because I was able to create a workaround in the code I am writing. It showed up as I added more kinds of predicates (e.g. AND and OR of predicates, necessary to make aggregation work over complex calculated members) and I was able to work around it by cloning every predicate with a fake column just before converting it to SQL. The workaround will do for mondrian-2.4, but it's really just papering over the cracks. It is a manifestation of the problem we've known about for some time: that AggStar and RolapStar should be unified.

          People

          • Assignee:
            Unassigned
            Reporter:
            jhyde Julian Hyde
          • Votes:
            0 Vote for this issue
            Watchers:
            0 Start watching this issue

            Dates

            • Created:
              Updated:
              Resolved: