Skip to content

Commit

Permalink
MONDRIAN: Fix bug 645744 (problem getting children of member of hiera…
Browse files Browse the repository at this point in the history
…rchy based on a join).

[git-p4: depot-paths = "//open/mondrian/": change = 240]
  • Loading branch information
julianhyde committed Dec 2, 2002
1 parent a6bf9da commit f69d4ca
Show file tree
Hide file tree
Showing 2 changed files with 37 additions and 0 deletions.
1 change: 1 addition & 0 deletions src/main/mondrian/rolap/SqlMemberSource.java
Expand Up @@ -485,6 +485,7 @@ String makeChildMemberSql(RolapMember member)
if (level.isAll()) {
continue;
}
hierarchy.addToFrom(sqlQuery, level.nameExp, null);
String q = level.nameExp.getExpression(sqlQuery);
sqlQuery.addWhere(q + " = " + m.quoteKeyForSql());
if (level.unique) {
Expand Down
36 changes: 36 additions & 0 deletions src/main/mondrian/test/FoodMartTestCase.java
Expand Up @@ -1765,6 +1765,42 @@ public void testSchemaTopLevelNotUnique() {
// uniqueNames="true"
}

/**
* Bug 645744 happens when getting the children of a member crosses a table
* boundary. The symptom
*/
public void testBug645744() {
// minimal test case
runQueryCheckResult(
"select {[Measures].[Unit Sales]} ON columns," + nl +
"{[Product].[All Products].[Drink].[Beverages].[Drinks].[Flavored Drinks].children} ON rows" + nl +
"from [Sales]",

"Axis #0:" + nl +
"{}" + nl +
"Axis #1:" + nl +
"{[Measures].[Unit Sales]}" + nl +
"Axis #2:" + nl +
"{[Product].[All Products].[Drink].[Beverages].[Drinks].[Flavored Drinks].[Excellent]}" + nl +
"{[Product].[All Products].[Drink].[Beverages].[Drinks].[Flavored Drinks].[Fabulous]}" + nl +
"{[Product].[All Products].[Drink].[Beverages].[Drinks].[Flavored Drinks].[Skinner]}" + nl +
"{[Product].[All Products].[Drink].[Beverages].[Drinks].[Flavored Drinks].[Token]}" + nl +
"{[Product].[All Products].[Drink].[Beverages].[Drinks].[Flavored Drinks].[Washington]}" + nl +
"Row #0: 468" + nl +
"Row #1: 469" + nl +
"Row #2: 506" + nl +
"Row #3: 466" + nl +
"Row #4: 560" + nl);

// shorter test case
runQuery(
"select {[Measures].[Unit Sales], [Measures].[Store Cost], [Measures].[Store Sales]} ON columns,"+
"ToggleDrillState({"+
"([Promotion Media].[All Media].[Radio], [Product].[All Products].[Drink].[Beverages].[Drinks].[Flavored Drinks])"+
"}, {[Product].[All Products].[Drink].[Beverages].[Drinks].[Flavored Drinks]}) ON rows "+
"from [Sales] where ([Time].[1997])");
}

/**
* The bug happened when a cell which was in cache was compared with a cell
* which was not in cache. The compare method could not deal with the
Expand Down

0 comments on commit f69d4ca

Please sign in to comment.