drill-dev mailing list archives

Site index · List index
Message view « Date » · « Thread »
Top « Date » · « Thread »
From Jason Altekruse <altekruseja...@gmail.com>
Subject Re: question about correlated arrays and flatten
Date Fri, 29 May 2015 16:58:41 GMT
I understand what you want to do, unfortunately we don't have support for
this right now. A UDF is the best I can suggest at this point.

Just to explore the idea a little further for the sake of creating a
complete feature request, I assume you would just want nulls filled in for
the cases where the lists were different lengths?

On Fri, May 29, 2015 at 8:58 AM, Ted Dunning <ted.dunning@gmail.com> wrote:

> Input is here: https://gist.github.com/tdunning/07ce66e7e4d4af41afd7
>
> Output is here: https://gist.github.com/tdunning/3aa841c56bfcdc0ab90e
>
> log-synth schema for generating input data is here:
> https://gist.github.com/tdunning/638dd52c00569ffa9582
>
>
> Preferred syntax would be like
>
> select flatten(t, v1, v2) from ...
>
>
>
>
> On Fri, May 29, 2015 at 7:04 AM, Neeraja Rentachintala <
> nrentachintala@maprtech.com> wrote:
>
> > Ted
> > can you pls give an example with few data elements in a, b and the
> expected
> > output you are looking from the query.
> >
> > -Neeraja
> >
> > On Fri, May 29, 2015 at 6:43 AM, Ted Dunning <ted.dunning@gmail.com>
> > wrote:
> >
> > > 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