You are viewing a plain text version of this content. The canonical link for it is here.
Posted to commits@phoenix.apache.org by ma...@apache.org on 2015/12/11 03:44:29 UTC

[51/52] [abbrv] phoenix git commit: PHOENIX-2495 Fix test failures in CsvBulkLoadToolIT

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/f244feb4
Tree: http://git-wip-us.apache.org/repos/asf/phoenix/tree/f244feb4
Diff: http://git-wip-us.apache.org/repos/asf/phoenix/diff/f244feb4

Branch: refs/heads/calcite
Commit: f244feb4261d0edd19992f0d7f04a3a58615e479
Parents: 24a94a2
Author: Nick Dimiduk <nd...@apache.org>
Authored: Wed Dec 9 16:51:18 2015 -0800
Committer: Nick Dimiduk <nd...@apache.org>
Committed: Wed Dec 9 17:37:54 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/f244feb4/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/f244feb4/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/f244feb4/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);
         }