asterixdb-notifications mailing list archives

Site index · List index
Message view « Date » · « Thread »
Top « Date » · « Thread »
From "Chris Hillery (Code Review)" <do-not-re...@asterixdb.incubator.apache.org>
Subject Change in asterixdb[master]: ASTERIXDB-1165: Use clean JSON consistently
Date Fri, 13 Nov 2015 18:07:45 GMT
Chris Hillery has submitted this change and it was merged.

Change subject: ASTERIXDB-1165: Use clean JSON consistently
......................................................................


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>
---
A asterix-app/src/test/resources/runtimets/queries/json/issue-ASTERIXDB-1165/nullablefield.1.query.aql
A asterix-app/src/test/resources/runtimets/results/json/issue-ASTERIXDB-1165/nullablefield.1.json
M asterix-app/src/test/resources/runtimets/testsuite.xml
M asterix-om/src/main/java/org/apache/asterix/dataflow/data/nontagged/printers/json/clean/ANullableFieldPrinterFactory.java
M asterix-om/src/main/java/org/apache/asterix/dataflow/data/nontagged/printers/json/clean/AUnionPrinterFactory.java
5 files changed, 19 insertions(+), 10 deletions(-)

Approvals:
  Till Westmann: Looks good to me, approved
  Jenkins: Verified



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)
+
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
+ ]
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">
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,15 +18,15 @@
  */
 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;
 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 {
 
@@ -46,9 +46,9 @@
 
             @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();
             }
 
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,16 +18,16 @@
  */
 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;
 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 {
 
@@ -52,7 +52,7 @@
                 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();
                 }

-- 
To view, visit https://asterix-gerrit.ics.uci.edu/493
To unsubscribe, visit https://asterix-gerrit.ics.uci.edu/settings

Gerrit-MessageType: merged
Gerrit-Change-Id: I50442edc3187d003987bc4119559eda676c9b2eb
Gerrit-PatchSet: 2
Gerrit-Project: asterixdb
Gerrit-Branch: master
Gerrit-Owner: Chris Hillery <ceej@lambda.nu>
Gerrit-Reviewer: Chris Hillery <ceej@lambda.nu>
Gerrit-Reviewer: Ian Maxon <imaxon@apache.org>
Gerrit-Reviewer: Jenkins <jenkins@fulliautomatix.ics.uci.edu>
Gerrit-Reviewer: Till Westmann <tillw@apache.org>

Mime
View raw message