Skip to content

Commit

Permalink
MONDRIAN: Fix bug 804903: ArrayIndexOutOfBoundsException when using '…
Browse files Browse the repository at this point in the history
…count distinct' measure and no others.

[git-p4: depot-paths = "//open/mondrian/": change = 769]
  • Loading branch information
julianhyde committed Sep 12, 2003
1 parent 2bab626 commit 6c7f6cb
Show file tree
Hide file tree
Showing 2 changed files with 25 additions and 3 deletions.
9 changes: 6 additions & 3 deletions src/main/mondrian/rolap/agg/AggregationManager.java
Expand Up @@ -118,9 +118,12 @@ public void loadAggregations(ArrayList batches, Collection pinnedSegments) {
distinctMeasuresList.toArray(new RolapStar.Measure[0]);
loadAggregation(measures, columns, constraintses, pinnedSegments);
}
RolapStar.Measure[] measures = (RolapStar.Measure[])
measuresList.toArray(new RolapStar.Measure[0]);
loadAggregation(measures, columns, constraintses, pinnedSegments);
final int measureCount = measuresList.size();
if (measureCount > 0) {
RolapStar.Measure[] measures = (RolapStar.Measure[])
measuresList.toArray(new RolapStar.Measure[measureCount]);
loadAggregation(measures, columns, constraintses, pinnedSegments);
}
}
}

Expand Down
19 changes: 19 additions & 0 deletions src/main/mondrian/test/BasicQueryTest.java
Expand Up @@ -1861,6 +1861,25 @@ public void testBug761952() {
"{[Gender].[All Gender].[M]}" + nl +
"Row #0: 131,558" + nl +
"Row #1: 135,215" + nl);
}
/**
* Query with distinct-count measure and no other measures gives
* {@link ArrayIndexOutOfBoundsException}
*/
public void testBug804903() {
CachePool.instance().flush();
runQueryCheckResult(
"select {[Measures].[Customer Count]} ON columns," + nl +
" {([Promotion Media].[All Media], [Product].[All Products])} ON rows" + nl +
"from [Sales]" + nl +
"where [Time].[1997]",
"Axis #0:" + nl +
"{[Time].[1997]}" + nl +
"Axis #1:" + nl +
"{[Measures].[Customer Count]}" + nl +
"Axis #2:" + nl +
"{[Promotion Media].[All Media], [Product].[All Products]}" + nl +
"Row #0: 5,581" + nl);
}
/** Make sure that the "Store" cube is working. **/
public void testStoreCube() {
Expand Down

0 comments on commit 6c7f6cb

Please sign in to comment.