Repository: phoenix
Updated Branches:
  refs/heads/4.x-HBase-0.98 8296b9857 -> df65b174d
  refs/heads/4.x-HBase-1.0 16810a8af -> d0d6964af
  refs/heads/4.x-HBase-1.1 81878a185 -> 891131c78
  refs/heads/master e7e8e130b -> 865458fbf


PHOENIX-2975 CSVBulkLoad for local index only fails.


Project: http://git-wip-us.apache.org/repos/asf/phoenix/repo
Commit: http://git-wip-us.apache.org/repos/asf/phoenix/commit/865458fb
Tree: http://git-wip-us.apache.org/repos/asf/phoenix/tree/865458fb
Diff: http://git-wip-us.apache.org/repos/asf/phoenix/diff/865458fb

Branch: refs/heads/master
Commit: 865458fbfa2b7f4597076351b6011ec063c3aa09
Parents: e7e8e13
Author: Sergey Soldatov <s...@apache.org>
Authored: Thu Jun 9 17:59:51 2016 -0700
Committer: Sergey Soldatov <s...@apache.org>
Committed: Fri Jun 10 01:56:47 2016 -0700

----------------------------------------------------------------------
 .../phoenix/mapreduce/FormatToBytesWritableMapper.java    | 10 ++++++++--
 1 file changed, 8 insertions(+), 2 deletions(-)
----------------------------------------------------------------------


http://git-wip-us.apache.org/repos/asf/phoenix/blob/865458fb/phoenix-core/src/main/java/org/apache/phoenix/mapreduce/FormatToBytesWritableMapper.java
----------------------------------------------------------------------
diff --git 
a/phoenix-core/src/main/java/org/apache/phoenix/mapreduce/FormatToBytesWritableMapper.java
 
b/phoenix-core/src/main/java/org/apache/phoenix/mapreduce/FormatToBytesWritableMapper.java
index a736fc4..cacbce7 100644
--- 
a/phoenix-core/src/main/java/org/apache/phoenix/mapreduce/FormatToBytesWritableMapper.java
+++ 
b/phoenix-core/src/main/java/org/apache/phoenix/mapreduce/FormatToBytesWritableMapper.java
@@ -248,7 +248,7 @@ public abstract class FormatToBytesWritableMapper<RECORD> 
extends Mapper<LongWri
         if(columnIndexes.containsKey(cfn)) {
             return columnIndexes.get(cfn);
         }
-        throw new IOException("Unable to map cell to column index");
+        return -1;
     }
 
     /**
@@ -287,8 +287,14 @@ public abstract class FormatToBytesWritableMapper<RECORD> 
extends Mapper<LongWri
                 /*
                 The order of aggregation: type, index of column, length of 
value, value itself
                  */
-                outputStream.writeByte(cell.getTypeByte());
                 int i = findIndex(cell);
+                if(i == -1) {
+                    //That may happen when we load only local indexes. Since 
KV pairs for both
+                    // table and local index are going to the same physical 
table at that point
+                    // we skip those KVs that are not belongs to loca index
+                    continue;
+                }
+                outputStream.writeByte(cell.getTypeByte());
                 WritableUtils.writeVInt(outputStream, i);
                 WritableUtils.writeVInt(outputStream, cell.getValueLength());
                 outputStream.write(cell.getValueArray(), 
cell.getValueOffset(), cell.getValueLength());

Reply via email to