You are viewing a plain text version of this content. The canonical link for it is here.
Posted to user@drill.apache.org by Andrea Sella <me...@alkagin.xyz> on 2018/11/21 17:02:01 UTC

Write custom aggregate function

Hi,

I've just started with Apache Drill and I'd like to write a custom
aggregate function in order to concatenate array fields.

I have seen that the feature is still in alpha and before trying to make it
work I would like to know if at this stage my custom function is possible.

The main idea is trying to achieve something like this:
a,b
foo, [1,2,3]
foo, [3,5,6]

> select my_custom_fun(b) from table group by a
> foo, [1,2,3,3,5,6]

If it is possible, there are any other available documentation other than
this section[1]?

Thank you,
Andrea

[1] https://drill.apache.org/docs/developing-an-aggregate-function/

Re: Write custom aggregate function

Posted by Gautam Parai <gp...@mapr.com>.
Hi Andrea,

Hi,
>
> I tried to implement it using ObjectHolder and ComplexWriter and it doesn't
> seem possible to achieve something general at this point.
>
> Andrea


I would think it should be possible to achieve what you are trying to do
with the ObjectHolder and ComplexWriter. Could you please be more specific
with what you mean by "doesn't seem possible to achieve something general
at this point" ?

As Charles mentioned, please link your code so the community can take a
look and give suggestions.

Gautam

On Tue, Nov 27, 2018 at 6:58 AM Charles Givre <cg...@gmail.com> wrote:

> Hi Andrea,
> Can you post your code on github?
>
> > On Nov 27, 2018, at 17:44, Andrea Sella <me...@alkagin.xyz> wrote:
> >
> > Hi,
> >
> > I tried to implement it using ObjectHolder and ComplexWriter and it
> doesn't
> > seem possible to achieve something general at this point.
> >
> > Andrea
> >
> > On Wed, Nov 21, 2018 at 6:02 PM Andrea Sella <me...@alkagin.xyz> wrote:
> >
> >> Hi,
> >>
> >> I've just started with Apache Drill and I'd like to write a custom
> >> aggregate function in order to concatenate array fields.
> >>
> >> I have seen that the feature is still in alpha and before trying to make
> >> it work I would like to know if at this stage my custom function is
> >> possible.
> >>
> >> The main idea is trying to achieve something like this:
> >> a,b
> >> foo, [1,2,3]
> >> foo, [3,5,6]
> >>
> >>> select my_custom_fun(b) from table group by a
> >>> foo, [1,2,3,3,5,6]
> >>
> >> If it is possible, there are any other available documentation other
> than
> >> this section[1]?
> >>
> >> Thank you,
> >> Andrea
> >>
> >> [1]
> https://urldefense.proofpoint.com/v2/url?u=https-3A__drill.apache.org_docs_developing-2Dan-2Daggregate-2Dfunction_&d=DwICAg&c=cskdkSMqhcnjZxdQVpwTXg&r=jGaWXfAULy7L7yLSDM6rFQ&m=vUF9XwSOr0EJaZ-FqjyA9vNYrl91s9CuH7m_xkAYmXM&s=A-FpweWJq6cWdy5UQLXuxJND6Xmn0lOPTfiJHLTm_NI&e=
> >>
> >
> >
> > --
> > BR,
> > Andrea
>
>

Re: Write custom aggregate function

Posted by Charles Givre <cg...@gmail.com>.
Hi Andrea, 
Can you post your code on github?

> On Nov 27, 2018, at 17:44, Andrea Sella <me...@alkagin.xyz> wrote:
> 
> Hi,
> 
> I tried to implement it using ObjectHolder and ComplexWriter and it doesn't
> seem possible to achieve something general at this point.
> 
> Andrea
> 
> On Wed, Nov 21, 2018 at 6:02 PM Andrea Sella <me...@alkagin.xyz> wrote:
> 
>> Hi,
>> 
>> I've just started with Apache Drill and I'd like to write a custom
>> aggregate function in order to concatenate array fields.
>> 
>> I have seen that the feature is still in alpha and before trying to make
>> it work I would like to know if at this stage my custom function is
>> possible.
>> 
>> The main idea is trying to achieve something like this:
>> a,b
>> foo, [1,2,3]
>> foo, [3,5,6]
>> 
>>> select my_custom_fun(b) from table group by a
>>> foo, [1,2,3,3,5,6]
>> 
>> If it is possible, there are any other available documentation other than
>> this section[1]?
>> 
>> Thank you,
>> Andrea
>> 
>> [1] https://drill.apache.org/docs/developing-an-aggregate-function/
>> 
> 
> 
> -- 
> BR,
> Andrea


Re: Write custom aggregate function

Posted by Andrea Sella <me...@alkagin.xyz>.
Hi,

I tried to implement it using ObjectHolder and ComplexWriter and it doesn't
seem possible to achieve something general at this point.

Andrea

On Wed, Nov 21, 2018 at 6:02 PM Andrea Sella <me...@alkagin.xyz> wrote:

> Hi,
>
> I've just started with Apache Drill and I'd like to write a custom
> aggregate function in order to concatenate array fields.
>
> I have seen that the feature is still in alpha and before trying to make
> it work I would like to know if at this stage my custom function is
> possible.
>
> The main idea is trying to achieve something like this:
> a,b
> foo, [1,2,3]
> foo, [3,5,6]
>
> > select my_custom_fun(b) from table group by a
> > foo, [1,2,3,3,5,6]
>
> If it is possible, there are any other available documentation other than
> this section[1]?
>
> Thank you,
> Andrea
>
> [1] https://drill.apache.org/docs/developing-an-aggregate-function/
>


-- 
BR,
Andrea