Home | About | Sematext search-lucene.com search-hadoop.com
 Search Hadoop and all its subprojects:

Switch to Threaded View
Hive >> mail # dev >> Extending Explode


Copy link to this message
-
Re: Extending Explode
FYI,
  Brickhouse provides a numeric_range UDTF, which explodes integer values,
and an array_index UDF, so you could solve your problem by exploding on a
numeric range of the size of the array. ie.

select n, array_index(arr, n )
  from mytable
lateral view numeric_range(0, size(arr) -1 ) n1 as n
;

-- jerome
On Fri, Jul 26, 2013 at 6:40 AM, Edward Capriolo <[EMAIL PROTECTED]>wrote:

> So the explode output should be in the order of the array or the map you
> are exploding.
>
> I think you could use rank or row-sequence to give the exploded attay a
> number. If that does not wok adding a new udf might make more sence then
> extwnding in this case.:
>
> On Friday, July 26, 2013,  <[EMAIL PROTECTED]> wrote:
> > Hi,
> >
> > I'd like to make a patch that extends the functionality of "explode" to
> include an output column with the position of each item in the original
> array.
> >
> > I imagine this could be useful to the greater community and am wondering
> if I should extend the current explode function or if I should write a
> completely new function. Any thoughts on what will be more useful and more
> likely to be added to the hive-trunk would be greatly appreciated.
> >
> > Thanks,
> > Niko
> >
> >
>