Something similar to what Julian mentioned in the mail thread -  by adding
new commands for parsing.

| < STDDEV_POP: "STDDEV_POP" >
| < STDDEV_SAMP: "STDDEV_SAMP" >

Thanks.

On Mon, Sep 22, 2014 at 8:58 PM, Yash Sharma <[email protected]> wrote:

> Cool. So do we add the new function definitions in the CombinedParser.jj
> in Optiq?
> I see that we did something like that for standard deviation functions.
>
>
> On Mon, Sep 22, 2014 at 8:49 PM, Jinfeng Ni <[email protected]> wrote:
>
>> There are some differences between Drill simple functions and aggregate
>> functions.
>>
>> For Drill simple function, optiq will check Drill function registry
>> whether
>> a function exists. So, all you need to is to provide the function
>> template,
>> the function converter will automatically add the  function template into
>> function registry.
>>
>> Aggregate functions are different in that simple function could appear
>> anywhere in the query, while aggregate function could be only in certain
>> clause ( no aggregation function in where clause, etc).  Optiq have to
>> know
>> one certain function is aggregate function, in order to validate such
>> logic.  Seems we either need modify optiq to let it know new function
>> "regr_avgx"
>> is an aggregate, or Drill need provide a way to let optiq know "regr_avgx"
>> is aggregate function, not simple function.
>>
>>
>>
>> On Mon, Sep 22, 2014 at 7:42 AM, Jason Altekruse <
>> [email protected]>
>> wrote:
>>
>> > Hi Yash,
>> >
>> > I did not work on the code for this, but if the functions are just
>> acting
>> > on columns to provide aggregates I believe they are just supported by
>> > Drills default mechanism for tying into the parser. We ended up
>> modifying
>> > the parser with some FreeMarker hooks that allows for consumers of
>> optiq to
>> > provide custom syntax that extends the parser without forking the whole
>> > thing.
>> >
>> > I believe that this works together with our function registry to provide
>> > default support for UDFs (which our system functions are defined in the
>> > same way as UDFs) without having to modify the parser itself. I haven't
>> had
>> > any trouble just adding new DrillFuncs and having them be discovered by
>> > Drill and work after a new build. I believe I have only written scalar
>> > functions and not aggregations, but you can look at the SumFunctions
>> class
>> > for some reference on the differences.
>> >
>> > -Jason
>> >
>> > On Mon, Sep 22, 2014 at 7:50 AM, Yash Sharma <[email protected]> wrote:
>> >
>> > > Hi All,
>> > > I am planning to add new drill functions to optiq syntax for parsing.
>> > > We have new functions like regr_avgx/regr_avgy etc and existing ones
>> like
>> > > covar_samp,covar_pop, correlation/corr etc.
>> > >
>> > > Going through this old thread[1] I see that we need to add the
>> > definitions
>> > > in the CombinedParser.jj[2] in Optiq.
>> > >
>> > > Is that the way we still use or its handled differently now ?
>> > >
>> > > Thanks.
>> > >
>> > > 1: https://groups.google.com/forum/#!topic/optiq-dev/dkkxsHh2MnE
>> > > 2.
>> > >
>> > >
>> >
>> https://github.com/yssharma/optiq/blob/retired/core/src/main/codegen/templates/CombinedParser.jj
>> > >
>> >
>>
>
>

Reply via email to