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

Issues with aggregate table recognition when using <KeyExpression><SQL>...</SQL></KeyExpression> to define a level

    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.

      Description

      seen on custom build of mondrian 2.4, but seems to still exist in 3.2.

      We have a dimension with a single level defined as follows*:

      <Dimension name="Dim" foreignKey="$keyColumn$">
      <Hierarchy hasAll="true" primaryKey="$keyColumn$" allMemberName="All Dim">
      <Table name="Dim_$CUSTOMER_ID$$CLIENT_ID$" alias="Dim$CUSTOMER_ID$$CLIENT_ID$$it$">
      </Table>
      <Level name="Dim_Value" nameColumn="dim_value" type="String" levelType="Regular" uniqueMembers="true">
      <KeyExpression><SQL>UPPER(dim_value)</SQL></KeyExpression>
      </Level>
      </Hierarchy>
      </Dimension>

      and an agg table with a rollup column of "dim_dim_value".

      loading up this schema results in:

      [24 Sep 2010 10:46:29] [http-8080-1] 269705 ERROR (mondrian.recorder.AbstractRecorder:46) - DefaultRecognizer.matchLevel:Recognizer.makeLevel: Rolap.Column not found (null) for tableAlias=Dim_1_1_23, factColumnName=UPPER(dim_value), levelColumnName=dim_dim_value, symbolicName=Dim_Value
      [24 Sep 2010 10:46:29] [http-8080-1] 269707 ERROR (com.marin.olap.server.OlapServer:194) - Mondrian Exception
      mondrian.olap.MondrianException: Mondrian Error:Too many errors, '1', while loading/reloadin aggregates.
      at mondrian.resource.MondrianResource$_Def8.ex(MondrianResource.java:898)
      at mondrian.rolap.aggmatcher.AggTableManager.loadRolapStarAggregates(AggTableManager.java:318)
      at mondrian.rolap.aggmatcher.AggTableManager.initialize(AggTableManager.java:94)
      at mondrian.rolap.RolapSchema.load(RolapSchema.java:332)
      at mondrian.rolap.RolapSchema.<init>(RolapSchema.java:205)
      at mondrian.rolap.RolapSchema.<init>(RolapSchema.java:79)
      at mondrian.rolap.RolapSchema$Pool.get(RolapSchema.java:831)
      at mondrian.rolap.RolapSchema$Pool.get(RolapSchema.java:703)
      at mondrian.rolap.RolapConnection.<init>(RolapConnection.java:156)
      at mondrian.rolap.RolapConnection.<init>(RolapConnection.java:80)
      at mondrian.olap.DriverManager.getConnection(DriverManager.java:190)

      Applying the following patch to RolapStar.java (Modifiying the body of RolapStar$Table#lookupColumn(String columnName)):
      Index: src/main/mondrian/rolap/RolapStar.java
      ===================================================================
      — src/main/mondrian/rolap/RolapStar.java (revision 128)
      +++ src/main/mondrian/rolap/RolapStar.java (working copy)
      @@ -1346,6 +1346,12 @@
      if (columnExpr.name.equals(columnName))

      { return column; }

      + } else if (column.getExpression() instanceof MondrianDef.KeyExpression) {
      + MondrianDef.KeyExpression columnExpr =
      + (MondrianDef.KeyExpression) column.getExpression();
      + if (columnExpr.toString().equals(columnName))

      { + return column; + }

      } else if (column.getName().equals(columnName))

      { return column; }

      fixes the issue.

      I think it makes sense, as Recognizer#getColumnName() is already special casing for both MondrianDef$Column and MondrianDef$KeyExpression, and the "columnName" argument to this lookupColumn() method originates from the Recognizer#getColumnName() call, so this is just extending that special case to the other side of the .equals().

      *Reason for the definition is that the 'dim_value' is not always capitalized the same, and we want the rollup to work case-insensitively, without actually transforming the case that the users are enterning into the system – which is why nameColumn just ref's the column direclty

        Attachments

          Activity

            People

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

              Dates

              • Created:
                Updated:
                Resolved: