You are viewing a plain text version of this content. The canonical link for it is here.
Posted to user@hive.apache.org by ZORAIDA HIDALGO SANCHEZ <zo...@tid.es> on 2014/02/04 16:23:24 UTC

collect_list on two columns of the same row

Dear all,

I need to call to one of my UDFs that receives two arrays as a parameters. Each of these arrays represents the result of collect_list(col) after doing group by. Does the first position of the first array correspond with the first position to the second array?

Por instace, having this:

col11 col21 col31
col12 col22 col32
col13 col23 col33

i would expect :
select col3,
            result
from (
         select col3, collect_list(col1) as col1_list,collect_list(col2) as col2_list
         from my_table
         group by col3 ) tmp
lateral view my_udf([col11,col12,col13],[col21,col22,col23])tmp as result

is that correct?

Thanks.

Zoraida.-

________________________________

Este mensaje se dirige exclusivamente a su destinatario. Puede consultar nuestra política de envío y recepción de correo electrónico en el enlace situado más abajo.
This message is intended exclusively for its addressee. We only send and receive email on the basis of the terms set out at:
http://www.tid.es/ES/PAGINAS/disclaimer.aspx

Re: collect_list on two columns of the same row

Posted by ZORAIDA HIDALGO SANCHEZ <zo...@tid.es>.
Dear all,

other question, related with the previous one is: can I assume that map_values(map) and map_keys(map) are going to be correlated? That is:

having this map: {k1:v1, k2:v2},

map_values will return [v1,v2] and
map_keys will return [k1,k2]

or

map_values will return [v2,v1] and
map_keys will return [k2,k1]

Thanks.

Zoraida.-

De: zoraida <zo...@tid.es>>
Responder a: "user@hive.apache.org<ma...@hive.apache.org>" <us...@hive.apache.org>>
Fecha: martes, 4 de febrero de 2014 16:23
Para: "user@hive.apache.org<ma...@hive.apache.org>" <us...@hive.apache.org>>
Asunto: collect_list on two columns of the same row

Dear all,

I need to call to one of my UDFs that receives two arrays as a parameters. Each of these arrays represents the result of collect_list(col) after doing group by. Does the first position of the first array correspond with the first position to the second array?

Por instace, having this:

col11 col21 col31
col12 col22 col32
col13 col23 col33

i would expect :
select col3,
            result
from (
         select col3, collect_list(col1) as col1_list,collect_list(col2) as col2_list
         from my_table
         group by col3 ) tmp
lateral view my_udf([col11,col12,col13],[col21,col22,col23])tmp as result

is that correct?

Thanks.

Zoraida.-

________________________________

Este mensaje se dirige exclusivamente a su destinatario. Puede consultar nuestra política de envío y recepción de correo electrónico en el enlace situado más abajo.
This message is intended exclusively for its addressee. We only send and receive email on the basis of the terms set out at:
http://www.tid.es/ES/PAGINAS/disclaimer.aspx

________________________________

Este mensaje se dirige exclusivamente a su destinatario. Puede consultar nuestra política de envío y recepción de correo electrónico en el enlace situado más abajo.
This message is intended exclusively for its addressee. We only send and receive email on the basis of the terms set out at:
http://www.tid.es/ES/PAGINAS/disclaimer.aspx