asterixdb-dev mailing list archives

Site index · List index
Message view « Date » · « Thread »
Top « Date » · « Thread »
From "Chris Hillery (Code Review)" <do-not-re...@asterix-gerrit.ics.uci.edu>
Subject Change in asterixdb[master]: Fix JSON output for hex and uuid, and support int types for ...
Date Fri, 21 Aug 2015 09:23:30 GMT
Chris Hillery has uploaded a new change for review.

  https://asterix-gerrit.ics.uci.edu/362

Change subject: Fix JSON output for hex and uuid, and support int types for cleanjson
......................................................................

Fix JSON output for hex and uuid, and support int types for cleanjson

Change-Id: I5c37d3b5aad7f286eba1cb8cb5f05ad456a6521d
---
A asterix-app/data/nontagged/allData.adm
D asterix-app/data/nontagged/allData.json
M asterix-app/src/test/resources/runtimets/queries/scan/alltypes_01/alltypes_01.1.ddl.aql
M asterix-app/src/test/resources/runtimets/queries/scan/alltypes_02/alltypes_02.1.ddl.aql
A asterix-app/src/test/resources/runtimets/results/scan/alltypes_01-cleanjson/alltypes_01.1.json
A asterix-app/src/test/resources/runtimets/results/scan/alltypes_01-json/alltypes_01.1.json
M asterix-app/src/test/resources/runtimets/results/scan/alltypes_01/alltypes_01.1.adm
M asterix-app/src/test/resources/runtimets/results/scan/alltypes_02/alltypes_02.1.adm
M asterix-app/src/test/resources/runtimets/testsuite.xml
R asterix-om/src/main/java/edu/uci/ics/asterix/dataflow/data/nontagged/printers/PrintTools.java
M asterix-om/src/main/java/edu/uci/ics/asterix/dataflow/data/nontagged/printers/adm/ABinaryHexPrinter.java
M asterix-om/src/main/java/edu/uci/ics/asterix/dataflow/data/nontagged/printers/adm/AStringPrinter.java
A asterix-om/src/main/java/edu/uci/ics/asterix/dataflow/data/nontagged/printers/cleanjson/ABinaryHexPrinter.java
A asterix-om/src/main/java/edu/uci/ics/asterix/dataflow/data/nontagged/printers/cleanjson/ABinaryPrinterFactory.java
M asterix-om/src/main/java/edu/uci/ics/asterix/dataflow/data/nontagged/printers/cleanjson/AInt16Printer.java
M asterix-om/src/main/java/edu/uci/ics/asterix/dataflow/data/nontagged/printers/cleanjson/AInt32Printer.java
M asterix-om/src/main/java/edu/uci/ics/asterix/dataflow/data/nontagged/printers/cleanjson/AInt64Printer.java
M asterix-om/src/main/java/edu/uci/ics/asterix/dataflow/data/nontagged/printers/cleanjson/AInt8Printer.java
M asterix-om/src/main/java/edu/uci/ics/asterix/dataflow/data/nontagged/printers/cleanjson/AObjectPrinter.java
M asterix-om/src/main/java/edu/uci/ics/asterix/dataflow/data/nontagged/printers/cleanjson/AStringPrinter.java
A asterix-om/src/main/java/edu/uci/ics/asterix/dataflow/data/nontagged/printers/cleanjson/AUUIDPrinter.java
A asterix-om/src/main/java/edu/uci/ics/asterix/dataflow/data/nontagged/printers/cleanjson/AUUIDPrinterFactory.java
M asterix-om/src/main/java/edu/uci/ics/asterix/dataflow/data/nontagged/printers/csv/AStringPrinter.java
A asterix-om/src/main/java/edu/uci/ics/asterix/dataflow/data/nontagged/printers/json/ABinaryHexPrinter.java
A asterix-om/src/main/java/edu/uci/ics/asterix/dataflow/data/nontagged/printers/json/ABinaryPrinterFactory.java
M asterix-om/src/main/java/edu/uci/ics/asterix/dataflow/data/nontagged/printers/json/AInt16Printer.java
M asterix-om/src/main/java/edu/uci/ics/asterix/dataflow/data/nontagged/printers/json/AInt32Printer.java
M asterix-om/src/main/java/edu/uci/ics/asterix/dataflow/data/nontagged/printers/json/AInt64Printer.java
M asterix-om/src/main/java/edu/uci/ics/asterix/dataflow/data/nontagged/printers/json/AInt8Printer.java
M asterix-om/src/main/java/edu/uci/ics/asterix/dataflow/data/nontagged/printers/json/AObjectPrinter.java
M asterix-om/src/main/java/edu/uci/ics/asterix/dataflow/data/nontagged/printers/json/AStringPrinter.java
A asterix-om/src/main/java/edu/uci/ics/asterix/dataflow/data/nontagged/printers/json/AUUIDPrinter.java
A asterix-om/src/main/java/edu/uci/ics/asterix/dataflow/data/nontagged/printers/json/AUUIDPrinterFactory.java
M asterix-om/src/main/java/edu/uci/ics/asterix/formats/nontagged/AqlCleanJSONPrinterFactoryProvider.java
M asterix-om/src/main/java/edu/uci/ics/asterix/formats/nontagged/AqlJSONPrinterFactoryProvider.java
M asterix-om/src/main/java/edu/uci/ics/asterix/om/pointables/printer/cleanjson/APrintVisitor.java
M asterix-om/src/main/java/edu/uci/ics/asterix/om/pointables/printer/json/APrintVisitor.java
M asterix-runtime/src/main/java/edu/uci/ics/asterix/runtime/evaluators/functions/binary/PrintBinaryDescriptor.java
38 files changed, 450 insertions(+), 116 deletions(-)


  git pull ssh://asterix-gerrit.ics.uci.edu:29418/asterixdb refs/changes/62/362/1

diff --git a/asterix-app/data/nontagged/allData.adm b/asterix-app/data/nontagged/allData.adm
new file mode 100644
index 0000000..da13528
--- /dev/null
+++ b/asterix-app/data/nontagged/allData.adm
@@ -0,0 +1,25 @@
+{ "id": 10,
+"string": string("Nancy"),
+"float": 32.5f,
+"double" : double("-2013.5938237483274"),
+"boolean" : true,
+"int8": int8("125"),
+"int16": int16("32765"),
+"int32": int32("294967295"),
+"int64": int64("1700000000000000000"),
+"unorderedList": {{"reading","writing"}},
+"orderedList": ["Brad","Scott"],
+"record": {  "number": 8389, "street": "Hill St.", "city": "Mountain View" },
+"date": date("-2011-01-27"),
+"time": time("12:20:30Z"),
+"datetime": datetime("-1951-12-27T12:20:30"),
+"duration": duration("P10Y11M12DT10H50M30S"),
+"point": point("41.00,44.00"),
+"point3d": point3d("44.00,13.00,41.00"),
+"line" : line("10.1,11.1 10.2,11.2"),
+"rectangle" : rectangle("5.1,11.8 87.6,15.6548"),
+"polygon" : polygon("1.2,1.3 2.1,2.5 3.5,3.6 4.6,4.8"),
+"circle" : circle("10.1,11.1 10.2"),
+"binary" : hex("ABCDEF0123456789"),
+"uuid" : uuid("5c848e5c-6b6a-498f-8452-8847a2957421")
+}
diff --git a/asterix-app/data/nontagged/allData.json b/asterix-app/data/nontagged/allData.json
deleted file mode 100644
index 06c786f..0000000
--- a/asterix-app/data/nontagged/allData.json
+++ /dev/null
@@ -1,17 +0,0 @@
-{ "id": 10,
-"name": string("Nancy"),
-"age": 32.5f,
-"salary": 12.000 ,"married": boolean("true"),
-"interests": {{"reading","writing"}},
-"children": ["Brad","Scott"],
- "address": {  "number": 8389, "street": "Hill St.", "city": "Mountain View" },
-"dob": date("-2011-01-27"),
-"time": time("12:20:30Z"),
-"datetime": datetime("-1951-12-27T12:20:30"),
- "duration": duration("P10Y11M12DT10H50M30S"),
- "location2d": point("41.00,44.00"),
- "location3d": point3d("44.00,13.00,41.00"),
-"line" : line("10.1,11.1 10.2,11.2"),
-"polygon" : polygon("1.2,1.3 2.1,2.5 3.5,3.6 4.6,4.8"),
-"circle" : circle("10.1,11.1 10.2"),
-"binary" : hex("ABCDEF0123456789") }
diff --git a/asterix-app/src/test/resources/runtimets/queries/scan/alltypes_01/alltypes_01.1.ddl.aql b/asterix-app/src/test/resources/runtimets/queries/scan/alltypes_01/alltypes_01.1.ddl.aql
index d3f7c27..4c84f32 100644
--- a/asterix-app/src/test/resources/runtimets/queries/scan/alltypes_01/alltypes_01.1.ddl.aql
+++ b/asterix-app/src/test/resources/runtimets/queries/scan/alltypes_01/alltypes_01.1.ddl.aql
@@ -11,26 +11,32 @@
 
 create type AllType as open {
   id: int64,
-  name: string,
-  age: float,
-  salary: double,
-  married: boolean,
-  interests: {{string}},
-  children: [string],
-  address: AddressType,
-  dob: date,
+  string: string,
+  float: float,
+  double: double,
+  boolean: boolean,
+  int8: int8,
+  int16: int16,
+  int32: int32,
+  int64: int64,
+  unorderedList: {{string}},
+  orderedList: [string],
+  record: AddressType,
+  date: date,
   time: time,
   datetime: datetime,
   duration: duration,
-  location2d: point,
-  location3d: point3d,
+  point: point,
+  point3d: point3d,
   line: line,
+  rectangle: rectangle,
   polygon: polygon,
   circle: circle,
-  binary: binary
+  binary: binary,
+  uuid: uuid
   // union
 }
 
 create external dataset All(AllType)
 using "edu.uci.ics.asterix.external.dataset.adapter.NCFileSystemAdapter"
-(("path"="nc1://data/nontagged/allData.json"),("format"="adm"));
+(("path"="nc1://data/nontagged/allData.adm"),("format"="adm"));
diff --git a/asterix-app/src/test/resources/runtimets/queries/scan/alltypes_02/alltypes_02.1.ddl.aql b/asterix-app/src/test/resources/runtimets/queries/scan/alltypes_02/alltypes_02.1.ddl.aql
index 826bfaa..4c84f32 100644
--- a/asterix-app/src/test/resources/runtimets/queries/scan/alltypes_02/alltypes_02.1.ddl.aql
+++ b/asterix-app/src/test/resources/runtimets/queries/scan/alltypes_02/alltypes_02.1.ddl.aql
@@ -1,10 +1,3 @@
-/*
- * Description  : Test variant syntax for dataset access (scan)
- *              : using parentheses and quotes is optional
- * Expected Res : Success
- * Date         : 6th March 2013
- */
-
 drop dataverse test if exists;
 create dataverse test;
 
@@ -18,26 +11,32 @@
 
 create type AllType as open {
   id: int64,
-  name: string,
-  age: float,
-  salary: double,
-  married: boolean,
-  interests: {{string}},
-  children: [string],
-  address: AddressType,
-  dob: date,
+  string: string,
+  float: float,
+  double: double,
+  boolean: boolean,
+  int8: int8,
+  int16: int16,
+  int32: int32,
+  int64: int64,
+  unorderedList: {{string}},
+  orderedList: [string],
+  record: AddressType,
+  date: date,
   time: time,
   datetime: datetime,
   duration: duration,
-  location2d: point,
-  location3d: point3d,
+  point: point,
+  point3d: point3d,
   line: line,
+  rectangle: rectangle,
   polygon: polygon,
   circle: circle,
-  binary: binary
+  binary: binary,
+  uuid: uuid
   // union
 }
 
 create external dataset All(AllType)
 using "edu.uci.ics.asterix.external.dataset.adapter.NCFileSystemAdapter"
-(("path"="nc1://data/nontagged/allData.json"),("format"="adm"));
+(("path"="nc1://data/nontagged/allData.adm"),("format"="adm"));
diff --git a/asterix-app/src/test/resources/runtimets/results/scan/alltypes_01-cleanjson/alltypes_01.1.json b/asterix-app/src/test/resources/runtimets/results/scan/alltypes_01-cleanjson/alltypes_01.1.json
new file mode 100644
index 0000000..b6e9a08
--- /dev/null
+++ b/asterix-app/src/test/resources/runtimets/results/scan/alltypes_01-cleanjson/alltypes_01.1.json
@@ -0,0 +1,2 @@
+[ { "id": 10, "string": "Nancy", "float": 32.5, "double": -2013.5938237483274, "boolean": true, "int8": 125, "int16": 32765, "int32": 294967295, "int64": 1700000000000000000, "unorderedList": [ "reading", "writing" ], "orderedList": [ "Brad", "Scott" ], "record": { "number": 8389, "street": "Hill St.", "city": "Mountain View" }, "date": { "date": -125625945600000}, "time": { "time": 44430000}, "datetime": { "datetime": -123703587570000}, "duration": { "duration": { "months": 131, "millis": 1075830000} }, "point": { "point": [41.0, 44.0] }, "point3d": { "point3d": [44.0, 13.0, 41.0] }, "line": { "line":  [ { "point": [10.1, 11.1] }, { "point": [10.2, 11.2] } ] }, "rectangle": { "rectangle": [{ "point": [5.1, 11.8] }, { "point": [87.6, 15.6548] } ] }, "polygon": { "polygon": [{ "point": [1.2, 1.3] },{ "point": [2.1, 2.5] },{ "point": [3.5, 3.6] },{ "point": [4.6, 4.8] }] }, "circle": { "circle": [10.1, { "point": [11.1, 10.2] } ] }, "binary": "ABCDEF0123456789", "uuid": "5c848
 e5c-6b6a-498f-8452-8847a2957421" }
+ ]
diff --git a/asterix-app/src/test/resources/runtimets/results/scan/alltypes_01-json/alltypes_01.1.json b/asterix-app/src/test/resources/runtimets/results/scan/alltypes_01-json/alltypes_01.1.json
new file mode 100644
index 0000000..2c4d9d7
--- /dev/null
+++ b/asterix-app/src/test/resources/runtimets/results/scan/alltypes_01-json/alltypes_01.1.json
@@ -0,0 +1,2 @@
+[ { "id": { "int64": 10 }, "string": "Nancy", "float": 32.5, "double": -2013.5938237483274, "boolean": true, "int8": { "int8": 125 }, "int16": { "int16": 32765 }, "int32": { "int32": 294967295 }, "int64": { "int64": 1700000000000000000 }, "unorderedList": { "unorderedlist": [ "reading", "writing" ] }, "orderedList": { "orderedlist": [ "Brad", "Scott" ] }, "record": { "number": { "int64": 8389 }, "street": "Hill St.", "city": "Mountain View" }, "date": { "date": -125625945600000}, "time": { "time": 44430000}, "datetime": { "datetime": -123703587570000}, "duration": { "duration": { "months": 131, "millis": 1075830000} }, "point": { "point": [41.0, 44.0] }, "point3d": { "point3d": [44.0, 13.0, 41.0] }, "line": { "line":  [ { "point": [10.1, 11.1] }, { "point": [10.2, 11.2] } ] }, "rectangle": { "rectangle": [{ "point": [5.1, 11.8] }, { "point": [87.6, 15.6548] } ] }, "polygon": { "polygon": [{ "point": [1.2, 1.3] },{ "point": [2.1, 2.5] },{ "point": [3.5, 3.6] },{ "point": [4.6
 , 4.8] }] }, "circle": { "circle": [10.1, { "point": [11.1, 10.2] } ] }, "binary": "ABCDEF0123456789", "uuid": "5c848e5c-6b6a-498f-8452-8847a2957421" }
+ ]
diff --git a/asterix-app/src/test/resources/runtimets/results/scan/alltypes_01/alltypes_01.1.adm b/asterix-app/src/test/resources/runtimets/results/scan/alltypes_01/alltypes_01.1.adm
index 6d9f6e9..66df0aa 100644
--- a/asterix-app/src/test/resources/runtimets/results/scan/alltypes_01/alltypes_01.1.adm
+++ b/asterix-app/src/test/resources/runtimets/results/scan/alltypes_01/alltypes_01.1.adm
@@ -1,2 +1,2 @@
-[ { "id": 10, "name": "Nancy", "age": 32.5f, "salary": 12.0d, "married": true, "interests": {{ "reading", "writing" }}, "children": [ "Brad", "Scott" ], "address": { "number": 8389, "street": "Hill St.", "city": "Mountain View" }, "dob": date("-2011-01-27"), "time": time("12:20:30.000Z"), "datetime": datetime("-1951-12-27T12:20:30.000Z"), "duration": duration("P10Y11M12DT10H50M30S"), "location2d": point("41.0,44.0"), "location3d": point3d("44.0,13.0,41.0"), "line": line("10.1,11.1 10.2,11.2"), "polygon": polygon("1.2,1.3 2.1,2.5 3.5,3.6 4.6,4.8"), "circle": circle("10.1,11.1 10.2"), "binary": hex("ABCDEF0123456789") }
+[ { "id": 10, "string": "Nancy", "float": 32.5f, "double": -2013.5938237483274d, "boolean": true, "int8": 125i8, "int16": 32765i16, "int32": 294967295i32, "int64": 1700000000000000000, "unorderedList": {{ "reading", "writing" }}, "orderedList": [ "Brad", "Scott" ], "record": { "number": 8389, "street": "Hill St.", "city": "Mountain View" }, "date": date("-2011-01-27"), "time": time("12:20:30.000Z"), "datetime": datetime("-1951-12-27T12:20:30.000Z"), "duration": duration("P10Y11M12DT10H50M30S"), "point": point("41.0,44.0"), "point3d": point3d("44.0,13.0,41.0"), "line": line("10.1,11.1 10.2,11.2"), "rectangle": rectangle("5.1,11.8 87.6,15.6548"), "polygon": polygon("1.2,1.3 2.1,2.5 3.5,3.6 4.6,4.8"), "circle": circle("10.1,11.1 10.2"), "binary": hex("ABCDEF0123456789"), "uuid": uuid("5c848e5c-6b6a-498f-8452-8847a2957421") }
  ]
diff --git a/asterix-app/src/test/resources/runtimets/results/scan/alltypes_02/alltypes_02.1.adm b/asterix-app/src/test/resources/runtimets/results/scan/alltypes_02/alltypes_02.1.adm
index 6d9f6e9..66df0aa 100644
--- a/asterix-app/src/test/resources/runtimets/results/scan/alltypes_02/alltypes_02.1.adm
+++ b/asterix-app/src/test/resources/runtimets/results/scan/alltypes_02/alltypes_02.1.adm
@@ -1,2 +1,2 @@
-[ { "id": 10, "name": "Nancy", "age": 32.5f, "salary": 12.0d, "married": true, "interests": {{ "reading", "writing" }}, "children": [ "Brad", "Scott" ], "address": { "number": 8389, "street": "Hill St.", "city": "Mountain View" }, "dob": date("-2011-01-27"), "time": time("12:20:30.000Z"), "datetime": datetime("-1951-12-27T12:20:30.000Z"), "duration": duration("P10Y11M12DT10H50M30S"), "location2d": point("41.0,44.0"), "location3d": point3d("44.0,13.0,41.0"), "line": line("10.1,11.1 10.2,11.2"), "polygon": polygon("1.2,1.3 2.1,2.5 3.5,3.6 4.6,4.8"), "circle": circle("10.1,11.1 10.2"), "binary": hex("ABCDEF0123456789") }
+[ { "id": 10, "string": "Nancy", "float": 32.5f, "double": -2013.5938237483274d, "boolean": true, "int8": 125i8, "int16": 32765i16, "int32": 294967295i32, "int64": 1700000000000000000, "unorderedList": {{ "reading", "writing" }}, "orderedList": [ "Brad", "Scott" ], "record": { "number": 8389, "street": "Hill St.", "city": "Mountain View" }, "date": date("-2011-01-27"), "time": time("12:20:30.000Z"), "datetime": datetime("-1951-12-27T12:20:30.000Z"), "duration": duration("P10Y11M12DT10H50M30S"), "point": point("41.0,44.0"), "point3d": point3d("44.0,13.0,41.0"), "line": line("10.1,11.1 10.2,11.2"), "rectangle": rectangle("5.1,11.8 87.6,15.6548"), "polygon": polygon("1.2,1.3 2.1,2.5 3.5,3.6 4.6,4.8"), "circle": circle("10.1,11.1 10.2"), "binary": hex("ABCDEF0123456789"), "uuid": uuid("5c848e5c-6b6a-498f-8452-8847a2957421") }
  ]
diff --git a/asterix-app/src/test/resources/runtimets/testsuite.xml b/asterix-app/src/test/resources/runtimets/testsuite.xml
index 20fc769..8708c5a 100644
--- a/asterix-app/src/test/resources/runtimets/testsuite.xml
+++ b/asterix-app/src/test/resources/runtimets/testsuite.xml
@@ -4414,6 +4414,16 @@
             </compilation-unit>
         </test-case>
         <test-case FilePath="scan">
+            <compilation-unit name="alltypes_01">
+                <output-dir compare="JSON">alltypes_01-json</output-dir>
+            </compilation-unit>
+        </test-case>
+        <test-case FilePath="scan">
+            <compilation-unit name="alltypes_01">
+                <output-dir compare="Clean-JSON">alltypes_01-cleanjson</output-dir>
+            </compilation-unit>
+        </test-case>
+        <test-case FilePath="scan">
             <compilation-unit name="alltypes_02">
                 <output-dir compare="Text">alltypes_02</output-dir>
             </compilation-unit>
@@ -5324,7 +5334,7 @@
             </compilation-unit>
         </test-case>
         <test-case FilePath="tpch">
-            <compilation-unit name="q17_small_quantity_order_revenue">
+            <compilation-unit name="q17_squantity_order_revenue">
                 <output-dir compare="Text">q17_small_quantity_order_revenue</output-dir>
             </compilation-unit>
         </test-case>
@@ -6656,14 +6666,14 @@
     <test-group name="json">
         <test-case FilePath="json">
             <compilation-unit name="int01">
-                <output-dir compare="JSON">int01-json</output-dir>
+                <output-dir compare="JSON">int01</output-dir>
             </compilation-unit>
         </test-case>
     </test-group>
     <test-group name="cleanjson">
         <test-case FilePath="json">
             <compilation-unit name="int01">
-                <output-dir compare="Clean-JSON">int01-cleanjson</output-dir>
+                <output-dir compare="Clean-JSON">int01</output-dir>
             </compilation-unit>
         </test-case>
     </test-group>
diff --git a/asterix-om/src/main/java/edu/uci/ics/asterix/dataflow/data/nontagged/printers/adm/PrintTools.java b/asterix-om/src/main/java/edu/uci/ics/asterix/dataflow/data/nontagged/printers/PrintTools.java
similarity index 91%
rename from asterix-om/src/main/java/edu/uci/ics/asterix/dataflow/data/nontagged/printers/adm/PrintTools.java
rename to asterix-om/src/main/java/edu/uci/ics/asterix/dataflow/data/nontagged/printers/PrintTools.java
index 7044aaa..aef03b1 100644
--- a/asterix-om/src/main/java/edu/uci/ics/asterix/dataflow/data/nontagged/printers/adm/PrintTools.java
+++ b/asterix-om/src/main/java/edu/uci/ics/asterix/dataflow/data/nontagged/printers/PrintTools.java
@@ -12,7 +12,7 @@
  * See the License for the specific language governing permissions and
  * limitations under the License.
  */
-package edu.uci.ics.asterix.dataflow.data.nontagged.printers.adm;
+package edu.uci.ics.asterix.dataflow.data.nontagged.printers;
 
 import java.io.IOException;
 import java.io.OutputStream;
@@ -20,7 +20,8 @@
 import edu.uci.ics.hyracks.data.std.primitive.UTF8StringPointable;
 
 public class PrintTools {
-    public static enum CASE {
+
+    public enum CASE {
         LOWER_CASE,
         UPPER_CASE,
     }
@@ -142,7 +143,16 @@
         os.write(hex(c & 0x0f, CASE.LOWER_CASE));
     }
 
-    static byte hex(int i, CASE c) {
+    public static Appendable printHexString(byte[] bytes, int start, int length, Appendable appendable)
+            throws IOException {
+        for (int i = 0; i < length; ++i) {
+            appendable.append((char) hex((bytes[start + i] >>> 4) & 0x0f, CASE.UPPER_CASE));
+            appendable.append((char) hex((bytes[start + i] & 0x0f), CASE.UPPER_CASE));
+        }
+        return appendable;
+    }
+
+    public static byte hex(int i, CASE c) {
         switch (c) {
             case LOWER_CASE:
                 return (byte) (i < 10 ? i + '0' : i + ('a' - 10));
diff --git a/asterix-om/src/main/java/edu/uci/ics/asterix/dataflow/data/nontagged/printers/adm/ABinaryHexPrinter.java b/asterix-om/src/main/java/edu/uci/ics/asterix/dataflow/data/nontagged/printers/adm/ABinaryHexPrinter.java
index 03677eb..efdcb63 100644
--- a/asterix-om/src/main/java/edu/uci/ics/asterix/dataflow/data/nontagged/printers/adm/ABinaryHexPrinter.java
+++ b/asterix-om/src/main/java/edu/uci/ics/asterix/dataflow/data/nontagged/printers/adm/ABinaryHexPrinter.java
@@ -15,6 +15,7 @@
 
 package edu.uci.ics.asterix.dataflow.data.nontagged.printers.adm;
 
+import edu.uci.ics.asterix.dataflow.data.nontagged.printers.PrintTools;
 import edu.uci.ics.asterix.dataflow.data.nontagged.serde.ABinarySerializerDeserializer;
 import edu.uci.ics.hyracks.algebricks.common.exceptions.AlgebricksException;
 import edu.uci.ics.hyracks.algebricks.data.IPrinter;
@@ -37,19 +38,10 @@
         int start = s + 1 + ABinarySerializerDeserializer.SIZE_OF_LENGTH;
         try {
             ps.print("hex(\"");
-            printHexString(b, start, validLength, ps);
+            PrintTools.printHexString(b, start, validLength, ps);
             ps.print("\")");
         } catch (IOException e) {
             throw new AlgebricksException(e);
         }
-    }
-
-    public static Appendable printHexString(byte[] bytes, int start, int length, Appendable appendable)
-            throws IOException {
-        for (int i = 0; i < length; ++i) {
-            appendable.append((char) PrintTools.hex((bytes[start + i] >>> 4) & 0x0f, PrintTools.CASE.UPPER_CASE));
-            appendable.append((char) PrintTools.hex((bytes[start + i] & 0x0f), PrintTools.CASE.UPPER_CASE));
-        }
-        return appendable;
     }
 }
diff --git a/asterix-om/src/main/java/edu/uci/ics/asterix/dataflow/data/nontagged/printers/adm/AStringPrinter.java b/asterix-om/src/main/java/edu/uci/ics/asterix/dataflow/data/nontagged/printers/adm/AStringPrinter.java
index c41c0dc..4d99be6 100644
--- a/asterix-om/src/main/java/edu/uci/ics/asterix/dataflow/data/nontagged/printers/adm/AStringPrinter.java
+++ b/asterix-om/src/main/java/edu/uci/ics/asterix/dataflow/data/nontagged/printers/adm/AStringPrinter.java
@@ -17,6 +17,7 @@
 import java.io.IOException;
 import java.io.PrintStream;
 
+import edu.uci.ics.asterix.dataflow.data.nontagged.printers.PrintTools;
 import edu.uci.ics.hyracks.algebricks.common.exceptions.AlgebricksException;
 import edu.uci.ics.hyracks.algebricks.data.IPrinter;
 
diff --git a/asterix-om/src/main/java/edu/uci/ics/asterix/dataflow/data/nontagged/printers/cleanjson/ABinaryHexPrinter.java b/asterix-om/src/main/java/edu/uci/ics/asterix/dataflow/data/nontagged/printers/cleanjson/ABinaryHexPrinter.java
new file mode 100644
index 0000000..3d5d8a1
--- /dev/null
+++ b/asterix-om/src/main/java/edu/uci/ics/asterix/dataflow/data/nontagged/printers/cleanjson/ABinaryHexPrinter.java
@@ -0,0 +1,48 @@
+/*
+ * Copyright 2009-2013 by The Regents of the University of California
+ *  Licensed under the Apache License, Version 2.0 (the "License");
+ *  you may not use this file except in compliance with the License.
+ *  you may obtain a copy of the License from
+ *
+ *     http://www.apache.org/licenses/LICENSE-2.0
+ *
+ *  Unless required by applicable law or agreed to in writing, software
+ *  distributed under the License is distributed on an "AS IS" BASIS,
+ *  WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
+ *  See the License for the specific language governing permissions and
+ *  limitations under the License.
+ */
+
+package edu.uci.ics.asterix.dataflow.data.nontagged.printers.cleanjson;
+
+import edu.uci.ics.asterix.dataflow.data.nontagged.printers.PrintTools;
+import edu.uci.ics.asterix.dataflow.data.nontagged.serde.ABinarySerializerDeserializer;
+import edu.uci.ics.hyracks.algebricks.common.exceptions.AlgebricksException;
+import edu.uci.ics.hyracks.algebricks.data.IPrinter;
+
+import java.io.IOException;
+import java.io.PrintStream;
+
+public class ABinaryHexPrinter implements IPrinter {
+    private ABinaryHexPrinter() {
+    }
+
+    public static final ABinaryHexPrinter INSTANCE = new ABinaryHexPrinter();
+
+    @Override public void init() throws AlgebricksException {
+
+    }
+
+    @Override public void print(byte[] b, int s, int l, PrintStream ps) throws AlgebricksException {
+        int validLength = ABinarySerializerDeserializer.getLength(b, s + 1);
+        int start = s + 1 + ABinarySerializerDeserializer.SIZE_OF_LENGTH;
+        try {
+            ps.print("\"");
+            PrintTools.printHexString(b, start, validLength, ps);
+            ps.print("\"");
+        } catch (IOException e) {
+            throw new AlgebricksException(e);
+        }
+    }
+
+}
diff --git a/asterix-om/src/main/java/edu/uci/ics/asterix/dataflow/data/nontagged/printers/cleanjson/ABinaryPrinterFactory.java b/asterix-om/src/main/java/edu/uci/ics/asterix/dataflow/data/nontagged/printers/cleanjson/ABinaryPrinterFactory.java
new file mode 100644
index 0000000..14c12d4
--- /dev/null
+++ b/asterix-om/src/main/java/edu/uci/ics/asterix/dataflow/data/nontagged/printers/cleanjson/ABinaryPrinterFactory.java
@@ -0,0 +1,31 @@
+/*
+ * Copyright 2009-2013 by The Regents of the University of California
+ *  Licensed under the Apache License, Version 2.0 (the "License");
+ *  you may not use this file except in compliance with the License.
+ *  you may obtain a copy of the License from
+ *
+ *     http://www.apache.org/licenses/LICENSE-2.0
+ *
+ *  Unless required by applicable law or agreed to in writing, software
+ *  distributed under the License is distributed on an "AS IS" BASIS,
+ *  WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
+ *  See the License for the specific language governing permissions and
+ *  limitations under the License.
+ */
+
+package edu.uci.ics.asterix.dataflow.data.nontagged.printers.cleanjson;
+
+import edu.uci.ics.hyracks.algebricks.data.IPrinter;
+import edu.uci.ics.hyracks.algebricks.data.IPrinterFactory;
+
+public class ABinaryPrinterFactory implements IPrinterFactory {
+
+    private ABinaryPrinterFactory() {
+    }
+
+    public static final ABinaryPrinterFactory INSTANCE = new ABinaryPrinterFactory();
+
+    @Override public IPrinter createPrinter() {
+        return ABinaryHexPrinter.INSTANCE;
+    }
+}
diff --git a/asterix-om/src/main/java/edu/uci/ics/asterix/dataflow/data/nontagged/printers/cleanjson/AInt16Printer.java b/asterix-om/src/main/java/edu/uci/ics/asterix/dataflow/data/nontagged/printers/cleanjson/AInt16Printer.java
index 06a2cfc..da3f44d 100644
--- a/asterix-om/src/main/java/edu/uci/ics/asterix/dataflow/data/nontagged/printers/cleanjson/AInt16Printer.java
+++ b/asterix-om/src/main/java/edu/uci/ics/asterix/dataflow/data/nontagged/printers/cleanjson/AInt16Printer.java
@@ -31,9 +31,6 @@
     @Override
     public void print(byte[] b, int s, int l, PrintStream ps) throws AlgebricksException {
         short i = AInt16SerializerDeserializer.getShort(b, s + 1);
-
-        ps.println("{ \"int16\": ");
-        ps.println(i);
-        ps.println("}");
+        ps.print(i);
     }
 }
diff --git a/asterix-om/src/main/java/edu/uci/ics/asterix/dataflow/data/nontagged/printers/cleanjson/AInt32Printer.java b/asterix-om/src/main/java/edu/uci/ics/asterix/dataflow/data/nontagged/printers/cleanjson/AInt32Printer.java
index 7c43f30..ea23d38 100644
--- a/asterix-om/src/main/java/edu/uci/ics/asterix/dataflow/data/nontagged/printers/cleanjson/AInt32Printer.java
+++ b/asterix-om/src/main/java/edu/uci/ics/asterix/dataflow/data/nontagged/printers/cleanjson/AInt32Printer.java
@@ -32,9 +32,6 @@
     @Override
     public void print(byte[] b, int s, int l, PrintStream ps) throws AlgebricksException {
         int d = AInt32SerializerDeserializer.getInt(b, s + 1);
-
-        ps.println("{ \"int32\": ");
-        ps.println(d);
-        ps.println("}");
+        ps.print(d);
     }
 }
diff --git a/asterix-om/src/main/java/edu/uci/ics/asterix/dataflow/data/nontagged/printers/cleanjson/AInt64Printer.java b/asterix-om/src/main/java/edu/uci/ics/asterix/dataflow/data/nontagged/printers/cleanjson/AInt64Printer.java
index a23574b..adb7c84 100644
--- a/asterix-om/src/main/java/edu/uci/ics/asterix/dataflow/data/nontagged/printers/cleanjson/AInt64Printer.java
+++ b/asterix-om/src/main/java/edu/uci/ics/asterix/dataflow/data/nontagged/printers/cleanjson/AInt64Printer.java
@@ -30,8 +30,6 @@
     @Override
     public void print(byte[] b, int s, int l, PrintStream ps) throws AlgebricksException {
         long d = AInt64SerializerDeserializer.getLong(b, s + 1);
-        ps.println("{ \"int64\": ");
-        ps.println(d);
-        ps.println("}");
+        ps.print(d);
     }
 }
diff --git a/asterix-om/src/main/java/edu/uci/ics/asterix/dataflow/data/nontagged/printers/cleanjson/AInt8Printer.java b/asterix-om/src/main/java/edu/uci/ics/asterix/dataflow/data/nontagged/printers/cleanjson/AInt8Printer.java
index 94466d9..81d6dae 100644
--- a/asterix-om/src/main/java/edu/uci/ics/asterix/dataflow/data/nontagged/printers/cleanjson/AInt8Printer.java
+++ b/asterix-om/src/main/java/edu/uci/ics/asterix/dataflow/data/nontagged/printers/cleanjson/AInt8Printer.java
@@ -32,9 +32,6 @@
     @Override
     public void print(byte[] b, int s, int l, PrintStream ps) throws AlgebricksException {
         byte o = AInt8SerializerDeserializer.getByte(b, s + 1);
-
-        ps.println("{ \"int8\": ");
-        ps.println(o);
-        ps.println("}");
+        ps.print(o);
     }
 }
diff --git a/asterix-om/src/main/java/edu/uci/ics/asterix/dataflow/data/nontagged/printers/cleanjson/AObjectPrinter.java b/asterix-om/src/main/java/edu/uci/ics/asterix/dataflow/data/nontagged/printers/cleanjson/AObjectPrinter.java
index ef45631..13e5894 100644
--- a/asterix-om/src/main/java/edu/uci/ics/asterix/dataflow/data/nontagged/printers/cleanjson/AObjectPrinter.java
+++ b/asterix-om/src/main/java/edu/uci/ics/asterix/dataflow/data/nontagged/printers/cleanjson/AObjectPrinter.java
@@ -16,7 +16,6 @@
 
 import java.io.PrintStream;
 
-import edu.uci.ics.asterix.dataflow.data.nontagged.printers.adm.ABinaryHexPrinter;
 import edu.uci.ics.asterix.om.types.ATypeTag;
 import edu.uci.ics.asterix.om.types.EnumDeserializer;
 import edu.uci.ics.hyracks.algebricks.common.exceptions.AlgebricksException;
@@ -147,6 +146,10 @@
                 unorderedListPrinter.print(b, s, l, ps);
                 break;
             }
+            case UUID: {
+                AUUIDPrinter.INSTANCE.print(b, s, l, ps);
+                break;
+            }
             case ANY:
             case BITARRAY:
             case ENUM:
@@ -159,7 +162,6 @@
             case UINT64:
             case UINT8:
             case UNION:
-            case UUID:
             case UUID_STRING:
                 throw new NotImplementedException("No printer for type " + typeTag);
         }
diff --git a/asterix-om/src/main/java/edu/uci/ics/asterix/dataflow/data/nontagged/printers/cleanjson/AStringPrinter.java b/asterix-om/src/main/java/edu/uci/ics/asterix/dataflow/data/nontagged/printers/cleanjson/AStringPrinter.java
index 4ca3427..70c9880 100644
--- a/asterix-om/src/main/java/edu/uci/ics/asterix/dataflow/data/nontagged/printers/cleanjson/AStringPrinter.java
+++ b/asterix-om/src/main/java/edu/uci/ics/asterix/dataflow/data/nontagged/printers/cleanjson/AStringPrinter.java
@@ -17,7 +17,7 @@
 import java.io.IOException;
 import java.io.PrintStream;
 
-import edu.uci.ics.asterix.dataflow.data.nontagged.printers.adm.PrintTools;
+import edu.uci.ics.asterix.dataflow.data.nontagged.printers.PrintTools;
 import edu.uci.ics.hyracks.algebricks.common.exceptions.AlgebricksException;
 import edu.uci.ics.hyracks.algebricks.data.IPrinter;
 
diff --git a/asterix-om/src/main/java/edu/uci/ics/asterix/dataflow/data/nontagged/printers/cleanjson/AUUIDPrinter.java b/asterix-om/src/main/java/edu/uci/ics/asterix/dataflow/data/nontagged/printers/cleanjson/AUUIDPrinter.java
new file mode 100644
index 0000000..795a6a8
--- /dev/null
+++ b/asterix-om/src/main/java/edu/uci/ics/asterix/dataflow/data/nontagged/printers/cleanjson/AUUIDPrinter.java
@@ -0,0 +1,44 @@
+/*
+ * Copyright 2009-2013 by The Regents of the University of California
+ *  Licensed under the Apache License, Version 2.0 (the "License");
+ *  you may not use this file except in compliance with the License.
+ *  you may obtain a copy of the License from
+ *
+ *     http://www.apache.org/licenses/LICENSE-2.0
+ *
+ *  Unless required by applicable law or agreed to in writing, software
+ *  distributed under the License is distributed on an "AS IS" BASIS,
+ *  WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
+ *  See the License for the specific language governing permissions and
+ *  limitations under the License.
+ */
+
+package edu.uci.ics.asterix.dataflow.data.nontagged.printers.cleanjson;
+
+import edu.uci.ics.asterix.om.base.AMutableUUID;
+import edu.uci.ics.hyracks.algebricks.common.exceptions.AlgebricksException;
+import edu.uci.ics.hyracks.algebricks.data.IPrinter;
+import edu.uci.ics.hyracks.data.std.primitive.LongPointable;
+
+import java.io.PrintStream;
+
+public class AUUIDPrinter implements IPrinter {
+
+    public static final AUUIDPrinter INSTANCE = new AUUIDPrinter();
+    // We use mutable UUID not to create a UUID object multiple times.
+    AMutableUUID uuid = new AMutableUUID(0, 0);
+
+    @Override
+    public void init() throws AlgebricksException {
+    }
+
+    @Override
+    public void print(byte[] b, int s, int l, PrintStream ps) throws AlgebricksException {
+        long msb = LongPointable.getLong(b, s + 1);
+        long lsb = LongPointable.getLong(b, s + 9);
+        uuid.setValue(msb, lsb);
+
+        ps.print("\"" + uuid.toStringLiteralOnly() + "\"");
+    }
+
+}
diff --git a/asterix-om/src/main/java/edu/uci/ics/asterix/dataflow/data/nontagged/printers/cleanjson/AUUIDPrinterFactory.java b/asterix-om/src/main/java/edu/uci/ics/asterix/dataflow/data/nontagged/printers/cleanjson/AUUIDPrinterFactory.java
new file mode 100644
index 0000000..9e06042
--- /dev/null
+++ b/asterix-om/src/main/java/edu/uci/ics/asterix/dataflow/data/nontagged/printers/cleanjson/AUUIDPrinterFactory.java
@@ -0,0 +1,33 @@
+/*
+ * Copyright 2009-2013 by The Regents of the University of California
+ *  Licensed under the Apache License, Version 2.0 (the "License");
+ *  you may not use this file except in compliance with the License.
+ *  you may obtain a copy of the License from
+ *
+ *     http://www.apache.org/licenses/LICENSE-2.0
+ *
+ *  Unless required by applicable law or agreed to in writing, software
+ *  distributed under the License is distributed on an "AS IS" BASIS,
+ *  WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
+ *  See the License for the specific language governing permissions and
+ *  limitations under the License.
+ */
+
+package edu.uci.ics.asterix.dataflow.data.nontagged.printers.cleanjson;
+
+import edu.uci.ics.asterix.dataflow.data.nontagged.printers.adm.AUUIDPrinter;
+import edu.uci.ics.hyracks.algebricks.data.IPrinter;
+import edu.uci.ics.hyracks.algebricks.data.IPrinterFactory;
+
+public class AUUIDPrinterFactory implements IPrinterFactory {
+
+    private static final long serialVersionUID = 1L;
+
+    public static final AUUIDPrinterFactory INSTANCE = new AUUIDPrinterFactory();
+
+    @Override
+    public IPrinter createPrinter() {
+        return AUUIDPrinter.INSTANCE;
+    }
+
+}
diff --git a/asterix-om/src/main/java/edu/uci/ics/asterix/dataflow/data/nontagged/printers/csv/AStringPrinter.java b/asterix-om/src/main/java/edu/uci/ics/asterix/dataflow/data/nontagged/printers/csv/AStringPrinter.java
index 4a78c19..a5e033b 100644
--- a/asterix-om/src/main/java/edu/uci/ics/asterix/dataflow/data/nontagged/printers/csv/AStringPrinter.java
+++ b/asterix-om/src/main/java/edu/uci/ics/asterix/dataflow/data/nontagged/printers/csv/AStringPrinter.java
@@ -17,7 +17,7 @@
 import java.io.IOException;
 import java.io.PrintStream;
 
-import edu.uci.ics.asterix.dataflow.data.nontagged.printers.adm.PrintTools;
+import edu.uci.ics.asterix.dataflow.data.nontagged.printers.PrintTools;
 import edu.uci.ics.hyracks.algebricks.common.exceptions.AlgebricksException;
 import edu.uci.ics.hyracks.algebricks.data.IPrinter;
 
diff --git a/asterix-om/src/main/java/edu/uci/ics/asterix/dataflow/data/nontagged/printers/json/ABinaryHexPrinter.java b/asterix-om/src/main/java/edu/uci/ics/asterix/dataflow/data/nontagged/printers/json/ABinaryHexPrinter.java
new file mode 100644
index 0000000..068070e
--- /dev/null
+++ b/asterix-om/src/main/java/edu/uci/ics/asterix/dataflow/data/nontagged/printers/json/ABinaryHexPrinter.java
@@ -0,0 +1,47 @@
+/*
+ * Copyright 2009-2013 by The Regents of the University of California
+ *  Licensed under the Apache License, Version 2.0 (the "License");
+ *  you may not use this file except in compliance with the License.
+ *  you may obtain a copy of the License from
+ *
+ *     http://www.apache.org/licenses/LICENSE-2.0
+ *
+ *  Unless required by applicable law or agreed to in writing, software
+ *  distributed under the License is distributed on an "AS IS" BASIS,
+ *  WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
+ *  See the License for the specific language governing permissions and
+ *  limitations under the License.
+ */
+
+package edu.uci.ics.asterix.dataflow.data.nontagged.printers.json;
+
+import edu.uci.ics.asterix.dataflow.data.nontagged.printers.PrintTools;
+import edu.uci.ics.asterix.dataflow.data.nontagged.serde.ABinarySerializerDeserializer;
+import edu.uci.ics.hyracks.algebricks.common.exceptions.AlgebricksException;
+import edu.uci.ics.hyracks.algebricks.data.IPrinter;
+
+import java.io.IOException;
+import java.io.PrintStream;
+
+public class ABinaryHexPrinter implements IPrinter {
+    private ABinaryHexPrinter() {
+    }
+
+    public static final ABinaryHexPrinter INSTANCE = new ABinaryHexPrinter();
+
+    @Override public void init() throws AlgebricksException {
+
+    }
+
+    @Override public void print(byte[] b, int s, int l, PrintStream ps) throws AlgebricksException {
+        int validLength = ABinarySerializerDeserializer.getLength(b, s + 1);
+        int start = s + 1 + ABinarySerializerDeserializer.SIZE_OF_LENGTH;
+        try {
+            ps.print("\"");
+            PrintTools.printHexString(b, start, validLength, ps);
+            ps.print("\"");
+        } catch (IOException e) {
+            throw new AlgebricksException(e);
+        }
+    }
+}
diff --git a/asterix-om/src/main/java/edu/uci/ics/asterix/dataflow/data/nontagged/printers/json/ABinaryPrinterFactory.java b/asterix-om/src/main/java/edu/uci/ics/asterix/dataflow/data/nontagged/printers/json/ABinaryPrinterFactory.java
new file mode 100644
index 0000000..74ef153
--- /dev/null
+++ b/asterix-om/src/main/java/edu/uci/ics/asterix/dataflow/data/nontagged/printers/json/ABinaryPrinterFactory.java
@@ -0,0 +1,31 @@
+/*
+ * Copyright 2009-2013 by The Regents of the University of California
+ *  Licensed under the Apache License, Version 2.0 (the "License");
+ *  you may not use this file except in compliance with the License.
+ *  you may obtain a copy of the License from
+ *
+ *     http://www.apache.org/licenses/LICENSE-2.0
+ *
+ *  Unless required by applicable law or agreed to in writing, software
+ *  distributed under the License is distributed on an "AS IS" BASIS,
+ *  WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
+ *  See the License for the specific language governing permissions and
+ *  limitations under the License.
+ */
+
+package edu.uci.ics.asterix.dataflow.data.nontagged.printers.json;
+
+import edu.uci.ics.hyracks.algebricks.data.IPrinter;
+import edu.uci.ics.hyracks.algebricks.data.IPrinterFactory;
+
+public class ABinaryPrinterFactory implements IPrinterFactory {
+
+    private ABinaryPrinterFactory() {
+    }
+
+    public static final ABinaryPrinterFactory INSTANCE = new ABinaryPrinterFactory();
+
+    @Override public IPrinter createPrinter() {
+        return ABinaryHexPrinter.INSTANCE;
+    }
+}
diff --git a/asterix-om/src/main/java/edu/uci/ics/asterix/dataflow/data/nontagged/printers/json/AInt16Printer.java b/asterix-om/src/main/java/edu/uci/ics/asterix/dataflow/data/nontagged/printers/json/AInt16Printer.java
index 2a0a312..ee1df92 100644
--- a/asterix-om/src/main/java/edu/uci/ics/asterix/dataflow/data/nontagged/printers/json/AInt16Printer.java
+++ b/asterix-om/src/main/java/edu/uci/ics/asterix/dataflow/data/nontagged/printers/json/AInt16Printer.java
@@ -32,8 +32,8 @@
     public void print(byte[] b, int s, int l, PrintStream ps) throws AlgebricksException {
         short i = AInt16SerializerDeserializer.getShort(b, s + 1);
 
-        ps.println("{ \"int16\": ");
-        ps.println(i);
-        ps.println("}");
+        ps.print("{ \"int16\": ");
+        ps.print(i);
+        ps.print(" }");
     }
 }
diff --git a/asterix-om/src/main/java/edu/uci/ics/asterix/dataflow/data/nontagged/printers/json/AInt32Printer.java b/asterix-om/src/main/java/edu/uci/ics/asterix/dataflow/data/nontagged/printers/json/AInt32Printer.java
index 760f4cf..07fc3cd 100644
--- a/asterix-om/src/main/java/edu/uci/ics/asterix/dataflow/data/nontagged/printers/json/AInt32Printer.java
+++ b/asterix-om/src/main/java/edu/uci/ics/asterix/dataflow/data/nontagged/printers/json/AInt32Printer.java
@@ -33,8 +33,8 @@
     public void print(byte[] b, int s, int l, PrintStream ps) throws AlgebricksException {
         int d = AInt32SerializerDeserializer.getInt(b, s + 1);
 
-        ps.println("{ \"int32\": ");
-        ps.println(d);
-        ps.println("}");
+        ps.print("{ \"int32\": ");
+        ps.print(d);
+        ps.print(" }");
     }
 }
diff --git a/asterix-om/src/main/java/edu/uci/ics/asterix/dataflow/data/nontagged/printers/json/AInt64Printer.java b/asterix-om/src/main/java/edu/uci/ics/asterix/dataflow/data/nontagged/printers/json/AInt64Printer.java
index facc462..6ed69db 100644
--- a/asterix-om/src/main/java/edu/uci/ics/asterix/dataflow/data/nontagged/printers/json/AInt64Printer.java
+++ b/asterix-om/src/main/java/edu/uci/ics/asterix/dataflow/data/nontagged/printers/json/AInt64Printer.java
@@ -30,8 +30,8 @@
     @Override
     public void print(byte[] b, int s, int l, PrintStream ps) throws AlgebricksException {
         long d = AInt64SerializerDeserializer.getLong(b, s + 1);
-        ps.println("{ \"int64\": ");
-        ps.println(d);
-        ps.println("}");
+        ps.print("{ \"int64\": ");
+        ps.print(d);
+        ps.print(" }");
     }
 }
diff --git a/asterix-om/src/main/java/edu/uci/ics/asterix/dataflow/data/nontagged/printers/json/AInt8Printer.java b/asterix-om/src/main/java/edu/uci/ics/asterix/dataflow/data/nontagged/printers/json/AInt8Printer.java
index 1afff05..f891bce 100644
--- a/asterix-om/src/main/java/edu/uci/ics/asterix/dataflow/data/nontagged/printers/json/AInt8Printer.java
+++ b/asterix-om/src/main/java/edu/uci/ics/asterix/dataflow/data/nontagged/printers/json/AInt8Printer.java
@@ -33,8 +33,8 @@
     public void print(byte[] b, int s, int l, PrintStream ps) throws AlgebricksException {
         byte o = AInt8SerializerDeserializer.getByte(b, s + 1);
 
-        ps.println("{ \"int8\": ");
-        ps.println(o);
-        ps.println("}");
+        ps.print("{ \"int8\": ");
+        ps.print(o);
+        ps.print(" }");
     }
 }
diff --git a/asterix-om/src/main/java/edu/uci/ics/asterix/dataflow/data/nontagged/printers/json/AObjectPrinter.java b/asterix-om/src/main/java/edu/uci/ics/asterix/dataflow/data/nontagged/printers/json/AObjectPrinter.java
index 402472e..6e2bf63 100644
--- a/asterix-om/src/main/java/edu/uci/ics/asterix/dataflow/data/nontagged/printers/json/AObjectPrinter.java
+++ b/asterix-om/src/main/java/edu/uci/ics/asterix/dataflow/data/nontagged/printers/json/AObjectPrinter.java
@@ -16,7 +16,6 @@
 
 import java.io.PrintStream;
 
-import edu.uci.ics.asterix.dataflow.data.nontagged.printers.adm.ABinaryHexPrinter;
 import edu.uci.ics.asterix.om.types.ATypeTag;
 import edu.uci.ics.asterix.om.types.EnumDeserializer;
 import edu.uci.ics.hyracks.algebricks.common.exceptions.AlgebricksException;
@@ -147,6 +146,10 @@
                 unorderedListPrinter.print(b, s, l, ps);
                 break;
             }
+            case UUID: {
+                AUUIDPrinter.INSTANCE.print(b, s, l, ps);
+                break;
+            }
             case ANY:
             case BITARRAY:
             case ENUM:
@@ -159,7 +162,6 @@
             case UINT64:
             case UINT8:
             case UNION:
-            case UUID:
             case UUID_STRING:
                 throw new NotImplementedException("No printer for type " + typeTag);
         }
diff --git a/asterix-om/src/main/java/edu/uci/ics/asterix/dataflow/data/nontagged/printers/json/AStringPrinter.java b/asterix-om/src/main/java/edu/uci/ics/asterix/dataflow/data/nontagged/printers/json/AStringPrinter.java
index f852f46..43af3ad 100644
--- a/asterix-om/src/main/java/edu/uci/ics/asterix/dataflow/data/nontagged/printers/json/AStringPrinter.java
+++ b/asterix-om/src/main/java/edu/uci/ics/asterix/dataflow/data/nontagged/printers/json/AStringPrinter.java
@@ -17,7 +17,7 @@
 import java.io.IOException;
 import java.io.PrintStream;
 
-import edu.uci.ics.asterix.dataflow.data.nontagged.printers.adm.PrintTools;
+import edu.uci.ics.asterix.dataflow.data.nontagged.printers.PrintTools;
 import edu.uci.ics.hyracks.algebricks.common.exceptions.AlgebricksException;
 import edu.uci.ics.hyracks.algebricks.data.IPrinter;
 
diff --git a/asterix-om/src/main/java/edu/uci/ics/asterix/dataflow/data/nontagged/printers/json/AUUIDPrinter.java b/asterix-om/src/main/java/edu/uci/ics/asterix/dataflow/data/nontagged/printers/json/AUUIDPrinter.java
new file mode 100644
index 0000000..1fcc1cf
--- /dev/null
+++ b/asterix-om/src/main/java/edu/uci/ics/asterix/dataflow/data/nontagged/printers/json/AUUIDPrinter.java
@@ -0,0 +1,44 @@
+/*
+ * Copyright 2009-2013 by The Regents of the University of California
+ *  Licensed under the Apache License, Version 2.0 (the "License");
+ *  you may not use this file except in compliance with the License.
+ *  you may obtain a copy of the License from
+ *
+ *     http://www.apache.org/licenses/LICENSE-2.0
+ *
+ *  Unless required by applicable law or agreed to in writing, software
+ *  distributed under the License is distributed on an "AS IS" BASIS,
+ *  WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
+ *  See the License for the specific language governing permissions and
+ *  limitations under the License.
+ */
+
+package edu.uci.ics.asterix.dataflow.data.nontagged.printers.json;
+
+import edu.uci.ics.asterix.om.base.AMutableUUID;
+import edu.uci.ics.hyracks.algebricks.common.exceptions.AlgebricksException;
+import edu.uci.ics.hyracks.algebricks.data.IPrinter;
+import edu.uci.ics.hyracks.data.std.primitive.LongPointable;
+
+import java.io.PrintStream;
+
+public class AUUIDPrinter implements IPrinter {
+
+    public static final AUUIDPrinter INSTANCE = new AUUIDPrinter();
+    // We use mutable UUID not to create a UUID object multiple times.
+    AMutableUUID uuid = new AMutableUUID(0, 0);
+
+    @Override
+    public void init() throws AlgebricksException {
+    }
+
+    @Override
+    public void print(byte[] b, int s, int l, PrintStream ps) throws AlgebricksException {
+        long msb = LongPointable.getLong(b, s + 1);
+        long lsb = LongPointable.getLong(b, s + 9);
+        uuid.setValue(msb, lsb);
+
+        ps.print("\"" + uuid.toStringLiteralOnly() + "\"");
+    }
+
+}
diff --git a/asterix-om/src/main/java/edu/uci/ics/asterix/dataflow/data/nontagged/printers/json/AUUIDPrinterFactory.java b/asterix-om/src/main/java/edu/uci/ics/asterix/dataflow/data/nontagged/printers/json/AUUIDPrinterFactory.java
new file mode 100644
index 0000000..0b271bd
--- /dev/null
+++ b/asterix-om/src/main/java/edu/uci/ics/asterix/dataflow/data/nontagged/printers/json/AUUIDPrinterFactory.java
@@ -0,0 +1,33 @@
+/*
+ * Copyright 2009-2013 by The Regents of the University of California
+ *  Licensed under the Apache License, Version 2.0 (the "License");
+ *  you may not use this file except in compliance with the License.
+ *  you may obtain a copy of the License from
+ *
+ *     http://www.apache.org/licenses/LICENSE-2.0
+ *
+ *  Unless required by applicable law or agreed to in writing, software
+ *  distributed under the License is distributed on an "AS IS" BASIS,
+ *  WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
+ *  See the License for the specific language governing permissions and
+ *  limitations under the License.
+ */
+
+package edu.uci.ics.asterix.dataflow.data.nontagged.printers.json;
+
+import edu.uci.ics.asterix.dataflow.data.nontagged.printers.adm.AUUIDPrinter;
+import edu.uci.ics.hyracks.algebricks.data.IPrinter;
+import edu.uci.ics.hyracks.algebricks.data.IPrinterFactory;
+
+public class AUUIDPrinterFactory implements IPrinterFactory {
+
+    private static final long serialVersionUID = 1L;
+
+    public static final AUUIDPrinterFactory INSTANCE = new AUUIDPrinterFactory();
+
+    @Override
+    public IPrinter createPrinter() {
+        return AUUIDPrinter.INSTANCE;
+    }
+
+}
diff --git a/asterix-om/src/main/java/edu/uci/ics/asterix/formats/nontagged/AqlCleanJSONPrinterFactoryProvider.java b/asterix-om/src/main/java/edu/uci/ics/asterix/formats/nontagged/AqlCleanJSONPrinterFactoryProvider.java
index faca078..ccf24f5 100644
--- a/asterix-om/src/main/java/edu/uci/ics/asterix/formats/nontagged/AqlCleanJSONPrinterFactoryProvider.java
+++ b/asterix-om/src/main/java/edu/uci/ics/asterix/formats/nontagged/AqlCleanJSONPrinterFactoryProvider.java
@@ -14,9 +14,9 @@
  */
 package edu.uci.ics.asterix.formats.nontagged;
 
-import edu.uci.ics.asterix.dataflow.data.nontagged.printers.adm.ABinaryPrinterFactory;
 import edu.uci.ics.asterix.dataflow.data.nontagged.printers.adm.AUUIDPrinterFactory;
 import edu.uci.ics.asterix.dataflow.data.nontagged.printers.adm.ShortWithoutTypeInfoPrinterFactory;
+import edu.uci.ics.asterix.dataflow.data.nontagged.printers.cleanjson.ABinaryPrinterFactory;
 import edu.uci.ics.asterix.dataflow.data.nontagged.printers.cleanjson.ABooleanPrinterFactory;
 import edu.uci.ics.asterix.dataflow.data.nontagged.printers.cleanjson.ACirclePrinterFactory;
 import edu.uci.ics.asterix.dataflow.data.nontagged.printers.cleanjson.ADatePrinterFactory;
diff --git a/asterix-om/src/main/java/edu/uci/ics/asterix/formats/nontagged/AqlJSONPrinterFactoryProvider.java b/asterix-om/src/main/java/edu/uci/ics/asterix/formats/nontagged/AqlJSONPrinterFactoryProvider.java
index 4a6c908..b2f2ee5 100644
--- a/asterix-om/src/main/java/edu/uci/ics/asterix/formats/nontagged/AqlJSONPrinterFactoryProvider.java
+++ b/asterix-om/src/main/java/edu/uci/ics/asterix/formats/nontagged/AqlJSONPrinterFactoryProvider.java
@@ -14,9 +14,9 @@
  */
 package edu.uci.ics.asterix.formats.nontagged;
 
-import edu.uci.ics.asterix.dataflow.data.nontagged.printers.adm.ABinaryPrinterFactory;
 import edu.uci.ics.asterix.dataflow.data.nontagged.printers.adm.AUUIDPrinterFactory;
 import edu.uci.ics.asterix.dataflow.data.nontagged.printers.adm.ShortWithoutTypeInfoPrinterFactory;
+import edu.uci.ics.asterix.dataflow.data.nontagged.printers.json.ABinaryPrinterFactory;
 import edu.uci.ics.asterix.dataflow.data.nontagged.printers.json.ABooleanPrinterFactory;
 import edu.uci.ics.asterix.dataflow.data.nontagged.printers.json.ACirclePrinterFactory;
 import edu.uci.ics.asterix.dataflow.data.nontagged.printers.json.ADatePrinterFactory;
diff --git a/asterix-om/src/main/java/edu/uci/ics/asterix/om/pointables/printer/cleanjson/APrintVisitor.java b/asterix-om/src/main/java/edu/uci/ics/asterix/om/pointables/printer/cleanjson/APrintVisitor.java
index 6c2c7d1..4e759b3 100644
--- a/asterix-om/src/main/java/edu/uci/ics/asterix/om/pointables/printer/cleanjson/APrintVisitor.java
+++ b/asterix-om/src/main/java/edu/uci/ics/asterix/om/pointables/printer/cleanjson/APrintVisitor.java
@@ -15,13 +15,7 @@
 
 package edu.uci.ics.asterix.om.pointables.printer.cleanjson;
 
-import java.io.PrintStream;
-import java.util.HashMap;
-import java.util.Map;
-
 import edu.uci.ics.asterix.common.exceptions.AsterixException;
-import edu.uci.ics.asterix.dataflow.data.nontagged.printers.adm.ABinaryHexPrinter;
-import edu.uci.ics.asterix.dataflow.data.nontagged.printers.adm.AUUIDPrinter;
 import edu.uci.ics.asterix.dataflow.data.nontagged.printers.adm.ShortWithoutTypeInfoPrinter;
 import edu.uci.ics.asterix.dataflow.data.nontagged.printers.cleanjson.ABooleanPrinter;
 import edu.uci.ics.asterix.dataflow.data.nontagged.printers.cleanjson.ACirclePrinter;
@@ -44,6 +38,8 @@
 import edu.uci.ics.asterix.dataflow.data.nontagged.printers.cleanjson.AStringPrinter;
 import edu.uci.ics.asterix.dataflow.data.nontagged.printers.cleanjson.ATimePrinter;
 import edu.uci.ics.asterix.dataflow.data.nontagged.printers.cleanjson.AYearMonthDurationPrinter;
+import edu.uci.ics.asterix.dataflow.data.nontagged.printers.json.ABinaryHexPrinter;
+import edu.uci.ics.asterix.dataflow.data.nontagged.printers.json.AUUIDPrinter;
 import edu.uci.ics.asterix.om.pointables.AFlatValuePointable;
 import edu.uci.ics.asterix.om.pointables.AListVisitablePointable;
 import edu.uci.ics.asterix.om.pointables.ARecordVisitablePointable;
@@ -53,6 +49,10 @@
 import edu.uci.ics.hyracks.algebricks.common.exceptions.NotImplementedException;
 import edu.uci.ics.hyracks.algebricks.common.utils.Pair;
 
+import java.io.PrintStream;
+import java.util.HashMap;
+import java.util.Map;
+
 /**
  * This class is a IVisitablePointableVisitor implementation which recursively
  * visit a given record, list or flat value of a given type, and print it to a
diff --git a/asterix-om/src/main/java/edu/uci/ics/asterix/om/pointables/printer/json/APrintVisitor.java b/asterix-om/src/main/java/edu/uci/ics/asterix/om/pointables/printer/json/APrintVisitor.java
index 32a47d0..a201d6b 100644
--- a/asterix-om/src/main/java/edu/uci/ics/asterix/om/pointables/printer/json/APrintVisitor.java
+++ b/asterix-om/src/main/java/edu/uci/ics/asterix/om/pointables/printer/json/APrintVisitor.java
@@ -15,14 +15,9 @@
 
 package edu.uci.ics.asterix.om.pointables.printer.json;
 
-import java.io.PrintStream;
-import java.util.HashMap;
-import java.util.Map;
-
 import edu.uci.ics.asterix.common.exceptions.AsterixException;
-import edu.uci.ics.asterix.dataflow.data.nontagged.printers.adm.ABinaryHexPrinter;
-import edu.uci.ics.asterix.dataflow.data.nontagged.printers.adm.AUUIDPrinter;
 import edu.uci.ics.asterix.dataflow.data.nontagged.printers.adm.ShortWithoutTypeInfoPrinter;
+import edu.uci.ics.asterix.dataflow.data.nontagged.printers.json.ABinaryHexPrinter;
 import edu.uci.ics.asterix.dataflow.data.nontagged.printers.json.ABooleanPrinter;
 import edu.uci.ics.asterix.dataflow.data.nontagged.printers.json.ACirclePrinter;
 import edu.uci.ics.asterix.dataflow.data.nontagged.printers.json.ADatePrinter;
@@ -43,6 +38,7 @@
 import edu.uci.ics.asterix.dataflow.data.nontagged.printers.json.ARectanglePrinter;
 import edu.uci.ics.asterix.dataflow.data.nontagged.printers.json.AStringPrinter;
 import edu.uci.ics.asterix.dataflow.data.nontagged.printers.json.ATimePrinter;
+import edu.uci.ics.asterix.dataflow.data.nontagged.printers.json.AUUIDPrinter;
 import edu.uci.ics.asterix.dataflow.data.nontagged.printers.json.AYearMonthDurationPrinter;
 import edu.uci.ics.asterix.om.pointables.AFlatValuePointable;
 import edu.uci.ics.asterix.om.pointables.AListVisitablePointable;
@@ -53,6 +49,10 @@
 import edu.uci.ics.hyracks.algebricks.common.exceptions.NotImplementedException;
 import edu.uci.ics.hyracks.algebricks.common.utils.Pair;
 
+import java.io.PrintStream;
+import java.util.HashMap;
+import java.util.Map;
+
 /**
  * This class is a IVisitablePointableVisitor implementation which recursively
  * visit a given record, list or flat value of a given type, and print it to a
diff --git a/asterix-runtime/src/main/java/edu/uci/ics/asterix/runtime/evaluators/functions/binary/PrintBinaryDescriptor.java b/asterix-runtime/src/main/java/edu/uci/ics/asterix/runtime/evaluators/functions/binary/PrintBinaryDescriptor.java
index 0e17a66..0c96190 100644
--- a/asterix-runtime/src/main/java/edu/uci/ics/asterix/runtime/evaluators/functions/binary/PrintBinaryDescriptor.java
+++ b/asterix-runtime/src/main/java/edu/uci/ics/asterix/runtime/evaluators/functions/binary/PrintBinaryDescriptor.java
@@ -15,8 +15,8 @@
 
 package edu.uci.ics.asterix.runtime.evaluators.functions.binary;
 
+import edu.uci.ics.asterix.dataflow.data.nontagged.printers.PrintTools;
 import edu.uci.ics.asterix.dataflow.data.nontagged.printers.adm.ABinaryBase64Printer;
-import edu.uci.ics.asterix.dataflow.data.nontagged.printers.adm.ABinaryHexPrinter;
 import edu.uci.ics.asterix.om.functions.AsterixBuiltinFunctions;
 import edu.uci.ics.asterix.om.functions.IFunctionDescriptor;
 import edu.uci.ics.asterix.om.functions.IFunctionDescriptorFactory;
@@ -80,7 +80,7 @@
                             int lengthFormat = UTF8StringPointable.getUTFLength(formatBytes, 1);
                             stringBuilder.setLength(0);
                             if (isCaseIgnoreEqual(HEX_FORMAT, formatBytes, 3, lengthFormat)) {
-                                ABinaryHexPrinter
+                                PrintTools
                                         .printHexString(binaryBytes, 3, lengthBinary, stringBuilder);
 
                             } else if (isCaseIgnoreEqual(BASE64_FORMAT, formatBytes, 3, lengthFormat)) {

-- 
To view, visit https://asterix-gerrit.ics.uci.edu/362
To unsubscribe, visit https://asterix-gerrit.ics.uci.edu/settings

Gerrit-MessageType: newchange
Gerrit-Change-Id: I5c37d3b5aad7f286eba1cb8cb5f05ad456a6521d
Gerrit-PatchSet: 1
Gerrit-Project: asterixdb
Gerrit-Branch: master
Gerrit-Owner: Chris Hillery <ceej@lambda.nu>

Mime
View raw message