asterixdb-commits mailing list archives

Site index · List index
Message view « Date » · « Thread »
Top « Date » · « Thread »
From ti...@apache.org
Subject [6/8] incubator-asterixdb git commit: ASTERIXDB-1220: print nested values using visitors
Date Thu, 26 May 2016 19:19:16 GMT
http://git-wip-us.apache.org/repos/asf/incubator-asterixdb/blob/fd7fb5a1/asterixdb/asterix-om/src/main/java/org/apache/asterix/dataflow/data/nontagged/printers/csv/ADateTimePrinterFactory.java
----------------------------------------------------------------------
diff --git a/asterixdb/asterix-om/src/main/java/org/apache/asterix/dataflow/data/nontagged/printers/csv/ADateTimePrinterFactory.java b/asterixdb/asterix-om/src/main/java/org/apache/asterix/dataflow/data/nontagged/printers/csv/ADateTimePrinterFactory.java
index 13c5b90..bc52e50 100644
--- a/asterixdb/asterix-om/src/main/java/org/apache/asterix/dataflow/data/nontagged/printers/csv/ADateTimePrinterFactory.java
+++ b/asterixdb/asterix-om/src/main/java/org/apache/asterix/dataflow/data/nontagged/printers/csv/ADateTimePrinterFactory.java
@@ -18,6 +18,9 @@
  */
 package org.apache.asterix.dataflow.data.nontagged.printers.csv;
 
+import java.io.PrintStream;
+
+import org.apache.asterix.dataflow.data.nontagged.printers.PrintTools;
 import org.apache.hyracks.algebricks.data.IPrinter;
 import org.apache.hyracks.algebricks.data.IPrinterFactory;
 
@@ -26,9 +29,14 @@ public class ADateTimePrinterFactory implements IPrinterFactory {
     private static final long serialVersionUID = 1L;
     public static final ADateTimePrinterFactory INSTANCE = new ADateTimePrinterFactory();
 
+    public static final IPrinter PRINTER = (byte[] b, int s, int l, PrintStream ps) -> {
+        ps.print("\"");
+        PrintTools.printDateTimeString(b, s, l, ps);
+        ps.print("\"");
+    };
+
     @Override
     public IPrinter createPrinter() {
-        return ADateTimePrinter.INSTANCE;
+        return PRINTER;
     }
-
 }

http://git-wip-us.apache.org/repos/asf/incubator-asterixdb/blob/fd7fb5a1/asterixdb/asterix-om/src/main/java/org/apache/asterix/dataflow/data/nontagged/printers/csv/ADayTimeDurationPrinter.java
----------------------------------------------------------------------
diff --git a/asterixdb/asterix-om/src/main/java/org/apache/asterix/dataflow/data/nontagged/printers/csv/ADayTimeDurationPrinter.java b/asterixdb/asterix-om/src/main/java/org/apache/asterix/dataflow/data/nontagged/printers/csv/ADayTimeDurationPrinter.java
deleted file mode 100644
index 6dc819b..0000000
--- a/asterixdb/asterix-om/src/main/java/org/apache/asterix/dataflow/data/nontagged/printers/csv/ADayTimeDurationPrinter.java
+++ /dev/null
@@ -1,41 +0,0 @@
-/*
- * Licensed to the Apache Software Foundation (ASF) under one
- * or more contributor license agreements.  See the NOTICE file
- * distributed with this work for additional information
- * regarding copyright ownership.  The ASF licenses this file
- * to you 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 at
- *
- *   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 org.apache.asterix.dataflow.data.nontagged.printers.csv;
-
-import java.io.PrintStream;
-
-import org.apache.asterix.dataflow.data.nontagged.printers.PrintTools;
-import org.apache.hyracks.algebricks.data.IPrinter;
-import org.apache.hyracks.api.exceptions.HyracksDataException;
-
-public class ADayTimeDurationPrinter implements IPrinter {
-
-    public static final ADayTimeDurationPrinter INSTANCE = new ADayTimeDurationPrinter();
-
-    @Override
-    public void init() {
-    }
-
-    @Override
-    public void print(byte[] b, int s, int l, PrintStream ps) throws HyracksDataException {
-        ps.print("\"");
-        PrintTools.printDayTimeDurationString(b, s, l, ps);
-        ps.print("\")");
-    }
-}

http://git-wip-us.apache.org/repos/asf/incubator-asterixdb/blob/fd7fb5a1/asterixdb/asterix-om/src/main/java/org/apache/asterix/dataflow/data/nontagged/printers/csv/ADayTimeDurationPrinterFactory.java
----------------------------------------------------------------------
diff --git a/asterixdb/asterix-om/src/main/java/org/apache/asterix/dataflow/data/nontagged/printers/csv/ADayTimeDurationPrinterFactory.java b/asterixdb/asterix-om/src/main/java/org/apache/asterix/dataflow/data/nontagged/printers/csv/ADayTimeDurationPrinterFactory.java
index 594ef2c..64c28de 100644
--- a/asterixdb/asterix-om/src/main/java/org/apache/asterix/dataflow/data/nontagged/printers/csv/ADayTimeDurationPrinterFactory.java
+++ b/asterixdb/asterix-om/src/main/java/org/apache/asterix/dataflow/data/nontagged/printers/csv/ADayTimeDurationPrinterFactory.java
@@ -18,6 +18,9 @@
  */
 package org.apache.asterix.dataflow.data.nontagged.printers.csv;
 
+import java.io.PrintStream;
+
+import org.apache.asterix.dataflow.data.nontagged.printers.PrintTools;
 import org.apache.hyracks.algebricks.data.IPrinter;
 import org.apache.hyracks.algebricks.data.IPrinterFactory;
 
@@ -26,9 +29,14 @@ public class ADayTimeDurationPrinterFactory implements IPrinterFactory {
     private static final long serialVersionUID = 1L;
     public static final ADayTimeDurationPrinterFactory INSTANCE = new ADayTimeDurationPrinterFactory();
 
+    public static final IPrinter PRINTER = (byte[] b, int s, int l, PrintStream ps) -> {
+        ps.print("\"");
+        PrintTools.printDayTimeDurationString(b, s, l, ps);
+        ps.print("\")");
+    };
+
     @Override
     public IPrinter createPrinter() {
-        return ADayTimeDurationPrinter.INSTANCE;
+        return PRINTER;
     }
-
 }

http://git-wip-us.apache.org/repos/asf/incubator-asterixdb/blob/fd7fb5a1/asterixdb/asterix-om/src/main/java/org/apache/asterix/dataflow/data/nontagged/printers/csv/ADoublePrinter.java
----------------------------------------------------------------------
diff --git a/asterixdb/asterix-om/src/main/java/org/apache/asterix/dataflow/data/nontagged/printers/csv/ADoublePrinter.java b/asterixdb/asterix-om/src/main/java/org/apache/asterix/dataflow/data/nontagged/printers/csv/ADoublePrinter.java
deleted file mode 100644
index 5ca2d6e..0000000
--- a/asterixdb/asterix-om/src/main/java/org/apache/asterix/dataflow/data/nontagged/printers/csv/ADoublePrinter.java
+++ /dev/null
@@ -1,39 +0,0 @@
-/*
- * Licensed to the Apache Software Foundation (ASF) under one
- * or more contributor license agreements.  See the NOTICE file
- * distributed with this work for additional information
- * regarding copyright ownership.  The ASF licenses this file
- * to you 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 at
- *
- *   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 org.apache.asterix.dataflow.data.nontagged.printers.csv;
-
-import java.io.PrintStream;
-
-import org.apache.asterix.dataflow.data.nontagged.serde.ADoubleSerializerDeserializer;
-import org.apache.hyracks.algebricks.data.IPrinter;
-import org.apache.hyracks.api.exceptions.HyracksDataException;
-
-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 HyracksDataException {
-        ps.print(ADoubleSerializerDeserializer.getDouble(b, s + 1));
-    }
-}

http://git-wip-us.apache.org/repos/asf/incubator-asterixdb/blob/fd7fb5a1/asterixdb/asterix-om/src/main/java/org/apache/asterix/dataflow/data/nontagged/printers/csv/ADoublePrinterFactory.java
----------------------------------------------------------------------
diff --git a/asterixdb/asterix-om/src/main/java/org/apache/asterix/dataflow/data/nontagged/printers/csv/ADoublePrinterFactory.java b/asterixdb/asterix-om/src/main/java/org/apache/asterix/dataflow/data/nontagged/printers/csv/ADoublePrinterFactory.java
index e667eca..d08bae5 100644
--- a/asterixdb/asterix-om/src/main/java/org/apache/asterix/dataflow/data/nontagged/printers/csv/ADoublePrinterFactory.java
+++ b/asterixdb/asterix-om/src/main/java/org/apache/asterix/dataflow/data/nontagged/printers/csv/ADoublePrinterFactory.java
@@ -18,6 +18,9 @@
  */
 package org.apache.asterix.dataflow.data.nontagged.printers.csv;
 
+import java.io.PrintStream;
+
+import org.apache.asterix.dataflow.data.nontagged.serde.ADoubleSerializerDeserializer;
 import org.apache.hyracks.algebricks.data.IPrinter;
 import org.apache.hyracks.algebricks.data.IPrinterFactory;
 
@@ -26,9 +29,11 @@ public class ADoublePrinterFactory implements IPrinterFactory {
     private static final long serialVersionUID = 1L;
     public static final ADoublePrinterFactory INSTANCE = new ADoublePrinterFactory();
 
+    public static final IPrinter PRINTER = (byte[] b, int s, int l, PrintStream ps) -> ps
+            .print(ADoubleSerializerDeserializer.getDouble(b, s + 1));
+
     @Override
     public IPrinter createPrinter() {
-        return ADoublePrinter.INSTANCE;
+        return PRINTER;
     }
-
 }

http://git-wip-us.apache.org/repos/asf/incubator-asterixdb/blob/fd7fb5a1/asterixdb/asterix-om/src/main/java/org/apache/asterix/dataflow/data/nontagged/printers/csv/ADurationPrinter.java
----------------------------------------------------------------------
diff --git a/asterixdb/asterix-om/src/main/java/org/apache/asterix/dataflow/data/nontagged/printers/csv/ADurationPrinter.java b/asterixdb/asterix-om/src/main/java/org/apache/asterix/dataflow/data/nontagged/printers/csv/ADurationPrinter.java
deleted file mode 100644
index dbff71b..0000000
--- a/asterixdb/asterix-om/src/main/java/org/apache/asterix/dataflow/data/nontagged/printers/csv/ADurationPrinter.java
+++ /dev/null
@@ -1,41 +0,0 @@
-/*
- * Licensed to the Apache Software Foundation (ASF) under one
- * or more contributor license agreements.  See the NOTICE file
- * distributed with this work for additional information
- * regarding copyright ownership.  The ASF licenses this file
- * to you 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 at
- *
- *   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 org.apache.asterix.dataflow.data.nontagged.printers.csv;
-
-import java.io.PrintStream;
-
-import org.apache.asterix.dataflow.data.nontagged.printers.PrintTools;
-import org.apache.hyracks.algebricks.data.IPrinter;
-import org.apache.hyracks.api.exceptions.HyracksDataException;
-
-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 HyracksDataException {
-        ps.print("\"");
-        PrintTools.printDurationString(b, s, l, ps);
-        ps.print("\"");
-    }
-}

http://git-wip-us.apache.org/repos/asf/incubator-asterixdb/blob/fd7fb5a1/asterixdb/asterix-om/src/main/java/org/apache/asterix/dataflow/data/nontagged/printers/csv/ADurationPrinterFactory.java
----------------------------------------------------------------------
diff --git a/asterixdb/asterix-om/src/main/java/org/apache/asterix/dataflow/data/nontagged/printers/csv/ADurationPrinterFactory.java b/asterixdb/asterix-om/src/main/java/org/apache/asterix/dataflow/data/nontagged/printers/csv/ADurationPrinterFactory.java
index 3ba2faf..1eb797a 100644
--- a/asterixdb/asterix-om/src/main/java/org/apache/asterix/dataflow/data/nontagged/printers/csv/ADurationPrinterFactory.java
+++ b/asterixdb/asterix-om/src/main/java/org/apache/asterix/dataflow/data/nontagged/printers/csv/ADurationPrinterFactory.java
@@ -18,6 +18,9 @@
  */
 package org.apache.asterix.dataflow.data.nontagged.printers.csv;
 
+import java.io.PrintStream;
+
+import org.apache.asterix.dataflow.data.nontagged.printers.PrintTools;
 import org.apache.hyracks.algebricks.data.IPrinter;
 import org.apache.hyracks.algebricks.data.IPrinterFactory;
 
@@ -26,9 +29,14 @@ public class ADurationPrinterFactory implements IPrinterFactory {
     private static final long serialVersionUID = 1L;
     public static final ADurationPrinterFactory INSTANCE = new ADurationPrinterFactory();
 
+    public static final IPrinter PRINTER = (byte[] b, int s, int l, PrintStream ps) -> {
+        ps.print("\"");
+        PrintTools.printDurationString(b, s, l, ps);
+        ps.print("\"");
+    };
+
     @Override
     public IPrinter createPrinter() {
-        return ADurationPrinter.INSTANCE;
+        return PRINTER;
     }
-
 }

http://git-wip-us.apache.org/repos/asf/incubator-asterixdb/blob/fd7fb5a1/asterixdb/asterix-om/src/main/java/org/apache/asterix/dataflow/data/nontagged/printers/csv/AFloatPrinter.java
----------------------------------------------------------------------
diff --git a/asterixdb/asterix-om/src/main/java/org/apache/asterix/dataflow/data/nontagged/printers/csv/AFloatPrinter.java b/asterixdb/asterix-om/src/main/java/org/apache/asterix/dataflow/data/nontagged/printers/csv/AFloatPrinter.java
deleted file mode 100644
index 4d64b46..0000000
--- a/asterixdb/asterix-om/src/main/java/org/apache/asterix/dataflow/data/nontagged/printers/csv/AFloatPrinter.java
+++ /dev/null
@@ -1,39 +0,0 @@
-/*
- * Licensed to the Apache Software Foundation (ASF) under one
- * or more contributor license agreements.  See the NOTICE file
- * distributed with this work for additional information
- * regarding copyright ownership.  The ASF licenses this file
- * to you 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 at
- *
- *   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 org.apache.asterix.dataflow.data.nontagged.printers.csv;
-
-import java.io.PrintStream;
-
-import org.apache.asterix.dataflow.data.nontagged.serde.AFloatSerializerDeserializer;
-import org.apache.hyracks.algebricks.data.IPrinter;
-import org.apache.hyracks.api.exceptions.HyracksDataException;
-
-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 HyracksDataException {
-        ps.print(AFloatSerializerDeserializer.getFloat(b, s + 1));
-    }
-}

http://git-wip-us.apache.org/repos/asf/incubator-asterixdb/blob/fd7fb5a1/asterixdb/asterix-om/src/main/java/org/apache/asterix/dataflow/data/nontagged/printers/csv/AFloatPrinterFactory.java
----------------------------------------------------------------------
diff --git a/asterixdb/asterix-om/src/main/java/org/apache/asterix/dataflow/data/nontagged/printers/csv/AFloatPrinterFactory.java b/asterixdb/asterix-om/src/main/java/org/apache/asterix/dataflow/data/nontagged/printers/csv/AFloatPrinterFactory.java
index bbab5f3..ed2c2f4 100644
--- a/asterixdb/asterix-om/src/main/java/org/apache/asterix/dataflow/data/nontagged/printers/csv/AFloatPrinterFactory.java
+++ b/asterixdb/asterix-om/src/main/java/org/apache/asterix/dataflow/data/nontagged/printers/csv/AFloatPrinterFactory.java
@@ -18,6 +18,9 @@
  */
 package org.apache.asterix.dataflow.data.nontagged.printers.csv;
 
+import java.io.PrintStream;
+
+import org.apache.asterix.dataflow.data.nontagged.serde.AFloatSerializerDeserializer;
 import org.apache.hyracks.algebricks.data.IPrinter;
 import org.apache.hyracks.algebricks.data.IPrinterFactory;
 
@@ -26,9 +29,11 @@ public class AFloatPrinterFactory implements IPrinterFactory {
     private static final long serialVersionUID = 1L;
     public static final AFloatPrinterFactory INSTANCE = new AFloatPrinterFactory();
 
+    public static final IPrinter PRINTER = (byte[] b, int s, int l, PrintStream ps) -> ps
+            .print(AFloatSerializerDeserializer.getFloat(b, s + 1));
+
     @Override
     public IPrinter createPrinter() {
-        return AFloatPrinter.INSTANCE;
+        return PRINTER;
     }
-
 }

http://git-wip-us.apache.org/repos/asf/incubator-asterixdb/blob/fd7fb5a1/asterixdb/asterix-om/src/main/java/org/apache/asterix/dataflow/data/nontagged/printers/csv/AInt16Printer.java
----------------------------------------------------------------------
diff --git a/asterixdb/asterix-om/src/main/java/org/apache/asterix/dataflow/data/nontagged/printers/csv/AInt16Printer.java b/asterixdb/asterix-om/src/main/java/org/apache/asterix/dataflow/data/nontagged/printers/csv/AInt16Printer.java
deleted file mode 100644
index 1349d98..0000000
--- a/asterixdb/asterix-om/src/main/java/org/apache/asterix/dataflow/data/nontagged/printers/csv/AInt16Printer.java
+++ /dev/null
@@ -1,39 +0,0 @@
-/*
- * Licensed to the Apache Software Foundation (ASF) under one
- * or more contributor license agreements.  See the NOTICE file
- * distributed with this work for additional information
- * regarding copyright ownership.  The ASF licenses this file
- * to you 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 at
- *
- *   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 org.apache.asterix.dataflow.data.nontagged.printers.csv;
-
-import java.io.PrintStream;
-
-import org.apache.asterix.dataflow.data.nontagged.serde.AInt16SerializerDeserializer;
-import org.apache.hyracks.algebricks.data.IPrinter;
-import org.apache.hyracks.api.exceptions.HyracksDataException;
-
-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 HyracksDataException {
-        short i = AInt16SerializerDeserializer.getShort(b, s + 1);
-        ps.print(i);
-    }
-}

http://git-wip-us.apache.org/repos/asf/incubator-asterixdb/blob/fd7fb5a1/asterixdb/asterix-om/src/main/java/org/apache/asterix/dataflow/data/nontagged/printers/csv/AInt16PrinterFactory.java
----------------------------------------------------------------------
diff --git a/asterixdb/asterix-om/src/main/java/org/apache/asterix/dataflow/data/nontagged/printers/csv/AInt16PrinterFactory.java b/asterixdb/asterix-om/src/main/java/org/apache/asterix/dataflow/data/nontagged/printers/csv/AInt16PrinterFactory.java
index 45a6cec..8c6ec22 100644
--- a/asterixdb/asterix-om/src/main/java/org/apache/asterix/dataflow/data/nontagged/printers/csv/AInt16PrinterFactory.java
+++ b/asterixdb/asterix-om/src/main/java/org/apache/asterix/dataflow/data/nontagged/printers/csv/AInt16PrinterFactory.java
@@ -18,6 +18,9 @@
  */
 package org.apache.asterix.dataflow.data.nontagged.printers.csv;
 
+import java.io.PrintStream;
+
+import org.apache.asterix.dataflow.data.nontagged.serde.AInt16SerializerDeserializer;
 import org.apache.hyracks.algebricks.data.IPrinter;
 import org.apache.hyracks.algebricks.data.IPrinterFactory;
 
@@ -26,9 +29,11 @@ public class AInt16PrinterFactory implements IPrinterFactory {
     private static final long serialVersionUID = 1L;
     public static final AInt16PrinterFactory INSTANCE = new AInt16PrinterFactory();
 
+    public static final IPrinter PRINTER = (byte[] b, int s, int l, PrintStream ps) -> ps
+            .print(AInt16SerializerDeserializer.getShort(b, s + 1));
+
     @Override
     public IPrinter createPrinter() {
-        return AInt16Printer.INSTANCE;
+        return PRINTER;
     }
-
 }

http://git-wip-us.apache.org/repos/asf/incubator-asterixdb/blob/fd7fb5a1/asterixdb/asterix-om/src/main/java/org/apache/asterix/dataflow/data/nontagged/printers/csv/AInt32Printer.java
----------------------------------------------------------------------
diff --git a/asterixdb/asterix-om/src/main/java/org/apache/asterix/dataflow/data/nontagged/printers/csv/AInt32Printer.java b/asterixdb/asterix-om/src/main/java/org/apache/asterix/dataflow/data/nontagged/printers/csv/AInt32Printer.java
deleted file mode 100644
index 01b6c02..0000000
--- a/asterixdb/asterix-om/src/main/java/org/apache/asterix/dataflow/data/nontagged/printers/csv/AInt32Printer.java
+++ /dev/null
@@ -1,40 +0,0 @@
-/*
- * Licensed to the Apache Software Foundation (ASF) under one
- * or more contributor license agreements.  See the NOTICE file
- * distributed with this work for additional information
- * regarding copyright ownership.  The ASF licenses this file
- * to you 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 at
- *
- *   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 org.apache.asterix.dataflow.data.nontagged.printers.csv;
-
-import java.io.PrintStream;
-
-import org.apache.asterix.dataflow.data.nontagged.serde.AInt32SerializerDeserializer;
-import org.apache.hyracks.algebricks.data.IPrinter;
-import org.apache.hyracks.api.exceptions.HyracksDataException;
-
-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 HyracksDataException {
-        int d = AInt32SerializerDeserializer.getInt(b, s + 1);
-        ps.print(d);
-    }
-}

http://git-wip-us.apache.org/repos/asf/incubator-asterixdb/blob/fd7fb5a1/asterixdb/asterix-om/src/main/java/org/apache/asterix/dataflow/data/nontagged/printers/csv/AInt32PrinterFactory.java
----------------------------------------------------------------------
diff --git a/asterixdb/asterix-om/src/main/java/org/apache/asterix/dataflow/data/nontagged/printers/csv/AInt32PrinterFactory.java b/asterixdb/asterix-om/src/main/java/org/apache/asterix/dataflow/data/nontagged/printers/csv/AInt32PrinterFactory.java
index 3a169b6..ef3f9d9 100644
--- a/asterixdb/asterix-om/src/main/java/org/apache/asterix/dataflow/data/nontagged/printers/csv/AInt32PrinterFactory.java
+++ b/asterixdb/asterix-om/src/main/java/org/apache/asterix/dataflow/data/nontagged/printers/csv/AInt32PrinterFactory.java
@@ -18,6 +18,9 @@
  */
 package org.apache.asterix.dataflow.data.nontagged.printers.csv;
 
+import java.io.PrintStream;
+
+import org.apache.asterix.dataflow.data.nontagged.serde.AInt32SerializerDeserializer;
 import org.apache.hyracks.algebricks.data.IPrinter;
 import org.apache.hyracks.algebricks.data.IPrinterFactory;
 
@@ -26,9 +29,11 @@ public class AInt32PrinterFactory implements IPrinterFactory {
     private static final long serialVersionUID = 1L;
     public static final AInt32PrinterFactory INSTANCE = new AInt32PrinterFactory();
 
+    public static final IPrinter PRINTER = (byte[] b, int s, int l, PrintStream ps) -> ps
+            .print(AInt32SerializerDeserializer.getInt(b, s + 1));
+
     @Override
     public IPrinter createPrinter() {
-        return AInt32Printer.INSTANCE;
+        return PRINTER;
     }
-
 }

http://git-wip-us.apache.org/repos/asf/incubator-asterixdb/blob/fd7fb5a1/asterixdb/asterix-om/src/main/java/org/apache/asterix/dataflow/data/nontagged/printers/csv/AInt64Printer.java
----------------------------------------------------------------------
diff --git a/asterixdb/asterix-om/src/main/java/org/apache/asterix/dataflow/data/nontagged/printers/csv/AInt64Printer.java b/asterixdb/asterix-om/src/main/java/org/apache/asterix/dataflow/data/nontagged/printers/csv/AInt64Printer.java
deleted file mode 100644
index 5b05275..0000000
--- a/asterixdb/asterix-om/src/main/java/org/apache/asterix/dataflow/data/nontagged/printers/csv/AInt64Printer.java
+++ /dev/null
@@ -1,39 +0,0 @@
-/*
- * Licensed to the Apache Software Foundation (ASF) under one
- * or more contributor license agreements.  See the NOTICE file
- * distributed with this work for additional information
- * regarding copyright ownership.  The ASF licenses this file
- * to you 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 at
- *
- *   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 org.apache.asterix.dataflow.data.nontagged.printers.csv;
-
-import java.io.PrintStream;
-
-import org.apache.asterix.dataflow.data.nontagged.serde.AInt64SerializerDeserializer;
-import org.apache.hyracks.algebricks.data.IPrinter;
-import org.apache.hyracks.api.exceptions.HyracksDataException;
-
-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 HyracksDataException {
-        long d = AInt64SerializerDeserializer.getLong(b, s + 1);
-        ps.print(d);
-    }
-}

http://git-wip-us.apache.org/repos/asf/incubator-asterixdb/blob/fd7fb5a1/asterixdb/asterix-om/src/main/java/org/apache/asterix/dataflow/data/nontagged/printers/csv/AInt64PrinterFactory.java
----------------------------------------------------------------------
diff --git a/asterixdb/asterix-om/src/main/java/org/apache/asterix/dataflow/data/nontagged/printers/csv/AInt64PrinterFactory.java b/asterixdb/asterix-om/src/main/java/org/apache/asterix/dataflow/data/nontagged/printers/csv/AInt64PrinterFactory.java
index 0e7cde9..403d0f4 100644
--- a/asterixdb/asterix-om/src/main/java/org/apache/asterix/dataflow/data/nontagged/printers/csv/AInt64PrinterFactory.java
+++ b/asterixdb/asterix-om/src/main/java/org/apache/asterix/dataflow/data/nontagged/printers/csv/AInt64PrinterFactory.java
@@ -18,6 +18,9 @@
  */
 package org.apache.asterix.dataflow.data.nontagged.printers.csv;
 
+import java.io.PrintStream;
+
+import org.apache.asterix.dataflow.data.nontagged.serde.AInt64SerializerDeserializer;
 import org.apache.hyracks.algebricks.data.IPrinter;
 import org.apache.hyracks.algebricks.data.IPrinterFactory;
 
@@ -26,9 +29,11 @@ public class AInt64PrinterFactory implements IPrinterFactory {
     private static final long serialVersionUID = 1L;
     public static final AInt64PrinterFactory INSTANCE = new AInt64PrinterFactory();
 
+    public static final IPrinter PRINTER = (byte[] b, int s, int l, PrintStream ps) -> ps
+            .print(AInt64SerializerDeserializer.getLong(b, s + 1));
+
     @Override
     public IPrinter createPrinter() {
-        return AInt64Printer.INSTANCE;
+        return PRINTER;
     }
-
 }

http://git-wip-us.apache.org/repos/asf/incubator-asterixdb/blob/fd7fb5a1/asterixdb/asterix-om/src/main/java/org/apache/asterix/dataflow/data/nontagged/printers/csv/AInt8Printer.java
----------------------------------------------------------------------
diff --git a/asterixdb/asterix-om/src/main/java/org/apache/asterix/dataflow/data/nontagged/printers/csv/AInt8Printer.java b/asterixdb/asterix-om/src/main/java/org/apache/asterix/dataflow/data/nontagged/printers/csv/AInt8Printer.java
deleted file mode 100644
index 3e59811..0000000
--- a/asterixdb/asterix-om/src/main/java/org/apache/asterix/dataflow/data/nontagged/printers/csv/AInt8Printer.java
+++ /dev/null
@@ -1,40 +0,0 @@
-/*
- * Licensed to the Apache Software Foundation (ASF) under one
- * or more contributor license agreements.  See the NOTICE file
- * distributed with this work for additional information
- * regarding copyright ownership.  The ASF licenses this file
- * to you 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 at
- *
- *   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 org.apache.asterix.dataflow.data.nontagged.printers.csv;
-
-import java.io.PrintStream;
-
-import org.apache.asterix.dataflow.data.nontagged.serde.AInt8SerializerDeserializer;
-import org.apache.hyracks.algebricks.data.IPrinter;
-import org.apache.hyracks.api.exceptions.HyracksDataException;
-
-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 HyracksDataException {
-        byte o = AInt8SerializerDeserializer.getByte(b, s + 1);
-        ps.print(o);
-    }
-}

http://git-wip-us.apache.org/repos/asf/incubator-asterixdb/blob/fd7fb5a1/asterixdb/asterix-om/src/main/java/org/apache/asterix/dataflow/data/nontagged/printers/csv/AInt8PrinterFactory.java
----------------------------------------------------------------------
diff --git a/asterixdb/asterix-om/src/main/java/org/apache/asterix/dataflow/data/nontagged/printers/csv/AInt8PrinterFactory.java b/asterixdb/asterix-om/src/main/java/org/apache/asterix/dataflow/data/nontagged/printers/csv/AInt8PrinterFactory.java
index 3ce36a8..c9d4165 100644
--- a/asterixdb/asterix-om/src/main/java/org/apache/asterix/dataflow/data/nontagged/printers/csv/AInt8PrinterFactory.java
+++ b/asterixdb/asterix-om/src/main/java/org/apache/asterix/dataflow/data/nontagged/printers/csv/AInt8PrinterFactory.java
@@ -18,6 +18,9 @@
  */
 package org.apache.asterix.dataflow.data.nontagged.printers.csv;
 
+import java.io.PrintStream;
+
+import org.apache.asterix.dataflow.data.nontagged.serde.AInt8SerializerDeserializer;
 import org.apache.hyracks.algebricks.data.IPrinter;
 import org.apache.hyracks.algebricks.data.IPrinterFactory;
 
@@ -26,9 +29,11 @@ public class AInt8PrinterFactory implements IPrinterFactory {
     private static final long serialVersionUID = 1L;
     public static final AInt8PrinterFactory INSTANCE = new AInt8PrinterFactory();
 
+    public static final IPrinter PRINTER = (byte[] b, int s, int l, PrintStream ps) -> ps
+            .print(AInt8SerializerDeserializer.getByte(b, s + 1));
+
     @Override
     public IPrinter createPrinter() {
-        return AInt8Printer.INSTANCE;
+        return PRINTER;
     }
-
 }

http://git-wip-us.apache.org/repos/asf/incubator-asterixdb/blob/fd7fb5a1/asterixdb/asterix-om/src/main/java/org/apache/asterix/dataflow/data/nontagged/printers/csv/AIntervalPrinter.java
----------------------------------------------------------------------
diff --git a/asterixdb/asterix-om/src/main/java/org/apache/asterix/dataflow/data/nontagged/printers/csv/AIntervalPrinter.java b/asterixdb/asterix-om/src/main/java/org/apache/asterix/dataflow/data/nontagged/printers/csv/AIntervalPrinter.java
deleted file mode 100644
index ba74790..0000000
--- a/asterixdb/asterix-om/src/main/java/org/apache/asterix/dataflow/data/nontagged/printers/csv/AIntervalPrinter.java
+++ /dev/null
@@ -1,39 +0,0 @@
-/*
- * Licensed to the Apache Software Foundation (ASF) under one
- * or more contributor license agreements.  See the NOTICE file
- * distributed with this work for additional information
- * regarding copyright ownership.  The ASF licenses this file
- * to you 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 at
- *
- *   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 org.apache.asterix.dataflow.data.nontagged.printers.csv;
-
-import java.io.PrintStream;
-
-import org.apache.hyracks.algebricks.data.IPrinter;
-import org.apache.hyracks.api.exceptions.HyracksDataException;
-
-public class AIntervalPrinter implements IPrinter {
-
-    public static final AIntervalPrinter INSTANCE = new AIntervalPrinter();
-
-
-    @Override
-    public void init() {
-    }
-
-    @Override
-    public void print(byte[] b, int s, int l, PrintStream ps) throws HyracksDataException {
-        throw new HyracksDataException("'Interval' type unsupported for CSV output");
-    }
-}

http://git-wip-us.apache.org/repos/asf/incubator-asterixdb/blob/fd7fb5a1/asterixdb/asterix-om/src/main/java/org/apache/asterix/dataflow/data/nontagged/printers/csv/AIntervalPrinterFactory.java
----------------------------------------------------------------------
diff --git a/asterixdb/asterix-om/src/main/java/org/apache/asterix/dataflow/data/nontagged/printers/csv/AIntervalPrinterFactory.java b/asterixdb/asterix-om/src/main/java/org/apache/asterix/dataflow/data/nontagged/printers/csv/AIntervalPrinterFactory.java
index a12d75c..7e1c1cb 100644
--- a/asterixdb/asterix-om/src/main/java/org/apache/asterix/dataflow/data/nontagged/printers/csv/AIntervalPrinterFactory.java
+++ b/asterixdb/asterix-om/src/main/java/org/apache/asterix/dataflow/data/nontagged/printers/csv/AIntervalPrinterFactory.java
@@ -18,17 +18,23 @@
  */
 package org.apache.asterix.dataflow.data.nontagged.printers.csv;
 
+import java.io.PrintStream;
+
 import org.apache.hyracks.algebricks.data.IPrinter;
 import org.apache.hyracks.algebricks.data.IPrinterFactory;
+import org.apache.hyracks.api.exceptions.HyracksDataException;
 
 public class AIntervalPrinterFactory implements IPrinterFactory {
 
     private static final long serialVersionUID = 1L;
     public static final AIntervalPrinterFactory INSTANCE = new AIntervalPrinterFactory();
 
+    public static final IPrinter PRINTER = (byte[] b, int s, int l, PrintStream ps) -> {
+        throw new HyracksDataException("'Interval' type unsupported for CSV output");
+    };
+
     @Override
     public IPrinter createPrinter() {
-        return AIntervalPrinter.INSTANCE;
+        return PRINTER;
     }
-
 }

http://git-wip-us.apache.org/repos/asf/incubator-asterixdb/blob/fd7fb5a1/asterixdb/asterix-om/src/main/java/org/apache/asterix/dataflow/data/nontagged/printers/csv/ALinePrinter.java
----------------------------------------------------------------------
diff --git a/asterixdb/asterix-om/src/main/java/org/apache/asterix/dataflow/data/nontagged/printers/csv/ALinePrinter.java b/asterixdb/asterix-om/src/main/java/org/apache/asterix/dataflow/data/nontagged/printers/csv/ALinePrinter.java
deleted file mode 100644
index a500e58..0000000
--- a/asterixdb/asterix-om/src/main/java/org/apache/asterix/dataflow/data/nontagged/printers/csv/ALinePrinter.java
+++ /dev/null
@@ -1,47 +0,0 @@
-/*
- * Licensed to the Apache Software Foundation (ASF) under one
- * or more contributor license agreements.  See the NOTICE file
- * distributed with this work for additional information
- * regarding copyright ownership.  The ASF licenses this file
- * to you 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 at
- *
- *   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 org.apache.asterix.dataflow.data.nontagged.printers.csv;
-
-import java.io.PrintStream;
-
-import org.apache.asterix.dataflow.data.nontagged.serde.ADoubleSerializerDeserializer;
-import org.apache.hyracks.algebricks.data.IPrinter;
-import org.apache.hyracks.api.exceptions.HyracksDataException;
-
-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 HyracksDataException {
-        ps.print("\"[ [");
-        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(", ");
-        ps.print(ADoubleSerializerDeserializer.getDouble(b, s + 25));
-        ps.print("] ]\"");
-    }
-}

http://git-wip-us.apache.org/repos/asf/incubator-asterixdb/blob/fd7fb5a1/asterixdb/asterix-om/src/main/java/org/apache/asterix/dataflow/data/nontagged/printers/csv/ALinePrinterFactory.java
----------------------------------------------------------------------
diff --git a/asterixdb/asterix-om/src/main/java/org/apache/asterix/dataflow/data/nontagged/printers/csv/ALinePrinterFactory.java b/asterixdb/asterix-om/src/main/java/org/apache/asterix/dataflow/data/nontagged/printers/csv/ALinePrinterFactory.java
index cbbc462..929cec9 100644
--- a/asterixdb/asterix-om/src/main/java/org/apache/asterix/dataflow/data/nontagged/printers/csv/ALinePrinterFactory.java
+++ b/asterixdb/asterix-om/src/main/java/org/apache/asterix/dataflow/data/nontagged/printers/csv/ALinePrinterFactory.java
@@ -18,6 +18,9 @@
  */
 package org.apache.asterix.dataflow.data.nontagged.printers.csv;
 
+import java.io.PrintStream;
+
+import org.apache.asterix.dataflow.data.nontagged.serde.ADoubleSerializerDeserializer;
 import org.apache.hyracks.algebricks.data.IPrinter;
 import org.apache.hyracks.algebricks.data.IPrinterFactory;
 
@@ -26,9 +29,20 @@ public class ALinePrinterFactory implements IPrinterFactory {
     private static final long serialVersionUID = 1L;
     public static final ALinePrinterFactory INSTANCE = new ALinePrinterFactory();
 
+    public static final IPrinter PRINTER = (byte[] b, int s, int l, PrintStream ps) -> {
+        ps.print("\"[ [");
+        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(", ");
+        ps.print(ADoubleSerializerDeserializer.getDouble(b, s + 25));
+        ps.print("] ]\"");
+    };
+
     @Override
     public IPrinter createPrinter() {
-        return ALinePrinter.INSTANCE;
+        return PRINTER;
     }
-
 }

http://git-wip-us.apache.org/repos/asf/incubator-asterixdb/blob/fd7fb5a1/asterixdb/asterix-om/src/main/java/org/apache/asterix/dataflow/data/nontagged/printers/csv/ANullPrinter.java
----------------------------------------------------------------------
diff --git a/asterixdb/asterix-om/src/main/java/org/apache/asterix/dataflow/data/nontagged/printers/csv/ANullPrinter.java b/asterixdb/asterix-om/src/main/java/org/apache/asterix/dataflow/data/nontagged/printers/csv/ANullPrinter.java
deleted file mode 100644
index 38d6bf8..0000000
--- a/asterixdb/asterix-om/src/main/java/org/apache/asterix/dataflow/data/nontagged/printers/csv/ANullPrinter.java
+++ /dev/null
@@ -1,38 +0,0 @@
-/*
- * Licensed to the Apache Software Foundation (ASF) under one
- * or more contributor license agreements.  See the NOTICE file
- * distributed with this work for additional information
- * regarding copyright ownership.  The ASF licenses this file
- * to you 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 at
- *
- *   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 org.apache.asterix.dataflow.data.nontagged.printers.csv;
-
-import java.io.PrintStream;
-
-import org.apache.hyracks.algebricks.data.IPrinter;
-import org.apache.hyracks.api.exceptions.HyracksDataException;
-
-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 HyracksDataException {
-        ps.print("null");
-    }
-}

http://git-wip-us.apache.org/repos/asf/incubator-asterixdb/blob/fd7fb5a1/asterixdb/asterix-om/src/main/java/org/apache/asterix/dataflow/data/nontagged/printers/csv/ANullPrinterFactory.java
----------------------------------------------------------------------
diff --git a/asterixdb/asterix-om/src/main/java/org/apache/asterix/dataflow/data/nontagged/printers/csv/ANullPrinterFactory.java b/asterixdb/asterix-om/src/main/java/org/apache/asterix/dataflow/data/nontagged/printers/csv/ANullPrinterFactory.java
index 2e9c1dc..dcf98a0 100644
--- a/asterixdb/asterix-om/src/main/java/org/apache/asterix/dataflow/data/nontagged/printers/csv/ANullPrinterFactory.java
+++ b/asterixdb/asterix-om/src/main/java/org/apache/asterix/dataflow/data/nontagged/printers/csv/ANullPrinterFactory.java
@@ -18,6 +18,8 @@
  */
 package org.apache.asterix.dataflow.data.nontagged.printers.csv;
 
+import java.io.PrintStream;
+
 import org.apache.hyracks.algebricks.data.IPrinter;
 import org.apache.hyracks.algebricks.data.IPrinterFactory;
 
@@ -26,9 +28,10 @@ public class ANullPrinterFactory implements IPrinterFactory {
     private static final long serialVersionUID = 1L;
     public static final ANullPrinterFactory INSTANCE = new ANullPrinterFactory();
 
+    public static final IPrinter PRINTER = (byte[] b, int s, int l, PrintStream ps) -> ps.print("null");
+
     @Override
     public IPrinter createPrinter() {
-        return ANullPrinter.INSTANCE;
+        return PRINTER;
     }
-
 }

http://git-wip-us.apache.org/repos/asf/incubator-asterixdb/blob/fd7fb5a1/asterixdb/asterix-om/src/main/java/org/apache/asterix/dataflow/data/nontagged/printers/csv/ANullableFieldPrinterFactory.java
----------------------------------------------------------------------
diff --git a/asterixdb/asterix-om/src/main/java/org/apache/asterix/dataflow/data/nontagged/printers/csv/ANullableFieldPrinterFactory.java b/asterixdb/asterix-om/src/main/java/org/apache/asterix/dataflow/data/nontagged/printers/csv/ANullableFieldPrinterFactory.java
index f920080..deb6014 100644
--- a/asterixdb/asterix-om/src/main/java/org/apache/asterix/dataflow/data/nontagged/printers/csv/ANullableFieldPrinterFactory.java
+++ b/asterixdb/asterix-om/src/main/java/org/apache/asterix/dataflow/data/nontagged/printers/csv/ANullableFieldPrinterFactory.java
@@ -64,5 +64,4 @@ public class ANullableFieldPrinterFactory implements IPrinterFactory {
 
         };
     }
-
 }

http://git-wip-us.apache.org/repos/asf/incubator-asterixdb/blob/fd7fb5a1/asterixdb/asterix-om/src/main/java/org/apache/asterix/dataflow/data/nontagged/printers/csv/AObjectPrinter.java
----------------------------------------------------------------------
diff --git a/asterixdb/asterix-om/src/main/java/org/apache/asterix/dataflow/data/nontagged/printers/csv/AObjectPrinter.java b/asterixdb/asterix-om/src/main/java/org/apache/asterix/dataflow/data/nontagged/printers/csv/AObjectPrinter.java
deleted file mode 100644
index 09cd5ac..0000000
--- a/asterixdb/asterix-om/src/main/java/org/apache/asterix/dataflow/data/nontagged/printers/csv/AObjectPrinter.java
+++ /dev/null
@@ -1,154 +0,0 @@
-/*
- * Licensed to the Apache Software Foundation (ASF) under one
- * or more contributor license agreements.  See the NOTICE file
- * distributed with this work for additional information
- * regarding copyright ownership.  The ASF licenses this file
- * to you 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 at
- *
- *   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 org.apache.asterix.dataflow.data.nontagged.printers.csv;
-
-import java.io.PrintStream;
-
-import org.apache.asterix.om.types.ATypeTag;
-import org.apache.asterix.om.types.EnumDeserializer;
-import org.apache.hyracks.algebricks.common.exceptions.NotImplementedException;
-import org.apache.hyracks.algebricks.data.IPrinter;
-import org.apache.hyracks.api.exceptions.HyracksDataException;
-
-public class AObjectPrinter implements IPrinter {
-
-    public static final AObjectPrinter INSTANCE = new AObjectPrinter();
-
-    private IPrinter recordPrinter = new ARecordPrinterFactory(null).createPrinter();
-
-    @Override
-    public void init() {
-    }
-
-    @Override
-    public void print(byte[] b, int s, int l, PrintStream ps) throws HyracksDataException {
-        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 MISSING:
-            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 RECORD: {
-                this.recordPrinter.init();
-                recordPrinter.print(b, s, l, ps);
-                break;
-            }
-            case ANY:
-            case BINARY:
-            case BITARRAY:
-            case ENUM:
-            case ORDEREDLIST:
-            case SHORTWITHOUTTYPEINFO:
-            case SPARSERECORD:
-            case SYSTEM_NULL:
-            case TYPE:
-            case UINT16:
-            case UINT32:
-            case UINT64:
-            case UINT8:
-            case UNION:
-            case UNORDEREDLIST:
-            case UUID:
-                throw new NotImplementedException("No printer for type " + typeTag);
-        }
-    }
-}

http://git-wip-us.apache.org/repos/asf/incubator-asterixdb/blob/fd7fb5a1/asterixdb/asterix-om/src/main/java/org/apache/asterix/dataflow/data/nontagged/printers/csv/AObjectPrinterFactory.java
----------------------------------------------------------------------
diff --git a/asterixdb/asterix-om/src/main/java/org/apache/asterix/dataflow/data/nontagged/printers/csv/AObjectPrinterFactory.java b/asterixdb/asterix-om/src/main/java/org/apache/asterix/dataflow/data/nontagged/printers/csv/AObjectPrinterFactory.java
index 09bef1b..55c6fd4 100644
--- a/asterixdb/asterix-om/src/main/java/org/apache/asterix/dataflow/data/nontagged/printers/csv/AObjectPrinterFactory.java
+++ b/asterixdb/asterix-om/src/main/java/org/apache/asterix/dataflow/data/nontagged/printers/csv/AObjectPrinterFactory.java
@@ -18,17 +18,132 @@
  */
 package org.apache.asterix.dataflow.data.nontagged.printers.csv;
 
+import java.io.PrintStream;
+
+import org.apache.asterix.common.exceptions.AsterixException;
+import org.apache.asterix.om.pointables.ARecordVisitablePointable;
+import org.apache.asterix.om.pointables.base.DefaultOpenFieldType;
+import org.apache.asterix.om.pointables.printer.IPrintVisitor;
+import org.apache.asterix.om.pointables.printer.csv.APrintVisitor;
+import org.apache.asterix.om.types.ATypeTag;
+import org.apache.asterix.om.types.EnumDeserializer;
+import org.apache.hyracks.algebricks.common.utils.Pair;
 import org.apache.hyracks.algebricks.data.IPrinter;
 import org.apache.hyracks.algebricks.data.IPrinterFactory;
+import org.apache.hyracks.api.exceptions.HyracksDataException;
 
 public class AObjectPrinterFactory implements IPrinterFactory {
 
     private static final long serialVersionUID = 1L;
     public static final AObjectPrinterFactory INSTANCE = new AObjectPrinterFactory();
 
+    public static boolean printFlatValue(ATypeTag typeTag, byte[] b, int s, int l, PrintStream ps)
+            throws HyracksDataException {
+        switch (typeTag) {
+            case INT8:
+                AInt8PrinterFactory.PRINTER.print(b, s, l, ps);
+                return true;
+            case INT16:
+                AInt16PrinterFactory.PRINTER.print(b, s, l, ps);
+                return true;
+            case INT32:
+                AInt32PrinterFactory.PRINTER.print(b, s, l, ps);
+                return true;
+            case INT64:
+                AInt64PrinterFactory.PRINTER.print(b, s, l, ps);
+                return true;
+            case MISSING:
+            case NULL:
+                ANullPrinterFactory.PRINTER.print(b, s, l, ps);
+                return true;
+            case BOOLEAN:
+                ABooleanPrinterFactory.PRINTER.print(b, s, l, ps);
+                return true;
+            case FLOAT:
+                AFloatPrinterFactory.PRINTER.print(b, s, l, ps);
+                return true;
+            case DOUBLE:
+                ADoublePrinterFactory.PRINTER.print(b, s, l, ps);
+                return true;
+            case DATE:
+                ADatePrinterFactory.PRINTER.print(b, s, l, ps);
+                return true;
+            case TIME:
+                ATimePrinterFactory.PRINTER.print(b, s, l, ps);
+                return true;
+            case DATETIME:
+                ADateTimePrinterFactory.PRINTER.print(b, s, l, ps);
+                return true;
+            case DURATION:
+                ADurationPrinterFactory.PRINTER.print(b, s, l, ps);
+                return true;
+            case YEARMONTHDURATION:
+                AYearMonthDurationPrinterFactory.PRINTER.print(b, s, l, ps);
+                return true;
+            case DAYTIMEDURATION:
+                ADayTimeDurationPrinterFactory.PRINTER.print(b, s, l, ps);
+                return true;
+            case INTERVAL:
+                AIntervalPrinterFactory.PRINTER.print(b, s, l, ps);
+                return true;
+            case POINT:
+                APointPrinterFactory.PRINTER.print(b, s, l, ps);
+                return true;
+            case POINT3D:
+                APoint3DPrinterFactory.PRINTER.print(b, s, l, ps);
+                return true;
+            case LINE:
+                ALinePrinterFactory.PRINTER.print(b, s, l, ps);
+                return true;
+            case POLYGON:
+                APolygonPrinterFactory.PRINTER.print(b, s, l, ps);
+                return true;
+            case CIRCLE:
+                ACirclePrinterFactory.PRINTER.print(b, s, l, ps);
+                return true;
+            case RECTANGLE:
+                ARectanglePrinterFactory.PRINTER.print(b, s, l, ps);
+                return true;
+            case STRING:
+                AStringPrinterFactory.PRINTER.print(b, s, l, ps);
+                return true;
+            case BINARY:
+                ABinaryHexPrinterFactory.PRINTER.print(b, s, l, ps);
+                return true;
+            case UUID:
+                AUUIDPrinterFactory.PRINTER.print(b, s, l, ps);
+                return true;
+            default:
+                return false;
+        }
+    }
+
     @Override
     public IPrinter createPrinter() {
-        return AObjectPrinter.INSTANCE;
-    }
+        final ARecordVisitablePointable rPointable = new ARecordVisitablePointable(
+                DefaultOpenFieldType.NESTED_OPEN_RECORD_TYPE);
+        final Pair<PrintStream, ATypeTag> streamTag = new Pair<>(null, null);
+
+        final IPrintVisitor visitor = new APrintVisitor();
 
+        return (byte[] b, int s, int l, PrintStream ps) -> {
+            ATypeTag typeTag = EnumDeserializer.ATYPETAGDESERIALIZER.deserialize(b[s]);
+            if (!printFlatValue(typeTag, b, s, l, ps)) {
+                streamTag.first = ps;
+                streamTag.second = typeTag;
+                try {
+                    switch (typeTag) {
+                        case RECORD:
+                            rPointable.set(b, s, l);
+                            visitor.visit(rPointable, streamTag);
+                            break;
+                        default:
+                            throw new HyracksDataException("No printer for type " + typeTag);
+                    }
+                } catch (AsterixException e) {
+                    throw new HyracksDataException(e);
+                }
+            }
+        };
+    }
 }

http://git-wip-us.apache.org/repos/asf/incubator-asterixdb/blob/fd7fb5a1/asterixdb/asterix-om/src/main/java/org/apache/asterix/dataflow/data/nontagged/printers/csv/APoint3DPrinter.java
----------------------------------------------------------------------
diff --git a/asterixdb/asterix-om/src/main/java/org/apache/asterix/dataflow/data/nontagged/printers/csv/APoint3DPrinter.java b/asterixdb/asterix-om/src/main/java/org/apache/asterix/dataflow/data/nontagged/printers/csv/APoint3DPrinter.java
deleted file mode 100644
index 296cb41..0000000
--- a/asterixdb/asterix-om/src/main/java/org/apache/asterix/dataflow/data/nontagged/printers/csv/APoint3DPrinter.java
+++ /dev/null
@@ -1,45 +0,0 @@
-/*
- * Licensed to the Apache Software Foundation (ASF) under one
- * or more contributor license agreements.  See the NOTICE file
- * distributed with this work for additional information
- * regarding copyright ownership.  The ASF licenses this file
- * to you 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 at
- *
- *   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 org.apache.asterix.dataflow.data.nontagged.printers.csv;
-
-import java.io.PrintStream;
-
-import org.apache.asterix.dataflow.data.nontagged.serde.ADoubleSerializerDeserializer;
-import org.apache.hyracks.algebricks.data.IPrinter;
-import org.apache.hyracks.api.exceptions.HyracksDataException;
-
-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 HyracksDataException {
-        ps.print("\"[");
-        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("]\"");
-    }
-}

http://git-wip-us.apache.org/repos/asf/incubator-asterixdb/blob/fd7fb5a1/asterixdb/asterix-om/src/main/java/org/apache/asterix/dataflow/data/nontagged/printers/csv/APoint3DPrinterFactory.java
----------------------------------------------------------------------
diff --git a/asterixdb/asterix-om/src/main/java/org/apache/asterix/dataflow/data/nontagged/printers/csv/APoint3DPrinterFactory.java b/asterixdb/asterix-om/src/main/java/org/apache/asterix/dataflow/data/nontagged/printers/csv/APoint3DPrinterFactory.java
index 803e9cb..2839a8b 100644
--- a/asterixdb/asterix-om/src/main/java/org/apache/asterix/dataflow/data/nontagged/printers/csv/APoint3DPrinterFactory.java
+++ b/asterixdb/asterix-om/src/main/java/org/apache/asterix/dataflow/data/nontagged/printers/csv/APoint3DPrinterFactory.java
@@ -18,6 +18,9 @@
  */
 package org.apache.asterix.dataflow.data.nontagged.printers.csv;
 
+import java.io.PrintStream;
+
+import org.apache.asterix.dataflow.data.nontagged.serde.ADoubleSerializerDeserializer;
 import org.apache.hyracks.algebricks.data.IPrinter;
 import org.apache.hyracks.algebricks.data.IPrinterFactory;
 
@@ -26,9 +29,18 @@ public class APoint3DPrinterFactory implements IPrinterFactory {
     private static final long serialVersionUID = 1L;
     public static final APoint3DPrinterFactory INSTANCE = new APoint3DPrinterFactory();
 
+    public static final IPrinter PRINTER = (byte[] b, int s, int l, PrintStream ps) -> {
+        ps.print("\"[");
+        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("]\"");
+    };
+
     @Override
     public IPrinter createPrinter() {
-        return APoint3DPrinter.INSTANCE;
+        return PRINTER;
     }
-
 }

http://git-wip-us.apache.org/repos/asf/incubator-asterixdb/blob/fd7fb5a1/asterixdb/asterix-om/src/main/java/org/apache/asterix/dataflow/data/nontagged/printers/csv/APointPrinter.java
----------------------------------------------------------------------
diff --git a/asterixdb/asterix-om/src/main/java/org/apache/asterix/dataflow/data/nontagged/printers/csv/APointPrinter.java b/asterixdb/asterix-om/src/main/java/org/apache/asterix/dataflow/data/nontagged/printers/csv/APointPrinter.java
deleted file mode 100644
index bab0ddd..0000000
--- a/asterixdb/asterix-om/src/main/java/org/apache/asterix/dataflow/data/nontagged/printers/csv/APointPrinter.java
+++ /dev/null
@@ -1,43 +0,0 @@
-/*
- * Licensed to the Apache Software Foundation (ASF) under one
- * or more contributor license agreements.  See the NOTICE file
- * distributed with this work for additional information
- * regarding copyright ownership.  The ASF licenses this file
- * to you 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 at
- *
- *   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 org.apache.asterix.dataflow.data.nontagged.printers.csv;
-
-import java.io.PrintStream;
-
-import org.apache.asterix.dataflow.data.nontagged.serde.ADoubleSerializerDeserializer;
-import org.apache.hyracks.algebricks.data.IPrinter;
-import org.apache.hyracks.api.exceptions.HyracksDataException;
-
-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 HyracksDataException {
-        ps.print("\"[");
-        ps.print(ADoubleSerializerDeserializer.getDouble(b, s + 1));
-        ps.print(", ");
-        ps.print(ADoubleSerializerDeserializer.getDouble(b, s + 9));
-        ps.print("]\"");
-    }
-}

http://git-wip-us.apache.org/repos/asf/incubator-asterixdb/blob/fd7fb5a1/asterixdb/asterix-om/src/main/java/org/apache/asterix/dataflow/data/nontagged/printers/csv/APointPrinterFactory.java
----------------------------------------------------------------------
diff --git a/asterixdb/asterix-om/src/main/java/org/apache/asterix/dataflow/data/nontagged/printers/csv/APointPrinterFactory.java b/asterixdb/asterix-om/src/main/java/org/apache/asterix/dataflow/data/nontagged/printers/csv/APointPrinterFactory.java
index 2561a4e..60bd007 100644
--- a/asterixdb/asterix-om/src/main/java/org/apache/asterix/dataflow/data/nontagged/printers/csv/APointPrinterFactory.java
+++ b/asterixdb/asterix-om/src/main/java/org/apache/asterix/dataflow/data/nontagged/printers/csv/APointPrinterFactory.java
@@ -18,6 +18,9 @@
  */
 package org.apache.asterix.dataflow.data.nontagged.printers.csv;
 
+import java.io.PrintStream;
+
+import org.apache.asterix.dataflow.data.nontagged.serde.ADoubleSerializerDeserializer;
 import org.apache.hyracks.algebricks.data.IPrinter;
 import org.apache.hyracks.algebricks.data.IPrinterFactory;
 
@@ -26,9 +29,16 @@ public class APointPrinterFactory implements IPrinterFactory {
     private static final long serialVersionUID = 1L;
     public static final APointPrinterFactory INSTANCE = new APointPrinterFactory();
 
+    public static final IPrinter PRINTER = (byte[] b, int s, int l, PrintStream ps) -> {
+        ps.print("\"[");
+        ps.print(ADoubleSerializerDeserializer.getDouble(b, s + 1));
+        ps.print(", ");
+        ps.print(ADoubleSerializerDeserializer.getDouble(b, s + 9));
+        ps.print("]\"");
+    };
+
     @Override
     public IPrinter createPrinter() {
-        return APointPrinter.INSTANCE;
+        return PRINTER;
     }
-
 }

http://git-wip-us.apache.org/repos/asf/incubator-asterixdb/blob/fd7fb5a1/asterixdb/asterix-om/src/main/java/org/apache/asterix/dataflow/data/nontagged/printers/csv/APolygonPrinter.java
----------------------------------------------------------------------
diff --git a/asterixdb/asterix-om/src/main/java/org/apache/asterix/dataflow/data/nontagged/printers/csv/APolygonPrinter.java b/asterixdb/asterix-om/src/main/java/org/apache/asterix/dataflow/data/nontagged/printers/csv/APolygonPrinter.java
deleted file mode 100644
index 493715a..0000000
--- a/asterixdb/asterix-om/src/main/java/org/apache/asterix/dataflow/data/nontagged/printers/csv/APolygonPrinter.java
+++ /dev/null
@@ -1,58 +0,0 @@
-/*
- * Licensed to the Apache Software Foundation (ASF) under one
- * or more contributor license agreements.  See the NOTICE file
- * distributed with this work for additional information
- * regarding copyright ownership.  The ASF licenses this file
- * to you 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 at
- *
- *   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 org.apache.asterix.dataflow.data.nontagged.printers.csv;
-
-import java.io.PrintStream;
-
-import org.apache.asterix.dataflow.data.nontagged.serde.ADoubleSerializerDeserializer;
-import org.apache.asterix.dataflow.data.nontagged.serde.AInt16SerializerDeserializer;
-import org.apache.hyracks.algebricks.data.IPrinter;
-import org.apache.hyracks.api.exceptions.HyracksDataException;
-
-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 HyracksDataException {
-        short numberOfPoints = AInt16SerializerDeserializer.getShort(b, s + 1);
-        s += 3;
-
-        ps.print("\"[ ");
-
-        for (int i = 0; i < numberOfPoints; i++) {
-            if (i > 0)
-                ps.print(", ");
-
-            ps.print("[");
-            ps.print(ADoubleSerializerDeserializer.getDouble(b, s));
-            ps.print(", ");
-            ps.print(ADoubleSerializerDeserializer.getDouble(b, s + 8));
-            ps.print("]");
-
-            s += 16;
-        }
-
-        ps.print(" ]\"");
-    }
-}

http://git-wip-us.apache.org/repos/asf/incubator-asterixdb/blob/fd7fb5a1/asterixdb/asterix-om/src/main/java/org/apache/asterix/dataflow/data/nontagged/printers/csv/APolygonPrinterFactory.java
----------------------------------------------------------------------
diff --git a/asterixdb/asterix-om/src/main/java/org/apache/asterix/dataflow/data/nontagged/printers/csv/APolygonPrinterFactory.java b/asterixdb/asterix-om/src/main/java/org/apache/asterix/dataflow/data/nontagged/printers/csv/APolygonPrinterFactory.java
index cc30b98..4df7676 100644
--- a/asterixdb/asterix-om/src/main/java/org/apache/asterix/dataflow/data/nontagged/printers/csv/APolygonPrinterFactory.java
+++ b/asterixdb/asterix-om/src/main/java/org/apache/asterix/dataflow/data/nontagged/printers/csv/APolygonPrinterFactory.java
@@ -18,6 +18,10 @@
  */
 package org.apache.asterix.dataflow.data.nontagged.printers.csv;
 
+import java.io.PrintStream;
+
+import org.apache.asterix.dataflow.data.nontagged.serde.ADoubleSerializerDeserializer;
+import org.apache.asterix.dataflow.data.nontagged.serde.AInt16SerializerDeserializer;
 import org.apache.hyracks.algebricks.data.IPrinter;
 import org.apache.hyracks.algebricks.data.IPrinterFactory;
 
@@ -26,9 +30,26 @@ public class APolygonPrinterFactory implements IPrinterFactory {
     private static final long serialVersionUID = 1L;
     public static final APolygonPrinterFactory INSTANCE = new APolygonPrinterFactory();
 
+    public static final IPrinter PRINTER = (byte[] b, int s, int l, PrintStream ps) -> {
+        short numberOfPoints = AInt16SerializerDeserializer.getShort(b, s + 1);
+        s += 3;
+        ps.print("\"[ ");
+        for (int i = 0; i < numberOfPoints; i++) {
+            if (i > 0) {
+                ps.print(", ");
+            }
+            ps.print("[");
+            ps.print(ADoubleSerializerDeserializer.getDouble(b, s));
+            ps.print(", ");
+            ps.print(ADoubleSerializerDeserializer.getDouble(b, s + 8));
+            ps.print("]");
+            s += 16;
+        }
+        ps.print(" ]\"");
+    };
+
     @Override
     public IPrinter createPrinter() {
-        return APolygonPrinter.INSTANCE;
+        return PRINTER;
     }
-
 }

http://git-wip-us.apache.org/repos/asf/incubator-asterixdb/blob/fd7fb5a1/asterixdb/asterix-om/src/main/java/org/apache/asterix/dataflow/data/nontagged/printers/csv/ARecordPrinterFactory.java
----------------------------------------------------------------------
diff --git a/asterixdb/asterix-om/src/main/java/org/apache/asterix/dataflow/data/nontagged/printers/csv/ARecordPrinterFactory.java b/asterixdb/asterix-om/src/main/java/org/apache/asterix/dataflow/data/nontagged/printers/csv/ARecordPrinterFactory.java
index ad513a5..baeb526 100644
--- a/asterixdb/asterix-om/src/main/java/org/apache/asterix/dataflow/data/nontagged/printers/csv/ARecordPrinterFactory.java
+++ b/asterixdb/asterix-om/src/main/java/org/apache/asterix/dataflow/data/nontagged/printers/csv/ARecordPrinterFactory.java
@@ -44,16 +44,14 @@ public class ARecordPrinterFactory implements IPrinterFactory {
 
     @Override
     public IPrinter createPrinter() {
-
-        PointableAllocator allocator = new PointableAllocator();
+        final 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);
+        final Pair<PrintStream, ATypeTag> arg = new Pair<>(null, null);
 
         return new IPrinter() {
-
             @Override
             public void init() {
                 arg.second = inputType.getTypeTag();

http://git-wip-us.apache.org/repos/asf/incubator-asterixdb/blob/fd7fb5a1/asterixdb/asterix-om/src/main/java/org/apache/asterix/dataflow/data/nontagged/printers/csv/ARectanglePrinter.java
----------------------------------------------------------------------
diff --git a/asterixdb/asterix-om/src/main/java/org/apache/asterix/dataflow/data/nontagged/printers/csv/ARectanglePrinter.java b/asterixdb/asterix-om/src/main/java/org/apache/asterix/dataflow/data/nontagged/printers/csv/ARectanglePrinter.java
deleted file mode 100644
index 07449cf..0000000
--- a/asterixdb/asterix-om/src/main/java/org/apache/asterix/dataflow/data/nontagged/printers/csv/ARectanglePrinter.java
+++ /dev/null
@@ -1,47 +0,0 @@
-/*
- * Licensed to the Apache Software Foundation (ASF) under one
- * or more contributor license agreements.  See the NOTICE file
- * distributed with this work for additional information
- * regarding copyright ownership.  The ASF licenses this file
- * to you 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 at
- *
- *   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 org.apache.asterix.dataflow.data.nontagged.printers.csv;
-
-import java.io.PrintStream;
-
-import org.apache.asterix.dataflow.data.nontagged.serde.ADoubleSerializerDeserializer;
-import org.apache.hyracks.algebricks.data.IPrinter;
-import org.apache.hyracks.api.exceptions.HyracksDataException;
-
-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 HyracksDataException {
-        ps.print("\"[ [");
-        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(", ");
-        ps.print(ADoubleSerializerDeserializer.getDouble(b, s + 25));
-        ps.print("] ]\"");
-    }
-}

http://git-wip-us.apache.org/repos/asf/incubator-asterixdb/blob/fd7fb5a1/asterixdb/asterix-om/src/main/java/org/apache/asterix/dataflow/data/nontagged/printers/csv/ARectanglePrinterFactory.java
----------------------------------------------------------------------
diff --git a/asterixdb/asterix-om/src/main/java/org/apache/asterix/dataflow/data/nontagged/printers/csv/ARectanglePrinterFactory.java b/asterixdb/asterix-om/src/main/java/org/apache/asterix/dataflow/data/nontagged/printers/csv/ARectanglePrinterFactory.java
index 13ec5d2..38a1c4f 100644
--- a/asterixdb/asterix-om/src/main/java/org/apache/asterix/dataflow/data/nontagged/printers/csv/ARectanglePrinterFactory.java
+++ b/asterixdb/asterix-om/src/main/java/org/apache/asterix/dataflow/data/nontagged/printers/csv/ARectanglePrinterFactory.java
@@ -18,6 +18,9 @@
  */
 package org.apache.asterix.dataflow.data.nontagged.printers.csv;
 
+import java.io.PrintStream;
+
+import org.apache.asterix.dataflow.data.nontagged.serde.ADoubleSerializerDeserializer;
 import org.apache.hyracks.algebricks.data.IPrinter;
 import org.apache.hyracks.algebricks.data.IPrinterFactory;
 
@@ -26,9 +29,20 @@ public class ARectanglePrinterFactory implements IPrinterFactory {
     private static final long serialVersionUID = 1L;
     public static final ARectanglePrinterFactory INSTANCE = new ARectanglePrinterFactory();
 
+    public static final IPrinter PRINTER = (byte[] b, int s, int l, PrintStream ps) -> {
+        ps.print("\"[ [");
+        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(", ");
+        ps.print(ADoubleSerializerDeserializer.getDouble(b, s + 25));
+        ps.print("] ]\"");
+    };
+
     @Override
     public IPrinter createPrinter() {
-        return ARectanglePrinter.INSTANCE;
+        return PRINTER;
     }
-
 }

http://git-wip-us.apache.org/repos/asf/incubator-asterixdb/blob/fd7fb5a1/asterixdb/asterix-om/src/main/java/org/apache/asterix/dataflow/data/nontagged/printers/csv/AStringPrinter.java
----------------------------------------------------------------------
diff --git a/asterixdb/asterix-om/src/main/java/org/apache/asterix/dataflow/data/nontagged/printers/csv/AStringPrinter.java b/asterixdb/asterix-om/src/main/java/org/apache/asterix/dataflow/data/nontagged/printers/csv/AStringPrinter.java
deleted file mode 100644
index 709929d..0000000
--- a/asterixdb/asterix-om/src/main/java/org/apache/asterix/dataflow/data/nontagged/printers/csv/AStringPrinter.java
+++ /dev/null
@@ -1,44 +0,0 @@
-/*
- * Licensed to the Apache Software Foundation (ASF) under one
- * or more contributor license agreements.  See the NOTICE file
- * distributed with this work for additional information
- * regarding copyright ownership.  The ASF licenses this file
- * to you 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 at
- *
- *   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 org.apache.asterix.dataflow.data.nontagged.printers.csv;
-
-import java.io.IOException;
-import java.io.PrintStream;
-
-import org.apache.asterix.dataflow.data.nontagged.printers.PrintTools;
-import org.apache.hyracks.algebricks.data.IPrinter;
-import org.apache.hyracks.api.exceptions.HyracksDataException;
-
-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 HyracksDataException {
-        try {
-            PrintTools.writeUTF8StringAsCSV(b, s + 1, l - 1, ps);
-        } catch (IOException e) {
-            throw new HyracksDataException(e);
-        }
-    }
-}

http://git-wip-us.apache.org/repos/asf/incubator-asterixdb/blob/fd7fb5a1/asterixdb/asterix-om/src/main/java/org/apache/asterix/dataflow/data/nontagged/printers/csv/AStringPrinterFactory.java
----------------------------------------------------------------------
diff --git a/asterixdb/asterix-om/src/main/java/org/apache/asterix/dataflow/data/nontagged/printers/csv/AStringPrinterFactory.java b/asterixdb/asterix-om/src/main/java/org/apache/asterix/dataflow/data/nontagged/printers/csv/AStringPrinterFactory.java
index 44f8c74..85925c9 100644
--- a/asterixdb/asterix-om/src/main/java/org/apache/asterix/dataflow/data/nontagged/printers/csv/AStringPrinterFactory.java
+++ b/asterixdb/asterix-om/src/main/java/org/apache/asterix/dataflow/data/nontagged/printers/csv/AStringPrinterFactory.java
@@ -18,17 +18,29 @@
  */
 package org.apache.asterix.dataflow.data.nontagged.printers.csv;
 
+import java.io.IOException;
+import java.io.PrintStream;
+
+import org.apache.asterix.dataflow.data.nontagged.printers.PrintTools;
 import org.apache.hyracks.algebricks.data.IPrinter;
 import org.apache.hyracks.algebricks.data.IPrinterFactory;
+import org.apache.hyracks.api.exceptions.HyracksDataException;
 
 public class AStringPrinterFactory implements IPrinterFactory {
 
     private static final long serialVersionUID = 1L;
     public static final AStringPrinterFactory INSTANCE = new AStringPrinterFactory();
 
+    public static final IPrinter PRINTER = (byte[] b, int s, int l, PrintStream ps) -> {
+        try {
+            PrintTools.writeUTF8StringAsCSV(b, s + 1, l - 1, ps);
+        } catch (IOException e) {
+            throw new HyracksDataException(e);
+        }
+    };
+
     @Override
     public IPrinter createPrinter() {
-        return AStringPrinter.INSTANCE;
+        return PRINTER;
     }
-
 }

http://git-wip-us.apache.org/repos/asf/incubator-asterixdb/blob/fd7fb5a1/asterixdb/asterix-om/src/main/java/org/apache/asterix/dataflow/data/nontagged/printers/csv/ATimePrinter.java
----------------------------------------------------------------------
diff --git a/asterixdb/asterix-om/src/main/java/org/apache/asterix/dataflow/data/nontagged/printers/csv/ATimePrinter.java b/asterixdb/asterix-om/src/main/java/org/apache/asterix/dataflow/data/nontagged/printers/csv/ATimePrinter.java
deleted file mode 100644
index dfd5501..0000000
--- a/asterixdb/asterix-om/src/main/java/org/apache/asterix/dataflow/data/nontagged/printers/csv/ATimePrinter.java
+++ /dev/null
@@ -1,41 +0,0 @@
-/*
- * Licensed to the Apache Software Foundation (ASF) under one
- * or more contributor license agreements.  See the NOTICE file
- * distributed with this work for additional information
- * regarding copyright ownership.  The ASF licenses this file
- * to you 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 at
- *
- *   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 org.apache.asterix.dataflow.data.nontagged.printers.csv;
-
-import java.io.PrintStream;
-
-import org.apache.asterix.dataflow.data.nontagged.printers.PrintTools;
-import org.apache.hyracks.algebricks.data.IPrinter;
-import org.apache.hyracks.api.exceptions.HyracksDataException;
-
-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 HyracksDataException {
-        ps.print("\"");
-        PrintTools.printTimeString(b, s, l, ps);
-        ps.print("\"");
-    }
-}

http://git-wip-us.apache.org/repos/asf/incubator-asterixdb/blob/fd7fb5a1/asterixdb/asterix-om/src/main/java/org/apache/asterix/dataflow/data/nontagged/printers/csv/ATimePrinterFactory.java
----------------------------------------------------------------------
diff --git a/asterixdb/asterix-om/src/main/java/org/apache/asterix/dataflow/data/nontagged/printers/csv/ATimePrinterFactory.java b/asterixdb/asterix-om/src/main/java/org/apache/asterix/dataflow/data/nontagged/printers/csv/ATimePrinterFactory.java
index 4a1fd5e..d328a2d 100644
--- a/asterixdb/asterix-om/src/main/java/org/apache/asterix/dataflow/data/nontagged/printers/csv/ATimePrinterFactory.java
+++ b/asterixdb/asterix-om/src/main/java/org/apache/asterix/dataflow/data/nontagged/printers/csv/ATimePrinterFactory.java
@@ -18,6 +18,9 @@
  */
 package org.apache.asterix.dataflow.data.nontagged.printers.csv;
 
+import java.io.PrintStream;
+
+import org.apache.asterix.dataflow.data.nontagged.printers.PrintTools;
 import org.apache.hyracks.algebricks.data.IPrinter;
 import org.apache.hyracks.algebricks.data.IPrinterFactory;
 
@@ -26,9 +29,14 @@ public class ATimePrinterFactory implements IPrinterFactory {
     private static final long serialVersionUID = 1L;
     public static final ATimePrinterFactory INSTANCE = new ATimePrinterFactory();
 
+    public static final IPrinter PRINTER = (byte[] b, int s, int l, PrintStream ps) -> {
+        ps.print("\"");
+        PrintTools.printTimeString(b, s, l, ps);
+        ps.print("\"");
+    };
+
     @Override
     public IPrinter createPrinter() {
-        return ATimePrinter.INSTANCE;
+        return PRINTER;
     }
-
 }

http://git-wip-us.apache.org/repos/asf/incubator-asterixdb/blob/fd7fb5a1/asterixdb/asterix-om/src/main/java/org/apache/asterix/dataflow/data/nontagged/printers/csv/AUUIDPrinter.java
----------------------------------------------------------------------
diff --git a/asterixdb/asterix-om/src/main/java/org/apache/asterix/dataflow/data/nontagged/printers/csv/AUUIDPrinter.java b/asterixdb/asterix-om/src/main/java/org/apache/asterix/dataflow/data/nontagged/printers/csv/AUUIDPrinter.java
deleted file mode 100644
index 34998e5..0000000
--- a/asterixdb/asterix-om/src/main/java/org/apache/asterix/dataflow/data/nontagged/printers/csv/AUUIDPrinter.java
+++ /dev/null
@@ -1,44 +0,0 @@
-/*
- * Licensed to the Apache Software Foundation (ASF) under one
- * or more contributor license agreements.  See the NOTICE file
- * distributed with this work for additional information
- * regarding copyright ownership.  The ASF licenses this file
- * to you 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 at
- *
- *   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 org.apache.asterix.dataflow.data.nontagged.printers.csv;
-
-import java.io.PrintStream;
-
-import org.apache.asterix.om.base.AUUID;
-import org.apache.hyracks.algebricks.data.IPrinter;
-import org.apache.hyracks.api.exceptions.HyracksDataException;
-
-public class AUUIDPrinter implements IPrinter {
-
-    public static final AUUIDPrinter INSTANCE = new AUUIDPrinter();
-
-    @Override
-    public void init() {
-    }
-
-    @Override
-    public void print(byte[] b, int s, int l, PrintStream ps) throws HyracksDataException {
-        StringBuilder buf = new StringBuilder(AUUID.UUID_CHARS + 2);
-        buf.append('"');
-        AUUID.appendLiteralOnly(b, s + 1, buf).append('"');
-        ps.print(buf.toString());
-    }
-
-}

http://git-wip-us.apache.org/repos/asf/incubator-asterixdb/blob/fd7fb5a1/asterixdb/asterix-om/src/main/java/org/apache/asterix/dataflow/data/nontagged/printers/csv/AUUIDPrinterFactory.java
----------------------------------------------------------------------
diff --git a/asterixdb/asterix-om/src/main/java/org/apache/asterix/dataflow/data/nontagged/printers/csv/AUUIDPrinterFactory.java b/asterixdb/asterix-om/src/main/java/org/apache/asterix/dataflow/data/nontagged/printers/csv/AUUIDPrinterFactory.java
index e15e297..e4ecfea 100644
--- a/asterixdb/asterix-om/src/main/java/org/apache/asterix/dataflow/data/nontagged/printers/csv/AUUIDPrinterFactory.java
+++ b/asterixdb/asterix-om/src/main/java/org/apache/asterix/dataflow/data/nontagged/printers/csv/AUUIDPrinterFactory.java
@@ -19,7 +19,9 @@
 
 package org.apache.asterix.dataflow.data.nontagged.printers.csv;
 
-import org.apache.asterix.dataflow.data.nontagged.printers.adm.AUUIDPrinter;
+import java.io.PrintStream;
+
+import org.apache.asterix.om.base.AUUID;
 import org.apache.hyracks.algebricks.data.IPrinter;
 import org.apache.hyracks.algebricks.data.IPrinterFactory;
 
@@ -29,8 +31,15 @@ public class AUUIDPrinterFactory implements IPrinterFactory {
 
     public static final AUUIDPrinterFactory INSTANCE = new AUUIDPrinterFactory();
 
+    public static final IPrinter PRINTER = (byte[] b, int s, int l, PrintStream ps) -> {
+        StringBuilder buf = new StringBuilder(AUUID.UUID_CHARS + 2);
+        buf.append('"');
+        AUUID.appendLiteralOnly(b, s + 1, buf).append('"');
+        ps.print(buf.toString());
+    };
+
     @Override
     public IPrinter createPrinter() {
-        return AUUIDPrinter.INSTANCE;
+        return PRINTER;
     }
 }



Mime
View raw message