You are viewing a plain text version of this content. The canonical link for it is here.
Posted to dev@drill.apache.org by Jim Scott <js...@maprtech.com> on 2015/06/29 23:23:07 UTC

Opposite of FLATTEN

Given a data set:
'ndb_no','description'
'02001','SPICE OR HERB (US CFR)'
'02001','ALLSPICE'
'02001','FINELY GROUND'
'02001','NOT HEAT-TREATED'
'02001','COOKING METHOD NOT APPLICABLE'
'02001','WATER REMOVED'
'02001','NATURALLY DRIED'
'02001','SUN DRIED'

I'm seeking the capability to be able execute a query like:
SELECT primary_key, CONCAT(description, ', ') from mytable group by
primary_key
(regardless of what the function name is, concat, array_aggregate, etc..)

to yield results like:
'02001','SPICE OR HERB (US CFR), ALLSPICE, FINELY GROUND, NOT HEAT-TREATED,
COOKING METHOD NOT APPLICABLE, WATER REMOVED, NATURALLY DRIED, SUN DRIED'

Does any functionality like this exist? If not, do we have any JIRA tickets
that are asking for this?

Thanks,
Jim

Re: Opposite of FLATTEN

Posted by Ted Dunning <te...@gmail.com>.
I could write a custom Hive aggregator, but I want to use Drill and get all
the performance possible.



On Mon, Jun 29, 2015 at 7:02 PM, Venky Kandaswamy <ve...@adisya.com> wrote:

> Couldn¹t you write a custom aggregate function in Hive? (I don¹t have
> one).
> Thanks, Venky
>
> On 6/29/15, 6:41 PM, "Ted Dunning" <te...@gmail.com> wrote:
>
> >Like array_agg in postgres:
> >
> >http://www.craigkerstiens.com/2013/04/17/array-agg/
> >
> >
> >
> >On Mon, Jun 29, 2015 at 2:23 PM, Jim Scott <js...@maprtech.com> wrote:
> >
> >> Given a data set:
> >> 'ndb_no','description'
> >> '02001','SPICE OR HERB (US CFR)'
> >> '02001','ALLSPICE'
> >> '02001','FINELY GROUND'
> >> '02001','NOT HEAT-TREATED'
> >> '02001','COOKING METHOD NOT APPLICABLE'
> >> '02001','WATER REMOVED'
> >> '02001','NATURALLY DRIED'
> >> '02001','SUN DRIED'
> >>
> >> I'm seeking the capability to be able execute a query like:
> >> SELECT primary_key, CONCAT(description, ', ') from mytable group by
> >> primary_key
> >> (regardless of what the function name is, concat, array_aggregate,
> >>etc..)
> >>
> >> to yield results like:
> >> '02001','SPICE OR HERB (US CFR), ALLSPICE, FINELY GROUND, NOT
> >>HEAT-TREATED,
> >> COOKING METHOD NOT APPLICABLE, WATER REMOVED, NATURALLY DRIED, SUN
> >>DRIED'
> >>
> >> Does any functionality like this exist? If not, do we have any JIRA
> >>tickets
> >> that are asking for this?
> >>
> >> Thanks,
> >> Jim
> >>
>
>
>

Re: Opposite of FLATTEN

Posted by Venky Kandaswamy <ve...@adisya.com>.
Couldn¹t you write a custom aggregate function in Hive? (I don¹t have
one). 
Thanks, Venky

On 6/29/15, 6:41 PM, "Ted Dunning" <te...@gmail.com> wrote:

>Like array_agg in postgres:
>
>http://www.craigkerstiens.com/2013/04/17/array-agg/
>
>
>
>On Mon, Jun 29, 2015 at 2:23 PM, Jim Scott <js...@maprtech.com> wrote:
>
>> Given a data set:
>> 'ndb_no','description'
>> '02001','SPICE OR HERB (US CFR)'
>> '02001','ALLSPICE'
>> '02001','FINELY GROUND'
>> '02001','NOT HEAT-TREATED'
>> '02001','COOKING METHOD NOT APPLICABLE'
>> '02001','WATER REMOVED'
>> '02001','NATURALLY DRIED'
>> '02001','SUN DRIED'
>>
>> I'm seeking the capability to be able execute a query like:
>> SELECT primary_key, CONCAT(description, ', ') from mytable group by
>> primary_key
>> (regardless of what the function name is, concat, array_aggregate,
>>etc..)
>>
>> to yield results like:
>> '02001','SPICE OR HERB (US CFR), ALLSPICE, FINELY GROUND, NOT
>>HEAT-TREATED,
>> COOKING METHOD NOT APPLICABLE, WATER REMOVED, NATURALLY DRIED, SUN
>>DRIED'
>>
>> Does any functionality like this exist? If not, do we have any JIRA
>>tickets
>> that are asking for this?
>>
>> Thanks,
>> Jim
>>



Re: Opposite of FLATTEN

Posted by Ted Dunning <te...@gmail.com>.
Like array_agg in postgres:

http://www.craigkerstiens.com/2013/04/17/array-agg/



On Mon, Jun 29, 2015 at 2:23 PM, Jim Scott <js...@maprtech.com> wrote:

> Given a data set:
> 'ndb_no','description'
> '02001','SPICE OR HERB (US CFR)'
> '02001','ALLSPICE'
> '02001','FINELY GROUND'
> '02001','NOT HEAT-TREATED'
> '02001','COOKING METHOD NOT APPLICABLE'
> '02001','WATER REMOVED'
> '02001','NATURALLY DRIED'
> '02001','SUN DRIED'
>
> I'm seeking the capability to be able execute a query like:
> SELECT primary_key, CONCAT(description, ', ') from mytable group by
> primary_key
> (regardless of what the function name is, concat, array_aggregate, etc..)
>
> to yield results like:
> '02001','SPICE OR HERB (US CFR), ALLSPICE, FINELY GROUND, NOT HEAT-TREATED,
> COOKING METHOD NOT APPLICABLE, WATER REMOVED, NATURALLY DRIED, SUN DRIED'
>
> Does any functionality like this exist? If not, do we have any JIRA tickets
> that are asking for this?
>
> Thanks,
> Jim
>