[Mondrian] Parent-child hierachy with no Closure

Will Gorman wgorman at pentaho.org
Mon Jul 30 14:08:50 EDT 2007


Hi Eduardo,

This bug is known and has been fixed.  The next release of Mondrian will
contain the fix:

http://sourceforge.net/tracker/index.php?func=detail&aid=1708327&group_id=35302&atid=414613

If you can't wait until the next release, which is coming out soon, you
will need to implement a closure table to get your parent-child
hierarchy to work properly.

Will

On Mon, 2007-07-30 at 14:38 +0100, Eduardo Andrade wrote:
> Hi, i'm having a problem with Mondrian's parent-child hierarchies. In
> a parent-child hierachy if we don't specify a Closure Element the
> results obtained from Mondrian are different on each version. Tested
> with Mondrian 2.1.1, 2.2.2 and 2.3.2.8944 (Foodmart.xml - with the
> Dimension "Employees" from "HR" Cube).
> 
> --------------------------------------------------------------------------------------------------------------------- 
> <Dimension name="Employees" foreignKey="employee_id">
> <Hierarchy hasAll="true" allMemberName="All Employees"
> primaryKey="employee_id">
> <Table name="employee"/>
> <Level name="Employee Id" type="Numeric" uniqueMembers="true"
> column="employee_id" parentColumn="supervisor_id"
> nameColumn="full_name" nullParentValue="0"> 
> <!--
>    <Closure parentColumn="supervisor_id" childColumn="employee_id">
>       <Table name="employee_closure"/>
>    </Closure>
> -->
> <Property name="Marital Status" column="marital_status"/>
> <Property name="Position Title" column="position_title"/>
> <Property name="Gender" column="gender"/>
> <Property name="Salary" column="salary"/>
> <Property name="Education Level" column="education_level"/>
> <Property name="Management Role" column="management_role"/>
> </Level>
> </Hierarchy>
> </Dimension>
> ---------------------------------------------------------------------------------------------------------------------
> 
> With this JAVA code :
> --------------------------------------------------------------------------------------------------------------------- 
> import mondrian.olap.*;
> import java.io.PrintWriter;
> 
> public class MondrianCCATest {
> 
>     public static void main(String[] args) {
>         String jdbcUrl = "jdbc:mysql://localhost:3306/foodmart"; 
>         String jdbcUser = "foodmart";
>         String jdbcPass = "foodmart";
> 
>         String connectionString = "Provider=mondrian; Locale=pt_PT;
> Jdbc=" + jdbcUrl + "; JdbcUser=" + jdbcUser + "; JdbcPassword=" +
> jdbcPass 
>                 + "; Catalog=file:FoodMart.xml;";
> 
>         Connection connection =
> DriverManager.getConnection(connectionString, null, false);
>         Query query = connection.parseQuery("SELECT {[Measures].[Org
> Salary]} on columns," + " {[Employees].[All Employees].[Sheri
> Nowmer].children} on rows " 
>                 + "FROM [HR] ");
>         Result result = connection.execute(query);
>         Position[] positions = result.getAxes()[1].positions;
>       
>         try {
>             result.print (new PrintWriter("mondrian.html"));
>         } catch (Exception e) {
>             e.printStackTrace();
>         }
>     }
> }
> --------------------------------------------------------------------------------------------------------------------- 
> 
> With Mondrian 2.1.1 I get the list of members correctly :
> - Derrick Whelply
> - Michael Spence
> - Maya Gutierrez
> - Roberta Damstra
> - Rebecca Kanagaki
> - Darren Stanz
> - Donna Arnold
> 
> But with Mondrian 2.2.2 and 2.3.2.8944 I get an empty result. Should I
> log a bug request with this information ?
> 
> Thank you for your time.
> 
> Best Regards,
> 
> -- 
> Eduardo Andrade
> eduardofandrade at gmail.com 
> _______________________________________________
> Mondrian mailing list
> Mondrian at pentaho.org
> http://lists.pentaho.org/mailman/listinfo/mondrian




More information about the Mondrian mailing list