Till Westmann has submitted this change and it was merged.

Change subject: [NO ISSUE][TYPE] Avoid 'null' collection types
......................................................................


[NO ISSUE][TYPE] Avoid 'null' collection types

- user model changes: no
- storage format changes: no
- interface changes: no

Change-Id: Id7ab2a20e776152ecf35d5bd01b1eded7e987e26
Reviewed-on: https://asterix-gerrit.ics.uci.edu/3247
Sonar-Qube: Jenkins <jenk...@fulliautomatix.ics.uci.edu>
Tested-by: Jenkins <jenk...@fulliautomatix.ics.uci.edu>
Contrib: Jenkins <jenk...@fulliautomatix.ics.uci.edu>
Integration-Tests: Jenkins <jenk...@fulliautomatix.ics.uci.edu>
Reviewed-by: Michael Blow <mb...@apache.org>
---
M 
asterixdb/asterix-algebra/src/main/java/org/apache/asterix/translator/TypeTranslator.java
M 
asterixdb/asterix-om/src/main/java/org/apache/asterix/om/types/AUnorderedListType.java
M 
asterixdb/asterix-om/src/main/java/org/apache/asterix/om/types/AbstractCollectionType.java
3 files changed, 8 insertions(+), 5 deletions(-)

Approvals:
  Anon. E. Moose #1000171: 
  Jenkins: Verified; No violations found; ; Verified
  Michael Blow: Looks good to me, approved



diff --git 
a/asterixdb/asterix-algebra/src/main/java/org/apache/asterix/translator/TypeTranslator.java
 
b/asterixdb/asterix-algebra/src/main/java/org/apache/asterix/translator/TypeTranslator.java
index 9edfddb..bb620b0 100644
--- 
a/asterixdb/asterix-algebra/src/main/java/org/apache/asterix/translator/TypeTranslator.java
+++ 
b/asterixdb/asterix-algebra/src/main/java/org/apache/asterix/translator/TypeTranslator.java
@@ -48,6 +48,8 @@
 import org.apache.asterix.om.types.TypeSignature;
 import org.apache.hyracks.algebricks.common.exceptions.AlgebricksException;
 
+import static org.apache.asterix.om.types.BuiltinType.ANY;
+
 public class TypeTranslator {
 
     private TypeTranslator() {
@@ -200,7 +202,7 @@
             throws AlgebricksException {
         TypeExpression tExpr = oltd.getItemTypeExpression();
         String typeName = typeSignature != null ? typeSignature.getName() : 
null;
-        AOrderedListType aolt = new AOrderedListType(null, typeName);
+        AOrderedListType aolt = new AOrderedListType(ANY, typeName);
         setCollectionItemType(tExpr, typeMap, incompleteItemTypes, 
incompleteFieldTypes, aolt, defaultDataverse);
         return aolt;
     }
@@ -212,7 +214,7 @@
             throws AlgebricksException {
         TypeExpression tExpr = ultd.getItemTypeExpression();
         String typeName = typeSignature != null ? typeSignature.getName() : 
null;
-        AUnorderedListType ault = new AUnorderedListType(null, typeName);
+        AUnorderedListType ault = new AUnorderedListType(ANY, typeName);
         setCollectionItemType(tExpr, typeMap, incompleteItemTypes, 
incompleteFieldTypes, ault, defaulDataverse);
         return ault;
     }
diff --git 
a/asterixdb/asterix-om/src/main/java/org/apache/asterix/om/types/AUnorderedListType.java
 
b/asterixdb/asterix-om/src/main/java/org/apache/asterix/om/types/AUnorderedListType.java
index 9defce0..711b2f3 100644
--- 
a/asterixdb/asterix-om/src/main/java/org/apache/asterix/om/types/AUnorderedListType.java
+++ 
b/asterixdb/asterix-om/src/main/java/org/apache/asterix/om/types/AUnorderedListType.java
@@ -31,8 +31,7 @@
 
     private static final long serialVersionUID = 1L;
 
-    // TODO: why is the item type "null"? why not ANY?
-    public static final AUnorderedListType FULLY_OPEN_UNORDEREDLIST_TYPE = new 
AUnorderedListType(null, "");
+    public static final AUnorderedListType FULLY_OPEN_UNORDEREDLIST_TYPE = new 
AUnorderedListType(BuiltinType.ANY, "");
 
     /**
      * @param itemType
diff --git 
a/asterixdb/asterix-om/src/main/java/org/apache/asterix/om/types/AbstractCollectionType.java
 
b/asterixdb/asterix-om/src/main/java/org/apache/asterix/om/types/AbstractCollectionType.java
index 1b2b8fe..4b748a9 100644
--- 
a/asterixdb/asterix-om/src/main/java/org/apache/asterix/om/types/AbstractCollectionType.java
+++ 
b/asterixdb/asterix-om/src/main/java/org/apache/asterix/om/types/AbstractCollectionType.java
@@ -18,6 +18,8 @@
  */
 package org.apache.asterix.om.types;
 
+import java.util.Objects;
+
 import org.apache.hyracks.api.exceptions.HyracksDataException;
 import org.apache.hyracks.api.io.IJsonSerializable;
 import org.apache.hyracks.api.io.IPersistedResourceRegistry;
@@ -33,7 +35,7 @@
 
     AbstractCollectionType(IAType itemType, String typeName) {
         super(typeName);
-        this.itemType = itemType;
+        this.itemType = Objects.requireNonNull(itemType);
     }
 
     public boolean isTyped() {

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

Gerrit-MessageType: merged
Gerrit-Change-Id: Id7ab2a20e776152ecf35d5bd01b1eded7e987e26
Gerrit-PatchSet: 5
Gerrit-Project: asterixdb
Gerrit-Branch: master
Gerrit-Owner: Till Westmann <ti...@apache.org>
Gerrit-Reviewer: Anon. E. Moose #1000171
Gerrit-Reviewer: Jenkins <jenk...@fulliautomatix.ics.uci.edu>
Gerrit-Reviewer: Michael Blow <mb...@apache.org>
Gerrit-Reviewer: Till Westmann <ti...@apache.org>

Reply via email to