[Mondrian] RE: [Olap4j-devel] bug in mdx function ORDER() ?

Julian Hyde jhyde at pentaho.com
Tue Oct 5 20:54:58 EDT 2010


Paul,

Does the query produce expected results if you use BDESC rather than DESC?

Remember that with DESC (and ASC), the Order function will only re-order
siblings within the same parent. You need to use BDESC (or BASC) to break
the hierarchy.

It's not surprising that you are not seeing SQL generated. Mondrian will
convert a call to the Order function to SQL only in certain particular
circumstances involving sorting by a cell value. Member name is, as far as
mondrian is concerned, an 'arbitrary expression' and has to be done
in-memory.

Julian 

> -----Original Message-----
> From: Paul Stoellberger [mailto:paul.stoellberger at aschauer-edv.at] 
> Sent: Tuesday, October 05, 2010 5:45 PM
> To: Mondrian developer mailing list; 
> olap4j-devel at lists.sourceforge.net
> Subject: [Olap4j-devel] bug in mdx function ORDER() ?
> 
> Hello,
> 
> i'm trying to get my head around the Order() functionality in 
> the olap4j query model... but something seems wrong which 
> could be caused by mondrian.
> When I execute this MDX:
> 
> select NON EMPTY {[Measures].[Quantity]} ON COLUMNS,
>   NON EMPTY Crossjoin({[Product].[All Products]}, Order( 
> {[Order Status].[All Status Types],[Order Status].[All Status 
> Types].Children}, [Order Status].CurrentMember.Name, DESC))
>  ON ROWS
> from [SteelWheelsSales]
> 
> The order status is order by name correctly!
> 
> But when I remove the [Order Status].[All Status Types] from 
> the set thats being ordered.... the result is wrong... its 
> just like as if the Order() has no effect at all:
> 
> select NON EMPTY {[Measures].[Quantity]} ON COLUMNS,
>   NON EMPTY Crossjoin({[Product].[All Products]}, Order( 
> {[Order Status].[All Status Types].Children}, [Order 
> Status].CurrentMember.Name, DESC))
>  ON ROWS
> from [SteelWheelsSales]
> 
> I looked at the SQL but there was no sign of ORDER BY status 
> DESC ... that means mondrian must resolve that internally.
> 
> Am I misunderstanding something here or is this a bug in mondrian?
> 
> - Paul
> --------------------------------------------------------------
> ----------------
> Beautiful is writing same markup. Internet Explorer 9 supports
> standards for HTML5, CSS3, SVG 1.1,  ECMAScript5, and DOM L2 & L3.
> Spend less time writing and  rewriting code and more time 
> creating great
> experiences on the web. Be a part of the beta today.
> http://p.sf.net/sfu/beautyoftheweb
> _______________________________________________
> olap4j-devel mailing list
> olap4j-devel at lists.sourceforge.net
> https://lists.sourceforge.net/lists/listinfo/olap4j-devel
> 




More information about the Mondrian mailing list