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 6188953
In Process

The Archive Base Latest Questions

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

I got stuck for a few days because I want to create a custom

  • 0

I got stuck for a few days because I want to create a custom map reduce program based on my query on hive, I found not many examples after googling and I’m still confused about the rule.

What is the rule to create my custom mapreduce program, how about the mapper and reducer class?

Can anyone provide any solution?

I want to develop this program in Java, but I’m still stuck ,and then when formatting output in collector, how do I format the result in mapper and reducer class?

Does anybody want to give me some example and explanation about this kind of stuff?

  • 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-24T02:19:27+00:00Added an answer on May 24, 2026 at 2:19 am

    There are basically 2 ways to add custom mappers/reducers to hive queries.

    1. using transform

    SELECT TRANSFORM(stuff1, stuff2) FROM table1 USING ‘script’ AS thing1,
    thing2

    where stuff1, stuff2 are the fields in table1 and script is any executable which accepts the format i describe later. thing1, thing2 are the outputs from script

    1. using map and reduce
    FROM (
        FROM table
        MAP table.f1 table.f2
        USING 'map_script'
        AS mp1, mp2
        CLUSTER BY mp1) map_output
      INSERT OVERWRITE TABLE someothertable
        REDUCE map_output.mp1, map_output.mp2
        USING 'reduce_script'
        AS reducef1, reducef2;
    

    This is slightly more complicated but gives more control. There are 2 parts to this. In the first part the mapper script will receive data from table and map it to fields mp1 and mp2. these are then passed on to reduce_script, this script will receive sorted output on the key, which we have specified in CLUSTER BY mp1. mind you, more than one key will be handled by one reducer. The output of the reduce script will go to table someothertable

    Now all these scripts follow a simple pattern. they will read line by line from stdin. The fields will be \t separated and they will write back to stdout, in the same manner ( fields separated by ‘\t’ )

    Check out this blog, there are some nice examples.

    http://dev.bizo.com/2009/07/custom-map-scripts-and-hive.html

    http://dev.bizo.com/2009/10/reduce-scripts-in-hive.html

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

Sidebar

Related Questions

I got a problem stuck me few days, tried several ways still can't figure
I have been working on this for few hours and got stuck, so how
Okay, so the issue I'm being stuck at for few days already is that
I'm writing a kind of Remote Desktop program and I got stuck with a
I kinda got stuck at trying to combine a few queries. What I got
I recently launched my desktop application and it got cracked after a few days.
Okay, I was going through a few programming exercises, and got stuck with one
I try to understand a few things in Cocoa but I got stuck on
I started reading about implementing various data structures a few days back, and got
Got stuck here: http://jsfiddle.net/UFkg8/ Right now the animation is top-down. What do I need

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.