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

Pedro Alves pmgalves at gmail.com
Fri Sep 14 13:53:55 EDT 2012



I'm getting somewhere! It's almost fully working!!


https://github.com/webdetails/mondrian/commits/nativeagg


Basically I had to implement a new Evaluator.SetEvaluator . The 
reasoning behind it is the same as the NamedSetEvaluator (in fact, a 
namedset could very well be passed to this new SetEvaluator, as it's 
just a generalization).


Since we already had a bunch of changes in SqlConstraintUtils to allow 
supporting sets in queries, this work was mainly to expand the set, and 
seems really a good approach to me (at least comparing with the 
alternative approach of nested instanceofs).


The only think that I now need to support is topcount(set,( 
measures.something, dimension.aggregatedMember   )  to finish the case, 
but I'm 5/6 in success for MONDRIAN-1128



-pedro




On Fri 31 Aug 2012 12:45:24 AM WEST, Julian Hyde wrote:
> 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
>
> _______________________________________________
> Mondrian mailing list
> Mondrian at pentaho.org
> http://lists.pentaho.org/mailman/listinfo/mondrian


More information about the Mondrian mailing list