Search in sources :

Example 26 with Result

use of mondrian.olap.Result in project mondrian by pentaho.

the class BUG_1541077 method testStoreCount.

public void testStoreCount() throws Exception {
    if (!isApplicable()) {
        return;
    }
    MondrianProperties props = MondrianProperties.instance();
    // get value without aggregates
    propSaver.set(props.UseAggregates, false);
    String mdx = "select {[Measures].[Store Count]} on columns from Cheques";
    Result result = getTestContext().executeQuery(mdx);
    Object v = result.getCell(new int[] { 0 }).getValue();
    propSaver.set(props.UseAggregates, true);
    Result result1 = getTestContext().executeQuery(mdx);
    Object v1 = result1.getCell(new int[] { 0 }).getValue();
    assertTrue(v.equals(v1));
}
Also used : MondrianProperties(mondrian.olap.MondrianProperties) Result(mondrian.olap.Result)

Example 27 with Result

use of mondrian.olap.Result in project mondrian by pentaho.

the class Checkin_7641 method testImplicitMember.

public void testImplicitMember() throws Exception {
    // explicit use of [Product].[Class1]
    String mdx = " select NON EMPTY Crossjoin(" + " Hierarchize(Union({[Product].[Class1]}, " + "[Product].[Class1].Children)), " + " {[Measures].[Requested Value], " + " [Measures].[Shipped Value]}" + ") ON COLUMNS," + " NON EMPTY Hierarchize(Union({[Geography].[All Regions]}," + "[Geography].[All Regions].Children)) ON ROWS" + " from [ImplicitMember]";
    Result result1 = getTestContext().executeQuery(mdx);
    String resultString1 = TestContext.toString(result1);
    Result result2 = getTestContext().executeQuery(mdx);
    String resultString2 = TestContext.toString(result2);
    assertEquals(resultString1, resultString2);
}
Also used : Result(mondrian.olap.Result)

Example 28 with Result

use of mondrian.olap.Result in project mondrian by pentaho.

the class MultipleColsInTupleAggTest method testTotal.

public void testTotal() throws Exception {
    if (!isApplicable()) {
        return;
    }
    MondrianProperties props = MondrianProperties.instance();
    // get value without aggregates
    propSaver.set(props.UseAggregates, false);
    propSaver.set(props.ReadAggregates, false);
    String mdx = "select {[Measures].[Total]} on columns from [Fact]";
    Result result = getTestContext().executeQuery(mdx);
    Object v = result.getCell(new int[] { 0 }).getValue();
    String mdx2 = "select {[Measures].[Total]} on columns from [Fact] where " + "{[Product].[Cat One].[Prod Cat One].[One]}";
    Result aresult = getTestContext().executeQuery(mdx2);
    Object av = aresult.getCell(new int[] { 0 }).getValue();
    // unless there is a way to flush the cache,
    // I'm skeptical about these results
    propSaver.set(props.UseAggregates, true);
    propSaver.set(props.ReadAggregates, false);
    Result result1 = getTestContext().executeQuery(mdx);
    Object v1 = result1.getCell(new int[] { 0 }).getValue();
    assertTrue(v.equals(v1));
    Result aresult2 = getTestContext().executeQuery(mdx2);
    Object av1 = aresult2.getCell(new int[] { 0 }).getValue();
    assertTrue(av.equals(av1));
}
Also used : MondrianProperties(mondrian.olap.MondrianProperties) Result(mondrian.olap.Result)

Example 29 with Result

use of mondrian.olap.Result in project mondrian by pentaho.

the class AggMeasureFactCountTest method verifySameAggAndNot.

private void verifySameAggAndNot(String query, String schema) {
    TestContext testContext = getTestContext().withSchema(schema);
    Result resultWithAgg = testContext.withFreshConnection().executeQuery(query);
    disableAggregates();
    Result result = testContext.executeQuery(query);
    String resultStr = TestContext.toString(result);
    String resultWithAggStr = TestContext.toString(resultWithAgg);
    assertEquals("Results with and without agg table should be equal", resultStr, resultWithAggStr);
}
Also used : TestContext(mondrian.test.TestContext) Result(mondrian.olap.Result)

Example 30 with Result

use of mondrian.olap.Result in project mondrian by pentaho.

the class NamedSetTest method testNamedSetMustBeSet.

public void testNamedSetMustBeSet() {
    Result result;
    String queryString;
    String pattern;
    // Formula for a named set must not be a member.
    queryString = "with set [Foo] as ' [Store].CurrentMember  '" + "select {[Foo]} on columns from [Sales]";
    pattern = "Set expression '[Foo]' must be a set";
    assertQueryThrows(queryString, pattern);
    // Formula for a named set must not be a dimension.
    queryString = "with set [Foo] as ' [Store] '" + "select {[Foo]} on columns from [Sales]";
    assertQueryThrows(queryString, pattern);
    // Formula for a named set must not be a level.
    queryString = "with set [Foo] as ' [Store].[Store Country] '" + "select {[Foo]} on columns from [Sales]";
    assertQueryThrows(queryString, pattern);
    // Formula for a named set must not be a cube name.
    queryString = "with set [Foo] as ' [Sales] '" + "select {[Foo]} on columns from [Sales]";
    assertQueryThrows(queryString, "MDX object '[Sales]' not found in cube 'Sales'");
    // Formula for a named set must not be a string.
    queryString = "with set [Foo] as ' \"foobar\" '" + "select {[Foo]} on columns from [Sales]";
    assertQueryThrows(queryString, pattern);
    // Formula for a named set must not be a number.
    queryString = "with set [Foo] as ' -1.45 '" + "select {[Foo]} on columns from [Sales]";
    assertQueryThrows(queryString, pattern);
    // Formula for a named set must not be a tuple.
    queryString = "with set [Foo] as ' ([Gender].[M], [Marital Status].[S]) '" + "select {[Foo]} on columns from [Sales]";
    assertQueryThrows(queryString, pattern);
    // Formula for a named set may be a set of tuples.
    queryString = "with set [Foo] as ' CrossJoin([Gender].members, [Marital Status].members) '" + "select {[Foo]} on columns from [Sales]";
    result = executeQuery(queryString);
    Util.discard(result);
    // Formula for a named set may be a set of members.
    queryString = "with set [Foo] as ' [Gender].members '" + "select {[Foo]} on columns from [Sales]";
    result = executeQuery(queryString);
    Util.discard(result);
}
Also used : Result(mondrian.olap.Result)

Aggregations

Result (mondrian.olap.Result)113 Axis (mondrian.olap.Axis)24 Member (mondrian.olap.Member)10 Test (org.junit.Test)10 Cell (mondrian.olap.Cell)9 Connection (mondrian.olap.Connection)9 Query (mondrian.olap.Query)9 Position (mondrian.olap.Position)8 TestContext (mondrian.test.TestContext)7 ArrayList (java.util.ArrayList)5 MondrianProperties (mondrian.olap.MondrianProperties)5 OlapElement (mondrian.olap.OlapElement)5 RolapCell (mondrian.rolap.RolapCell)5 NonEmptyResult (mondrian.rolap.RolapConnection.NonEmptyResult)5 Execution (mondrian.server.Execution)5 Dialect (mondrian.spi.Dialect)5 OlapConnection (org.olap4j.OlapConnection)5 List (java.util.List)4 ResultBase (mondrian.olap.ResultBase)4 Evaluator (mondrian.olap.Evaluator)3