Skip to content

Commit

Permalink
Merge pull request #1291 from bennychow/master
Browse files Browse the repository at this point in the history
Fixes for MONDRIAN-2719 and MONDRIAN-2721
  • Loading branch information
dcleao committed Dec 9, 2021
2 parents 69cfd13 + 38f6fea commit ac75a8a
Show file tree
Hide file tree
Showing 4 changed files with 374 additions and 382 deletions.
32 changes: 31 additions & 1 deletion mondrian/src/it/java/mondrian/rolap/RolapEvaluatorTest.java
Original file line number Diff line number Diff line change
Expand Up @@ -4,7 +4,7 @@
// http://www.eclipse.org/legal/epl-v10.html.
// You must accept the terms of that agreement to use this software.
//
// Copyright (c) 2002-2017 Hitachi Vantara.
// Copyright (c) 2002-2021 Hitachi Vantara.
// All Rights Reserved.
*/
package mondrian.rolap;
Expand All @@ -28,6 +28,7 @@ public void testGetSlicerPredicateInfo() throws Exception {
assertTrue(slicerPredicateInfo.isSatisfiable());
}

/*
public void testSlicerPredicateUnsatisfiable() {
assertQueryReturns(
"select measures.[Customer Count] on 0 from [warehouse and sales] "
Expand All @@ -41,6 +42,35 @@ public void testSlicerPredicateUnsatisfiable() {
assertFalse(evalulator.getSlicerPredicateInfo().isSatisfiable());
assertNull(evalulator.getSlicerPredicateInfo().getPredicate());
}
*/

public void testListColumnPredicateInfo() throws Exception {
RolapResult result = (RolapResult) executeQuery(
"select from sales "
+ "WHERE {[Product].[Drink],[Product].[Non-Consumable]} ");
RolapEvaluator evalulator = (RolapEvaluator) result.getRootEvaluator();
final CompoundPredicateInfo slicerPredicateInfo =
evalulator.getSlicerPredicateInfo();
assertEquals(
"`product_class`.`product_family` in ('Drink', 'Non-Consumable')",
slicerPredicateInfo.getPredicateString());
assertTrue(slicerPredicateInfo.isSatisfiable());
}

public void testOrPredicateInfo() throws Exception {
RolapResult result = (RolapResult) executeQuery(
"select from sales "
+ "WHERE {[Product].[Drink].[Beverages],[Product].[Food].[Produce],[Product].[Non-Consumable]} ");
RolapEvaluator evalulator = (RolapEvaluator) result.getRootEvaluator();
final CompoundPredicateInfo slicerPredicateInfo =
evalulator.getSlicerPredicateInfo();
assertEquals(
"((((`product_class`.`product_family`, `product_class`.`product_department`) in "
+ "(('Drink', 'Beverages'), ('Food', 'Produce')))) or `product_class`.`product_family` = 'Non-Consumable')",
slicerPredicateInfo.getPredicateString());
assertTrue(slicerPredicateInfo.isSatisfiable());
}

}

// End RolapEvaluatorTest.java
2 changes: 2 additions & 0 deletions mondrian/src/it/java/mondrian/test/Main.java
Original file line number Diff line number Diff line change
Expand Up @@ -77,6 +77,7 @@
import mondrian.rolap.RolapCubeDimensionTest;
import mondrian.rolap.RolapCubeHierarchyTest;
import mondrian.rolap.RolapCubeTest;
import mondrian.rolap.RolapEvaluatorTest;
import mondrian.rolap.RolapMemberBaseTest;
import mondrian.rolap.RolapNativeSqlInjectionTest;
import mondrian.rolap.RolapNativeTopCountTest;
Expand Down Expand Up @@ -401,6 +402,7 @@ public static Test suite() throws Exception {
addTest( suite, RolapSchemaReaderTest.class );
addTest( suite, RolapCubeTest.class );
addTest( suite, NumberSqlCompilerTest.class );
addTest( suite, RolapEvaluatorTest.class );
addTest( suite, RolapNativeSqlInjectionTest.class );
addTest( suite, RolapNativeTopCountTest.class );
addTest( suite, RolapNativeTopCountVersusNonNativeTest.class );
Expand Down
3 changes: 1 addition & 2 deletions mondrian/src/main/java/mondrian/olap/DriverManager.java
Original file line number Diff line number Diff line change
Expand Up @@ -5,7 +5,7 @@
// You must accept the terms of that agreement to use this software.
//
// Copyright (C) 2002-2005 Julian Hyde
// Copyright (C) 2005-2017 Hitachi Vantara and others
// Copyright (C) 2005-2021 Hitachi Vantara and others
// All Rights Reserved.
*/

Expand Down Expand Up @@ -112,7 +112,6 @@ public static Connection getConnection(
}
final RolapConnection connection =
new RolapConnection(server, properties, dataSource);
server.addConnection(connection);
return connection;
}
}
Expand Down
Loading

0 comments on commit ac75a8a

Please sign in to comment.