Re: IMPALA-4326 - split() function
That standard 2016 spec did not predate hive's implementation of lateral view On Sunday, July 9, 2017, Greg Rahn wrote: > (also commented on IMPALA-4326) > > For this functionality, I'd prefer to follow what Postgres does and use its > well-named functions like string_to_array(). > This becomes powerful when using the unnest() table function, which is > defined and is part of the ANSI/ISO SQL:2016 spec (vs the non-standard > lateral view explode Hive syntax). > > with t as ( > select > 42 as id, > '1,2,3,4,5,6'::text as string_array > ) > select > t.id, > u.l > from t, unnest(string_to_array(t.string_array,',')) as u(l); > > id | l > +--- > 42 | 1 > 42 | 2 > 42 | 3 > 42 | 4 > 42 | 5 > 42 | 6 > > > On Mon, Jun 19, 2017 at 7:40 AM, Alexander Behm > > wrote: > > > Yes and no. Extending the UDF framework might be hard, but I think > > implementing a built-in split() is feasible. We already have a built-in > > Expr that returns an array type to implement unnest. > > > > On Mon, Jun 19, 2017 at 6:22 AM, Vincent Tran > wrote: > > > > > This request appears to be blocked by the current UDF framework's > > > limitation. > > > As far as I can tell, functions can still only return simple scalar > > types, > > > right? > > > > > > -- Sorry this was sent from mobile. Will do less grammar and spell check than usual.
Re: IMPALA-4326 - split() function
(also commented on IMPALA-4326) For this functionality, I'd prefer to follow what Postgres does and use its well-named functions like string_to_array(). This becomes powerful when using the unnest() table function, which is defined and is part of the ANSI/ISO SQL:2016 spec (vs the non-standard lateral view explode Hive syntax). with t as ( select 42 as id, '1,2,3,4,5,6'::text as string_array ) select t.id, u.l from t, unnest(string_to_array(t.string_array,',')) as u(l); id | l +--- 42 | 1 42 | 2 42 | 3 42 | 4 42 | 5 42 | 6 On Mon, Jun 19, 2017 at 7:40 AM, Alexander Behm wrote: > Yes and no. Extending the UDF framework might be hard, but I think > implementing a built-in split() is feasible. We already have a built-in > Expr that returns an array type to implement unnest. > > On Mon, Jun 19, 2017 at 6:22 AM, Vincent Tran wrote: > > > This request appears to be blocked by the current UDF framework's > > limitation. > > As far as I can tell, functions can still only return simple scalar > types, > > right? > > >
Re: IMPALA-4326 - split() function
Yes and no. Extending the UDF framework might be hard, but I think implementing a built-in split() is feasible. We already have a built-in Expr that returns an array type to implement unnest. On Mon, Jun 19, 2017 at 6:22 AM, Vincent Tran wrote: > This request appears to be blocked by the current UDF framework's > limitation. > As far as I can tell, functions can still only return simple scalar types, > right? >