I agree with Ted that this would be a great feature. You might need support from Optiq for parsing the SQL and representing the relational algebra before it is translated to the Drill physical algebra that you build. Unfortunately Optiq doesn't have that support yet (see https://issues.apache.org/jira/browse/OPTIQ-370) but we could expedite it.
(You're welcome to come to the Optiq hackathon on Wednesday and work on it there!) CUBE and ROLLUP have a related feature, GROUPING SETS. GROUPING SETS allows you to specify exactly which levels of aggregation you want. In my view, CUBE and ROLLUP are just syntactic sugar to allow you to ask for a lot of grouping sets at the same time (most of which you may not need). But to keep things simple, just implement CUBE at first. Add a 'boolean cube' field to the AggregationRelBase operator, so that GROUP BY CUBE(x, y, z) passes through the parser, validator, translator very similarly to GROUP BY x, y, z. When you have made the changes to the physical operator and you have some cube queries working correctly, circle back and implement GROUPING SETS, specifying exactly which grouping sets you want. Julian On Sun, Sep 14, 2014 at 7:05 AM, Timothy Chen <[email protected]> wrote: > Hi Matt, > > I'm also working on window functions (Yash is interested helping) and we > should work together. I already have a first patch that provides a physical > operator but now going to build on top of it to provide more flexible > ground work for different window functions and offets configurations. > > Tim > > Sent from my iPhone > > > On Sep 14, 2014, at 7:53 AM, Matt Burgess <[email protected]> wrote: > > > > I'm looking at some windowing functions (starting with rank functions > like row_number, rank, and dense_rank) right now, not sure if those count > as analytic functions for this discussion or not... > > > > Regards, > > Matt > > > > Sent from my iPhone > > > >> On Sep 14, 2014, at 2:28 AM, Ted Dunning <[email protected]> wrote: > >> > >> Uli, > >> > >> Which analytics functions do you mean? > >> > >> Does this impression of high priority mean that you are willing to work > on > >> these analytics functions? > >> > >> Michael is offering to implement these functions for his own > edification. > >> That is a great thing. Could you provide some guidance about which > >> functions you think would be more useful with some examples of why you > >> think so? > >> > >> > >> > >> > >> > >> > >>> On Sat, Sep 13, 2014 at 1:33 PM, Uli Bethke <[email protected]> > wrote: > >>> > >>> My personal opinion is that analytic functions should take a much > higher > >>> priority. No analytics database engine can live without these. In my > >>> opinion anything that you can do with ROLLUP/CUBE you can do with > analytic > >>> functions while the opposite is not true. > >>> > >>> Uli > >>> > >>> > >>>> On 13/09/2014 18:57, Michael Johnson wrote: > >>>> > >>>> For an advanced databases class project, I'm looking at adding CUBE > and > >>>> ROLLUP operators to Drill. (I'll be working up to that by trying out > some > >>>> smaller changes first to get a better understanding of Drill's code.) > >>>> > >>>> Does this sound like a feature that you might want to incorporate into > >>>> Drill? Any other thoughts about this idea? > >>>> > >>>> Michael > >>> >
