[Mondrian] Native expressions - allowing aggregated members on native topcount

Julian Hyde jhyde at pentaho.com
Thu Aug 30 19:45:24 EDT 2012


We'd always like to push more stuff down for native SQL evaluation. But pushing a general aggregation expression down is hard (the expressions don't often turn into clean SQL). If there are only a few members in the slicer, the code in executeStrip isn't too bad.

Julian


On Aug 29, 2012, at 11:37 AM, Pedro Alves <pmgalves at gmail.com> wrote:

> 
> 
> My goal with my previous bug is to allow native top counts to be used 
> with sets.
> 
> 
> And I'm a bit lost here...
> 
> 
> AA)
> 
> this seems natural to me:
> 
> with set a as '([Time].[1997].[Q1] : [Time].[1997].[Q2])'
> member Time.x as Aggregate(a,[Measures].[Store Sales])
> member Measures.x1 as ([Time].[1997].[Q1],[Measures].[Store Sales])
> member Measures.x2 as ([Time].[1997].[Q2],[Measures].[Store Sales])
> set products as TopCount(Product.[Product 
> Name].Members,2,Measures.[Store Sales])
> SELECT
> NON EMPTY products ON 1,
> NON EMPTY {[Measures].[Store Sales], Measures.x1, Measures.x2} ON 0
> FROM [Sales]
> -- where ([Time].[1997].[Q1] : [Time].[1997].[Q2])
> where Time.x
> 
> 
> but native evaluations don't allow for calculated members. Would it be a 
> good idea to try to support aggregates to be used in native evaluations?
> 
> 
> 
> BB)
> 
> with set a as '([Time].[1997].[Q1] : [Time].[1997].[Q2])'
> member Time.x as Aggregate(a,[Measures].[Store Sales])
> member Measures.x1 as ([Time].[1997].[Q1],[Measures].[Store Sales])
> member Measures.x2 as ([Time].[1997].[Q2],[Measures].[Store Sales])
> set products as TopCount(Product.[Product 
> Name].Members,2,Measures.[Store Sales])
> SELECT
> NON EMPTY products ON 1,
> NON EMPTY {[Measures].[Store Sales], Measures.x1, Measures.x2} ON 0
> FROM [Sales]
> where ([Time].[1997].[Q1] : [Time].[1997].[Q2])
> -- where Time.x
> 
> This works... well, apart from the bug I mentioned before. But I don't 
> like it a lot; RolapResults:executeStripe does this:
> 
>             RolapAxis axis = (RolapAxis) slicerAxis;
>             TupleList tupleList = axis.getTupleList();
>             for (List<Member> members : tupleList) {
> 
> And will do the entire evaluation for every member of that tupleList. 
> That's a lot of processing power.
> 
> 
> CC)
> 
> Is there any other way of doing this queries that I'm not seeing? Seems 
> to me that I'm over complicating things when all I want is to start my 
> query with a calculated set that I want to be natively evaluated...
> 
> 
> 
> 
> -pedro
> 
> 
> 
> _______________________________________________
> Mondrian mailing list
> Mondrian at pentaho.org
> http://lists.pentaho.org/mailman/listinfo/mondrian



More information about the Mondrian mailing list