From 0ef441480c71c54981ee275b308c588a3b90d2f3 Mon Sep 17 00:00:00 2001 From: Julian Hyde Date: Tue, 16 Nov 2010 21:37:12 +0000 Subject: [PATCH] Upgrade to version of mondrian that implements latest API. Update URL for JDK javadoc. Clarify API doc regarding filter axis when WHERE clause is non-existent or evaluates to empty set of tuples. Fix XMLA driver and test accordingly. git-svn-id: https://olap4j.svn.sourceforge.net/svnroot/olap4j/trunk@368 c6a108a4-781c-0410-a6c6-c2d559e19af0 --- build.xml | 8 ++++---- ivy.xml | 2 +- src/org/olap4j/CellSet.java | 20 ++++++++++++------- .../olap4j/driver/xmla/XmlaOlap4jCellSet.java | 10 ++++------ testsrc/org/olap4j/ConnectionTest.java | 2 +- 5 files changed, 23 insertions(+), 19 deletions(-) diff --git a/build.xml b/build.xml index 263f899..9cad265 100644 --- a/build.xml +++ b/build.xml @@ -3,7 +3,7 @@ == This software is subject to the terms of the Eclipse Public License v1.0 == Agreement, available at the following URL: == http://www.eclipse.org/legal/epl-v10.html. - == Copyright (C) 2006-2009 Julian Hyde and others. + == Copyright (C) 2006-2010 Julian Hyde and others. == All Rights Reserved. == You must accept the terms of that agreement to use this software. --> @@ -272,7 +272,7 @@ META-INF/**" /> - + @@ -291,7 +291,7 @@ META-INF/**" /> - + @@ -315,7 +315,7 @@ META-INF/**" /> - + diff --git a/ivy.xml b/ivy.xml index 270b82f..5159084 100644 --- a/ivy.xml +++ b/ivy.xml @@ -76,7 +76,7 @@ - This axis always has one position, and members of - * dimensions not included in any other axis. Some of these dimensions may - * have been explicitly mentioned in the WHERE clause of the MDX statement; - * others dimensions are represented by their default member. - * - *

In particular, if the query has no WHERE clause, the axis has a single - * position as usual, but the position has no members. + *

If the query has a WHERE clause, the contains the members returned + * by that expression. Most query authors write a WHERE clause so that it + * evaluates to just one member or tuple. The members in this tuple (or + * the sole member), are referred to as the 'slicer context' of the query. + * The tuple contains only members of hierarchies explicitly mentioned in + * the WHERE expression; the slicer context of every hierarchy in the + * query's cube is implicitly the default member of that hierarchy. + * + *

While not typical, note that a query's WHERE clause may also evaluate + * to zero or more than one tuples. + * + *

If the query has no WHERE clause, the filter axis has a single + * position, but the position has no members. * *

The filter axis is not included in the {@link #getAxes()} collection. * diff --git a/src/org/olap4j/driver/xmla/XmlaOlap4jCellSet.java b/src/org/olap4j/driver/xmla/XmlaOlap4jCellSet.java index 7badd8d..e46a5e9 100644 --- a/src/org/olap4j/driver/xmla/XmlaOlap4jCellSet.java +++ b/src/org/olap4j/driver/xmla/XmlaOlap4jCellSet.java @@ -278,17 +278,15 @@ void populate() throws OlapException { } } - // olap4j requires a filter axis even if XMLA does not return one. If - // XMLA does not return one, presumably there was no WHERE clause and - // therefore the filter axis has a single position containing 0 members + // 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 (filterAxis == null) { filterAxis = new XmlaOlap4jCellSetAxis( this, Axis.FILTER, - Collections.singletonList( - new XmlaOlap4jPosition( - Collections.emptyList(), 0))); + Collections.emptyList()); } final Element cellDataNode = findChild(root, MDDATASET_NS, "CellData"); diff --git a/testsrc/org/olap4j/ConnectionTest.java b/testsrc/org/olap4j/ConnectionTest.java index b7fd5f5..1565a9d 100644 --- a/testsrc/org/olap4j/ConnectionTest.java +++ b/testsrc/org/olap4j/ConnectionTest.java @@ -577,7 +577,7 @@ public void testEmptyFilter() throws SQLException { assertEquals(0, filterAxis.getPositionCount()); final List filterPositions = filterAxis.getPositions(); assertEquals(0, filterPositions.size()); - assertEquals(2, filterAxis.getAxisMetaData().getHierarchies().size()); + assertEquals(0, filterAxis.getAxisMetaData().getHierarchies().size()); final Cell cell = cellSet.getCell(Arrays.asList(0, 0)); assertTrue(cell.isNull()); }