You are viewing a plain text version of this content. The canonical link for it is here.
Posted to commits@phoenix.apache.org by gj...@apache.org on 2019/02/06 21:30:52 UTC
[phoenix] branch master updated: PHOENIX-5111: Null Pointer
exception fix in index tool due to outputpath being null when direct option
is supplied
This is an automated email from the ASF dual-hosted git repository.
gjacoby pushed a commit to branch master
in repository https://gitbox.apache.org/repos/asf/phoenix.git
The following commit(s) were added to refs/heads/master by this push:
new 4a8a4bc PHOENIX-5111: Null Pointer exception fix in index tool due to outputpath being null when direct option is supplied
4a8a4bc is described below
commit 4a8a4bc18475ff3f69b7e1ebbf6653962c7caf9b
Author: Gokcen Iskender <gi...@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 <gj...@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 c7e7b88..a69fa47 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
@@ -251,7 +251,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);
}
}
@@ -364,7 +364,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;
@@ -411,14 +411,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,