This is an automated email from the ASF dual-hosted git repository. gjacoby pushed a commit to branch 4.x-HBase-1.4 in repository https://gitbox.apache.org/repos/asf/phoenix.git
The following commit(s) were added to refs/heads/4.x-HBase-1.4 by this push: new 9801459 PHOENIX-5111: Null Pointer exception fix in index tool due to outputpath being null when direct option is supplied 9801459 is described below commit 9801459b7cac8348b78413871e4c57d4e84ece6b Author: Gokcen Iskender <gisken...@salesforce.com> AuthorDate: Mon Jan 28 13:16:44 2019 -0800 PHOENIX-5111: Null Pointer exception fix in index tool due to outputpath being null when direct option is supplied Signed-off-by: Geoffrey Jacoby <gjac...@apache.org> --- .../java/org/apache/phoenix/mapreduce/index/IndexTool.java | 14 ++++++++------ 1 file changed, 8 insertions(+), 6 deletions(-) diff --git a/phoenix-core/src/main/java/org/apache/phoenix/mapreduce/index/IndexTool.java b/phoenix-core/src/main/java/org/apache/phoenix/mapreduce/index/IndexTool.java index f2f4cdb..a4c82be 100644 --- a/phoenix-core/src/main/java/org/apache/phoenix/mapreduce/index/IndexTool.java +++ b/phoenix-core/src/main/java/org/apache/phoenix/mapreduce/index/IndexTool.java @@ -249,7 +249,7 @@ public class IndexTool extends Configured implements Tool { if (isPartialBuild) { return configureJobForPartialBuild(schemaName, dataTable); } else { - return configureJobForAysncIndex(schemaName, indexTable, dataTable, useDirectApi, useSnapshot); + return configureJobForAsyncIndex(schemaName, indexTable, dataTable, useDirectApi, useSnapshot); } } @@ -362,7 +362,7 @@ public class IndexTool extends Configured implements Tool { } - 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; @@ -409,14 +409,16 @@ public class IndexTool extends Configured implements Tool { 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,