1 /**
2 * Copyright 2010 The Apache Software Foundation
3 *
4 * Licensed to the Apache Software Foundation (ASF) under one
5 * or more contributor license agreements. See the NOTICE file
6 * distributed with this work for additional information
7 * regarding copyright ownership. The ASF licenses this file
8 * to you under the Apache License, Version 2.0 (the
9 * "License"); you may not use this file except in compliance
10 * with the License. You may obtain a copy of the License at
11 *
12 * http://www.apache.org/licenses/LICENSE-2.0
13 *
14 * Unless required by applicable law or agreed to in writing, software
15 * distributed under the License is distributed on an "AS IS" BASIS,
16 * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
17 * See the License for the specific language governing permissions and
18 * limitations under the License.
19 */
20 package org.apache.hadoop.hbase.mapred;
21
22 import java.io.IOException;
23
24 import org.apache.hadoop.hbase.io.ImmutableBytesWritable;
25 import org.apache.hadoop.hbase.client.Result;
26 import org.apache.hadoop.mapred.JobConf;
27 import org.apache.hadoop.mapred.MapReduceBase;
28 import org.apache.hadoop.mapred.OutputCollector;
29 import org.apache.hadoop.mapred.Reporter;
30
31 /**
32 * Pass the given key and record as-is to reduce
33 */
34 @Deprecated
35 public class IdentityTableMap
36 extends MapReduceBase
37 implements TableMap<ImmutableBytesWritable, Result> {
38
39 /** constructor */
40 public IdentityTableMap() {
41 super();
42 }
43
44 /**
45 * Use this before submitting a TableMap job. It will
46 * appropriately set up the JobConf.
47 *
48 * @param table table name
49 * @param columns columns to scan
50 * @param mapper mapper class
51 * @param job job configuration
52 */
53 @SuppressWarnings("unchecked")
54 public static void initJob(String table, String columns,
55 Class<? extends TableMap> mapper, JobConf job) {
56 TableMapReduceUtil.initTableMapJob(table, columns, mapper,
57 ImmutableBytesWritable.class,
58 Result.class, job);
59 }
60
61 /**
62 * Pass the key, value to reduce
63 * @param key
64 * @param value
65 * @param output
66 * @param reporter
67 * @throws IOException
68 */
69 public void map(ImmutableBytesWritable key, Result value,
70 OutputCollector<ImmutableBytesWritable,Result> output,
71 Reporter reporter) throws IOException {
72
73 // convert
74 output.collect(key, value);
75 }
76 }