Hitachi Vantara Pentaho Community Forums
Results 1 to 4 of 4

Thread: Degenerate dimensions in Mondrian 4

  1. #1
    Join Date
    Apr 2007
    Posts
    10

    Default Degenerate dimensions in Mondrian 4

    Hi everyone.
    I'm trying to implement a couple of degenerate dimensions on Mondrian 4 but haven't been able to do it. The docs still have the "old" way.

    This is my Mondrian 3 schema that works fine:

    Code:
    <Schema name="cvdelop">
        <Cube name="Sales" visible="true" cache="true" enabled="true">
            <Table name="sales" schema="public" alias="">
            </Table>
            <Dimension type="StandardDimension" visible="true" foreignKey="store" name="Store">
                <Hierarchy name="Store" visible="true" hasAll="true">
                    <Level name="Store" visible="true" column="store" uniqueMembers="false">
                    </Level>
                </Hierarchy>
            </Dimension>
            <Dimension type="StandardDimension" visible="true" foreignKey="city" name="City">
                <Hierarchy name="City" visible="true" hasAll="true">
                    <Level name="City" visible="true" column="city" uniqueMembers="false">
                    </Level>
                </Hierarchy>
            </Dimension>
            <Measure name="Units Sold" column="unitssold" aggregator="sum" visible="true">
            </Measure>
        </Cube>
    </Schema>
    But when I try to do something similar on 4 it gave me this error:

    mondrian.rolap.RolapSchema$MondrianSchemaException: table must be specified (in Attribute 'City') (at line 0, column 215)
    at mondrian.rolap.RolapSchemaLoaderHandlerImpl.error(RolapSchemaLoaderHandlerImpl.java:117)
    at mondrian.rolap.RolapSchemaLoader.createColumnList(RolapSchemaLoader.java:3999)
    at mondrian.rolap.RolapSchemaLoader.createAttribute(RolapSchemaLoader.java:3397)
    at mondrian.rolap.RolapSchemaLoader.getOrCreateDimension(RolapSchemaLoader.java:2724)
    at mondrian.rolap.RolapSchemaLoader.createCube(RolapSchemaLoader.java:1563)
    at mondrian.rolap.RolapSchemaLoader.loadStage2(RolapSchemaLoader.java:420)
    at mondrian.rolap.RolapSchemaLoader.loadStage1(RolapSchemaLoader.java:336)

    The Mondrian 4 schema is this one:
    Code:
    <?xml version='1.0'?>
    <Schema name='cdvelop' metamodelVersion='4.0'>
        <PhysicalSchema>
            <Table name='sales' />
        </PhysicalSchema>
        <Cube name='Sales'>
        <Dimensions>
            <Dimension name='City' key='City'>
                <Attributes>    
                    <Attribute name='City' keyColumn='city' hasHierarchy='false'/>
                </Attributes>
                <Hierarchies>
                    <Hierarchy name="City" hasAll="true">
                        <Level attribute="City"/>
                    </Hierarchy>
                </Hierarchies>
            </Dimension>
    
    
            <Dimension name='Store' key='Store'>
                <Attributes>
                    <Attribute name='Store' keyColumn='store' hasHierarchy='false'/>
                </Attributes>
                <Hierarchies>
                    <Hierarchy name="Store" hasAll="true">
                        <Level attribute="Store"/>
                    </Hierarchy>
                </Hierarchies>
            </Dimension>
        </Dimensions>
        <MeasureGroups>
            <MeasureGroup name='Sales' table='sales'>
            <Measures>
                <Measure name='Units sold' column='unitssold' aggregator='sum' formatString='#,###'/>
            </Measures>
            <DimensionLinks>
                <ForeignKeyLink dimension='City' foreignKeyColumn='city'/>
                <ForeignKeyLink dimension='Store' foreignKeyColumn='store'/>
            </DimensionLinks>
            </MeasureGroup>
        </MeasureGroups>
        </Cube>
    </Schema>
    Any idea?

  2. #2
    Join Date
    Jan 2013
    Posts
    796

    Default

    Try setting the table value on your <Attributes>, just using the same table name as your measure group.

    See the [Store] Cube in Foodmart.mondrian.xml for an example of where degenerates are used: https://github.com/pentaho/mondrian/...t.mondrian.xml

  3. #3
    Join Date
    Apr 2007
    Posts
    10

    Default

    Great, it worked like a charm!

    Thanks

  4. #4
    Join Date
    Jun 2016
    Posts
    1

    Default

    I'm reviving this topic as I'm having the same issue, but this solution does not seem to work for me. Specifying the table name in the attribute and the measuregroup does not work when you are using aggregate tables. In that case, the table that should be in the city attribute is depending on which measureGroup is used for the query.

    Any ideas on how to resolve this situation?

    Thanks!

Posting Permissions

  • You may not post new threads
  • You may not post replies
  • You may not post attachments
  • You may not edit your posts
  •  
Privacy Policy | Legal Notices | Safe Harbor Privacy Policy

Copyright © 2005 - 2019 Hitachi Vantara Corporation. All Rights Reserved.