Author: lewismc
Date: Wed Apr 9 20:21:24 2014
New Revision: 1586128
URL: http://svn.apache.org/r1586128
Log:
GORA-244 Upgrade to Avro 1.7.X in gora-accumulo accumulo-updateTestFix.patch
Modified:
gora/branches/GORA_94/gora-accumulo/src/main/java/org/apache/gora/accumulo/store/AccumuloStore.java
Modified:
gora/branches/GORA_94/gora-accumulo/src/main/java/org/apache/gora/accumulo/store/AccumuloStore.java
URL:
http://svn.apache.org/viewvc/gora/branches/GORA_94/gora-accumulo/src/main/java/org/apache/gora/accumulo/store/AccumuloStore.java?rev=1586128&r1=1586127&r2=1586128&view=diff
==============================================================================
---
gora/branches/GORA_94/gora-accumulo/src/main/java/org/apache/gora/accumulo/store/AccumuloStore.java
(original)
+++
gora/branches/GORA_94/gora-accumulo/src/main/java/org/apache/gora/accumulo/store/AccumuloStore.java
Wed Apr 9 20:21:24 2014
@@ -723,6 +723,19 @@ public class AccumuloStore<K,T extends P
}
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 @@ public class AccumuloStore<K,T extends P
}
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) {