gora-commits mailing list archives

Site index · List index
Message view « Date » · « Thread »
Top « Date » · « Thread »
From lewi...@apache.org
Subject gora git commit: GORA-419: AccumuloStore.put deletes entire row when updating map/array field
Date Thu, 27 Aug 2015 03:51:41 GMT
Repository: gora
Updated Branches:
  refs/heads/master 1f6ba329e -> ed768b4be


GORA-419: AccumuloStore.put deletes entire row when updating map/array field


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

Branch: refs/heads/master
Commit: ed768b4be6af4cc8fa18fa11bdb01c616101afbe
Parents: 1f6ba32
Author: Lewis John McGibbney <lewis.j.mcgibbney@jpl.nasa.gov>
Authored: Wed Aug 26 20:52:46 2015 -0700
Committer: Lewis John McGibbney <lewis.j.mcgibbney@jpl.nasa.gov>
Committed: Wed Aug 26 20:52:46 2015 -0700

----------------------------------------------------------------------
 CHANGES.txt                                         |  2 ++
 .../apache/gora/accumulo/store/AccumuloStore.java   | 16 ++++++++--------
 2 files changed, 10 insertions(+), 8 deletions(-)
----------------------------------------------------------------------


http://git-wip-us.apache.org/repos/asf/gora/blob/ed768b4b/CHANGES.txt
----------------------------------------------------------------------
diff --git a/CHANGES.txt b/CHANGES.txt
index d87d74e..ca79a6c 100644
--- a/CHANGES.txt
+++ b/CHANGES.txt
@@ -4,6 +4,8 @@
 
 Current Development
 
+* GORA-419: AccumuloStore.put deletes entire row when updating map/array field (gerhardgossen
via lewismc)
+
 * GORA-420: AccumuloStore.createSchema fails when table already exists (gerhardgossen via
lewismc)
 
 * GORA-427 Configure MongoDB ReadPreference and WriteConcern (drazzib)

http://git-wip-us.apache.org/repos/asf/gora/blob/ed768b4b/gora-accumulo/src/main/java/org/apache/gora/accumulo/store/AccumuloStore.java
----------------------------------------------------------------------
diff --git a/gora-accumulo/src/main/java/org/apache/gora/accumulo/store/AccumuloStore.java
b/gora-accumulo/src/main/java/org/apache/gora/accumulo/store/AccumuloStore.java
index 38566f8..780178f 100644
--- a/gora-accumulo/src/main/java/org/apache/gora/accumulo/store/AccumuloStore.java
+++ b/gora-accumulo/src/main/java/org/apache/gora/accumulo/store/AccumuloStore.java
@@ -673,21 +673,21 @@ public class AccumuloStore<K,T extends PersistentBase> extends
DataStoreBase<K,T
 
         switch (field.schema().getType()) {
         case MAP:
-          count = putMap(m, count, field.schema().getValueType(), o, col);
+          count = putMap(m, count, field.schema().getValueType(), o, col, field.name());
           break;
         case ARRAY:
-          count = putArray(m, count, o, col);
+          count = putArray(m, count, o, col, field.name());
           break;
         case UNION: // default value of null acts like union with null
           Schema effectiveSchema = field.schema().getTypes()
           .get(firstNotNullSchemaTypeIndex(field.schema()));
           // map and array need to compute qualifier
           if (effectiveSchema.getType() == Type.ARRAY) {
-            count = putArray(m, count, o, col);
+            count = putArray(m, count, o, col, field.name());
             break;
           }
           else if (effectiveSchema.getType() == Type.MAP) {
-            count = putMap(m, count, effectiveSchema.getValueType(), o, col);
+            count = putMap(m, count, effectiveSchema.getValueType(), o, col, field.name());
             break;
           }
           // continue like a regular top-level union
@@ -718,12 +718,12 @@ public class AccumuloStore<K,T extends PersistentBase> extends
DataStoreBase<K,T
     }
   }
 
-  private int putMap(Mutation m, int count, Schema valueType, Object o, Pair<Text, Text>
col) throws GoraException {
+  private int putMap(Mutation m, int count, Schema valueType, Object o, Pair<Text, Text>
col, String fieldName) throws GoraException {
 
     // First of all we delete map field on accumulo store
     Text rowKey = new Text(m.getRow());
     Query<K, T> query = newQuery();
-    query.setFields(col.getFirst().toString());
+    query.setFields(fieldName);
     query.setStartKey((K)rowKey.toString());
     query.setEndKey((K)rowKey.toString());
     deleteByQuery(query);
@@ -746,12 +746,12 @@ public class AccumuloStore<K,T extends PersistentBase> extends
DataStoreBase<K,T
     return count;
   }
 
-  private int putArray(Mutation m, int count, Object o, Pair<Text, Text> col) {
+  private int putArray(Mutation m, int count, Object o, Pair<Text, Text> col, String
fieldName) {
 
     // First of all we delete array field on accumulo store
     Text rowKey = new Text(m.getRow());
     Query<K, T> query = newQuery();
-    query.setFields(col.getFirst().toString());
+    query.setFields(fieldName);
     query.setStartKey((K)rowKey.toString());
     query.setEndKey((K)rowKey.toString());
     deleteByQuery(query);


Mime
View raw message