Package mondrian.olap

Examples of mondrian.olap.Result


    public void testScenarioPropertyBug1496() {
        // looking up the $scenario property for a non ScenarioCalc member
        // causes class cast exception
        // http://jira.pentaho.com/browse/MONDRIAN-1496
        Result result = TestContext.instance().executeQuery(
            "select {[Gender].[Gender].members} on columns from Sales");

        // non calc member, should return null
        Object o = result.getAxes()[0].getPositions().get(0).get(0)
            .getPropertyValue("$scenario");
        assertEquals(null, o);

        result = TestContext.instance().executeQuery(
            "with member gender.cal as '1' "
            + "select {[Gender].cal} on 0 from Sales");
        // calc member, should return null
        o = result.getAxes()[0].getPositions().get(0).get(0)
            .getPropertyValue("$scenario");
        assertEquals(null, o);
    }
View Full Code Here


            String mdx = "with member measures.type as '"
            + castedType + "' "
            + "select measures.type on 0 from sales";
            CellSet olap4jXmlaCellset = context.executeOlap4jXmlaQuery(mdx);
            CellSet olap4jCellset = context.executeOlap4jQuery(mdx);
            Result nativeMondrianResult = context.executeQuery(mdx);
            assertEquals(
                "Checking olap4jXmla datatype against native Mondrian. \n"
                + "Unexpected datatype when running mdx " + mdx + "\n",
                nativeMondrianResult.getCell(new int[]{0})
                    .getValue().getClass(),
                olap4jXmlaCellset.getCell(0).getValue().getClass());
            assertEquals(
                "Checking olap4jXmla datatype against native Mondrian. \n"
                + "Unexpected datatype when running mdx " + mdx + "\n",
                olap4jXmlaCellset.getCell(0).getValue().getClass(),
                olap4jCellset.getCell(0).getValue().getClass());
        }

        RolapCube cube =
            (RolapCube)context.executeQuery("select from sales")
                .getQuery().getCube();
        Dialect dialect = cube.getStar().getSqlQueryDialect();

        if (!dialect.getDatabaseProduct()
            .equals(Dialect.DatabaseProduct.MYSQL)
            && !dialect.getDatabaseProduct()
                .equals(Dialect.DatabaseProduct.ORACLE))
        {
            return;
        }

        // map of sql expressions to the corresponding (optional) datatype
        // attribute (RolapBaseCubeMeasure.Datatype)
        Map<String, String> expressionTypeMap = new HashMap<String, String>();
        expressionTypeMap.put("'StringValue'", "String");
        expressionTypeMap.put("cast(1.0001 as decimal)", null);
        expressionTypeMap.put("cast(1.0001 as decimal)", "Numeric");
        expressionTypeMap.put("cast(10.101 as decimal(10,8))", null);
        expressionTypeMap.put("cast(10.101 as decimal(10,8))", "Numeric");


        for (String expression : expressionTypeMap.keySet()) {
            String query = "Select measures.typeMeasure on 0 from Sales";
            context = getContextWithMeasureExpression(
                expression, expressionTypeMap.get(expression));
            CellSet olap4jXmlaCellset = context.executeOlap4jXmlaQuery(query);
            CellSet olap4jCellset = context.executeOlap4jQuery(query);
            Result nativeMondrianResult = context.executeQuery(query);

            assertEquals(
                "Checking olap4jXmla datatype against native Mondrian. \n"
                + "Unexpected datatype for measure expression " + expression
                + " with datatype attribute "
                + expressionTypeMap.get(expression) + "\n",
                nativeMondrianResult.getCell(new int[]{0})
                    .getValue().getClass(),
                olap4jXmlaCellset.getCell(0).getValue().getClass());
            assertEquals(
                "Checking olap4jXmla datatype against olap4j in process. \n"
                + "Unexpected datatype for expression " + expression
View Full Code Here

            + " {[D2].[x],[D2].[y],[D2].[z]} "
            + " ON ROWS "
            + "from FT1";

        //getCubeTestContext().assertQueryReturns(mdx, RESULTS);
        Result result = getTestContext().executeQuery(mdx);
        String resultString = TestContext.toString(result);
//System.out.println(resultString);
/*
This is what is produced
Axis #0:
View Full Code Here

            + " {[D2].[x],[D2].[y],[D2].[z]} "
            + " ON ROWS "
            + "from FT2Extra";

        //getCubeTestContext().assertQueryReturns(mdx, RESULTS);
        Result result = getTestContext().executeQuery(mdx);
        String resultString = TestContext.toString(result);
        assertTrue(resultString.equals(RESULTS));
    }
View Full Code Here

TOP

Related Classes of mondrian.olap.Result

Copyright © 2018 www.massapicom. All rights reserved.
All source code are property of their respective owners. Java is a trademark of Sun Microsystems, Inc and owned by ORACLE Inc. Contact coftware#gmail.com.