asterixdb-notifications mailing list archives

Site index · List index
Message view « Date » · « Thread »
Top « Date » · « Thread »
From "Yingyi Bu (Code Review)" <do-not-re...@asterixdb.incubator.apache.org>
Subject Change in asterixdb[master]: ASTERIXDB-1630: fix ATypeHierarchy to handle ANY.
Date Tue, 13 Sep 2016 21:49:16 GMT
Yingyi Bu has uploaded a new change for review.

  https://asterix-gerrit.ics.uci.edu/1168

Change subject: ASTERIXDB-1630: fix ATypeHierarchy to handle ANY.
......................................................................

ASTERIXDB-1630: fix ATypeHierarchy to handle ANY.

Change-Id: Ic22421d12b1a6a17f15283e1e1403961e7fe17d0
---
M asterixdb/asterix-om/src/main/java/org/apache/asterix/om/typecomputer/base/TypeCastUtils.java
M asterixdb/asterix-om/src/main/java/org/apache/asterix/om/types/hierachy/ATypeHierarchy.java
2 files changed, 2 insertions(+), 8 deletions(-)


  git pull ssh://asterix-gerrit.ics.uci.edu:29418/asterixdb refs/changes/68/1168/1

diff --git a/asterixdb/asterix-om/src/main/java/org/apache/asterix/om/typecomputer/base/TypeCastUtils.java
b/asterixdb/asterix-om/src/main/java/org/apache/asterix/om/typecomputer/base/TypeCastUtils.java
index 4bdcbba..91990f2 100644
--- a/asterixdb/asterix-om/src/main/java/org/apache/asterix/om/typecomputer/base/TypeCastUtils.java
+++ b/asterixdb/asterix-om/src/main/java/org/apache/asterix/om/typecomputer/base/TypeCastUtils.java
@@ -39,9 +39,7 @@
             opaqueParameters = new Object[2];
             opaqueParameters[0] = requiredType;
             opaqueParameters[1] = inputType;
-            if (TypeComputeUtils.getActualType(inputType).getTypeTag() != ATypeTag.ANY
-                    && TypeComputeUtils.getActualType(requiredType).getTypeTag()
!= ATypeTag.ANY
-                    && !ATypeHierarchy.isCompatible(requiredType.getTypeTag(),
+            if (!ATypeHierarchy.isCompatible(requiredType.getTypeTag(),
                             TypeComputeUtils.getActualType(inputType).getTypeTag())) {
                 throw new AlgebricksException(inputType + " can't be casted to " + requiredType);
             }
diff --git a/asterixdb/asterix-om/src/main/java/org/apache/asterix/om/types/hierachy/ATypeHierarchy.java
b/asterixdb/asterix-om/src/main/java/org/apache/asterix/om/types/hierachy/ATypeHierarchy.java
index f85aa50..c23147e 100644
--- a/asterixdb/asterix-om/src/main/java/org/apache/asterix/om/types/hierachy/ATypeHierarchy.java
+++ b/asterixdb/asterix-om/src/main/java/org/apache/asterix/om/types/hierachy/ATypeHierarchy.java
@@ -169,11 +169,7 @@
     }
 
     public static boolean isCompatible(ATypeTag type1, ATypeTag type2) {
-        return canPromote(type1, type2) | canPromote(type2, type1);
-    }
-
-    public static boolean isDemoteCompatible(ATypeTag type1, ATypeTag type2) {
-        return canDemote(type1, type2) | canDemote(type2, type1);
+        return type1 == ATypeTag.ANY || type2 == ATypeTag.ANY || canPromote(type1, type2)
|| canPromote(type2, type1);
     }
 
     // Get an AsterixConstantValue from a source Object

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

Gerrit-MessageType: newchange
Gerrit-Change-Id: Ic22421d12b1a6a17f15283e1e1403961e7fe17d0
Gerrit-PatchSet: 1
Gerrit-Project: asterixdb
Gerrit-Branch: master
Gerrit-Owner: Yingyi Bu <buyingyi@gmail.com>

Mime
View raw message