Skip to content

Commit

Permalink
MONDRIAN: Rolling back DrillThroughTest (removing dialect conditional…
Browse files Browse the repository at this point in the history
… logic from the test itself). Puzzled why it was not working earlier. Added a log statement in executeStripe to capture all failures.

[git-p4: depot-paths = "//open/mondrian/": change = 10601]
  • Loading branch information
Ajit Joglekar committed Feb 25, 2008
1 parent 068cb14 commit e27f63d
Show file tree
Hide file tree
Showing 2 changed files with 50 additions and 118 deletions.
1 change: 1 addition & 0 deletions src/main/mondrian/rolap/RolapResult.java
Expand Up @@ -834,6 +834,7 @@ private void executeStripe(int axisOrdinal, RolapEvaluator revaluator) {
try {
o = revaluator.evaluateCurrent();
} catch (MondrianEvaluationException e) {
LOGGER.warn("Mondrian: exception in executeStripe.", e);
o = e;
}

Expand Down
167 changes: 49 additions & 118 deletions testsrc/main/mondrian/test/DrillThroughTest.java
Expand Up @@ -577,124 +577,55 @@ public void testBug1438285() throws Exception {
// an assertion error
String sql = result.getCell(new int[] {0, 0}).getDrillThroughSQL(true);

String mysqlSql =
"select `store`.`store_country` as `Store Country`, " +
"`store`.`store_state` as `Store State`, `store`.`store_city` as `Store City`, " +
"`store`.`store_name` as `Store Name`, `store`.`store_sqft` as `Store Sqft`, " +
"`store`.`store_type` as `Store Type`, `time_by_day`.`the_year` as `Year`, " +
"`time_by_day`.`quarter` as `Quarter`, `time_by_day`.`month_of_year` as `Month`, " +
"`product_class`.`product_family` as `Product Family`, " +
"`product_class`.`product_department` as `Product Department`, " +
"`product_class`.`product_category` as `Product Category`, " +
"`product_class`.`product_subcategory` as `Product Subcategory`, " +
"`product`.`brand_name` as `Brand Name`, `product`.`product_name` as `Product Name`, " +
"`store_ragged`.`store_id` as `Store Id`, `store_ragged`.`store_id` as `Store Id (Key)`, " +
"`promotion`.`media_type` as `Media Type`, " +
"`promotion`.`promotion_name` as `Promotion Name`, `customer`.`country` as `Country`, " +
"`customer`.`state_province` as `State Province`, `customer`.`city` as `City`, " +
"CONCAT(`customer`.`fname`, ' ', `customer`.`lname`) as `Name`, " +
"`customer`.`customer_id` as `Name (Key)`, " +
"`customer`.`education` as `Education Level`, `customer`.`gender` as `Gender`, " +
"`customer`.`marital_status` as `Marital Status`, " +
"`customer`.`yearly_income` as `Yearly Income`, " +
"`sales_fact_1997`.`unit_sales` as `Unit Sales` " +
"from `store` as `store`, `sales_fact_1997` as `sales_fact_1997`, " +
"`time_by_day` as `time_by_day`, `product_class` as `product_class`, " +
"`product` as `product`, `store_ragged` as `store_ragged`, " +
"`promotion` as `promotion`, `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`.`product_id` = `product`.`product_id` and " +
"`product`.`product_class_id` = `product_class`.`product_class_id` and " +
"`sales_fact_1997`.`store_id` = `store_ragged`.`store_id` and " +
"`sales_fact_1997`.`promotion_id` = `promotion`.`promotion_id` and " +
"`sales_fact_1997`.`customer_id` = `customer`.`customer_id` " +
"order by `store`.`store_country` ASC, `store`.`store_state` ASC, " +
"`store`.`store_city` ASC, `store`.`store_name` ASC, " +
"`store`.`store_sqft` ASC, `store`.`store_type` ASC, " +
"`time_by_day`.`the_year` ASC, `time_by_day`.`quarter` ASC, " +
"`time_by_day`.`month_of_year` ASC, `product_class`.`product_family` ASC, " +
"`product_class`.`product_department` ASC, " +
"`product_class`.`product_category` ASC, " +
"`product_class`.`product_subcategory` ASC, `product`.`brand_name` ASC, " +
"`product`.`product_name` ASC, `store_ragged`.`store_id` ASC, " +
"`promotion`.`media_type` ASC, `promotion`.`promotion_name` ASC, " +
"`customer`.`country` ASC, `customer`.`state_province` ASC, " +
"`customer`.`city` ASC, CONCAT(`customer`.`fname`, ' ', `customer`.`lname`) ASC, " +
"`customer`.`customer_id` ASC, `customer`.`education` ASC, " +
"`customer`.`gender` ASC, `customer`.`marital_status` ASC, " +
"`customer`.`yearly_income` ASC";
String derbySql =
"select \"store\".\"store_country\" as \"Store Country\", " +
"\"store\".\"store_state\" as \"Store State\", " +
"\"store\".\"store_city\" as \"Store City\", " +
"\"store\".\"store_name\" as \"Store Name\", " +
"\"store\".\"store_sqft\" as \"Store Sqft\", " +
"\"store\".\"store_type\" as \"Store Type\", " +
"\"time_by_day\".\"the_year\" as \"Year\", " +
"\"time_by_day\".\"quarter\" as \"Quarter\", " +
"\"time_by_day\".\"month_of_year\" as \"Month\", " +
"\"product_class\".\"product_family\" as \"Product Family\", " +
"\"product_class\".\"product_department\" as \"Product Department\", " +
"\"product_class\".\"product_category\" as \"Product Category\", " +
"\"product_class\".\"product_subcategory\" as \"ProductSubcategory\", " +
"\"product\".\"brand_name\" as \"Brand Name\", " +
"\"product\".\"product_name\" as \"Product Name\", " +
"\"store_ragged\".\"store_id\" as \"Store Id\", " +
"\"store_ragged\".\"store_id\" as \"Store Id (Key)\", " +
"\"promotion\".\"media_type\" as \"Media Type\", " +
"\"promotion\".\"promotion_name\" as \"Promotion Name\", " +
"\"customer\".\"country\" as \"Country\", " +
"\"customer\".\"state_province\" as \"State Province\", " +
"\"customer\".\"city\" as \"City\", \"customer\".\"fullname\" as \"Name\", " +
"\"customer\".\"customer_id\" as \"Name (Key)\", " +
"\"customer\".\"education\" as \"Education Level\", " +
"\"customer\".\"gender\" as \"Gender\", " +
"\"customer\".\"marital_status\" as \"Marital Status\", " +
"\"customer\".\"yearly_income\" as \"Yearly Income\", " +
"\"sales_fact_1997\".\"unit_sales\" as \"Unit Sales\" " +
"from \"store\" as \"store\", \"sales_fact_1997\" as \"sales_fact_1997\", " +
"\"time_by_day\" as \"time_by_day\", \"product_class\"as \"product_class\", " +
"\"product\" as \"product\", \"store_ragged\" as \"store_ragged\", " +
"\"promotion\" as \"promotion\", \"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\".\"product_id\" = \"product\".\"product_id\" and " +
"\"product\".\"product_class_id\" = \"product_class\".\"product_class_id\" and " +
"\"sales_fact_1997\".\"store_id\" = \"store_ragged\".\"store_id\" and " +
"\"sales_fact_1997\".\"promotion_id\" = \"promotion\".\"promotion_id\" and " +
"\"sales_fact_1997\".\"customer_id\" = \"customer\".\"customer_id\" " +
"order by \"store\".\"store_country\" ASC, \"store\".\"store_state\" ASC, " +
"\"store\".\"store_city\" ASC, \"store\".\"store_name\" ASC, " +
"\"store\".\"store_sqft\" ASC, \"store\".\"store_type\" ASC, " +
"\"time_by_day\".\"the_year\" ASC,\"time_by_day\".\"quarter\" ASC, " +
"\"time_by_day\".\"month_of_year\" ASC, \"product_class\".\"product_family\" ASC, " +
"\"product_class\".\"product_department\" ASC, " +
"\"product_class\".\"product_category\" ASC, " +
"\"product_class\".\"product_subcategory\" ASC, \"product\".\"brand_name\" ASC, " +
"\"product\".\"product_name\" ASC, \"store_ragged\".\"store_id\" ASC, " +
"\"promotion\".\"media_type\" ASC, \"promotion\".\"promotion_name\" ASC, " +
"\"customer\".\"country\" ASC, \"customer\".\"state_province\" ASC, " +
"\"customer\".\"city\" ASC, \"customer\".\"fullname\" ASC, " +
"\"customer\".\"customer_id\" ASC, \"customer\".\"education\" ASC, " +
"\"customer\".\"gender\" ASC, \"customer\".\"marital_status\"ASC, " +
"\"customer\".\"yearly_income\" ASC";

final Cube cube = result.getQuery().getCube();
RolapStar star = ((RolapCube) cube).getStar();

SqlQuery.Dialect dialect = star.getSqlQueryDialect();
if (dialect.isMySQL()) {
getTestContext().assertSqlEquals(mysqlSql, sql, 86837);
} else if (dialect.isDerby()) {
//todo: there seems to be an issue with the following assertSqlEquals
// method when used for derby. Need to investigate. Since this is
// an issue with the test code do we log a bug?
// getTestContext().assertSqlEquals(derbySql, sql, 86837);
}

String expectedSql =
"select `store`.`store_country` as `Store Country`," +
" `store`.`store_state` as `Store State`," +
" `store`.`store_city` as `Store City`, `store`.`store_name` as `Store Name`," +
" `store`.`store_sqft` as `Store Sqft`, `store`.`store_type` as `Store Type`," +
" `time_by_day`.`the_year` as `Year`, `time_by_day`.`quarter` as `Quarter`," +
" `time_by_day`.`month_of_year` as `Month`," +
" `product_class`.`product_family` as `Product Family`," +
" `product_class`.`product_department` as `Product Department`," +
" `product_class`.`product_category` as `Product Category`," +
" `product_class`.`product_subcategory` as `Product Subcategory`," +
" `product`.`brand_name` as `Brand Name`," +
" `product`.`product_name` as `Product Name`, `store_ragged`.`store_id` as `Store Id`," +
" `store_ragged`.`store_id` as `Store Id (Key)`, `promotion`.`media_type` as `Media Type`," +
" `promotion`.`promotion_name` as `Promotion Name`, `customer`.`country` as `Country`," +
" `customer`.`state_province` as `State Province`, `customer`.`city` as `City`," +
" fname + ' ' + lname as `Name`, `customer`.`customer_id` as `Name (Key)`," +
" `customer`.`education` as `Education Level`, `customer`.`gender` as `Gender`," +
" `customer`.`marital_status` as `Marital Status`," +
" `customer`.`yearly_income` as `Yearly Income`," +
" `sales_fact_1997`.`unit_sales` as `Unit Sales`" +
" from `store` =as= `store`, `sales_fact_1997` =as= `sales_fact_1997`," +
" `time_by_day` =as= `time_by_day`, `product_class` =as= `product_class`," +
" `product` =as= `product`, `store_ragged` =as= `store_ragged`," +
" `promotion` =as= `promotion`, `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`.`product_id` = `product`.`product_id`" +
" and `product`.`product_class_id` = `product_class`.`product_class_id`" +
" and `sales_fact_1997`.`store_id` = `store_ragged`.`store_id`" +
" and `sales_fact_1997`.`promotion_id` = `promotion`.`promotion_id`" +
" and `sales_fact_1997`.`customer_id` = `customer`.`customer_id`" +
" order by `store`.`store_country` ASC, `store`.`store_state` ASC," +
" `store`.`store_city` ASC, `store`.`store_name` ASC, `store`.`store_sqft` ASC," +
" `store`.`store_type` ASC, `time_by_day`.`the_year` ASC," +
" `time_by_day`.`quarter` ASC, `time_by_day`.`month_of_year` ASC," +
" `product_class`.`product_family` ASC, `product_class`.`product_department` ASC," +
" `product_class`.`product_category` ASC," +
" `product_class`.`product_subcategory` ASC, `product`.`brand_name` ASC," +
" `product`.`product_name` ASC, `store_ragged`.`store_id` ASC," +
" `promotion`.`media_type` ASC, `promotion`.`promotion_name` ASC," +
" `customer`.`country` ASC, `customer`.`state_province` ASC," +
" `customer`.`city` ASC, fname + ' ' + lname ASC," +
" `customer`.`customer_id` ASC, `customer`.`education` ASC," +
" `customer`.`gender` ASC, `customer`.`marital_status` ASC," +
" `customer`.`yearly_income` ASC";

getTestContext().assertSqlEquals(expectedSql, sql, 86837);
}
}

Expand Down

0 comments on commit e27f63d

Please sign in to comment.