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,270 points
2,864 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,040 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,040 points
579 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,040 points
1,147 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 Nov 30, 2018 in Big Data Hadoop by Omkar
• 69,040 points
6,935 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
• 10,920 points
5,268 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
• 10,920 points
770 views
+1 vote
11 answers

hadoop fs -put command?

put syntax: put <localSrc> <dest> copy syntax: copyF ...READ MORE

answered Dec 7, 2018 in Big Data Hadoop by Aditya
32,036 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,310 points
1,982 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,040 points
1,753 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,040 points
5,943 views