[Mondrian] Re: Olap4j Parsing is not working with Named Sets

Julian Hyde jhyde at pentaho.com
Mon Jan 3 10:48:31 EST 2011


This is a bug in mondrian's olap4j driver. Can you log a bug please, and
post the number to this list.
 
As you have noted, the workaround is to skip validation.
 
Julian


  _____  

From: mondrian-bounces at pentaho.org [mailto:mondrian-bounces at pentaho.org] On
Behalf Of Venkatesh U
Sent: Monday, January 03, 2011 7:01 AM
To: Mondrian developer mailing list
Subject: [Mondrian] Re: Olap4j Parsing is not working with Named Sets


The interesting Part is it executes Successfully, If I dont try to validate
the modified query. Below is the code snippet which i Used to validate the
query 

 try {
 
mdxParsetest.mdxValidator.validateSelect(mdxParsetest.parsedObject);
        } catch (OlapException e) {
            System.out.println("Execution failed: " + e);
        }


         CellSet cSet =
mdxParsetest.statement.executeOlapQuery(mdxParsetest.parsedObject);

On Mon, Jan 3, 2011 at 8:23 PM, Venkatesh U <venkatesh20 at gmail.com> wrote:


Hi, 
 I am trying a olap4j with simple example below. But it is not working

String mdxQuery2 = "WITH SET [TimeDimension-CurrentSelection] AS'"
                +
"{[TimeDimension.MonthLevel].[JAN-2010]:[TimeDimension.MonthLevel].[MAR-2010
]}'"
                + "SELECT [TimeDimension-CurrentSelection] on 0 "
                + "FROM [SpendAnalytics]";




        mdxParsetest.parsedObject =
mdxParsetest.parser.parseSelect(mdxQuery2);



      List<ParseTreeNode> wthSet = mdxParsetest.parsedObject.getWithList();

        List<ParseTreeNode> DOWCurSel = new ArrayList<ParseTreeNode>();

        DOWCurSel.add(new IdentifierNode(
                new IdentifierNode.NameSegment("DayOfWeek"),
                new IdentifierNode.NameSegment("MON")));

        DOWCurSel.add(new IdentifierNode(
                new IdentifierNode.NameSegment("DayOfWeek"),
                new IdentifierNode.NameSegment("TUE")));

        CallNode AggOfDow = new CallNode(null, "Aggregate", Syntax.Function,
new CallNode(null, null, Syntax.Braces, DOWCurSel));
        IdentifierNode AggDowSel = new IdentifierNode(new
IdentifierNode.NameSegment("DayOfWeek"), new
IdentifierNode.NameSegment("CurrentSelection"));

        
WithMemberNode DayOfweekCurrentSelection = new WithMemberNode(null,
AggDowSel, AggOfDow, null);

        wthSet.add(0, DayOfweekCurrentSelection);

The generated MDX query is 


WITH
MEMBER [DayOfWeek].[CurrentSelection] AS 'Aggregate({[DayOfWeek].[MON],
[DayOfWeek].[TUE]})'
SET [TimeDimension-CurrentSelection] AS
'{([TimeDimension.MonthLevel].[JAN-2010] :
[TimeDimension.MonthLevel].[MAR-2010])}'
SELECT
[TimeDimension-CurrentSelection] ON COLUMNS
FROM [SpendAnalytics]

But i get the below error when i try to validate and execute the above
SelectNode, below is the stack trace

Exception in thread "main" java.lang.UnsupportedOperationException: need to
implement class mondrian.mdx.NamedSetExpr
        at mondrian.olap.Util.needToImplement(Util.java:1133)
        at
mondrian.olap4j.MondrianOlap4jConnection$MondrianToOlap4jNodeConverter.toOla
p4j(MondrianOlap4jConnection.java:755)
        at
mondrian.olap4j.MondrianOlap4jConnection$MondrianToOlap4jNodeConverter.toOla
p4j(MondrianOlap4jConnection.java:687)
        at
mondrian.olap4j.MondrianOlap4jConnection$MondrianToOlap4jNodeConverter.toOla
p4j(MondrianOlap4jConnection.java:785)
        at
mondrian.olap4j.MondrianOlap4jConnection$MondrianToOlap4jNodeConverter.toOla
p4j(MondrianOlap4jConnection.java:673)
        at
mondrian.olap4j.MondrianOlap4jConnection.toOlap4j(MondrianOlap4jConnection.j
ava:516)
        at
mondrian.olap4j.MondrianOlap4jConnection$MondrianOlap4jMdxValidator.validate
Select(MondrianOlap4jConnection.java:655)
        at com.mdxparsetest.venki.MdxParseTest.main(MdxParseTest.java:123)


Could anyone please help to resolve this?


Thanks in advance


Venkatesh






-------------- next part --------------
An HTML attachment was scrubbed...
URL: http://lists.pentaho.org/pipermail/mondrian/attachments/20110103/da75e129/attachment.html 


More information about the Mondrian mailing list