Pig is used in shell to load and process files in batches

Source: Internet
Author: User

First, I want to process many documents in a folder in batches. These documents save the data I want to process, because pig is a beginner ,, so I don't know how to load data in batches, and I haven't written it.

Your UDF can only load files one by one and then process them.

But this is definitely not the way I want to handle it, so I think it is possible to insert the pig script into the shell and then execute it cyclically.

The final attempt was successful. Of course, I believe that the pig UDF can define this load method by myself, but for quick implementation

Use this method first.

The following is the shell code:

Mkdir result_0925_d2for eachfile in 'LS-B | grep 00. * 'do echo $ eachfile input _ = $ eachfile output _ =. /result_0925_d2/$ input _ echo $ output _ file = "$ input _" file_out = "$ output _" pig-Param input = $ file-Param output = $ file_out-x local new_getresult.pigdone

The most important thing is to input and output file loops during pig execution.

Pig is used in shell to load and process files in batches

Related Article

Contact Us

The content source of this page is from Internet, which doesn't represent Alibaba Cloud's opinion; products and services mentioned on that page don't have any relationship with Alibaba Cloud. If the content of the page makes you feel confusing, please write us an email, we will handle the problem within 5 days after receiving your email.

If you find any instances of plagiarism from the community, please send an email to: info-contact@alibabacloud.com and provide relevant evidence. A staff member will contact you within 5 working days.

A Free Trial That Lets You Build Big!

Start building with 50+ products and up to 12 months usage for Elastic Compute Service

  • Sales Support

    1 on 1 presale consultation

  • After-Sales Support

    24/7 Technical Support 6 Free Tickets per Quarter Faster Response

  • Alibaba Cloud offers highly flexible support services tailored to meet your exact needs.