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]: Adding 'cleanjson' output format, along with implementation ...
Date Fri, 21 Aug 2015 08:12:06 GMT
Chris Hillery has uploaded a new change for review.

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

Change subject: Adding 'cleanjson' output format, along with implementation of lists.
......................................................................

Adding 'cleanjson' output format, along with implementation of lists.

Also includes test-framework update to allow testing of cleanjson.

Change-Id: I5c37d3b5aad7f286eba1cb8cb5f05ad456a6521c
---
M asterix-app/src/main/java/edu/uci/ics/asterix/api/common/APIFramework.java
M asterix-app/src/main/java/edu/uci/ics/asterix/api/common/SessionConfig.java
M asterix-app/src/main/java/edu/uci/ics/asterix/api/http/servlet/APIServlet.java
M asterix-app/src/main/java/edu/uci/ics/asterix/api/http/servlet/RESTAPIServlet.java
M asterix-app/src/main/java/edu/uci/ics/asterix/result/ResultUtils.java
M asterix-app/src/main/resources/webui/querytemplate.html
A asterix-app/src/test/resources/runtimets/results/json/int01-cleanjson/int01.1.json
R asterix-app/src/test/resources/runtimets/results/json/int01-json/int01.1.json
M asterix-app/src/test/resources/runtimets/testsuite.xml
M asterix-common/src/test/java/edu/uci/ics/asterix/test/aql/TestsUtils.java
A asterix-om/src/main/java/edu/uci/ics/asterix/dataflow/data/nontagged/printers/cleanjson/ABooleanPrinter.java
A asterix-om/src/main/java/edu/uci/ics/asterix/dataflow/data/nontagged/printers/cleanjson/ABooleanPrinterFactory.java
A asterix-om/src/main/java/edu/uci/ics/asterix/dataflow/data/nontagged/printers/cleanjson/ACirclePrinter.java
A asterix-om/src/main/java/edu/uci/ics/asterix/dataflow/data/nontagged/printers/cleanjson/ACirclePrinterFactory.java
A asterix-om/src/main/java/edu/uci/ics/asterix/dataflow/data/nontagged/printers/cleanjson/ADatePrinter.java
A asterix-om/src/main/java/edu/uci/ics/asterix/dataflow/data/nontagged/printers/cleanjson/ADatePrinterFactory.java
A asterix-om/src/main/java/edu/uci/ics/asterix/dataflow/data/nontagged/printers/cleanjson/ADateTimePrinter.java
A asterix-om/src/main/java/edu/uci/ics/asterix/dataflow/data/nontagged/printers/cleanjson/ADateTimePrinterFactory.java
A asterix-om/src/main/java/edu/uci/ics/asterix/dataflow/data/nontagged/printers/cleanjson/ADayTimeDurationPrinter.java
A asterix-om/src/main/java/edu/uci/ics/asterix/dataflow/data/nontagged/printers/cleanjson/ADayTimeDurationPrinterFactory.java
A asterix-om/src/main/java/edu/uci/ics/asterix/dataflow/data/nontagged/printers/cleanjson/ADoublePrinter.java
A asterix-om/src/main/java/edu/uci/ics/asterix/dataflow/data/nontagged/printers/cleanjson/ADoublePrinterFactory.java
A asterix-om/src/main/java/edu/uci/ics/asterix/dataflow/data/nontagged/printers/cleanjson/ADurationPrinter.java
A asterix-om/src/main/java/edu/uci/ics/asterix/dataflow/data/nontagged/printers/cleanjson/ADurationPrinterFactory.java
A asterix-om/src/main/java/edu/uci/ics/asterix/dataflow/data/nontagged/printers/cleanjson/AFloatPrinter.java
A asterix-om/src/main/java/edu/uci/ics/asterix/dataflow/data/nontagged/printers/cleanjson/AFloatPrinterFactory.java
A asterix-om/src/main/java/edu/uci/ics/asterix/dataflow/data/nontagged/printers/cleanjson/AInt16Printer.java
A asterix-om/src/main/java/edu/uci/ics/asterix/dataflow/data/nontagged/printers/cleanjson/AInt16PrinterFactory.java
A asterix-om/src/main/java/edu/uci/ics/asterix/dataflow/data/nontagged/printers/cleanjson/AInt32Printer.java
A asterix-om/src/main/java/edu/uci/ics/asterix/dataflow/data/nontagged/printers/cleanjson/AInt32PrinterFactory.java
A asterix-om/src/main/java/edu/uci/ics/asterix/dataflow/data/nontagged/printers/cleanjson/AInt64Printer.java
A asterix-om/src/main/java/edu/uci/ics/asterix/dataflow/data/nontagged/printers/cleanjson/AInt64PrinterFactory.java
A asterix-om/src/main/java/edu/uci/ics/asterix/dataflow/data/nontagged/printers/cleanjson/AInt8Printer.java
A asterix-om/src/main/java/edu/uci/ics/asterix/dataflow/data/nontagged/printers/cleanjson/AInt8PrinterFactory.java
A asterix-om/src/main/java/edu/uci/ics/asterix/dataflow/data/nontagged/printers/cleanjson/AIntervalPrinter.java
A asterix-om/src/main/java/edu/uci/ics/asterix/dataflow/data/nontagged/printers/cleanjson/AIntervalPrinterFactory.java
A asterix-om/src/main/java/edu/uci/ics/asterix/dataflow/data/nontagged/printers/cleanjson/ALinePrinter.java
A asterix-om/src/main/java/edu/uci/ics/asterix/dataflow/data/nontagged/printers/cleanjson/ALinePrinterFactory.java
A asterix-om/src/main/java/edu/uci/ics/asterix/dataflow/data/nontagged/printers/cleanjson/ANullPrinter.java
A asterix-om/src/main/java/edu/uci/ics/asterix/dataflow/data/nontagged/printers/cleanjson/ANullPrinterFactory.java
A asterix-om/src/main/java/edu/uci/ics/asterix/dataflow/data/nontagged/printers/cleanjson/ANullableFieldPrinterFactory.java
A asterix-om/src/main/java/edu/uci/ics/asterix/dataflow/data/nontagged/printers/cleanjson/AObjectPrinter.java
A asterix-om/src/main/java/edu/uci/ics/asterix/dataflow/data/nontagged/printers/cleanjson/AObjectPrinterFactory.java
A asterix-om/src/main/java/edu/uci/ics/asterix/dataflow/data/nontagged/printers/cleanjson/AOrderedlistPrinterFactory.java
A asterix-om/src/main/java/edu/uci/ics/asterix/dataflow/data/nontagged/printers/cleanjson/APoint3DPrinter.java
A asterix-om/src/main/java/edu/uci/ics/asterix/dataflow/data/nontagged/printers/cleanjson/APoint3DPrinterFactory.java
A asterix-om/src/main/java/edu/uci/ics/asterix/dataflow/data/nontagged/printers/cleanjson/APointPrinter.java
A asterix-om/src/main/java/edu/uci/ics/asterix/dataflow/data/nontagged/printers/cleanjson/APointPrinterFactory.java
A asterix-om/src/main/java/edu/uci/ics/asterix/dataflow/data/nontagged/printers/cleanjson/APolygonPrinter.java
A asterix-om/src/main/java/edu/uci/ics/asterix/dataflow/data/nontagged/printers/cleanjson/APolygonPrinterFactory.java
A asterix-om/src/main/java/edu/uci/ics/asterix/dataflow/data/nontagged/printers/cleanjson/ARecordPrinterFactory.java
A asterix-om/src/main/java/edu/uci/ics/asterix/dataflow/data/nontagged/printers/cleanjson/ARectanglePrinter.java
A asterix-om/src/main/java/edu/uci/ics/asterix/dataflow/data/nontagged/printers/cleanjson/ARectanglePrinterFactory.java
A 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/AStringPrinterFactory.java
A asterix-om/src/main/java/edu/uci/ics/asterix/dataflow/data/nontagged/printers/cleanjson/ATimePrinter.java
A asterix-om/src/main/java/edu/uci/ics/asterix/dataflow/data/nontagged/printers/cleanjson/ATimePrinterFactory.java
A asterix-om/src/main/java/edu/uci/ics/asterix/dataflow/data/nontagged/printers/cleanjson/AUnionPrinterFactory.java
A asterix-om/src/main/java/edu/uci/ics/asterix/dataflow/data/nontagged/printers/cleanjson/AUnorderedlistPrinterFactory.java
A asterix-om/src/main/java/edu/uci/ics/asterix/dataflow/data/nontagged/printers/cleanjson/AYearMonthDurationPrinter.java
A asterix-om/src/main/java/edu/uci/ics/asterix/dataflow/data/nontagged/printers/cleanjson/AYearMonthDurationPrinterFactory.java
M asterix-om/src/main/java/edu/uci/ics/asterix/formats/base/IDataFormat.java
A asterix-om/src/main/java/edu/uci/ics/asterix/formats/nontagged/AqlCleanJSONPrinterFactoryProvider.java
A asterix-om/src/main/java/edu/uci/ics/asterix/om/pointables/printer/cleanjson/AListPrinter.java
A asterix-om/src/main/java/edu/uci/ics/asterix/om/pointables/printer/cleanjson/APrintVisitor.java
A asterix-om/src/main/java/edu/uci/ics/asterix/om/pointables/printer/cleanjson/ARecordPrinter.java
M asterix-runtime/src/main/java/edu/uci/ics/asterix/runtime/formats/NonTaggedDataFormat.java
M asterix-test-framework/src/main/java/edu/uci/ics/asterix/testframework/context/TestCaseContext.java
M asterix-test-framework/src/main/resources/Catalog.xsd
69 files changed, 2,715 insertions(+), 11 deletions(-)


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

diff --git a/asterix-app/src/main/java/edu/uci/ics/asterix/api/common/APIFramework.java b/asterix-app/src/main/java/edu/uci/ics/asterix/api/common/APIFramework.java
index 783a085..c96d6df 100644
--- a/asterix-app/src/main/java/edu/uci/ics/asterix/api/common/APIFramework.java
+++ b/asterix-app/src/main/java/edu/uci/ics/asterix/api/common/APIFramework.java
@@ -329,6 +329,9 @@
             case ADM:
                 builder.setPrinterProvider(format.getADMPrinterFactoryProvider());
                 break;
+            case CLEANJSON:
+                builder.setPrinterProvider(format.getCleanJSONPrinterFactoryProvider());
+                break;
             default:
                 throw new RuntimeException("Unexpected OutputFormat!");
         }
diff --git a/asterix-app/src/main/java/edu/uci/ics/asterix/api/common/SessionConfig.java b/asterix-app/src/main/java/edu/uci/ics/asterix/api/common/SessionConfig.java
index 27d981e..3bb2b21 100644
--- a/asterix-app/src/main/java/edu/uci/ics/asterix/api/common/SessionConfig.java
+++ b/asterix-app/src/main/java/edu/uci/ics/asterix/api/common/SessionConfig.java
@@ -39,7 +39,8 @@
     public enum OutputFormat {
         ADM,
         JSON,
-        CSV
+        CSV,
+        CLEANJSON
     };
 
     /**
diff --git a/asterix-app/src/main/java/edu/uci/ics/asterix/api/http/servlet/APIServlet.java b/asterix-app/src/main/java/edu/uci/ics/asterix/api/http/servlet/APIServlet.java
index 4984741..30bfb22 100644
--- a/asterix-app/src/main/java/edu/uci/ics/asterix/api/http/servlet/APIServlet.java
+++ b/asterix-app/src/main/java/edu/uci/ics/asterix/api/http/servlet/APIServlet.java
@@ -67,6 +67,9 @@
             format = OutputFormat.CSV;
             csv_and_header = true;
         }
+        else if (output.equals("CLEANJSON")) {
+            format = OutputFormat.CLEANJSON;
+        }
         else {
             // Default output format
             format = OutputFormat.JSON;
diff --git a/asterix-app/src/main/java/edu/uci/ics/asterix/api/http/servlet/RESTAPIServlet.java b/asterix-app/src/main/java/edu/uci/ics/asterix/api/http/servlet/RESTAPIServlet.java
index dd19c97..2698e9d 100644
--- a/asterix-app/src/main/java/edu/uci/ics/asterix/api/http/servlet/RESTAPIServlet.java
+++ b/asterix-app/src/main/java/edu/uci/ics/asterix/api/http/servlet/RESTAPIServlet.java
@@ -88,6 +88,13 @@
             }
         }
 
+        // If it's JSON, check for the "clean" flag
+        if (format == OutputFormat.JSON &&
+                ("true".equals(request.getParameter("clean")) ||
+                (accept != null && accept.contains("clean=true")))) {
+            format = OutputFormat.CLEANJSON;
+        }
+
         SessionConfig sessionConfig = new SessionConfig(response.getWriter(), format);
 
         // Now that format is set, output the content-type
@@ -95,6 +102,8 @@
             case ADM:
                 response.setContentType("application/x-adm");
                 break;
+            case CLEANJSON:
+                // No need to reflect "clean-ness" in output type; fall through
             case JSON:
                 response.setContentType("application/json");
                 break;
diff --git a/asterix-app/src/main/java/edu/uci/ics/asterix/result/ResultUtils.java b/asterix-app/src/main/java/edu/uci/ics/asterix/result/ResultUtils.java
index 3a4fd5f..1e40185 100644
--- a/asterix-app/src/main/java/edu/uci/ics/asterix/result/ResultUtils.java
+++ b/asterix-app/src/main/java/edu/uci/ics/asterix/result/ResultUtils.java
@@ -114,6 +114,7 @@
                 need_commas = false;
                 break;
             case JSON:
+            case CLEANJSON:
             case ADM:
                 // Conveniently, JSON and ADM have the same syntax for an
                 // "ordered list", and our representation of the result of a
@@ -164,6 +165,7 @@
 
         switch (conf.fmt()) {
             case JSON:
+            case CLEANJSON:
             case ADM:
                 conf.out().println(" ]");
                 break;
diff --git a/asterix-app/src/main/resources/webui/querytemplate.html b/asterix-app/src/main/resources/webui/querytemplate.html
index fb0a1cc..f1a7552 100644
--- a/asterix-app/src/main/resources/webui/querytemplate.html
+++ b/asterix-app/src/main/resources/webui/querytemplate.html
@@ -3,9 +3,9 @@
  ! 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.
@@ -39,9 +39,9 @@
             $('#opts').hide();
             $('#queryform :input').prop('checked', false);
         } else {
-            $('#opts').show();    
+            $('#opts').show();
             $('#queryform :input').prop('checked', true);
-        }    
+        }
         return false;
     });
 
@@ -185,7 +185,7 @@
               <label class="query">Query</label>
               <textarea rows="10" id="qry" name="query" class="query" value="%s" placeholder="Type your AQL query ..."></textarea>
             </div>
-            
+
             <div class="btn-group">
               <button id="checkboxes-on" class="btn">
                   <i id="opts" class="icon-ok" style="display:none;"></i>Select Options</button>
@@ -200,7 +200,8 @@
                   <option selected value="ADM">ADM</option>
                   <option value="CSV">CSV (no header)</option>
                   <option value="CSV-Header">CSV (with header)</option>
-                  <option value="JSON">JSON</option>
+                  <option value="CLEANJSON">JSON</option>
+                  <option value="JSON">JSON (lossless)</option>
                 </select>
               </label>
               <label class="checkbox optlabel"><input type="checkbox" name="print-expr-tree" value="true" /> Print parsed expressions</label>
@@ -236,4 +237,3 @@
   </div>
 </body>
 </html>
-
diff --git a/asterix-app/src/test/resources/runtimets/results/json/int01-cleanjson/int01.1.json b/asterix-app/src/test/resources/runtimets/results/json/int01-cleanjson/int01.1.json
new file mode 100644
index 0000000..205afcd
--- /dev/null
+++ b/asterix-app/src/test/resources/runtimets/results/json/int01-cleanjson/int01.1.json
@@ -0,0 +1,8 @@
+[ [ { "int64":
+1
+}
+, { "int64":
+2
+}
+ ] 
+ ]
diff --git a/asterix-app/src/test/resources/runtimets/results/json/int01/int01.1.json b/asterix-app/src/test/resources/runtimets/results/json/int01-json/int01.1.json
similarity index 100%
rename from asterix-app/src/test/resources/runtimets/results/json/int01/int01.1.json
rename to asterix-app/src/test/resources/runtimets/results/json/int01-json/int01.1.json
diff --git a/asterix-app/src/test/resources/runtimets/testsuite.xml b/asterix-app/src/test/resources/runtimets/testsuite.xml
index b62645d..20fc769 100644
--- a/asterix-app/src/test/resources/runtimets/testsuite.xml
+++ b/asterix-app/src/test/resources/runtimets/testsuite.xml
@@ -6656,7 +6656,14 @@
     <test-group name="json">
         <test-case FilePath="json">
             <compilation-unit name="int01">
-                <output-dir compare="JSON">int01</output-dir>
+                <output-dir compare="JSON">int01-json</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>
             </compilation-unit>
         </test-case>
     </test-group>
diff --git a/asterix-common/src/test/java/edu/uci/ics/asterix/test/aql/TestsUtils.java b/asterix-common/src/test/java/edu/uci/ics/asterix/test/aql/TestsUtils.java
index 1da2e83..85d22b1 100644
--- a/asterix-common/src/test/java/edu/uci/ics/asterix/test/aql/TestsUtils.java
+++ b/asterix-common/src/test/java/edu/uci/ics/asterix/test/aql/TestsUtils.java
@@ -425,7 +425,7 @@
                                 resultStream = executeAnyAQLAsync(statement, true, fmt);
 
                             if (queryCount >= expectedResultFileCtxs.size()) {
-                                throw new IllegalStateException("no result file for " + testFile.toString());
+                                throw new IllegalStateException("no result file for " + testFile.toString() + "; queryCount: " + queryCount + ", filectxs.size: " + expectedResultFileCtxs.size());
                             }
                             expectedResultFile = expectedResultFileCtxs.get(queryCount).getFile();
 
diff --git a/asterix-om/src/main/java/edu/uci/ics/asterix/dataflow/data/nontagged/printers/cleanjson/ABooleanPrinter.java b/asterix-om/src/main/java/edu/uci/ics/asterix/dataflow/data/nontagged/printers/cleanjson/ABooleanPrinter.java
new file mode 100644
index 0000000..25ed430
--- /dev/null
+++ b/asterix-om/src/main/java/edu/uci/ics/asterix/dataflow/data/nontagged/printers/cleanjson/ABooleanPrinter.java
@@ -0,0 +1,36 @@
+/*
+ * 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 java.io.PrintStream;
+
+import edu.uci.ics.asterix.dataflow.data.nontagged.serde.ABooleanSerializerDeserializer;
+import edu.uci.ics.hyracks.algebricks.common.exceptions.AlgebricksException;
+import edu.uci.ics.hyracks.algebricks.data.IPrinter;
+
+public class ABooleanPrinter implements IPrinter {
+
+    public static final ABooleanPrinter INSTANCE = new ABooleanPrinter();
+
+    @Override
+    public void init() {
+
+    }
+
+    @Override
+    public void print(byte[] b, int s, int l, PrintStream ps) throws AlgebricksException {
+        ps.print(ABooleanSerializerDeserializer.getBoolean(b, s + 1));
+    }
+}
\ No newline at end of file
diff --git a/asterix-om/src/main/java/edu/uci/ics/asterix/dataflow/data/nontagged/printers/cleanjson/ABooleanPrinterFactory.java b/asterix-om/src/main/java/edu/uci/ics/asterix/dataflow/data/nontagged/printers/cleanjson/ABooleanPrinterFactory.java
new file mode 100644
index 0000000..e709e30
--- /dev/null
+++ b/asterix-om/src/main/java/edu/uci/ics/asterix/dataflow/data/nontagged/printers/cleanjson/ABooleanPrinterFactory.java
@@ -0,0 +1,30 @@
+/*
+ * 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 ABooleanPrinterFactory implements IPrinterFactory {
+
+    private static final long serialVersionUID = 1L;
+    public static final ABooleanPrinterFactory INSTANCE = new ABooleanPrinterFactory();
+
+    @Override
+    public IPrinter createPrinter() {
+        return ABooleanPrinter.INSTANCE;
+    }
+
+}
\ No newline at end of file
diff --git a/asterix-om/src/main/java/edu/uci/ics/asterix/dataflow/data/nontagged/printers/cleanjson/ACirclePrinter.java b/asterix-om/src/main/java/edu/uci/ics/asterix/dataflow/data/nontagged/printers/cleanjson/ACirclePrinter.java
new file mode 100644
index 0000000..5ca6d07
--- /dev/null
+++ b/asterix-om/src/main/java/edu/uci/ics/asterix/dataflow/data/nontagged/printers/cleanjson/ACirclePrinter.java
@@ -0,0 +1,42 @@
+/*
+ * 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 java.io.PrintStream;
+
+import edu.uci.ics.asterix.dataflow.data.nontagged.serde.ADoubleSerializerDeserializer;
+import edu.uci.ics.hyracks.algebricks.common.exceptions.AlgebricksException;
+import edu.uci.ics.hyracks.algebricks.data.IPrinter;
+
+public class ACirclePrinter implements IPrinter {
+
+    public static final ACirclePrinter INSTANCE = new ACirclePrinter();
+
+    @Override
+    public void init() {
+
+    }
+
+    @Override
+    public void print(byte[] b, int s, int l, PrintStream ps) throws AlgebricksException {
+        ps.print("{ \"circle\": [");
+        ps.print(ADoubleSerializerDeserializer.getDouble(b, s + 1));
+        ps.print(", { \"point\": [");
+        ps.print(ADoubleSerializerDeserializer.getDouble(b, s + 9));
+        ps.print(", ");
+        ps.print(ADoubleSerializerDeserializer.getDouble(b, s + 17));
+        ps.print("] } ] }");
+    }
+}
diff --git a/asterix-om/src/main/java/edu/uci/ics/asterix/dataflow/data/nontagged/printers/cleanjson/ACirclePrinterFactory.java b/asterix-om/src/main/java/edu/uci/ics/asterix/dataflow/data/nontagged/printers/cleanjson/ACirclePrinterFactory.java
new file mode 100644
index 0000000..e48c77f
--- /dev/null
+++ b/asterix-om/src/main/java/edu/uci/ics/asterix/dataflow/data/nontagged/printers/cleanjson/ACirclePrinterFactory.java
@@ -0,0 +1,30 @@
+/*
+ * 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 ACirclePrinterFactory implements IPrinterFactory {
+
+    private static final long serialVersionUID = 1L;
+    public static final ACirclePrinterFactory INSTANCE = new ACirclePrinterFactory();
+
+    @Override
+    public IPrinter createPrinter() {
+        return ACirclePrinter.INSTANCE;
+    }
+
+}
\ No newline at end of file
diff --git a/asterix-om/src/main/java/edu/uci/ics/asterix/dataflow/data/nontagged/printers/cleanjson/ADatePrinter.java b/asterix-om/src/main/java/edu/uci/ics/asterix/dataflow/data/nontagged/printers/cleanjson/ADatePrinter.java
new file mode 100644
index 0000000..7f0b4d0
--- /dev/null
+++ b/asterix-om/src/main/java/edu/uci/ics/asterix/dataflow/data/nontagged/printers/cleanjson/ADatePrinter.java
@@ -0,0 +1,41 @@
+/*
+ * 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 java.io.PrintStream;
+
+import edu.uci.ics.asterix.dataflow.data.nontagged.serde.AInt32SerializerDeserializer;
+import edu.uci.ics.hyracks.algebricks.common.exceptions.AlgebricksException;
+import edu.uci.ics.hyracks.algebricks.data.IPrinter;
+
+public class ADatePrinter implements IPrinter {
+
+    private static long CHRONON_OF_DAY = 24 * 60 * 60 * 1000;
+    public static final ADatePrinter INSTANCE = new ADatePrinter();
+
+    @Override
+    public void init() {
+
+    }
+
+    @Override
+    public void print(byte[] b, int s, int l, PrintStream ps) throws AlgebricksException {
+        long chrononTime = AInt32SerializerDeserializer.getInt(b, s + 1) * CHRONON_OF_DAY;
+
+        ps.print("{ \"date\": ");
+        ps.print(chrononTime);
+        ps.print("}");
+    }
+}
diff --git a/asterix-om/src/main/java/edu/uci/ics/asterix/dataflow/data/nontagged/printers/cleanjson/ADatePrinterFactory.java b/asterix-om/src/main/java/edu/uci/ics/asterix/dataflow/data/nontagged/printers/cleanjson/ADatePrinterFactory.java
new file mode 100644
index 0000000..5ffe59f
--- /dev/null
+++ b/asterix-om/src/main/java/edu/uci/ics/asterix/dataflow/data/nontagged/printers/cleanjson/ADatePrinterFactory.java
@@ -0,0 +1,30 @@
+/*
+ * 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 ADatePrinterFactory implements IPrinterFactory {
+
+    private static final long serialVersionUID = 1L;
+    public static final ADatePrinterFactory INSTANCE = new ADatePrinterFactory();
+
+    @Override
+    public IPrinter createPrinter() {
+        return ADatePrinter.INSTANCE;
+    }
+
+}
\ No newline at end of file
diff --git a/asterix-om/src/main/java/edu/uci/ics/asterix/dataflow/data/nontagged/printers/cleanjson/ADateTimePrinter.java b/asterix-om/src/main/java/edu/uci/ics/asterix/dataflow/data/nontagged/printers/cleanjson/ADateTimePrinter.java
new file mode 100644
index 0000000..c017f8a
--- /dev/null
+++ b/asterix-om/src/main/java/edu/uci/ics/asterix/dataflow/data/nontagged/printers/cleanjson/ADateTimePrinter.java
@@ -0,0 +1,40 @@
+/*
+ * 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 java.io.PrintStream;
+
+import edu.uci.ics.asterix.dataflow.data.nontagged.serde.AInt64SerializerDeserializer;
+import edu.uci.ics.hyracks.algebricks.common.exceptions.AlgebricksException;
+import edu.uci.ics.hyracks.algebricks.data.IPrinter;
+
+public class ADateTimePrinter implements IPrinter {
+
+    public static final ADateTimePrinter INSTANCE = new ADateTimePrinter();
+
+    @Override
+    public void init() {
+
+    }
+
+    @Override
+    public void print(byte[] b, int s, int l, PrintStream ps) throws AlgebricksException {
+        long chrononTime = AInt64SerializerDeserializer.getLong(b, s + 1);
+
+        ps.print("{ \"datetime\": ");
+        ps.print(chrononTime);
+        ps.print("}");
+    }
+}
diff --git a/asterix-om/src/main/java/edu/uci/ics/asterix/dataflow/data/nontagged/printers/cleanjson/ADateTimePrinterFactory.java b/asterix-om/src/main/java/edu/uci/ics/asterix/dataflow/data/nontagged/printers/cleanjson/ADateTimePrinterFactory.java
new file mode 100644
index 0000000..dac0496
--- /dev/null
+++ b/asterix-om/src/main/java/edu/uci/ics/asterix/dataflow/data/nontagged/printers/cleanjson/ADateTimePrinterFactory.java
@@ -0,0 +1,30 @@
+/*
+ * 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 ADateTimePrinterFactory implements IPrinterFactory {
+
+    private static final long serialVersionUID = 1L;
+    public static final ADateTimePrinterFactory INSTANCE = new ADateTimePrinterFactory();
+
+    @Override
+    public IPrinter createPrinter() {
+        return ADateTimePrinter.INSTANCE;
+    }
+
+}
\ No newline at end of file
diff --git a/asterix-om/src/main/java/edu/uci/ics/asterix/dataflow/data/nontagged/printers/cleanjson/ADayTimeDurationPrinter.java b/asterix-om/src/main/java/edu/uci/ics/asterix/dataflow/data/nontagged/printers/cleanjson/ADayTimeDurationPrinter.java
new file mode 100644
index 0000000..f710b42
--- /dev/null
+++ b/asterix-om/src/main/java/edu/uci/ics/asterix/dataflow/data/nontagged/printers/cleanjson/ADayTimeDurationPrinter.java
@@ -0,0 +1,41 @@
+/*
+ * 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 java.io.PrintStream;
+
+import edu.uci.ics.asterix.dataflow.data.nontagged.serde.AInt64SerializerDeserializer;
+import edu.uci.ics.hyracks.algebricks.common.exceptions.AlgebricksException;
+import edu.uci.ics.hyracks.algebricks.data.IPrinter;
+
+public class ADayTimeDurationPrinter implements IPrinter {
+
+    public static final ADayTimeDurationPrinter INSTANCE = new ADayTimeDurationPrinter();
+
+    @Override
+    public void init() throws AlgebricksException {
+
+    }
+
+    @Override
+    public void print(byte[] b, int s, int l, PrintStream ps) throws AlgebricksException {
+        long milliseconds = AInt64SerializerDeserializer.getLong(b, s + 1);
+
+        ps.print("{ \"day-time-duration\": ");
+        ps.print(milliseconds);
+        ps.print("}");
+    }
+
+}
diff --git a/asterix-om/src/main/java/edu/uci/ics/asterix/dataflow/data/nontagged/printers/cleanjson/ADayTimeDurationPrinterFactory.java b/asterix-om/src/main/java/edu/uci/ics/asterix/dataflow/data/nontagged/printers/cleanjson/ADayTimeDurationPrinterFactory.java
new file mode 100644
index 0000000..11088ff
--- /dev/null
+++ b/asterix-om/src/main/java/edu/uci/ics/asterix/dataflow/data/nontagged/printers/cleanjson/ADayTimeDurationPrinterFactory.java
@@ -0,0 +1,30 @@
+/*
+ * 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 ADayTimeDurationPrinterFactory implements IPrinterFactory {
+
+    private static final long serialVersionUID = 1L;
+    public static final ADayTimeDurationPrinterFactory INSTANCE = new ADayTimeDurationPrinterFactory();
+
+    @Override
+    public IPrinter createPrinter() {
+        return ADayTimeDurationPrinter.INSTANCE;
+    }
+
+}
diff --git a/asterix-om/src/main/java/edu/uci/ics/asterix/dataflow/data/nontagged/printers/cleanjson/ADoublePrinter.java b/asterix-om/src/main/java/edu/uci/ics/asterix/dataflow/data/nontagged/printers/cleanjson/ADoublePrinter.java
new file mode 100644
index 0000000..4b9cc5c
--- /dev/null
+++ b/asterix-om/src/main/java/edu/uci/ics/asterix/dataflow/data/nontagged/printers/cleanjson/ADoublePrinter.java
@@ -0,0 +1,36 @@
+/*
+ * 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 java.io.PrintStream;
+
+import edu.uci.ics.asterix.dataflow.data.nontagged.serde.ADoubleSerializerDeserializer;
+import edu.uci.ics.hyracks.algebricks.common.exceptions.AlgebricksException;
+import edu.uci.ics.hyracks.algebricks.data.IPrinter;
+
+public class ADoublePrinter implements IPrinter {
+
+    public static final ADoublePrinter INSTANCE = new ADoublePrinter();
+
+    @Override
+    public void init() {
+
+    }
+
+    @Override
+    public void print(byte[] b, int s, int l, PrintStream ps) throws AlgebricksException {
+        ps.print(ADoubleSerializerDeserializer.getDouble(b, s + 1));
+    }
+}
\ No newline at end of file
diff --git a/asterix-om/src/main/java/edu/uci/ics/asterix/dataflow/data/nontagged/printers/cleanjson/ADoublePrinterFactory.java b/asterix-om/src/main/java/edu/uci/ics/asterix/dataflow/data/nontagged/printers/cleanjson/ADoublePrinterFactory.java
new file mode 100644
index 0000000..a044f95
--- /dev/null
+++ b/asterix-om/src/main/java/edu/uci/ics/asterix/dataflow/data/nontagged/printers/cleanjson/ADoublePrinterFactory.java
@@ -0,0 +1,30 @@
+/*
+ * 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 ADoublePrinterFactory implements IPrinterFactory {
+
+    private static final long serialVersionUID = 1L;
+    public static final ADoublePrinterFactory INSTANCE = new ADoublePrinterFactory();
+
+    @Override
+    public IPrinter createPrinter() {
+        return ADoublePrinter.INSTANCE;
+    }
+
+}
\ No newline at end of file
diff --git a/asterix-om/src/main/java/edu/uci/ics/asterix/dataflow/data/nontagged/printers/cleanjson/ADurationPrinter.java b/asterix-om/src/main/java/edu/uci/ics/asterix/dataflow/data/nontagged/printers/cleanjson/ADurationPrinter.java
new file mode 100644
index 0000000..665ca4d
--- /dev/null
+++ b/asterix-om/src/main/java/edu/uci/ics/asterix/dataflow/data/nontagged/printers/cleanjson/ADurationPrinter.java
@@ -0,0 +1,45 @@
+/*
+ * 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 java.io.PrintStream;
+
+import edu.uci.ics.asterix.dataflow.data.nontagged.serde.AInt32SerializerDeserializer;
+import edu.uci.ics.asterix.dataflow.data.nontagged.serde.AInt64SerializerDeserializer;
+import edu.uci.ics.hyracks.algebricks.common.exceptions.AlgebricksException;
+import edu.uci.ics.hyracks.algebricks.data.IPrinter;
+
+public class ADurationPrinter implements IPrinter {
+
+    public static final ADurationPrinter INSTANCE = new ADurationPrinter();
+
+    @Override
+    public void init() {
+
+    }
+
+    @Override
+    public void print(byte[] b, int s, int l, PrintStream ps) throws AlgebricksException {
+        int months = AInt32SerializerDeserializer.getInt(b, s + 1);
+        long milliseconds = AInt64SerializerDeserializer.getLong(b, s + 5);
+
+        ps.print("{ \"duration\": { ");
+        ps.print("\"months\": ");
+        ps.print(months);
+        ps.print(", \"millis\": ");
+        ps.print(milliseconds);
+        ps.print("} }");
+    }
+}
diff --git a/asterix-om/src/main/java/edu/uci/ics/asterix/dataflow/data/nontagged/printers/cleanjson/ADurationPrinterFactory.java b/asterix-om/src/main/java/edu/uci/ics/asterix/dataflow/data/nontagged/printers/cleanjson/ADurationPrinterFactory.java
new file mode 100644
index 0000000..55802a8
--- /dev/null
+++ b/asterix-om/src/main/java/edu/uci/ics/asterix/dataflow/data/nontagged/printers/cleanjson/ADurationPrinterFactory.java
@@ -0,0 +1,30 @@
+/*
+ * 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 ADurationPrinterFactory implements IPrinterFactory {
+
+    private static final long serialVersionUID = 1L;
+    public static final ADurationPrinterFactory INSTANCE = new ADurationPrinterFactory();
+
+    @Override
+    public IPrinter createPrinter() {
+        return ADurationPrinter.INSTANCE;
+    }
+
+}
\ No newline at end of file
diff --git a/asterix-om/src/main/java/edu/uci/ics/asterix/dataflow/data/nontagged/printers/cleanjson/AFloatPrinter.java b/asterix-om/src/main/java/edu/uci/ics/asterix/dataflow/data/nontagged/printers/cleanjson/AFloatPrinter.java
new file mode 100644
index 0000000..7a5e067
--- /dev/null
+++ b/asterix-om/src/main/java/edu/uci/ics/asterix/dataflow/data/nontagged/printers/cleanjson/AFloatPrinter.java
@@ -0,0 +1,36 @@
+/*
+ * 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 java.io.PrintStream;
+
+import edu.uci.ics.asterix.dataflow.data.nontagged.serde.AFloatSerializerDeserializer;
+import edu.uci.ics.hyracks.algebricks.common.exceptions.AlgebricksException;
+import edu.uci.ics.hyracks.algebricks.data.IPrinter;
+
+public class AFloatPrinter implements IPrinter {
+
+    public static final AFloatPrinter INSTANCE = new AFloatPrinter();
+
+    @Override
+    public void init() {
+
+    }
+
+    @Override
+    public void print(byte[] b, int s, int l, PrintStream ps) throws AlgebricksException {
+        ps.print(AFloatSerializerDeserializer.getFloat(b, s + 1));
+    }
+}
\ No newline at end of file
diff --git a/asterix-om/src/main/java/edu/uci/ics/asterix/dataflow/data/nontagged/printers/cleanjson/AFloatPrinterFactory.java b/asterix-om/src/main/java/edu/uci/ics/asterix/dataflow/data/nontagged/printers/cleanjson/AFloatPrinterFactory.java
new file mode 100644
index 0000000..f72d076
--- /dev/null
+++ b/asterix-om/src/main/java/edu/uci/ics/asterix/dataflow/data/nontagged/printers/cleanjson/AFloatPrinterFactory.java
@@ -0,0 +1,30 @@
+/*
+ * 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 AFloatPrinterFactory implements IPrinterFactory {
+
+    private static final long serialVersionUID = 1L;
+    public static final AFloatPrinterFactory INSTANCE = new AFloatPrinterFactory();
+
+    @Override
+    public IPrinter createPrinter() {
+        return AFloatPrinter.INSTANCE;
+    }
+
+}
\ No newline at end of file
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
new file mode 100644
index 0000000..06a2cfc
--- /dev/null
+++ b/asterix-om/src/main/java/edu/uci/ics/asterix/dataflow/data/nontagged/printers/cleanjson/AInt16Printer.java
@@ -0,0 +1,39 @@
+/*
+ * 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 java.io.PrintStream;
+
+import edu.uci.ics.asterix.dataflow.data.nontagged.serde.AInt16SerializerDeserializer;
+import edu.uci.ics.hyracks.algebricks.common.exceptions.AlgebricksException;
+import edu.uci.ics.hyracks.algebricks.data.IPrinter;
+
+public class AInt16Printer implements IPrinter {
+    public static final AInt16Printer INSTANCE = new AInt16Printer();
+
+    @Override
+    public void init() {
+
+    }
+
+    @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("}");
+    }
+}
diff --git a/asterix-om/src/main/java/edu/uci/ics/asterix/dataflow/data/nontagged/printers/cleanjson/AInt16PrinterFactory.java b/asterix-om/src/main/java/edu/uci/ics/asterix/dataflow/data/nontagged/printers/cleanjson/AInt16PrinterFactory.java
new file mode 100644
index 0000000..a1510e4
--- /dev/null
+++ b/asterix-om/src/main/java/edu/uci/ics/asterix/dataflow/data/nontagged/printers/cleanjson/AInt16PrinterFactory.java
@@ -0,0 +1,30 @@
+/*
+ * 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 AInt16PrinterFactory implements IPrinterFactory {
+
+    private static final long serialVersionUID = 1L;
+    public static final AInt16PrinterFactory INSTANCE = new AInt16PrinterFactory();
+
+    @Override
+    public IPrinter createPrinter() {
+        return AInt16Printer.INSTANCE;
+    }
+
+}
\ No newline at end of file
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
new file mode 100644
index 0000000..7c43f30
--- /dev/null
+++ b/asterix-om/src/main/java/edu/uci/ics/asterix/dataflow/data/nontagged/printers/cleanjson/AInt32Printer.java
@@ -0,0 +1,40 @@
+/*
+ * 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 java.io.PrintStream;
+
+import edu.uci.ics.asterix.dataflow.data.nontagged.serde.AInt32SerializerDeserializer;
+import edu.uci.ics.hyracks.algebricks.common.exceptions.AlgebricksException;
+import edu.uci.ics.hyracks.algebricks.data.IPrinter;
+
+public class AInt32Printer implements IPrinter {
+
+    public static final AInt32Printer INSTANCE = new AInt32Printer();
+
+    @Override
+    public void init() {
+
+    }
+
+    @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("}");
+    }
+}
diff --git a/asterix-om/src/main/java/edu/uci/ics/asterix/dataflow/data/nontagged/printers/cleanjson/AInt32PrinterFactory.java b/asterix-om/src/main/java/edu/uci/ics/asterix/dataflow/data/nontagged/printers/cleanjson/AInt32PrinterFactory.java
new file mode 100644
index 0000000..9091f54
--- /dev/null
+++ b/asterix-om/src/main/java/edu/uci/ics/asterix/dataflow/data/nontagged/printers/cleanjson/AInt32PrinterFactory.java
@@ -0,0 +1,30 @@
+/*
+ * 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 AInt32PrinterFactory implements IPrinterFactory {
+
+    private static final long serialVersionUID = 1L;
+    public static final AInt32PrinterFactory INSTANCE = new AInt32PrinterFactory();
+
+    @Override
+    public IPrinter createPrinter() {
+        return AInt32Printer.INSTANCE;
+    }
+
+}
\ No newline at end of file
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
new file mode 100644
index 0000000..a23574b
--- /dev/null
+++ b/asterix-om/src/main/java/edu/uci/ics/asterix/dataflow/data/nontagged/printers/cleanjson/AInt64Printer.java
@@ -0,0 +1,37 @@
+/*
+ * 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 java.io.PrintStream;
+
+import edu.uci.ics.asterix.dataflow.data.nontagged.serde.AInt64SerializerDeserializer;
+import edu.uci.ics.hyracks.algebricks.common.exceptions.AlgebricksException;
+import edu.uci.ics.hyracks.algebricks.data.IPrinter;
+
+public class AInt64Printer implements IPrinter {
+    public static final AInt64Printer INSTANCE = new AInt64Printer();
+
+    @Override
+    public void init() {
+    }
+
+    @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("}");
+    }
+}
diff --git a/asterix-om/src/main/java/edu/uci/ics/asterix/dataflow/data/nontagged/printers/cleanjson/AInt64PrinterFactory.java b/asterix-om/src/main/java/edu/uci/ics/asterix/dataflow/data/nontagged/printers/cleanjson/AInt64PrinterFactory.java
new file mode 100644
index 0000000..8fbea9a
--- /dev/null
+++ b/asterix-om/src/main/java/edu/uci/ics/asterix/dataflow/data/nontagged/printers/cleanjson/AInt64PrinterFactory.java
@@ -0,0 +1,30 @@
+/*
+ * 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 AInt64PrinterFactory implements IPrinterFactory {
+
+    private static final long serialVersionUID = 1L;
+    public static final AInt64PrinterFactory INSTANCE = new AInt64PrinterFactory();
+
+    @Override
+    public IPrinter createPrinter() {
+        return AInt64Printer.INSTANCE;
+    }
+
+}
\ No newline at end of file
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
new file mode 100644
index 0000000..94466d9
--- /dev/null
+++ b/asterix-om/src/main/java/edu/uci/ics/asterix/dataflow/data/nontagged/printers/cleanjson/AInt8Printer.java
@@ -0,0 +1,40 @@
+/*
+ * 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 java.io.PrintStream;
+
+import edu.uci.ics.asterix.dataflow.data.nontagged.serde.AInt8SerializerDeserializer;
+import edu.uci.ics.hyracks.algebricks.common.exceptions.AlgebricksException;
+import edu.uci.ics.hyracks.algebricks.data.IPrinter;
+
+public class AInt8Printer implements IPrinter {
+
+    public static final AInt8Printer INSTANCE = new AInt8Printer();
+
+    @Override
+    public void init() {
+
+    }
+
+    @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("}");
+    }
+}
diff --git a/asterix-om/src/main/java/edu/uci/ics/asterix/dataflow/data/nontagged/printers/cleanjson/AInt8PrinterFactory.java b/asterix-om/src/main/java/edu/uci/ics/asterix/dataflow/data/nontagged/printers/cleanjson/AInt8PrinterFactory.java
new file mode 100644
index 0000000..e56376a
--- /dev/null
+++ b/asterix-om/src/main/java/edu/uci/ics/asterix/dataflow/data/nontagged/printers/cleanjson/AInt8PrinterFactory.java
@@ -0,0 +1,30 @@
+/*
+ * 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 AInt8PrinterFactory implements IPrinterFactory {
+
+    private static final long serialVersionUID = 1L;
+    public static final AInt8PrinterFactory INSTANCE = new AInt8PrinterFactory();
+
+    @Override
+    public IPrinter createPrinter() {
+        return AInt8Printer.INSTANCE;
+    }
+
+}
\ No newline at end of file
diff --git a/asterix-om/src/main/java/edu/uci/ics/asterix/dataflow/data/nontagged/printers/cleanjson/AIntervalPrinter.java b/asterix-om/src/main/java/edu/uci/ics/asterix/dataflow/data/nontagged/printers/cleanjson/AIntervalPrinter.java
new file mode 100644
index 0000000..588c071
--- /dev/null
+++ b/asterix-om/src/main/java/edu/uci/ics/asterix/dataflow/data/nontagged/printers/cleanjson/AIntervalPrinter.java
@@ -0,0 +1,67 @@
+/*
+ * 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 java.io.PrintStream;
+
+import edu.uci.ics.asterix.dataflow.data.nontagged.serde.AInt8SerializerDeserializer;
+import edu.uci.ics.asterix.om.types.ATypeTag;
+import edu.uci.ics.hyracks.algebricks.common.exceptions.AlgebricksException;
+import edu.uci.ics.hyracks.algebricks.data.IPrinter;
+
+public class AIntervalPrinter implements IPrinter {
+
+    public static final AIntervalPrinter INSTANCE = new AIntervalPrinter();
+
+    /* (non-Javadoc)
+     * @see edu.uci.ics.hyracks.algebricks.data.IPrinter#init()
+     */
+    @Override
+    public void init() throws AlgebricksException {
+    }
+
+    /* (non-Javadoc)
+     * @see edu.uci.ics.hyracks.algebricks.data.IPrinter#print(byte[], int, int, java.io.PrintStream)
+     */
+    @Override
+    public void print(byte[] b, int s, int l, PrintStream ps) throws AlgebricksException {
+        ps.print("{ \"interval\": { \"start\": ");
+
+        short typetag = AInt8SerializerDeserializer.getByte(b, s + 1 + 8 * 2);
+
+        IPrinter timeInstancePrinter;
+
+        if (typetag == ATypeTag.DATE.serialize()) {
+            timeInstancePrinter = ADatePrinter.INSTANCE;
+            ((ADatePrinter) timeInstancePrinter).print(b, s + 4, 4, ps);
+            ps.print(", \"end\": ");
+            ((ADatePrinter) timeInstancePrinter).print(b, s + 12, 4, ps);
+        } else if (typetag == ATypeTag.TIME.serialize()) {
+            timeInstancePrinter = ATimePrinter.INSTANCE;
+            ((ATimePrinter) timeInstancePrinter).print(b, s + 4, 4, ps);
+            ps.print(", \"end\": ");
+            ((ATimePrinter) timeInstancePrinter).print(b, s + 12, 4, ps);
+        } else if (typetag == ATypeTag.DATETIME.serialize()) {
+            timeInstancePrinter = ADateTimePrinter.INSTANCE;
+            ((ADateTimePrinter) timeInstancePrinter).print(b, s, 8, ps);
+            ps.print(", \"end\": ");
+            ((ADateTimePrinter) timeInstancePrinter).print(b, s + 8, 8, ps);
+        } else {
+            throw new AlgebricksException("Unsupport internal time types in interval: " + typetag);
+        }
+
+        ps.print("}}");
+    }
+}
diff --git a/asterix-om/src/main/java/edu/uci/ics/asterix/dataflow/data/nontagged/printers/cleanjson/AIntervalPrinterFactory.java b/asterix-om/src/main/java/edu/uci/ics/asterix/dataflow/data/nontagged/printers/cleanjson/AIntervalPrinterFactory.java
new file mode 100644
index 0000000..69d37de
--- /dev/null
+++ b/asterix-om/src/main/java/edu/uci/ics/asterix/dataflow/data/nontagged/printers/cleanjson/AIntervalPrinterFactory.java
@@ -0,0 +1,30 @@
+/*
+ * 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 AIntervalPrinterFactory implements IPrinterFactory {
+
+    private static final long serialVersionUID = 1L;
+    public static final AIntervalPrinterFactory INSTANCE = new AIntervalPrinterFactory();
+
+    @Override
+    public IPrinter createPrinter() {
+        return AIntervalPrinter.INSTANCE;
+    }
+
+}
diff --git a/asterix-om/src/main/java/edu/uci/ics/asterix/dataflow/data/nontagged/printers/cleanjson/ALinePrinter.java b/asterix-om/src/main/java/edu/uci/ics/asterix/dataflow/data/nontagged/printers/cleanjson/ALinePrinter.java
new file mode 100644
index 0000000..9c43173
--- /dev/null
+++ b/asterix-om/src/main/java/edu/uci/ics/asterix/dataflow/data/nontagged/printers/cleanjson/ALinePrinter.java
@@ -0,0 +1,45 @@
+/*
+ * 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 java.io.PrintStream;
+
+import edu.uci.ics.asterix.dataflow.data.nontagged.serde.ADoubleSerializerDeserializer;
+import edu.uci.ics.hyracks.algebricks.common.exceptions.AlgebricksException;
+import edu.uci.ics.hyracks.algebricks.data.IPrinter;
+
+public class ALinePrinter implements IPrinter {
+
+    public static final ALinePrinter INSTANCE = new ALinePrinter();
+
+    @Override
+    public void init() {
+
+    }
+
+    @Override
+    public void print(byte[] b, int s, int l, PrintStream ps) throws AlgebricksException {
+        ps.print("{ \"line\": ");
+        ps.print(" [ { \"point\": [");
+        ps.print(ADoubleSerializerDeserializer.getDouble(b, s + 1));
+        ps.print(", ");
+        ps.print(ADoubleSerializerDeserializer.getDouble(b, s + 9));
+        ps.print("] }, { \"point\": [");
+        ps.print(ADoubleSerializerDeserializer.getDouble(b, s + 17));
+        ps.print(", ");
+        ps.print(ADoubleSerializerDeserializer.getDouble(b, s + 25));
+        ps.print("] } ] }");
+    }
+}
diff --git a/asterix-om/src/main/java/edu/uci/ics/asterix/dataflow/data/nontagged/printers/cleanjson/ALinePrinterFactory.java b/asterix-om/src/main/java/edu/uci/ics/asterix/dataflow/data/nontagged/printers/cleanjson/ALinePrinterFactory.java
new file mode 100644
index 0000000..efcb90d
--- /dev/null
+++ b/asterix-om/src/main/java/edu/uci/ics/asterix/dataflow/data/nontagged/printers/cleanjson/ALinePrinterFactory.java
@@ -0,0 +1,30 @@
+/*
+ * 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 ALinePrinterFactory implements IPrinterFactory {
+
+    private static final long serialVersionUID = 1L;
+    public static final ALinePrinterFactory INSTANCE = new ALinePrinterFactory();
+
+    @Override
+    public IPrinter createPrinter() {
+        return ALinePrinter.INSTANCE;
+    }
+
+}
\ No newline at end of file
diff --git a/asterix-om/src/main/java/edu/uci/ics/asterix/dataflow/data/nontagged/printers/cleanjson/ANullPrinter.java b/asterix-om/src/main/java/edu/uci/ics/asterix/dataflow/data/nontagged/printers/cleanjson/ANullPrinter.java
new file mode 100644
index 0000000..ce07a28
--- /dev/null
+++ b/asterix-om/src/main/java/edu/uci/ics/asterix/dataflow/data/nontagged/printers/cleanjson/ANullPrinter.java
@@ -0,0 +1,35 @@
+/*
+ * 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 java.io.PrintStream;
+
+import edu.uci.ics.hyracks.algebricks.common.exceptions.AlgebricksException;
+import edu.uci.ics.hyracks.algebricks.data.IPrinter;
+
+public class ANullPrinter implements IPrinter {
+
+    public static final ANullPrinter INSTANCE = new ANullPrinter();
+
+    @Override
+    public void init() {
+
+    }
+
+    @Override
+    public void print(byte[] b, int s, int l, PrintStream ps) throws AlgebricksException {
+        ps.print("null");
+    }
+}
\ No newline at end of file
diff --git a/asterix-om/src/main/java/edu/uci/ics/asterix/dataflow/data/nontagged/printers/cleanjson/ANullPrinterFactory.java b/asterix-om/src/main/java/edu/uci/ics/asterix/dataflow/data/nontagged/printers/cleanjson/ANullPrinterFactory.java
new file mode 100644
index 0000000..4c9aa62
--- /dev/null
+++ b/asterix-om/src/main/java/edu/uci/ics/asterix/dataflow/data/nontagged/printers/cleanjson/ANullPrinterFactory.java
@@ -0,0 +1,30 @@
+/*
+ * 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 ANullPrinterFactory implements IPrinterFactory {
+
+    private static final long serialVersionUID = 1L;
+    public static final ANullPrinterFactory INSTANCE = new ANullPrinterFactory();
+
+    @Override
+    public IPrinter createPrinter() {
+        return ANullPrinter.INSTANCE;
+    }
+
+}
\ No newline at end of file
diff --git a/asterix-om/src/main/java/edu/uci/ics/asterix/dataflow/data/nontagged/printers/cleanjson/ANullableFieldPrinterFactory.java b/asterix-om/src/main/java/edu/uci/ics/asterix/dataflow/data/nontagged/printers/cleanjson/ANullableFieldPrinterFactory.java
new file mode 100644
index 0000000..1e95a57
--- /dev/null
+++ b/asterix-om/src/main/java/edu/uci/ics/asterix/dataflow/data/nontagged/printers/cleanjson/ANullableFieldPrinterFactory.java
@@ -0,0 +1,63 @@
+/*
+ * 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 java.io.PrintStream;
+
+import edu.uci.ics.asterix.formats.nontagged.AqlJSONPrinterFactoryProvider;
+import edu.uci.ics.asterix.om.types.ATypeTag;
+import edu.uci.ics.asterix.om.types.AUnionType;
+import edu.uci.ics.asterix.om.types.BuiltinType;
+import edu.uci.ics.hyracks.algebricks.common.exceptions.AlgebricksException;
+import edu.uci.ics.hyracks.algebricks.data.IPrinter;
+import edu.uci.ics.hyracks.algebricks.data.IPrinterFactory;
+
+public class ANullableFieldPrinterFactory implements IPrinterFactory {
+
+    private static final long serialVersionUID = 1L;
+
+    private AUnionType unionType;
+
+    public ANullableFieldPrinterFactory(AUnionType unionType) {
+        this.unionType = unionType;
+    }
+
+    @Override
+    public IPrinter createPrinter() {
+        return new IPrinter() {
+            private IPrinter nullPrinter;
+            private IPrinter fieldPrinter;
+
+            @Override
+            public void init() throws AlgebricksException {
+                nullPrinter = (AqlJSONPrinterFactoryProvider.INSTANCE.getPrinterFactory(BuiltinType.ANULL))
+                        .createPrinter();
+                fieldPrinter = (AqlJSONPrinterFactoryProvider.INSTANCE.getPrinterFactory(unionType.getNullableType()))
+                        .createPrinter();
+            }
+
+            @Override
+            public void print(byte[] b, int s, int l, PrintStream ps) throws AlgebricksException {
+                fieldPrinter.init();
+                if (b[s] == ATypeTag.NULL.serialize())
+                    nullPrinter.print(b, s, l, ps);
+                else
+                    fieldPrinter.print(b, s, l, ps);
+            }
+
+        };
+    }
+
+}
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
new file mode 100644
index 0000000..ef45631
--- /dev/null
+++ b/asterix-om/src/main/java/edu/uci/ics/asterix/dataflow/data/nontagged/printers/cleanjson/AObjectPrinter.java
@@ -0,0 +1,167 @@
+/*
+ * 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 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;
+import edu.uci.ics.hyracks.algebricks.common.exceptions.NotImplementedException;
+import edu.uci.ics.hyracks.algebricks.data.IPrinter;
+
+public class AObjectPrinter implements IPrinter {
+
+    public static final AObjectPrinter INSTANCE = new AObjectPrinter();
+
+    private IPrinter recordPrinter = new ARecordPrinterFactory(null).createPrinter();
+    private IPrinter orderedlistPrinter = new AOrderedlistPrinterFactory(null).createPrinter();
+    private IPrinter unorderedListPrinter = new AUnorderedlistPrinterFactory(null).createPrinter();
+
+    @Override
+    public void init() throws AlgebricksException {
+
+    }
+
+    @Override
+    public void print(byte[] b, int s, int l, PrintStream ps) throws AlgebricksException {
+        ATypeTag typeTag = EnumDeserializer.ATYPETAGDESERIALIZER.deserialize(b[s]);
+        switch (typeTag) {
+            case INT8: {
+                AInt8Printer.INSTANCE.print(b, s, l, ps);
+                break;
+            }
+            case INT16: {
+                AInt16Printer.INSTANCE.print(b, s, l, ps);
+                break;
+            }
+            case INT32: {
+                AInt32Printer.INSTANCE.print(b, s, l, ps);
+                break;
+            }
+            case INT64: {
+                AInt64Printer.INSTANCE.print(b, s, l, ps);
+                break;
+            }
+            case NULL: {
+                ANullPrinter.INSTANCE.print(b, s, l, ps);
+                break;
+            }
+            case BOOLEAN: {
+                ABooleanPrinter.INSTANCE.print(b, s, l, ps);
+                break;
+            }
+            case FLOAT: {
+                AFloatPrinter.INSTANCE.print(b, s, l, ps);
+                break;
+            }
+            case DOUBLE: {
+                ADoublePrinter.INSTANCE.print(b, s, l, ps);
+                break;
+            }
+            case DATE: {
+                ADatePrinter.INSTANCE.print(b, s, l, ps);
+                break;
+            }
+            case TIME: {
+                ATimePrinter.INSTANCE.print(b, s, l, ps);
+                break;
+            }
+            case DATETIME: {
+                ADateTimePrinter.INSTANCE.print(b, s, l, ps);
+                break;
+            }
+            case DURATION: {
+                ADurationPrinter.INSTANCE.print(b, s, l, ps);
+                break;
+            }
+            case YEARMONTHDURATION: {
+                AYearMonthDurationPrinter.INSTANCE.print(b, s, l, ps);
+                break;
+            }
+            case DAYTIMEDURATION: {
+                ADayTimeDurationPrinter.INSTANCE.print(b, s, l, ps);
+                break;
+            }
+            case INTERVAL: {
+                AIntervalPrinter.INSTANCE.print(b, s, l, ps);
+                break;
+            }
+             case POINT: {
+                APointPrinter.INSTANCE.print(b, s, l, ps);
+                break;
+            }
+            case POINT3D: {
+                APoint3DPrinter.INSTANCE.print(b, s, l, ps);
+                break;
+            }
+            case LINE: {
+                ALinePrinter.INSTANCE.print(b, s, l, ps);
+                break;
+            }
+            case POLYGON: {
+                APolygonPrinter.INSTANCE.print(b, s, l, ps);
+                break;
+            }
+            case CIRCLE: {
+                ACirclePrinter.INSTANCE.print(b, s, l, ps);
+                break;
+            }
+            case RECTANGLE: {
+                ARectanglePrinter.INSTANCE.print(b, s, l, ps);
+                break;
+            }
+            case STRING: {
+                AStringPrinter.INSTANCE.print(b, s, l, ps);
+                break;
+            }
+            case BINARY: {
+                ABinaryHexPrinter.INSTANCE.print(b, s, l, ps);
+                break;
+            }
+            case RECORD: {
+                this.recordPrinter.init();
+                recordPrinter.print(b, s, l, ps);
+                break;
+            }
+            case ORDEREDLIST: {
+                this.orderedlistPrinter.init();
+                orderedlistPrinter.print(b, s, l, ps);
+                break;
+            }
+            case UNORDEREDLIST: {
+                this.unorderedListPrinter.init();
+                unorderedListPrinter.print(b, s, l, ps);
+                break;
+            }
+            case ANY:
+            case BITARRAY:
+            case ENUM:
+            case SHORTWITHOUTTYPEINFO:
+            case SPARSERECORD:
+            case SYSTEM_NULL:
+            case TYPE:
+            case UINT16:
+            case UINT32:
+            case UINT64:
+            case UINT8:
+            case UNION:
+            case UUID:
+            case UUID_STRING:
+                throw new NotImplementedException("No printer for type " + typeTag);
+        }
+    }
+}
\ No newline at end of file
diff --git a/asterix-om/src/main/java/edu/uci/ics/asterix/dataflow/data/nontagged/printers/cleanjson/AObjectPrinterFactory.java b/asterix-om/src/main/java/edu/uci/ics/asterix/dataflow/data/nontagged/printers/cleanjson/AObjectPrinterFactory.java
new file mode 100644
index 0000000..21fe520
--- /dev/null
+++ b/asterix-om/src/main/java/edu/uci/ics/asterix/dataflow/data/nontagged/printers/cleanjson/AObjectPrinterFactory.java
@@ -0,0 +1,30 @@
+/*
+ * 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 AObjectPrinterFactory implements IPrinterFactory {
+
+    private static final long serialVersionUID = 1L;
+    public static final AObjectPrinterFactory INSTANCE = new AObjectPrinterFactory();
+
+    @Override
+    public IPrinter createPrinter() {
+        return AObjectPrinter.INSTANCE;
+    }
+
+}
\ No newline at end of file
diff --git a/asterix-om/src/main/java/edu/uci/ics/asterix/dataflow/data/nontagged/printers/cleanjson/AOrderedlistPrinterFactory.java b/asterix-om/src/main/java/edu/uci/ics/asterix/dataflow/data/nontagged/printers/cleanjson/AOrderedlistPrinterFactory.java
new file mode 100644
index 0000000..0e63fa7
--- /dev/null
+++ b/asterix-om/src/main/java/edu/uci/ics/asterix/dataflow/data/nontagged/printers/cleanjson/AOrderedlistPrinterFactory.java
@@ -0,0 +1,69 @@
+/*
+ * 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 java.io.PrintStream;
+
+import edu.uci.ics.asterix.om.pointables.PointableAllocator;
+import edu.uci.ics.asterix.om.pointables.base.DefaultOpenFieldType;
+import edu.uci.ics.asterix.om.pointables.base.IVisitablePointable;
+import edu.uci.ics.asterix.om.pointables.printer.cleanjson.APrintVisitor;
+import edu.uci.ics.asterix.om.types.AOrderedListType;
+import edu.uci.ics.asterix.om.types.ATypeTag;
+import edu.uci.ics.asterix.om.types.IAType;
+import edu.uci.ics.hyracks.algebricks.common.exceptions.AlgebricksException;
+import edu.uci.ics.hyracks.algebricks.common.utils.Pair;
+import edu.uci.ics.hyracks.algebricks.data.IPrinter;
+import edu.uci.ics.hyracks.algebricks.data.IPrinterFactory;
+
+public class AOrderedlistPrinterFactory implements IPrinterFactory {
+
+    private static final long serialVersionUID = 1L;
+    private AOrderedListType orderedlistType;
+
+    public AOrderedlistPrinterFactory(AOrderedListType orderedlistType) {
+        this.orderedlistType = orderedlistType;
+    }
+
+    @Override
+    public IPrinter createPrinter() {
+
+        PointableAllocator allocator = new PointableAllocator();
+        final IAType inputType = orderedlistType == null ? DefaultOpenFieldType
+                .getDefaultOpenFieldType(ATypeTag.ORDEREDLIST) : orderedlistType;
+        final IVisitablePointable listAccessor = allocator.allocateListValue(inputType);
+        final APrintVisitor printVisitor = new APrintVisitor();
+        final Pair<PrintStream, ATypeTag> arg = new Pair<PrintStream, ATypeTag>(null, null);
+
+        return new IPrinter() {
+
+            @Override
+            public void init() throws AlgebricksException {
+                arg.second = inputType.getTypeTag();
+            }
+
+            @Override
+            public void print(byte[] b, int start, int l, PrintStream ps) throws AlgebricksException {
+                try {
+                    listAccessor.set(b, start, l);
+                    arg.first = ps;
+                    listAccessor.accept(printVisitor, arg);
+                } catch (Exception ioe) {
+                    throw new AlgebricksException(ioe);
+                }
+            }
+        };
+    }
+}
diff --git a/asterix-om/src/main/java/edu/uci/ics/asterix/dataflow/data/nontagged/printers/cleanjson/APoint3DPrinter.java b/asterix-om/src/main/java/edu/uci/ics/asterix/dataflow/data/nontagged/printers/cleanjson/APoint3DPrinter.java
new file mode 100644
index 0000000..5dbf552
--- /dev/null
+++ b/asterix-om/src/main/java/edu/uci/ics/asterix/dataflow/data/nontagged/printers/cleanjson/APoint3DPrinter.java
@@ -0,0 +1,42 @@
+/*
+ * 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 java.io.PrintStream;
+
+import edu.uci.ics.asterix.dataflow.data.nontagged.serde.ADoubleSerializerDeserializer;
+import edu.uci.ics.hyracks.algebricks.common.exceptions.AlgebricksException;
+import edu.uci.ics.hyracks.algebricks.data.IPrinter;
+
+public class APoint3DPrinter implements IPrinter {
+
+    public static final APoint3DPrinter INSTANCE = new APoint3DPrinter();
+
+    @Override
+    public void init() {
+
+    }
+
+    @Override
+    public void print(byte[] b, int s, int l, PrintStream ps) throws AlgebricksException {
+        ps.print("{ \"point3d\": [");
+        ps.print(ADoubleSerializerDeserializer.getDouble(b, s + 1));
+        ps.print(", ");
+        ps.print(ADoubleSerializerDeserializer.getDouble(b, s + 9));
+        ps.print(", ");
+        ps.print(ADoubleSerializerDeserializer.getDouble(b, s + 17));
+        ps.print("] }");
+    }
+}
diff --git a/asterix-om/src/main/java/edu/uci/ics/asterix/dataflow/data/nontagged/printers/cleanjson/APoint3DPrinterFactory.java b/asterix-om/src/main/java/edu/uci/ics/asterix/dataflow/data/nontagged/printers/cleanjson/APoint3DPrinterFactory.java
new file mode 100644
index 0000000..64d840c
--- /dev/null
+++ b/asterix-om/src/main/java/edu/uci/ics/asterix/dataflow/data/nontagged/printers/cleanjson/APoint3DPrinterFactory.java
@@ -0,0 +1,30 @@
+/*
+ * 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 APoint3DPrinterFactory implements IPrinterFactory {
+
+    private static final long serialVersionUID = 1L;
+    public static final APoint3DPrinterFactory INSTANCE = new APoint3DPrinterFactory();
+
+    @Override
+    public IPrinter createPrinter() {
+        return APoint3DPrinter.INSTANCE;
+    }
+
+}
\ No newline at end of file
diff --git a/asterix-om/src/main/java/edu/uci/ics/asterix/dataflow/data/nontagged/printers/cleanjson/APointPrinter.java b/asterix-om/src/main/java/edu/uci/ics/asterix/dataflow/data/nontagged/printers/cleanjson/APointPrinter.java
new file mode 100644
index 0000000..e78a6bf
--- /dev/null
+++ b/asterix-om/src/main/java/edu/uci/ics/asterix/dataflow/data/nontagged/printers/cleanjson/APointPrinter.java
@@ -0,0 +1,40 @@
+/*
+ * 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 java.io.PrintStream;
+
+import edu.uci.ics.asterix.dataflow.data.nontagged.serde.ADoubleSerializerDeserializer;
+import edu.uci.ics.hyracks.algebricks.common.exceptions.AlgebricksException;
+import edu.uci.ics.hyracks.algebricks.data.IPrinter;
+
+public class APointPrinter implements IPrinter {
+
+    public static final APointPrinter INSTANCE = new APointPrinter();
+
+    @Override
+    public void init() {
+
+    }
+
+    @Override
+    public void print(byte[] b, int s, int l, PrintStream ps) throws AlgebricksException {
+        ps.print("{ \"point\": [");
+        ps.print(ADoubleSerializerDeserializer.getDouble(b, s + 1));
+        ps.print(", ");
+        ps.print(ADoubleSerializerDeserializer.getDouble(b, s + 9));
+        ps.print("] }");
+    }
+}
diff --git a/asterix-om/src/main/java/edu/uci/ics/asterix/dataflow/data/nontagged/printers/cleanjson/APointPrinterFactory.java b/asterix-om/src/main/java/edu/uci/ics/asterix/dataflow/data/nontagged/printers/cleanjson/APointPrinterFactory.java
new file mode 100644
index 0000000..c537b47
--- /dev/null
+++ b/asterix-om/src/main/java/edu/uci/ics/asterix/dataflow/data/nontagged/printers/cleanjson/APointPrinterFactory.java
@@ -0,0 +1,30 @@
+/*
+ * 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 APointPrinterFactory implements IPrinterFactory {
+
+    private static final long serialVersionUID = 1L;
+    public static final APointPrinterFactory INSTANCE = new APointPrinterFactory();
+
+    @Override
+    public IPrinter createPrinter() {
+        return APointPrinter.INSTANCE;
+    }
+
+}
\ No newline at end of file
diff --git a/asterix-om/src/main/java/edu/uci/ics/asterix/dataflow/data/nontagged/printers/cleanjson/APolygonPrinter.java b/asterix-om/src/main/java/edu/uci/ics/asterix/dataflow/data/nontagged/printers/cleanjson/APolygonPrinter.java
new file mode 100644
index 0000000..140f696
--- /dev/null
+++ b/asterix-om/src/main/java/edu/uci/ics/asterix/dataflow/data/nontagged/printers/cleanjson/APolygonPrinter.java
@@ -0,0 +1,56 @@
+/*
+ * 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 java.io.PrintStream;
+
+import edu.uci.ics.asterix.dataflow.data.nontagged.serde.ADoubleSerializerDeserializer;
+import edu.uci.ics.asterix.dataflow.data.nontagged.serde.AInt16SerializerDeserializer;
+import edu.uci.ics.hyracks.algebricks.common.exceptions.AlgebricksException;
+import edu.uci.ics.hyracks.algebricks.data.IPrinter;
+
+public class APolygonPrinter implements IPrinter {
+
+    public static final APolygonPrinter INSTANCE = new APolygonPrinter();
+
+    @Override
+    public void init() {
+
+    }
+
+    @Override
+    public void print(byte[] b, int s, int l, PrintStream ps) throws AlgebricksException {
+        short numberOfPoints = AInt16SerializerDeserializer.getShort(b, s + 1);
+        s += 3;
+
+        ps.print("{ \"polygon\": [");
+
+        for (int i = 0; i < numberOfPoints; i++) {
+            if (i > 0)
+                ps.print(",");
+
+            ps.print("{ \"point\": [");
+            ps.print(ADoubleSerializerDeserializer.getDouble(b, s));
+            ps.print(", ");
+            ps.print(ADoubleSerializerDeserializer.getDouble(b, s + 8));
+            ps.print("] }");
+
+            s += 16;
+        }
+
+        ps.print("] }");
+
+    }
+}
diff --git a/asterix-om/src/main/java/edu/uci/ics/asterix/dataflow/data/nontagged/printers/cleanjson/APolygonPrinterFactory.java b/asterix-om/src/main/java/edu/uci/ics/asterix/dataflow/data/nontagged/printers/cleanjson/APolygonPrinterFactory.java
new file mode 100644
index 0000000..b7d3c28
--- /dev/null
+++ b/asterix-om/src/main/java/edu/uci/ics/asterix/dataflow/data/nontagged/printers/cleanjson/APolygonPrinterFactory.java
@@ -0,0 +1,30 @@
+/*
+ * 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 APolygonPrinterFactory implements IPrinterFactory {
+
+    private static final long serialVersionUID = 1L;
+    public static final APolygonPrinterFactory INSTANCE = new APolygonPrinterFactory();
+
+    @Override
+    public IPrinter createPrinter() {
+        return APolygonPrinter.INSTANCE;
+    }
+
+}
\ No newline at end of file
diff --git a/asterix-om/src/main/java/edu/uci/ics/asterix/dataflow/data/nontagged/printers/cleanjson/ARecordPrinterFactory.java b/asterix-om/src/main/java/edu/uci/ics/asterix/dataflow/data/nontagged/printers/cleanjson/ARecordPrinterFactory.java
new file mode 100644
index 0000000..4ede0b9
--- /dev/null
+++ b/asterix-om/src/main/java/edu/uci/ics/asterix/dataflow/data/nontagged/printers/cleanjson/ARecordPrinterFactory.java
@@ -0,0 +1,69 @@
+/*
+ * 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 java.io.PrintStream;
+
+import edu.uci.ics.asterix.om.pointables.PointableAllocator;
+import edu.uci.ics.asterix.om.pointables.base.DefaultOpenFieldType;
+import edu.uci.ics.asterix.om.pointables.base.IVisitablePointable;
+import edu.uci.ics.asterix.om.pointables.printer.cleanjson.APrintVisitor;
+import edu.uci.ics.asterix.om.types.ARecordType;
+import edu.uci.ics.asterix.om.types.ATypeTag;
+import edu.uci.ics.asterix.om.types.IAType;
+import edu.uci.ics.hyracks.algebricks.common.exceptions.AlgebricksException;
+import edu.uci.ics.hyracks.algebricks.common.utils.Pair;
+import edu.uci.ics.hyracks.algebricks.data.IPrinter;
+import edu.uci.ics.hyracks.algebricks.data.IPrinterFactory;
+
+public class ARecordPrinterFactory implements IPrinterFactory {
+
+    private static final long serialVersionUID = 1L;
+    private final ARecordType recType;
+
+    public ARecordPrinterFactory(ARecordType recType) {
+        this.recType = recType;
+    }
+
+    @Override
+    public IPrinter createPrinter() {
+
+        PointableAllocator allocator = new PointableAllocator();
+        final IAType inputType = recType == null ? DefaultOpenFieldType.getDefaultOpenFieldType(ATypeTag.RECORD)
+                : recType;
+        final IVisitablePointable recAccessor = allocator.allocateRecordValue(inputType);
+        final APrintVisitor printVisitor = new APrintVisitor();
+        final Pair<PrintStream, ATypeTag> arg = new Pair<PrintStream, ATypeTag>(null, null);
+
+        return new IPrinter() {
+
+            @Override
+            public void init() throws AlgebricksException {
+                arg.second = inputType.getTypeTag();
+            }
+
+            @Override
+            public void print(byte[] b, int start, int l, PrintStream ps) throws AlgebricksException {
+                try {
+                    recAccessor.set(b, start, l);
+                    arg.first = ps;
+                    recAccessor.accept(printVisitor, arg);
+                } catch (Exception ioe) {
+                    throw new AlgebricksException(ioe);
+                }
+            }
+        };
+    }
+}
diff --git a/asterix-om/src/main/java/edu/uci/ics/asterix/dataflow/data/nontagged/printers/cleanjson/ARectanglePrinter.java b/asterix-om/src/main/java/edu/uci/ics/asterix/dataflow/data/nontagged/printers/cleanjson/ARectanglePrinter.java
new file mode 100644
index 0000000..6ff901c
--- /dev/null
+++ b/asterix-om/src/main/java/edu/uci/ics/asterix/dataflow/data/nontagged/printers/cleanjson/ARectanglePrinter.java
@@ -0,0 +1,45 @@
+/*
+ * 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 java.io.PrintStream;
+
+import edu.uci.ics.asterix.dataflow.data.nontagged.serde.ADoubleSerializerDeserializer;
+import edu.uci.ics.hyracks.algebricks.common.exceptions.AlgebricksException;
+import edu.uci.ics.hyracks.algebricks.data.IPrinter;
+
+public class ARectanglePrinter implements IPrinter {
+
+    public static final ARectanglePrinter INSTANCE = new ARectanglePrinter();
+
+    @Override
+    public void init() {
+
+    }
+
+    @Override
+    public void print(byte[] b, int s, int l, PrintStream ps) throws AlgebricksException {
+        ps.print("{ \"rectangle\": [");
+        ps.print("{ \"point\": [");
+        ps.print(ADoubleSerializerDeserializer.getDouble(b, s + 1));
+        ps.print(", ");
+        ps.print(ADoubleSerializerDeserializer.getDouble(b, s + 9));
+        ps.print("] }, { \"point\": [");
+        ps.print(ADoubleSerializerDeserializer.getDouble(b, s + 17));
+        ps.print(", ");
+        ps.print(ADoubleSerializerDeserializer.getDouble(b, s + 25));
+        ps.print("] } ] }");
+    }
+}
diff --git a/asterix-om/src/main/java/edu/uci/ics/asterix/dataflow/data/nontagged/printers/cleanjson/ARectanglePrinterFactory.java b/asterix-om/src/main/java/edu/uci/ics/asterix/dataflow/data/nontagged/printers/cleanjson/ARectanglePrinterFactory.java
new file mode 100644
index 0000000..8154850
--- /dev/null
+++ b/asterix-om/src/main/java/edu/uci/ics/asterix/dataflow/data/nontagged/printers/cleanjson/ARectanglePrinterFactory.java
@@ -0,0 +1,30 @@
+/*
+ * 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 ARectanglePrinterFactory implements IPrinterFactory {
+
+    private static final long serialVersionUID = 1L;
+    public static final ARectanglePrinterFactory INSTANCE = new ARectanglePrinterFactory();
+
+    @Override
+    public IPrinter createPrinter() {
+        return ARectanglePrinter.INSTANCE;
+    }
+
+}
\ No newline at end of file
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
new file mode 100644
index 0000000..4ca3427
--- /dev/null
+++ b/asterix-om/src/main/java/edu/uci/ics/asterix/dataflow/data/nontagged/printers/cleanjson/AStringPrinter.java
@@ -0,0 +1,41 @@
+/*
+ * 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 java.io.IOException;
+import java.io.PrintStream;
+
+import edu.uci.ics.asterix.dataflow.data.nontagged.printers.adm.PrintTools;
+import edu.uci.ics.hyracks.algebricks.common.exceptions.AlgebricksException;
+import edu.uci.ics.hyracks.algebricks.data.IPrinter;
+
+public class AStringPrinter implements IPrinter {
+
+    public static final AStringPrinter INSTANCE = new AStringPrinter();
+
+    @Override
+    public void init() {
+
+    }
+
+    @Override
+    public void print(byte[] b, int s, int l, PrintStream ps) throws AlgebricksException {
+        try {
+            PrintTools.writeUTF8StringAsJSON(b, s + 1, l - 1, ps);
+        } catch (IOException e) {
+            throw new AlgebricksException(e);
+        }
+    }
+}
diff --git a/asterix-om/src/main/java/edu/uci/ics/asterix/dataflow/data/nontagged/printers/cleanjson/AStringPrinterFactory.java b/asterix-om/src/main/java/edu/uci/ics/asterix/dataflow/data/nontagged/printers/cleanjson/AStringPrinterFactory.java
new file mode 100644
index 0000000..f325c67
--- /dev/null
+++ b/asterix-om/src/main/java/edu/uci/ics/asterix/dataflow/data/nontagged/printers/cleanjson/AStringPrinterFactory.java
@@ -0,0 +1,30 @@
+/*
+ * 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 AStringPrinterFactory implements IPrinterFactory {
+
+    private static final long serialVersionUID = 1L;
+    public static final AStringPrinterFactory INSTANCE = new AStringPrinterFactory();
+
+    @Override
+    public IPrinter createPrinter() {
+        return AStringPrinter.INSTANCE;
+    }
+
+}
\ No newline at end of file
diff --git a/asterix-om/src/main/java/edu/uci/ics/asterix/dataflow/data/nontagged/printers/cleanjson/ATimePrinter.java b/asterix-om/src/main/java/edu/uci/ics/asterix/dataflow/data/nontagged/printers/cleanjson/ATimePrinter.java
new file mode 100644
index 0000000..25fdd1e
--- /dev/null
+++ b/asterix-om/src/main/java/edu/uci/ics/asterix/dataflow/data/nontagged/printers/cleanjson/ATimePrinter.java
@@ -0,0 +1,41 @@
+/*
+ * 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 java.io.PrintStream;
+
+import edu.uci.ics.asterix.dataflow.data.nontagged.serde.AInt32SerializerDeserializer;
+import edu.uci.ics.hyracks.algebricks.common.exceptions.AlgebricksException;
+import edu.uci.ics.hyracks.algebricks.data.IPrinter;
+
+public class ATimePrinter implements IPrinter {
+
+    public static final ATimePrinter INSTANCE = new ATimePrinter();
+
+    @Override
+    public void init() {
+
+    }
+
+    @Override
+    public void print(byte[] b, int s, int l, PrintStream ps) throws AlgebricksException {
+        int time = AInt32SerializerDeserializer.getInt(b, s + 1);
+
+        ps.print("{ \"time\": ");
+        ps.print(time);
+        ps.print("}");
+    }
+
+}
diff --git a/asterix-om/src/main/java/edu/uci/ics/asterix/dataflow/data/nontagged/printers/cleanjson/ATimePrinterFactory.java b/asterix-om/src/main/java/edu/uci/ics/asterix/dataflow/data/nontagged/printers/cleanjson/ATimePrinterFactory.java
new file mode 100644
index 0000000..6b513d8
--- /dev/null
+++ b/asterix-om/src/main/java/edu/uci/ics/asterix/dataflow/data/nontagged/printers/cleanjson/ATimePrinterFactory.java
@@ -0,0 +1,30 @@
+/*
+ * 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 ATimePrinterFactory implements IPrinterFactory {
+
+    private static final long serialVersionUID = 1L;
+    public static final ATimePrinterFactory INSTANCE = new ATimePrinterFactory();
+
+    @Override
+    public IPrinter createPrinter() {
+        return ATimePrinter.INSTANCE;
+    }
+
+}
\ No newline at end of file
diff --git a/asterix-om/src/main/java/edu/uci/ics/asterix/dataflow/data/nontagged/printers/cleanjson/AUnionPrinterFactory.java b/asterix-om/src/main/java/edu/uci/ics/asterix/dataflow/data/nontagged/printers/cleanjson/AUnionPrinterFactory.java
new file mode 100644
index 0000000..047c35a
--- /dev/null
+++ b/asterix-om/src/main/java/edu/uci/ics/asterix/dataflow/data/nontagged/printers/cleanjson/AUnionPrinterFactory.java
@@ -0,0 +1,72 @@
+/*
+ * 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 java.io.PrintStream;
+import java.util.List;
+
+import edu.uci.ics.asterix.formats.nontagged.AqlJSONPrinterFactoryProvider;
+import edu.uci.ics.asterix.om.types.ATypeTag;
+import edu.uci.ics.asterix.om.types.AUnionType;
+import edu.uci.ics.asterix.om.types.IAType;
+import edu.uci.ics.hyracks.algebricks.common.exceptions.AlgebricksException;
+import edu.uci.ics.hyracks.algebricks.data.IPrinter;
+import edu.uci.ics.hyracks.algebricks.data.IPrinterFactory;
+
+public class AUnionPrinterFactory implements IPrinterFactory {
+
+    private static final long serialVersionUID = 1L;
+
+    private AUnionType unionType;
+
+    public AUnionPrinterFactory(AUnionType unionType) {
+        this.unionType = unionType;
+    }
+
+    @Override
+    public IPrinter createPrinter() {
+
+        return new IPrinter() {
+
+            private IPrinter[] printers;
+            private List<IAType> unionList;
+
+            @Override
+            public void init() throws AlgebricksException {
+                unionList = unionType.getUnionList();
+                printers = new IPrinter[unionType.getUnionList().size()];
+                for (int i = 0; i < printers.length; i++) {
+                    printers[i] = (AqlJSONPrinterFactoryProvider.INSTANCE.getPrinterFactory(unionType.getUnionList()
+                            .get(i))).createPrinter();
+                    printers[i].init();
+                }
+            }
+
+            @Override
+            public void print(byte[] b, int s, int l, PrintStream ps) throws AlgebricksException {
+                ATypeTag tag = unionList.get(b[s + 1]).getTypeTag();
+                if (tag == ATypeTag.UNION)
+                    printers[b[s + 1]].print(b, s + 1, l, ps);
+                else {
+                    if (tag == ATypeTag.ANY)
+                        printers[b[s + 1]].print(b, s + 2, l, ps);
+                    else
+                        printers[b[s + 1]].print(b, s + 1, l, ps);
+                }
+            }
+        };
+    }
+
+}
diff --git a/asterix-om/src/main/java/edu/uci/ics/asterix/dataflow/data/nontagged/printers/cleanjson/AUnorderedlistPrinterFactory.java b/asterix-om/src/main/java/edu/uci/ics/asterix/dataflow/data/nontagged/printers/cleanjson/AUnorderedlistPrinterFactory.java
new file mode 100644
index 0000000..ace8925
--- /dev/null
+++ b/asterix-om/src/main/java/edu/uci/ics/asterix/dataflow/data/nontagged/printers/cleanjson/AUnorderedlistPrinterFactory.java
@@ -0,0 +1,69 @@
+/*
+ * 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 java.io.PrintStream;
+
+import edu.uci.ics.asterix.om.pointables.PointableAllocator;
+import edu.uci.ics.asterix.om.pointables.base.DefaultOpenFieldType;
+import edu.uci.ics.asterix.om.pointables.base.IVisitablePointable;
+import edu.uci.ics.asterix.om.pointables.printer.cleanjson.APrintVisitor;
+import edu.uci.ics.asterix.om.types.ATypeTag;
+import edu.uci.ics.asterix.om.types.AUnorderedListType;
+import edu.uci.ics.asterix.om.types.IAType;
+import edu.uci.ics.hyracks.algebricks.common.exceptions.AlgebricksException;
+import edu.uci.ics.hyracks.algebricks.common.utils.Pair;
+import edu.uci.ics.hyracks.algebricks.data.IPrinter;
+import edu.uci.ics.hyracks.algebricks.data.IPrinterFactory;
+
+public class AUnorderedlistPrinterFactory implements IPrinterFactory {
+
+    private static final long serialVersionUID = 1L;
+    private AUnorderedListType unorderedlistType;
+
+    public AUnorderedlistPrinterFactory(AUnorderedListType unorderedlistType) {
+        this.unorderedlistType = unorderedlistType;
+    }
+
+    @Override
+    public IPrinter createPrinter() {
+
+        PointableAllocator allocator = new PointableAllocator();
+        final IAType inputType = unorderedlistType == null ? DefaultOpenFieldType
+                .getDefaultOpenFieldType(ATypeTag.UNORDEREDLIST) : unorderedlistType;
+        final IVisitablePointable listAccessor = allocator.allocateListValue(inputType);
+        final APrintVisitor printVisitor = new APrintVisitor();
+        final Pair<PrintStream, ATypeTag> arg = new Pair<PrintStream, ATypeTag>(null, null);
+
+        return new IPrinter() {
+
+            @Override
+            public void init() throws AlgebricksException {
+                arg.second = inputType.getTypeTag();
+            }
+
+            @Override
+            public void print(byte[] b, int start, int l, PrintStream ps) throws AlgebricksException {
+                try {
+                    listAccessor.set(b, start, l);
+                    arg.first = ps;
+                    listAccessor.accept(printVisitor, arg);
+                } catch (Exception ioe) {
+                    throw new AlgebricksException(ioe);
+                }
+            }
+        };
+    }
+}
diff --git a/asterix-om/src/main/java/edu/uci/ics/asterix/dataflow/data/nontagged/printers/cleanjson/AYearMonthDurationPrinter.java b/asterix-om/src/main/java/edu/uci/ics/asterix/dataflow/data/nontagged/printers/cleanjson/AYearMonthDurationPrinter.java
new file mode 100644
index 0000000..c543f27
--- /dev/null
+++ b/asterix-om/src/main/java/edu/uci/ics/asterix/dataflow/data/nontagged/printers/cleanjson/AYearMonthDurationPrinter.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.cleanjson;
+
+import java.io.PrintStream;
+
+import edu.uci.ics.asterix.dataflow.data.nontagged.serde.AInt32SerializerDeserializer;
+import edu.uci.ics.hyracks.algebricks.common.exceptions.AlgebricksException;
+import edu.uci.ics.hyracks.algebricks.data.IPrinter;
+
+public class AYearMonthDurationPrinter implements IPrinter {
+
+    public static final AYearMonthDurationPrinter INSTANCE = new AYearMonthDurationPrinter();
+
+    /* (non-Javadoc)
+     * @see edu.uci.ics.hyracks.algebricks.data.IPrinter#init()
+     */
+    @Override
+    public void init() throws AlgebricksException {
+    }
+
+    /* (non-Javadoc)
+     * @see edu.uci.ics.hyracks.algebricks.data.IPrinter#print(byte[], int, int, java.io.PrintStream)
+     */
+    @Override
+    public void print(byte[] b, int s, int l, PrintStream ps) throws AlgebricksException {
+
+        int months = AInt32SerializerDeserializer.getInt(b, s + 1);
+
+        ps.print("{ \"year-month-duration\": ");
+        ps.print(months);
+        ps.print("}");
+    }
+
+}
diff --git a/asterix-om/src/main/java/edu/uci/ics/asterix/dataflow/data/nontagged/printers/cleanjson/AYearMonthDurationPrinterFactory.java b/asterix-om/src/main/java/edu/uci/ics/asterix/dataflow/data/nontagged/printers/cleanjson/AYearMonthDurationPrinterFactory.java
new file mode 100644
index 0000000..5d9687b
--- /dev/null
+++ b/asterix-om/src/main/java/edu/uci/ics/asterix/dataflow/data/nontagged/printers/cleanjson/AYearMonthDurationPrinterFactory.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.hyracks.algebricks.data.IPrinter;
+import edu.uci.ics.hyracks.algebricks.data.IPrinterFactory;
+
+public class AYearMonthDurationPrinterFactory implements IPrinterFactory {
+
+    private static final long serialVersionUID = 1L;
+    public static final AYearMonthDurationPrinterFactory INSTANCE = new AYearMonthDurationPrinterFactory();
+
+    /* (non-Javadoc)
+     * @see edu.uci.ics.hyracks.algebricks.data.IPrinterFactory#createPrinter()
+     */
+    @Override
+    public IPrinter createPrinter() {
+        return AYearMonthDurationPrinter.INSTANCE;
+    }
+
+}
diff --git a/asterix-om/src/main/java/edu/uci/ics/asterix/formats/base/IDataFormat.java b/asterix-om/src/main/java/edu/uci/ics/asterix/formats/base/IDataFormat.java
index 9427cc8..2ea4198 100644
--- a/asterix-om/src/main/java/edu/uci/ics/asterix/formats/base/IDataFormat.java
+++ b/asterix-om/src/main/java/edu/uci/ics/asterix/formats/base/IDataFormat.java
@@ -63,6 +63,8 @@
 
     public IPrinterFactoryProvider getCSVPrinterFactoryProvider();
 
+    public IPrinterFactoryProvider getCleanJSONPrinterFactoryProvider();
+
     public INullWriterFactory getNullWriterFactory();
 
     public Triple<ICopyEvaluatorFactory, ScalarFunctionCallExpression, IAType> partitioningEvaluatorFactory(
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
new file mode 100644
index 0000000..faca078
--- /dev/null
+++ b/asterix-om/src/main/java/edu/uci/ics/asterix/formats/nontagged/AqlCleanJSONPrinterFactoryProvider.java
@@ -0,0 +1,150 @@
+/*
+ * 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.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.ABooleanPrinterFactory;
+import edu.uci.ics.asterix.dataflow.data.nontagged.printers.cleanjson.ACirclePrinterFactory;
+import edu.uci.ics.asterix.dataflow.data.nontagged.printers.cleanjson.ADatePrinterFactory;
+import edu.uci.ics.asterix.dataflow.data.nontagged.printers.cleanjson.ADateTimePrinterFactory;
+import edu.uci.ics.asterix.dataflow.data.nontagged.printers.cleanjson.ADayTimeDurationPrinterFactory;
+import edu.uci.ics.asterix.dataflow.data.nontagged.printers.cleanjson.ADoublePrinterFactory;
+import edu.uci.ics.asterix.dataflow.data.nontagged.printers.cleanjson.ADurationPrinterFactory;
+import edu.uci.ics.asterix.dataflow.data.nontagged.printers.cleanjson.AFloatPrinterFactory;
+import edu.uci.ics.asterix.dataflow.data.nontagged.printers.cleanjson.AInt16PrinterFactory;
+import edu.uci.ics.asterix.dataflow.data.nontagged.printers.cleanjson.AInt32PrinterFactory;
+import edu.uci.ics.asterix.dataflow.data.nontagged.printers.cleanjson.AInt64PrinterFactory;
+import edu.uci.ics.asterix.dataflow.data.nontagged.printers.cleanjson.AInt8PrinterFactory;
+import edu.uci.ics.asterix.dataflow.data.nontagged.printers.cleanjson.AIntervalPrinterFactory;
+import edu.uci.ics.asterix.dataflow.data.nontagged.printers.cleanjson.ALinePrinterFactory;
+import edu.uci.ics.asterix.dataflow.data.nontagged.printers.cleanjson.ANullPrinterFactory;
+import edu.uci.ics.asterix.dataflow.data.nontagged.printers.cleanjson.ANullableFieldPrinterFactory;
+import edu.uci.ics.asterix.dataflow.data.nontagged.printers.cleanjson.AObjectPrinterFactory;
+import edu.uci.ics.asterix.dataflow.data.nontagged.printers.cleanjson.AOrderedlistPrinterFactory;
+import edu.uci.ics.asterix.dataflow.data.nontagged.printers.cleanjson.APoint3DPrinterFactory;
+import edu.uci.ics.asterix.dataflow.data.nontagged.printers.cleanjson.APointPrinterFactory;
+import edu.uci.ics.asterix.dataflow.data.nontagged.printers.cleanjson.APolygonPrinterFactory;
+import edu.uci.ics.asterix.dataflow.data.nontagged.printers.cleanjson.ARecordPrinterFactory;
+import edu.uci.ics.asterix.dataflow.data.nontagged.printers.cleanjson.ARectanglePrinterFactory;
+import edu.uci.ics.asterix.dataflow.data.nontagged.printers.cleanjson.AStringPrinterFactory;
+import edu.uci.ics.asterix.dataflow.data.nontagged.printers.cleanjson.ATimePrinterFactory;
+import edu.uci.ics.asterix.dataflow.data.nontagged.printers.cleanjson.AUnionPrinterFactory;
+import edu.uci.ics.asterix.dataflow.data.nontagged.printers.cleanjson.AUnorderedlistPrinterFactory;
+import edu.uci.ics.asterix.dataflow.data.nontagged.printers.cleanjson.AYearMonthDurationPrinterFactory;
+import edu.uci.ics.asterix.om.types.AOrderedListType;
+import edu.uci.ics.asterix.om.types.ARecordType;
+import edu.uci.ics.asterix.om.types.AUnionType;
+import edu.uci.ics.asterix.om.types.AUnorderedListType;
+import edu.uci.ics.asterix.om.types.IAType;
+import edu.uci.ics.hyracks.algebricks.common.exceptions.AlgebricksException;
+import edu.uci.ics.hyracks.algebricks.data.IPrinterFactory;
+import edu.uci.ics.hyracks.algebricks.data.IPrinterFactoryProvider;
+
+public class AqlCleanJSONPrinterFactoryProvider implements IPrinterFactoryProvider {
+
+    public static final AqlCleanJSONPrinterFactoryProvider INSTANCE = new AqlCleanJSONPrinterFactoryProvider();
+
+    private AqlCleanJSONPrinterFactoryProvider() {
+    }
+
+    @Override
+    public IPrinterFactory getPrinterFactory(Object type) throws AlgebricksException {
+        IAType aqlType = (IAType) type;
+
+        if (aqlType != null) {
+            switch (aqlType.getTypeTag()) {
+                case INT8:
+                    return AInt8PrinterFactory.INSTANCE;
+                case INT16:
+                    return AInt16PrinterFactory.INSTANCE;
+                case INT32:
+                    return AInt32PrinterFactory.INSTANCE;
+                case INT64:
+                    return AInt64PrinterFactory.INSTANCE;
+                case NULL:
+                    return ANullPrinterFactory.INSTANCE;
+                case BOOLEAN:
+                    return ABooleanPrinterFactory.INSTANCE;
+                case FLOAT:
+                    return AFloatPrinterFactory.INSTANCE;
+                case DOUBLE:
+                    return ADoublePrinterFactory.INSTANCE;
+                case TIME:
+                    return ATimePrinterFactory.INSTANCE;
+                case DATE:
+                    return ADatePrinterFactory.INSTANCE;
+                case DATETIME:
+                    return ADateTimePrinterFactory.INSTANCE;
+                case DURATION:
+                    return ADurationPrinterFactory.INSTANCE;
+                case YEARMONTHDURATION:
+                    return AYearMonthDurationPrinterFactory.INSTANCE;
+                case DAYTIMEDURATION:
+                    return ADayTimeDurationPrinterFactory.INSTANCE;
+                case INTERVAL:
+                    return AIntervalPrinterFactory.INSTANCE;
+                case POINT:
+                    return APointPrinterFactory.INSTANCE;
+                case POINT3D:
+                    return APoint3DPrinterFactory.INSTANCE;
+                case LINE:
+                    return ALinePrinterFactory.INSTANCE;
+                case POLYGON:
+                    return APolygonPrinterFactory.INSTANCE;
+                case CIRCLE:
+                    return ACirclePrinterFactory.INSTANCE;
+                case RECTANGLE:
+                    return ARectanglePrinterFactory.INSTANCE;
+                case STRING:
+                    return AStringPrinterFactory.INSTANCE;
+                case BINARY:
+                    return ABinaryPrinterFactory.INSTANCE;
+                case RECORD:
+                    return new ARecordPrinterFactory((ARecordType) aqlType);
+                case ORDEREDLIST:
+                    return new AOrderedlistPrinterFactory((AOrderedListType) aqlType);
+                case UNORDEREDLIST:
+                    return new AUnorderedlistPrinterFactory((AUnorderedListType) aqlType);
+                case UNION: {
+                    if (((AUnionType) aqlType).isNullableType())
+                        return new ANullableFieldPrinterFactory((AUnionType) aqlType);
+                    else
+                        return new AUnionPrinterFactory((AUnionType) aqlType);
+                }
+                case UUID: {
+                    return AUUIDPrinterFactory.INSTANCE;
+                }
+                case SHORTWITHOUTTYPEINFO:
+                    return ShortWithoutTypeInfoPrinterFactory.INSTANCE;
+                case ANY:
+                case BITARRAY:
+                case ENUM:
+                case SPARSERECORD:
+                case SYSTEM_NULL:
+                case TYPE:
+                case UINT16:
+                case UINT32:
+                case UINT64:
+                case UINT8:
+                case UUID_STRING:
+                    // These types are not intended to be printed to the user.
+                    break;
+            }
+        }
+        return AObjectPrinterFactory.INSTANCE;
+    }
+}
diff --git a/asterix-om/src/main/java/edu/uci/ics/asterix/om/pointables/printer/cleanjson/AListPrinter.java b/asterix-om/src/main/java/edu/uci/ics/asterix/om/pointables/printer/cleanjson/AListPrinter.java
new file mode 100644
index 0000000..943388d
--- /dev/null
+++ b/asterix-om/src/main/java/edu/uci/ics/asterix/om/pointables/printer/cleanjson/AListPrinter.java
@@ -0,0 +1,77 @@
+/*
+ * 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.om.pointables.printer.cleanjson;
+
+import java.io.IOException;
+import java.io.PrintStream;
+import java.util.List;
+
+import edu.uci.ics.asterix.common.exceptions.AsterixException;
+import edu.uci.ics.asterix.om.pointables.AListVisitablePointable;
+import edu.uci.ics.asterix.om.pointables.base.IVisitablePointable;
+import edu.uci.ics.asterix.om.types.ATypeTag;
+import edu.uci.ics.asterix.om.types.EnumDeserializer;
+import edu.uci.ics.hyracks.algebricks.common.utils.Pair;
+
+/**
+ * This class is to print the content of a list. It is ONLY visible to
+ * APrintVisitor.
+ */
+class AListPrinter {
+    private static String BEGIN = "[ ";
+    private static String END = " ]";
+    private static String COMMA = ", ";
+
+    private final Pair<PrintStream, ATypeTag> itemVisitorArg = new Pair<PrintStream, ATypeTag>(null, null);
+
+    public AListPrinter(boolean ordered) {
+    }
+
+    public void printList(AListVisitablePointable listAccessor, PrintStream ps, APrintVisitor visitor) throws IOException,
+            AsterixException {
+        List<IVisitablePointable> itemTags = listAccessor.getItemTags();
+        List<IVisitablePointable> items = listAccessor.getItems();
+        itemVisitorArg.first = ps;
+
+        // print the beginning part
+        ps.print(BEGIN);
+
+        // print item 0 to n-2
+        for (int i = 0; i < items.size() - 1; i++) {
+            printItem(visitor, itemTags, items, i);
+            // print the comma
+            ps.print(COMMA);
+        }
+
+        // print item n-1
+        if (items.size() > 0) {
+            printItem(visitor, itemTags, items, items.size() - 1);
+        }
+
+        // print the end part
+        ps.print(END);
+    }
+
+    private void printItem(APrintVisitor visitor, List<IVisitablePointable> itemTags, List<IVisitablePointable> items,
+            int i) throws AsterixException {
+        IVisitablePointable itemTypeTag = itemTags.get(i);
+        IVisitablePointable item = items.get(i);
+        ATypeTag typeTag = EnumDeserializer.ATYPETAGDESERIALIZER.deserialize(itemTypeTag.getByteArray()[itemTypeTag
+                .getStartOffset()]);
+        itemVisitorArg.second = item.getLength() <= 1 ? ATypeTag.NULL : typeTag;
+        item.accept(visitor, itemVisitorArg);
+    }
+}
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
new file mode 100644
index 0000000..6c2c7d1
--- /dev/null
+++ b/asterix-om/src/main/java/edu/uci/ics/asterix/om/pointables/printer/cleanjson/APrintVisitor.java
@@ -0,0 +1,210 @@
+/*
+ * 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.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;
+import edu.uci.ics.asterix.dataflow.data.nontagged.printers.cleanjson.ADatePrinter;
+import edu.uci.ics.asterix.dataflow.data.nontagged.printers.cleanjson.ADateTimePrinter;
+import edu.uci.ics.asterix.dataflow.data.nontagged.printers.cleanjson.ADayTimeDurationPrinter;
+import edu.uci.ics.asterix.dataflow.data.nontagged.printers.cleanjson.ADoublePrinter;
+import edu.uci.ics.asterix.dataflow.data.nontagged.printers.cleanjson.ADurationPrinter;
+import edu.uci.ics.asterix.dataflow.data.nontagged.printers.cleanjson.AFloatPrinter;
+import edu.uci.ics.asterix.dataflow.data.nontagged.printers.cleanjson.AInt16Printer;
+import edu.uci.ics.asterix.dataflow.data.nontagged.printers.cleanjson.AInt32Printer;
+import edu.uci.ics.asterix.dataflow.data.nontagged.printers.cleanjson.AInt64Printer;
+import edu.uci.ics.asterix.dataflow.data.nontagged.printers.cleanjson.AInt8Printer;
+import edu.uci.ics.asterix.dataflow.data.nontagged.printers.cleanjson.ALinePrinter;
+import edu.uci.ics.asterix.dataflow.data.nontagged.printers.cleanjson.ANullPrinter;
+import edu.uci.ics.asterix.dataflow.data.nontagged.printers.cleanjson.APoint3DPrinter;
+import edu.uci.ics.asterix.dataflow.data.nontagged.printers.cleanjson.APointPrinter;
+import edu.uci.ics.asterix.dataflow.data.nontagged.printers.cleanjson.APolygonPrinter;
+import edu.uci.ics.asterix.dataflow.data.nontagged.printers.cleanjson.ARectanglePrinter;
+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.om.pointables.AFlatValuePointable;
+import edu.uci.ics.asterix.om.pointables.AListVisitablePointable;
+import edu.uci.ics.asterix.om.pointables.ARecordVisitablePointable;
+import edu.uci.ics.asterix.om.pointables.base.IVisitablePointable;
+import edu.uci.ics.asterix.om.pointables.visitor.IVisitablePointableVisitor;
+import edu.uci.ics.asterix.om.types.ATypeTag;
+import edu.uci.ics.hyracks.algebricks.common.exceptions.NotImplementedException;
+import edu.uci.ics.hyracks.algebricks.common.utils.Pair;
+
+/**
+ * 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
+ * PrintStream in Clean JSON format.
+ */
+public class APrintVisitor implements IVisitablePointableVisitor<Void, Pair<PrintStream, ATypeTag>> {
+
+    private final Map<IVisitablePointable, ARecordPrinter> raccessorToPrinter = new HashMap<IVisitablePointable, ARecordPrinter>();
+    private final Map<IVisitablePointable, AListPrinter> laccessorToPrinter = new HashMap<IVisitablePointable, AListPrinter>();
+
+    @Override
+    public Void visit(AListVisitablePointable accessor, Pair<PrintStream, ATypeTag> arg) throws AsterixException {
+        AListPrinter printer = laccessorToPrinter.get(accessor);
+        if (printer == null) {
+            printer = new AListPrinter(accessor.ordered());
+            laccessorToPrinter.put(accessor, printer);
+        }
+        try {
+            printer.printList(accessor, arg.first, this);
+        } catch (Exception e) {
+            throw new AsterixException(e);
+        }
+        return null;
+    }
+
+    @Override
+    public Void visit(ARecordVisitablePointable accessor, Pair<PrintStream, ATypeTag> arg) throws AsterixException {
+        ARecordPrinter printer = raccessorToPrinter.get(accessor);
+        if (printer == null) {
+            printer = new ARecordPrinter();
+            raccessorToPrinter.put(accessor, printer);
+        }
+        try {
+            printer.printRecord(accessor, arg.first, this);
+        } catch (Exception e) {
+            throw new AsterixException(e);
+        }
+        return null;
+    }
+
+    @Override
+    public Void visit(AFlatValuePointable accessor, Pair<PrintStream, ATypeTag> arg) {
+        try {
+            byte[] b = accessor.getByteArray();
+            int s = accessor.getStartOffset();
+            int l = accessor.getLength();
+            PrintStream ps = arg.first;
+            ATypeTag typeTag = arg.second;
+            switch (typeTag) {
+                case INT8: {
+                    AInt8Printer.INSTANCE.print(b, s, l, ps);
+                    break;
+                }
+                case INT16: {
+                    AInt16Printer.INSTANCE.print(b, s, l, ps);
+                    break;
+                }
+                case INT32: {
+                    AInt32Printer.INSTANCE.print(b, s, l, ps);
+                    break;
+                }
+                case INT64: {
+                    AInt64Printer.INSTANCE.print(b, s, l, ps);
+                    break;
+                }
+                case NULL: {
+                    ANullPrinter.INSTANCE.print(b, s, l, ps);
+                    break;
+                }
+                case BOOLEAN: {
+                    ABooleanPrinter.INSTANCE.print(b, s, l, ps);
+                    break;
+                }
+                case FLOAT: {
+                    AFloatPrinter.INSTANCE.print(b, s, l, ps);
+                    break;
+                }
+                case DOUBLE: {
+                    ADoublePrinter.INSTANCE.print(b, s, l, ps);
+                    break;
+                }
+                case DATE: {
+                    ADatePrinter.INSTANCE.print(b, s, l, ps);
+                    break;
+                }
+                case TIME: {
+                    ATimePrinter.INSTANCE.print(b, s, l, ps);
+                    break;
+                }
+                case DATETIME: {
+                    ADateTimePrinter.INSTANCE.print(b, s, l, ps);
+                    break;
+                }
+                case DURATION: {
+                    ADurationPrinter.INSTANCE.print(b, s, l, ps);
+                    break;
+                }
+                case POINT: {
+                    APointPrinter.INSTANCE.print(b, s, l, ps);
+                    break;
+                }
+                case POINT3D: {
+                    APoint3DPrinter.INSTANCE.print(b, s, l, ps);
+                    break;
+                }
+                case LINE: {
+                    ALinePrinter.INSTANCE.print(b, s, l, ps);
+                    break;
+                }
+                case POLYGON: {
+                    APolygonPrinter.INSTANCE.print(b, s, l, ps);
+                    break;
+                }
+                case CIRCLE: {
+                    ACirclePrinter.INSTANCE.print(b, s, l, ps);
+                    break;
+                }
+                case RECTANGLE: {
+                    ARectanglePrinter.INSTANCE.print(b, s, l, ps);
+                    break;
+                }
+                case STRING: {
+                    AStringPrinter.INSTANCE.print(b, s, l, ps);
+                    break;
+                }
+                case BINARY: {
+                    ABinaryHexPrinter.INSTANCE.print(b, s, l, ps);
+                    break;
+                }
+                case YEARMONTHDURATION: {
+                    AYearMonthDurationPrinter.INSTANCE.print(b, s, l, ps);
+                    break;
+                }
+                case DAYTIMEDURATION: {
+                    ADayTimeDurationPrinter.INSTANCE.print(b, s, l, ps);
+                    break;
+                }
+                case UUID: {
+                    AUUIDPrinter.INSTANCE.print(b, s, l, ps);
+                    break;
+                }
+                case SHORTWITHOUTTYPEINFO: {
+                    ShortWithoutTypeInfoPrinter.INSTANCE.print(b, s, l, ps);
+                    break;
+                }
+                default: {
+                    throw new NotImplementedException("No printer for type " + typeTag);
+                }
+            }
+            return null;
+        } catch (Exception e) {
+            throw new IllegalStateException(e);
+        }
+    }
+}
diff --git a/asterix-om/src/main/java/edu/uci/ics/asterix/om/pointables/printer/cleanjson/ARecordPrinter.java b/asterix-om/src/main/java/edu/uci/ics/asterix/om/pointables/printer/cleanjson/ARecordPrinter.java
new file mode 100644
index 0000000..cfbcf28
--- /dev/null
+++ b/asterix-om/src/main/java/edu/uci/ics/asterix/om/pointables/printer/cleanjson/ARecordPrinter.java
@@ -0,0 +1,88 @@
+/*
+ * 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.om.pointables.printer.cleanjson;
+
+import java.io.IOException;
+import java.io.PrintStream;
+import java.util.List;
+
+import edu.uci.ics.asterix.common.exceptions.AsterixException;
+import edu.uci.ics.asterix.om.pointables.ARecordVisitablePointable;
+import edu.uci.ics.asterix.om.pointables.base.IVisitablePointable;
+import edu.uci.ics.asterix.om.types.ATypeTag;
+import edu.uci.ics.asterix.om.types.EnumDeserializer;
+import edu.uci.ics.hyracks.algebricks.common.utils.Pair;
+
+/**
+ * This class is to print the content of a record. It is ONLY visible to
+ * APrintVisitor.
+ */
+class ARecordPrinter {
+    private static String LEFT_PAREN = "{ ";
+    private static String RIGHT_PAREN = " }";
+    private static String COMMA = ", ";
+    private static String COLON = ": ";
+
+    private final Pair<PrintStream, ATypeTag> nameVisitorArg = new Pair<PrintStream, ATypeTag>(null, ATypeTag.STRING);
+    private final Pair<PrintStream, ATypeTag> itemVisitorArg = new Pair<PrintStream, ATypeTag>(null, null);
+
+    public ARecordPrinter() {
+
+    }
+
+    public void printRecord(ARecordVisitablePointable recordAccessor, PrintStream ps, APrintVisitor visitor) throws IOException,
+            AsterixException {
+        List<IVisitablePointable> fieldNames = recordAccessor.getFieldNames();
+        List<IVisitablePointable> fieldTags = recordAccessor.getFieldTypeTags();
+        List<IVisitablePointable> fieldValues = recordAccessor.getFieldValues();
+
+        nameVisitorArg.first = ps;
+        itemVisitorArg.first = ps;
+
+        // print the beginning part
+        ps.print(LEFT_PAREN);
+
+        // print field 0 to n-2
+        for (int i = 0; i < fieldNames.size() - 1; i++) {
+            printField(ps, visitor, fieldNames, fieldTags, fieldValues, i);
+            // print the comma
+            ps.print(COMMA);
+        }
+
+        // print field n-1
+        if (fieldValues.size() > 0) {
+            printField(ps, visitor, fieldNames, fieldTags, fieldValues, fieldValues.size() - 1);
+        }
+
+        // print the end part
+        ps.print(RIGHT_PAREN);
+    }
+
+    private void printField(PrintStream ps, APrintVisitor visitor, List<IVisitablePointable> fieldNames,
+            List<IVisitablePointable> fieldTags, List<IVisitablePointable> fieldValues, int i) throws AsterixException {
+        IVisitablePointable itemTypeTag = fieldTags.get(i);
+        IVisitablePointable item = fieldValues.get(i);
+        ATypeTag typeTag = EnumDeserializer.ATYPETAGDESERIALIZER.deserialize(itemTypeTag.getByteArray()[itemTypeTag
+                .getStartOffset()]);
+        itemVisitorArg.second = item.getLength() <= 1 ? ATypeTag.NULL : typeTag;
+
+        // print field name
+        fieldNames.get(i).accept(visitor, nameVisitorArg);
+        ps.print(COLON);
+        // print field value
+        item.accept(visitor, itemVisitorArg);
+    }
+}
diff --git a/asterix-runtime/src/main/java/edu/uci/ics/asterix/runtime/formats/NonTaggedDataFormat.java b/asterix-runtime/src/main/java/edu/uci/ics/asterix/runtime/formats/NonTaggedDataFormat.java
index ef4b360..4c82462 100644
--- a/asterix-runtime/src/main/java/edu/uci/ics/asterix/runtime/formats/NonTaggedDataFormat.java
+++ b/asterix-runtime/src/main/java/edu/uci/ics/asterix/runtime/formats/NonTaggedDataFormat.java
@@ -25,6 +25,7 @@
 import edu.uci.ics.asterix.formats.nontagged.AqlBinaryHashFunctionFamilyProvider;
 import edu.uci.ics.asterix.formats.nontagged.AqlBinaryIntegerInspector;
 import edu.uci.ics.asterix.formats.nontagged.AqlCSVPrinterFactoryProvider;
+import edu.uci.ics.asterix.formats.nontagged.AqlCleanJSONPrinterFactoryProvider;
 import edu.uci.ics.asterix.formats.nontagged.AqlJSONPrinterFactoryProvider;
 import edu.uci.ics.asterix.formats.nontagged.AqlNormalizedKeyComputerFactoryProvider;
 import edu.uci.ics.asterix.formats.nontagged.AqlPredicateEvaluatorFactoryProvider;
@@ -1059,6 +1060,11 @@
     }
 
     @Override
+    public IPrinterFactoryProvider getCleanJSONPrinterFactoryProvider() {
+        return AqlCleanJSONPrinterFactoryProvider.INSTANCE;
+    }
+
+    @Override
     public IPrinterFactoryProvider getCSVPrinterFactoryProvider() {
         return AqlCSVPrinterFactoryProvider.INSTANCE;
     }
diff --git a/asterix-test-framework/src/main/java/edu/uci/ics/asterix/testframework/context/TestCaseContext.java b/asterix-test-framework/src/main/java/edu/uci/ics/asterix/testframework/context/TestCaseContext.java
index 3167a17..818b06a 100644
--- a/asterix-test-framework/src/main/java/edu/uci/ics/asterix/testframework/context/TestCaseContext.java
+++ b/asterix-test-framework/src/main/java/edu/uci/ics/asterix/testframework/context/TestCaseContext.java
@@ -36,6 +36,7 @@
         NONE  ("", ""),
         ADM   ("adm", "application/x-adm"),
         JSON  ("json", "application/json"),
+        CLEAN_JSON ("json", "application/json; clean=true"),
         CSV   ("csv", "text/csv"),
         CSV_HEADER ("csv-header", "text/csv; header=present");
 
@@ -61,6 +62,8 @@
                 return OutputFormat.ADM;
             case JSON:
                 return OutputFormat.JSON;
+            case CLEAN_JSON:
+                return OutputFormat.CLEAN_JSON;
             case CSV:
                 return OutputFormat.CSV;
             case CSV_HEADER:
diff --git a/asterix-test-framework/src/main/resources/Catalog.xsd b/asterix-test-framework/src/main/resources/Catalog.xsd
index 65ba7a4..a083f75 100644
--- a/asterix-test-framework/src/main/resources/Catalog.xsd
+++ b/asterix-test-framework/src/main/resources/Catalog.xsd
@@ -187,6 +187,7 @@
          <xs:enumeration value="Inspect"/>
          <xs:enumeration value="Ignore"/>
          <xs:enumeration value="JSON"/>
+         <xs:enumeration value="Clean-JSON"/>
          <xs:enumeration value="CSV"/>
          <xs:enumeration value="CSV_Header"/>
       </xs:restriction>
@@ -217,5 +218,5 @@
          <xs:pattern value="\*|([A-Z]{4}[0-9]{4})"/>
       </xs:restriction>
    </xs:simpleType>
-   
+
 </xs:schema>

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

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

Mime
View raw message