drill-dev mailing list archives

Site index · List index
Message view « Date » · « Thread »
Top « Date » · « Thread »
From Ted Dunning <ted.dunn...@gmail.com>
Subject question about correlated arrays and flatten
Date Fri, 29 May 2015 13:43:21 GMT
I have two arrays.  Their elements are correlated times and values.  I
would like to flatten them into rows, each with two elements.

The query

   select flatten(a), flatten(b) from ...

doesn't work because I get the cartesian product (of course).  The query

   select flatten(a, b) from ...

also doesn't work because flatten doesn't have a multi-argument form.

Going crazy, this query kind of sort of almost works, but not really:

     select r.x.`key`, flatten(r.x.`value`)  from (

         select flatten(kvgen(x)) as x from ...) r;

What I really want to see is something like this:
   select zip(flatten(a), flatten(b)) from ...

Any pointers?  Is my next step to write a UDF?

Mime
  • Unnamed multipart/alternative (inline, None, 0 bytes)
View raw message