There seems to be a bug with snowflake hierarchies that causes Aggregate tables to join using the wrong column name in some situations.
(I will attach a sample testmart.xml to go along with this example)
If for example, there is a Dimension based on Family => Genus => Species using tables DIM_FAMILY, DIM_GENUS, DIM_SPECIES
dim_family columns: family_id, family_name
dim_genus columns: family_id, genus_id, genus_name
dim_species columns: genus_id, species_id, species_name
Base Fact columns: species_id, population
Aggregate table's columns: gen_id, population
In this example, for whatever reason, the database designer gave genus_id a different name (gen_id) in the aggregate table. The column name is defined in the AggLevel tag but gets ignored
So for a simple MDX like this:
It runs a query like this:
"DIM_FAMILY"."FAMILY_ID" as "c0",
sum("AGG_SPECIES_MART"."POPULATION") as "m0"
"DIM_FAMILY" as "DIM_FAMILY",
"DIM_GENUS" as "DIM_GENUS",
"AGG_SPECIES_MART" as "AGG_SPECIES_MART"
"AGG_SPECIES_MART"."GENUS_ID" = "DIM_GENUS"."GENUS_ID"
"DIM_GENUS"."FAMILY_ID" = "DIM_FAMILY"."FAMILY_ID"
The problem being that agg_species_mart doesn't have a column called "genus_id", it is "gen_id".
I've identified where in Mondrian's code the column name gets lost and will attach a patch that fixes it in this case.