diff --git a/src/org/olap4j/query/Olap4jNodeConverter.java b/src/org/olap4j/query/Olap4jNodeConverter.java index 26478f6..165f067 100644 --- a/src/org/olap4j/query/Olap4jNodeConverter.java +++ b/src/org/olap4j/query/Olap4jNodeConverter.java @@ -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(); @@ -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 members = toOlap4j(dimension); @@ -339,7 +342,10 @@ private static ParseTreeNode toOlap4j( private static List toOlap4j(List axes) { final ArrayList axisList = new ArrayList(); for (QueryAxis axis : axes) { - axisList.add(toOlap4j(axis)); + AxisNode axisNode = toOlap4j(axis); + if (axisNode != null) { + axisList.add(toOlap4j(axis)); + } } return axisList; }