Skip to content

Instantly share code, notes, and snippets.

@bobrik
Created December 12, 2015 14:11
Show Gist options
  • Save bobrik/fc7fa3f4e69f8dee3cea to your computer and use it in GitHub Desktop.
Save bobrik/fc7fa3f4e69f8dee3cea to your computer and use it in GitHub Desktop.
TableInputFormat for HBase that works with binary row keys
import org.apache.hadoop.conf.Configuration;
import org.apache.hadoop.hbase.mapreduce.TableInputFormat;
import org.apache.hadoop.hbase.util.Bytes;
public class UnfuckedTableInputFormat extends TableInputFormat {
@Override
public void setConf(Configuration configuration) {
super.setConf(configuration);
if (getConf().get(SCAN_ROW_START) != null) {
getScan().setStartRow(Bytes.toBytesBinary(getConf().get(SCAN_ROW_START)));
}
if (getConf().get(SCAN_ROW_STOP) != null) {
getScan().setStopRow(Bytes.toBytesBinary(getConf().get(SCAN_ROW_STOP)));
}
}
}
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment