Forums Register Login
How to update records in PIG
(1 like)
I want to update/delete some records in pig, I want to know how to achieve that in pig.

ID Name
1 A
2 B
3 C
4 D
5 E
I want to update value of ID = 3 and delete record with ID =5 so that my expected table will have records like :

1 A
2 B
3 Z
4 D
How to achieve the above result?
Assuming your data is in files on HDFS, my understanding is that you cannot really do arbitrary in-place updates like you would with SQL in a relational database. You would probably need to read the data and modify the relevant records before writing it all back to HDFS. If you're using Hive or HBase to store your data, then maybe there are other options available, but in-place updates are not really what Hadoop is intended for.
You can't update the Pig values.
The same issue was mention in Pig issue list- https://issues.apache.org/jira/browse/PIG-1693
Pig script language called Pig Latin, used for filtering of the data.
Although hortonworks comes with Project_Range Expression that can help resolve this issue.
Check the link here: http://hortonworks.com/blog/new-apache-pig-0-9-features-part-3-additional-features/

But you can change some specific values check this links:

To learn more about Pig check this Pig tutorials:
Pig is not a database in which you can update/delete data. It basically reads data from HDFS/local file system and does operations on it. So you should not try updating/deleting that data.

This thread has been viewed 2592 times.

All times above are in ranch (not your local) time.
The current ranch time is
Oct 16, 2018 00:50:19.