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

The Archive Base Latest Questions

Editorial Team
  • 0
Editorial Team
Asked: June 7, 20262026-06-07T14:19:03+00:00 2026-06-07T14:19:03+00:00

I am counting average of numbers using Hadoop/Mapreduce with structure guid banid countview g1

  • 0

I am counting average of numbers using Hadoop/Mapreduce
with structure

guid banid countview

g1 b1 1

g1 b2 1

g1 b1 2

g1 b1 1

g2 b1 1

g2 b2 1

g2 b1 1

g2 b3 1

g3 b1 1

I want count average countview of each banid of guid?
(my mind is average=5/2 with guid g1 (2 is total numbers another banid: b1,b2))

  • 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-06-07T14:19:05+00:00Added an answer on June 7, 2026 at 2:19 pm

    So if i understand what you’re asking, the answer you’re looking for might look like:

    g1 b1 1
    g1 b2 1
    g1 b1 2
    g1 b1 1

    Average for “g1” = 5/2 (total count / unique banid count)

    First you need to break the problem down into your Map and Reduce stages. The objective is to group all the counts and banids for each “guid” in the reducer.

    Mapper:

    Output Key/Value types: Text / Text

    The output key is probably going to be a Text Writable which will contain the guid. The Value will contain the banid and the count (ie b1:1). This will group all the banids and counts for each guid.

    Reducer:

    Output Key/Value types: Text / FloatWritable

    You will now get a list of Text objects for each guid in the Key. Iterate through each Value object, spliting up the banid and the count. Create a set of the banids and sum the counts as you iterate. Once you’ve done this you should be able to calculate the average. Write out the average as a FloatWritable (or Text.. its up to you). The Key will be the same as the input key to the reduce.

    This is a simple approach to dealing with a value that needs to contain multiple pieces of information. A more advanced approach would be to create your own Writable object that wraps a Text and VIntWritable object.

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

Sidebar

Related Questions

I am using counting sort to sort a selection of numbers read from a
I want to ignore counting the length of characters in the text if there
hey huys im counting my table with this code: $county = mysql_query(SELECT COUNT(id) from
This is a counting sort algorithm. I want to change the last for loop
Actually I am in need of counting the visitors count for a particular document.
I've started differentiating two images by counting the number of different pixels using a
I was create a procedure for counting a question set using mssql. I post
There are plenty of script/tools for counting line of code, and some to count
remote: Counting objects: 610, done. remote: Compressing objects: 100% (352/352), done. remote: Total 610
I am using criteria for counting number of rows. consider a class class GroupMembership{

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.