use of mondrian.olap.Result in project mondrian by pentaho.
the class FunctionTest method testUnionQuery.
public void testUnionQuery() {
Result result = executeQuery("select {[Measures].[Unit Sales], " + "[Measures].[Store Cost], " + "[Measures].[Store Sales]} on columns,\n" + " Hierarchize(\n" + " Union(\n" + " Crossjoin(\n" + " Crossjoin([Gender].[All Gender].children,\n" + " [Marital Status].[All Marital Status].children),\n" + " Crossjoin([Customers].[All Customers].children,\n" + " [Product].[All Products].children) ),\n" + " Crossjoin({([Gender].[All Gender].[M], [Marital Status].[All Marital Status].[M])},\n" + " Crossjoin(\n" + " [Customers].[All Customers].[USA].children,\n" + " [Product].[All Products].children) ) )) on rows\n" + "from Sales where ([Time].[1997])");
final Axis rowsAxis = result.getAxes()[1];
Assert.assertEquals(45, rowsAxis.getPositions().size());
}
use of mondrian.olap.Result in project mondrian by pentaho.
the class FunctionTest method testBrokenContextBug.
public void testBrokenContextBug() {
Result result = executeQuery("with\n" + " member Measures.[Sales Per Customer] as 'Measures.[Sales Count] / Measures.[Customer Count]'\n" + " member Measures.[Coal] as 'coalesceempty(([Measures].[Sales Per Customer], [Store].[All Stores]" + ".[Mexico].[DF]),\n" + " Measures.[Sales Per Customer])'\n" + "select \n" + " {Measures.[Coal]} on columns,\n" + " {[Store].[All Stores].[USA].[WA]} on rows\n" + "from \n" + " [Sales]\n" + "where\n" + " ([Time].[1997].[Q2])");
checkDataResults(new Double[][] { { new Double(8.963) } }, result, 0.001);
}
use of mondrian.olap.Result in project mondrian by pentaho.
the class FunctionTest method testFirstInLevel.
public void testFirstInLevel() {
Result result = executeQuery("select {[Gender].[F].PrevMember} ON COLUMNS from Sales");
assertEquals(0, result.getAxes()[0].getPositions().size());
}
use of mondrian.olap.Result in project mondrian by pentaho.
the class FunctionTest method testFilterCompound.
public void testFilterCompound() {
Result result = executeQuery("select {[Measures].[Unit Sales]} on columns,\n" + " Filter(\n" + " CrossJoin(\n" + " [Gender].Children,\n" + " [Customers].[USA].Children),\n" + " [Measures].[Unit Sales] > 9500) on rows\n" + "from Sales\n" + "where ([Time].[1997].[Q1])");
List<Position> rows = result.getAxes()[1].getPositions();
Assert.assertEquals(3, rows.size());
Assert.assertEquals("F", rows.get(0).get(0).getName());
Assert.assertEquals("WA", rows.get(0).get(1).getName());
Assert.assertEquals("M", rows.get(1).get(0).getName());
Assert.assertEquals("OR", rows.get(1).get(1).getName());
Assert.assertEquals("M", rows.get(2).get(0).getName());
Assert.assertEquals("WA", rows.get(2).get(1).getName());
}
use of mondrian.olap.Result in project mondrian by pentaho.
the class FunctionTest method testAll.
public void testAll() {
Result result = executeQuery("select {[Gender].PrevMember} ON COLUMNS from Sales");
// previous to [Gender].[All] is null, so no members are returned
assertEquals(0, result.getAxes()[0].getPositions().size());
}
Aggregations