blob: 77996c689e670b7470a37f724e72f7a06d1e94ad (
plain)
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
49
50
|
package parallelai.spyglass.hbase;
import org.apache.commons.logging.Log;
import org.apache.commons.logging.LogFactory;
import java.io.IOException;
/**
* Utility class that sets the parameters of the record reader of a table split
*/
public class HBaseConfigUtils {
static final Log LOG = LogFactory.getLog(HBaseConfigUtils.class);
public static void setRecordReaderParms(HBaseRecordReaderBase trr, HBaseTableSplitBase tSplit) throws IOException {
switch (tSplit.getSourceMode()) {
case SCAN_ALL:
case SCAN_RANGE: {
LOG.debug(String.format(
"For split [%s] we have start key (%s) and stop key (%s)",
tSplit, tSplit.getStartRow(), tSplit.getEndRow()));
trr.setStartRow(tSplit.getStartRow());
trr.setEndRow(tSplit.getEndRow());
trr.setEndRowInclusive(tSplit.getEndRowInclusive());
trr.setUseSalt(tSplit.getUseSalt());
trr.setTimestamp(tSplit.getTimestamp());
}
break;
case GET_LIST: {
LOG.debug(String.format("For split [%s] we have key list (%s)",
tSplit, tSplit.getKeyList()));
trr.setKeyList(tSplit.getKeyList());
trr.setVersions(tSplit.getVersions());
trr.setUseSalt(tSplit.getUseSalt());
}
break;
default:
throw new IOException("Unknown source mode : "
+ tSplit.getSourceMode());
}
trr.setSourceMode(tSplit.getSourceMode());
}
}
|