phoenix-commits mailing list archives

Site index · List index
Message view « Date » · « Thread »
Top « Date » · « Thread »
From s..@apache.org
Subject [4/4] phoenix git commit: PHOENIX-2975 CSVBulkLoad for local index only fails.
Date Fri, 10 Jun 2016 08:59:08 GMT
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/891131c7
Tree: http://git-wip-us.apache.org/repos/asf/phoenix/tree/891131c7
Diff: http://git-wip-us.apache.org/repos/asf/phoenix/diff/891131c7

Branch: refs/heads/4.x-HBase-1.1
Commit: 891131c786f598e3ab8869caffffda02af86afb3
Parents: 81878a1
Author: Sergey Soldatov <ssa@apache.org>
Authored: Thu Jun 9 17:59:51 2016 -0700
Committer: Sergey Soldatov <ssa@apache.org>
Committed: Fri Jun 10 01:58:07 2016 -0700

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


http://git-wip-us.apache.org/repos/asf/phoenix/blob/891131c7/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());


Mime
View raw message