use of mondrian.olap.Result in project mondrian by pentaho.
the class BasicQueryTest method testFilteredCrossJoin.
/**
* This resulted in {@link OutOfMemoryError} when the BatchingCellReader did not know the values for the tuples that
* were used in filters.
*/
public void testFilteredCrossJoin() {
TestContext.instance().flushSchemaCache();
Result result = executeQuery("select {[Measures].[Store Sales]} on columns,\n" + " NON EMPTY Crossjoin(\n" + " Filter([Customers].[Name].Members,\n" + " (([Measures].[Store Sales],\n" + " [Store].[All Stores].[USA].[CA].[San Francisco].[Store 14],\n" + " [Time].[1997].[Q1].[1]) > 5.0)),\n" + " Filter([Product].[Product Name].Members,\n" + " (([Measures].[Store Sales],\n" + " [Store].[All Stores].[USA].[CA].[San Francisco].[Store 14],\n" + " [Time].[1997].[Q1].[1]) > 5.0))\n" + " ) ON rows\n" + "from [Sales]\n" + "where (\n" + " [Store].[All Stores].[USA].[CA].[San Francisco].[Store 14],\n" + " [Time].[1997].[Q1].[1]\n" + ")\n");
// ok if no OutOfMemoryError occurs
Axis a = result.getAxes()[1];
assertEquals(12, a.getPositions().size());
}
use of mondrian.olap.Result in project mondrian by pentaho.
the class BasicQueryTest method testAllLevelName.
public void testAllLevelName() {
TestContext testContext = TestContext.instance().createSubstitutingCube("Sales", "<Dimension name=\"Gender4\" foreignKey=\"customer_id\">\n" + " <Hierarchy hasAll=\"true\" allMemberName=\"All Gender\"\n" + " allLevelName=\"GenderLevel\" primaryKey=\"customer_id\">\n" + " <Table name=\"customer\"/>\n" + " <Level name=\"Gender\" column=\"gender\" uniqueMembers=\"true\"/>\n" + " </Hierarchy>\n" + "</Dimension>");
String mdx = "select {[Gender4].[All Gender]} on columns from Sales";
Result result = testContext.executeQuery(mdx);
Axis axis0 = result.getAxes()[0];
Position pos0 = axis0.getPositions().get(0);
Member allGender = pos0.get(0);
String caption = allGender.getLevel().getName();
Assert.assertEquals(caption, "GenderLevel");
}
use of mondrian.olap.Result in project mondrian by pentaho.
the class BasicQueryTest method testNonEmptyCrossJoin.
/**
* Tests a query with a CrossJoin so large that we run out of memory unless we can push down evaluation to SQL.
*/
public void testNonEmptyCrossJoin() {
if (!props.EnableNativeCrossJoin.get()) {
// memory.
return;
}
TestContext.instance().flushSchemaCache();
Result result = executeQuery("select {[Measures].[Store Sales]} on columns,\n" + " NON EMPTY Crossjoin(\n" + " [Customers].[Name].Members,\n" + " [Product].[Product Name].Members\n" + " ) ON rows\n" + "from [Sales]\n" + "where (\n" + " [Store].[All Stores].[USA].[CA].[San Francisco].[Store 14],\n" + " [Time].[1997].[Q1].[1]\n" + ")\n");
// ok if no OutOfMemoryError occurs
Axis a = result.getAxes()[1];
assertEquals(67, a.getPositions().size());
}
use of mondrian.olap.Result in project mondrian by pentaho.
the class BasicQueryTest method testMembersOfLargeDimensionTheHardWay.
public void testMembersOfLargeDimensionTheHardWay() {
// Avoid this test if memory is scarce.
if (Bug.avoidMemoryOverflow(TestContext.instance().getDialect())) {
return;
}
final Connection connection = TestContext.instance().getConnection();
String queryString = "select {[Measures].[Unit Sales]} on columns,\n" + "{[Customers].members} on rows\n" + "from Sales";
Query query = connection.parseQuery(queryString);
Result result = connection.execute(query);
assertEquals(10407, result.getAxes()[1].getPositions().size());
}
use of mondrian.olap.Result in project mondrian by pentaho.
the class BasicQueryTest method testBug1630754.
/**
* Tests for bug #1630754. In Mondrian 2.2.2 the SqlTupleReader.readTuples method would create a SQL having an
* in-clause with more that 1000 entities under some circumstances. This exceeded the limit for Oracle resulting in an
* ORA-01795 error.
*/
public void testBug1630754() {
// In order to reproduce this bug a dimension with 2 levels with more
// than 1000 member each was necessary. The customer_id column has more
// than 1000 distinct members so it was used for this test.
TestContext testContext = TestContext.instance().createSubstitutingCube("Sales", " <Dimension name=\"Customer_2\" foreignKey=\"customer_id\">\n" + " <Hierarchy hasAll=\"true\" " + "allMemberName=\"All Customers\" " + "primaryKey=\"customer_id\" " + " >\n" + " <Table name=\"customer\"/>\n" + " <Level name=\"Name1\" column=\"customer_id\" uniqueMembers=\"true\"/>" + " <Level name=\"Name2\" column=\"customer_id\" uniqueMembers=\"true\"/>\n" + " </Hierarchy>\n" + " </Dimension>");
Result result = testContext.executeQuery("WITH SET [#DataSet#] AS " + " 'NonEmptyCrossjoin({Descendants([Customer_2].[All Customers], 2)}, " + " {[Product].[All Products]})' " + "SELECT {[Measures].[Unit Sales], [Measures].[Store Sales]} on columns, " + "Hierarchize({[#DataSet#]}) on rows FROM [Sales]");
final int rowCount = result.getAxes()[1].getPositions().size();
assertEquals(5581, rowCount);
}
Aggregations