}
public void testLimitedRollupMemberRetrievableFromCache() throws Exception {
final String mdx =
"select NON EMPTY { [Store].[Store].[Store State].members } on 0 from [Sales]";
final TestContext context =
TestContext.instance().create(
null, null, null, null, null,
" <Role name='justCA'>\n"
+ " <SchemaGrant access='all'>\n"
+ " <CubeGrant cube='Sales' access='all'>\n"
+ " <HierarchyGrant hierarchy='[Store]' access='custom' rollupPolicy='partial'>\n"
+ " <MemberGrant member='[Store].[USA].[CA]' access='all'/>\n"
+ " </HierarchyGrant>\n"
+ " </CubeGrant>\n"
+ " </SchemaGrant>\n"
+ " </Role>\n").withRole("justCA");
String pgSql =
"select \"store\".\"store_country\" as \"c0\","
+ " \"store\".\"store_state\" as \"c1\""
+ " from \"sales_fact_1997\" as \"sales_fact_1997\","
+ " \"store\" as \"store\" "
+ "where (\"store\".\"store_country\" = 'USA') "
+ "and (\"store\".\"store_state\" = 'CA') "
+ "and \"sales_fact_1997\".\"store_id\" = \"store\".\"store_id\" "
+ "group by \"store\".\"store_country\", \"store\".\"store_state\" "
+ "order by \"store\".\"store_country\" ASC NULLS LAST,"
+ " \"store\".\"store_state\" ASC NULLS LAST";
SqlPattern pgPattern =
new SqlPattern(POSTGRESQL, pgSql, pgSql.length());
String mySql =
"select `store`.`store_country` as `c0`,"
+ " `store`.`store_state` as `c1`"
+ " from `store` as `store`, `sales_fact_1997` as `sales_fact_1997` "
+ "where `sales_fact_1997`.`store_id` = `store`.`store_id` "
+ "and `store`.`store_country` = 'USA' "
+ "and `store`.`store_state` = 'CA' "
+ "group by `store`.`store_country`, `store`.`store_state` "
+ "order by ISNULL(`store`.`store_country`) ASC,"
+ " `store`.`store_country` ASC,"
+ " ISNULL(`store`.`store_state`) ASC, `store`.`store_state` ASC";
SqlPattern myPattern = new SqlPattern(MYSQL, mySql, mySql.length());
SqlPattern[] patterns = {pgPattern, myPattern};
context.executeQuery(mdx);
assertQuerySqlOrNot(context, mdx, patterns, true, false, false);
}