@VisibleForTesting
void evaluateScan() {
this.scans = Lists.newArrayList();
IndexerComponentFactory factory = IndexerComponentFactoryUtil.getComponentFactory(hbaseIndexingSpecification.getIndexerComponentFactory(), new ByteArrayInputStream(hbaseIndexingSpecification.getConfiguration()), hbaseIndexingSpecification.getIndexConnectionParams());
IndexerConf indexerConf = factory.createIndexerConf();
applyMorphLineParams(indexerConf);
List<byte[]> tableNames = Lists.newArrayList();
String tableNameSpec = indexerConf.getTable();
if (indexerConf.tableNameIsRegex()) {
HTableDescriptor[] tables;
try {
HBaseAdmin admin = getHbaseAdmin();
tables = admin.listTables(tableNameSpec);
} catch (IOException e) {
throw new RuntimeException("Error occurred fetching hbase tables", e);
}
for (HTableDescriptor descriptor : tables) {
tableNames.add(descriptor.getName());
}
} else {
tableNames.add(Bytes.toBytesBinary(tableNameSpec));
}
for (byte[] tableName : tableNames) {
Scan hbaseScan = new Scan();
hbaseScan.setCacheBlocks(false);
hbaseScan.setCaching(conf.getInt("hbase.client.scanner.caching", 200));
if (hbaseStartRow != null) {
hbaseScan.setStartRow(Bytes.toBytesBinary(hbaseStartRow));
LOG.debug("Starting row scan at " + hbaseStartRow);
}
if (hbaseEndRow != null) {
hbaseScan.setStopRow(Bytes.toBytesBinary(hbaseEndRow));
LOG.debug("Stopping row scan at " + hbaseEndRow);
}
Long startTime = evaluateTimestamp(hbaseStartTimeString, hbaseTimestampFormat);
Long endTime = evaluateTimestamp(hbaseEndTimeString, hbaseTimestampFormat);
if (startTime != null || endTime != null) {
long scanStartTime = 0L;
long scanEndTime = Long.MAX_VALUE;
if (startTime != null) {
scanStartTime = startTime;
LOG.debug("Setting scan start of time range to " + startTime);
}
if (endTime != null) {
scanEndTime = endTime;
LOG.debug("Setting scan end of time range to " + endTime);
}
try {
hbaseScan.setTimeRange(scanStartTime, scanEndTime);
} catch (IOException e) {
// In reality an IOE will never be thrown here
throw new RuntimeException(e);
}
}
// Only scan the column families and/or cells that the indexer requires
// if we're running in row-indexing mode
if (indexerConf.getMappingType() == MappingType.ROW) {
MorphlineClasspathUtil.setupJavaCompilerClasspath();
ResultToSolrMapper resultToSolrMapper = factory.createMapper(
hbaseIndexingSpecification.getIndexerName()
);