This is an automated email from the ASF dual-hosted git repository.

tillw pushed a commit to branch master
in repository https://gitbox.apache.org/repos/asf/asterixdb.git


The following commit(s) were added to refs/heads/master by this push:
     new 1571c93  [NO ISSUE][TYPE] Avoid 'null' collection types
1571c93 is described below

commit 1571c93343902a9483050e5eb8416b09e816ce85
Author: Till Westmann <ti...@apache.org>
AuthorDate: Fri Mar 15 11:43:10 2019 -0700

    [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>
---
 .../src/main/java/org/apache/asterix/translator/TypeTranslator.java | 6 ++++--
 .../main/java/org/apache/asterix/om/types/AUnorderedListType.java   | 3 +--
 .../java/org/apache/asterix/om/types/AbstractCollectionType.java    | 4 +++-
 3 files changed, 8 insertions(+), 5 deletions(-)

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.IAType;
 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 @@ public class TypeTranslator {
             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 @@ public class TypeTranslator {
             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 @@ public class AUnorderedListType extends 
AbstractCollectionType {
 
     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 @@ public abstract class AbstractCollectionType extends 
AbstractComplexType {
 
     AbstractCollectionType(IAType itemType, String typeName) {
         super(typeName);
-        this.itemType = itemType;
+        this.itemType = Objects.requireNonNull(itemType);
     }
 
     public boolean isTyped() {

Reply via email to