Skip to content

Commit

Permalink
XmlaOlap4jCellSet now treats a missing filter axis the same as a
Browse files Browse the repository at this point in the history
filter axis with one empty tuple. Both signify a missing WHERE clause;
the former is expected by Excel 2007 and is now the behavior of
Mondrian.

Also some cosmetic changes.


git-svn-id: https://olap4j.svn.sourceforge.net/svnroot/olap4j/trunk@524 c6a108a4-781c-0410-a6c6-c2d559e19af0
  • Loading branch information
julianhyde committed Mar 21, 2012
1 parent 5838d7c commit 08f2550
Show file tree
Hide file tree
Showing 3 changed files with 15 additions and 9 deletions.
13 changes: 9 additions & 4 deletions src/org/olap4j/driver/xmla/XmlaOlap4jCellSet.java
Original file line number Diff line number Diff line change
Expand Up @@ -291,15 +291,20 @@ void populate() throws OlapException {
}
}

// If XMLA did not return a filter axis, it means that the WHERE clause
// evaluated to zero tuples. (If the query had no WHERE clause, it
// would have evaluated to a single tuple with zero positions.)
// If XMLA did not return a filter axis, it means that there was no
// WHERE. This is equivalent to a slicer axis with one tuple that has
// zero positions. (Versions of Mondrian before 3.4 do, in fact, return
// a slicer axis with one empty position. This CellSet should behave the
// same.)
if (filterAxis == null) {
filterAxis =
new XmlaOlap4jCellSetAxis(
this,
Axis.FILTER,
Collections.<Position>emptyList());
Collections.<Position>singletonList(
new XmlaOlap4jPosition(
Collections.<Member>emptyList(),
0)));
}

final Element cellDataNode = findChild(root, MDDATASET_NS, "CellData");
Expand Down
5 changes: 3 additions & 2 deletions src/org/olap4j/driver/xmla/XmlaOlap4jConnection.java
Original file line number Diff line number Diff line change
Expand Up @@ -325,11 +325,12 @@ String makeConnectionPropertyList() throws OlapException {
propPopulation.set(true);
this.olap4jDatabaseProperties = new HashSet<String>();
final ResultSet rs =
this.olap4jDatabaseMetaData.getDatabaseProperties(null, null);
olap4jDatabaseMetaData.getDatabaseProperties(null, null);
try {
while (rs.next()) {
String property =
rs.getString(XmlaConstants.Literal.PROPERTY_NAME.name());
rs.getString(
XmlaConstants.Literal.PROPERTY_NAME.name());
if (property != null) {
property = property.toUpperCase();
olap4jDatabaseProperties.add(property);
Expand Down
6 changes: 3 additions & 3 deletions testsrc/org/olap4j/ConnectionTest.java
Original file line number Diff line number Diff line change
Expand Up @@ -19,8 +19,6 @@
*/
package org.olap4j;

import mondrian.olap.MondrianProperties;

import org.olap4j.driver.xmla.XmlaOlap4jDriver;
import org.olap4j.impl.Bug;
import org.olap4j.impl.Olap4jUtil;
Expand All @@ -35,6 +33,8 @@
import junit.framework.AssertionFailedError;
import junit.framework.TestCase;

import mondrian.olap.MondrianProperties;

import java.io.*;
import java.lang.reflect.InvocationTargetException;
import java.sql.*;
Expand Down Expand Up @@ -3086,7 +3086,7 @@ public void testCubesDrillthroughReturnClause6() throws Exception {
rs,
"ROW:1.27,\n"
+ "ROW:1.95,\n"
+"ROW:2.82,\n"
+ "ROW:2.82,\n"
+ "ROW:2.84,\n"
+ "ROW:3.46,\n");
}
Expand Down

0 comments on commit 08f2550

Please sign in to comment.