Java Program for MapReduce processing data

Source: Internet
Author: User

1, through the traditional Key-value class analysis data

When you create a key class, all keys inherit the Writablecomparable interface

public class Sendorkey implements Writablecomparable

{

Default Constructor+parameterized constructor

Implementation of ReadFields method

Implementation of Write method

Overriding the Compare to method

}

Sensorkey.java

Sensorvalue.java

"Note: The default constructor initializes the variable

Constructors with parameters initialize class variables with their parameter values

The default ReadFields method parameter is datainput, regardless of what the content is, we use the Readfield method to accept and pass the data entered into this class, regardless of the dataoutput content, the Write method will output the data

In the Compreto method logic, we will compare the different sensors

Each property contains a get and set method "

2, creating a customized Recordreader class (how to create a custom Recordreader Class)

"Note: The custom Recordreader will inherit the default Recordreader, his parameters when the custom Key,value type, in Nextkeyvalue, we get the current value from the reader that contains the full record. Records, the columns are split according to the TDB key, and the first three columns are assigned to the key class, and the value class is assigned a value of "

3.creating a customized InputFormat class

Java Program for MapReduce processing data

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.