gora-commits mailing list archives

Site index · List index
Message view « Date » · « Thread »
Top « Date » · « Thread »
From rmarroq...@apache.org
Subject git commit: GORA-350 fixed. NPE within CassandraClient.getFamilyMap.
Date Sun, 29 Jun 2014 17:00:14 GMT
Repository: gora
Updated Branches:
  refs/heads/master e00f420fb -> d61a1735e


GORA-350 fixed. NPE within CassandraClient.getFamilyMap.


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

Branch: refs/heads/master
Commit: d61a1735e3fdaeff00c4ecad85905e335651bafa
Parents: e00f420
Author: Renato Marroquin <rmarroquin@apache.org>
Authored: Sun Jun 29 18:59:56 2014 +0200
Committer: Renato Marroquin <rmarroquin@apache.org>
Committed: Sun Jun 29 18:59:56 2014 +0200

----------------------------------------------------------------------
 .../gora/cassandra/query/CassandraResult.java       |  2 --
 .../gora/cassandra/store/CassandraClient.java       |  4 ++--
 .../apache/gora/cassandra/store/CassandraStore.java | 16 +---------------
 3 files changed, 3 insertions(+), 19 deletions(-)
----------------------------------------------------------------------


http://git-wip-us.apache.org/repos/asf/gora/blob/d61a1735/gora-cassandra/src/main/java/org/apache/gora/cassandra/query/CassandraResult.java
----------------------------------------------------------------------
diff --git a/gora-cassandra/src/main/java/org/apache/gora/cassandra/query/CassandraResult.java
b/gora-cassandra/src/main/java/org/apache/gora/cassandra/query/CassandraResult.java
index 61dd5bb..46dad15 100644
--- a/gora-cassandra/src/main/java/org/apache/gora/cassandra/query/CassandraResult.java
+++ b/gora-cassandra/src/main/java/org/apache/gora/cassandra/query/CassandraResult.java
@@ -107,8 +107,6 @@ public class CassandraResult<K, T extends PersistentBase> extends
ResultBase<K,
           int pos = this.persistent.getSchema().getField(fieldName).pos();
           Field field = fields.get(pos);
           Type fieldType = field.schema().getType();
-          // LOG.info(StringSerializer.get().fromByteBuffer(cassandraColumn.getName())
-          // + fieldName + " " + fieldType.name());
           if (fieldType.equals(Type.UNION)) {
             //getting UNION stored type
             CassandraColumn cc = getUnionTypeColumn(fieldName

http://git-wip-us.apache.org/repos/asf/gora/blob/d61a1735/gora-cassandra/src/main/java/org/apache/gora/cassandra/store/CassandraClient.java
----------------------------------------------------------------------
diff --git a/gora-cassandra/src/main/java/org/apache/gora/cassandra/store/CassandraClient.java
b/gora-cassandra/src/main/java/org/apache/gora/cassandra/store/CassandraClient.java
index 3df6517..1d56e32 100644
--- a/gora-cassandra/src/main/java/org/apache/gora/cassandra/store/CassandraClient.java
+++ b/gora-cassandra/src/main/java/org/apache/gora/cassandra/store/CassandraClient.java
@@ -478,7 +478,7 @@ public class CassandraClient<K, T extends PersistentBase> {
         map.put(family, list);
       }
       if (persistentSchema.getField(field).schema().getType() == Type.UNION)
-        list.add(column + CassandraStore.UNION_COL_SUFIX);
+        list.add(field + CassandraStore.UNION_COL_SUFIX);
       if (column != null) {
         list.add(column);
       }
@@ -510,7 +510,7 @@ public class CassandraClient<K, T extends PersistentBase> {
       String family = this.getMappingFamily(field);
       String column = this.getMappingColumn(field);
       if (persistentSchema.getField(field).schema().getType() == Type.UNION)
-        map.put(family + ":" + column + CassandraStore.UNION_COL_SUFIX, field + CassandraStore.UNION_COL_SUFIX);
+        map.put(family + ":" + field + CassandraStore.UNION_COL_SUFIX, field + CassandraStore.UNION_COL_SUFIX);
       map.put(family + ":" + column, field);
     }
     

http://git-wip-us.apache.org/repos/asf/gora/blob/d61a1735/gora-cassandra/src/main/java/org/apache/gora/cassandra/store/CassandraStore.java
----------------------------------------------------------------------
diff --git a/gora-cassandra/src/main/java/org/apache/gora/cassandra/store/CassandraStore.java
b/gora-cassandra/src/main/java/org/apache/gora/cassandra/store/CassandraStore.java
index 51138ca..ffb4af0 100644
--- a/gora-cassandra/src/main/java/org/apache/gora/cassandra/store/CassandraStore.java
+++ b/gora-cassandra/src/main/java/org/apache/gora/cassandra/store/CassandraStore.java
@@ -47,7 +47,6 @@ import org.apache.avro.io.BinaryEncoder;
 import org.apache.avro.specific.SpecificData;
 import org.apache.avro.specific.SpecificDatumWriter;
 import org.apache.avro.util.Utf8;
-import org.apache.commons.lang.ArrayUtils;
 import org.apache.gora.cassandra.query.CassandraQuery;
 import org.apache.gora.cassandra.query.CassandraResult;
 import org.apache.gora.cassandra.query.CassandraResultSet;
@@ -314,20 +313,7 @@ public class CassandraStore<K, T extends PersistentBase> extends
DataStoreBase<K
     if (fields == null){
       fields = this.getFields();
     }
-    // Generating UnionFields
-    ArrayList<String> unionFields = new ArrayList<String>();
-    for (String field: fields){
-      Field schemaField =this.fieldMap.get(field);
-      Type type = schemaField.schema().getType();
-      if (type.getName().equals("UNION".toLowerCase())){
-        unionFields.add(field+UNION_COL_SUFIX);
-      }
-    }
-    
-    String[] arr = unionFields.toArray(new String[unionFields.size()]);
-    String[] both = (String[]) ArrayUtils.addAll(fields, arr);
-    
-    query.setFields(both);
+    query.setFields(fields);
 
     query.setLimit(1);
     Result<K,T> result = execute(query);


Mime
View raw message