Search code examples
textapache-pigstore

apache pig, store result in a txt file


Hello i'm a new PIG user, I'm trying to stock some data in a txt file but when i'm using the STORE command, it creates a folder that contains the following files : _SUCCESS and part-r-00000.

How to get this result in a txt file ? Thanks.


Solution

  • This is how STORE output usually look like. You can run Hadoop fs command from inside pig so you can write something like the below inside your pig (see the documentation here)

    fs -getmerge /my/hdfs/output/dir/* /my/local/dir/result.txt
    fs -copyFromLocal /my/local/dir/result.txt /my/hdfs/other/output/dir/