Skip to content

Commit

Permalink
MONDRIAN: Fix bug 1751352, "Parser should not require braces around r…
Browse files Browse the repository at this point in the history
…ange operator in WITH SET".

[git-p4: depot-paths = "//open/mondrian/": change = 9564]
  • Loading branch information
julianhyde committed Jul 10, 2007
1 parent cfa80e6 commit 108be9c
Show file tree
Hide file tree
Showing 2 changed files with 23 additions and 3 deletions.
5 changes: 2 additions & 3 deletions src/main/mondrian/olap/Parser.cup
Expand Up @@ -1231,12 +1231,11 @@ exp_list ::=
// SELECT [<axis_specification>
// [, <axis_specification>...]]
// FROM [<cube_specification>]
// WHERE [<slicer_specification>]
// [WHERE <slicer_specification>]
// [<cell_props>]
// jhyde: The above is wrong... you can omit 'WHERE'.
statement ::=
select_statement
| _VALUE_EXPRESSION value_expression:e {: RESULT = (QueryPart) e; :}
| _VALUE_EXPRESSION expression:e {: RESULT = (QueryPart) e; :}
;

select_statement ::=
Expand Down
21 changes: 21 additions & 0 deletions testsrc/main/mondrian/olap/ParserTest.java
Expand Up @@ -198,6 +198,27 @@ public void testCaseSwitch() {
"from [cube]\n"));
}

public void testSetExpr() {
// bug 1751352: parser does not recognize ':' range operator in WITH SET
assertParseQuery("with set [Set1] as '[Product].[Drink]:[Product].[Food]' \n" +
"select [Set1] on columns, {[Measures].defaultMember} on rows \n" +
"from Sales",
TestContext.fold(
"with set [Set1] as '([Product].[Drink] : [Product].[Food])'\n" +
"select [Set1] ON COLUMNS,\n" +
" {[Measures].defaultMember} ON ROWS\n" +
"from [Sales]\n"));

// set expr in axes
assertParseQuery("select [Product].[Drink]:[Product].[Food] on columns,\n" +
" {[Measures].defaultMember} on rows \n" +
"from Sales",
TestContext.fold(
"select ([Product].[Drink] : [Product].[Food]) ON COLUMNS,\n" +
" {[Measures].defaultMember} ON ROWS\n" +
"from [Sales]\n"));
}

public void testDimensionProperties() {
assertParseQuery(
"select {[foo]} properties p1, p2 on columns from [cube]",
Expand Down

0 comments on commit 108be9c

Please sign in to comment.