GORA-244 Upgrade to Avro 1.7.X in gora-accumulo accumulo-updateTestFix.patch
git-svn-id: https://svn.apache.org/repos/asf/gora/branches/GORA_94@1586128 13f79535-47bb-0310-9956-ffa450edef68
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 d0fc71f..3c1911a 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
@@ -723,6 +723,19 @@
}
private int putMap(Mutation m, int count, Schema valueType, Object o, Pair<Text, Text> col) 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.setStartKey((K)rowKey.toString());
+ query.setEndKey((K)rowKey.toString());
+ deleteByQuery(query);
+ flush();
+ if (o == null){
+ return 0;
+ }
+
Set<?> es = ((Map<?, ?>)o).entrySet();
for (Object entry : es) {
Object mapKey = ((Entry<?, ?>) entry).getKey();
@@ -738,6 +751,19 @@
}
private int putArray(Mutation m, int count, Object o, Pair<Text, Text> col) {
+
+ // 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.setStartKey((K)rowKey.toString());
+ query.setEndKey((K)rowKey.toString());
+ deleteByQuery(query);
+ flush();
+ if (o == null){
+ return 0;
+ }
+
List<?> array = (List<?>) o; // both GenericArray and DirtyListWrapper
int j = 0;
for (Object item : array) {