Skip to content

Commit

Permalink
Browse files Browse the repository at this point in the history
…88/topic/3416385

When no dimensions are included on a query axis, there was an index out of bounds exception thrown. Now it simply skips the axis. One can still validate his query object with the Query.validate() method prior to execution to detect any potential problems.

git-svn-id: https://olap4j.svn.sourceforge.net/svnroot/olap4j/trunk@280 c6a108a4-781c-0410-a6c6-c2d559e19af0
  • Loading branch information
lucboudreau committed Sep 30, 2009
1 parent 2dc01de commit d344db5
Showing 1 changed file with 12 additions and 6 deletions.
18 changes: 12 additions & 6 deletions src/org/olap4j/query/Olap4jNodeConverter.java
Original file line number Diff line number Diff line change
Expand Up @@ -105,11 +105,12 @@ protected static CallNode crossJoin(
getMemberSet(dim2));
}

//
// This method merges the selections into a single
// MDX axis selection. Right now we do a simple
// crossjoin
//
/*
* This method merges the selections into a single
* MDX axis selection. Right now we do a simple
* crossjoin.
* It might return null if there are no dimensions placed on the axis.
*/
private static AxisNode toOlap4j(QueryAxis axis) {
CallNode callNode = null;
int numDimensions = axis.getDimensions().size();
Expand All @@ -124,6 +125,8 @@ private static AxisNode toOlap4j(QueryAxis axis) {
}
}
callNode = generateListTupleCall(members);
} else if (numDimensions == 0) {
return null;
} else if (numDimensions == 1) {
QueryDimension dimension = axis.getDimensions().get(0);
List<ParseTreeNode> members = toOlap4j(dimension);
Expand Down Expand Up @@ -339,7 +342,10 @@ private static ParseTreeNode toOlap4j(
private static List<AxisNode> toOlap4j(List<QueryAxis> axes) {
final ArrayList<AxisNode> axisList = new ArrayList<AxisNode>();
for (QueryAxis axis : axes) {
axisList.add(toOlap4j(axis));
AxisNode axisNode = toOlap4j(axis);
if (axisNode != null) {
axisList.add(toOlap4j(axis));
}
}
return axisList;
}
Expand Down

0 comments on commit d344db5

Please sign in to comment.