Skip to content

Commit

Permalink
MONDRIAN: fix 3-arg rank with null values
Browse files Browse the repository at this point in the history
[git-p4: depot-paths = "//open/mondrian/": change = 8258]
  • Loading branch information
jsichi committed Dec 6, 2006
1 parent 1ea633f commit dbf7099
Show file tree
Hide file tree
Showing 2 changed files with 22 additions and 1 deletion.
2 changes: 1 addition & 1 deletion src/main/mondrian/olap/fun/RankFunDef.java
Expand Up @@ -356,7 +356,7 @@ public Object evaluate(Evaluator evaluator) {
if (exception == null) {
exception = (RuntimeException) value;
}
} else if (value == Util.nullValue) {
} else if (Util.isNull(value)) {
;
} else {
values[j++] = value;
Expand Down
21 changes: 21 additions & 0 deletions testsrc/main/mondrian/olap/fun/FunctionTest.java
Expand Up @@ -6046,6 +6046,27 @@ public void testRankWithExpr2() {
"1");
}

/**
* Tests the 3-arg version of the RANK function with a value
* which returns null within a set of nulls.
*/
public void testRankWithNulls() {
assertQueryReturns(
"with member [Measures].[X] as " +
"'iif([Measures].[Store Sales]=777," +
"[Measures].[Store Sales],Null)'\n" +
"member [Measures].[Y] as 'Rank([Gender].[M]," +
"{[Measures].[X],[Measures].[X],[Measures].[X]}," +
" [Marital Status].[All Marital Status].Parent)'" +
"select {[Measures].[Y]} on rows from Sales",
fold(
"Axis #0:\n" +
"{}\n" +
"Axis #1:\n" +
"{[Measures].[Y]}\n" +
"Row #0: 1\n"));
}

/**
* Tests a RANK function which is so large that we need to use caching
* in order to execute it efficiently.
Expand Down

0 comments on commit dbf7099

Please sign in to comment.