[Mondrian] [ 1955815 ] Cartesian Join in SQL from MDX against virtual cube

Will Gorman wgorman at pentaho.com
Wed Jul 16 22:21:02 EDT 2008


Hi Julian,

I'm investigating bug #1955815, the virtual cube cartesian join issue.
I've confirmed that this issue existed in 2.4.2, making sure it wasn't a
regression in 3.0.  when generating a non-empty tuple with a filter, the
SqlTupleReader creates SQL that contains the Tuple's join to it's fact
table, but also a constraint join to the measure's fact table based on
the current evaluation context, which contains the a filtered member.

I've added the following if statement within
SqlTupleReader.generateSelectForLevels to verify that the constraint's
evaluation context base cube matches that of the current Tuple's base
cube.  Do you think this is a reasonable approach?

        // if we're a virtual cube (baseCube != null), only apply the 
        // constraint if it maps to the current base cube.
        if (baseCube == null || 
        		constraint.getEvaluator().getMeasureCube().equals(baseCube)) {
        	constraint.addConstraint(sqlQuery, baseCube);
        }

All the tests pass with this change, and the cartesian join no longer
occurs.  My knowledge of how to apply non-empty constraints to virtual
cubes where the filter doesn't match the tuple is limited, so your
thoughts are appreciated!

Thanks!

Will




More information about the Mondrian mailing list