gora-commits mailing list archives

Site index · List index
Message view « Date » · « Thread »
Top « Date » · « Thread »
From lewi...@apache.org
Subject [1/2] gora git commit: GORA-487 Edited AccumuloStore.java duplicate code lines
Date Fri, 19 Aug 2016 09:16:14 GMT
Repository: gora
Updated Branches:
  refs/heads/master 61c25fefb -> 4192c8751


GORA-487 Edited AccumuloStore.java duplicate code lines


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

Branch: refs/heads/master
Commit: 6428e5d0d82aec4dfc8511f9e9d9ff5477b4dc31
Parents: 61c25fe
Author: cihad guzel <cguzelg@gmail.com>
Authored: Wed Aug 17 22:45:50 2016 +0300
Committer: cihad guzel <cguzelg@gmail.com>
Committed: Thu Aug 18 02:10:20 2016 +0300

----------------------------------------------------------------------
 .../org/apache/gora/accumulo/store/AccumuloStore.java     | 10 ++++------
 1 file changed, 4 insertions(+), 6 deletions(-)
----------------------------------------------------------------------


http://git-wip-us.apache.org/repos/asf/gora/blob/6428e5d0/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 2a8af02..18145ae 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
@@ -97,6 +97,7 @@ import org.apache.gora.store.DataStoreFactory;
 import org.apache.gora.store.impl.DataStoreBase;
 import org.apache.gora.util.AvroUtils;
 import org.apache.gora.util.GoraException;
+import org.apache.gora.util.IOUtils;
 import org.apache.hadoop.io.Text;
 import org.slf4j.Logger;
 import org.slf4j.LoggerFactory;
@@ -690,12 +691,9 @@ public class AccumuloStore<K,T extends PersistentBase> extends
DataStoreBase<K,T
           }
           // continue like a regular top-level union
         case RECORD:
-          SpecificDatumWriter<Object> writer = new SpecificDatumWriter<>(field.schema());
-          ByteArrayOutputStream os = new ByteArrayOutputStream();
-          org.apache.avro.io.BinaryEncoder encoder = EncoderFactory.get().binaryEncoder(os,
null);
-          writer.write(o, encoder);
-          encoder.flush();
-          m.put(col.getFirst(), col.getSecond(), new Value(os.toByteArray()));
+          final SpecificDatumWriter<Object> writer = new SpecificDatumWriter<>(field.schema());
+          final byte[] byteData = IOUtils.serialize(writer,o);
+          m.put(col.getFirst(), col.getSecond(), new Value(byteData));
           count++;
           break;
         default:


Mime
View raw message