Sign Up

Sign Up to our social questions and Answers Engine to ask questions, answer people’s questions, and connect with other people.

Have an account? Sign In

Have an account? Sign In Now

Sign In

Login to our social questions & Answers Engine to ask questions answer people’s questions & connect with other people.

Sign Up Here

Forgot Password?

Don't have account, Sign Up Here

Forgot Password

Lost your password? Please enter your email address. You will receive a link and will create a new password via email.

Have an account? Sign In Now

You must login to ask a question.

Forgot Password?

Need An Account, Sign Up Here

Please briefly explain why you feel this question should be reported.

Please briefly explain why you feel this answer should be reported.

Please briefly explain why you feel this user should be reported.

Sign InSign Up

The Archive Base

The Archive Base Logo The Archive Base Logo

The Archive Base Navigation

  • SEARCH
  • Home
  • About Us
  • Blog
  • Contact Us
Search
Ask A Question

Mobile menu

Close
Ask a Question
  • Home
  • Add group
  • Groups page
  • Feed
  • User Profile
  • Communities
  • Questions
    • New Questions
    • Trending Questions
    • Must read Questions
    • Hot Questions
  • Polls
  • Tags
  • Badges
  • Buy Points
  • Users
  • Help
  • Buy Theme
  • SEARCH
Home/ Questions/Q 6183167
In Process

The Archive Base Latest Questions

Editorial Team
  • 0
Editorial Team
Asked: May 24, 20262026-05-24T01:19:11+00:00 2026-05-24T01:19:11+00:00

I have a Pig job which analyzes log files and write summary output to

  • 0

I have a Pig job which analyzes log files and write summary output to S3. Instead of writing the output to S3, I want to convert it to a JSON payload and POST it to a URL.

Some notes:

  • This job is running on Amazon Elastic MapReduce.
  • I can use a STREAM to pipe the data through an external command, and load it from there. But because Pig never sends an EOF to external commands, this means I need to POST each row as it arrives, and I can’t batch them. Obviously, this hurts performance.

What’s the best way to address this problem? Is there something in PiggyBank or another library that I can use? Or should I write a new storage adapter? Thank you for your advice!

  • 1 1 Answer
  • 0 Views
  • 0 Followers
  • 0
Share
  • Facebook
  • Report

Leave an answer
Cancel reply

You must login to add an answer.

Forgot Password?

Need An Account, Sign Up Here

1 Answer

  • Voted
  • Oldest
  • Recent
  • Random
  1. Editorial Team
    Editorial Team
    2026-05-24T01:19:12+00:00Added an answer on May 24, 2026 at 1:19 am

    As it turns out, Pig does correctly send EOF to external commands, so you do have the option of streaming everything through an external script. If it isn’t working, then you probably have a hard-to-debug configuration problem.

    Here’s how to get started. Define an external command as follows, using whatever interpreter and script you need:

    DEFINE UPLOAD_RESULTS `env GEM_PATH=/usr/lib/ruby/gems/1.9.0 ruby1.9 /home/hadoop/upload_results.rb`;
    

    Stream the results through your script:

    /* Write our results to our Ruby script for uploading.  We add
       a trailing bogus DUMP to make sure something actually gets run. */
    empty = STREAM results THROUGH UPLOAD_RESULTS;
    DUMP empty;
    

    From Ruby, you can batch the input records into blocks of 1024:

    STDIN.each_line.each_slice(1024) do |chunk|
      # 'chunk' is an array of 1024 lines, each consisting of tab-separated
      # fields followed by a newline. 
    end
    

    If this fails to work, check the following carefully:

    1. Does your script work from the command line?
    2. When run from Pig, does your script have all the necessary environment variables?
    3. Are your EC2 bootstrap actions working correctly?

    Some of these are hard to verify, but if any of them are failing, you can easily waste quite a lot of time debugging.

    Note, however, that you should strongly consider the alternative approaches recommended by mat kelcey.

    • 0
    • Reply
    • Share
      Share
      • Share on Facebook
      • Share on Twitter
      • Share on LinkedIn
      • Share on WhatsApp
      • Report

Sidebar

Related Questions

how to declare a variable in PIG? suppose i want to have a integer
I have a script (it's a hadoop pig script to b precice) from which
Hi folks I have a block of text which i want to split in
I have a pig job where in I need to filter the data by
We have a cluster (hadoop, pig) which churns data 350Gb (growing couple of GB
I want to use Apache pig , but until now I have just parsed
I have a List<Animal> which contains objects of type Cat , Dog and Pig
I have a file in hdfs with 100 columns, which i want to proces
Assume I have the following input in Pig: some And I would like to
I have a string $str = 'abcde-da__123123213.xef'; $str2 = 'asdfasd__2342352353.gff'; $str3 = 'twethe__3242323423.pig'; I

Explore

  • Home
  • Add group
  • Groups page
  • Communities
  • Questions
    • New Questions
    • Trending Questions
    • Must read Questions
    • Hot Questions
  • Polls
  • Tags
  • Badges
  • Users
  • Help
  • SEARCH

Footer

© 2021 The Archive Base. All Rights Reserved
With Love by The Archive Base

Insert/edit link

Enter the destination URL

Or link to existing content

    No search term specified. Showing recent items. Search or use up and down arrow keys to select an item.