Search in sources :

Example 1 with RolapAxis

use of mondrian.rolap.RolapAxis in project mondrian by pentaho.

the class MondrianOlap4jCellSet method execute.

/**
 * Executes a query. Not part of the olap4j API; internal to the mondrian
 * driver.
 *
 * <p>This method may take some time. While it is executing, a client may
 * execute {@link MondrianOlap4jStatement#cancel()}.
 *
 * @throws org.olap4j.OlapException on error
 */
void execute() throws OlapException {
    result = olap4jStatement.olap4jConnection.getMondrianConnection().execute(this);
    // initialize axes
    mondrian.olap.Axis[] axes = result.getAxes();
    QueryAxis[] queryAxes = result.getQuery().getAxes();
    assert axes.length == queryAxes.length;
    for (int i = 0; i < axes.length; i++) {
        Axis axis = axes[i];
        QueryAxis queryAxis = queryAxes[i];
        axisList.add(new MondrianOlap4jCellSetAxis(this, queryAxis, (RolapAxis) axis));
    }
    // initialize filter axis
    QueryAxis queryAxis = result.getQuery().getSlicerAxis();
    final Axis axis = result.getSlicerAxis();
    if (queryAxis == null) {
        // Dummy slicer axis.
        queryAxis = new QueryAxis(false, null, AxisOrdinal.StandardAxisOrdinal.SLICER, QueryAxis.SubtotalVisibility.Undefined);
    }
    filterAxis = new MondrianOlap4jCellSetAxis(this, queryAxis, (RolapAxis) axis);
}
Also used : RolapAxis(mondrian.rolap.RolapAxis) Axis(mondrian.olap.Axis) RolapAxis(mondrian.rolap.RolapAxis)

Example 2 with RolapAxis

use of mondrian.rolap.RolapAxis in project mondrian by pentaho.

the class MultipleColsInTupleAggTest method testNativeFilterWithoutMeasuresAndLevelWithProps.

public void testNativeFilterWithoutMeasuresAndLevelWithProps() throws Exception {
    if (!isApplicable()) {
        return;
    }
    // similar to the previous test, but verifies a case where
    // a level property is the extra column that requires joining
    // agg star back to the dim table.  This test also uses the bottom
    // level of the dim
    final String query = "select " + "Filter([Product].[Product Name].members, " + "Product.CurrentMember.Caption MATCHES (\"(?i).*Two.*\") )" + " on columns " + "from [Fact] ";
    getTestContext().assertQueryReturns(query, "Axis #0:\n" + "{}\n" + "Axis #1:\n" + "{[Product].[Cat One].[Prod Cat One].[Two]}\n" + "Row #0: 6\n");
    // check generated sql only for native evaluation
    if (MondrianProperties.instance().EnableNativeFilter.get()) {
        assertQuerySql(query, new SqlPattern[] { new SqlPattern(Dialect.DatabaseProduct.MYSQL, "select\n" + "    `cat`.`cat` as `c0`,\n" + "    `cat`.`cap` as `c1`,\n" + "    `cat`.`ord` as `c2`,\n" + "    `cat`.`name3` as `c3`,\n" + "    `product_cat`.`name2` as `c4`,\n" + "    `product_cat`.`cap` as `c5`,\n" + "    `product_cat`.`ord` as `c6`,\n" + "    `test_lp_xx2_fact`.`prodname` as `c7`,\n" + "    `product_csv`.`color` as `c8`\n" + "from\n" + "    `product_csv` as `product_csv`,\n" + "    `product_cat` as `product_cat`,\n" + "    `cat` as `cat`,\n" + "    `test_lp_xx2_fact` as `test_lp_xx2_fact`\n" + "where\n" + "    `product_cat`.`cat` = `cat`.`cat`\n" + "and\n" + "    `product_csv`.`prod_cat` = `product_cat`.`prod_cat`\n" + "and\n" + "    `product_csv`.`name1` = `test_lp_xx2_fact`.`prodname`\n" + "group by\n" + "    `cat`.`cat`,\n" + "    `cat`.`cap`,\n" + "    `cat`.`ord`,\n" + "    `cat`.`name3`,\n" + "    `product_cat`.`name2`,\n" + "    `product_cat`.`cap`,\n" + "    `product_cat`.`ord`,\n" + "    `test_lp_xx2_fact`.`prodname`,\n" + "    `product_csv`.`color`\n" + "having\n" + "    c7 IS NOT NULL AND UPPER(c7) REGEXP '.*TWO.*'\n" + "order by\n" + (TestContext.instance().getDialect().requiresOrderByAlias() ? "    ISNULL(`c2`) ASC, `c2` ASC,\n" + "    ISNULL(`c6`) ASC, `c6` ASC,\n" + "    ISNULL(`c7`) ASC, `c7` ASC" : "    ISNULL(`cat`.`ord`) ASC, `cat`.`ord` ASC,\n" + "    ISNULL(`product_cat`.`ord`) ASC, `product_cat`.`ord` ASC,\n" + "    ISNULL(`test_lp_xx2_fact`.`prodname`) ASC, " + "`test_lp_xx2_fact`.`prodname` ASC"), null) });
    }
    Axis axis = getTestContext().withCube("Fact").executeAxis("Filter([Product].[Product Name].members, " + "Product.CurrentMember.Caption MATCHES (\"(?i).*Two.*\") )");
    assertEquals("Member property value was not loaded correctly.", "Black", ((RolapAxis) axis).getTupleList().get(0).get(0).getPropertyValue("Product Color"));
}
Also used : RolapAxis(mondrian.rolap.RolapAxis) SqlPattern(mondrian.test.SqlPattern) RolapAxis(mondrian.rolap.RolapAxis) Axis(mondrian.olap.Axis)

Aggregations

Axis (mondrian.olap.Axis)2 RolapAxis (mondrian.rolap.RolapAxis)2 SqlPattern (mondrian.test.SqlPattern)1