Add JSON printer classes for each Asterix type.

git-svn-id: https://asterixdb.googlecode.com/svn/branches/asterix_stabilization_result_distribution@1232 eaa15691-b419-025a-1212-ee371bd00084
diff --git a/asterix-om/src/main/java/edu/uci/ics/asterix/dataflow/data/nontagged/printers/json/ABooleanPrinter.java b/asterix-om/src/main/java/edu/uci/ics/asterix/dataflow/data/nontagged/printers/json/ABooleanPrinter.java
new file mode 100644
index 0000000..0ae242c
--- /dev/null
+++ b/asterix-om/src/main/java/edu/uci/ics/asterix/dataflow/data/nontagged/printers/json/ABooleanPrinter.java
@@ -0,0 +1,22 @@
+package edu.uci.ics.asterix.dataflow.data.nontagged.printers.json;
+
+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/json/ABooleanPrinterFactory.java b/asterix-om/src/main/java/edu/uci/ics/asterix/dataflow/data/nontagged/printers/json/ABooleanPrinterFactory.java
new file mode 100644
index 0000000..e18072a
--- /dev/null
+++ b/asterix-om/src/main/java/edu/uci/ics/asterix/dataflow/data/nontagged/printers/json/ABooleanPrinterFactory.java
@@ -0,0 +1,16 @@
+package edu.uci.ics.asterix.dataflow.data.nontagged.printers.json;
+
+import edu.uci.ics.hyracks.algebricks.data.IPrinter;
+import edu.uci.ics.hyracks.algebricks.data.IPrinterFactory;
+
+public class 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/json/ACirclePrinter.java b/asterix-om/src/main/java/edu/uci/ics/asterix/dataflow/data/nontagged/printers/json/ACirclePrinter.java
new file mode 100644
index 0000000..7799aaf
--- /dev/null
+++ b/asterix-om/src/main/java/edu/uci/ics/asterix/dataflow/data/nontagged/printers/json/ACirclePrinter.java
@@ -0,0 +1,28 @@
+package edu.uci.ics.asterix.dataflow.data.nontagged.printers.json;
+
+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("]}]}");
+    }
+}
\ No newline at end of file
diff --git a/asterix-om/src/main/java/edu/uci/ics/asterix/dataflow/data/nontagged/printers/json/ACirclePrinterFactory.java b/asterix-om/src/main/java/edu/uci/ics/asterix/dataflow/data/nontagged/printers/json/ACirclePrinterFactory.java
new file mode 100644
index 0000000..e406a23
--- /dev/null
+++ b/asterix-om/src/main/java/edu/uci/ics/asterix/dataflow/data/nontagged/printers/json/ACirclePrinterFactory.java
@@ -0,0 +1,16 @@
+package edu.uci.ics.asterix.dataflow.data.nontagged.printers.json;
+
+import edu.uci.ics.hyracks.algebricks.data.IPrinter;
+import edu.uci.ics.hyracks.algebricks.data.IPrinterFactory;
+
+public class 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/json/ADatePrinter.java b/asterix-om/src/main/java/edu/uci/ics/asterix/dataflow/data/nontagged/printers/json/ADatePrinter.java
new file mode 100644
index 0000000..0486cf1
--- /dev/null
+++ b/asterix-om/src/main/java/edu/uci/ics/asterix/dataflow/data/nontagged/printers/json/ADatePrinter.java
@@ -0,0 +1,27 @@
+package edu.uci.ics.asterix.dataflow.data.nontagged.printers.json;
+
+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("}");
+    }
+}
\ No newline at end of file
diff --git a/asterix-om/src/main/java/edu/uci/ics/asterix/dataflow/data/nontagged/printers/json/ADatePrinterFactory.java b/asterix-om/src/main/java/edu/uci/ics/asterix/dataflow/data/nontagged/printers/json/ADatePrinterFactory.java
new file mode 100644
index 0000000..f60a25e
--- /dev/null
+++ b/asterix-om/src/main/java/edu/uci/ics/asterix/dataflow/data/nontagged/printers/json/ADatePrinterFactory.java
@@ -0,0 +1,16 @@
+package edu.uci.ics.asterix.dataflow.data.nontagged.printers.json;
+
+import edu.uci.ics.hyracks.algebricks.data.IPrinter;
+import edu.uci.ics.hyracks.algebricks.data.IPrinterFactory;
+
+public class 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/json/ADateTimePrinter.java b/asterix-om/src/main/java/edu/uci/ics/asterix/dataflow/data/nontagged/printers/json/ADateTimePrinter.java
new file mode 100644
index 0000000..4fc3589
--- /dev/null
+++ b/asterix-om/src/main/java/edu/uci/ics/asterix/dataflow/data/nontagged/printers/json/ADateTimePrinter.java
@@ -0,0 +1,26 @@
+package edu.uci.ics.asterix.dataflow.data.nontagged.printers.json;
+
+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("}");
+    }
+}
\ No newline at end of file
diff --git a/asterix-om/src/main/java/edu/uci/ics/asterix/dataflow/data/nontagged/printers/json/ADateTimePrinterFactory.java b/asterix-om/src/main/java/edu/uci/ics/asterix/dataflow/data/nontagged/printers/json/ADateTimePrinterFactory.java
new file mode 100644
index 0000000..851fb8a
--- /dev/null
+++ b/asterix-om/src/main/java/edu/uci/ics/asterix/dataflow/data/nontagged/printers/json/ADateTimePrinterFactory.java
@@ -0,0 +1,16 @@
+package edu.uci.ics.asterix.dataflow.data.nontagged.printers.json;
+
+import edu.uci.ics.hyracks.algebricks.data.IPrinter;
+import edu.uci.ics.hyracks.algebricks.data.IPrinterFactory;
+
+public class 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/json/ADoublePrinter.java b/asterix-om/src/main/java/edu/uci/ics/asterix/dataflow/data/nontagged/printers/json/ADoublePrinter.java
new file mode 100644
index 0000000..2b977a5
--- /dev/null
+++ b/asterix-om/src/main/java/edu/uci/ics/asterix/dataflow/data/nontagged/printers/json/ADoublePrinter.java
@@ -0,0 +1,22 @@
+package edu.uci.ics.asterix.dataflow.data.nontagged.printers.json;
+
+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/json/ADoublePrinterFactory.java b/asterix-om/src/main/java/edu/uci/ics/asterix/dataflow/data/nontagged/printers/json/ADoublePrinterFactory.java
new file mode 100644
index 0000000..1fdb7d7
--- /dev/null
+++ b/asterix-om/src/main/java/edu/uci/ics/asterix/dataflow/data/nontagged/printers/json/ADoublePrinterFactory.java
@@ -0,0 +1,16 @@
+package edu.uci.ics.asterix.dataflow.data.nontagged.printers.json;
+
+import edu.uci.ics.hyracks.algebricks.data.IPrinter;
+import edu.uci.ics.hyracks.algebricks.data.IPrinterFactory;
+
+public class 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/json/ADurationPrinter.java b/asterix-om/src/main/java/edu/uci/ics/asterix/dataflow/data/nontagged/printers/json/ADurationPrinter.java
new file mode 100644
index 0000000..877c00e
--- /dev/null
+++ b/asterix-om/src/main/java/edu/uci/ics/asterix/dataflow/data/nontagged/printers/json/ADurationPrinter.java
@@ -0,0 +1,31 @@
+package edu.uci.ics.asterix.dataflow.data.nontagged.printers.json;
+
+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("}}");
+    }
+}
\ No newline at end of file
diff --git a/asterix-om/src/main/java/edu/uci/ics/asterix/dataflow/data/nontagged/printers/json/ADurationPrinterFactory.java b/asterix-om/src/main/java/edu/uci/ics/asterix/dataflow/data/nontagged/printers/json/ADurationPrinterFactory.java
new file mode 100644
index 0000000..c0b68db
--- /dev/null
+++ b/asterix-om/src/main/java/edu/uci/ics/asterix/dataflow/data/nontagged/printers/json/ADurationPrinterFactory.java
@@ -0,0 +1,16 @@
+package edu.uci.ics.asterix.dataflow.data.nontagged.printers.json;
+
+import edu.uci.ics.hyracks.algebricks.data.IPrinter;
+import edu.uci.ics.hyracks.algebricks.data.IPrinterFactory;
+
+public class 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/json/AFloatPrinter.java b/asterix-om/src/main/java/edu/uci/ics/asterix/dataflow/data/nontagged/printers/json/AFloatPrinter.java
new file mode 100644
index 0000000..a941043
--- /dev/null
+++ b/asterix-om/src/main/java/edu/uci/ics/asterix/dataflow/data/nontagged/printers/json/AFloatPrinter.java
@@ -0,0 +1,22 @@
+package edu.uci.ics.asterix.dataflow.data.nontagged.printers.json;
+
+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/json/AFloatPrinterFactory.java b/asterix-om/src/main/java/edu/uci/ics/asterix/dataflow/data/nontagged/printers/json/AFloatPrinterFactory.java
new file mode 100644
index 0000000..5285daa
--- /dev/null
+++ b/asterix-om/src/main/java/edu/uci/ics/asterix/dataflow/data/nontagged/printers/json/AFloatPrinterFactory.java
@@ -0,0 +1,18 @@
+package edu.uci.ics.asterix.dataflow.data.nontagged.printers.json;
+
+import edu.uci.ics.hyracks.algebricks.data.IPrinter;
+import edu.uci.ics.hyracks.algebricks.data.IPrinterFactory;
+
+
+
+public class 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/json/AInt16Printer.java b/asterix-om/src/main/java/edu/uci/ics/asterix/dataflow/data/nontagged/printers/json/AInt16Printer.java
new file mode 100644
index 0000000..03dfcdc
--- /dev/null
+++ b/asterix-om/src/main/java/edu/uci/ics/asterix/dataflow/data/nontagged/printers/json/AInt16Printer.java
@@ -0,0 +1,25 @@
+package edu.uci.ics.asterix.dataflow.data.nontagged.printers.json;
+
+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("}");
+    }
+}
\ No newline at end of file
diff --git a/asterix-om/src/main/java/edu/uci/ics/asterix/dataflow/data/nontagged/printers/json/AInt16PrinterFactory.java b/asterix-om/src/main/java/edu/uci/ics/asterix/dataflow/data/nontagged/printers/json/AInt16PrinterFactory.java
new file mode 100644
index 0000000..c890b19
--- /dev/null
+++ b/asterix-om/src/main/java/edu/uci/ics/asterix/dataflow/data/nontagged/printers/json/AInt16PrinterFactory.java
@@ -0,0 +1,18 @@
+package edu.uci.ics.asterix.dataflow.data.nontagged.printers.json;
+
+import edu.uci.ics.hyracks.algebricks.data.IPrinter;
+import edu.uci.ics.hyracks.algebricks.data.IPrinterFactory;
+
+
+
+public class 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/json/AInt32Printer.java b/asterix-om/src/main/java/edu/uci/ics/asterix/dataflow/data/nontagged/printers/json/AInt32Printer.java
new file mode 100644
index 0000000..9c3cf42
--- /dev/null
+++ b/asterix-om/src/main/java/edu/uci/ics/asterix/dataflow/data/nontagged/printers/json/AInt32Printer.java
@@ -0,0 +1,26 @@
+package edu.uci.ics.asterix.dataflow.data.nontagged.printers.json;
+
+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("}");
+    }
+}
\ No newline at end of file
diff --git a/asterix-om/src/main/java/edu/uci/ics/asterix/dataflow/data/nontagged/printers/json/AInt32PrinterFactory.java b/asterix-om/src/main/java/edu/uci/ics/asterix/dataflow/data/nontagged/printers/json/AInt32PrinterFactory.java
new file mode 100644
index 0000000..6026424
--- /dev/null
+++ b/asterix-om/src/main/java/edu/uci/ics/asterix/dataflow/data/nontagged/printers/json/AInt32PrinterFactory.java
@@ -0,0 +1,18 @@
+package edu.uci.ics.asterix.dataflow.data.nontagged.printers.json;
+
+import edu.uci.ics.hyracks.algebricks.data.IPrinter;
+import edu.uci.ics.hyracks.algebricks.data.IPrinterFactory;
+
+
+
+public class 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/json/AInt64Printer.java b/asterix-om/src/main/java/edu/uci/ics/asterix/dataflow/data/nontagged/printers/json/AInt64Printer.java
new file mode 100644
index 0000000..afb690e
--- /dev/null
+++ b/asterix-om/src/main/java/edu/uci/ics/asterix/dataflow/data/nontagged/printers/json/AInt64Printer.java
@@ -0,0 +1,23 @@
+package edu.uci.ics.asterix.dataflow.data.nontagged.printers.json;
+
+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("}");
+    }
+}
\ No newline at end of file
diff --git a/asterix-om/src/main/java/edu/uci/ics/asterix/dataflow/data/nontagged/printers/json/AInt64PrinterFactory.java b/asterix-om/src/main/java/edu/uci/ics/asterix/dataflow/data/nontagged/printers/json/AInt64PrinterFactory.java
new file mode 100644
index 0000000..e7e59a7
--- /dev/null
+++ b/asterix-om/src/main/java/edu/uci/ics/asterix/dataflow/data/nontagged/printers/json/AInt64PrinterFactory.java
@@ -0,0 +1,16 @@
+package edu.uci.ics.asterix.dataflow.data.nontagged.printers.json;
+
+import edu.uci.ics.hyracks.algebricks.data.IPrinter;
+import edu.uci.ics.hyracks.algebricks.data.IPrinterFactory;
+
+public class 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/json/AInt8Printer.java b/asterix-om/src/main/java/edu/uci/ics/asterix/dataflow/data/nontagged/printers/json/AInt8Printer.java
new file mode 100644
index 0000000..9890b2e
--- /dev/null
+++ b/asterix-om/src/main/java/edu/uci/ics/asterix/dataflow/data/nontagged/printers/json/AInt8Printer.java
@@ -0,0 +1,26 @@
+package edu.uci.ics.asterix.dataflow.data.nontagged.printers.json;
+
+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("}");
+    }
+}
\ No newline at end of file
diff --git a/asterix-om/src/main/java/edu/uci/ics/asterix/dataflow/data/nontagged/printers/json/AInt8PrinterFactory.java b/asterix-om/src/main/java/edu/uci/ics/asterix/dataflow/data/nontagged/printers/json/AInt8PrinterFactory.java
new file mode 100644
index 0000000..c9b1155
--- /dev/null
+++ b/asterix-om/src/main/java/edu/uci/ics/asterix/dataflow/data/nontagged/printers/json/AInt8PrinterFactory.java
@@ -0,0 +1,18 @@
+package edu.uci.ics.asterix.dataflow.data.nontagged.printers.json;
+
+import edu.uci.ics.hyracks.algebricks.data.IPrinter;
+import edu.uci.ics.hyracks.algebricks.data.IPrinterFactory;
+
+
+
+public class 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/json/ALinePrinter.java b/asterix-om/src/main/java/edu/uci/ics/asterix/dataflow/data/nontagged/printers/json/ALinePrinter.java
new file mode 100644
index 0000000..c088904
--- /dev/null
+++ b/asterix-om/src/main/java/edu/uci/ics/asterix/dataflow/data/nontagged/printers/json/ALinePrinter.java
@@ -0,0 +1,31 @@
+package edu.uci.ics.asterix.dataflow.data.nontagged.printers.json;
+
+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("]}]}");
+    }
+}
\ No newline at end of file
diff --git a/asterix-om/src/main/java/edu/uci/ics/asterix/dataflow/data/nontagged/printers/json/ALinePrinterFactory.java b/asterix-om/src/main/java/edu/uci/ics/asterix/dataflow/data/nontagged/printers/json/ALinePrinterFactory.java
new file mode 100644
index 0000000..072bdd0
--- /dev/null
+++ b/asterix-om/src/main/java/edu/uci/ics/asterix/dataflow/data/nontagged/printers/json/ALinePrinterFactory.java
@@ -0,0 +1,16 @@
+package edu.uci.ics.asterix.dataflow.data.nontagged.printers.json;
+
+import edu.uci.ics.hyracks.algebricks.data.IPrinter;
+import edu.uci.ics.hyracks.algebricks.data.IPrinterFactory;
+
+public class 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/json/ANullPrinter.java b/asterix-om/src/main/java/edu/uci/ics/asterix/dataflow/data/nontagged/printers/json/ANullPrinter.java
new file mode 100644
index 0000000..a80eec6
--- /dev/null
+++ b/asterix-om/src/main/java/edu/uci/ics/asterix/dataflow/data/nontagged/printers/json/ANullPrinter.java
@@ -0,0 +1,21 @@
+package edu.uci.ics.asterix.dataflow.data.nontagged.printers.json;
+
+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/json/ANullPrinterFactory.java b/asterix-om/src/main/java/edu/uci/ics/asterix/dataflow/data/nontagged/printers/json/ANullPrinterFactory.java
new file mode 100644
index 0000000..3184260
--- /dev/null
+++ b/asterix-om/src/main/java/edu/uci/ics/asterix/dataflow/data/nontagged/printers/json/ANullPrinterFactory.java
@@ -0,0 +1,18 @@
+package edu.uci.ics.asterix.dataflow.data.nontagged.printers.json;
+
+import edu.uci.ics.hyracks.algebricks.data.IPrinter;
+import edu.uci.ics.hyracks.algebricks.data.IPrinterFactory;
+
+
+
+public class 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/json/ANullableFieldPrinterFactory.java b/asterix-om/src/main/java/edu/uci/ics/asterix/dataflow/data/nontagged/printers/json/ANullableFieldPrinterFactory.java
new file mode 100644
index 0000000..83c7f31
--- /dev/null
+++ b/asterix-om/src/main/java/edu/uci/ics/asterix/dataflow/data/nontagged/printers/json/ANullableFieldPrinterFactory.java
@@ -0,0 +1,48 @@
+package edu.uci.ics.asterix.dataflow.data.nontagged.printers.json;
+
+import java.io.PrintStream;
+
+import edu.uci.ics.asterix.formats.nontagged.AqlPrinterFactoryProvider;
+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 = (AqlPrinterFactoryProvider.INSTANCE.getPrinterFactory(BuiltinType.ANULL)).createPrinter();
+                fieldPrinter = (AqlPrinterFactoryProvider.INSTANCE.getPrinterFactory(unionType.getUnionList().get(1)))
+                        .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/json/AObjectPrinter.java b/asterix-om/src/main/java/edu/uci/ics/asterix/dataflow/data/nontagged/printers/json/AObjectPrinter.java
new file mode 100644
index 0000000..29c4ee1
--- /dev/null
+++ b/asterix-om/src/main/java/edu/uci/ics/asterix/dataflow/data/nontagged/printers/json/AObjectPrinter.java
@@ -0,0 +1,120 @@
+package edu.uci.ics.asterix.dataflow.data.nontagged.printers.json;
+
+import java.io.PrintStream;
+
+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 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 STRING: {
+                AStringPrinter.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;
+            }
+            default: {
+                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/json/AObjectPrinterFactory.java b/asterix-om/src/main/java/edu/uci/ics/asterix/dataflow/data/nontagged/printers/json/AObjectPrinterFactory.java
new file mode 100644
index 0000000..1c2ba77
--- /dev/null
+++ b/asterix-om/src/main/java/edu/uci/ics/asterix/dataflow/data/nontagged/printers/json/AObjectPrinterFactory.java
@@ -0,0 +1,16 @@
+package edu.uci.ics.asterix.dataflow.data.nontagged.printers.json;
+
+import edu.uci.ics.hyracks.algebricks.data.IPrinter;
+import edu.uci.ics.hyracks.algebricks.data.IPrinterFactory;
+
+public class 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/json/AOrderedlistPrinterFactory.java b/asterix-om/src/main/java/edu/uci/ics/asterix/dataflow/data/nontagged/printers/json/AOrderedlistPrinterFactory.java
new file mode 100644
index 0000000..b95a072
--- /dev/null
+++ b/asterix-om/src/main/java/edu/uci/ics/asterix/dataflow/data/nontagged/printers/json/AOrderedlistPrinterFactory.java
@@ -0,0 +1,55 @@
+package edu.uci.ics.asterix.dataflow.data.nontagged.printers.json;
+
+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.json.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/json/APoint3DPrinter.java b/asterix-om/src/main/java/edu/uci/ics/asterix/dataflow/data/nontagged/printers/json/APoint3DPrinter.java
new file mode 100644
index 0000000..873ee61
--- /dev/null
+++ b/asterix-om/src/main/java/edu/uci/ics/asterix/dataflow/data/nontagged/printers/json/APoint3DPrinter.java
@@ -0,0 +1,28 @@
+package edu.uci.ics.asterix.dataflow.data.nontagged.printers.json;
+
+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("]}");
+    }
+}
\ No newline at end of file
diff --git a/asterix-om/src/main/java/edu/uci/ics/asterix/dataflow/data/nontagged/printers/json/APoint3DPrinterFactory.java b/asterix-om/src/main/java/edu/uci/ics/asterix/dataflow/data/nontagged/printers/json/APoint3DPrinterFactory.java
new file mode 100644
index 0000000..7105ad3
--- /dev/null
+++ b/asterix-om/src/main/java/edu/uci/ics/asterix/dataflow/data/nontagged/printers/json/APoint3DPrinterFactory.java
@@ -0,0 +1,16 @@
+package edu.uci.ics.asterix.dataflow.data.nontagged.printers.json;
+
+import edu.uci.ics.hyracks.algebricks.data.IPrinter;
+import edu.uci.ics.hyracks.algebricks.data.IPrinterFactory;
+
+public class 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/json/APointPrinter.java b/asterix-om/src/main/java/edu/uci/ics/asterix/dataflow/data/nontagged/printers/json/APointPrinter.java
new file mode 100644
index 0000000..aad4758
--- /dev/null
+++ b/asterix-om/src/main/java/edu/uci/ics/asterix/dataflow/data/nontagged/printers/json/APointPrinter.java
@@ -0,0 +1,26 @@
+package edu.uci.ics.asterix.dataflow.data.nontagged.printers.json;
+
+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("]}");
+    }
+}
\ No newline at end of file
diff --git a/asterix-om/src/main/java/edu/uci/ics/asterix/dataflow/data/nontagged/printers/json/APointPrinterFactory.java b/asterix-om/src/main/java/edu/uci/ics/asterix/dataflow/data/nontagged/printers/json/APointPrinterFactory.java
new file mode 100644
index 0000000..36a9bf3
--- /dev/null
+++ b/asterix-om/src/main/java/edu/uci/ics/asterix/dataflow/data/nontagged/printers/json/APointPrinterFactory.java
@@ -0,0 +1,17 @@
+package edu.uci.ics.asterix.dataflow.data.nontagged.printers.json;
+
+import edu.uci.ics.hyracks.algebricks.data.IPrinter;
+import edu.uci.ics.hyracks.algebricks.data.IPrinterFactory;
+
+
+public class 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/json/APolygonPrinter.java b/asterix-om/src/main/java/edu/uci/ics/asterix/dataflow/data/nontagged/printers/json/APolygonPrinter.java
new file mode 100644
index 0000000..23eef9d
--- /dev/null
+++ b/asterix-om/src/main/java/edu/uci/ics/asterix/dataflow/data/nontagged/printers/json/APolygonPrinter.java
@@ -0,0 +1,42 @@
+package edu.uci.ics.asterix.dataflow.data.nontagged.printers.json;
+
+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("]}");
+
+    }
+}
\ No newline at end of file
diff --git a/asterix-om/src/main/java/edu/uci/ics/asterix/dataflow/data/nontagged/printers/json/APolygonPrinterFactory.java b/asterix-om/src/main/java/edu/uci/ics/asterix/dataflow/data/nontagged/printers/json/APolygonPrinterFactory.java
new file mode 100644
index 0000000..74c54d0
--- /dev/null
+++ b/asterix-om/src/main/java/edu/uci/ics/asterix/dataflow/data/nontagged/printers/json/APolygonPrinterFactory.java
@@ -0,0 +1,16 @@
+package edu.uci.ics.asterix.dataflow.data.nontagged.printers.json;
+
+import edu.uci.ics.hyracks.algebricks.data.IPrinter;
+import edu.uci.ics.hyracks.algebricks.data.IPrinterFactory;
+
+public class 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/json/ARecordPrinterFactory.java b/asterix-om/src/main/java/edu/uci/ics/asterix/dataflow/data/nontagged/printers/json/ARecordPrinterFactory.java
new file mode 100644
index 0000000..ca0597c
--- /dev/null
+++ b/asterix-om/src/main/java/edu/uci/ics/asterix/dataflow/data/nontagged/printers/json/ARecordPrinterFactory.java
@@ -0,0 +1,55 @@
+package edu.uci.ics.asterix.dataflow.data.nontagged.printers.json;
+
+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.json.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/json/ARectanglePrinter.java b/asterix-om/src/main/java/edu/uci/ics/asterix/dataflow/data/nontagged/printers/json/ARectanglePrinter.java
new file mode 100644
index 0000000..e54b73b
--- /dev/null
+++ b/asterix-om/src/main/java/edu/uci/ics/asterix/dataflow/data/nontagged/printers/json/ARectanglePrinter.java
@@ -0,0 +1,31 @@
+package edu.uci.ics.asterix.dataflow.data.nontagged.printers.json;
+
+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("]}]}");
+    }
+}
\ No newline at end of file
diff --git a/asterix-om/src/main/java/edu/uci/ics/asterix/dataflow/data/nontagged/printers/json/ARectanglePrinterFactory.java b/asterix-om/src/main/java/edu/uci/ics/asterix/dataflow/data/nontagged/printers/json/ARectanglePrinterFactory.java
new file mode 100644
index 0000000..51f6f21
--- /dev/null
+++ b/asterix-om/src/main/java/edu/uci/ics/asterix/dataflow/data/nontagged/printers/json/ARectanglePrinterFactory.java
@@ -0,0 +1,16 @@
+package edu.uci.ics.asterix.dataflow.data.nontagged.printers.json;
+
+import edu.uci.ics.hyracks.algebricks.data.IPrinter;
+import edu.uci.ics.hyracks.algebricks.data.IPrinterFactory;
+
+public class 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/json/AStringPrinter.java b/asterix-om/src/main/java/edu/uci/ics/asterix/dataflow/data/nontagged/printers/json/AStringPrinter.java
new file mode 100644
index 0000000..c7828fc
--- /dev/null
+++ b/asterix-om/src/main/java/edu/uci/ics/asterix/dataflow/data/nontagged/printers/json/AStringPrinter.java
@@ -0,0 +1,27 @@
+package edu.uci.ics.asterix.dataflow.data.nontagged.printers.json;
+
+import java.io.IOException;
+import java.io.PrintStream;
+
+import edu.uci.ics.hyracks.algebricks.common.exceptions.AlgebricksException;
+import edu.uci.ics.hyracks.algebricks.data.IPrinter;
+import edu.uci.ics.hyracks.algebricks.data.utils.WriteValueTools;
+
+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 {
+            WriteValueTools.writeUTF8String(b, s + 1, l - 1, ps);
+        } catch (IOException e) {
+            throw new AlgebricksException(e);
+        }
+    }
+}
\ No newline at end of file
diff --git a/asterix-om/src/main/java/edu/uci/ics/asterix/dataflow/data/nontagged/printers/json/AStringPrinterFactory.java b/asterix-om/src/main/java/edu/uci/ics/asterix/dataflow/data/nontagged/printers/json/AStringPrinterFactory.java
new file mode 100644
index 0000000..9d76f35
--- /dev/null
+++ b/asterix-om/src/main/java/edu/uci/ics/asterix/dataflow/data/nontagged/printers/json/AStringPrinterFactory.java
@@ -0,0 +1,16 @@
+package edu.uci.ics.asterix.dataflow.data.nontagged.printers.json;
+
+import edu.uci.ics.hyracks.algebricks.data.IPrinter;
+import edu.uci.ics.hyracks.algebricks.data.IPrinterFactory;
+
+public class 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/json/ATimePrinter.java b/asterix-om/src/main/java/edu/uci/ics/asterix/dataflow/data/nontagged/printers/json/ATimePrinter.java
new file mode 100644
index 0000000..53fad9f
--- /dev/null
+++ b/asterix-om/src/main/java/edu/uci/ics/asterix/dataflow/data/nontagged/printers/json/ATimePrinter.java
@@ -0,0 +1,27 @@
+package edu.uci.ics.asterix.dataflow.data.nontagged.printers.json;
+
+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("}");
+    }
+
+}
\ No newline at end of file
diff --git a/asterix-om/src/main/java/edu/uci/ics/asterix/dataflow/data/nontagged/printers/json/ATimePrinterFactory.java b/asterix-om/src/main/java/edu/uci/ics/asterix/dataflow/data/nontagged/printers/json/ATimePrinterFactory.java
new file mode 100644
index 0000000..8f05c69
--- /dev/null
+++ b/asterix-om/src/main/java/edu/uci/ics/asterix/dataflow/data/nontagged/printers/json/ATimePrinterFactory.java
@@ -0,0 +1,16 @@
+package edu.uci.ics.asterix.dataflow.data.nontagged.printers.json;
+
+import edu.uci.ics.hyracks.algebricks.data.IPrinter;
+import edu.uci.ics.hyracks.algebricks.data.IPrinterFactory;
+
+public class 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/json/AUnionPrinterFactory.java b/asterix-om/src/main/java/edu/uci/ics/asterix/dataflow/data/nontagged/printers/json/AUnionPrinterFactory.java
new file mode 100644
index 0000000..393ad63
--- /dev/null
+++ b/asterix-om/src/main/java/edu/uci/ics/asterix/dataflow/data/nontagged/printers/json/AUnionPrinterFactory.java
@@ -0,0 +1,58 @@
+package edu.uci.ics.asterix.dataflow.data.nontagged.printers.json;
+
+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/json/AUnorderedlistPrinterFactory.java b/asterix-om/src/main/java/edu/uci/ics/asterix/dataflow/data/nontagged/printers/json/AUnorderedlistPrinterFactory.java
new file mode 100644
index 0000000..9e1bdda
--- /dev/null
+++ b/asterix-om/src/main/java/edu/uci/ics/asterix/dataflow/data/nontagged/printers/json/AUnorderedlistPrinterFactory.java
@@ -0,0 +1,55 @@
+package edu.uci.ics.asterix.dataflow.data.nontagged.printers.json;
+
+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.json.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);
+                }
+            }
+        };
+    }
+}