Skip to content

Commit

Permalink
MONDRIAN: Fix FastBatchingCellReaderTest for mysql, derby.
Browse files Browse the repository at this point in the history
[git-p4: depot-paths = "//open/mondrian/": change = 10309]
  • Loading branch information
julianhyde committed Dec 16, 2007
1 parent a34742c commit baaaaeb
Showing 1 changed file with 36 additions and 39 deletions.
75 changes: 36 additions & 39 deletions testsrc/main/mondrian/rolap/FastBatchingCellReaderTest.java
Expand Up @@ -1219,45 +1219,42 @@ public void testAggregateDistinctCount4() {
" {[Store].[CA plus USA]} * {[Time].[Q1 plus July]} ON ROWS\n" +
"FROM Sales";

String accessSql = "select 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 (\"store\".\"store_country\" = 'USA'" +
" or (\"store\".\"store_state\" = 'CA'" +
" and \"store\".\"store_country\" = 'USA')) " +
"and \"sales_fact_1997\".\"time_id\" = \"time_by_day\".\"time_id\" " +
"and ((\"time_by_day\".\"quarter\" = 'Q1'" +
" and \"time_by_day\".\"the_year\" = 1997)" +
" or (\"time_by_day\".\"month_of_year\" = 7" +
" and \"time_by_day\".\"quarter\" = 'Q3' " +
"and \"time_by_day\".\"the_year\" = 1997))";
accessSql = "select count(`m0`) as `c0` from (select 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 ((`store`.`store_state` = 'CA' and `store`.`store_country` = 'USA') or `store`.`store_country` = 'USA') and `sales_fact_1997`.`time_id` = `time_by_day`.`time_id` and ((`time_by_day`.`quarter` = 'Q1' and `time_by_day`.`the_year` = 1997) or (`time_by_day`.`month_of_year` = 7 and `time_by_day`.`quarter` = 'Q3' and `time_by_day`.`the_year` = 1997))) as `dummyname`";

String derbySql =
"select " +
"count(distinct \"sales_fact_1997\".\"customer_id\") as \"m0\" " +
"from \"time_by_day\" as \"time_by_day\", \"sales_fact_1997\" as \"sales_fact_1997\", " +
"\"store\" as \"store\" " +
"where \"sales_fact_1997\".\"time_id\" = \"time_by_day\".\"time_id\" and " +
"((\"time_by_day\".\"month_of_year\" = 7 and \"time_by_day\".\"quarter\" = 'Q3' and \"time_by_day\".\"the_year\" = 1997) or " +
"(\"time_by_day\".\"quarter\" = 'Q1' and \"time_by_day\".\"the_year\" = 1997)) and " +
"\"sales_fact_1997\".\"store_id\" = \"store\".\"store_id\" and " +
"(\"store\".\"store_country\" = 'USA' or (\"store\".\"store_state\" = 'CA' and \"store\".\"store_country\" = 'USA'))";

final String mysqlSql =
"select " +
"count(distinct `sales_fact_1997`.`customer_id`) as `m0` " +
"from " +
"`time_by_day` as `time_by_day`, `sales_fact_1997` as `sales_fact_1997`, `store` as `store` " +
"where " +
"`sales_fact_1997`.`time_id` = `time_by_day`.`time_id` and " +
"((`time_by_day`.`month_of_year` = 7 and `time_by_day`.`quarter` = 'Q3' and `time_by_day`.`the_year` = 1997) " +
"or (`time_by_day`.`quarter` = 'Q1' and `time_by_day`.`the_year` = 1997)) and " +
"`sales_fact_1997`.`store_id` = `store`.`store_id` and " +
"(`store`.`store_country` = 'USA' " +
"or (`store`.`store_state` = 'CA' and `store`.`store_country` = 'USA'))";
String accessSql = "select count(`m0`) as `c0` from ("
+ "select 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 ((`store`.`store_state` = 'CA' and `store`.`store_country` = 'USA')"
+ " or `store`.`store_country` = 'USA') "
+ "and `sales_fact_1997`.`time_id` = `time_by_day`.`time_id` "
+ "and ((`time_by_day`.`quarter` = 'Q1' and `time_by_day`.`the_year` = 1997)"
+ " or (`time_by_day`.`month_of_year` = 7 and `time_by_day`.`quarter` = 'Q3' and `time_by_day`.`the_year` = 1997))"
+ ") as `dummyname`";

String derbySql = "select "
+ "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 ((\"store\".\"store_state\" = 'CA' and \"store\".\"store_country\" = 'USA')"
+ " or \"store\".\"store_country\" = 'USA') "
+ "and \"sales_fact_1997\".\"time_id\" = \"time_by_day\".\"time_id\" "
+ "and ((\"time_by_day\".\"quarter\" = 'Q1' and \"time_by_day\".\"the_year\" = 1997)"
+ " or (\"time_by_day\".\"month_of_year\" = 7 and \"time_by_day\".\"quarter\" = 'Q3' and \"time_by_day\".\"the_year\" = 1997))";

final String mysqlSql = "select"
+ " 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 ((`store`.`store_state` = 'CA' and `store`.`store_country` = 'USA')"
+ " or `store`.`store_country` = 'USA') "
+ "and `sales_fact_1997`.`time_id` = `time_by_day`.`time_id` "
+ "and ((`time_by_day`.`quarter` = 'Q1' and `time_by_day`.`the_year` = 1997)"
+ " or (`time_by_day`.`month_of_year` = 7 and `time_by_day`.`quarter` = 'Q3' and `time_by_day`.`the_year` = 1997))";

assertQuerySql(mdxQuery, new SqlPattern[] {
new SqlPattern(SqlPattern.Dialect.ACCESS, accessSql, accessSql),
Expand Down

0 comments on commit baaaaeb

Please sign in to comment.