accumulo-commits mailing list archives

Site index · List index
Message view « Date » · « Thread »
Top « Date » · « Thread »
From els...@apache.org
Subject [04/13] git commit: added better support for handling real data from tuples
Date Fri, 18 Oct 2013 23:53:11 GMT
added better support for handling real data from tuples


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

Branch: refs/heads/1.5
Commit: da7e1a045f48859af486590944fa896f635739fd
Parents: 3426685
Author: Jason Trost <jason.trost@gmail.com>
Authored: Fri Mar 2 11:55:37 2012 -0500
Committer: Jason Trost <jason.trost@gmail.com>
Committed: Fri Mar 2 11:55:37 2012 -0500

----------------------------------------------------------------------
 .../apache/accumulo/pig/AccumuloStorage.java    | 29 +++++++++++++++++++-
 1 file changed, 28 insertions(+), 1 deletion(-)
----------------------------------------------------------------------


http://git-wip-us.apache.org/repos/asf/accumulo-pig/blob/da7e1a04/src/main/java/org/apache/accumulo/pig/AccumuloStorage.java
----------------------------------------------------------------------
diff --git a/src/main/java/org/apache/accumulo/pig/AccumuloStorage.java b/src/main/java/org/apache/accumulo/pig/AccumuloStorage.java
index f3b0819..ea7e809 100644
--- a/src/main/java/org/apache/accumulo/pig/AccumuloStorage.java
+++ b/src/main/java/org/apache/accumulo/pig/AccumuloStorage.java
@@ -296,11 +296,38 @@ public class AccumuloStorage extends LoadFunc implements StoreFuncInterface
     
     private static Text objToText(Object o)
     {
-    	return new Text(((DataByteArray)o).get());
+    	return new Text(objToBytes(o));
     }
     
     private static byte[] objToBytes(Object o)
     {
+    	if (o instanceof String) {
+			String str = (String) o;
+			return str.getBytes();
+		}
+    	else if (o instanceof Long) {
+			Long l = (Long) o;
+			return l.toString().getBytes();
+		}
+    	else if (o instanceof Integer) {
+    		Integer l = (Integer) o;
+			return l.toString().getBytes();
+		}
+    	else if (o instanceof Boolean) {
+    		Boolean l = (Boolean) o;
+			return l.toString().getBytes();
+		}
+    	else if (o instanceof Float) {
+    		Float l = (Float) o;
+			return l.toString().getBytes();
+		}
+    	else if (o instanceof Double) {
+    		Double l = (Double) o;
+			return l.toString().getBytes();
+		}
+    	
+    	// TODO: handle DataBag, Map<Object, Object>, and Tuple
+    	
     	return ((DataByteArray)o).get();
     }
 


Mime
View raw message