Giter VIP home page Giter VIP logo

hadoop_map_reduce's Introduction

hadoop_map_reduce

I suppose that each line in input file is a transaction.

TokenizerMapper extends Mapper function.

In the map(), I try to count word If the key not in the hash map, we add(Key,1) into the hash map else, we put the (key,count+1) into the hash map After we have already got the hash map for one customer's transaction, we use a loop to send<item, <other_item,count>>

HashCombiner extends Reducer.

It is used to do the combination after map function. That means, for those have the same value of key, we will try to combine the mapwritable object, when there is two mapwritable object, if they have the same key, we will add the two count.

IntSumReducer extends reducer

It will transform the mapwritable object into map object. We will sort the map object according to the value. We create a results to store the order of the item. We will transform the string into Text object. Finally, we output the (key, output).

My input:

file01 :
book1, book2, cd1
book1, cd2

file02:
book1, book2, cd3
book1, book2, cd2

My output:

par-r-00000: (it's already sorted, though i didn't show the exact number to customer)

book1 book2 cd2 cd1 cd3
book2 book1 cd2 cd1 cd3
cd1 book2 book1
cd2 book1 book2
cd3 book2 book1

hadoop_map_reduce's People

Contributors

shuopwang avatar

Watchers

James Cloos avatar  avatar

Recommend Projects

  • React photo React

    A declarative, efficient, and flexible JavaScript library for building user interfaces.

  • Vue.js photo Vue.js

    ๐Ÿ–– Vue.js is a progressive, incrementally-adoptable JavaScript framework for building UI on the web.

  • Typescript photo Typescript

    TypeScript is a superset of JavaScript that compiles to clean JavaScript output.

  • TensorFlow photo TensorFlow

    An Open Source Machine Learning Framework for Everyone

  • Django photo Django

    The Web framework for perfectionists with deadlines.

  • D3 photo D3

    Bring data to life with SVG, Canvas and HTML. ๐Ÿ“Š๐Ÿ“ˆ๐ŸŽ‰

Recommend Topics

  • javascript

    JavaScript (JS) is a lightweight interpreted programming language with first-class functions.

  • web

    Some thing interesting about web. New door for the world.

  • server

    A server is a program made to process requests and deliver data to clients.

  • Machine learning

    Machine learning is a way of modeling and interpreting data that allows a piece of software to respond intelligently.

  • Game

    Some thing interesting about game, make everyone happy.

Recommend Org

  • Facebook photo Facebook

    We are working to build community through open source technology. NB: members must have two-factor auth.

  • Microsoft photo Microsoft

    Open source projects and samples from Microsoft.

  • Google photo Google

    Google โค๏ธ Open Source for everyone.

  • D3 photo D3

    Data-Driven Documents codes.