Our Community is getting an upgrade! To get everything ready for the relaunch, we’ll be placing the site in read-only mode starting September 21st.
We really appreciate your understanding while we get things set up behind the scenes. Catch up on all the exciting details about the move here.
Need help or have questions? Drop us a line at [email protected]
Created 12-18-2015 08:48 AM
I would like to select one normal datatype column(primitive) column along with UDTF as follows.But it is throwing error like
SemanticException [Error 10081]: UDTF's are not supported outside the SELECT clause, nor nested in expressions
I understood the problem.Don't we have any way to do this.
Query is : select col1,explode(split(col2,'\\s')) from table_name;
assume col2 is int type and col2 is string.
Created 12-18-2015 10:25 AM
You have to use LATERAL VIEW to do it.
See this:
https://cwiki.apache.org/confluence/display/Hive/LanguageManual+LateralView
And an example here:
select s.code, exp.splitted
from sample_07 s
lateral view explode(split('asdfa adsfa asdaf asdfad','\\s')) exp as splitted
Created 12-18-2015 10:25 AM
You have to use LATERAL VIEW to do it.
See this:
https://cwiki.apache.org/confluence/display/Hive/LanguageManual+LateralView
And an example here:
select s.code, exp.splitted
from sample_07 s
lateral view explode(split('asdfa adsfa asdaf asdfad','\\s')) exp as splitted
Created 12-18-2015 10:35 AM
@Guilherme Braccialli thank you.its working.