Skip to content

Commit

Permalink
MONDRIAN: Fix MONDRIAN-977, "NPE in Query with Crossjoin Descendants …
Browse files Browse the repository at this point in the history
…of Unknown

    Member". Patch contributed by Andreas Voss.

[git-p4: depot-paths = "//open/mondrian/": change = 14539]
  • Loading branch information
julianhyde committed Aug 10, 2011
1 parent 3fc43c3 commit 901dfa2
Show file tree
Hide file tree
Showing 2 changed files with 25 additions and 0 deletions.
3 changes: 3 additions & 0 deletions src/main/mondrian/rolap/SqlConstraintUtils.java
Expand Up @@ -1161,6 +1161,9 @@ private static String generateSingleValueInExpr(
if (m.isAll()) {
continue;
}
if (m.isNull()) {
return "1 = 0";
}
if (m.isCalculated() && !m.isParentChildLeaf()) {
if (restrictMemberTypes) {
throw Util.newInternal(
Expand Down
22 changes: 22 additions & 0 deletions testsrc/main/mondrian/test/BasicQueryTest.java
Expand Up @@ -3521,6 +3521,28 @@ public void testMemberWithNullKey() {
TestContext.assertEqualsVerbose(expected, resultString);
}

/**
* Test case for
* <a href="http://jira.pentaho.com/browse/MONDRIAN-977">MONDRIAN-977,
* "NPE in Query with Crossjoin Descendants of Unknown Member"</a>.
*/
public void testCrossjoinWithDescendantsAndUnknownMember() {
propSaver.set(
MondrianProperties.instance().IgnoreInvalidMembersDuringQuery,
true);
assertQueryReturns(
"select {[Measures].[Unit Sales]} on columns,\n"
+ "NON EMPTY CrossJoin(\n"
+ " Descendants([Product].[All Products], [Product].[Product Family]),\n"
+ " Descendants([Store].[All Stores].[Foo], [Store].[Store State])) on rows\n"
+ "from [Sales]",
"Axis #0:\n"
+ "{}\n"
+ "Axis #1:\n"
+ "{[Measures].[Unit Sales]}\n"
+ "Axis #2:\n");
}

/**
* Slicer contains <code>[Promotion Media].[Daily Paper]</code>, but
* filter expression is in terms of <code>[Promotion Media].[Radio]</code>.
Expand Down

0 comments on commit 901dfa2

Please sign in to comment.