Skip to content

Commit

Permalink
PHOENIX-5111: Null Pointer exception fix in index tool due to outputp…
Browse files Browse the repository at this point in the history
…ath being null when direct option is supplied

Signed-off-by: Geoffrey Jacoby <gjacoby@apache.org>
  • Loading branch information
gokceni authored and gjacoby126 committed Feb 6, 2019
1 parent 4a911a8 commit 4a8a4bc
Showing 1 changed file with 8 additions and 6 deletions.
Expand Up @@ -251,7 +251,7 @@ public Job getJob(String schemaName, String indexTable, String dataTable, boolea
if (isPartialBuild) {
return configureJobForPartialBuild(schemaName, dataTable);
} else {
return configureJobForAysncIndex(schemaName, indexTable, dataTable, useDirectApi, useSnapshot);
return configureJobForAsyncIndex(schemaName, indexTable, dataTable, useDirectApi, useSnapshot);
}
}

Expand Down Expand Up @@ -364,7 +364,7 @@ private long getMaxRebuildAsyncDate(String schemaName, List<String> disableIndex

}

private Job configureJobForAysncIndex(String schemaName, String indexTable, String dataTable, boolean useDirectApi, boolean useSnapshot)
private Job configureJobForAsyncIndex(String schemaName, String indexTable, String dataTable, boolean useDirectApi, boolean useSnapshot)
throws Exception {
final String qDataTable = SchemaUtil.getQualifiedTableName(schemaName, dataTable);
final String qIndexTable;
Expand Down Expand Up @@ -411,14 +411,16 @@ private Job configureJobForAysncIndex(String schemaName, String indexTable, Stri
final List<ColumnInfo> columnMetadataList =
PhoenixRuntime.generateColumnInfo(connection, qIndexTable, indexColumns);
ColumnInfoToStringEncoderDecoder.encode(configuration, columnMetadataList);
fs = outputPath.getFileSystem(configuration);
fs.delete(outputPath, true);


final String jobName = String.format(INDEX_JOB_NAME_TEMPLATE, schemaName, dataTable, indexTable);
final Job job = Job.getInstance(configuration, jobName);
job.setJarByClass(IndexTool.class);
job.setMapOutputKeyClass(ImmutableBytesWritable.class);
FileOutputFormat.setOutputPath(job, outputPath);
if (outputPath != null) {
fs = outputPath.getFileSystem(configuration);
fs.delete(outputPath, true);
FileOutputFormat.setOutputPath(job, outputPath);
}

if (!useSnapshot) {
PhoenixMapReduceUtil.setInput(job, PhoenixIndexDBWritable.class, qDataTable,
Expand Down

0 comments on commit 4a8a4bc

Please sign in to comment.