Repository: phoenix Updated Branches: refs/heads/4.x-HBase-0.98 161793d90 -> 5d99167c1
PHOENIX-2495 Fix test failures in CsvBulkLoadToolIT Project: http://git-wip-us.apache.org/repos/asf/phoenix/repo Commit: http://git-wip-us.apache.org/repos/asf/phoenix/commit/5d99167c Tree: http://git-wip-us.apache.org/repos/asf/phoenix/tree/5d99167c Diff: http://git-wip-us.apache.org/repos/asf/phoenix/diff/5d99167c Branch: refs/heads/4.x-HBase-0.98 Commit: 5d99167c1c5f3af1a63e1830460e1329e257ee97 Parents: 161793d Author: Nick Dimiduk <ndimi...@apache.org> Authored: Wed Dec 9 16:51:18 2015 -0800 Committer: Nick Dimiduk <ndimi...@apache.org> Committed: Wed Dec 9 17:48:20 2015 -0800 ---------------------------------------------------------------------- .../java/org/apache/phoenix/mapreduce/CsvBulkLoadToolIT.java | 2 +- .../org/apache/phoenix/mapreduce/CsvToKeyValueMapper.java | 1 + .../org/apache/phoenix/mapreduce/FormatToKeyValueMapper.java | 7 ++++++- 3 files changed, 8 insertions(+), 2 deletions(-) ---------------------------------------------------------------------- http://git-wip-us.apache.org/repos/asf/phoenix/blob/5d99167c/phoenix-core/src/it/java/org/apache/phoenix/mapreduce/CsvBulkLoadToolIT.java ---------------------------------------------------------------------- diff --git a/phoenix-core/src/it/java/org/apache/phoenix/mapreduce/CsvBulkLoadToolIT.java b/phoenix-core/src/it/java/org/apache/phoenix/mapreduce/CsvBulkLoadToolIT.java index a5b7488..4a440d6 100644 --- a/phoenix-core/src/it/java/org/apache/phoenix/mapreduce/CsvBulkLoadToolIT.java +++ b/phoenix-core/src/it/java/org/apache/phoenix/mapreduce/CsvBulkLoadToolIT.java @@ -228,7 +228,7 @@ public class CsvBulkLoadToolIT { "--zookeeper", zkQuorum}); fail("Csv bulk load currently has issues with local indexes."); } catch( UnsupportedOperationException ise) { - assertEquals("Local indexes not supported by CSV Bulk Loader",ise.getMessage()); + assertEquals("Local indexes not supported by Bulk Loader",ise.getMessage()); } } http://git-wip-us.apache.org/repos/asf/phoenix/blob/5d99167c/phoenix-core/src/main/java/org/apache/phoenix/mapreduce/CsvToKeyValueMapper.java ---------------------------------------------------------------------- diff --git a/phoenix-core/src/main/java/org/apache/phoenix/mapreduce/CsvToKeyValueMapper.java b/phoenix-core/src/main/java/org/apache/phoenix/mapreduce/CsvToKeyValueMapper.java index 5a5d378..2cb1ac7 100644 --- a/phoenix-core/src/main/java/org/apache/phoenix/mapreduce/CsvToKeyValueMapper.java +++ b/phoenix-core/src/main/java/org/apache/phoenix/mapreduce/CsvToKeyValueMapper.java @@ -64,6 +64,7 @@ public class CsvToKeyValueMapper extends FormatToKeyValueMapper<CSVRecord> { @Override protected void setup(Context context) throws IOException, InterruptedException { + super.setup(context); Configuration conf = context.getConfiguration(); lineParser = new CsvLineParser( CsvBulkImportUtil.getCharacter(conf, FIELD_DELIMITER_CONFKEY), http://git-wip-us.apache.org/repos/asf/phoenix/blob/5d99167c/phoenix-core/src/main/java/org/apache/phoenix/mapreduce/FormatToKeyValueMapper.java ---------------------------------------------------------------------- diff --git a/phoenix-core/src/main/java/org/apache/phoenix/mapreduce/FormatToKeyValueMapper.java b/phoenix-core/src/main/java/org/apache/phoenix/mapreduce/FormatToKeyValueMapper.java index b2e99e5..7e115e5 100644 --- a/phoenix-core/src/main/java/org/apache/phoenix/mapreduce/FormatToKeyValueMapper.java +++ b/phoenix-core/src/main/java/org/apache/phoenix/mapreduce/FormatToKeyValueMapper.java @@ -128,6 +128,9 @@ public abstract class FormatToKeyValueMapper<RECORD> extends Mapper<LongWritable @SuppressWarnings("deprecation") @Override protected void map(LongWritable key, Text value, Context context) throws IOException, InterruptedException { + if (conn == null) { + throw new RuntimeException("Connection not initialized."); + } try { RECORD record = null; try { @@ -171,7 +174,9 @@ public abstract class FormatToKeyValueMapper<RECORD> extends Mapper<LongWritable @Override protected void cleanup(Context context) throws IOException, InterruptedException { try { - conn.close(); + if (conn != null) { + conn.close(); + } } catch (SQLException e) { throw new RuntimeException(e); }