[Mondrian] problem in using <Query> element and <Table> element inside <Join> - mondrian

Radha Ranjan Madhaw RMadhaw at facetime.com
Mon May 26 11:15:47 EDT 2008


Hi,

 

My fact table is connecting to a dimension table Product, which in turn
refers to Category which in turn refers to Type - so it's a snowflake
design.

 

As per the documentation on schema design available in the latest
Mondrian distribution, which mentions that:

 

Section 4:

 

 "...element because <Join> takes two operands; the operands can be
tables, joins, or even queries. "

 

I'm trying to use following:

<Dimension name="DimProduct">

<Hierarchy hasAll="true" primaryKey="id" primaryKeyTable="dim_products">

                        <Join leftKey="gcategoryid" rightAlias="types"
rightKey="id">

                                    <Table name="dim_products"/>

                                    <Query>

                                                <SQL dialect="generic">

                                                            select
cat.id as id, cat.name as categoryName, typ.name as typeName

                                                            from
dim_categories cat, dim_types typ

                                                            where
cat.gtypeid=typ.id

                                                </SQL>

                                    </Query>

                        </Join>

                        <Level name="Product Name" table="dim_products"
column="name" type="String" uniqueMembers="false"/>

                        <Level name="Product Desription"
table="dim_products" column="description" type="String"
uniqueMembers="false"/>

                        <Level name="Category Name" table="types"
column="categoryName" type="String" uniqueMembers="false"/>

            </Hierarchy>

</Dimension>

 

but it gives an error as following:

 

Caused by: org.eigenbase.xom.XOMException: In Schema: In Dimension: In
Hierarchy: In Join: element <Query> is not of exp

ected type mondrian.olap.MondrianDef$RelationOrJoin

      at mondrian.olap.MondrianDef$Schema.<init>(MondrianDef.java:139)

      at mondrian.rolap.RolapSchema.load(RolapSchema.java:324)

      ... 23 more

 

I've also tried a nested join in place of <Query> element as following:

 

<Dimension name="DimProduct">

<Hierarchy hasAll="true" primaryKey="id" primaryKeyTable="dim_products">

                        <Join leftKey="gcategoryid" rightAlias="types"
rightKey="id">

                                    <Table name="dim_products"/>

                                    <Join leftKey="gtypeid"
rightKey="id">

                                                <Table
name="dim_categories"/>

                                                <Table
name="dim_types"/>

                                    </Join-->

</Join>

                        <Level name="Product Name" table="dim_products"
column="name" type="String" uniqueMembers="false"/>

                        <Level name="Product Desription"
table="dim_products" column="description" type="String"
uniqueMembers="false"/>

                        <Level name="Category Name" table="types"
column="categoryName" type="String" uniqueMembers="false"/>

            </Hierarchy>

</Dimension>

 

but that gives some error as following:

 

Exception in thread "main" java.lang.UnsupportedOperationException

      at
mondrian.rolap.RolapCubeHierarchy.extractNewAliases(RolapCubeHierarchy.j
ava:181)

      at
mondrian.rolap.RolapCubeHierarchy.extractNewAliases(RolapCubeHierarchy.j
ava:178)

      at
mondrian.rolap.RolapCubeHierarchy.extractNewAliases(RolapCubeHierarchy.j
ava:179)

.......

 

Can anyone help me figure out the problem?

 

Regards,

Madhav

 

-------------- next part --------------
An HTML attachment was scrubbed...
URL: http://lists.pentaho.org/pipermail/mondrian/attachments/20080526/31e14961/attachment.html 


More information about the Mondrian mailing list