Skip to content

Instantly share code, notes, and snippets.

View sudhir-reddy's full-sized avatar

Sudhir Reddy sudhir-reddy

  • Flipkart
  • Bangalore
View GitHub Profile
public class RoundRobinTableInputFormat extends TableInputFormat {
@Override
public List<InputSplit> getSplits(JobContext context) throws IOException {
List<InputSplit> inputSplits = super.getSplits(context); // Get splits from HBase TableInputFormat gives
List<InputSplit> roundRobinInputSplits = new ArrayList<InputSplit>();
Map<String, List<InputSplit>> regionServersInputSplits = new HashMap<String, List<InputSplit>>();
// Prepare a hashmap with each region server as key and list of Input Splits as value
if (inputSplits != null && inputSplits.size() != 0) {
for (InputSplit inputSplit : inputSplits) {
if (inputSplit instanceof TableSplit) {