Hadoop Hive How to split a single row into multiple rows

0 votes
I have a row with comma separated values. Now I want to create multiple rows for these values. How can I do this?
Nov 14, 2018 in Big Data Hadoop by slayer
• 29,370 points
9,422 views

1 answer to this question.

0 votes

Try this

SELECT ID1, Sub
FROM tableName lateral view explode(split(Subs,',')) Subs AS Sub  
answered Nov 14, 2018 by Omkar
• 69,220 points
what is SUBs and Sub?

Can u use actual column names

Example.

ID1    Subs
1     11, 22
2     22, 33

Now You want to split this table.

ID1   Sub
1     11
2     22
SELECT ID1, Sub
FROM tableName lateral view explode(split(Subs,',')) Subs AS Sub 

Now, it may clear your doubt.

Related Questions In Big Data Hadoop

0 votes
1 answer

Hadoop Hive: How to drop a table?

You cannot drop column directly from a ...READ MORE

answered Nov 14, 2018 in Big Data Hadoop by Omkar
• 69,220 points
2,017 views
0 votes
1 answer

Hadoop Hive Hbase: How to insert data into Hbase using Hive (JSON file)?

You can use the get_json_object function to parse the ...READ MORE

answered Nov 15, 2018 in Big Data Hadoop by Omkar
• 69,220 points
2,946 views
+1 vote
1 answer

How to limit the number of rows per each item in a Hive QL?

SELECT a_id, b, c, count(*) as sumrequests FROM ...READ MORE

answered Dec 1, 2018 in Big Data Hadoop by Omkar
• 69,220 points
27,080 views
+1 vote
1 answer

Hadoop Mapreduce word count Program

Firstly you need to understand the concept ...READ MORE

answered Mar 16, 2018 in Data Analytics by nitinrawat895
• 11,380 points
11,072 views
0 votes
1 answer

hadoop.mapred vs hadoop.mapreduce?

org.apache.hadoop.mapred is the Old API  org.apache.hadoop.mapreduce is the ...READ MORE

answered Mar 16, 2018 in Data Analytics by nitinrawat895
• 11,380 points
2,571 views
+2 votes
11 answers

hadoop fs -put command?

Hi, You can create one directory in HDFS ...READ MORE

answered Mar 16, 2018 in Big Data Hadoop by nitinrawat895
• 11,380 points
109,055 views
–1 vote
1 answer

Hadoop dfs -ls command?

In your case there is no difference ...READ MORE

answered Mar 16, 2018 in Big Data Hadoop by kurt_cobain
• 9,350 points
4,639 views
0 votes
1 answer

Hadoop Hive: How to convert multiple rows into comma separated values?

You can use the aggregator function collect_set to do ...READ MORE

answered Nov 14, 2018 in Big Data Hadoop by Omkar
• 69,220 points
5,462 views
0 votes
1 answer

Hadoop Hive: How to split string in Hive?

You can use the split function along ...READ MORE

answered Nov 6, 2018 in Big Data Hadoop by Omkar
• 69,220 points
12,071 views
webinar REGISTER FOR FREE WEBINAR X
REGISTER NOW
webinar_success Thank you for registering Join Edureka Meetup community for 100+ Free Webinars each month JOIN MEETUP GROUP