asterixdb-commits mailing list archives

Site index · List index
Message view « Date » · « Thread »
Top « Date » · « Thread »
From c...@apache.org
Subject incubator-asterixdb git commit: ASTERIXDB-1165: Use clean JSON consistently
Date Fri, 13 Nov 2015 18:12:36 GMT
Repository: incubator-asterixdb
Updated Branches:
  refs/heads/master 487063057 -> ed21d4946


ASTERIXDB-1165: Use clean JSON consistently

When printing nullable fields and unions, the clean JSON PrinterFactories
were using lossless JSON printers. This is now fixed.

Change-Id: I50442edc3187d003987bc4119559eda676c9b2eb
Reviewed-on: https://asterix-gerrit.ics.uci.edu/493
Tested-by: Jenkins <jenkins@fulliautomatix.ics.uci.edu>
Reviewed-by: Till Westmann <tillw@apache.org>


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

Branch: refs/heads/master
Commit: ed21d49464d85e7bb4823bfaa92a7070f517b7a5
Parents: 4870630
Author: Chris Hillery <chillery@lambda.nu>
Authored: Fri Nov 13 01:42:24 2015 -0800
Committer: Chris Hillery <ceej@lambda.nu>
Committed: Fri Nov 13 10:07:45 2015 -0800

----------------------------------------------------------------------
 .../json/issue-ASTERIXDB-1165/nullablefield.1.query.aql   |  2 ++
 .../json/issue-ASTERIXDB-1165/nullablefield.1.json        |  2 ++
 asterix-app/src/test/resources/runtimets/testsuite.xml    |  5 +++++
 .../printers/json/clean/ANullableFieldPrinterFactory.java | 10 +++++-----
 .../printers/json/clean/AUnionPrinterFactory.java         | 10 +++++-----
 5 files changed, 19 insertions(+), 10 deletions(-)
----------------------------------------------------------------------


http://git-wip-us.apache.org/repos/asf/incubator-asterixdb/blob/ed21d494/asterix-app/src/test/resources/runtimets/queries/json/issue-ASTERIXDB-1165/nullablefield.1.query.aql
----------------------------------------------------------------------
diff --git a/asterix-app/src/test/resources/runtimets/queries/json/issue-ASTERIXDB-1165/nullablefield.1.query.aql
b/asterix-app/src/test/resources/runtimets/queries/json/issue-ASTERIXDB-1165/nullablefield.1.query.aql
new file mode 100644
index 0000000..958c58b
--- /dev/null
+++ b/asterix-app/src/test/resources/runtimets/queries/json/issue-ASTERIXDB-1165/nullablefield.1.query.aql
@@ -0,0 +1,2 @@
+count(for $u in [1,2,3] return $u)
+

http://git-wip-us.apache.org/repos/asf/incubator-asterixdb/blob/ed21d494/asterix-app/src/test/resources/runtimets/results/json/issue-ASTERIXDB-1165/nullablefield.1.json
----------------------------------------------------------------------
diff --git a/asterix-app/src/test/resources/runtimets/results/json/issue-ASTERIXDB-1165/nullablefield.1.json
b/asterix-app/src/test/resources/runtimets/results/json/issue-ASTERIXDB-1165/nullablefield.1.json
new file mode 100644
index 0000000..f2868b6
--- /dev/null
+++ b/asterix-app/src/test/resources/runtimets/results/json/issue-ASTERIXDB-1165/nullablefield.1.json
@@ -0,0 +1,2 @@
+[ 3
+ ]

http://git-wip-us.apache.org/repos/asf/incubator-asterixdb/blob/ed21d494/asterix-app/src/test/resources/runtimets/testsuite.xml
----------------------------------------------------------------------
diff --git a/asterix-app/src/test/resources/runtimets/testsuite.xml b/asterix-app/src/test/resources/runtimets/testsuite.xml
index b2ded7b..430fd8e 100644
--- a/asterix-app/src/test/resources/runtimets/testsuite.xml
+++ b/asterix-app/src/test/resources/runtimets/testsuite.xml
@@ -6744,6 +6744,11 @@
                 <output-dir compare="Clean-JSON">int01-cleanjson</output-dir>
             </compilation-unit>
         </test-case>
+        <test-case FilePath="json">
+            <compilation-unit name="issue-ASTERIXDB-1165">
+                <output-dir compare="Clean-JSON">issue-ASTERIXDB-1165</output-dir>
+            </compilation-unit>
+        </test-case>
     </test-group>
     <test-group name="csv">
         <test-case FilePath="csv">

http://git-wip-us.apache.org/repos/asf/incubator-asterixdb/blob/ed21d494/asterix-om/src/main/java/org/apache/asterix/dataflow/data/nontagged/printers/json/clean/ANullableFieldPrinterFactory.java
----------------------------------------------------------------------
diff --git a/asterix-om/src/main/java/org/apache/asterix/dataflow/data/nontagged/printers/json/clean/ANullableFieldPrinterFactory.java
b/asterix-om/src/main/java/org/apache/asterix/dataflow/data/nontagged/printers/json/clean/ANullableFieldPrinterFactory.java
index 35a5b50..406a9e4 100644
--- a/asterix-om/src/main/java/org/apache/asterix/dataflow/data/nontagged/printers/json/clean/ANullableFieldPrinterFactory.java
+++ b/asterix-om/src/main/java/org/apache/asterix/dataflow/data/nontagged/printers/json/clean/ANullableFieldPrinterFactory.java
@@ -18,9 +18,7 @@
  */
 package org.apache.asterix.dataflow.data.nontagged.printers.json.clean;
 
-import java.io.PrintStream;
-
-import org.apache.asterix.formats.nontagged.AqlLosslessJSONPrinterFactoryProvider;
+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;
@@ -28,6 +26,8 @@ import org.apache.hyracks.algebricks.common.exceptions.AlgebricksException;
 import org.apache.hyracks.algebricks.data.IPrinter;
 import org.apache.hyracks.algebricks.data.IPrinterFactory;
 
+import java.io.PrintStream;
+
 public class ANullableFieldPrinterFactory implements IPrinterFactory {
 
     private static final long serialVersionUID = 1L;
@@ -46,9 +46,9 @@ public class ANullableFieldPrinterFactory implements IPrinterFactory {
 
             @Override
             public void init() throws AlgebricksException {
-                nullPrinter = (AqlLosslessJSONPrinterFactoryProvider.INSTANCE.getPrinterFactory(BuiltinType.ANULL))
+                nullPrinter = (AqlCleanJSONPrinterFactoryProvider.INSTANCE.getPrinterFactory(BuiltinType.ANULL))
                         .createPrinter();
-                fieldPrinter = (AqlLosslessJSONPrinterFactoryProvider.INSTANCE.getPrinterFactory(unionType.getNullableType()))
+                fieldPrinter = (AqlCleanJSONPrinterFactoryProvider.INSTANCE.getPrinterFactory(unionType.getNullableType()))
                         .createPrinter();
             }
 

http://git-wip-us.apache.org/repos/asf/incubator-asterixdb/blob/ed21d494/asterix-om/src/main/java/org/apache/asterix/dataflow/data/nontagged/printers/json/clean/AUnionPrinterFactory.java
----------------------------------------------------------------------
diff --git a/asterix-om/src/main/java/org/apache/asterix/dataflow/data/nontagged/printers/json/clean/AUnionPrinterFactory.java
b/asterix-om/src/main/java/org/apache/asterix/dataflow/data/nontagged/printers/json/clean/AUnionPrinterFactory.java
index 2d1b35f..e3e835e 100644
--- a/asterix-om/src/main/java/org/apache/asterix/dataflow/data/nontagged/printers/json/clean/AUnionPrinterFactory.java
+++ b/asterix-om/src/main/java/org/apache/asterix/dataflow/data/nontagged/printers/json/clean/AUnionPrinterFactory.java
@@ -18,10 +18,7 @@
  */
 package org.apache.asterix.dataflow.data.nontagged.printers.json.clean;
 
-import java.io.PrintStream;
-import java.util.List;
-
-import org.apache.asterix.formats.nontagged.AqlLosslessJSONPrinterFactoryProvider;
+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.IAType;
@@ -29,6 +26,9 @@ import org.apache.hyracks.algebricks.common.exceptions.AlgebricksException;
 import org.apache.hyracks.algebricks.data.IPrinter;
 import org.apache.hyracks.algebricks.data.IPrinterFactory;
 
+import java.io.PrintStream;
+import java.util.List;
+
 public class AUnionPrinterFactory implements IPrinterFactory {
 
     private static final long serialVersionUID = 1L;
@@ -52,7 +52,7 @@ public class AUnionPrinterFactory implements IPrinterFactory {
                 unionList = unionType.getUnionList();
                 printers = new IPrinter[unionType.getUnionList().size()];
                 for (int i = 0; i < printers.length; i++) {
-                    printers[i] = (AqlLosslessJSONPrinterFactoryProvider.INSTANCE.getPrinterFactory(unionType.getUnionList()
+                    printers[i] = (AqlCleanJSONPrinterFactoryProvider.INSTANCE.getPrinterFactory(unionType.getUnionList()
                             .get(i))).createPrinter();
                     printers[i].init();
                 }


Mime
View raw message