[ASTERIXDB-2445][COMP] Nullable category handling in TypeComputeUtils.getResultType()
- user model changes: no
- storage format changes: no
- interface changes: no
Details:
- TypeComputeUtils.getResultType() currently makes the output type unknownable when
nullable category is passed. It should make it nullable instead
Change-Id: I0bb1e96c5a4f83a3d281811246da183d1a31e0f1
Reviewed-on: https://asterix-gerrit.ics.uci.edu/2932
Sonar-Qube: Jenkins <jenkins@fulliautomatix.ics.uci.edu>
Tested-by: Jenkins <jenkins@fulliautomatix.ics.uci.edu>
Contrib: Jenkins <jenkins@fulliautomatix.ics.uci.edu>
Integration-Tests: Jenkins <jenkins@fulliautomatix.ics.uci.edu>
Reviewed-by: abdullah alamoudi <bamousaa@gmail.com>
diff --git a/asterixdb/asterix-om/src/main/java/org/apache/asterix/om/typecomputer/impl/TypeComputeUtils.java b/asterixdb/asterix-om/src/main/java/org/apache/asterix/om/typecomputer/impl/TypeComputeUtils.java
index 448ab4c..f1f1be3 100644
--- a/asterixdb/asterix-om/src/main/java/org/apache/asterix/om/typecomputer/impl/TypeComputeUtils.java
+++ b/asterixdb/asterix-om/src/main/java/org/apache/asterix/om/typecomputer/impl/TypeComputeUtils.java
@@ -168,8 +168,9 @@
}
IAType resultType = type;
if ((category & NULLABLE) != 0 || (category & NULL) != 0) {
- resultType = AUnionType.createUnknownableType(resultType);
- } else if ((category & MISSABLE) != 0 || (category & MISSING) != 0) {
+ resultType = AUnionType.createNullableType(resultType);
+ }
+ if ((category & MISSABLE) != 0 || (category & MISSING) != 0) {
resultType = AUnionType.createMissableType(resultType);
}
return resultType;