Cambridge SMT System
MergePartitioner.java
Go to the documentation of this file.
1 /*******************************************************************************
2  * Licensed under the Apache License, Version 2.0 (the "License");
3  * you may not use these files except in compliance with the License.
4  * You may obtain a copy of the License at
5  *
6  * http://www.apache.org/licenses/LICENSE-2.0
7  *
8  * Unless required by applicable law or agreed to in writing, software
9  * distributed under the License is distributed on an "AS IS" BASIS,
10  * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
11  * See the License for the specific language governing permissions and
12  * limitations under the License.
13  *
14  * Copyright 2014 - Juan Pino, Aurelien Waite, William Byrne
15  *******************************************************************************/
16 package uk.ac.cam.eng.extraction.hadoop.merge;
17 
18 import org.apache.hadoop.mapreduce.Partitioner;
19 import org.apache.hadoop.mapreduce.lib.partition.HashPartitioner;
20 
21 import uk.ac.cam.eng.extraction.Rule;
22 import uk.ac.cam.eng.extraction.RuleString;
24 
30 class MergePartitioner extends
31  Partitioner<Rule, RuleData> {
32 
33  private Partitioner<RuleString, RuleData> defaultPartitioner = new HashPartitioner<>();
34 
35  @Override
36  public int getPartition(Rule key, RuleData value,
37  int numPartitions) {
38  return defaultPartitioner.getPartition(key.source(), value,
39  numPartitions);
40  }
41 
42 }