From bf6b1aa71b2c0b5e1ddb5d6918b4b42c161d2653 Mon Sep 17 00:00:00 2001 From: Julian Hyde Date: Mon, 22 Feb 2010 22:53:45 -0800 Subject: [PATCH] MONDRIAN: Fix bug MONDRIAN-704, "MDSCHEMA_PROPERTIES should not return internal properties". [git-p4: depot-paths = "//open/mondrian-release/3.2/": change = 13409] --- src/main/mondrian/xmla/RowsetDefinition.java | 3 + testsrc/main/mondrian/xmla/XmlaBasicTest.java | 8 +++ .../main/mondrian/xmla/XmlaBasicTest.ref.xml | 64 ++----------------- .../main/mondrian/xmla/XmlaExcel2007Test.java | 42 ++++++++++-- .../mondrian/xmla/XmlaExcel2007Test.ref.xml | 60 ----------------- 5 files changed, 51 insertions(+), 126 deletions(-) diff --git a/src/main/mondrian/xmla/RowsetDefinition.java b/src/main/mondrian/xmla/RowsetDefinition.java index c3af466ff8..639c891621 100644 --- a/src/main/mondrian/xmla/RowsetDefinition.java +++ b/src/main/mondrian/xmla/RowsetDefinition.java @@ -6608,6 +6608,9 @@ private void populateLevel( { Property[] properties = level.getProperties(); for (Property property : properties) { + if (property.isInternal()) { + continue; + } if (propertyNameRT.passes(property.getName())) { outputProperty( schemaReader, property, diff --git a/testsrc/main/mondrian/xmla/XmlaBasicTest.java b/testsrc/main/mondrian/xmla/XmlaBasicTest.java index 36b4e2801d..2fe403ab74 100644 --- a/testsrc/main/mondrian/xmla/XmlaBasicTest.java +++ b/testsrc/main/mondrian/xmla/XmlaBasicTest.java @@ -600,6 +600,14 @@ protected String filter( " sql:field=\"Day\" type=\"xsd:integer\""); break; case ACCESS: + content = Util.replace( + content, + " sql:field=\"Week\" type=\"xsd:decimal\"", + " sql:field=\"Week\" type=\"xsd:double\""); + content = Util.replace( + content, + " sql:field=\"Day\" type=\"xsd:decimal\"", + " sql:field=\"Day\" type=\"xsd:integer\""); break; } } diff --git a/testsrc/main/mondrian/xmla/XmlaBasicTest.ref.xml b/testsrc/main/mondrian/xmla/XmlaBasicTest.ref.xml index d21ddbbe9b..ab1fa2d0b1 100644 --- a/testsrc/main/mondrian/xmla/XmlaBasicTest.ref.xml +++ b/testsrc/main/mondrian/xmla/XmlaBasicTest.ref.xml @@ -10761,20 +10761,6 @@ xmlns:SOAP-ENV="http://schemas.xmlsoap.org/soap/envelope/" - - FoodMart - FoodMart - HR - [Time] - [Time] - [Time].[Month] - $name - $name - 1 - 130 - 0 - HR Cube - Time Hierarchy - Month Level - $name Property - FoodMart FoodMart @@ -10887,20 +10873,6 @@ xmlns:SOAP-ENV="http://schemas.xmlsoap.org/soap/envelope/" 0 HR Cube - Store Hierarchy - Store Name Level - Street address Property - - FoodMart - FoodMart - HR - [Employees] - [Employees] - [Employees].[Employee Id] - $name - $name - 1 - 130 - 0 - HR Cube - Employees Hierarchy - Employee Id Level - $name Property - FoodMart FoodMart @@ -11097,20 +11069,6 @@ xmlns:SOAP-ENV="http://schemas.xmlsoap.org/soap/envelope/" 0 Sales Cube - Store Hierarchy - Store Name Level - Street address Property - - FoodMart - FoodMart - Sales - [Customers] - [Customers] - [Customers].[Name] - $name - $name - 1 - 130 - 0 - Sales Cube - Customers Hierarchy - Name Level - $name Property - FoodMart FoodMart @@ -11559,20 +11517,6 @@ xmlns:SOAP-ENV="http://schemas.xmlsoap.org/soap/envelope/" 0 Warehouse Cube - Store Hierarchy - Store Name Level - Street address Property - - FoodMart - FoodMart - Warehouse and Sales - [Customers] - [Customers] - [Customers].[Name] - $name - $name - 1 - 130 - 0 - Warehouse and Sales Cube - Customers Hierarchy - Name Level - $name Property - FoodMart FoodMart @@ -14413,9 +14357,9 @@ xmlns:SOAP-ENV="http://schemas.xmlsoap.org/soap/envelope/" + sql:field="Week" type="xsd:decimal"/> + sql:field="Day" type="xsd:decimal"/> @@ -14682,9 +14626,9 @@ FROM Sales + sql:field="Week" type="xsd:decimal"/> + sql:field="Day" type="xsd:decimal"/> diff --git a/testsrc/main/mondrian/xmla/XmlaExcel2007Test.java b/testsrc/main/mondrian/xmla/XmlaExcel2007Test.java index 39a0a5c166..13ae13b303 100644 --- a/testsrc/main/mondrian/xmla/XmlaExcel2007Test.java +++ b/testsrc/main/mondrian/xmla/XmlaExcel2007Test.java @@ -58,18 +58,48 @@ protected String filter( Dialect dialect = TestContext.instance().getDialect(); switch (dialect.getDatabaseProduct()) { case MYSQL: - final String start = ""; - final String end = ""; - content = Util.replace( - content, start + "1" + end, start + "true" + end); - content = Util.replace( - content, start + "0" + end, start + "false" + end); + content = + foo(content, "Has_x0020_coffee_x0020_bar", "1", "true"); + content = + foo(content, "Has_x0020_coffee_x0020_bar", "0", "false"); + break; + case ACCESS: + content = + foo(content, "Has_x0020_coffee_x0020_bar", "1", "true"); + content = + foo(content, "Has_x0020_coffee_x0020_bar", "0", "false"); + content = + foo(content, "Store_x0020_Sqft", "23688", "23688.0"); + content = foo( + content, "Grocery_x0020_Sqft", "15337", + "15336.753169821777"); + content = foo( + content, "Frozen_x0020_Sqft", "5011", "5010.748098106934"); + content = foo( + content, "Meat_x0020_Sqft", "3340", "3340.4987320712894"); + content = foo(content, "Store_x0020_Sqft", "23598", "23598.0"); + content = foo( + content, "Grocery_x0020_Sqft", "14210", + "14210.378025591175"); + content = foo( + content, "Frozen_x0020_Sqft", "5633", "5632.5731846452945"); + content = foo( + content, "Meat_x0020_Sqft", "3755", "3755.0487897635303"); break; } } return content; } + private String foo(String content, String tag, String from, String to) { + String start = "<" + tag + ">"; + String end = ""; + final String s = Util.replace( + content, start + from + end, start + to + end); + assert !s.contains(start + from + end); + return s; + } + /** *

Testcase for * bug MONDRIAN-679, "VisualTotals gives ClassCastException when called via diff --git a/testsrc/main/mondrian/xmla/XmlaExcel2007Test.ref.xml b/testsrc/main/mondrian/xmla/XmlaExcel2007Test.ref.xml index ded98d42d7..b9feabc206 100644 --- a/testsrc/main/mondrian/xmla/XmlaExcel2007Test.ref.xml +++ b/testsrc/main/mondrian/xmla/XmlaExcel2007Test.ref.xml @@ -798,21 +798,6 @@ where [Measures].[Unit Sales] - - FoodMart - FoodMart - HR - [Time] - [Time] - [Time].[Month] - $name - $name - 1 - 130 - 0 - HR Cube - Time Hierarchy - Month - Level - $name Property - FoodMart FoodMart @@ -933,21 +918,6 @@ where [Measures].[Unit Sales] HR Cube - Store Hierarchy - Store Name Level - Street address Property - - FoodMart - FoodMart - HR - [Employees] - [Employees] - [Employees].[Employee Id] - $name - $name - 1 - 130 - 0 - HR Cube - Employees Hierarchy - - Employee Id Level - $name Property - FoodMart FoodMart @@ -1158,21 +1128,6 @@ where [Measures].[Unit Sales] Sales Cube - Store Hierarchy - Store Name Level - Street address Property - - FoodMart - FoodMart - Sales - [Customers] - [Customers] - [Customers].[Name] - $name - $name - 1 - 130 - 0 - Sales Cube - Customers Hierarchy - - Name Level - $name Property - FoodMart FoodMart @@ -1653,21 +1608,6 @@ where [Measures].[Unit Sales] Warehouse Cube - Store Hierarchy - Store Name Level - Street address Property - - FoodMart - FoodMart - Warehouse and Sales - [Customers] - [Customers] - [Customers].[Name] - $name - $name - 1 - 130 - 0 - Warehouse and Sales Cube - - Customers Hierarchy - Name Level - $name Property - FoodMart FoodMart