+ "where {[Measures].[Unit Sales]}";
// Provoke an error in the key resolution to prove it uses it.
final String colName =
TestContext.instance().getDialect()
.quoteIdentifier("promotion_name");
TestContext testContext = TestContext.instance().createSubstitutingCube(
"Sales",
"<Dimension name=\"Promotions\" foreignKey=\"promotion_id\">\n"
+ " <Hierarchy hasAll=\"true\" allMemberName=\"All Promotions\" primaryKey=\"promotion_id\" defaultMember=\"[All Promotions]\">\n"
+ " <Table name=\"promotion\"/>\n"
+ " <Level name=\"Promotion Name\" column=\"promotion_name\" uniqueMembers=\"true\">\n"
+ " <KeyExpression><SQL>ERROR_TEST_FUNCTION_NAME("
+ colName + ")</SQL></KeyExpression>\n"
+ " </Level>\n"
+ " </Hierarchy>\n"
+ "</Dimension>");
testContext.assertQueryThrows(
mdxQuery,
"ERROR_TEST_FUNCTION_NAME");
// Run for real this time
testContext = TestContext.instance().createSubstitutingCube(
"Sales",
"<Dimension name=\"Promotions\" foreignKey=\"promotion_id\">\n"
+ " <Hierarchy hasAll=\"true\" allMemberName=\"All Promotions\" primaryKey=\"promotion_id\" defaultMember=\"[All Promotions]\">\n"
+ " <Table name=\"promotion\"/>\n"
+ " <Level name=\"Promotion Name\" column=\"promotion_name\" uniqueMembers=\"true\">\n"
+ " <KeyExpression><SQL>RTRIM("
+ colName + ")</SQL></KeyExpression>\n"
+ " </Level>\n"
+ " </Hierarchy>\n"
+ "</Dimension>");
testContext.assertQueryReturns(
"select non empty{[Promotions].[All Promotions].Children} ON rows, "
+ "non empty {[Store].[All Stores]} ON columns "
+ "from [Sales] "
+ "where {[Measures].[Unit Sales]}",
"Axis #0:\n"