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-1951][FUN] Cleanup type constructor functions
Date Fri, 23 Jun 2017 06:17:00 GMT
Yingyi Bu has submitted this change and it was merged.

Change subject: [ASTERIXDB-1951][FUN] Cleanup type constructor functions
......................................................................


[ASTERIXDB-1951][FUN] Cleanup type constructor functions

- user model changes: yes

1) primitive type constructor functions now accept input values
   of their respective types and return them as is
2) removed type constructor function for 'null' type

- storage format changes: no
- interface changes: no

Change-Id: I4a6627bfcc302b2621df8d7837c15434970b9d3a
Reviewed-on: https://asterix-gerrit.ics.uci.edu/1846
Sonar-Qube: Jenkins <jenkins@fulliautomatix.ics.uci.edu>
Tested-by: Jenkins <jenkins@fulliautomatix.ics.uci.edu>
BAD: Jenkins <jenkins@fulliautomatix.ics.uci.edu>
Integration-Tests: Jenkins <jenkins@fulliautomatix.ics.uci.edu>
Reviewed-by: Yingyi Bu <buyingyi@gmail.com>
---
M asterixdb/asterix-algebra/src/main/java/org/apache/asterix/translator/util/FunctionCollection.java
M asterixdb/asterix-app/src/test/resources/runtimets/queries/constructor/binary_01/binary_01.3.query.aql
M asterixdb/asterix-app/src/test/resources/runtimets/queries/constructor/boolean_01/boolean_01.3.query.aql
M asterixdb/asterix-app/src/test/resources/runtimets/queries/constructor/circle_01/circle_01.3.query.aql
M asterixdb/asterix-app/src/test/resources/runtimets/queries/constructor/date_01/date_01.3.query.aql
M asterixdb/asterix-app/src/test/resources/runtimets/queries/constructor/datetime_01/datetime_01.3.query.aql
M asterixdb/asterix-app/src/test/resources/runtimets/queries/constructor/double_01/double_01.3.query.aql
M asterixdb/asterix-app/src/test/resources/runtimets/queries/constructor/duration_01/duration_01.3.query.aql
M asterixdb/asterix-app/src/test/resources/runtimets/queries/constructor/duration_02/duration_02.3.query.aql
M asterixdb/asterix-app/src/test/resources/runtimets/queries/constructor/float_01/float_01.3.query.aql
M asterixdb/asterix-app/src/test/resources/runtimets/queries/constructor/int_01/int_01.3.query.aql
M asterixdb/asterix-app/src/test/resources/runtimets/queries/constructor/line_01/line_01.3.query.aql
M asterixdb/asterix-app/src/test/resources/runtimets/queries/constructor/point_01/point_01.3.query.aql
M asterixdb/asterix-app/src/test/resources/runtimets/queries/constructor/polygon_01/polygon_01.3.query.aql
M asterixdb/asterix-app/src/test/resources/runtimets/queries/constructor/rectangle_01/rectangle_01.3.query.aql
M asterixdb/asterix-app/src/test/resources/runtimets/queries/constructor/string_01/string_01.3.query.aql
M asterixdb/asterix-app/src/test/resources/runtimets/queries/constructor/time_01/time_01.3.query.aql
M asterixdb/asterix-app/src/test/resources/runtimets/queries/constructor/uuid_01/uuid_01.3.query.aql
M asterixdb/asterix-app/src/test/resources/runtimets/queries_sqlpp/constructor/binary_01/binary_01.3.query.sqlpp
M asterixdb/asterix-app/src/test/resources/runtimets/queries_sqlpp/constructor/boolean_01/boolean_01.3.query.sqlpp
M asterixdb/asterix-app/src/test/resources/runtimets/queries_sqlpp/constructor/circle_01/circle_01.3.query.sqlpp
M asterixdb/asterix-app/src/test/resources/runtimets/queries_sqlpp/constructor/date_01/date_01.3.query.sqlpp
M asterixdb/asterix-app/src/test/resources/runtimets/queries_sqlpp/constructor/datetime_01/datetime_01.3.query.sqlpp
M asterixdb/asterix-app/src/test/resources/runtimets/queries_sqlpp/constructor/double_01/double_01.3.query.sqlpp
M asterixdb/asterix-app/src/test/resources/runtimets/queries_sqlpp/constructor/duration_01/duration_01.3.query.sqlpp
M asterixdb/asterix-app/src/test/resources/runtimets/queries_sqlpp/constructor/duration_02/duration_02.3.query.sqlpp
M asterixdb/asterix-app/src/test/resources/runtimets/queries_sqlpp/constructor/float_01/float_01.3.query.sqlpp
M asterixdb/asterix-app/src/test/resources/runtimets/queries_sqlpp/constructor/int_01/int_01.3.query.sqlpp
M asterixdb/asterix-app/src/test/resources/runtimets/queries_sqlpp/constructor/line_01/line_01.3.query.sqlpp
M asterixdb/asterix-app/src/test/resources/runtimets/queries_sqlpp/constructor/point_01/point_01.3.query.sqlpp
M asterixdb/asterix-app/src/test/resources/runtimets/queries_sqlpp/constructor/polygon_01/polygon_01.3.query.sqlpp
M asterixdb/asterix-app/src/test/resources/runtimets/queries_sqlpp/constructor/rectangle_01/rectangle_01.3.query.sqlpp
M asterixdb/asterix-app/src/test/resources/runtimets/queries_sqlpp/constructor/string_01/string_01.3.query.sqlpp
M asterixdb/asterix-app/src/test/resources/runtimets/queries_sqlpp/constructor/time_01/time_01.3.query.sqlpp
M asterixdb/asterix-app/src/test/resources/runtimets/queries_sqlpp/constructor/uuid_01/uuid_01.3.query.sqlpp
M asterixdb/asterix-app/src/test/resources/runtimets/results/constructor/binary_01/binary_01.1.adm
M asterixdb/asterix-app/src/test/resources/runtimets/results/constructor/boolean_01/boolean_01.1.adm
M asterixdb/asterix-app/src/test/resources/runtimets/results/constructor/circle_01/circle_01.1.adm
M asterixdb/asterix-app/src/test/resources/runtimets/results/constructor/date_01/date_01.1.adm
M asterixdb/asterix-app/src/test/resources/runtimets/results/constructor/datetime_01/datetime_01.1.adm
M asterixdb/asterix-app/src/test/resources/runtimets/results/constructor/double_01/double_01.1.adm
M asterixdb/asterix-app/src/test/resources/runtimets/results/constructor/duration_01/duration_01.1.adm
M asterixdb/asterix-app/src/test/resources/runtimets/results/constructor/duration_02/duration_02.1.adm
M asterixdb/asterix-app/src/test/resources/runtimets/results/constructor/float_01/float_01.1.adm
M asterixdb/asterix-app/src/test/resources/runtimets/results/constructor/int_01/int_01.1.adm
M asterixdb/asterix-app/src/test/resources/runtimets/results/constructor/line_01/line_01.1.adm
M asterixdb/asterix-app/src/test/resources/runtimets/results/constructor/point_01/point_01.1.adm
M asterixdb/asterix-app/src/test/resources/runtimets/results/constructor/polygon_01/polygon_01.1.adm
M asterixdb/asterix-app/src/test/resources/runtimets/results/constructor/rectangle_01/rectangle_01.1.adm
M asterixdb/asterix-app/src/test/resources/runtimets/results/constructor/string_01/string_01.1.adm
M asterixdb/asterix-app/src/test/resources/runtimets/results/constructor/time_01/time_01.1.adm
M asterixdb/asterix-app/src/test/resources/runtimets/results/constructor/uuid_01/uuid_01.1.adm
M asterixdb/asterix-app/src/test/resources/runtimets/results_parser_sqlpp/constructor/binary_01/binary_01.3.ast
M asterixdb/asterix-app/src/test/resources/runtimets/results_parser_sqlpp/constructor/boolean_01/boolean_01.3.ast
M asterixdb/asterix-app/src/test/resources/runtimets/results_parser_sqlpp/constructor/circle_01/circle_01.3.ast
M asterixdb/asterix-app/src/test/resources/runtimets/results_parser_sqlpp/constructor/date_01/date_01.3.ast
M asterixdb/asterix-app/src/test/resources/runtimets/results_parser_sqlpp/constructor/datetime_01/datetime_01.3.ast
M asterixdb/asterix-app/src/test/resources/runtimets/results_parser_sqlpp/constructor/double_01/double_01.3.ast
M asterixdb/asterix-app/src/test/resources/runtimets/results_parser_sqlpp/constructor/duration_01/duration_01.3.ast
M asterixdb/asterix-app/src/test/resources/runtimets/results_parser_sqlpp/constructor/duration_02/duration_02.3.ast
M asterixdb/asterix-app/src/test/resources/runtimets/results_parser_sqlpp/constructor/float_01/float_01.3.ast
M asterixdb/asterix-app/src/test/resources/runtimets/results_parser_sqlpp/constructor/int_01/int_01.3.ast
M asterixdb/asterix-app/src/test/resources/runtimets/results_parser_sqlpp/constructor/line_01/line_01.3.ast
M asterixdb/asterix-app/src/test/resources/runtimets/results_parser_sqlpp/constructor/point_01/point_01.3.ast
M asterixdb/asterix-app/src/test/resources/runtimets/results_parser_sqlpp/constructor/polygon_01/polygon_01.3.ast
M asterixdb/asterix-app/src/test/resources/runtimets/results_parser_sqlpp/constructor/rectangle_01/rectangle_01.3.ast
M asterixdb/asterix-app/src/test/resources/runtimets/results_parser_sqlpp/constructor/string_01/string_01.3.ast
M asterixdb/asterix-app/src/test/resources/runtimets/results_parser_sqlpp/constructor/time_01/time_01.3.ast
M asterixdb/asterix-app/src/test/resources/runtimets/results_parser_sqlpp/constructor/uuid_01/uuid_01.3.ast
M asterixdb/asterix-om/src/main/java/org/apache/asterix/om/functions/BuiltinFunctions.java
D asterixdb/asterix-om/src/main/java/org/apache/asterix/om/typecomputer/impl/AMissingTypeComputer.java
M asterixdb/asterix-om/src/main/java/org/apache/asterix/om/types/ATypeTag.java
M asterixdb/asterix-runtime/src/main/java/org/apache/asterix/runtime/evaluators/constructors/ABinaryHexStringConstructorDescriptor.java
M asterixdb/asterix-runtime/src/main/java/org/apache/asterix/runtime/evaluators/constructors/ABooleanConstructorDescriptor.java
M asterixdb/asterix-runtime/src/main/java/org/apache/asterix/runtime/evaluators/constructors/ACircleConstructorDescriptor.java
M asterixdb/asterix-runtime/src/main/java/org/apache/asterix/runtime/evaluators/constructors/ADateConstructorDescriptor.java
M asterixdb/asterix-runtime/src/main/java/org/apache/asterix/runtime/evaluators/constructors/ADateTimeConstructorDescriptor.java
M asterixdb/asterix-runtime/src/main/java/org/apache/asterix/runtime/evaluators/constructors/ADayTimeDurationConstructorDescriptor.java
M asterixdb/asterix-runtime/src/main/java/org/apache/asterix/runtime/evaluators/constructors/ADoubleConstructorDescriptor.java
M asterixdb/asterix-runtime/src/main/java/org/apache/asterix/runtime/evaluators/constructors/ADurationConstructorDescriptor.java
M asterixdb/asterix-runtime/src/main/java/org/apache/asterix/runtime/evaluators/constructors/AFloatConstructorDescriptor.java
M asterixdb/asterix-runtime/src/main/java/org/apache/asterix/runtime/evaluators/constructors/AInt16ConstructorDescriptor.java
M asterixdb/asterix-runtime/src/main/java/org/apache/asterix/runtime/evaluators/constructors/AInt32ConstructorDescriptor.java
M asterixdb/asterix-runtime/src/main/java/org/apache/asterix/runtime/evaluators/constructors/AInt64ConstructorDescriptor.java
M asterixdb/asterix-runtime/src/main/java/org/apache/asterix/runtime/evaluators/constructors/AInt8ConstructorDescriptor.java
M asterixdb/asterix-runtime/src/main/java/org/apache/asterix/runtime/evaluators/constructors/ALineConstructorDescriptor.java
D asterixdb/asterix-runtime/src/main/java/org/apache/asterix/runtime/evaluators/constructors/ANullConstructorDescriptor.java
M asterixdb/asterix-runtime/src/main/java/org/apache/asterix/runtime/evaluators/constructors/APoint3DConstructorDescriptor.java
M asterixdb/asterix-runtime/src/main/java/org/apache/asterix/runtime/evaluators/constructors/APointConstructorDescriptor.java
M asterixdb/asterix-runtime/src/main/java/org/apache/asterix/runtime/evaluators/constructors/APolygonConstructorDescriptor.java
M asterixdb/asterix-runtime/src/main/java/org/apache/asterix/runtime/evaluators/constructors/ARectangleConstructorDescriptor.java
M asterixdb/asterix-runtime/src/main/java/org/apache/asterix/runtime/evaluators/constructors/AStringConstructorDescriptor.java
M asterixdb/asterix-runtime/src/main/java/org/apache/asterix/runtime/evaluators/constructors/ATimeConstructorDescriptor.java
M asterixdb/asterix-runtime/src/main/java/org/apache/asterix/runtime/evaluators/constructors/AUUIDFromStringConstructorDescriptor.java
M asterixdb/asterix-runtime/src/main/java/org/apache/asterix/runtime/evaluators/constructors/AYearMonthDurationConstructorDescriptor.java
95 files changed, 836 insertions(+), 365 deletions(-)

Approvals:
  Yingyi Bu: Looks good to me, approved
  Jenkins: Verified; No violations found; No violations found; Verified



diff --git a/asterixdb/asterix-algebra/src/main/java/org/apache/asterix/translator/util/FunctionCollection.java b/asterixdb/asterix-algebra/src/main/java/org/apache/asterix/translator/util/FunctionCollection.java
index 53efe2f..f833692 100644
--- a/asterixdb/asterix-algebra/src/main/java/org/apache/asterix/translator/util/FunctionCollection.java
+++ b/asterixdb/asterix-algebra/src/main/java/org/apache/asterix/translator/util/FunctionCollection.java
@@ -120,7 +120,6 @@
 import org.apache.asterix.runtime.evaluators.constructors.AIntervalStartFromDateTimeConstructorDescriptor;
 import org.apache.asterix.runtime.evaluators.constructors.AIntervalStartFromTimeConstructorDescriptor;
 import org.apache.asterix.runtime.evaluators.constructors.ALineConstructorDescriptor;
-import org.apache.asterix.runtime.evaluators.constructors.ANullConstructorDescriptor;
 import org.apache.asterix.runtime.evaluators.constructors.APoint3DConstructorDescriptor;
 import org.apache.asterix.runtime.evaluators.constructors.APointConstructorDescriptor;
 import org.apache.asterix.runtime.evaluators.constructors.APolygonConstructorDescriptor;
@@ -545,7 +544,6 @@
 
         // Constructors
         functionsToInjectUnkownHandling.add(ABooleanConstructorDescriptor.FACTORY);
-        functionsToInjectUnkownHandling.add(ANullConstructorDescriptor.FACTORY);
         functionsToInjectUnkownHandling.add(ABinaryHexStringConstructorDescriptor.FACTORY);
         functionsToInjectUnkownHandling.add(ABinaryBase64StringConstructorDescriptor.FACTORY);
         functionsToInjectUnkownHandling.add(AStringConstructorDescriptor.FACTORY);
diff --git a/asterixdb/asterix-app/src/test/resources/runtimets/queries/constructor/binary_01/binary_01.3.query.aql b/asterixdb/asterix-app/src/test/resources/runtimets/queries/constructor/binary_01/binary_01.3.query.aql
index f0d2cb2..c1c8f98 100644
--- a/asterixdb/asterix-app/src/test/resources/runtimets/queries/constructor/binary_01/binary_01.3.query.aql
+++ b/asterixdb/asterix-app/src/test/resources/runtimets/queries/constructor/binary_01/binary_01.3.query.aql
@@ -23,11 +23,13 @@
 let $c3 := hex("0A0B0C0D0E0F")
 let $c4 := hex('01020304050607080900')
 let $c5 := hex('')
+let $c6 := hex($c1)
 
-let $c6 := base64("0123456789qwertyuiopasdfghjklzxcvbnmQWERTYUIOPLKJHGFDSAZXCVBNM+/")
-let $c7 := base64('')
-let $c8 := base64('QXN0ZXJpeA==')
-let $c9 := base64('QXN0ZXJpeAE=')
-let $c0 := base64('QXN0ZXJpeAE8')
+let $c7 := base64("0123456789qwertyuiopasdfghjklzxcvbnmQWERTYUIOPLKJHGFDSAZXCVBNM+/")
+let $c8 := base64('')
+let $c9 := base64('QXN0ZXJpeA==')
+let $c10 := base64('QXN0ZXJpeAE=')
+let $c11 := base64('QXN0ZXJpeAE8')
+let $c12 := base64($c11)
 
-return [ $c1,$c2,$c3,$c4,$c5,$c6,$c7,$c8,$c9,$c0 ]
+return [ $c1,$c2,$c3,$c4,$c5,$c6,$c7,$c8,$c9,$c10,$c11,$c12 ]
diff --git a/asterixdb/asterix-app/src/test/resources/runtimets/queries/constructor/boolean_01/boolean_01.3.query.aql b/asterixdb/asterix-app/src/test/resources/runtimets/queries/constructor/boolean_01/boolean_01.3.query.aql
index acca8fb..99ad694 100644
--- a/asterixdb/asterix-app/src/test/resources/runtimets/queries/constructor/boolean_01/boolean_01.3.query.aql
+++ b/asterixdb/asterix-app/src/test/resources/runtimets/queries/constructor/boolean_01/boolean_01.3.query.aql
@@ -20,5 +20,12 @@
 
 let $c1 := boolean("true")
 let $c2 := boolean("false")
-return {"boolean1": $c1,"boolean2": $c2}
+let $c3 := boolean($c2)
+
+return
+{
+    "boolean1": $c1,
+    "boolean2": $c2,
+    "boolean3": $c3
+}
 
diff --git a/asterixdb/asterix-app/src/test/resources/runtimets/queries/constructor/circle_01/circle_01.3.query.aql b/asterixdb/asterix-app/src/test/resources/runtimets/queries/constructor/circle_01/circle_01.3.query.aql
index b5f2070..392bdc7 100644
--- a/asterixdb/asterix-app/src/test/resources/runtimets/queries/constructor/circle_01/circle_01.3.query.aql
+++ b/asterixdb/asterix-app/src/test/resources/runtimets/queries/constructor/circle_01/circle_01.3.query.aql
@@ -20,4 +20,11 @@
 
 let $c1 := circle("10.1234,11.1e-1 +10.2E-2")
 let $c2 := circle("0.1234,-1.00e-10 +10.5E-2")
-return {"circle1": $c1,"circle2": $c2}
+let $c3 := circle($c2)
+
+return
+{
+    "circle1": $c1,
+    "circle2": $c2,
+    "circle3": $c3
+}
diff --git a/asterixdb/asterix-app/src/test/resources/runtimets/queries/constructor/date_01/date_01.3.query.aql b/asterixdb/asterix-app/src/test/resources/runtimets/queries/constructor/date_01/date_01.3.query.aql
index 8e56f5f..22f6f1a 100644
--- a/asterixdb/asterix-app/src/test/resources/runtimets/queries/constructor/date_01/date_01.3.query.aql
+++ b/asterixdb/asterix-app/src/test/resources/runtimets/queries/constructor/date_01/date_01.3.query.aql
@@ -28,5 +28,19 @@
 let $c8 := date("19280329")
 let $c9 := date("19000228")
 let $c10 := date("20000229")
+let $c11 := date($c10)
 
-return {"date1": $c1, "date2": $c2, "date3": $c3, "date4": $c4, "date5": $c5, "date6": $c6, "date7": $c7, "date8": $c8, "date9": $c9, "date10": $c10}
+return
+{
+    "date1": $c1,
+    "date2": $c2,
+    "date3": $c3,
+    "date4": $c4,
+    "date5": $c5,
+    "date6": $c6,
+    "date7": $c7,
+    "date8": $c8,
+    "date9": $c9,
+    "date10": $c10,
+    "date11": $c11
+}
diff --git a/asterixdb/asterix-app/src/test/resources/runtimets/queries/constructor/datetime_01/datetime_01.3.query.aql b/asterixdb/asterix-app/src/test/resources/runtimets/queries/constructor/datetime_01/datetime_01.3.query.aql
index 5991798..448f8f0 100644
--- a/asterixdb/asterix-app/src/test/resources/runtimets/queries/constructor/datetime_01/datetime_01.3.query.aql
+++ b/asterixdb/asterix-app/src/test/resources/runtimets/queries/constructor/datetime_01/datetime_01.3.query.aql
@@ -32,4 +32,23 @@
 let $c12 := datetime("-19280329T174937374+0630")
 let $c13 := datetime("-19280329T17493737+0630")
 let $c14 := datetime("-19280301T05493737+0630")
-return {"datetime1": $c1, "datetime2": $c2, "datetime3": $c3, "datetime4": $c4, "datetime5": $c5, "datetime6": $c6, "datetime7": $c7, "datetime8": $c8, "datetime9": $c9, "datetime10": $c10, "datetime11": $c11, "datetime12": $c12, "datetime13": $c13, "datetime14": $c14}
+let $c15 := datetime($c14)
+
+return
+{
+    "datetime1": $c1,
+    "datetime2": $c2,
+    "datetime3": $c3,
+    "datetime4": $c4,
+    "datetime5": $c5,
+    "datetime6": $c6,
+    "datetime7": $c7,
+    "datetime8": $c8,
+    "datetime9": $c9,
+    "datetime10": $c10,
+    "datetime11": $c11,
+    "datetime12": $c12,
+    "datetime13": $c13,
+    "datetime14": $c14,
+    "datetime15": $c15
+}
diff --git a/asterixdb/asterix-app/src/test/resources/runtimets/queries/constructor/double_01/double_01.3.query.aql b/asterixdb/asterix-app/src/test/resources/runtimets/queries/constructor/double_01/double_01.3.query.aql
index 3b2abbe..db4473c 100644
--- a/asterixdb/asterix-app/src/test/resources/runtimets/queries/constructor/double_01/double_01.3.query.aql
+++ b/asterixdb/asterix-app/src/test/resources/runtimets/queries/constructor/double_01/double_01.3.query.aql
@@ -25,5 +25,15 @@
 let $c4 := double("-80.20d")
 let $c5 := double("-20.56e-30")
 let $c6 := double("-20.56e-300")
-return {"double1": $c1,"double2": $c2,"double3": $c3,"double4": $c4,"double5": $c5,"double6": $c6}
+let $c7 := double($c6)
 
+return
+{
+    "double1": $c1,
+    "double2": $c2,
+    "double3": $c3,
+    "double4": $c4,
+    "double5": $c5,
+    "double6": $c6,
+    "double7": $c7
+}
diff --git a/asterixdb/asterix-app/src/test/resources/runtimets/queries/constructor/duration_01/duration_01.3.query.aql b/asterixdb/asterix-app/src/test/resources/runtimets/queries/constructor/duration_01/duration_01.3.query.aql
index 6f2e49f..5ccc7b4 100644
--- a/asterixdb/asterix-app/src/test/resources/runtimets/queries/constructor/duration_01/duration_01.3.query.aql
+++ b/asterixdb/asterix-app/src/test/resources/runtimets/queries/constructor/duration_01/duration_01.3.query.aql
@@ -17,7 +17,7 @@
  * under the License.
  */
 /*
- * Description  : test duration constructors 
+ * Description  : test duration constructors
  * Expected Res : Success
  * Date         : 7 May 2013
  */
@@ -36,4 +36,21 @@
 let $c10 := duration("-P28M")
 let $c11 := duration("PT29M90.937S")
 let $c12 := duration("P300Y15M60DT300H98M482.435S")
-return {"duration1": $c1, "duration2": $c2, "duration3": $c3, "duration4": $c4, "duration5": $c5, "duration6": $c6, "duration7": $c7, "duration8": $c8, "duration9": $c9, "duration10": $c10, "duration11": $c11, "duration12": $c12}
+let $c13 := duration($c12)
+
+return
+{
+    "duration1": $c1,
+    "duration2": $c2,
+    "duration3": $c3,
+    "duration4": $c4,
+    "duration5": $c5,
+    "duration6": $c6,
+    "duration7": $c7,
+    "duration8": $c8,
+    "duration9": $c9,
+    "duration10": $c10,
+    "duration11": $c11,
+    "duration12": $c12,
+    "duration13": $c13
+}
diff --git a/asterixdb/asterix-app/src/test/resources/runtimets/queries/constructor/duration_02/duration_02.3.query.aql b/asterixdb/asterix-app/src/test/resources/runtimets/queries/constructor/duration_02/duration_02.3.query.aql
index 9659e81..d294392 100644
--- a/asterixdb/asterix-app/src/test/resources/runtimets/queries/constructor/duration_02/duration_02.3.query.aql
+++ b/asterixdb/asterix-app/src/test/resources/runtimets/queries/constructor/duration_02/duration_02.3.query.aql
@@ -17,7 +17,7 @@
  * under the License.
  */
 /*
- * Description  : test sub type duration (year-month-duration and day-time-duration) constructors 
+ * Description  : test sub type duration (year-month-duration and day-time-duration) constructors
  * Expected Res : Success
  * Date         : 7 May 2013
  * issue        : 363
@@ -37,4 +37,21 @@
 let $c10 := year-month-duration("-P28M")
 let $c11 := day-time-duration("PT29M90.937S")
 let $c12 := year-month-duration("P300Y15M")
-return {"duration1": $c1, "duration2": $c2, "duration3": $c3, "duration4": $c4, "duration5": $c5, "duration6": $c6, "duration7": $c7, "duration8": $c8, "duration9": $c9, "duration10": $c10, "duration11": $c11, "duration12": $c12}
+let $c13 := year-month-duration($c12)
+
+return
+{
+    "duration1": $c1,
+    "duration2": $c2,
+    "duration3": $c3,
+    "duration4": $c4,
+    "duration5": $c5,
+    "duration6": $c6,
+    "duration7": $c7,
+    "duration8": $c8,
+    "duration9": $c9,
+    "duration10": $c10,
+    "duration11": $c11,
+    "duration12": $c12,
+    "duration13": $c13
+}
diff --git a/asterixdb/asterix-app/src/test/resources/runtimets/queries/constructor/float_01/float_01.3.query.aql b/asterixdb/asterix-app/src/test/resources/runtimets/queries/constructor/float_01/float_01.3.query.aql
index 2c7f011..ad92a44 100644
--- a/asterixdb/asterix-app/src/test/resources/runtimets/queries/constructor/float_01/float_01.3.query.aql
+++ b/asterixdb/asterix-app/src/test/resources/runtimets/queries/constructor/float_01/float_01.3.query.aql
@@ -23,8 +23,16 @@
 let $c3 := float("-INF")
 let $c4 := float("-80.20")
 let $c5 := float("-20.56e-30")
+let $c6 := float($c5)
 // +5.0E10 would not generate a precise calc. even with parseFloat
- 
 
-return {"float1": $c1,"float2": $c2, "float3": $c3,"float4": $c4,"float5": $c5}
+return
+{
+    "float1": $c1,
+    "float2": $c2,
+    "float3": $c3,
+    "float4": $c4,
+    "float5": $c5,
+    "float6": $c6
+}
 
diff --git a/asterixdb/asterix-app/src/test/resources/runtimets/queries/constructor/int_01/int_01.3.query.aql b/asterixdb/asterix-app/src/test/resources/runtimets/queries/constructor/int_01/int_01.3.query.aql
index 1928609..05dd24f 100644
--- a/asterixdb/asterix-app/src/test/resources/runtimets/queries/constructor/int_01/int_01.3.query.aql
+++ b/asterixdb/asterix-app/src/test/resources/runtimets/queries/constructor/int_01/int_01.3.query.aql
@@ -22,9 +22,35 @@
 let $c2 := int16("160")
 let $c3 := int32("+320i32")
 let $c4 := int64("640")
+
 let $c5 := int8("-80")
 let $c6 := int16("-160i16")
 let $c7 := int32("-320")
 let $c8 := int64("-640i64")
+
 let $c9 := int64("-9223372036854775808")
-return {"int8": $c1,"int16": $c2,"int32": $c3, "int64": $c4, "int8_2": $c5,"int16_2": $c6,"int32_2": $c7, "int64_2": $c8, "int64_min" : $c9}
+
+let $c10 := int8($c1)
+let $c11 := int16($c2)
+let $c12 := int32($c3)
+let $c13 := int64($c4)
+
+return
+{
+    "int8": $c1,
+    "int16": $c2,
+    "int32": $c3,
+    "int64": $c4,
+
+    "int8_2": $c5,
+    "int16_2": $c6,
+    "int32_2": $c7,
+    "int64_2": $c8,
+
+    "int64_min" : $c9,
+
+    "int8_3": $c10,
+    "int16_3": $c11,
+    "int32_3": $c12,
+    "int64_3": $c13
+}
diff --git a/asterixdb/asterix-app/src/test/resources/runtimets/queries/constructor/line_01/line_01.3.query.aql b/asterixdb/asterix-app/src/test/resources/runtimets/queries/constructor/line_01/line_01.3.query.aql
index 1b52b25..84f6658 100644
--- a/asterixdb/asterix-app/src/test/resources/runtimets/queries/constructor/line_01/line_01.3.query.aql
+++ b/asterixdb/asterix-app/src/test/resources/runtimets/queries/constructor/line_01/line_01.3.query.aql
@@ -20,4 +20,11 @@
 
 let $c1 := line("10.1234,11.1e-1 +10.2E-2,-11.22")
 let $c2 := line("0.1234,-1.00e-10 +10.5E-2,-01.02")
-return {"line1": $c1,"line2": $c2}
+let $c3 := line($c2)
+
+return
+{
+    "line1": $c1,
+    "line2": $c2,
+    "line3": $c3
+}
diff --git a/asterixdb/asterix-app/src/test/resources/runtimets/queries/constructor/point_01/point_01.3.query.aql b/asterixdb/asterix-app/src/test/resources/runtimets/queries/constructor/point_01/point_01.3.query.aql
index 64c3c2f..444fa55 100644
--- a/asterixdb/asterix-app/src/test/resources/runtimets/queries/constructor/point_01/point_01.3.query.aql
+++ b/asterixdb/asterix-app/src/test/resources/runtimets/queries/constructor/point_01/point_01.3.query.aql
@@ -22,4 +22,15 @@
 let $c2 := point3d("5e2, -10E+5, +10.5e-10d")
 let $c3 := point("5.10E-10d, -10E5")
 let $c4 := point3d("0.5e+2d, -10.0E+5d, +10.05e-10")
-return {"point1": $c1,"point3d1": $c2,"point2": $c3, "point3d2": $c4}
+let $c5 := point($c3)
+let $c6 := point3d($c4)
+
+return
+{
+    "point1": $c1,
+    "point3d1": $c2,
+    "point2": $c3,
+    "point3d2": $c4,
+    "point3": $c5,
+    "point3d3": $c6
+}
diff --git a/asterixdb/asterix-app/src/test/resources/runtimets/queries/constructor/polygon_01/polygon_01.3.query.aql b/asterixdb/asterix-app/src/test/resources/runtimets/queries/constructor/polygon_01/polygon_01.3.query.aql
index 6a3b01a..36d81a5 100644
--- a/asterixdb/asterix-app/src/test/resources/runtimets/queries/constructor/polygon_01/polygon_01.3.query.aql
+++ b/asterixdb/asterix-app/src/test/resources/runtimets/queries/constructor/polygon_01/polygon_01.3.query.aql
@@ -20,4 +20,11 @@
 
 let $c1 := polygon("-1.2,+1.3e2 -2.14E+5,2.15 -3.5e+2,03.6 -4.6E-3,+4.81")
 let $c2 := polygon("-1.0,+10.5e2 -02.15E+50,2.5 -1.0,+3.3e3 -2.50E+05,20.15 +3.5e+2,03.6 -4.60E-3,+4.75 -2,+1.0e2 -2.00E+5,20.10 30.5,03.25 -4.33E-3,+4.75")
-return {"polygon1": $c1,"polygon2": $c2}
+let $c3 := polygon($c1)
+
+return
+{
+    "polygon1": $c1,
+    "polygon2": $c2,
+    "polygon3": $c3
+}
diff --git a/asterixdb/asterix-app/src/test/resources/runtimets/queries/constructor/rectangle_01/rectangle_01.3.query.aql b/asterixdb/asterix-app/src/test/resources/runtimets/queries/constructor/rectangle_01/rectangle_01.3.query.aql
index 864c0c8..39c3c8f 100644
--- a/asterixdb/asterix-app/src/test/resources/runtimets/queries/constructor/rectangle_01/rectangle_01.3.query.aql
+++ b/asterixdb/asterix-app/src/test/resources/runtimets/queries/constructor/rectangle_01/rectangle_01.3.query.aql
@@ -22,9 +22,16 @@
  * Date         : 18 April 2013
  * Issue        : 272
  */
- 
+
 use dataverse test;
 
 let $r1 := rectangle("5.1,11.8 87.6,15.6548")
 let $r2 := rectangle("0.1234,-1.00e-10 5.5487,0.48765")
-return {"rectangle1": $r1,"rectangle2": $r2}
+let $r3 := rectangle($r1)
+
+return
+{
+    "rectangle1": $r1,
+    "rectangle2": $r2,
+    "rectangle3": $r3
+}
diff --git a/asterixdb/asterix-app/src/test/resources/runtimets/queries/constructor/string_01/string_01.3.query.aql b/asterixdb/asterix-app/src/test/resources/runtimets/queries/constructor/string_01/string_01.3.query.aql
index 2dd5fa1..a8997df 100644
--- a/asterixdb/asterix-app/src/test/resources/runtimets/queries/constructor/string_01/string_01.3.query.aql
+++ b/asterixdb/asterix-app/src/test/resources/runtimets/queries/constructor/string_01/string_01.3.query.aql
@@ -20,5 +20,22 @@
 
 let $c1 := string("true")
 let $c2 := string("false\"")
-return {"string1": $c1,"string2": $c2}
+let $c3 := string(int8("8"))
+let $c4 := string(int16("16"))
+let $c5 := string(int32("32"))
+let $c6 := string(int64("64"))
+let $c7 := string(float("1.25"))
+let $c8 := string(double("2.5"))
+
+return
+{
+    "string1": $c1,
+    "string2": $c2,
+    "string3": $c3,
+    "string4": $c4,
+    "string5": $c5,
+    "string6": $c6,
+    "string7": $c7,
+    "string8": $c8
+}
 
diff --git a/asterixdb/asterix-app/src/test/resources/runtimets/queries/constructor/time_01/time_01.3.query.aql b/asterixdb/asterix-app/src/test/resources/runtimets/queries/constructor/time_01/time_01.3.query.aql
index 525ff2d..542d985 100644
--- a/asterixdb/asterix-app/src/test/resources/runtimets/queries/constructor/time_01/time_01.3.query.aql
+++ b/asterixdb/asterix-app/src/test/resources/runtimets/queries/constructor/time_01/time_01.3.query.aql
@@ -29,4 +29,20 @@
 let $c9 := time("12:59:00.019-01:00")
 let $c10 := time("12590001-0100")
 let $c11 := time("125900019+0100")
-return {"time1": $c1, "time2": $c2, "time3": $c3, "time4": $c4, "time5": $c5, "time6": $c6, "time7": $c7, "time8": $c8, "time9": $c9, "time10": $c10, "time11": $c11}
+let $c12 := time($c11)
+
+return
+{
+    "time1": $c1,
+    "time2": $c2,
+    "time3": $c3,
+    "time4": $c4,
+    "time5": $c5,
+    "time6": $c6,
+    "time7": $c7,
+    "time8": $c8,
+    "time9": $c9,
+    "time10": $c10,
+    "time11": $c11,
+    "time12": $c12
+}
diff --git a/asterixdb/asterix-app/src/test/resources/runtimets/queries/constructor/uuid_01/uuid_01.3.query.aql b/asterixdb/asterix-app/src/test/resources/runtimets/queries/constructor/uuid_01/uuid_01.3.query.aql
index 5b86d5c..fe04f51 100644
--- a/asterixdb/asterix-app/src/test/resources/runtimets/queries/constructor/uuid_01/uuid_01.3.query.aql
+++ b/asterixdb/asterix-app/src/test/resources/runtimets/queries/constructor/uuid_01/uuid_01.3.query.aql
@@ -20,4 +20,11 @@
 
 let $v1:=uuid("02a199ca-bf58-412e-bd9f-60a0c975a8ac")
 let $v2:=uuid("8cea25ab-55f8-467e-929d-94888f754832")
-return {"uuid1": $v1,"uuid2": $v2}
+let $v3:=uuid($v2)
+
+return
+{
+    "uuid1": $v1,
+    "uuid2": $v2,
+    "uuid3": $v3
+}
diff --git a/asterixdb/asterix-app/src/test/resources/runtimets/queries_sqlpp/constructor/binary_01/binary_01.3.query.sqlpp b/asterixdb/asterix-app/src/test/resources/runtimets/queries_sqlpp/constructor/binary_01/binary_01.3.query.sqlpp
index efbaaa6..509d97d 100644
--- a/asterixdb/asterix-app/src/test/resources/runtimets/queries_sqlpp/constructor/binary_01/binary_01.3.query.sqlpp
+++ b/asterixdb/asterix-app/src/test/resources/runtimets/queries_sqlpp/constructor/binary_01/binary_01.3.query.sqlpp
@@ -19,5 +19,18 @@
 
 use test;
 
+[
+    test.hex('ABCDEF0123456789'),
+    test.hex('abcdef0123456789'),
+    test.hex('0A0B0C0D0E0F'),
+    test.hex('01020304050607080900'),
+    test.hex(''),
+    test.hex(test.hex('ABCDEF0123456789')),
 
-[test.hex('ABCDEF0123456789'),test.hex('abcdef0123456789'),test.hex('0A0B0C0D0E0F'),test.hex('01020304050607080900'),test.hex(''),test.base64('0123456789qwertyuiopasdfghjklzxcvbnmQWERTYUIOPLKJHGFDSAZXCVBNM+/'),test.base64(''),test.base64('QXN0ZXJpeA=='),test.base64('QXN0ZXJpeAE='),test.base64('QXN0ZXJpeAE8')];
+    test.base64('0123456789qwertyuiopasdfghjklzxcvbnmQWERTYUIOPLKJHGFDSAZXCVBNM+/'),
+    test.base64(''),
+    test.base64('QXN0ZXJpeA=='),
+    test.base64('QXN0ZXJpeAE='),
+    test.base64('QXN0ZXJpeAE8'),
+    test.base64(test.base64('QXN0ZXJpeAE8'))
+];
diff --git a/asterixdb/asterix-app/src/test/resources/runtimets/queries_sqlpp/constructor/boolean_01/boolean_01.3.query.sqlpp b/asterixdb/asterix-app/src/test/resources/runtimets/queries_sqlpp/constructor/boolean_01/boolean_01.3.query.sqlpp
index 0261222..e7eb630 100644
--- a/asterixdb/asterix-app/src/test/resources/runtimets/queries_sqlpp/constructor/boolean_01/boolean_01.3.query.sqlpp
+++ b/asterixdb/asterix-app/src/test/resources/runtimets/queries_sqlpp/constructor/boolean_01/boolean_01.3.query.sqlpp
@@ -19,5 +19,8 @@
 
 use test;
 
-
-{'boolean1':test.boolean('true'),'boolean2':test.boolean('false')};
+{
+    'boolean1':test.boolean('true'),
+    'boolean2':test.boolean('false'),
+    'boolean3':test.boolean(test.boolean('false'))
+};
diff --git a/asterixdb/asterix-app/src/test/resources/runtimets/queries_sqlpp/constructor/circle_01/circle_01.3.query.sqlpp b/asterixdb/asterix-app/src/test/resources/runtimets/queries_sqlpp/constructor/circle_01/circle_01.3.query.sqlpp
index 9125879..7178658 100644
--- a/asterixdb/asterix-app/src/test/resources/runtimets/queries_sqlpp/constructor/circle_01/circle_01.3.query.sqlpp
+++ b/asterixdb/asterix-app/src/test/resources/runtimets/queries_sqlpp/constructor/circle_01/circle_01.3.query.sqlpp
@@ -19,5 +19,8 @@
 
 use test;
 
-
-{'circle1':test.circle('10.1234,11.1e-1 +10.2E-2'),'circle2':test.circle('0.1234,-1.00e-10 +10.5E-2')};
+{
+    'circle1':test.circle('10.1234,11.1e-1 +10.2E-2'),
+    'circle2':test.circle('0.1234,-1.00e-10 +10.5E-2'),
+    'circle3':test.circle(test.circle('0.1234,-1.00e-10 +10.5E-2'))
+};
diff --git a/asterixdb/asterix-app/src/test/resources/runtimets/queries_sqlpp/constructor/date_01/date_01.3.query.sqlpp b/asterixdb/asterix-app/src/test/resources/runtimets/queries_sqlpp/constructor/date_01/date_01.3.query.sqlpp
index 7b5394a..8292dbd 100644
--- a/asterixdb/asterix-app/src/test/resources/runtimets/queries_sqlpp/constructor/date_01/date_01.3.query.sqlpp
+++ b/asterixdb/asterix-app/src/test/resources/runtimets/queries_sqlpp/constructor/date_01/date_01.3.query.sqlpp
@@ -19,5 +19,16 @@
 
 use test;
 
-
-{'date1':test.date('2010-10-30'),'date2':test.date('1987-11-19'),'date3':test.date('-1987-11-19'),'date4':test.date('0001-12-27'),'date5':test.date('-1951-12-27'),'date6':test.date('-2043-11-19'),'date7':test.date('-19280329'),'date8':test.date('19280329'),'date9':test.date('19000228'),'date10':test.date('20000229')};
+{
+    'date1':test.date('2010-10-30'),
+    'date2':test.date('1987-11-19'),
+    'date3':test.date('-1987-11-19'),
+    'date4':test.date('0001-12-27'),
+    'date5':test.date('-1951-12-27'),
+    'date6':test.date('-2043-11-19'),
+    'date7':test.date('-19280329'),
+    'date8':test.date('19280329'),
+    'date9':test.date('19000228'),
+    'date10':test.date('20000229'),
+    'date11':test.date(test.date('20000229'))
+};
diff --git a/asterixdb/asterix-app/src/test/resources/runtimets/queries_sqlpp/constructor/datetime_01/datetime_01.3.query.sqlpp b/asterixdb/asterix-app/src/test/resources/runtimets/queries_sqlpp/constructor/datetime_01/datetime_01.3.query.sqlpp
index 07ed68a..7f91427 100644
--- a/asterixdb/asterix-app/src/test/resources/runtimets/queries_sqlpp/constructor/datetime_01/datetime_01.3.query.sqlpp
+++ b/asterixdb/asterix-app/src/test/resources/runtimets/queries_sqlpp/constructor/datetime_01/datetime_01.3.query.sqlpp
@@ -19,5 +19,20 @@
 
 use test;
 
-
-{'datetime1':test.datetime('2010-10-30T10:50:56.999+05:45'),'datetime2':test.datetime('2010-10-30T10:30:56.250-10:00'),'datetime3':test.datetime('1987-11-19T09:20:00.200Z'),'datetime4':test.datetime('1987-11-19T10:50:56Z'),'datetime5':test.datetime('-1987-11-19T10:50:56.099-05:30'),'datetime6':test.datetime('-0001-11-19T10:50:56.719Z'),'datetime7':test.datetime('1951-12-27T12:20:15Z'),'datetime8':test.datetime('2043-11-19T10:50:56.719Z'),'datetime9':test.datetime('-19280329T174937374-0630'),'datetime10':test.datetime('-19280329T174937374+0630'),'datetime11':test.datetime('-19280329T174937374'),'datetime12':test.datetime('-19280329T174937374+0630'),'datetime13':test.datetime('-19280329T17493737+0630'),'datetime14':test.datetime('-19280301T05493737+0630')};
+{
+    'datetime1':test.datetime('2010-10-30T10:50:56.999+05:45'),
+    'datetime2':test.datetime('2010-10-30T10:30:56.250-10:00'),
+    'datetime3':test.datetime('1987-11-19T09:20:00.200Z'),
+    'datetime4':test.datetime('1987-11-19T10:50:56Z'),
+    'datetime5':test.datetime('-1987-11-19T10:50:56.099-05:30'),
+    'datetime6':test.datetime('-0001-11-19T10:50:56.719Z'),
+    'datetime7':test.datetime('1951-12-27T12:20:15Z'),
+    'datetime8':test.datetime('2043-11-19T10:50:56.719Z'),
+    'datetime9':test.datetime('-19280329T174937374-0630'),
+    'datetime10':test.datetime('-19280329T174937374+0630'),
+    'datetime11':test.datetime('-19280329T174937374'),
+    'datetime12':test.datetime('-19280329T174937374+0630'),
+    'datetime13':test.datetime('-19280329T17493737+0630'),
+    'datetime14':test.datetime('-19280301T05493737+0630'),
+    'datetime15':test.datetime(test.datetime('-19280301T05493737+0630'))
+};
diff --git a/asterixdb/asterix-app/src/test/resources/runtimets/queries_sqlpp/constructor/double_01/double_01.3.query.sqlpp b/asterixdb/asterix-app/src/test/resources/runtimets/queries_sqlpp/constructor/double_01/double_01.3.query.sqlpp
index c320657..a6bdbc5 100644
--- a/asterixdb/asterix-app/src/test/resources/runtimets/queries_sqlpp/constructor/double_01/double_01.3.query.sqlpp
+++ b/asterixdb/asterix-app/src/test/resources/runtimets/queries_sqlpp/constructor/double_01/double_01.3.query.sqlpp
@@ -19,5 +19,12 @@
 
 use test;
 
-
-{'double1':test.double('NaN'),'double2':test.double('INF'),'double3':test.double('-INF'),'double4':test.double('-80.20d'),'double5':test.double('-20.56e-30'),'double6':test.double('-20.56e-300')};
+{
+    'double1':test.double('NaN'),
+    'double2':test.double('INF'),
+    'double3':test.double('-INF'),
+    'double4':test.double('-80.20d'),
+    'double5':test.double('-20.56e-30'),
+    'double6':test.double('-20.56e-300'),
+    'double7':test.double(test.double('-20.56e-300'))
+};
diff --git a/asterixdb/asterix-app/src/test/resources/runtimets/queries_sqlpp/constructor/duration_01/duration_01.3.query.sqlpp b/asterixdb/asterix-app/src/test/resources/runtimets/queries_sqlpp/constructor/duration_01/duration_01.3.query.sqlpp
index 178e7da..d0520df 100644
--- a/asterixdb/asterix-app/src/test/resources/runtimets/queries_sqlpp/constructor/duration_01/duration_01.3.query.sqlpp
+++ b/asterixdb/asterix-app/src/test/resources/runtimets/queries_sqlpp/constructor/duration_01/duration_01.3.query.sqlpp
@@ -24,5 +24,18 @@
 
 use test;
 
-
-{'duration1':test.duration('P30Y10M25DT13H12M50S'),'duration2':test.duration('P25DT13H12M50S'),'duration3':test.duration('PT13H12M50S'),'duration4':test.duration('P30YT12MS'),'duration5':test.duration('PT13H'),'duration6':test.duration('-P30Y10M25DT13H12M50S'),'duration7':test.duration('-P25DT13H12M50S'),'duration8':test.duration('-PT13H50S'),'duration9':test.duration('P120D'),'duration10':test.duration('-P28M'),'duration11':test.duration('PT29M90.937S'),'duration12':test.duration('P300Y15M60DT300H98M482.435S')};
+{
+    'duration1':test.duration('P30Y10M25DT13H12M50S'),
+    'duration2':test.duration('P25DT13H12M50S'),
+    'duration3':test.duration('PT13H12M50S'),
+    'duration4':test.duration('P30YT12MS'),
+    'duration5':test.duration('PT13H'),
+    'duration6':test.duration('-P30Y10M25DT13H12M50S'),
+    'duration7':test.duration('-P25DT13H12M50S'),
+    'duration8':test.duration('-PT13H50S'),
+    'duration9':test.duration('P120D'),
+    'duration10':test.duration('-P28M'),
+    'duration11':test.duration('PT29M90.937S'),
+    'duration12':test.duration('P300Y15M60DT300H98M482.435S'),
+    'duration13':test.duration(test.duration('P300Y15M60DT300H98M482.435S'))
+};
diff --git a/asterixdb/asterix-app/src/test/resources/runtimets/queries_sqlpp/constructor/duration_02/duration_02.3.query.sqlpp b/asterixdb/asterix-app/src/test/resources/runtimets/queries_sqlpp/constructor/duration_02/duration_02.3.query.sqlpp
index 5a42c34..e722070 100644
--- a/asterixdb/asterix-app/src/test/resources/runtimets/queries_sqlpp/constructor/duration_02/duration_02.3.query.sqlpp
+++ b/asterixdb/asterix-app/src/test/resources/runtimets/queries_sqlpp/constructor/duration_02/duration_02.3.query.sqlpp
@@ -25,5 +25,18 @@
 
 use test;
 
-
-{'duration1':test.`year_month_duration`('P30Y10M'),'duration2':test.`day_time_duration`('P25DT13H12M50S'),'duration3':test.`day_time_duration`('PT13H12M50S'),'duration4':test.`year_month_duration`('P30Y'),'duration5':test.`day_time_duration`('PT13H'),'duration6':test.`year_month_duration`('-P30Y10M'),'duration7':test.`day_time_duration`('-P25DT13H12M50S'),'duration8':test.`day_time_duration`('-PT13H50S'),'duration9':test.`day_time_duration`('P120D'),'duration10':test.`year_month_duration`('-P28M'),'duration11':test.`day_time_duration`('PT29M90.937S'),'duration12':test.`year_month_duration`('P300Y15M')};
+{
+    'duration1':test.`year_month_duration`('P30Y10M'),
+    'duration2':test.`day_time_duration`('P25DT13H12M50S'),
+    'duration3':test.`day_time_duration`('PT13H12M50S'),
+    'duration4':test.`year_month_duration`('P30Y'),
+    'duration5':test.`day_time_duration`('PT13H'),
+    'duration6':test.`year_month_duration`('-P30Y10M'),
+    'duration7':test.`day_time_duration`('-P25DT13H12M50S'),
+    'duration8':test.`day_time_duration`('-PT13H50S'),
+    'duration9':test.`day_time_duration`('P120D'),
+    'duration10':test.`year_month_duration`('-P28M'),
+    'duration11':test.`day_time_duration`('PT29M90.937S'),
+    'duration12':test.`year_month_duration`('P300Y15M'),
+    'duration13':test.`year_month_duration`(test.`year_month_duration`('P300Y15M'))
+};
diff --git a/asterixdb/asterix-app/src/test/resources/runtimets/queries_sqlpp/constructor/float_01/float_01.3.query.sqlpp b/asterixdb/asterix-app/src/test/resources/runtimets/queries_sqlpp/constructor/float_01/float_01.3.query.sqlpp
index 759e5b6..2186a4c 100644
--- a/asterixdb/asterix-app/src/test/resources/runtimets/queries_sqlpp/constructor/float_01/float_01.3.query.sqlpp
+++ b/asterixdb/asterix-app/src/test/resources/runtimets/queries_sqlpp/constructor/float_01/float_01.3.query.sqlpp
@@ -19,5 +19,11 @@
 
 use test;
 
-
-{'float1':test.float('NaN'),'float2':test.float('INF'),'float3':test.float('-INF'),'float4':test.float('-80.20'),'float5':test.float('-20.56e-30')};
+{
+    'float1':test.float('NaN'),
+    'float2':test.float('INF'),
+    'float3':test.float('-INF'),
+    'float4':test.float('-80.20'),
+    'float5':test.float('-20.56e-30'),
+    'float6':test.float(test.float('-20.56e-30'))
+};
diff --git a/asterixdb/asterix-app/src/test/resources/runtimets/queries_sqlpp/constructor/int_01/int_01.3.query.sqlpp b/asterixdb/asterix-app/src/test/resources/runtimets/queries_sqlpp/constructor/int_01/int_01.3.query.sqlpp
index 1d466f2..32d9c17 100644
--- a/asterixdb/asterix-app/src/test/resources/runtimets/queries_sqlpp/constructor/int_01/int_01.3.query.sqlpp
+++ b/asterixdb/asterix-app/src/test/resources/runtimets/queries_sqlpp/constructor/int_01/int_01.3.query.sqlpp
@@ -19,5 +19,21 @@
 
 use test;
 
+{
+    'int8':test.tinyint('+80i8'),
+    'int16':test.smallint('160'),
+    'int32':test.integer('+320i32'),
+    'int64':test.bigint('640'),
 
-{'int8':test.tinyint('+80i8'),'int16':test.smallint('160'),'int32':test.integer('+320i32'),'int64':test.bigint('640'),'int8_2':test.tinyint('-80'),'int16_2':test.smallint('-160i16'),'int32_2':test.integer('-320'),'int64_2':test.bigint('-640i64'),'int64_min':test.bigint('-9223372036854775808')};
+    'int8_2':test.tinyint('-80'),
+    'int16_2':test.smallint('-160i16'),
+    'int32_2':test.integer('-320'),
+    'int64_2':test.bigint('-640i64'),
+
+    'int64_min':test.bigint('-9223372036854775808'),
+
+    'int8_3':test.tinyint(test.tinyint('+80i8')),
+    'int16_3':test.smallint(test.smallint('160')),
+    'int32_3':test.integer(test.integer('+320i32')),
+    'int64_3':test.bigint(test.bigint('640'))
+};
diff --git a/asterixdb/asterix-app/src/test/resources/runtimets/queries_sqlpp/constructor/line_01/line_01.3.query.sqlpp b/asterixdb/asterix-app/src/test/resources/runtimets/queries_sqlpp/constructor/line_01/line_01.3.query.sqlpp
index 94f0c7d..e4d2236 100644
--- a/asterixdb/asterix-app/src/test/resources/runtimets/queries_sqlpp/constructor/line_01/line_01.3.query.sqlpp
+++ b/asterixdb/asterix-app/src/test/resources/runtimets/queries_sqlpp/constructor/line_01/line_01.3.query.sqlpp
@@ -19,5 +19,8 @@
 
 use test;
 
-
-{'line1':test.line('10.1234,11.1e-1 +10.2E-2,-11.22'),'line2':test.line('0.1234,-1.00e-10 +10.5E-2,-01.02')};
+{
+    'line1':test.line('10.1234,11.1e-1 +10.2E-2,-11.22'),
+    'line2':test.line('0.1234,-1.00e-10 +10.5E-2,-01.02'),
+    'line3':test.line(test.line('0.1234,-1.00e-10 +10.5E-2,-01.02'))
+};
diff --git a/asterixdb/asterix-app/src/test/resources/runtimets/queries_sqlpp/constructor/point_01/point_01.3.query.sqlpp b/asterixdb/asterix-app/src/test/resources/runtimets/queries_sqlpp/constructor/point_01/point_01.3.query.sqlpp
index 242d6c0..5f789ec 100644
--- a/asterixdb/asterix-app/src/test/resources/runtimets/queries_sqlpp/constructor/point_01/point_01.3.query.sqlpp
+++ b/asterixdb/asterix-app/src/test/resources/runtimets/queries_sqlpp/constructor/point_01/point_01.3.query.sqlpp
@@ -19,5 +19,11 @@
 
 use test;
 
-
-{'point1':test.point('80.10d, -10E5'),'point3d1':test.point3d('5e2, -10E+5, +10.5e-10d'),'point2':test.point('5.10E-10d, -10E5'),'point3d2':test.point3d('0.5e+2d, -10.0E+5d, +10.05e-10')};
+{
+    'point1':test.point('80.10d, -10E5'),
+    'point3d1':test.point3d('5e2, -10E+5, +10.5e-10d'),
+    'point2':test.point('5.10E-10d, -10E5'),
+    'point3d2':test.point3d('0.5e+2d, -10.0E+5d, +10.05e-10'),
+    'point3':test.point(test.point('5.10E-10d, -10E5')),
+    'point3d3':test.point3d(test.point3d('0.5e+2d, -10.0E+5d, +10.05e-10'))
+};
diff --git a/asterixdb/asterix-app/src/test/resources/runtimets/queries_sqlpp/constructor/polygon_01/polygon_01.3.query.sqlpp b/asterixdb/asterix-app/src/test/resources/runtimets/queries_sqlpp/constructor/polygon_01/polygon_01.3.query.sqlpp
index c87e983..a242991 100644
--- a/asterixdb/asterix-app/src/test/resources/runtimets/queries_sqlpp/constructor/polygon_01/polygon_01.3.query.sqlpp
+++ b/asterixdb/asterix-app/src/test/resources/runtimets/queries_sqlpp/constructor/polygon_01/polygon_01.3.query.sqlpp
@@ -19,5 +19,8 @@
 
 use test;
 
-
-{'polygon1':test.polygon('-1.2,+1.3e2 -2.14E+5,2.15 -3.5e+2,03.6 -4.6E-3,+4.81'),'polygon2':test.polygon('-1.0,+10.5e2 -02.15E+50,2.5 -1.0,+3.3e3 -2.50E+05,20.15 +3.5e+2,03.6 -4.60E-3,+4.75 -2,+1.0e2 -2.00E+5,20.10 30.5,03.25 -4.33E-3,+4.75')};
+{
+    'polygon1':test.polygon('-1.2,+1.3e2 -2.14E+5,2.15 -3.5e+2,03.6 -4.6E-3,+4.81'),
+    'polygon2':test.polygon('-1.0,+10.5e2 -02.15E+50,2.5 -1.0,+3.3e3 -2.50E+05,20.15 +3.5e+2,03.6 -4.60E-3,+4.75 -2,+1.0e2 -2.00E+5,20.10 30.5,03.25 -4.33E-3,+4.75'),
+    'polygon3':test.polygon(test.polygon('-1.2,+1.3e2 -2.14E+5,2.15 -3.5e+2,03.6 -4.6E-3,+4.81'))
+};
diff --git a/asterixdb/asterix-app/src/test/resources/runtimets/queries_sqlpp/constructor/rectangle_01/rectangle_01.3.query.sqlpp b/asterixdb/asterix-app/src/test/resources/runtimets/queries_sqlpp/constructor/rectangle_01/rectangle_01.3.query.sqlpp
index e27ce38..3f2324d 100644
--- a/asterixdb/asterix-app/src/test/resources/runtimets/queries_sqlpp/constructor/rectangle_01/rectangle_01.3.query.sqlpp
+++ b/asterixdb/asterix-app/src/test/resources/runtimets/queries_sqlpp/constructor/rectangle_01/rectangle_01.3.query.sqlpp
@@ -25,5 +25,8 @@
 
 use test;
 
-
-{'rectangle1':test.rectangle('5.1,11.8 87.6,15.6548'),'rectangle2':test.rectangle('0.1234,-1.00e-10 5.5487,0.48765')};
+{
+    'rectangle1':test.rectangle('5.1,11.8 87.6,15.6548'),
+    'rectangle2':test.rectangle('0.1234,-1.00e-10 5.5487,0.48765'),
+    'rectangle3':test.rectangle(test.rectangle('5.1,11.8 87.6,15.6548'))
+};
diff --git a/asterixdb/asterix-app/src/test/resources/runtimets/queries_sqlpp/constructor/string_01/string_01.3.query.sqlpp b/asterixdb/asterix-app/src/test/resources/runtimets/queries_sqlpp/constructor/string_01/string_01.3.query.sqlpp
index ef0ff22..81fbd1f 100644
--- a/asterixdb/asterix-app/src/test/resources/runtimets/queries_sqlpp/constructor/string_01/string_01.3.query.sqlpp
+++ b/asterixdb/asterix-app/src/test/resources/runtimets/queries_sqlpp/constructor/string_01/string_01.3.query.sqlpp
@@ -19,5 +19,13 @@
 
 use test;
 
-
-{'string1':test.string('true'),'string2':test.string('false"')};
+{
+    'string1':test.string('true'),
+    'string2':test.string('false"'),
+    'string3':test.string(test.int8('8')),
+    'string4':test.string(test.int16('16')),
+    'string5':test.string(test.int32('32')),
+    'string6':test.string(test.int64('64')),
+    'string7':test.string(test.float('1.25')),
+    'string8':test.string(test.double('2.5'))
+};
diff --git a/asterixdb/asterix-app/src/test/resources/runtimets/queries_sqlpp/constructor/time_01/time_01.3.query.sqlpp b/asterixdb/asterix-app/src/test/resources/runtimets/queries_sqlpp/constructor/time_01/time_01.3.query.sqlpp
index d807ee3..1395d7d 100644
--- a/asterixdb/asterix-app/src/test/resources/runtimets/queries_sqlpp/constructor/time_01/time_01.3.query.sqlpp
+++ b/asterixdb/asterix-app/src/test/resources/runtimets/queries_sqlpp/constructor/time_01/time_01.3.query.sqlpp
@@ -19,5 +19,17 @@
 
 use test;
 
-
-{'time1':test.time('10:50:56.200+05:00'),'time2':test.time('10:50:56.200-10:15'),'time3':test.time('10:50:56'),'time4':test.time('10:50:56.200Z'),'time5':test.time('23:59:59.999-13:30'),'time6':test.time('00:00:00.000+14:45'),'time7':test.time('12:59:00.019-01:00'),'time8':test.time('12:59:00.01-01:00'),'time9':test.time('12:59:00.019-01:00'),'time10':test.time('12590001-0100'),'time11':test.time('125900019+0100')};
+{
+    'time1':test.time('10:50:56.200+05:00'),
+    'time2':test.time('10:50:56.200-10:15'),
+    'time3':test.time('10:50:56'),
+    'time4':test.time('10:50:56.200Z'),
+    'time5':test.time('23:59:59.999-13:30'),
+    'time6':test.time('00:00:00.000+14:45'),
+    'time7':test.time('12:59:00.019-01:00'),
+    'time8':test.time('12:59:00.01-01:00'),
+    'time9':test.time('12:59:00.019-01:00'),
+    'time10':test.time('12590001-0100'),
+    'time11':test.time('125900019+0100'),
+    'time12':test.time(test.time('125900019+0100'))
+};
diff --git a/asterixdb/asterix-app/src/test/resources/runtimets/queries_sqlpp/constructor/uuid_01/uuid_01.3.query.sqlpp b/asterixdb/asterix-app/src/test/resources/runtimets/queries_sqlpp/constructor/uuid_01/uuid_01.3.query.sqlpp
index b58cdb3..53d24c5 100644
--- a/asterixdb/asterix-app/src/test/resources/runtimets/queries_sqlpp/constructor/uuid_01/uuid_01.3.query.sqlpp
+++ b/asterixdb/asterix-app/src/test/resources/runtimets/queries_sqlpp/constructor/uuid_01/uuid_01.3.query.sqlpp
@@ -19,5 +19,8 @@
 
 use test;
 
-
-{'uuid1':test.uuid('02a199ca-bf58-412e-bd9f-60a0c975a8ac'),'uuid2':test.uuid('8cea25ab-55f8-467e-929d-94888f754832')};
+{
+    'uuid1':test.uuid('02a199ca-bf58-412e-bd9f-60a0c975a8ac'),
+    'uuid2':test.uuid('8cea25ab-55f8-467e-929d-94888f754832'),
+    'uuid3':test.uuid(test.uuid('8cea25ab-55f8-467e-929d-94888f754832'))
+};
diff --git a/asterixdb/asterix-app/src/test/resources/runtimets/results/constructor/binary_01/binary_01.1.adm b/asterixdb/asterix-app/src/test/resources/runtimets/results/constructor/binary_01/binary_01.1.adm
index c5c98c5..7e08562 100644
--- a/asterixdb/asterix-app/src/test/resources/runtimets/results/constructor/binary_01/binary_01.1.adm
+++ b/asterixdb/asterix-app/src/test/resources/runtimets/results/constructor/binary_01/binary_01.1.adm
@@ -1 +1 @@
-[ hex("ABCDEF0123456789"), hex("ABCDEF0123456789"), hex("0A0B0C0D0E0F"), hex("01020304050607080900"), hex(""), hex("D35DB7E39EBBF3DAB07ABB72BA2A296AC75F8218E4973C5CBDB9E64161114D850838F2CA2471850D20195C254134CFBF"), hex(""), hex("41737465726978"), hex("4173746572697801"), hex("41737465726978013C") ]
+[ hex("ABCDEF0123456789"), hex("ABCDEF0123456789"), hex("0A0B0C0D0E0F"), hex("01020304050607080900"), hex(""), hex("ABCDEF0123456789"), hex("D35DB7E39EBBF3DAB07ABB72BA2A296AC75F8218E4973C5CBDB9E64161114D850838F2CA2471850D20195C254134CFBF"), hex(""), hex("41737465726978"), hex("4173746572697801"), hex("41737465726978013C"), hex("41737465726978013C") ]
diff --git a/asterixdb/asterix-app/src/test/resources/runtimets/results/constructor/boolean_01/boolean_01.1.adm b/asterixdb/asterix-app/src/test/resources/runtimets/results/constructor/boolean_01/boolean_01.1.adm
index f49e449..fd25362 100644
--- a/asterixdb/asterix-app/src/test/resources/runtimets/results/constructor/boolean_01/boolean_01.1.adm
+++ b/asterixdb/asterix-app/src/test/resources/runtimets/results/constructor/boolean_01/boolean_01.1.adm
@@ -1 +1 @@
-{ "boolean1": true, "boolean2": false }
+{ "boolean1": true, "boolean2": false, "boolean3": false }
diff --git a/asterixdb/asterix-app/src/test/resources/runtimets/results/constructor/circle_01/circle_01.1.adm b/asterixdb/asterix-app/src/test/resources/runtimets/results/constructor/circle_01/circle_01.1.adm
index fd0d0f9..e81acd5 100644
--- a/asterixdb/asterix-app/src/test/resources/runtimets/results/constructor/circle_01/circle_01.1.adm
+++ b/asterixdb/asterix-app/src/test/resources/runtimets/results/constructor/circle_01/circle_01.1.adm
@@ -1 +1 @@
-{ "circle1": circle("10.1234,1.11 0.102"), "circle2": circle("0.1234,-1.0E-10 0.105") }
+{ "circle1": circle("10.1234,1.11 0.102"), "circle2": circle("0.1234,-1.0E-10 0.105"), "circle3": circle("0.1234,-1.0E-10 0.105") }
diff --git a/asterixdb/asterix-app/src/test/resources/runtimets/results/constructor/date_01/date_01.1.adm b/asterixdb/asterix-app/src/test/resources/runtimets/results/constructor/date_01/date_01.1.adm
index caa0dbc..527fc91 100644
--- a/asterixdb/asterix-app/src/test/resources/runtimets/results/constructor/date_01/date_01.1.adm
+++ b/asterixdb/asterix-app/src/test/resources/runtimets/results/constructor/date_01/date_01.1.adm
@@ -1 +1 @@
-{ "date1": date("2010-10-30"), "date2": date("1987-11-19"), "date3": date("-1987-11-19"), "date4": date("0001-12-27"), "date5": date("-1951-12-27"), "date6": date("-2043-11-19"), "date7": date("-1928-03-29"), "date8": date("1928-03-29"), "date9": date("1900-02-28"), "date10": date("2000-02-29") }
+{ "date1": date("2010-10-30"), "date2": date("1987-11-19"), "date3": date("-1987-11-19"), "date4": date("0001-12-27"), "date5": date("-1951-12-27"), "date6": date("-2043-11-19"), "date7": date("-1928-03-29"), "date8": date("1928-03-29"), "date9": date("1900-02-28"), "date10": date("2000-02-29"), "date11": date("2000-02-29") }
diff --git a/asterixdb/asterix-app/src/test/resources/runtimets/results/constructor/datetime_01/datetime_01.1.adm b/asterixdb/asterix-app/src/test/resources/runtimets/results/constructor/datetime_01/datetime_01.1.adm
index 54e76c4..ad50e30 100644
--- a/asterixdb/asterix-app/src/test/resources/runtimets/results/constructor/datetime_01/datetime_01.1.adm
+++ b/asterixdb/asterix-app/src/test/resources/runtimets/results/constructor/datetime_01/datetime_01.1.adm
@@ -1 +1 @@
-{ "datetime1": datetime("2010-10-30T05:05:56.999Z"), "datetime2": datetime("2010-10-30T20:30:56.250Z"), "datetime3": datetime("1987-11-19T09:20:00.200Z"), "datetime4": datetime("1987-11-19T10:50:56.000Z"), "datetime5": datetime("-1987-11-19T16:20:56.099Z"), "datetime6": datetime("-0001-11-19T10:50:56.719Z"), "datetime7": datetime("1951-12-27T12:20:15.000Z"), "datetime8": datetime("2043-11-19T10:50:56.719Z"), "datetime9": datetime("-1928-03-30T00:19:37.374Z"), "datetime10": datetime("-1928-03-29T11:19:37.374Z"), "datetime11": datetime("-1928-03-29T17:49:37.374Z"), "datetime12": datetime("-1928-03-29T11:19:37.374Z"), "datetime13": datetime("-1928-03-29T11:19:37.370Z"), "datetime14": datetime("-1928-02-29T23:19:37.370Z") }
+{ "datetime1": datetime("2010-10-30T05:05:56.999Z"), "datetime2": datetime("2010-10-30T20:30:56.250Z"), "datetime3": datetime("1987-11-19T09:20:00.200Z"), "datetime4": datetime("1987-11-19T10:50:56.000Z"), "datetime5": datetime("-1987-11-19T16:20:56.099Z"), "datetime6": datetime("-0001-11-19T10:50:56.719Z"), "datetime7": datetime("1951-12-27T12:20:15.000Z"), "datetime8": datetime("2043-11-19T10:50:56.719Z"), "datetime9": datetime("-1928-03-30T00:19:37.374Z"), "datetime10": datetime("-1928-03-29T11:19:37.374Z"), "datetime11": datetime("-1928-03-29T17:49:37.374Z"), "datetime12": datetime("-1928-03-29T11:19:37.374Z"), "datetime13": datetime("-1928-03-29T11:19:37.370Z"), "datetime14": datetime("-1928-02-29T23:19:37.370Z"), "datetime15": datetime("-1928-02-29T23:19:37.370Z") }
diff --git a/asterixdb/asterix-app/src/test/resources/runtimets/results/constructor/double_01/double_01.1.adm b/asterixdb/asterix-app/src/test/resources/runtimets/results/constructor/double_01/double_01.1.adm
index 0e90fe0..ae7413d 100644
--- a/asterixdb/asterix-app/src/test/resources/runtimets/results/constructor/double_01/double_01.1.adm
+++ b/asterixdb/asterix-app/src/test/resources/runtimets/results/constructor/double_01/double_01.1.adm
@@ -1 +1 @@
-{ "double1": NaN, "double2": Infinity, "double3": -Infinity, "double4": -80.2, "double5": -2.056E-29, "double6": -2.056E-299 }
+{ "double1": NaN, "double2": Infinity, "double3": -Infinity, "double4": -80.2, "double5": -2.056E-29, "double6": -2.056E-299, "double7": -2.056E-299 }
diff --git a/asterixdb/asterix-app/src/test/resources/runtimets/results/constructor/duration_01/duration_01.1.adm b/asterixdb/asterix-app/src/test/resources/runtimets/results/constructor/duration_01/duration_01.1.adm
index 3a9cbb7..bba1507 100644
--- a/asterixdb/asterix-app/src/test/resources/runtimets/results/constructor/duration_01/duration_01.1.adm
+++ b/asterixdb/asterix-app/src/test/resources/runtimets/results/constructor/duration_01/duration_01.1.adm
@@ -1 +1 @@
-{ "duration1": duration("P30Y10M25DT13H12M50S"), "duration2": duration("P25DT13H12M50S"), "duration3": duration("PT13H12M50S"), "duration4": duration("P30YT12M"), "duration5": duration("PT13H"), "duration6": duration("-P30Y10M25DT13H12M50S"), "duration7": duration("-P25DT13H12M50S"), "duration8": duration("-PT13H50S"), "duration9": duration("P120D"), "duration10": duration("-P2Y4M"), "duration11": duration("PT30M30.937S"), "duration12": duration("P301Y3M72DT13H46M2.435S") }
+{ "duration1": duration("P30Y10M25DT13H12M50S"), "duration2": duration("P25DT13H12M50S"), "duration3": duration("PT13H12M50S"), "duration4": duration("P30YT12M"), "duration5": duration("PT13H"), "duration6": duration("-P30Y10M25DT13H12M50S"), "duration7": duration("-P25DT13H12M50S"), "duration8": duration("-PT13H50S"), "duration9": duration("P120D"), "duration10": duration("-P2Y4M"), "duration11": duration("PT30M30.937S"), "duration12": duration("P301Y3M72DT13H46M2.435S"), "duration13": duration("P301Y3M72DT13H46M2.435S") }
diff --git a/asterixdb/asterix-app/src/test/resources/runtimets/results/constructor/duration_02/duration_02.1.adm b/asterixdb/asterix-app/src/test/resources/runtimets/results/constructor/duration_02/duration_02.1.adm
index dc54207..f9e89d9 100644
--- a/asterixdb/asterix-app/src/test/resources/runtimets/results/constructor/duration_02/duration_02.1.adm
+++ b/asterixdb/asterix-app/src/test/resources/runtimets/results/constructor/duration_02/duration_02.1.adm
@@ -1 +1 @@
-{ "duration1": year-month-duration("P30Y10M"), "duration2": day-time-duration("P25DT13H12M50S"), "duration3": day-time-duration("PT13H12M50S"), "duration4": year-month-duration("P30Y"), "duration5": day-time-duration("PT13H"), "duration6": year-month-duration("-P30Y10M"), "duration7": day-time-duration("-P25DT13H12M50S"), "duration8": day-time-duration("-PT13H50S"), "duration9": day-time-duration("P120D"), "duration10": year-month-duration("-P2Y4M"), "duration11": day-time-duration("PT30M30.937S"), "duration12": year-month-duration("P301Y3M") }
+{ "duration1": year-month-duration("P30Y10M"), "duration2": day-time-duration("P25DT13H12M50S"), "duration3": day-time-duration("PT13H12M50S"), "duration4": year-month-duration("P30Y"), "duration5": day-time-duration("PT13H"), "duration6": year-month-duration("-P30Y10M"), "duration7": day-time-duration("-P25DT13H12M50S"), "duration8": day-time-duration("-PT13H50S"), "duration9": day-time-duration("P120D"), "duration10": year-month-duration("-P2Y4M"), "duration11": day-time-duration("PT30M30.937S"), "duration12": year-month-duration("P301Y3M"), "duration13": year-month-duration("P301Y3M") }
diff --git a/asterixdb/asterix-app/src/test/resources/runtimets/results/constructor/float_01/float_01.1.adm b/asterixdb/asterix-app/src/test/resources/runtimets/results/constructor/float_01/float_01.1.adm
index 9dfb94a..9acd764 100644
--- a/asterixdb/asterix-app/src/test/resources/runtimets/results/constructor/float_01/float_01.1.adm
+++ b/asterixdb/asterix-app/src/test/resources/runtimets/results/constructor/float_01/float_01.1.adm
@@ -1 +1 @@
-{ "float1": NaN, "float2": Infinity, "float3": -Infinity, "float4": -80.2, "float5": -2.056E-29 }
+{ "float1": NaN, "float2": Infinity, "float3": -Infinity, "float4": -80.2, "float5": -2.056E-29, "float6": -2.056E-29 }
diff --git a/asterixdb/asterix-app/src/test/resources/runtimets/results/constructor/int_01/int_01.1.adm b/asterixdb/asterix-app/src/test/resources/runtimets/results/constructor/int_01/int_01.1.adm
index 18b9dd5..7945209 100644
--- a/asterixdb/asterix-app/src/test/resources/runtimets/results/constructor/int_01/int_01.1.adm
+++ b/asterixdb/asterix-app/src/test/resources/runtimets/results/constructor/int_01/int_01.1.adm
@@ -1 +1 @@
-{ "int8": 80, "int16": 160, "int32": 320, "int64": 640, "int8_2": -80, "int16_2": -160, "int32_2": -320, "int64_2": -640, "int64_min": -9223372036854775808 }
+{ "int8": 80, "int16": 160, "int32": 320, "int64": 640, "int8_2": -80, "int16_2": -160, "int32_2": -320, "int64_2": -640, "int64_min": -9223372036854775808, "int8_3": 80, "int16_3": 160, "int32_3": 320, "int64_3": 640 }
diff --git a/asterixdb/asterix-app/src/test/resources/runtimets/results/constructor/line_01/line_01.1.adm b/asterixdb/asterix-app/src/test/resources/runtimets/results/constructor/line_01/line_01.1.adm
index 1335cac..ac3ccc9 100644
--- a/asterixdb/asterix-app/src/test/resources/runtimets/results/constructor/line_01/line_01.1.adm
+++ b/asterixdb/asterix-app/src/test/resources/runtimets/results/constructor/line_01/line_01.1.adm
@@ -1 +1 @@
-{ "line1": line("10.1234,1.11 0.102,-11.22"), "line2": line("0.1234,-1.0E-10 0.105,-1.02") }
+{ "line1": line("10.1234,1.11 0.102,-11.22"), "line2": line("0.1234,-1.0E-10 0.105,-1.02"), "line3": line("0.1234,-1.0E-10 0.105,-1.02") }
diff --git a/asterixdb/asterix-app/src/test/resources/runtimets/results/constructor/point_01/point_01.1.adm b/asterixdb/asterix-app/src/test/resources/runtimets/results/constructor/point_01/point_01.1.adm
index 3fedd4b..f2c4053 100644
--- a/asterixdb/asterix-app/src/test/resources/runtimets/results/constructor/point_01/point_01.1.adm
+++ b/asterixdb/asterix-app/src/test/resources/runtimets/results/constructor/point_01/point_01.1.adm
@@ -1 +1 @@
-{ "point1": point("80.1,-1000000.0"), "point3d1": point3d("500.0,-1000000.0,1.05E-9"), "point2": point("5.1E-10,-1000000.0"), "point3d2": point3d("50.0,-1000000.0,1.005E-9") }
+{ "point1": point("80.1,-1000000.0"), "point3d1": point3d("500.0,-1000000.0,1.05E-9"), "point2": point("5.1E-10,-1000000.0"), "point3d2": point3d("50.0,-1000000.0,1.005E-9"), "point3": point("5.1E-10,-1000000.0"), "point3d3": point3d("50.0,-1000000.0,1.005E-9") }
diff --git a/asterixdb/asterix-app/src/test/resources/runtimets/results/constructor/polygon_01/polygon_01.1.adm b/asterixdb/asterix-app/src/test/resources/runtimets/results/constructor/polygon_01/polygon_01.1.adm
index c992f78..6b79dbe 100644
--- a/asterixdb/asterix-app/src/test/resources/runtimets/results/constructor/polygon_01/polygon_01.1.adm
+++ b/asterixdb/asterix-app/src/test/resources/runtimets/results/constructor/polygon_01/polygon_01.1.adm
@@ -1 +1 @@
-{ "polygon1": polygon("-1.2,130.0 -214000.0,2.15 -350.0,3.6 -0.0046,4.81"), "polygon2": polygon("-1.0,1050.0 -2.15E50,2.5 -1.0,3300.0 -250000.0,20.15 350.0,3.6 -0.0046,4.75 -2.0,100.0 -200000.0,20.1 30.5,3.25 -0.00433,4.75") }
+{ "polygon1": polygon("-1.2,130.0 -214000.0,2.15 -350.0,3.6 -0.0046,4.81"), "polygon2": polygon("-1.0,1050.0 -2.15E50,2.5 -1.0,3300.0 -250000.0,20.15 350.0,3.6 -0.0046,4.75 -2.0,100.0 -200000.0,20.1 30.5,3.25 -0.00433,4.75"), "polygon3": polygon("-1.2,130.0 -214000.0,2.15 -350.0,3.6 -0.0046,4.81") }
diff --git a/asterixdb/asterix-app/src/test/resources/runtimets/results/constructor/rectangle_01/rectangle_01.1.adm b/asterixdb/asterix-app/src/test/resources/runtimets/results/constructor/rectangle_01/rectangle_01.1.adm
index 32f14b3..eb693ae 100644
--- a/asterixdb/asterix-app/src/test/resources/runtimets/results/constructor/rectangle_01/rectangle_01.1.adm
+++ b/asterixdb/asterix-app/src/test/resources/runtimets/results/constructor/rectangle_01/rectangle_01.1.adm
@@ -1 +1 @@
-{ "rectangle1": rectangle("5.1,11.8 87.6,15.6548"), "rectangle2": rectangle("0.1234,-1.0E-10 5.5487,0.48765") }
+{ "rectangle1": rectangle("5.1,11.8 87.6,15.6548"), "rectangle2": rectangle("0.1234,-1.0E-10 5.5487,0.48765"), "rectangle3": rectangle("5.1,11.8 87.6,15.6548") }
diff --git a/asterixdb/asterix-app/src/test/resources/runtimets/results/constructor/string_01/string_01.1.adm b/asterixdb/asterix-app/src/test/resources/runtimets/results/constructor/string_01/string_01.1.adm
index 13fadd0..068d061 100644
--- a/asterixdb/asterix-app/src/test/resources/runtimets/results/constructor/string_01/string_01.1.adm
+++ b/asterixdb/asterix-app/src/test/resources/runtimets/results/constructor/string_01/string_01.1.adm
@@ -1 +1 @@
-{ "string1": "true", "string2": "false\"" }
+{ "string1": "true", "string2": "false\"", "string3": "8", "string4": "16", "string5": "32", "string6": "64", "string7": "1.25", "string8": "2.5" }
diff --git a/asterixdb/asterix-app/src/test/resources/runtimets/results/constructor/time_01/time_01.1.adm b/asterixdb/asterix-app/src/test/resources/runtimets/results/constructor/time_01/time_01.1.adm
index 34a119f..ade4e3b 100644
--- a/asterixdb/asterix-app/src/test/resources/runtimets/results/constructor/time_01/time_01.1.adm
+++ b/asterixdb/asterix-app/src/test/resources/runtimets/results/constructor/time_01/time_01.1.adm
@@ -1 +1 @@
-{ "time1": time("05:50:56.200Z"), "time2": time("21:05:56.200Z"), "time3": time("10:50:56.000Z"), "time4": time("10:50:56.200Z"), "time5": time("13:29:59.999Z"), "time6": time("09:15:00.000Z"), "time7": time("13:59:00.019Z"), "time8": time("13:59:00.010Z"), "time9": time("13:59:00.019Z"), "time10": time("13:59:00.010Z"), "time11": time("11:59:00.019Z") }
+{ "time1": time("05:50:56.200Z"), "time2": time("21:05:56.200Z"), "time3": time("10:50:56.000Z"), "time4": time("10:50:56.200Z"), "time5": time("13:29:59.999Z"), "time6": time("09:15:00.000Z"), "time7": time("13:59:00.019Z"), "time8": time("13:59:00.010Z"), "time9": time("13:59:00.019Z"), "time10": time("13:59:00.010Z"), "time11": time("11:59:00.019Z"), "time12": time("11:59:00.019Z") }
diff --git a/asterixdb/asterix-app/src/test/resources/runtimets/results/constructor/uuid_01/uuid_01.1.adm b/asterixdb/asterix-app/src/test/resources/runtimets/results/constructor/uuid_01/uuid_01.1.adm
index 12b14d0..f7437ec 100644
--- a/asterixdb/asterix-app/src/test/resources/runtimets/results/constructor/uuid_01/uuid_01.1.adm
+++ b/asterixdb/asterix-app/src/test/resources/runtimets/results/constructor/uuid_01/uuid_01.1.adm
@@ -1 +1 @@
-{ "uuid1": uuid("02a199ca-bf58-412e-bd9f-60a0c975a8ac"), "uuid2": uuid("8cea25ab-55f8-467e-929d-94888f754832") }
+{ "uuid1": uuid("02a199ca-bf58-412e-bd9f-60a0c975a8ac"), "uuid2": uuid("8cea25ab-55f8-467e-929d-94888f754832"), "uuid3": uuid("8cea25ab-55f8-467e-929d-94888f754832") }
diff --git a/asterixdb/asterix-app/src/test/resources/runtimets/results_parser_sqlpp/constructor/binary_01/binary_01.3.ast b/asterixdb/asterix-app/src/test/resources/runtimets/results_parser_sqlpp/constructor/binary_01/binary_01.3.ast
index 45f8b2c..f099319 100644
--- a/asterixdb/asterix-app/src/test/resources/runtimets/results_parser_sqlpp/constructor/binary_01/binary_01.3.ast
+++ b/asterixdb/asterix-app/src/test/resources/runtimets/results_parser_sqlpp/constructor/binary_01/binary_01.3.ast
@@ -16,6 +16,11 @@
   FunctionCall test.hex@1[
     LiteralExpr [STRING] []
   ]
+  FunctionCall test.hex@1[
+    FunctionCall test.hex@1[
+      LiteralExpr [STRING] [ABCDEF0123456789]
+    ]
+  ]
   FunctionCall test.base64@1[
     LiteralExpr [STRING] [0123456789qwertyuiopasdfghjklzxcvbnmQWERTYUIOPLKJHGFDSAZXCVBNM+/]
   ]
@@ -31,4 +36,9 @@
   FunctionCall test.base64@1[
     LiteralExpr [STRING] [QXN0ZXJpeAE8]
   ]
+  FunctionCall test.base64@1[
+    FunctionCall test.base64@1[
+      LiteralExpr [STRING] [QXN0ZXJpeAE8]
+    ]
+  ]
 ]
diff --git a/asterixdb/asterix-app/src/test/resources/runtimets/results_parser_sqlpp/constructor/boolean_01/boolean_01.3.ast b/asterixdb/asterix-app/src/test/resources/runtimets/results_parser_sqlpp/constructor/boolean_01/boolean_01.3.ast
index 300b114..f247b92 100644
--- a/asterixdb/asterix-app/src/test/resources/runtimets/results_parser_sqlpp/constructor/boolean_01/boolean_01.3.ast
+++ b/asterixdb/asterix-app/src/test/resources/runtimets/results_parser_sqlpp/constructor/boolean_01/boolean_01.3.ast
@@ -15,4 +15,13 @@
       LiteralExpr [STRING] [false]
     ]
   )
+  (
+    LiteralExpr [STRING] [boolean3]
+    :
+    FunctionCall test.boolean@1[
+      FunctionCall test.boolean@1[
+        LiteralExpr [STRING] [false]
+      ]
+    ]
+  )
 ]
diff --git a/asterixdb/asterix-app/src/test/resources/runtimets/results_parser_sqlpp/constructor/circle_01/circle_01.3.ast b/asterixdb/asterix-app/src/test/resources/runtimets/results_parser_sqlpp/constructor/circle_01/circle_01.3.ast
index c4b1b6b..f8be79e 100644
--- a/asterixdb/asterix-app/src/test/resources/runtimets/results_parser_sqlpp/constructor/circle_01/circle_01.3.ast
+++ b/asterixdb/asterix-app/src/test/resources/runtimets/results_parser_sqlpp/constructor/circle_01/circle_01.3.ast
@@ -15,4 +15,13 @@
       LiteralExpr [STRING] [0.1234,-1.00e-10 +10.5E-2]
     ]
   )
+  (
+    LiteralExpr [STRING] [circle3]
+    :
+    FunctionCall test.circle@1[
+      FunctionCall test.circle@1[
+        LiteralExpr [STRING] [0.1234,-1.00e-10 +10.5E-2]
+      ]
+    ]
+  )
 ]
diff --git a/asterixdb/asterix-app/src/test/resources/runtimets/results_parser_sqlpp/constructor/date_01/date_01.3.ast b/asterixdb/asterix-app/src/test/resources/runtimets/results_parser_sqlpp/constructor/date_01/date_01.3.ast
index 94e80ef..b54c957 100644
--- a/asterixdb/asterix-app/src/test/resources/runtimets/results_parser_sqlpp/constructor/date_01/date_01.3.ast
+++ b/asterixdb/asterix-app/src/test/resources/runtimets/results_parser_sqlpp/constructor/date_01/date_01.3.ast
@@ -71,4 +71,13 @@
       LiteralExpr [STRING] [20000229]
     ]
   )
+  (
+    LiteralExpr [STRING] [date11]
+    :
+    FunctionCall test.date@1[
+      FunctionCall test.date@1[
+        LiteralExpr [STRING] [20000229]
+      ]
+    ]
+  )
 ]
diff --git a/asterixdb/asterix-app/src/test/resources/runtimets/results_parser_sqlpp/constructor/datetime_01/datetime_01.3.ast b/asterixdb/asterix-app/src/test/resources/runtimets/results_parser_sqlpp/constructor/datetime_01/datetime_01.3.ast
index db8570f..7b80fb1 100644
--- a/asterixdb/asterix-app/src/test/resources/runtimets/results_parser_sqlpp/constructor/datetime_01/datetime_01.3.ast
+++ b/asterixdb/asterix-app/src/test/resources/runtimets/results_parser_sqlpp/constructor/datetime_01/datetime_01.3.ast
@@ -99,4 +99,13 @@
       LiteralExpr [STRING] [-19280301T05493737+0630]
     ]
   )
+  (
+    LiteralExpr [STRING] [datetime15]
+    :
+    FunctionCall test.datetime@1[
+      FunctionCall test.datetime@1[
+        LiteralExpr [STRING] [-19280301T05493737+0630]
+      ]
+    ]
+  )
 ]
diff --git a/asterixdb/asterix-app/src/test/resources/runtimets/results_parser_sqlpp/constructor/double_01/double_01.3.ast b/asterixdb/asterix-app/src/test/resources/runtimets/results_parser_sqlpp/constructor/double_01/double_01.3.ast
index f361f74..903775c 100644
--- a/asterixdb/asterix-app/src/test/resources/runtimets/results_parser_sqlpp/constructor/double_01/double_01.3.ast
+++ b/asterixdb/asterix-app/src/test/resources/runtimets/results_parser_sqlpp/constructor/double_01/double_01.3.ast
@@ -43,4 +43,13 @@
       LiteralExpr [STRING] [-20.56e-300]
     ]
   )
+  (
+    LiteralExpr [STRING] [double7]
+    :
+    FunctionCall test.double@1[
+      FunctionCall test.double@1[
+        LiteralExpr [STRING] [-20.56e-300]
+      ]
+    ]
+  )
 ]
diff --git a/asterixdb/asterix-app/src/test/resources/runtimets/results_parser_sqlpp/constructor/duration_01/duration_01.3.ast b/asterixdb/asterix-app/src/test/resources/runtimets/results_parser_sqlpp/constructor/duration_01/duration_01.3.ast
index abb9671..566d8d2 100644
--- a/asterixdb/asterix-app/src/test/resources/runtimets/results_parser_sqlpp/constructor/duration_01/duration_01.3.ast
+++ b/asterixdb/asterix-app/src/test/resources/runtimets/results_parser_sqlpp/constructor/duration_01/duration_01.3.ast
@@ -85,4 +85,13 @@
       LiteralExpr [STRING] [P300Y15M60DT300H98M482.435S]
     ]
   )
+  (
+    LiteralExpr [STRING] [duration13]
+    :
+    FunctionCall test.duration@1[
+      FunctionCall test.duration@1[
+        LiteralExpr [STRING] [P300Y15M60DT300H98M482.435S]
+      ]
+    ]
+  )
 ]
diff --git a/asterixdb/asterix-app/src/test/resources/runtimets/results_parser_sqlpp/constructor/duration_02/duration_02.3.ast b/asterixdb/asterix-app/src/test/resources/runtimets/results_parser_sqlpp/constructor/duration_02/duration_02.3.ast
index d34f2a3..5ef3343 100644
--- a/asterixdb/asterix-app/src/test/resources/runtimets/results_parser_sqlpp/constructor/duration_02/duration_02.3.ast
+++ b/asterixdb/asterix-app/src/test/resources/runtimets/results_parser_sqlpp/constructor/duration_02/duration_02.3.ast
@@ -85,4 +85,13 @@
       LiteralExpr [STRING] [P300Y15M]
     ]
   )
+  (
+    LiteralExpr [STRING] [duration13]
+    :
+    FunctionCall test.year-month-duration@1[
+      FunctionCall test.year-month-duration@1[
+        LiteralExpr [STRING] [P300Y15M]
+      ]
+    ]
+  )
 ]
diff --git a/asterixdb/asterix-app/src/test/resources/runtimets/results_parser_sqlpp/constructor/float_01/float_01.3.ast b/asterixdb/asterix-app/src/test/resources/runtimets/results_parser_sqlpp/constructor/float_01/float_01.3.ast
index 58edf1e..caf9745 100644
--- a/asterixdb/asterix-app/src/test/resources/runtimets/results_parser_sqlpp/constructor/float_01/float_01.3.ast
+++ b/asterixdb/asterix-app/src/test/resources/runtimets/results_parser_sqlpp/constructor/float_01/float_01.3.ast
@@ -36,4 +36,13 @@
       LiteralExpr [STRING] [-20.56e-30]
     ]
   )
+  (
+    LiteralExpr [STRING] [float6]
+    :
+    FunctionCall test.float@1[
+      FunctionCall test.float@1[
+        LiteralExpr [STRING] [-20.56e-30]
+      ]
+    ]
+  )
 ]
diff --git a/asterixdb/asterix-app/src/test/resources/runtimets/results_parser_sqlpp/constructor/int_01/int_01.3.ast b/asterixdb/asterix-app/src/test/resources/runtimets/results_parser_sqlpp/constructor/int_01/int_01.3.ast
index 745fbbe..1ee39a1 100644
--- a/asterixdb/asterix-app/src/test/resources/runtimets/results_parser_sqlpp/constructor/int_01/int_01.3.ast
+++ b/asterixdb/asterix-app/src/test/resources/runtimets/results_parser_sqlpp/constructor/int_01/int_01.3.ast
@@ -64,4 +64,40 @@
       LiteralExpr [STRING] [-9223372036854775808]
     ]
   )
+  (
+    LiteralExpr [STRING] [int8_3]
+    :
+    FunctionCall test.int8@1[
+      FunctionCall test.int8@1[
+        LiteralExpr [STRING] [+80i8]
+      ]
+    ]
+  )
+  (
+    LiteralExpr [STRING] [int16_3]
+    :
+    FunctionCall test.int16@1[
+      FunctionCall test.int16@1[
+        LiteralExpr [STRING] [160]
+      ]
+    ]
+  )
+  (
+    LiteralExpr [STRING] [int32_3]
+    :
+    FunctionCall test.int32@1[
+      FunctionCall test.int32@1[
+        LiteralExpr [STRING] [+320i32]
+      ]
+    ]
+  )
+  (
+    LiteralExpr [STRING] [int64_3]
+    :
+    FunctionCall test.int64@1[
+      FunctionCall test.int64@1[
+        LiteralExpr [STRING] [640]
+      ]
+    ]
+  )
 ]
diff --git a/asterixdb/asterix-app/src/test/resources/runtimets/results_parser_sqlpp/constructor/line_01/line_01.3.ast b/asterixdb/asterix-app/src/test/resources/runtimets/results_parser_sqlpp/constructor/line_01/line_01.3.ast
index 99d0842..a9bcd9f 100644
--- a/asterixdb/asterix-app/src/test/resources/runtimets/results_parser_sqlpp/constructor/line_01/line_01.3.ast
+++ b/asterixdb/asterix-app/src/test/resources/runtimets/results_parser_sqlpp/constructor/line_01/line_01.3.ast
@@ -15,4 +15,13 @@
       LiteralExpr [STRING] [0.1234,-1.00e-10 +10.5E-2,-01.02]
     ]
   )
+  (
+    LiteralExpr [STRING] [line3]
+    :
+    FunctionCall test.line@1[
+      FunctionCall test.line@1[
+        LiteralExpr [STRING] [0.1234,-1.00e-10 +10.5E-2,-01.02]
+      ]
+    ]
+  )
 ]
diff --git a/asterixdb/asterix-app/src/test/resources/runtimets/results_parser_sqlpp/constructor/point_01/point_01.3.ast b/asterixdb/asterix-app/src/test/resources/runtimets/results_parser_sqlpp/constructor/point_01/point_01.3.ast
index f7c5de0..cf0faa2 100644
--- a/asterixdb/asterix-app/src/test/resources/runtimets/results_parser_sqlpp/constructor/point_01/point_01.3.ast
+++ b/asterixdb/asterix-app/src/test/resources/runtimets/results_parser_sqlpp/constructor/point_01/point_01.3.ast
@@ -29,4 +29,22 @@
       LiteralExpr [STRING] [0.5e+2d, -10.0E+5d, +10.05e-10]
     ]
   )
+  (
+    LiteralExpr [STRING] [point3]
+    :
+    FunctionCall test.point@1[
+      FunctionCall test.point@1[
+        LiteralExpr [STRING] [5.10E-10d, -10E5]
+      ]
+    ]
+  )
+  (
+    LiteralExpr [STRING] [point3d3]
+    :
+    FunctionCall test.point3d@1[
+      FunctionCall test.point3d@1[
+        LiteralExpr [STRING] [0.5e+2d, -10.0E+5d, +10.05e-10]
+      ]
+    ]
+  )
 ]
diff --git a/asterixdb/asterix-app/src/test/resources/runtimets/results_parser_sqlpp/constructor/polygon_01/polygon_01.3.ast b/asterixdb/asterix-app/src/test/resources/runtimets/results_parser_sqlpp/constructor/polygon_01/polygon_01.3.ast
index 86781d6..ece41d9 100644
--- a/asterixdb/asterix-app/src/test/resources/runtimets/results_parser_sqlpp/constructor/polygon_01/polygon_01.3.ast
+++ b/asterixdb/asterix-app/src/test/resources/runtimets/results_parser_sqlpp/constructor/polygon_01/polygon_01.3.ast
@@ -15,4 +15,13 @@
       LiteralExpr [STRING] [-1.0,+10.5e2 -02.15E+50,2.5 -1.0,+3.3e3 -2.50E+05,20.15 +3.5e+2,03.6 -4.60E-3,+4.75 -2,+1.0e2 -2.00E+5,20.10 30.5,03.25 -4.33E-3,+4.75]
     ]
   )
+  (
+    LiteralExpr [STRING] [polygon3]
+    :
+    FunctionCall test.polygon@1[
+      FunctionCall test.polygon@1[
+        LiteralExpr [STRING] [-1.2,+1.3e2 -2.14E+5,2.15 -3.5e+2,03.6 -4.6E-3,+4.81]
+      ]
+    ]
+  )
 ]
diff --git a/asterixdb/asterix-app/src/test/resources/runtimets/results_parser_sqlpp/constructor/rectangle_01/rectangle_01.3.ast b/asterixdb/asterix-app/src/test/resources/runtimets/results_parser_sqlpp/constructor/rectangle_01/rectangle_01.3.ast
index da4c509..9632ac0 100644
--- a/asterixdb/asterix-app/src/test/resources/runtimets/results_parser_sqlpp/constructor/rectangle_01/rectangle_01.3.ast
+++ b/asterixdb/asterix-app/src/test/resources/runtimets/results_parser_sqlpp/constructor/rectangle_01/rectangle_01.3.ast
@@ -15,4 +15,13 @@
       LiteralExpr [STRING] [0.1234,-1.00e-10 5.5487,0.48765]
     ]
   )
+  (
+    LiteralExpr [STRING] [rectangle3]
+    :
+    FunctionCall test.rectangle@1[
+      FunctionCall test.rectangle@1[
+        LiteralExpr [STRING] [5.1,11.8 87.6,15.6548]
+      ]
+    ]
+  )
 ]
diff --git a/asterixdb/asterix-app/src/test/resources/runtimets/results_parser_sqlpp/constructor/string_01/string_01.3.ast b/asterixdb/asterix-app/src/test/resources/runtimets/results_parser_sqlpp/constructor/string_01/string_01.3.ast
index 8b23981..5d4de90 100644
--- a/asterixdb/asterix-app/src/test/resources/runtimets/results_parser_sqlpp/constructor/string_01/string_01.3.ast
+++ b/asterixdb/asterix-app/src/test/resources/runtimets/results_parser_sqlpp/constructor/string_01/string_01.3.ast
@@ -15,4 +15,58 @@
       LiteralExpr [STRING] [false"]
     ]
   )
+  (
+    LiteralExpr [STRING] [string3]
+    :
+    FunctionCall test.string@1[
+      FunctionCall test.int8@1[
+        LiteralExpr [STRING] [8]
+      ]
+    ]
+  )
+  (
+    LiteralExpr [STRING] [string4]
+    :
+    FunctionCall test.string@1[
+      FunctionCall test.int16@1[
+        LiteralExpr [STRING] [16]
+      ]
+    ]
+  )
+  (
+    LiteralExpr [STRING] [string5]
+    :
+    FunctionCall test.string@1[
+      FunctionCall test.int32@1[
+        LiteralExpr [STRING] [32]
+      ]
+    ]
+  )
+  (
+    LiteralExpr [STRING] [string6]
+    :
+    FunctionCall test.string@1[
+      FunctionCall test.int64@1[
+        LiteralExpr [STRING] [64]
+      ]
+    ]
+  )
+  (
+    LiteralExpr [STRING] [string7]
+    :
+    FunctionCall test.string@1[
+      FunctionCall test.float@1[
+        LiteralExpr [STRING] [1.25]
+      ]
+    ]
+  )
+  (
+    LiteralExpr [STRING] [string8]
+    :
+    FunctionCall test.string@1[
+      FunctionCall test.double@1[
+        LiteralExpr [STRING] [2.5]
+      ]
+    ]
+  )
 ]
diff --git a/asterixdb/asterix-app/src/test/resources/runtimets/results_parser_sqlpp/constructor/time_01/time_01.3.ast b/asterixdb/asterix-app/src/test/resources/runtimets/results_parser_sqlpp/constructor/time_01/time_01.3.ast
index c9a018a..6be78b1 100644
--- a/asterixdb/asterix-app/src/test/resources/runtimets/results_parser_sqlpp/constructor/time_01/time_01.3.ast
+++ b/asterixdb/asterix-app/src/test/resources/runtimets/results_parser_sqlpp/constructor/time_01/time_01.3.ast
@@ -78,4 +78,13 @@
       LiteralExpr [STRING] [125900019+0100]
     ]
   )
+  (
+    LiteralExpr [STRING] [time12]
+    :
+    FunctionCall test.time@1[
+      FunctionCall test.time@1[
+        LiteralExpr [STRING] [125900019+0100]
+      ]
+    ]
+  )
 ]
diff --git a/asterixdb/asterix-app/src/test/resources/runtimets/results_parser_sqlpp/constructor/uuid_01/uuid_01.3.ast b/asterixdb/asterix-app/src/test/resources/runtimets/results_parser_sqlpp/constructor/uuid_01/uuid_01.3.ast
index e79a445..9b2f4e0 100644
--- a/asterixdb/asterix-app/src/test/resources/runtimets/results_parser_sqlpp/constructor/uuid_01/uuid_01.3.ast
+++ b/asterixdb/asterix-app/src/test/resources/runtimets/results_parser_sqlpp/constructor/uuid_01/uuid_01.3.ast
@@ -15,4 +15,13 @@
       LiteralExpr [STRING] [8cea25ab-55f8-467e-929d-94888f754832]
     ]
   )
+  (
+    LiteralExpr [STRING] [uuid3]
+    :
+    FunctionCall test.uuid@1[
+      FunctionCall test.uuid@1[
+        LiteralExpr [STRING] [8cea25ab-55f8-467e-929d-94888f754832]
+      ]
+    ]
+  )
 ]
diff --git a/asterixdb/asterix-om/src/main/java/org/apache/asterix/om/functions/BuiltinFunctions.java b/asterixdb/asterix-om/src/main/java/org/apache/asterix/om/functions/BuiltinFunctions.java
index f4fb36a..dbcef6c 100644
--- a/asterixdb/asterix-om/src/main/java/org/apache/asterix/om/functions/BuiltinFunctions.java
+++ b/asterixdb/asterix-om/src/main/java/org/apache/asterix/om/functions/BuiltinFunctions.java
@@ -42,7 +42,6 @@
 import org.apache.asterix.om.typecomputer.impl.AInt8TypeComputer;
 import org.apache.asterix.om.typecomputer.impl.AIntervalTypeComputer;
 import org.apache.asterix.om.typecomputer.impl.ALineTypeComputer;
-import org.apache.asterix.om.typecomputer.impl.AMissingTypeComputer;
 import org.apache.asterix.om.typecomputer.impl.APoint3DTypeComputer;
 import org.apache.asterix.om.typecomputer.impl.APointTypeComputer;
 import org.apache.asterix.om.typecomputer.impl.APolygonTypeComputer;
@@ -519,8 +518,6 @@
     // constructors:
     public static final FunctionIdentifier BOOLEAN_CONSTRUCTOR = new FunctionIdentifier(FunctionConstants.ASTERIX_NS,
             "boolean", 1);
-    public static final FunctionIdentifier NULL_CONSTRUCTOR = new FunctionIdentifier(FunctionConstants.ASTERIX_NS,
-            "null", 1);
     public static final FunctionIdentifier STRING_CONSTRUCTOR = new FunctionIdentifier(FunctionConstants.ASTERIX_NS,
             "string", 1);
     public static final FunctionIdentifier BINARY_HEX_CONSTRUCTOR = new FunctionIdentifier(FunctionConstants.ASTERIX_NS,
@@ -855,7 +852,7 @@
         // and then, Asterix builtin functions
         addPrivateFunction(CHECK_UNKNOWN, NotUnknownTypeComputer.INSTANCE, true);
         addPrivateFunction(ANY_COLLECTION_MEMBER, CollectionMemberResultType.INSTANCE, true);
-        addFunction(BOOLEAN_CONSTRUCTOR, StringBooleanTypeComputer.INSTANCE, true);
+        addFunction(BOOLEAN_CONSTRUCTOR, ABooleanTypeComputer.INSTANCE, true);
         addFunction(CARET, NumericAddSubMulDivTypeComputer.INSTANCE, true);
         addFunction(CIRCLE_CONSTRUCTOR, ACircleTypeComputer.INSTANCE, true);
         addPrivateFunction(CONCAT_NON_NULL, ConcatNonNullTypeComputer.INSTANCE, true);
@@ -906,7 +903,6 @@
         addPrivateFunction(LISTIFY, OrderedListConstructorTypeComputer.INSTANCE, true);
         addPrivateFunction(MAKE_FIELD_INDEX_HANDLE, null, true);
         addPrivateFunction(MAKE_FIELD_NAME_HANDLE, null, true);
-        addFunction(NULL_CONSTRUCTOR, AMissingTypeComputer.INSTANCE, true);
 
         addPrivateFunction(NUMERIC_UNARY_MINUS, UnaryMinusTypeComputer.INSTANCE, true);
         addPrivateFunction(NUMERIC_SUBTRACT, NumericAddSubMulDivTypeComputer.INSTANCE, true);
@@ -943,6 +939,7 @@
         addFunction(FIND_BINARY, AInt64TypeComputer.INSTANCE, true);
         addFunction(FIND_BINARY_FROM, AInt64TypeComputer.INSTANCE, true);
 
+        addFunction(STRING_CONSTRUCTOR, AStringTypeComputer.INSTANCE, true);
         addFunction(STRING_LIKE, BooleanFunctionTypeComputer.INSTANCE, true);
         addFunction(STRING_CONTAINS, ABooleanTypeComputer.INSTANCE, true);
         addFunction(STRING_TO_CODEPOINT, StringToInt64ListTypeComputer.INSTANCE, true);
@@ -1068,7 +1065,6 @@
         addFunction(GET_CIRCLE_RADIUS_ACCESSOR, ADoubleTypeComputer.INSTANCE, true);
         addFunction(GET_CIRCLE_CENTER_ACCESSOR, APointTypeComputer.INSTANCE, true);
         addFunction(GET_POINTS_LINE_RECTANGLE_POLYGON_ACCESSOR, OrderedListOfAPointTypeComputer.INSTANCE, true);
-        addFunction(STRING_CONSTRUCTOR, AStringTypeComputer.INSTANCE, true);
 
         // Binary functions
         addFunction(BINARY_HEX_CONSTRUCTOR, ABinaryTypeComputer.INSTANCE, true);
diff --git a/asterixdb/asterix-om/src/main/java/org/apache/asterix/om/typecomputer/impl/AMissingTypeComputer.java b/asterixdb/asterix-om/src/main/java/org/apache/asterix/om/typecomputer/impl/AMissingTypeComputer.java
deleted file mode 100644
index bf262c3..0000000
--- a/asterixdb/asterix-om/src/main/java/org/apache/asterix/om/typecomputer/impl/AMissingTypeComputer.java
+++ /dev/null
@@ -1,42 +0,0 @@
-/*
- * Licensed to the Apache Software Foundation (ASF) under one
- * or more contributor license agreements.  See the NOTICE file
- * distributed with this work for additional information
- * regarding copyright ownership.  The ASF licenses this file
- * to you under the Apache License, Version 2.0 (the
- * "License"); you may not use this file except in compliance
- * with the License.  You may obtain a copy of the License at
- *
- *   http://www.apache.org/licenses/LICENSE-2.0
- *
- * Unless required by applicable law or agreed to in writing,
- * software distributed under the License is distributed on an
- * "AS IS" BASIS, WITHOUT WARRANTIES OR CONDITIONS OF ANY
- * KIND, either express or implied.  See the License for the
- * specific language governing permissions and limitations
- * under the License.
- */
-package org.apache.asterix.om.typecomputer.impl;
-
-import org.apache.asterix.om.typecomputer.base.IResultTypeComputer;
-import org.apache.asterix.om.types.BuiltinType;
-import org.apache.asterix.om.types.IAType;
-import org.apache.hyracks.algebricks.common.exceptions.AlgebricksException;
-import org.apache.hyracks.algebricks.core.algebra.base.ILogicalExpression;
-import org.apache.hyracks.algebricks.core.algebra.expressions.IVariableTypeEnvironment;
-import org.apache.hyracks.algebricks.core.algebra.metadata.IMetadataProvider;
-
-public class AMissingTypeComputer implements IResultTypeComputer {
-
-    public static final AMissingTypeComputer INSTANCE = new AMissingTypeComputer();
-
-    private AMissingTypeComputer() {
-    }
-
-    @Override
-    public IAType computeType(ILogicalExpression expression, IVariableTypeEnvironment env,
-            IMetadataProvider<?, ?> metadataProvider) throws AlgebricksException {
-        return BuiltinType.AMISSING;
-    }
-
-}
diff --git a/asterixdb/asterix-om/src/main/java/org/apache/asterix/om/types/ATypeTag.java b/asterixdb/asterix-om/src/main/java/org/apache/asterix/om/types/ATypeTag.java
index 4e1f7f6..6889934 100644
--- a/asterixdb/asterix-om/src/main/java/org/apache/asterix/om/types/ATypeTag.java
+++ b/asterixdb/asterix-om/src/main/java/org/apache/asterix/om/types/ATypeTag.java
@@ -87,6 +87,7 @@
     public static final byte SERIALIZED_DURATION_TYPE_TAG = DURATION.serialize();
     public static final byte SERIALIZED_DAY_TIME_DURATION_TYPE_TAG = DAYTIMEDURATION.serialize();
     public static final byte SERIALIZED_POINT_TYPE_TAG = POINT.serialize();
+    public static final byte SERIALIZED_POINT3D_TYPE_TAG = POINT3D.serialize();
     public static final byte SERIALIZED_INTERVAL_TYPE_TAG = INTERVAL.serialize();
     public static final byte SERIALIZED_CIRCLE_TYPE_TAG = CIRCLE.serialize();
     public static final byte SERIALIZED_YEAR_MONTH_DURATION_TYPE_TAG = YEARMONTHDURATION.serialize();
diff --git a/asterixdb/asterix-runtime/src/main/java/org/apache/asterix/runtime/evaluators/constructors/ABinaryHexStringConstructorDescriptor.java b/asterixdb/asterix-runtime/src/main/java/org/apache/asterix/runtime/evaluators/constructors/ABinaryHexStringConstructorDescriptor.java
index 04e32b1..720e9bc 100644
--- a/asterixdb/asterix-runtime/src/main/java/org/apache/asterix/runtime/evaluators/constructors/ABinaryHexStringConstructorDescriptor.java
+++ b/asterixdb/asterix-runtime/src/main/java/org/apache/asterix/runtime/evaluators/constructors/ABinaryHexStringConstructorDescriptor.java
@@ -91,9 +91,10 @@
                 int startOffset = inputArg.getStartOffset();
                 int len = inputArg.getLength();
 
-                if (binary[startOffset] == ATypeTag.SERIALIZED_BINARY_TYPE_TAG) {
+                byte tt = binary[startOffset];
+                if (tt == ATypeTag.SERIALIZED_BINARY_TYPE_TAG) {
                     result.set(inputArg);
-                } else if (binary[startOffset] == ATypeTag.SERIALIZED_STRING_TYPE_TAG) {
+                } else if (tt == ATypeTag.SERIALIZED_STRING_TYPE_TAG) {
                     resultStorage.reset();
                     utf8Ptr.set(inputArg.getByteArray(), startOffset + 1, len - 1);
                     char[] buffer = utf8Ptr.toString().toCharArray();
@@ -101,9 +102,8 @@
                     byteArrayParser.parse(buffer, 0, buffer.length, out);
                     result.set(resultStorage);
                 } else {
-                    throw new TypeMismatchException(BuiltinFunctions.BINARY_HEX_CONSTRUCTOR, 0,
-                            binary[startOffset], ATypeTag.SERIALIZED_BINARY_TYPE_TAG,
-                            ATypeTag.SERIALIZED_STRING_TYPE_TAG);
+                    throw new TypeMismatchException(BuiltinFunctions.BINARY_HEX_CONSTRUCTOR, 0, tt,
+                            ATypeTag.SERIALIZED_BINARY_TYPE_TAG, ATypeTag.SERIALIZED_STRING_TYPE_TAG);
                 }
             } catch (IOException e) {
                 throw new InvalidDataFormatException(BuiltinFunctions.BINARY_HEX_CONSTRUCTOR, e,
diff --git a/asterixdb/asterix-runtime/src/main/java/org/apache/asterix/runtime/evaluators/constructors/ABooleanConstructorDescriptor.java b/asterixdb/asterix-runtime/src/main/java/org/apache/asterix/runtime/evaluators/constructors/ABooleanConstructorDescriptor.java
index d737376..5ef78d3 100644
--- a/asterixdb/asterix-runtime/src/main/java/org/apache/asterix/runtime/evaluators/constructors/ABooleanConstructorDescriptor.java
+++ b/asterixdb/asterix-runtime/src/main/java/org/apache/asterix/runtime/evaluators/constructors/ABooleanConstructorDescriptor.java
@@ -71,35 +71,36 @@
                     IBinaryComparator utf8BinaryComparator =
                             BinaryComparatorFactoryProvider.UTF8STRING_POINTABLE_INSTANCE.createBinaryComparator();
                     @SuppressWarnings("unchecked")
-                    private ISerializerDeserializer<ABoolean> booleanSerde = SerializerDeserializerProvider.INSTANCE
-                            .getSerializerDeserializer(BuiltinType.ABOOLEAN);
+                    private ISerializerDeserializer<ABoolean> booleanSerde =
+                            SerializerDeserializerProvider.INSTANCE.getSerializerDeserializer(BuiltinType.ABOOLEAN);
 
                     @Override
                     public void evaluate(IFrameTupleReference tuple, IPointable result) throws HyracksDataException {
                         try {
-                            resultStorage.reset();
                             eval.evaluate(tuple, inputArg);
                             byte[] serString = inputArg.getByteArray();
                             int startOffset = inputArg.getStartOffset();
                             int len = inputArg.getLength();
 
-                            if (serString[startOffset] == ATypeTag.SERIALIZED_STRING_TYPE_TAG) {
+                            byte tt = serString[startOffset];
+                            if (tt == ATypeTag.SERIALIZED_BOOLEAN_TYPE_TAG) {
+                                result.set(inputArg);
+                            } else if (tt == ATypeTag.SERIALIZED_STRING_TYPE_TAG) {
+                                resultStorage.reset();
                                 if (utf8BinaryComparator.compare(serString, startOffset + 1, len - 1, TRUE, 0,
                                         TRUE.length) == 0) {
                                     booleanSerde.serialize(ABoolean.TRUE, out);
                                     result.set(resultStorage);
-                                    return;
                                 } else if (utf8BinaryComparator.compare(serString, startOffset + 1, len - 1, FALSE, 0,
                                         FALSE.length) == 0) {
                                     booleanSerde.serialize(ABoolean.FALSE, out);
                                     result.set(resultStorage);
-                                    return;
                                 } else {
                                     throw new InvalidDataFormatException(getIdentifier(),
                                             ATypeTag.SERIALIZED_BOOLEAN_TYPE_TAG);
                                 }
                             } else {
-                                throw new TypeMismatchException(getIdentifier(), 0, serString[startOffset],
+                                throw new TypeMismatchException(getIdentifier(), 0, tt,
                                         ATypeTag.SERIALIZED_STRING_TYPE_TAG);
                             }
                         } catch (IOException e) {
diff --git a/asterixdb/asterix-runtime/src/main/java/org/apache/asterix/runtime/evaluators/constructors/ACircleConstructorDescriptor.java b/asterixdb/asterix-runtime/src/main/java/org/apache/asterix/runtime/evaluators/constructors/ACircleConstructorDescriptor.java
index a4d851a..5b0d250 100644
--- a/asterixdb/asterix-runtime/src/main/java/org/apache/asterix/runtime/evaluators/constructors/ACircleConstructorDescriptor.java
+++ b/asterixdb/asterix-runtime/src/main/java/org/apache/asterix/runtime/evaluators/constructors/ACircleConstructorDescriptor.java
@@ -70,22 +70,24 @@
                     private final AMutablePoint aPoint = new AMutablePoint(0, 0);
                     private AMutableCircle aCircle = new AMutableCircle(null, 0);
                     @SuppressWarnings("unchecked")
-                    private ISerializerDeserializer<ACircle> circleSerde = SerializerDeserializerProvider.INSTANCE
-                            .getSerializerDeserializer(BuiltinType.ACIRCLE);
+                    private ISerializerDeserializer<ACircle> circleSerde =
+                            SerializerDeserializerProvider.INSTANCE.getSerializerDeserializer(BuiltinType.ACIRCLE);
 
                     private final UTF8StringPointable utf8Ptr = new UTF8StringPointable();
 
                     @Override
                     public void evaluate(IFrameTupleReference tuple, IPointable result) throws HyracksDataException {
                         try {
-                            resultStorage.reset();
                             eval.evaluate(tuple, inputArg);
-
                             byte[] serString = inputArg.getByteArray();
                             int offset = inputArg.getStartOffset();
                             int len = inputArg.getLength();
 
-                            if (serString[offset] == ATypeTag.SERIALIZED_STRING_TYPE_TAG) {
+                            byte tt = serString[offset];
+                            if (tt == ATypeTag.SERIALIZED_CIRCLE_TYPE_TAG) {
+                                result.set(inputArg);
+                            } else if (tt == ATypeTag.SERIALIZED_STRING_TYPE_TAG) {
+                                resultStorage.reset();
                                 utf8Ptr.set(serString, offset + 1, len - 1);
                                 String s = utf8Ptr.toString();
                                 int commaIndex = s.indexOf(',');
@@ -94,11 +96,11 @@
                                         Double.parseDouble(s.substring(commaIndex + 1, spaceIndex)));
                                 aCircle.setValue(aPoint, Double.parseDouble(s.substring(spaceIndex + 1, s.length())));
                                 circleSerde.serialize(aCircle, out);
+                                result.set(resultStorage);
                             } else {
-                                throw new TypeMismatchException(getIdentifier(), 0, serString[offset],
+                                throw new TypeMismatchException(getIdentifier(), 0, tt,
                                         ATypeTag.SERIALIZED_STRING_TYPE_TAG);
                             }
-                            result.set(resultStorage);
                         } catch (IOException e) {
                             throw new InvalidDataFormatException(getIdentifier(), e,
                                     ATypeTag.SERIALIZED_CIRCLE_TYPE_TAG);
diff --git a/asterixdb/asterix-runtime/src/main/java/org/apache/asterix/runtime/evaluators/constructors/ADateConstructorDescriptor.java b/asterixdb/asterix-runtime/src/main/java/org/apache/asterix/runtime/evaluators/constructors/ADateConstructorDescriptor.java
index cd9d939..eb9b40f 100644
--- a/asterixdb/asterix-runtime/src/main/java/org/apache/asterix/runtime/evaluators/constructors/ADateConstructorDescriptor.java
+++ b/asterixdb/asterix-runtime/src/main/java/org/apache/asterix/runtime/evaluators/constructors/ADateConstructorDescriptor.java
@@ -70,8 +70,8 @@
                     private IScalarEvaluator eval = args[0].createScalarEvaluator(ctx);
                     private AMutableDate aDate = new AMutableDate(0);
                     @SuppressWarnings("unchecked")
-                    private ISerializerDeserializer<ADate> dateSerde = SerializerDeserializerProvider.INSTANCE
-                            .getSerializerDeserializer(BuiltinType.ADATE);
+                    private ISerializerDeserializer<ADate> dateSerde =
+                            SerializerDeserializerProvider.INSTANCE.getSerializerDeserializer(BuiltinType.ADATE);
 
                     private final UTF8StringPointable utf8Ptr = new UTF8StringPointable();
 
@@ -84,7 +84,10 @@
                             int offset = inputArg.getStartOffset();
                             int len = inputArg.getLength();
 
-                            if (serString[offset] == ATypeTag.SERIALIZED_STRING_TYPE_TAG) {
+                            byte tt = serString[offset];
+                            if (tt == ATypeTag.SERIALIZED_DATE_TYPE_TAG) {
+                                result.set(inputArg);
+                            } else if (tt == ATypeTag.SERIALIZED_STRING_TYPE_TAG) {
                                 utf8Ptr.set(serString, offset + 1, len - 1);
                                 int stringLength = utf8Ptr.getUTF8Length();
 
@@ -112,11 +115,11 @@
                                 }
                                 aDate.setValue((int) (chrononTimeInMs / GregorianCalendarSystem.CHRONON_OF_DAY) - temp);
                                 dateSerde.serialize(aDate, out);
+                                result.set(resultStorage);
                             } else {
-                                throw new TypeMismatchException(getIdentifier(), 0, serString[offset],
+                                throw new TypeMismatchException(getIdentifier(), 0, tt,
                                         ATypeTag.SERIALIZED_STRING_TYPE_TAG);
                             }
-                            result.set(resultStorage);
                         } catch (IOException e) {
                             throw new InvalidDataFormatException(getIdentifier(), e, ATypeTag.SERIALIZED_DATE_TYPE_TAG);
                         }
diff --git a/asterixdb/asterix-runtime/src/main/java/org/apache/asterix/runtime/evaluators/constructors/ADateTimeConstructorDescriptor.java b/asterixdb/asterix-runtime/src/main/java/org/apache/asterix/runtime/evaluators/constructors/ADateTimeConstructorDescriptor.java
index 3a8a742..f202dbe 100644
--- a/asterixdb/asterix-runtime/src/main/java/org/apache/asterix/runtime/evaluators/constructors/ADateTimeConstructorDescriptor.java
+++ b/asterixdb/asterix-runtime/src/main/java/org/apache/asterix/runtime/evaluators/constructors/ADateTimeConstructorDescriptor.java
@@ -69,8 +69,8 @@
                     private IScalarEvaluator eval = args[0].createScalarEvaluator(ctx);
                     private AMutableDateTime aDateTime = new AMutableDateTime(0L);
                     @SuppressWarnings("unchecked")
-                    private ISerializerDeserializer<ADateTime> datetimeSerde = SerializerDeserializerProvider.INSTANCE
-                            .getSerializerDeserializer(BuiltinType.ADATETIME);
+                    private ISerializerDeserializer<ADateTime> datetimeSerde =
+                            SerializerDeserializerProvider.INSTANCE.getSerializerDeserializer(BuiltinType.ADATETIME);
                     private final UTF8StringPointable utf8Ptr = new UTF8StringPointable();
 
                     @Override
@@ -82,7 +82,10 @@
                             int offset = inputArg.getStartOffset();
                             int len = inputArg.getLength();
 
-                            if (serString[offset] == ATypeTag.SERIALIZED_STRING_TYPE_TAG) {
+                            byte tt = serString[offset];
+                            if (tt == ATypeTag.SERIALIZED_DATETIME_TYPE_TAG) {
+                                result.set(inputArg);
+                            } else if (tt == ATypeTag.SERIALIZED_STRING_TYPE_TAG) {
                                 utf8Ptr.set(serString, offset + 1, len - 1);
                                 int stringLength = utf8Ptr.getUTF8Length();
                                 int startOffset = utf8Ptr.getCharStartOffset();
@@ -104,19 +107,19 @@
                                     }
                                 }
 
-                                long chrononTimeInMs = ADateParserFactory.parseDatePart(serString, startOffset,
-                                        timeOffset);
+                                long chrononTimeInMs =
+                                        ADateParserFactory.parseDatePart(serString, startOffset, timeOffset);
 
                                 chrononTimeInMs += ATimeParserFactory.parseTimePart(serString,
                                         startOffset + timeOffset + 1, stringLength - timeOffset - 1);
 
                                 aDateTime.setValue(chrononTimeInMs);
                                 datetimeSerde.serialize(aDateTime, out);
+                                result.set(resultStorage);
                             } else {
-                                throw new TypeMismatchException(getIdentifier(), 0, serString[offset],
+                                throw new TypeMismatchException(getIdentifier(), 0, tt,
                                         ATypeTag.SERIALIZED_STRING_TYPE_TAG);
                             }
-                            result.set(resultStorage);
                         } catch (IOException e) {
                             throw new InvalidDataFormatException(getIdentifier(), e,
                                     ATypeTag.SERIALIZED_DATETIME_TYPE_TAG);
diff --git a/asterixdb/asterix-runtime/src/main/java/org/apache/asterix/runtime/evaluators/constructors/ADayTimeDurationConstructorDescriptor.java b/asterixdb/asterix-runtime/src/main/java/org/apache/asterix/runtime/evaluators/constructors/ADayTimeDurationConstructorDescriptor.java
index c7723ef..0e7cc34 100644
--- a/asterixdb/asterix-runtime/src/main/java/org/apache/asterix/runtime/evaluators/constructors/ADayTimeDurationConstructorDescriptor.java
+++ b/asterixdb/asterix-runtime/src/main/java/org/apache/asterix/runtime/evaluators/constructors/ADayTimeDurationConstructorDescriptor.java
@@ -72,20 +72,23 @@
                     private AMutableDayTimeDuration aDayTimeDuration = new AMutableDayTimeDuration(0);
                     @SuppressWarnings("unchecked")
                     private ISerializerDeserializer<ADayTimeDuration> dayTimeDurationSerde =
-                            SerializerDeserializerProvider.INSTANCE.getSerializerDeserializer(
-                                    BuiltinType.ADAYTIMEDURATION);
+                            SerializerDeserializerProvider.INSTANCE
+                                    .getSerializerDeserializer(BuiltinType.ADAYTIMEDURATION);
                     private final UTF8StringPointable utf8Ptr = new UTF8StringPointable();
 
                     @Override
                     public void evaluate(IFrameTupleReference tuple, IPointable result) throws HyracksDataException {
                         try {
-                            resultStorage.reset();
                             eval.evaluate(tuple, inputArg);
                             byte[] serString = inputArg.getByteArray();
                             int offset = inputArg.getStartOffset();
                             int len = inputArg.getLength();
 
-                            if (serString[offset] == ATypeTag.SERIALIZED_STRING_TYPE_TAG) {
+                            byte tt = serString[offset];
+                            if (tt == ATypeTag.SERIALIZED_DAY_TIME_DURATION_TYPE_TAG) {
+                                result.set(inputArg);
+                            } else if (tt == ATypeTag.SERIALIZED_STRING_TYPE_TAG) {
+                                resultStorage.reset();
                                 utf8Ptr.set(serString, offset + 1, len - 1);
                                 int stringLength = utf8Ptr.getUTF8Length();
                                 int startOffset = utf8Ptr.getCharStartOffset();
@@ -94,11 +97,11 @@
                                         aDayTimeDuration, ADurationParseOption.DAY_TIME);
 
                                 dayTimeDurationSerde.serialize(aDayTimeDuration, out);
+                                result.set(resultStorage);
                             } else {
-                                throw new TypeMismatchException(getIdentifier(), 0, serString[offset],
+                                throw new TypeMismatchException(getIdentifier(), 0, tt,
                                         ATypeTag.SERIALIZED_STRING_TYPE_TAG);
                             }
-                            result.set(resultStorage);
                         } catch (Exception e) {
                             throw new InvalidDataFormatException(getIdentifier(), e,
                                     ATypeTag.SERIALIZED_DAY_TIME_DURATION_TYPE_TAG);
diff --git a/asterixdb/asterix-runtime/src/main/java/org/apache/asterix/runtime/evaluators/constructors/ADoubleConstructorDescriptor.java b/asterixdb/asterix-runtime/src/main/java/org/apache/asterix/runtime/evaluators/constructors/ADoubleConstructorDescriptor.java
index 00dbaae..299a452 100644
--- a/asterixdb/asterix-runtime/src/main/java/org/apache/asterix/runtime/evaluators/constructors/ADoubleConstructorDescriptor.java
+++ b/asterixdb/asterix-runtime/src/main/java/org/apache/asterix/runtime/evaluators/constructors/ADoubleConstructorDescriptor.java
@@ -75,21 +75,24 @@
                             BinaryComparatorFactoryProvider.UTF8STRING_POINTABLE_INSTANCE.createBinaryComparator();
                     private AMutableDouble aDouble = new AMutableDouble(0);
                     @SuppressWarnings("unchecked")
-                    private ISerializerDeserializer<ADouble> doubleSerde = SerializerDeserializerProvider.INSTANCE
-                            .getSerializerDeserializer(BuiltinType.ADOUBLE);
+                    private ISerializerDeserializer<ADouble> doubleSerde =
+                            SerializerDeserializerProvider.INSTANCE.getSerializerDeserializer(BuiltinType.ADOUBLE);
 
                     private final UTF8StringPointable utf8Ptr = new UTF8StringPointable();
 
                     @Override
                     public void evaluate(IFrameTupleReference tuple, IPointable result) throws HyracksDataException {
                         try {
-                            resultStorage.reset();
                             eval.evaluate(tuple, inputArg);
                             byte[] serString = inputArg.getByteArray();
                             int offset = inputArg.getStartOffset();
                             int len = inputArg.getLength();
 
-                            if (serString[offset] == ATypeTag.SERIALIZED_STRING_TYPE_TAG) {
+                            byte tt = serString[offset];
+                            if (tt == ATypeTag.SERIALIZED_DOUBLE_TYPE_TAG) {
+                                result.set(inputArg);
+                            } else if (tt == ATypeTag.SERIALIZED_STRING_TYPE_TAG) {
+                                resultStorage.reset();
                                 if (utf8BinaryComparator.compare(serString, offset + 1, len - 1, POSITIVE_INF, 0,
                                         5) == 0) {
                                     aDouble.setValue(Double.POSITIVE_INFINITY);
@@ -104,11 +107,11 @@
                                     aDouble.setValue(Double.parseDouble(utf8Ptr.toString()));
                                 }
                                 doubleSerde.serialize(aDouble, out);
+                                result.set(resultStorage);
                             } else {
-                                throw new TypeMismatchException(getIdentifier(), 0, serString[offset],
+                                throw new TypeMismatchException(getIdentifier(), 0, tt,
                                         ATypeTag.SERIALIZED_STRING_TYPE_TAG);
                             }
-                            result.set(resultStorage);
                         } catch (IOException e) {
                             throw new InvalidDataFormatException(getIdentifier(), e,
                                     ATypeTag.SERIALIZED_DATETIME_TYPE_TAG);
diff --git a/asterixdb/asterix-runtime/src/main/java/org/apache/asterix/runtime/evaluators/constructors/ADurationConstructorDescriptor.java b/asterixdb/asterix-runtime/src/main/java/org/apache/asterix/runtime/evaluators/constructors/ADurationConstructorDescriptor.java
index 0202b7b..df39306 100644
--- a/asterixdb/asterix-runtime/src/main/java/org/apache/asterix/runtime/evaluators/constructors/ADurationConstructorDescriptor.java
+++ b/asterixdb/asterix-runtime/src/main/java/org/apache/asterix/runtime/evaluators/constructors/ADurationConstructorDescriptor.java
@@ -69,30 +69,33 @@
                     private IScalarEvaluator eval = args[0].createScalarEvaluator(ctx);
                     private AMutableDuration aDuration = new AMutableDuration(0, 0);
                     @SuppressWarnings("unchecked")
-                    private ISerializerDeserializer<ADuration> durationSerde = SerializerDeserializerProvider.INSTANCE
-                            .getSerializerDeserializer(BuiltinType.ADURATION);
+                    private ISerializerDeserializer<ADuration> durationSerde =
+                            SerializerDeserializerProvider.INSTANCE.getSerializerDeserializer(BuiltinType.ADURATION);
                     private final UTF8StringPointable utf8Ptr = new UTF8StringPointable();
 
                     @Override
                     public void evaluate(IFrameTupleReference tuple, IPointable result) throws HyracksDataException {
                         try {
-                            resultStorage.reset();
                             eval.evaluate(tuple, inputArg);
                             byte[] serString = inputArg.getByteArray();
                             int offset = inputArg.getStartOffset();
                             int len = inputArg.getLength();
 
-                            if (serString[offset] == ATypeTag.SERIALIZED_STRING_TYPE_TAG) {
+                            byte tt = serString[offset];
+                            if (tt == ATypeTag.SERIALIZED_DURATION_TYPE_TAG) {
+                                result.set(inputArg);
+                            } else if (tt == ATypeTag.SERIALIZED_STRING_TYPE_TAG) {
+                                resultStorage.reset();
                                 utf8Ptr.set(serString, offset + 1, len - 1);
                                 int stringLength = utf8Ptr.getUTF8Length();
                                 ADurationParserFactory.parseDuration(serString, utf8Ptr.getCharStartOffset(),
                                         stringLength, aDuration, ADurationParseOption.All);
                                 durationSerde.serialize(aDuration, out);
+                                result.set(resultStorage);
                             } else {
-                                throw new TypeMismatchException(getIdentifier(), 0, serString[offset],
+                                throw new TypeMismatchException(getIdentifier(), 0, tt,
                                         ATypeTag.SERIALIZED_STRING_TYPE_TAG);
                             }
-                            result.set(resultStorage);
                         } catch (IOException e) {
                             throw new InvalidDataFormatException(getIdentifier(), e,
                                     ATypeTag.SERIALIZED_DURATION_TYPE_TAG);
diff --git a/asterixdb/asterix-runtime/src/main/java/org/apache/asterix/runtime/evaluators/constructors/AFloatConstructorDescriptor.java b/asterixdb/asterix-runtime/src/main/java/org/apache/asterix/runtime/evaluators/constructors/AFloatConstructorDescriptor.java
index 3b7a6b2..ffc982a 100644
--- a/asterixdb/asterix-runtime/src/main/java/org/apache/asterix/runtime/evaluators/constructors/AFloatConstructorDescriptor.java
+++ b/asterixdb/asterix-runtime/src/main/java/org/apache/asterix/runtime/evaluators/constructors/AFloatConstructorDescriptor.java
@@ -71,24 +71,27 @@
                     private final byte[] POSITIVE_INF = UTF8StringUtil.writeStringToBytes("INF");
                     private final byte[] NEGATIVE_INF = UTF8StringUtil.writeStringToBytes("-INF");
                     private final byte[] NAN = UTF8StringUtil.writeStringToBytes("NaN");
-                    private IBinaryComparator utf8BinaryComparator = BinaryComparatorFactoryProvider.
-                            UTF8STRING_POINTABLE_INSTANCE.createBinaryComparator();
+                    private IBinaryComparator utf8BinaryComparator =
+                            BinaryComparatorFactoryProvider.UTF8STRING_POINTABLE_INSTANCE.createBinaryComparator();
                     private AMutableFloat aFloat = new AMutableFloat(0);
                     @SuppressWarnings("unchecked")
-                    private ISerializerDeserializer<AFloat> floatSerde = SerializerDeserializerProvider.INSTANCE
-                            .getSerializerDeserializer(BuiltinType.AFLOAT);
+                    private ISerializerDeserializer<AFloat> floatSerde =
+                            SerializerDeserializerProvider.INSTANCE.getSerializerDeserializer(BuiltinType.AFLOAT);
                     private final UTF8StringPointable utf8Ptr = new UTF8StringPointable();
 
                     @Override
                     public void evaluate(IFrameTupleReference tuple, IPointable result) throws HyracksDataException {
                         try {
-                            resultStorage.reset();
                             eval.evaluate(tuple, inputArg);
                             byte[] serString = inputArg.getByteArray();
                             int offset = inputArg.getStartOffset();
                             int len = inputArg.getLength();
 
-                            if (serString[offset] == ATypeTag.SERIALIZED_STRING_TYPE_TAG) {
+                            byte tt = serString[offset];
+                            if (tt == ATypeTag.SERIALIZED_FLOAT_TYPE_TAG) {
+                                result.set(inputArg);
+                            } else if (tt == ATypeTag.SERIALIZED_STRING_TYPE_TAG) {
+                                resultStorage.reset();
                                 if (utf8BinaryComparator.compare(serString, offset + 1, len - 1, POSITIVE_INF, 0,
                                         5) == 0) {
                                     aFloat.setValue(Float.POSITIVE_INFINITY);
@@ -103,11 +106,11 @@
                                     aFloat.setValue(Float.parseFloat(utf8Ptr.toString()));
                                 }
                                 floatSerde.serialize(aFloat, out);
+                                result.set(resultStorage);
                             } else {
-                                throw new TypeMismatchException(getIdentifier(), 0, serString[offset],
+                                throw new TypeMismatchException(getIdentifier(), 0, tt,
                                         ATypeTag.SERIALIZED_STRING_TYPE_TAG);
                             }
-                            result.set(resultStorage);
                         } catch (IOException e) {
                             throw new InvalidDataFormatException(getIdentifier(), e,
                                     ATypeTag.SERIALIZED_FLOAT_TYPE_TAG);
diff --git a/asterixdb/asterix-runtime/src/main/java/org/apache/asterix/runtime/evaluators/constructors/AInt16ConstructorDescriptor.java b/asterixdb/asterix-runtime/src/main/java/org/apache/asterix/runtime/evaluators/constructors/AInt16ConstructorDescriptor.java
index 9f7dbc3..9413cb4 100644
--- a/asterixdb/asterix-runtime/src/main/java/org/apache/asterix/runtime/evaluators/constructors/AInt16ConstructorDescriptor.java
+++ b/asterixdb/asterix-runtime/src/main/java/org/apache/asterix/runtime/evaluators/constructors/AInt16ConstructorDescriptor.java
@@ -71,20 +71,23 @@
                     private boolean positive;
                     private AMutableInt16 aInt16 = new AMutableInt16((short) 0);
                     @SuppressWarnings("unchecked")
-                    private ISerializerDeserializer<AInt16> int16Serde = SerializerDeserializerProvider.INSTANCE
-                            .getSerializerDeserializer(BuiltinType.AINT16);
+                    private ISerializerDeserializer<AInt16> int16Serde =
+                            SerializerDeserializerProvider.INSTANCE.getSerializerDeserializer(BuiltinType.AINT16);
                     private final UTF8StringPointable utf8Ptr = new UTF8StringPointable();
 
                     @Override
                     public void evaluate(IFrameTupleReference tuple, IPointable result) throws HyracksDataException {
                         try {
-                            resultStorage.reset();
                             eval.evaluate(tuple, inputArg);
                             byte[] serString = inputArg.getByteArray();
                             int startOffset = inputArg.getStartOffset();
                             int len = inputArg.getLength();
 
-                            if (serString[startOffset] == ATypeTag.SERIALIZED_STRING_TYPE_TAG) {
+                            byte tt = serString[startOffset];
+                            if (tt == ATypeTag.SERIALIZED_INT16_TYPE_TAG) {
+                                result.set(inputArg);
+                            } else if (tt == ATypeTag.SERIALIZED_STRING_TYPE_TAG) {
+                                resultStorage.reset();
                                 utf8Ptr.set(serString, startOffset + 1, len - 1);
                                 offset = utf8Ptr.getCharStartOffset();
                                 //accumulating value in negative domain
@@ -128,11 +131,11 @@
 
                                 aInt16.setValue(value);
                                 int16Serde.serialize(aInt16, out);
+                                result.set(resultStorage);
                             } else {
-                                throw new TypeMismatchException(getIdentifier(), 0, serString[offset],
+                                throw new TypeMismatchException(getIdentifier(), 0, tt,
                                         ATypeTag.SERIALIZED_STRING_TYPE_TAG);
                             }
-                            result.set(resultStorage);
                         } catch (IOException e) {
                             throw new InvalidDataFormatException(getIdentifier(), e,
                                     ATypeTag.SERIALIZED_INT16_TYPE_TAG);
diff --git a/asterixdb/asterix-runtime/src/main/java/org/apache/asterix/runtime/evaluators/constructors/AInt32ConstructorDescriptor.java b/asterixdb/asterix-runtime/src/main/java/org/apache/asterix/runtime/evaluators/constructors/AInt32ConstructorDescriptor.java
index bc74b94..985d966 100644
--- a/asterixdb/asterix-runtime/src/main/java/org/apache/asterix/runtime/evaluators/constructors/AInt32ConstructorDescriptor.java
+++ b/asterixdb/asterix-runtime/src/main/java/org/apache/asterix/runtime/evaluators/constructors/AInt32ConstructorDescriptor.java
@@ -70,20 +70,23 @@
                     private boolean positive;
                     private AMutableInt32 aInt32 = new AMutableInt32(0);
                     @SuppressWarnings("unchecked")
-                    private ISerializerDeserializer<AInt32> int32Serde = SerializerDeserializerProvider.INSTANCE
-                            .getSerializerDeserializer(BuiltinType.AINT32);
+                    private ISerializerDeserializer<AInt32> int32Serde =
+                            SerializerDeserializerProvider.INSTANCE.getSerializerDeserializer(BuiltinType.AINT32);
                     private final UTF8StringPointable utf8Ptr = new UTF8StringPointable();
 
                     @Override
                     public void evaluate(IFrameTupleReference tuple, IPointable result) throws HyracksDataException {
                         try {
-                            resultStorage.reset();
                             eval.evaluate(tuple, inputArg);
                             byte[] serString = inputArg.getByteArray();
                             int startOffset = inputArg.getStartOffset();
                             int len = inputArg.getLength();
 
-                            if (serString[startOffset] == ATypeTag.SERIALIZED_STRING_TYPE_TAG) {
+                            byte tt = serString[startOffset];
+                            if (tt == ATypeTag.SERIALIZED_INT32_TYPE_TAG) {
+                                result.set(inputArg);
+                            } else if (tt == ATypeTag.SERIALIZED_STRING_TYPE_TAG) {
+                                resultStorage.reset();
                                 utf8Ptr.set(serString, startOffset + 1, len - 1);
                                 offset = utf8Ptr.getCharStartOffset();
                                 //accumulating value in negative domain
@@ -127,11 +130,11 @@
 
                                 aInt32.setValue(value);
                                 int32Serde.serialize(aInt32, out);
+                                result.set(resultStorage);
                             } else {
-                                throw new TypeMismatchException(getIdentifier(), 0, serString[offset],
+                                throw new TypeMismatchException(getIdentifier(), 0, tt,
                                         ATypeTag.SERIALIZED_STRING_TYPE_TAG);
                             }
-                            result.set(resultStorage);
                         } catch (IOException e) {
                             throw new InvalidDataFormatException(getIdentifier(), e,
                                     ATypeTag.SERIALIZED_INT32_TYPE_TAG);
diff --git a/asterixdb/asterix-runtime/src/main/java/org/apache/asterix/runtime/evaluators/constructors/AInt64ConstructorDescriptor.java b/asterixdb/asterix-runtime/src/main/java/org/apache/asterix/runtime/evaluators/constructors/AInt64ConstructorDescriptor.java
index 0870f73..a2dc8b2 100644
--- a/asterixdb/asterix-runtime/src/main/java/org/apache/asterix/runtime/evaluators/constructors/AInt64ConstructorDescriptor.java
+++ b/asterixdb/asterix-runtime/src/main/java/org/apache/asterix/runtime/evaluators/constructors/AInt64ConstructorDescriptor.java
@@ -31,6 +31,7 @@
 import org.apache.asterix.om.types.BuiltinType;
 import org.apache.asterix.runtime.evaluators.base.AbstractScalarFunctionDynamicDescriptor;
 import org.apache.asterix.runtime.exceptions.InvalidDataFormatException;
+import org.apache.asterix.runtime.exceptions.TypeMismatchException;
 import org.apache.hyracks.algebricks.core.algebra.functions.FunctionIdentifier;
 import org.apache.hyracks.algebricks.runtime.base.IScalarEvaluator;
 import org.apache.hyracks.algebricks.runtime.base.IScalarEvaluatorFactory;
@@ -77,13 +78,16 @@
                     @Override
                     public void evaluate(IFrameTupleReference tuple, IPointable result) throws HyracksDataException {
                         try {
-                            resultStorage.reset();
                             eval.evaluate(tuple, inputArg);
                             byte[] serString = inputArg.getByteArray();
                             int startOffset = inputArg.getStartOffset();
                             int len = inputArg.getLength();
 
-                            if (serString[startOffset] == ATypeTag.SERIALIZED_STRING_TYPE_TAG) {
+                            byte tt = serString[startOffset];
+                            if (tt == ATypeTag.SERIALIZED_INT64_TYPE_TAG) {
+                                result.set(inputArg);
+                            } else if (tt == ATypeTag.SERIALIZED_STRING_TYPE_TAG) {
+                                resultStorage.reset();
                                 utf8Ptr.set(serString, startOffset + 1, len - 1);
                                 offset = utf8Ptr.getCharStartOffset();
                                 //accumulating value in negative domain
@@ -127,11 +131,11 @@
 
                                 aInt64.setValue(value);
                                 int64Serde.serialize(aInt64, out);
+                                result.set(resultStorage);
                             } else {
-                                throw new InvalidDataFormatException(getIdentifier(),
-                                        ATypeTag.SERIALIZED_INT64_TYPE_TAG);
+                                throw new TypeMismatchException(getIdentifier(), 0, tt,
+                                        ATypeTag.SERIALIZED_STRING_TYPE_TAG);
                             }
-                            result.set(resultStorage);
                         } catch (IOException e) {
                             throw new InvalidDataFormatException(getIdentifier(), e,
                                     ATypeTag.SERIALIZED_INT64_TYPE_TAG);
diff --git a/asterixdb/asterix-runtime/src/main/java/org/apache/asterix/runtime/evaluators/constructors/AInt8ConstructorDescriptor.java b/asterixdb/asterix-runtime/src/main/java/org/apache/asterix/runtime/evaluators/constructors/AInt8ConstructorDescriptor.java
index c0d9fd4..e4a9d32 100644
--- a/asterixdb/asterix-runtime/src/main/java/org/apache/asterix/runtime/evaluators/constructors/AInt8ConstructorDescriptor.java
+++ b/asterixdb/asterix-runtime/src/main/java/org/apache/asterix/runtime/evaluators/constructors/AInt8ConstructorDescriptor.java
@@ -31,6 +31,7 @@
 import org.apache.asterix.om.types.BuiltinType;
 import org.apache.asterix.runtime.evaluators.base.AbstractScalarFunctionDynamicDescriptor;
 import org.apache.asterix.runtime.exceptions.InvalidDataFormatException;
+import org.apache.asterix.runtime.exceptions.TypeMismatchException;
 import org.apache.hyracks.algebricks.core.algebra.functions.FunctionIdentifier;
 import org.apache.hyracks.algebricks.runtime.base.IScalarEvaluator;
 import org.apache.hyracks.algebricks.runtime.base.IScalarEvaluatorFactory;
@@ -70,20 +71,23 @@
                     private boolean positive;
                     private AMutableInt8 aInt8 = new AMutableInt8((byte) 0);
                     @SuppressWarnings("unchecked")
-                    private ISerializerDeserializer<AInt8> int8Serde = SerializerDeserializerProvider.INSTANCE
-                            .getSerializerDeserializer(BuiltinType.AINT8);
+                    private ISerializerDeserializer<AInt8> int8Serde =
+                            SerializerDeserializerProvider.INSTANCE.getSerializerDeserializer(BuiltinType.AINT8);
                     private final UTF8StringPointable utf8Ptr = new UTF8StringPointable();
 
                     @Override
                     public void evaluate(IFrameTupleReference tuple, IPointable result) throws HyracksDataException {
                         try {
-                            resultStorage.reset();
                             eval.evaluate(tuple, inputArg);
                             byte[] serString = inputArg.getByteArray();
                             int startOffset = inputArg.getStartOffset();
                             int len = inputArg.getLength();
 
-                            if (serString[startOffset] == ATypeTag.SERIALIZED_STRING_TYPE_TAG) {
+                            byte tt = serString[startOffset];
+                            if (tt == ATypeTag.SERIALIZED_INT8_TYPE_TAG) {
+                                result.set(inputArg);
+                            } else if (tt == ATypeTag.SERIALIZED_STRING_TYPE_TAG) {
+                                resultStorage.reset();
                                 utf8Ptr.set(serString, startOffset + 1, len - 1);
                                 offset = utf8Ptr.getCharStartOffset();
                                 //accumulating value in negative domain
@@ -127,11 +131,11 @@
 
                                 aInt8.setValue(value);
                                 int8Serde.serialize(aInt8, out);
+                                result.set(resultStorage);
                             } else {
-                                throw new InvalidDataFormatException(getIdentifier(),
-                                        ATypeTag.SERIALIZED_INT8_TYPE_TAG);
+                                throw new TypeMismatchException(getIdentifier(), 0, tt,
+                                        ATypeTag.SERIALIZED_STRING_TYPE_TAG);
                             }
-                            result.set(resultStorage);
                         } catch (IOException e1) {
                             throw new InvalidDataFormatException(getIdentifier(), e1,
                                     ATypeTag.SERIALIZED_INT8_TYPE_TAG);
diff --git a/asterixdb/asterix-runtime/src/main/java/org/apache/asterix/runtime/evaluators/constructors/ALineConstructorDescriptor.java b/asterixdb/asterix-runtime/src/main/java/org/apache/asterix/runtime/evaluators/constructors/ALineConstructorDescriptor.java
index 2e8a850..0ef585c 100644
--- a/asterixdb/asterix-runtime/src/main/java/org/apache/asterix/runtime/evaluators/constructors/ALineConstructorDescriptor.java
+++ b/asterixdb/asterix-runtime/src/main/java/org/apache/asterix/runtime/evaluators/constructors/ALineConstructorDescriptor.java
@@ -71,20 +71,23 @@
                     private AMutableLine aLine = new AMutableLine(null, null);
                     private AMutablePoint[] aPoint = { new AMutablePoint(0, 0), new AMutablePoint(0, 0) };
                     @SuppressWarnings("unchecked")
-                    private ISerializerDeserializer<ALine> lineSerde = SerializerDeserializerProvider.INSTANCE
-                            .getSerializerDeserializer(BuiltinType.ALINE);
+                    private ISerializerDeserializer<ALine> lineSerde =
+                            SerializerDeserializerProvider.INSTANCE.getSerializerDeserializer(BuiltinType.ALINE);
                     private final UTF8StringPointable utf8Ptr = new UTF8StringPointable();
 
                     @Override
                     public void evaluate(IFrameTupleReference tuple, IPointable result) throws HyracksDataException {
                         try {
-                            resultStorage.reset();
                             eval.evaluate(tuple, inputArg);
                             byte[] serString = inputArg.getByteArray();
                             int offset = inputArg.getStartOffset();
                             int len = inputArg.getLength();
 
-                            if (serString[offset] == ATypeTag.SERIALIZED_STRING_TYPE_TAG) {
+                            byte tt = serString[offset];
+                            if (tt == ATypeTag.SERIALIZED_LINE_TYPE_TAG) {
+                                result.set(inputArg);
+                            } else if (tt == ATypeTag.SERIALIZED_STRING_TYPE_TAG) {
+                                resultStorage.reset();
                                 utf8Ptr.set(serString, offset + 1, len - 1);
                                 String s = utf8Ptr.toString();
                                 int commaIndex = s.indexOf(',');
@@ -96,11 +99,11 @@
                                         Double.parseDouble(s.substring(commaIndex + 1, s.length())));
                                 aLine.setValue(aPoint[0], aPoint[1]);
                                 lineSerde.serialize(aLine, out);
+                                result.set(resultStorage);
                             } else {
-                                throw new TypeMismatchException(getIdentifier(), 0, serString[offset],
+                                throw new TypeMismatchException(getIdentifier(), 0, tt,
                                         ATypeTag.SERIALIZED_STRING_TYPE_TAG);
                             }
-                            result.set(resultStorage);
                         } catch (IOException e) {
                             throw new InvalidDataFormatException(getIdentifier(), e,
                                     ATypeTag.SERIALIZED_INTERVAL_TYPE_TAG);
diff --git a/asterixdb/asterix-runtime/src/main/java/org/apache/asterix/runtime/evaluators/constructors/ANullConstructorDescriptor.java b/asterixdb/asterix-runtime/src/main/java/org/apache/asterix/runtime/evaluators/constructors/ANullConstructorDescriptor.java
deleted file mode 100644
index 2df7d97..0000000
--- a/asterixdb/asterix-runtime/src/main/java/org/apache/asterix/runtime/evaluators/constructors/ANullConstructorDescriptor.java
+++ /dev/null
@@ -1,114 +0,0 @@
-/*
- * Licensed to the Apache Software Foundation (ASF) under one
- * or more contributor license agreements.  See the NOTICE file
- * distributed with this work for additional information
- * regarding copyright ownership.  The ASF licenses this file
- * to you under the Apache License, Version 2.0 (the
- * "License"); you may not use this file except in compliance
- * with the License.  You may obtain a copy of the License at
- *
- *   http://www.apache.org/licenses/LICENSE-2.0
- *
- * Unless required by applicable law or agreed to in writing,
- * software distributed under the License is distributed on an
- * "AS IS" BASIS, WITHOUT WARRANTIES OR CONDITIONS OF ANY
- * KIND, either express or implied.  See the License for the
- * specific language governing permissions and limitations
- * under the License.
- */
-package org.apache.asterix.runtime.evaluators.constructors;
-
-import java.io.DataOutput;
-import java.io.IOException;
-
-import org.apache.asterix.formats.nontagged.BinaryComparatorFactoryProvider;
-import org.apache.asterix.formats.nontagged.SerializerDeserializerProvider;
-import org.apache.asterix.om.base.AMissing;
-import org.apache.asterix.om.functions.BuiltinFunctions;
-import org.apache.asterix.om.functions.IFunctionDescriptor;
-import org.apache.asterix.om.functions.IFunctionDescriptorFactory;
-import org.apache.asterix.om.types.ATypeTag;
-import org.apache.asterix.om.types.BuiltinType;
-import org.apache.asterix.runtime.evaluators.base.AbstractScalarFunctionDynamicDescriptor;
-import org.apache.asterix.runtime.exceptions.InvalidDataFormatException;
-import org.apache.asterix.runtime.exceptions.TypeMismatchException;
-import org.apache.hyracks.algebricks.core.algebra.functions.FunctionIdentifier;
-import org.apache.hyracks.algebricks.runtime.base.IScalarEvaluator;
-import org.apache.hyracks.algebricks.runtime.base.IScalarEvaluatorFactory;
-import org.apache.hyracks.api.context.IHyracksTaskContext;
-import org.apache.hyracks.api.dataflow.value.IBinaryComparator;
-import org.apache.hyracks.api.dataflow.value.ISerializerDeserializer;
-import org.apache.hyracks.api.exceptions.HyracksDataException;
-import org.apache.hyracks.data.std.api.IPointable;
-import org.apache.hyracks.data.std.primitive.VoidPointable;
-import org.apache.hyracks.data.std.util.ArrayBackedValueStorage;
-import org.apache.hyracks.dataflow.common.data.accessors.IFrameTupleReference;
-import org.apache.hyracks.util.string.UTF8StringUtil;
-
-public class ANullConstructorDescriptor extends AbstractScalarFunctionDynamicDescriptor {
-    private static final long serialVersionUID = 1L;
-    public static final IFunctionDescriptorFactory FACTORY = new IFunctionDescriptorFactory() {
-        @Override
-        public IFunctionDescriptor createFunctionDescriptor() {
-            return new ANullConstructorDescriptor();
-        }
-    };
-
-    @Override
-    public IScalarEvaluatorFactory createEvaluatorFactory(final IScalarEvaluatorFactory[] args) {
-        return new IScalarEvaluatorFactory() {
-            private static final long serialVersionUID = 1L;
-
-            @Override
-            public IScalarEvaluator createScalarEvaluator(IHyracksTaskContext ctx) throws HyracksDataException {
-                return new IScalarEvaluator() {
-
-                    private ArrayBackedValueStorage resultStorage = new ArrayBackedValueStorage();
-                    private DataOutput out = resultStorage.getDataOutput();
-                    private IPointable inputArg = new VoidPointable();
-                    private IScalarEvaluator eval = args[0].createScalarEvaluator(ctx);
-                    private final byte[] NULL = UTF8StringUtil.writeStringToBytes("null");
-                    IBinaryComparator utf8BinaryComparator =
-                            BinaryComparatorFactoryProvider.UTF8STRING_POINTABLE_INSTANCE.createBinaryComparator();
-                    @SuppressWarnings("unchecked")
-                    private ISerializerDeserializer<AMissing> nullSerde = SerializerDeserializerProvider.INSTANCE
-                            .getSerializerDeserializer(BuiltinType.AMISSING);
-
-                    @Override
-                    public void evaluate(IFrameTupleReference tuple, IPointable result) throws HyracksDataException {
-                        try {
-                            eval.evaluate(tuple, inputArg);
-                            byte[] serString = inputArg.getByteArray();
-                            int offset = inputArg.getStartOffset();
-                            int len = inputArg.getLength();
-
-                            if (serString[offset] == ATypeTag.SERIALIZED_STRING_TYPE_TAG) {
-                                if (utf8BinaryComparator.compare(serString, offset + 1, len - 1, NULL, 0,
-                                        NULL.length) == 0) {
-                                    resultStorage.reset();
-                                    nullSerde.serialize(AMissing.MISSING, out);
-                                    result.set(resultStorage);
-                                    return;
-                                } else {
-                                    throw new InvalidDataFormatException(getIdentifier(),
-                                            ATypeTag.SERIALIZED_NULL_TYPE_TAG);
-                                }
-                            } else {
-                                throw new TypeMismatchException(getIdentifier(), 0, serString[offset],
-                                        ATypeTag.SERIALIZED_STRING_TYPE_TAG);
-                            }
-                        } catch (IOException e) {
-                            throw new InvalidDataFormatException(getIdentifier(), e, ATypeTag.SERIALIZED_NULL_TYPE_TAG);
-                        }
-                    }
-                };
-            }
-        };
-    }
-
-    @Override
-    public FunctionIdentifier getIdentifier() {
-        return BuiltinFunctions.NULL_CONSTRUCTOR;
-    }
-
-}
diff --git a/asterixdb/asterix-runtime/src/main/java/org/apache/asterix/runtime/evaluators/constructors/APoint3DConstructorDescriptor.java b/asterixdb/asterix-runtime/src/main/java/org/apache/asterix/runtime/evaluators/constructors/APoint3DConstructorDescriptor.java
index 23cccb7..3415f38 100644
--- a/asterixdb/asterix-runtime/src/main/java/org/apache/asterix/runtime/evaluators/constructors/APoint3DConstructorDescriptor.java
+++ b/asterixdb/asterix-runtime/src/main/java/org/apache/asterix/runtime/evaluators/constructors/APoint3DConstructorDescriptor.java
@@ -69,20 +69,23 @@
                     private IScalarEvaluator eval = args[0].createScalarEvaluator(ctx);
                     private AMutablePoint3D aPoint3D = new AMutablePoint3D(0, 0, 0);
                     @SuppressWarnings("unchecked")
-                    private ISerializerDeserializer<APoint3D> point3DSerde = SerializerDeserializerProvider.INSTANCE
-                            .getSerializerDeserializer(BuiltinType.APOINT3D);
+                    private ISerializerDeserializer<APoint3D> point3DSerde =
+                            SerializerDeserializerProvider.INSTANCE.getSerializerDeserializer(BuiltinType.APOINT3D);
                     private final UTF8StringPointable utf8Ptr = new UTF8StringPointable();
 
                     @Override
                     public void evaluate(IFrameTupleReference tuple, IPointable result) throws HyracksDataException {
                         try {
-                            resultStorage.reset();
                             eval.evaluate(tuple, inputArg);
                             byte[] serString = inputArg.getByteArray();
                             int offset = inputArg.getStartOffset();
                             int len = inputArg.getLength();
 
-                            if (serString[offset] == ATypeTag.SERIALIZED_STRING_TYPE_TAG) {
+                            byte tt = serString[offset];
+                            if (tt == ATypeTag.SERIALIZED_POINT3D_TYPE_TAG) {
+                                result.set(inputArg);
+                            } else if (tt == ATypeTag.SERIALIZED_STRING_TYPE_TAG) {
+                                resultStorage.reset();
                                 utf8Ptr.set(serString, offset + 1, len - 1);
                                 String s = utf8Ptr.toString();
                                 int firstCommaIndex = s.indexOf(',');
@@ -91,14 +94,14 @@
                                         Double.parseDouble(s.substring(firstCommaIndex + 1, secondCommaIndex)),
                                         Double.parseDouble(s.substring(secondCommaIndex + 1, s.length())));
                                 point3DSerde.serialize(aPoint3D, out);
+                                result.set(resultStorage);
                             } else {
-                                throw new TypeMismatchException(getIdentifier(), 0, serString[offset],
+                                throw new TypeMismatchException(getIdentifier(), 0, tt,
                                         ATypeTag.SERIALIZED_STRING_TYPE_TAG);
                             }
-                            result.set(resultStorage);
                         } catch (IOException e) {
                             throw new InvalidDataFormatException(getIdentifier(), e,
-                                    ATypeTag.SERIALIZED_POINT_TYPE_TAG);
+                                    ATypeTag.SERIALIZED_POINT3D_TYPE_TAG);
                         }
                     }
                 };
diff --git a/asterixdb/asterix-runtime/src/main/java/org/apache/asterix/runtime/evaluators/constructors/APointConstructorDescriptor.java b/asterixdb/asterix-runtime/src/main/java/org/apache/asterix/runtime/evaluators/constructors/APointConstructorDescriptor.java
index 739d084..24045b9 100644
--- a/asterixdb/asterix-runtime/src/main/java/org/apache/asterix/runtime/evaluators/constructors/APointConstructorDescriptor.java
+++ b/asterixdb/asterix-runtime/src/main/java/org/apache/asterix/runtime/evaluators/constructors/APointConstructorDescriptor.java
@@ -68,31 +68,33 @@
                     private IScalarEvaluator eval = args[0].createScalarEvaluator(ctx);
                     private AMutablePoint aPoint = new AMutablePoint(0, 0);
                     @SuppressWarnings("unchecked")
-                    private ISerializerDeserializer<APoint> pointSerde = SerializerDeserializerProvider.INSTANCE
-                            .getSerializerDeserializer(BuiltinType.APOINT);
+                    private ISerializerDeserializer<APoint> pointSerde =
+                            SerializerDeserializerProvider.INSTANCE.getSerializerDeserializer(BuiltinType.APOINT);
                     private final UTF8StringPointable utf8Ptr = new UTF8StringPointable();
 
                     @Override
                     public void evaluate(IFrameTupleReference tuple, IPointable result) throws HyracksDataException {
-
                         try {
-                            resultStorage.reset();
                             eval.evaluate(tuple, inputArg);
                             byte[] serString = inputArg.getByteArray();
                             int offset = inputArg.getStartOffset();
                             int len = inputArg.getLength();
 
-                            if (serString[offset] == ATypeTag.SERIALIZED_STRING_TYPE_TAG) {
+                            byte tt = serString[offset];
+                            if (tt == ATypeTag.SERIALIZED_POINT_TYPE_TAG) {
+                                result.set(inputArg);
+                            } else if (tt == ATypeTag.SERIALIZED_STRING_TYPE_TAG) {
+                                resultStorage.reset();
                                 utf8Ptr.set(serString, offset + 1, len - 1);
                                 String s = utf8Ptr.toString();
                                 aPoint.setValue(Double.parseDouble(s.substring(0, s.indexOf(','))),
                                         Double.parseDouble(s.substring(s.indexOf(',') + 1, s.length())));
                                 pointSerde.serialize(aPoint, out);
+                                result.set(resultStorage);
                             } else {
-                                throw new TypeMismatchException(getIdentifier(), 0, serString[offset],
+                                throw new TypeMismatchException(getIdentifier(), 0, tt,
                                         ATypeTag.SERIALIZED_STRING_TYPE_TAG);
                             }
-                            result.set(resultStorage);
                         } catch (IOException e) {
                             throw new InvalidDataFormatException(getIdentifier(), e,
                                     ATypeTag.SERIALIZED_POINT_TYPE_TAG);
diff --git a/asterixdb/asterix-runtime/src/main/java/org/apache/asterix/runtime/evaluators/constructors/APolygonConstructorDescriptor.java b/asterixdb/asterix-runtime/src/main/java/org/apache/asterix/runtime/evaluators/constructors/APolygonConstructorDescriptor.java
index e43c550..eb139b0 100644
--- a/asterixdb/asterix-runtime/src/main/java/org/apache/asterix/runtime/evaluators/constructors/APolygonConstructorDescriptor.java
+++ b/asterixdb/asterix-runtime/src/main/java/org/apache/asterix/runtime/evaluators/constructors/APolygonConstructorDescriptor.java
@@ -72,13 +72,16 @@
                     @Override
                     public void evaluate(IFrameTupleReference tuple, IPointable result) throws HyracksDataException {
                         try {
-                            resultStorage.reset();
                             eval.evaluate(tuple, inputArg);
                             byte[] serString = inputArg.getByteArray();
                             int offset = inputArg.getStartOffset();
                             int len = inputArg.getLength();
 
-                            if (serString[offset] == ATypeTag.SERIALIZED_STRING_TYPE_TAG) {
+                            byte tt = serString[offset];
+                            if (tt == ATypeTag.SERIALIZED_POLYGON_TYPE_TAG) {
+                                result.set(inputArg);
+                            } else if (tt == ATypeTag.SERIALIZED_STRING_TYPE_TAG) {
+                                resultStorage.reset();
                                 utf8Ptr.set(serString, offset + 1, len - 1);
                                 String s = utf8Ptr.toString();
                                 String[] points = WS.split(s.trim());
@@ -93,11 +96,11 @@
                                     APointSerializerDeserializer.serialize(Double.parseDouble(point[0]),
                                             Double.parseDouble(point[1]), out);
                                 }
+                                result.set(resultStorage);
                             } else {
-                                throw new TypeMismatchException(getIdentifier(), 0, serString[offset],
+                                throw new TypeMismatchException(getIdentifier(), 0, tt,
                                         ATypeTag.SERIALIZED_STRING_TYPE_TAG);
                             }
-                            result.set(resultStorage);
                         } catch (IOException e) {
                             throw new InvalidDataFormatException(getIdentifier(), e,
                                     ATypeTag.SERIALIZED_POLYGON_TYPE_TAG);
diff --git a/asterixdb/asterix-runtime/src/main/java/org/apache/asterix/runtime/evaluators/constructors/ARectangleConstructorDescriptor.java b/asterixdb/asterix-runtime/src/main/java/org/apache/asterix/runtime/evaluators/constructors/ARectangleConstructorDescriptor.java
index ef03dc2..ccaf7b8 100644
--- a/asterixdb/asterix-runtime/src/main/java/org/apache/asterix/runtime/evaluators/constructors/ARectangleConstructorDescriptor.java
+++ b/asterixdb/asterix-runtime/src/main/java/org/apache/asterix/runtime/evaluators/constructors/ARectangleConstructorDescriptor.java
@@ -77,13 +77,16 @@
                     @Override
                     public void evaluate(IFrameTupleReference tuple, IPointable result) throws HyracksDataException {
                         try {
-                            resultStorage.reset();
                             eval.evaluate(tuple, inputArg);
                             byte[] serString = inputArg.getByteArray();
                             int offset = inputArg.getStartOffset();
                             int len = inputArg.getLength();
 
-                            if (serString[offset] == ATypeTag.SERIALIZED_STRING_TYPE_TAG) {
+                            byte tt = serString[offset];
+                            if (tt == ATypeTag.SERIALIZED_RECTANGLE_TYPE_TAG) {
+                                result.set(inputArg);
+                            } else if (tt == ATypeTag.SERIALIZED_STRING_TYPE_TAG) {
+                                resultStorage.reset();
                                 utf8Ptr.set(serString, offset + 1, len - 1);
                                 String s = utf8Ptr.toString();
                                 int commaIndex = s.indexOf(',');
@@ -102,11 +105,11 @@
                                             ATypeTag.SERIALIZED_RECTANGLE_TYPE_TAG);
                                 }
                                 rectangle2DSerde.serialize(aRectangle, out);
+                                result.set(resultStorage);
                             } else {
-                                throw new TypeMismatchException(getIdentifier(), 0, serString[offset],
+                                throw new TypeMismatchException(getIdentifier(), 0, tt,
                                         ATypeTag.SERIALIZED_STRING_TYPE_TAG);
                             }
-                            result.set(resultStorage);
                         } catch (IOException e) {
                             throw new InvalidDataFormatException(getIdentifier(), e,
                                     ATypeTag.SERIALIZED_RECTANGLE_TYPE_TAG);
diff --git a/asterixdb/asterix-runtime/src/main/java/org/apache/asterix/runtime/evaluators/constructors/AStringConstructorDescriptor.java b/asterixdb/asterix-runtime/src/main/java/org/apache/asterix/runtime/evaluators/constructors/AStringConstructorDescriptor.java
index 681ff16..3c59c4c 100644
--- a/asterixdb/asterix-runtime/src/main/java/org/apache/asterix/runtime/evaluators/constructors/AStringConstructorDescriptor.java
+++ b/asterixdb/asterix-runtime/src/main/java/org/apache/asterix/runtime/evaluators/constructors/AStringConstructorDescriptor.java
@@ -76,8 +76,6 @@
                     @Override
                     public void evaluate(IFrameTupleReference tuple, IPointable result) throws HyracksDataException {
                         try {
-                            resultStorage.reset();
-                            baaos.reset();
                             eval.evaluate(tuple, inputArg);
                             byte[] serString = inputArg.getByteArray();
                             int offset = inputArg.getStartOffset();
@@ -87,6 +85,8 @@
                             if (tt == ATypeTag.STRING) {
                                 result.set(inputArg);
                             } else {
+                                resultStorage.reset();
+                                baaos.reset();
                                 builder.reset(baaos, len);
                                 int startOffset = offset + 1;
                                 switch (tt) {
diff --git a/asterixdb/asterix-runtime/src/main/java/org/apache/asterix/runtime/evaluators/constructors/ATimeConstructorDescriptor.java b/asterixdb/asterix-runtime/src/main/java/org/apache/asterix/runtime/evaluators/constructors/ATimeConstructorDescriptor.java
index 031dbad..56f6e38 100644
--- a/asterixdb/asterix-runtime/src/main/java/org/apache/asterix/runtime/evaluators/constructors/ATimeConstructorDescriptor.java
+++ b/asterixdb/asterix-runtime/src/main/java/org/apache/asterix/runtime/evaluators/constructors/ATimeConstructorDescriptor.java
@@ -77,13 +77,16 @@
                     @Override
                     public void evaluate(IFrameTupleReference tuple, IPointable result) throws HyracksDataException {
                         try {
-                            resultStorage.reset();
                             eval.evaluate(tuple, inputArg);
                             byte[] serString = inputArg.getByteArray();
                             int offset = inputArg.getStartOffset();
                             int len = inputArg.getLength();
 
-                            if (serString[offset] == ATypeTag.SERIALIZED_STRING_TYPE_TAG) {
+                            byte tt = serString[offset];
+                            if (tt == ATypeTag.SERIALIZED_TIME_TYPE_TAG) {
+                                result.set(inputArg);
+                            } else if (tt == ATypeTag.SERIALIZED_STRING_TYPE_TAG) {
+                                resultStorage.reset();
                                 utf8Ptr.set(serString, offset + 1, len - 1);
                                 int stringLength = utf8Ptr.getUTF8Length();
                                 int startOffset = utf8Ptr.getCharStartOffset();
@@ -103,11 +106,11 @@
 
                                 aTime.setValue(chrononTimeInMs);
                                 timeSerde.serialize(aTime, out);
+                                result.set(resultStorage);
                             } else {
-                                throw new TypeMismatchException(getIdentifier(), 0, serString[offset],
+                                throw new TypeMismatchException(getIdentifier(), 0, tt,
                                         ATypeTag.SERIALIZED_STRING_TYPE_TAG);
                             }
-                            result.set(resultStorage);
                         } catch (IOException e) {
                             throw new InvalidDataFormatException(getIdentifier(), e,
                                     ATypeTag.SERIALIZED_POLYGON_TYPE_TAG);
diff --git a/asterixdb/asterix-runtime/src/main/java/org/apache/asterix/runtime/evaluators/constructors/AUUIDFromStringConstructorDescriptor.java b/asterixdb/asterix-runtime/src/main/java/org/apache/asterix/runtime/evaluators/constructors/AUUIDFromStringConstructorDescriptor.java
index a9b1f88..64b9278 100644
--- a/asterixdb/asterix-runtime/src/main/java/org/apache/asterix/runtime/evaluators/constructors/AUUIDFromStringConstructorDescriptor.java
+++ b/asterixdb/asterix-runtime/src/main/java/org/apache/asterix/runtime/evaluators/constructors/AUUIDFromStringConstructorDescriptor.java
@@ -73,31 +73,35 @@
                     private IScalarEvaluator eval = args[0].createScalarEvaluator(ctx);
                     private AMutableUUID uuid = new AMutableUUID();
                     @SuppressWarnings("unchecked")
-                    private ISerializerDeserializer<AUUID> uuidSerde = SerializerDeserializerProvider.INSTANCE
-                            .getSerializerDeserializer(BuiltinType.AUUID);
+                    private ISerializerDeserializer<AUUID> uuidSerde =
+                            SerializerDeserializerProvider.INSTANCE.getSerializerDeserializer(BuiltinType.AUUID);
 
                     private final UTF8StringPointable utf8Ptr = new UTF8StringPointable();
 
                     @Override
                     public void evaluate(IFrameTupleReference tuple, IPointable result) throws HyracksDataException {
                         try {
-                            resultStorage.reset();
                             eval.evaluate(tuple, inputArg);
                             byte[] serString = inputArg.getByteArray();
                             int start = inputArg.getStartOffset();
                             int len = inputArg.getLength();
-                            if (serString[start] == ATypeTag.SERIALIZED_STRING_TYPE_TAG) {
+
+                            byte tt = serString[start];
+                            if (tt == ATypeTag.SERIALIZED_UUID_TYPE_TAG) {
+                                result.set(inputArg);
+                            } else if (tt == ATypeTag.SERIALIZED_STRING_TYPE_TAG) {
+                                resultStorage.reset();
                                 utf8Ptr.set(serString, start + 1, len - 1);
 
                                 // first byte: tag, next x bytes: length
                                 int offset = utf8Ptr.getCharStartOffset();
                                 uuid.parseUUIDHexBytes(serString, offset);
                                 uuidSerde.serialize(uuid, out);
+                                result.set(resultStorage);
                             } else {
-                                throw new TypeMismatchException(getIdentifier(), 0, serString[start],
+                                throw new TypeMismatchException(getIdentifier(), 0, tt,
                                         ATypeTag.SERIALIZED_STRING_TYPE_TAG);
                             }
-                            result.set(resultStorage);
                         } catch (IOException e) {
                             throw new InvalidDataFormatException(getIdentifier(), e, ATypeTag.SERIALIZED_UUID_TYPE_TAG);
                         }
diff --git a/asterixdb/asterix-runtime/src/main/java/org/apache/asterix/runtime/evaluators/constructors/AYearMonthDurationConstructorDescriptor.java b/asterixdb/asterix-runtime/src/main/java/org/apache/asterix/runtime/evaluators/constructors/AYearMonthDurationConstructorDescriptor.java
index f7095bc..b95d512 100644
--- a/asterixdb/asterix-runtime/src/main/java/org/apache/asterix/runtime/evaluators/constructors/AYearMonthDurationConstructorDescriptor.java
+++ b/asterixdb/asterix-runtime/src/main/java/org/apache/asterix/runtime/evaluators/constructors/AYearMonthDurationConstructorDescriptor.java
@@ -19,6 +19,7 @@
 package org.apache.asterix.runtime.evaluators.constructors;
 
 import java.io.DataOutput;
+import java.io.IOException;
 
 import org.apache.asterix.formats.nontagged.SerializerDeserializerProvider;
 import org.apache.asterix.om.base.AMutableYearMonthDuration;
@@ -78,24 +79,27 @@
                     @Override
                     public void evaluate(IFrameTupleReference tuple, IPointable result) throws HyracksDataException {
                         try {
-                            resultStorage.reset();
                             eval.evaluate(tuple, inputArg);
                             byte[] serString = inputArg.getByteArray();
                             int offset = inputArg.getStartOffset();
                             int len = inputArg.getLength();
 
-                            if (serString[offset] == ATypeTag.SERIALIZED_STRING_TYPE_TAG) {
+                            byte tt = serString[offset];
+                            if (tt == ATypeTag.SERIALIZED_YEAR_MONTH_DURATION_TYPE_TAG) {
+                                result.set(inputArg);
+                            } else if (tt == ATypeTag.SERIALIZED_STRING_TYPE_TAG) {
+                                resultStorage.reset();
                                 utf8Ptr.set(serString, offset + 1, len - 1);
                                 int stringLength = utf8Ptr.getUTF8Length();
                                 ADurationParserFactory.parseDuration(serString, utf8Ptr.getCharStartOffset(),
                                         stringLength, aYearMonthDuration, ADurationParseOption.YEAR_MONTH);
                                 yearMonthDurationSerde.serialize(aYearMonthDuration, out);
+                                result.set(resultStorage);
                             } else {
-                                throw new TypeMismatchException(getIdentifier(), 0, serString[offset],
+                                throw new TypeMismatchException(getIdentifier(), 0, tt,
                                         ATypeTag.SERIALIZED_STRING_TYPE_TAG);
                             }
-                            result.set(resultStorage);
-                        } catch (Exception e) {
+                        } catch (IOException e) {
                             throw new InvalidDataFormatException(getIdentifier(), e,
                                     ATypeTag.SERIALIZED_YEAR_MONTH_DURATION_TYPE_TAG);
                         }

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

Gerrit-MessageType: merged
Gerrit-Change-Id: I4a6627bfcc302b2621df8d7837c15434970b9d3a
Gerrit-PatchSet: 2
Gerrit-Project: asterixdb
Gerrit-Branch: master
Gerrit-Owner: Dmitry Lychagin <dmitry.lychagin@couchbase.com>
Gerrit-Reviewer: Jenkins <jenkins@fulliautomatix.ics.uci.edu>
Gerrit-Reviewer: Till Westmann <tillw@apache.org>
Gerrit-Reviewer: Yingyi Bu <buyingyi@gmail.com>

Mime
View raw message