pig tutorial - apache pig tutorial - How to Store pig result to local file ? - pig latin - apache pig - pig hadoop

How to Store Data

  • We can store the loaded data in the file system using the store operator. This explains how to store data in Apache Pig using the Store operator.


  • The syntax of the Store statement.
STORE Relation_name INTO ' required_directory_path ' 


  • Consider that we have a file student_data.txt in HDFS with the following content.

  • And we have read it into a relation student using the LOAD operator as shown below.
grunt> student = LOAD 'hdfs://localhost:9000/pig_data/student_data.txt' 
   USING PigStorage(',')
   as ( id:int, firstname:chararray, lastname:chararray, phone:chararray, 
   city:chararray );

  • We can merging everything to a single file then we can use the copyToLocal command in grunt
grunt> copyToLocal <src> <dest>

Related Searches to How to Store pig result to local file

Adblocker detected! Please consider reading this notice.

We've detected that you are using AdBlock Plus or some other adblocking software which is preventing the page from fully loading.

We don't have any banner, Flash, animation, obnoxious sound, or popup ad. We do not implement these annoying types of ads!

We need money to operate the site, and almost all of it comes from our online advertising.

Please add wikitechy.com to your ad blocking whitelist or disable your adblocking software.