cassandra-commits mailing list archives

Site index · List index
Message view « Date » · « Thread »
Top « Date » · « Thread »
From jbel...@apache.org
Subject [3/3] git commit: Pig's objToBB should handle all types. Patch by brandonwilliams, reviewed by xedin for CASSANDRA-3886
Date Mon, 13 Feb 2012 21:45:03 GMT
Pig's objToBB should handle all types.
Patch by brandonwilliams, reviewed by xedin for CASSANDRA-3886


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

Branch: refs/heads/trunk
Commit: bcad06883dc599c77393bc4eb2807be9da3d294a
Parents: c49a149
Author: Brandon Williams <brandonwilliams@apache.org>
Authored: Fri Feb 10 10:07:53 2012 -0600
Committer: Jonathan Ellis <jbellis@apache.org>
Committed: Mon Feb 13 15:43:03 2012 -0600

----------------------------------------------------------------------
 .../cassandra/hadoop/pig/CassandraStorage.java     |   14 ++++++++++++--
 1 files changed, 12 insertions(+), 2 deletions(-)
----------------------------------------------------------------------


http://git-wip-us.apache.org/repos/asf/cassandra/blob/bcad0688/src/java/org/apache/cassandra/hadoop/pig/CassandraStorage.java
----------------------------------------------------------------------
diff --git a/src/java/org/apache/cassandra/hadoop/pig/CassandraStorage.java b/src/java/org/apache/cassandra/hadoop/pig/CassandraStorage.java
index 9c6dd30..ebd118c 100644
--- a/src/java/org/apache/cassandra/hadoop/pig/CassandraStorage.java
+++ b/src/java/org/apache/cassandra/hadoop/pig/CassandraStorage.java
@@ -561,8 +561,18 @@ public class CassandraStorage extends LoadFunc implements StoreFuncInterface,
Lo
         if (o == null)
             return (ByteBuffer)o;
         if (o instanceof java.lang.String)
-            o = new DataByteArray((String)o);
-        return ByteBuffer.wrap(((DataByteArray) o).get());
+            return new ByteBuffer.wrap(DataByteArray((String)o).get());
+        if (o instanceof Integer)
+            return IntegerType.instance.decompose((BigInteger)o);
+        if (o instanceof Long)
+            return LongType.instance.decompose((Long)o);
+        if (o instanceof Float)
+            return FloatType.instance.decompose((Float)o);
+        if (o instanceof Double)
+            return DoubleType.instance.decompose((Double)o);
+        if (o instanceof UUID)
+            return ByteBuffer.wrap(UUIDGen.decompose((UUID) o));
+        return null;
     }
 
     public void putNext(Tuple t) throws ExecException, IOException


Mime
View raw message