You are viewing a plain text version of this content. The canonical link for it is here.
Posted to commits@asterixdb.apache.org by im...@apache.org on 2015/10/08 18:44:46 UTC
[2/5] incubator-asterixdb git commit: Move ADM-specific printers and
related classes into .adm packages.
http://git-wip-us.apache.org/repos/asf/incubator-asterixdb/blob/2574f43d/asterix-om/src/main/java/org/apache/asterix/dataflow/data/nontagged/printers/adm/AObjectPrinter.java
----------------------------------------------------------------------
diff --git a/asterix-om/src/main/java/org/apache/asterix/dataflow/data/nontagged/printers/adm/AObjectPrinter.java b/asterix-om/src/main/java/org/apache/asterix/dataflow/data/nontagged/printers/adm/AObjectPrinter.java
new file mode 100644
index 0000000..6a3d61d
--- /dev/null
+++ b/asterix-om/src/main/java/org/apache/asterix/dataflow/data/nontagged/printers/adm/AObjectPrinter.java
@@ -0,0 +1,177 @@
+/*
+ * 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.adm;
+
+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.AlgebricksException;
+import org.apache.hyracks.algebricks.common.exceptions.NotImplementedException;
+import org.apache.hyracks.algebricks.data.IPrinter;
+
+public class AObjectPrinter implements IPrinter {
+
+ public static final AObjectPrinter INSTANCE = new AObjectPrinter();
+
+ private IPrinter recordPrinter = new ARecordPrinterFactory(null).createPrinter();
+ private IPrinter orderedlistPrinter = new AOrderedlistPrinterFactory(null).createPrinter();
+ private IPrinter unorderedListPrinter = new AUnorderedlistPrinterFactory(null).createPrinter();
+
+ @Override
+ public void init() throws AlgebricksException {
+
+ }
+
+ @Override
+ public void print(byte[] b, int s, int l, PrintStream ps) throws AlgebricksException {
+ ATypeTag typeTag = EnumDeserializer.ATYPETAGDESERIALIZER.deserialize(b[s]);
+ switch (typeTag) {
+ case INT8: {
+ AInt8Printer.INSTANCE.print(b, s, l, ps);
+ break;
+ }
+ case INT16: {
+ AInt16Printer.INSTANCE.print(b, s, l, ps);
+ break;
+ }
+ case INT32: {
+ AInt32Printer.INSTANCE.print(b, s, l, ps);
+ break;
+ }
+ case INT64: {
+ AInt64Printer.INSTANCE.print(b, s, l, ps);
+ break;
+ }
+ case NULL: {
+ ANullPrinter.INSTANCE.print(b, s, l, ps);
+ break;
+ }
+ case BOOLEAN: {
+ ABooleanPrinter.INSTANCE.print(b, s, l, ps);
+ break;
+ }
+ case FLOAT: {
+ AFloatPrinter.INSTANCE.print(b, s, l, ps);
+ break;
+ }
+ case DOUBLE: {
+ ADoublePrinter.INSTANCE.print(b, s, l, ps);
+ break;
+ }
+ case DATE: {
+ ADatePrinter.INSTANCE.print(b, s, l, ps);
+ break;
+ }
+ case TIME: {
+ ATimePrinter.INSTANCE.print(b, s, l, ps);
+ break;
+ }
+ case DATETIME: {
+ ADateTimePrinter.INSTANCE.print(b, s, l, ps);
+ break;
+ }
+ case DURATION: {
+ ADurationPrinter.INSTANCE.print(b, s, l, ps);
+ break;
+ }
+ case YEARMONTHDURATION: {
+ AYearMonthDurationPrinter.INSTANCE.print(b, s, l, ps);
+ break;
+ }
+ case DAYTIMEDURATION: {
+ ADayTimeDurationPrinter.INSTANCE.print(b, s, l, ps);
+ break;
+ }
+ case INTERVAL: {
+ AIntervalPrinter.INSTANCE.print(b, s, l, ps);
+ break;
+ }
+ case POINT: {
+ APointPrinter.INSTANCE.print(b, s, l, ps);
+ break;
+ }
+ case POINT3D: {
+ APoint3DPrinter.INSTANCE.print(b, s, l, ps);
+ break;
+ }
+ case LINE: {
+ ALinePrinter.INSTANCE.print(b, s, l, ps);
+ break;
+ }
+ case POLYGON: {
+ APolygonPrinter.INSTANCE.print(b, s, l, ps);
+ break;
+ }
+ case RECTANGLE: {
+ ARectanglePrinter.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 BINARY: {
+ ABinaryHexPrinter.INSTANCE.print(b, s, l, ps);
+ break;
+ }
+ case RECORD: {
+ this.recordPrinter.init();
+ recordPrinter.print(b, s, l, ps);
+ break;
+ }
+ case ORDEREDLIST: {
+ this.orderedlistPrinter.init();
+ orderedlistPrinter.print(b, s, l, ps);
+ break;
+ }
+ case UNORDEREDLIST: {
+ this.unorderedListPrinter.init();
+ unorderedListPrinter.print(b, s, l, ps);
+ break;
+ }
+ case UUID: {
+ AUUIDPrinter.INSTANCE.print(b, s, l, ps);
+ break;
+ }
+ case SHORTWITHOUTTYPEINFO: {
+ ShortWithoutTypeInfoPrinter.INSTANCE.print(b, s, l, ps);
+ break;
+ }
+ case ANY:
+ case BITARRAY:
+ case ENUM:
+ case SPARSERECORD:
+ case SYSTEM_NULL:
+ case TYPE:
+ case UINT16:
+ case UINT32:
+ case UINT64:
+ case UINT8:
+ case UNION:
+ case UUID_STRING:
+ // These are internal types and do not need a printer.
+ throw new NotImplementedException("No printer for type " + typeTag);
+ }
+ }
+}
\ No newline at end of file
http://git-wip-us.apache.org/repos/asf/incubator-asterixdb/blob/2574f43d/asterix-om/src/main/java/org/apache/asterix/dataflow/data/nontagged/printers/adm/AObjectPrinterFactory.java
----------------------------------------------------------------------
diff --git a/asterix-om/src/main/java/org/apache/asterix/dataflow/data/nontagged/printers/adm/AObjectPrinterFactory.java b/asterix-om/src/main/java/org/apache/asterix/dataflow/data/nontagged/printers/adm/AObjectPrinterFactory.java
new file mode 100644
index 0000000..1812ae3
--- /dev/null
+++ b/asterix-om/src/main/java/org/apache/asterix/dataflow/data/nontagged/printers/adm/AObjectPrinterFactory.java
@@ -0,0 +1,34 @@
+/*
+ * 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.adm;
+
+import org.apache.hyracks.algebricks.data.IPrinter;
+import org.apache.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
http://git-wip-us.apache.org/repos/asf/incubator-asterixdb/blob/2574f43d/asterix-om/src/main/java/org/apache/asterix/dataflow/data/nontagged/printers/adm/AOrderedlistPrinterFactory.java
----------------------------------------------------------------------
diff --git a/asterix-om/src/main/java/org/apache/asterix/dataflow/data/nontagged/printers/adm/AOrderedlistPrinterFactory.java b/asterix-om/src/main/java/org/apache/asterix/dataflow/data/nontagged/printers/adm/AOrderedlistPrinterFactory.java
new file mode 100644
index 0000000..2ddd652
--- /dev/null
+++ b/asterix-om/src/main/java/org/apache/asterix/dataflow/data/nontagged/printers/adm/AOrderedlistPrinterFactory.java
@@ -0,0 +1,73 @@
+/*
+ * 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.adm;
+
+import java.io.PrintStream;
+
+import org.apache.asterix.om.pointables.PointableAllocator;
+import org.apache.asterix.om.pointables.base.DefaultOpenFieldType;
+import org.apache.asterix.om.pointables.base.IVisitablePointable;
+import org.apache.asterix.om.pointables.printer.adm.APrintVisitor;
+import org.apache.asterix.om.types.AOrderedListType;
+import org.apache.asterix.om.types.ATypeTag;
+import org.apache.asterix.om.types.IAType;
+import org.apache.hyracks.algebricks.common.exceptions.AlgebricksException;
+import org.apache.hyracks.algebricks.common.utils.Pair;
+import org.apache.hyracks.algebricks.data.IPrinter;
+import org.apache.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);
+ }
+ }
+ };
+ }
+}
http://git-wip-us.apache.org/repos/asf/incubator-asterixdb/blob/2574f43d/asterix-om/src/main/java/org/apache/asterix/dataflow/data/nontagged/printers/adm/APoint3DPrinter.java
----------------------------------------------------------------------
diff --git a/asterix-om/src/main/java/org/apache/asterix/dataflow/data/nontagged/printers/adm/APoint3DPrinter.java b/asterix-om/src/main/java/org/apache/asterix/dataflow/data/nontagged/printers/adm/APoint3DPrinter.java
new file mode 100644
index 0000000..ff7b452
--- /dev/null
+++ b/asterix-om/src/main/java/org/apache/asterix/dataflow/data/nontagged/printers/adm/APoint3DPrinter.java
@@ -0,0 +1,46 @@
+/*
+ * 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.adm;
+
+import java.io.PrintStream;
+
+import org.apache.asterix.dataflow.data.nontagged.serde.ADoubleSerializerDeserializer;
+import org.apache.hyracks.algebricks.common.exceptions.AlgebricksException;
+import org.apache.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
http://git-wip-us.apache.org/repos/asf/incubator-asterixdb/blob/2574f43d/asterix-om/src/main/java/org/apache/asterix/dataflow/data/nontagged/printers/adm/APoint3DPrinterFactory.java
----------------------------------------------------------------------
diff --git a/asterix-om/src/main/java/org/apache/asterix/dataflow/data/nontagged/printers/adm/APoint3DPrinterFactory.java b/asterix-om/src/main/java/org/apache/asterix/dataflow/data/nontagged/printers/adm/APoint3DPrinterFactory.java
new file mode 100644
index 0000000..351a227
--- /dev/null
+++ b/asterix-om/src/main/java/org/apache/asterix/dataflow/data/nontagged/printers/adm/APoint3DPrinterFactory.java
@@ -0,0 +1,34 @@
+/*
+ * 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.adm;
+
+import org.apache.hyracks.algebricks.data.IPrinter;
+import org.apache.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
http://git-wip-us.apache.org/repos/asf/incubator-asterixdb/blob/2574f43d/asterix-om/src/main/java/org/apache/asterix/dataflow/data/nontagged/printers/adm/APointPrinter.java
----------------------------------------------------------------------
diff --git a/asterix-om/src/main/java/org/apache/asterix/dataflow/data/nontagged/printers/adm/APointPrinter.java b/asterix-om/src/main/java/org/apache/asterix/dataflow/data/nontagged/printers/adm/APointPrinter.java
new file mode 100644
index 0000000..2a2ba08
--- /dev/null
+++ b/asterix-om/src/main/java/org/apache/asterix/dataflow/data/nontagged/printers/adm/APointPrinter.java
@@ -0,0 +1,44 @@
+/*
+ * 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.adm;
+
+import java.io.PrintStream;
+
+import org.apache.asterix.dataflow.data.nontagged.serde.ADoubleSerializerDeserializer;
+import org.apache.hyracks.algebricks.common.exceptions.AlgebricksException;
+import org.apache.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
http://git-wip-us.apache.org/repos/asf/incubator-asterixdb/blob/2574f43d/asterix-om/src/main/java/org/apache/asterix/dataflow/data/nontagged/printers/adm/APointPrinterFactory.java
----------------------------------------------------------------------
diff --git a/asterix-om/src/main/java/org/apache/asterix/dataflow/data/nontagged/printers/adm/APointPrinterFactory.java b/asterix-om/src/main/java/org/apache/asterix/dataflow/data/nontagged/printers/adm/APointPrinterFactory.java
new file mode 100644
index 0000000..1d17ed0
--- /dev/null
+++ b/asterix-om/src/main/java/org/apache/asterix/dataflow/data/nontagged/printers/adm/APointPrinterFactory.java
@@ -0,0 +1,34 @@
+/*
+ * 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.adm;
+
+import org.apache.hyracks.algebricks.data.IPrinter;
+import org.apache.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
http://git-wip-us.apache.org/repos/asf/incubator-asterixdb/blob/2574f43d/asterix-om/src/main/java/org/apache/asterix/dataflow/data/nontagged/printers/adm/APolygonPrinter.java
----------------------------------------------------------------------
diff --git a/asterix-om/src/main/java/org/apache/asterix/dataflow/data/nontagged/printers/adm/APolygonPrinter.java b/asterix-om/src/main/java/org/apache/asterix/dataflow/data/nontagged/printers/adm/APolygonPrinter.java
new file mode 100644
index 0000000..c5a7b85
--- /dev/null
+++ b/asterix-om/src/main/java/org/apache/asterix/dataflow/data/nontagged/printers/adm/APolygonPrinter.java
@@ -0,0 +1,53 @@
+/*
+ * 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.adm;
+
+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.common.exceptions.AlgebricksException;
+import org.apache.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(ADoubleSerializerDeserializer.getDouble(b, s));
+ ps.print(",");
+ ps.print(ADoubleSerializerDeserializer.getDouble(b, s + 8));
+ s += 16;
+ }
+ ps.print("\")");
+
+ }
+}
\ No newline at end of file
http://git-wip-us.apache.org/repos/asf/incubator-asterixdb/blob/2574f43d/asterix-om/src/main/java/org/apache/asterix/dataflow/data/nontagged/printers/adm/APolygonPrinterFactory.java
----------------------------------------------------------------------
diff --git a/asterix-om/src/main/java/org/apache/asterix/dataflow/data/nontagged/printers/adm/APolygonPrinterFactory.java b/asterix-om/src/main/java/org/apache/asterix/dataflow/data/nontagged/printers/adm/APolygonPrinterFactory.java
new file mode 100644
index 0000000..93a6cf6
--- /dev/null
+++ b/asterix-om/src/main/java/org/apache/asterix/dataflow/data/nontagged/printers/adm/APolygonPrinterFactory.java
@@ -0,0 +1,34 @@
+/*
+ * 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.adm;
+
+import org.apache.hyracks.algebricks.data.IPrinter;
+import org.apache.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
http://git-wip-us.apache.org/repos/asf/incubator-asterixdb/blob/2574f43d/asterix-om/src/main/java/org/apache/asterix/dataflow/data/nontagged/printers/adm/ARecordPrinterFactory.java
----------------------------------------------------------------------
diff --git a/asterix-om/src/main/java/org/apache/asterix/dataflow/data/nontagged/printers/adm/ARecordPrinterFactory.java b/asterix-om/src/main/java/org/apache/asterix/dataflow/data/nontagged/printers/adm/ARecordPrinterFactory.java
new file mode 100644
index 0000000..06cce73
--- /dev/null
+++ b/asterix-om/src/main/java/org/apache/asterix/dataflow/data/nontagged/printers/adm/ARecordPrinterFactory.java
@@ -0,0 +1,73 @@
+/*
+ * 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.adm;
+
+import java.io.PrintStream;
+
+import org.apache.asterix.om.pointables.PointableAllocator;
+import org.apache.asterix.om.pointables.base.DefaultOpenFieldType;
+import org.apache.asterix.om.pointables.base.IVisitablePointable;
+import org.apache.asterix.om.pointables.printer.adm.APrintVisitor;
+import org.apache.asterix.om.types.ARecordType;
+import org.apache.asterix.om.types.ATypeTag;
+import org.apache.asterix.om.types.IAType;
+import org.apache.hyracks.algebricks.common.exceptions.AlgebricksException;
+import org.apache.hyracks.algebricks.common.utils.Pair;
+import org.apache.hyracks.algebricks.data.IPrinter;
+import org.apache.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);
+ }
+ }
+ };
+ }
+}
http://git-wip-us.apache.org/repos/asf/incubator-asterixdb/blob/2574f43d/asterix-om/src/main/java/org/apache/asterix/dataflow/data/nontagged/printers/adm/ARectanglePrinter.java
----------------------------------------------------------------------
diff --git a/asterix-om/src/main/java/org/apache/asterix/dataflow/data/nontagged/printers/adm/ARectanglePrinter.java b/asterix-om/src/main/java/org/apache/asterix/dataflow/data/nontagged/printers/adm/ARectanglePrinter.java
new file mode 100644
index 0000000..2c488ad
--- /dev/null
+++ b/asterix-om/src/main/java/org/apache/asterix/dataflow/data/nontagged/printers/adm/ARectanglePrinter.java
@@ -0,0 +1,48 @@
+/*
+ * 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.adm;
+
+import java.io.PrintStream;
+
+import org.apache.asterix.dataflow.data.nontagged.serde.ADoubleSerializerDeserializer;
+import org.apache.hyracks.algebricks.common.exceptions.AlgebricksException;
+import org.apache.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(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("\")");
+ }
+}
\ No newline at end of file
http://git-wip-us.apache.org/repos/asf/incubator-asterixdb/blob/2574f43d/asterix-om/src/main/java/org/apache/asterix/dataflow/data/nontagged/printers/adm/ARectanglePrinterFactory.java
----------------------------------------------------------------------
diff --git a/asterix-om/src/main/java/org/apache/asterix/dataflow/data/nontagged/printers/adm/ARectanglePrinterFactory.java b/asterix-om/src/main/java/org/apache/asterix/dataflow/data/nontagged/printers/adm/ARectanglePrinterFactory.java
new file mode 100644
index 0000000..7be06d4
--- /dev/null
+++ b/asterix-om/src/main/java/org/apache/asterix/dataflow/data/nontagged/printers/adm/ARectanglePrinterFactory.java
@@ -0,0 +1,34 @@
+/*
+ * 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.adm;
+
+import org.apache.hyracks.algebricks.data.IPrinter;
+import org.apache.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
http://git-wip-us.apache.org/repos/asf/incubator-asterixdb/blob/2574f43d/asterix-om/src/main/java/org/apache/asterix/dataflow/data/nontagged/printers/adm/AStringPrinter.java
----------------------------------------------------------------------
diff --git a/asterix-om/src/main/java/org/apache/asterix/dataflow/data/nontagged/printers/adm/AStringPrinter.java b/asterix-om/src/main/java/org/apache/asterix/dataflow/data/nontagged/printers/adm/AStringPrinter.java
new file mode 100644
index 0000000..c767330
--- /dev/null
+++ b/asterix-om/src/main/java/org/apache/asterix/dataflow/data/nontagged/printers/adm/AStringPrinter.java
@@ -0,0 +1,45 @@
+/*
+ * 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.adm;
+
+import java.io.IOException;
+import java.io.PrintStream;
+
+import org.apache.hyracks.algebricks.common.exceptions.AlgebricksException;
+import org.apache.hyracks.algebricks.data.IPrinter;
+
+public class AStringPrinter implements IPrinter {
+
+ public static final AStringPrinter INSTANCE = new AStringPrinter();
+
+ @Override
+ public void init() {
+
+ }
+
+ @Override
+ public void print(byte[] b, int s, int l, PrintStream ps) throws AlgebricksException {
+ try {
+ // ADM uses same escape semantics as JSON for strings
+ PrintTools.writeUTF8StringAsJSON(b, s + 1, l - 1, ps);
+ } catch (IOException e) {
+ throw new AlgebricksException(e);
+ }
+ }
+}
http://git-wip-us.apache.org/repos/asf/incubator-asterixdb/blob/2574f43d/asterix-om/src/main/java/org/apache/asterix/dataflow/data/nontagged/printers/adm/AStringPrinterFactory.java
----------------------------------------------------------------------
diff --git a/asterix-om/src/main/java/org/apache/asterix/dataflow/data/nontagged/printers/adm/AStringPrinterFactory.java b/asterix-om/src/main/java/org/apache/asterix/dataflow/data/nontagged/printers/adm/AStringPrinterFactory.java
new file mode 100644
index 0000000..0621e50
--- /dev/null
+++ b/asterix-om/src/main/java/org/apache/asterix/dataflow/data/nontagged/printers/adm/AStringPrinterFactory.java
@@ -0,0 +1,34 @@
+/*
+ * 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.adm;
+
+import org.apache.hyracks.algebricks.data.IPrinter;
+import org.apache.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
http://git-wip-us.apache.org/repos/asf/incubator-asterixdb/blob/2574f43d/asterix-om/src/main/java/org/apache/asterix/dataflow/data/nontagged/printers/adm/ATimePrinter.java
----------------------------------------------------------------------
diff --git a/asterix-om/src/main/java/org/apache/asterix/dataflow/data/nontagged/printers/adm/ATimePrinter.java b/asterix-om/src/main/java/org/apache/asterix/dataflow/data/nontagged/printers/adm/ATimePrinter.java
new file mode 100644
index 0000000..06861a6
--- /dev/null
+++ b/asterix-om/src/main/java/org/apache/asterix/dataflow/data/nontagged/printers/adm/ATimePrinter.java
@@ -0,0 +1,57 @@
+/*
+ * 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.adm;
+
+import java.io.IOException;
+import java.io.PrintStream;
+
+import org.apache.asterix.dataflow.data.nontagged.serde.AInt32SerializerDeserializer;
+import org.apache.asterix.om.base.temporal.GregorianCalendarSystem;
+import org.apache.asterix.om.base.temporal.GregorianCalendarSystem.Fields;
+import org.apache.hyracks.algebricks.common.exceptions.AlgebricksException;
+import org.apache.hyracks.algebricks.data.IPrinter;
+
+public class ATimePrinter implements IPrinter {
+
+ public static final ATimePrinter INSTANCE = new ATimePrinter();
+ private static final GregorianCalendarSystem gCalInstance = GregorianCalendarSystem.getInstance();
+
+ @Override
+ public void init() {
+
+ }
+
+ @Override
+ public void print(byte[] b, int s, int l, PrintStream ps) throws AlgebricksException {
+ ps.print("time(\"");
+ printString(b,s,l, ps);
+ ps.print("\")");
+ }
+
+ public void printString(byte[] b, int s, int l, PrintStream ps) throws AlgebricksException {
+ int time = AInt32SerializerDeserializer.getInt(b, s + 1);
+
+ try {
+ gCalInstance.getExtendStringRepUntilField(time, 0, ps, Fields.HOUR, Fields.MILLISECOND, true);
+ } catch (IOException e) {
+ throw new AlgebricksException(e);
+ }
+ }
+
+}
\ No newline at end of file
http://git-wip-us.apache.org/repos/asf/incubator-asterixdb/blob/2574f43d/asterix-om/src/main/java/org/apache/asterix/dataflow/data/nontagged/printers/adm/ATimePrinterFactory.java
----------------------------------------------------------------------
diff --git a/asterix-om/src/main/java/org/apache/asterix/dataflow/data/nontagged/printers/adm/ATimePrinterFactory.java b/asterix-om/src/main/java/org/apache/asterix/dataflow/data/nontagged/printers/adm/ATimePrinterFactory.java
new file mode 100644
index 0000000..c776dab
--- /dev/null
+++ b/asterix-om/src/main/java/org/apache/asterix/dataflow/data/nontagged/printers/adm/ATimePrinterFactory.java
@@ -0,0 +1,34 @@
+/*
+ * 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.adm;
+
+import org.apache.hyracks.algebricks.data.IPrinter;
+import org.apache.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
http://git-wip-us.apache.org/repos/asf/incubator-asterixdb/blob/2574f43d/asterix-om/src/main/java/org/apache/asterix/dataflow/data/nontagged/printers/adm/AUUIDPrinter.java
----------------------------------------------------------------------
diff --git a/asterix-om/src/main/java/org/apache/asterix/dataflow/data/nontagged/printers/adm/AUUIDPrinter.java b/asterix-om/src/main/java/org/apache/asterix/dataflow/data/nontagged/printers/adm/AUUIDPrinter.java
new file mode 100644
index 0000000..c1b6b81
--- /dev/null
+++ b/asterix-om/src/main/java/org/apache/asterix/dataflow/data/nontagged/printers/adm/AUUIDPrinter.java
@@ -0,0 +1,48 @@
+/*
+ * 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.adm;
+
+import java.io.PrintStream;
+
+import org.apache.asterix.om.base.AMutableUUID;
+import org.apache.hyracks.algebricks.common.exceptions.AlgebricksException;
+import org.apache.hyracks.algebricks.data.IPrinter;
+import org.apache.hyracks.data.std.primitive.LongPointable;
+
+public class AUUIDPrinter implements IPrinter {
+
+ public static final AUUIDPrinter INSTANCE = new AUUIDPrinter();
+ // We use mutable UUID not to create a UUID object multiple times.
+ AMutableUUID uuid = new AMutableUUID(0, 0);
+
+ @Override
+ public void init() throws AlgebricksException {
+ }
+
+ @Override
+ public void print(byte[] b, int s, int l, PrintStream ps) throws AlgebricksException {
+ long msb = LongPointable.getLong(b, s + 1);
+ long lsb = LongPointable.getLong(b, s + 9);
+ uuid.setValue(msb, lsb);
+
+ ps.print("uuid(\"" + uuid.toStringLiteralOnly() + "\")");
+ }
+
+}
http://git-wip-us.apache.org/repos/asf/incubator-asterixdb/blob/2574f43d/asterix-om/src/main/java/org/apache/asterix/dataflow/data/nontagged/printers/adm/AUUIDPrinterFactory.java
----------------------------------------------------------------------
diff --git a/asterix-om/src/main/java/org/apache/asterix/dataflow/data/nontagged/printers/adm/AUUIDPrinterFactory.java b/asterix-om/src/main/java/org/apache/asterix/dataflow/data/nontagged/printers/adm/AUUIDPrinterFactory.java
new file mode 100644
index 0000000..eeed0b8
--- /dev/null
+++ b/asterix-om/src/main/java/org/apache/asterix/dataflow/data/nontagged/printers/adm/AUUIDPrinterFactory.java
@@ -0,0 +1,36 @@
+/*
+ * 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.adm;
+
+import org.apache.hyracks.algebricks.data.IPrinter;
+import org.apache.hyracks.algebricks.data.IPrinterFactory;
+
+public class AUUIDPrinterFactory implements IPrinterFactory {
+
+ private static final long serialVersionUID = 1L;
+
+ public static final AUUIDPrinterFactory INSTANCE = new AUUIDPrinterFactory();
+
+ @Override
+ public IPrinter createPrinter() {
+ return AUUIDPrinter.INSTANCE;
+ }
+
+}
http://git-wip-us.apache.org/repos/asf/incubator-asterixdb/blob/2574f43d/asterix-om/src/main/java/org/apache/asterix/dataflow/data/nontagged/printers/adm/AUnionPrinterFactory.java
----------------------------------------------------------------------
diff --git a/asterix-om/src/main/java/org/apache/asterix/dataflow/data/nontagged/printers/adm/AUnionPrinterFactory.java b/asterix-om/src/main/java/org/apache/asterix/dataflow/data/nontagged/printers/adm/AUnionPrinterFactory.java
new file mode 100644
index 0000000..5d4f450
--- /dev/null
+++ b/asterix-om/src/main/java/org/apache/asterix/dataflow/data/nontagged/printers/adm/AUnionPrinterFactory.java
@@ -0,0 +1,76 @@
+/*
+ * 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.adm;
+
+import java.io.PrintStream;
+import java.util.List;
+
+import org.apache.asterix.formats.nontagged.AqlADMPrinterFactoryProvider;
+import org.apache.asterix.om.types.ATypeTag;
+import org.apache.asterix.om.types.AUnionType;
+import org.apache.asterix.om.types.IAType;
+import org.apache.hyracks.algebricks.common.exceptions.AlgebricksException;
+import org.apache.hyracks.algebricks.data.IPrinter;
+import org.apache.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] = (AqlADMPrinterFactoryProvider.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);
+ }
+ }
+ };
+ }
+
+}
http://git-wip-us.apache.org/repos/asf/incubator-asterixdb/blob/2574f43d/asterix-om/src/main/java/org/apache/asterix/dataflow/data/nontagged/printers/adm/AUnorderedlistPrinterFactory.java
----------------------------------------------------------------------
diff --git a/asterix-om/src/main/java/org/apache/asterix/dataflow/data/nontagged/printers/adm/AUnorderedlistPrinterFactory.java b/asterix-om/src/main/java/org/apache/asterix/dataflow/data/nontagged/printers/adm/AUnorderedlistPrinterFactory.java
new file mode 100644
index 0000000..fa586db
--- /dev/null
+++ b/asterix-om/src/main/java/org/apache/asterix/dataflow/data/nontagged/printers/adm/AUnorderedlistPrinterFactory.java
@@ -0,0 +1,73 @@
+/*
+ * 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.adm;
+
+import java.io.PrintStream;
+
+import org.apache.asterix.om.pointables.PointableAllocator;
+import org.apache.asterix.om.pointables.base.DefaultOpenFieldType;
+import org.apache.asterix.om.pointables.base.IVisitablePointable;
+import org.apache.asterix.om.pointables.printer.adm.APrintVisitor;
+import org.apache.asterix.om.types.ATypeTag;
+import org.apache.asterix.om.types.AUnorderedListType;
+import org.apache.asterix.om.types.IAType;
+import org.apache.hyracks.algebricks.common.exceptions.AlgebricksException;
+import org.apache.hyracks.algebricks.common.utils.Pair;
+import org.apache.hyracks.algebricks.data.IPrinter;
+import org.apache.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);
+ }
+ }
+ };
+ }
+}
http://git-wip-us.apache.org/repos/asf/incubator-asterixdb/blob/2574f43d/asterix-om/src/main/java/org/apache/asterix/dataflow/data/nontagged/printers/adm/AYearMonthDurationPrinter.java
----------------------------------------------------------------------
diff --git a/asterix-om/src/main/java/org/apache/asterix/dataflow/data/nontagged/printers/adm/AYearMonthDurationPrinter.java b/asterix-om/src/main/java/org/apache/asterix/dataflow/data/nontagged/printers/adm/AYearMonthDurationPrinter.java
new file mode 100644
index 0000000..d91eb17
--- /dev/null
+++ b/asterix-om/src/main/java/org/apache/asterix/dataflow/data/nontagged/printers/adm/AYearMonthDurationPrinter.java
@@ -0,0 +1,79 @@
+/*
+ * 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.adm;
+
+import java.io.IOException;
+import java.io.PrintStream;
+
+import org.apache.asterix.dataflow.data.nontagged.serde.AInt32SerializerDeserializer;
+import org.apache.asterix.om.base.temporal.GregorianCalendarSystem;
+import org.apache.hyracks.algebricks.common.exceptions.AlgebricksException;
+import org.apache.hyracks.algebricks.data.IPrinter;
+import org.apache.hyracks.algebricks.data.utils.WriteValueTools;
+
+public class AYearMonthDurationPrinter implements IPrinter {
+
+ public static final AYearMonthDurationPrinter INSTANCE = new AYearMonthDurationPrinter();
+ private static final GregorianCalendarSystem gCalInstance = GregorianCalendarSystem.getInstance();
+
+ /* (non-Javadoc)
+ * @see org.apache.hyracks.algebricks.data.IPrinter#init()
+ */
+ @Override
+ public void init() throws AlgebricksException {
+ }
+
+ /* (non-Javadoc)
+ * @see org.apache.hyracks.algebricks.data.IPrinter#print(byte[], int, int, java.io.PrintStream)
+ */
+ @Override
+ public void print(byte[] b, int s, int l, PrintStream ps) throws AlgebricksException {
+ boolean positive = true;
+ int months = AInt32SerializerDeserializer.getInt(b, s + 1);
+
+ // set the negative flag. "||" is necessary in case that months field is not there (so it is 0)
+ if (months < 0) {
+ months *= -1;
+ positive = false;
+ }
+
+ int month = gCalInstance.getDurationMonth(months);
+ int year = gCalInstance.getDurationYear(months);
+
+ ps.print("year-month-duration(\"");
+ if (!positive) {
+ ps.print("-");
+ }
+ try {
+ ps.print("P");
+ if (year != 0) {
+ WriteValueTools.writeInt(year, ps);
+ ps.print("Y");
+ }
+ if (month != 0) {
+ WriteValueTools.writeInt(month, ps);
+ ps.print("M");
+ }
+ ps.print("\")");
+ } catch (IOException e) {
+ throw new AlgebricksException(e);
+ }
+ }
+
+}
http://git-wip-us.apache.org/repos/asf/incubator-asterixdb/blob/2574f43d/asterix-om/src/main/java/org/apache/asterix/dataflow/data/nontagged/printers/adm/AYearMonthDurationPrinterFactory.java
----------------------------------------------------------------------
diff --git a/asterix-om/src/main/java/org/apache/asterix/dataflow/data/nontagged/printers/adm/AYearMonthDurationPrinterFactory.java b/asterix-om/src/main/java/org/apache/asterix/dataflow/data/nontagged/printers/adm/AYearMonthDurationPrinterFactory.java
new file mode 100644
index 0000000..ff16fb7
--- /dev/null
+++ b/asterix-om/src/main/java/org/apache/asterix/dataflow/data/nontagged/printers/adm/AYearMonthDurationPrinterFactory.java
@@ -0,0 +1,37 @@
+/*
+ * 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.adm;
+
+import org.apache.hyracks.algebricks.data.IPrinter;
+import org.apache.hyracks.algebricks.data.IPrinterFactory;
+
+public class AYearMonthDurationPrinterFactory implements IPrinterFactory {
+
+ private static final long serialVersionUID = 1L;
+ public static final AYearMonthDurationPrinterFactory INSTANCE = new AYearMonthDurationPrinterFactory();
+
+ /* (non-Javadoc)
+ * @see org.apache.hyracks.algebricks.data.IPrinterFactory#createPrinter()
+ */
+ @Override
+ public IPrinter createPrinter() {
+ return AYearMonthDurationPrinter.INSTANCE;
+ }
+
+}
http://git-wip-us.apache.org/repos/asf/incubator-asterixdb/blob/2574f43d/asterix-om/src/main/java/org/apache/asterix/dataflow/data/nontagged/printers/adm/PrintTools.java
----------------------------------------------------------------------
diff --git a/asterix-om/src/main/java/org/apache/asterix/dataflow/data/nontagged/printers/adm/PrintTools.java b/asterix-om/src/main/java/org/apache/asterix/dataflow/data/nontagged/printers/adm/PrintTools.java
new file mode 100644
index 0000000..395bfd8
--- /dev/null
+++ b/asterix-om/src/main/java/org/apache/asterix/dataflow/data/nontagged/printers/adm/PrintTools.java
@@ -0,0 +1,159 @@
+/*
+ * 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.adm;
+
+import java.io.IOException;
+import java.io.OutputStream;
+
+import org.apache.hyracks.data.std.primitive.UTF8StringPointable;
+
+public class PrintTools {
+ public static enum CASE {
+ LOWER_CASE,
+ UPPER_CASE,
+ }
+
+
+ public static void writeUTF8StringAsCSV(byte[] b, int s, int l, OutputStream os) throws IOException {
+ int stringLength = UTF8StringPointable.getUTFLength(b, s);
+ int position = s + 2; // skip 2 bytes containing string size
+ int maxPosition = position + stringLength;
+ os.write('"');
+ while (position < maxPosition) {
+ char c = UTF8StringPointable.charAt(b, position);
+ int sz = UTF8StringPointable.charSize(b, position);
+ if (c == '"') {
+ os.write('"');
+ }
+ os.write(c);
+ position += sz;
+ }
+ os.write('"');
+ }
+
+ public static void writeUTF8StringAsJSON(byte[] b, int s, int l, OutputStream os) throws IOException {
+ int stringLength = UTF8StringPointable.getUTFLength(b, s);
+ int position = s + 2; // skip 2 bytes containing string size
+ int maxPosition = position + stringLength;
+ os.write('"');
+ while (position < maxPosition) {
+ char c = UTF8StringPointable.charAt(b, position);
+ int sz = UTF8StringPointable.charSize(b, position);
+ switch (c) {
+ // escape
+ case '\b':
+ os.write('\\');
+ os.write('b');
+ position += sz;
+ break;
+ case '\f':
+ os.write('\\');
+ os.write('f');
+ position += sz;
+ break;
+ case '\n':
+ os.write('\\');
+ os.write('n');
+ position += sz;
+ break;
+ case '\r':
+ os.write('\\');
+ os.write('r');
+ position += sz;
+ break;
+ case '\t':
+ os.write('\\');
+ os.write('t');
+ position += sz;
+ break;
+ case '\\':
+ case '"':
+ os.write('\\');
+ default:
+ switch (sz) {
+ case 1:
+ if (c <= (byte) 0x1f || c == (byte) 0x7f) {
+ // this is to print out "control code points" (single byte UTF-8 representation,
+ // value up to 0x1f or 0x7f) in the 'uXXXX' format
+ writeUEscape(os, c);
+ ++position;
+ sz = 0; // no more processing
+ }
+ break;
+
+ case 2:
+ // 2-byte encodings of some code points in modified UTF-8 as described in
+ // DataInput.html#modified-utf-8
+ //
+ // 110xxxxx 10xxxxxx
+ // U+0000 00000 000000 C0 80
+ // U+0080 00010 000000 C2 80
+ // U+009F 00010 011111 C2 9F
+ switch (b[position]) {
+ case (byte) 0xc0:
+ if (b[position + 1] == (byte) 0x80) {
+ // special treatment for the U+0000 code point as described in
+ // DataInput.html#modified-utf-8
+ writeUEscape(os, c);
+ position += 2;
+ sz = 0; // no more processing
+ }
+ break;
+ case (byte) 0xc2:
+ if (b[position + 1] <= (byte) 0x9f) {
+ // special treatment for the U+0080 to U+009F code points
+ writeUEscape(os, c);
+ position += 2;
+ sz = 0; // no more processing
+ }
+ break;
+ }
+ break;
+ }
+ while (sz > 0) {
+ os.write(b[position]);
+ ++position;
+ --sz;
+ }
+ break;
+ }
+ }
+ os.write('\"');
+ }
+
+ private static void writeUEscape(OutputStream os, char c) throws IOException {
+ os.write('\\');
+ os.write('u');
+ os.write('0');
+ os.write('0');
+ os.write(hex((c >>> 4) & 0x0f, CASE.LOWER_CASE));
+ os.write(hex(c & 0x0f, CASE.LOWER_CASE));
+ }
+
+ static byte hex(int i, CASE c) {
+ switch (c) {
+ case LOWER_CASE:
+ return (byte) (i < 10 ? i + '0' : i + ('a' - 10));
+ case UPPER_CASE:
+ return (byte) (i < 10 ? i + '0' : i + ('A' - 10));
+ }
+ return Byte.parseByte(null);
+ }
+
+}
http://git-wip-us.apache.org/repos/asf/incubator-asterixdb/blob/2574f43d/asterix-om/src/main/java/org/apache/asterix/dataflow/data/nontagged/printers/adm/ShortWithoutTypeInfoPrinter.java
----------------------------------------------------------------------
diff --git a/asterix-om/src/main/java/org/apache/asterix/dataflow/data/nontagged/printers/adm/ShortWithoutTypeInfoPrinter.java b/asterix-om/src/main/java/org/apache/asterix/dataflow/data/nontagged/printers/adm/ShortWithoutTypeInfoPrinter.java
new file mode 100644
index 0000000..ec3ee38
--- /dev/null
+++ b/asterix-om/src/main/java/org/apache/asterix/dataflow/data/nontagged/printers/adm/ShortWithoutTypeInfoPrinter.java
@@ -0,0 +1,47 @@
+/*
+ * 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.adm;
+
+import java.io.IOException;
+import java.io.PrintStream;
+
+import org.apache.hyracks.algebricks.common.exceptions.AlgebricksException;
+import org.apache.hyracks.algebricks.data.IPrinter;
+import org.apache.hyracks.algebricks.data.utils.WriteValueTools;
+import org.apache.hyracks.data.std.primitive.ShortPointable;
+
+public class ShortWithoutTypeInfoPrinter implements IPrinter {
+
+ public static final ShortWithoutTypeInfoPrinter INSTANCE = new ShortWithoutTypeInfoPrinter();
+
+ @Override
+ public void init() {
+
+ }
+
+ @Override
+ public void print(byte[] b, int s, int l, PrintStream ps) throws AlgebricksException {
+ short d = ShortPointable.getShort(b, s);
+ try {
+ WriteValueTools.writeInt((int)d, ps);
+ } catch (IOException e) {
+ throw new AlgebricksException(e);
+ }
+ }
+}
\ No newline at end of file
http://git-wip-us.apache.org/repos/asf/incubator-asterixdb/blob/2574f43d/asterix-om/src/main/java/org/apache/asterix/dataflow/data/nontagged/printers/adm/ShortWithoutTypeInfoPrinterFactory.java
----------------------------------------------------------------------
diff --git a/asterix-om/src/main/java/org/apache/asterix/dataflow/data/nontagged/printers/adm/ShortWithoutTypeInfoPrinterFactory.java b/asterix-om/src/main/java/org/apache/asterix/dataflow/data/nontagged/printers/adm/ShortWithoutTypeInfoPrinterFactory.java
new file mode 100644
index 0000000..ec93417
--- /dev/null
+++ b/asterix-om/src/main/java/org/apache/asterix/dataflow/data/nontagged/printers/adm/ShortWithoutTypeInfoPrinterFactory.java
@@ -0,0 +1,34 @@
+/*
+ * 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.adm;
+
+import org.apache.hyracks.algebricks.data.IPrinter;
+import org.apache.hyracks.algebricks.data.IPrinterFactory;
+
+public class ShortWithoutTypeInfoPrinterFactory implements IPrinterFactory {
+
+ private static final long serialVersionUID = 1L;
+ public static final ShortWithoutTypeInfoPrinterFactory INSTANCE = new ShortWithoutTypeInfoPrinterFactory();
+
+ @Override
+ public IPrinter createPrinter() {
+ return ShortWithoutTypeInfoPrinter.INSTANCE;
+ }
+
+}
\ No newline at end of file
http://git-wip-us.apache.org/repos/asf/incubator-asterixdb/blob/2574f43d/asterix-om/src/main/java/org/apache/asterix/dataflow/data/nontagged/printers/csv/AStringPrinter.java
----------------------------------------------------------------------
diff --git a/asterix-om/src/main/java/org/apache/asterix/dataflow/data/nontagged/printers/csv/AStringPrinter.java b/asterix-om/src/main/java/org/apache/asterix/dataflow/data/nontagged/printers/csv/AStringPrinter.java
index 8c6337e..c88efe4 100644
--- a/asterix-om/src/main/java/org/apache/asterix/dataflow/data/nontagged/printers/csv/AStringPrinter.java
+++ b/asterix-om/src/main/java/org/apache/asterix/dataflow/data/nontagged/printers/csv/AStringPrinter.java
@@ -21,7 +21,7 @@ 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.asterix.dataflow.data.nontagged.printers.adm.PrintTools;
import org.apache.hyracks.algebricks.common.exceptions.AlgebricksException;
import org.apache.hyracks.algebricks.data.IPrinter;
http://git-wip-us.apache.org/repos/asf/incubator-asterixdb/blob/2574f43d/asterix-om/src/main/java/org/apache/asterix/dataflow/data/nontagged/printers/json/AObjectPrinter.java
----------------------------------------------------------------------
diff --git a/asterix-om/src/main/java/org/apache/asterix/dataflow/data/nontagged/printers/json/AObjectPrinter.java b/asterix-om/src/main/java/org/apache/asterix/dataflow/data/nontagged/printers/json/AObjectPrinter.java
index 4247841..faf21a3 100644
--- a/asterix-om/src/main/java/org/apache/asterix/dataflow/data/nontagged/printers/json/AObjectPrinter.java
+++ b/asterix-om/src/main/java/org/apache/asterix/dataflow/data/nontagged/printers/json/AObjectPrinter.java
@@ -20,7 +20,7 @@ package org.apache.asterix.dataflow.data.nontagged.printers.json;
import java.io.PrintStream;
-import org.apache.asterix.dataflow.data.nontagged.printers.ABinaryHexPrinter;
+import org.apache.asterix.dataflow.data.nontagged.printers.adm.ABinaryHexPrinter;
import org.apache.asterix.om.types.ATypeTag;
import org.apache.asterix.om.types.EnumDeserializer;
import org.apache.hyracks.algebricks.common.exceptions.AlgebricksException;
http://git-wip-us.apache.org/repos/asf/incubator-asterixdb/blob/2574f43d/asterix-om/src/main/java/org/apache/asterix/dataflow/data/nontagged/printers/json/AStringPrinter.java
----------------------------------------------------------------------
diff --git a/asterix-om/src/main/java/org/apache/asterix/dataflow/data/nontagged/printers/json/AStringPrinter.java b/asterix-om/src/main/java/org/apache/asterix/dataflow/data/nontagged/printers/json/AStringPrinter.java
index c5fb80c6..bd19b66 100644
--- a/asterix-om/src/main/java/org/apache/asterix/dataflow/data/nontagged/printers/json/AStringPrinter.java
+++ b/asterix-om/src/main/java/org/apache/asterix/dataflow/data/nontagged/printers/json/AStringPrinter.java
@@ -21,7 +21,7 @@ package org.apache.asterix.dataflow.data.nontagged.printers.json;
import java.io.IOException;
import java.io.PrintStream;
-import org.apache.asterix.dataflow.data.nontagged.printers.PrintTools;
+import org.apache.asterix.dataflow.data.nontagged.printers.adm.PrintTools;
import org.apache.hyracks.algebricks.common.exceptions.AlgebricksException;
import org.apache.hyracks.algebricks.data.IPrinter;
http://git-wip-us.apache.org/repos/asf/incubator-asterixdb/blob/2574f43d/asterix-om/src/main/java/org/apache/asterix/formats/base/IDataFormat.java
----------------------------------------------------------------------
diff --git a/asterix-om/src/main/java/org/apache/asterix/formats/base/IDataFormat.java b/asterix-om/src/main/java/org/apache/asterix/formats/base/IDataFormat.java
index f5e8ab0..ffbcd20 100644
--- a/asterix-om/src/main/java/org/apache/asterix/formats/base/IDataFormat.java
+++ b/asterix-om/src/main/java/org/apache/asterix/formats/base/IDataFormat.java
@@ -61,7 +61,7 @@ public interface IDataFormat {
public IBinaryIntegerInspectorFactory getBinaryIntegerInspectorFactory();
// QQQ Refactor: Make this accept an APIFramework.OutputFormat parameter
- public IPrinterFactoryProvider getPrinterFactoryProvider();
+ public IPrinterFactoryProvider getADMPrinterFactoryProvider();
public IPrinterFactoryProvider getJSONPrinterFactoryProvider();
http://git-wip-us.apache.org/repos/asf/incubator-asterixdb/blob/2574f43d/asterix-om/src/main/java/org/apache/asterix/formats/nontagged/AqlADMPrinterFactoryProvider.java
----------------------------------------------------------------------
diff --git a/asterix-om/src/main/java/org/apache/asterix/formats/nontagged/AqlADMPrinterFactoryProvider.java b/asterix-om/src/main/java/org/apache/asterix/formats/nontagged/AqlADMPrinterFactoryProvider.java
new file mode 100644
index 0000000..19174f6
--- /dev/null
+++ b/asterix-om/src/main/java/org/apache/asterix/formats/nontagged/AqlADMPrinterFactoryProvider.java
@@ -0,0 +1,155 @@
+/*
+ * 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.formats.nontagged;
+
+import org.apache.asterix.dataflow.data.nontagged.printers.adm.ABinaryPrinterFactory;
+import org.apache.asterix.dataflow.data.nontagged.printers.adm.ABooleanPrinterFactory;
+import org.apache.asterix.dataflow.data.nontagged.printers.adm.ACirclePrinterFactory;
+import org.apache.asterix.dataflow.data.nontagged.printers.adm.ADatePrinterFactory;
+import org.apache.asterix.dataflow.data.nontagged.printers.adm.ADateTimePrinterFactory;
+import org.apache.asterix.dataflow.data.nontagged.printers.adm.ADayTimeDurationPrinterFactory;
+import org.apache.asterix.dataflow.data.nontagged.printers.adm.ADoublePrinterFactory;
+import org.apache.asterix.dataflow.data.nontagged.printers.adm.ADurationPrinterFactory;
+import org.apache.asterix.dataflow.data.nontagged.printers.adm.AFloatPrinterFactory;
+import org.apache.asterix.dataflow.data.nontagged.printers.adm.AInt16PrinterFactory;
+import org.apache.asterix.dataflow.data.nontagged.printers.adm.AInt32PrinterFactory;
+import org.apache.asterix.dataflow.data.nontagged.printers.adm.AInt64PrinterFactory;
+import org.apache.asterix.dataflow.data.nontagged.printers.adm.AInt8PrinterFactory;
+import org.apache.asterix.dataflow.data.nontagged.printers.adm.AIntervalPrinterFactory;
+import org.apache.asterix.dataflow.data.nontagged.printers.adm.ALinePrinterFactory;
+import org.apache.asterix.dataflow.data.nontagged.printers.adm.ANullPrinterFactory;
+import org.apache.asterix.dataflow.data.nontagged.printers.adm.ANullableFieldPrinterFactory;
+import org.apache.asterix.dataflow.data.nontagged.printers.adm.AObjectPrinterFactory;
+import org.apache.asterix.dataflow.data.nontagged.printers.adm.AOrderedlistPrinterFactory;
+import org.apache.asterix.dataflow.data.nontagged.printers.adm.APoint3DPrinterFactory;
+import org.apache.asterix.dataflow.data.nontagged.printers.adm.APointPrinterFactory;
+import org.apache.asterix.dataflow.data.nontagged.printers.adm.APolygonPrinterFactory;
+import org.apache.asterix.dataflow.data.nontagged.printers.adm.ARecordPrinterFactory;
+import org.apache.asterix.dataflow.data.nontagged.printers.adm.ARectanglePrinterFactory;
+import org.apache.asterix.dataflow.data.nontagged.printers.adm.AStringPrinterFactory;
+import org.apache.asterix.dataflow.data.nontagged.printers.adm.ATimePrinterFactory;
+import org.apache.asterix.dataflow.data.nontagged.printers.adm.AUUIDPrinterFactory;
+import org.apache.asterix.dataflow.data.nontagged.printers.adm.AUnionPrinterFactory;
+import org.apache.asterix.dataflow.data.nontagged.printers.adm.AUnorderedlistPrinterFactory;
+import org.apache.asterix.dataflow.data.nontagged.printers.adm.AYearMonthDurationPrinterFactory;
+import org.apache.asterix.dataflow.data.nontagged.printers.adm.ShortWithoutTypeInfoPrinterFactory;
+import org.apache.asterix.om.types.AOrderedListType;
+import org.apache.asterix.om.types.ARecordType;
+import org.apache.asterix.om.types.AUnionType;
+import org.apache.asterix.om.types.AUnorderedListType;
+import org.apache.asterix.om.types.IAType;
+import org.apache.hyracks.algebricks.common.exceptions.AlgebricksException;
+import org.apache.hyracks.algebricks.data.IPrinterFactory;
+import org.apache.hyracks.algebricks.data.IPrinterFactoryProvider;
+
+public class AqlADMPrinterFactoryProvider implements IPrinterFactoryProvider {
+
+ public static final AqlADMPrinterFactoryProvider INSTANCE = new AqlADMPrinterFactoryProvider();
+
+ private AqlADMPrinterFactoryProvider() {
+ }
+
+ @Override
+ public IPrinterFactory getPrinterFactory(Object type) throws AlgebricksException {
+ IAType aqlType = (IAType) type;
+
+ if (aqlType != null) {
+ switch (aqlType.getTypeTag()) {
+ case INT8:
+ return AInt8PrinterFactory.INSTANCE;
+ case INT16:
+ return AInt16PrinterFactory.INSTANCE;
+ case INT32:
+ return AInt32PrinterFactory.INSTANCE;
+ case INT64:
+ return AInt64PrinterFactory.INSTANCE;
+ case NULL:
+ return ANullPrinterFactory.INSTANCE;
+ case BOOLEAN:
+ return ABooleanPrinterFactory.INSTANCE;
+ case FLOAT:
+ return AFloatPrinterFactory.INSTANCE;
+ case DOUBLE:
+ return ADoublePrinterFactory.INSTANCE;
+ case TIME:
+ return ATimePrinterFactory.INSTANCE;
+ case DATE:
+ return ADatePrinterFactory.INSTANCE;
+ case DATETIME:
+ return ADateTimePrinterFactory.INSTANCE;
+ case DURATION:
+ return ADurationPrinterFactory.INSTANCE;
+ case DAYTIMEDURATION:
+ return ADayTimeDurationPrinterFactory.INSTANCE;
+ case YEARMONTHDURATION:
+ return AYearMonthDurationPrinterFactory.INSTANCE;
+ case INTERVAL:
+ return AIntervalPrinterFactory.INSTANCE;
+ case POINT:
+ return APointPrinterFactory.INSTANCE;
+ case POINT3D:
+ return APoint3DPrinterFactory.INSTANCE;
+ case LINE:
+ return ALinePrinterFactory.INSTANCE;
+ case POLYGON:
+ return APolygonPrinterFactory.INSTANCE;
+ case CIRCLE:
+ return ACirclePrinterFactory.INSTANCE;
+ case RECTANGLE:
+ return ARectanglePrinterFactory.INSTANCE;
+ case STRING:
+ return AStringPrinterFactory.INSTANCE;
+ case BINARY:
+ return ABinaryPrinterFactory.INSTANCE;
+ case RECORD:
+ return new ARecordPrinterFactory((ARecordType) aqlType);
+ case ORDEREDLIST:
+ return new AOrderedlistPrinterFactory((AOrderedListType) aqlType);
+ case UNORDEREDLIST:
+ return new AUnorderedlistPrinterFactory((AUnorderedListType) aqlType);
+ case UNION: {
+ if (((AUnionType) aqlType).isNullableType())
+ return new ANullableFieldPrinterFactory((AUnionType) aqlType);
+ else
+ return new AUnionPrinterFactory((AUnionType) aqlType);
+ }
+ case UUID: {
+ return AUUIDPrinterFactory.INSTANCE;
+ }
+ case SHORTWITHOUTTYPEINFO:
+ return ShortWithoutTypeInfoPrinterFactory.INSTANCE;
+ case ANY:
+ case BITARRAY:
+ case ENUM:
+ case SPARSERECORD:
+ case SYSTEM_NULL:
+ case TYPE:
+ case UINT16:
+ case UINT32:
+ case UINT64:
+ case UINT8:
+ case UUID_STRING:
+ // These types are not intended to be printed to the user.
+ break;
+ }
+ }
+ return AObjectPrinterFactory.INSTANCE;
+
+ }
+}
http://git-wip-us.apache.org/repos/asf/incubator-asterixdb/blob/2574f43d/asterix-om/src/main/java/org/apache/asterix/formats/nontagged/AqlCSVPrinterFactoryProvider.java
----------------------------------------------------------------------
diff --git a/asterix-om/src/main/java/org/apache/asterix/formats/nontagged/AqlCSVPrinterFactoryProvider.java b/asterix-om/src/main/java/org/apache/asterix/formats/nontagged/AqlCSVPrinterFactoryProvider.java
index ce3c101..f4c8156 100644
--- a/asterix-om/src/main/java/org/apache/asterix/formats/nontagged/AqlCSVPrinterFactoryProvider.java
+++ b/asterix-om/src/main/java/org/apache/asterix/formats/nontagged/AqlCSVPrinterFactoryProvider.java
@@ -18,8 +18,8 @@
*/
package org.apache.asterix.formats.nontagged;
-import org.apache.asterix.dataflow.data.nontagged.printers.AUUIDPrinterFactory;
-import org.apache.asterix.dataflow.data.nontagged.printers.ShortWithoutTypeInfoPrinterFactory;
+import org.apache.asterix.dataflow.data.nontagged.printers.adm.AUUIDPrinterFactory;
+import org.apache.asterix.dataflow.data.nontagged.printers.adm.ShortWithoutTypeInfoPrinterFactory;
import org.apache.asterix.dataflow.data.nontagged.printers.csv.ABooleanPrinterFactory;
import org.apache.asterix.dataflow.data.nontagged.printers.csv.ACirclePrinterFactory;
import org.apache.asterix.dataflow.data.nontagged.printers.csv.ADatePrinterFactory;
http://git-wip-us.apache.org/repos/asf/incubator-asterixdb/blob/2574f43d/asterix-om/src/main/java/org/apache/asterix/formats/nontagged/AqlJSONPrinterFactoryProvider.java
----------------------------------------------------------------------
diff --git a/asterix-om/src/main/java/org/apache/asterix/formats/nontagged/AqlJSONPrinterFactoryProvider.java b/asterix-om/src/main/java/org/apache/asterix/formats/nontagged/AqlJSONPrinterFactoryProvider.java
index 2f7f8dd..96dcbb5 100644
--- a/asterix-om/src/main/java/org/apache/asterix/formats/nontagged/AqlJSONPrinterFactoryProvider.java
+++ b/asterix-om/src/main/java/org/apache/asterix/formats/nontagged/AqlJSONPrinterFactoryProvider.java
@@ -18,9 +18,9 @@
*/
package org.apache.asterix.formats.nontagged;
-import org.apache.asterix.dataflow.data.nontagged.printers.ABinaryPrinterFactory;
-import org.apache.asterix.dataflow.data.nontagged.printers.AUUIDPrinterFactory;
-import org.apache.asterix.dataflow.data.nontagged.printers.ShortWithoutTypeInfoPrinterFactory;
+import org.apache.asterix.dataflow.data.nontagged.printers.adm.ABinaryPrinterFactory;
+import org.apache.asterix.dataflow.data.nontagged.printers.adm.AUUIDPrinterFactory;
+import org.apache.asterix.dataflow.data.nontagged.printers.adm.ShortWithoutTypeInfoPrinterFactory;
import org.apache.asterix.dataflow.data.nontagged.printers.json.ABooleanPrinterFactory;
import org.apache.asterix.dataflow.data.nontagged.printers.json.ACirclePrinterFactory;
import org.apache.asterix.dataflow.data.nontagged.printers.json.ADatePrinterFactory;