Skip to content

Commit

Permalink
MONDRIAN: fix test problem in 9654; also fixing original code logic.
Browse files Browse the repository at this point in the history
[git-p4: depot-paths = "//open/mondrian/": change = 9656]
  • Loading branch information
Rushan Chen committed Jul 26, 2007
1 parent caf84cc commit cc9e44a
Show file tree
Hide file tree
Showing 3 changed files with 10 additions and 15 deletions.
1 change: 0 additions & 1 deletion src/main/mondrian/rolap/RolapNativeSet.java
Expand Up @@ -9,7 +9,6 @@
package mondrian.rolap;

import java.util.*;
import java.sql.*;

import mondrian.calc.ExpCompiler;
import mondrian.calc.ListCalc;
Expand Down
7 changes: 4 additions & 3 deletions src/main/mondrian/rolap/SqlConstraintUtils.java
Expand Up @@ -729,15 +729,16 @@ private static String generateMultiValueInExpr(
sqlQuery.getDialect(),
level.getDatatype());

if (RolapUtil.mdxNullLiteral.equalsIgnoreCase(value)) {
if (RolapUtil.mdxNullLiteral.equalsIgnoreCase(value)) {
RolapMember mp = m.getParentMember();
// Add to the nullParent map
List<RolapMember> childrenList =
parentWithNullToChildrenMap.get(p);
parentWithNullToChildrenMap.get(mp);
if (childrenList == null) {
childrenList = new ArrayList<RolapMember>();
}
childrenList.add(m);
parentWithNullToChildrenMap.put(m.getParentMember(), childrenList);
parentWithNullToChildrenMap.put(mp, childrenList);
// Skip generating condition for this parent
containsNull = true;
break;
Expand Down
17 changes: 6 additions & 11 deletions testsrc/main/mondrian/rolap/NonEmptyTest.java
Expand Up @@ -1260,10 +1260,6 @@ public void testCjChildrenChildren() {
* (1) User IN list if possible
* (2) Group members sharing the same parent
* (3) Only need to compare up to the first unique parent level.
*
* Note: matching SQL pattern only works if the SQL is run in the same
* thread, which is the case with Derby. For LucidDB dialect, the
* generated SQL is verified manually.
*/
public void testMultiLevelMemberConstraint() {
String query =
Expand All @@ -1272,7 +1268,7 @@ public void testMultiLevelMemberConstraint() {
"set [NECJ] as NonEmptyCrossJoin([Filtered Store City Set], {[Product].[Product Family].Food}) " +
"select [NECJ] on rows from [Sales]";

String necjSql =
String necjSqlDerby =
"select " +
"\"store\".\"store_country\", \"store\".\"store_state\", \"store\".\"store_city\", " +
"\"product_class\".\"product_family\" " +
Expand All @@ -1291,15 +1287,16 @@ public void testMultiLevelMemberConstraint() {

SqlPattern[] patterns =
new SqlPattern[] {
new SqlPattern(SqlPattern.DERBY_DIALECT, necjSql, necjSql)
new SqlPattern(SqlPattern.DERBY_DIALECT, necjSqlDerby, necjSqlDerby)
};

assertQuerySql(query, patterns);
}

/**
* Check that multi-level member list generates compact form of SQL where clause:
* (1) User IN list if possible(not possible if there are null values)
* (1) User IN list if possible(not possible if there are null values because
* NULLs do not match)
* (2) Group members sharing the same parent
* (3) Only need to compare up to the first unique parent level.
*/
Expand Down Expand Up @@ -1330,7 +1327,7 @@ public void testMultiLevelMemberConstraintWithNull() {
"set [NECJ] as NonEmptyCrossJoin([Filtered Warehouse Set], {[Product].[Product Family].Food})\n" +
"select [NECJ] on rows from [Warehouse2]\n";

String necjSql =
String necjSqlDerby =
"select " +
"\"warehouse\".\"wa_address3\", \"warehouse\".\"wa_address2\", \"warehouse\".\"wa_address1\", \"warehouse\".\"warehouse_name\", " +
"\"product_class\".\"product_family\" " +
Expand Down Expand Up @@ -1362,9 +1359,7 @@ public void testMultiLevelMemberConstraintWithNull() {

SqlPattern[] patterns =
new SqlPattern[] {
new SqlPattern(
SqlPattern.getDialect(testContext.getDialect()),
necjSql, necjSql)
new SqlPattern(SqlPattern.DERBY_DIALECT, necjSqlDerby, necjSqlDerby)
};

assertQuerySql(testContext, query, patterns);
Expand Down

0 comments on commit cc9e44a

Please sign in to comment.