You are viewing a plain text version of this content. The canonical link for it is here.
Posted to commits@asterixdb.apache.org by bu...@apache.org on 2016/06/05 06:38:28 UTC

incubator-asterixdb git commit: ASTERIXDB-1212: fixes and test cases.

Repository: incubator-asterixdb
Updated Branches:
  refs/heads/master 91a840d5b -> 273c7a566


ASTERIXDB-1212: fixes and test cases.

Change-Id: I0b5fc5c09dfffa11ff8debb69e85ead894b4a597
Reviewed-on: https://asterix-gerrit.ics.uci.edu/908
Tested-by: Jenkins <je...@fulliautomatix.ics.uci.edu>
Reviewed-by: Jianfeng Jia <ji...@gmail.com>


Project: http://git-wip-us.apache.org/repos/asf/incubator-asterixdb/repo
Commit: http://git-wip-us.apache.org/repos/asf/incubator-asterixdb/commit/273c7a56
Tree: http://git-wip-us.apache.org/repos/asf/incubator-asterixdb/tree/273c7a56
Diff: http://git-wip-us.apache.org/repos/asf/incubator-asterixdb/diff/273c7a56

Branch: refs/heads/master
Commit: 273c7a5665943c351245f39221f28270584e968e
Parents: 91a840d
Author: Yingyi Bu <yi...@couchbase.com>
Authored: Sat Jun 4 22:29:20 2016 -0700
Committer: Yingyi Bu <bu...@gmail.com>
Committed: Sat Jun 4 23:37:55 2016 -0700

----------------------------------------------------------------------
 .../query-ASTERIXDB-1212-2-open.1.query.aql     | 24 +++++++
 .../query-ASTERIXDB-1212-2.1.query.aql          | 25 ++++++++
 .../query-ASTERIXDB-1212-open.1.query.aql       | 22 +++++++
 .../query-ASTERIXDB-1212.1.query.aql            | 23 +++++++
 .../query-ASTERIXDB-1212-2-open.1.adm           |  2 +
 .../query-ASTERIXDB-1212-2.1.adm                |  2 +
 .../query-ASTERIXDB-1212-open.1.adm             |  1 +
 .../query-ASTERIXDB-1212.1.adm                  |  1 +
 .../src/test/resources/runtimets/testsuite.xml  | 20 ++++++
 .../adm/ANullableFieldPrinterFactory.java       | 66 -------------------
 .../adm/AOptionalFieldPrinterFactory.java       | 66 +++++++++++++++++++
 .../csv/ANullableFieldPrinterFactory.java       | 67 --------------------
 .../csv/AOptionalFieldPrinterFactory.java       | 67 ++++++++++++++++++++
 .../clean/ANullableFieldPrinterFactory.java     | 65 -------------------
 .../clean/AOptionalFieldPrinterFactory.java     | 65 +++++++++++++++++++
 .../lossless/ANullableFieldPrinterFactory.java  | 65 -------------------
 .../lossless/AOptionalFieldPrinterFactory.java  | 65 +++++++++++++++++++
 .../nontagged/AqlADMPrinterFactoryProvider.java |  4 +-
 .../nontagged/AqlCSVPrinterFactoryProvider.java |  4 +-
 .../AqlCleanJSONPrinterFactoryProvider.java     |  4 +-
 .../AqlLosslessJSONPrinterFactoryProvider.java  |  4 +-
 21 files changed, 391 insertions(+), 271 deletions(-)
----------------------------------------------------------------------


http://git-wip-us.apache.org/repos/asf/incubator-asterixdb/blob/273c7a56/asterixdb/asterix-app/src/test/resources/runtimets/queries/list/query-ASTERIXDB-1212-2-open/query-ASTERIXDB-1212-2-open.1.query.aql
----------------------------------------------------------------------
diff --git a/asterixdb/asterix-app/src/test/resources/runtimets/queries/list/query-ASTERIXDB-1212-2-open/query-ASTERIXDB-1212-2-open.1.query.aql b/asterixdb/asterix-app/src/test/resources/runtimets/queries/list/query-ASTERIXDB-1212-2-open/query-ASTERIXDB-1212-2-open.1.query.aql
new file mode 100644
index 0000000..3e37ac2
--- /dev/null
+++ b/asterixdb/asterix-app/src/test/resources/runtimets/queries/list/query-ASTERIXDB-1212-2-open/query-ASTERIXDB-1212-2-open.1.query.aql
@@ -0,0 +1,24 @@
+/*
+ * 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.
+ */
+
+let $all := [ { "ka":"a1",  "kb":"b1"},
+              { "ka":2,  "kb":"b2"}]
+for $x in $all
+group by $k := $x.kb with $x
+return { "g": $k, "s1": $x[1].ka}

http://git-wip-us.apache.org/repos/asf/incubator-asterixdb/blob/273c7a56/asterixdb/asterix-app/src/test/resources/runtimets/queries/list/query-ASTERIXDB-1212-2/query-ASTERIXDB-1212-2.1.query.aql
----------------------------------------------------------------------
diff --git a/asterixdb/asterix-app/src/test/resources/runtimets/queries/list/query-ASTERIXDB-1212-2/query-ASTERIXDB-1212-2.1.query.aql b/asterixdb/asterix-app/src/test/resources/runtimets/queries/list/query-ASTERIXDB-1212-2/query-ASTERIXDB-1212-2.1.query.aql
new file mode 100644
index 0000000..e12cb9f
--- /dev/null
+++ b/asterixdb/asterix-app/src/test/resources/runtimets/queries/list/query-ASTERIXDB-1212-2/query-ASTERIXDB-1212-2.1.query.aql
@@ -0,0 +1,25 @@
+/*
+ * 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.
+ */
+
+let $all := [ { "ka":"a1",  "kb":"b1"},
+              { "ka":"a2",  "kb":"b2"}]
+for $x in $all
+group by $k := $x.kb with $x
+return { "g": $k, "s1": $x[1].ka}
+

http://git-wip-us.apache.org/repos/asf/incubator-asterixdb/blob/273c7a56/asterixdb/asterix-app/src/test/resources/runtimets/queries/list/query-ASTERIXDB-1212-open/query-ASTERIXDB-1212-open.1.query.aql
----------------------------------------------------------------------
diff --git a/asterixdb/asterix-app/src/test/resources/runtimets/queries/list/query-ASTERIXDB-1212-open/query-ASTERIXDB-1212-open.1.query.aql b/asterixdb/asterix-app/src/test/resources/runtimets/queries/list/query-ASTERIXDB-1212-open/query-ASTERIXDB-1212-open.1.query.aql
new file mode 100644
index 0000000..52ee35d
--- /dev/null
+++ b/asterixdb/asterix-app/src/test/resources/runtimets/queries/list/query-ASTERIXDB-1212-open/query-ASTERIXDB-1212-open.1.query.aql
@@ -0,0 +1,22 @@
+/*
+ * 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.
+ */
+
+let $all := [ { "ka":"a1",  "kb":"b1"},
+              { "ka":2,  "kb":"b2"}]
+return $all[3].ka;

http://git-wip-us.apache.org/repos/asf/incubator-asterixdb/blob/273c7a56/asterixdb/asterix-app/src/test/resources/runtimets/queries/list/query-ASTERIXDB-1212/query-ASTERIXDB-1212.1.query.aql
----------------------------------------------------------------------
diff --git a/asterixdb/asterix-app/src/test/resources/runtimets/queries/list/query-ASTERIXDB-1212/query-ASTERIXDB-1212.1.query.aql b/asterixdb/asterix-app/src/test/resources/runtimets/queries/list/query-ASTERIXDB-1212/query-ASTERIXDB-1212.1.query.aql
new file mode 100644
index 0000000..abf53d0
--- /dev/null
+++ b/asterixdb/asterix-app/src/test/resources/runtimets/queries/list/query-ASTERIXDB-1212/query-ASTERIXDB-1212.1.query.aql
@@ -0,0 +1,23 @@
+/*
+ * 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.
+ */
+
+let $all := [ { "ka":"a1",  "kb":"b1"},
+              { "ka":"a1",  "kb":"b2"}]
+return $all[3].ka;
+

http://git-wip-us.apache.org/repos/asf/incubator-asterixdb/blob/273c7a56/asterixdb/asterix-app/src/test/resources/runtimets/results/list/query-ASTERIXDB-1212-2-open/query-ASTERIXDB-1212-2-open.1.adm
----------------------------------------------------------------------
diff --git a/asterixdb/asterix-app/src/test/resources/runtimets/results/list/query-ASTERIXDB-1212-2-open/query-ASTERIXDB-1212-2-open.1.adm b/asterixdb/asterix-app/src/test/resources/runtimets/results/list/query-ASTERIXDB-1212-2-open/query-ASTERIXDB-1212-2-open.1.adm
new file mode 100644
index 0000000..1652c38
--- /dev/null
+++ b/asterixdb/asterix-app/src/test/resources/runtimets/results/list/query-ASTERIXDB-1212-2-open/query-ASTERIXDB-1212-2-open.1.adm
@@ -0,0 +1,2 @@
+{ "g": "b1" }
+{ "g": "b2" }

http://git-wip-us.apache.org/repos/asf/incubator-asterixdb/blob/273c7a56/asterixdb/asterix-app/src/test/resources/runtimets/results/list/query-ASTERIXDB-1212-2/query-ASTERIXDB-1212-2.1.adm
----------------------------------------------------------------------
diff --git a/asterixdb/asterix-app/src/test/resources/runtimets/results/list/query-ASTERIXDB-1212-2/query-ASTERIXDB-1212-2.1.adm b/asterixdb/asterix-app/src/test/resources/runtimets/results/list/query-ASTERIXDB-1212-2/query-ASTERIXDB-1212-2.1.adm
new file mode 100644
index 0000000..1652c38
--- /dev/null
+++ b/asterixdb/asterix-app/src/test/resources/runtimets/results/list/query-ASTERIXDB-1212-2/query-ASTERIXDB-1212-2.1.adm
@@ -0,0 +1,2 @@
+{ "g": "b1" }
+{ "g": "b2" }

http://git-wip-us.apache.org/repos/asf/incubator-asterixdb/blob/273c7a56/asterixdb/asterix-app/src/test/resources/runtimets/results/list/query-ASTERIXDB-1212-open/query-ASTERIXDB-1212-open.1.adm
----------------------------------------------------------------------
diff --git a/asterixdb/asterix-app/src/test/resources/runtimets/results/list/query-ASTERIXDB-1212-open/query-ASTERIXDB-1212-open.1.adm b/asterixdb/asterix-app/src/test/resources/runtimets/results/list/query-ASTERIXDB-1212-open/query-ASTERIXDB-1212-open.1.adm
new file mode 100644
index 0000000..19765bd
--- /dev/null
+++ b/asterixdb/asterix-app/src/test/resources/runtimets/results/list/query-ASTERIXDB-1212-open/query-ASTERIXDB-1212-open.1.adm
@@ -0,0 +1 @@
+null

http://git-wip-us.apache.org/repos/asf/incubator-asterixdb/blob/273c7a56/asterixdb/asterix-app/src/test/resources/runtimets/results/list/query-ASTERIXDB-1212/query-ASTERIXDB-1212.1.adm
----------------------------------------------------------------------
diff --git a/asterixdb/asterix-app/src/test/resources/runtimets/results/list/query-ASTERIXDB-1212/query-ASTERIXDB-1212.1.adm b/asterixdb/asterix-app/src/test/resources/runtimets/results/list/query-ASTERIXDB-1212/query-ASTERIXDB-1212.1.adm
new file mode 100644
index 0000000..19765bd
--- /dev/null
+++ b/asterixdb/asterix-app/src/test/resources/runtimets/results/list/query-ASTERIXDB-1212/query-ASTERIXDB-1212.1.adm
@@ -0,0 +1 @@
+null

http://git-wip-us.apache.org/repos/asf/incubator-asterixdb/blob/273c7a56/asterixdb/asterix-app/src/test/resources/runtimets/testsuite.xml
----------------------------------------------------------------------
diff --git a/asterixdb/asterix-app/src/test/resources/runtimets/testsuite.xml b/asterixdb/asterix-app/src/test/resources/runtimets/testsuite.xml
index adbf40f..3d12573 100644
--- a/asterixdb/asterix-app/src/test/resources/runtimets/testsuite.xml
+++ b/asterixdb/asterix-app/src/test/resources/runtimets/testsuite.xml
@@ -3039,6 +3039,26 @@
         <output-dir compare="Text">query-ASTERIXDB-1131-2</output-dir>
       </compilation-unit>
     </test-case>
+    <test-case FilePath="list">
+      <compilation-unit name="query-ASTERIXDB-1212">
+        <output-dir compare="Text">query-ASTERIXDB-1212</output-dir>
+      </compilation-unit>
+    </test-case>
+    <test-case FilePath="list">
+      <compilation-unit name="query-ASTERIXDB-1212-open">
+        <output-dir compare="Text">query-ASTERIXDB-1212-open</output-dir>
+      </compilation-unit>
+    </test-case>
+    <test-case FilePath="list">
+      <compilation-unit name="query-ASTERIXDB-1212-2">
+        <output-dir compare="Text">query-ASTERIXDB-1212-2</output-dir>
+      </compilation-unit>
+    </test-case>
+    <test-case FilePath="list">
+      <compilation-unit name="query-ASTERIXDB-1212-2-open">
+        <output-dir compare="Text">query-ASTERIXDB-1212-2-open</output-dir>
+      </compilation-unit>
+    </test-case>
   </test-group>
   <test-group name="meta">
     <test-case FilePath="meta">

http://git-wip-us.apache.org/repos/asf/incubator-asterixdb/blob/273c7a56/asterixdb/asterix-om/src/main/java/org/apache/asterix/dataflow/data/nontagged/printers/adm/ANullableFieldPrinterFactory.java
----------------------------------------------------------------------
diff --git a/asterixdb/asterix-om/src/main/java/org/apache/asterix/dataflow/data/nontagged/printers/adm/ANullableFieldPrinterFactory.java b/asterixdb/asterix-om/src/main/java/org/apache/asterix/dataflow/data/nontagged/printers/adm/ANullableFieldPrinterFactory.java
deleted file mode 100644
index 784bd0b..0000000
--- a/asterixdb/asterix-om/src/main/java/org/apache/asterix/dataflow/data/nontagged/printers/adm/ANullableFieldPrinterFactory.java
+++ /dev/null
@@ -1,66 +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.adm;
-
-import java.io.PrintStream;
-
-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.BuiltinType;
-import org.apache.hyracks.algebricks.data.IPrinter;
-import org.apache.hyracks.algebricks.data.IPrinterFactory;
-import org.apache.hyracks.api.exceptions.HyracksDataException;
-
-public class ANullableFieldPrinterFactory implements IPrinterFactory {
-
-    private static final long serialVersionUID = 1L;
-
-    private AUnionType unionType;
-
-    public ANullableFieldPrinterFactory(AUnionType unionType) {
-        this.unionType = unionType;
-    }
-
-    @Override
-    public IPrinter createPrinter() {
-        return new IPrinter() {
-            private IPrinter nullPrinter;
-            private IPrinter fieldPrinter;
-
-            @Override
-            public void init() throws HyracksDataException {
-                nullPrinter = (AqlADMPrinterFactoryProvider.INSTANCE.getPrinterFactory(BuiltinType.ANULL))
-                        .createPrinter();
-                fieldPrinter = (AqlADMPrinterFactoryProvider.INSTANCE.getPrinterFactory(unionType.getActualType()))
-                        .createPrinter();
-            }
-
-            @Override
-            public void print(byte[] b, int s, int l, PrintStream ps) throws HyracksDataException {
-                fieldPrinter.init();
-                if (b[s] == ATypeTag.SERIALIZED_NULL_TYPE_TAG) {
-                    nullPrinter.print(b, s, l, ps);
-                } else {
-                    fieldPrinter.print(b, s, l, ps);
-                }
-            }
-        };
-    }
-}

http://git-wip-us.apache.org/repos/asf/incubator-asterixdb/blob/273c7a56/asterixdb/asterix-om/src/main/java/org/apache/asterix/dataflow/data/nontagged/printers/adm/AOptionalFieldPrinterFactory.java
----------------------------------------------------------------------
diff --git a/asterixdb/asterix-om/src/main/java/org/apache/asterix/dataflow/data/nontagged/printers/adm/AOptionalFieldPrinterFactory.java b/asterixdb/asterix-om/src/main/java/org/apache/asterix/dataflow/data/nontagged/printers/adm/AOptionalFieldPrinterFactory.java
new file mode 100644
index 0000000..7825812
--- /dev/null
+++ b/asterixdb/asterix-om/src/main/java/org/apache/asterix/dataflow/data/nontagged/printers/adm/AOptionalFieldPrinterFactory.java
@@ -0,0 +1,66 @@
+/*
+ * 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.formats.nontagged.AqlADMPrinterFactoryProvider;
+import org.apache.asterix.om.types.ATypeTag;
+import org.apache.asterix.om.types.AUnionType;
+import org.apache.asterix.om.types.BuiltinType;
+import org.apache.hyracks.algebricks.data.IPrinter;
+import org.apache.hyracks.algebricks.data.IPrinterFactory;
+import org.apache.hyracks.api.exceptions.HyracksDataException;
+
+public class AOptionalFieldPrinterFactory implements IPrinterFactory {
+
+    private static final long serialVersionUID = 1L;
+
+    private AUnionType unionType;
+
+    public AOptionalFieldPrinterFactory(AUnionType unionType) {
+        this.unionType = unionType;
+    }
+
+    @Override
+    public IPrinter createPrinter() {
+        return new IPrinter() {
+            private IPrinter nullPrinter;
+            private IPrinter fieldPrinter;
+
+            @Override
+            public void init() throws HyracksDataException {
+                nullPrinter = (AqlADMPrinterFactoryProvider.INSTANCE.getPrinterFactory(BuiltinType.ANULL))
+                        .createPrinter();
+                fieldPrinter = (AqlADMPrinterFactoryProvider.INSTANCE.getPrinterFactory(unionType.getActualType()))
+                        .createPrinter();
+            }
+
+            @Override
+            public void print(byte[] b, int s, int l, PrintStream ps) throws HyracksDataException {
+                fieldPrinter.init();
+                if (b[s] == ATypeTag.SERIALIZED_NULL_TYPE_TAG || b[s] == ATypeTag.SERIALIZED_MISSING_TYPE_TAG) {
+                    nullPrinter.print(b, s, l, ps);
+                } else {
+                    fieldPrinter.print(b, s, l, ps);
+                }
+            }
+        };
+    }
+}

http://git-wip-us.apache.org/repos/asf/incubator-asterixdb/blob/273c7a56/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
deleted file mode 100644
index deb6014..0000000
--- a/asterixdb/asterix-om/src/main/java/org/apache/asterix/dataflow/data/nontagged/printers/csv/ANullableFieldPrinterFactory.java
+++ /dev/null
@@ -1,67 +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.formats.nontagged.AqlCSVPrinterFactoryProvider;
-import org.apache.asterix.om.types.ATypeTag;
-import org.apache.asterix.om.types.AUnionType;
-import org.apache.asterix.om.types.BuiltinType;
-import org.apache.hyracks.algebricks.data.IPrinter;
-import org.apache.hyracks.algebricks.data.IPrinterFactory;
-import org.apache.hyracks.api.exceptions.HyracksDataException;
-
-public class ANullableFieldPrinterFactory implements IPrinterFactory {
-
-    private static final long serialVersionUID = 1L;
-
-    private AUnionType unionType;
-
-    public ANullableFieldPrinterFactory(AUnionType unionType) {
-        this.unionType = unionType;
-    }
-
-    @Override
-    public IPrinter createPrinter() {
-        return new IPrinter() {
-            private IPrinter nullPrinter;
-            private IPrinter fieldPrinter;
-
-            @Override
-            public void init() throws HyracksDataException {
-                nullPrinter = (AqlCSVPrinterFactoryProvider.INSTANCE.getPrinterFactory(BuiltinType.AMISSING))
-                        .createPrinter();
-                fieldPrinter = (AqlCSVPrinterFactoryProvider.INSTANCE.getPrinterFactory(unionType.getActualType()))
-                        .createPrinter();
-            }
-
-            @Override
-            public void print(byte[] b, int s, int l, PrintStream ps) throws HyracksDataException {
-                fieldPrinter.init();
-                if (b[s] == ATypeTag.MISSING.serialize()) {
-                    nullPrinter.print(b, s, l, ps);
-                } else {
-                    fieldPrinter.print(b, s, l, ps);
-                }
-            }
-
-        };
-    }
-}

http://git-wip-us.apache.org/repos/asf/incubator-asterixdb/blob/273c7a56/asterixdb/asterix-om/src/main/java/org/apache/asterix/dataflow/data/nontagged/printers/csv/AOptionalFieldPrinterFactory.java
----------------------------------------------------------------------
diff --git a/asterixdb/asterix-om/src/main/java/org/apache/asterix/dataflow/data/nontagged/printers/csv/AOptionalFieldPrinterFactory.java b/asterixdb/asterix-om/src/main/java/org/apache/asterix/dataflow/data/nontagged/printers/csv/AOptionalFieldPrinterFactory.java
new file mode 100644
index 0000000..a40edc8
--- /dev/null
+++ b/asterixdb/asterix-om/src/main/java/org/apache/asterix/dataflow/data/nontagged/printers/csv/AOptionalFieldPrinterFactory.java
@@ -0,0 +1,67 @@
+/*
+ * 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.formats.nontagged.AqlCSVPrinterFactoryProvider;
+import org.apache.asterix.om.types.ATypeTag;
+import org.apache.asterix.om.types.AUnionType;
+import org.apache.asterix.om.types.BuiltinType;
+import org.apache.hyracks.algebricks.data.IPrinter;
+import org.apache.hyracks.algebricks.data.IPrinterFactory;
+import org.apache.hyracks.api.exceptions.HyracksDataException;
+
+public class AOptionalFieldPrinterFactory implements IPrinterFactory {
+
+    private static final long serialVersionUID = 1L;
+
+    private AUnionType unionType;
+
+    public AOptionalFieldPrinterFactory(AUnionType unionType) {
+        this.unionType = unionType;
+    }
+
+    @Override
+    public IPrinter createPrinter() {
+        return new IPrinter() {
+            private IPrinter nullPrinter;
+            private IPrinter fieldPrinter;
+
+            @Override
+            public void init() throws HyracksDataException {
+                nullPrinter = (AqlCSVPrinterFactoryProvider.INSTANCE.getPrinterFactory(BuiltinType.AMISSING))
+                        .createPrinter();
+                fieldPrinter = (AqlCSVPrinterFactoryProvider.INSTANCE.getPrinterFactory(unionType.getActualType()))
+                        .createPrinter();
+            }
+
+            @Override
+            public void print(byte[] b, int s, int l, PrintStream ps) throws HyracksDataException {
+                fieldPrinter.init();
+                if (b[s] == ATypeTag.SERIALIZED_NULL_TYPE_TAG || b[s] == ATypeTag.SERIALIZED_MISSING_TYPE_TAG) {
+                    nullPrinter.print(b, s, l, ps);
+                } else {
+                    fieldPrinter.print(b, s, l, ps);
+                }
+            }
+
+        };
+    }
+}

http://git-wip-us.apache.org/repos/asf/incubator-asterixdb/blob/273c7a56/asterixdb/asterix-om/src/main/java/org/apache/asterix/dataflow/data/nontagged/printers/json/clean/ANullableFieldPrinterFactory.java
----------------------------------------------------------------------
diff --git a/asterixdb/asterix-om/src/main/java/org/apache/asterix/dataflow/data/nontagged/printers/json/clean/ANullableFieldPrinterFactory.java b/asterixdb/asterix-om/src/main/java/org/apache/asterix/dataflow/data/nontagged/printers/json/clean/ANullableFieldPrinterFactory.java
deleted file mode 100644
index b2c13af..0000000
--- a/asterixdb/asterix-om/src/main/java/org/apache/asterix/dataflow/data/nontagged/printers/json/clean/ANullableFieldPrinterFactory.java
+++ /dev/null
@@ -1,65 +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.json.clean;
-
-import java.io.PrintStream;
-
-import org.apache.asterix.formats.nontagged.AqlCleanJSONPrinterFactoryProvider;
-import org.apache.asterix.om.types.ATypeTag;
-import org.apache.asterix.om.types.AUnionType;
-import org.apache.asterix.om.types.BuiltinType;
-import org.apache.hyracks.algebricks.data.IPrinter;
-import org.apache.hyracks.algebricks.data.IPrinterFactory;
-import org.apache.hyracks.api.exceptions.HyracksDataException;
-
-public class ANullableFieldPrinterFactory implements IPrinterFactory {
-
-    private static final long serialVersionUID = 1L;
-    private AUnionType unionType;
-
-    public ANullableFieldPrinterFactory(AUnionType unionType) {
-        this.unionType = unionType;
-    }
-
-    @Override
-    public IPrinter createPrinter() {
-        return new IPrinter() {
-            private IPrinter nullPrinter;
-            private IPrinter fieldPrinter;
-
-            @Override
-            public void init() throws HyracksDataException {
-                nullPrinter = (AqlCleanJSONPrinterFactoryProvider.INSTANCE.getPrinterFactory(BuiltinType.AMISSING))
-                        .createPrinter();
-                fieldPrinter = (AqlCleanJSONPrinterFactoryProvider.INSTANCE
-                        .getPrinterFactory(unionType.getActualType())).createPrinter();
-            }
-
-            @Override
-            public void print(byte[] b, int s, int l, PrintStream ps) throws HyracksDataException {
-                fieldPrinter.init();
-                if (b[s] == ATypeTag.MISSING.serialize()) {
-                    nullPrinter.print(b, s, l, ps);
-                } else {
-                    fieldPrinter.print(b, s, l, ps);
-                }
-            }
-        };
-    }
-}

http://git-wip-us.apache.org/repos/asf/incubator-asterixdb/blob/273c7a56/asterixdb/asterix-om/src/main/java/org/apache/asterix/dataflow/data/nontagged/printers/json/clean/AOptionalFieldPrinterFactory.java
----------------------------------------------------------------------
diff --git a/asterixdb/asterix-om/src/main/java/org/apache/asterix/dataflow/data/nontagged/printers/json/clean/AOptionalFieldPrinterFactory.java b/asterixdb/asterix-om/src/main/java/org/apache/asterix/dataflow/data/nontagged/printers/json/clean/AOptionalFieldPrinterFactory.java
new file mode 100644
index 0000000..4edacbd
--- /dev/null
+++ b/asterixdb/asterix-om/src/main/java/org/apache/asterix/dataflow/data/nontagged/printers/json/clean/AOptionalFieldPrinterFactory.java
@@ -0,0 +1,65 @@
+/*
+ * 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.json.clean;
+
+import java.io.PrintStream;
+
+import org.apache.asterix.formats.nontagged.AqlCleanJSONPrinterFactoryProvider;
+import org.apache.asterix.om.types.ATypeTag;
+import org.apache.asterix.om.types.AUnionType;
+import org.apache.asterix.om.types.BuiltinType;
+import org.apache.hyracks.algebricks.data.IPrinter;
+import org.apache.hyracks.algebricks.data.IPrinterFactory;
+import org.apache.hyracks.api.exceptions.HyracksDataException;
+
+public class AOptionalFieldPrinterFactory implements IPrinterFactory {
+
+    private static final long serialVersionUID = 1L;
+    private AUnionType unionType;
+
+    public AOptionalFieldPrinterFactory(AUnionType unionType) {
+        this.unionType = unionType;
+    }
+
+    @Override
+    public IPrinter createPrinter() {
+        return new IPrinter() {
+            private IPrinter nullPrinter;
+            private IPrinter fieldPrinter;
+
+            @Override
+            public void init() throws HyracksDataException {
+                nullPrinter = (AqlCleanJSONPrinterFactoryProvider.INSTANCE.getPrinterFactory(BuiltinType.AMISSING))
+                        .createPrinter();
+                fieldPrinter = (AqlCleanJSONPrinterFactoryProvider.INSTANCE
+                        .getPrinterFactory(unionType.getActualType())).createPrinter();
+            }
+
+            @Override
+            public void print(byte[] b, int s, int l, PrintStream ps) throws HyracksDataException {
+                fieldPrinter.init();
+                if (b[s] == ATypeTag.SERIALIZED_NULL_TYPE_TAG || b[s] == ATypeTag.SERIALIZED_MISSING_TYPE_TAG) {
+                    nullPrinter.print(b, s, l, ps);
+                } else {
+                    fieldPrinter.print(b, s, l, ps);
+                }
+            }
+        };
+    }
+}

http://git-wip-us.apache.org/repos/asf/incubator-asterixdb/blob/273c7a56/asterixdb/asterix-om/src/main/java/org/apache/asterix/dataflow/data/nontagged/printers/json/lossless/ANullableFieldPrinterFactory.java
----------------------------------------------------------------------
diff --git a/asterixdb/asterix-om/src/main/java/org/apache/asterix/dataflow/data/nontagged/printers/json/lossless/ANullableFieldPrinterFactory.java b/asterixdb/asterix-om/src/main/java/org/apache/asterix/dataflow/data/nontagged/printers/json/lossless/ANullableFieldPrinterFactory.java
deleted file mode 100644
index c7e51ce..0000000
--- a/asterixdb/asterix-om/src/main/java/org/apache/asterix/dataflow/data/nontagged/printers/json/lossless/ANullableFieldPrinterFactory.java
+++ /dev/null
@@ -1,65 +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.json.lossless;
-
-import java.io.PrintStream;
-
-import org.apache.asterix.formats.nontagged.AqlLosslessJSONPrinterFactoryProvider;
-import org.apache.asterix.om.types.ATypeTag;
-import org.apache.asterix.om.types.AUnionType;
-import org.apache.asterix.om.types.BuiltinType;
-import org.apache.hyracks.algebricks.data.IPrinter;
-import org.apache.hyracks.algebricks.data.IPrinterFactory;
-import org.apache.hyracks.api.exceptions.HyracksDataException;
-
-public class ANullableFieldPrinterFactory implements IPrinterFactory {
-
-    private static final long serialVersionUID = 1L;
-    private AUnionType unionType;
-
-    public ANullableFieldPrinterFactory(AUnionType unionType) {
-        this.unionType = unionType;
-    }
-
-    @Override
-    public IPrinter createPrinter() {
-        return new IPrinter() {
-            private IPrinter nullPrinter;
-            private IPrinter fieldPrinter;
-
-            @Override
-            public void init() throws HyracksDataException {
-                nullPrinter = (AqlLosslessJSONPrinterFactoryProvider.INSTANCE.getPrinterFactory(BuiltinType.AMISSING))
-                        .createPrinter();
-                fieldPrinter = (AqlLosslessJSONPrinterFactoryProvider.INSTANCE
-                        .getPrinterFactory(unionType.getActualType())).createPrinter();
-            }
-
-            @Override
-            public void print(byte[] b, int s, int l, PrintStream ps) throws HyracksDataException {
-                fieldPrinter.init();
-                if (b[s] == ATypeTag.MISSING.serialize()) {
-                    nullPrinter.print(b, s, l, ps);
-                } else {
-                    fieldPrinter.print(b, s, l, ps);
-                }
-            }
-        };
-    }
-}

http://git-wip-us.apache.org/repos/asf/incubator-asterixdb/blob/273c7a56/asterixdb/asterix-om/src/main/java/org/apache/asterix/dataflow/data/nontagged/printers/json/lossless/AOptionalFieldPrinterFactory.java
----------------------------------------------------------------------
diff --git a/asterixdb/asterix-om/src/main/java/org/apache/asterix/dataflow/data/nontagged/printers/json/lossless/AOptionalFieldPrinterFactory.java b/asterixdb/asterix-om/src/main/java/org/apache/asterix/dataflow/data/nontagged/printers/json/lossless/AOptionalFieldPrinterFactory.java
new file mode 100644
index 0000000..7fb22d6
--- /dev/null
+++ b/asterixdb/asterix-om/src/main/java/org/apache/asterix/dataflow/data/nontagged/printers/json/lossless/AOptionalFieldPrinterFactory.java
@@ -0,0 +1,65 @@
+/*
+ * 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.json.lossless;
+
+import java.io.PrintStream;
+
+import org.apache.asterix.formats.nontagged.AqlLosslessJSONPrinterFactoryProvider;
+import org.apache.asterix.om.types.ATypeTag;
+import org.apache.asterix.om.types.AUnionType;
+import org.apache.asterix.om.types.BuiltinType;
+import org.apache.hyracks.algebricks.data.IPrinter;
+import org.apache.hyracks.algebricks.data.IPrinterFactory;
+import org.apache.hyracks.api.exceptions.HyracksDataException;
+
+public class AOptionalFieldPrinterFactory implements IPrinterFactory {
+
+    private static final long serialVersionUID = 1L;
+    private AUnionType unionType;
+
+    public AOptionalFieldPrinterFactory(AUnionType unionType) {
+        this.unionType = unionType;
+    }
+
+    @Override
+    public IPrinter createPrinter() {
+        return new IPrinter() {
+            private IPrinter nullPrinter;
+            private IPrinter fieldPrinter;
+
+            @Override
+            public void init() throws HyracksDataException {
+                nullPrinter = (AqlLosslessJSONPrinterFactoryProvider.INSTANCE.getPrinterFactory(BuiltinType.AMISSING))
+                        .createPrinter();
+                fieldPrinter = (AqlLosslessJSONPrinterFactoryProvider.INSTANCE
+                        .getPrinterFactory(unionType.getActualType())).createPrinter();
+            }
+
+            @Override
+            public void print(byte[] b, int s, int l, PrintStream ps) throws HyracksDataException {
+                fieldPrinter.init();
+                if (b[s] == ATypeTag.SERIALIZED_NULL_TYPE_TAG || b[s] == ATypeTag.SERIALIZED_MISSING_TYPE_TAG) {
+                    nullPrinter.print(b, s, l, ps);
+                } else {
+                    fieldPrinter.print(b, s, l, ps);
+                }
+            }
+        };
+    }
+}

http://git-wip-us.apache.org/repos/asf/incubator-asterixdb/blob/273c7a56/asterixdb/asterix-om/src/main/java/org/apache/asterix/formats/nontagged/AqlADMPrinterFactoryProvider.java
----------------------------------------------------------------------
diff --git a/asterixdb/asterix-om/src/main/java/org/apache/asterix/formats/nontagged/AqlADMPrinterFactoryProvider.java b/asterixdb/asterix-om/src/main/java/org/apache/asterix/formats/nontagged/AqlADMPrinterFactoryProvider.java
index 5f1854d..a1c1dc8 100644
--- a/asterixdb/asterix-om/src/main/java/org/apache/asterix/formats/nontagged/AqlADMPrinterFactoryProvider.java
+++ b/asterixdb/asterix-om/src/main/java/org/apache/asterix/formats/nontagged/AqlADMPrinterFactoryProvider.java
@@ -34,7 +34,7 @@ import org.apache.asterix.dataflow.data.nontagged.printers.adm.AInt8PrinterFacto
 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.AOptionalFieldPrinterFactory;
 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;
@@ -125,7 +125,7 @@ public class AqlADMPrinterFactoryProvider implements IPrinterFactoryProvider {
                     return new AUnorderedlistPrinterFactory((AUnorderedListType) aqlType);
                 case UNION: {
                     if (((AUnionType) aqlType).isUnknownableType()) {
-                        return new ANullableFieldPrinterFactory((AUnionType) aqlType);
+                        return new AOptionalFieldPrinterFactory((AUnionType) aqlType);
                     } else {
                         return new AUnionPrinterFactory((AUnionType) aqlType);
                     }

http://git-wip-us.apache.org/repos/asf/incubator-asterixdb/blob/273c7a56/asterixdb/asterix-om/src/main/java/org/apache/asterix/formats/nontagged/AqlCSVPrinterFactoryProvider.java
----------------------------------------------------------------------
diff --git a/asterixdb/asterix-om/src/main/java/org/apache/asterix/formats/nontagged/AqlCSVPrinterFactoryProvider.java b/asterixdb/asterix-om/src/main/java/org/apache/asterix/formats/nontagged/AqlCSVPrinterFactoryProvider.java
index d197e52..eef4456 100644
--- a/asterixdb/asterix-om/src/main/java/org/apache/asterix/formats/nontagged/AqlCSVPrinterFactoryProvider.java
+++ b/asterixdb/asterix-om/src/main/java/org/apache/asterix/formats/nontagged/AqlCSVPrinterFactoryProvider.java
@@ -35,7 +35,7 @@ import org.apache.asterix.dataflow.data.nontagged.printers.csv.AInt8PrinterFacto
 import org.apache.asterix.dataflow.data.nontagged.printers.csv.AIntervalPrinterFactory;
 import org.apache.asterix.dataflow.data.nontagged.printers.csv.ALinePrinterFactory;
 import org.apache.asterix.dataflow.data.nontagged.printers.csv.ANullPrinterFactory;
-import org.apache.asterix.dataflow.data.nontagged.printers.csv.ANullableFieldPrinterFactory;
+import org.apache.asterix.dataflow.data.nontagged.printers.csv.AOptionalFieldPrinterFactory;
 import org.apache.asterix.dataflow.data.nontagged.printers.csv.AObjectPrinterFactory;
 import org.apache.asterix.dataflow.data.nontagged.printers.csv.APoint3DPrinterFactory;
 import org.apache.asterix.dataflow.data.nontagged.printers.csv.APointPrinterFactory;
@@ -119,7 +119,7 @@ public class AqlCSVPrinterFactoryProvider implements IPrinterFactoryProvider {
                     throw new NotImplementedException("'Unorderedlist' type unsupported for CSV output");
                 case UNION: {
                     if (((AUnionType) aqlType).isUnknownableType()) {
-                        return new ANullableFieldPrinterFactory((AUnionType) aqlType);
+                        return new AOptionalFieldPrinterFactory((AUnionType) aqlType);
                     } else {
                         return new AUnionPrinterFactory((AUnionType) aqlType);
                     }

http://git-wip-us.apache.org/repos/asf/incubator-asterixdb/blob/273c7a56/asterixdb/asterix-om/src/main/java/org/apache/asterix/formats/nontagged/AqlCleanJSONPrinterFactoryProvider.java
----------------------------------------------------------------------
diff --git a/asterixdb/asterix-om/src/main/java/org/apache/asterix/formats/nontagged/AqlCleanJSONPrinterFactoryProvider.java b/asterixdb/asterix-om/src/main/java/org/apache/asterix/formats/nontagged/AqlCleanJSONPrinterFactoryProvider.java
index 9cf9f8e..a69adc6 100644
--- a/asterixdb/asterix-om/src/main/java/org/apache/asterix/formats/nontagged/AqlCleanJSONPrinterFactoryProvider.java
+++ b/asterixdb/asterix-om/src/main/java/org/apache/asterix/formats/nontagged/AqlCleanJSONPrinterFactoryProvider.java
@@ -36,7 +36,7 @@ import org.apache.asterix.dataflow.data.nontagged.printers.json.clean.AInt8Print
 import org.apache.asterix.dataflow.data.nontagged.printers.json.clean.AIntervalPrinterFactory;
 import org.apache.asterix.dataflow.data.nontagged.printers.json.clean.ALinePrinterFactory;
 import org.apache.asterix.dataflow.data.nontagged.printers.json.clean.ANullPrinterFactory;
-import org.apache.asterix.dataflow.data.nontagged.printers.json.clean.ANullableFieldPrinterFactory;
+import org.apache.asterix.dataflow.data.nontagged.printers.json.clean.AOptionalFieldPrinterFactory;
 import org.apache.asterix.dataflow.data.nontagged.printers.json.clean.AObjectPrinterFactory;
 import org.apache.asterix.dataflow.data.nontagged.printers.json.clean.AOrderedlistPrinterFactory;
 import org.apache.asterix.dataflow.data.nontagged.printers.json.clean.APoint3DPrinterFactory;
@@ -125,7 +125,7 @@ public class AqlCleanJSONPrinterFactoryProvider implements IPrinterFactoryProvid
                     return new AUnorderedlistPrinterFactory((AUnorderedListType) aqlType);
                 case UNION: {
                     if (((AUnionType) aqlType).isUnknownableType()) {
-                        return new ANullableFieldPrinterFactory((AUnionType) aqlType);
+                        return new AOptionalFieldPrinterFactory((AUnionType) aqlType);
                     } else {
                         return new AUnionPrinterFactory((AUnionType) aqlType);
                     }

http://git-wip-us.apache.org/repos/asf/incubator-asterixdb/blob/273c7a56/asterixdb/asterix-om/src/main/java/org/apache/asterix/formats/nontagged/AqlLosslessJSONPrinterFactoryProvider.java
----------------------------------------------------------------------
diff --git a/asterixdb/asterix-om/src/main/java/org/apache/asterix/formats/nontagged/AqlLosslessJSONPrinterFactoryProvider.java b/asterixdb/asterix-om/src/main/java/org/apache/asterix/formats/nontagged/AqlLosslessJSONPrinterFactoryProvider.java
index 370a47b..eeb812b 100644
--- a/asterixdb/asterix-om/src/main/java/org/apache/asterix/formats/nontagged/AqlLosslessJSONPrinterFactoryProvider.java
+++ b/asterixdb/asterix-om/src/main/java/org/apache/asterix/formats/nontagged/AqlLosslessJSONPrinterFactoryProvider.java
@@ -36,7 +36,7 @@ import org.apache.asterix.dataflow.data.nontagged.printers.json.lossless.AInt8Pr
 import org.apache.asterix.dataflow.data.nontagged.printers.json.lossless.AIntervalPrinterFactory;
 import org.apache.asterix.dataflow.data.nontagged.printers.json.lossless.ALinePrinterFactory;
 import org.apache.asterix.dataflow.data.nontagged.printers.json.lossless.ANullPrinterFactory;
-import org.apache.asterix.dataflow.data.nontagged.printers.json.lossless.ANullableFieldPrinterFactory;
+import org.apache.asterix.dataflow.data.nontagged.printers.json.lossless.AOptionalFieldPrinterFactory;
 import org.apache.asterix.dataflow.data.nontagged.printers.json.lossless.AObjectPrinterFactory;
 import org.apache.asterix.dataflow.data.nontagged.printers.json.lossless.AOrderedlistPrinterFactory;
 import org.apache.asterix.dataflow.data.nontagged.printers.json.lossless.APoint3DPrinterFactory;
@@ -125,7 +125,7 @@ public class AqlLosslessJSONPrinterFactoryProvider implements IPrinterFactoryPro
                     return new AUnorderedlistPrinterFactory((AUnorderedListType) aqlType);
                 case UNION: {
                     if (((AUnionType) aqlType).isUnknownableType()) {
-                        return new ANullableFieldPrinterFactory((AUnionType) aqlType);
+                        return new AOptionalFieldPrinterFactory((AUnionType) aqlType);
                     } else {
                         return new AUnionPrinterFactory((AUnionType) aqlType);
                     }