Skip to content

Commit

Permalink
MONDRIAN: be explicit about the number of decimal places shown in res…
Browse files Browse the repository at this point in the history
…ults, to deal with the way different DBMSs return aggregate values in JDBC result sets. MySQL and Access may return a Double on an Integer column, while Postgres will return a Long. Setting the format string in the schema or for calculated members makes results consistent across DBMSs.

[git-p4: depot-paths = "//open/mondrian/": change = 3075]
  • Loading branch information
Sherman Wood committed Jan 19, 2005
1 parent e1ea20b commit 4a2654f
Show file tree
Hide file tree
Showing 2 changed files with 6 additions and 5 deletions.
4 changes: 2 additions & 2 deletions demo/FoodMart.xml
Expand Up @@ -216,8 +216,8 @@ lname
<Measure name="Supply Time" column="supply_time" aggregator="sum"/>
<Measure name="Warehouse Cost" column="warehouse_cost" aggregator="sum"/>
<Measure name="Warehouse Sales" column="warehouse_sales" aggregator="sum"/>
<Measure name="Units Shipped" column="units_shipped" aggregator="sum"/>
<Measure name="Units Ordered" column="units_ordered" aggregator="sum"/>
<Measure name="Units Shipped" column="units_shipped" aggregator="sum" formatString="#.0"/>
<Measure name="Units Ordered" column="units_ordered" aggregator="sum" formatString="#.0"/>
<Measure name="Warehouse Profit" column="&quot;warehouse_sales&quot;-&quot;inventory_fact_1997&quot;.&quot;warehouse_cost&quot;" aggregator="sum"/>
</Cube>

Expand Down
7 changes: 4 additions & 3 deletions testsrc/main/mondrian/test/BasicQueryTest.java
Expand Up @@ -3280,7 +3280,8 @@ public void testRank() {
public void testDifferentCalculationsForDifferentLevels() {
runQueryCheckResult(
"WITH MEMBER Measures.[Average Units Ordered] AS" + nl +
" 'AVG(DESCENDANTS([Store].CURRENTMEMBER, [Store].[Store Name]), [Measures].[Units Ordered])'" + nl +
" 'AVG(DESCENDANTS([Store].CURRENTMEMBER, [Store].[Store Name]), [Measures].[Units Ordered])'," + nl +
" FORMAT_STRING='#.00'" + nl +
"SELECT {[Measures].[Units ordered], Measures.[Average Units Ordered]} ON COLUMNS," + nl +
" [Store].[Store State].MEMBERS ON ROWS" + nl +
"FROM Warehouse",
Expand Down Expand Up @@ -3318,9 +3319,9 @@ public void testDifferentCalculationsForDifferentLevels() {
"Row #7: 66307.0" + nl +
"Row #7: 16576.75" + nl +
"Row #8: 44906.0" + nl +
"Row #8: 22453.0" + nl +
"Row #8: 22453.00" + nl +
"Row #9: 116025.0" + nl +
"Row #9: 16575.0" + nl);
"Row #9: 16575.00" + nl);
}

/**
Expand Down

0 comments on commit 4a2654f

Please sign in to comment.