Skip to content

Commit

Permalink
MONDRIAN: Fix test exception. Mondrian should not use GROUPING SETS i…
Browse files Browse the repository at this point in the history
…f there are

    distinct-count measures (see MONDRIAN-470), but test was expecting it to.

[git-p4: depot-paths = "//open/mondrian/": change = 14655]
  • Loading branch information
julianhyde committed Oct 4, 2011
1 parent d13c6d1 commit 8bb6eb7
Showing 1 changed file with 17 additions and 36 deletions.
Expand Up @@ -635,42 +635,23 @@ public void testMultiLevelsMixedNullNonNullChild() {
}

public void testAggregationOnCJofMembersGeneratesOptimalQuery() {
if (MondrianProperties.instance().UseAggregates.get()) {
// Using aggregates makes this test failing since it won't be able
// to use grouping sets.
return;
}
String oraTeraSql;
if (props.EnableGroupingSets.get()) {
oraTeraSql =
"select \"store\".\"store_name\" as \"c0\","
+ " \"time_by_day\".\"the_year\" as \"c1\","
+ " \"customer\".\"gender\" as \"c2\","
+ " count(distinct \"sales_fact_1997\".\"customer_id\") as \"m0\","
+ " grouping(\"customer\".\"gender\") as \"g0\" "
+ "from \"store\" =as= \"store\","
+ " \"sales_fact_1997\" =as= \"sales_fact_1997\","
+ " \"time_by_day\" =as= \"time_by_day\","
+ " \"customer\" =as= \"customer\" "
+ "where \"sales_fact_1997\".\"store_id\" = \"store\".\"store_id\" "
+ "and \"sales_fact_1997\".\"time_id\" = \"time_by_day\".\"time_id\" "
+ "and \"time_by_day\".\"the_year\" = 1997 "
+ "and \"sales_fact_1997\".\"customer_id\" = \"customer\".\"customer_id\" "
+ "group by grouping sets ((\"store\".\"store_name\",\"time_by_day\".\"the_year\",\"customer\".\"gender\"),"
+ "(\"store\".\"store_name\",\"time_by_day\".\"the_year\"))";
} else {
oraTeraSql =
"select \"store\".\"store_state\" as \"c0\","
+ " \"time_by_day\".\"the_year\" as \"c1\","
+ " count(distinct \"sales_fact_1997\".\"customer_id\") as \"m0\" "
+ "from \"store\" =as= \"store\","
+ " \"sales_fact_1997\" =as= \"sales_fact_1997\","
+ " \"time_by_day\" =as= \"time_by_day\" "
+ "where \"sales_fact_1997\".\"store_id\" = \"store\".\"store_id\" "
+ "and \"sales_fact_1997\".\"time_id\" = \"time_by_day\".\"time_id\" "
+ "and \"time_by_day\".\"the_year\" = 1997 "
+ "group by \"store\".\"store_state\", \"time_by_day\".\"the_year\"";
}
// Mondrian does not use GROUPING SETS for distinct-count measures.
// So, this test should not use GROUPING SETS, even if they are enabled.
// See change 12310, bug MONDRIAN-470 (aka SF.net 2207515).
Util.discard(props.EnableGroupingSets);

String oraTeraSql =
"select \"store\".\"store_state\" as \"c0\","
+ " \"time_by_day\".\"the_year\" as \"c1\","
+ " count(distinct \"sales_fact_1997\".\"customer_id\") as \"m0\" "
+ "from \"store\" =as= \"store\","
+ " \"sales_fact_1997\" =as= \"sales_fact_1997\","
+ " \"time_by_day\" =as= \"time_by_day\" "
+ "where \"sales_fact_1997\".\"store_id\" = \"store\".\"store_id\" "
+ "and \"sales_fact_1997\".\"time_id\" = \"time_by_day\".\"time_id\" "
+ "and \"time_by_day\".\"the_year\" = 1997 "
+ "group by \"store\".\"store_state\", \"time_by_day\".\"the_year\"";

SqlPattern[] patterns = {
new SqlPattern(
Dialect.DatabaseProduct.ORACLE, oraTeraSql, oraTeraSql),
Expand Down

0 comments on commit 8bb6eb7

Please sign in to comment.