You are viewing a plain text version of this content. The canonical link for it is here.
Posted to notifications@asterixdb.apache.org by AsterixDB Code Review <do...@asterix-gerrit.ics.uci.edu> on 2021/11/11 04:26:55 UTC

Change in asterixdb[master]: [NO ISSUE][FUN] Add cast-null functions for constructors

From Ali Alsuliman <al...@gmail.com>:

Ali Alsuliman has uploaded this change for review. ( https://asterix-gerrit.ics.uci.edu/c/asterixdb/+/14027 )


Change subject: [NO ISSUE][FUN] Add cast-null functions for constructors
......................................................................

[NO ISSUE][FUN] Add cast-null functions for constructors

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

Details:
- Add cast-null type constructors that produce null for missing input.
- Make views use these types of constructors.
- Make secondary indexes with CAST (DEFAULT NULL) modifier use
  these types of constructors.

Change-Id: I120d18c4c7bbcf098fceaa6784cce265a2811e3b
---
M asterixdb/asterix-algebra/src/main/java/org/apache/asterix/optimizer/rules/IntroduceSecondaryIndexInsertDeleteRule.java
M asterixdb/asterix-app/src/test/resources/runtimets/testsuite_sqlpp.xml
M asterixdb/asterix-lang-sqlpp/src/main/java/org/apache/asterix/lang/sqlpp/rewrites/SqlppFunctionBodyRewriter.java
M asterixdb/asterix-metadata/src/main/java/org/apache/asterix/metadata/utils/SecondaryBTreeOperationsHelper.java
M asterixdb/asterix-metadata/src/main/java/org/apache/asterix/metadata/utils/TypeUtil.java
M asterixdb/asterix-om/src/main/java/org/apache/asterix/om/functions/BuiltinFunctions.java
A asterixdb/asterix-runtime/src/main/java/org/apache/asterix/runtime/evaluators/constructors/ABinaryBase64StringCastNullConstructorDescriptor.java
M asterixdb/asterix-runtime/src/main/java/org/apache/asterix/runtime/evaluators/constructors/ABinaryBase64StringConstructorDescriptor.java
A asterixdb/asterix-runtime/src/main/java/org/apache/asterix/runtime/evaluators/constructors/ABooleanCastNullConstructorDescriptor.java
A asterixdb/asterix-runtime/src/main/java/org/apache/asterix/runtime/evaluators/constructors/ADateCastNullConstructorDescriptor.java
A asterixdb/asterix-runtime/src/main/java/org/apache/asterix/runtime/evaluators/constructors/ADateCastNullConstructorWithFormatDescriptor.java
M asterixdb/asterix-runtime/src/main/java/org/apache/asterix/runtime/evaluators/constructors/ADateConstructorWithFormatDescriptor.java
A asterixdb/asterix-runtime/src/main/java/org/apache/asterix/runtime/evaluators/constructors/ADateTimeCastNullConstructorDescriptor.java
A asterixdb/asterix-runtime/src/main/java/org/apache/asterix/runtime/evaluators/constructors/ADateTimeCastNullConstructorWithFormatDescriptor.java
M asterixdb/asterix-runtime/src/main/java/org/apache/asterix/runtime/evaluators/constructors/ADateTimeConstructorWithFormatDescriptor.java
A asterixdb/asterix-runtime/src/main/java/org/apache/asterix/runtime/evaluators/constructors/ADayTimeDurationCastNullConstructorDescriptor.java
M asterixdb/asterix-runtime/src/main/java/org/apache/asterix/runtime/evaluators/constructors/ADayTimeDurationConstructorDescriptor.java
A asterixdb/asterix-runtime/src/main/java/org/apache/asterix/runtime/evaluators/constructors/ADoubleCastNullConstructorDescriptor.java
A asterixdb/asterix-runtime/src/main/java/org/apache/asterix/runtime/evaluators/constructors/ADurationCastNullConstructorDescriptor.java
M asterixdb/asterix-runtime/src/main/java/org/apache/asterix/runtime/evaluators/constructors/ADurationConstructorDescriptor.java
A asterixdb/asterix-runtime/src/main/java/org/apache/asterix/runtime/evaluators/constructors/AFloatCastNullConstructorDescriptor.java
M asterixdb/asterix-runtime/src/main/java/org/apache/asterix/runtime/evaluators/constructors/AFloatConstructorDescriptor.java
A asterixdb/asterix-runtime/src/main/java/org/apache/asterix/runtime/evaluators/constructors/AInt16CastNullConstructorDescriptor.java
M asterixdb/asterix-runtime/src/main/java/org/apache/asterix/runtime/evaluators/constructors/AInt16ConstructorDescriptor.java
A asterixdb/asterix-runtime/src/main/java/org/apache/asterix/runtime/evaluators/constructors/AInt32CastNullConstructorDescriptor.java
M asterixdb/asterix-runtime/src/main/java/org/apache/asterix/runtime/evaluators/constructors/AInt32ConstructorDescriptor.java
A asterixdb/asterix-runtime/src/main/java/org/apache/asterix/runtime/evaluators/constructors/AInt64CastNullConstructorDescriptor.java
A asterixdb/asterix-runtime/src/main/java/org/apache/asterix/runtime/evaluators/constructors/AInt8CastNullConstructorDescriptor.java
M asterixdb/asterix-runtime/src/main/java/org/apache/asterix/runtime/evaluators/constructors/AInt8ConstructorDescriptor.java
A asterixdb/asterix-runtime/src/main/java/org/apache/asterix/runtime/evaluators/constructors/AStringCastNullConstructorDescriptor.java
A asterixdb/asterix-runtime/src/main/java/org/apache/asterix/runtime/evaluators/constructors/ATimeCastNullConstructorDescriptor.java
A asterixdb/asterix-runtime/src/main/java/org/apache/asterix/runtime/evaluators/constructors/ATimeCastNullConstructorWithFormatDescriptor.java
M asterixdb/asterix-runtime/src/main/java/org/apache/asterix/runtime/evaluators/constructors/ATimeConstructorWithFormatDescriptor.java
A asterixdb/asterix-runtime/src/main/java/org/apache/asterix/runtime/evaluators/constructors/AUUIDFromStringCastNullConstructorDescriptor.java
M asterixdb/asterix-runtime/src/main/java/org/apache/asterix/runtime/evaluators/constructors/AUUIDFromStringConstructorDescriptor.java
A asterixdb/asterix-runtime/src/main/java/org/apache/asterix/runtime/evaluators/constructors/AYearMonthDurationCastNullConstructorDescriptor.java
M asterixdb/asterix-runtime/src/main/java/org/apache/asterix/runtime/evaluators/constructors/AYearMonthDurationConstructorDescriptor.java
A asterixdb/asterix-runtime/src/main/java/org/apache/asterix/runtime/evaluators/constructors/AbstractDateConstructorWithFormatEvaluator.java
A asterixdb/asterix-runtime/src/main/java/org/apache/asterix/runtime/evaluators/constructors/AbstractDateTimeConstructorWithFormatEvaluator.java
A asterixdb/asterix-runtime/src/main/java/org/apache/asterix/runtime/evaluators/constructors/AbstractDayTimeDurationConstructorEvaluator.java
A asterixdb/asterix-runtime/src/main/java/org/apache/asterix/runtime/evaluators/constructors/AbstractDurationConstructorEvaluator.java
A asterixdb/asterix-runtime/src/main/java/org/apache/asterix/runtime/evaluators/constructors/AbstractFloatConstructorEvaluator.java
A asterixdb/asterix-runtime/src/main/java/org/apache/asterix/runtime/evaluators/constructors/AbstractInt16ConstructorEvaluator.java
A asterixdb/asterix-runtime/src/main/java/org/apache/asterix/runtime/evaluators/constructors/AbstractInt32ConstructorEvaluator.java
A asterixdb/asterix-runtime/src/main/java/org/apache/asterix/runtime/evaluators/constructors/AbstractInt8ConstructorEvaluator.java
A asterixdb/asterix-runtime/src/main/java/org/apache/asterix/runtime/evaluators/constructors/AbstractTimeWithFormatConstructorEvaluator.java
A asterixdb/asterix-runtime/src/main/java/org/apache/asterix/runtime/evaluators/constructors/AbstractUUIDFromStringConstructorEvaluator.java
A asterixdb/asterix-runtime/src/main/java/org/apache/asterix/runtime/evaluators/constructors/AbstractYearMonthDurationConstructorEvaluator.java
M asterixdb/asterix-runtime/src/main/java/org/apache/asterix/runtime/evaluators/functions/PointableHelper.java
M asterixdb/asterix-runtime/src/main/java/org/apache/asterix/runtime/functions/FunctionCollection.java
50 files changed, 2,555 insertions(+), 804 deletions(-)



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

diff --git a/asterixdb/asterix-algebra/src/main/java/org/apache/asterix/optimizer/rules/IntroduceSecondaryIndexInsertDeleteRule.java b/asterixdb/asterix-algebra/src/main/java/org/apache/asterix/optimizer/rules/IntroduceSecondaryIndexInsertDeleteRule.java
index bf5ef28..699fc18 100644
--- a/asterixdb/asterix-algebra/src/main/java/org/apache/asterix/optimizer/rules/IntroduceSecondaryIndexInsertDeleteRule.java
+++ b/asterixdb/asterix-algebra/src/main/java/org/apache/asterix/optimizer/rules/IntroduceSecondaryIndexInsertDeleteRule.java
@@ -895,16 +895,9 @@
             throw new CompilationException(ErrorCode.COMPILATION_TYPE_UNSUPPORTED, sourceLoc, "index",
                     requiredType.getTypeName());
         }
-        // make CONSTRUCTOR(IF_MISSING(input, NULL))
-        BuiltinFunctionInfo ifMissingInfo = BuiltinFunctions.getBuiltinFunctionInfo(BuiltinFunctions.IF_MISSING);
-        ScalarFunctionCallExpression ifMissingExpr = new ScalarFunctionCallExpression(ifMissingInfo);
-        ifMissingExpr.getArguments().add(new MutableObject<>(inputExpr));
-        ifMissingExpr.getArguments().add(new MutableObject<>(ConstantExpression.NULL));
-        ifMissingExpr.setSourceLocation(sourceLoc);
-
         BuiltinFunctionInfo typeConstructorInfo = BuiltinFunctions.getBuiltinFunctionInfo(typeConstructorFun);
         ScalarFunctionCallExpression constructorExpr = new ScalarFunctionCallExpression(typeConstructorInfo);
-        constructorExpr.getArguments().add(new MutableObject<>(ifMissingExpr));
+        constructorExpr.getArguments().add(new MutableObject<>(inputExpr));
         constructorExpr.setSourceLocation(sourceLoc);
         return constructorExpr;
     }
diff --git a/asterixdb/asterix-app/src/test/resources/runtimets/testsuite_sqlpp.xml b/asterixdb/asterix-app/src/test/resources/runtimets/testsuite_sqlpp.xml
index 77f412c..a32d27d 100644
--- a/asterixdb/asterix-app/src/test/resources/runtimets/testsuite_sqlpp.xml
+++ b/asterixdb/asterix-app/src/test/resources/runtimets/testsuite_sqlpp.xml
@@ -13324,19 +13324,19 @@
         <expected-warn>ASX0006: Invalid format for duration in k (in line 30, at column 6)</expected-warn>
         <expected-warn>ASX0006: Invalid format for yearmonthduration in m (in line 30, at column 6)</expected-warn>
         <expected-warn>ASX0006: Invalid format for daytimeduration in n (in line 30, at column 6)</expected-warn>
-        <expected-warn>ASX0004: Unsupported type: boolean() cannot process input type duration (in line 30, at column 6)</expected-warn>
-        <expected-warn>ASX0004: Unsupported type: int8() cannot process input type duration (in line 30, at column 6)</expected-warn>
-        <expected-warn>ASX0004: Unsupported type: int16() cannot process input type duration (in line 30, at column 6)</expected-warn>
-        <expected-warn>ASX0004: Unsupported type: int32() cannot process input type duration (in line 30, at column 6)</expected-warn>
-        <expected-warn>ASX0004: Unsupported type: int64() cannot process input type duration (in line 30, at column 6)</expected-warn>
-        <expected-warn>ASX0004: Unsupported type: float() cannot process input type duration (in line 30, at column 6)</expected-warn>
-        <expected-warn>ASX0004: Unsupported type: double() cannot process input type duration (in line 30, at column 6)</expected-warn>
-        <expected-warn>ASX0004: Unsupported type: datetime() cannot process input type duration (in line 30, at column 6)</expected-warn>
-        <expected-warn>ASX0004: Unsupported type: date() cannot process input type duration (in line 30, at column 6)</expected-warn>
-        <expected-warn>ASX0004: Unsupported type: time() cannot process input type duration (in line 30, at column 6)</expected-warn>
-        <expected-warn>ASX0004: Unsupported type: duration() cannot process input type date (in line 30, at column 6)</expected-warn>
-        <expected-warn>ASX0004: Unsupported type: year-month-duration() cannot process input type date (in line 30, at column 6)</expected-warn>
-        <expected-warn>ASX0004: Unsupported type: day-time-duration() cannot process input type date (in line 30, at column 6)</expected-warn>
+        <expected-warn>ASX0004: Unsupported type: boolean-cast-null() cannot process input type duration (in line 30, at column 6)</expected-warn>
+        <expected-warn>ASX0004: Unsupported type: int8-cast-null() cannot process input type duration (in line 30, at column 6)</expected-warn>
+        <expected-warn>ASX0004: Unsupported type: int16-cast-null() cannot process input type duration (in line 30, at column 6)</expected-warn>
+        <expected-warn>ASX0004: Unsupported type: int32-cast-null() cannot process input type duration (in line 30, at column 6)</expected-warn>
+        <expected-warn>ASX0004: Unsupported type: int64-cast-null() cannot process input type duration (in line 30, at column 6)</expected-warn>
+        <expected-warn>ASX0004: Unsupported type: float-cast-null() cannot process input type duration (in line 30, at column 6)</expected-warn>
+        <expected-warn>ASX0004: Unsupported type: double-cast-null() cannot process input type duration (in line 30, at column 6)</expected-warn>
+        <expected-warn>ASX0004: Unsupported type: datetime-cast-null() cannot process input type duration (in line 30, at column 6)</expected-warn>
+        <expected-warn>ASX0004: Unsupported type: date-cast-null() cannot process input type duration (in line 30, at column 6)</expected-warn>
+        <expected-warn>ASX0004: Unsupported type: time-cast-null() cannot process input type duration (in line 30, at column 6)</expected-warn>
+        <expected-warn>ASX0004: Unsupported type: duration-cast-null() cannot process input type date (in line 30, at column 6)</expected-warn>
+        <expected-warn>ASX0004: Unsupported type: year-month-duration-cast-null() cannot process input type date (in line 30, at column 6)</expected-warn>
+        <expected-warn>ASX0004: Unsupported type: day-time-duration-cast-null() cannot process input type date (in line 30, at column 6)</expected-warn>
       </compilation-unit>
     </test-case>
     <test-case FilePath="view" check-warnings="true">
diff --git a/asterixdb/asterix-lang-sqlpp/src/main/java/org/apache/asterix/lang/sqlpp/rewrites/SqlppFunctionBodyRewriter.java b/asterixdb/asterix-lang-sqlpp/src/main/java/org/apache/asterix/lang/sqlpp/rewrites/SqlppFunctionBodyRewriter.java
index 868469b..557f17d 100644
--- a/asterixdb/asterix-lang-sqlpp/src/main/java/org/apache/asterix/lang/sqlpp/rewrites/SqlppFunctionBodyRewriter.java
+++ b/asterixdb/asterix-lang-sqlpp/src/main/java/org/apache/asterix/lang/sqlpp/rewrites/SqlppFunctionBodyRewriter.java
@@ -173,7 +173,6 @@
                 primeType = fieldType;
             }
             Expression expr = ViewUtil.createFieldAccessExpression(fromVar, fieldName, sourceLoc);
-            expr = ViewUtil.createMissingToNullExpression(expr, sourceLoc); // Default Null handling
             Expression projectExpr =
                     ViewUtil.createTypeConvertExpression(expr, primeType, temporalDataFormat, viewName, sourceLoc);
             VarIdentifier projectVar = context.newVariable();
diff --git a/asterixdb/asterix-metadata/src/main/java/org/apache/asterix/metadata/utils/SecondaryBTreeOperationsHelper.java b/asterixdb/asterix-metadata/src/main/java/org/apache/asterix/metadata/utils/SecondaryBTreeOperationsHelper.java
index 61c2df8..2095a3b 100644
--- a/asterixdb/asterix-metadata/src/main/java/org/apache/asterix/metadata/utils/SecondaryBTreeOperationsHelper.java
+++ b/asterixdb/asterix-metadata/src/main/java/org/apache/asterix/metadata/utils/SecondaryBTreeOperationsHelper.java
@@ -31,7 +31,6 @@
 import org.apache.asterix.metadata.entities.Dataset;
 import org.apache.asterix.metadata.entities.Index;
 import org.apache.asterix.metadata.entities.InternalDatasetDetails;
-import org.apache.asterix.om.functions.BuiltinFunctions;
 import org.apache.asterix.om.functions.IFunctionDescriptor;
 import org.apache.asterix.om.functions.IFunctionManager;
 import org.apache.asterix.om.typecomputer.impl.TypeComputeUtils;
@@ -41,7 +40,6 @@
 import org.apache.asterix.runtime.utils.RuntimeUtils;
 import org.apache.hyracks.algebricks.common.exceptions.AlgebricksException;
 import org.apache.hyracks.algebricks.common.utils.Pair;
-import org.apache.hyracks.algebricks.core.algebra.expressions.ConstantExpression;
 import org.apache.hyracks.algebricks.core.algebra.functions.FunctionIdentifier;
 import org.apache.hyracks.algebricks.core.jobgen.impl.ConnectorPolicyAssignmentPolicy;
 import org.apache.hyracks.algebricks.data.IBinaryComparatorFactoryProvider;
@@ -315,7 +313,7 @@
 
         IScalarEvaluatorFactory castFieldEvalFactory;
         if (IndexUtil.castDefaultNull(index)) {
-            castFieldEvalFactory = createConstructorFunction(funManger, dataFormat, fieldEvalFactory, fieldType);
+            castFieldEvalFactory = createConstructorFunction(funManger, fieldEvalFactory, fieldType);
         } else if (index.isEnforced()) {
             IScalarEvaluatorFactory[] castArg = new IScalarEvaluatorFactory[] { fieldEvalFactory };
             castFieldEvalFactory =
@@ -328,14 +326,8 @@
         return castFieldEvalFactory;
     }
 
-    private IScalarEvaluatorFactory createConstructorFunction(IFunctionManager funManager, IDataFormat dataFormat,
+    private IScalarEvaluatorFactory createConstructorFunction(IFunctionManager funManager,
             IScalarEvaluatorFactory fieldEvalFactory, IAType fieldType) throws AlgebricksException {
-        // make CONSTRUCTOR(IF_MISSING(field_access, NULL))
-        IFunctionDescriptor ifMissing = funManager.lookupFunction(BuiltinFunctions.IF_MISSING, sourceLoc);
-        IScalarEvaluatorFactory nullEvalFactory = dataFormat.getConstantEvalFactory(ConstantExpression.NULL.getValue());
-        IScalarEvaluatorFactory[] ifMissingArgs = new IScalarEvaluatorFactory[] { fieldEvalFactory, nullEvalFactory };
-        ifMissing.setSourceLocation(sourceLoc);
-        IScalarEvaluatorFactory ifMissingEvalFactory = ifMissing.createEvaluatorFactory(ifMissingArgs);
         FunctionIdentifier typeConstructorFun = TypeUtil.getTypeConstructor(TypeComputeUtils.getActualType(fieldType));
         if (typeConstructorFun == null) {
             throw new CompilationException(ErrorCode.COMPILATION_TYPE_UNSUPPORTED, sourceLoc, "index",
@@ -343,7 +335,7 @@
         }
         IFunctionDescriptor typeConstructor = funManager.lookupFunction(typeConstructorFun, sourceLoc);
         typeConstructor.setSourceLocation(sourceLoc);
-        return typeConstructor.createEvaluatorFactory(new IScalarEvaluatorFactory[] { ifMissingEvalFactory });
+        return typeConstructor.createEvaluatorFactory(new IScalarEvaluatorFactory[] { fieldEvalFactory });
     }
 
     private int[] createFieldPermutationForBulkLoadOp(int numSecondaryKeyFields) {
diff --git a/asterixdb/asterix-metadata/src/main/java/org/apache/asterix/metadata/utils/TypeUtil.java b/asterixdb/asterix-metadata/src/main/java/org/apache/asterix/metadata/utils/TypeUtil.java
index 661ad0b..0a12d88 100644
--- a/asterixdb/asterix-metadata/src/main/java/org/apache/asterix/metadata/utils/TypeUtil.java
+++ b/asterixdb/asterix-metadata/src/main/java/org/apache/asterix/metadata/utils/TypeUtil.java
@@ -62,53 +62,63 @@
     private TypeUtil() {
     }
 
+    /**
+     * @param type type
+     *
+     * @return a type constructor that produces NULL for MISSING input
+     */
     public static FunctionIdentifier getTypeConstructor(IAType type) {
         switch (type.getTypeTag()) {
             case TINYINT:
-                return BuiltinFunctions.INT8_CONSTRUCTOR;
+                return BuiltinFunctions.INT8_CAST_NULL_CONSTRUCTOR;
             case SMALLINT:
-                return BuiltinFunctions.INT16_CONSTRUCTOR;
+                return BuiltinFunctions.INT16_CAST_NULL_CONSTRUCTOR;
             case INTEGER:
-                return BuiltinFunctions.INT32_CONSTRUCTOR;
+                return BuiltinFunctions.INT32_CAST_NULL_CONSTRUCTOR;
             case BIGINT:
-                return BuiltinFunctions.INT64_CONSTRUCTOR;
+                return BuiltinFunctions.INT64_CAST_NULL_CONSTRUCTOR;
             case FLOAT:
-                return BuiltinFunctions.FLOAT_CONSTRUCTOR;
+                return BuiltinFunctions.FLOAT_CAST_NULL_CONSTRUCTOR;
             case DOUBLE:
-                return BuiltinFunctions.DOUBLE_CONSTRUCTOR;
+                return BuiltinFunctions.DOUBLE_CAST_NULL_CONSTRUCTOR;
             case BOOLEAN:
-                return BuiltinFunctions.BOOLEAN_CONSTRUCTOR;
+                return BuiltinFunctions.BOOLEAN_CAST_NULL_CONSTRUCTOR;
             case STRING:
-                return BuiltinFunctions.STRING_CONSTRUCTOR;
+                return BuiltinFunctions.STRING_CAST_NULL_CONSTRUCTOR;
             case DATE:
-                return BuiltinFunctions.DATE_CONSTRUCTOR;
+                return BuiltinFunctions.DATE_CAST_NULL_CONSTRUCTOR;
             case TIME:
-                return BuiltinFunctions.TIME_CONSTRUCTOR;
+                return BuiltinFunctions.TIME_CAST_NULL_CONSTRUCTOR;
             case DATETIME:
-                return BuiltinFunctions.DATETIME_CONSTRUCTOR;
+                return BuiltinFunctions.DATETIME_CAST_NULL_CONSTRUCTOR;
             case YEARMONTHDURATION:
-                return BuiltinFunctions.YEAR_MONTH_DURATION_CONSTRUCTOR;
+                return BuiltinFunctions.YEAR_MONTH_DURATION_CAST_NULL_CONSTRUCTOR;
             case DAYTIMEDURATION:
-                return BuiltinFunctions.DAY_TIME_DURATION_CONSTRUCTOR;
+                return BuiltinFunctions.DAY_TIME_DURATION_CAST_NULL_CONSTRUCTOR;
             case DURATION:
-                return BuiltinFunctions.DURATION_CONSTRUCTOR;
+                return BuiltinFunctions.DURATION_CAST_NULL_CONSTRUCTOR;
             case UUID:
-                return BuiltinFunctions.UUID_CONSTRUCTOR;
+                return BuiltinFunctions.UUID_CAST_NULL_CONSTRUCTOR;
             case BINARY:
-                return BuiltinFunctions.BINARY_BASE64_CONSTRUCTOR;
+                return BuiltinFunctions.BINARY_BASE64_CAST_NULL_CONSTRUCTOR;
             default:
                 return null;
         }
     }
 
+    /**
+     * @param type type
+     *
+     * @return a type constructor that produces NULL for MISSING input
+     */
     public static FunctionIdentifier getTypeConstructorWithFormat(IAType type) {
         switch (type.getTypeTag()) {
             case DATE:
-                return BuiltinFunctions.DATE_CONSTRUCTOR_WITH_FORMAT;
+                return BuiltinFunctions.DATE_CAST_NULL_CONSTRUCTOR_WITH_FORMAT;
             case TIME:
-                return BuiltinFunctions.TIME_CONSTRUCTOR_WITH_FORMAT;
+                return BuiltinFunctions.TIME_CAST_NULL_CONSTRUCTOR_WITH_FORMAT;
             case DATETIME:
-                return BuiltinFunctions.DATETIME_CONSTRUCTOR_WITH_FORMAT;
+                return BuiltinFunctions.DATETIME_CAST_NULL_CONSTRUCTOR_WITH_FORMAT;
             default:
                 return null;
         }
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 c452c9a..5b8dc67 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
@@ -1115,24 +1115,42 @@
     // constructors:
     public static final FunctionIdentifier BOOLEAN_CONSTRUCTOR =
             new FunctionIdentifier(FunctionConstants.ASTERIX_NS, "boolean", 1);
+    public static final FunctionIdentifier BOOLEAN_CAST_NULL_CONSTRUCTOR =
+            new FunctionIdentifier(FunctionConstants.ASTERIX_NS, "boolean-cast-null", 1);
     public static final FunctionIdentifier STRING_CONSTRUCTOR =
             new FunctionIdentifier(FunctionConstants.ASTERIX_NS, "string", 1);
+    public static final FunctionIdentifier STRING_CAST_NULL_CONSTRUCTOR =
+            new FunctionIdentifier(FunctionConstants.ASTERIX_NS, "string-cast-null", 1);
     public static final FunctionIdentifier BINARY_HEX_CONSTRUCTOR =
             new FunctionIdentifier(FunctionConstants.ASTERIX_NS, "hex", 1);
     public static final FunctionIdentifier BINARY_BASE64_CONSTRUCTOR =
             new FunctionIdentifier(FunctionConstants.ASTERIX_NS, "base64", 1);
+    public static final FunctionIdentifier BINARY_BASE64_CAST_NULL_CONSTRUCTOR =
+            new FunctionIdentifier(FunctionConstants.ASTERIX_NS, "base64-cast-null", 1);
     public static final FunctionIdentifier INT8_CONSTRUCTOR =
             new FunctionIdentifier(FunctionConstants.ASTERIX_NS, "int8", 1);
+    public static final FunctionIdentifier INT8_CAST_NULL_CONSTRUCTOR =
+            new FunctionIdentifier(FunctionConstants.ASTERIX_NS, "int8-cast-null", 1);
     public static final FunctionIdentifier INT16_CONSTRUCTOR =
             new FunctionIdentifier(FunctionConstants.ASTERIX_NS, "int16", 1);
+    public static final FunctionIdentifier INT16_CAST_NULL_CONSTRUCTOR =
+            new FunctionIdentifier(FunctionConstants.ASTERIX_NS, "int16-cast-null", 1);
     public static final FunctionIdentifier INT32_CONSTRUCTOR =
             new FunctionIdentifier(FunctionConstants.ASTERIX_NS, "int32", 1);
+    public static final FunctionIdentifier INT32_CAST_NULL_CONSTRUCTOR =
+            new FunctionIdentifier(FunctionConstants.ASTERIX_NS, "int32-cast-null", 1);
     public static final FunctionIdentifier INT64_CONSTRUCTOR =
             new FunctionIdentifier(FunctionConstants.ASTERIX_NS, "int64", 1);
+    public static final FunctionIdentifier INT64_CAST_NULL_CONSTRUCTOR =
+            new FunctionIdentifier(FunctionConstants.ASTERIX_NS, "int64-cast-null", 1);
     public static final FunctionIdentifier FLOAT_CONSTRUCTOR =
             new FunctionIdentifier(FunctionConstants.ASTERIX_NS, "float", 1);
+    public static final FunctionIdentifier FLOAT_CAST_NULL_CONSTRUCTOR =
+            new FunctionIdentifier(FunctionConstants.ASTERIX_NS, "float-cast-null", 1);
     public static final FunctionIdentifier DOUBLE_CONSTRUCTOR =
             new FunctionIdentifier(FunctionConstants.ASTERIX_NS, "double", 1);
+    public static final FunctionIdentifier DOUBLE_CAST_NULL_CONSTRUCTOR =
+            new FunctionIdentifier(FunctionConstants.ASTERIX_NS, "double-cast-null", 1);
     public static final FunctionIdentifier POINT_CONSTRUCTOR =
             new FunctionIdentifier(FunctionConstants.ASTERIX_NS, "point", 1);
     public static final FunctionIdentifier POINT3D_CONSTRUCTOR =
@@ -1147,25 +1165,45 @@
             new FunctionIdentifier(FunctionConstants.ASTERIX_NS, "polygon", 1);
     public static final FunctionIdentifier TIME_CONSTRUCTOR =
             new FunctionIdentifier(FunctionConstants.ASTERIX_NS, "time", 1);
+    public static final FunctionIdentifier TIME_CAST_NULL_CONSTRUCTOR =
+            new FunctionIdentifier(FunctionConstants.ASTERIX_NS, "time-cast-null", 1);
     public static final FunctionIdentifier TIME_CONSTRUCTOR_WITH_FORMAT =
             new FunctionIdentifier(FunctionConstants.ASTERIX_NS, "time", 2);
+    public static final FunctionIdentifier TIME_CAST_NULL_CONSTRUCTOR_WITH_FORMAT =
+            new FunctionIdentifier(FunctionConstants.ASTERIX_NS, "time-cast-null", 2);
     public static final FunctionIdentifier DATE_CONSTRUCTOR =
             new FunctionIdentifier(FunctionConstants.ASTERIX_NS, "date", 1);
+    public static final FunctionIdentifier DATE_CAST_NULL_CONSTRUCTOR =
+            new FunctionIdentifier(FunctionConstants.ASTERIX_NS, "date-cast-null", 1);
     public static final FunctionIdentifier DATE_CONSTRUCTOR_WITH_FORMAT =
             new FunctionIdentifier(FunctionConstants.ASTERIX_NS, "date", 2);
+    public static final FunctionIdentifier DATE_CAST_NULL_CONSTRUCTOR_WITH_FORMAT =
+            new FunctionIdentifier(FunctionConstants.ASTERIX_NS, "date-cast-null", 2);
     public static final FunctionIdentifier DATETIME_CONSTRUCTOR =
             new FunctionIdentifier(FunctionConstants.ASTERIX_NS, "datetime", 1);
+    public static final FunctionIdentifier DATETIME_CAST_NULL_CONSTRUCTOR =
+            new FunctionIdentifier(FunctionConstants.ASTERIX_NS, "datetime-cast-null", 1);
     public static final FunctionIdentifier DATETIME_CONSTRUCTOR_WITH_FORMAT =
             new FunctionIdentifier(FunctionConstants.ASTERIX_NS, "datetime", 2);
+    public static final FunctionIdentifier DATETIME_CAST_NULL_CONSTRUCTOR_WITH_FORMAT =
+            new FunctionIdentifier(FunctionConstants.ASTERIX_NS, "datetime-cast-null", 2);
     public static final FunctionIdentifier DURATION_CONSTRUCTOR =
             new FunctionIdentifier(FunctionConstants.ASTERIX_NS, "duration", 1);
+    public static final FunctionIdentifier DURATION_CAST_NULL_CONSTRUCTOR =
+            new FunctionIdentifier(FunctionConstants.ASTERIX_NS, "duration-cast-null", 1);
     public static final FunctionIdentifier UUID_CONSTRUCTOR =
             new FunctionIdentifier(FunctionConstants.ASTERIX_NS, "uuid", 1);
+    public static final FunctionIdentifier UUID_CAST_NULL_CONSTRUCTOR =
+            new FunctionIdentifier(FunctionConstants.ASTERIX_NS, "uuid-cast-null", 1);
 
     public static final FunctionIdentifier YEAR_MONTH_DURATION_CONSTRUCTOR =
             new FunctionIdentifier(FunctionConstants.ASTERIX_NS, "year-month-duration", 1);
+    public static final FunctionIdentifier YEAR_MONTH_DURATION_CAST_NULL_CONSTRUCTOR =
+            new FunctionIdentifier(FunctionConstants.ASTERIX_NS, "year-month-duration-cast-null", 1);
     public static final FunctionIdentifier DAY_TIME_DURATION_CONSTRUCTOR =
             new FunctionIdentifier(FunctionConstants.ASTERIX_NS, "day-time-duration", 1);
+    public static final FunctionIdentifier DAY_TIME_DURATION_CAST_NULL_CONSTRUCTOR =
+            new FunctionIdentifier(FunctionConstants.ASTERIX_NS, "day-time-duration-cast-null", 1);
 
     public static final FunctionIdentifier INTERVAL_CONSTRUCTOR =
             new FunctionIdentifier(FunctionConstants.ASTERIX_NS, "interval", 2);
@@ -1755,6 +1793,27 @@
         addPrivateFunction(MAKE_FIELD_INDEX_HANDLE, AnyTypeComputer.INSTANCE, true);
         addPrivateFunction(MAKE_FIELD_NAME_HANDLE, AnyTypeComputer.INSTANCE, true);
 
+        // cast null type constructors
+        addPrivateFunction(BOOLEAN_CAST_NULL_CONSTRUCTOR, ABooleanTypeComputer.INSTANCE_NULLABLE, true);
+        addPrivateFunction(INT8_CAST_NULL_CONSTRUCTOR, AInt8TypeComputer.INSTANCE_NULLABLE, true);
+        addPrivateFunction(INT16_CAST_NULL_CONSTRUCTOR, AInt16TypeComputer.INSTANCE_NULLABLE, true);
+        addPrivateFunction(INT32_CAST_NULL_CONSTRUCTOR, AInt32TypeComputer.INSTANCE_NULLABLE, true);
+        addPrivateFunction(INT64_CAST_NULL_CONSTRUCTOR, AInt64TypeComputer.INSTANCE_NULLABLE, true);
+        addPrivateFunction(FLOAT_CAST_NULL_CONSTRUCTOR, AFloatTypeComputer.INSTANCE_NULLABLE, true);
+        addPrivateFunction(DOUBLE_CAST_NULL_CONSTRUCTOR, ADoubleTypeComputer.INSTANCE_NULLABLE, true);
+        addPrivateFunction(STRING_CAST_NULL_CONSTRUCTOR, AStringTypeComputer.INSTANCE_NULLABLE, true);
+        addPrivateFunction(DATE_CAST_NULL_CONSTRUCTOR, ADateTypeComputer.INSTANCE_NULLABLE, true);
+        addPrivateFunction(DATE_CAST_NULL_CONSTRUCTOR_WITH_FORMAT, ADateTypeComputer.INSTANCE_NULLABLE, true);
+        addPrivateFunction(TIME_CAST_NULL_CONSTRUCTOR, ATimeTypeComputer.INSTANCE_NULLABLE, true);
+        addPrivateFunction(TIME_CAST_NULL_CONSTRUCTOR_WITH_FORMAT, ATimeTypeComputer.INSTANCE_NULLABLE, true);
+        addPrivateFunction(DATETIME_CAST_NULL_CONSTRUCTOR, ADateTimeTypeComputer.INSTANCE_NULLABLE, true);
+        addPrivateFunction(DATETIME_CAST_NULL_CONSTRUCTOR_WITH_FORMAT, ADateTimeTypeComputer.INSTANCE_NULLABLE, true);
+        addPrivateFunction(DURATION_CAST_NULL_CONSTRUCTOR, ADurationTypeComputer.INSTANCE_NULLABLE, true);
+        addPrivateFunction(DAY_TIME_DURATION_CAST_NULL_CONSTRUCTOR, ADayTimeDurationTypeComputer.INSTANCE_NULLABLE, true);
+        addPrivateFunction(YEAR_MONTH_DURATION_CAST_NULL_CONSTRUCTOR, AYearMonthDurationTypeComputer.INSTANCE_NULLABLE, true);
+        addPrivateFunction(UUID_CAST_NULL_CONSTRUCTOR, AUUIDTypeComputer.INSTANCE_NULLABLE, true);
+        addPrivateFunction(BINARY_BASE64_CAST_NULL_CONSTRUCTOR, ABinaryTypeComputer.INSTANCE_NULLABLE, true);
+
         addPrivateFunction(NUMERIC_UNARY_MINUS, NumericUnaryTypeComputer.INSTANCE, true);
         addPrivateFunction(NUMERIC_SUBTRACT, NumericAddSubMulDivTypeComputer.INSTANCE_SUB, true);
         addPrivateFunction(NUMERIC_MULTIPLY, NumericAddSubMulDivTypeComputer.INSTANCE_MUL_POW, true);
diff --git a/asterixdb/asterix-runtime/src/main/java/org/apache/asterix/runtime/evaluators/constructors/ABinaryBase64StringCastNullConstructorDescriptor.java b/asterixdb/asterix-runtime/src/main/java/org/apache/asterix/runtime/evaluators/constructors/ABinaryBase64StringCastNullConstructorDescriptor.java
new file mode 100644
index 0000000..53ed0a4
--- /dev/null
+++ b/asterixdb/asterix-runtime/src/main/java/org/apache/asterix/runtime/evaluators/constructors/ABinaryBase64StringCastNullConstructorDescriptor.java
@@ -0,0 +1,65 @@
+/*
+ * 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 org.apache.asterix.common.annotations.MissingNullInOutFunction;
+import org.apache.asterix.om.functions.BuiltinFunctions;
+import org.apache.asterix.om.functions.IFunctionDescriptorFactory;
+import org.apache.asterix.runtime.evaluators.base.AbstractScalarFunctionDynamicDescriptor;
+import org.apache.asterix.runtime.evaluators.functions.PointableHelper;
+import org.apache.hyracks.algebricks.core.algebra.functions.FunctionIdentifier;
+import org.apache.hyracks.algebricks.runtime.base.IEvaluatorContext;
+import org.apache.hyracks.algebricks.runtime.base.IScalarEvaluator;
+import org.apache.hyracks.algebricks.runtime.base.IScalarEvaluatorFactory;
+import org.apache.hyracks.api.exceptions.HyracksDataException;
+import org.apache.hyracks.data.std.api.IPointable;
+
+@MissingNullInOutFunction
+public class ABinaryBase64StringCastNullConstructorDescriptor extends AbstractScalarFunctionDynamicDescriptor {
+    private static final long serialVersionUID = 1L;
+    public static final IFunctionDescriptorFactory FACTORY = ABinaryBase64StringCastNullConstructorDescriptor::new;
+
+    @Override
+    public IScalarEvaluatorFactory createEvaluatorFactory(final IScalarEvaluatorFactory[] args) {
+        return new IScalarEvaluatorFactory() {
+            private static final long serialVersionUID = 1L;
+
+            @Override
+            public IScalarEvaluator createScalarEvaluator(IEvaluatorContext ctx) throws HyracksDataException {
+                return new ABinaryBase64StringConstructorDescriptor.ABinaryBase64StringConstructorEvaluator(ctx, args[0].createScalarEvaluator(ctx), sourceLoc) {
+
+                    @Override
+                    protected boolean checkAndSetMissingOrNull(IPointable result) throws HyracksDataException {
+                        return PointableHelper.checkAndSetNull(result, inputArg);
+                    }
+
+                    @Override
+                    protected FunctionIdentifier getIdentifier() {
+                        return ABinaryBase64StringCastNullConstructorDescriptor.this.getIdentifier();
+                    }
+                };
+            }
+        };
+    }
+
+    @Override
+    public FunctionIdentifier getIdentifier() {
+        return BuiltinFunctions.BINARY_BASE64_CAST_NULL_CONSTRUCTOR;
+    }
+}
diff --git a/asterixdb/asterix-runtime/src/main/java/org/apache/asterix/runtime/evaluators/constructors/ABinaryBase64StringConstructorDescriptor.java b/asterixdb/asterix-runtime/src/main/java/org/apache/asterix/runtime/evaluators/constructors/ABinaryBase64StringConstructorDescriptor.java
index 3f2f68a..72ae651 100644
--- a/asterixdb/asterix-runtime/src/main/java/org/apache/asterix/runtime/evaluators/constructors/ABinaryBase64StringConstructorDescriptor.java
+++ b/asterixdb/asterix-runtime/src/main/java/org/apache/asterix/runtime/evaluators/constructors/ABinaryBase64StringConstructorDescriptor.java
@@ -28,6 +28,7 @@
 import org.apache.hyracks.algebricks.runtime.base.IScalarEvaluator;
 import org.apache.hyracks.algebricks.runtime.base.IScalarEvaluatorFactory;
 import org.apache.hyracks.api.exceptions.HyracksDataException;
+import org.apache.hyracks.api.exceptions.SourceLocation;
 import org.apache.hyracks.data.std.primitive.UTF8StringPointable;
 import org.apache.hyracks.util.bytes.Base64Parser;
 
@@ -43,27 +44,7 @@
 
             @Override
             public IScalarEvaluator createScalarEvaluator(IEvaluatorContext ctx) throws HyracksDataException {
-                return new AbstractBinaryConstructorEvaluator(ctx, args[0].createScalarEvaluator(ctx), sourceLoc) {
-
-                    private final Base64Parser parser = new Base64Parser();
-
-                    @Override
-                    protected boolean parseBinary(UTF8StringPointable textPtr, AMutableBinary result) {
-                        try {
-                            parser.generatePureByteArrayFromBase64String(textPtr.getByteArray(),
-                                    textPtr.getCharStartOffset(), textPtr.getUTF8Length());
-                        } catch (IllegalArgumentException e) {
-                            return false;
-                        }
-                        result.setValue(parser.getByteArray(), 0, parser.getLength());
-                        return true;
-                    }
-
-                    @Override
-                    protected FunctionIdentifier getIdentifier() {
-                        return ABinaryBase64StringConstructorDescriptor.this.getIdentifier();
-                    }
-                };
+                return new ABinaryBase64StringConstructorEvaluator(ctx, args[0].createScalarEvaluator(ctx), sourceLoc);
             }
         };
     }
@@ -72,4 +53,31 @@
     public FunctionIdentifier getIdentifier() {
         return BuiltinFunctions.BINARY_BASE64_CONSTRUCTOR;
     }
+
+    protected static class ABinaryBase64StringConstructorEvaluator extends AbstractBinaryConstructorEvaluator {
+
+        private final Base64Parser parser = new Base64Parser();
+
+        protected ABinaryBase64StringConstructorEvaluator(IEvaluatorContext ctx, IScalarEvaluator inputEval,
+                SourceLocation sourceLoc) {
+            super(ctx, inputEval, sourceLoc);
+        }
+
+        @Override
+        protected boolean parseBinary(UTF8StringPointable textPtr, AMutableBinary result) {
+            try {
+                parser.generatePureByteArrayFromBase64String(textPtr.getByteArray(),
+                        textPtr.getCharStartOffset(), textPtr.getUTF8Length());
+            } catch (IllegalArgumentException e) {
+                return false;
+            }
+            result.setValue(parser.getByteArray(), 0, parser.getLength());
+            return true;
+        }
+
+        @Override
+        protected FunctionIdentifier getIdentifier() {
+            return BuiltinFunctions.BINARY_BASE64_CONSTRUCTOR;
+        }
+    }
 }
diff --git a/asterixdb/asterix-runtime/src/main/java/org/apache/asterix/runtime/evaluators/constructors/ABooleanCastNullConstructorDescriptor.java b/asterixdb/asterix-runtime/src/main/java/org/apache/asterix/runtime/evaluators/constructors/ABooleanCastNullConstructorDescriptor.java
new file mode 100644
index 0000000..e5511d3
--- /dev/null
+++ b/asterixdb/asterix-runtime/src/main/java/org/apache/asterix/runtime/evaluators/constructors/ABooleanCastNullConstructorDescriptor.java
@@ -0,0 +1,64 @@
+/*
+ * 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 org.apache.asterix.common.annotations.MissingNullInOutFunction;
+import org.apache.asterix.om.functions.BuiltinFunctions;
+import org.apache.asterix.om.functions.IFunctionDescriptorFactory;
+import org.apache.asterix.runtime.evaluators.base.AbstractScalarFunctionDynamicDescriptor;
+import org.apache.asterix.runtime.evaluators.functions.PointableHelper;
+import org.apache.hyracks.algebricks.core.algebra.functions.FunctionIdentifier;
+import org.apache.hyracks.algebricks.runtime.base.IEvaluatorContext;
+import org.apache.hyracks.algebricks.runtime.base.IScalarEvaluator;
+import org.apache.hyracks.algebricks.runtime.base.IScalarEvaluatorFactory;
+import org.apache.hyracks.api.exceptions.HyracksDataException;
+import org.apache.hyracks.data.std.api.IPointable;
+
+@MissingNullInOutFunction
+public class ABooleanCastNullConstructorDescriptor extends AbstractScalarFunctionDynamicDescriptor {
+    private static final long serialVersionUID = 1L;
+    public static final IFunctionDescriptorFactory FACTORY = ABooleanCastNullConstructorDescriptor::new;
+
+    @Override
+    public IScalarEvaluatorFactory createEvaluatorFactory(final IScalarEvaluatorFactory[] args) {
+        return new IScalarEvaluatorFactory() {
+            private static final long serialVersionUID = 1L;
+
+            @Override
+            public IScalarEvaluator createScalarEvaluator(IEvaluatorContext ctx) throws HyracksDataException {
+                return new AbstractBooleanConstructorEvaluator(ctx, args[0].createScalarEvaluator(ctx), sourceLoc) {
+                    @Override
+                    protected FunctionIdentifier getIdentifier() {
+                        return ABooleanCastNullConstructorDescriptor.this.getIdentifier();
+                    }
+
+                    @Override
+                    protected boolean checkAndSetMissingOrNull(IPointable result) throws HyracksDataException {
+                        return PointableHelper.checkAndSetNull(result, inputArg);
+                    }
+                };
+            }
+        };
+    }
+
+    @Override
+    public FunctionIdentifier getIdentifier() {
+        return BuiltinFunctions.BOOLEAN_CAST_NULL_CONSTRUCTOR;
+    }
+}
diff --git a/asterixdb/asterix-runtime/src/main/java/org/apache/asterix/runtime/evaluators/constructors/ADateCastNullConstructorDescriptor.java b/asterixdb/asterix-runtime/src/main/java/org/apache/asterix/runtime/evaluators/constructors/ADateCastNullConstructorDescriptor.java
new file mode 100644
index 0000000..b2a8207
--- /dev/null
+++ b/asterixdb/asterix-runtime/src/main/java/org/apache/asterix/runtime/evaluators/constructors/ADateCastNullConstructorDescriptor.java
@@ -0,0 +1,65 @@
+/*
+ * 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 org.apache.asterix.common.annotations.MissingNullInOutFunction;
+import org.apache.asterix.om.functions.BuiltinFunctions;
+import org.apache.asterix.om.functions.IFunctionDescriptorFactory;
+import org.apache.asterix.runtime.evaluators.base.AbstractScalarFunctionDynamicDescriptor;
+import org.apache.asterix.runtime.evaluators.functions.PointableHelper;
+import org.apache.hyracks.algebricks.core.algebra.functions.FunctionIdentifier;
+import org.apache.hyracks.algebricks.runtime.base.IEvaluatorContext;
+import org.apache.hyracks.algebricks.runtime.base.IScalarEvaluator;
+import org.apache.hyracks.algebricks.runtime.base.IScalarEvaluatorFactory;
+import org.apache.hyracks.api.exceptions.HyracksDataException;
+import org.apache.hyracks.data.std.api.IPointable;
+
+@MissingNullInOutFunction
+public class ADateCastNullConstructorDescriptor extends AbstractScalarFunctionDynamicDescriptor {
+    private static final long serialVersionUID = 1L;
+    public static final IFunctionDescriptorFactory FACTORY = ADateCastNullConstructorDescriptor::new;
+
+    @Override
+    public IScalarEvaluatorFactory createEvaluatorFactory(final IScalarEvaluatorFactory[] args) {
+        return new IScalarEvaluatorFactory() {
+            private static final long serialVersionUID = 1L;
+
+            @Override
+            public IScalarEvaluator createScalarEvaluator(IEvaluatorContext ctx) throws HyracksDataException {
+                return new AbstractDateConstructorEvaluator(ctx, args[0].createScalarEvaluator(ctx), sourceLoc) {
+
+                    @Override
+                    protected FunctionIdentifier getIdentifier() {
+                        return ADateCastNullConstructorDescriptor.this.getIdentifier();
+                    }
+
+                    @Override
+                    protected boolean checkAndSetMissingOrNull(IPointable result) throws HyracksDataException {
+                        return PointableHelper.checkAndSetNull(result, inputArg);
+                    }
+                };
+            }
+        };
+    }
+
+    @Override
+    public FunctionIdentifier getIdentifier() {
+        return BuiltinFunctions.DATE_CAST_NULL_CONSTRUCTOR;
+    }
+}
diff --git a/asterixdb/asterix-runtime/src/main/java/org/apache/asterix/runtime/evaluators/constructors/ADateCastNullConstructorWithFormatDescriptor.java b/asterixdb/asterix-runtime/src/main/java/org/apache/asterix/runtime/evaluators/constructors/ADateCastNullConstructorWithFormatDescriptor.java
new file mode 100644
index 0000000..81b338e
--- /dev/null
+++ b/asterixdb/asterix-runtime/src/main/java/org/apache/asterix/runtime/evaluators/constructors/ADateCastNullConstructorWithFormatDescriptor.java
@@ -0,0 +1,69 @@
+/*
+ * 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 org.apache.asterix.common.annotations.MissingNullInOutFunction;
+import org.apache.asterix.om.functions.BuiltinFunctions;
+import org.apache.asterix.om.functions.IFunctionDescriptorFactory;
+import org.apache.asterix.runtime.evaluators.base.AbstractScalarFunctionDynamicDescriptor;
+import org.apache.asterix.runtime.evaluators.functions.PointableHelper;
+import org.apache.hyracks.algebricks.core.algebra.functions.FunctionIdentifier;
+import org.apache.hyracks.algebricks.runtime.base.IEvaluatorContext;
+import org.apache.hyracks.algebricks.runtime.base.IScalarEvaluator;
+import org.apache.hyracks.algebricks.runtime.base.IScalarEvaluatorFactory;
+import org.apache.hyracks.api.exceptions.HyracksDataException;
+import org.apache.hyracks.data.std.api.IPointable;
+
+@MissingNullInOutFunction
+public class ADateCastNullConstructorWithFormatDescriptor extends AbstractScalarFunctionDynamicDescriptor {
+    private static final long serialVersionUID = 1L;
+    public static final IFunctionDescriptorFactory FACTORY = ADateCastNullConstructorWithFormatDescriptor::new;
+
+    @Override
+    public IScalarEvaluatorFactory createEvaluatorFactory(final IScalarEvaluatorFactory[] args) {
+        return new IScalarEvaluatorFactory() {
+            private static final long serialVersionUID = 1L;
+
+            @Override
+            public IScalarEvaluator createScalarEvaluator(IEvaluatorContext ctx) throws HyracksDataException {
+                return new AbstractDateConstructorWithFormatEvaluator(ctx, args, sourceLoc) {
+
+                    @Override
+                    protected FunctionIdentifier getIdentifier() {
+                        return ADateCastNullConstructorWithFormatDescriptor.this.getIdentifier();
+                    }
+
+                    @Override
+                    protected boolean checkAndSetMissingOrNull(IPointable result) throws HyracksDataException {
+                        if (PointableHelper.checkAndSetNull(result, inputArg)) {
+                            return true;
+                        }
+                        return super.checkAndSetMissingOrNull(result);
+                    }
+                };
+            }
+        };
+    }
+
+    @Override
+    public FunctionIdentifier getIdentifier() {
+        return BuiltinFunctions.DATE_CAST_NULL_CONSTRUCTOR_WITH_FORMAT;
+    }
+}
diff --git a/asterixdb/asterix-runtime/src/main/java/org/apache/asterix/runtime/evaluators/constructors/ADateConstructorWithFormatDescriptor.java b/asterixdb/asterix-runtime/src/main/java/org/apache/asterix/runtime/evaluators/constructors/ADateConstructorWithFormatDescriptor.java
index 9d51f12..29cb552 100644
--- a/asterixdb/asterix-runtime/src/main/java/org/apache/asterix/runtime/evaluators/constructors/ADateConstructorWithFormatDescriptor.java
+++ b/asterixdb/asterix-runtime/src/main/java/org/apache/asterix/runtime/evaluators/constructors/ADateConstructorWithFormatDescriptor.java
@@ -20,36 +20,19 @@
 package org.apache.asterix.runtime.evaluators.constructors;
 
 import org.apache.asterix.common.annotations.MissingNullInOutFunction;
-import org.apache.asterix.om.base.AMutableDate;
-import org.apache.asterix.om.base.AMutableInt64;
-import org.apache.asterix.om.base.temporal.AsterixTemporalTypeParseException;
-import org.apache.asterix.om.base.temporal.DateTimeFormatUtils;
-import org.apache.asterix.om.base.temporal.GregorianCalendarSystem;
 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.runtime.evaluators.base.AbstractScalarFunctionDynamicDescriptor;
-import org.apache.asterix.runtime.evaluators.functions.PointableHelper;
 import org.apache.hyracks.algebricks.core.algebra.functions.FunctionIdentifier;
 import org.apache.hyracks.algebricks.runtime.base.IEvaluatorContext;
 import org.apache.hyracks.algebricks.runtime.base.IScalarEvaluator;
 import org.apache.hyracks.algebricks.runtime.base.IScalarEvaluatorFactory;
 import org.apache.hyracks.api.exceptions.HyracksDataException;
-import org.apache.hyracks.data.std.api.IPointable;
-import org.apache.hyracks.data.std.primitive.UTF8StringPointable;
-import org.apache.hyracks.data.std.primitive.VoidPointable;
-import org.apache.hyracks.dataflow.common.data.accessors.IFrameTupleReference;
 
 @MissingNullInOutFunction
 public class ADateConstructorWithFormatDescriptor extends AbstractScalarFunctionDynamicDescriptor {
     private static final long serialVersionUID = 1L;
-    public static final IFunctionDescriptorFactory FACTORY = new IFunctionDescriptorFactory() {
-        @Override
-        public IFunctionDescriptor createFunctionDescriptor() {
-            return new ADateConstructorWithFormatDescriptor();
-        }
-    };
+    public static final IFunctionDescriptorFactory FACTORY = ADateConstructorWithFormatDescriptor::new;
 
     @Override
     public IScalarEvaluatorFactory createEvaluatorFactory(final IScalarEvaluatorFactory[] args) {
@@ -58,48 +41,7 @@
 
             @Override
             public IScalarEvaluator createScalarEvaluator(IEvaluatorContext ctx) throws HyracksDataException {
-                return new AbstractDateConstructorEvaluator(ctx, args[0].createScalarEvaluator(ctx), sourceLoc) {
-
-                    private final IScalarEvaluator formatEval = args[1].createScalarEvaluator(ctx);
-                    private final IPointable formatArg = new VoidPointable();
-                    private final UTF8StringPointable formatTextPtr = new UTF8StringPointable();
-                    private final AMutableInt64 aInt64 = new AMutableInt64(0);
-
-                    @Override
-                    protected void evaluateInput(IFrameTupleReference tuple) throws HyracksDataException {
-                        super.evaluateInput(tuple);
-                        formatEval.evaluate(tuple, formatArg);
-                    }
-
-                    @Override
-                    protected boolean checkAndSetMissingOrNull(IPointable result) throws HyracksDataException {
-                        return PointableHelper.checkAndSetMissingOrNull(result, inputArg, formatArg);
-                    }
-
-                    @Override
-                    protected boolean parseDate(UTF8StringPointable textPtr, AMutableDate result) {
-                        byte[] formatBytes = formatArg.getByteArray();
-                        int formatStartOffset = formatArg.getStartOffset();
-                        int formatLength = formatArg.getLength();
-                        if (formatBytes[formatStartOffset] != ATypeTag.SERIALIZED_STRING_TYPE_TAG) {
-                            return false;
-                        }
-                        formatTextPtr.set(formatBytes, formatStartOffset + 1, formatLength - 1);
-                        try {
-                            if (DateTimeFormatUtils.getInstance().parseDateTime(aInt64, textPtr.getByteArray(),
-                                    textPtr.getCharStartOffset(), textPtr.getUTF8Length(), formatBytes,
-                                    formatTextPtr.getCharStartOffset(), formatTextPtr.getUTF8Length(),
-                                    DateTimeFormatUtils.DateTimeParseMode.DATE_ONLY, false)) {
-                                result.setValue((int) (aInt64.getLongValue() / GregorianCalendarSystem.CHRONON_OF_DAY));
-                                return true;
-                            } else {
-                                return false;
-                            }
-                        } catch (AsterixTemporalTypeParseException e) {
-                            // shouldn't happen
-                            return false;
-                        }
-                    }
+                return new AbstractDateConstructorWithFormatEvaluator(ctx, args, sourceLoc) {
 
                     @Override
                     protected FunctionIdentifier getIdentifier() {
diff --git a/asterixdb/asterix-runtime/src/main/java/org/apache/asterix/runtime/evaluators/constructors/ADateTimeCastNullConstructorDescriptor.java b/asterixdb/asterix-runtime/src/main/java/org/apache/asterix/runtime/evaluators/constructors/ADateTimeCastNullConstructorDescriptor.java
new file mode 100644
index 0000000..4b5c4d4
--- /dev/null
+++ b/asterixdb/asterix-runtime/src/main/java/org/apache/asterix/runtime/evaluators/constructors/ADateTimeCastNullConstructorDescriptor.java
@@ -0,0 +1,65 @@
+/*
+ * 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 org.apache.asterix.common.annotations.MissingNullInOutFunction;
+import org.apache.asterix.om.functions.BuiltinFunctions;
+import org.apache.asterix.om.functions.IFunctionDescriptorFactory;
+import org.apache.asterix.runtime.evaluators.base.AbstractScalarFunctionDynamicDescriptor;
+import org.apache.asterix.runtime.evaluators.functions.PointableHelper;
+import org.apache.hyracks.algebricks.core.algebra.functions.FunctionIdentifier;
+import org.apache.hyracks.algebricks.runtime.base.IEvaluatorContext;
+import org.apache.hyracks.algebricks.runtime.base.IScalarEvaluator;
+import org.apache.hyracks.algebricks.runtime.base.IScalarEvaluatorFactory;
+import org.apache.hyracks.api.exceptions.HyracksDataException;
+import org.apache.hyracks.data.std.api.IPointable;
+
+@MissingNullInOutFunction
+public class ADateTimeCastNullConstructorDescriptor extends AbstractScalarFunctionDynamicDescriptor {
+    private static final long serialVersionUID = 1L;
+    public static final IFunctionDescriptorFactory FACTORY = ADateTimeCastNullConstructorDescriptor::new;
+
+    @Override
+    public IScalarEvaluatorFactory createEvaluatorFactory(final IScalarEvaluatorFactory[] args) {
+        return new IScalarEvaluatorFactory() {
+            private static final long serialVersionUID = 1L;
+
+            @Override
+            public IScalarEvaluator createScalarEvaluator(IEvaluatorContext ctx) throws HyracksDataException {
+                return new AbstractDateTimeConstructorEvaluator(ctx, args[0].createScalarEvaluator(ctx), sourceLoc) {
+
+                    @Override
+                    protected FunctionIdentifier getIdentifier() {
+                        return ADateTimeCastNullConstructorDescriptor.this.getIdentifier();
+                    }
+
+                    @Override
+                    protected boolean checkAndSetMissingOrNull(IPointable result) throws HyracksDataException {
+                        return PointableHelper.checkAndSetNull(result, inputArg);
+                    }
+                };
+            }
+        };
+    }
+
+    @Override
+    public FunctionIdentifier getIdentifier() {
+        return BuiltinFunctions.DATETIME_CAST_NULL_CONSTRUCTOR;
+    }
+}
diff --git a/asterixdb/asterix-runtime/src/main/java/org/apache/asterix/runtime/evaluators/constructors/ADateTimeCastNullConstructorWithFormatDescriptor.java b/asterixdb/asterix-runtime/src/main/java/org/apache/asterix/runtime/evaluators/constructors/ADateTimeCastNullConstructorWithFormatDescriptor.java
new file mode 100644
index 0000000..bdaf3e3
--- /dev/null
+++ b/asterixdb/asterix-runtime/src/main/java/org/apache/asterix/runtime/evaluators/constructors/ADateTimeCastNullConstructorWithFormatDescriptor.java
@@ -0,0 +1,67 @@
+/*
+ * 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 org.apache.asterix.om.functions.BuiltinFunctions;
+import org.apache.asterix.om.functions.IFunctionDescriptorFactory;
+import org.apache.asterix.runtime.evaluators.base.AbstractScalarFunctionDynamicDescriptor;
+import org.apache.asterix.runtime.evaluators.functions.PointableHelper;
+import org.apache.hyracks.algebricks.core.algebra.functions.FunctionIdentifier;
+import org.apache.hyracks.algebricks.runtime.base.IEvaluatorContext;
+import org.apache.hyracks.algebricks.runtime.base.IScalarEvaluator;
+import org.apache.hyracks.algebricks.runtime.base.IScalarEvaluatorFactory;
+import org.apache.hyracks.api.exceptions.HyracksDataException;
+import org.apache.hyracks.data.std.api.IPointable;
+
+public class ADateTimeCastNullConstructorWithFormatDescriptor extends AbstractScalarFunctionDynamicDescriptor {
+    private static final long serialVersionUID = 1L;
+    public static final IFunctionDescriptorFactory FACTORY = ADateTimeCastNullConstructorWithFormatDescriptor::new;
+
+    @Override
+    public IScalarEvaluatorFactory createEvaluatorFactory(final IScalarEvaluatorFactory[] args) {
+        return new IScalarEvaluatorFactory() {
+            private static final long serialVersionUID = 1L;
+
+            @Override
+            public IScalarEvaluator createScalarEvaluator(IEvaluatorContext ctx) throws HyracksDataException {
+                return new AbstractDateTimeConstructorWithFormatEvaluator(ctx, args, sourceLoc) {
+
+                    @Override
+                    protected FunctionIdentifier getIdentifier() {
+                        return ADateTimeCastNullConstructorWithFormatDescriptor.this.getIdentifier();
+                    }
+
+                    @Override
+                    protected boolean checkAndSetMissingOrNull(IPointable result) throws HyracksDataException {
+                        if (PointableHelper.checkAndSetNull(result, inputArg)) {
+                            return true;
+                        }
+                        return super.checkAndSetMissingOrNull(result);
+                    }
+                };
+            }
+        };
+    }
+
+    @Override
+    public FunctionIdentifier getIdentifier() {
+        return BuiltinFunctions.DATETIME_CAST_NULL_CONSTRUCTOR_WITH_FORMAT;
+    }
+}
diff --git a/asterixdb/asterix-runtime/src/main/java/org/apache/asterix/runtime/evaluators/constructors/ADateTimeConstructorWithFormatDescriptor.java b/asterixdb/asterix-runtime/src/main/java/org/apache/asterix/runtime/evaluators/constructors/ADateTimeConstructorWithFormatDescriptor.java
index 715a7df..af8bba4 100644
--- a/asterixdb/asterix-runtime/src/main/java/org/apache/asterix/runtime/evaluators/constructors/ADateTimeConstructorWithFormatDescriptor.java
+++ b/asterixdb/asterix-runtime/src/main/java/org/apache/asterix/runtime/evaluators/constructors/ADateTimeConstructorWithFormatDescriptor.java
@@ -19,34 +19,18 @@
 
 package org.apache.asterix.runtime.evaluators.constructors;
 
-import org.apache.asterix.om.base.AMutableDateTime;
-import org.apache.asterix.om.base.AMutableInt64;
-import org.apache.asterix.om.base.temporal.AsterixTemporalTypeParseException;
-import org.apache.asterix.om.base.temporal.DateTimeFormatUtils;
 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.runtime.evaluators.base.AbstractScalarFunctionDynamicDescriptor;
-import org.apache.asterix.runtime.evaluators.functions.PointableHelper;
 import org.apache.hyracks.algebricks.core.algebra.functions.FunctionIdentifier;
 import org.apache.hyracks.algebricks.runtime.base.IEvaluatorContext;
 import org.apache.hyracks.algebricks.runtime.base.IScalarEvaluator;
 import org.apache.hyracks.algebricks.runtime.base.IScalarEvaluatorFactory;
 import org.apache.hyracks.api.exceptions.HyracksDataException;
-import org.apache.hyracks.data.std.api.IPointable;
-import org.apache.hyracks.data.std.primitive.UTF8StringPointable;
-import org.apache.hyracks.data.std.primitive.VoidPointable;
-import org.apache.hyracks.dataflow.common.data.accessors.IFrameTupleReference;
 
 public class ADateTimeConstructorWithFormatDescriptor extends AbstractScalarFunctionDynamicDescriptor {
     private static final long serialVersionUID = 1L;
-    public static final IFunctionDescriptorFactory FACTORY = new IFunctionDescriptorFactory() {
-        @Override
-        public IFunctionDescriptor createFunctionDescriptor() {
-            return new ADateTimeConstructorWithFormatDescriptor();
-        }
-    };
+    public static final IFunctionDescriptorFactory FACTORY = ADateTimeConstructorWithFormatDescriptor::new;
 
     @Override
     public IScalarEvaluatorFactory createEvaluatorFactory(final IScalarEvaluatorFactory[] args) {
@@ -55,48 +39,7 @@
 
             @Override
             public IScalarEvaluator createScalarEvaluator(IEvaluatorContext ctx) throws HyracksDataException {
-                return new AbstractDateTimeConstructorEvaluator(ctx, args[0].createScalarEvaluator(ctx), sourceLoc) {
-
-                    private final IScalarEvaluator formatEval = args[1].createScalarEvaluator(ctx);
-                    private final IPointable formatArg = new VoidPointable();
-                    private final UTF8StringPointable formatTextPtr = new UTF8StringPointable();
-                    private final AMutableInt64 aInt64 = new AMutableInt64(0);
-
-                    @Override
-                    protected void evaluateInput(IFrameTupleReference tuple) throws HyracksDataException {
-                        super.evaluateInput(tuple);
-                        formatEval.evaluate(tuple, formatArg);
-                    }
-
-                    @Override
-                    protected boolean checkAndSetMissingOrNull(IPointable result) throws HyracksDataException {
-                        return PointableHelper.checkAndSetMissingOrNull(result, inputArg, formatArg);
-                    }
-
-                    @Override
-                    protected boolean parseDateTime(UTF8StringPointable textPtr, AMutableDateTime result) {
-                        byte[] formatBytes = formatArg.getByteArray();
-                        int formatStartOffset = formatArg.getStartOffset();
-                        int formatLength = formatArg.getLength();
-                        if (formatBytes[formatStartOffset] != ATypeTag.SERIALIZED_STRING_TYPE_TAG) {
-                            return false;
-                        }
-                        formatTextPtr.set(formatBytes, formatStartOffset + 1, formatLength - 1);
-                        try {
-                            if (DateTimeFormatUtils.getInstance().parseDateTime(aInt64, textPtr.getByteArray(),
-                                    textPtr.getCharStartOffset(), textPtr.getUTF8Length(), formatBytes,
-                                    formatTextPtr.getCharStartOffset(), formatTextPtr.getUTF8Length(),
-                                    DateTimeFormatUtils.DateTimeParseMode.DATETIME, false)) {
-                                result.setValue(aInt64.getLongValue());
-                                return true;
-                            } else {
-                                return false;
-                            }
-                        } catch (AsterixTemporalTypeParseException e) {
-                            // shouldn't happen
-                            return false;
-                        }
-                    }
+                return new AbstractDateTimeConstructorWithFormatEvaluator(ctx, args, sourceLoc) {
 
                     @Override
                     protected FunctionIdentifier getIdentifier() {
diff --git a/asterixdb/asterix-runtime/src/main/java/org/apache/asterix/runtime/evaluators/constructors/ADayTimeDurationCastNullConstructorDescriptor.java b/asterixdb/asterix-runtime/src/main/java/org/apache/asterix/runtime/evaluators/constructors/ADayTimeDurationCastNullConstructorDescriptor.java
new file mode 100644
index 0000000..2b1f6ae
--- /dev/null
+++ b/asterixdb/asterix-runtime/src/main/java/org/apache/asterix/runtime/evaluators/constructors/ADayTimeDurationCastNullConstructorDescriptor.java
@@ -0,0 +1,66 @@
+/*
+ * 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 org.apache.asterix.common.annotations.MissingNullInOutFunction;
+import org.apache.asterix.om.functions.BuiltinFunctions;
+import org.apache.asterix.om.functions.IFunctionDescriptorFactory;
+import org.apache.asterix.runtime.evaluators.base.AbstractScalarFunctionDynamicDescriptor;
+import org.apache.asterix.runtime.evaluators.functions.PointableHelper;
+import org.apache.hyracks.algebricks.core.algebra.functions.FunctionIdentifier;
+import org.apache.hyracks.algebricks.runtime.base.IEvaluatorContext;
+import org.apache.hyracks.algebricks.runtime.base.IScalarEvaluator;
+import org.apache.hyracks.algebricks.runtime.base.IScalarEvaluatorFactory;
+import org.apache.hyracks.api.exceptions.HyracksDataException;
+import org.apache.hyracks.data.std.api.IPointable;
+
+@MissingNullInOutFunction
+public class ADayTimeDurationCastNullConstructorDescriptor extends AbstractScalarFunctionDynamicDescriptor {
+
+    private static final long serialVersionUID = 1L;
+    public static final IFunctionDescriptorFactory FACTORY = ADayTimeDurationCastNullConstructorDescriptor::new;
+
+    @Override
+    public IScalarEvaluatorFactory createEvaluatorFactory(final IScalarEvaluatorFactory[] args) {
+        return new IScalarEvaluatorFactory() {
+            private static final long serialVersionUID = 1L;
+
+            @Override
+            public IScalarEvaluator createScalarEvaluator(IEvaluatorContext ctx) throws HyracksDataException {
+                return new AbstractDayTimeDurationConstructorEvaluator(ctx, args[0].createScalarEvaluator(ctx), sourceLoc) {
+
+                    @Override
+                    protected FunctionIdentifier getIdentifier() {
+                        return ADayTimeDurationCastNullConstructorDescriptor.this.getIdentifier();
+                    }
+
+                    @Override
+                    protected boolean checkAndSetMissingOrNull(IPointable result) throws HyracksDataException {
+                        return PointableHelper.checkAndSetNull(result, inputArg);
+                    }
+                };
+            }
+        };
+    }
+
+    @Override
+    public FunctionIdentifier getIdentifier() {
+        return BuiltinFunctions.DAY_TIME_DURATION_CAST_NULL_CONSTRUCTOR;
+    }
+}
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 6178bc9..eb6ff04 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
@@ -53,52 +53,7 @@
 
             @Override
             public IScalarEvaluator createScalarEvaluator(IEvaluatorContext ctx) throws HyracksDataException {
-                return new AbstractConstructorEvaluator(ctx, args[0].createScalarEvaluator(ctx), sourceLoc) {
-
-                    private final AMutableDayTimeDuration aDayTimeDuration = new AMutableDayTimeDuration(0);
-                    @SuppressWarnings("unchecked")
-                    private final ISerializerDeserializer<ADayTimeDuration> dayTimeDurationSerde =
-                            SerializerDeserializerProvider.INSTANCE
-                                    .getSerializerDeserializer(BuiltinType.ADAYTIMEDURATION);
-                    private final UTF8StringPointable utf8Ptr = new UTF8StringPointable();
-
-                    @Override
-                    protected void evaluateImpl(IPointable result) throws HyracksDataException {
-                        byte[] bytes = inputArg.getByteArray();
-                        int startOffset = inputArg.getStartOffset();
-                        int len = inputArg.getLength();
-                        ATypeTag inputType = EnumDeserializer.ATYPETAGDESERIALIZER.deserialize(bytes[startOffset]);
-                        switch (inputType) {
-                            case DAYTIMEDURATION:
-                                result.set(inputArg);
-                                break;
-                            case DURATION:
-                                long millis = ADurationSerializerDeserializer.getDayTime(bytes, startOffset + 1);
-                                aDayTimeDuration.setMilliseconds(millis);
-                                resultStorage.reset();
-                                dayTimeDurationSerde.serialize(aDayTimeDuration, out);
-                                result.set(resultStorage);
-                                break;
-                            case STRING:
-                                utf8Ptr.set(bytes, startOffset + 1, len - 1);
-                                if (parseDayTimeDuration(utf8Ptr, aDayTimeDuration)) {
-                                    resultStorage.reset();
-                                    dayTimeDurationSerde.serialize(aDayTimeDuration, out);
-                                    result.set(resultStorage);
-                                } else {
-                                    handleParseError(utf8Ptr, result);
-                                }
-                                break;
-                            default:
-                                handleUnsupportedType(inputType, result);
-                                break;
-                        }
-                    }
-
-                    @Override
-                    protected BuiltinType getTargetType() {
-                        return BuiltinType.ADAYTIMEDURATION;
-                    }
+                return new AbstractDayTimeDurationConstructorEvaluator(ctx, args[0].createScalarEvaluator(ctx), sourceLoc) {
 
                     @Override
                     protected FunctionIdentifier getIdentifier() {
@@ -109,16 +64,6 @@
         };
     }
 
-    private static boolean parseDayTimeDuration(UTF8StringPointable textPtr, ADayTimeDuration result) {
-        try {
-            ADurationParserFactory.parseDuration(textPtr.getByteArray(), textPtr.getCharStartOffset(),
-                    textPtr.getUTF8Length(), result, ADurationParseOption.DAY_TIME);
-            return true;
-        } catch (HyracksDataException e) {
-            return false;
-        }
-    }
-
     @Override
     public FunctionIdentifier getIdentifier() {
         return BuiltinFunctions.DAY_TIME_DURATION_CONSTRUCTOR;
diff --git a/asterixdb/asterix-runtime/src/main/java/org/apache/asterix/runtime/evaluators/constructors/ADoubleCastNullConstructorDescriptor.java b/asterixdb/asterix-runtime/src/main/java/org/apache/asterix/runtime/evaluators/constructors/ADoubleCastNullConstructorDescriptor.java
new file mode 100644
index 0000000..1f4fd28
--- /dev/null
+++ b/asterixdb/asterix-runtime/src/main/java/org/apache/asterix/runtime/evaluators/constructors/ADoubleCastNullConstructorDescriptor.java
@@ -0,0 +1,65 @@
+/*
+ * 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 org.apache.asterix.common.annotations.MissingNullInOutFunction;
+import org.apache.asterix.om.functions.BuiltinFunctions;
+import org.apache.asterix.om.functions.IFunctionDescriptorFactory;
+import org.apache.asterix.runtime.evaluators.base.AbstractScalarFunctionDynamicDescriptor;
+import org.apache.asterix.runtime.evaluators.functions.PointableHelper;
+import org.apache.hyracks.algebricks.core.algebra.functions.FunctionIdentifier;
+import org.apache.hyracks.algebricks.runtime.base.IEvaluatorContext;
+import org.apache.hyracks.algebricks.runtime.base.IScalarEvaluator;
+import org.apache.hyracks.algebricks.runtime.base.IScalarEvaluatorFactory;
+import org.apache.hyracks.api.exceptions.HyracksDataException;
+import org.apache.hyracks.data.std.api.IPointable;
+
+@MissingNullInOutFunction
+public class ADoubleCastNullConstructorDescriptor extends AbstractScalarFunctionDynamicDescriptor {
+    private static final long serialVersionUID = 1L;
+    public static final IFunctionDescriptorFactory FACTORY = ADoubleCastNullConstructorDescriptor::new;
+
+    @Override
+    public IScalarEvaluatorFactory createEvaluatorFactory(final IScalarEvaluatorFactory[] args) {
+        return new IScalarEvaluatorFactory() {
+            private static final long serialVersionUID = 1L;
+
+            @Override
+            public IScalarEvaluator createScalarEvaluator(IEvaluatorContext ctx) throws HyracksDataException {
+                return new AbstractDoubleConstructorEvaluator(ctx, args[0].createScalarEvaluator(ctx), sourceLoc) {
+
+                    @Override
+                    protected FunctionIdentifier getIdentifier() {
+                        return ADoubleCastNullConstructorDescriptor.this.getIdentifier();
+                    }
+
+                    @Override
+                    protected boolean checkAndSetMissingOrNull(IPointable result) throws HyracksDataException {
+                        return PointableHelper.checkAndSetNull(result, inputArg);
+                    }
+                };
+            }
+        };
+    }
+
+    @Override
+    public FunctionIdentifier getIdentifier() {
+        return BuiltinFunctions.DOUBLE_CAST_NULL_CONSTRUCTOR;
+    }
+}
diff --git a/asterixdb/asterix-runtime/src/main/java/org/apache/asterix/runtime/evaluators/constructors/ADurationCastNullConstructorDescriptor.java b/asterixdb/asterix-runtime/src/main/java/org/apache/asterix/runtime/evaluators/constructors/ADurationCastNullConstructorDescriptor.java
new file mode 100644
index 0000000..8ed2833
--- /dev/null
+++ b/asterixdb/asterix-runtime/src/main/java/org/apache/asterix/runtime/evaluators/constructors/ADurationCastNullConstructorDescriptor.java
@@ -0,0 +1,65 @@
+/*
+ * 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 org.apache.asterix.common.annotations.MissingNullInOutFunction;
+import org.apache.asterix.om.functions.BuiltinFunctions;
+import org.apache.asterix.om.functions.IFunctionDescriptorFactory;
+import org.apache.asterix.runtime.evaluators.base.AbstractScalarFunctionDynamicDescriptor;
+import org.apache.asterix.runtime.evaluators.functions.PointableHelper;
+import org.apache.hyracks.algebricks.core.algebra.functions.FunctionIdentifier;
+import org.apache.hyracks.algebricks.runtime.base.IEvaluatorContext;
+import org.apache.hyracks.algebricks.runtime.base.IScalarEvaluator;
+import org.apache.hyracks.algebricks.runtime.base.IScalarEvaluatorFactory;
+import org.apache.hyracks.api.exceptions.HyracksDataException;
+import org.apache.hyracks.data.std.api.IPointable;
+
+@MissingNullInOutFunction
+public class ADurationCastNullConstructorDescriptor extends AbstractScalarFunctionDynamicDescriptor {
+    private static final long serialVersionUID = 1L;
+    public static final IFunctionDescriptorFactory FACTORY = ADurationCastNullConstructorDescriptor::new;
+
+    @Override
+    public IScalarEvaluatorFactory createEvaluatorFactory(final IScalarEvaluatorFactory[] args) {
+        return new IScalarEvaluatorFactory() {
+            private static final long serialVersionUID = 1L;
+
+            @Override
+            public IScalarEvaluator createScalarEvaluator(IEvaluatorContext ctx) throws HyracksDataException {
+                return new AbstractDurationConstructorEvaluator(ctx, args[0].createScalarEvaluator(ctx), sourceLoc) {
+
+                    @Override
+                    protected FunctionIdentifier getIdentifier() {
+                        return ADurationCastNullConstructorDescriptor.this.getIdentifier();
+                    }
+
+                    @Override
+                    protected boolean checkAndSetMissingOrNull(IPointable result) throws HyracksDataException {
+                        return PointableHelper.checkAndSetNull(result, inputArg);
+                    }
+                };
+            }
+        };
+    }
+
+    @Override
+    public FunctionIdentifier getIdentifier() {
+        return BuiltinFunctions.DURATION_CAST_NULL_CONSTRUCTOR;
+    }
+}
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 6a14031..67742c2 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
@@ -19,27 +19,14 @@
 package org.apache.asterix.runtime.evaluators.constructors;
 
 import org.apache.asterix.common.annotations.MissingNullInOutFunction;
-import org.apache.asterix.dataflow.data.nontagged.serde.ADayTimeDurationSerializerDeserializer;
-import org.apache.asterix.dataflow.data.nontagged.serde.AYearMonthDurationSerializerDeserializer;
-import org.apache.asterix.formats.nontagged.SerializerDeserializerProvider;
-import org.apache.asterix.om.base.ADuration;
-import org.apache.asterix.om.base.AMutableDuration;
-import org.apache.asterix.om.base.temporal.ADurationParserFactory;
-import org.apache.asterix.om.base.temporal.ADurationParserFactory.ADurationParseOption;
 import org.apache.asterix.om.functions.BuiltinFunctions;
 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.om.types.EnumDeserializer;
 import org.apache.asterix.runtime.evaluators.base.AbstractScalarFunctionDynamicDescriptor;
 import org.apache.hyracks.algebricks.core.algebra.functions.FunctionIdentifier;
 import org.apache.hyracks.algebricks.runtime.base.IEvaluatorContext;
 import org.apache.hyracks.algebricks.runtime.base.IScalarEvaluator;
 import org.apache.hyracks.algebricks.runtime.base.IScalarEvaluatorFactory;
-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.UTF8StringPointable;
 
 @MissingNullInOutFunction
 public class ADurationConstructorDescriptor extends AbstractScalarFunctionDynamicDescriptor {
@@ -53,59 +40,7 @@
 
             @Override
             public IScalarEvaluator createScalarEvaluator(IEvaluatorContext ctx) throws HyracksDataException {
-                return new AbstractConstructorEvaluator(ctx, args[0].createScalarEvaluator(ctx), sourceLoc) {
-
-                    private final AMutableDuration aDuration = new AMutableDuration(0, 0);
-                    @SuppressWarnings("unchecked")
-                    private final ISerializerDeserializer<ADuration> durationSerde =
-                            SerializerDeserializerProvider.INSTANCE.getSerializerDeserializer(BuiltinType.ADURATION);
-                    private final UTF8StringPointable utf8Ptr = new UTF8StringPointable();
-
-                    @Override
-                    protected void evaluateImpl(IPointable result) throws HyracksDataException {
-                        byte[] bytes = inputArg.getByteArray();
-                        int startOffset = inputArg.getStartOffset();
-                        int len = inputArg.getLength();
-                        ATypeTag inputType = EnumDeserializer.ATYPETAGDESERIALIZER.deserialize(bytes[startOffset]);
-                        switch (inputType) {
-                            case DURATION:
-                                result.set(inputArg);
-                                break;
-                            case YEARMONTHDURATION:
-                                int months =
-                                        AYearMonthDurationSerializerDeserializer.getYearMonth(bytes, startOffset + 1);
-                                aDuration.setValue(months, 0);
-                                resultStorage.reset();
-                                durationSerde.serialize(aDuration, out);
-                                result.set(resultStorage);
-                                break;
-                            case DAYTIMEDURATION:
-                                long millis = ADayTimeDurationSerializerDeserializer.getDayTime(bytes, startOffset + 1);
-                                aDuration.setValue(0, millis);
-                                resultStorage.reset();
-                                durationSerde.serialize(aDuration, out);
-                                result.set(resultStorage);
-                                break;
-                            case STRING:
-                                utf8Ptr.set(bytes, startOffset + 1, len - 1);
-                                if (parseDuration(utf8Ptr, aDuration)) {
-                                    resultStorage.reset();
-                                    durationSerde.serialize(aDuration, out);
-                                    result.set(resultStorage);
-                                } else {
-                                    handleParseError(utf8Ptr, result);
-                                }
-                                break;
-                            default:
-                                handleUnsupportedType(inputType, result);
-                                break;
-                        }
-                    }
-
-                    @Override
-                    protected BuiltinType getTargetType() {
-                        return BuiltinType.ADURATION;
-                    }
+                return new AbstractDurationConstructorEvaluator(ctx, args[0].createScalarEvaluator(ctx), sourceLoc) {
 
                     @Override
                     protected FunctionIdentifier getIdentifier() {
@@ -116,16 +51,6 @@
         };
     }
 
-    private static boolean parseDuration(UTF8StringPointable textPtr, ADuration result) {
-        try {
-            ADurationParserFactory.parseDuration(textPtr.getByteArray(), textPtr.getCharStartOffset(),
-                    textPtr.getUTF8Length(), result, ADurationParseOption.All);
-            return true;
-        } catch (HyracksDataException e) {
-            return false;
-        }
-    }
-
     @Override
     public FunctionIdentifier getIdentifier() {
         return BuiltinFunctions.DURATION_CONSTRUCTOR;
diff --git a/asterixdb/asterix-runtime/src/main/java/org/apache/asterix/runtime/evaluators/constructors/AFloatCastNullConstructorDescriptor.java b/asterixdb/asterix-runtime/src/main/java/org/apache/asterix/runtime/evaluators/constructors/AFloatCastNullConstructorDescriptor.java
new file mode 100644
index 0000000..2dadd68
--- /dev/null
+++ b/asterixdb/asterix-runtime/src/main/java/org/apache/asterix/runtime/evaluators/constructors/AFloatCastNullConstructorDescriptor.java
@@ -0,0 +1,65 @@
+/*
+ * 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 org.apache.asterix.common.annotations.MissingNullInOutFunction;
+import org.apache.asterix.om.functions.BuiltinFunctions;
+import org.apache.asterix.om.functions.IFunctionDescriptorFactory;
+import org.apache.asterix.runtime.evaluators.base.AbstractScalarFunctionDynamicDescriptor;
+import org.apache.asterix.runtime.evaluators.functions.PointableHelper;
+import org.apache.hyracks.algebricks.core.algebra.functions.FunctionIdentifier;
+import org.apache.hyracks.algebricks.runtime.base.IEvaluatorContext;
+import org.apache.hyracks.algebricks.runtime.base.IScalarEvaluator;
+import org.apache.hyracks.algebricks.runtime.base.IScalarEvaluatorFactory;
+import org.apache.hyracks.api.exceptions.HyracksDataException;
+import org.apache.hyracks.data.std.api.IPointable;
+
+@MissingNullInOutFunction
+public class AFloatCastNullConstructorDescriptor extends AbstractScalarFunctionDynamicDescriptor {
+    private static final long serialVersionUID = 1L;
+    public static final IFunctionDescriptorFactory FACTORY = AFloatCastNullConstructorDescriptor::new;
+
+    @Override
+    public IScalarEvaluatorFactory createEvaluatorFactory(final IScalarEvaluatorFactory[] args) {
+        return new IScalarEvaluatorFactory() {
+            private static final long serialVersionUID = 1L;
+
+            @Override
+            public IScalarEvaluator createScalarEvaluator(IEvaluatorContext ctx) throws HyracksDataException {
+                return new AbstractFloatConstructorEvaluator(ctx, args[0].createScalarEvaluator(ctx), sourceLoc) {
+
+                    @Override
+                    protected FunctionIdentifier getIdentifier() {
+                        return AFloatCastNullConstructorDescriptor.this.getIdentifier();
+                    }
+
+                    @Override
+                    protected boolean checkAndSetMissingOrNull(IPointable result) throws HyracksDataException {
+                        return PointableHelper.checkAndSetNull(result, inputArg);
+                    }
+                };
+            }
+        };
+    }
+
+    @Override
+    public FunctionIdentifier getIdentifier() {
+        return BuiltinFunctions.FLOAT_CAST_NULL_CONSTRUCTOR;
+    }
+}
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 0d443c7..ccd71b9 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
@@ -18,29 +18,15 @@
  */
 package org.apache.asterix.runtime.evaluators.constructors;
 
-import java.io.IOException;
-
 import org.apache.asterix.common.annotations.MissingNullInOutFunction;
-import org.apache.asterix.dataflow.data.nontagged.serde.ABooleanSerializerDeserializer;
-import org.apache.asterix.formats.nontagged.SerializerDeserializerProvider;
-import org.apache.asterix.om.base.AFloat;
-import org.apache.asterix.om.base.AMutableFloat;
 import org.apache.asterix.om.functions.BuiltinFunctions;
 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.om.types.EnumDeserializer;
-import org.apache.asterix.om.types.hierachy.ATypeHierarchy;
 import org.apache.asterix.runtime.evaluators.base.AbstractScalarFunctionDynamicDescriptor;
-import org.apache.asterix.runtime.evaluators.common.NumberUtils;
 import org.apache.hyracks.algebricks.core.algebra.functions.FunctionIdentifier;
 import org.apache.hyracks.algebricks.runtime.base.IEvaluatorContext;
 import org.apache.hyracks.algebricks.runtime.base.IScalarEvaluator;
 import org.apache.hyracks.algebricks.runtime.base.IScalarEvaluatorFactory;
-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.UTF8StringPointable;
 
 @MissingNullInOutFunction
 public class AFloatConstructorDescriptor extends AbstractScalarFunctionDynamicDescriptor {
@@ -54,74 +40,7 @@
 
             @Override
             public IScalarEvaluator createScalarEvaluator(IEvaluatorContext ctx) throws HyracksDataException {
-                return new AbstractConstructorEvaluator(ctx, args[0].createScalarEvaluator(ctx), sourceLoc) {
-
-                    private final AMutableFloat aFloat = new AMutableFloat(0);
-                    @SuppressWarnings("unchecked")
-                    private final ISerializerDeserializer<AFloat> floatSerde =
-                            SerializerDeserializerProvider.INSTANCE.getSerializerDeserializer(BuiltinType.AFLOAT);
-                    private final UTF8StringPointable utf8Ptr = new UTF8StringPointable();
-
-                    @Override
-                    protected void evaluateImpl(IPointable result) throws HyracksDataException {
-                        byte[] bytes = inputArg.getByteArray();
-                        int startOffset = inputArg.getStartOffset();
-                        int len = inputArg.getLength();
-                        ATypeTag inputType = EnumDeserializer.ATYPETAGDESERIALIZER.deserialize(bytes[startOffset]);
-                        switch (inputType) {
-                            case FLOAT:
-                                result.set(inputArg);
-                                break;
-                            case TINYINT:
-                            case SMALLINT:
-                            case INTEGER:
-                            case BIGINT:
-                                resultStorage.reset();
-                                try {
-                                    ATypeHierarchy.getTypePromoteComputer(inputType, ATypeTag.FLOAT).convertType(bytes,
-                                            startOffset + 1, len - 1, out);
-                                } catch (IOException e) {
-                                    throw HyracksDataException.create(e);
-                                }
-                                result.set(resultStorage);
-                                break;
-                            case DOUBLE:
-                                resultStorage.reset();
-                                try {
-                                    ATypeHierarchy.getTypeDemoteComputer(inputType, ATypeTag.FLOAT, false)
-                                            .convertType(bytes, startOffset + 1, len - 1, out);
-                                } catch (IOException e) {
-                                    throw HyracksDataException.create(e);
-                                }
-                                result.set(resultStorage);
-                                break;
-                            case BOOLEAN:
-                                boolean b = ABooleanSerializerDeserializer.getBoolean(bytes, startOffset + 1);
-                                aFloat.setValue(b ? 1 : 0);
-                                resultStorage.reset();
-                                floatSerde.serialize(aFloat, out);
-                                result.set(resultStorage);
-                                break;
-                            case STRING:
-                                utf8Ptr.set(bytes, startOffset + 1, len - 1);
-                                if (NumberUtils.parseFloat(utf8Ptr, aFloat)) {
-                                    resultStorage.reset();
-                                    floatSerde.serialize(aFloat, out);
-                                    result.set(resultStorage);
-                                } else {
-                                    handleParseError(utf8Ptr, result);
-                                }
-                                break;
-                            default:
-                                handleUnsupportedType(inputType, result);
-                                break;
-                        }
-                    }
-
-                    @Override
-                    protected BuiltinType getTargetType() {
-                        return BuiltinType.AFLOAT;
-                    }
+                return new AbstractFloatConstructorEvaluator(ctx, args[0].createScalarEvaluator(ctx), sourceLoc) {
 
                     @Override
                     protected FunctionIdentifier getIdentifier() {
diff --git a/asterixdb/asterix-runtime/src/main/java/org/apache/asterix/runtime/evaluators/constructors/AInt16CastNullConstructorDescriptor.java b/asterixdb/asterix-runtime/src/main/java/org/apache/asterix/runtime/evaluators/constructors/AInt16CastNullConstructorDescriptor.java
new file mode 100644
index 0000000..aa84791
--- /dev/null
+++ b/asterixdb/asterix-runtime/src/main/java/org/apache/asterix/runtime/evaluators/constructors/AInt16CastNullConstructorDescriptor.java
@@ -0,0 +1,65 @@
+/*
+ * 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 org.apache.asterix.common.annotations.MissingNullInOutFunction;
+import org.apache.asterix.om.functions.BuiltinFunctions;
+import org.apache.asterix.om.functions.IFunctionDescriptorFactory;
+import org.apache.asterix.runtime.evaluators.base.AbstractScalarFunctionDynamicDescriptor;
+import org.apache.asterix.runtime.evaluators.functions.PointableHelper;
+import org.apache.hyracks.algebricks.core.algebra.functions.FunctionIdentifier;
+import org.apache.hyracks.algebricks.runtime.base.IEvaluatorContext;
+import org.apache.hyracks.algebricks.runtime.base.IScalarEvaluator;
+import org.apache.hyracks.algebricks.runtime.base.IScalarEvaluatorFactory;
+import org.apache.hyracks.api.exceptions.HyracksDataException;
+import org.apache.hyracks.data.std.api.IPointable;
+
+@MissingNullInOutFunction
+public class AInt16CastNullConstructorDescriptor extends AbstractScalarFunctionDynamicDescriptor {
+    private static final long serialVersionUID = 1L;
+    public static final IFunctionDescriptorFactory FACTORY = AInt16CastNullConstructorDescriptor::new;
+
+    @Override
+    public IScalarEvaluatorFactory createEvaluatorFactory(final IScalarEvaluatorFactory[] args) {
+        return new IScalarEvaluatorFactory() {
+            private static final long serialVersionUID = 1L;
+
+            @Override
+            public IScalarEvaluator createScalarEvaluator(IEvaluatorContext ctx) throws HyracksDataException {
+                return new AbstractInt16ConstructorEvaluator(ctx, args[0].createScalarEvaluator(ctx), sourceLoc) {
+
+                    @Override
+                    protected FunctionIdentifier getIdentifier() {
+                        return AInt16CastNullConstructorDescriptor.this.getIdentifier();
+                    }
+
+                    @Override
+                    protected boolean checkAndSetMissingOrNull(IPointable result) throws HyracksDataException {
+                        return PointableHelper.checkAndSetNull(result, inputArg);
+                    }
+                };
+            }
+        };
+    }
+
+    @Override
+    public FunctionIdentifier getIdentifier() {
+        return BuiltinFunctions.INT16_CAST_NULL_CONSTRUCTOR;
+    }
+}
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 f8f1537..87f377e 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
@@ -18,29 +18,15 @@
  */
 package org.apache.asterix.runtime.evaluators.constructors;
 
-import java.io.IOException;
-
 import org.apache.asterix.common.annotations.MissingNullInOutFunction;
-import org.apache.asterix.dataflow.data.nontagged.serde.ABooleanSerializerDeserializer;
-import org.apache.asterix.formats.nontagged.SerializerDeserializerProvider;
-import org.apache.asterix.om.base.AInt16;
-import org.apache.asterix.om.base.AMutableInt16;
 import org.apache.asterix.om.functions.BuiltinFunctions;
 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.om.types.EnumDeserializer;
-import org.apache.asterix.om.types.hierachy.ATypeHierarchy;
 import org.apache.asterix.runtime.evaluators.base.AbstractScalarFunctionDynamicDescriptor;
-import org.apache.asterix.runtime.evaluators.common.NumberUtils;
 import org.apache.hyracks.algebricks.core.algebra.functions.FunctionIdentifier;
 import org.apache.hyracks.algebricks.runtime.base.IEvaluatorContext;
 import org.apache.hyracks.algebricks.runtime.base.IScalarEvaluator;
 import org.apache.hyracks.algebricks.runtime.base.IScalarEvaluatorFactory;
-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.UTF8StringPointable;
 
 @MissingNullInOutFunction
 public class AInt16ConstructorDescriptor extends AbstractScalarFunctionDynamicDescriptor {
@@ -55,74 +41,7 @@
 
             @Override
             public IScalarEvaluator createScalarEvaluator(IEvaluatorContext ctx) throws HyracksDataException {
-                return new AbstractConstructorEvaluator(ctx, args[0].createScalarEvaluator(ctx), sourceLoc) {
-
-                    private final AMutableInt16 aInt16 = new AMutableInt16((short) 0);
-                    @SuppressWarnings("unchecked")
-                    private final ISerializerDeserializer<AInt16> int16Serde =
-                            SerializerDeserializerProvider.INSTANCE.getSerializerDeserializer(BuiltinType.AINT16);
-                    private final UTF8StringPointable utf8Ptr = new UTF8StringPointable();
-
-                    @Override
-                    protected void evaluateImpl(IPointable result) throws HyracksDataException {
-                        byte[] bytes = inputArg.getByteArray();
-                        int startOffset = inputArg.getStartOffset();
-                        int len = inputArg.getLength();
-                        ATypeTag inputType = EnumDeserializer.ATYPETAGDESERIALIZER.deserialize(bytes[startOffset]);
-                        switch (inputType) {
-                            case SMALLINT:
-                                result.set(inputArg);
-                                break;
-                            case TINYINT:
-                                resultStorage.reset();
-                                try {
-                                    ATypeHierarchy.getTypePromoteComputer(inputType, ATypeTag.SMALLINT)
-                                            .convertType(bytes, startOffset + 1, len - 1, out);
-                                } catch (IOException e) {
-                                    throw HyracksDataException.create(e);
-                                }
-                                result.set(resultStorage);
-                                break;
-                            case INTEGER:
-                            case BIGINT:
-                            case FLOAT:
-                            case DOUBLE:
-                                resultStorage.reset();
-                                try {
-                                    ATypeHierarchy.getTypeDemoteComputer(inputType, ATypeTag.SMALLINT, false)
-                                            .convertType(bytes, startOffset + 1, len - 1, out);
-                                } catch (IOException e) {
-                                    throw HyracksDataException.create(e);
-                                }
-                                result.set(resultStorage);
-                                break;
-                            case BOOLEAN:
-                                boolean b = ABooleanSerializerDeserializer.getBoolean(bytes, startOffset + 1);
-                                aInt16.setValue((short) (b ? 1 : 0));
-                                resultStorage.reset();
-                                int16Serde.serialize(aInt16, out);
-                                result.set(resultStorage);
-                                break;
-                            case STRING:
-                                utf8Ptr.set(bytes, startOffset + 1, len - 1);
-                                if (NumberUtils.parseInt16(utf8Ptr, aInt16)) {
-                                    resultStorage.reset();
-                                    int16Serde.serialize(aInt16, out);
-                                    result.set(resultStorage);
-                                } else {
-                                    handleParseError(utf8Ptr, result);
-                                }
-                                break;
-                            default:
-                                handleUnsupportedType(inputType, result);
-                                break;
-                        }
-                    }
-
-                    @Override
-                    protected BuiltinType getTargetType() {
-                        return BuiltinType.AINT16;
-                    }
+                return new AbstractInt16ConstructorEvaluator(ctx, args[0].createScalarEvaluator(ctx), sourceLoc) {
 
                     @Override
                     protected FunctionIdentifier getIdentifier() {
diff --git a/asterixdb/asterix-runtime/src/main/java/org/apache/asterix/runtime/evaluators/constructors/AInt32CastNullConstructorDescriptor.java b/asterixdb/asterix-runtime/src/main/java/org/apache/asterix/runtime/evaluators/constructors/AInt32CastNullConstructorDescriptor.java
new file mode 100644
index 0000000..059a2b5
--- /dev/null
+++ b/asterixdb/asterix-runtime/src/main/java/org/apache/asterix/runtime/evaluators/constructors/AInt32CastNullConstructorDescriptor.java
@@ -0,0 +1,65 @@
+/*
+ * 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 org.apache.asterix.common.annotations.MissingNullInOutFunction;
+import org.apache.asterix.om.functions.BuiltinFunctions;
+import org.apache.asterix.om.functions.IFunctionDescriptorFactory;
+import org.apache.asterix.runtime.evaluators.base.AbstractScalarFunctionDynamicDescriptor;
+import org.apache.asterix.runtime.evaluators.functions.PointableHelper;
+import org.apache.hyracks.algebricks.core.algebra.functions.FunctionIdentifier;
+import org.apache.hyracks.algebricks.runtime.base.IEvaluatorContext;
+import org.apache.hyracks.algebricks.runtime.base.IScalarEvaluator;
+import org.apache.hyracks.algebricks.runtime.base.IScalarEvaluatorFactory;
+import org.apache.hyracks.api.exceptions.HyracksDataException;
+import org.apache.hyracks.data.std.api.IPointable;
+
+@MissingNullInOutFunction
+public class AInt32CastNullConstructorDescriptor extends AbstractScalarFunctionDynamicDescriptor {
+    private static final long serialVersionUID = 1L;
+    public static final IFunctionDescriptorFactory FACTORY = AInt32CastNullConstructorDescriptor::new;
+
+    @Override
+    public IScalarEvaluatorFactory createEvaluatorFactory(final IScalarEvaluatorFactory[] args) {
+        return new IScalarEvaluatorFactory() {
+            private static final long serialVersionUID = 1L;
+
+            @Override
+            public IScalarEvaluator createScalarEvaluator(IEvaluatorContext ctx) throws HyracksDataException {
+                return new AbstractInt32ConstructorEvaluator(ctx, args[0].createScalarEvaluator(ctx), sourceLoc) {
+
+                    @Override
+                    protected FunctionIdentifier getIdentifier() {
+                        return AInt32CastNullConstructorDescriptor.this.getIdentifier();
+                    }
+
+                    @Override
+                    protected boolean checkAndSetMissingOrNull(IPointable result) throws HyracksDataException {
+                        return PointableHelper.checkAndSetNull(result, inputArg);
+                    }
+                };
+            }
+        };
+    }
+
+    @Override
+    public FunctionIdentifier getIdentifier() {
+        return BuiltinFunctions.INT32_CAST_NULL_CONSTRUCTOR;
+    }
+}
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 da1d3ba..d9c13ab 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
@@ -18,29 +18,15 @@
  */
 package org.apache.asterix.runtime.evaluators.constructors;
 
-import java.io.IOException;
-
 import org.apache.asterix.common.annotations.MissingNullInOutFunction;
-import org.apache.asterix.dataflow.data.nontagged.serde.ABooleanSerializerDeserializer;
-import org.apache.asterix.formats.nontagged.SerializerDeserializerProvider;
-import org.apache.asterix.om.base.AInt32;
-import org.apache.asterix.om.base.AMutableInt32;
 import org.apache.asterix.om.functions.BuiltinFunctions;
 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.om.types.EnumDeserializer;
-import org.apache.asterix.om.types.hierachy.ATypeHierarchy;
 import org.apache.asterix.runtime.evaluators.base.AbstractScalarFunctionDynamicDescriptor;
-import org.apache.asterix.runtime.evaluators.common.NumberUtils;
 import org.apache.hyracks.algebricks.core.algebra.functions.FunctionIdentifier;
 import org.apache.hyracks.algebricks.runtime.base.IEvaluatorContext;
 import org.apache.hyracks.algebricks.runtime.base.IScalarEvaluator;
 import org.apache.hyracks.algebricks.runtime.base.IScalarEvaluatorFactory;
-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.UTF8StringPointable;
 
 @MissingNullInOutFunction
 public class AInt32ConstructorDescriptor extends AbstractScalarFunctionDynamicDescriptor {
@@ -54,74 +40,7 @@
 
             @Override
             public IScalarEvaluator createScalarEvaluator(IEvaluatorContext ctx) throws HyracksDataException {
-                return new AbstractConstructorEvaluator(ctx, args[0].createScalarEvaluator(ctx), sourceLoc) {
-
-                    private final AMutableInt32 aInt32 = new AMutableInt32(0);
-                    @SuppressWarnings("unchecked")
-                    private final ISerializerDeserializer<AInt32> int32Serde =
-                            SerializerDeserializerProvider.INSTANCE.getSerializerDeserializer(BuiltinType.AINT32);
-                    private final UTF8StringPointable utf8Ptr = new UTF8StringPointable();
-
-                    @Override
-                    protected void evaluateImpl(IPointable result) throws HyracksDataException {
-                        byte[] bytes = inputArg.getByteArray();
-                        int startOffset = inputArg.getStartOffset();
-                        int len = inputArg.getLength();
-                        ATypeTag inputType = EnumDeserializer.ATYPETAGDESERIALIZER.deserialize(bytes[startOffset]);
-                        switch (inputType) {
-                            case INTEGER:
-                                result.set(inputArg);
-                                break;
-                            case TINYINT:
-                            case SMALLINT:
-                                resultStorage.reset();
-                                try {
-                                    ATypeHierarchy.getTypePromoteComputer(inputType, ATypeTag.INTEGER)
-                                            .convertType(bytes, startOffset + 1, len - 1, out);
-                                } catch (IOException e) {
-                                    throw HyracksDataException.create(e);
-                                }
-                                result.set(resultStorage);
-                                break;
-                            case BIGINT:
-                            case FLOAT:
-                            case DOUBLE:
-                                resultStorage.reset();
-                                try {
-                                    ATypeHierarchy.getTypeDemoteComputer(inputType, ATypeTag.INTEGER, false)
-                                            .convertType(bytes, startOffset + 1, len - 1, out);
-                                } catch (IOException e) {
-                                    throw HyracksDataException.create(e);
-                                }
-                                result.set(resultStorage);
-                                break;
-                            case BOOLEAN:
-                                boolean b = ABooleanSerializerDeserializer.getBoolean(bytes, startOffset + 1);
-                                aInt32.setValue(b ? 1 : 0);
-                                resultStorage.reset();
-                                int32Serde.serialize(aInt32, out);
-                                result.set(resultStorage);
-                                break;
-                            case STRING:
-                                utf8Ptr.set(bytes, startOffset + 1, len - 1);
-                                if (NumberUtils.parseInt32(utf8Ptr, aInt32)) {
-                                    resultStorage.reset();
-                                    int32Serde.serialize(aInt32, out);
-                                    result.set(resultStorage);
-                                } else {
-                                    handleParseError(utf8Ptr, result);
-                                }
-                                break;
-                            default:
-                                handleUnsupportedType(inputType, result);
-                                break;
-                        }
-                    }
-
-                    @Override
-                    protected BuiltinType getTargetType() {
-                        return BuiltinType.AINT32;
-                    }
+                return new AbstractInt32ConstructorEvaluator(ctx, args[0].createScalarEvaluator(ctx), sourceLoc) {
 
                     @Override
                     protected FunctionIdentifier getIdentifier() {
diff --git a/asterixdb/asterix-runtime/src/main/java/org/apache/asterix/runtime/evaluators/constructors/AInt64CastNullConstructorDescriptor.java b/asterixdb/asterix-runtime/src/main/java/org/apache/asterix/runtime/evaluators/constructors/AInt64CastNullConstructorDescriptor.java
new file mode 100644
index 0000000..4beafca
--- /dev/null
+++ b/asterixdb/asterix-runtime/src/main/java/org/apache/asterix/runtime/evaluators/constructors/AInt64CastNullConstructorDescriptor.java
@@ -0,0 +1,64 @@
+/*
+ * 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 org.apache.asterix.common.annotations.MissingNullInOutFunction;
+import org.apache.asterix.om.functions.BuiltinFunctions;
+import org.apache.asterix.om.functions.IFunctionDescriptorFactory;
+import org.apache.asterix.runtime.evaluators.base.AbstractScalarFunctionDynamicDescriptor;
+import org.apache.asterix.runtime.evaluators.functions.PointableHelper;
+import org.apache.hyracks.algebricks.core.algebra.functions.FunctionIdentifier;
+import org.apache.hyracks.algebricks.runtime.base.IEvaluatorContext;
+import org.apache.hyracks.algebricks.runtime.base.IScalarEvaluator;
+import org.apache.hyracks.algebricks.runtime.base.IScalarEvaluatorFactory;
+import org.apache.hyracks.api.exceptions.HyracksDataException;
+import org.apache.hyracks.data.std.api.IPointable;
+
+@MissingNullInOutFunction
+public class AInt64CastNullConstructorDescriptor extends AbstractScalarFunctionDynamicDescriptor {
+    private static final long serialVersionUID = 1L;
+    public static final IFunctionDescriptorFactory FACTORY = AInt64CastNullConstructorDescriptor::new;
+
+    @Override
+    public IScalarEvaluatorFactory createEvaluatorFactory(final IScalarEvaluatorFactory[] args) {
+        return new IScalarEvaluatorFactory() {
+            private static final long serialVersionUID = 1L;
+
+            @Override
+            public IScalarEvaluator createScalarEvaluator(IEvaluatorContext ctx) throws HyracksDataException {
+                return new AbstractInt64ConstructorEvaluator(ctx, args[0].createScalarEvaluator(ctx), sourceLoc) {
+                    @Override
+                    public FunctionIdentifier getIdentifier() {
+                        return AInt64CastNullConstructorDescriptor.this.getIdentifier();
+                    }
+
+                    @Override
+                    protected boolean checkAndSetMissingOrNull(IPointable result) throws HyracksDataException {
+                        return PointableHelper.checkAndSetNull(result, inputArg);
+                    }
+                };
+            }
+        };
+    }
+
+    @Override
+    public FunctionIdentifier getIdentifier() {
+        return BuiltinFunctions.INT64_CAST_NULL_CONSTRUCTOR;
+    }
+}
diff --git a/asterixdb/asterix-runtime/src/main/java/org/apache/asterix/runtime/evaluators/constructors/AInt8CastNullConstructorDescriptor.java b/asterixdb/asterix-runtime/src/main/java/org/apache/asterix/runtime/evaluators/constructors/AInt8CastNullConstructorDescriptor.java
new file mode 100644
index 0000000..0538d1d
--- /dev/null
+++ b/asterixdb/asterix-runtime/src/main/java/org/apache/asterix/runtime/evaluators/constructors/AInt8CastNullConstructorDescriptor.java
@@ -0,0 +1,65 @@
+/*
+ * 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 org.apache.asterix.common.annotations.MissingNullInOutFunction;
+import org.apache.asterix.om.functions.BuiltinFunctions;
+import org.apache.asterix.om.functions.IFunctionDescriptorFactory;
+import org.apache.asterix.runtime.evaluators.base.AbstractScalarFunctionDynamicDescriptor;
+import org.apache.asterix.runtime.evaluators.functions.PointableHelper;
+import org.apache.hyracks.algebricks.core.algebra.functions.FunctionIdentifier;
+import org.apache.hyracks.algebricks.runtime.base.IEvaluatorContext;
+import org.apache.hyracks.algebricks.runtime.base.IScalarEvaluator;
+import org.apache.hyracks.algebricks.runtime.base.IScalarEvaluatorFactory;
+import org.apache.hyracks.api.exceptions.HyracksDataException;
+import org.apache.hyracks.data.std.api.IPointable;
+
+@MissingNullInOutFunction
+public class AInt8CastNullConstructorDescriptor extends AbstractScalarFunctionDynamicDescriptor {
+    private static final long serialVersionUID = 1L;
+    public static final IFunctionDescriptorFactory FACTORY = AInt8CastNullConstructorDescriptor::new;
+
+    @Override
+    public IScalarEvaluatorFactory createEvaluatorFactory(final IScalarEvaluatorFactory[] args) {
+        return new IScalarEvaluatorFactory() {
+            private static final long serialVersionUID = 1L;
+
+            @Override
+            public IScalarEvaluator createScalarEvaluator(IEvaluatorContext ctx) throws HyracksDataException {
+                return new AbstractInt8ConstructorEvaluator(ctx, args[0].createScalarEvaluator(ctx), sourceLoc) {
+
+                    @Override
+                    protected FunctionIdentifier getIdentifier() {
+                        return AInt8CastNullConstructorDescriptor.this.getIdentifier();
+                    }
+
+                    @Override
+                    protected boolean checkAndSetMissingOrNull(IPointable result) throws HyracksDataException {
+                        return PointableHelper.checkAndSetNull(result, inputArg);
+                    }
+                };
+            }
+        };
+    }
+
+    @Override
+    public FunctionIdentifier getIdentifier() {
+        return BuiltinFunctions.INT8_CAST_NULL_CONSTRUCTOR;
+    }
+}
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 2305eef..425623a 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
@@ -18,29 +18,15 @@
  */
 package org.apache.asterix.runtime.evaluators.constructors;
 
-import java.io.IOException;
-
 import org.apache.asterix.common.annotations.MissingNullInOutFunction;
-import org.apache.asterix.dataflow.data.nontagged.serde.ABooleanSerializerDeserializer;
-import org.apache.asterix.formats.nontagged.SerializerDeserializerProvider;
-import org.apache.asterix.om.base.AInt8;
-import org.apache.asterix.om.base.AMutableInt8;
 import org.apache.asterix.om.functions.BuiltinFunctions;
 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.om.types.EnumDeserializer;
-import org.apache.asterix.om.types.hierachy.ATypeHierarchy;
 import org.apache.asterix.runtime.evaluators.base.AbstractScalarFunctionDynamicDescriptor;
-import org.apache.asterix.runtime.evaluators.common.NumberUtils;
 import org.apache.hyracks.algebricks.core.algebra.functions.FunctionIdentifier;
 import org.apache.hyracks.algebricks.runtime.base.IEvaluatorContext;
 import org.apache.hyracks.algebricks.runtime.base.IScalarEvaluator;
 import org.apache.hyracks.algebricks.runtime.base.IScalarEvaluatorFactory;
-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.UTF8StringPointable;
 
 @MissingNullInOutFunction
 public class AInt8ConstructorDescriptor extends AbstractScalarFunctionDynamicDescriptor {
@@ -54,65 +40,7 @@
 
             @Override
             public IScalarEvaluator createScalarEvaluator(IEvaluatorContext ctx) throws HyracksDataException {
-                return new AbstractConstructorEvaluator(ctx, args[0].createScalarEvaluator(ctx), sourceLoc) {
-
-                    private final AMutableInt8 aInt8 = new AMutableInt8((byte) 0);
-                    @SuppressWarnings("unchecked")
-                    private final ISerializerDeserializer<AInt8> int8Serde =
-                            SerializerDeserializerProvider.INSTANCE.getSerializerDeserializer(BuiltinType.AINT8);
-                    private final UTF8StringPointable utf8Ptr = new UTF8StringPointable();
-
-                    @Override
-                    protected void evaluateImpl(IPointable result) throws HyracksDataException {
-                        byte[] bytes = inputArg.getByteArray();
-                        int startOffset = inputArg.getStartOffset();
-                        int len = inputArg.getLength();
-                        ATypeTag inputType = EnumDeserializer.ATYPETAGDESERIALIZER.deserialize(bytes[startOffset]);
-                        switch (inputType) {
-                            case TINYINT:
-                                result.set(inputArg);
-                                break;
-                            case SMALLINT:
-                            case INTEGER:
-                            case BIGINT:
-                            case FLOAT:
-                            case DOUBLE:
-                                resultStorage.reset();
-                                try {
-                                    ATypeHierarchy.getTypeDemoteComputer(inputType, ATypeTag.TINYINT, false)
-                                            .convertType(bytes, startOffset + 1, len - 1, out);
-                                } catch (IOException e) {
-                                    throw HyracksDataException.create(e);
-                                }
-                                result.set(resultStorage);
-                                break;
-                            case BOOLEAN:
-                                boolean b = ABooleanSerializerDeserializer.getBoolean(bytes, startOffset + 1);
-                                aInt8.setValue((byte) (b ? 1 : 0));
-                                resultStorage.reset();
-                                int8Serde.serialize(aInt8, out);
-                                result.set(resultStorage);
-                                break;
-                            case STRING:
-                                utf8Ptr.set(bytes, startOffset + 1, len - 1);
-                                if (NumberUtils.parseInt8(utf8Ptr, aInt8)) {
-                                    resultStorage.reset();
-                                    int8Serde.serialize(aInt8, out);
-                                    result.set(resultStorage);
-                                } else {
-                                    handleParseError(utf8Ptr, result);
-                                }
-                                break;
-                            default:
-                                handleUnsupportedType(inputType, result);
-                                break;
-                        }
-                    }
-
-                    @Override
-                    protected BuiltinType getTargetType() {
-                        return BuiltinType.AINT8;
-                    }
+                return new AbstractInt8ConstructorEvaluator(ctx, args[0].createScalarEvaluator(ctx), sourceLoc) {
 
                     @Override
                     protected FunctionIdentifier getIdentifier() {
diff --git a/asterixdb/asterix-runtime/src/main/java/org/apache/asterix/runtime/evaluators/constructors/AStringCastNullConstructorDescriptor.java b/asterixdb/asterix-runtime/src/main/java/org/apache/asterix/runtime/evaluators/constructors/AStringCastNullConstructorDescriptor.java
new file mode 100644
index 0000000..45597fe
--- /dev/null
+++ b/asterixdb/asterix-runtime/src/main/java/org/apache/asterix/runtime/evaluators/constructors/AStringCastNullConstructorDescriptor.java
@@ -0,0 +1,65 @@
+/*
+ * 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 org.apache.asterix.common.annotations.MissingNullInOutFunction;
+import org.apache.asterix.om.functions.BuiltinFunctions;
+import org.apache.asterix.om.functions.IFunctionDescriptorFactory;
+import org.apache.asterix.runtime.evaluators.base.AbstractScalarFunctionDynamicDescriptor;
+import org.apache.asterix.runtime.evaluators.functions.PointableHelper;
+import org.apache.hyracks.algebricks.core.algebra.functions.FunctionIdentifier;
+import org.apache.hyracks.algebricks.runtime.base.IEvaluatorContext;
+import org.apache.hyracks.algebricks.runtime.base.IScalarEvaluator;
+import org.apache.hyracks.algebricks.runtime.base.IScalarEvaluatorFactory;
+import org.apache.hyracks.api.exceptions.HyracksDataException;
+import org.apache.hyracks.data.std.api.IPointable;
+
+@MissingNullInOutFunction
+public class AStringCastNullConstructorDescriptor extends AbstractScalarFunctionDynamicDescriptor {
+
+    private static final long serialVersionUID = 1L;
+    public static final IFunctionDescriptorFactory FACTORY = AStringCastNullConstructorDescriptor::new;
+
+    @Override
+    public IScalarEvaluatorFactory createEvaluatorFactory(final IScalarEvaluatorFactory[] args) {
+        return new IScalarEvaluatorFactory() {
+            private static final long serialVersionUID = 1L;
+
+            @Override
+            public IScalarEvaluator createScalarEvaluator(IEvaluatorContext ctx) throws HyracksDataException {
+                return new AbstractStringConstructorEvaluator(ctx, args[0].createScalarEvaluator(ctx), sourceLoc) {
+                    @Override
+                    protected FunctionIdentifier getIdentifier() {
+                        return AStringCastNullConstructorDescriptor.this.getIdentifier();
+                    }
+
+                    @Override
+                    protected boolean checkAndSetMissingOrNull(IPointable result) throws HyracksDataException {
+                        return PointableHelper.checkAndSetNull(result, inputArg);
+                    }
+                };
+            }
+        };
+    }
+
+    @Override
+    public FunctionIdentifier getIdentifier() {
+        return BuiltinFunctions.STRING_CAST_NULL_CONSTRUCTOR;
+    }
+}
diff --git a/asterixdb/asterix-runtime/src/main/java/org/apache/asterix/runtime/evaluators/constructors/ATimeCastNullConstructorDescriptor.java b/asterixdb/asterix-runtime/src/main/java/org/apache/asterix/runtime/evaluators/constructors/ATimeCastNullConstructorDescriptor.java
new file mode 100644
index 0000000..0f6cae1
--- /dev/null
+++ b/asterixdb/asterix-runtime/src/main/java/org/apache/asterix/runtime/evaluators/constructors/ATimeCastNullConstructorDescriptor.java
@@ -0,0 +1,65 @@
+/*
+ * 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 org.apache.asterix.common.annotations.MissingNullInOutFunction;
+import org.apache.asterix.om.functions.BuiltinFunctions;
+import org.apache.asterix.om.functions.IFunctionDescriptorFactory;
+import org.apache.asterix.runtime.evaluators.base.AbstractScalarFunctionDynamicDescriptor;
+import org.apache.asterix.runtime.evaluators.functions.PointableHelper;
+import org.apache.hyracks.algebricks.core.algebra.functions.FunctionIdentifier;
+import org.apache.hyracks.algebricks.runtime.base.IEvaluatorContext;
+import org.apache.hyracks.algebricks.runtime.base.IScalarEvaluator;
+import org.apache.hyracks.algebricks.runtime.base.IScalarEvaluatorFactory;
+import org.apache.hyracks.api.exceptions.HyracksDataException;
+import org.apache.hyracks.data.std.api.IPointable;
+
+@MissingNullInOutFunction
+public class ATimeCastNullConstructorDescriptor extends AbstractScalarFunctionDynamicDescriptor {
+    private static final long serialVersionUID = 1L;
+    public static final IFunctionDescriptorFactory FACTORY = ATimeCastNullConstructorDescriptor::new;
+
+    @Override
+    public IScalarEvaluatorFactory createEvaluatorFactory(final IScalarEvaluatorFactory[] args) {
+        return new IScalarEvaluatorFactory() {
+            private static final long serialVersionUID = 1L;
+
+            @Override
+            public IScalarEvaluator createScalarEvaluator(IEvaluatorContext ctx) throws HyracksDataException {
+                return new AbstractTimeConstructorEvaluator(ctx, args[0].createScalarEvaluator(ctx), sourceLoc) {
+
+                    @Override
+                    protected FunctionIdentifier getIdentifier() {
+                        return ATimeCastNullConstructorDescriptor.this.getIdentifier();
+                    }
+
+                    @Override
+                    protected boolean checkAndSetMissingOrNull(IPointable result) throws HyracksDataException {
+                        return PointableHelper.checkAndSetNull(result, inputArg);
+                    }
+                };
+            }
+        };
+    }
+
+    @Override
+    public FunctionIdentifier getIdentifier() {
+        return BuiltinFunctions.TIME_CAST_NULL_CONSTRUCTOR;
+    }
+}
diff --git a/asterixdb/asterix-runtime/src/main/java/org/apache/asterix/runtime/evaluators/constructors/ATimeCastNullConstructorWithFormatDescriptor.java b/asterixdb/asterix-runtime/src/main/java/org/apache/asterix/runtime/evaluators/constructors/ATimeCastNullConstructorWithFormatDescriptor.java
new file mode 100644
index 0000000..5afba07
--- /dev/null
+++ b/asterixdb/asterix-runtime/src/main/java/org/apache/asterix/runtime/evaluators/constructors/ATimeCastNullConstructorWithFormatDescriptor.java
@@ -0,0 +1,67 @@
+/*
+ * 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 org.apache.asterix.om.functions.BuiltinFunctions;
+import org.apache.asterix.om.functions.IFunctionDescriptorFactory;
+import org.apache.asterix.runtime.evaluators.base.AbstractScalarFunctionDynamicDescriptor;
+import org.apache.asterix.runtime.evaluators.functions.PointableHelper;
+import org.apache.hyracks.algebricks.core.algebra.functions.FunctionIdentifier;
+import org.apache.hyracks.algebricks.runtime.base.IEvaluatorContext;
+import org.apache.hyracks.algebricks.runtime.base.IScalarEvaluator;
+import org.apache.hyracks.algebricks.runtime.base.IScalarEvaluatorFactory;
+import org.apache.hyracks.api.exceptions.HyracksDataException;
+import org.apache.hyracks.data.std.api.IPointable;
+
+public class ATimeCastNullConstructorWithFormatDescriptor extends AbstractScalarFunctionDynamicDescriptor {
+    private static final long serialVersionUID = 1L;
+    public static final IFunctionDescriptorFactory FACTORY = ATimeCastNullConstructorWithFormatDescriptor::new;
+
+    @Override
+    public IScalarEvaluatorFactory createEvaluatorFactory(final IScalarEvaluatorFactory[] args) {
+        return new IScalarEvaluatorFactory() {
+            private static final long serialVersionUID = 1L;
+
+            @Override
+            public IScalarEvaluator createScalarEvaluator(IEvaluatorContext ctx) throws HyracksDataException {
+                return new AbstractTimeWithFormatConstructorEvaluator(ctx, args, sourceLoc) {
+
+                    @Override
+                    protected FunctionIdentifier getIdentifier() {
+                        return ATimeCastNullConstructorWithFormatDescriptor.this.getIdentifier();
+                    }
+
+                    @Override
+                    protected boolean checkAndSetMissingOrNull(IPointable result) throws HyracksDataException {
+                        if (PointableHelper.checkAndSetNull(result, inputArg)) {
+                            return true;
+                        }
+                        return super.checkAndSetMissingOrNull(result);
+                    }
+                };
+            }
+        };
+    }
+
+    @Override
+    public FunctionIdentifier getIdentifier() {
+        return BuiltinFunctions.TIME_CAST_NULL_CONSTRUCTOR_WITH_FORMAT;
+    }
+}
diff --git a/asterixdb/asterix-runtime/src/main/java/org/apache/asterix/runtime/evaluators/constructors/ATimeConstructorWithFormatDescriptor.java b/asterixdb/asterix-runtime/src/main/java/org/apache/asterix/runtime/evaluators/constructors/ATimeConstructorWithFormatDescriptor.java
index e2df1be..72141d6 100644
--- a/asterixdb/asterix-runtime/src/main/java/org/apache/asterix/runtime/evaluators/constructors/ATimeConstructorWithFormatDescriptor.java
+++ b/asterixdb/asterix-runtime/src/main/java/org/apache/asterix/runtime/evaluators/constructors/ATimeConstructorWithFormatDescriptor.java
@@ -19,14 +19,8 @@
 
 package org.apache.asterix.runtime.evaluators.constructors;
 
-import org.apache.asterix.om.base.AMutableInt64;
-import org.apache.asterix.om.base.AMutableTime;
-import org.apache.asterix.om.base.temporal.AsterixTemporalTypeParseException;
-import org.apache.asterix.om.base.temporal.DateTimeFormatUtils;
 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.runtime.evaluators.base.AbstractScalarFunctionDynamicDescriptor;
 import org.apache.asterix.runtime.evaluators.functions.PointableHelper;
 import org.apache.hyracks.algebricks.core.algebra.functions.FunctionIdentifier;
@@ -35,18 +29,10 @@
 import org.apache.hyracks.algebricks.runtime.base.IScalarEvaluatorFactory;
 import org.apache.hyracks.api.exceptions.HyracksDataException;
 import org.apache.hyracks.data.std.api.IPointable;
-import org.apache.hyracks.data.std.primitive.UTF8StringPointable;
-import org.apache.hyracks.data.std.primitive.VoidPointable;
-import org.apache.hyracks.dataflow.common.data.accessors.IFrameTupleReference;
 
 public class ATimeConstructorWithFormatDescriptor extends AbstractScalarFunctionDynamicDescriptor {
     private static final long serialVersionUID = 1L;
-    public static final IFunctionDescriptorFactory FACTORY = new IFunctionDescriptorFactory() {
-        @Override
-        public IFunctionDescriptor createFunctionDescriptor() {
-            return new ATimeConstructorWithFormatDescriptor();
-        }
-    };
+    public static final IFunctionDescriptorFactory FACTORY = ATimeConstructorWithFormatDescriptor::new;
 
     @Override
     public IScalarEvaluatorFactory createEvaluatorFactory(final IScalarEvaluatorFactory[] args) {
@@ -55,48 +41,7 @@
 
             @Override
             public IScalarEvaluator createScalarEvaluator(IEvaluatorContext ctx) throws HyracksDataException {
-                return new AbstractTimeConstructorEvaluator(ctx, args[0].createScalarEvaluator(ctx), sourceLoc) {
-
-                    private final IScalarEvaluator formatEval = args[1].createScalarEvaluator(ctx);
-                    private final IPointable formatArg = new VoidPointable();
-                    private final UTF8StringPointable formatTextPtr = new UTF8StringPointable();
-                    private final AMutableInt64 aInt64 = new AMutableInt64(0);
-
-                    @Override
-                    protected void evaluateInput(IFrameTupleReference tuple) throws HyracksDataException {
-                        super.evaluateInput(tuple);
-                        formatEval.evaluate(tuple, formatArg);
-                    }
-
-                    @Override
-                    protected boolean checkAndSetMissingOrNull(IPointable result) throws HyracksDataException {
-                        return PointableHelper.checkAndSetMissingOrNull(result, inputArg, formatArg);
-                    }
-
-                    @Override
-                    protected boolean parseTime(UTF8StringPointable textPtr, AMutableTime result) {
-                        byte[] formatBytes = formatArg.getByteArray();
-                        int formatStartOffset = formatArg.getStartOffset();
-                        int formatLength = formatArg.getLength();
-                        if (formatBytes[formatStartOffset] != ATypeTag.SERIALIZED_STRING_TYPE_TAG) {
-                            return false;
-                        }
-                        formatTextPtr.set(formatBytes, formatStartOffset + 1, formatLength - 1);
-                        try {
-                            if (DateTimeFormatUtils.getInstance().parseDateTime(aInt64, textPtr.getByteArray(),
-                                    textPtr.getCharStartOffset(), textPtr.getUTF8Length(), formatBytes,
-                                    formatTextPtr.getCharStartOffset(), formatTextPtr.getUTF8Length(),
-                                    DateTimeFormatUtils.DateTimeParseMode.TIME_ONLY, false)) {
-                                result.setValue((int) aInt64.getLongValue());
-                                return true;
-                            } else {
-                                return false;
-                            }
-                        } catch (AsterixTemporalTypeParseException e) {
-                            // shouldn't happen
-                            return false;
-                        }
-                    }
+                return new AbstractTimeWithFormatConstructorEvaluator(ctx, args, sourceLoc) {
 
                     @Override
                     protected FunctionIdentifier getIdentifier() {
diff --git a/asterixdb/asterix-runtime/src/main/java/org/apache/asterix/runtime/evaluators/constructors/AUUIDFromStringCastNullConstructorDescriptor.java b/asterixdb/asterix-runtime/src/main/java/org/apache/asterix/runtime/evaluators/constructors/AUUIDFromStringCastNullConstructorDescriptor.java
new file mode 100644
index 0000000..2c1fb39
--- /dev/null
+++ b/asterixdb/asterix-runtime/src/main/java/org/apache/asterix/runtime/evaluators/constructors/AUUIDFromStringCastNullConstructorDescriptor.java
@@ -0,0 +1,71 @@
+/*
+ * 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 org.apache.asterix.common.annotations.MissingNullInOutFunction;
+import org.apache.asterix.om.functions.BuiltinFunctions;
+import org.apache.asterix.om.functions.IFunctionDescriptorFactory;
+import org.apache.asterix.runtime.evaluators.base.AbstractScalarFunctionDynamicDescriptor;
+import org.apache.asterix.runtime.evaluators.functions.PointableHelper;
+import org.apache.hyracks.algebricks.core.algebra.functions.FunctionIdentifier;
+import org.apache.hyracks.algebricks.runtime.base.IEvaluatorContext;
+import org.apache.hyracks.algebricks.runtime.base.IScalarEvaluator;
+import org.apache.hyracks.algebricks.runtime.base.IScalarEvaluatorFactory;
+import org.apache.hyracks.api.exceptions.HyracksDataException;
+import org.apache.hyracks.data.std.api.IPointable;
+
+/**
+ * Receives a canonical representation of UUID and construct a UUID value.
+ * a UUID is represented by 32 lowercase hexadecimal digits (8-4-4-4-12). (E.g.
+ * uuid("02a199ca-bf58-412e-bd9f-60a0c975a8ac"))
+ */
+
+@MissingNullInOutFunction
+public class AUUIDFromStringCastNullConstructorDescriptor extends AbstractScalarFunctionDynamicDescriptor {
+    private static final long serialVersionUID = 1L;
+    public static final IFunctionDescriptorFactory FACTORY = AUUIDFromStringCastNullConstructorDescriptor::new;
+
+    @Override
+    public IScalarEvaluatorFactory createEvaluatorFactory(final IScalarEvaluatorFactory[] args) {
+        return new IScalarEvaluatorFactory() {
+            private static final long serialVersionUID = 1L;
+
+            @Override
+            public IScalarEvaluator createScalarEvaluator(IEvaluatorContext ctx) throws HyracksDataException {
+                return new AbstractUUIDFromStringConstructorEvaluator(ctx, args[0].createScalarEvaluator(ctx), sourceLoc) {
+
+                    @Override
+                    protected FunctionIdentifier getIdentifier() {
+                        return AUUIDFromStringCastNullConstructorDescriptor.this.getIdentifier();
+                    }
+
+                    @Override
+                    protected boolean checkAndSetMissingOrNull(IPointable result) throws HyracksDataException {
+                        return PointableHelper.checkAndSetNull(result, inputArg);
+                    }
+                };
+            }
+        };
+    }
+
+    @Override
+    public FunctionIdentifier getIdentifier() {
+        return BuiltinFunctions.UUID_CAST_NULL_CONSTRUCTOR;
+    }
+}
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 ec2b9db..b8d6bc5 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
@@ -55,44 +55,7 @@
 
             @Override
             public IScalarEvaluator createScalarEvaluator(IEvaluatorContext ctx) throws HyracksDataException {
-                return new AbstractConstructorEvaluator(ctx, args[0].createScalarEvaluator(ctx), sourceLoc) {
-
-                    private final AMutableUUID uuid = new AMutableUUID();
-                    @SuppressWarnings("unchecked")
-                    private final ISerializerDeserializer<AUUID> uuidSerde =
-                            SerializerDeserializerProvider.INSTANCE.getSerializerDeserializer(BuiltinType.AUUID);
-                    private final UTF8StringPointable utf8Ptr = new UTF8StringPointable();
-
-                    @Override
-                    protected void evaluateImpl(IPointable result) throws HyracksDataException {
-                        byte[] bytes = inputArg.getByteArray();
-                        int startOffset = inputArg.getStartOffset();
-                        int len = inputArg.getLength();
-                        ATypeTag inputType = EnumDeserializer.ATYPETAGDESERIALIZER.deserialize(bytes[startOffset]);
-                        switch (inputType) {
-                            case UUID:
-                                result.set(inputArg);
-                                break;
-                            case STRING:
-                                utf8Ptr.set(bytes, startOffset + 1, len - 1);
-                                if (parseUUID(utf8Ptr, uuid)) {
-                                    resultStorage.reset();
-                                    uuidSerde.serialize(uuid, out);
-                                    result.set(resultStorage);
-                                } else {
-                                    handleParseError(utf8Ptr, result);
-                                }
-                                break;
-                            default:
-                                handleUnsupportedType(inputType, result);
-                                break;
-                        }
-                    }
-
-                    @Override
-                    protected BuiltinType getTargetType() {
-                        return BuiltinType.AUUID;
-                    }
+                return new AbstractUUIDFromStringConstructorEvaluator(ctx, args[0].createScalarEvaluator(ctx), sourceLoc) {
 
                     @Override
                     protected FunctionIdentifier getIdentifier() {
@@ -103,16 +66,6 @@
         };
     }
 
-    private static boolean parseUUID(UTF8StringPointable textPtr, AMutableUUID result) {
-        try {
-            // first byte: tag, next x bytes: length
-            result.parseUUIDHexBytes(textPtr.getByteArray(), textPtr.getCharStartOffset());
-            return true;
-        } catch (HyracksDataException e) {
-            return false;
-        }
-    }
-
     @Override
     public FunctionIdentifier getIdentifier() {
         return BuiltinFunctions.UUID_CONSTRUCTOR;
diff --git a/asterixdb/asterix-runtime/src/main/java/org/apache/asterix/runtime/evaluators/constructors/AYearMonthDurationCastNullConstructorDescriptor.java b/asterixdb/asterix-runtime/src/main/java/org/apache/asterix/runtime/evaluators/constructors/AYearMonthDurationCastNullConstructorDescriptor.java
new file mode 100644
index 0000000..eb6f6db
--- /dev/null
+++ b/asterixdb/asterix-runtime/src/main/java/org/apache/asterix/runtime/evaluators/constructors/AYearMonthDurationCastNullConstructorDescriptor.java
@@ -0,0 +1,66 @@
+/*
+ * 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 org.apache.asterix.common.annotations.MissingNullInOutFunction;
+import org.apache.asterix.om.functions.BuiltinFunctions;
+import org.apache.asterix.om.functions.IFunctionDescriptorFactory;
+import org.apache.asterix.runtime.evaluators.base.AbstractScalarFunctionDynamicDescriptor;
+import org.apache.asterix.runtime.evaluators.functions.PointableHelper;
+import org.apache.hyracks.algebricks.core.algebra.functions.FunctionIdentifier;
+import org.apache.hyracks.algebricks.runtime.base.IEvaluatorContext;
+import org.apache.hyracks.algebricks.runtime.base.IScalarEvaluator;
+import org.apache.hyracks.algebricks.runtime.base.IScalarEvaluatorFactory;
+import org.apache.hyracks.api.exceptions.HyracksDataException;
+import org.apache.hyracks.data.std.api.IPointable;
+
+@MissingNullInOutFunction
+public class AYearMonthDurationCastNullConstructorDescriptor extends AbstractScalarFunctionDynamicDescriptor {
+    private static final long serialVersionUID = 1L;
+    public static final IFunctionDescriptorFactory FACTORY = AYearMonthDurationCastNullConstructorDescriptor::new;
+
+    @Override
+    public IScalarEvaluatorFactory createEvaluatorFactory(final IScalarEvaluatorFactory[] args) {
+        return new IScalarEvaluatorFactory() {
+            private static final long serialVersionUID = 1L;
+
+            @Override
+            public IScalarEvaluator createScalarEvaluator(IEvaluatorContext ctx) throws HyracksDataException {
+                return new AbstractYearMonthDurationConstructorEvaluator(ctx, args[0].createScalarEvaluator(ctx), sourceLoc) {
+
+                    @Override
+                    protected FunctionIdentifier getIdentifier() {
+                        return AYearMonthDurationCastNullConstructorDescriptor.this.getIdentifier();
+                    }
+
+                    @Override
+                    protected boolean checkAndSetMissingOrNull(IPointable result) throws HyracksDataException {
+                        return PointableHelper.checkAndSetNull(result, inputArg);
+                    }
+                };
+            }
+        };
+    }
+
+    @Override
+    public FunctionIdentifier getIdentifier() {
+        return BuiltinFunctions.YEAR_MONTH_DURATION_CAST_NULL_CONSTRUCTOR;
+    }
+
+}
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 5a64f28..c2062de 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
@@ -52,52 +52,7 @@
 
             @Override
             public IScalarEvaluator createScalarEvaluator(IEvaluatorContext ctx) throws HyracksDataException {
-                return new AbstractConstructorEvaluator(ctx, args[0].createScalarEvaluator(ctx), sourceLoc) {
-
-                    private final AMutableYearMonthDuration aYearMonthDuration = new AMutableYearMonthDuration(0);
-                    @SuppressWarnings("unchecked")
-                    private final ISerializerDeserializer<AYearMonthDuration> yearMonthDurationSerde =
-                            SerializerDeserializerProvider.INSTANCE
-                                    .getSerializerDeserializer(BuiltinType.AYEARMONTHDURATION);
-                    private final UTF8StringPointable utf8Ptr = new UTF8StringPointable();
-
-                    @Override
-                    protected void evaluateImpl(IPointable result) throws HyracksDataException {
-                        byte[] bytes = inputArg.getByteArray();
-                        int startOffset = inputArg.getStartOffset();
-                        int len = inputArg.getLength();
-                        ATypeTag inputType = EnumDeserializer.ATYPETAGDESERIALIZER.deserialize(bytes[startOffset]);
-                        switch (inputType) {
-                            case YEARMONTHDURATION:
-                                result.set(inputArg);
-                                break;
-                            case DURATION:
-                                int months = ADurationSerializerDeserializer.getYearMonth(bytes, startOffset + 1);
-                                aYearMonthDuration.setMonths(months);
-                                resultStorage.reset();
-                                yearMonthDurationSerde.serialize(aYearMonthDuration, out);
-                                result.set(resultStorage);
-                                break;
-                            case STRING:
-                                utf8Ptr.set(bytes, startOffset + 1, len - 1);
-                                if (parseYearMonthDuration(utf8Ptr, aYearMonthDuration)) {
-                                    resultStorage.reset();
-                                    yearMonthDurationSerde.serialize(aYearMonthDuration, out);
-                                    result.set(resultStorage);
-                                } else {
-                                    handleParseError(utf8Ptr, result);
-                                }
-                                break;
-                            default:
-                                handleUnsupportedType(inputType, result);
-                                break;
-                        }
-                    }
-
-                    @Override
-                    protected BuiltinType getTargetType() {
-                        return BuiltinType.AYEARMONTHDURATION;
-                    }
+                return new AbstractYearMonthDurationConstructorEvaluator(ctx, args[0].createScalarEvaluator(ctx), sourceLoc) {
 
                     @Override
                     protected FunctionIdentifier getIdentifier() {
@@ -108,16 +63,6 @@
         };
     }
 
-    private static boolean parseYearMonthDuration(UTF8StringPointable textPtr, AMutableYearMonthDuration result) {
-        try {
-            ADurationParserFactory.parseDuration(textPtr.getByteArray(), textPtr.getCharStartOffset(),
-                    textPtr.getUTF8Length(), result, ADurationParseOption.YEAR_MONTH);
-            return true;
-        } catch (HyracksDataException e) {
-            return false;
-        }
-    }
-
     @Override
     public FunctionIdentifier getIdentifier() {
         return BuiltinFunctions.YEAR_MONTH_DURATION_CONSTRUCTOR;
diff --git a/asterixdb/asterix-runtime/src/main/java/org/apache/asterix/runtime/evaluators/constructors/AbstractDateConstructorWithFormatEvaluator.java b/asterixdb/asterix-runtime/src/main/java/org/apache/asterix/runtime/evaluators/constructors/AbstractDateConstructorWithFormatEvaluator.java
new file mode 100644
index 0000000..f02ddec
--- /dev/null
+++ b/asterixdb/asterix-runtime/src/main/java/org/apache/asterix/runtime/evaluators/constructors/AbstractDateConstructorWithFormatEvaluator.java
@@ -0,0 +1,87 @@
+/*
+ * 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 org.apache.asterix.om.base.AMutableDate;
+import org.apache.asterix.om.base.AMutableInt64;
+import org.apache.asterix.om.base.temporal.AsterixTemporalTypeParseException;
+import org.apache.asterix.om.base.temporal.DateTimeFormatUtils;
+import org.apache.asterix.om.base.temporal.GregorianCalendarSystem;
+import org.apache.asterix.om.types.ATypeTag;
+import org.apache.asterix.runtime.evaluators.functions.PointableHelper;
+import org.apache.hyracks.algebricks.runtime.base.IEvaluatorContext;
+import org.apache.hyracks.algebricks.runtime.base.IScalarEvaluator;
+import org.apache.hyracks.algebricks.runtime.base.IScalarEvaluatorFactory;
+import org.apache.hyracks.api.exceptions.HyracksDataException;
+import org.apache.hyracks.api.exceptions.SourceLocation;
+import org.apache.hyracks.data.std.api.IPointable;
+import org.apache.hyracks.data.std.primitive.UTF8StringPointable;
+import org.apache.hyracks.data.std.primitive.VoidPointable;
+import org.apache.hyracks.dataflow.common.data.accessors.IFrameTupleReference;
+
+public abstract class AbstractDateConstructorWithFormatEvaluator extends AbstractDateConstructorEvaluator {
+
+    private final IScalarEvaluator formatEval;
+    private final IPointable formatArg = new VoidPointable();
+    private final UTF8StringPointable formatTextPtr = new UTF8StringPointable();
+    private final AMutableInt64 aInt64 = new AMutableInt64(0);
+
+    protected AbstractDateConstructorWithFormatEvaluator(IEvaluatorContext ctx, IScalarEvaluatorFactory[] args,
+            SourceLocation sourceLoc) throws HyracksDataException {
+        super(ctx, args[0].createScalarEvaluator(ctx), sourceLoc);
+        formatEval = args[1].createScalarEvaluator(ctx);
+    }
+
+    @Override
+    protected void evaluateInput(IFrameTupleReference tuple) throws HyracksDataException {
+        super.evaluateInput(tuple);
+        formatEval.evaluate(tuple, formatArg);
+    }
+
+    @Override
+    protected boolean checkAndSetMissingOrNull(IPointable result) throws HyracksDataException {
+        return PointableHelper.checkAndSetMissingOrNull(result, inputArg, formatArg);
+    }
+
+    @Override
+    protected boolean parseDate(UTF8StringPointable textPtr, AMutableDate result) {
+        byte[] formatBytes = formatArg.getByteArray();
+        int formatStartOffset = formatArg.getStartOffset();
+        int formatLength = formatArg.getLength();
+        if (formatBytes[formatStartOffset] != ATypeTag.SERIALIZED_STRING_TYPE_TAG) {
+            return false;
+        }
+        formatTextPtr.set(formatBytes, formatStartOffset + 1, formatLength - 1);
+        try {
+            if (DateTimeFormatUtils.getInstance().parseDateTime(aInt64, textPtr.getByteArray(),
+                    textPtr.getCharStartOffset(), textPtr.getUTF8Length(), formatBytes,
+                    formatTextPtr.getCharStartOffset(), formatTextPtr.getUTF8Length(),
+                    DateTimeFormatUtils.DateTimeParseMode.DATE_ONLY, false)) {
+                result.setValue((int) (aInt64.getLongValue() / GregorianCalendarSystem.CHRONON_OF_DAY));
+                return true;
+            } else {
+                return false;
+            }
+        } catch (AsterixTemporalTypeParseException e) {
+            // shouldn't happen
+            return false;
+        }
+    }
+}
diff --git a/asterixdb/asterix-runtime/src/main/java/org/apache/asterix/runtime/evaluators/constructors/AbstractDateTimeConstructorWithFormatEvaluator.java b/asterixdb/asterix-runtime/src/main/java/org/apache/asterix/runtime/evaluators/constructors/AbstractDateTimeConstructorWithFormatEvaluator.java
new file mode 100644
index 0000000..c304d05
--- /dev/null
+++ b/asterixdb/asterix-runtime/src/main/java/org/apache/asterix/runtime/evaluators/constructors/AbstractDateTimeConstructorWithFormatEvaluator.java
@@ -0,0 +1,85 @@
+/*
+ * 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 org.apache.asterix.om.base.AMutableDateTime;
+import org.apache.asterix.om.base.AMutableInt64;
+import org.apache.asterix.om.base.temporal.AsterixTemporalTypeParseException;
+import org.apache.asterix.om.base.temporal.DateTimeFormatUtils;
+import org.apache.asterix.om.types.ATypeTag;
+import org.apache.asterix.runtime.evaluators.functions.PointableHelper;
+import org.apache.hyracks.algebricks.runtime.base.IEvaluatorContext;
+import org.apache.hyracks.algebricks.runtime.base.IScalarEvaluator;
+import org.apache.hyracks.algebricks.runtime.base.IScalarEvaluatorFactory;
+import org.apache.hyracks.api.exceptions.HyracksDataException;
+import org.apache.hyracks.api.exceptions.SourceLocation;
+import org.apache.hyracks.data.std.api.IPointable;
+import org.apache.hyracks.data.std.primitive.UTF8StringPointable;
+import org.apache.hyracks.data.std.primitive.VoidPointable;
+import org.apache.hyracks.dataflow.common.data.accessors.IFrameTupleReference;
+
+public abstract class AbstractDateTimeConstructorWithFormatEvaluator extends AbstractDateTimeConstructorEvaluator {
+
+    private final IScalarEvaluator formatEval;
+    private final IPointable formatArg = new VoidPointable();
+    private final UTF8StringPointable formatTextPtr = new UTF8StringPointable();
+    private final AMutableInt64 aInt64 = new AMutableInt64(0);
+
+    protected AbstractDateTimeConstructorWithFormatEvaluator(IEvaluatorContext ctx, IScalarEvaluatorFactory[] args,
+            SourceLocation sourceLoc) throws HyracksDataException {
+        super(ctx, args[0].createScalarEvaluator(ctx), sourceLoc);
+        formatEval = args[1].createScalarEvaluator(ctx);
+    }
+    @Override
+    protected void evaluateInput(IFrameTupleReference tuple) throws HyracksDataException {
+        super.evaluateInput(tuple);
+        formatEval.evaluate(tuple, formatArg);
+    }
+
+    @Override
+    protected boolean checkAndSetMissingOrNull(IPointable result) throws HyracksDataException {
+        return PointableHelper.checkAndSetMissingOrNull(result, inputArg, formatArg);
+    }
+
+    @Override
+    protected boolean parseDateTime(UTF8StringPointable textPtr, AMutableDateTime result) {
+        byte[] formatBytes = formatArg.getByteArray();
+        int formatStartOffset = formatArg.getStartOffset();
+        int formatLength = formatArg.getLength();
+        if (formatBytes[formatStartOffset] != ATypeTag.SERIALIZED_STRING_TYPE_TAG) {
+            return false;
+        }
+        formatTextPtr.set(formatBytes, formatStartOffset + 1, formatLength - 1);
+        try {
+            if (DateTimeFormatUtils.getInstance().parseDateTime(aInt64, textPtr.getByteArray(),
+                    textPtr.getCharStartOffset(), textPtr.getUTF8Length(), formatBytes,
+                    formatTextPtr.getCharStartOffset(), formatTextPtr.getUTF8Length(),
+                    DateTimeFormatUtils.DateTimeParseMode.DATETIME, false)) {
+                result.setValue(aInt64.getLongValue());
+                return true;
+            } else {
+                return false;
+            }
+        } catch (AsterixTemporalTypeParseException e) {
+            // shouldn't happen
+            return false;
+        }
+    }
+}
diff --git a/asterixdb/asterix-runtime/src/main/java/org/apache/asterix/runtime/evaluators/constructors/AbstractDayTimeDurationConstructorEvaluator.java b/asterixdb/asterix-runtime/src/main/java/org/apache/asterix/runtime/evaluators/constructors/AbstractDayTimeDurationConstructorEvaluator.java
new file mode 100644
index 0000000..479d44f
--- /dev/null
+++ b/asterixdb/asterix-runtime/src/main/java/org/apache/asterix/runtime/evaluators/constructors/AbstractDayTimeDurationConstructorEvaluator.java
@@ -0,0 +1,100 @@
+/*
+ * 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 org.apache.asterix.dataflow.data.nontagged.serde.ADurationSerializerDeserializer;
+import org.apache.asterix.formats.nontagged.SerializerDeserializerProvider;
+import org.apache.asterix.om.base.ADayTimeDuration;
+import org.apache.asterix.om.base.AMutableDayTimeDuration;
+import org.apache.asterix.om.base.temporal.ADurationParserFactory;
+import org.apache.asterix.om.types.ATypeTag;
+import org.apache.asterix.om.types.BuiltinType;
+import org.apache.asterix.om.types.EnumDeserializer;
+import org.apache.hyracks.algebricks.runtime.base.IEvaluatorContext;
+import org.apache.hyracks.algebricks.runtime.base.IScalarEvaluator;
+import org.apache.hyracks.api.dataflow.value.ISerializerDeserializer;
+import org.apache.hyracks.api.exceptions.HyracksDataException;
+import org.apache.hyracks.api.exceptions.SourceLocation;
+import org.apache.hyracks.data.std.api.IPointable;
+import org.apache.hyracks.data.std.primitive.UTF8StringPointable;
+
+public abstract class AbstractDayTimeDurationConstructorEvaluator extends AbstractConstructorEvaluator {
+
+    private final AMutableDayTimeDuration aDayTimeDuration = new AMutableDayTimeDuration(0);
+    @SuppressWarnings("unchecked")
+    private final ISerializerDeserializer<ADayTimeDuration> dayTimeDurationSerde =
+            SerializerDeserializerProvider.INSTANCE
+                    .getSerializerDeserializer(BuiltinType.ADAYTIMEDURATION);
+    private final UTF8StringPointable utf8Ptr = new UTF8StringPointable();
+
+    protected AbstractDayTimeDurationConstructorEvaluator(IEvaluatorContext ctx, IScalarEvaluator inputEval,
+            SourceLocation sourceLoc) {
+        super(ctx, inputEval, sourceLoc);
+    }
+
+    @Override
+    protected void evaluateImpl(IPointable result) throws HyracksDataException {
+        byte[] bytes = inputArg.getByteArray();
+        int startOffset = inputArg.getStartOffset();
+        int len = inputArg.getLength();
+        ATypeTag inputType = EnumDeserializer.ATYPETAGDESERIALIZER.deserialize(bytes[startOffset]);
+        switch (inputType) {
+            case DAYTIMEDURATION:
+                result.set(inputArg);
+                break;
+            case DURATION:
+                long millis = ADurationSerializerDeserializer.getDayTime(bytes, startOffset + 1);
+                aDayTimeDuration.setMilliseconds(millis);
+                resultStorage.reset();
+                dayTimeDurationSerde.serialize(aDayTimeDuration, out);
+                result.set(resultStorage);
+                break;
+            case STRING:
+                utf8Ptr.set(bytes, startOffset + 1, len - 1);
+                if (parseDayTimeDuration(utf8Ptr, aDayTimeDuration)) {
+                    resultStorage.reset();
+                    dayTimeDurationSerde.serialize(aDayTimeDuration, out);
+                    result.set(resultStorage);
+                } else {
+                    handleParseError(utf8Ptr, result);
+                }
+                break;
+            default:
+                handleUnsupportedType(inputType, result);
+                break;
+        }
+    }
+
+    @Override
+    protected final BuiltinType getTargetType() {
+        return BuiltinType.ADAYTIMEDURATION;
+    }
+
+
+    private static boolean parseDayTimeDuration(UTF8StringPointable textPtr, ADayTimeDuration result) {
+        try {
+            ADurationParserFactory.parseDuration(textPtr.getByteArray(), textPtr.getCharStartOffset(),
+                    textPtr.getUTF8Length(), result, ADurationParserFactory.ADurationParseOption.DAY_TIME);
+            return true;
+        } catch (HyracksDataException e) {
+            return false;
+        }
+    }
+}
diff --git a/asterixdb/asterix-runtime/src/main/java/org/apache/asterix/runtime/evaluators/constructors/AbstractDurationConstructorEvaluator.java b/asterixdb/asterix-runtime/src/main/java/org/apache/asterix/runtime/evaluators/constructors/AbstractDurationConstructorEvaluator.java
new file mode 100644
index 0000000..81ffdf0
--- /dev/null
+++ b/asterixdb/asterix-runtime/src/main/java/org/apache/asterix/runtime/evaluators/constructors/AbstractDurationConstructorEvaluator.java
@@ -0,0 +1,107 @@
+/*
+ * 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 org.apache.asterix.dataflow.data.nontagged.serde.ADayTimeDurationSerializerDeserializer;
+import org.apache.asterix.dataflow.data.nontagged.serde.AYearMonthDurationSerializerDeserializer;
+import org.apache.asterix.formats.nontagged.SerializerDeserializerProvider;
+import org.apache.asterix.om.base.ADuration;
+import org.apache.asterix.om.base.AMutableDuration;
+import org.apache.asterix.om.base.temporal.ADurationParserFactory;
+import org.apache.asterix.om.types.ATypeTag;
+import org.apache.asterix.om.types.BuiltinType;
+import org.apache.asterix.om.types.EnumDeserializer;
+import org.apache.hyracks.algebricks.runtime.base.IEvaluatorContext;
+import org.apache.hyracks.algebricks.runtime.base.IScalarEvaluator;
+import org.apache.hyracks.api.dataflow.value.ISerializerDeserializer;
+import org.apache.hyracks.api.exceptions.HyracksDataException;
+import org.apache.hyracks.api.exceptions.SourceLocation;
+import org.apache.hyracks.data.std.api.IPointable;
+import org.apache.hyracks.data.std.primitive.UTF8StringPointable;
+
+public abstract class AbstractDurationConstructorEvaluator extends AbstractConstructorEvaluator {
+
+    private final AMutableDuration aDuration = new AMutableDuration(0, 0);
+    @SuppressWarnings("unchecked")
+    private final ISerializerDeserializer<ADuration> durationSerde =
+            SerializerDeserializerProvider.INSTANCE.getSerializerDeserializer(BuiltinType.ADURATION);
+    private final UTF8StringPointable utf8Ptr = new UTF8StringPointable();
+
+    protected AbstractDurationConstructorEvaluator(IEvaluatorContext ctx, IScalarEvaluator inputEval,
+            SourceLocation sourceLoc) {
+        super(ctx, inputEval, sourceLoc);
+    }
+
+    @Override
+    protected void evaluateImpl(IPointable result) throws HyracksDataException {
+        byte[] bytes = inputArg.getByteArray();
+        int startOffset = inputArg.getStartOffset();
+        int len = inputArg.getLength();
+        ATypeTag inputType = EnumDeserializer.ATYPETAGDESERIALIZER.deserialize(bytes[startOffset]);
+        switch (inputType) {
+            case DURATION:
+                result.set(inputArg);
+                break;
+            case YEARMONTHDURATION:
+                int months =
+                        AYearMonthDurationSerializerDeserializer.getYearMonth(bytes, startOffset + 1);
+                aDuration.setValue(months, 0);
+                resultStorage.reset();
+                durationSerde.serialize(aDuration, out);
+                result.set(resultStorage);
+                break;
+            case DAYTIMEDURATION:
+                long millis = ADayTimeDurationSerializerDeserializer.getDayTime(bytes, startOffset + 1);
+                aDuration.setValue(0, millis);
+                resultStorage.reset();
+                durationSerde.serialize(aDuration, out);
+                result.set(resultStorage);
+                break;
+            case STRING:
+                utf8Ptr.set(bytes, startOffset + 1, len - 1);
+                if (parseDuration(utf8Ptr, aDuration)) {
+                    resultStorage.reset();
+                    durationSerde.serialize(aDuration, out);
+                    result.set(resultStorage);
+                } else {
+                    handleParseError(utf8Ptr, result);
+                }
+                break;
+            default:
+                handleUnsupportedType(inputType, result);
+                break;
+        }
+    }
+
+    @Override
+    protected final BuiltinType getTargetType() {
+        return BuiltinType.ADURATION;
+    }
+
+    private static boolean parseDuration(UTF8StringPointable textPtr, ADuration result) {
+        try {
+            ADurationParserFactory.parseDuration(textPtr.getByteArray(), textPtr.getCharStartOffset(),
+                    textPtr.getUTF8Length(), result, ADurationParserFactory.ADurationParseOption.All);
+            return true;
+        } catch (HyracksDataException e) {
+            return false;
+        }
+    }
+}
diff --git a/asterixdb/asterix-runtime/src/main/java/org/apache/asterix/runtime/evaluators/constructors/AbstractFloatConstructorEvaluator.java b/asterixdb/asterix-runtime/src/main/java/org/apache/asterix/runtime/evaluators/constructors/AbstractFloatConstructorEvaluator.java
new file mode 100644
index 0000000..0e80aed
--- /dev/null
+++ b/asterixdb/asterix-runtime/src/main/java/org/apache/asterix/runtime/evaluators/constructors/AbstractFloatConstructorEvaluator.java
@@ -0,0 +1,114 @@
+/*
+ * 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.IOException;
+
+import org.apache.asterix.dataflow.data.nontagged.serde.ABooleanSerializerDeserializer;
+import org.apache.asterix.formats.nontagged.SerializerDeserializerProvider;
+import org.apache.asterix.om.base.AFloat;
+import org.apache.asterix.om.base.AMutableFloat;
+import org.apache.asterix.om.types.ATypeTag;
+import org.apache.asterix.om.types.BuiltinType;
+import org.apache.asterix.om.types.EnumDeserializer;
+import org.apache.asterix.om.types.hierachy.ATypeHierarchy;
+import org.apache.asterix.runtime.evaluators.common.NumberUtils;
+import org.apache.hyracks.algebricks.runtime.base.IEvaluatorContext;
+import org.apache.hyracks.algebricks.runtime.base.IScalarEvaluator;
+import org.apache.hyracks.api.dataflow.value.ISerializerDeserializer;
+import org.apache.hyracks.api.exceptions.HyracksDataException;
+import org.apache.hyracks.api.exceptions.SourceLocation;
+import org.apache.hyracks.data.std.api.IPointable;
+import org.apache.hyracks.data.std.primitive.UTF8StringPointable;
+
+public abstract class AbstractFloatConstructorEvaluator extends AbstractConstructorEvaluator {
+
+    private final AMutableFloat aFloat = new AMutableFloat(0);
+    @SuppressWarnings("unchecked")
+    private final ISerializerDeserializer<AFloat> floatSerde =
+            SerializerDeserializerProvider.INSTANCE.getSerializerDeserializer(BuiltinType.AFLOAT);
+    private final UTF8StringPointable utf8Ptr = new UTF8StringPointable();
+
+    protected AbstractFloatConstructorEvaluator(IEvaluatorContext ctx, IScalarEvaluator inputEval,
+            SourceLocation sourceLoc) {
+        super(ctx, inputEval, sourceLoc);
+    }
+
+    @Override
+    protected void evaluateImpl(IPointable result) throws HyracksDataException {
+        byte[] bytes = inputArg.getByteArray();
+        int startOffset = inputArg.getStartOffset();
+        int len = inputArg.getLength();
+        ATypeTag inputType = EnumDeserializer.ATYPETAGDESERIALIZER.deserialize(bytes[startOffset]);
+        switch (inputType) {
+            case FLOAT:
+                result.set(inputArg);
+                break;
+            case TINYINT:
+            case SMALLINT:
+            case INTEGER:
+            case BIGINT:
+                resultStorage.reset();
+                try {
+                    ATypeHierarchy.getTypePromoteComputer(inputType, ATypeTag.FLOAT).convertType(bytes,
+                            startOffset + 1, len - 1, out);
+                } catch (IOException e) {
+                    throw HyracksDataException.create(e);
+                }
+                result.set(resultStorage);
+                break;
+            case DOUBLE:
+                resultStorage.reset();
+                try {
+                    ATypeHierarchy.getTypeDemoteComputer(inputType, ATypeTag.FLOAT, false)
+                            .convertType(bytes, startOffset + 1, len - 1, out);
+                } catch (IOException e) {
+                    throw HyracksDataException.create(e);
+                }
+                result.set(resultStorage);
+                break;
+            case BOOLEAN:
+                boolean b = ABooleanSerializerDeserializer.getBoolean(bytes, startOffset + 1);
+                aFloat.setValue(b ? 1 : 0);
+                resultStorage.reset();
+                floatSerde.serialize(aFloat, out);
+                result.set(resultStorage);
+                break;
+            case STRING:
+                utf8Ptr.set(bytes, startOffset + 1, len - 1);
+                if (NumberUtils.parseFloat(utf8Ptr, aFloat)) {
+                    resultStorage.reset();
+                    floatSerde.serialize(aFloat, out);
+                    result.set(resultStorage);
+                } else {
+                    handleParseError(utf8Ptr, result);
+                }
+                break;
+            default:
+                handleUnsupportedType(inputType, result);
+                break;
+        }
+    }
+
+    @Override
+    protected final BuiltinType getTargetType() {
+        return BuiltinType.AFLOAT;
+    }
+}
diff --git a/asterixdb/asterix-runtime/src/main/java/org/apache/asterix/runtime/evaluators/constructors/AbstractInt16ConstructorEvaluator.java b/asterixdb/asterix-runtime/src/main/java/org/apache/asterix/runtime/evaluators/constructors/AbstractInt16ConstructorEvaluator.java
new file mode 100644
index 0000000..051241c
--- /dev/null
+++ b/asterixdb/asterix-runtime/src/main/java/org/apache/asterix/runtime/evaluators/constructors/AbstractInt16ConstructorEvaluator.java
@@ -0,0 +1,114 @@
+/*
+ * 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.IOException;
+
+import org.apache.asterix.dataflow.data.nontagged.serde.ABooleanSerializerDeserializer;
+import org.apache.asterix.formats.nontagged.SerializerDeserializerProvider;
+import org.apache.asterix.om.base.AInt16;
+import org.apache.asterix.om.base.AMutableInt16;
+import org.apache.asterix.om.types.ATypeTag;
+import org.apache.asterix.om.types.BuiltinType;
+import org.apache.asterix.om.types.EnumDeserializer;
+import org.apache.asterix.om.types.hierachy.ATypeHierarchy;
+import org.apache.asterix.runtime.evaluators.common.NumberUtils;
+import org.apache.hyracks.algebricks.runtime.base.IEvaluatorContext;
+import org.apache.hyracks.algebricks.runtime.base.IScalarEvaluator;
+import org.apache.hyracks.api.dataflow.value.ISerializerDeserializer;
+import org.apache.hyracks.api.exceptions.HyracksDataException;
+import org.apache.hyracks.api.exceptions.SourceLocation;
+import org.apache.hyracks.data.std.api.IPointable;
+import org.apache.hyracks.data.std.primitive.UTF8StringPointable;
+
+public abstract class AbstractInt16ConstructorEvaluator extends AbstractConstructorEvaluator {
+
+    private final AMutableInt16 aInt16 = new AMutableInt16((short) 0);
+    @SuppressWarnings("unchecked")
+    private final ISerializerDeserializer<AInt16> int16Serde =
+            SerializerDeserializerProvider.INSTANCE.getSerializerDeserializer(BuiltinType.AINT16);
+    private final UTF8StringPointable utf8Ptr = new UTF8StringPointable();
+
+    protected AbstractInt16ConstructorEvaluator(IEvaluatorContext ctx, IScalarEvaluator inputEval,
+            SourceLocation sourceLoc) {
+        super(ctx, inputEval, sourceLoc);
+    }
+
+    @Override
+    protected void evaluateImpl(IPointable result) throws HyracksDataException {
+        byte[] bytes = inputArg.getByteArray();
+        int startOffset = inputArg.getStartOffset();
+        int len = inputArg.getLength();
+        ATypeTag inputType = EnumDeserializer.ATYPETAGDESERIALIZER.deserialize(bytes[startOffset]);
+        switch (inputType) {
+            case SMALLINT:
+                result.set(inputArg);
+                break;
+            case TINYINT:
+                resultStorage.reset();
+                try {
+                    ATypeHierarchy.getTypePromoteComputer(inputType, ATypeTag.SMALLINT)
+                            .convertType(bytes, startOffset + 1, len - 1, out);
+                } catch (IOException e) {
+                    throw HyracksDataException.create(e);
+                }
+                result.set(resultStorage);
+                break;
+            case INTEGER:
+            case BIGINT:
+            case FLOAT:
+            case DOUBLE:
+                resultStorage.reset();
+                try {
+                    ATypeHierarchy.getTypeDemoteComputer(inputType, ATypeTag.SMALLINT, false)
+                            .convertType(bytes, startOffset + 1, len - 1, out);
+                } catch (IOException e) {
+                    throw HyracksDataException.create(e);
+                }
+                result.set(resultStorage);
+                break;
+            case BOOLEAN:
+                boolean b = ABooleanSerializerDeserializer.getBoolean(bytes, startOffset + 1);
+                aInt16.setValue((short) (b ? 1 : 0));
+                resultStorage.reset();
+                int16Serde.serialize(aInt16, out);
+                result.set(resultStorage);
+                break;
+            case STRING:
+                utf8Ptr.set(bytes, startOffset + 1, len - 1);
+                if (NumberUtils.parseInt16(utf8Ptr, aInt16)) {
+                    resultStorage.reset();
+                    int16Serde.serialize(aInt16, out);
+                    result.set(resultStorage);
+                } else {
+                    handleParseError(utf8Ptr, result);
+                }
+                break;
+            default:
+                handleUnsupportedType(inputType, result);
+                break;
+        }
+    }
+
+    @Override
+    protected final BuiltinType getTargetType() {
+        return BuiltinType.AINT16;
+    }
+}
diff --git a/asterixdb/asterix-runtime/src/main/java/org/apache/asterix/runtime/evaluators/constructors/AbstractInt32ConstructorEvaluator.java b/asterixdb/asterix-runtime/src/main/java/org/apache/asterix/runtime/evaluators/constructors/AbstractInt32ConstructorEvaluator.java
new file mode 100644
index 0000000..0d623a6
--- /dev/null
+++ b/asterixdb/asterix-runtime/src/main/java/org/apache/asterix/runtime/evaluators/constructors/AbstractInt32ConstructorEvaluator.java
@@ -0,0 +1,114 @@
+/*
+ * 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.IOException;
+
+import org.apache.asterix.dataflow.data.nontagged.serde.ABooleanSerializerDeserializer;
+import org.apache.asterix.formats.nontagged.SerializerDeserializerProvider;
+import org.apache.asterix.om.base.AInt32;
+import org.apache.asterix.om.base.AMutableInt32;
+import org.apache.asterix.om.types.ATypeTag;
+import org.apache.asterix.om.types.BuiltinType;
+import org.apache.asterix.om.types.EnumDeserializer;
+import org.apache.asterix.om.types.hierachy.ATypeHierarchy;
+import org.apache.asterix.runtime.evaluators.common.NumberUtils;
+import org.apache.hyracks.algebricks.runtime.base.IEvaluatorContext;
+import org.apache.hyracks.algebricks.runtime.base.IScalarEvaluator;
+import org.apache.hyracks.api.dataflow.value.ISerializerDeserializer;
+import org.apache.hyracks.api.exceptions.HyracksDataException;
+import org.apache.hyracks.api.exceptions.SourceLocation;
+import org.apache.hyracks.data.std.api.IPointable;
+import org.apache.hyracks.data.std.primitive.UTF8StringPointable;
+
+public abstract class AbstractInt32ConstructorEvaluator extends AbstractConstructorEvaluator {
+
+    private final AMutableInt32 aInt32 = new AMutableInt32(0);
+    @SuppressWarnings("unchecked")
+    private final ISerializerDeserializer<AInt32> int32Serde =
+            SerializerDeserializerProvider.INSTANCE.getSerializerDeserializer(BuiltinType.AINT32);
+    private final UTF8StringPointable utf8Ptr = new UTF8StringPointable();
+
+    protected AbstractInt32ConstructorEvaluator(IEvaluatorContext ctx, IScalarEvaluator inputEval,
+            SourceLocation sourceLoc) {
+        super(ctx, inputEval, sourceLoc);
+    }
+
+    @Override
+    protected void evaluateImpl(IPointable result) throws HyracksDataException {
+        byte[] bytes = inputArg.getByteArray();
+        int startOffset = inputArg.getStartOffset();
+        int len = inputArg.getLength();
+        ATypeTag inputType = EnumDeserializer.ATYPETAGDESERIALIZER.deserialize(bytes[startOffset]);
+        switch (inputType) {
+            case INTEGER:
+                result.set(inputArg);
+                break;
+            case TINYINT:
+            case SMALLINT:
+                resultStorage.reset();
+                try {
+                    ATypeHierarchy.getTypePromoteComputer(inputType, ATypeTag.INTEGER)
+                            .convertType(bytes, startOffset + 1, len - 1, out);
+                } catch (IOException e) {
+                    throw HyracksDataException.create(e);
+                }
+                result.set(resultStorage);
+                break;
+            case BIGINT:
+            case FLOAT:
+            case DOUBLE:
+                resultStorage.reset();
+                try {
+                    ATypeHierarchy.getTypeDemoteComputer(inputType, ATypeTag.INTEGER, false)
+                            .convertType(bytes, startOffset + 1, len - 1, out);
+                } catch (IOException e) {
+                    throw HyracksDataException.create(e);
+                }
+                result.set(resultStorage);
+                break;
+            case BOOLEAN:
+                boolean b = ABooleanSerializerDeserializer.getBoolean(bytes, startOffset + 1);
+                aInt32.setValue(b ? 1 : 0);
+                resultStorage.reset();
+                int32Serde.serialize(aInt32, out);
+                result.set(resultStorage);
+                break;
+            case STRING:
+                utf8Ptr.set(bytes, startOffset + 1, len - 1);
+                if (NumberUtils.parseInt32(utf8Ptr, aInt32)) {
+                    resultStorage.reset();
+                    int32Serde.serialize(aInt32, out);
+                    result.set(resultStorage);
+                } else {
+                    handleParseError(utf8Ptr, result);
+                }
+                break;
+            default:
+                handleUnsupportedType(inputType, result);
+                break;
+        }
+    }
+
+    @Override
+    protected final BuiltinType getTargetType() {
+        return BuiltinType.AINT32;
+    }
+}
diff --git a/asterixdb/asterix-runtime/src/main/java/org/apache/asterix/runtime/evaluators/constructors/AbstractInt8ConstructorEvaluator.java b/asterixdb/asterix-runtime/src/main/java/org/apache/asterix/runtime/evaluators/constructors/AbstractInt8ConstructorEvaluator.java
new file mode 100644
index 0000000..9610c44
--- /dev/null
+++ b/asterixdb/asterix-runtime/src/main/java/org/apache/asterix/runtime/evaluators/constructors/AbstractInt8ConstructorEvaluator.java
@@ -0,0 +1,105 @@
+/*
+ * 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.IOException;
+
+import org.apache.asterix.dataflow.data.nontagged.serde.ABooleanSerializerDeserializer;
+import org.apache.asterix.formats.nontagged.SerializerDeserializerProvider;
+import org.apache.asterix.om.base.AInt8;
+import org.apache.asterix.om.base.AMutableInt8;
+import org.apache.asterix.om.types.ATypeTag;
+import org.apache.asterix.om.types.BuiltinType;
+import org.apache.asterix.om.types.EnumDeserializer;
+import org.apache.asterix.om.types.hierachy.ATypeHierarchy;
+import org.apache.asterix.runtime.evaluators.common.NumberUtils;
+import org.apache.hyracks.algebricks.runtime.base.IEvaluatorContext;
+import org.apache.hyracks.algebricks.runtime.base.IScalarEvaluator;
+import org.apache.hyracks.api.dataflow.value.ISerializerDeserializer;
+import org.apache.hyracks.api.exceptions.HyracksDataException;
+import org.apache.hyracks.api.exceptions.SourceLocation;
+import org.apache.hyracks.data.std.api.IPointable;
+import org.apache.hyracks.data.std.primitive.UTF8StringPointable;
+
+public abstract class AbstractInt8ConstructorEvaluator extends AbstractConstructorEvaluator {
+
+    private final AMutableInt8 aInt8 = new AMutableInt8((byte) 0);
+    @SuppressWarnings("unchecked")
+    private final ISerializerDeserializer<AInt8> int8Serde =
+            SerializerDeserializerProvider.INSTANCE.getSerializerDeserializer(BuiltinType.AINT8);
+    private final UTF8StringPointable utf8Ptr = new UTF8StringPointable();
+
+    protected AbstractInt8ConstructorEvaluator(IEvaluatorContext ctx, IScalarEvaluator inputEval,
+            SourceLocation sourceLoc) {
+        super(ctx, inputEval, sourceLoc);
+    }
+
+    @Override
+    protected void evaluateImpl(IPointable result) throws HyracksDataException {
+        byte[] bytes = inputArg.getByteArray();
+        int startOffset = inputArg.getStartOffset();
+        int len = inputArg.getLength();
+        ATypeTag inputType = EnumDeserializer.ATYPETAGDESERIALIZER.deserialize(bytes[startOffset]);
+        switch (inputType) {
+            case TINYINT:
+                result.set(inputArg);
+                break;
+            case SMALLINT:
+            case INTEGER:
+            case BIGINT:
+            case FLOAT:
+            case DOUBLE:
+                resultStorage.reset();
+                try {
+                    ATypeHierarchy.getTypeDemoteComputer(inputType, ATypeTag.TINYINT, false)
+                            .convertType(bytes, startOffset + 1, len - 1, out);
+                } catch (IOException e) {
+                    throw HyracksDataException.create(e);
+                }
+                result.set(resultStorage);
+                break;
+            case BOOLEAN:
+                boolean b = ABooleanSerializerDeserializer.getBoolean(bytes, startOffset + 1);
+                aInt8.setValue((byte) (b ? 1 : 0));
+                resultStorage.reset();
+                int8Serde.serialize(aInt8, out);
+                result.set(resultStorage);
+                break;
+            case STRING:
+                utf8Ptr.set(bytes, startOffset + 1, len - 1);
+                if (NumberUtils.parseInt8(utf8Ptr, aInt8)) {
+                    resultStorage.reset();
+                    int8Serde.serialize(aInt8, out);
+                    result.set(resultStorage);
+                } else {
+                    handleParseError(utf8Ptr, result);
+                }
+                break;
+            default:
+                handleUnsupportedType(inputType, result);
+                break;
+        }
+    }
+
+    @Override
+    protected final BuiltinType getTargetType() {
+        return BuiltinType.AINT8;
+    }
+}
diff --git a/asterixdb/asterix-runtime/src/main/java/org/apache/asterix/runtime/evaluators/constructors/AbstractTimeWithFormatConstructorEvaluator.java b/asterixdb/asterix-runtime/src/main/java/org/apache/asterix/runtime/evaluators/constructors/AbstractTimeWithFormatConstructorEvaluator.java
new file mode 100644
index 0000000..d70e3bb
--- /dev/null
+++ b/asterixdb/asterix-runtime/src/main/java/org/apache/asterix/runtime/evaluators/constructors/AbstractTimeWithFormatConstructorEvaluator.java
@@ -0,0 +1,86 @@
+/*
+ * 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 org.apache.asterix.om.base.AMutableInt64;
+import org.apache.asterix.om.base.AMutableTime;
+import org.apache.asterix.om.base.temporal.AsterixTemporalTypeParseException;
+import org.apache.asterix.om.base.temporal.DateTimeFormatUtils;
+import org.apache.asterix.om.types.ATypeTag;
+import org.apache.asterix.runtime.evaluators.functions.PointableHelper;
+import org.apache.hyracks.algebricks.runtime.base.IEvaluatorContext;
+import org.apache.hyracks.algebricks.runtime.base.IScalarEvaluator;
+import org.apache.hyracks.algebricks.runtime.base.IScalarEvaluatorFactory;
+import org.apache.hyracks.api.exceptions.HyracksDataException;
+import org.apache.hyracks.api.exceptions.SourceLocation;
+import org.apache.hyracks.data.std.api.IPointable;
+import org.apache.hyracks.data.std.primitive.UTF8StringPointable;
+import org.apache.hyracks.data.std.primitive.VoidPointable;
+import org.apache.hyracks.dataflow.common.data.accessors.IFrameTupleReference;
+
+public abstract class AbstractTimeWithFormatConstructorEvaluator extends AbstractTimeConstructorEvaluator {
+
+    private final IScalarEvaluator formatEval;
+    private final IPointable formatArg = new VoidPointable();
+    private final UTF8StringPointable formatTextPtr = new UTF8StringPointable();
+    private final AMutableInt64 aInt64 = new AMutableInt64(0);
+
+    protected AbstractTimeWithFormatConstructorEvaluator(IEvaluatorContext ctx, IScalarEvaluatorFactory[] args,
+            SourceLocation sourceLoc) throws HyracksDataException {
+        super(ctx, args[0].createScalarEvaluator(ctx), sourceLoc);
+        formatEval = args[1].createScalarEvaluator(ctx);
+    }
+
+    @Override
+    protected void evaluateInput(IFrameTupleReference tuple) throws HyracksDataException {
+        super.evaluateInput(tuple);
+        formatEval.evaluate(tuple, formatArg);
+    }
+
+    @Override
+    protected boolean checkAndSetMissingOrNull(IPointable result) throws HyracksDataException {
+        return PointableHelper.checkAndSetMissingOrNull(result, inputArg, formatArg);
+    }
+
+    @Override
+    protected boolean parseTime(UTF8StringPointable textPtr, AMutableTime result) {
+        byte[] formatBytes = formatArg.getByteArray();
+        int formatStartOffset = formatArg.getStartOffset();
+        int formatLength = formatArg.getLength();
+        if (formatBytes[formatStartOffset] != ATypeTag.SERIALIZED_STRING_TYPE_TAG) {
+            return false;
+        }
+        formatTextPtr.set(formatBytes, formatStartOffset + 1, formatLength - 1);
+        try {
+            if (DateTimeFormatUtils.getInstance().parseDateTime(aInt64, textPtr.getByteArray(),
+                    textPtr.getCharStartOffset(), textPtr.getUTF8Length(), formatBytes,
+                    formatTextPtr.getCharStartOffset(), formatTextPtr.getUTF8Length(),
+                    DateTimeFormatUtils.DateTimeParseMode.TIME_ONLY, false)) {
+                result.setValue((int) aInt64.getLongValue());
+                return true;
+            } else {
+                return false;
+            }
+        } catch (AsterixTemporalTypeParseException e) {
+            // shouldn't happen
+            return false;
+        }
+    }
+}
diff --git a/asterixdb/asterix-runtime/src/main/java/org/apache/asterix/runtime/evaluators/constructors/AbstractUUIDFromStringConstructorEvaluator.java b/asterixdb/asterix-runtime/src/main/java/org/apache/asterix/runtime/evaluators/constructors/AbstractUUIDFromStringConstructorEvaluator.java
new file mode 100644
index 0000000..e429c1d
--- /dev/null
+++ b/asterixdb/asterix-runtime/src/main/java/org/apache/asterix/runtime/evaluators/constructors/AbstractUUIDFromStringConstructorEvaluator.java
@@ -0,0 +1,89 @@
+/*
+ * 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 org.apache.asterix.formats.nontagged.SerializerDeserializerProvider;
+import org.apache.asterix.om.base.AMutableUUID;
+import org.apache.asterix.om.base.AUUID;
+import org.apache.asterix.om.types.ATypeTag;
+import org.apache.asterix.om.types.BuiltinType;
+import org.apache.asterix.om.types.EnumDeserializer;
+import org.apache.hyracks.algebricks.runtime.base.IEvaluatorContext;
+import org.apache.hyracks.algebricks.runtime.base.IScalarEvaluator;
+import org.apache.hyracks.api.dataflow.value.ISerializerDeserializer;
+import org.apache.hyracks.api.exceptions.HyracksDataException;
+import org.apache.hyracks.api.exceptions.SourceLocation;
+import org.apache.hyracks.data.std.api.IPointable;
+import org.apache.hyracks.data.std.primitive.UTF8StringPointable;
+
+public abstract class AbstractUUIDFromStringConstructorEvaluator extends AbstractConstructorEvaluator {
+
+    private final AMutableUUID uuid = new AMutableUUID();
+    @SuppressWarnings("unchecked")
+    private final ISerializerDeserializer<AUUID> uuidSerde =
+            SerializerDeserializerProvider.INSTANCE.getSerializerDeserializer(BuiltinType.AUUID);
+    private final UTF8StringPointable utf8Ptr = new UTF8StringPointable();
+
+    protected AbstractUUIDFromStringConstructorEvaluator(IEvaluatorContext ctx, IScalarEvaluator inputEval,
+            SourceLocation sourceLoc) {
+        super(ctx, inputEval, sourceLoc);
+    }
+
+    @Override
+    protected void evaluateImpl(IPointable result) throws HyracksDataException {
+        byte[] bytes = inputArg.getByteArray();
+        int startOffset = inputArg.getStartOffset();
+        int len = inputArg.getLength();
+        ATypeTag inputType = EnumDeserializer.ATYPETAGDESERIALIZER.deserialize(bytes[startOffset]);
+        switch (inputType) {
+            case UUID:
+                result.set(inputArg);
+                break;
+            case STRING:
+                utf8Ptr.set(bytes, startOffset + 1, len - 1);
+                if (parseUUID(utf8Ptr, uuid)) {
+                    resultStorage.reset();
+                    uuidSerde.serialize(uuid, out);
+                    result.set(resultStorage);
+                } else {
+                    handleParseError(utf8Ptr, result);
+                }
+                break;
+            default:
+                handleUnsupportedType(inputType, result);
+                break;
+        }
+    }
+
+    @Override
+    protected final BuiltinType getTargetType() {
+        return BuiltinType.AUUID;
+    }
+
+    private static boolean parseUUID(UTF8StringPointable textPtr, AMutableUUID result) {
+        try {
+            // first byte: tag, next x bytes: length
+            result.parseUUIDHexBytes(textPtr.getByteArray(), textPtr.getCharStartOffset());
+            return true;
+        } catch (HyracksDataException e) {
+            return false;
+        }
+    }
+}
diff --git a/asterixdb/asterix-runtime/src/main/java/org/apache/asterix/runtime/evaluators/constructors/AbstractYearMonthDurationConstructorEvaluator.java b/asterixdb/asterix-runtime/src/main/java/org/apache/asterix/runtime/evaluators/constructors/AbstractYearMonthDurationConstructorEvaluator.java
new file mode 100644
index 0000000..c561823
--- /dev/null
+++ b/asterixdb/asterix-runtime/src/main/java/org/apache/asterix/runtime/evaluators/constructors/AbstractYearMonthDurationConstructorEvaluator.java
@@ -0,0 +1,99 @@
+/*
+ * 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 org.apache.asterix.dataflow.data.nontagged.serde.ADurationSerializerDeserializer;
+import org.apache.asterix.formats.nontagged.SerializerDeserializerProvider;
+import org.apache.asterix.om.base.AMutableYearMonthDuration;
+import org.apache.asterix.om.base.AYearMonthDuration;
+import org.apache.asterix.om.base.temporal.ADurationParserFactory;
+import org.apache.asterix.om.types.ATypeTag;
+import org.apache.asterix.om.types.BuiltinType;
+import org.apache.asterix.om.types.EnumDeserializer;
+import org.apache.hyracks.algebricks.runtime.base.IEvaluatorContext;
+import org.apache.hyracks.algebricks.runtime.base.IScalarEvaluator;
+import org.apache.hyracks.api.dataflow.value.ISerializerDeserializer;
+import org.apache.hyracks.api.exceptions.HyracksDataException;
+import org.apache.hyracks.api.exceptions.SourceLocation;
+import org.apache.hyracks.data.std.api.IPointable;
+import org.apache.hyracks.data.std.primitive.UTF8StringPointable;
+
+public abstract class AbstractYearMonthDurationConstructorEvaluator extends AbstractConstructorEvaluator {
+
+    private final AMutableYearMonthDuration aYearMonthDuration = new AMutableYearMonthDuration(0);
+    @SuppressWarnings("unchecked")
+    private final ISerializerDeserializer<AYearMonthDuration> yearMonthDurationSerde =
+            SerializerDeserializerProvider.INSTANCE
+                    .getSerializerDeserializer(BuiltinType.AYEARMONTHDURATION);
+    private final UTF8StringPointable utf8Ptr = new UTF8StringPointable();
+
+    protected AbstractYearMonthDurationConstructorEvaluator(IEvaluatorContext ctx, IScalarEvaluator inputEval,
+            SourceLocation sourceLoc) {
+        super(ctx, inputEval, sourceLoc);
+    }
+
+    @Override
+    protected void evaluateImpl(IPointable result) throws HyracksDataException {
+        byte[] bytes = inputArg.getByteArray();
+        int startOffset = inputArg.getStartOffset();
+        int len = inputArg.getLength();
+        ATypeTag inputType = EnumDeserializer.ATYPETAGDESERIALIZER.deserialize(bytes[startOffset]);
+        switch (inputType) {
+            case YEARMONTHDURATION:
+                result.set(inputArg);
+                break;
+            case DURATION:
+                int months = ADurationSerializerDeserializer.getYearMonth(bytes, startOffset + 1);
+                aYearMonthDuration.setMonths(months);
+                resultStorage.reset();
+                yearMonthDurationSerde.serialize(aYearMonthDuration, out);
+                result.set(resultStorage);
+                break;
+            case STRING:
+                utf8Ptr.set(bytes, startOffset + 1, len - 1);
+                if (parseYearMonthDuration(utf8Ptr, aYearMonthDuration)) {
+                    resultStorage.reset();
+                    yearMonthDurationSerde.serialize(aYearMonthDuration, out);
+                    result.set(resultStorage);
+                } else {
+                    handleParseError(utf8Ptr, result);
+                }
+                break;
+            default:
+                handleUnsupportedType(inputType, result);
+                break;
+        }
+    }
+
+    @Override
+    protected final BuiltinType getTargetType() {
+        return BuiltinType.AYEARMONTHDURATION;
+    }
+
+    private static boolean parseYearMonthDuration(UTF8StringPointable textPtr, AMutableYearMonthDuration result) {
+        try {
+            ADurationParserFactory.parseDuration(textPtr.getByteArray(), textPtr.getCharStartOffset(),
+                    textPtr.getUTF8Length(), result, ADurationParserFactory.ADurationParseOption.YEAR_MONTH);
+            return true;
+        } catch (HyracksDataException e) {
+            return false;
+        }
+    }
+}
diff --git a/asterixdb/asterix-runtime/src/main/java/org/apache/asterix/runtime/evaluators/functions/PointableHelper.java b/asterixdb/asterix-runtime/src/main/java/org/apache/asterix/runtime/evaluators/functions/PointableHelper.java
index 4a4c36c..e0fbe5c 100644
--- a/asterixdb/asterix-runtime/src/main/java/org/apache/asterix/runtime/evaluators/functions/PointableHelper.java
+++ b/asterixdb/asterix-runtime/src/main/java/org/apache/asterix/runtime/evaluators/functions/PointableHelper.java
@@ -308,6 +308,26 @@
     }
 
     /**
+     * Checks whether the pointable {@param pointable1} is null or missing, and if true, assigns null to the
+     * {@param result}.
+     *
+     * @param result the result pointable that will hold the null value
+     * @param pointable1 the pointable to be checked
+     *
+     * @return {@code true} if the {@param pointable1} value is missing or null, {@code false} otherwise.
+     */
+    public static boolean checkAndSetNull(IPointable result, IPointable pointable1) throws HyracksDataException {
+        switch (getPointableValueState(pointable1, null)) {
+            case MISSING:
+            case NULL:
+                setNull(result);
+                return true;
+            default:
+                return false;
+        }
+    }
+
+    /**
      * This method checks and returns the pointable value state.
      *
      * If a ListAccessor is passed to this function, it will check if the passed pointable is a list, and if so, it
diff --git a/asterixdb/asterix-runtime/src/main/java/org/apache/asterix/runtime/functions/FunctionCollection.java b/asterixdb/asterix-runtime/src/main/java/org/apache/asterix/runtime/functions/FunctionCollection.java
index b32d0db..ee76cc0 100644
--- a/asterixdb/asterix-runtime/src/main/java/org/apache/asterix/runtime/functions/FunctionCollection.java
+++ b/asterixdb/asterix-runtime/src/main/java/org/apache/asterix/runtime/functions/FunctionCollection.java
@@ -271,21 +271,35 @@
 import org.apache.asterix.runtime.evaluators.comparisons.NotEqualsDescriptor;
 import org.apache.asterix.runtime.evaluators.comparisons.NullIfEqualsDescriptor;
 import org.apache.asterix.runtime.evaluators.comparisons.PosInfIfEqualsDescriptor;
+import org.apache.asterix.runtime.evaluators.constructors.ABinaryBase64StringCastNullConstructorDescriptor;
 import org.apache.asterix.runtime.evaluators.constructors.ABinaryBase64StringConstructorDescriptor;
 import org.apache.asterix.runtime.evaluators.constructors.ABinaryHexStringConstructorDescriptor;
+import org.apache.asterix.runtime.evaluators.constructors.ABooleanCastNullConstructorDescriptor;
 import org.apache.asterix.runtime.evaluators.constructors.ABooleanConstructorDescriptor;
 import org.apache.asterix.runtime.evaluators.constructors.ACircleConstructorDescriptor;
+import org.apache.asterix.runtime.evaluators.constructors.ADateCastNullConstructorDescriptor;
+import org.apache.asterix.runtime.evaluators.constructors.ADateCastNullConstructorWithFormatDescriptor;
 import org.apache.asterix.runtime.evaluators.constructors.ADateConstructorDescriptor;
 import org.apache.asterix.runtime.evaluators.constructors.ADateConstructorWithFormatDescriptor;
+import org.apache.asterix.runtime.evaluators.constructors.ADateTimeCastNullConstructorDescriptor;
+import org.apache.asterix.runtime.evaluators.constructors.ADateTimeCastNullConstructorWithFormatDescriptor;
 import org.apache.asterix.runtime.evaluators.constructors.ADateTimeConstructorDescriptor;
 import org.apache.asterix.runtime.evaluators.constructors.ADateTimeConstructorWithFormatDescriptor;
+import org.apache.asterix.runtime.evaluators.constructors.ADayTimeDurationCastNullConstructorDescriptor;
 import org.apache.asterix.runtime.evaluators.constructors.ADayTimeDurationConstructorDescriptor;
+import org.apache.asterix.runtime.evaluators.constructors.ADoubleCastNullConstructorDescriptor;
 import org.apache.asterix.runtime.evaluators.constructors.ADoubleConstructorDescriptor;
+import org.apache.asterix.runtime.evaluators.constructors.ADurationCastNullConstructorDescriptor;
 import org.apache.asterix.runtime.evaluators.constructors.ADurationConstructorDescriptor;
+import org.apache.asterix.runtime.evaluators.constructors.AFloatCastNullConstructorDescriptor;
 import org.apache.asterix.runtime.evaluators.constructors.AFloatConstructorDescriptor;
+import org.apache.asterix.runtime.evaluators.constructors.AInt16CastNullConstructorDescriptor;
 import org.apache.asterix.runtime.evaluators.constructors.AInt16ConstructorDescriptor;
+import org.apache.asterix.runtime.evaluators.constructors.AInt32CastNullConstructorDescriptor;
 import org.apache.asterix.runtime.evaluators.constructors.AInt32ConstructorDescriptor;
+import org.apache.asterix.runtime.evaluators.constructors.AInt64CastNullConstructorDescriptor;
 import org.apache.asterix.runtime.evaluators.constructors.AInt64ConstructorDescriptor;
+import org.apache.asterix.runtime.evaluators.constructors.AInt8CastNullConstructorDescriptor;
 import org.apache.asterix.runtime.evaluators.constructors.AInt8ConstructorDescriptor;
 import org.apache.asterix.runtime.evaluators.constructors.AIntervalConstructorDescriptor;
 import org.apache.asterix.runtime.evaluators.constructors.AIntervalStartFromDateConstructorDescriptor;
@@ -296,10 +310,15 @@
 import org.apache.asterix.runtime.evaluators.constructors.APointConstructorDescriptor;
 import org.apache.asterix.runtime.evaluators.constructors.APolygonConstructorDescriptor;
 import org.apache.asterix.runtime.evaluators.constructors.ARectangleConstructorDescriptor;
+import org.apache.asterix.runtime.evaluators.constructors.AStringCastNullConstructorDescriptor;
 import org.apache.asterix.runtime.evaluators.constructors.AStringConstructorDescriptor;
+import org.apache.asterix.runtime.evaluators.constructors.ATimeCastNullConstructorDescriptor;
+import org.apache.asterix.runtime.evaluators.constructors.ATimeCastNullConstructorWithFormatDescriptor;
 import org.apache.asterix.runtime.evaluators.constructors.ATimeConstructorDescriptor;
 import org.apache.asterix.runtime.evaluators.constructors.ATimeConstructorWithFormatDescriptor;
+import org.apache.asterix.runtime.evaluators.constructors.AUUIDFromStringCastNullConstructorDescriptor;
 import org.apache.asterix.runtime.evaluators.constructors.AUUIDFromStringConstructorDescriptor;
+import org.apache.asterix.runtime.evaluators.constructors.AYearMonthDurationCastNullConstructorDescriptor;
 import org.apache.asterix.runtime.evaluators.constructors.AYearMonthDurationConstructorDescriptor;
 import org.apache.asterix.runtime.evaluators.constructors.ClosedRecordConstructorDescriptor;
 import org.apache.asterix.runtime.evaluators.constructors.OpenRecordConstructorDescriptor;
@@ -1082,15 +1101,24 @@
 
         // Constructors
         fc.add(ABooleanConstructorDescriptor.FACTORY);
+        fc.add(ABooleanCastNullConstructorDescriptor.FACTORY);
         fc.add(ABinaryHexStringConstructorDescriptor.FACTORY);
         fc.add(ABinaryBase64StringConstructorDescriptor.FACTORY);
+        fc.add(ABinaryBase64StringCastNullConstructorDescriptor.FACTORY);
         fc.add(AStringConstructorDescriptor.FACTORY);
+        fc.add(AStringCastNullConstructorDescriptor.FACTORY);
         fc.add(AInt8ConstructorDescriptor.FACTORY);
+        fc.add(AInt8CastNullConstructorDescriptor.FACTORY);
         fc.add(AInt16ConstructorDescriptor.FACTORY);
+        fc.add(AInt16CastNullConstructorDescriptor.FACTORY);
         fc.add(AInt32ConstructorDescriptor.FACTORY);
+        fc.add(AInt32CastNullConstructorDescriptor.FACTORY);
         fc.add(AInt64ConstructorDescriptor.FACTORY);
+        fc.add(AInt64CastNullConstructorDescriptor.FACTORY);
         fc.add(AFloatConstructorDescriptor.FACTORY);
+        fc.add(AFloatCastNullConstructorDescriptor.FACTORY);
         fc.add(ADoubleConstructorDescriptor.FACTORY);
+        fc.add(ADoubleCastNullConstructorDescriptor.FACTORY);
         fc.add(APointConstructorDescriptor.FACTORY);
         fc.add(APoint3DConstructorDescriptor.FACTORY);
         fc.add(ALineConstructorDescriptor.FACTORY);
@@ -1098,15 +1126,25 @@
         fc.add(ACircleConstructorDescriptor.FACTORY);
         fc.add(ARectangleConstructorDescriptor.FACTORY);
         fc.add(ATimeConstructorDescriptor.FACTORY);
+        fc.add(ATimeCastNullConstructorDescriptor.FACTORY);
         fc.add(ATimeConstructorWithFormatDescriptor.FACTORY);
+        fc.add(ATimeCastNullConstructorWithFormatDescriptor.FACTORY);
         fc.add(ADateConstructorDescriptor.FACTORY);
+        fc.add(ADateCastNullConstructorDescriptor.FACTORY);
         fc.add(ADateConstructorWithFormatDescriptor.FACTORY);
+        fc.add(ADateCastNullConstructorWithFormatDescriptor.FACTORY);
         fc.add(ADateTimeConstructorDescriptor.FACTORY);
+        fc.add(ADateTimeCastNullConstructorDescriptor.FACTORY);
         fc.add(ADateTimeConstructorWithFormatDescriptor.FACTORY);
+        fc.add(ADateTimeCastNullConstructorWithFormatDescriptor.FACTORY);
         fc.add(ADurationConstructorDescriptor.FACTORY);
+        fc.add(ADurationCastNullConstructorDescriptor.FACTORY);
         fc.add(AYearMonthDurationConstructorDescriptor.FACTORY);
+        fc.add(AYearMonthDurationCastNullConstructorDescriptor.FACTORY);
         fc.add(ADayTimeDurationConstructorDescriptor.FACTORY);
+        fc.add(ADayTimeDurationCastNullConstructorDescriptor.FACTORY);
         fc.add(AUUIDFromStringConstructorDescriptor.FACTORY);
+        fc.add(AUUIDFromStringCastNullConstructorDescriptor.FACTORY);
         fc.add(AIntervalConstructorDescriptor.FACTORY);
         fc.add(AIntervalStartFromDateConstructorDescriptor.FACTORY);
         fc.add(AIntervalStartFromDateTimeConstructorDescriptor.FACTORY);

-- 
To view, visit https://asterix-gerrit.ics.uci.edu/c/asterixdb/+/14027
To unsubscribe, or for help writing mail filters, visit https://asterix-gerrit.ics.uci.edu/settings

Gerrit-Project: asterixdb
Gerrit-Branch: master
Gerrit-Change-Id: I120d18c4c7bbcf098fceaa6784cce265a2811e3b
Gerrit-Change-Number: 14027
Gerrit-PatchSet: 1
Gerrit-Owner: Ali Alsuliman <al...@gmail.com>
Gerrit-MessageType: newchange

Change in asterixdb[master]: [NO ISSUE][FUN] Add cast-null functions for constructors

Posted by AsterixDB Code Review <do...@asterix-gerrit.ics.uci.edu>.
From Jenkins <je...@fulliautomatix.ics.uci.edu>:

Jenkins has posted comments on this change. ( https://asterix-gerrit.ics.uci.edu/c/asterixdb/+/14027 )

Change subject: [NO ISSUE][FUN] Add cast-null functions for constructors
......................................................................


Patch Set 3: Integration-Tests+1

Integration Tests Successful

https://asterix-jenkins.ics.uci.edu/job/asterix-gerrit-integration-tests/12701/ : SUCCESS


-- 
To view, visit https://asterix-gerrit.ics.uci.edu/c/asterixdb/+/14027
To unsubscribe, or for help writing mail filters, visit https://asterix-gerrit.ics.uci.edu/settings

Gerrit-Project: asterixdb
Gerrit-Branch: master
Gerrit-Change-Id: I120d18c4c7bbcf098fceaa6784cce265a2811e3b
Gerrit-Change-Number: 14027
Gerrit-PatchSet: 3
Gerrit-Owner: Ali Alsuliman <al...@gmail.com>
Gerrit-Reviewer: Ali Alsuliman <al...@gmail.com>
Gerrit-Reviewer: Anon. E. Moose #1000171
Gerrit-Reviewer: Dmitry Lychagin <dm...@couchbase.com>
Gerrit-Reviewer: Jenkins <je...@fulliautomatix.ics.uci.edu>
Gerrit-Comment-Date: Thu, 11 Nov 2021 18:47:42 +0000
Gerrit-HasComments: No
Gerrit-Has-Labels: Yes
Gerrit-MessageType: comment

Change in asterixdb[master]: [NO ISSUE][FUN] Add cast-null functions for constructors

Posted by AsterixDB Code Review <do...@asterix-gerrit.ics.uci.edu>.
From Ali Alsuliman <al...@gmail.com>:

Ali Alsuliman has uploaded this change for review. ( https://asterix-gerrit.ics.uci.edu/c/asterixdb/+/14027 )


Change subject: [NO ISSUE][FUN] Add cast-null functions for constructors
......................................................................

[NO ISSUE][FUN] Add cast-null functions for constructors

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

Details:
- Add cast-null type constructors that produce null for missing input.
- Make views use these types of constructors.
- Make secondary indexes with CAST (DEFAULT NULL) modifier use
  these types of constructors.

Change-Id: I120d18c4c7bbcf098fceaa6784cce265a2811e3b
---
M asterixdb/asterix-algebra/src/main/java/org/apache/asterix/optimizer/rules/IntroduceSecondaryIndexInsertDeleteRule.java
M asterixdb/asterix-app/src/test/resources/runtimets/testsuite_sqlpp.xml
M asterixdb/asterix-lang-sqlpp/src/main/java/org/apache/asterix/lang/sqlpp/rewrites/SqlppFunctionBodyRewriter.java
M asterixdb/asterix-metadata/src/main/java/org/apache/asterix/metadata/utils/SecondaryBTreeOperationsHelper.java
M asterixdb/asterix-metadata/src/main/java/org/apache/asterix/metadata/utils/TypeUtil.java
M asterixdb/asterix-om/src/main/java/org/apache/asterix/om/functions/BuiltinFunctions.java
A asterixdb/asterix-runtime/src/main/java/org/apache/asterix/runtime/evaluators/constructors/ABinaryBase64StringCastNullConstructorDescriptor.java
M asterixdb/asterix-runtime/src/main/java/org/apache/asterix/runtime/evaluators/constructors/ABinaryBase64StringConstructorDescriptor.java
A asterixdb/asterix-runtime/src/main/java/org/apache/asterix/runtime/evaluators/constructors/ABooleanCastNullConstructorDescriptor.java
A asterixdb/asterix-runtime/src/main/java/org/apache/asterix/runtime/evaluators/constructors/ADateCastNullConstructorDescriptor.java
A asterixdb/asterix-runtime/src/main/java/org/apache/asterix/runtime/evaluators/constructors/ADateCastNullConstructorWithFormatDescriptor.java
M asterixdb/asterix-runtime/src/main/java/org/apache/asterix/runtime/evaluators/constructors/ADateConstructorWithFormatDescriptor.java
A asterixdb/asterix-runtime/src/main/java/org/apache/asterix/runtime/evaluators/constructors/ADateTimeCastNullConstructorDescriptor.java
A asterixdb/asterix-runtime/src/main/java/org/apache/asterix/runtime/evaluators/constructors/ADateTimeCastNullConstructorWithFormatDescriptor.java
M asterixdb/asterix-runtime/src/main/java/org/apache/asterix/runtime/evaluators/constructors/ADateTimeConstructorWithFormatDescriptor.java
A asterixdb/asterix-runtime/src/main/java/org/apache/asterix/runtime/evaluators/constructors/ADayTimeDurationCastNullConstructorDescriptor.java
M asterixdb/asterix-runtime/src/main/java/org/apache/asterix/runtime/evaluators/constructors/ADayTimeDurationConstructorDescriptor.java
A asterixdb/asterix-runtime/src/main/java/org/apache/asterix/runtime/evaluators/constructors/ADoubleCastNullConstructorDescriptor.java
A asterixdb/asterix-runtime/src/main/java/org/apache/asterix/runtime/evaluators/constructors/ADurationCastNullConstructorDescriptor.java
M asterixdb/asterix-runtime/src/main/java/org/apache/asterix/runtime/evaluators/constructors/ADurationConstructorDescriptor.java
A asterixdb/asterix-runtime/src/main/java/org/apache/asterix/runtime/evaluators/constructors/AFloatCastNullConstructorDescriptor.java
M asterixdb/asterix-runtime/src/main/java/org/apache/asterix/runtime/evaluators/constructors/AFloatConstructorDescriptor.java
A asterixdb/asterix-runtime/src/main/java/org/apache/asterix/runtime/evaluators/constructors/AInt16CastNullConstructorDescriptor.java
M asterixdb/asterix-runtime/src/main/java/org/apache/asterix/runtime/evaluators/constructors/AInt16ConstructorDescriptor.java
A asterixdb/asterix-runtime/src/main/java/org/apache/asterix/runtime/evaluators/constructors/AInt32CastNullConstructorDescriptor.java
M asterixdb/asterix-runtime/src/main/java/org/apache/asterix/runtime/evaluators/constructors/AInt32ConstructorDescriptor.java
A asterixdb/asterix-runtime/src/main/java/org/apache/asterix/runtime/evaluators/constructors/AInt64CastNullConstructorDescriptor.java
A asterixdb/asterix-runtime/src/main/java/org/apache/asterix/runtime/evaluators/constructors/AInt8CastNullConstructorDescriptor.java
M asterixdb/asterix-runtime/src/main/java/org/apache/asterix/runtime/evaluators/constructors/AInt8ConstructorDescriptor.java
A asterixdb/asterix-runtime/src/main/java/org/apache/asterix/runtime/evaluators/constructors/AStringCastNullConstructorDescriptor.java
A asterixdb/asterix-runtime/src/main/java/org/apache/asterix/runtime/evaluators/constructors/ATimeCastNullConstructorDescriptor.java
A asterixdb/asterix-runtime/src/main/java/org/apache/asterix/runtime/evaluators/constructors/ATimeCastNullConstructorWithFormatDescriptor.java
M asterixdb/asterix-runtime/src/main/java/org/apache/asterix/runtime/evaluators/constructors/ATimeConstructorWithFormatDescriptor.java
A asterixdb/asterix-runtime/src/main/java/org/apache/asterix/runtime/evaluators/constructors/AUUIDFromStringCastNullConstructorDescriptor.java
M asterixdb/asterix-runtime/src/main/java/org/apache/asterix/runtime/evaluators/constructors/AUUIDFromStringConstructorDescriptor.java
A asterixdb/asterix-runtime/src/main/java/org/apache/asterix/runtime/evaluators/constructors/AYearMonthDurationCastNullConstructorDescriptor.java
M asterixdb/asterix-runtime/src/main/java/org/apache/asterix/runtime/evaluators/constructors/AYearMonthDurationConstructorDescriptor.java
A asterixdb/asterix-runtime/src/main/java/org/apache/asterix/runtime/evaluators/constructors/AbstractDateConstructorWithFormatEvaluator.java
A asterixdb/asterix-runtime/src/main/java/org/apache/asterix/runtime/evaluators/constructors/AbstractDateTimeConstructorWithFormatEvaluator.java
A asterixdb/asterix-runtime/src/main/java/org/apache/asterix/runtime/evaluators/constructors/AbstractDayTimeDurationConstructorEvaluator.java
A asterixdb/asterix-runtime/src/main/java/org/apache/asterix/runtime/evaluators/constructors/AbstractDurationConstructorEvaluator.java
A asterixdb/asterix-runtime/src/main/java/org/apache/asterix/runtime/evaluators/constructors/AbstractFloatConstructorEvaluator.java
A asterixdb/asterix-runtime/src/main/java/org/apache/asterix/runtime/evaluators/constructors/AbstractInt16ConstructorEvaluator.java
A asterixdb/asterix-runtime/src/main/java/org/apache/asterix/runtime/evaluators/constructors/AbstractInt32ConstructorEvaluator.java
A asterixdb/asterix-runtime/src/main/java/org/apache/asterix/runtime/evaluators/constructors/AbstractInt8ConstructorEvaluator.java
A asterixdb/asterix-runtime/src/main/java/org/apache/asterix/runtime/evaluators/constructors/AbstractTimeWithFormatConstructorEvaluator.java
A asterixdb/asterix-runtime/src/main/java/org/apache/asterix/runtime/evaluators/constructors/AbstractUUIDFromStringConstructorEvaluator.java
A asterixdb/asterix-runtime/src/main/java/org/apache/asterix/runtime/evaluators/constructors/AbstractYearMonthDurationConstructorEvaluator.java
M asterixdb/asterix-runtime/src/main/java/org/apache/asterix/runtime/evaluators/functions/PointableHelper.java
M asterixdb/asterix-runtime/src/main/java/org/apache/asterix/runtime/functions/FunctionCollection.java
50 files changed, 2,555 insertions(+), 804 deletions(-)



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

diff --git a/asterixdb/asterix-algebra/src/main/java/org/apache/asterix/optimizer/rules/IntroduceSecondaryIndexInsertDeleteRule.java b/asterixdb/asterix-algebra/src/main/java/org/apache/asterix/optimizer/rules/IntroduceSecondaryIndexInsertDeleteRule.java
index bf5ef28..699fc18 100644
--- a/asterixdb/asterix-algebra/src/main/java/org/apache/asterix/optimizer/rules/IntroduceSecondaryIndexInsertDeleteRule.java
+++ b/asterixdb/asterix-algebra/src/main/java/org/apache/asterix/optimizer/rules/IntroduceSecondaryIndexInsertDeleteRule.java
@@ -895,16 +895,9 @@
             throw new CompilationException(ErrorCode.COMPILATION_TYPE_UNSUPPORTED, sourceLoc, "index",
                     requiredType.getTypeName());
         }
-        // make CONSTRUCTOR(IF_MISSING(input, NULL))
-        BuiltinFunctionInfo ifMissingInfo = BuiltinFunctions.getBuiltinFunctionInfo(BuiltinFunctions.IF_MISSING);
-        ScalarFunctionCallExpression ifMissingExpr = new ScalarFunctionCallExpression(ifMissingInfo);
-        ifMissingExpr.getArguments().add(new MutableObject<>(inputExpr));
-        ifMissingExpr.getArguments().add(new MutableObject<>(ConstantExpression.NULL));
-        ifMissingExpr.setSourceLocation(sourceLoc);
-
         BuiltinFunctionInfo typeConstructorInfo = BuiltinFunctions.getBuiltinFunctionInfo(typeConstructorFun);
         ScalarFunctionCallExpression constructorExpr = new ScalarFunctionCallExpression(typeConstructorInfo);
-        constructorExpr.getArguments().add(new MutableObject<>(ifMissingExpr));
+        constructorExpr.getArguments().add(new MutableObject<>(inputExpr));
         constructorExpr.setSourceLocation(sourceLoc);
         return constructorExpr;
     }
diff --git a/asterixdb/asterix-app/src/test/resources/runtimets/testsuite_sqlpp.xml b/asterixdb/asterix-app/src/test/resources/runtimets/testsuite_sqlpp.xml
index 77f412c..a32d27d 100644
--- a/asterixdb/asterix-app/src/test/resources/runtimets/testsuite_sqlpp.xml
+++ b/asterixdb/asterix-app/src/test/resources/runtimets/testsuite_sqlpp.xml
@@ -13324,19 +13324,19 @@
         <expected-warn>ASX0006: Invalid format for duration in k (in line 30, at column 6)</expected-warn>
         <expected-warn>ASX0006: Invalid format for yearmonthduration in m (in line 30, at column 6)</expected-warn>
         <expected-warn>ASX0006: Invalid format for daytimeduration in n (in line 30, at column 6)</expected-warn>
-        <expected-warn>ASX0004: Unsupported type: boolean() cannot process input type duration (in line 30, at column 6)</expected-warn>
-        <expected-warn>ASX0004: Unsupported type: int8() cannot process input type duration (in line 30, at column 6)</expected-warn>
-        <expected-warn>ASX0004: Unsupported type: int16() cannot process input type duration (in line 30, at column 6)</expected-warn>
-        <expected-warn>ASX0004: Unsupported type: int32() cannot process input type duration (in line 30, at column 6)</expected-warn>
-        <expected-warn>ASX0004: Unsupported type: int64() cannot process input type duration (in line 30, at column 6)</expected-warn>
-        <expected-warn>ASX0004: Unsupported type: float() cannot process input type duration (in line 30, at column 6)</expected-warn>
-        <expected-warn>ASX0004: Unsupported type: double() cannot process input type duration (in line 30, at column 6)</expected-warn>
-        <expected-warn>ASX0004: Unsupported type: datetime() cannot process input type duration (in line 30, at column 6)</expected-warn>
-        <expected-warn>ASX0004: Unsupported type: date() cannot process input type duration (in line 30, at column 6)</expected-warn>
-        <expected-warn>ASX0004: Unsupported type: time() cannot process input type duration (in line 30, at column 6)</expected-warn>
-        <expected-warn>ASX0004: Unsupported type: duration() cannot process input type date (in line 30, at column 6)</expected-warn>
-        <expected-warn>ASX0004: Unsupported type: year-month-duration() cannot process input type date (in line 30, at column 6)</expected-warn>
-        <expected-warn>ASX0004: Unsupported type: day-time-duration() cannot process input type date (in line 30, at column 6)</expected-warn>
+        <expected-warn>ASX0004: Unsupported type: boolean-cast-null() cannot process input type duration (in line 30, at column 6)</expected-warn>
+        <expected-warn>ASX0004: Unsupported type: int8-cast-null() cannot process input type duration (in line 30, at column 6)</expected-warn>
+        <expected-warn>ASX0004: Unsupported type: int16-cast-null() cannot process input type duration (in line 30, at column 6)</expected-warn>
+        <expected-warn>ASX0004: Unsupported type: int32-cast-null() cannot process input type duration (in line 30, at column 6)</expected-warn>
+        <expected-warn>ASX0004: Unsupported type: int64-cast-null() cannot process input type duration (in line 30, at column 6)</expected-warn>
+        <expected-warn>ASX0004: Unsupported type: float-cast-null() cannot process input type duration (in line 30, at column 6)</expected-warn>
+        <expected-warn>ASX0004: Unsupported type: double-cast-null() cannot process input type duration (in line 30, at column 6)</expected-warn>
+        <expected-warn>ASX0004: Unsupported type: datetime-cast-null() cannot process input type duration (in line 30, at column 6)</expected-warn>
+        <expected-warn>ASX0004: Unsupported type: date-cast-null() cannot process input type duration (in line 30, at column 6)</expected-warn>
+        <expected-warn>ASX0004: Unsupported type: time-cast-null() cannot process input type duration (in line 30, at column 6)</expected-warn>
+        <expected-warn>ASX0004: Unsupported type: duration-cast-null() cannot process input type date (in line 30, at column 6)</expected-warn>
+        <expected-warn>ASX0004: Unsupported type: year-month-duration-cast-null() cannot process input type date (in line 30, at column 6)</expected-warn>
+        <expected-warn>ASX0004: Unsupported type: day-time-duration-cast-null() cannot process input type date (in line 30, at column 6)</expected-warn>
       </compilation-unit>
     </test-case>
     <test-case FilePath="view" check-warnings="true">
diff --git a/asterixdb/asterix-lang-sqlpp/src/main/java/org/apache/asterix/lang/sqlpp/rewrites/SqlppFunctionBodyRewriter.java b/asterixdb/asterix-lang-sqlpp/src/main/java/org/apache/asterix/lang/sqlpp/rewrites/SqlppFunctionBodyRewriter.java
index 868469b..557f17d 100644
--- a/asterixdb/asterix-lang-sqlpp/src/main/java/org/apache/asterix/lang/sqlpp/rewrites/SqlppFunctionBodyRewriter.java
+++ b/asterixdb/asterix-lang-sqlpp/src/main/java/org/apache/asterix/lang/sqlpp/rewrites/SqlppFunctionBodyRewriter.java
@@ -173,7 +173,6 @@
                 primeType = fieldType;
             }
             Expression expr = ViewUtil.createFieldAccessExpression(fromVar, fieldName, sourceLoc);
-            expr = ViewUtil.createMissingToNullExpression(expr, sourceLoc); // Default Null handling
             Expression projectExpr =
                     ViewUtil.createTypeConvertExpression(expr, primeType, temporalDataFormat, viewName, sourceLoc);
             VarIdentifier projectVar = context.newVariable();
diff --git a/asterixdb/asterix-metadata/src/main/java/org/apache/asterix/metadata/utils/SecondaryBTreeOperationsHelper.java b/asterixdb/asterix-metadata/src/main/java/org/apache/asterix/metadata/utils/SecondaryBTreeOperationsHelper.java
index 61c2df8..2095a3b 100644
--- a/asterixdb/asterix-metadata/src/main/java/org/apache/asterix/metadata/utils/SecondaryBTreeOperationsHelper.java
+++ b/asterixdb/asterix-metadata/src/main/java/org/apache/asterix/metadata/utils/SecondaryBTreeOperationsHelper.java
@@ -31,7 +31,6 @@
 import org.apache.asterix.metadata.entities.Dataset;
 import org.apache.asterix.metadata.entities.Index;
 import org.apache.asterix.metadata.entities.InternalDatasetDetails;
-import org.apache.asterix.om.functions.BuiltinFunctions;
 import org.apache.asterix.om.functions.IFunctionDescriptor;
 import org.apache.asterix.om.functions.IFunctionManager;
 import org.apache.asterix.om.typecomputer.impl.TypeComputeUtils;
@@ -41,7 +40,6 @@
 import org.apache.asterix.runtime.utils.RuntimeUtils;
 import org.apache.hyracks.algebricks.common.exceptions.AlgebricksException;
 import org.apache.hyracks.algebricks.common.utils.Pair;
-import org.apache.hyracks.algebricks.core.algebra.expressions.ConstantExpression;
 import org.apache.hyracks.algebricks.core.algebra.functions.FunctionIdentifier;
 import org.apache.hyracks.algebricks.core.jobgen.impl.ConnectorPolicyAssignmentPolicy;
 import org.apache.hyracks.algebricks.data.IBinaryComparatorFactoryProvider;
@@ -315,7 +313,7 @@
 
         IScalarEvaluatorFactory castFieldEvalFactory;
         if (IndexUtil.castDefaultNull(index)) {
-            castFieldEvalFactory = createConstructorFunction(funManger, dataFormat, fieldEvalFactory, fieldType);
+            castFieldEvalFactory = createConstructorFunction(funManger, fieldEvalFactory, fieldType);
         } else if (index.isEnforced()) {
             IScalarEvaluatorFactory[] castArg = new IScalarEvaluatorFactory[] { fieldEvalFactory };
             castFieldEvalFactory =
@@ -328,14 +326,8 @@
         return castFieldEvalFactory;
     }
 
-    private IScalarEvaluatorFactory createConstructorFunction(IFunctionManager funManager, IDataFormat dataFormat,
+    private IScalarEvaluatorFactory createConstructorFunction(IFunctionManager funManager,
             IScalarEvaluatorFactory fieldEvalFactory, IAType fieldType) throws AlgebricksException {
-        // make CONSTRUCTOR(IF_MISSING(field_access, NULL))
-        IFunctionDescriptor ifMissing = funManager.lookupFunction(BuiltinFunctions.IF_MISSING, sourceLoc);
-        IScalarEvaluatorFactory nullEvalFactory = dataFormat.getConstantEvalFactory(ConstantExpression.NULL.getValue());
-        IScalarEvaluatorFactory[] ifMissingArgs = new IScalarEvaluatorFactory[] { fieldEvalFactory, nullEvalFactory };
-        ifMissing.setSourceLocation(sourceLoc);
-        IScalarEvaluatorFactory ifMissingEvalFactory = ifMissing.createEvaluatorFactory(ifMissingArgs);
         FunctionIdentifier typeConstructorFun = TypeUtil.getTypeConstructor(TypeComputeUtils.getActualType(fieldType));
         if (typeConstructorFun == null) {
             throw new CompilationException(ErrorCode.COMPILATION_TYPE_UNSUPPORTED, sourceLoc, "index",
@@ -343,7 +335,7 @@
         }
         IFunctionDescriptor typeConstructor = funManager.lookupFunction(typeConstructorFun, sourceLoc);
         typeConstructor.setSourceLocation(sourceLoc);
-        return typeConstructor.createEvaluatorFactory(new IScalarEvaluatorFactory[] { ifMissingEvalFactory });
+        return typeConstructor.createEvaluatorFactory(new IScalarEvaluatorFactory[] { fieldEvalFactory });
     }
 
     private int[] createFieldPermutationForBulkLoadOp(int numSecondaryKeyFields) {
diff --git a/asterixdb/asterix-metadata/src/main/java/org/apache/asterix/metadata/utils/TypeUtil.java b/asterixdb/asterix-metadata/src/main/java/org/apache/asterix/metadata/utils/TypeUtil.java
index 661ad0b..0a12d88 100644
--- a/asterixdb/asterix-metadata/src/main/java/org/apache/asterix/metadata/utils/TypeUtil.java
+++ b/asterixdb/asterix-metadata/src/main/java/org/apache/asterix/metadata/utils/TypeUtil.java
@@ -62,53 +62,63 @@
     private TypeUtil() {
     }
 
+    /**
+     * @param type type
+     *
+     * @return a type constructor that produces NULL for MISSING input
+     */
     public static FunctionIdentifier getTypeConstructor(IAType type) {
         switch (type.getTypeTag()) {
             case TINYINT:
-                return BuiltinFunctions.INT8_CONSTRUCTOR;
+                return BuiltinFunctions.INT8_CAST_NULL_CONSTRUCTOR;
             case SMALLINT:
-                return BuiltinFunctions.INT16_CONSTRUCTOR;
+                return BuiltinFunctions.INT16_CAST_NULL_CONSTRUCTOR;
             case INTEGER:
-                return BuiltinFunctions.INT32_CONSTRUCTOR;
+                return BuiltinFunctions.INT32_CAST_NULL_CONSTRUCTOR;
             case BIGINT:
-                return BuiltinFunctions.INT64_CONSTRUCTOR;
+                return BuiltinFunctions.INT64_CAST_NULL_CONSTRUCTOR;
             case FLOAT:
-                return BuiltinFunctions.FLOAT_CONSTRUCTOR;
+                return BuiltinFunctions.FLOAT_CAST_NULL_CONSTRUCTOR;
             case DOUBLE:
-                return BuiltinFunctions.DOUBLE_CONSTRUCTOR;
+                return BuiltinFunctions.DOUBLE_CAST_NULL_CONSTRUCTOR;
             case BOOLEAN:
-                return BuiltinFunctions.BOOLEAN_CONSTRUCTOR;
+                return BuiltinFunctions.BOOLEAN_CAST_NULL_CONSTRUCTOR;
             case STRING:
-                return BuiltinFunctions.STRING_CONSTRUCTOR;
+                return BuiltinFunctions.STRING_CAST_NULL_CONSTRUCTOR;
             case DATE:
-                return BuiltinFunctions.DATE_CONSTRUCTOR;
+                return BuiltinFunctions.DATE_CAST_NULL_CONSTRUCTOR;
             case TIME:
-                return BuiltinFunctions.TIME_CONSTRUCTOR;
+                return BuiltinFunctions.TIME_CAST_NULL_CONSTRUCTOR;
             case DATETIME:
-                return BuiltinFunctions.DATETIME_CONSTRUCTOR;
+                return BuiltinFunctions.DATETIME_CAST_NULL_CONSTRUCTOR;
             case YEARMONTHDURATION:
-                return BuiltinFunctions.YEAR_MONTH_DURATION_CONSTRUCTOR;
+                return BuiltinFunctions.YEAR_MONTH_DURATION_CAST_NULL_CONSTRUCTOR;
             case DAYTIMEDURATION:
-                return BuiltinFunctions.DAY_TIME_DURATION_CONSTRUCTOR;
+                return BuiltinFunctions.DAY_TIME_DURATION_CAST_NULL_CONSTRUCTOR;
             case DURATION:
-                return BuiltinFunctions.DURATION_CONSTRUCTOR;
+                return BuiltinFunctions.DURATION_CAST_NULL_CONSTRUCTOR;
             case UUID:
-                return BuiltinFunctions.UUID_CONSTRUCTOR;
+                return BuiltinFunctions.UUID_CAST_NULL_CONSTRUCTOR;
             case BINARY:
-                return BuiltinFunctions.BINARY_BASE64_CONSTRUCTOR;
+                return BuiltinFunctions.BINARY_BASE64_CAST_NULL_CONSTRUCTOR;
             default:
                 return null;
         }
     }
 
+    /**
+     * @param type type
+     *
+     * @return a type constructor that produces NULL for MISSING input
+     */
     public static FunctionIdentifier getTypeConstructorWithFormat(IAType type) {
         switch (type.getTypeTag()) {
             case DATE:
-                return BuiltinFunctions.DATE_CONSTRUCTOR_WITH_FORMAT;
+                return BuiltinFunctions.DATE_CAST_NULL_CONSTRUCTOR_WITH_FORMAT;
             case TIME:
-                return BuiltinFunctions.TIME_CONSTRUCTOR_WITH_FORMAT;
+                return BuiltinFunctions.TIME_CAST_NULL_CONSTRUCTOR_WITH_FORMAT;
             case DATETIME:
-                return BuiltinFunctions.DATETIME_CONSTRUCTOR_WITH_FORMAT;
+                return BuiltinFunctions.DATETIME_CAST_NULL_CONSTRUCTOR_WITH_FORMAT;
             default:
                 return null;
         }
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 c452c9a..5b8dc67 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
@@ -1115,24 +1115,42 @@
     // constructors:
     public static final FunctionIdentifier BOOLEAN_CONSTRUCTOR =
             new FunctionIdentifier(FunctionConstants.ASTERIX_NS, "boolean", 1);
+    public static final FunctionIdentifier BOOLEAN_CAST_NULL_CONSTRUCTOR =
+            new FunctionIdentifier(FunctionConstants.ASTERIX_NS, "boolean-cast-null", 1);
     public static final FunctionIdentifier STRING_CONSTRUCTOR =
             new FunctionIdentifier(FunctionConstants.ASTERIX_NS, "string", 1);
+    public static final FunctionIdentifier STRING_CAST_NULL_CONSTRUCTOR =
+            new FunctionIdentifier(FunctionConstants.ASTERIX_NS, "string-cast-null", 1);
     public static final FunctionIdentifier BINARY_HEX_CONSTRUCTOR =
             new FunctionIdentifier(FunctionConstants.ASTERIX_NS, "hex", 1);
     public static final FunctionIdentifier BINARY_BASE64_CONSTRUCTOR =
             new FunctionIdentifier(FunctionConstants.ASTERIX_NS, "base64", 1);
+    public static final FunctionIdentifier BINARY_BASE64_CAST_NULL_CONSTRUCTOR =
+            new FunctionIdentifier(FunctionConstants.ASTERIX_NS, "base64-cast-null", 1);
     public static final FunctionIdentifier INT8_CONSTRUCTOR =
             new FunctionIdentifier(FunctionConstants.ASTERIX_NS, "int8", 1);
+    public static final FunctionIdentifier INT8_CAST_NULL_CONSTRUCTOR =
+            new FunctionIdentifier(FunctionConstants.ASTERIX_NS, "int8-cast-null", 1);
     public static final FunctionIdentifier INT16_CONSTRUCTOR =
             new FunctionIdentifier(FunctionConstants.ASTERIX_NS, "int16", 1);
+    public static final FunctionIdentifier INT16_CAST_NULL_CONSTRUCTOR =
+            new FunctionIdentifier(FunctionConstants.ASTERIX_NS, "int16-cast-null", 1);
     public static final FunctionIdentifier INT32_CONSTRUCTOR =
             new FunctionIdentifier(FunctionConstants.ASTERIX_NS, "int32", 1);
+    public static final FunctionIdentifier INT32_CAST_NULL_CONSTRUCTOR =
+            new FunctionIdentifier(FunctionConstants.ASTERIX_NS, "int32-cast-null", 1);
     public static final FunctionIdentifier INT64_CONSTRUCTOR =
             new FunctionIdentifier(FunctionConstants.ASTERIX_NS, "int64", 1);
+    public static final FunctionIdentifier INT64_CAST_NULL_CONSTRUCTOR =
+            new FunctionIdentifier(FunctionConstants.ASTERIX_NS, "int64-cast-null", 1);
     public static final FunctionIdentifier FLOAT_CONSTRUCTOR =
             new FunctionIdentifier(FunctionConstants.ASTERIX_NS, "float", 1);
+    public static final FunctionIdentifier FLOAT_CAST_NULL_CONSTRUCTOR =
+            new FunctionIdentifier(FunctionConstants.ASTERIX_NS, "float-cast-null", 1);
     public static final FunctionIdentifier DOUBLE_CONSTRUCTOR =
             new FunctionIdentifier(FunctionConstants.ASTERIX_NS, "double", 1);
+    public static final FunctionIdentifier DOUBLE_CAST_NULL_CONSTRUCTOR =
+            new FunctionIdentifier(FunctionConstants.ASTERIX_NS, "double-cast-null", 1);
     public static final FunctionIdentifier POINT_CONSTRUCTOR =
             new FunctionIdentifier(FunctionConstants.ASTERIX_NS, "point", 1);
     public static final FunctionIdentifier POINT3D_CONSTRUCTOR =
@@ -1147,25 +1165,45 @@
             new FunctionIdentifier(FunctionConstants.ASTERIX_NS, "polygon", 1);
     public static final FunctionIdentifier TIME_CONSTRUCTOR =
             new FunctionIdentifier(FunctionConstants.ASTERIX_NS, "time", 1);
+    public static final FunctionIdentifier TIME_CAST_NULL_CONSTRUCTOR =
+            new FunctionIdentifier(FunctionConstants.ASTERIX_NS, "time-cast-null", 1);
     public static final FunctionIdentifier TIME_CONSTRUCTOR_WITH_FORMAT =
             new FunctionIdentifier(FunctionConstants.ASTERIX_NS, "time", 2);
+    public static final FunctionIdentifier TIME_CAST_NULL_CONSTRUCTOR_WITH_FORMAT =
+            new FunctionIdentifier(FunctionConstants.ASTERIX_NS, "time-cast-null", 2);
     public static final FunctionIdentifier DATE_CONSTRUCTOR =
             new FunctionIdentifier(FunctionConstants.ASTERIX_NS, "date", 1);
+    public static final FunctionIdentifier DATE_CAST_NULL_CONSTRUCTOR =
+            new FunctionIdentifier(FunctionConstants.ASTERIX_NS, "date-cast-null", 1);
     public static final FunctionIdentifier DATE_CONSTRUCTOR_WITH_FORMAT =
             new FunctionIdentifier(FunctionConstants.ASTERIX_NS, "date", 2);
+    public static final FunctionIdentifier DATE_CAST_NULL_CONSTRUCTOR_WITH_FORMAT =
+            new FunctionIdentifier(FunctionConstants.ASTERIX_NS, "date-cast-null", 2);
     public static final FunctionIdentifier DATETIME_CONSTRUCTOR =
             new FunctionIdentifier(FunctionConstants.ASTERIX_NS, "datetime", 1);
+    public static final FunctionIdentifier DATETIME_CAST_NULL_CONSTRUCTOR =
+            new FunctionIdentifier(FunctionConstants.ASTERIX_NS, "datetime-cast-null", 1);
     public static final FunctionIdentifier DATETIME_CONSTRUCTOR_WITH_FORMAT =
             new FunctionIdentifier(FunctionConstants.ASTERIX_NS, "datetime", 2);
+    public static final FunctionIdentifier DATETIME_CAST_NULL_CONSTRUCTOR_WITH_FORMAT =
+            new FunctionIdentifier(FunctionConstants.ASTERIX_NS, "datetime-cast-null", 2);
     public static final FunctionIdentifier DURATION_CONSTRUCTOR =
             new FunctionIdentifier(FunctionConstants.ASTERIX_NS, "duration", 1);
+    public static final FunctionIdentifier DURATION_CAST_NULL_CONSTRUCTOR =
+            new FunctionIdentifier(FunctionConstants.ASTERIX_NS, "duration-cast-null", 1);
     public static final FunctionIdentifier UUID_CONSTRUCTOR =
             new FunctionIdentifier(FunctionConstants.ASTERIX_NS, "uuid", 1);
+    public static final FunctionIdentifier UUID_CAST_NULL_CONSTRUCTOR =
+            new FunctionIdentifier(FunctionConstants.ASTERIX_NS, "uuid-cast-null", 1);
 
     public static final FunctionIdentifier YEAR_MONTH_DURATION_CONSTRUCTOR =
             new FunctionIdentifier(FunctionConstants.ASTERIX_NS, "year-month-duration", 1);
+    public static final FunctionIdentifier YEAR_MONTH_DURATION_CAST_NULL_CONSTRUCTOR =
+            new FunctionIdentifier(FunctionConstants.ASTERIX_NS, "year-month-duration-cast-null", 1);
     public static final FunctionIdentifier DAY_TIME_DURATION_CONSTRUCTOR =
             new FunctionIdentifier(FunctionConstants.ASTERIX_NS, "day-time-duration", 1);
+    public static final FunctionIdentifier DAY_TIME_DURATION_CAST_NULL_CONSTRUCTOR =
+            new FunctionIdentifier(FunctionConstants.ASTERIX_NS, "day-time-duration-cast-null", 1);
 
     public static final FunctionIdentifier INTERVAL_CONSTRUCTOR =
             new FunctionIdentifier(FunctionConstants.ASTERIX_NS, "interval", 2);
@@ -1755,6 +1793,27 @@
         addPrivateFunction(MAKE_FIELD_INDEX_HANDLE, AnyTypeComputer.INSTANCE, true);
         addPrivateFunction(MAKE_FIELD_NAME_HANDLE, AnyTypeComputer.INSTANCE, true);
 
+        // cast null type constructors
+        addPrivateFunction(BOOLEAN_CAST_NULL_CONSTRUCTOR, ABooleanTypeComputer.INSTANCE_NULLABLE, true);
+        addPrivateFunction(INT8_CAST_NULL_CONSTRUCTOR, AInt8TypeComputer.INSTANCE_NULLABLE, true);
+        addPrivateFunction(INT16_CAST_NULL_CONSTRUCTOR, AInt16TypeComputer.INSTANCE_NULLABLE, true);
+        addPrivateFunction(INT32_CAST_NULL_CONSTRUCTOR, AInt32TypeComputer.INSTANCE_NULLABLE, true);
+        addPrivateFunction(INT64_CAST_NULL_CONSTRUCTOR, AInt64TypeComputer.INSTANCE_NULLABLE, true);
+        addPrivateFunction(FLOAT_CAST_NULL_CONSTRUCTOR, AFloatTypeComputer.INSTANCE_NULLABLE, true);
+        addPrivateFunction(DOUBLE_CAST_NULL_CONSTRUCTOR, ADoubleTypeComputer.INSTANCE_NULLABLE, true);
+        addPrivateFunction(STRING_CAST_NULL_CONSTRUCTOR, AStringTypeComputer.INSTANCE_NULLABLE, true);
+        addPrivateFunction(DATE_CAST_NULL_CONSTRUCTOR, ADateTypeComputer.INSTANCE_NULLABLE, true);
+        addPrivateFunction(DATE_CAST_NULL_CONSTRUCTOR_WITH_FORMAT, ADateTypeComputer.INSTANCE_NULLABLE, true);
+        addPrivateFunction(TIME_CAST_NULL_CONSTRUCTOR, ATimeTypeComputer.INSTANCE_NULLABLE, true);
+        addPrivateFunction(TIME_CAST_NULL_CONSTRUCTOR_WITH_FORMAT, ATimeTypeComputer.INSTANCE_NULLABLE, true);
+        addPrivateFunction(DATETIME_CAST_NULL_CONSTRUCTOR, ADateTimeTypeComputer.INSTANCE_NULLABLE, true);
+        addPrivateFunction(DATETIME_CAST_NULL_CONSTRUCTOR_WITH_FORMAT, ADateTimeTypeComputer.INSTANCE_NULLABLE, true);
+        addPrivateFunction(DURATION_CAST_NULL_CONSTRUCTOR, ADurationTypeComputer.INSTANCE_NULLABLE, true);
+        addPrivateFunction(DAY_TIME_DURATION_CAST_NULL_CONSTRUCTOR, ADayTimeDurationTypeComputer.INSTANCE_NULLABLE, true);
+        addPrivateFunction(YEAR_MONTH_DURATION_CAST_NULL_CONSTRUCTOR, AYearMonthDurationTypeComputer.INSTANCE_NULLABLE, true);
+        addPrivateFunction(UUID_CAST_NULL_CONSTRUCTOR, AUUIDTypeComputer.INSTANCE_NULLABLE, true);
+        addPrivateFunction(BINARY_BASE64_CAST_NULL_CONSTRUCTOR, ABinaryTypeComputer.INSTANCE_NULLABLE, true);
+
         addPrivateFunction(NUMERIC_UNARY_MINUS, NumericUnaryTypeComputer.INSTANCE, true);
         addPrivateFunction(NUMERIC_SUBTRACT, NumericAddSubMulDivTypeComputer.INSTANCE_SUB, true);
         addPrivateFunction(NUMERIC_MULTIPLY, NumericAddSubMulDivTypeComputer.INSTANCE_MUL_POW, true);
diff --git a/asterixdb/asterix-runtime/src/main/java/org/apache/asterix/runtime/evaluators/constructors/ABinaryBase64StringCastNullConstructorDescriptor.java b/asterixdb/asterix-runtime/src/main/java/org/apache/asterix/runtime/evaluators/constructors/ABinaryBase64StringCastNullConstructorDescriptor.java
new file mode 100644
index 0000000..53ed0a4
--- /dev/null
+++ b/asterixdb/asterix-runtime/src/main/java/org/apache/asterix/runtime/evaluators/constructors/ABinaryBase64StringCastNullConstructorDescriptor.java
@@ -0,0 +1,65 @@
+/*
+ * 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 org.apache.asterix.common.annotations.MissingNullInOutFunction;
+import org.apache.asterix.om.functions.BuiltinFunctions;
+import org.apache.asterix.om.functions.IFunctionDescriptorFactory;
+import org.apache.asterix.runtime.evaluators.base.AbstractScalarFunctionDynamicDescriptor;
+import org.apache.asterix.runtime.evaluators.functions.PointableHelper;
+import org.apache.hyracks.algebricks.core.algebra.functions.FunctionIdentifier;
+import org.apache.hyracks.algebricks.runtime.base.IEvaluatorContext;
+import org.apache.hyracks.algebricks.runtime.base.IScalarEvaluator;
+import org.apache.hyracks.algebricks.runtime.base.IScalarEvaluatorFactory;
+import org.apache.hyracks.api.exceptions.HyracksDataException;
+import org.apache.hyracks.data.std.api.IPointable;
+
+@MissingNullInOutFunction
+public class ABinaryBase64StringCastNullConstructorDescriptor extends AbstractScalarFunctionDynamicDescriptor {
+    private static final long serialVersionUID = 1L;
+    public static final IFunctionDescriptorFactory FACTORY = ABinaryBase64StringCastNullConstructorDescriptor::new;
+
+    @Override
+    public IScalarEvaluatorFactory createEvaluatorFactory(final IScalarEvaluatorFactory[] args) {
+        return new IScalarEvaluatorFactory() {
+            private static final long serialVersionUID = 1L;
+
+            @Override
+            public IScalarEvaluator createScalarEvaluator(IEvaluatorContext ctx) throws HyracksDataException {
+                return new ABinaryBase64StringConstructorDescriptor.ABinaryBase64StringConstructorEvaluator(ctx, args[0].createScalarEvaluator(ctx), sourceLoc) {
+
+                    @Override
+                    protected boolean checkAndSetMissingOrNull(IPointable result) throws HyracksDataException {
+                        return PointableHelper.checkAndSetNull(result, inputArg);
+                    }
+
+                    @Override
+                    protected FunctionIdentifier getIdentifier() {
+                        return ABinaryBase64StringCastNullConstructorDescriptor.this.getIdentifier();
+                    }
+                };
+            }
+        };
+    }
+
+    @Override
+    public FunctionIdentifier getIdentifier() {
+        return BuiltinFunctions.BINARY_BASE64_CAST_NULL_CONSTRUCTOR;
+    }
+}
diff --git a/asterixdb/asterix-runtime/src/main/java/org/apache/asterix/runtime/evaluators/constructors/ABinaryBase64StringConstructorDescriptor.java b/asterixdb/asterix-runtime/src/main/java/org/apache/asterix/runtime/evaluators/constructors/ABinaryBase64StringConstructorDescriptor.java
index 3f2f68a..72ae651 100644
--- a/asterixdb/asterix-runtime/src/main/java/org/apache/asterix/runtime/evaluators/constructors/ABinaryBase64StringConstructorDescriptor.java
+++ b/asterixdb/asterix-runtime/src/main/java/org/apache/asterix/runtime/evaluators/constructors/ABinaryBase64StringConstructorDescriptor.java
@@ -28,6 +28,7 @@
 import org.apache.hyracks.algebricks.runtime.base.IScalarEvaluator;
 import org.apache.hyracks.algebricks.runtime.base.IScalarEvaluatorFactory;
 import org.apache.hyracks.api.exceptions.HyracksDataException;
+import org.apache.hyracks.api.exceptions.SourceLocation;
 import org.apache.hyracks.data.std.primitive.UTF8StringPointable;
 import org.apache.hyracks.util.bytes.Base64Parser;
 
@@ -43,27 +44,7 @@
 
             @Override
             public IScalarEvaluator createScalarEvaluator(IEvaluatorContext ctx) throws HyracksDataException {
-                return new AbstractBinaryConstructorEvaluator(ctx, args[0].createScalarEvaluator(ctx), sourceLoc) {
-
-                    private final Base64Parser parser = new Base64Parser();
-
-                    @Override
-                    protected boolean parseBinary(UTF8StringPointable textPtr, AMutableBinary result) {
-                        try {
-                            parser.generatePureByteArrayFromBase64String(textPtr.getByteArray(),
-                                    textPtr.getCharStartOffset(), textPtr.getUTF8Length());
-                        } catch (IllegalArgumentException e) {
-                            return false;
-                        }
-                        result.setValue(parser.getByteArray(), 0, parser.getLength());
-                        return true;
-                    }
-
-                    @Override
-                    protected FunctionIdentifier getIdentifier() {
-                        return ABinaryBase64StringConstructorDescriptor.this.getIdentifier();
-                    }
-                };
+                return new ABinaryBase64StringConstructorEvaluator(ctx, args[0].createScalarEvaluator(ctx), sourceLoc);
             }
         };
     }
@@ -72,4 +53,31 @@
     public FunctionIdentifier getIdentifier() {
         return BuiltinFunctions.BINARY_BASE64_CONSTRUCTOR;
     }
+
+    protected static class ABinaryBase64StringConstructorEvaluator extends AbstractBinaryConstructorEvaluator {
+
+        private final Base64Parser parser = new Base64Parser();
+
+        protected ABinaryBase64StringConstructorEvaluator(IEvaluatorContext ctx, IScalarEvaluator inputEval,
+                SourceLocation sourceLoc) {
+            super(ctx, inputEval, sourceLoc);
+        }
+
+        @Override
+        protected boolean parseBinary(UTF8StringPointable textPtr, AMutableBinary result) {
+            try {
+                parser.generatePureByteArrayFromBase64String(textPtr.getByteArray(),
+                        textPtr.getCharStartOffset(), textPtr.getUTF8Length());
+            } catch (IllegalArgumentException e) {
+                return false;
+            }
+            result.setValue(parser.getByteArray(), 0, parser.getLength());
+            return true;
+        }
+
+        @Override
+        protected FunctionIdentifier getIdentifier() {
+            return BuiltinFunctions.BINARY_BASE64_CONSTRUCTOR;
+        }
+    }
 }
diff --git a/asterixdb/asterix-runtime/src/main/java/org/apache/asterix/runtime/evaluators/constructors/ABooleanCastNullConstructorDescriptor.java b/asterixdb/asterix-runtime/src/main/java/org/apache/asterix/runtime/evaluators/constructors/ABooleanCastNullConstructorDescriptor.java
new file mode 100644
index 0000000..e5511d3
--- /dev/null
+++ b/asterixdb/asterix-runtime/src/main/java/org/apache/asterix/runtime/evaluators/constructors/ABooleanCastNullConstructorDescriptor.java
@@ -0,0 +1,64 @@
+/*
+ * 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 org.apache.asterix.common.annotations.MissingNullInOutFunction;
+import org.apache.asterix.om.functions.BuiltinFunctions;
+import org.apache.asterix.om.functions.IFunctionDescriptorFactory;
+import org.apache.asterix.runtime.evaluators.base.AbstractScalarFunctionDynamicDescriptor;
+import org.apache.asterix.runtime.evaluators.functions.PointableHelper;
+import org.apache.hyracks.algebricks.core.algebra.functions.FunctionIdentifier;
+import org.apache.hyracks.algebricks.runtime.base.IEvaluatorContext;
+import org.apache.hyracks.algebricks.runtime.base.IScalarEvaluator;
+import org.apache.hyracks.algebricks.runtime.base.IScalarEvaluatorFactory;
+import org.apache.hyracks.api.exceptions.HyracksDataException;
+import org.apache.hyracks.data.std.api.IPointable;
+
+@MissingNullInOutFunction
+public class ABooleanCastNullConstructorDescriptor extends AbstractScalarFunctionDynamicDescriptor {
+    private static final long serialVersionUID = 1L;
+    public static final IFunctionDescriptorFactory FACTORY = ABooleanCastNullConstructorDescriptor::new;
+
+    @Override
+    public IScalarEvaluatorFactory createEvaluatorFactory(final IScalarEvaluatorFactory[] args) {
+        return new IScalarEvaluatorFactory() {
+            private static final long serialVersionUID = 1L;
+
+            @Override
+            public IScalarEvaluator createScalarEvaluator(IEvaluatorContext ctx) throws HyracksDataException {
+                return new AbstractBooleanConstructorEvaluator(ctx, args[0].createScalarEvaluator(ctx), sourceLoc) {
+                    @Override
+                    protected FunctionIdentifier getIdentifier() {
+                        return ABooleanCastNullConstructorDescriptor.this.getIdentifier();
+                    }
+
+                    @Override
+                    protected boolean checkAndSetMissingOrNull(IPointable result) throws HyracksDataException {
+                        return PointableHelper.checkAndSetNull(result, inputArg);
+                    }
+                };
+            }
+        };
+    }
+
+    @Override
+    public FunctionIdentifier getIdentifier() {
+        return BuiltinFunctions.BOOLEAN_CAST_NULL_CONSTRUCTOR;
+    }
+}
diff --git a/asterixdb/asterix-runtime/src/main/java/org/apache/asterix/runtime/evaluators/constructors/ADateCastNullConstructorDescriptor.java b/asterixdb/asterix-runtime/src/main/java/org/apache/asterix/runtime/evaluators/constructors/ADateCastNullConstructorDescriptor.java
new file mode 100644
index 0000000..b2a8207
--- /dev/null
+++ b/asterixdb/asterix-runtime/src/main/java/org/apache/asterix/runtime/evaluators/constructors/ADateCastNullConstructorDescriptor.java
@@ -0,0 +1,65 @@
+/*
+ * 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 org.apache.asterix.common.annotations.MissingNullInOutFunction;
+import org.apache.asterix.om.functions.BuiltinFunctions;
+import org.apache.asterix.om.functions.IFunctionDescriptorFactory;
+import org.apache.asterix.runtime.evaluators.base.AbstractScalarFunctionDynamicDescriptor;
+import org.apache.asterix.runtime.evaluators.functions.PointableHelper;
+import org.apache.hyracks.algebricks.core.algebra.functions.FunctionIdentifier;
+import org.apache.hyracks.algebricks.runtime.base.IEvaluatorContext;
+import org.apache.hyracks.algebricks.runtime.base.IScalarEvaluator;
+import org.apache.hyracks.algebricks.runtime.base.IScalarEvaluatorFactory;
+import org.apache.hyracks.api.exceptions.HyracksDataException;
+import org.apache.hyracks.data.std.api.IPointable;
+
+@MissingNullInOutFunction
+public class ADateCastNullConstructorDescriptor extends AbstractScalarFunctionDynamicDescriptor {
+    private static final long serialVersionUID = 1L;
+    public static final IFunctionDescriptorFactory FACTORY = ADateCastNullConstructorDescriptor::new;
+
+    @Override
+    public IScalarEvaluatorFactory createEvaluatorFactory(final IScalarEvaluatorFactory[] args) {
+        return new IScalarEvaluatorFactory() {
+            private static final long serialVersionUID = 1L;
+
+            @Override
+            public IScalarEvaluator createScalarEvaluator(IEvaluatorContext ctx) throws HyracksDataException {
+                return new AbstractDateConstructorEvaluator(ctx, args[0].createScalarEvaluator(ctx), sourceLoc) {
+
+                    @Override
+                    protected FunctionIdentifier getIdentifier() {
+                        return ADateCastNullConstructorDescriptor.this.getIdentifier();
+                    }
+
+                    @Override
+                    protected boolean checkAndSetMissingOrNull(IPointable result) throws HyracksDataException {
+                        return PointableHelper.checkAndSetNull(result, inputArg);
+                    }
+                };
+            }
+        };
+    }
+
+    @Override
+    public FunctionIdentifier getIdentifier() {
+        return BuiltinFunctions.DATE_CAST_NULL_CONSTRUCTOR;
+    }
+}
diff --git a/asterixdb/asterix-runtime/src/main/java/org/apache/asterix/runtime/evaluators/constructors/ADateCastNullConstructorWithFormatDescriptor.java b/asterixdb/asterix-runtime/src/main/java/org/apache/asterix/runtime/evaluators/constructors/ADateCastNullConstructorWithFormatDescriptor.java
new file mode 100644
index 0000000..81b338e
--- /dev/null
+++ b/asterixdb/asterix-runtime/src/main/java/org/apache/asterix/runtime/evaluators/constructors/ADateCastNullConstructorWithFormatDescriptor.java
@@ -0,0 +1,69 @@
+/*
+ * 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 org.apache.asterix.common.annotations.MissingNullInOutFunction;
+import org.apache.asterix.om.functions.BuiltinFunctions;
+import org.apache.asterix.om.functions.IFunctionDescriptorFactory;
+import org.apache.asterix.runtime.evaluators.base.AbstractScalarFunctionDynamicDescriptor;
+import org.apache.asterix.runtime.evaluators.functions.PointableHelper;
+import org.apache.hyracks.algebricks.core.algebra.functions.FunctionIdentifier;
+import org.apache.hyracks.algebricks.runtime.base.IEvaluatorContext;
+import org.apache.hyracks.algebricks.runtime.base.IScalarEvaluator;
+import org.apache.hyracks.algebricks.runtime.base.IScalarEvaluatorFactory;
+import org.apache.hyracks.api.exceptions.HyracksDataException;
+import org.apache.hyracks.data.std.api.IPointable;
+
+@MissingNullInOutFunction
+public class ADateCastNullConstructorWithFormatDescriptor extends AbstractScalarFunctionDynamicDescriptor {
+    private static final long serialVersionUID = 1L;
+    public static final IFunctionDescriptorFactory FACTORY = ADateCastNullConstructorWithFormatDescriptor::new;
+
+    @Override
+    public IScalarEvaluatorFactory createEvaluatorFactory(final IScalarEvaluatorFactory[] args) {
+        return new IScalarEvaluatorFactory() {
+            private static final long serialVersionUID = 1L;
+
+            @Override
+            public IScalarEvaluator createScalarEvaluator(IEvaluatorContext ctx) throws HyracksDataException {
+                return new AbstractDateConstructorWithFormatEvaluator(ctx, args, sourceLoc) {
+
+                    @Override
+                    protected FunctionIdentifier getIdentifier() {
+                        return ADateCastNullConstructorWithFormatDescriptor.this.getIdentifier();
+                    }
+
+                    @Override
+                    protected boolean checkAndSetMissingOrNull(IPointable result) throws HyracksDataException {
+                        if (PointableHelper.checkAndSetNull(result, inputArg)) {
+                            return true;
+                        }
+                        return super.checkAndSetMissingOrNull(result);
+                    }
+                };
+            }
+        };
+    }
+
+    @Override
+    public FunctionIdentifier getIdentifier() {
+        return BuiltinFunctions.DATE_CAST_NULL_CONSTRUCTOR_WITH_FORMAT;
+    }
+}
diff --git a/asterixdb/asterix-runtime/src/main/java/org/apache/asterix/runtime/evaluators/constructors/ADateConstructorWithFormatDescriptor.java b/asterixdb/asterix-runtime/src/main/java/org/apache/asterix/runtime/evaluators/constructors/ADateConstructorWithFormatDescriptor.java
index 9d51f12..29cb552 100644
--- a/asterixdb/asterix-runtime/src/main/java/org/apache/asterix/runtime/evaluators/constructors/ADateConstructorWithFormatDescriptor.java
+++ b/asterixdb/asterix-runtime/src/main/java/org/apache/asterix/runtime/evaluators/constructors/ADateConstructorWithFormatDescriptor.java
@@ -20,36 +20,19 @@
 package org.apache.asterix.runtime.evaluators.constructors;
 
 import org.apache.asterix.common.annotations.MissingNullInOutFunction;
-import org.apache.asterix.om.base.AMutableDate;
-import org.apache.asterix.om.base.AMutableInt64;
-import org.apache.asterix.om.base.temporal.AsterixTemporalTypeParseException;
-import org.apache.asterix.om.base.temporal.DateTimeFormatUtils;
-import org.apache.asterix.om.base.temporal.GregorianCalendarSystem;
 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.runtime.evaluators.base.AbstractScalarFunctionDynamicDescriptor;
-import org.apache.asterix.runtime.evaluators.functions.PointableHelper;
 import org.apache.hyracks.algebricks.core.algebra.functions.FunctionIdentifier;
 import org.apache.hyracks.algebricks.runtime.base.IEvaluatorContext;
 import org.apache.hyracks.algebricks.runtime.base.IScalarEvaluator;
 import org.apache.hyracks.algebricks.runtime.base.IScalarEvaluatorFactory;
 import org.apache.hyracks.api.exceptions.HyracksDataException;
-import org.apache.hyracks.data.std.api.IPointable;
-import org.apache.hyracks.data.std.primitive.UTF8StringPointable;
-import org.apache.hyracks.data.std.primitive.VoidPointable;
-import org.apache.hyracks.dataflow.common.data.accessors.IFrameTupleReference;
 
 @MissingNullInOutFunction
 public class ADateConstructorWithFormatDescriptor extends AbstractScalarFunctionDynamicDescriptor {
     private static final long serialVersionUID = 1L;
-    public static final IFunctionDescriptorFactory FACTORY = new IFunctionDescriptorFactory() {
-        @Override
-        public IFunctionDescriptor createFunctionDescriptor() {
-            return new ADateConstructorWithFormatDescriptor();
-        }
-    };
+    public static final IFunctionDescriptorFactory FACTORY = ADateConstructorWithFormatDescriptor::new;
 
     @Override
     public IScalarEvaluatorFactory createEvaluatorFactory(final IScalarEvaluatorFactory[] args) {
@@ -58,48 +41,7 @@
 
             @Override
             public IScalarEvaluator createScalarEvaluator(IEvaluatorContext ctx) throws HyracksDataException {
-                return new AbstractDateConstructorEvaluator(ctx, args[0].createScalarEvaluator(ctx), sourceLoc) {
-
-                    private final IScalarEvaluator formatEval = args[1].createScalarEvaluator(ctx);
-                    private final IPointable formatArg = new VoidPointable();
-                    private final UTF8StringPointable formatTextPtr = new UTF8StringPointable();
-                    private final AMutableInt64 aInt64 = new AMutableInt64(0);
-
-                    @Override
-                    protected void evaluateInput(IFrameTupleReference tuple) throws HyracksDataException {
-                        super.evaluateInput(tuple);
-                        formatEval.evaluate(tuple, formatArg);
-                    }
-
-                    @Override
-                    protected boolean checkAndSetMissingOrNull(IPointable result) throws HyracksDataException {
-                        return PointableHelper.checkAndSetMissingOrNull(result, inputArg, formatArg);
-                    }
-
-                    @Override
-                    protected boolean parseDate(UTF8StringPointable textPtr, AMutableDate result) {
-                        byte[] formatBytes = formatArg.getByteArray();
-                        int formatStartOffset = formatArg.getStartOffset();
-                        int formatLength = formatArg.getLength();
-                        if (formatBytes[formatStartOffset] != ATypeTag.SERIALIZED_STRING_TYPE_TAG) {
-                            return false;
-                        }
-                        formatTextPtr.set(formatBytes, formatStartOffset + 1, formatLength - 1);
-                        try {
-                            if (DateTimeFormatUtils.getInstance().parseDateTime(aInt64, textPtr.getByteArray(),
-                                    textPtr.getCharStartOffset(), textPtr.getUTF8Length(), formatBytes,
-                                    formatTextPtr.getCharStartOffset(), formatTextPtr.getUTF8Length(),
-                                    DateTimeFormatUtils.DateTimeParseMode.DATE_ONLY, false)) {
-                                result.setValue((int) (aInt64.getLongValue() / GregorianCalendarSystem.CHRONON_OF_DAY));
-                                return true;
-                            } else {
-                                return false;
-                            }
-                        } catch (AsterixTemporalTypeParseException e) {
-                            // shouldn't happen
-                            return false;
-                        }
-                    }
+                return new AbstractDateConstructorWithFormatEvaluator(ctx, args, sourceLoc) {
 
                     @Override
                     protected FunctionIdentifier getIdentifier() {
diff --git a/asterixdb/asterix-runtime/src/main/java/org/apache/asterix/runtime/evaluators/constructors/ADateTimeCastNullConstructorDescriptor.java b/asterixdb/asterix-runtime/src/main/java/org/apache/asterix/runtime/evaluators/constructors/ADateTimeCastNullConstructorDescriptor.java
new file mode 100644
index 0000000..4b5c4d4
--- /dev/null
+++ b/asterixdb/asterix-runtime/src/main/java/org/apache/asterix/runtime/evaluators/constructors/ADateTimeCastNullConstructorDescriptor.java
@@ -0,0 +1,65 @@
+/*
+ * 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 org.apache.asterix.common.annotations.MissingNullInOutFunction;
+import org.apache.asterix.om.functions.BuiltinFunctions;
+import org.apache.asterix.om.functions.IFunctionDescriptorFactory;
+import org.apache.asterix.runtime.evaluators.base.AbstractScalarFunctionDynamicDescriptor;
+import org.apache.asterix.runtime.evaluators.functions.PointableHelper;
+import org.apache.hyracks.algebricks.core.algebra.functions.FunctionIdentifier;
+import org.apache.hyracks.algebricks.runtime.base.IEvaluatorContext;
+import org.apache.hyracks.algebricks.runtime.base.IScalarEvaluator;
+import org.apache.hyracks.algebricks.runtime.base.IScalarEvaluatorFactory;
+import org.apache.hyracks.api.exceptions.HyracksDataException;
+import org.apache.hyracks.data.std.api.IPointable;
+
+@MissingNullInOutFunction
+public class ADateTimeCastNullConstructorDescriptor extends AbstractScalarFunctionDynamicDescriptor {
+    private static final long serialVersionUID = 1L;
+    public static final IFunctionDescriptorFactory FACTORY = ADateTimeCastNullConstructorDescriptor::new;
+
+    @Override
+    public IScalarEvaluatorFactory createEvaluatorFactory(final IScalarEvaluatorFactory[] args) {
+        return new IScalarEvaluatorFactory() {
+            private static final long serialVersionUID = 1L;
+
+            @Override
+            public IScalarEvaluator createScalarEvaluator(IEvaluatorContext ctx) throws HyracksDataException {
+                return new AbstractDateTimeConstructorEvaluator(ctx, args[0].createScalarEvaluator(ctx), sourceLoc) {
+
+                    @Override
+                    protected FunctionIdentifier getIdentifier() {
+                        return ADateTimeCastNullConstructorDescriptor.this.getIdentifier();
+                    }
+
+                    @Override
+                    protected boolean checkAndSetMissingOrNull(IPointable result) throws HyracksDataException {
+                        return PointableHelper.checkAndSetNull(result, inputArg);
+                    }
+                };
+            }
+        };
+    }
+
+    @Override
+    public FunctionIdentifier getIdentifier() {
+        return BuiltinFunctions.DATETIME_CAST_NULL_CONSTRUCTOR;
+    }
+}
diff --git a/asterixdb/asterix-runtime/src/main/java/org/apache/asterix/runtime/evaluators/constructors/ADateTimeCastNullConstructorWithFormatDescriptor.java b/asterixdb/asterix-runtime/src/main/java/org/apache/asterix/runtime/evaluators/constructors/ADateTimeCastNullConstructorWithFormatDescriptor.java
new file mode 100644
index 0000000..bdaf3e3
--- /dev/null
+++ b/asterixdb/asterix-runtime/src/main/java/org/apache/asterix/runtime/evaluators/constructors/ADateTimeCastNullConstructorWithFormatDescriptor.java
@@ -0,0 +1,67 @@
+/*
+ * 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 org.apache.asterix.om.functions.BuiltinFunctions;
+import org.apache.asterix.om.functions.IFunctionDescriptorFactory;
+import org.apache.asterix.runtime.evaluators.base.AbstractScalarFunctionDynamicDescriptor;
+import org.apache.asterix.runtime.evaluators.functions.PointableHelper;
+import org.apache.hyracks.algebricks.core.algebra.functions.FunctionIdentifier;
+import org.apache.hyracks.algebricks.runtime.base.IEvaluatorContext;
+import org.apache.hyracks.algebricks.runtime.base.IScalarEvaluator;
+import org.apache.hyracks.algebricks.runtime.base.IScalarEvaluatorFactory;
+import org.apache.hyracks.api.exceptions.HyracksDataException;
+import org.apache.hyracks.data.std.api.IPointable;
+
+public class ADateTimeCastNullConstructorWithFormatDescriptor extends AbstractScalarFunctionDynamicDescriptor {
+    private static final long serialVersionUID = 1L;
+    public static final IFunctionDescriptorFactory FACTORY = ADateTimeCastNullConstructorWithFormatDescriptor::new;
+
+    @Override
+    public IScalarEvaluatorFactory createEvaluatorFactory(final IScalarEvaluatorFactory[] args) {
+        return new IScalarEvaluatorFactory() {
+            private static final long serialVersionUID = 1L;
+
+            @Override
+            public IScalarEvaluator createScalarEvaluator(IEvaluatorContext ctx) throws HyracksDataException {
+                return new AbstractDateTimeConstructorWithFormatEvaluator(ctx, args, sourceLoc) {
+
+                    @Override
+                    protected FunctionIdentifier getIdentifier() {
+                        return ADateTimeCastNullConstructorWithFormatDescriptor.this.getIdentifier();
+                    }
+
+                    @Override
+                    protected boolean checkAndSetMissingOrNull(IPointable result) throws HyracksDataException {
+                        if (PointableHelper.checkAndSetNull(result, inputArg)) {
+                            return true;
+                        }
+                        return super.checkAndSetMissingOrNull(result);
+                    }
+                };
+            }
+        };
+    }
+
+    @Override
+    public FunctionIdentifier getIdentifier() {
+        return BuiltinFunctions.DATETIME_CAST_NULL_CONSTRUCTOR_WITH_FORMAT;
+    }
+}
diff --git a/asterixdb/asterix-runtime/src/main/java/org/apache/asterix/runtime/evaluators/constructors/ADateTimeConstructorWithFormatDescriptor.java b/asterixdb/asterix-runtime/src/main/java/org/apache/asterix/runtime/evaluators/constructors/ADateTimeConstructorWithFormatDescriptor.java
index 715a7df..af8bba4 100644
--- a/asterixdb/asterix-runtime/src/main/java/org/apache/asterix/runtime/evaluators/constructors/ADateTimeConstructorWithFormatDescriptor.java
+++ b/asterixdb/asterix-runtime/src/main/java/org/apache/asterix/runtime/evaluators/constructors/ADateTimeConstructorWithFormatDescriptor.java
@@ -19,34 +19,18 @@
 
 package org.apache.asterix.runtime.evaluators.constructors;
 
-import org.apache.asterix.om.base.AMutableDateTime;
-import org.apache.asterix.om.base.AMutableInt64;
-import org.apache.asterix.om.base.temporal.AsterixTemporalTypeParseException;
-import org.apache.asterix.om.base.temporal.DateTimeFormatUtils;
 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.runtime.evaluators.base.AbstractScalarFunctionDynamicDescriptor;
-import org.apache.asterix.runtime.evaluators.functions.PointableHelper;
 import org.apache.hyracks.algebricks.core.algebra.functions.FunctionIdentifier;
 import org.apache.hyracks.algebricks.runtime.base.IEvaluatorContext;
 import org.apache.hyracks.algebricks.runtime.base.IScalarEvaluator;
 import org.apache.hyracks.algebricks.runtime.base.IScalarEvaluatorFactory;
 import org.apache.hyracks.api.exceptions.HyracksDataException;
-import org.apache.hyracks.data.std.api.IPointable;
-import org.apache.hyracks.data.std.primitive.UTF8StringPointable;
-import org.apache.hyracks.data.std.primitive.VoidPointable;
-import org.apache.hyracks.dataflow.common.data.accessors.IFrameTupleReference;
 
 public class ADateTimeConstructorWithFormatDescriptor extends AbstractScalarFunctionDynamicDescriptor {
     private static final long serialVersionUID = 1L;
-    public static final IFunctionDescriptorFactory FACTORY = new IFunctionDescriptorFactory() {
-        @Override
-        public IFunctionDescriptor createFunctionDescriptor() {
-            return new ADateTimeConstructorWithFormatDescriptor();
-        }
-    };
+    public static final IFunctionDescriptorFactory FACTORY = ADateTimeConstructorWithFormatDescriptor::new;
 
     @Override
     public IScalarEvaluatorFactory createEvaluatorFactory(final IScalarEvaluatorFactory[] args) {
@@ -55,48 +39,7 @@
 
             @Override
             public IScalarEvaluator createScalarEvaluator(IEvaluatorContext ctx) throws HyracksDataException {
-                return new AbstractDateTimeConstructorEvaluator(ctx, args[0].createScalarEvaluator(ctx), sourceLoc) {
-
-                    private final IScalarEvaluator formatEval = args[1].createScalarEvaluator(ctx);
-                    private final IPointable formatArg = new VoidPointable();
-                    private final UTF8StringPointable formatTextPtr = new UTF8StringPointable();
-                    private final AMutableInt64 aInt64 = new AMutableInt64(0);
-
-                    @Override
-                    protected void evaluateInput(IFrameTupleReference tuple) throws HyracksDataException {
-                        super.evaluateInput(tuple);
-                        formatEval.evaluate(tuple, formatArg);
-                    }
-
-                    @Override
-                    protected boolean checkAndSetMissingOrNull(IPointable result) throws HyracksDataException {
-                        return PointableHelper.checkAndSetMissingOrNull(result, inputArg, formatArg);
-                    }
-
-                    @Override
-                    protected boolean parseDateTime(UTF8StringPointable textPtr, AMutableDateTime result) {
-                        byte[] formatBytes = formatArg.getByteArray();
-                        int formatStartOffset = formatArg.getStartOffset();
-                        int formatLength = formatArg.getLength();
-                        if (formatBytes[formatStartOffset] != ATypeTag.SERIALIZED_STRING_TYPE_TAG) {
-                            return false;
-                        }
-                        formatTextPtr.set(formatBytes, formatStartOffset + 1, formatLength - 1);
-                        try {
-                            if (DateTimeFormatUtils.getInstance().parseDateTime(aInt64, textPtr.getByteArray(),
-                                    textPtr.getCharStartOffset(), textPtr.getUTF8Length(), formatBytes,
-                                    formatTextPtr.getCharStartOffset(), formatTextPtr.getUTF8Length(),
-                                    DateTimeFormatUtils.DateTimeParseMode.DATETIME, false)) {
-                                result.setValue(aInt64.getLongValue());
-                                return true;
-                            } else {
-                                return false;
-                            }
-                        } catch (AsterixTemporalTypeParseException e) {
-                            // shouldn't happen
-                            return false;
-                        }
-                    }
+                return new AbstractDateTimeConstructorWithFormatEvaluator(ctx, args, sourceLoc) {
 
                     @Override
                     protected FunctionIdentifier getIdentifier() {
diff --git a/asterixdb/asterix-runtime/src/main/java/org/apache/asterix/runtime/evaluators/constructors/ADayTimeDurationCastNullConstructorDescriptor.java b/asterixdb/asterix-runtime/src/main/java/org/apache/asterix/runtime/evaluators/constructors/ADayTimeDurationCastNullConstructorDescriptor.java
new file mode 100644
index 0000000..2b1f6ae
--- /dev/null
+++ b/asterixdb/asterix-runtime/src/main/java/org/apache/asterix/runtime/evaluators/constructors/ADayTimeDurationCastNullConstructorDescriptor.java
@@ -0,0 +1,66 @@
+/*
+ * 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 org.apache.asterix.common.annotations.MissingNullInOutFunction;
+import org.apache.asterix.om.functions.BuiltinFunctions;
+import org.apache.asterix.om.functions.IFunctionDescriptorFactory;
+import org.apache.asterix.runtime.evaluators.base.AbstractScalarFunctionDynamicDescriptor;
+import org.apache.asterix.runtime.evaluators.functions.PointableHelper;
+import org.apache.hyracks.algebricks.core.algebra.functions.FunctionIdentifier;
+import org.apache.hyracks.algebricks.runtime.base.IEvaluatorContext;
+import org.apache.hyracks.algebricks.runtime.base.IScalarEvaluator;
+import org.apache.hyracks.algebricks.runtime.base.IScalarEvaluatorFactory;
+import org.apache.hyracks.api.exceptions.HyracksDataException;
+import org.apache.hyracks.data.std.api.IPointable;
+
+@MissingNullInOutFunction
+public class ADayTimeDurationCastNullConstructorDescriptor extends AbstractScalarFunctionDynamicDescriptor {
+
+    private static final long serialVersionUID = 1L;
+    public static final IFunctionDescriptorFactory FACTORY = ADayTimeDurationCastNullConstructorDescriptor::new;
+
+    @Override
+    public IScalarEvaluatorFactory createEvaluatorFactory(final IScalarEvaluatorFactory[] args) {
+        return new IScalarEvaluatorFactory() {
+            private static final long serialVersionUID = 1L;
+
+            @Override
+            public IScalarEvaluator createScalarEvaluator(IEvaluatorContext ctx) throws HyracksDataException {
+                return new AbstractDayTimeDurationConstructorEvaluator(ctx, args[0].createScalarEvaluator(ctx), sourceLoc) {
+
+                    @Override
+                    protected FunctionIdentifier getIdentifier() {
+                        return ADayTimeDurationCastNullConstructorDescriptor.this.getIdentifier();
+                    }
+
+                    @Override
+                    protected boolean checkAndSetMissingOrNull(IPointable result) throws HyracksDataException {
+                        return PointableHelper.checkAndSetNull(result, inputArg);
+                    }
+                };
+            }
+        };
+    }
+
+    @Override
+    public FunctionIdentifier getIdentifier() {
+        return BuiltinFunctions.DAY_TIME_DURATION_CAST_NULL_CONSTRUCTOR;
+    }
+}
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 6178bc9..eb6ff04 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
@@ -53,52 +53,7 @@
 
             @Override
             public IScalarEvaluator createScalarEvaluator(IEvaluatorContext ctx) throws HyracksDataException {
-                return new AbstractConstructorEvaluator(ctx, args[0].createScalarEvaluator(ctx), sourceLoc) {
-
-                    private final AMutableDayTimeDuration aDayTimeDuration = new AMutableDayTimeDuration(0);
-                    @SuppressWarnings("unchecked")
-                    private final ISerializerDeserializer<ADayTimeDuration> dayTimeDurationSerde =
-                            SerializerDeserializerProvider.INSTANCE
-                                    .getSerializerDeserializer(BuiltinType.ADAYTIMEDURATION);
-                    private final UTF8StringPointable utf8Ptr = new UTF8StringPointable();
-
-                    @Override
-                    protected void evaluateImpl(IPointable result) throws HyracksDataException {
-                        byte[] bytes = inputArg.getByteArray();
-                        int startOffset = inputArg.getStartOffset();
-                        int len = inputArg.getLength();
-                        ATypeTag inputType = EnumDeserializer.ATYPETAGDESERIALIZER.deserialize(bytes[startOffset]);
-                        switch (inputType) {
-                            case DAYTIMEDURATION:
-                                result.set(inputArg);
-                                break;
-                            case DURATION:
-                                long millis = ADurationSerializerDeserializer.getDayTime(bytes, startOffset + 1);
-                                aDayTimeDuration.setMilliseconds(millis);
-                                resultStorage.reset();
-                                dayTimeDurationSerde.serialize(aDayTimeDuration, out);
-                                result.set(resultStorage);
-                                break;
-                            case STRING:
-                                utf8Ptr.set(bytes, startOffset + 1, len - 1);
-                                if (parseDayTimeDuration(utf8Ptr, aDayTimeDuration)) {
-                                    resultStorage.reset();
-                                    dayTimeDurationSerde.serialize(aDayTimeDuration, out);
-                                    result.set(resultStorage);
-                                } else {
-                                    handleParseError(utf8Ptr, result);
-                                }
-                                break;
-                            default:
-                                handleUnsupportedType(inputType, result);
-                                break;
-                        }
-                    }
-
-                    @Override
-                    protected BuiltinType getTargetType() {
-                        return BuiltinType.ADAYTIMEDURATION;
-                    }
+                return new AbstractDayTimeDurationConstructorEvaluator(ctx, args[0].createScalarEvaluator(ctx), sourceLoc) {
 
                     @Override
                     protected FunctionIdentifier getIdentifier() {
@@ -109,16 +64,6 @@
         };
     }
 
-    private static boolean parseDayTimeDuration(UTF8StringPointable textPtr, ADayTimeDuration result) {
-        try {
-            ADurationParserFactory.parseDuration(textPtr.getByteArray(), textPtr.getCharStartOffset(),
-                    textPtr.getUTF8Length(), result, ADurationParseOption.DAY_TIME);
-            return true;
-        } catch (HyracksDataException e) {
-            return false;
-        }
-    }
-
     @Override
     public FunctionIdentifier getIdentifier() {
         return BuiltinFunctions.DAY_TIME_DURATION_CONSTRUCTOR;
diff --git a/asterixdb/asterix-runtime/src/main/java/org/apache/asterix/runtime/evaluators/constructors/ADoubleCastNullConstructorDescriptor.java b/asterixdb/asterix-runtime/src/main/java/org/apache/asterix/runtime/evaluators/constructors/ADoubleCastNullConstructorDescriptor.java
new file mode 100644
index 0000000..1f4fd28
--- /dev/null
+++ b/asterixdb/asterix-runtime/src/main/java/org/apache/asterix/runtime/evaluators/constructors/ADoubleCastNullConstructorDescriptor.java
@@ -0,0 +1,65 @@
+/*
+ * 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 org.apache.asterix.common.annotations.MissingNullInOutFunction;
+import org.apache.asterix.om.functions.BuiltinFunctions;
+import org.apache.asterix.om.functions.IFunctionDescriptorFactory;
+import org.apache.asterix.runtime.evaluators.base.AbstractScalarFunctionDynamicDescriptor;
+import org.apache.asterix.runtime.evaluators.functions.PointableHelper;
+import org.apache.hyracks.algebricks.core.algebra.functions.FunctionIdentifier;
+import org.apache.hyracks.algebricks.runtime.base.IEvaluatorContext;
+import org.apache.hyracks.algebricks.runtime.base.IScalarEvaluator;
+import org.apache.hyracks.algebricks.runtime.base.IScalarEvaluatorFactory;
+import org.apache.hyracks.api.exceptions.HyracksDataException;
+import org.apache.hyracks.data.std.api.IPointable;
+
+@MissingNullInOutFunction
+public class ADoubleCastNullConstructorDescriptor extends AbstractScalarFunctionDynamicDescriptor {
+    private static final long serialVersionUID = 1L;
+    public static final IFunctionDescriptorFactory FACTORY = ADoubleCastNullConstructorDescriptor::new;
+
+    @Override
+    public IScalarEvaluatorFactory createEvaluatorFactory(final IScalarEvaluatorFactory[] args) {
+        return new IScalarEvaluatorFactory() {
+            private static final long serialVersionUID = 1L;
+
+            @Override
+            public IScalarEvaluator createScalarEvaluator(IEvaluatorContext ctx) throws HyracksDataException {
+                return new AbstractDoubleConstructorEvaluator(ctx, args[0].createScalarEvaluator(ctx), sourceLoc) {
+
+                    @Override
+                    protected FunctionIdentifier getIdentifier() {
+                        return ADoubleCastNullConstructorDescriptor.this.getIdentifier();
+                    }
+
+                    @Override
+                    protected boolean checkAndSetMissingOrNull(IPointable result) throws HyracksDataException {
+                        return PointableHelper.checkAndSetNull(result, inputArg);
+                    }
+                };
+            }
+        };
+    }
+
+    @Override
+    public FunctionIdentifier getIdentifier() {
+        return BuiltinFunctions.DOUBLE_CAST_NULL_CONSTRUCTOR;
+    }
+}
diff --git a/asterixdb/asterix-runtime/src/main/java/org/apache/asterix/runtime/evaluators/constructors/ADurationCastNullConstructorDescriptor.java b/asterixdb/asterix-runtime/src/main/java/org/apache/asterix/runtime/evaluators/constructors/ADurationCastNullConstructorDescriptor.java
new file mode 100644
index 0000000..8ed2833
--- /dev/null
+++ b/asterixdb/asterix-runtime/src/main/java/org/apache/asterix/runtime/evaluators/constructors/ADurationCastNullConstructorDescriptor.java
@@ -0,0 +1,65 @@
+/*
+ * 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 org.apache.asterix.common.annotations.MissingNullInOutFunction;
+import org.apache.asterix.om.functions.BuiltinFunctions;
+import org.apache.asterix.om.functions.IFunctionDescriptorFactory;
+import org.apache.asterix.runtime.evaluators.base.AbstractScalarFunctionDynamicDescriptor;
+import org.apache.asterix.runtime.evaluators.functions.PointableHelper;
+import org.apache.hyracks.algebricks.core.algebra.functions.FunctionIdentifier;
+import org.apache.hyracks.algebricks.runtime.base.IEvaluatorContext;
+import org.apache.hyracks.algebricks.runtime.base.IScalarEvaluator;
+import org.apache.hyracks.algebricks.runtime.base.IScalarEvaluatorFactory;
+import org.apache.hyracks.api.exceptions.HyracksDataException;
+import org.apache.hyracks.data.std.api.IPointable;
+
+@MissingNullInOutFunction
+public class ADurationCastNullConstructorDescriptor extends AbstractScalarFunctionDynamicDescriptor {
+    private static final long serialVersionUID = 1L;
+    public static final IFunctionDescriptorFactory FACTORY = ADurationCastNullConstructorDescriptor::new;
+
+    @Override
+    public IScalarEvaluatorFactory createEvaluatorFactory(final IScalarEvaluatorFactory[] args) {
+        return new IScalarEvaluatorFactory() {
+            private static final long serialVersionUID = 1L;
+
+            @Override
+            public IScalarEvaluator createScalarEvaluator(IEvaluatorContext ctx) throws HyracksDataException {
+                return new AbstractDurationConstructorEvaluator(ctx, args[0].createScalarEvaluator(ctx), sourceLoc) {
+
+                    @Override
+                    protected FunctionIdentifier getIdentifier() {
+                        return ADurationCastNullConstructorDescriptor.this.getIdentifier();
+                    }
+
+                    @Override
+                    protected boolean checkAndSetMissingOrNull(IPointable result) throws HyracksDataException {
+                        return PointableHelper.checkAndSetNull(result, inputArg);
+                    }
+                };
+            }
+        };
+    }
+
+    @Override
+    public FunctionIdentifier getIdentifier() {
+        return BuiltinFunctions.DURATION_CAST_NULL_CONSTRUCTOR;
+    }
+}
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 6a14031..67742c2 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
@@ -19,27 +19,14 @@
 package org.apache.asterix.runtime.evaluators.constructors;
 
 import org.apache.asterix.common.annotations.MissingNullInOutFunction;
-import org.apache.asterix.dataflow.data.nontagged.serde.ADayTimeDurationSerializerDeserializer;
-import org.apache.asterix.dataflow.data.nontagged.serde.AYearMonthDurationSerializerDeserializer;
-import org.apache.asterix.formats.nontagged.SerializerDeserializerProvider;
-import org.apache.asterix.om.base.ADuration;
-import org.apache.asterix.om.base.AMutableDuration;
-import org.apache.asterix.om.base.temporal.ADurationParserFactory;
-import org.apache.asterix.om.base.temporal.ADurationParserFactory.ADurationParseOption;
 import org.apache.asterix.om.functions.BuiltinFunctions;
 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.om.types.EnumDeserializer;
 import org.apache.asterix.runtime.evaluators.base.AbstractScalarFunctionDynamicDescriptor;
 import org.apache.hyracks.algebricks.core.algebra.functions.FunctionIdentifier;
 import org.apache.hyracks.algebricks.runtime.base.IEvaluatorContext;
 import org.apache.hyracks.algebricks.runtime.base.IScalarEvaluator;
 import org.apache.hyracks.algebricks.runtime.base.IScalarEvaluatorFactory;
-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.UTF8StringPointable;
 
 @MissingNullInOutFunction
 public class ADurationConstructorDescriptor extends AbstractScalarFunctionDynamicDescriptor {
@@ -53,59 +40,7 @@
 
             @Override
             public IScalarEvaluator createScalarEvaluator(IEvaluatorContext ctx) throws HyracksDataException {
-                return new AbstractConstructorEvaluator(ctx, args[0].createScalarEvaluator(ctx), sourceLoc) {
-
-                    private final AMutableDuration aDuration = new AMutableDuration(0, 0);
-                    @SuppressWarnings("unchecked")
-                    private final ISerializerDeserializer<ADuration> durationSerde =
-                            SerializerDeserializerProvider.INSTANCE.getSerializerDeserializer(BuiltinType.ADURATION);
-                    private final UTF8StringPointable utf8Ptr = new UTF8StringPointable();
-
-                    @Override
-                    protected void evaluateImpl(IPointable result) throws HyracksDataException {
-                        byte[] bytes = inputArg.getByteArray();
-                        int startOffset = inputArg.getStartOffset();
-                        int len = inputArg.getLength();
-                        ATypeTag inputType = EnumDeserializer.ATYPETAGDESERIALIZER.deserialize(bytes[startOffset]);
-                        switch (inputType) {
-                            case DURATION:
-                                result.set(inputArg);
-                                break;
-                            case YEARMONTHDURATION:
-                                int months =
-                                        AYearMonthDurationSerializerDeserializer.getYearMonth(bytes, startOffset + 1);
-                                aDuration.setValue(months, 0);
-                                resultStorage.reset();
-                                durationSerde.serialize(aDuration, out);
-                                result.set(resultStorage);
-                                break;
-                            case DAYTIMEDURATION:
-                                long millis = ADayTimeDurationSerializerDeserializer.getDayTime(bytes, startOffset + 1);
-                                aDuration.setValue(0, millis);
-                                resultStorage.reset();
-                                durationSerde.serialize(aDuration, out);
-                                result.set(resultStorage);
-                                break;
-                            case STRING:
-                                utf8Ptr.set(bytes, startOffset + 1, len - 1);
-                                if (parseDuration(utf8Ptr, aDuration)) {
-                                    resultStorage.reset();
-                                    durationSerde.serialize(aDuration, out);
-                                    result.set(resultStorage);
-                                } else {
-                                    handleParseError(utf8Ptr, result);
-                                }
-                                break;
-                            default:
-                                handleUnsupportedType(inputType, result);
-                                break;
-                        }
-                    }
-
-                    @Override
-                    protected BuiltinType getTargetType() {
-                        return BuiltinType.ADURATION;
-                    }
+                return new AbstractDurationConstructorEvaluator(ctx, args[0].createScalarEvaluator(ctx), sourceLoc) {
 
                     @Override
                     protected FunctionIdentifier getIdentifier() {
@@ -116,16 +51,6 @@
         };
     }
 
-    private static boolean parseDuration(UTF8StringPointable textPtr, ADuration result) {
-        try {
-            ADurationParserFactory.parseDuration(textPtr.getByteArray(), textPtr.getCharStartOffset(),
-                    textPtr.getUTF8Length(), result, ADurationParseOption.All);
-            return true;
-        } catch (HyracksDataException e) {
-            return false;
-        }
-    }
-
     @Override
     public FunctionIdentifier getIdentifier() {
         return BuiltinFunctions.DURATION_CONSTRUCTOR;
diff --git a/asterixdb/asterix-runtime/src/main/java/org/apache/asterix/runtime/evaluators/constructors/AFloatCastNullConstructorDescriptor.java b/asterixdb/asterix-runtime/src/main/java/org/apache/asterix/runtime/evaluators/constructors/AFloatCastNullConstructorDescriptor.java
new file mode 100644
index 0000000..2dadd68
--- /dev/null
+++ b/asterixdb/asterix-runtime/src/main/java/org/apache/asterix/runtime/evaluators/constructors/AFloatCastNullConstructorDescriptor.java
@@ -0,0 +1,65 @@
+/*
+ * 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 org.apache.asterix.common.annotations.MissingNullInOutFunction;
+import org.apache.asterix.om.functions.BuiltinFunctions;
+import org.apache.asterix.om.functions.IFunctionDescriptorFactory;
+import org.apache.asterix.runtime.evaluators.base.AbstractScalarFunctionDynamicDescriptor;
+import org.apache.asterix.runtime.evaluators.functions.PointableHelper;
+import org.apache.hyracks.algebricks.core.algebra.functions.FunctionIdentifier;
+import org.apache.hyracks.algebricks.runtime.base.IEvaluatorContext;
+import org.apache.hyracks.algebricks.runtime.base.IScalarEvaluator;
+import org.apache.hyracks.algebricks.runtime.base.IScalarEvaluatorFactory;
+import org.apache.hyracks.api.exceptions.HyracksDataException;
+import org.apache.hyracks.data.std.api.IPointable;
+
+@MissingNullInOutFunction
+public class AFloatCastNullConstructorDescriptor extends AbstractScalarFunctionDynamicDescriptor {
+    private static final long serialVersionUID = 1L;
+    public static final IFunctionDescriptorFactory FACTORY = AFloatCastNullConstructorDescriptor::new;
+
+    @Override
+    public IScalarEvaluatorFactory createEvaluatorFactory(final IScalarEvaluatorFactory[] args) {
+        return new IScalarEvaluatorFactory() {
+            private static final long serialVersionUID = 1L;
+
+            @Override
+            public IScalarEvaluator createScalarEvaluator(IEvaluatorContext ctx) throws HyracksDataException {
+                return new AbstractFloatConstructorEvaluator(ctx, args[0].createScalarEvaluator(ctx), sourceLoc) {
+
+                    @Override
+                    protected FunctionIdentifier getIdentifier() {
+                        return AFloatCastNullConstructorDescriptor.this.getIdentifier();
+                    }
+
+                    @Override
+                    protected boolean checkAndSetMissingOrNull(IPointable result) throws HyracksDataException {
+                        return PointableHelper.checkAndSetNull(result, inputArg);
+                    }
+                };
+            }
+        };
+    }
+
+    @Override
+    public FunctionIdentifier getIdentifier() {
+        return BuiltinFunctions.FLOAT_CAST_NULL_CONSTRUCTOR;
+    }
+}
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 0d443c7..ccd71b9 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
@@ -18,29 +18,15 @@
  */
 package org.apache.asterix.runtime.evaluators.constructors;
 
-import java.io.IOException;
-
 import org.apache.asterix.common.annotations.MissingNullInOutFunction;
-import org.apache.asterix.dataflow.data.nontagged.serde.ABooleanSerializerDeserializer;
-import org.apache.asterix.formats.nontagged.SerializerDeserializerProvider;
-import org.apache.asterix.om.base.AFloat;
-import org.apache.asterix.om.base.AMutableFloat;
 import org.apache.asterix.om.functions.BuiltinFunctions;
 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.om.types.EnumDeserializer;
-import org.apache.asterix.om.types.hierachy.ATypeHierarchy;
 import org.apache.asterix.runtime.evaluators.base.AbstractScalarFunctionDynamicDescriptor;
-import org.apache.asterix.runtime.evaluators.common.NumberUtils;
 import org.apache.hyracks.algebricks.core.algebra.functions.FunctionIdentifier;
 import org.apache.hyracks.algebricks.runtime.base.IEvaluatorContext;
 import org.apache.hyracks.algebricks.runtime.base.IScalarEvaluator;
 import org.apache.hyracks.algebricks.runtime.base.IScalarEvaluatorFactory;
-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.UTF8StringPointable;
 
 @MissingNullInOutFunction
 public class AFloatConstructorDescriptor extends AbstractScalarFunctionDynamicDescriptor {
@@ -54,74 +40,7 @@
 
             @Override
             public IScalarEvaluator createScalarEvaluator(IEvaluatorContext ctx) throws HyracksDataException {
-                return new AbstractConstructorEvaluator(ctx, args[0].createScalarEvaluator(ctx), sourceLoc) {
-
-                    private final AMutableFloat aFloat = new AMutableFloat(0);
-                    @SuppressWarnings("unchecked")
-                    private final ISerializerDeserializer<AFloat> floatSerde =
-                            SerializerDeserializerProvider.INSTANCE.getSerializerDeserializer(BuiltinType.AFLOAT);
-                    private final UTF8StringPointable utf8Ptr = new UTF8StringPointable();
-
-                    @Override
-                    protected void evaluateImpl(IPointable result) throws HyracksDataException {
-                        byte[] bytes = inputArg.getByteArray();
-                        int startOffset = inputArg.getStartOffset();
-                        int len = inputArg.getLength();
-                        ATypeTag inputType = EnumDeserializer.ATYPETAGDESERIALIZER.deserialize(bytes[startOffset]);
-                        switch (inputType) {
-                            case FLOAT:
-                                result.set(inputArg);
-                                break;
-                            case TINYINT:
-                            case SMALLINT:
-                            case INTEGER:
-                            case BIGINT:
-                                resultStorage.reset();
-                                try {
-                                    ATypeHierarchy.getTypePromoteComputer(inputType, ATypeTag.FLOAT).convertType(bytes,
-                                            startOffset + 1, len - 1, out);
-                                } catch (IOException e) {
-                                    throw HyracksDataException.create(e);
-                                }
-                                result.set(resultStorage);
-                                break;
-                            case DOUBLE:
-                                resultStorage.reset();
-                                try {
-                                    ATypeHierarchy.getTypeDemoteComputer(inputType, ATypeTag.FLOAT, false)
-                                            .convertType(bytes, startOffset + 1, len - 1, out);
-                                } catch (IOException e) {
-                                    throw HyracksDataException.create(e);
-                                }
-                                result.set(resultStorage);
-                                break;
-                            case BOOLEAN:
-                                boolean b = ABooleanSerializerDeserializer.getBoolean(bytes, startOffset + 1);
-                                aFloat.setValue(b ? 1 : 0);
-                                resultStorage.reset();
-                                floatSerde.serialize(aFloat, out);
-                                result.set(resultStorage);
-                                break;
-                            case STRING:
-                                utf8Ptr.set(bytes, startOffset + 1, len - 1);
-                                if (NumberUtils.parseFloat(utf8Ptr, aFloat)) {
-                                    resultStorage.reset();
-                                    floatSerde.serialize(aFloat, out);
-                                    result.set(resultStorage);
-                                } else {
-                                    handleParseError(utf8Ptr, result);
-                                }
-                                break;
-                            default:
-                                handleUnsupportedType(inputType, result);
-                                break;
-                        }
-                    }
-
-                    @Override
-                    protected BuiltinType getTargetType() {
-                        return BuiltinType.AFLOAT;
-                    }
+                return new AbstractFloatConstructorEvaluator(ctx, args[0].createScalarEvaluator(ctx), sourceLoc) {
 
                     @Override
                     protected FunctionIdentifier getIdentifier() {
diff --git a/asterixdb/asterix-runtime/src/main/java/org/apache/asterix/runtime/evaluators/constructors/AInt16CastNullConstructorDescriptor.java b/asterixdb/asterix-runtime/src/main/java/org/apache/asterix/runtime/evaluators/constructors/AInt16CastNullConstructorDescriptor.java
new file mode 100644
index 0000000..aa84791
--- /dev/null
+++ b/asterixdb/asterix-runtime/src/main/java/org/apache/asterix/runtime/evaluators/constructors/AInt16CastNullConstructorDescriptor.java
@@ -0,0 +1,65 @@
+/*
+ * 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 org.apache.asterix.common.annotations.MissingNullInOutFunction;
+import org.apache.asterix.om.functions.BuiltinFunctions;
+import org.apache.asterix.om.functions.IFunctionDescriptorFactory;
+import org.apache.asterix.runtime.evaluators.base.AbstractScalarFunctionDynamicDescriptor;
+import org.apache.asterix.runtime.evaluators.functions.PointableHelper;
+import org.apache.hyracks.algebricks.core.algebra.functions.FunctionIdentifier;
+import org.apache.hyracks.algebricks.runtime.base.IEvaluatorContext;
+import org.apache.hyracks.algebricks.runtime.base.IScalarEvaluator;
+import org.apache.hyracks.algebricks.runtime.base.IScalarEvaluatorFactory;
+import org.apache.hyracks.api.exceptions.HyracksDataException;
+import org.apache.hyracks.data.std.api.IPointable;
+
+@MissingNullInOutFunction
+public class AInt16CastNullConstructorDescriptor extends AbstractScalarFunctionDynamicDescriptor {
+    private static final long serialVersionUID = 1L;
+    public static final IFunctionDescriptorFactory FACTORY = AInt16CastNullConstructorDescriptor::new;
+
+    @Override
+    public IScalarEvaluatorFactory createEvaluatorFactory(final IScalarEvaluatorFactory[] args) {
+        return new IScalarEvaluatorFactory() {
+            private static final long serialVersionUID = 1L;
+
+            @Override
+            public IScalarEvaluator createScalarEvaluator(IEvaluatorContext ctx) throws HyracksDataException {
+                return new AbstractInt16ConstructorEvaluator(ctx, args[0].createScalarEvaluator(ctx), sourceLoc) {
+
+                    @Override
+                    protected FunctionIdentifier getIdentifier() {
+                        return AInt16CastNullConstructorDescriptor.this.getIdentifier();
+                    }
+
+                    @Override
+                    protected boolean checkAndSetMissingOrNull(IPointable result) throws HyracksDataException {
+                        return PointableHelper.checkAndSetNull(result, inputArg);
+                    }
+                };
+            }
+        };
+    }
+
+    @Override
+    public FunctionIdentifier getIdentifier() {
+        return BuiltinFunctions.INT16_CAST_NULL_CONSTRUCTOR;
+    }
+}
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 f8f1537..87f377e 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
@@ -18,29 +18,15 @@
  */
 package org.apache.asterix.runtime.evaluators.constructors;
 
-import java.io.IOException;
-
 import org.apache.asterix.common.annotations.MissingNullInOutFunction;
-import org.apache.asterix.dataflow.data.nontagged.serde.ABooleanSerializerDeserializer;
-import org.apache.asterix.formats.nontagged.SerializerDeserializerProvider;
-import org.apache.asterix.om.base.AInt16;
-import org.apache.asterix.om.base.AMutableInt16;
 import org.apache.asterix.om.functions.BuiltinFunctions;
 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.om.types.EnumDeserializer;
-import org.apache.asterix.om.types.hierachy.ATypeHierarchy;
 import org.apache.asterix.runtime.evaluators.base.AbstractScalarFunctionDynamicDescriptor;
-import org.apache.asterix.runtime.evaluators.common.NumberUtils;
 import org.apache.hyracks.algebricks.core.algebra.functions.FunctionIdentifier;
 import org.apache.hyracks.algebricks.runtime.base.IEvaluatorContext;
 import org.apache.hyracks.algebricks.runtime.base.IScalarEvaluator;
 import org.apache.hyracks.algebricks.runtime.base.IScalarEvaluatorFactory;
-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.UTF8StringPointable;
 
 @MissingNullInOutFunction
 public class AInt16ConstructorDescriptor extends AbstractScalarFunctionDynamicDescriptor {
@@ -55,74 +41,7 @@
 
             @Override
             public IScalarEvaluator createScalarEvaluator(IEvaluatorContext ctx) throws HyracksDataException {
-                return new AbstractConstructorEvaluator(ctx, args[0].createScalarEvaluator(ctx), sourceLoc) {
-
-                    private final AMutableInt16 aInt16 = new AMutableInt16((short) 0);
-                    @SuppressWarnings("unchecked")
-                    private final ISerializerDeserializer<AInt16> int16Serde =
-                            SerializerDeserializerProvider.INSTANCE.getSerializerDeserializer(BuiltinType.AINT16);
-                    private final UTF8StringPointable utf8Ptr = new UTF8StringPointable();
-
-                    @Override
-                    protected void evaluateImpl(IPointable result) throws HyracksDataException {
-                        byte[] bytes = inputArg.getByteArray();
-                        int startOffset = inputArg.getStartOffset();
-                        int len = inputArg.getLength();
-                        ATypeTag inputType = EnumDeserializer.ATYPETAGDESERIALIZER.deserialize(bytes[startOffset]);
-                        switch (inputType) {
-                            case SMALLINT:
-                                result.set(inputArg);
-                                break;
-                            case TINYINT:
-                                resultStorage.reset();
-                                try {
-                                    ATypeHierarchy.getTypePromoteComputer(inputType, ATypeTag.SMALLINT)
-                                            .convertType(bytes, startOffset + 1, len - 1, out);
-                                } catch (IOException e) {
-                                    throw HyracksDataException.create(e);
-                                }
-                                result.set(resultStorage);
-                                break;
-                            case INTEGER:
-                            case BIGINT:
-                            case FLOAT:
-                            case DOUBLE:
-                                resultStorage.reset();
-                                try {
-                                    ATypeHierarchy.getTypeDemoteComputer(inputType, ATypeTag.SMALLINT, false)
-                                            .convertType(bytes, startOffset + 1, len - 1, out);
-                                } catch (IOException e) {
-                                    throw HyracksDataException.create(e);
-                                }
-                                result.set(resultStorage);
-                                break;
-                            case BOOLEAN:
-                                boolean b = ABooleanSerializerDeserializer.getBoolean(bytes, startOffset + 1);
-                                aInt16.setValue((short) (b ? 1 : 0));
-                                resultStorage.reset();
-                                int16Serde.serialize(aInt16, out);
-                                result.set(resultStorage);
-                                break;
-                            case STRING:
-                                utf8Ptr.set(bytes, startOffset + 1, len - 1);
-                                if (NumberUtils.parseInt16(utf8Ptr, aInt16)) {
-                                    resultStorage.reset();
-                                    int16Serde.serialize(aInt16, out);
-                                    result.set(resultStorage);
-                                } else {
-                                    handleParseError(utf8Ptr, result);
-                                }
-                                break;
-                            default:
-                                handleUnsupportedType(inputType, result);
-                                break;
-                        }
-                    }
-
-                    @Override
-                    protected BuiltinType getTargetType() {
-                        return BuiltinType.AINT16;
-                    }
+                return new AbstractInt16ConstructorEvaluator(ctx, args[0].createScalarEvaluator(ctx), sourceLoc) {
 
                     @Override
                     protected FunctionIdentifier getIdentifier() {
diff --git a/asterixdb/asterix-runtime/src/main/java/org/apache/asterix/runtime/evaluators/constructors/AInt32CastNullConstructorDescriptor.java b/asterixdb/asterix-runtime/src/main/java/org/apache/asterix/runtime/evaluators/constructors/AInt32CastNullConstructorDescriptor.java
new file mode 100644
index 0000000..059a2b5
--- /dev/null
+++ b/asterixdb/asterix-runtime/src/main/java/org/apache/asterix/runtime/evaluators/constructors/AInt32CastNullConstructorDescriptor.java
@@ -0,0 +1,65 @@
+/*
+ * 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 org.apache.asterix.common.annotations.MissingNullInOutFunction;
+import org.apache.asterix.om.functions.BuiltinFunctions;
+import org.apache.asterix.om.functions.IFunctionDescriptorFactory;
+import org.apache.asterix.runtime.evaluators.base.AbstractScalarFunctionDynamicDescriptor;
+import org.apache.asterix.runtime.evaluators.functions.PointableHelper;
+import org.apache.hyracks.algebricks.core.algebra.functions.FunctionIdentifier;
+import org.apache.hyracks.algebricks.runtime.base.IEvaluatorContext;
+import org.apache.hyracks.algebricks.runtime.base.IScalarEvaluator;
+import org.apache.hyracks.algebricks.runtime.base.IScalarEvaluatorFactory;
+import org.apache.hyracks.api.exceptions.HyracksDataException;
+import org.apache.hyracks.data.std.api.IPointable;
+
+@MissingNullInOutFunction
+public class AInt32CastNullConstructorDescriptor extends AbstractScalarFunctionDynamicDescriptor {
+    private static final long serialVersionUID = 1L;
+    public static final IFunctionDescriptorFactory FACTORY = AInt32CastNullConstructorDescriptor::new;
+
+    @Override
+    public IScalarEvaluatorFactory createEvaluatorFactory(final IScalarEvaluatorFactory[] args) {
+        return new IScalarEvaluatorFactory() {
+            private static final long serialVersionUID = 1L;
+
+            @Override
+            public IScalarEvaluator createScalarEvaluator(IEvaluatorContext ctx) throws HyracksDataException {
+                return new AbstractInt32ConstructorEvaluator(ctx, args[0].createScalarEvaluator(ctx), sourceLoc) {
+
+                    @Override
+                    protected FunctionIdentifier getIdentifier() {
+                        return AInt32CastNullConstructorDescriptor.this.getIdentifier();
+                    }
+
+                    @Override
+                    protected boolean checkAndSetMissingOrNull(IPointable result) throws HyracksDataException {
+                        return PointableHelper.checkAndSetNull(result, inputArg);
+                    }
+                };
+            }
+        };
+    }
+
+    @Override
+    public FunctionIdentifier getIdentifier() {
+        return BuiltinFunctions.INT32_CAST_NULL_CONSTRUCTOR;
+    }
+}
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 da1d3ba..d9c13ab 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
@@ -18,29 +18,15 @@
  */
 package org.apache.asterix.runtime.evaluators.constructors;
 
-import java.io.IOException;
-
 import org.apache.asterix.common.annotations.MissingNullInOutFunction;
-import org.apache.asterix.dataflow.data.nontagged.serde.ABooleanSerializerDeserializer;
-import org.apache.asterix.formats.nontagged.SerializerDeserializerProvider;
-import org.apache.asterix.om.base.AInt32;
-import org.apache.asterix.om.base.AMutableInt32;
 import org.apache.asterix.om.functions.BuiltinFunctions;
 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.om.types.EnumDeserializer;
-import org.apache.asterix.om.types.hierachy.ATypeHierarchy;
 import org.apache.asterix.runtime.evaluators.base.AbstractScalarFunctionDynamicDescriptor;
-import org.apache.asterix.runtime.evaluators.common.NumberUtils;
 import org.apache.hyracks.algebricks.core.algebra.functions.FunctionIdentifier;
 import org.apache.hyracks.algebricks.runtime.base.IEvaluatorContext;
 import org.apache.hyracks.algebricks.runtime.base.IScalarEvaluator;
 import org.apache.hyracks.algebricks.runtime.base.IScalarEvaluatorFactory;
-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.UTF8StringPointable;
 
 @MissingNullInOutFunction
 public class AInt32ConstructorDescriptor extends AbstractScalarFunctionDynamicDescriptor {
@@ -54,74 +40,7 @@
 
             @Override
             public IScalarEvaluator createScalarEvaluator(IEvaluatorContext ctx) throws HyracksDataException {
-                return new AbstractConstructorEvaluator(ctx, args[0].createScalarEvaluator(ctx), sourceLoc) {
-
-                    private final AMutableInt32 aInt32 = new AMutableInt32(0);
-                    @SuppressWarnings("unchecked")
-                    private final ISerializerDeserializer<AInt32> int32Serde =
-                            SerializerDeserializerProvider.INSTANCE.getSerializerDeserializer(BuiltinType.AINT32);
-                    private final UTF8StringPointable utf8Ptr = new UTF8StringPointable();
-
-                    @Override
-                    protected void evaluateImpl(IPointable result) throws HyracksDataException {
-                        byte[] bytes = inputArg.getByteArray();
-                        int startOffset = inputArg.getStartOffset();
-                        int len = inputArg.getLength();
-                        ATypeTag inputType = EnumDeserializer.ATYPETAGDESERIALIZER.deserialize(bytes[startOffset]);
-                        switch (inputType) {
-                            case INTEGER:
-                                result.set(inputArg);
-                                break;
-                            case TINYINT:
-                            case SMALLINT:
-                                resultStorage.reset();
-                                try {
-                                    ATypeHierarchy.getTypePromoteComputer(inputType, ATypeTag.INTEGER)
-                                            .convertType(bytes, startOffset + 1, len - 1, out);
-                                } catch (IOException e) {
-                                    throw HyracksDataException.create(e);
-                                }
-                                result.set(resultStorage);
-                                break;
-                            case BIGINT:
-                            case FLOAT:
-                            case DOUBLE:
-                                resultStorage.reset();
-                                try {
-                                    ATypeHierarchy.getTypeDemoteComputer(inputType, ATypeTag.INTEGER, false)
-                                            .convertType(bytes, startOffset + 1, len - 1, out);
-                                } catch (IOException e) {
-                                    throw HyracksDataException.create(e);
-                                }
-                                result.set(resultStorage);
-                                break;
-                            case BOOLEAN:
-                                boolean b = ABooleanSerializerDeserializer.getBoolean(bytes, startOffset + 1);
-                                aInt32.setValue(b ? 1 : 0);
-                                resultStorage.reset();
-                                int32Serde.serialize(aInt32, out);
-                                result.set(resultStorage);
-                                break;
-                            case STRING:
-                                utf8Ptr.set(bytes, startOffset + 1, len - 1);
-                                if (NumberUtils.parseInt32(utf8Ptr, aInt32)) {
-                                    resultStorage.reset();
-                                    int32Serde.serialize(aInt32, out);
-                                    result.set(resultStorage);
-                                } else {
-                                    handleParseError(utf8Ptr, result);
-                                }
-                                break;
-                            default:
-                                handleUnsupportedType(inputType, result);
-                                break;
-                        }
-                    }
-
-                    @Override
-                    protected BuiltinType getTargetType() {
-                        return BuiltinType.AINT32;
-                    }
+                return new AbstractInt32ConstructorEvaluator(ctx, args[0].createScalarEvaluator(ctx), sourceLoc) {
 
                     @Override
                     protected FunctionIdentifier getIdentifier() {
diff --git a/asterixdb/asterix-runtime/src/main/java/org/apache/asterix/runtime/evaluators/constructors/AInt64CastNullConstructorDescriptor.java b/asterixdb/asterix-runtime/src/main/java/org/apache/asterix/runtime/evaluators/constructors/AInt64CastNullConstructorDescriptor.java
new file mode 100644
index 0000000..4beafca
--- /dev/null
+++ b/asterixdb/asterix-runtime/src/main/java/org/apache/asterix/runtime/evaluators/constructors/AInt64CastNullConstructorDescriptor.java
@@ -0,0 +1,64 @@
+/*
+ * 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 org.apache.asterix.common.annotations.MissingNullInOutFunction;
+import org.apache.asterix.om.functions.BuiltinFunctions;
+import org.apache.asterix.om.functions.IFunctionDescriptorFactory;
+import org.apache.asterix.runtime.evaluators.base.AbstractScalarFunctionDynamicDescriptor;
+import org.apache.asterix.runtime.evaluators.functions.PointableHelper;
+import org.apache.hyracks.algebricks.core.algebra.functions.FunctionIdentifier;
+import org.apache.hyracks.algebricks.runtime.base.IEvaluatorContext;
+import org.apache.hyracks.algebricks.runtime.base.IScalarEvaluator;
+import org.apache.hyracks.algebricks.runtime.base.IScalarEvaluatorFactory;
+import org.apache.hyracks.api.exceptions.HyracksDataException;
+import org.apache.hyracks.data.std.api.IPointable;
+
+@MissingNullInOutFunction
+public class AInt64CastNullConstructorDescriptor extends AbstractScalarFunctionDynamicDescriptor {
+    private static final long serialVersionUID = 1L;
+    public static final IFunctionDescriptorFactory FACTORY = AInt64CastNullConstructorDescriptor::new;
+
+    @Override
+    public IScalarEvaluatorFactory createEvaluatorFactory(final IScalarEvaluatorFactory[] args) {
+        return new IScalarEvaluatorFactory() {
+            private static final long serialVersionUID = 1L;
+
+            @Override
+            public IScalarEvaluator createScalarEvaluator(IEvaluatorContext ctx) throws HyracksDataException {
+                return new AbstractInt64ConstructorEvaluator(ctx, args[0].createScalarEvaluator(ctx), sourceLoc) {
+                    @Override
+                    public FunctionIdentifier getIdentifier() {
+                        return AInt64CastNullConstructorDescriptor.this.getIdentifier();
+                    }
+
+                    @Override
+                    protected boolean checkAndSetMissingOrNull(IPointable result) throws HyracksDataException {
+                        return PointableHelper.checkAndSetNull(result, inputArg);
+                    }
+                };
+            }
+        };
+    }
+
+    @Override
+    public FunctionIdentifier getIdentifier() {
+        return BuiltinFunctions.INT64_CAST_NULL_CONSTRUCTOR;
+    }
+}
diff --git a/asterixdb/asterix-runtime/src/main/java/org/apache/asterix/runtime/evaluators/constructors/AInt8CastNullConstructorDescriptor.java b/asterixdb/asterix-runtime/src/main/java/org/apache/asterix/runtime/evaluators/constructors/AInt8CastNullConstructorDescriptor.java
new file mode 100644
index 0000000..0538d1d
--- /dev/null
+++ b/asterixdb/asterix-runtime/src/main/java/org/apache/asterix/runtime/evaluators/constructors/AInt8CastNullConstructorDescriptor.java
@@ -0,0 +1,65 @@
+/*
+ * 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 org.apache.asterix.common.annotations.MissingNullInOutFunction;
+import org.apache.asterix.om.functions.BuiltinFunctions;
+import org.apache.asterix.om.functions.IFunctionDescriptorFactory;
+import org.apache.asterix.runtime.evaluators.base.AbstractScalarFunctionDynamicDescriptor;
+import org.apache.asterix.runtime.evaluators.functions.PointableHelper;
+import org.apache.hyracks.algebricks.core.algebra.functions.FunctionIdentifier;
+import org.apache.hyracks.algebricks.runtime.base.IEvaluatorContext;
+import org.apache.hyracks.algebricks.runtime.base.IScalarEvaluator;
+import org.apache.hyracks.algebricks.runtime.base.IScalarEvaluatorFactory;
+import org.apache.hyracks.api.exceptions.HyracksDataException;
+import org.apache.hyracks.data.std.api.IPointable;
+
+@MissingNullInOutFunction
+public class AInt8CastNullConstructorDescriptor extends AbstractScalarFunctionDynamicDescriptor {
+    private static final long serialVersionUID = 1L;
+    public static final IFunctionDescriptorFactory FACTORY = AInt8CastNullConstructorDescriptor::new;
+
+    @Override
+    public IScalarEvaluatorFactory createEvaluatorFactory(final IScalarEvaluatorFactory[] args) {
+        return new IScalarEvaluatorFactory() {
+            private static final long serialVersionUID = 1L;
+
+            @Override
+            public IScalarEvaluator createScalarEvaluator(IEvaluatorContext ctx) throws HyracksDataException {
+                return new AbstractInt8ConstructorEvaluator(ctx, args[0].createScalarEvaluator(ctx), sourceLoc) {
+
+                    @Override
+                    protected FunctionIdentifier getIdentifier() {
+                        return AInt8CastNullConstructorDescriptor.this.getIdentifier();
+                    }
+
+                    @Override
+                    protected boolean checkAndSetMissingOrNull(IPointable result) throws HyracksDataException {
+                        return PointableHelper.checkAndSetNull(result, inputArg);
+                    }
+                };
+            }
+        };
+    }
+
+    @Override
+    public FunctionIdentifier getIdentifier() {
+        return BuiltinFunctions.INT8_CAST_NULL_CONSTRUCTOR;
+    }
+}
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 2305eef..425623a 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
@@ -18,29 +18,15 @@
  */
 package org.apache.asterix.runtime.evaluators.constructors;
 
-import java.io.IOException;
-
 import org.apache.asterix.common.annotations.MissingNullInOutFunction;
-import org.apache.asterix.dataflow.data.nontagged.serde.ABooleanSerializerDeserializer;
-import org.apache.asterix.formats.nontagged.SerializerDeserializerProvider;
-import org.apache.asterix.om.base.AInt8;
-import org.apache.asterix.om.base.AMutableInt8;
 import org.apache.asterix.om.functions.BuiltinFunctions;
 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.om.types.EnumDeserializer;
-import org.apache.asterix.om.types.hierachy.ATypeHierarchy;
 import org.apache.asterix.runtime.evaluators.base.AbstractScalarFunctionDynamicDescriptor;
-import org.apache.asterix.runtime.evaluators.common.NumberUtils;
 import org.apache.hyracks.algebricks.core.algebra.functions.FunctionIdentifier;
 import org.apache.hyracks.algebricks.runtime.base.IEvaluatorContext;
 import org.apache.hyracks.algebricks.runtime.base.IScalarEvaluator;
 import org.apache.hyracks.algebricks.runtime.base.IScalarEvaluatorFactory;
-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.UTF8StringPointable;
 
 @MissingNullInOutFunction
 public class AInt8ConstructorDescriptor extends AbstractScalarFunctionDynamicDescriptor {
@@ -54,65 +40,7 @@
 
             @Override
             public IScalarEvaluator createScalarEvaluator(IEvaluatorContext ctx) throws HyracksDataException {
-                return new AbstractConstructorEvaluator(ctx, args[0].createScalarEvaluator(ctx), sourceLoc) {
-
-                    private final AMutableInt8 aInt8 = new AMutableInt8((byte) 0);
-                    @SuppressWarnings("unchecked")
-                    private final ISerializerDeserializer<AInt8> int8Serde =
-                            SerializerDeserializerProvider.INSTANCE.getSerializerDeserializer(BuiltinType.AINT8);
-                    private final UTF8StringPointable utf8Ptr = new UTF8StringPointable();
-
-                    @Override
-                    protected void evaluateImpl(IPointable result) throws HyracksDataException {
-                        byte[] bytes = inputArg.getByteArray();
-                        int startOffset = inputArg.getStartOffset();
-                        int len = inputArg.getLength();
-                        ATypeTag inputType = EnumDeserializer.ATYPETAGDESERIALIZER.deserialize(bytes[startOffset]);
-                        switch (inputType) {
-                            case TINYINT:
-                                result.set(inputArg);
-                                break;
-                            case SMALLINT:
-                            case INTEGER:
-                            case BIGINT:
-                            case FLOAT:
-                            case DOUBLE:
-                                resultStorage.reset();
-                                try {
-                                    ATypeHierarchy.getTypeDemoteComputer(inputType, ATypeTag.TINYINT, false)
-                                            .convertType(bytes, startOffset + 1, len - 1, out);
-                                } catch (IOException e) {
-                                    throw HyracksDataException.create(e);
-                                }
-                                result.set(resultStorage);
-                                break;
-                            case BOOLEAN:
-                                boolean b = ABooleanSerializerDeserializer.getBoolean(bytes, startOffset + 1);
-                                aInt8.setValue((byte) (b ? 1 : 0));
-                                resultStorage.reset();
-                                int8Serde.serialize(aInt8, out);
-                                result.set(resultStorage);
-                                break;
-                            case STRING:
-                                utf8Ptr.set(bytes, startOffset + 1, len - 1);
-                                if (NumberUtils.parseInt8(utf8Ptr, aInt8)) {
-                                    resultStorage.reset();
-                                    int8Serde.serialize(aInt8, out);
-                                    result.set(resultStorage);
-                                } else {
-                                    handleParseError(utf8Ptr, result);
-                                }
-                                break;
-                            default:
-                                handleUnsupportedType(inputType, result);
-                                break;
-                        }
-                    }
-
-                    @Override
-                    protected BuiltinType getTargetType() {
-                        return BuiltinType.AINT8;
-                    }
+                return new AbstractInt8ConstructorEvaluator(ctx, args[0].createScalarEvaluator(ctx), sourceLoc) {
 
                     @Override
                     protected FunctionIdentifier getIdentifier() {
diff --git a/asterixdb/asterix-runtime/src/main/java/org/apache/asterix/runtime/evaluators/constructors/AStringCastNullConstructorDescriptor.java b/asterixdb/asterix-runtime/src/main/java/org/apache/asterix/runtime/evaluators/constructors/AStringCastNullConstructorDescriptor.java
new file mode 100644
index 0000000..45597fe
--- /dev/null
+++ b/asterixdb/asterix-runtime/src/main/java/org/apache/asterix/runtime/evaluators/constructors/AStringCastNullConstructorDescriptor.java
@@ -0,0 +1,65 @@
+/*
+ * 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 org.apache.asterix.common.annotations.MissingNullInOutFunction;
+import org.apache.asterix.om.functions.BuiltinFunctions;
+import org.apache.asterix.om.functions.IFunctionDescriptorFactory;
+import org.apache.asterix.runtime.evaluators.base.AbstractScalarFunctionDynamicDescriptor;
+import org.apache.asterix.runtime.evaluators.functions.PointableHelper;
+import org.apache.hyracks.algebricks.core.algebra.functions.FunctionIdentifier;
+import org.apache.hyracks.algebricks.runtime.base.IEvaluatorContext;
+import org.apache.hyracks.algebricks.runtime.base.IScalarEvaluator;
+import org.apache.hyracks.algebricks.runtime.base.IScalarEvaluatorFactory;
+import org.apache.hyracks.api.exceptions.HyracksDataException;
+import org.apache.hyracks.data.std.api.IPointable;
+
+@MissingNullInOutFunction
+public class AStringCastNullConstructorDescriptor extends AbstractScalarFunctionDynamicDescriptor {
+
+    private static final long serialVersionUID = 1L;
+    public static final IFunctionDescriptorFactory FACTORY = AStringCastNullConstructorDescriptor::new;
+
+    @Override
+    public IScalarEvaluatorFactory createEvaluatorFactory(final IScalarEvaluatorFactory[] args) {
+        return new IScalarEvaluatorFactory() {
+            private static final long serialVersionUID = 1L;
+
+            @Override
+            public IScalarEvaluator createScalarEvaluator(IEvaluatorContext ctx) throws HyracksDataException {
+                return new AbstractStringConstructorEvaluator(ctx, args[0].createScalarEvaluator(ctx), sourceLoc) {
+                    @Override
+                    protected FunctionIdentifier getIdentifier() {
+                        return AStringCastNullConstructorDescriptor.this.getIdentifier();
+                    }
+
+                    @Override
+                    protected boolean checkAndSetMissingOrNull(IPointable result) throws HyracksDataException {
+                        return PointableHelper.checkAndSetNull(result, inputArg);
+                    }
+                };
+            }
+        };
+    }
+
+    @Override
+    public FunctionIdentifier getIdentifier() {
+        return BuiltinFunctions.STRING_CAST_NULL_CONSTRUCTOR;
+    }
+}
diff --git a/asterixdb/asterix-runtime/src/main/java/org/apache/asterix/runtime/evaluators/constructors/ATimeCastNullConstructorDescriptor.java b/asterixdb/asterix-runtime/src/main/java/org/apache/asterix/runtime/evaluators/constructors/ATimeCastNullConstructorDescriptor.java
new file mode 100644
index 0000000..0f6cae1
--- /dev/null
+++ b/asterixdb/asterix-runtime/src/main/java/org/apache/asterix/runtime/evaluators/constructors/ATimeCastNullConstructorDescriptor.java
@@ -0,0 +1,65 @@
+/*
+ * 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 org.apache.asterix.common.annotations.MissingNullInOutFunction;
+import org.apache.asterix.om.functions.BuiltinFunctions;
+import org.apache.asterix.om.functions.IFunctionDescriptorFactory;
+import org.apache.asterix.runtime.evaluators.base.AbstractScalarFunctionDynamicDescriptor;
+import org.apache.asterix.runtime.evaluators.functions.PointableHelper;
+import org.apache.hyracks.algebricks.core.algebra.functions.FunctionIdentifier;
+import org.apache.hyracks.algebricks.runtime.base.IEvaluatorContext;
+import org.apache.hyracks.algebricks.runtime.base.IScalarEvaluator;
+import org.apache.hyracks.algebricks.runtime.base.IScalarEvaluatorFactory;
+import org.apache.hyracks.api.exceptions.HyracksDataException;
+import org.apache.hyracks.data.std.api.IPointable;
+
+@MissingNullInOutFunction
+public class ATimeCastNullConstructorDescriptor extends AbstractScalarFunctionDynamicDescriptor {
+    private static final long serialVersionUID = 1L;
+    public static final IFunctionDescriptorFactory FACTORY = ATimeCastNullConstructorDescriptor::new;
+
+    @Override
+    public IScalarEvaluatorFactory createEvaluatorFactory(final IScalarEvaluatorFactory[] args) {
+        return new IScalarEvaluatorFactory() {
+            private static final long serialVersionUID = 1L;
+
+            @Override
+            public IScalarEvaluator createScalarEvaluator(IEvaluatorContext ctx) throws HyracksDataException {
+                return new AbstractTimeConstructorEvaluator(ctx, args[0].createScalarEvaluator(ctx), sourceLoc) {
+
+                    @Override
+                    protected FunctionIdentifier getIdentifier() {
+                        return ATimeCastNullConstructorDescriptor.this.getIdentifier();
+                    }
+
+                    @Override
+                    protected boolean checkAndSetMissingOrNull(IPointable result) throws HyracksDataException {
+                        return PointableHelper.checkAndSetNull(result, inputArg);
+                    }
+                };
+            }
+        };
+    }
+
+    @Override
+    public FunctionIdentifier getIdentifier() {
+        return BuiltinFunctions.TIME_CAST_NULL_CONSTRUCTOR;
+    }
+}
diff --git a/asterixdb/asterix-runtime/src/main/java/org/apache/asterix/runtime/evaluators/constructors/ATimeCastNullConstructorWithFormatDescriptor.java b/asterixdb/asterix-runtime/src/main/java/org/apache/asterix/runtime/evaluators/constructors/ATimeCastNullConstructorWithFormatDescriptor.java
new file mode 100644
index 0000000..5afba07
--- /dev/null
+++ b/asterixdb/asterix-runtime/src/main/java/org/apache/asterix/runtime/evaluators/constructors/ATimeCastNullConstructorWithFormatDescriptor.java
@@ -0,0 +1,67 @@
+/*
+ * 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 org.apache.asterix.om.functions.BuiltinFunctions;
+import org.apache.asterix.om.functions.IFunctionDescriptorFactory;
+import org.apache.asterix.runtime.evaluators.base.AbstractScalarFunctionDynamicDescriptor;
+import org.apache.asterix.runtime.evaluators.functions.PointableHelper;
+import org.apache.hyracks.algebricks.core.algebra.functions.FunctionIdentifier;
+import org.apache.hyracks.algebricks.runtime.base.IEvaluatorContext;
+import org.apache.hyracks.algebricks.runtime.base.IScalarEvaluator;
+import org.apache.hyracks.algebricks.runtime.base.IScalarEvaluatorFactory;
+import org.apache.hyracks.api.exceptions.HyracksDataException;
+import org.apache.hyracks.data.std.api.IPointable;
+
+public class ATimeCastNullConstructorWithFormatDescriptor extends AbstractScalarFunctionDynamicDescriptor {
+    private static final long serialVersionUID = 1L;
+    public static final IFunctionDescriptorFactory FACTORY = ATimeCastNullConstructorWithFormatDescriptor::new;
+
+    @Override
+    public IScalarEvaluatorFactory createEvaluatorFactory(final IScalarEvaluatorFactory[] args) {
+        return new IScalarEvaluatorFactory() {
+            private static final long serialVersionUID = 1L;
+
+            @Override
+            public IScalarEvaluator createScalarEvaluator(IEvaluatorContext ctx) throws HyracksDataException {
+                return new AbstractTimeWithFormatConstructorEvaluator(ctx, args, sourceLoc) {
+
+                    @Override
+                    protected FunctionIdentifier getIdentifier() {
+                        return ATimeCastNullConstructorWithFormatDescriptor.this.getIdentifier();
+                    }
+
+                    @Override
+                    protected boolean checkAndSetMissingOrNull(IPointable result) throws HyracksDataException {
+                        if (PointableHelper.checkAndSetNull(result, inputArg)) {
+                            return true;
+                        }
+                        return super.checkAndSetMissingOrNull(result);
+                    }
+                };
+            }
+        };
+    }
+
+    @Override
+    public FunctionIdentifier getIdentifier() {
+        return BuiltinFunctions.TIME_CAST_NULL_CONSTRUCTOR_WITH_FORMAT;
+    }
+}
diff --git a/asterixdb/asterix-runtime/src/main/java/org/apache/asterix/runtime/evaluators/constructors/ATimeConstructorWithFormatDescriptor.java b/asterixdb/asterix-runtime/src/main/java/org/apache/asterix/runtime/evaluators/constructors/ATimeConstructorWithFormatDescriptor.java
index e2df1be..72141d6 100644
--- a/asterixdb/asterix-runtime/src/main/java/org/apache/asterix/runtime/evaluators/constructors/ATimeConstructorWithFormatDescriptor.java
+++ b/asterixdb/asterix-runtime/src/main/java/org/apache/asterix/runtime/evaluators/constructors/ATimeConstructorWithFormatDescriptor.java
@@ -19,14 +19,8 @@
 
 package org.apache.asterix.runtime.evaluators.constructors;
 
-import org.apache.asterix.om.base.AMutableInt64;
-import org.apache.asterix.om.base.AMutableTime;
-import org.apache.asterix.om.base.temporal.AsterixTemporalTypeParseException;
-import org.apache.asterix.om.base.temporal.DateTimeFormatUtils;
 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.runtime.evaluators.base.AbstractScalarFunctionDynamicDescriptor;
 import org.apache.asterix.runtime.evaluators.functions.PointableHelper;
 import org.apache.hyracks.algebricks.core.algebra.functions.FunctionIdentifier;
@@ -35,18 +29,10 @@
 import org.apache.hyracks.algebricks.runtime.base.IScalarEvaluatorFactory;
 import org.apache.hyracks.api.exceptions.HyracksDataException;
 import org.apache.hyracks.data.std.api.IPointable;
-import org.apache.hyracks.data.std.primitive.UTF8StringPointable;
-import org.apache.hyracks.data.std.primitive.VoidPointable;
-import org.apache.hyracks.dataflow.common.data.accessors.IFrameTupleReference;
 
 public class ATimeConstructorWithFormatDescriptor extends AbstractScalarFunctionDynamicDescriptor {
     private static final long serialVersionUID = 1L;
-    public static final IFunctionDescriptorFactory FACTORY = new IFunctionDescriptorFactory() {
-        @Override
-        public IFunctionDescriptor createFunctionDescriptor() {
-            return new ATimeConstructorWithFormatDescriptor();
-        }
-    };
+    public static final IFunctionDescriptorFactory FACTORY = ATimeConstructorWithFormatDescriptor::new;
 
     @Override
     public IScalarEvaluatorFactory createEvaluatorFactory(final IScalarEvaluatorFactory[] args) {
@@ -55,48 +41,7 @@
 
             @Override
             public IScalarEvaluator createScalarEvaluator(IEvaluatorContext ctx) throws HyracksDataException {
-                return new AbstractTimeConstructorEvaluator(ctx, args[0].createScalarEvaluator(ctx), sourceLoc) {
-
-                    private final IScalarEvaluator formatEval = args[1].createScalarEvaluator(ctx);
-                    private final IPointable formatArg = new VoidPointable();
-                    private final UTF8StringPointable formatTextPtr = new UTF8StringPointable();
-                    private final AMutableInt64 aInt64 = new AMutableInt64(0);
-
-                    @Override
-                    protected void evaluateInput(IFrameTupleReference tuple) throws HyracksDataException {
-                        super.evaluateInput(tuple);
-                        formatEval.evaluate(tuple, formatArg);
-                    }
-
-                    @Override
-                    protected boolean checkAndSetMissingOrNull(IPointable result) throws HyracksDataException {
-                        return PointableHelper.checkAndSetMissingOrNull(result, inputArg, formatArg);
-                    }
-
-                    @Override
-                    protected boolean parseTime(UTF8StringPointable textPtr, AMutableTime result) {
-                        byte[] formatBytes = formatArg.getByteArray();
-                        int formatStartOffset = formatArg.getStartOffset();
-                        int formatLength = formatArg.getLength();
-                        if (formatBytes[formatStartOffset] != ATypeTag.SERIALIZED_STRING_TYPE_TAG) {
-                            return false;
-                        }
-                        formatTextPtr.set(formatBytes, formatStartOffset + 1, formatLength - 1);
-                        try {
-                            if (DateTimeFormatUtils.getInstance().parseDateTime(aInt64, textPtr.getByteArray(),
-                                    textPtr.getCharStartOffset(), textPtr.getUTF8Length(), formatBytes,
-                                    formatTextPtr.getCharStartOffset(), formatTextPtr.getUTF8Length(),
-                                    DateTimeFormatUtils.DateTimeParseMode.TIME_ONLY, false)) {
-                                result.setValue((int) aInt64.getLongValue());
-                                return true;
-                            } else {
-                                return false;
-                            }
-                        } catch (AsterixTemporalTypeParseException e) {
-                            // shouldn't happen
-                            return false;
-                        }
-                    }
+                return new AbstractTimeWithFormatConstructorEvaluator(ctx, args, sourceLoc) {
 
                     @Override
                     protected FunctionIdentifier getIdentifier() {
diff --git a/asterixdb/asterix-runtime/src/main/java/org/apache/asterix/runtime/evaluators/constructors/AUUIDFromStringCastNullConstructorDescriptor.java b/asterixdb/asterix-runtime/src/main/java/org/apache/asterix/runtime/evaluators/constructors/AUUIDFromStringCastNullConstructorDescriptor.java
new file mode 100644
index 0000000..2c1fb39
--- /dev/null
+++ b/asterixdb/asterix-runtime/src/main/java/org/apache/asterix/runtime/evaluators/constructors/AUUIDFromStringCastNullConstructorDescriptor.java
@@ -0,0 +1,71 @@
+/*
+ * 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 org.apache.asterix.common.annotations.MissingNullInOutFunction;
+import org.apache.asterix.om.functions.BuiltinFunctions;
+import org.apache.asterix.om.functions.IFunctionDescriptorFactory;
+import org.apache.asterix.runtime.evaluators.base.AbstractScalarFunctionDynamicDescriptor;
+import org.apache.asterix.runtime.evaluators.functions.PointableHelper;
+import org.apache.hyracks.algebricks.core.algebra.functions.FunctionIdentifier;
+import org.apache.hyracks.algebricks.runtime.base.IEvaluatorContext;
+import org.apache.hyracks.algebricks.runtime.base.IScalarEvaluator;
+import org.apache.hyracks.algebricks.runtime.base.IScalarEvaluatorFactory;
+import org.apache.hyracks.api.exceptions.HyracksDataException;
+import org.apache.hyracks.data.std.api.IPointable;
+
+/**
+ * Receives a canonical representation of UUID and construct a UUID value.
+ * a UUID is represented by 32 lowercase hexadecimal digits (8-4-4-4-12). (E.g.
+ * uuid("02a199ca-bf58-412e-bd9f-60a0c975a8ac"))
+ */
+
+@MissingNullInOutFunction
+public class AUUIDFromStringCastNullConstructorDescriptor extends AbstractScalarFunctionDynamicDescriptor {
+    private static final long serialVersionUID = 1L;
+    public static final IFunctionDescriptorFactory FACTORY = AUUIDFromStringCastNullConstructorDescriptor::new;
+
+    @Override
+    public IScalarEvaluatorFactory createEvaluatorFactory(final IScalarEvaluatorFactory[] args) {
+        return new IScalarEvaluatorFactory() {
+            private static final long serialVersionUID = 1L;
+
+            @Override
+            public IScalarEvaluator createScalarEvaluator(IEvaluatorContext ctx) throws HyracksDataException {
+                return new AbstractUUIDFromStringConstructorEvaluator(ctx, args[0].createScalarEvaluator(ctx), sourceLoc) {
+
+                    @Override
+                    protected FunctionIdentifier getIdentifier() {
+                        return AUUIDFromStringCastNullConstructorDescriptor.this.getIdentifier();
+                    }
+
+                    @Override
+                    protected boolean checkAndSetMissingOrNull(IPointable result) throws HyracksDataException {
+                        return PointableHelper.checkAndSetNull(result, inputArg);
+                    }
+                };
+            }
+        };
+    }
+
+    @Override
+    public FunctionIdentifier getIdentifier() {
+        return BuiltinFunctions.UUID_CAST_NULL_CONSTRUCTOR;
+    }
+}
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 ec2b9db..b8d6bc5 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
@@ -55,44 +55,7 @@
 
             @Override
             public IScalarEvaluator createScalarEvaluator(IEvaluatorContext ctx) throws HyracksDataException {
-                return new AbstractConstructorEvaluator(ctx, args[0].createScalarEvaluator(ctx), sourceLoc) {
-
-                    private final AMutableUUID uuid = new AMutableUUID();
-                    @SuppressWarnings("unchecked")
-                    private final ISerializerDeserializer<AUUID> uuidSerde =
-                            SerializerDeserializerProvider.INSTANCE.getSerializerDeserializer(BuiltinType.AUUID);
-                    private final UTF8StringPointable utf8Ptr = new UTF8StringPointable();
-
-                    @Override
-                    protected void evaluateImpl(IPointable result) throws HyracksDataException {
-                        byte[] bytes = inputArg.getByteArray();
-                        int startOffset = inputArg.getStartOffset();
-                        int len = inputArg.getLength();
-                        ATypeTag inputType = EnumDeserializer.ATYPETAGDESERIALIZER.deserialize(bytes[startOffset]);
-                        switch (inputType) {
-                            case UUID:
-                                result.set(inputArg);
-                                break;
-                            case STRING:
-                                utf8Ptr.set(bytes, startOffset + 1, len - 1);
-                                if (parseUUID(utf8Ptr, uuid)) {
-                                    resultStorage.reset();
-                                    uuidSerde.serialize(uuid, out);
-                                    result.set(resultStorage);
-                                } else {
-                                    handleParseError(utf8Ptr, result);
-                                }
-                                break;
-                            default:
-                                handleUnsupportedType(inputType, result);
-                                break;
-                        }
-                    }
-
-                    @Override
-                    protected BuiltinType getTargetType() {
-                        return BuiltinType.AUUID;
-                    }
+                return new AbstractUUIDFromStringConstructorEvaluator(ctx, args[0].createScalarEvaluator(ctx), sourceLoc) {
 
                     @Override
                     protected FunctionIdentifier getIdentifier() {
@@ -103,16 +66,6 @@
         };
     }
 
-    private static boolean parseUUID(UTF8StringPointable textPtr, AMutableUUID result) {
-        try {
-            // first byte: tag, next x bytes: length
-            result.parseUUIDHexBytes(textPtr.getByteArray(), textPtr.getCharStartOffset());
-            return true;
-        } catch (HyracksDataException e) {
-            return false;
-        }
-    }
-
     @Override
     public FunctionIdentifier getIdentifier() {
         return BuiltinFunctions.UUID_CONSTRUCTOR;
diff --git a/asterixdb/asterix-runtime/src/main/java/org/apache/asterix/runtime/evaluators/constructors/AYearMonthDurationCastNullConstructorDescriptor.java b/asterixdb/asterix-runtime/src/main/java/org/apache/asterix/runtime/evaluators/constructors/AYearMonthDurationCastNullConstructorDescriptor.java
new file mode 100644
index 0000000..eb6f6db
--- /dev/null
+++ b/asterixdb/asterix-runtime/src/main/java/org/apache/asterix/runtime/evaluators/constructors/AYearMonthDurationCastNullConstructorDescriptor.java
@@ -0,0 +1,66 @@
+/*
+ * 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 org.apache.asterix.common.annotations.MissingNullInOutFunction;
+import org.apache.asterix.om.functions.BuiltinFunctions;
+import org.apache.asterix.om.functions.IFunctionDescriptorFactory;
+import org.apache.asterix.runtime.evaluators.base.AbstractScalarFunctionDynamicDescriptor;
+import org.apache.asterix.runtime.evaluators.functions.PointableHelper;
+import org.apache.hyracks.algebricks.core.algebra.functions.FunctionIdentifier;
+import org.apache.hyracks.algebricks.runtime.base.IEvaluatorContext;
+import org.apache.hyracks.algebricks.runtime.base.IScalarEvaluator;
+import org.apache.hyracks.algebricks.runtime.base.IScalarEvaluatorFactory;
+import org.apache.hyracks.api.exceptions.HyracksDataException;
+import org.apache.hyracks.data.std.api.IPointable;
+
+@MissingNullInOutFunction
+public class AYearMonthDurationCastNullConstructorDescriptor extends AbstractScalarFunctionDynamicDescriptor {
+    private static final long serialVersionUID = 1L;
+    public static final IFunctionDescriptorFactory FACTORY = AYearMonthDurationCastNullConstructorDescriptor::new;
+
+    @Override
+    public IScalarEvaluatorFactory createEvaluatorFactory(final IScalarEvaluatorFactory[] args) {
+        return new IScalarEvaluatorFactory() {
+            private static final long serialVersionUID = 1L;
+
+            @Override
+            public IScalarEvaluator createScalarEvaluator(IEvaluatorContext ctx) throws HyracksDataException {
+                return new AbstractYearMonthDurationConstructorEvaluator(ctx, args[0].createScalarEvaluator(ctx), sourceLoc) {
+
+                    @Override
+                    protected FunctionIdentifier getIdentifier() {
+                        return AYearMonthDurationCastNullConstructorDescriptor.this.getIdentifier();
+                    }
+
+                    @Override
+                    protected boolean checkAndSetMissingOrNull(IPointable result) throws HyracksDataException {
+                        return PointableHelper.checkAndSetNull(result, inputArg);
+                    }
+                };
+            }
+        };
+    }
+
+    @Override
+    public FunctionIdentifier getIdentifier() {
+        return BuiltinFunctions.YEAR_MONTH_DURATION_CAST_NULL_CONSTRUCTOR;
+    }
+
+}
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 5a64f28..c2062de 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
@@ -52,52 +52,7 @@
 
             @Override
             public IScalarEvaluator createScalarEvaluator(IEvaluatorContext ctx) throws HyracksDataException {
-                return new AbstractConstructorEvaluator(ctx, args[0].createScalarEvaluator(ctx), sourceLoc) {
-
-                    private final AMutableYearMonthDuration aYearMonthDuration = new AMutableYearMonthDuration(0);
-                    @SuppressWarnings("unchecked")
-                    private final ISerializerDeserializer<AYearMonthDuration> yearMonthDurationSerde =
-                            SerializerDeserializerProvider.INSTANCE
-                                    .getSerializerDeserializer(BuiltinType.AYEARMONTHDURATION);
-                    private final UTF8StringPointable utf8Ptr = new UTF8StringPointable();
-
-                    @Override
-                    protected void evaluateImpl(IPointable result) throws HyracksDataException {
-                        byte[] bytes = inputArg.getByteArray();
-                        int startOffset = inputArg.getStartOffset();
-                        int len = inputArg.getLength();
-                        ATypeTag inputType = EnumDeserializer.ATYPETAGDESERIALIZER.deserialize(bytes[startOffset]);
-                        switch (inputType) {
-                            case YEARMONTHDURATION:
-                                result.set(inputArg);
-                                break;
-                            case DURATION:
-                                int months = ADurationSerializerDeserializer.getYearMonth(bytes, startOffset + 1);
-                                aYearMonthDuration.setMonths(months);
-                                resultStorage.reset();
-                                yearMonthDurationSerde.serialize(aYearMonthDuration, out);
-                                result.set(resultStorage);
-                                break;
-                            case STRING:
-                                utf8Ptr.set(bytes, startOffset + 1, len - 1);
-                                if (parseYearMonthDuration(utf8Ptr, aYearMonthDuration)) {
-                                    resultStorage.reset();
-                                    yearMonthDurationSerde.serialize(aYearMonthDuration, out);
-                                    result.set(resultStorage);
-                                } else {
-                                    handleParseError(utf8Ptr, result);
-                                }
-                                break;
-                            default:
-                                handleUnsupportedType(inputType, result);
-                                break;
-                        }
-                    }
-
-                    @Override
-                    protected BuiltinType getTargetType() {
-                        return BuiltinType.AYEARMONTHDURATION;
-                    }
+                return new AbstractYearMonthDurationConstructorEvaluator(ctx, args[0].createScalarEvaluator(ctx), sourceLoc) {
 
                     @Override
                     protected FunctionIdentifier getIdentifier() {
@@ -108,16 +63,6 @@
         };
     }
 
-    private static boolean parseYearMonthDuration(UTF8StringPointable textPtr, AMutableYearMonthDuration result) {
-        try {
-            ADurationParserFactory.parseDuration(textPtr.getByteArray(), textPtr.getCharStartOffset(),
-                    textPtr.getUTF8Length(), result, ADurationParseOption.YEAR_MONTH);
-            return true;
-        } catch (HyracksDataException e) {
-            return false;
-        }
-    }
-
     @Override
     public FunctionIdentifier getIdentifier() {
         return BuiltinFunctions.YEAR_MONTH_DURATION_CONSTRUCTOR;
diff --git a/asterixdb/asterix-runtime/src/main/java/org/apache/asterix/runtime/evaluators/constructors/AbstractDateConstructorWithFormatEvaluator.java b/asterixdb/asterix-runtime/src/main/java/org/apache/asterix/runtime/evaluators/constructors/AbstractDateConstructorWithFormatEvaluator.java
new file mode 100644
index 0000000..f02ddec
--- /dev/null
+++ b/asterixdb/asterix-runtime/src/main/java/org/apache/asterix/runtime/evaluators/constructors/AbstractDateConstructorWithFormatEvaluator.java
@@ -0,0 +1,87 @@
+/*
+ * 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 org.apache.asterix.om.base.AMutableDate;
+import org.apache.asterix.om.base.AMutableInt64;
+import org.apache.asterix.om.base.temporal.AsterixTemporalTypeParseException;
+import org.apache.asterix.om.base.temporal.DateTimeFormatUtils;
+import org.apache.asterix.om.base.temporal.GregorianCalendarSystem;
+import org.apache.asterix.om.types.ATypeTag;
+import org.apache.asterix.runtime.evaluators.functions.PointableHelper;
+import org.apache.hyracks.algebricks.runtime.base.IEvaluatorContext;
+import org.apache.hyracks.algebricks.runtime.base.IScalarEvaluator;
+import org.apache.hyracks.algebricks.runtime.base.IScalarEvaluatorFactory;
+import org.apache.hyracks.api.exceptions.HyracksDataException;
+import org.apache.hyracks.api.exceptions.SourceLocation;
+import org.apache.hyracks.data.std.api.IPointable;
+import org.apache.hyracks.data.std.primitive.UTF8StringPointable;
+import org.apache.hyracks.data.std.primitive.VoidPointable;
+import org.apache.hyracks.dataflow.common.data.accessors.IFrameTupleReference;
+
+public abstract class AbstractDateConstructorWithFormatEvaluator extends AbstractDateConstructorEvaluator {
+
+    private final IScalarEvaluator formatEval;
+    private final IPointable formatArg = new VoidPointable();
+    private final UTF8StringPointable formatTextPtr = new UTF8StringPointable();
+    private final AMutableInt64 aInt64 = new AMutableInt64(0);
+
+    protected AbstractDateConstructorWithFormatEvaluator(IEvaluatorContext ctx, IScalarEvaluatorFactory[] args,
+            SourceLocation sourceLoc) throws HyracksDataException {
+        super(ctx, args[0].createScalarEvaluator(ctx), sourceLoc);
+        formatEval = args[1].createScalarEvaluator(ctx);
+    }
+
+    @Override
+    protected void evaluateInput(IFrameTupleReference tuple) throws HyracksDataException {
+        super.evaluateInput(tuple);
+        formatEval.evaluate(tuple, formatArg);
+    }
+
+    @Override
+    protected boolean checkAndSetMissingOrNull(IPointable result) throws HyracksDataException {
+        return PointableHelper.checkAndSetMissingOrNull(result, inputArg, formatArg);
+    }
+
+    @Override
+    protected boolean parseDate(UTF8StringPointable textPtr, AMutableDate result) {
+        byte[] formatBytes = formatArg.getByteArray();
+        int formatStartOffset = formatArg.getStartOffset();
+        int formatLength = formatArg.getLength();
+        if (formatBytes[formatStartOffset] != ATypeTag.SERIALIZED_STRING_TYPE_TAG) {
+            return false;
+        }
+        formatTextPtr.set(formatBytes, formatStartOffset + 1, formatLength - 1);
+        try {
+            if (DateTimeFormatUtils.getInstance().parseDateTime(aInt64, textPtr.getByteArray(),
+                    textPtr.getCharStartOffset(), textPtr.getUTF8Length(), formatBytes,
+                    formatTextPtr.getCharStartOffset(), formatTextPtr.getUTF8Length(),
+                    DateTimeFormatUtils.DateTimeParseMode.DATE_ONLY, false)) {
+                result.setValue((int) (aInt64.getLongValue() / GregorianCalendarSystem.CHRONON_OF_DAY));
+                return true;
+            } else {
+                return false;
+            }
+        } catch (AsterixTemporalTypeParseException e) {
+            // shouldn't happen
+            return false;
+        }
+    }
+}
diff --git a/asterixdb/asterix-runtime/src/main/java/org/apache/asterix/runtime/evaluators/constructors/AbstractDateTimeConstructorWithFormatEvaluator.java b/asterixdb/asterix-runtime/src/main/java/org/apache/asterix/runtime/evaluators/constructors/AbstractDateTimeConstructorWithFormatEvaluator.java
new file mode 100644
index 0000000..c304d05
--- /dev/null
+++ b/asterixdb/asterix-runtime/src/main/java/org/apache/asterix/runtime/evaluators/constructors/AbstractDateTimeConstructorWithFormatEvaluator.java
@@ -0,0 +1,85 @@
+/*
+ * 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 org.apache.asterix.om.base.AMutableDateTime;
+import org.apache.asterix.om.base.AMutableInt64;
+import org.apache.asterix.om.base.temporal.AsterixTemporalTypeParseException;
+import org.apache.asterix.om.base.temporal.DateTimeFormatUtils;
+import org.apache.asterix.om.types.ATypeTag;
+import org.apache.asterix.runtime.evaluators.functions.PointableHelper;
+import org.apache.hyracks.algebricks.runtime.base.IEvaluatorContext;
+import org.apache.hyracks.algebricks.runtime.base.IScalarEvaluator;
+import org.apache.hyracks.algebricks.runtime.base.IScalarEvaluatorFactory;
+import org.apache.hyracks.api.exceptions.HyracksDataException;
+import org.apache.hyracks.api.exceptions.SourceLocation;
+import org.apache.hyracks.data.std.api.IPointable;
+import org.apache.hyracks.data.std.primitive.UTF8StringPointable;
+import org.apache.hyracks.data.std.primitive.VoidPointable;
+import org.apache.hyracks.dataflow.common.data.accessors.IFrameTupleReference;
+
+public abstract class AbstractDateTimeConstructorWithFormatEvaluator extends AbstractDateTimeConstructorEvaluator {
+
+    private final IScalarEvaluator formatEval;
+    private final IPointable formatArg = new VoidPointable();
+    private final UTF8StringPointable formatTextPtr = new UTF8StringPointable();
+    private final AMutableInt64 aInt64 = new AMutableInt64(0);
+
+    protected AbstractDateTimeConstructorWithFormatEvaluator(IEvaluatorContext ctx, IScalarEvaluatorFactory[] args,
+            SourceLocation sourceLoc) throws HyracksDataException {
+        super(ctx, args[0].createScalarEvaluator(ctx), sourceLoc);
+        formatEval = args[1].createScalarEvaluator(ctx);
+    }
+    @Override
+    protected void evaluateInput(IFrameTupleReference tuple) throws HyracksDataException {
+        super.evaluateInput(tuple);
+        formatEval.evaluate(tuple, formatArg);
+    }
+
+    @Override
+    protected boolean checkAndSetMissingOrNull(IPointable result) throws HyracksDataException {
+        return PointableHelper.checkAndSetMissingOrNull(result, inputArg, formatArg);
+    }
+
+    @Override
+    protected boolean parseDateTime(UTF8StringPointable textPtr, AMutableDateTime result) {
+        byte[] formatBytes = formatArg.getByteArray();
+        int formatStartOffset = formatArg.getStartOffset();
+        int formatLength = formatArg.getLength();
+        if (formatBytes[formatStartOffset] != ATypeTag.SERIALIZED_STRING_TYPE_TAG) {
+            return false;
+        }
+        formatTextPtr.set(formatBytes, formatStartOffset + 1, formatLength - 1);
+        try {
+            if (DateTimeFormatUtils.getInstance().parseDateTime(aInt64, textPtr.getByteArray(),
+                    textPtr.getCharStartOffset(), textPtr.getUTF8Length(), formatBytes,
+                    formatTextPtr.getCharStartOffset(), formatTextPtr.getUTF8Length(),
+                    DateTimeFormatUtils.DateTimeParseMode.DATETIME, false)) {
+                result.setValue(aInt64.getLongValue());
+                return true;
+            } else {
+                return false;
+            }
+        } catch (AsterixTemporalTypeParseException e) {
+            // shouldn't happen
+            return false;
+        }
+    }
+}
diff --git a/asterixdb/asterix-runtime/src/main/java/org/apache/asterix/runtime/evaluators/constructors/AbstractDayTimeDurationConstructorEvaluator.java b/asterixdb/asterix-runtime/src/main/java/org/apache/asterix/runtime/evaluators/constructors/AbstractDayTimeDurationConstructorEvaluator.java
new file mode 100644
index 0000000..479d44f
--- /dev/null
+++ b/asterixdb/asterix-runtime/src/main/java/org/apache/asterix/runtime/evaluators/constructors/AbstractDayTimeDurationConstructorEvaluator.java
@@ -0,0 +1,100 @@
+/*
+ * 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 org.apache.asterix.dataflow.data.nontagged.serde.ADurationSerializerDeserializer;
+import org.apache.asterix.formats.nontagged.SerializerDeserializerProvider;
+import org.apache.asterix.om.base.ADayTimeDuration;
+import org.apache.asterix.om.base.AMutableDayTimeDuration;
+import org.apache.asterix.om.base.temporal.ADurationParserFactory;
+import org.apache.asterix.om.types.ATypeTag;
+import org.apache.asterix.om.types.BuiltinType;
+import org.apache.asterix.om.types.EnumDeserializer;
+import org.apache.hyracks.algebricks.runtime.base.IEvaluatorContext;
+import org.apache.hyracks.algebricks.runtime.base.IScalarEvaluator;
+import org.apache.hyracks.api.dataflow.value.ISerializerDeserializer;
+import org.apache.hyracks.api.exceptions.HyracksDataException;
+import org.apache.hyracks.api.exceptions.SourceLocation;
+import org.apache.hyracks.data.std.api.IPointable;
+import org.apache.hyracks.data.std.primitive.UTF8StringPointable;
+
+public abstract class AbstractDayTimeDurationConstructorEvaluator extends AbstractConstructorEvaluator {
+
+    private final AMutableDayTimeDuration aDayTimeDuration = new AMutableDayTimeDuration(0);
+    @SuppressWarnings("unchecked")
+    private final ISerializerDeserializer<ADayTimeDuration> dayTimeDurationSerde =
+            SerializerDeserializerProvider.INSTANCE
+                    .getSerializerDeserializer(BuiltinType.ADAYTIMEDURATION);
+    private final UTF8StringPointable utf8Ptr = new UTF8StringPointable();
+
+    protected AbstractDayTimeDurationConstructorEvaluator(IEvaluatorContext ctx, IScalarEvaluator inputEval,
+            SourceLocation sourceLoc) {
+        super(ctx, inputEval, sourceLoc);
+    }
+
+    @Override
+    protected void evaluateImpl(IPointable result) throws HyracksDataException {
+        byte[] bytes = inputArg.getByteArray();
+        int startOffset = inputArg.getStartOffset();
+        int len = inputArg.getLength();
+        ATypeTag inputType = EnumDeserializer.ATYPETAGDESERIALIZER.deserialize(bytes[startOffset]);
+        switch (inputType) {
+            case DAYTIMEDURATION:
+                result.set(inputArg);
+                break;
+            case DURATION:
+                long millis = ADurationSerializerDeserializer.getDayTime(bytes, startOffset + 1);
+                aDayTimeDuration.setMilliseconds(millis);
+                resultStorage.reset();
+                dayTimeDurationSerde.serialize(aDayTimeDuration, out);
+                result.set(resultStorage);
+                break;
+            case STRING:
+                utf8Ptr.set(bytes, startOffset + 1, len - 1);
+                if (parseDayTimeDuration(utf8Ptr, aDayTimeDuration)) {
+                    resultStorage.reset();
+                    dayTimeDurationSerde.serialize(aDayTimeDuration, out);
+                    result.set(resultStorage);
+                } else {
+                    handleParseError(utf8Ptr, result);
+                }
+                break;
+            default:
+                handleUnsupportedType(inputType, result);
+                break;
+        }
+    }
+
+    @Override
+    protected final BuiltinType getTargetType() {
+        return BuiltinType.ADAYTIMEDURATION;
+    }
+
+
+    private static boolean parseDayTimeDuration(UTF8StringPointable textPtr, ADayTimeDuration result) {
+        try {
+            ADurationParserFactory.parseDuration(textPtr.getByteArray(), textPtr.getCharStartOffset(),
+                    textPtr.getUTF8Length(), result, ADurationParserFactory.ADurationParseOption.DAY_TIME);
+            return true;
+        } catch (HyracksDataException e) {
+            return false;
+        }
+    }
+}
diff --git a/asterixdb/asterix-runtime/src/main/java/org/apache/asterix/runtime/evaluators/constructors/AbstractDurationConstructorEvaluator.java b/asterixdb/asterix-runtime/src/main/java/org/apache/asterix/runtime/evaluators/constructors/AbstractDurationConstructorEvaluator.java
new file mode 100644
index 0000000..81ffdf0
--- /dev/null
+++ b/asterixdb/asterix-runtime/src/main/java/org/apache/asterix/runtime/evaluators/constructors/AbstractDurationConstructorEvaluator.java
@@ -0,0 +1,107 @@
+/*
+ * 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 org.apache.asterix.dataflow.data.nontagged.serde.ADayTimeDurationSerializerDeserializer;
+import org.apache.asterix.dataflow.data.nontagged.serde.AYearMonthDurationSerializerDeserializer;
+import org.apache.asterix.formats.nontagged.SerializerDeserializerProvider;
+import org.apache.asterix.om.base.ADuration;
+import org.apache.asterix.om.base.AMutableDuration;
+import org.apache.asterix.om.base.temporal.ADurationParserFactory;
+import org.apache.asterix.om.types.ATypeTag;
+import org.apache.asterix.om.types.BuiltinType;
+import org.apache.asterix.om.types.EnumDeserializer;
+import org.apache.hyracks.algebricks.runtime.base.IEvaluatorContext;
+import org.apache.hyracks.algebricks.runtime.base.IScalarEvaluator;
+import org.apache.hyracks.api.dataflow.value.ISerializerDeserializer;
+import org.apache.hyracks.api.exceptions.HyracksDataException;
+import org.apache.hyracks.api.exceptions.SourceLocation;
+import org.apache.hyracks.data.std.api.IPointable;
+import org.apache.hyracks.data.std.primitive.UTF8StringPointable;
+
+public abstract class AbstractDurationConstructorEvaluator extends AbstractConstructorEvaluator {
+
+    private final AMutableDuration aDuration = new AMutableDuration(0, 0);
+    @SuppressWarnings("unchecked")
+    private final ISerializerDeserializer<ADuration> durationSerde =
+            SerializerDeserializerProvider.INSTANCE.getSerializerDeserializer(BuiltinType.ADURATION);
+    private final UTF8StringPointable utf8Ptr = new UTF8StringPointable();
+
+    protected AbstractDurationConstructorEvaluator(IEvaluatorContext ctx, IScalarEvaluator inputEval,
+            SourceLocation sourceLoc) {
+        super(ctx, inputEval, sourceLoc);
+    }
+
+    @Override
+    protected void evaluateImpl(IPointable result) throws HyracksDataException {
+        byte[] bytes = inputArg.getByteArray();
+        int startOffset = inputArg.getStartOffset();
+        int len = inputArg.getLength();
+        ATypeTag inputType = EnumDeserializer.ATYPETAGDESERIALIZER.deserialize(bytes[startOffset]);
+        switch (inputType) {
+            case DURATION:
+                result.set(inputArg);
+                break;
+            case YEARMONTHDURATION:
+                int months =
+                        AYearMonthDurationSerializerDeserializer.getYearMonth(bytes, startOffset + 1);
+                aDuration.setValue(months, 0);
+                resultStorage.reset();
+                durationSerde.serialize(aDuration, out);
+                result.set(resultStorage);
+                break;
+            case DAYTIMEDURATION:
+                long millis = ADayTimeDurationSerializerDeserializer.getDayTime(bytes, startOffset + 1);
+                aDuration.setValue(0, millis);
+                resultStorage.reset();
+                durationSerde.serialize(aDuration, out);
+                result.set(resultStorage);
+                break;
+            case STRING:
+                utf8Ptr.set(bytes, startOffset + 1, len - 1);
+                if (parseDuration(utf8Ptr, aDuration)) {
+                    resultStorage.reset();
+                    durationSerde.serialize(aDuration, out);
+                    result.set(resultStorage);
+                } else {
+                    handleParseError(utf8Ptr, result);
+                }
+                break;
+            default:
+                handleUnsupportedType(inputType, result);
+                break;
+        }
+    }
+
+    @Override
+    protected final BuiltinType getTargetType() {
+        return BuiltinType.ADURATION;
+    }
+
+    private static boolean parseDuration(UTF8StringPointable textPtr, ADuration result) {
+        try {
+            ADurationParserFactory.parseDuration(textPtr.getByteArray(), textPtr.getCharStartOffset(),
+                    textPtr.getUTF8Length(), result, ADurationParserFactory.ADurationParseOption.All);
+            return true;
+        } catch (HyracksDataException e) {
+            return false;
+        }
+    }
+}
diff --git a/asterixdb/asterix-runtime/src/main/java/org/apache/asterix/runtime/evaluators/constructors/AbstractFloatConstructorEvaluator.java b/asterixdb/asterix-runtime/src/main/java/org/apache/asterix/runtime/evaluators/constructors/AbstractFloatConstructorEvaluator.java
new file mode 100644
index 0000000..0e80aed
--- /dev/null
+++ b/asterixdb/asterix-runtime/src/main/java/org/apache/asterix/runtime/evaluators/constructors/AbstractFloatConstructorEvaluator.java
@@ -0,0 +1,114 @@
+/*
+ * 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.IOException;
+
+import org.apache.asterix.dataflow.data.nontagged.serde.ABooleanSerializerDeserializer;
+import org.apache.asterix.formats.nontagged.SerializerDeserializerProvider;
+import org.apache.asterix.om.base.AFloat;
+import org.apache.asterix.om.base.AMutableFloat;
+import org.apache.asterix.om.types.ATypeTag;
+import org.apache.asterix.om.types.BuiltinType;
+import org.apache.asterix.om.types.EnumDeserializer;
+import org.apache.asterix.om.types.hierachy.ATypeHierarchy;
+import org.apache.asterix.runtime.evaluators.common.NumberUtils;
+import org.apache.hyracks.algebricks.runtime.base.IEvaluatorContext;
+import org.apache.hyracks.algebricks.runtime.base.IScalarEvaluator;
+import org.apache.hyracks.api.dataflow.value.ISerializerDeserializer;
+import org.apache.hyracks.api.exceptions.HyracksDataException;
+import org.apache.hyracks.api.exceptions.SourceLocation;
+import org.apache.hyracks.data.std.api.IPointable;
+import org.apache.hyracks.data.std.primitive.UTF8StringPointable;
+
+public abstract class AbstractFloatConstructorEvaluator extends AbstractConstructorEvaluator {
+
+    private final AMutableFloat aFloat = new AMutableFloat(0);
+    @SuppressWarnings("unchecked")
+    private final ISerializerDeserializer<AFloat> floatSerde =
+            SerializerDeserializerProvider.INSTANCE.getSerializerDeserializer(BuiltinType.AFLOAT);
+    private final UTF8StringPointable utf8Ptr = new UTF8StringPointable();
+
+    protected AbstractFloatConstructorEvaluator(IEvaluatorContext ctx, IScalarEvaluator inputEval,
+            SourceLocation sourceLoc) {
+        super(ctx, inputEval, sourceLoc);
+    }
+
+    @Override
+    protected void evaluateImpl(IPointable result) throws HyracksDataException {
+        byte[] bytes = inputArg.getByteArray();
+        int startOffset = inputArg.getStartOffset();
+        int len = inputArg.getLength();
+        ATypeTag inputType = EnumDeserializer.ATYPETAGDESERIALIZER.deserialize(bytes[startOffset]);
+        switch (inputType) {
+            case FLOAT:
+                result.set(inputArg);
+                break;
+            case TINYINT:
+            case SMALLINT:
+            case INTEGER:
+            case BIGINT:
+                resultStorage.reset();
+                try {
+                    ATypeHierarchy.getTypePromoteComputer(inputType, ATypeTag.FLOAT).convertType(bytes,
+                            startOffset + 1, len - 1, out);
+                } catch (IOException e) {
+                    throw HyracksDataException.create(e);
+                }
+                result.set(resultStorage);
+                break;
+            case DOUBLE:
+                resultStorage.reset();
+                try {
+                    ATypeHierarchy.getTypeDemoteComputer(inputType, ATypeTag.FLOAT, false)
+                            .convertType(bytes, startOffset + 1, len - 1, out);
+                } catch (IOException e) {
+                    throw HyracksDataException.create(e);
+                }
+                result.set(resultStorage);
+                break;
+            case BOOLEAN:
+                boolean b = ABooleanSerializerDeserializer.getBoolean(bytes, startOffset + 1);
+                aFloat.setValue(b ? 1 : 0);
+                resultStorage.reset();
+                floatSerde.serialize(aFloat, out);
+                result.set(resultStorage);
+                break;
+            case STRING:
+                utf8Ptr.set(bytes, startOffset + 1, len - 1);
+                if (NumberUtils.parseFloat(utf8Ptr, aFloat)) {
+                    resultStorage.reset();
+                    floatSerde.serialize(aFloat, out);
+                    result.set(resultStorage);
+                } else {
+                    handleParseError(utf8Ptr, result);
+                }
+                break;
+            default:
+                handleUnsupportedType(inputType, result);
+                break;
+        }
+    }
+
+    @Override
+    protected final BuiltinType getTargetType() {
+        return BuiltinType.AFLOAT;
+    }
+}
diff --git a/asterixdb/asterix-runtime/src/main/java/org/apache/asterix/runtime/evaluators/constructors/AbstractInt16ConstructorEvaluator.java b/asterixdb/asterix-runtime/src/main/java/org/apache/asterix/runtime/evaluators/constructors/AbstractInt16ConstructorEvaluator.java
new file mode 100644
index 0000000..051241c
--- /dev/null
+++ b/asterixdb/asterix-runtime/src/main/java/org/apache/asterix/runtime/evaluators/constructors/AbstractInt16ConstructorEvaluator.java
@@ -0,0 +1,114 @@
+/*
+ * 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.IOException;
+
+import org.apache.asterix.dataflow.data.nontagged.serde.ABooleanSerializerDeserializer;
+import org.apache.asterix.formats.nontagged.SerializerDeserializerProvider;
+import org.apache.asterix.om.base.AInt16;
+import org.apache.asterix.om.base.AMutableInt16;
+import org.apache.asterix.om.types.ATypeTag;
+import org.apache.asterix.om.types.BuiltinType;
+import org.apache.asterix.om.types.EnumDeserializer;
+import org.apache.asterix.om.types.hierachy.ATypeHierarchy;
+import org.apache.asterix.runtime.evaluators.common.NumberUtils;
+import org.apache.hyracks.algebricks.runtime.base.IEvaluatorContext;
+import org.apache.hyracks.algebricks.runtime.base.IScalarEvaluator;
+import org.apache.hyracks.api.dataflow.value.ISerializerDeserializer;
+import org.apache.hyracks.api.exceptions.HyracksDataException;
+import org.apache.hyracks.api.exceptions.SourceLocation;
+import org.apache.hyracks.data.std.api.IPointable;
+import org.apache.hyracks.data.std.primitive.UTF8StringPointable;
+
+public abstract class AbstractInt16ConstructorEvaluator extends AbstractConstructorEvaluator {
+
+    private final AMutableInt16 aInt16 = new AMutableInt16((short) 0);
+    @SuppressWarnings("unchecked")
+    private final ISerializerDeserializer<AInt16> int16Serde =
+            SerializerDeserializerProvider.INSTANCE.getSerializerDeserializer(BuiltinType.AINT16);
+    private final UTF8StringPointable utf8Ptr = new UTF8StringPointable();
+
+    protected AbstractInt16ConstructorEvaluator(IEvaluatorContext ctx, IScalarEvaluator inputEval,
+            SourceLocation sourceLoc) {
+        super(ctx, inputEval, sourceLoc);
+    }
+
+    @Override
+    protected void evaluateImpl(IPointable result) throws HyracksDataException {
+        byte[] bytes = inputArg.getByteArray();
+        int startOffset = inputArg.getStartOffset();
+        int len = inputArg.getLength();
+        ATypeTag inputType = EnumDeserializer.ATYPETAGDESERIALIZER.deserialize(bytes[startOffset]);
+        switch (inputType) {
+            case SMALLINT:
+                result.set(inputArg);
+                break;
+            case TINYINT:
+                resultStorage.reset();
+                try {
+                    ATypeHierarchy.getTypePromoteComputer(inputType, ATypeTag.SMALLINT)
+                            .convertType(bytes, startOffset + 1, len - 1, out);
+                } catch (IOException e) {
+                    throw HyracksDataException.create(e);
+                }
+                result.set(resultStorage);
+                break;
+            case INTEGER:
+            case BIGINT:
+            case FLOAT:
+            case DOUBLE:
+                resultStorage.reset();
+                try {
+                    ATypeHierarchy.getTypeDemoteComputer(inputType, ATypeTag.SMALLINT, false)
+                            .convertType(bytes, startOffset + 1, len - 1, out);
+                } catch (IOException e) {
+                    throw HyracksDataException.create(e);
+                }
+                result.set(resultStorage);
+                break;
+            case BOOLEAN:
+                boolean b = ABooleanSerializerDeserializer.getBoolean(bytes, startOffset + 1);
+                aInt16.setValue((short) (b ? 1 : 0));
+                resultStorage.reset();
+                int16Serde.serialize(aInt16, out);
+                result.set(resultStorage);
+                break;
+            case STRING:
+                utf8Ptr.set(bytes, startOffset + 1, len - 1);
+                if (NumberUtils.parseInt16(utf8Ptr, aInt16)) {
+                    resultStorage.reset();
+                    int16Serde.serialize(aInt16, out);
+                    result.set(resultStorage);
+                } else {
+                    handleParseError(utf8Ptr, result);
+                }
+                break;
+            default:
+                handleUnsupportedType(inputType, result);
+                break;
+        }
+    }
+
+    @Override
+    protected final BuiltinType getTargetType() {
+        return BuiltinType.AINT16;
+    }
+}
diff --git a/asterixdb/asterix-runtime/src/main/java/org/apache/asterix/runtime/evaluators/constructors/AbstractInt32ConstructorEvaluator.java b/asterixdb/asterix-runtime/src/main/java/org/apache/asterix/runtime/evaluators/constructors/AbstractInt32ConstructorEvaluator.java
new file mode 100644
index 0000000..0d623a6
--- /dev/null
+++ b/asterixdb/asterix-runtime/src/main/java/org/apache/asterix/runtime/evaluators/constructors/AbstractInt32ConstructorEvaluator.java
@@ -0,0 +1,114 @@
+/*
+ * 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.IOException;
+
+import org.apache.asterix.dataflow.data.nontagged.serde.ABooleanSerializerDeserializer;
+import org.apache.asterix.formats.nontagged.SerializerDeserializerProvider;
+import org.apache.asterix.om.base.AInt32;
+import org.apache.asterix.om.base.AMutableInt32;
+import org.apache.asterix.om.types.ATypeTag;
+import org.apache.asterix.om.types.BuiltinType;
+import org.apache.asterix.om.types.EnumDeserializer;
+import org.apache.asterix.om.types.hierachy.ATypeHierarchy;
+import org.apache.asterix.runtime.evaluators.common.NumberUtils;
+import org.apache.hyracks.algebricks.runtime.base.IEvaluatorContext;
+import org.apache.hyracks.algebricks.runtime.base.IScalarEvaluator;
+import org.apache.hyracks.api.dataflow.value.ISerializerDeserializer;
+import org.apache.hyracks.api.exceptions.HyracksDataException;
+import org.apache.hyracks.api.exceptions.SourceLocation;
+import org.apache.hyracks.data.std.api.IPointable;
+import org.apache.hyracks.data.std.primitive.UTF8StringPointable;
+
+public abstract class AbstractInt32ConstructorEvaluator extends AbstractConstructorEvaluator {
+
+    private final AMutableInt32 aInt32 = new AMutableInt32(0);
+    @SuppressWarnings("unchecked")
+    private final ISerializerDeserializer<AInt32> int32Serde =
+            SerializerDeserializerProvider.INSTANCE.getSerializerDeserializer(BuiltinType.AINT32);
+    private final UTF8StringPointable utf8Ptr = new UTF8StringPointable();
+
+    protected AbstractInt32ConstructorEvaluator(IEvaluatorContext ctx, IScalarEvaluator inputEval,
+            SourceLocation sourceLoc) {
+        super(ctx, inputEval, sourceLoc);
+    }
+
+    @Override
+    protected void evaluateImpl(IPointable result) throws HyracksDataException {
+        byte[] bytes = inputArg.getByteArray();
+        int startOffset = inputArg.getStartOffset();
+        int len = inputArg.getLength();
+        ATypeTag inputType = EnumDeserializer.ATYPETAGDESERIALIZER.deserialize(bytes[startOffset]);
+        switch (inputType) {
+            case INTEGER:
+                result.set(inputArg);
+                break;
+            case TINYINT:
+            case SMALLINT:
+                resultStorage.reset();
+                try {
+                    ATypeHierarchy.getTypePromoteComputer(inputType, ATypeTag.INTEGER)
+                            .convertType(bytes, startOffset + 1, len - 1, out);
+                } catch (IOException e) {
+                    throw HyracksDataException.create(e);
+                }
+                result.set(resultStorage);
+                break;
+            case BIGINT:
+            case FLOAT:
+            case DOUBLE:
+                resultStorage.reset();
+                try {
+                    ATypeHierarchy.getTypeDemoteComputer(inputType, ATypeTag.INTEGER, false)
+                            .convertType(bytes, startOffset + 1, len - 1, out);
+                } catch (IOException e) {
+                    throw HyracksDataException.create(e);
+                }
+                result.set(resultStorage);
+                break;
+            case BOOLEAN:
+                boolean b = ABooleanSerializerDeserializer.getBoolean(bytes, startOffset + 1);
+                aInt32.setValue(b ? 1 : 0);
+                resultStorage.reset();
+                int32Serde.serialize(aInt32, out);
+                result.set(resultStorage);
+                break;
+            case STRING:
+                utf8Ptr.set(bytes, startOffset + 1, len - 1);
+                if (NumberUtils.parseInt32(utf8Ptr, aInt32)) {
+                    resultStorage.reset();
+                    int32Serde.serialize(aInt32, out);
+                    result.set(resultStorage);
+                } else {
+                    handleParseError(utf8Ptr, result);
+                }
+                break;
+            default:
+                handleUnsupportedType(inputType, result);
+                break;
+        }
+    }
+
+    @Override
+    protected final BuiltinType getTargetType() {
+        return BuiltinType.AINT32;
+    }
+}
diff --git a/asterixdb/asterix-runtime/src/main/java/org/apache/asterix/runtime/evaluators/constructors/AbstractInt8ConstructorEvaluator.java b/asterixdb/asterix-runtime/src/main/java/org/apache/asterix/runtime/evaluators/constructors/AbstractInt8ConstructorEvaluator.java
new file mode 100644
index 0000000..9610c44
--- /dev/null
+++ b/asterixdb/asterix-runtime/src/main/java/org/apache/asterix/runtime/evaluators/constructors/AbstractInt8ConstructorEvaluator.java
@@ -0,0 +1,105 @@
+/*
+ * 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.IOException;
+
+import org.apache.asterix.dataflow.data.nontagged.serde.ABooleanSerializerDeserializer;
+import org.apache.asterix.formats.nontagged.SerializerDeserializerProvider;
+import org.apache.asterix.om.base.AInt8;
+import org.apache.asterix.om.base.AMutableInt8;
+import org.apache.asterix.om.types.ATypeTag;
+import org.apache.asterix.om.types.BuiltinType;
+import org.apache.asterix.om.types.EnumDeserializer;
+import org.apache.asterix.om.types.hierachy.ATypeHierarchy;
+import org.apache.asterix.runtime.evaluators.common.NumberUtils;
+import org.apache.hyracks.algebricks.runtime.base.IEvaluatorContext;
+import org.apache.hyracks.algebricks.runtime.base.IScalarEvaluator;
+import org.apache.hyracks.api.dataflow.value.ISerializerDeserializer;
+import org.apache.hyracks.api.exceptions.HyracksDataException;
+import org.apache.hyracks.api.exceptions.SourceLocation;
+import org.apache.hyracks.data.std.api.IPointable;
+import org.apache.hyracks.data.std.primitive.UTF8StringPointable;
+
+public abstract class AbstractInt8ConstructorEvaluator extends AbstractConstructorEvaluator {
+
+    private final AMutableInt8 aInt8 = new AMutableInt8((byte) 0);
+    @SuppressWarnings("unchecked")
+    private final ISerializerDeserializer<AInt8> int8Serde =
+            SerializerDeserializerProvider.INSTANCE.getSerializerDeserializer(BuiltinType.AINT8);
+    private final UTF8StringPointable utf8Ptr = new UTF8StringPointable();
+
+    protected AbstractInt8ConstructorEvaluator(IEvaluatorContext ctx, IScalarEvaluator inputEval,
+            SourceLocation sourceLoc) {
+        super(ctx, inputEval, sourceLoc);
+    }
+
+    @Override
+    protected void evaluateImpl(IPointable result) throws HyracksDataException {
+        byte[] bytes = inputArg.getByteArray();
+        int startOffset = inputArg.getStartOffset();
+        int len = inputArg.getLength();
+        ATypeTag inputType = EnumDeserializer.ATYPETAGDESERIALIZER.deserialize(bytes[startOffset]);
+        switch (inputType) {
+            case TINYINT:
+                result.set(inputArg);
+                break;
+            case SMALLINT:
+            case INTEGER:
+            case BIGINT:
+            case FLOAT:
+            case DOUBLE:
+                resultStorage.reset();
+                try {
+                    ATypeHierarchy.getTypeDemoteComputer(inputType, ATypeTag.TINYINT, false)
+                            .convertType(bytes, startOffset + 1, len - 1, out);
+                } catch (IOException e) {
+                    throw HyracksDataException.create(e);
+                }
+                result.set(resultStorage);
+                break;
+            case BOOLEAN:
+                boolean b = ABooleanSerializerDeserializer.getBoolean(bytes, startOffset + 1);
+                aInt8.setValue((byte) (b ? 1 : 0));
+                resultStorage.reset();
+                int8Serde.serialize(aInt8, out);
+                result.set(resultStorage);
+                break;
+            case STRING:
+                utf8Ptr.set(bytes, startOffset + 1, len - 1);
+                if (NumberUtils.parseInt8(utf8Ptr, aInt8)) {
+                    resultStorage.reset();
+                    int8Serde.serialize(aInt8, out);
+                    result.set(resultStorage);
+                } else {
+                    handleParseError(utf8Ptr, result);
+                }
+                break;
+            default:
+                handleUnsupportedType(inputType, result);
+                break;
+        }
+    }
+
+    @Override
+    protected final BuiltinType getTargetType() {
+        return BuiltinType.AINT8;
+    }
+}
diff --git a/asterixdb/asterix-runtime/src/main/java/org/apache/asterix/runtime/evaluators/constructors/AbstractTimeWithFormatConstructorEvaluator.java b/asterixdb/asterix-runtime/src/main/java/org/apache/asterix/runtime/evaluators/constructors/AbstractTimeWithFormatConstructorEvaluator.java
new file mode 100644
index 0000000..d70e3bb
--- /dev/null
+++ b/asterixdb/asterix-runtime/src/main/java/org/apache/asterix/runtime/evaluators/constructors/AbstractTimeWithFormatConstructorEvaluator.java
@@ -0,0 +1,86 @@
+/*
+ * 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 org.apache.asterix.om.base.AMutableInt64;
+import org.apache.asterix.om.base.AMutableTime;
+import org.apache.asterix.om.base.temporal.AsterixTemporalTypeParseException;
+import org.apache.asterix.om.base.temporal.DateTimeFormatUtils;
+import org.apache.asterix.om.types.ATypeTag;
+import org.apache.asterix.runtime.evaluators.functions.PointableHelper;
+import org.apache.hyracks.algebricks.runtime.base.IEvaluatorContext;
+import org.apache.hyracks.algebricks.runtime.base.IScalarEvaluator;
+import org.apache.hyracks.algebricks.runtime.base.IScalarEvaluatorFactory;
+import org.apache.hyracks.api.exceptions.HyracksDataException;
+import org.apache.hyracks.api.exceptions.SourceLocation;
+import org.apache.hyracks.data.std.api.IPointable;
+import org.apache.hyracks.data.std.primitive.UTF8StringPointable;
+import org.apache.hyracks.data.std.primitive.VoidPointable;
+import org.apache.hyracks.dataflow.common.data.accessors.IFrameTupleReference;
+
+public abstract class AbstractTimeWithFormatConstructorEvaluator extends AbstractTimeConstructorEvaluator {
+
+    private final IScalarEvaluator formatEval;
+    private final IPointable formatArg = new VoidPointable();
+    private final UTF8StringPointable formatTextPtr = new UTF8StringPointable();
+    private final AMutableInt64 aInt64 = new AMutableInt64(0);
+
+    protected AbstractTimeWithFormatConstructorEvaluator(IEvaluatorContext ctx, IScalarEvaluatorFactory[] args,
+            SourceLocation sourceLoc) throws HyracksDataException {
+        super(ctx, args[0].createScalarEvaluator(ctx), sourceLoc);
+        formatEval = args[1].createScalarEvaluator(ctx);
+    }
+
+    @Override
+    protected void evaluateInput(IFrameTupleReference tuple) throws HyracksDataException {
+        super.evaluateInput(tuple);
+        formatEval.evaluate(tuple, formatArg);
+    }
+
+    @Override
+    protected boolean checkAndSetMissingOrNull(IPointable result) throws HyracksDataException {
+        return PointableHelper.checkAndSetMissingOrNull(result, inputArg, formatArg);
+    }
+
+    @Override
+    protected boolean parseTime(UTF8StringPointable textPtr, AMutableTime result) {
+        byte[] formatBytes = formatArg.getByteArray();
+        int formatStartOffset = formatArg.getStartOffset();
+        int formatLength = formatArg.getLength();
+        if (formatBytes[formatStartOffset] != ATypeTag.SERIALIZED_STRING_TYPE_TAG) {
+            return false;
+        }
+        formatTextPtr.set(formatBytes, formatStartOffset + 1, formatLength - 1);
+        try {
+            if (DateTimeFormatUtils.getInstance().parseDateTime(aInt64, textPtr.getByteArray(),
+                    textPtr.getCharStartOffset(), textPtr.getUTF8Length(), formatBytes,
+                    formatTextPtr.getCharStartOffset(), formatTextPtr.getUTF8Length(),
+                    DateTimeFormatUtils.DateTimeParseMode.TIME_ONLY, false)) {
+                result.setValue((int) aInt64.getLongValue());
+                return true;
+            } else {
+                return false;
+            }
+        } catch (AsterixTemporalTypeParseException e) {
+            // shouldn't happen
+            return false;
+        }
+    }
+}
diff --git a/asterixdb/asterix-runtime/src/main/java/org/apache/asterix/runtime/evaluators/constructors/AbstractUUIDFromStringConstructorEvaluator.java b/asterixdb/asterix-runtime/src/main/java/org/apache/asterix/runtime/evaluators/constructors/AbstractUUIDFromStringConstructorEvaluator.java
new file mode 100644
index 0000000..e429c1d
--- /dev/null
+++ b/asterixdb/asterix-runtime/src/main/java/org/apache/asterix/runtime/evaluators/constructors/AbstractUUIDFromStringConstructorEvaluator.java
@@ -0,0 +1,89 @@
+/*
+ * 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 org.apache.asterix.formats.nontagged.SerializerDeserializerProvider;
+import org.apache.asterix.om.base.AMutableUUID;
+import org.apache.asterix.om.base.AUUID;
+import org.apache.asterix.om.types.ATypeTag;
+import org.apache.asterix.om.types.BuiltinType;
+import org.apache.asterix.om.types.EnumDeserializer;
+import org.apache.hyracks.algebricks.runtime.base.IEvaluatorContext;
+import org.apache.hyracks.algebricks.runtime.base.IScalarEvaluator;
+import org.apache.hyracks.api.dataflow.value.ISerializerDeserializer;
+import org.apache.hyracks.api.exceptions.HyracksDataException;
+import org.apache.hyracks.api.exceptions.SourceLocation;
+import org.apache.hyracks.data.std.api.IPointable;
+import org.apache.hyracks.data.std.primitive.UTF8StringPointable;
+
+public abstract class AbstractUUIDFromStringConstructorEvaluator extends AbstractConstructorEvaluator {
+
+    private final AMutableUUID uuid = new AMutableUUID();
+    @SuppressWarnings("unchecked")
+    private final ISerializerDeserializer<AUUID> uuidSerde =
+            SerializerDeserializerProvider.INSTANCE.getSerializerDeserializer(BuiltinType.AUUID);
+    private final UTF8StringPointable utf8Ptr = new UTF8StringPointable();
+
+    protected AbstractUUIDFromStringConstructorEvaluator(IEvaluatorContext ctx, IScalarEvaluator inputEval,
+            SourceLocation sourceLoc) {
+        super(ctx, inputEval, sourceLoc);
+    }
+
+    @Override
+    protected void evaluateImpl(IPointable result) throws HyracksDataException {
+        byte[] bytes = inputArg.getByteArray();
+        int startOffset = inputArg.getStartOffset();
+        int len = inputArg.getLength();
+        ATypeTag inputType = EnumDeserializer.ATYPETAGDESERIALIZER.deserialize(bytes[startOffset]);
+        switch (inputType) {
+            case UUID:
+                result.set(inputArg);
+                break;
+            case STRING:
+                utf8Ptr.set(bytes, startOffset + 1, len - 1);
+                if (parseUUID(utf8Ptr, uuid)) {
+                    resultStorage.reset();
+                    uuidSerde.serialize(uuid, out);
+                    result.set(resultStorage);
+                } else {
+                    handleParseError(utf8Ptr, result);
+                }
+                break;
+            default:
+                handleUnsupportedType(inputType, result);
+                break;
+        }
+    }
+
+    @Override
+    protected final BuiltinType getTargetType() {
+        return BuiltinType.AUUID;
+    }
+
+    private static boolean parseUUID(UTF8StringPointable textPtr, AMutableUUID result) {
+        try {
+            // first byte: tag, next x bytes: length
+            result.parseUUIDHexBytes(textPtr.getByteArray(), textPtr.getCharStartOffset());
+            return true;
+        } catch (HyracksDataException e) {
+            return false;
+        }
+    }
+}
diff --git a/asterixdb/asterix-runtime/src/main/java/org/apache/asterix/runtime/evaluators/constructors/AbstractYearMonthDurationConstructorEvaluator.java b/asterixdb/asterix-runtime/src/main/java/org/apache/asterix/runtime/evaluators/constructors/AbstractYearMonthDurationConstructorEvaluator.java
new file mode 100644
index 0000000..c561823
--- /dev/null
+++ b/asterixdb/asterix-runtime/src/main/java/org/apache/asterix/runtime/evaluators/constructors/AbstractYearMonthDurationConstructorEvaluator.java
@@ -0,0 +1,99 @@
+/*
+ * 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 org.apache.asterix.dataflow.data.nontagged.serde.ADurationSerializerDeserializer;
+import org.apache.asterix.formats.nontagged.SerializerDeserializerProvider;
+import org.apache.asterix.om.base.AMutableYearMonthDuration;
+import org.apache.asterix.om.base.AYearMonthDuration;
+import org.apache.asterix.om.base.temporal.ADurationParserFactory;
+import org.apache.asterix.om.types.ATypeTag;
+import org.apache.asterix.om.types.BuiltinType;
+import org.apache.asterix.om.types.EnumDeserializer;
+import org.apache.hyracks.algebricks.runtime.base.IEvaluatorContext;
+import org.apache.hyracks.algebricks.runtime.base.IScalarEvaluator;
+import org.apache.hyracks.api.dataflow.value.ISerializerDeserializer;
+import org.apache.hyracks.api.exceptions.HyracksDataException;
+import org.apache.hyracks.api.exceptions.SourceLocation;
+import org.apache.hyracks.data.std.api.IPointable;
+import org.apache.hyracks.data.std.primitive.UTF8StringPointable;
+
+public abstract class AbstractYearMonthDurationConstructorEvaluator extends AbstractConstructorEvaluator {
+
+    private final AMutableYearMonthDuration aYearMonthDuration = new AMutableYearMonthDuration(0);
+    @SuppressWarnings("unchecked")
+    private final ISerializerDeserializer<AYearMonthDuration> yearMonthDurationSerde =
+            SerializerDeserializerProvider.INSTANCE
+                    .getSerializerDeserializer(BuiltinType.AYEARMONTHDURATION);
+    private final UTF8StringPointable utf8Ptr = new UTF8StringPointable();
+
+    protected AbstractYearMonthDurationConstructorEvaluator(IEvaluatorContext ctx, IScalarEvaluator inputEval,
+            SourceLocation sourceLoc) {
+        super(ctx, inputEval, sourceLoc);
+    }
+
+    @Override
+    protected void evaluateImpl(IPointable result) throws HyracksDataException {
+        byte[] bytes = inputArg.getByteArray();
+        int startOffset = inputArg.getStartOffset();
+        int len = inputArg.getLength();
+        ATypeTag inputType = EnumDeserializer.ATYPETAGDESERIALIZER.deserialize(bytes[startOffset]);
+        switch (inputType) {
+            case YEARMONTHDURATION:
+                result.set(inputArg);
+                break;
+            case DURATION:
+                int months = ADurationSerializerDeserializer.getYearMonth(bytes, startOffset + 1);
+                aYearMonthDuration.setMonths(months);
+                resultStorage.reset();
+                yearMonthDurationSerde.serialize(aYearMonthDuration, out);
+                result.set(resultStorage);
+                break;
+            case STRING:
+                utf8Ptr.set(bytes, startOffset + 1, len - 1);
+                if (parseYearMonthDuration(utf8Ptr, aYearMonthDuration)) {
+                    resultStorage.reset();
+                    yearMonthDurationSerde.serialize(aYearMonthDuration, out);
+                    result.set(resultStorage);
+                } else {
+                    handleParseError(utf8Ptr, result);
+                }
+                break;
+            default:
+                handleUnsupportedType(inputType, result);
+                break;
+        }
+    }
+
+    @Override
+    protected final BuiltinType getTargetType() {
+        return BuiltinType.AYEARMONTHDURATION;
+    }
+
+    private static boolean parseYearMonthDuration(UTF8StringPointable textPtr, AMutableYearMonthDuration result) {
+        try {
+            ADurationParserFactory.parseDuration(textPtr.getByteArray(), textPtr.getCharStartOffset(),
+                    textPtr.getUTF8Length(), result, ADurationParserFactory.ADurationParseOption.YEAR_MONTH);
+            return true;
+        } catch (HyracksDataException e) {
+            return false;
+        }
+    }
+}
diff --git a/asterixdb/asterix-runtime/src/main/java/org/apache/asterix/runtime/evaluators/functions/PointableHelper.java b/asterixdb/asterix-runtime/src/main/java/org/apache/asterix/runtime/evaluators/functions/PointableHelper.java
index 4a4c36c..e0fbe5c 100644
--- a/asterixdb/asterix-runtime/src/main/java/org/apache/asterix/runtime/evaluators/functions/PointableHelper.java
+++ b/asterixdb/asterix-runtime/src/main/java/org/apache/asterix/runtime/evaluators/functions/PointableHelper.java
@@ -308,6 +308,26 @@
     }
 
     /**
+     * Checks whether the pointable {@param pointable1} is null or missing, and if true, assigns null to the
+     * {@param result}.
+     *
+     * @param result the result pointable that will hold the null value
+     * @param pointable1 the pointable to be checked
+     *
+     * @return {@code true} if the {@param pointable1} value is missing or null, {@code false} otherwise.
+     */
+    public static boolean checkAndSetNull(IPointable result, IPointable pointable1) throws HyracksDataException {
+        switch (getPointableValueState(pointable1, null)) {
+            case MISSING:
+            case NULL:
+                setNull(result);
+                return true;
+            default:
+                return false;
+        }
+    }
+
+    /**
      * This method checks and returns the pointable value state.
      *
      * If a ListAccessor is passed to this function, it will check if the passed pointable is a list, and if so, it
diff --git a/asterixdb/asterix-runtime/src/main/java/org/apache/asterix/runtime/functions/FunctionCollection.java b/asterixdb/asterix-runtime/src/main/java/org/apache/asterix/runtime/functions/FunctionCollection.java
index b32d0db..ee76cc0 100644
--- a/asterixdb/asterix-runtime/src/main/java/org/apache/asterix/runtime/functions/FunctionCollection.java
+++ b/asterixdb/asterix-runtime/src/main/java/org/apache/asterix/runtime/functions/FunctionCollection.java
@@ -271,21 +271,35 @@
 import org.apache.asterix.runtime.evaluators.comparisons.NotEqualsDescriptor;
 import org.apache.asterix.runtime.evaluators.comparisons.NullIfEqualsDescriptor;
 import org.apache.asterix.runtime.evaluators.comparisons.PosInfIfEqualsDescriptor;
+import org.apache.asterix.runtime.evaluators.constructors.ABinaryBase64StringCastNullConstructorDescriptor;
 import org.apache.asterix.runtime.evaluators.constructors.ABinaryBase64StringConstructorDescriptor;
 import org.apache.asterix.runtime.evaluators.constructors.ABinaryHexStringConstructorDescriptor;
+import org.apache.asterix.runtime.evaluators.constructors.ABooleanCastNullConstructorDescriptor;
 import org.apache.asterix.runtime.evaluators.constructors.ABooleanConstructorDescriptor;
 import org.apache.asterix.runtime.evaluators.constructors.ACircleConstructorDescriptor;
+import org.apache.asterix.runtime.evaluators.constructors.ADateCastNullConstructorDescriptor;
+import org.apache.asterix.runtime.evaluators.constructors.ADateCastNullConstructorWithFormatDescriptor;
 import org.apache.asterix.runtime.evaluators.constructors.ADateConstructorDescriptor;
 import org.apache.asterix.runtime.evaluators.constructors.ADateConstructorWithFormatDescriptor;
+import org.apache.asterix.runtime.evaluators.constructors.ADateTimeCastNullConstructorDescriptor;
+import org.apache.asterix.runtime.evaluators.constructors.ADateTimeCastNullConstructorWithFormatDescriptor;
 import org.apache.asterix.runtime.evaluators.constructors.ADateTimeConstructorDescriptor;
 import org.apache.asterix.runtime.evaluators.constructors.ADateTimeConstructorWithFormatDescriptor;
+import org.apache.asterix.runtime.evaluators.constructors.ADayTimeDurationCastNullConstructorDescriptor;
 import org.apache.asterix.runtime.evaluators.constructors.ADayTimeDurationConstructorDescriptor;
+import org.apache.asterix.runtime.evaluators.constructors.ADoubleCastNullConstructorDescriptor;
 import org.apache.asterix.runtime.evaluators.constructors.ADoubleConstructorDescriptor;
+import org.apache.asterix.runtime.evaluators.constructors.ADurationCastNullConstructorDescriptor;
 import org.apache.asterix.runtime.evaluators.constructors.ADurationConstructorDescriptor;
+import org.apache.asterix.runtime.evaluators.constructors.AFloatCastNullConstructorDescriptor;
 import org.apache.asterix.runtime.evaluators.constructors.AFloatConstructorDescriptor;
+import org.apache.asterix.runtime.evaluators.constructors.AInt16CastNullConstructorDescriptor;
 import org.apache.asterix.runtime.evaluators.constructors.AInt16ConstructorDescriptor;
+import org.apache.asterix.runtime.evaluators.constructors.AInt32CastNullConstructorDescriptor;
 import org.apache.asterix.runtime.evaluators.constructors.AInt32ConstructorDescriptor;
+import org.apache.asterix.runtime.evaluators.constructors.AInt64CastNullConstructorDescriptor;
 import org.apache.asterix.runtime.evaluators.constructors.AInt64ConstructorDescriptor;
+import org.apache.asterix.runtime.evaluators.constructors.AInt8CastNullConstructorDescriptor;
 import org.apache.asterix.runtime.evaluators.constructors.AInt8ConstructorDescriptor;
 import org.apache.asterix.runtime.evaluators.constructors.AIntervalConstructorDescriptor;
 import org.apache.asterix.runtime.evaluators.constructors.AIntervalStartFromDateConstructorDescriptor;
@@ -296,10 +310,15 @@
 import org.apache.asterix.runtime.evaluators.constructors.APointConstructorDescriptor;
 import org.apache.asterix.runtime.evaluators.constructors.APolygonConstructorDescriptor;
 import org.apache.asterix.runtime.evaluators.constructors.ARectangleConstructorDescriptor;
+import org.apache.asterix.runtime.evaluators.constructors.AStringCastNullConstructorDescriptor;
 import org.apache.asterix.runtime.evaluators.constructors.AStringConstructorDescriptor;
+import org.apache.asterix.runtime.evaluators.constructors.ATimeCastNullConstructorDescriptor;
+import org.apache.asterix.runtime.evaluators.constructors.ATimeCastNullConstructorWithFormatDescriptor;
 import org.apache.asterix.runtime.evaluators.constructors.ATimeConstructorDescriptor;
 import org.apache.asterix.runtime.evaluators.constructors.ATimeConstructorWithFormatDescriptor;
+import org.apache.asterix.runtime.evaluators.constructors.AUUIDFromStringCastNullConstructorDescriptor;
 import org.apache.asterix.runtime.evaluators.constructors.AUUIDFromStringConstructorDescriptor;
+import org.apache.asterix.runtime.evaluators.constructors.AYearMonthDurationCastNullConstructorDescriptor;
 import org.apache.asterix.runtime.evaluators.constructors.AYearMonthDurationConstructorDescriptor;
 import org.apache.asterix.runtime.evaluators.constructors.ClosedRecordConstructorDescriptor;
 import org.apache.asterix.runtime.evaluators.constructors.OpenRecordConstructorDescriptor;
@@ -1082,15 +1101,24 @@
 
         // Constructors
         fc.add(ABooleanConstructorDescriptor.FACTORY);
+        fc.add(ABooleanCastNullConstructorDescriptor.FACTORY);
         fc.add(ABinaryHexStringConstructorDescriptor.FACTORY);
         fc.add(ABinaryBase64StringConstructorDescriptor.FACTORY);
+        fc.add(ABinaryBase64StringCastNullConstructorDescriptor.FACTORY);
         fc.add(AStringConstructorDescriptor.FACTORY);
+        fc.add(AStringCastNullConstructorDescriptor.FACTORY);
         fc.add(AInt8ConstructorDescriptor.FACTORY);
+        fc.add(AInt8CastNullConstructorDescriptor.FACTORY);
         fc.add(AInt16ConstructorDescriptor.FACTORY);
+        fc.add(AInt16CastNullConstructorDescriptor.FACTORY);
         fc.add(AInt32ConstructorDescriptor.FACTORY);
+        fc.add(AInt32CastNullConstructorDescriptor.FACTORY);
         fc.add(AInt64ConstructorDescriptor.FACTORY);
+        fc.add(AInt64CastNullConstructorDescriptor.FACTORY);
         fc.add(AFloatConstructorDescriptor.FACTORY);
+        fc.add(AFloatCastNullConstructorDescriptor.FACTORY);
         fc.add(ADoubleConstructorDescriptor.FACTORY);
+        fc.add(ADoubleCastNullConstructorDescriptor.FACTORY);
         fc.add(APointConstructorDescriptor.FACTORY);
         fc.add(APoint3DConstructorDescriptor.FACTORY);
         fc.add(ALineConstructorDescriptor.FACTORY);
@@ -1098,15 +1126,25 @@
         fc.add(ACircleConstructorDescriptor.FACTORY);
         fc.add(ARectangleConstructorDescriptor.FACTORY);
         fc.add(ATimeConstructorDescriptor.FACTORY);
+        fc.add(ATimeCastNullConstructorDescriptor.FACTORY);
         fc.add(ATimeConstructorWithFormatDescriptor.FACTORY);
+        fc.add(ATimeCastNullConstructorWithFormatDescriptor.FACTORY);
         fc.add(ADateConstructorDescriptor.FACTORY);
+        fc.add(ADateCastNullConstructorDescriptor.FACTORY);
         fc.add(ADateConstructorWithFormatDescriptor.FACTORY);
+        fc.add(ADateCastNullConstructorWithFormatDescriptor.FACTORY);
         fc.add(ADateTimeConstructorDescriptor.FACTORY);
+        fc.add(ADateTimeCastNullConstructorDescriptor.FACTORY);
         fc.add(ADateTimeConstructorWithFormatDescriptor.FACTORY);
+        fc.add(ADateTimeCastNullConstructorWithFormatDescriptor.FACTORY);
         fc.add(ADurationConstructorDescriptor.FACTORY);
+        fc.add(ADurationCastNullConstructorDescriptor.FACTORY);
         fc.add(AYearMonthDurationConstructorDescriptor.FACTORY);
+        fc.add(AYearMonthDurationCastNullConstructorDescriptor.FACTORY);
         fc.add(ADayTimeDurationConstructorDescriptor.FACTORY);
+        fc.add(ADayTimeDurationCastNullConstructorDescriptor.FACTORY);
         fc.add(AUUIDFromStringConstructorDescriptor.FACTORY);
+        fc.add(AUUIDFromStringCastNullConstructorDescriptor.FACTORY);
         fc.add(AIntervalConstructorDescriptor.FACTORY);
         fc.add(AIntervalStartFromDateConstructorDescriptor.FACTORY);
         fc.add(AIntervalStartFromDateTimeConstructorDescriptor.FACTORY);

-- 
To view, visit https://asterix-gerrit.ics.uci.edu/c/asterixdb/+/14027
To unsubscribe, or for help writing mail filters, visit https://asterix-gerrit.ics.uci.edu/settings

Gerrit-Project: asterixdb
Gerrit-Branch: master
Gerrit-Change-Id: I120d18c4c7bbcf098fceaa6784cce265a2811e3b
Gerrit-Change-Number: 14027
Gerrit-PatchSet: 1
Gerrit-Owner: Ali Alsuliman <al...@gmail.com>
Gerrit-MessageType: newchange

Change in asterixdb[master]: [NO ISSUE][FUN] Add cast-null functions for constructors

Posted by AsterixDB Code Review <do...@asterix-gerrit.ics.uci.edu>.
From Ali Alsuliman <al...@gmail.com>:

Hello Jenkins, Anon. E. Moose #1000171, 

I'd like you to reexamine a change. Please visit

    https://asterix-gerrit.ics.uci.edu/c/asterixdb/+/14027

to look at the new patch set (#2).

Change subject: [NO ISSUE][FUN] Add cast-null functions for constructors
......................................................................

[NO ISSUE][FUN] Add cast-null functions for constructors

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

Details:
- Add cast-null type constructors that produce null for missing input.
- Make views use these types of constructors.
- Make secondary indexes with CAST (DEFAULT NULL) modifier use
  these types of constructors.

Change-Id: I120d18c4c7bbcf098fceaa6784cce265a2811e3b
---
M asterixdb/asterix-algebra/src/main/java/org/apache/asterix/optimizer/rules/IntroduceSecondaryIndexInsertDeleteRule.java
M asterixdb/asterix-app/src/test/resources/runtimets/testsuite_sqlpp.xml
M asterixdb/asterix-lang-sqlpp/src/main/java/org/apache/asterix/lang/sqlpp/rewrites/SqlppFunctionBodyRewriter.java
M asterixdb/asterix-metadata/src/main/java/org/apache/asterix/metadata/utils/SecondaryBTreeOperationsHelper.java
M asterixdb/asterix-metadata/src/main/java/org/apache/asterix/metadata/utils/TypeUtil.java
M asterixdb/asterix-om/src/main/java/org/apache/asterix/om/functions/BuiltinFunctions.java
A asterixdb/asterix-runtime/src/main/java/org/apache/asterix/runtime/evaluators/constructors/ABinaryBase64StringCastNullConstructorDescriptor.java
M asterixdb/asterix-runtime/src/main/java/org/apache/asterix/runtime/evaluators/constructors/ABinaryBase64StringConstructorDescriptor.java
A asterixdb/asterix-runtime/src/main/java/org/apache/asterix/runtime/evaluators/constructors/ABooleanCastNullConstructorDescriptor.java
A asterixdb/asterix-runtime/src/main/java/org/apache/asterix/runtime/evaluators/constructors/ADateCastNullConstructorDescriptor.java
A asterixdb/asterix-runtime/src/main/java/org/apache/asterix/runtime/evaluators/constructors/ADateCastNullConstructorWithFormatDescriptor.java
M asterixdb/asterix-runtime/src/main/java/org/apache/asterix/runtime/evaluators/constructors/ADateConstructorWithFormatDescriptor.java
A asterixdb/asterix-runtime/src/main/java/org/apache/asterix/runtime/evaluators/constructors/ADateTimeCastNullConstructorDescriptor.java
A asterixdb/asterix-runtime/src/main/java/org/apache/asterix/runtime/evaluators/constructors/ADateTimeCastNullConstructorWithFormatDescriptor.java
M asterixdb/asterix-runtime/src/main/java/org/apache/asterix/runtime/evaluators/constructors/ADateTimeConstructorWithFormatDescriptor.java
A asterixdb/asterix-runtime/src/main/java/org/apache/asterix/runtime/evaluators/constructors/ADayTimeDurationCastNullConstructorDescriptor.java
M asterixdb/asterix-runtime/src/main/java/org/apache/asterix/runtime/evaluators/constructors/ADayTimeDurationConstructorDescriptor.java
A asterixdb/asterix-runtime/src/main/java/org/apache/asterix/runtime/evaluators/constructors/ADoubleCastNullConstructorDescriptor.java
A asterixdb/asterix-runtime/src/main/java/org/apache/asterix/runtime/evaluators/constructors/ADurationCastNullConstructorDescriptor.java
M asterixdb/asterix-runtime/src/main/java/org/apache/asterix/runtime/evaluators/constructors/ADurationConstructorDescriptor.java
A asterixdb/asterix-runtime/src/main/java/org/apache/asterix/runtime/evaluators/constructors/AFloatCastNullConstructorDescriptor.java
M asterixdb/asterix-runtime/src/main/java/org/apache/asterix/runtime/evaluators/constructors/AFloatConstructorDescriptor.java
A asterixdb/asterix-runtime/src/main/java/org/apache/asterix/runtime/evaluators/constructors/AInt16CastNullConstructorDescriptor.java
M asterixdb/asterix-runtime/src/main/java/org/apache/asterix/runtime/evaluators/constructors/AInt16ConstructorDescriptor.java
A asterixdb/asterix-runtime/src/main/java/org/apache/asterix/runtime/evaluators/constructors/AInt32CastNullConstructorDescriptor.java
M asterixdb/asterix-runtime/src/main/java/org/apache/asterix/runtime/evaluators/constructors/AInt32ConstructorDescriptor.java
A asterixdb/asterix-runtime/src/main/java/org/apache/asterix/runtime/evaluators/constructors/AInt64CastNullConstructorDescriptor.java
A asterixdb/asterix-runtime/src/main/java/org/apache/asterix/runtime/evaluators/constructors/AInt8CastNullConstructorDescriptor.java
M asterixdb/asterix-runtime/src/main/java/org/apache/asterix/runtime/evaluators/constructors/AInt8ConstructorDescriptor.java
A asterixdb/asterix-runtime/src/main/java/org/apache/asterix/runtime/evaluators/constructors/AStringCastNullConstructorDescriptor.java
A asterixdb/asterix-runtime/src/main/java/org/apache/asterix/runtime/evaluators/constructors/ATimeCastNullConstructorDescriptor.java
A asterixdb/asterix-runtime/src/main/java/org/apache/asterix/runtime/evaluators/constructors/ATimeCastNullConstructorWithFormatDescriptor.java
M asterixdb/asterix-runtime/src/main/java/org/apache/asterix/runtime/evaluators/constructors/ATimeConstructorWithFormatDescriptor.java
A asterixdb/asterix-runtime/src/main/java/org/apache/asterix/runtime/evaluators/constructors/AUUIDFromStringCastNullConstructorDescriptor.java
M asterixdb/asterix-runtime/src/main/java/org/apache/asterix/runtime/evaluators/constructors/AUUIDFromStringConstructorDescriptor.java
A asterixdb/asterix-runtime/src/main/java/org/apache/asterix/runtime/evaluators/constructors/AYearMonthDurationCastNullConstructorDescriptor.java
M asterixdb/asterix-runtime/src/main/java/org/apache/asterix/runtime/evaluators/constructors/AYearMonthDurationConstructorDescriptor.java
A asterixdb/asterix-runtime/src/main/java/org/apache/asterix/runtime/evaluators/constructors/AbstractDateConstructorWithFormatEvaluator.java
A asterixdb/asterix-runtime/src/main/java/org/apache/asterix/runtime/evaluators/constructors/AbstractDateTimeConstructorWithFormatEvaluator.java
A asterixdb/asterix-runtime/src/main/java/org/apache/asterix/runtime/evaluators/constructors/AbstractDayTimeDurationConstructorEvaluator.java
A asterixdb/asterix-runtime/src/main/java/org/apache/asterix/runtime/evaluators/constructors/AbstractDurationConstructorEvaluator.java
A asterixdb/asterix-runtime/src/main/java/org/apache/asterix/runtime/evaluators/constructors/AbstractFloatConstructorEvaluator.java
A asterixdb/asterix-runtime/src/main/java/org/apache/asterix/runtime/evaluators/constructors/AbstractInt16ConstructorEvaluator.java
A asterixdb/asterix-runtime/src/main/java/org/apache/asterix/runtime/evaluators/constructors/AbstractInt32ConstructorEvaluator.java
A asterixdb/asterix-runtime/src/main/java/org/apache/asterix/runtime/evaluators/constructors/AbstractInt8ConstructorEvaluator.java
A asterixdb/asterix-runtime/src/main/java/org/apache/asterix/runtime/evaluators/constructors/AbstractTimeWithFormatConstructorEvaluator.java
A asterixdb/asterix-runtime/src/main/java/org/apache/asterix/runtime/evaluators/constructors/AbstractUUIDFromStringConstructorEvaluator.java
A asterixdb/asterix-runtime/src/main/java/org/apache/asterix/runtime/evaluators/constructors/AbstractYearMonthDurationConstructorEvaluator.java
M asterixdb/asterix-runtime/src/main/java/org/apache/asterix/runtime/evaluators/functions/PointableHelper.java
M asterixdb/asterix-runtime/src/main/java/org/apache/asterix/runtime/functions/FunctionCollection.java
50 files changed, 2,561 insertions(+), 839 deletions(-)


  git pull ssh://asterix-gerrit.ics.uci.edu:29418/asterixdb refs/changes/27/14027/2
-- 
To view, visit https://asterix-gerrit.ics.uci.edu/c/asterixdb/+/14027
To unsubscribe, or for help writing mail filters, visit https://asterix-gerrit.ics.uci.edu/settings

Gerrit-Project: asterixdb
Gerrit-Branch: master
Gerrit-Change-Id: I120d18c4c7bbcf098fceaa6784cce265a2811e3b
Gerrit-Change-Number: 14027
Gerrit-PatchSet: 2
Gerrit-Owner: Ali Alsuliman <al...@gmail.com>
Gerrit-Reviewer: Anon. E. Moose #1000171
Gerrit-Reviewer: Jenkins <je...@fulliautomatix.ics.uci.edu>
Gerrit-MessageType: newpatchset

Change in asterixdb[master]: [NO ISSUE][FUN] Add cast-null functions for constructors

Posted by AsterixDB Code Review <do...@asterix-gerrit.ics.uci.edu>.
From Ali Alsuliman <al...@gmail.com>:

Ali Alsuliman has submitted this change. ( https://asterix-gerrit.ics.uci.edu/c/asterixdb/+/14027 )

Change subject: [NO ISSUE][FUN] Add cast-null functions for constructors
......................................................................

[NO ISSUE][FUN] Add cast-null functions for constructors

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

Details:
- Add cast-null type constructors that produce null for missing input.
- Make views use these types of constructors.
- Make secondary indexes with CAST (DEFAULT NULL) modifier use
  these types of constructors.

Change-Id: I120d18c4c7bbcf098fceaa6784cce265a2811e3b
Reviewed-on: https://asterix-gerrit.ics.uci.edu/c/asterixdb/+/14027
Integration-Tests: Jenkins <je...@fulliautomatix.ics.uci.edu>
Tested-by: Jenkins <je...@fulliautomatix.ics.uci.edu>
Reviewed-by: Dmitry Lychagin <dm...@couchbase.com>
---
M asterixdb/asterix-algebra/src/main/java/org/apache/asterix/optimizer/rules/IntroduceSecondaryIndexInsertDeleteRule.java
M asterixdb/asterix-app/src/test/java/org/apache/asterix/test/runtime/NullMissingExceptionTest.java
M asterixdb/asterix-app/src/test/java/org/apache/asterix/test/runtime/NullMissingTest.java
M asterixdb/asterix-app/src/test/resources/runtimets/testsuite_sqlpp.xml
M asterixdb/asterix-lang-common/src/main/java/org/apache/asterix/lang/common/util/ViewUtil.java
M asterixdb/asterix-lang-sqlpp/src/main/java/org/apache/asterix/lang/sqlpp/rewrites/SqlppFunctionBodyRewriter.java
M asterixdb/asterix-metadata/src/main/java/org/apache/asterix/metadata/utils/SecondaryBTreeOperationsHelper.java
M asterixdb/asterix-metadata/src/main/java/org/apache/asterix/metadata/utils/TypeUtil.java
M asterixdb/asterix-om/src/main/java/org/apache/asterix/om/functions/BuiltinFunctions.java
M asterixdb/asterix-runtime/src/main/java/org/apache/asterix/runtime/evaluators/constructors/ABinaryBase64StringConstructorDescriptor.java
A asterixdb/asterix-runtime/src/main/java/org/apache/asterix/runtime/evaluators/constructors/ABinaryBase64StringDefaultNullConstructorDescriptor.java
A asterixdb/asterix-runtime/src/main/java/org/apache/asterix/runtime/evaluators/constructors/ABooleanDefaultNullConstructorDescriptor.java
M asterixdb/asterix-runtime/src/main/java/org/apache/asterix/runtime/evaluators/constructors/ADateConstructorWithFormatDescriptor.java
A asterixdb/asterix-runtime/src/main/java/org/apache/asterix/runtime/evaluators/constructors/ADateDefaultNullConstructorDescriptor.java
A asterixdb/asterix-runtime/src/main/java/org/apache/asterix/runtime/evaluators/constructors/ADateDefaultNullConstructorWithFormatDescriptor.java
M asterixdb/asterix-runtime/src/main/java/org/apache/asterix/runtime/evaluators/constructors/ADateTimeConstructorWithFormatDescriptor.java
A asterixdb/asterix-runtime/src/main/java/org/apache/asterix/runtime/evaluators/constructors/ADateTimeDefaultNullConstructorDescriptor.java
A asterixdb/asterix-runtime/src/main/java/org/apache/asterix/runtime/evaluators/constructors/ADateTimeDefaultNullConstructorWithFormatDescriptor.java
M asterixdb/asterix-runtime/src/main/java/org/apache/asterix/runtime/evaluators/constructors/ADayTimeDurationConstructorDescriptor.java
A asterixdb/asterix-runtime/src/main/java/org/apache/asterix/runtime/evaluators/constructors/ADayTimeDurationDefaultNullConstructorDescriptor.java
A asterixdb/asterix-runtime/src/main/java/org/apache/asterix/runtime/evaluators/constructors/ADoubleDefaultNullConstructorDescriptor.java
M asterixdb/asterix-runtime/src/main/java/org/apache/asterix/runtime/evaluators/constructors/ADurationConstructorDescriptor.java
A asterixdb/asterix-runtime/src/main/java/org/apache/asterix/runtime/evaluators/constructors/ADurationDefaultNullConstructorDescriptor.java
M asterixdb/asterix-runtime/src/main/java/org/apache/asterix/runtime/evaluators/constructors/AFloatConstructorDescriptor.java
A asterixdb/asterix-runtime/src/main/java/org/apache/asterix/runtime/evaluators/constructors/AFloatDefaultNullConstructorDescriptor.java
M asterixdb/asterix-runtime/src/main/java/org/apache/asterix/runtime/evaluators/constructors/AInt16ConstructorDescriptor.java
A asterixdb/asterix-runtime/src/main/java/org/apache/asterix/runtime/evaluators/constructors/AInt16DefaultNullConstructorDescriptor.java
M asterixdb/asterix-runtime/src/main/java/org/apache/asterix/runtime/evaluators/constructors/AInt32ConstructorDescriptor.java
A asterixdb/asterix-runtime/src/main/java/org/apache/asterix/runtime/evaluators/constructors/AInt32DefaultNullConstructorDescriptor.java
A asterixdb/asterix-runtime/src/main/java/org/apache/asterix/runtime/evaluators/constructors/AInt64DefaultNullConstructorDescriptor.java
M asterixdb/asterix-runtime/src/main/java/org/apache/asterix/runtime/evaluators/constructors/AInt8ConstructorDescriptor.java
A asterixdb/asterix-runtime/src/main/java/org/apache/asterix/runtime/evaluators/constructors/AInt8DefaultNullConstructorDescriptor.java
A asterixdb/asterix-runtime/src/main/java/org/apache/asterix/runtime/evaluators/constructors/AStringDefaultNullConstructorDescriptor.java
M asterixdb/asterix-runtime/src/main/java/org/apache/asterix/runtime/evaluators/constructors/ATimeConstructorWithFormatDescriptor.java
A asterixdb/asterix-runtime/src/main/java/org/apache/asterix/runtime/evaluators/constructors/ATimeDefaultNullConstructorDescriptor.java
A asterixdb/asterix-runtime/src/main/java/org/apache/asterix/runtime/evaluators/constructors/ATimeDefaultNullConstructorWithFormatDescriptor.java
M asterixdb/asterix-runtime/src/main/java/org/apache/asterix/runtime/evaluators/constructors/AUUIDFromStringConstructorDescriptor.java
A asterixdb/asterix-runtime/src/main/java/org/apache/asterix/runtime/evaluators/constructors/AUUIDFromStringDefaultNullConstructorDescriptor.java
M asterixdb/asterix-runtime/src/main/java/org/apache/asterix/runtime/evaluators/constructors/AYearMonthDurationConstructorDescriptor.java
A asterixdb/asterix-runtime/src/main/java/org/apache/asterix/runtime/evaluators/constructors/AYearMonthDurationDefaultNullConstructorDescriptor.java
A asterixdb/asterix-runtime/src/main/java/org/apache/asterix/runtime/evaluators/constructors/AbstractDateConstructorWithFormatEvaluator.java
A asterixdb/asterix-runtime/src/main/java/org/apache/asterix/runtime/evaluators/constructors/AbstractDateTimeConstructorWithFormatEvaluator.java
A asterixdb/asterix-runtime/src/main/java/org/apache/asterix/runtime/evaluators/constructors/AbstractDayTimeDurationConstructorEvaluator.java
A asterixdb/asterix-runtime/src/main/java/org/apache/asterix/runtime/evaluators/constructors/AbstractDurationConstructorEvaluator.java
A asterixdb/asterix-runtime/src/main/java/org/apache/asterix/runtime/evaluators/constructors/AbstractFloatConstructorEvaluator.java
A asterixdb/asterix-runtime/src/main/java/org/apache/asterix/runtime/evaluators/constructors/AbstractInt16ConstructorEvaluator.java
A asterixdb/asterix-runtime/src/main/java/org/apache/asterix/runtime/evaluators/constructors/AbstractInt32ConstructorEvaluator.java
A asterixdb/asterix-runtime/src/main/java/org/apache/asterix/runtime/evaluators/constructors/AbstractInt8ConstructorEvaluator.java
A asterixdb/asterix-runtime/src/main/java/org/apache/asterix/runtime/evaluators/constructors/AbstractTimeWithFormatConstructorEvaluator.java
A asterixdb/asterix-runtime/src/main/java/org/apache/asterix/runtime/evaluators/constructors/AbstractUUIDFromStringConstructorEvaluator.java
A asterixdb/asterix-runtime/src/main/java/org/apache/asterix/runtime/evaluators/constructors/AbstractYearMonthDurationConstructorEvaluator.java
M asterixdb/asterix-runtime/src/main/java/org/apache/asterix/runtime/evaluators/functions/PointableHelper.java
M asterixdb/asterix-runtime/src/main/java/org/apache/asterix/runtime/functions/FunctionCollection.java
53 files changed, 2,575 insertions(+), 848 deletions(-)

Approvals:
  Dmitry Lychagin: Looks good to me, approved
  Jenkins: Verified; Verified

Objections:
  Anon. E. Moose #1000171: Violations found



diff --git a/asterixdb/asterix-algebra/src/main/java/org/apache/asterix/optimizer/rules/IntroduceSecondaryIndexInsertDeleteRule.java b/asterixdb/asterix-algebra/src/main/java/org/apache/asterix/optimizer/rules/IntroduceSecondaryIndexInsertDeleteRule.java
index bf5ef28..4946680 100644
--- a/asterixdb/asterix-algebra/src/main/java/org/apache/asterix/optimizer/rules/IntroduceSecondaryIndexInsertDeleteRule.java
+++ b/asterixdb/asterix-algebra/src/main/java/org/apache/asterix/optimizer/rules/IntroduceSecondaryIndexInsertDeleteRule.java
@@ -890,21 +890,14 @@
 
     private ScalarFunctionCallExpression constructorFunction(IAType requiredType,
             AbstractFunctionCallExpression inputExpr, SourceLocation sourceLoc) throws CompilationException {
-        FunctionIdentifier typeConstructorFun = TypeUtil.getTypeConstructor(requiredType);
+        FunctionIdentifier typeConstructorFun = TypeUtil.getTypeConstructorDefaultNull(requiredType);
         if (typeConstructorFun == null) {
             throw new CompilationException(ErrorCode.COMPILATION_TYPE_UNSUPPORTED, sourceLoc, "index",
                     requiredType.getTypeName());
         }
-        // make CONSTRUCTOR(IF_MISSING(input, NULL))
-        BuiltinFunctionInfo ifMissingInfo = BuiltinFunctions.getBuiltinFunctionInfo(BuiltinFunctions.IF_MISSING);
-        ScalarFunctionCallExpression ifMissingExpr = new ScalarFunctionCallExpression(ifMissingInfo);
-        ifMissingExpr.getArguments().add(new MutableObject<>(inputExpr));
-        ifMissingExpr.getArguments().add(new MutableObject<>(ConstantExpression.NULL));
-        ifMissingExpr.setSourceLocation(sourceLoc);
-
         BuiltinFunctionInfo typeConstructorInfo = BuiltinFunctions.getBuiltinFunctionInfo(typeConstructorFun);
         ScalarFunctionCallExpression constructorExpr = new ScalarFunctionCallExpression(typeConstructorInfo);
-        constructorExpr.getArguments().add(new MutableObject<>(ifMissingExpr));
+        constructorExpr.getArguments().add(new MutableObject<>(inputExpr));
         constructorExpr.setSourceLocation(sourceLoc);
         return constructorExpr;
     }
diff --git a/asterixdb/asterix-app/src/test/java/org/apache/asterix/test/runtime/NullMissingExceptionTest.java b/asterixdb/asterix-app/src/test/java/org/apache/asterix/test/runtime/NullMissingExceptionTest.java
index 735f8c5..5b8924f 100644
--- a/asterixdb/asterix-app/src/test/java/org/apache/asterix/test/runtime/NullMissingExceptionTest.java
+++ b/asterixdb/asterix-app/src/test/java/org/apache/asterix/test/runtime/NullMissingExceptionTest.java
@@ -77,7 +77,9 @@
 
                 // We test all functions except record and cast functions, which requires type settings (we test them
                 // in runtime tests).
-                if (!className.contains("record") && !className.contains("Cast")) {
+                // TODO(ali): ASTERIXDB-2982 do it in a proper way so that it does not exclude classes inadvertently
+                if (!className.contains("record") && !className.contains("Cast")
+                        && !className.contains("DefaultNull")) {
                     tests.add(new Object[] { getTestName(functionDescriptor.getClass()), functionDescriptor });
                 } else {
                     LOGGER.log(Level.INFO, "Excluding " + className);
diff --git a/asterixdb/asterix-app/src/test/java/org/apache/asterix/test/runtime/NullMissingTest.java b/asterixdb/asterix-app/src/test/java/org/apache/asterix/test/runtime/NullMissingTest.java
index 8cd02ed..9d9a10f 100644
--- a/asterixdb/asterix-app/src/test/java/org/apache/asterix/test/runtime/NullMissingTest.java
+++ b/asterixdb/asterix-app/src/test/java/org/apache/asterix/test/runtime/NullMissingTest.java
@@ -89,8 +89,9 @@
                 // We test all functions except record, cast and full-text contains functions,
                 // which requires type settings or argument settings.
                 // Instead, we test them in runtime tests.
+                // TODO(ali): ASTERIXDB-2982 do it in a proper way so that it does not exclude classes inadvertently
                 if (!className.contains("record") && !className.contains("Cast")
-                        && !className.contains("FullTextContains")) {
+                        && !className.contains("FullTextContains") && !className.contains("DefaultNull")) {
                     tests.add(new Object[] { getTestName(functionDescriptor.getClass()), functionDescriptor });
                 } else {
                     LOGGER.log(Level.INFO, "Excluding " + className);
diff --git a/asterixdb/asterix-app/src/test/resources/runtimets/testsuite_sqlpp.xml b/asterixdb/asterix-app/src/test/resources/runtimets/testsuite_sqlpp.xml
index 896497f..a79bbf5 100644
--- a/asterixdb/asterix-app/src/test/resources/runtimets/testsuite_sqlpp.xml
+++ b/asterixdb/asterix-app/src/test/resources/runtimets/testsuite_sqlpp.xml
@@ -13324,19 +13324,19 @@
         <expected-warn>ASX0006: Invalid format for duration in k (in line 30, at column 6)</expected-warn>
         <expected-warn>ASX0006: Invalid format for yearmonthduration in m (in line 30, at column 6)</expected-warn>
         <expected-warn>ASX0006: Invalid format for daytimeduration in n (in line 30, at column 6)</expected-warn>
-        <expected-warn>ASX0004: Unsupported type: boolean() cannot process input type duration (in line 30, at column 6)</expected-warn>
-        <expected-warn>ASX0004: Unsupported type: int8() cannot process input type duration (in line 30, at column 6)</expected-warn>
-        <expected-warn>ASX0004: Unsupported type: int16() cannot process input type duration (in line 30, at column 6)</expected-warn>
-        <expected-warn>ASX0004: Unsupported type: int32() cannot process input type duration (in line 30, at column 6)</expected-warn>
-        <expected-warn>ASX0004: Unsupported type: int64() cannot process input type duration (in line 30, at column 6)</expected-warn>
-        <expected-warn>ASX0004: Unsupported type: float() cannot process input type duration (in line 30, at column 6)</expected-warn>
-        <expected-warn>ASX0004: Unsupported type: double() cannot process input type duration (in line 30, at column 6)</expected-warn>
-        <expected-warn>ASX0004: Unsupported type: datetime() cannot process input type duration (in line 30, at column 6)</expected-warn>
-        <expected-warn>ASX0004: Unsupported type: date() cannot process input type duration (in line 30, at column 6)</expected-warn>
-        <expected-warn>ASX0004: Unsupported type: time() cannot process input type duration (in line 30, at column 6)</expected-warn>
-        <expected-warn>ASX0004: Unsupported type: duration() cannot process input type date (in line 30, at column 6)</expected-warn>
-        <expected-warn>ASX0004: Unsupported type: year-month-duration() cannot process input type date (in line 30, at column 6)</expected-warn>
-        <expected-warn>ASX0004: Unsupported type: day-time-duration() cannot process input type date (in line 30, at column 6)</expected-warn>
+        <expected-warn>ASX0004: Unsupported type: boolean-default-null() cannot process input type duration (in line 30, at column 6)</expected-warn>
+        <expected-warn>ASX0004: Unsupported type: int8-default-null() cannot process input type duration (in line 30, at column 6)</expected-warn>
+        <expected-warn>ASX0004: Unsupported type: int16-default-null() cannot process input type duration (in line 30, at column 6)</expected-warn>
+        <expected-warn>ASX0004: Unsupported type: int32-default-null() cannot process input type duration (in line 30, at column 6)</expected-warn>
+        <expected-warn>ASX0004: Unsupported type: int64-default-null() cannot process input type duration (in line 30, at column 6)</expected-warn>
+        <expected-warn>ASX0004: Unsupported type: float-default-null() cannot process input type duration (in line 30, at column 6)</expected-warn>
+        <expected-warn>ASX0004: Unsupported type: double-default-null() cannot process input type duration (in line 30, at column 6)</expected-warn>
+        <expected-warn>ASX0004: Unsupported type: datetime-default-null() cannot process input type duration (in line 30, at column 6)</expected-warn>
+        <expected-warn>ASX0004: Unsupported type: date-default-null() cannot process input type duration (in line 30, at column 6)</expected-warn>
+        <expected-warn>ASX0004: Unsupported type: time-default-null() cannot process input type duration (in line 30, at column 6)</expected-warn>
+        <expected-warn>ASX0004: Unsupported type: duration-default-null() cannot process input type date (in line 30, at column 6)</expected-warn>
+        <expected-warn>ASX0004: Unsupported type: year-month-duration-default-null() cannot process input type date (in line 30, at column 6)</expected-warn>
+        <expected-warn>ASX0004: Unsupported type: day-time-duration-default-null() cannot process input type date (in line 30, at column 6)</expected-warn>
       </compilation-unit>
     </test-case>
     <test-case FilePath="view" check-warnings="true">
diff --git a/asterixdb/asterix-lang-common/src/main/java/org/apache/asterix/lang/common/util/ViewUtil.java b/asterixdb/asterix-lang-common/src/main/java/org/apache/asterix/lang/common/util/ViewUtil.java
index 19b8946..b833946 100644
--- a/asterixdb/asterix-lang-common/src/main/java/org/apache/asterix/lang/common/util/ViewUtil.java
+++ b/asterixdb/asterix-lang-common/src/main/java/org/apache/asterix/lang/common/util/ViewUtil.java
@@ -144,7 +144,7 @@
             } else {
                 primeType = fieldType;
             }
-            if (TypeUtil.getTypeConstructor(primeType) == null) {
+            if (TypeUtil.getTypeConstructorDefaultNull(primeType) == null) {
                 throw new CompilationException(ErrorCode.COMPILATION_TYPE_UNSUPPORTED, sourceLoc, "view",
                         primeType.getTypeName());
             }
@@ -176,8 +176,8 @@
             SourceLocation sourceLoc) throws CompilationException {
         String format = temporalDataFormat != null ? getTemporalFormat(targetType, temporalDataFormat) : null;
         boolean withFormat = format != null;
-        FunctionIdentifier constrFid = withFormat ? TypeUtil.getTypeConstructorWithFormat(targetType)
-                : TypeUtil.getTypeConstructor(targetType);
+        FunctionIdentifier constrFid = withFormat ? TypeUtil.getTypeConstructorWithFormatDefaultNull(targetType)
+                : TypeUtil.getTypeConstructorDefaultNull(targetType);
         if (constrFid == null) {
             throw new CompilationException(ErrorCode.COMPILATION_TYPE_UNSUPPORTED, sourceLoc, viewName.toString(),
                     targetType.getTypeName());
diff --git a/asterixdb/asterix-lang-sqlpp/src/main/java/org/apache/asterix/lang/sqlpp/rewrites/SqlppFunctionBodyRewriter.java b/asterixdb/asterix-lang-sqlpp/src/main/java/org/apache/asterix/lang/sqlpp/rewrites/SqlppFunctionBodyRewriter.java
index 868469b..557f17d 100644
--- a/asterixdb/asterix-lang-sqlpp/src/main/java/org/apache/asterix/lang/sqlpp/rewrites/SqlppFunctionBodyRewriter.java
+++ b/asterixdb/asterix-lang-sqlpp/src/main/java/org/apache/asterix/lang/sqlpp/rewrites/SqlppFunctionBodyRewriter.java
@@ -173,7 +173,6 @@
                 primeType = fieldType;
             }
             Expression expr = ViewUtil.createFieldAccessExpression(fromVar, fieldName, sourceLoc);
-            expr = ViewUtil.createMissingToNullExpression(expr, sourceLoc); // Default Null handling
             Expression projectExpr =
                     ViewUtil.createTypeConvertExpression(expr, primeType, temporalDataFormat, viewName, sourceLoc);
             VarIdentifier projectVar = context.newVariable();
diff --git a/asterixdb/asterix-metadata/src/main/java/org/apache/asterix/metadata/utils/SecondaryBTreeOperationsHelper.java b/asterixdb/asterix-metadata/src/main/java/org/apache/asterix/metadata/utils/SecondaryBTreeOperationsHelper.java
index 61c2df8..50cec37 100644
--- a/asterixdb/asterix-metadata/src/main/java/org/apache/asterix/metadata/utils/SecondaryBTreeOperationsHelper.java
+++ b/asterixdb/asterix-metadata/src/main/java/org/apache/asterix/metadata/utils/SecondaryBTreeOperationsHelper.java
@@ -31,7 +31,6 @@
 import org.apache.asterix.metadata.entities.Dataset;
 import org.apache.asterix.metadata.entities.Index;
 import org.apache.asterix.metadata.entities.InternalDatasetDetails;
-import org.apache.asterix.om.functions.BuiltinFunctions;
 import org.apache.asterix.om.functions.IFunctionDescriptor;
 import org.apache.asterix.om.functions.IFunctionManager;
 import org.apache.asterix.om.typecomputer.impl.TypeComputeUtils;
@@ -41,7 +40,6 @@
 import org.apache.asterix.runtime.utils.RuntimeUtils;
 import org.apache.hyracks.algebricks.common.exceptions.AlgebricksException;
 import org.apache.hyracks.algebricks.common.utils.Pair;
-import org.apache.hyracks.algebricks.core.algebra.expressions.ConstantExpression;
 import org.apache.hyracks.algebricks.core.algebra.functions.FunctionIdentifier;
 import org.apache.hyracks.algebricks.core.jobgen.impl.ConnectorPolicyAssignmentPolicy;
 import org.apache.hyracks.algebricks.data.IBinaryComparatorFactoryProvider;
@@ -315,7 +313,7 @@
 
         IScalarEvaluatorFactory castFieldEvalFactory;
         if (IndexUtil.castDefaultNull(index)) {
-            castFieldEvalFactory = createConstructorFunction(funManger, dataFormat, fieldEvalFactory, fieldType);
+            castFieldEvalFactory = createConstructorFunction(funManger, fieldEvalFactory, fieldType);
         } else if (index.isEnforced()) {
             IScalarEvaluatorFactory[] castArg = new IScalarEvaluatorFactory[] { fieldEvalFactory };
             castFieldEvalFactory =
@@ -328,22 +326,17 @@
         return castFieldEvalFactory;
     }
 
-    private IScalarEvaluatorFactory createConstructorFunction(IFunctionManager funManager, IDataFormat dataFormat,
+    private IScalarEvaluatorFactory createConstructorFunction(IFunctionManager funManager,
             IScalarEvaluatorFactory fieldEvalFactory, IAType fieldType) throws AlgebricksException {
-        // make CONSTRUCTOR(IF_MISSING(field_access, NULL))
-        IFunctionDescriptor ifMissing = funManager.lookupFunction(BuiltinFunctions.IF_MISSING, sourceLoc);
-        IScalarEvaluatorFactory nullEvalFactory = dataFormat.getConstantEvalFactory(ConstantExpression.NULL.getValue());
-        IScalarEvaluatorFactory[] ifMissingArgs = new IScalarEvaluatorFactory[] { fieldEvalFactory, nullEvalFactory };
-        ifMissing.setSourceLocation(sourceLoc);
-        IScalarEvaluatorFactory ifMissingEvalFactory = ifMissing.createEvaluatorFactory(ifMissingArgs);
-        FunctionIdentifier typeConstructorFun = TypeUtil.getTypeConstructor(TypeComputeUtils.getActualType(fieldType));
+        FunctionIdentifier typeConstructorFun =
+                TypeUtil.getTypeConstructorDefaultNull(TypeComputeUtils.getActualType(fieldType));
         if (typeConstructorFun == null) {
             throw new CompilationException(ErrorCode.COMPILATION_TYPE_UNSUPPORTED, sourceLoc, "index",
                     fieldType.getTypeName());
         }
         IFunctionDescriptor typeConstructor = funManager.lookupFunction(typeConstructorFun, sourceLoc);
         typeConstructor.setSourceLocation(sourceLoc);
-        return typeConstructor.createEvaluatorFactory(new IScalarEvaluatorFactory[] { ifMissingEvalFactory });
+        return typeConstructor.createEvaluatorFactory(new IScalarEvaluatorFactory[] { fieldEvalFactory });
     }
 
     private int[] createFieldPermutationForBulkLoadOp(int numSecondaryKeyFields) {
diff --git a/asterixdb/asterix-metadata/src/main/java/org/apache/asterix/metadata/utils/TypeUtil.java b/asterixdb/asterix-metadata/src/main/java/org/apache/asterix/metadata/utils/TypeUtil.java
index 661ad0b..8a6cfe2 100644
--- a/asterixdb/asterix-metadata/src/main/java/org/apache/asterix/metadata/utils/TypeUtil.java
+++ b/asterixdb/asterix-metadata/src/main/java/org/apache/asterix/metadata/utils/TypeUtil.java
@@ -62,53 +62,63 @@
     private TypeUtil() {
     }
 
-    public static FunctionIdentifier getTypeConstructor(IAType type) {
+    /**
+     * @param type type
+     *
+     * @return a type constructor that produces NULL for MISSING input
+     */
+    public static FunctionIdentifier getTypeConstructorDefaultNull(IAType type) {
         switch (type.getTypeTag()) {
             case TINYINT:
-                return BuiltinFunctions.INT8_CONSTRUCTOR;
+                return BuiltinFunctions.INT8_DEFAULT_NULL_CONSTRUCTOR;
             case SMALLINT:
-                return BuiltinFunctions.INT16_CONSTRUCTOR;
+                return BuiltinFunctions.INT16_DEFAULT_NULL_CONSTRUCTOR;
             case INTEGER:
-                return BuiltinFunctions.INT32_CONSTRUCTOR;
+                return BuiltinFunctions.INT32_DEFAULT_NULL_CONSTRUCTOR;
             case BIGINT:
-                return BuiltinFunctions.INT64_CONSTRUCTOR;
+                return BuiltinFunctions.INT64_DEFAULT_NULL_CONSTRUCTOR;
             case FLOAT:
-                return BuiltinFunctions.FLOAT_CONSTRUCTOR;
+                return BuiltinFunctions.FLOAT_DEFAULT_NULL_CONSTRUCTOR;
             case DOUBLE:
-                return BuiltinFunctions.DOUBLE_CONSTRUCTOR;
+                return BuiltinFunctions.DOUBLE_DEFAULT_NULL_CONSTRUCTOR;
             case BOOLEAN:
-                return BuiltinFunctions.BOOLEAN_CONSTRUCTOR;
+                return BuiltinFunctions.BOOLEAN_DEFAULT_NULL_CONSTRUCTOR;
             case STRING:
-                return BuiltinFunctions.STRING_CONSTRUCTOR;
+                return BuiltinFunctions.STRING_DEFAULT_NULL_CONSTRUCTOR;
             case DATE:
-                return BuiltinFunctions.DATE_CONSTRUCTOR;
+                return BuiltinFunctions.DATE_DEFAULT_NULL_CONSTRUCTOR;
             case TIME:
-                return BuiltinFunctions.TIME_CONSTRUCTOR;
+                return BuiltinFunctions.TIME_DEFAULT_NULL_CONSTRUCTOR;
             case DATETIME:
-                return BuiltinFunctions.DATETIME_CONSTRUCTOR;
+                return BuiltinFunctions.DATETIME_DEFAULT_NULL_CONSTRUCTOR;
             case YEARMONTHDURATION:
-                return BuiltinFunctions.YEAR_MONTH_DURATION_CONSTRUCTOR;
+                return BuiltinFunctions.YEAR_MONTH_DURATION_DEFAULT_NULL_CONSTRUCTOR;
             case DAYTIMEDURATION:
-                return BuiltinFunctions.DAY_TIME_DURATION_CONSTRUCTOR;
+                return BuiltinFunctions.DAY_TIME_DURATION_DEFAULT_NULL_CONSTRUCTOR;
             case DURATION:
-                return BuiltinFunctions.DURATION_CONSTRUCTOR;
+                return BuiltinFunctions.DURATION_DEFAULT_NULL_CONSTRUCTOR;
             case UUID:
-                return BuiltinFunctions.UUID_CONSTRUCTOR;
+                return BuiltinFunctions.UUID_DEFAULT_NULL_CONSTRUCTOR;
             case BINARY:
-                return BuiltinFunctions.BINARY_BASE64_CONSTRUCTOR;
+                return BuiltinFunctions.BINARY_BASE64_DEFAULT_NULL_CONSTRUCTOR;
             default:
                 return null;
         }
     }
 
-    public static FunctionIdentifier getTypeConstructorWithFormat(IAType type) {
+    /**
+     * @param type type
+     *
+     * @return a type constructor that produces NULL for MISSING input
+     */
+    public static FunctionIdentifier getTypeConstructorWithFormatDefaultNull(IAType type) {
         switch (type.getTypeTag()) {
             case DATE:
-                return BuiltinFunctions.DATE_CONSTRUCTOR_WITH_FORMAT;
+                return BuiltinFunctions.DATE_DEFAULT_NULL_CONSTRUCTOR_WITH_FORMAT;
             case TIME:
-                return BuiltinFunctions.TIME_CONSTRUCTOR_WITH_FORMAT;
+                return BuiltinFunctions.TIME_DEFAULT_NULL_CONSTRUCTOR_WITH_FORMAT;
             case DATETIME:
-                return BuiltinFunctions.DATETIME_CONSTRUCTOR_WITH_FORMAT;
+                return BuiltinFunctions.DATETIME_DEFAULT_NULL_CONSTRUCTOR_WITH_FORMAT;
             default:
                 return null;
         }
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 c452c9a..24d8cdf 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
@@ -1115,24 +1115,42 @@
     // constructors:
     public static final FunctionIdentifier BOOLEAN_CONSTRUCTOR =
             new FunctionIdentifier(FunctionConstants.ASTERIX_NS, "boolean", 1);
+    public static final FunctionIdentifier BOOLEAN_DEFAULT_NULL_CONSTRUCTOR =
+            new FunctionIdentifier(FunctionConstants.ASTERIX_NS, "boolean-default-null", 1);
     public static final FunctionIdentifier STRING_CONSTRUCTOR =
             new FunctionIdentifier(FunctionConstants.ASTERIX_NS, "string", 1);
+    public static final FunctionIdentifier STRING_DEFAULT_NULL_CONSTRUCTOR =
+            new FunctionIdentifier(FunctionConstants.ASTERIX_NS, "string-default-null", 1);
     public static final FunctionIdentifier BINARY_HEX_CONSTRUCTOR =
             new FunctionIdentifier(FunctionConstants.ASTERIX_NS, "hex", 1);
     public static final FunctionIdentifier BINARY_BASE64_CONSTRUCTOR =
             new FunctionIdentifier(FunctionConstants.ASTERIX_NS, "base64", 1);
+    public static final FunctionIdentifier BINARY_BASE64_DEFAULT_NULL_CONSTRUCTOR =
+            new FunctionIdentifier(FunctionConstants.ASTERIX_NS, "base64-default-null", 1);
     public static final FunctionIdentifier INT8_CONSTRUCTOR =
             new FunctionIdentifier(FunctionConstants.ASTERIX_NS, "int8", 1);
+    public static final FunctionIdentifier INT8_DEFAULT_NULL_CONSTRUCTOR =
+            new FunctionIdentifier(FunctionConstants.ASTERIX_NS, "int8-default-null", 1);
     public static final FunctionIdentifier INT16_CONSTRUCTOR =
             new FunctionIdentifier(FunctionConstants.ASTERIX_NS, "int16", 1);
+    public static final FunctionIdentifier INT16_DEFAULT_NULL_CONSTRUCTOR =
+            new FunctionIdentifier(FunctionConstants.ASTERIX_NS, "int16-default-null", 1);
     public static final FunctionIdentifier INT32_CONSTRUCTOR =
             new FunctionIdentifier(FunctionConstants.ASTERIX_NS, "int32", 1);
+    public static final FunctionIdentifier INT32_DEFAULT_NULL_CONSTRUCTOR =
+            new FunctionIdentifier(FunctionConstants.ASTERIX_NS, "int32-default-null", 1);
     public static final FunctionIdentifier INT64_CONSTRUCTOR =
             new FunctionIdentifier(FunctionConstants.ASTERIX_NS, "int64", 1);
+    public static final FunctionIdentifier INT64_DEFAULT_NULL_CONSTRUCTOR =
+            new FunctionIdentifier(FunctionConstants.ASTERIX_NS, "int64-default-null", 1);
     public static final FunctionIdentifier FLOAT_CONSTRUCTOR =
             new FunctionIdentifier(FunctionConstants.ASTERIX_NS, "float", 1);
+    public static final FunctionIdentifier FLOAT_DEFAULT_NULL_CONSTRUCTOR =
+            new FunctionIdentifier(FunctionConstants.ASTERIX_NS, "float-default-null", 1);
     public static final FunctionIdentifier DOUBLE_CONSTRUCTOR =
             new FunctionIdentifier(FunctionConstants.ASTERIX_NS, "double", 1);
+    public static final FunctionIdentifier DOUBLE_DEFAULT_NULL_CONSTRUCTOR =
+            new FunctionIdentifier(FunctionConstants.ASTERIX_NS, "double-default-null", 1);
     public static final FunctionIdentifier POINT_CONSTRUCTOR =
             new FunctionIdentifier(FunctionConstants.ASTERIX_NS, "point", 1);
     public static final FunctionIdentifier POINT3D_CONSTRUCTOR =
@@ -1147,25 +1165,45 @@
             new FunctionIdentifier(FunctionConstants.ASTERIX_NS, "polygon", 1);
     public static final FunctionIdentifier TIME_CONSTRUCTOR =
             new FunctionIdentifier(FunctionConstants.ASTERIX_NS, "time", 1);
+    public static final FunctionIdentifier TIME_DEFAULT_NULL_CONSTRUCTOR =
+            new FunctionIdentifier(FunctionConstants.ASTERIX_NS, "time-default-null", 1);
     public static final FunctionIdentifier TIME_CONSTRUCTOR_WITH_FORMAT =
             new FunctionIdentifier(FunctionConstants.ASTERIX_NS, "time", 2);
+    public static final FunctionIdentifier TIME_DEFAULT_NULL_CONSTRUCTOR_WITH_FORMAT =
+            new FunctionIdentifier(FunctionConstants.ASTERIX_NS, "time-default-null", 2);
     public static final FunctionIdentifier DATE_CONSTRUCTOR =
             new FunctionIdentifier(FunctionConstants.ASTERIX_NS, "date", 1);
+    public static final FunctionIdentifier DATE_DEFAULT_NULL_CONSTRUCTOR =
+            new FunctionIdentifier(FunctionConstants.ASTERIX_NS, "date-default-null", 1);
     public static final FunctionIdentifier DATE_CONSTRUCTOR_WITH_FORMAT =
             new FunctionIdentifier(FunctionConstants.ASTERIX_NS, "date", 2);
+    public static final FunctionIdentifier DATE_DEFAULT_NULL_CONSTRUCTOR_WITH_FORMAT =
+            new FunctionIdentifier(FunctionConstants.ASTERIX_NS, "date-default-null", 2);
     public static final FunctionIdentifier DATETIME_CONSTRUCTOR =
             new FunctionIdentifier(FunctionConstants.ASTERIX_NS, "datetime", 1);
+    public static final FunctionIdentifier DATETIME_DEFAULT_NULL_CONSTRUCTOR =
+            new FunctionIdentifier(FunctionConstants.ASTERIX_NS, "datetime-default-null", 1);
     public static final FunctionIdentifier DATETIME_CONSTRUCTOR_WITH_FORMAT =
             new FunctionIdentifier(FunctionConstants.ASTERIX_NS, "datetime", 2);
+    public static final FunctionIdentifier DATETIME_DEFAULT_NULL_CONSTRUCTOR_WITH_FORMAT =
+            new FunctionIdentifier(FunctionConstants.ASTERIX_NS, "datetime-default-null", 2);
     public static final FunctionIdentifier DURATION_CONSTRUCTOR =
             new FunctionIdentifier(FunctionConstants.ASTERIX_NS, "duration", 1);
+    public static final FunctionIdentifier DURATION_DEFAULT_NULL_CONSTRUCTOR =
+            new FunctionIdentifier(FunctionConstants.ASTERIX_NS, "duration-default-null", 1);
     public static final FunctionIdentifier UUID_CONSTRUCTOR =
             new FunctionIdentifier(FunctionConstants.ASTERIX_NS, "uuid", 1);
+    public static final FunctionIdentifier UUID_DEFAULT_NULL_CONSTRUCTOR =
+            new FunctionIdentifier(FunctionConstants.ASTERIX_NS, "uuid-default-null", 1);
 
     public static final FunctionIdentifier YEAR_MONTH_DURATION_CONSTRUCTOR =
             new FunctionIdentifier(FunctionConstants.ASTERIX_NS, "year-month-duration", 1);
+    public static final FunctionIdentifier YEAR_MONTH_DURATION_DEFAULT_NULL_CONSTRUCTOR =
+            new FunctionIdentifier(FunctionConstants.ASTERIX_NS, "year-month-duration-default-null", 1);
     public static final FunctionIdentifier DAY_TIME_DURATION_CONSTRUCTOR =
             new FunctionIdentifier(FunctionConstants.ASTERIX_NS, "day-time-duration", 1);
+    public static final FunctionIdentifier DAY_TIME_DURATION_DEFAULT_NULL_CONSTRUCTOR =
+            new FunctionIdentifier(FunctionConstants.ASTERIX_NS, "day-time-duration-default-null", 1);
 
     public static final FunctionIdentifier INTERVAL_CONSTRUCTOR =
             new FunctionIdentifier(FunctionConstants.ASTERIX_NS, "interval", 2);
@@ -1755,6 +1793,30 @@
         addPrivateFunction(MAKE_FIELD_INDEX_HANDLE, AnyTypeComputer.INSTANCE, true);
         addPrivateFunction(MAKE_FIELD_NAME_HANDLE, AnyTypeComputer.INSTANCE, true);
 
+        // cast null type constructors
+        addPrivateFunction(BOOLEAN_DEFAULT_NULL_CONSTRUCTOR, ABooleanTypeComputer.INSTANCE_NULLABLE, true);
+        addPrivateFunction(INT8_DEFAULT_NULL_CONSTRUCTOR, AInt8TypeComputer.INSTANCE_NULLABLE, true);
+        addPrivateFunction(INT16_DEFAULT_NULL_CONSTRUCTOR, AInt16TypeComputer.INSTANCE_NULLABLE, true);
+        addPrivateFunction(INT32_DEFAULT_NULL_CONSTRUCTOR, AInt32TypeComputer.INSTANCE_NULLABLE, true);
+        addPrivateFunction(INT64_DEFAULT_NULL_CONSTRUCTOR, AInt64TypeComputer.INSTANCE_NULLABLE, true);
+        addPrivateFunction(FLOAT_DEFAULT_NULL_CONSTRUCTOR, AFloatTypeComputer.INSTANCE_NULLABLE, true);
+        addPrivateFunction(DOUBLE_DEFAULT_NULL_CONSTRUCTOR, ADoubleTypeComputer.INSTANCE_NULLABLE, true);
+        addPrivateFunction(STRING_DEFAULT_NULL_CONSTRUCTOR, AStringTypeComputer.INSTANCE_NULLABLE, true);
+        addPrivateFunction(DATE_DEFAULT_NULL_CONSTRUCTOR, ADateTypeComputer.INSTANCE_NULLABLE, true);
+        addPrivateFunction(DATE_DEFAULT_NULL_CONSTRUCTOR_WITH_FORMAT, ADateTypeComputer.INSTANCE_NULLABLE, true);
+        addPrivateFunction(TIME_DEFAULT_NULL_CONSTRUCTOR, ATimeTypeComputer.INSTANCE_NULLABLE, true);
+        addPrivateFunction(TIME_DEFAULT_NULL_CONSTRUCTOR_WITH_FORMAT, ATimeTypeComputer.INSTANCE_NULLABLE, true);
+        addPrivateFunction(DATETIME_DEFAULT_NULL_CONSTRUCTOR, ADateTimeTypeComputer.INSTANCE_NULLABLE, true);
+        addPrivateFunction(DATETIME_DEFAULT_NULL_CONSTRUCTOR_WITH_FORMAT, ADateTimeTypeComputer.INSTANCE_NULLABLE,
+                true);
+        addPrivateFunction(DURATION_DEFAULT_NULL_CONSTRUCTOR, ADurationTypeComputer.INSTANCE_NULLABLE, true);
+        addPrivateFunction(DAY_TIME_DURATION_DEFAULT_NULL_CONSTRUCTOR, ADayTimeDurationTypeComputer.INSTANCE_NULLABLE,
+                true);
+        addPrivateFunction(YEAR_MONTH_DURATION_DEFAULT_NULL_CONSTRUCTOR,
+                AYearMonthDurationTypeComputer.INSTANCE_NULLABLE, true);
+        addPrivateFunction(UUID_DEFAULT_NULL_CONSTRUCTOR, AUUIDTypeComputer.INSTANCE_NULLABLE, true);
+        addPrivateFunction(BINARY_BASE64_DEFAULT_NULL_CONSTRUCTOR, ABinaryTypeComputer.INSTANCE_NULLABLE, true);
+
         addPrivateFunction(NUMERIC_UNARY_MINUS, NumericUnaryTypeComputer.INSTANCE, true);
         addPrivateFunction(NUMERIC_SUBTRACT, NumericAddSubMulDivTypeComputer.INSTANCE_SUB, true);
         addPrivateFunction(NUMERIC_MULTIPLY, NumericAddSubMulDivTypeComputer.INSTANCE_MUL_POW, true);
diff --git a/asterixdb/asterix-runtime/src/main/java/org/apache/asterix/runtime/evaluators/constructors/ABinaryBase64StringConstructorDescriptor.java b/asterixdb/asterix-runtime/src/main/java/org/apache/asterix/runtime/evaluators/constructors/ABinaryBase64StringConstructorDescriptor.java
index 3f2f68a..479d603 100644
--- a/asterixdb/asterix-runtime/src/main/java/org/apache/asterix/runtime/evaluators/constructors/ABinaryBase64StringConstructorDescriptor.java
+++ b/asterixdb/asterix-runtime/src/main/java/org/apache/asterix/runtime/evaluators/constructors/ABinaryBase64StringConstructorDescriptor.java
@@ -28,6 +28,7 @@
 import org.apache.hyracks.algebricks.runtime.base.IScalarEvaluator;
 import org.apache.hyracks.algebricks.runtime.base.IScalarEvaluatorFactory;
 import org.apache.hyracks.api.exceptions.HyracksDataException;
+import org.apache.hyracks.api.exceptions.SourceLocation;
 import org.apache.hyracks.data.std.primitive.UTF8StringPointable;
 import org.apache.hyracks.util.bytes.Base64Parser;
 
@@ -43,27 +44,7 @@
 
             @Override
             public IScalarEvaluator createScalarEvaluator(IEvaluatorContext ctx) throws HyracksDataException {
-                return new AbstractBinaryConstructorEvaluator(ctx, args[0].createScalarEvaluator(ctx), sourceLoc) {
-
-                    private final Base64Parser parser = new Base64Parser();
-
-                    @Override
-                    protected boolean parseBinary(UTF8StringPointable textPtr, AMutableBinary result) {
-                        try {
-                            parser.generatePureByteArrayFromBase64String(textPtr.getByteArray(),
-                                    textPtr.getCharStartOffset(), textPtr.getUTF8Length());
-                        } catch (IllegalArgumentException e) {
-                            return false;
-                        }
-                        result.setValue(parser.getByteArray(), 0, parser.getLength());
-                        return true;
-                    }
-
-                    @Override
-                    protected FunctionIdentifier getIdentifier() {
-                        return ABinaryBase64StringConstructorDescriptor.this.getIdentifier();
-                    }
-                };
+                return new ABinaryBase64StringConstructorEvaluator(ctx, args[0].createScalarEvaluator(ctx), sourceLoc);
             }
         };
     }
@@ -72,4 +53,31 @@
     public FunctionIdentifier getIdentifier() {
         return BuiltinFunctions.BINARY_BASE64_CONSTRUCTOR;
     }
+
+    protected static class ABinaryBase64StringConstructorEvaluator extends AbstractBinaryConstructorEvaluator {
+
+        private final Base64Parser parser = new Base64Parser();
+
+        protected ABinaryBase64StringConstructorEvaluator(IEvaluatorContext ctx, IScalarEvaluator inputEval,
+                SourceLocation sourceLoc) {
+            super(ctx, inputEval, sourceLoc);
+        }
+
+        @Override
+        protected boolean parseBinary(UTF8StringPointable textPtr, AMutableBinary result) {
+            try {
+                parser.generatePureByteArrayFromBase64String(textPtr.getByteArray(), textPtr.getCharStartOffset(),
+                        textPtr.getUTF8Length());
+            } catch (IllegalArgumentException e) {
+                return false;
+            }
+            result.setValue(parser.getByteArray(), 0, parser.getLength());
+            return true;
+        }
+
+        @Override
+        protected FunctionIdentifier getIdentifier() {
+            return BuiltinFunctions.BINARY_BASE64_CONSTRUCTOR;
+        }
+    }
 }
diff --git a/asterixdb/asterix-runtime/src/main/java/org/apache/asterix/runtime/evaluators/constructors/ABinaryBase64StringDefaultNullConstructorDescriptor.java b/asterixdb/asterix-runtime/src/main/java/org/apache/asterix/runtime/evaluators/constructors/ABinaryBase64StringDefaultNullConstructorDescriptor.java
new file mode 100644
index 0000000..7b51e90
--- /dev/null
+++ b/asterixdb/asterix-runtime/src/main/java/org/apache/asterix/runtime/evaluators/constructors/ABinaryBase64StringDefaultNullConstructorDescriptor.java
@@ -0,0 +1,66 @@
+/*
+ * 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 org.apache.asterix.common.annotations.MissingNullInOutFunction;
+import org.apache.asterix.om.functions.BuiltinFunctions;
+import org.apache.asterix.om.functions.IFunctionDescriptorFactory;
+import org.apache.asterix.runtime.evaluators.base.AbstractScalarFunctionDynamicDescriptor;
+import org.apache.asterix.runtime.evaluators.functions.PointableHelper;
+import org.apache.hyracks.algebricks.core.algebra.functions.FunctionIdentifier;
+import org.apache.hyracks.algebricks.runtime.base.IEvaluatorContext;
+import org.apache.hyracks.algebricks.runtime.base.IScalarEvaluator;
+import org.apache.hyracks.algebricks.runtime.base.IScalarEvaluatorFactory;
+import org.apache.hyracks.api.exceptions.HyracksDataException;
+import org.apache.hyracks.data.std.api.IPointable;
+
+@MissingNullInOutFunction
+public class ABinaryBase64StringDefaultNullConstructorDescriptor extends AbstractScalarFunctionDynamicDescriptor {
+    private static final long serialVersionUID = 1L;
+    public static final IFunctionDescriptorFactory FACTORY = ABinaryBase64StringDefaultNullConstructorDescriptor::new;
+
+    @Override
+    public IScalarEvaluatorFactory createEvaluatorFactory(final IScalarEvaluatorFactory[] args) {
+        return new IScalarEvaluatorFactory() {
+            private static final long serialVersionUID = 1L;
+
+            @Override
+            public IScalarEvaluator createScalarEvaluator(IEvaluatorContext ctx) throws HyracksDataException {
+                return new ABinaryBase64StringConstructorDescriptor.ABinaryBase64StringConstructorEvaluator(ctx,
+                        args[0].createScalarEvaluator(ctx), sourceLoc) {
+
+                    @Override
+                    protected boolean checkAndSetMissingOrNull(IPointable result) throws HyracksDataException {
+                        return PointableHelper.checkAndSetNull(result, inputArg);
+                    }
+
+                    @Override
+                    protected FunctionIdentifier getIdentifier() {
+                        return ABinaryBase64StringDefaultNullConstructorDescriptor.this.getIdentifier();
+                    }
+                };
+            }
+        };
+    }
+
+    @Override
+    public FunctionIdentifier getIdentifier() {
+        return BuiltinFunctions.BINARY_BASE64_DEFAULT_NULL_CONSTRUCTOR;
+    }
+}
diff --git a/asterixdb/asterix-runtime/src/main/java/org/apache/asterix/runtime/evaluators/constructors/ABooleanDefaultNullConstructorDescriptor.java b/asterixdb/asterix-runtime/src/main/java/org/apache/asterix/runtime/evaluators/constructors/ABooleanDefaultNullConstructorDescriptor.java
new file mode 100644
index 0000000..ecc3896
--- /dev/null
+++ b/asterixdb/asterix-runtime/src/main/java/org/apache/asterix/runtime/evaluators/constructors/ABooleanDefaultNullConstructorDescriptor.java
@@ -0,0 +1,64 @@
+/*
+ * 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 org.apache.asterix.common.annotations.MissingNullInOutFunction;
+import org.apache.asterix.om.functions.BuiltinFunctions;
+import org.apache.asterix.om.functions.IFunctionDescriptorFactory;
+import org.apache.asterix.runtime.evaluators.base.AbstractScalarFunctionDynamicDescriptor;
+import org.apache.asterix.runtime.evaluators.functions.PointableHelper;
+import org.apache.hyracks.algebricks.core.algebra.functions.FunctionIdentifier;
+import org.apache.hyracks.algebricks.runtime.base.IEvaluatorContext;
+import org.apache.hyracks.algebricks.runtime.base.IScalarEvaluator;
+import org.apache.hyracks.algebricks.runtime.base.IScalarEvaluatorFactory;
+import org.apache.hyracks.api.exceptions.HyracksDataException;
+import org.apache.hyracks.data.std.api.IPointable;
+
+@MissingNullInOutFunction
+public class ABooleanDefaultNullConstructorDescriptor extends AbstractScalarFunctionDynamicDescriptor {
+    private static final long serialVersionUID = 1L;
+    public static final IFunctionDescriptorFactory FACTORY = ABooleanDefaultNullConstructorDescriptor::new;
+
+    @Override
+    public IScalarEvaluatorFactory createEvaluatorFactory(final IScalarEvaluatorFactory[] args) {
+        return new IScalarEvaluatorFactory() {
+            private static final long serialVersionUID = 1L;
+
+            @Override
+            public IScalarEvaluator createScalarEvaluator(IEvaluatorContext ctx) throws HyracksDataException {
+                return new AbstractBooleanConstructorEvaluator(ctx, args[0].createScalarEvaluator(ctx), sourceLoc) {
+                    @Override
+                    protected FunctionIdentifier getIdentifier() {
+                        return ABooleanDefaultNullConstructorDescriptor.this.getIdentifier();
+                    }
+
+                    @Override
+                    protected boolean checkAndSetMissingOrNull(IPointable result) throws HyracksDataException {
+                        return PointableHelper.checkAndSetNull(result, inputArg);
+                    }
+                };
+            }
+        };
+    }
+
+    @Override
+    public FunctionIdentifier getIdentifier() {
+        return BuiltinFunctions.BOOLEAN_DEFAULT_NULL_CONSTRUCTOR;
+    }
+}
diff --git a/asterixdb/asterix-runtime/src/main/java/org/apache/asterix/runtime/evaluators/constructors/ADateConstructorWithFormatDescriptor.java b/asterixdb/asterix-runtime/src/main/java/org/apache/asterix/runtime/evaluators/constructors/ADateConstructorWithFormatDescriptor.java
index 9d51f12..29cb552 100644
--- a/asterixdb/asterix-runtime/src/main/java/org/apache/asterix/runtime/evaluators/constructors/ADateConstructorWithFormatDescriptor.java
+++ b/asterixdb/asterix-runtime/src/main/java/org/apache/asterix/runtime/evaluators/constructors/ADateConstructorWithFormatDescriptor.java
@@ -20,36 +20,19 @@
 package org.apache.asterix.runtime.evaluators.constructors;
 
 import org.apache.asterix.common.annotations.MissingNullInOutFunction;
-import org.apache.asterix.om.base.AMutableDate;
-import org.apache.asterix.om.base.AMutableInt64;
-import org.apache.asterix.om.base.temporal.AsterixTemporalTypeParseException;
-import org.apache.asterix.om.base.temporal.DateTimeFormatUtils;
-import org.apache.asterix.om.base.temporal.GregorianCalendarSystem;
 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.runtime.evaluators.base.AbstractScalarFunctionDynamicDescriptor;
-import org.apache.asterix.runtime.evaluators.functions.PointableHelper;
 import org.apache.hyracks.algebricks.core.algebra.functions.FunctionIdentifier;
 import org.apache.hyracks.algebricks.runtime.base.IEvaluatorContext;
 import org.apache.hyracks.algebricks.runtime.base.IScalarEvaluator;
 import org.apache.hyracks.algebricks.runtime.base.IScalarEvaluatorFactory;
 import org.apache.hyracks.api.exceptions.HyracksDataException;
-import org.apache.hyracks.data.std.api.IPointable;
-import org.apache.hyracks.data.std.primitive.UTF8StringPointable;
-import org.apache.hyracks.data.std.primitive.VoidPointable;
-import org.apache.hyracks.dataflow.common.data.accessors.IFrameTupleReference;
 
 @MissingNullInOutFunction
 public class ADateConstructorWithFormatDescriptor extends AbstractScalarFunctionDynamicDescriptor {
     private static final long serialVersionUID = 1L;
-    public static final IFunctionDescriptorFactory FACTORY = new IFunctionDescriptorFactory() {
-        @Override
-        public IFunctionDescriptor createFunctionDescriptor() {
-            return new ADateConstructorWithFormatDescriptor();
-        }
-    };
+    public static final IFunctionDescriptorFactory FACTORY = ADateConstructorWithFormatDescriptor::new;
 
     @Override
     public IScalarEvaluatorFactory createEvaluatorFactory(final IScalarEvaluatorFactory[] args) {
@@ -58,48 +41,7 @@
 
             @Override
             public IScalarEvaluator createScalarEvaluator(IEvaluatorContext ctx) throws HyracksDataException {
-                return new AbstractDateConstructorEvaluator(ctx, args[0].createScalarEvaluator(ctx), sourceLoc) {
-
-                    private final IScalarEvaluator formatEval = args[1].createScalarEvaluator(ctx);
-                    private final IPointable formatArg = new VoidPointable();
-                    private final UTF8StringPointable formatTextPtr = new UTF8StringPointable();
-                    private final AMutableInt64 aInt64 = new AMutableInt64(0);
-
-                    @Override
-                    protected void evaluateInput(IFrameTupleReference tuple) throws HyracksDataException {
-                        super.evaluateInput(tuple);
-                        formatEval.evaluate(tuple, formatArg);
-                    }
-
-                    @Override
-                    protected boolean checkAndSetMissingOrNull(IPointable result) throws HyracksDataException {
-                        return PointableHelper.checkAndSetMissingOrNull(result, inputArg, formatArg);
-                    }
-
-                    @Override
-                    protected boolean parseDate(UTF8StringPointable textPtr, AMutableDate result) {
-                        byte[] formatBytes = formatArg.getByteArray();
-                        int formatStartOffset = formatArg.getStartOffset();
-                        int formatLength = formatArg.getLength();
-                        if (formatBytes[formatStartOffset] != ATypeTag.SERIALIZED_STRING_TYPE_TAG) {
-                            return false;
-                        }
-                        formatTextPtr.set(formatBytes, formatStartOffset + 1, formatLength - 1);
-                        try {
-                            if (DateTimeFormatUtils.getInstance().parseDateTime(aInt64, textPtr.getByteArray(),
-                                    textPtr.getCharStartOffset(), textPtr.getUTF8Length(), formatBytes,
-                                    formatTextPtr.getCharStartOffset(), formatTextPtr.getUTF8Length(),
-                                    DateTimeFormatUtils.DateTimeParseMode.DATE_ONLY, false)) {
-                                result.setValue((int) (aInt64.getLongValue() / GregorianCalendarSystem.CHRONON_OF_DAY));
-                                return true;
-                            } else {
-                                return false;
-                            }
-                        } catch (AsterixTemporalTypeParseException e) {
-                            // shouldn't happen
-                            return false;
-                        }
-                    }
+                return new AbstractDateConstructorWithFormatEvaluator(ctx, args, sourceLoc) {
 
                     @Override
                     protected FunctionIdentifier getIdentifier() {
diff --git a/asterixdb/asterix-runtime/src/main/java/org/apache/asterix/runtime/evaluators/constructors/ADateDefaultNullConstructorDescriptor.java b/asterixdb/asterix-runtime/src/main/java/org/apache/asterix/runtime/evaluators/constructors/ADateDefaultNullConstructorDescriptor.java
new file mode 100644
index 0000000..4508e9a
--- /dev/null
+++ b/asterixdb/asterix-runtime/src/main/java/org/apache/asterix/runtime/evaluators/constructors/ADateDefaultNullConstructorDescriptor.java
@@ -0,0 +1,65 @@
+/*
+ * 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 org.apache.asterix.common.annotations.MissingNullInOutFunction;
+import org.apache.asterix.om.functions.BuiltinFunctions;
+import org.apache.asterix.om.functions.IFunctionDescriptorFactory;
+import org.apache.asterix.runtime.evaluators.base.AbstractScalarFunctionDynamicDescriptor;
+import org.apache.asterix.runtime.evaluators.functions.PointableHelper;
+import org.apache.hyracks.algebricks.core.algebra.functions.FunctionIdentifier;
+import org.apache.hyracks.algebricks.runtime.base.IEvaluatorContext;
+import org.apache.hyracks.algebricks.runtime.base.IScalarEvaluator;
+import org.apache.hyracks.algebricks.runtime.base.IScalarEvaluatorFactory;
+import org.apache.hyracks.api.exceptions.HyracksDataException;
+import org.apache.hyracks.data.std.api.IPointable;
+
+@MissingNullInOutFunction
+public class ADateDefaultNullConstructorDescriptor extends AbstractScalarFunctionDynamicDescriptor {
+    private static final long serialVersionUID = 1L;
+    public static final IFunctionDescriptorFactory FACTORY = ADateDefaultNullConstructorDescriptor::new;
+
+    @Override
+    public IScalarEvaluatorFactory createEvaluatorFactory(final IScalarEvaluatorFactory[] args) {
+        return new IScalarEvaluatorFactory() {
+            private static final long serialVersionUID = 1L;
+
+            @Override
+            public IScalarEvaluator createScalarEvaluator(IEvaluatorContext ctx) throws HyracksDataException {
+                return new AbstractDateConstructorEvaluator(ctx, args[0].createScalarEvaluator(ctx), sourceLoc) {
+
+                    @Override
+                    protected FunctionIdentifier getIdentifier() {
+                        return ADateDefaultNullConstructorDescriptor.this.getIdentifier();
+                    }
+
+                    @Override
+                    protected boolean checkAndSetMissingOrNull(IPointable result) throws HyracksDataException {
+                        return PointableHelper.checkAndSetNull(result, inputArg);
+                    }
+                };
+            }
+        };
+    }
+
+    @Override
+    public FunctionIdentifier getIdentifier() {
+        return BuiltinFunctions.DATE_DEFAULT_NULL_CONSTRUCTOR;
+    }
+}
diff --git a/asterixdb/asterix-runtime/src/main/java/org/apache/asterix/runtime/evaluators/constructors/ADateDefaultNullConstructorWithFormatDescriptor.java b/asterixdb/asterix-runtime/src/main/java/org/apache/asterix/runtime/evaluators/constructors/ADateDefaultNullConstructorWithFormatDescriptor.java
new file mode 100644
index 0000000..ad67677
--- /dev/null
+++ b/asterixdb/asterix-runtime/src/main/java/org/apache/asterix/runtime/evaluators/constructors/ADateDefaultNullConstructorWithFormatDescriptor.java
@@ -0,0 +1,69 @@
+/*
+ * 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 org.apache.asterix.common.annotations.MissingNullInOutFunction;
+import org.apache.asterix.om.functions.BuiltinFunctions;
+import org.apache.asterix.om.functions.IFunctionDescriptorFactory;
+import org.apache.asterix.runtime.evaluators.base.AbstractScalarFunctionDynamicDescriptor;
+import org.apache.asterix.runtime.evaluators.functions.PointableHelper;
+import org.apache.hyracks.algebricks.core.algebra.functions.FunctionIdentifier;
+import org.apache.hyracks.algebricks.runtime.base.IEvaluatorContext;
+import org.apache.hyracks.algebricks.runtime.base.IScalarEvaluator;
+import org.apache.hyracks.algebricks.runtime.base.IScalarEvaluatorFactory;
+import org.apache.hyracks.api.exceptions.HyracksDataException;
+import org.apache.hyracks.data.std.api.IPointable;
+
+@MissingNullInOutFunction
+public class ADateDefaultNullConstructorWithFormatDescriptor extends AbstractScalarFunctionDynamicDescriptor {
+    private static final long serialVersionUID = 1L;
+    public static final IFunctionDescriptorFactory FACTORY = ADateDefaultNullConstructorWithFormatDescriptor::new;
+
+    @Override
+    public IScalarEvaluatorFactory createEvaluatorFactory(final IScalarEvaluatorFactory[] args) {
+        return new IScalarEvaluatorFactory() {
+            private static final long serialVersionUID = 1L;
+
+            @Override
+            public IScalarEvaluator createScalarEvaluator(IEvaluatorContext ctx) throws HyracksDataException {
+                return new AbstractDateConstructorWithFormatEvaluator(ctx, args, sourceLoc) {
+
+                    @Override
+                    protected FunctionIdentifier getIdentifier() {
+                        return ADateDefaultNullConstructorWithFormatDescriptor.this.getIdentifier();
+                    }
+
+                    @Override
+                    protected boolean checkAndSetMissingOrNull(IPointable result) throws HyracksDataException {
+                        if (PointableHelper.checkAndSetNull(result, inputArg)) {
+                            return true;
+                        }
+                        return super.checkAndSetMissingOrNull(result);
+                    }
+                };
+            }
+        };
+    }
+
+    @Override
+    public FunctionIdentifier getIdentifier() {
+        return BuiltinFunctions.DATE_DEFAULT_NULL_CONSTRUCTOR_WITH_FORMAT;
+    }
+}
diff --git a/asterixdb/asterix-runtime/src/main/java/org/apache/asterix/runtime/evaluators/constructors/ADateTimeConstructorWithFormatDescriptor.java b/asterixdb/asterix-runtime/src/main/java/org/apache/asterix/runtime/evaluators/constructors/ADateTimeConstructorWithFormatDescriptor.java
index 715a7df..af8bba4 100644
--- a/asterixdb/asterix-runtime/src/main/java/org/apache/asterix/runtime/evaluators/constructors/ADateTimeConstructorWithFormatDescriptor.java
+++ b/asterixdb/asterix-runtime/src/main/java/org/apache/asterix/runtime/evaluators/constructors/ADateTimeConstructorWithFormatDescriptor.java
@@ -19,34 +19,18 @@
 
 package org.apache.asterix.runtime.evaluators.constructors;
 
-import org.apache.asterix.om.base.AMutableDateTime;
-import org.apache.asterix.om.base.AMutableInt64;
-import org.apache.asterix.om.base.temporal.AsterixTemporalTypeParseException;
-import org.apache.asterix.om.base.temporal.DateTimeFormatUtils;
 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.runtime.evaluators.base.AbstractScalarFunctionDynamicDescriptor;
-import org.apache.asterix.runtime.evaluators.functions.PointableHelper;
 import org.apache.hyracks.algebricks.core.algebra.functions.FunctionIdentifier;
 import org.apache.hyracks.algebricks.runtime.base.IEvaluatorContext;
 import org.apache.hyracks.algebricks.runtime.base.IScalarEvaluator;
 import org.apache.hyracks.algebricks.runtime.base.IScalarEvaluatorFactory;
 import org.apache.hyracks.api.exceptions.HyracksDataException;
-import org.apache.hyracks.data.std.api.IPointable;
-import org.apache.hyracks.data.std.primitive.UTF8StringPointable;
-import org.apache.hyracks.data.std.primitive.VoidPointable;
-import org.apache.hyracks.dataflow.common.data.accessors.IFrameTupleReference;
 
 public class ADateTimeConstructorWithFormatDescriptor extends AbstractScalarFunctionDynamicDescriptor {
     private static final long serialVersionUID = 1L;
-    public static final IFunctionDescriptorFactory FACTORY = new IFunctionDescriptorFactory() {
-        @Override
-        public IFunctionDescriptor createFunctionDescriptor() {
-            return new ADateTimeConstructorWithFormatDescriptor();
-        }
-    };
+    public static final IFunctionDescriptorFactory FACTORY = ADateTimeConstructorWithFormatDescriptor::new;
 
     @Override
     public IScalarEvaluatorFactory createEvaluatorFactory(final IScalarEvaluatorFactory[] args) {
@@ -55,48 +39,7 @@
 
             @Override
             public IScalarEvaluator createScalarEvaluator(IEvaluatorContext ctx) throws HyracksDataException {
-                return new AbstractDateTimeConstructorEvaluator(ctx, args[0].createScalarEvaluator(ctx), sourceLoc) {
-
-                    private final IScalarEvaluator formatEval = args[1].createScalarEvaluator(ctx);
-                    private final IPointable formatArg = new VoidPointable();
-                    private final UTF8StringPointable formatTextPtr = new UTF8StringPointable();
-                    private final AMutableInt64 aInt64 = new AMutableInt64(0);
-
-                    @Override
-                    protected void evaluateInput(IFrameTupleReference tuple) throws HyracksDataException {
-                        super.evaluateInput(tuple);
-                        formatEval.evaluate(tuple, formatArg);
-                    }
-
-                    @Override
-                    protected boolean checkAndSetMissingOrNull(IPointable result) throws HyracksDataException {
-                        return PointableHelper.checkAndSetMissingOrNull(result, inputArg, formatArg);
-                    }
-
-                    @Override
-                    protected boolean parseDateTime(UTF8StringPointable textPtr, AMutableDateTime result) {
-                        byte[] formatBytes = formatArg.getByteArray();
-                        int formatStartOffset = formatArg.getStartOffset();
-                        int formatLength = formatArg.getLength();
-                        if (formatBytes[formatStartOffset] != ATypeTag.SERIALIZED_STRING_TYPE_TAG) {
-                            return false;
-                        }
-                        formatTextPtr.set(formatBytes, formatStartOffset + 1, formatLength - 1);
-                        try {
-                            if (DateTimeFormatUtils.getInstance().parseDateTime(aInt64, textPtr.getByteArray(),
-                                    textPtr.getCharStartOffset(), textPtr.getUTF8Length(), formatBytes,
-                                    formatTextPtr.getCharStartOffset(), formatTextPtr.getUTF8Length(),
-                                    DateTimeFormatUtils.DateTimeParseMode.DATETIME, false)) {
-                                result.setValue(aInt64.getLongValue());
-                                return true;
-                            } else {
-                                return false;
-                            }
-                        } catch (AsterixTemporalTypeParseException e) {
-                            // shouldn't happen
-                            return false;
-                        }
-                    }
+                return new AbstractDateTimeConstructorWithFormatEvaluator(ctx, args, sourceLoc) {
 
                     @Override
                     protected FunctionIdentifier getIdentifier() {
diff --git a/asterixdb/asterix-runtime/src/main/java/org/apache/asterix/runtime/evaluators/constructors/ADateTimeDefaultNullConstructorDescriptor.java b/asterixdb/asterix-runtime/src/main/java/org/apache/asterix/runtime/evaluators/constructors/ADateTimeDefaultNullConstructorDescriptor.java
new file mode 100644
index 0000000..92c0a78
--- /dev/null
+++ b/asterixdb/asterix-runtime/src/main/java/org/apache/asterix/runtime/evaluators/constructors/ADateTimeDefaultNullConstructorDescriptor.java
@@ -0,0 +1,65 @@
+/*
+ * 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 org.apache.asterix.common.annotations.MissingNullInOutFunction;
+import org.apache.asterix.om.functions.BuiltinFunctions;
+import org.apache.asterix.om.functions.IFunctionDescriptorFactory;
+import org.apache.asterix.runtime.evaluators.base.AbstractScalarFunctionDynamicDescriptor;
+import org.apache.asterix.runtime.evaluators.functions.PointableHelper;
+import org.apache.hyracks.algebricks.core.algebra.functions.FunctionIdentifier;
+import org.apache.hyracks.algebricks.runtime.base.IEvaluatorContext;
+import org.apache.hyracks.algebricks.runtime.base.IScalarEvaluator;
+import org.apache.hyracks.algebricks.runtime.base.IScalarEvaluatorFactory;
+import org.apache.hyracks.api.exceptions.HyracksDataException;
+import org.apache.hyracks.data.std.api.IPointable;
+
+@MissingNullInOutFunction
+public class ADateTimeDefaultNullConstructorDescriptor extends AbstractScalarFunctionDynamicDescriptor {
+    private static final long serialVersionUID = 1L;
+    public static final IFunctionDescriptorFactory FACTORY = ADateTimeDefaultNullConstructorDescriptor::new;
+
+    @Override
+    public IScalarEvaluatorFactory createEvaluatorFactory(final IScalarEvaluatorFactory[] args) {
+        return new IScalarEvaluatorFactory() {
+            private static final long serialVersionUID = 1L;
+
+            @Override
+            public IScalarEvaluator createScalarEvaluator(IEvaluatorContext ctx) throws HyracksDataException {
+                return new AbstractDateTimeConstructorEvaluator(ctx, args[0].createScalarEvaluator(ctx), sourceLoc) {
+
+                    @Override
+                    protected FunctionIdentifier getIdentifier() {
+                        return ADateTimeDefaultNullConstructorDescriptor.this.getIdentifier();
+                    }
+
+                    @Override
+                    protected boolean checkAndSetMissingOrNull(IPointable result) throws HyracksDataException {
+                        return PointableHelper.checkAndSetNull(result, inputArg);
+                    }
+                };
+            }
+        };
+    }
+
+    @Override
+    public FunctionIdentifier getIdentifier() {
+        return BuiltinFunctions.DATETIME_DEFAULT_NULL_CONSTRUCTOR;
+    }
+}
diff --git a/asterixdb/asterix-runtime/src/main/java/org/apache/asterix/runtime/evaluators/constructors/ADateTimeDefaultNullConstructorWithFormatDescriptor.java b/asterixdb/asterix-runtime/src/main/java/org/apache/asterix/runtime/evaluators/constructors/ADateTimeDefaultNullConstructorWithFormatDescriptor.java
new file mode 100644
index 0000000..8b2269b
--- /dev/null
+++ b/asterixdb/asterix-runtime/src/main/java/org/apache/asterix/runtime/evaluators/constructors/ADateTimeDefaultNullConstructorWithFormatDescriptor.java
@@ -0,0 +1,67 @@
+/*
+ * 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 org.apache.asterix.om.functions.BuiltinFunctions;
+import org.apache.asterix.om.functions.IFunctionDescriptorFactory;
+import org.apache.asterix.runtime.evaluators.base.AbstractScalarFunctionDynamicDescriptor;
+import org.apache.asterix.runtime.evaluators.functions.PointableHelper;
+import org.apache.hyracks.algebricks.core.algebra.functions.FunctionIdentifier;
+import org.apache.hyracks.algebricks.runtime.base.IEvaluatorContext;
+import org.apache.hyracks.algebricks.runtime.base.IScalarEvaluator;
+import org.apache.hyracks.algebricks.runtime.base.IScalarEvaluatorFactory;
+import org.apache.hyracks.api.exceptions.HyracksDataException;
+import org.apache.hyracks.data.std.api.IPointable;
+
+public class ADateTimeDefaultNullConstructorWithFormatDescriptor extends AbstractScalarFunctionDynamicDescriptor {
+    private static final long serialVersionUID = 1L;
+    public static final IFunctionDescriptorFactory FACTORY = ADateTimeDefaultNullConstructorWithFormatDescriptor::new;
+
+    @Override
+    public IScalarEvaluatorFactory createEvaluatorFactory(final IScalarEvaluatorFactory[] args) {
+        return new IScalarEvaluatorFactory() {
+            private static final long serialVersionUID = 1L;
+
+            @Override
+            public IScalarEvaluator createScalarEvaluator(IEvaluatorContext ctx) throws HyracksDataException {
+                return new AbstractDateTimeConstructorWithFormatEvaluator(ctx, args, sourceLoc) {
+
+                    @Override
+                    protected FunctionIdentifier getIdentifier() {
+                        return ADateTimeDefaultNullConstructorWithFormatDescriptor.this.getIdentifier();
+                    }
+
+                    @Override
+                    protected boolean checkAndSetMissingOrNull(IPointable result) throws HyracksDataException {
+                        if (PointableHelper.checkAndSetNull(result, inputArg)) {
+                            return true;
+                        }
+                        return super.checkAndSetMissingOrNull(result);
+                    }
+                };
+            }
+        };
+    }
+
+    @Override
+    public FunctionIdentifier getIdentifier() {
+        return BuiltinFunctions.DATETIME_DEFAULT_NULL_CONSTRUCTOR_WITH_FORMAT;
+    }
+}
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 6178bc9..a961bf9 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
@@ -19,26 +19,14 @@
 package org.apache.asterix.runtime.evaluators.constructors;
 
 import org.apache.asterix.common.annotations.MissingNullInOutFunction;
-import org.apache.asterix.dataflow.data.nontagged.serde.ADurationSerializerDeserializer;
-import org.apache.asterix.formats.nontagged.SerializerDeserializerProvider;
-import org.apache.asterix.om.base.ADayTimeDuration;
-import org.apache.asterix.om.base.AMutableDayTimeDuration;
-import org.apache.asterix.om.base.temporal.ADurationParserFactory;
-import org.apache.asterix.om.base.temporal.ADurationParserFactory.ADurationParseOption;
 import org.apache.asterix.om.functions.BuiltinFunctions;
 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.om.types.EnumDeserializer;
 import org.apache.asterix.runtime.evaluators.base.AbstractScalarFunctionDynamicDescriptor;
 import org.apache.hyracks.algebricks.core.algebra.functions.FunctionIdentifier;
 import org.apache.hyracks.algebricks.runtime.base.IEvaluatorContext;
 import org.apache.hyracks.algebricks.runtime.base.IScalarEvaluator;
 import org.apache.hyracks.algebricks.runtime.base.IScalarEvaluatorFactory;
-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.UTF8StringPointable;
 
 @MissingNullInOutFunction
 public class ADayTimeDurationConstructorDescriptor extends AbstractScalarFunctionDynamicDescriptor {
@@ -53,52 +41,8 @@
 
             @Override
             public IScalarEvaluator createScalarEvaluator(IEvaluatorContext ctx) throws HyracksDataException {
-                return new AbstractConstructorEvaluator(ctx, args[0].createScalarEvaluator(ctx), sourceLoc) {
-
-                    private final AMutableDayTimeDuration aDayTimeDuration = new AMutableDayTimeDuration(0);
-                    @SuppressWarnings("unchecked")
-                    private final ISerializerDeserializer<ADayTimeDuration> dayTimeDurationSerde =
-                            SerializerDeserializerProvider.INSTANCE
-                                    .getSerializerDeserializer(BuiltinType.ADAYTIMEDURATION);
-                    private final UTF8StringPointable utf8Ptr = new UTF8StringPointable();
-
-                    @Override
-                    protected void evaluateImpl(IPointable result) throws HyracksDataException {
-                        byte[] bytes = inputArg.getByteArray();
-                        int startOffset = inputArg.getStartOffset();
-                        int len = inputArg.getLength();
-                        ATypeTag inputType = EnumDeserializer.ATYPETAGDESERIALIZER.deserialize(bytes[startOffset]);
-                        switch (inputType) {
-                            case DAYTIMEDURATION:
-                                result.set(inputArg);
-                                break;
-                            case DURATION:
-                                long millis = ADurationSerializerDeserializer.getDayTime(bytes, startOffset + 1);
-                                aDayTimeDuration.setMilliseconds(millis);
-                                resultStorage.reset();
-                                dayTimeDurationSerde.serialize(aDayTimeDuration, out);
-                                result.set(resultStorage);
-                                break;
-                            case STRING:
-                                utf8Ptr.set(bytes, startOffset + 1, len - 1);
-                                if (parseDayTimeDuration(utf8Ptr, aDayTimeDuration)) {
-                                    resultStorage.reset();
-                                    dayTimeDurationSerde.serialize(aDayTimeDuration, out);
-                                    result.set(resultStorage);
-                                } else {
-                                    handleParseError(utf8Ptr, result);
-                                }
-                                break;
-                            default:
-                                handleUnsupportedType(inputType, result);
-                                break;
-                        }
-                    }
-
-                    @Override
-                    protected BuiltinType getTargetType() {
-                        return BuiltinType.ADAYTIMEDURATION;
-                    }
+                return new AbstractDayTimeDurationConstructorEvaluator(ctx, args[0].createScalarEvaluator(ctx),
+                        sourceLoc) {
 
                     @Override
                     protected FunctionIdentifier getIdentifier() {
@@ -109,16 +53,6 @@
         };
     }
 
-    private static boolean parseDayTimeDuration(UTF8StringPointable textPtr, ADayTimeDuration result) {
-        try {
-            ADurationParserFactory.parseDuration(textPtr.getByteArray(), textPtr.getCharStartOffset(),
-                    textPtr.getUTF8Length(), result, ADurationParseOption.DAY_TIME);
-            return true;
-        } catch (HyracksDataException e) {
-            return false;
-        }
-    }
-
     @Override
     public FunctionIdentifier getIdentifier() {
         return BuiltinFunctions.DAY_TIME_DURATION_CONSTRUCTOR;
diff --git a/asterixdb/asterix-runtime/src/main/java/org/apache/asterix/runtime/evaluators/constructors/ADayTimeDurationDefaultNullConstructorDescriptor.java b/asterixdb/asterix-runtime/src/main/java/org/apache/asterix/runtime/evaluators/constructors/ADayTimeDurationDefaultNullConstructorDescriptor.java
new file mode 100644
index 0000000..97c41f3
--- /dev/null
+++ b/asterixdb/asterix-runtime/src/main/java/org/apache/asterix/runtime/evaluators/constructors/ADayTimeDurationDefaultNullConstructorDescriptor.java
@@ -0,0 +1,67 @@
+/*
+ * 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 org.apache.asterix.common.annotations.MissingNullInOutFunction;
+import org.apache.asterix.om.functions.BuiltinFunctions;
+import org.apache.asterix.om.functions.IFunctionDescriptorFactory;
+import org.apache.asterix.runtime.evaluators.base.AbstractScalarFunctionDynamicDescriptor;
+import org.apache.asterix.runtime.evaluators.functions.PointableHelper;
+import org.apache.hyracks.algebricks.core.algebra.functions.FunctionIdentifier;
+import org.apache.hyracks.algebricks.runtime.base.IEvaluatorContext;
+import org.apache.hyracks.algebricks.runtime.base.IScalarEvaluator;
+import org.apache.hyracks.algebricks.runtime.base.IScalarEvaluatorFactory;
+import org.apache.hyracks.api.exceptions.HyracksDataException;
+import org.apache.hyracks.data.std.api.IPointable;
+
+@MissingNullInOutFunction
+public class ADayTimeDurationDefaultNullConstructorDescriptor extends AbstractScalarFunctionDynamicDescriptor {
+
+    private static final long serialVersionUID = 1L;
+    public static final IFunctionDescriptorFactory FACTORY = ADayTimeDurationDefaultNullConstructorDescriptor::new;
+
+    @Override
+    public IScalarEvaluatorFactory createEvaluatorFactory(final IScalarEvaluatorFactory[] args) {
+        return new IScalarEvaluatorFactory() {
+            private static final long serialVersionUID = 1L;
+
+            @Override
+            public IScalarEvaluator createScalarEvaluator(IEvaluatorContext ctx) throws HyracksDataException {
+                return new AbstractDayTimeDurationConstructorEvaluator(ctx, args[0].createScalarEvaluator(ctx),
+                        sourceLoc) {
+
+                    @Override
+                    protected FunctionIdentifier getIdentifier() {
+                        return ADayTimeDurationDefaultNullConstructorDescriptor.this.getIdentifier();
+                    }
+
+                    @Override
+                    protected boolean checkAndSetMissingOrNull(IPointable result) throws HyracksDataException {
+                        return PointableHelper.checkAndSetNull(result, inputArg);
+                    }
+                };
+            }
+        };
+    }
+
+    @Override
+    public FunctionIdentifier getIdentifier() {
+        return BuiltinFunctions.DAY_TIME_DURATION_DEFAULT_NULL_CONSTRUCTOR;
+    }
+}
diff --git a/asterixdb/asterix-runtime/src/main/java/org/apache/asterix/runtime/evaluators/constructors/ADoubleDefaultNullConstructorDescriptor.java b/asterixdb/asterix-runtime/src/main/java/org/apache/asterix/runtime/evaluators/constructors/ADoubleDefaultNullConstructorDescriptor.java
new file mode 100644
index 0000000..92be7de
--- /dev/null
+++ b/asterixdb/asterix-runtime/src/main/java/org/apache/asterix/runtime/evaluators/constructors/ADoubleDefaultNullConstructorDescriptor.java
@@ -0,0 +1,65 @@
+/*
+ * 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 org.apache.asterix.common.annotations.MissingNullInOutFunction;
+import org.apache.asterix.om.functions.BuiltinFunctions;
+import org.apache.asterix.om.functions.IFunctionDescriptorFactory;
+import org.apache.asterix.runtime.evaluators.base.AbstractScalarFunctionDynamicDescriptor;
+import org.apache.asterix.runtime.evaluators.functions.PointableHelper;
+import org.apache.hyracks.algebricks.core.algebra.functions.FunctionIdentifier;
+import org.apache.hyracks.algebricks.runtime.base.IEvaluatorContext;
+import org.apache.hyracks.algebricks.runtime.base.IScalarEvaluator;
+import org.apache.hyracks.algebricks.runtime.base.IScalarEvaluatorFactory;
+import org.apache.hyracks.api.exceptions.HyracksDataException;
+import org.apache.hyracks.data.std.api.IPointable;
+
+@MissingNullInOutFunction
+public class ADoubleDefaultNullConstructorDescriptor extends AbstractScalarFunctionDynamicDescriptor {
+    private static final long serialVersionUID = 1L;
+    public static final IFunctionDescriptorFactory FACTORY = ADoubleDefaultNullConstructorDescriptor::new;
+
+    @Override
+    public IScalarEvaluatorFactory createEvaluatorFactory(final IScalarEvaluatorFactory[] args) {
+        return new IScalarEvaluatorFactory() {
+            private static final long serialVersionUID = 1L;
+
+            @Override
+            public IScalarEvaluator createScalarEvaluator(IEvaluatorContext ctx) throws HyracksDataException {
+                return new AbstractDoubleConstructorEvaluator(ctx, args[0].createScalarEvaluator(ctx), sourceLoc) {
+
+                    @Override
+                    protected FunctionIdentifier getIdentifier() {
+                        return ADoubleDefaultNullConstructorDescriptor.this.getIdentifier();
+                    }
+
+                    @Override
+                    protected boolean checkAndSetMissingOrNull(IPointable result) throws HyracksDataException {
+                        return PointableHelper.checkAndSetNull(result, inputArg);
+                    }
+                };
+            }
+        };
+    }
+
+    @Override
+    public FunctionIdentifier getIdentifier() {
+        return BuiltinFunctions.DOUBLE_DEFAULT_NULL_CONSTRUCTOR;
+    }
+}
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 6a14031..67742c2 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
@@ -19,27 +19,14 @@
 package org.apache.asterix.runtime.evaluators.constructors;
 
 import org.apache.asterix.common.annotations.MissingNullInOutFunction;
-import org.apache.asterix.dataflow.data.nontagged.serde.ADayTimeDurationSerializerDeserializer;
-import org.apache.asterix.dataflow.data.nontagged.serde.AYearMonthDurationSerializerDeserializer;
-import org.apache.asterix.formats.nontagged.SerializerDeserializerProvider;
-import org.apache.asterix.om.base.ADuration;
-import org.apache.asterix.om.base.AMutableDuration;
-import org.apache.asterix.om.base.temporal.ADurationParserFactory;
-import org.apache.asterix.om.base.temporal.ADurationParserFactory.ADurationParseOption;
 import org.apache.asterix.om.functions.BuiltinFunctions;
 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.om.types.EnumDeserializer;
 import org.apache.asterix.runtime.evaluators.base.AbstractScalarFunctionDynamicDescriptor;
 import org.apache.hyracks.algebricks.core.algebra.functions.FunctionIdentifier;
 import org.apache.hyracks.algebricks.runtime.base.IEvaluatorContext;
 import org.apache.hyracks.algebricks.runtime.base.IScalarEvaluator;
 import org.apache.hyracks.algebricks.runtime.base.IScalarEvaluatorFactory;
-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.UTF8StringPointable;
 
 @MissingNullInOutFunction
 public class ADurationConstructorDescriptor extends AbstractScalarFunctionDynamicDescriptor {
@@ -53,59 +40,7 @@
 
             @Override
             public IScalarEvaluator createScalarEvaluator(IEvaluatorContext ctx) throws HyracksDataException {
-                return new AbstractConstructorEvaluator(ctx, args[0].createScalarEvaluator(ctx), sourceLoc) {
-
-                    private final AMutableDuration aDuration = new AMutableDuration(0, 0);
-                    @SuppressWarnings("unchecked")
-                    private final ISerializerDeserializer<ADuration> durationSerde =
-                            SerializerDeserializerProvider.INSTANCE.getSerializerDeserializer(BuiltinType.ADURATION);
-                    private final UTF8StringPointable utf8Ptr = new UTF8StringPointable();
-
-                    @Override
-                    protected void evaluateImpl(IPointable result) throws HyracksDataException {
-                        byte[] bytes = inputArg.getByteArray();
-                        int startOffset = inputArg.getStartOffset();
-                        int len = inputArg.getLength();
-                        ATypeTag inputType = EnumDeserializer.ATYPETAGDESERIALIZER.deserialize(bytes[startOffset]);
-                        switch (inputType) {
-                            case DURATION:
-                                result.set(inputArg);
-                                break;
-                            case YEARMONTHDURATION:
-                                int months =
-                                        AYearMonthDurationSerializerDeserializer.getYearMonth(bytes, startOffset + 1);
-                                aDuration.setValue(months, 0);
-                                resultStorage.reset();
-                                durationSerde.serialize(aDuration, out);
-                                result.set(resultStorage);
-                                break;
-                            case DAYTIMEDURATION:
-                                long millis = ADayTimeDurationSerializerDeserializer.getDayTime(bytes, startOffset + 1);
-                                aDuration.setValue(0, millis);
-                                resultStorage.reset();
-                                durationSerde.serialize(aDuration, out);
-                                result.set(resultStorage);
-                                break;
-                            case STRING:
-                                utf8Ptr.set(bytes, startOffset + 1, len - 1);
-                                if (parseDuration(utf8Ptr, aDuration)) {
-                                    resultStorage.reset();
-                                    durationSerde.serialize(aDuration, out);
-                                    result.set(resultStorage);
-                                } else {
-                                    handleParseError(utf8Ptr, result);
-                                }
-                                break;
-                            default:
-                                handleUnsupportedType(inputType, result);
-                                break;
-                        }
-                    }
-
-                    @Override
-                    protected BuiltinType getTargetType() {
-                        return BuiltinType.ADURATION;
-                    }
+                return new AbstractDurationConstructorEvaluator(ctx, args[0].createScalarEvaluator(ctx), sourceLoc) {
 
                     @Override
                     protected FunctionIdentifier getIdentifier() {
@@ -116,16 +51,6 @@
         };
     }
 
-    private static boolean parseDuration(UTF8StringPointable textPtr, ADuration result) {
-        try {
-            ADurationParserFactory.parseDuration(textPtr.getByteArray(), textPtr.getCharStartOffset(),
-                    textPtr.getUTF8Length(), result, ADurationParseOption.All);
-            return true;
-        } catch (HyracksDataException e) {
-            return false;
-        }
-    }
-
     @Override
     public FunctionIdentifier getIdentifier() {
         return BuiltinFunctions.DURATION_CONSTRUCTOR;
diff --git a/asterixdb/asterix-runtime/src/main/java/org/apache/asterix/runtime/evaluators/constructors/ADurationDefaultNullConstructorDescriptor.java b/asterixdb/asterix-runtime/src/main/java/org/apache/asterix/runtime/evaluators/constructors/ADurationDefaultNullConstructorDescriptor.java
new file mode 100644
index 0000000..3a0ccf1
--- /dev/null
+++ b/asterixdb/asterix-runtime/src/main/java/org/apache/asterix/runtime/evaluators/constructors/ADurationDefaultNullConstructorDescriptor.java
@@ -0,0 +1,65 @@
+/*
+ * 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 org.apache.asterix.common.annotations.MissingNullInOutFunction;
+import org.apache.asterix.om.functions.BuiltinFunctions;
+import org.apache.asterix.om.functions.IFunctionDescriptorFactory;
+import org.apache.asterix.runtime.evaluators.base.AbstractScalarFunctionDynamicDescriptor;
+import org.apache.asterix.runtime.evaluators.functions.PointableHelper;
+import org.apache.hyracks.algebricks.core.algebra.functions.FunctionIdentifier;
+import org.apache.hyracks.algebricks.runtime.base.IEvaluatorContext;
+import org.apache.hyracks.algebricks.runtime.base.IScalarEvaluator;
+import org.apache.hyracks.algebricks.runtime.base.IScalarEvaluatorFactory;
+import org.apache.hyracks.api.exceptions.HyracksDataException;
+import org.apache.hyracks.data.std.api.IPointable;
+
+@MissingNullInOutFunction
+public class ADurationDefaultNullConstructorDescriptor extends AbstractScalarFunctionDynamicDescriptor {
+    private static final long serialVersionUID = 1L;
+    public static final IFunctionDescriptorFactory FACTORY = ADurationDefaultNullConstructorDescriptor::new;
+
+    @Override
+    public IScalarEvaluatorFactory createEvaluatorFactory(final IScalarEvaluatorFactory[] args) {
+        return new IScalarEvaluatorFactory() {
+            private static final long serialVersionUID = 1L;
+
+            @Override
+            public IScalarEvaluator createScalarEvaluator(IEvaluatorContext ctx) throws HyracksDataException {
+                return new AbstractDurationConstructorEvaluator(ctx, args[0].createScalarEvaluator(ctx), sourceLoc) {
+
+                    @Override
+                    protected FunctionIdentifier getIdentifier() {
+                        return ADurationDefaultNullConstructorDescriptor.this.getIdentifier();
+                    }
+
+                    @Override
+                    protected boolean checkAndSetMissingOrNull(IPointable result) throws HyracksDataException {
+                        return PointableHelper.checkAndSetNull(result, inputArg);
+                    }
+                };
+            }
+        };
+    }
+
+    @Override
+    public FunctionIdentifier getIdentifier() {
+        return BuiltinFunctions.DURATION_DEFAULT_NULL_CONSTRUCTOR;
+    }
+}
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 0d443c7..ccd71b9 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
@@ -18,29 +18,15 @@
  */
 package org.apache.asterix.runtime.evaluators.constructors;
 
-import java.io.IOException;
-
 import org.apache.asterix.common.annotations.MissingNullInOutFunction;
-import org.apache.asterix.dataflow.data.nontagged.serde.ABooleanSerializerDeserializer;
-import org.apache.asterix.formats.nontagged.SerializerDeserializerProvider;
-import org.apache.asterix.om.base.AFloat;
-import org.apache.asterix.om.base.AMutableFloat;
 import org.apache.asterix.om.functions.BuiltinFunctions;
 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.om.types.EnumDeserializer;
-import org.apache.asterix.om.types.hierachy.ATypeHierarchy;
 import org.apache.asterix.runtime.evaluators.base.AbstractScalarFunctionDynamicDescriptor;
-import org.apache.asterix.runtime.evaluators.common.NumberUtils;
 import org.apache.hyracks.algebricks.core.algebra.functions.FunctionIdentifier;
 import org.apache.hyracks.algebricks.runtime.base.IEvaluatorContext;
 import org.apache.hyracks.algebricks.runtime.base.IScalarEvaluator;
 import org.apache.hyracks.algebricks.runtime.base.IScalarEvaluatorFactory;
-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.UTF8StringPointable;
 
 @MissingNullInOutFunction
 public class AFloatConstructorDescriptor extends AbstractScalarFunctionDynamicDescriptor {
@@ -54,74 +40,7 @@
 
             @Override
             public IScalarEvaluator createScalarEvaluator(IEvaluatorContext ctx) throws HyracksDataException {
-                return new AbstractConstructorEvaluator(ctx, args[0].createScalarEvaluator(ctx), sourceLoc) {
-
-                    private final AMutableFloat aFloat = new AMutableFloat(0);
-                    @SuppressWarnings("unchecked")
-                    private final ISerializerDeserializer<AFloat> floatSerde =
-                            SerializerDeserializerProvider.INSTANCE.getSerializerDeserializer(BuiltinType.AFLOAT);
-                    private final UTF8StringPointable utf8Ptr = new UTF8StringPointable();
-
-                    @Override
-                    protected void evaluateImpl(IPointable result) throws HyracksDataException {
-                        byte[] bytes = inputArg.getByteArray();
-                        int startOffset = inputArg.getStartOffset();
-                        int len = inputArg.getLength();
-                        ATypeTag inputType = EnumDeserializer.ATYPETAGDESERIALIZER.deserialize(bytes[startOffset]);
-                        switch (inputType) {
-                            case FLOAT:
-                                result.set(inputArg);
-                                break;
-                            case TINYINT:
-                            case SMALLINT:
-                            case INTEGER:
-                            case BIGINT:
-                                resultStorage.reset();
-                                try {
-                                    ATypeHierarchy.getTypePromoteComputer(inputType, ATypeTag.FLOAT).convertType(bytes,
-                                            startOffset + 1, len - 1, out);
-                                } catch (IOException e) {
-                                    throw HyracksDataException.create(e);
-                                }
-                                result.set(resultStorage);
-                                break;
-                            case DOUBLE:
-                                resultStorage.reset();
-                                try {
-                                    ATypeHierarchy.getTypeDemoteComputer(inputType, ATypeTag.FLOAT, false)
-                                            .convertType(bytes, startOffset + 1, len - 1, out);
-                                } catch (IOException e) {
-                                    throw HyracksDataException.create(e);
-                                }
-                                result.set(resultStorage);
-                                break;
-                            case BOOLEAN:
-                                boolean b = ABooleanSerializerDeserializer.getBoolean(bytes, startOffset + 1);
-                                aFloat.setValue(b ? 1 : 0);
-                                resultStorage.reset();
-                                floatSerde.serialize(aFloat, out);
-                                result.set(resultStorage);
-                                break;
-                            case STRING:
-                                utf8Ptr.set(bytes, startOffset + 1, len - 1);
-                                if (NumberUtils.parseFloat(utf8Ptr, aFloat)) {
-                                    resultStorage.reset();
-                                    floatSerde.serialize(aFloat, out);
-                                    result.set(resultStorage);
-                                } else {
-                                    handleParseError(utf8Ptr, result);
-                                }
-                                break;
-                            default:
-                                handleUnsupportedType(inputType, result);
-                                break;
-                        }
-                    }
-
-                    @Override
-                    protected BuiltinType getTargetType() {
-                        return BuiltinType.AFLOAT;
-                    }
+                return new AbstractFloatConstructorEvaluator(ctx, args[0].createScalarEvaluator(ctx), sourceLoc) {
 
                     @Override
                     protected FunctionIdentifier getIdentifier() {
diff --git a/asterixdb/asterix-runtime/src/main/java/org/apache/asterix/runtime/evaluators/constructors/AFloatDefaultNullConstructorDescriptor.java b/asterixdb/asterix-runtime/src/main/java/org/apache/asterix/runtime/evaluators/constructors/AFloatDefaultNullConstructorDescriptor.java
new file mode 100644
index 0000000..c1abb94
--- /dev/null
+++ b/asterixdb/asterix-runtime/src/main/java/org/apache/asterix/runtime/evaluators/constructors/AFloatDefaultNullConstructorDescriptor.java
@@ -0,0 +1,65 @@
+/*
+ * 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 org.apache.asterix.common.annotations.MissingNullInOutFunction;
+import org.apache.asterix.om.functions.BuiltinFunctions;
+import org.apache.asterix.om.functions.IFunctionDescriptorFactory;
+import org.apache.asterix.runtime.evaluators.base.AbstractScalarFunctionDynamicDescriptor;
+import org.apache.asterix.runtime.evaluators.functions.PointableHelper;
+import org.apache.hyracks.algebricks.core.algebra.functions.FunctionIdentifier;
+import org.apache.hyracks.algebricks.runtime.base.IEvaluatorContext;
+import org.apache.hyracks.algebricks.runtime.base.IScalarEvaluator;
+import org.apache.hyracks.algebricks.runtime.base.IScalarEvaluatorFactory;
+import org.apache.hyracks.api.exceptions.HyracksDataException;
+import org.apache.hyracks.data.std.api.IPointable;
+
+@MissingNullInOutFunction
+public class AFloatDefaultNullConstructorDescriptor extends AbstractScalarFunctionDynamicDescriptor {
+    private static final long serialVersionUID = 1L;
+    public static final IFunctionDescriptorFactory FACTORY = AFloatDefaultNullConstructorDescriptor::new;
+
+    @Override
+    public IScalarEvaluatorFactory createEvaluatorFactory(final IScalarEvaluatorFactory[] args) {
+        return new IScalarEvaluatorFactory() {
+            private static final long serialVersionUID = 1L;
+
+            @Override
+            public IScalarEvaluator createScalarEvaluator(IEvaluatorContext ctx) throws HyracksDataException {
+                return new AbstractFloatConstructorEvaluator(ctx, args[0].createScalarEvaluator(ctx), sourceLoc) {
+
+                    @Override
+                    protected FunctionIdentifier getIdentifier() {
+                        return AFloatDefaultNullConstructorDescriptor.this.getIdentifier();
+                    }
+
+                    @Override
+                    protected boolean checkAndSetMissingOrNull(IPointable result) throws HyracksDataException {
+                        return PointableHelper.checkAndSetNull(result, inputArg);
+                    }
+                };
+            }
+        };
+    }
+
+    @Override
+    public FunctionIdentifier getIdentifier() {
+        return BuiltinFunctions.FLOAT_DEFAULT_NULL_CONSTRUCTOR;
+    }
+}
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 f8f1537..87f377e 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
@@ -18,29 +18,15 @@
  */
 package org.apache.asterix.runtime.evaluators.constructors;
 
-import java.io.IOException;
-
 import org.apache.asterix.common.annotations.MissingNullInOutFunction;
-import org.apache.asterix.dataflow.data.nontagged.serde.ABooleanSerializerDeserializer;
-import org.apache.asterix.formats.nontagged.SerializerDeserializerProvider;
-import org.apache.asterix.om.base.AInt16;
-import org.apache.asterix.om.base.AMutableInt16;
 import org.apache.asterix.om.functions.BuiltinFunctions;
 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.om.types.EnumDeserializer;
-import org.apache.asterix.om.types.hierachy.ATypeHierarchy;
 import org.apache.asterix.runtime.evaluators.base.AbstractScalarFunctionDynamicDescriptor;
-import org.apache.asterix.runtime.evaluators.common.NumberUtils;
 import org.apache.hyracks.algebricks.core.algebra.functions.FunctionIdentifier;
 import org.apache.hyracks.algebricks.runtime.base.IEvaluatorContext;
 import org.apache.hyracks.algebricks.runtime.base.IScalarEvaluator;
 import org.apache.hyracks.algebricks.runtime.base.IScalarEvaluatorFactory;
-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.UTF8StringPointable;
 
 @MissingNullInOutFunction
 public class AInt16ConstructorDescriptor extends AbstractScalarFunctionDynamicDescriptor {
@@ -55,74 +41,7 @@
 
             @Override
             public IScalarEvaluator createScalarEvaluator(IEvaluatorContext ctx) throws HyracksDataException {
-                return new AbstractConstructorEvaluator(ctx, args[0].createScalarEvaluator(ctx), sourceLoc) {
-
-                    private final AMutableInt16 aInt16 = new AMutableInt16((short) 0);
-                    @SuppressWarnings("unchecked")
-                    private final ISerializerDeserializer<AInt16> int16Serde =
-                            SerializerDeserializerProvider.INSTANCE.getSerializerDeserializer(BuiltinType.AINT16);
-                    private final UTF8StringPointable utf8Ptr = new UTF8StringPointable();
-
-                    @Override
-                    protected void evaluateImpl(IPointable result) throws HyracksDataException {
-                        byte[] bytes = inputArg.getByteArray();
-                        int startOffset = inputArg.getStartOffset();
-                        int len = inputArg.getLength();
-                        ATypeTag inputType = EnumDeserializer.ATYPETAGDESERIALIZER.deserialize(bytes[startOffset]);
-                        switch (inputType) {
-                            case SMALLINT:
-                                result.set(inputArg);
-                                break;
-                            case TINYINT:
-                                resultStorage.reset();
-                                try {
-                                    ATypeHierarchy.getTypePromoteComputer(inputType, ATypeTag.SMALLINT)
-                                            .convertType(bytes, startOffset + 1, len - 1, out);
-                                } catch (IOException e) {
-                                    throw HyracksDataException.create(e);
-                                }
-                                result.set(resultStorage);
-                                break;
-                            case INTEGER:
-                            case BIGINT:
-                            case FLOAT:
-                            case DOUBLE:
-                                resultStorage.reset();
-                                try {
-                                    ATypeHierarchy.getTypeDemoteComputer(inputType, ATypeTag.SMALLINT, false)
-                                            .convertType(bytes, startOffset + 1, len - 1, out);
-                                } catch (IOException e) {
-                                    throw HyracksDataException.create(e);
-                                }
-                                result.set(resultStorage);
-                                break;
-                            case BOOLEAN:
-                                boolean b = ABooleanSerializerDeserializer.getBoolean(bytes, startOffset + 1);
-                                aInt16.setValue((short) (b ? 1 : 0));
-                                resultStorage.reset();
-                                int16Serde.serialize(aInt16, out);
-                                result.set(resultStorage);
-                                break;
-                            case STRING:
-                                utf8Ptr.set(bytes, startOffset + 1, len - 1);
-                                if (NumberUtils.parseInt16(utf8Ptr, aInt16)) {
-                                    resultStorage.reset();
-                                    int16Serde.serialize(aInt16, out);
-                                    result.set(resultStorage);
-                                } else {
-                                    handleParseError(utf8Ptr, result);
-                                }
-                                break;
-                            default:
-                                handleUnsupportedType(inputType, result);
-                                break;
-                        }
-                    }
-
-                    @Override
-                    protected BuiltinType getTargetType() {
-                        return BuiltinType.AINT16;
-                    }
+                return new AbstractInt16ConstructorEvaluator(ctx, args[0].createScalarEvaluator(ctx), sourceLoc) {
 
                     @Override
                     protected FunctionIdentifier getIdentifier() {
diff --git a/asterixdb/asterix-runtime/src/main/java/org/apache/asterix/runtime/evaluators/constructors/AInt16DefaultNullConstructorDescriptor.java b/asterixdb/asterix-runtime/src/main/java/org/apache/asterix/runtime/evaluators/constructors/AInt16DefaultNullConstructorDescriptor.java
new file mode 100644
index 0000000..0ebb7b2
--- /dev/null
+++ b/asterixdb/asterix-runtime/src/main/java/org/apache/asterix/runtime/evaluators/constructors/AInt16DefaultNullConstructorDescriptor.java
@@ -0,0 +1,65 @@
+/*
+ * 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 org.apache.asterix.common.annotations.MissingNullInOutFunction;
+import org.apache.asterix.om.functions.BuiltinFunctions;
+import org.apache.asterix.om.functions.IFunctionDescriptorFactory;
+import org.apache.asterix.runtime.evaluators.base.AbstractScalarFunctionDynamicDescriptor;
+import org.apache.asterix.runtime.evaluators.functions.PointableHelper;
+import org.apache.hyracks.algebricks.core.algebra.functions.FunctionIdentifier;
+import org.apache.hyracks.algebricks.runtime.base.IEvaluatorContext;
+import org.apache.hyracks.algebricks.runtime.base.IScalarEvaluator;
+import org.apache.hyracks.algebricks.runtime.base.IScalarEvaluatorFactory;
+import org.apache.hyracks.api.exceptions.HyracksDataException;
+import org.apache.hyracks.data.std.api.IPointable;
+
+@MissingNullInOutFunction
+public class AInt16DefaultNullConstructorDescriptor extends AbstractScalarFunctionDynamicDescriptor {
+    private static final long serialVersionUID = 1L;
+    public static final IFunctionDescriptorFactory FACTORY = AInt16DefaultNullConstructorDescriptor::new;
+
+    @Override
+    public IScalarEvaluatorFactory createEvaluatorFactory(final IScalarEvaluatorFactory[] args) {
+        return new IScalarEvaluatorFactory() {
+            private static final long serialVersionUID = 1L;
+
+            @Override
+            public IScalarEvaluator createScalarEvaluator(IEvaluatorContext ctx) throws HyracksDataException {
+                return new AbstractInt16ConstructorEvaluator(ctx, args[0].createScalarEvaluator(ctx), sourceLoc) {
+
+                    @Override
+                    protected FunctionIdentifier getIdentifier() {
+                        return AInt16DefaultNullConstructorDescriptor.this.getIdentifier();
+                    }
+
+                    @Override
+                    protected boolean checkAndSetMissingOrNull(IPointable result) throws HyracksDataException {
+                        return PointableHelper.checkAndSetNull(result, inputArg);
+                    }
+                };
+            }
+        };
+    }
+
+    @Override
+    public FunctionIdentifier getIdentifier() {
+        return BuiltinFunctions.INT16_DEFAULT_NULL_CONSTRUCTOR;
+    }
+}
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 da1d3ba..d9c13ab 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
@@ -18,29 +18,15 @@
  */
 package org.apache.asterix.runtime.evaluators.constructors;
 
-import java.io.IOException;
-
 import org.apache.asterix.common.annotations.MissingNullInOutFunction;
-import org.apache.asterix.dataflow.data.nontagged.serde.ABooleanSerializerDeserializer;
-import org.apache.asterix.formats.nontagged.SerializerDeserializerProvider;
-import org.apache.asterix.om.base.AInt32;
-import org.apache.asterix.om.base.AMutableInt32;
 import org.apache.asterix.om.functions.BuiltinFunctions;
 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.om.types.EnumDeserializer;
-import org.apache.asterix.om.types.hierachy.ATypeHierarchy;
 import org.apache.asterix.runtime.evaluators.base.AbstractScalarFunctionDynamicDescriptor;
-import org.apache.asterix.runtime.evaluators.common.NumberUtils;
 import org.apache.hyracks.algebricks.core.algebra.functions.FunctionIdentifier;
 import org.apache.hyracks.algebricks.runtime.base.IEvaluatorContext;
 import org.apache.hyracks.algebricks.runtime.base.IScalarEvaluator;
 import org.apache.hyracks.algebricks.runtime.base.IScalarEvaluatorFactory;
-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.UTF8StringPointable;
 
 @MissingNullInOutFunction
 public class AInt32ConstructorDescriptor extends AbstractScalarFunctionDynamicDescriptor {
@@ -54,74 +40,7 @@
 
             @Override
             public IScalarEvaluator createScalarEvaluator(IEvaluatorContext ctx) throws HyracksDataException {
-                return new AbstractConstructorEvaluator(ctx, args[0].createScalarEvaluator(ctx), sourceLoc) {
-
-                    private final AMutableInt32 aInt32 = new AMutableInt32(0);
-                    @SuppressWarnings("unchecked")
-                    private final ISerializerDeserializer<AInt32> int32Serde =
-                            SerializerDeserializerProvider.INSTANCE.getSerializerDeserializer(BuiltinType.AINT32);
-                    private final UTF8StringPointable utf8Ptr = new UTF8StringPointable();
-
-                    @Override
-                    protected void evaluateImpl(IPointable result) throws HyracksDataException {
-                        byte[] bytes = inputArg.getByteArray();
-                        int startOffset = inputArg.getStartOffset();
-                        int len = inputArg.getLength();
-                        ATypeTag inputType = EnumDeserializer.ATYPETAGDESERIALIZER.deserialize(bytes[startOffset]);
-                        switch (inputType) {
-                            case INTEGER:
-                                result.set(inputArg);
-                                break;
-                            case TINYINT:
-                            case SMALLINT:
-                                resultStorage.reset();
-                                try {
-                                    ATypeHierarchy.getTypePromoteComputer(inputType, ATypeTag.INTEGER)
-                                            .convertType(bytes, startOffset + 1, len - 1, out);
-                                } catch (IOException e) {
-                                    throw HyracksDataException.create(e);
-                                }
-                                result.set(resultStorage);
-                                break;
-                            case BIGINT:
-                            case FLOAT:
-                            case DOUBLE:
-                                resultStorage.reset();
-                                try {
-                                    ATypeHierarchy.getTypeDemoteComputer(inputType, ATypeTag.INTEGER, false)
-                                            .convertType(bytes, startOffset + 1, len - 1, out);
-                                } catch (IOException e) {
-                                    throw HyracksDataException.create(e);
-                                }
-                                result.set(resultStorage);
-                                break;
-                            case BOOLEAN:
-                                boolean b = ABooleanSerializerDeserializer.getBoolean(bytes, startOffset + 1);
-                                aInt32.setValue(b ? 1 : 0);
-                                resultStorage.reset();
-                                int32Serde.serialize(aInt32, out);
-                                result.set(resultStorage);
-                                break;
-                            case STRING:
-                                utf8Ptr.set(bytes, startOffset + 1, len - 1);
-                                if (NumberUtils.parseInt32(utf8Ptr, aInt32)) {
-                                    resultStorage.reset();
-                                    int32Serde.serialize(aInt32, out);
-                                    result.set(resultStorage);
-                                } else {
-                                    handleParseError(utf8Ptr, result);
-                                }
-                                break;
-                            default:
-                                handleUnsupportedType(inputType, result);
-                                break;
-                        }
-                    }
-
-                    @Override
-                    protected BuiltinType getTargetType() {
-                        return BuiltinType.AINT32;
-                    }
+                return new AbstractInt32ConstructorEvaluator(ctx, args[0].createScalarEvaluator(ctx), sourceLoc) {
 
                     @Override
                     protected FunctionIdentifier getIdentifier() {
diff --git a/asterixdb/asterix-runtime/src/main/java/org/apache/asterix/runtime/evaluators/constructors/AInt32DefaultNullConstructorDescriptor.java b/asterixdb/asterix-runtime/src/main/java/org/apache/asterix/runtime/evaluators/constructors/AInt32DefaultNullConstructorDescriptor.java
new file mode 100644
index 0000000..2f64596
--- /dev/null
+++ b/asterixdb/asterix-runtime/src/main/java/org/apache/asterix/runtime/evaluators/constructors/AInt32DefaultNullConstructorDescriptor.java
@@ -0,0 +1,65 @@
+/*
+ * 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 org.apache.asterix.common.annotations.MissingNullInOutFunction;
+import org.apache.asterix.om.functions.BuiltinFunctions;
+import org.apache.asterix.om.functions.IFunctionDescriptorFactory;
+import org.apache.asterix.runtime.evaluators.base.AbstractScalarFunctionDynamicDescriptor;
+import org.apache.asterix.runtime.evaluators.functions.PointableHelper;
+import org.apache.hyracks.algebricks.core.algebra.functions.FunctionIdentifier;
+import org.apache.hyracks.algebricks.runtime.base.IEvaluatorContext;
+import org.apache.hyracks.algebricks.runtime.base.IScalarEvaluator;
+import org.apache.hyracks.algebricks.runtime.base.IScalarEvaluatorFactory;
+import org.apache.hyracks.api.exceptions.HyracksDataException;
+import org.apache.hyracks.data.std.api.IPointable;
+
+@MissingNullInOutFunction
+public class AInt32DefaultNullConstructorDescriptor extends AbstractScalarFunctionDynamicDescriptor {
+    private static final long serialVersionUID = 1L;
+    public static final IFunctionDescriptorFactory FACTORY = AInt32DefaultNullConstructorDescriptor::new;
+
+    @Override
+    public IScalarEvaluatorFactory createEvaluatorFactory(final IScalarEvaluatorFactory[] args) {
+        return new IScalarEvaluatorFactory() {
+            private static final long serialVersionUID = 1L;
+
+            @Override
+            public IScalarEvaluator createScalarEvaluator(IEvaluatorContext ctx) throws HyracksDataException {
+                return new AbstractInt32ConstructorEvaluator(ctx, args[0].createScalarEvaluator(ctx), sourceLoc) {
+
+                    @Override
+                    protected FunctionIdentifier getIdentifier() {
+                        return AInt32DefaultNullConstructorDescriptor.this.getIdentifier();
+                    }
+
+                    @Override
+                    protected boolean checkAndSetMissingOrNull(IPointable result) throws HyracksDataException {
+                        return PointableHelper.checkAndSetNull(result, inputArg);
+                    }
+                };
+            }
+        };
+    }
+
+    @Override
+    public FunctionIdentifier getIdentifier() {
+        return BuiltinFunctions.INT32_DEFAULT_NULL_CONSTRUCTOR;
+    }
+}
diff --git a/asterixdb/asterix-runtime/src/main/java/org/apache/asterix/runtime/evaluators/constructors/AInt64DefaultNullConstructorDescriptor.java b/asterixdb/asterix-runtime/src/main/java/org/apache/asterix/runtime/evaluators/constructors/AInt64DefaultNullConstructorDescriptor.java
new file mode 100644
index 0000000..5e833b3
--- /dev/null
+++ b/asterixdb/asterix-runtime/src/main/java/org/apache/asterix/runtime/evaluators/constructors/AInt64DefaultNullConstructorDescriptor.java
@@ -0,0 +1,64 @@
+/*
+ * 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 org.apache.asterix.common.annotations.MissingNullInOutFunction;
+import org.apache.asterix.om.functions.BuiltinFunctions;
+import org.apache.asterix.om.functions.IFunctionDescriptorFactory;
+import org.apache.asterix.runtime.evaluators.base.AbstractScalarFunctionDynamicDescriptor;
+import org.apache.asterix.runtime.evaluators.functions.PointableHelper;
+import org.apache.hyracks.algebricks.core.algebra.functions.FunctionIdentifier;
+import org.apache.hyracks.algebricks.runtime.base.IEvaluatorContext;
+import org.apache.hyracks.algebricks.runtime.base.IScalarEvaluator;
+import org.apache.hyracks.algebricks.runtime.base.IScalarEvaluatorFactory;
+import org.apache.hyracks.api.exceptions.HyracksDataException;
+import org.apache.hyracks.data.std.api.IPointable;
+
+@MissingNullInOutFunction
+public class AInt64DefaultNullConstructorDescriptor extends AbstractScalarFunctionDynamicDescriptor {
+    private static final long serialVersionUID = 1L;
+    public static final IFunctionDescriptorFactory FACTORY = AInt64DefaultNullConstructorDescriptor::new;
+
+    @Override
+    public IScalarEvaluatorFactory createEvaluatorFactory(final IScalarEvaluatorFactory[] args) {
+        return new IScalarEvaluatorFactory() {
+            private static final long serialVersionUID = 1L;
+
+            @Override
+            public IScalarEvaluator createScalarEvaluator(IEvaluatorContext ctx) throws HyracksDataException {
+                return new AbstractInt64ConstructorEvaluator(ctx, args[0].createScalarEvaluator(ctx), sourceLoc) {
+                    @Override
+                    public FunctionIdentifier getIdentifier() {
+                        return AInt64DefaultNullConstructorDescriptor.this.getIdentifier();
+                    }
+
+                    @Override
+                    protected boolean checkAndSetMissingOrNull(IPointable result) throws HyracksDataException {
+                        return PointableHelper.checkAndSetNull(result, inputArg);
+                    }
+                };
+            }
+        };
+    }
+
+    @Override
+    public FunctionIdentifier getIdentifier() {
+        return BuiltinFunctions.INT64_DEFAULT_NULL_CONSTRUCTOR;
+    }
+}
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 2305eef..425623a 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
@@ -18,29 +18,15 @@
  */
 package org.apache.asterix.runtime.evaluators.constructors;
 
-import java.io.IOException;
-
 import org.apache.asterix.common.annotations.MissingNullInOutFunction;
-import org.apache.asterix.dataflow.data.nontagged.serde.ABooleanSerializerDeserializer;
-import org.apache.asterix.formats.nontagged.SerializerDeserializerProvider;
-import org.apache.asterix.om.base.AInt8;
-import org.apache.asterix.om.base.AMutableInt8;
 import org.apache.asterix.om.functions.BuiltinFunctions;
 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.om.types.EnumDeserializer;
-import org.apache.asterix.om.types.hierachy.ATypeHierarchy;
 import org.apache.asterix.runtime.evaluators.base.AbstractScalarFunctionDynamicDescriptor;
-import org.apache.asterix.runtime.evaluators.common.NumberUtils;
 import org.apache.hyracks.algebricks.core.algebra.functions.FunctionIdentifier;
 import org.apache.hyracks.algebricks.runtime.base.IEvaluatorContext;
 import org.apache.hyracks.algebricks.runtime.base.IScalarEvaluator;
 import org.apache.hyracks.algebricks.runtime.base.IScalarEvaluatorFactory;
-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.UTF8StringPointable;
 
 @MissingNullInOutFunction
 public class AInt8ConstructorDescriptor extends AbstractScalarFunctionDynamicDescriptor {
@@ -54,65 +40,7 @@
 
             @Override
             public IScalarEvaluator createScalarEvaluator(IEvaluatorContext ctx) throws HyracksDataException {
-                return new AbstractConstructorEvaluator(ctx, args[0].createScalarEvaluator(ctx), sourceLoc) {
-
-                    private final AMutableInt8 aInt8 = new AMutableInt8((byte) 0);
-                    @SuppressWarnings("unchecked")
-                    private final ISerializerDeserializer<AInt8> int8Serde =
-                            SerializerDeserializerProvider.INSTANCE.getSerializerDeserializer(BuiltinType.AINT8);
-                    private final UTF8StringPointable utf8Ptr = new UTF8StringPointable();
-
-                    @Override
-                    protected void evaluateImpl(IPointable result) throws HyracksDataException {
-                        byte[] bytes = inputArg.getByteArray();
-                        int startOffset = inputArg.getStartOffset();
-                        int len = inputArg.getLength();
-                        ATypeTag inputType = EnumDeserializer.ATYPETAGDESERIALIZER.deserialize(bytes[startOffset]);
-                        switch (inputType) {
-                            case TINYINT:
-                                result.set(inputArg);
-                                break;
-                            case SMALLINT:
-                            case INTEGER:
-                            case BIGINT:
-                            case FLOAT:
-                            case DOUBLE:
-                                resultStorage.reset();
-                                try {
-                                    ATypeHierarchy.getTypeDemoteComputer(inputType, ATypeTag.TINYINT, false)
-                                            .convertType(bytes, startOffset + 1, len - 1, out);
-                                } catch (IOException e) {
-                                    throw HyracksDataException.create(e);
-                                }
-                                result.set(resultStorage);
-                                break;
-                            case BOOLEAN:
-                                boolean b = ABooleanSerializerDeserializer.getBoolean(bytes, startOffset + 1);
-                                aInt8.setValue((byte) (b ? 1 : 0));
-                                resultStorage.reset();
-                                int8Serde.serialize(aInt8, out);
-                                result.set(resultStorage);
-                                break;
-                            case STRING:
-                                utf8Ptr.set(bytes, startOffset + 1, len - 1);
-                                if (NumberUtils.parseInt8(utf8Ptr, aInt8)) {
-                                    resultStorage.reset();
-                                    int8Serde.serialize(aInt8, out);
-                                    result.set(resultStorage);
-                                } else {
-                                    handleParseError(utf8Ptr, result);
-                                }
-                                break;
-                            default:
-                                handleUnsupportedType(inputType, result);
-                                break;
-                        }
-                    }
-
-                    @Override
-                    protected BuiltinType getTargetType() {
-                        return BuiltinType.AINT8;
-                    }
+                return new AbstractInt8ConstructorEvaluator(ctx, args[0].createScalarEvaluator(ctx), sourceLoc) {
 
                     @Override
                     protected FunctionIdentifier getIdentifier() {
diff --git a/asterixdb/asterix-runtime/src/main/java/org/apache/asterix/runtime/evaluators/constructors/AInt8DefaultNullConstructorDescriptor.java b/asterixdb/asterix-runtime/src/main/java/org/apache/asterix/runtime/evaluators/constructors/AInt8DefaultNullConstructorDescriptor.java
new file mode 100644
index 0000000..f1435f0
--- /dev/null
+++ b/asterixdb/asterix-runtime/src/main/java/org/apache/asterix/runtime/evaluators/constructors/AInt8DefaultNullConstructorDescriptor.java
@@ -0,0 +1,65 @@
+/*
+ * 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 org.apache.asterix.common.annotations.MissingNullInOutFunction;
+import org.apache.asterix.om.functions.BuiltinFunctions;
+import org.apache.asterix.om.functions.IFunctionDescriptorFactory;
+import org.apache.asterix.runtime.evaluators.base.AbstractScalarFunctionDynamicDescriptor;
+import org.apache.asterix.runtime.evaluators.functions.PointableHelper;
+import org.apache.hyracks.algebricks.core.algebra.functions.FunctionIdentifier;
+import org.apache.hyracks.algebricks.runtime.base.IEvaluatorContext;
+import org.apache.hyracks.algebricks.runtime.base.IScalarEvaluator;
+import org.apache.hyracks.algebricks.runtime.base.IScalarEvaluatorFactory;
+import org.apache.hyracks.api.exceptions.HyracksDataException;
+import org.apache.hyracks.data.std.api.IPointable;
+
+@MissingNullInOutFunction
+public class AInt8DefaultNullConstructorDescriptor extends AbstractScalarFunctionDynamicDescriptor {
+    private static final long serialVersionUID = 1L;
+    public static final IFunctionDescriptorFactory FACTORY = AInt8DefaultNullConstructorDescriptor::new;
+
+    @Override
+    public IScalarEvaluatorFactory createEvaluatorFactory(final IScalarEvaluatorFactory[] args) {
+        return new IScalarEvaluatorFactory() {
+            private static final long serialVersionUID = 1L;
+
+            @Override
+            public IScalarEvaluator createScalarEvaluator(IEvaluatorContext ctx) throws HyracksDataException {
+                return new AbstractInt8ConstructorEvaluator(ctx, args[0].createScalarEvaluator(ctx), sourceLoc) {
+
+                    @Override
+                    protected FunctionIdentifier getIdentifier() {
+                        return AInt8DefaultNullConstructorDescriptor.this.getIdentifier();
+                    }
+
+                    @Override
+                    protected boolean checkAndSetMissingOrNull(IPointable result) throws HyracksDataException {
+                        return PointableHelper.checkAndSetNull(result, inputArg);
+                    }
+                };
+            }
+        };
+    }
+
+    @Override
+    public FunctionIdentifier getIdentifier() {
+        return BuiltinFunctions.INT8_DEFAULT_NULL_CONSTRUCTOR;
+    }
+}
diff --git a/asterixdb/asterix-runtime/src/main/java/org/apache/asterix/runtime/evaluators/constructors/AStringDefaultNullConstructorDescriptor.java b/asterixdb/asterix-runtime/src/main/java/org/apache/asterix/runtime/evaluators/constructors/AStringDefaultNullConstructorDescriptor.java
new file mode 100644
index 0000000..0f12359
--- /dev/null
+++ b/asterixdb/asterix-runtime/src/main/java/org/apache/asterix/runtime/evaluators/constructors/AStringDefaultNullConstructorDescriptor.java
@@ -0,0 +1,65 @@
+/*
+ * 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 org.apache.asterix.common.annotations.MissingNullInOutFunction;
+import org.apache.asterix.om.functions.BuiltinFunctions;
+import org.apache.asterix.om.functions.IFunctionDescriptorFactory;
+import org.apache.asterix.runtime.evaluators.base.AbstractScalarFunctionDynamicDescriptor;
+import org.apache.asterix.runtime.evaluators.functions.PointableHelper;
+import org.apache.hyracks.algebricks.core.algebra.functions.FunctionIdentifier;
+import org.apache.hyracks.algebricks.runtime.base.IEvaluatorContext;
+import org.apache.hyracks.algebricks.runtime.base.IScalarEvaluator;
+import org.apache.hyracks.algebricks.runtime.base.IScalarEvaluatorFactory;
+import org.apache.hyracks.api.exceptions.HyracksDataException;
+import org.apache.hyracks.data.std.api.IPointable;
+
+@MissingNullInOutFunction
+public class AStringDefaultNullConstructorDescriptor extends AbstractScalarFunctionDynamicDescriptor {
+
+    private static final long serialVersionUID = 1L;
+    public static final IFunctionDescriptorFactory FACTORY = AStringDefaultNullConstructorDescriptor::new;
+
+    @Override
+    public IScalarEvaluatorFactory createEvaluatorFactory(final IScalarEvaluatorFactory[] args) {
+        return new IScalarEvaluatorFactory() {
+            private static final long serialVersionUID = 1L;
+
+            @Override
+            public IScalarEvaluator createScalarEvaluator(IEvaluatorContext ctx) throws HyracksDataException {
+                return new AbstractStringConstructorEvaluator(ctx, args[0].createScalarEvaluator(ctx), sourceLoc) {
+                    @Override
+                    protected FunctionIdentifier getIdentifier() {
+                        return AStringDefaultNullConstructorDescriptor.this.getIdentifier();
+                    }
+
+                    @Override
+                    protected boolean checkAndSetMissingOrNull(IPointable result) throws HyracksDataException {
+                        return PointableHelper.checkAndSetNull(result, inputArg);
+                    }
+                };
+            }
+        };
+    }
+
+    @Override
+    public FunctionIdentifier getIdentifier() {
+        return BuiltinFunctions.STRING_DEFAULT_NULL_CONSTRUCTOR;
+    }
+}
diff --git a/asterixdb/asterix-runtime/src/main/java/org/apache/asterix/runtime/evaluators/constructors/ATimeConstructorWithFormatDescriptor.java b/asterixdb/asterix-runtime/src/main/java/org/apache/asterix/runtime/evaluators/constructors/ATimeConstructorWithFormatDescriptor.java
index e2df1be..9244f7e 100644
--- a/asterixdb/asterix-runtime/src/main/java/org/apache/asterix/runtime/evaluators/constructors/ATimeConstructorWithFormatDescriptor.java
+++ b/asterixdb/asterix-runtime/src/main/java/org/apache/asterix/runtime/evaluators/constructors/ATimeConstructorWithFormatDescriptor.java
@@ -19,34 +19,18 @@
 
 package org.apache.asterix.runtime.evaluators.constructors;
 
-import org.apache.asterix.om.base.AMutableInt64;
-import org.apache.asterix.om.base.AMutableTime;
-import org.apache.asterix.om.base.temporal.AsterixTemporalTypeParseException;
-import org.apache.asterix.om.base.temporal.DateTimeFormatUtils;
 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.runtime.evaluators.base.AbstractScalarFunctionDynamicDescriptor;
-import org.apache.asterix.runtime.evaluators.functions.PointableHelper;
 import org.apache.hyracks.algebricks.core.algebra.functions.FunctionIdentifier;
 import org.apache.hyracks.algebricks.runtime.base.IEvaluatorContext;
 import org.apache.hyracks.algebricks.runtime.base.IScalarEvaluator;
 import org.apache.hyracks.algebricks.runtime.base.IScalarEvaluatorFactory;
 import org.apache.hyracks.api.exceptions.HyracksDataException;
-import org.apache.hyracks.data.std.api.IPointable;
-import org.apache.hyracks.data.std.primitive.UTF8StringPointable;
-import org.apache.hyracks.data.std.primitive.VoidPointable;
-import org.apache.hyracks.dataflow.common.data.accessors.IFrameTupleReference;
 
 public class ATimeConstructorWithFormatDescriptor extends AbstractScalarFunctionDynamicDescriptor {
     private static final long serialVersionUID = 1L;
-    public static final IFunctionDescriptorFactory FACTORY = new IFunctionDescriptorFactory() {
-        @Override
-        public IFunctionDescriptor createFunctionDescriptor() {
-            return new ATimeConstructorWithFormatDescriptor();
-        }
-    };
+    public static final IFunctionDescriptorFactory FACTORY = ATimeConstructorWithFormatDescriptor::new;
 
     @Override
     public IScalarEvaluatorFactory createEvaluatorFactory(final IScalarEvaluatorFactory[] args) {
@@ -55,48 +39,7 @@
 
             @Override
             public IScalarEvaluator createScalarEvaluator(IEvaluatorContext ctx) throws HyracksDataException {
-                return new AbstractTimeConstructorEvaluator(ctx, args[0].createScalarEvaluator(ctx), sourceLoc) {
-
-                    private final IScalarEvaluator formatEval = args[1].createScalarEvaluator(ctx);
-                    private final IPointable formatArg = new VoidPointable();
-                    private final UTF8StringPointable formatTextPtr = new UTF8StringPointable();
-                    private final AMutableInt64 aInt64 = new AMutableInt64(0);
-
-                    @Override
-                    protected void evaluateInput(IFrameTupleReference tuple) throws HyracksDataException {
-                        super.evaluateInput(tuple);
-                        formatEval.evaluate(tuple, formatArg);
-                    }
-
-                    @Override
-                    protected boolean checkAndSetMissingOrNull(IPointable result) throws HyracksDataException {
-                        return PointableHelper.checkAndSetMissingOrNull(result, inputArg, formatArg);
-                    }
-
-                    @Override
-                    protected boolean parseTime(UTF8StringPointable textPtr, AMutableTime result) {
-                        byte[] formatBytes = formatArg.getByteArray();
-                        int formatStartOffset = formatArg.getStartOffset();
-                        int formatLength = formatArg.getLength();
-                        if (formatBytes[formatStartOffset] != ATypeTag.SERIALIZED_STRING_TYPE_TAG) {
-                            return false;
-                        }
-                        formatTextPtr.set(formatBytes, formatStartOffset + 1, formatLength - 1);
-                        try {
-                            if (DateTimeFormatUtils.getInstance().parseDateTime(aInt64, textPtr.getByteArray(),
-                                    textPtr.getCharStartOffset(), textPtr.getUTF8Length(), formatBytes,
-                                    formatTextPtr.getCharStartOffset(), formatTextPtr.getUTF8Length(),
-                                    DateTimeFormatUtils.DateTimeParseMode.TIME_ONLY, false)) {
-                                result.setValue((int) aInt64.getLongValue());
-                                return true;
-                            } else {
-                                return false;
-                            }
-                        } catch (AsterixTemporalTypeParseException e) {
-                            // shouldn't happen
-                            return false;
-                        }
-                    }
+                return new AbstractTimeWithFormatConstructorEvaluator(ctx, args, sourceLoc) {
 
                     @Override
                     protected FunctionIdentifier getIdentifier() {
diff --git a/asterixdb/asterix-runtime/src/main/java/org/apache/asterix/runtime/evaluators/constructors/ATimeDefaultNullConstructorDescriptor.java b/asterixdb/asterix-runtime/src/main/java/org/apache/asterix/runtime/evaluators/constructors/ATimeDefaultNullConstructorDescriptor.java
new file mode 100644
index 0000000..859591c
--- /dev/null
+++ b/asterixdb/asterix-runtime/src/main/java/org/apache/asterix/runtime/evaluators/constructors/ATimeDefaultNullConstructorDescriptor.java
@@ -0,0 +1,65 @@
+/*
+ * 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 org.apache.asterix.common.annotations.MissingNullInOutFunction;
+import org.apache.asterix.om.functions.BuiltinFunctions;
+import org.apache.asterix.om.functions.IFunctionDescriptorFactory;
+import org.apache.asterix.runtime.evaluators.base.AbstractScalarFunctionDynamicDescriptor;
+import org.apache.asterix.runtime.evaluators.functions.PointableHelper;
+import org.apache.hyracks.algebricks.core.algebra.functions.FunctionIdentifier;
+import org.apache.hyracks.algebricks.runtime.base.IEvaluatorContext;
+import org.apache.hyracks.algebricks.runtime.base.IScalarEvaluator;
+import org.apache.hyracks.algebricks.runtime.base.IScalarEvaluatorFactory;
+import org.apache.hyracks.api.exceptions.HyracksDataException;
+import org.apache.hyracks.data.std.api.IPointable;
+
+@MissingNullInOutFunction
+public class ATimeDefaultNullConstructorDescriptor extends AbstractScalarFunctionDynamicDescriptor {
+    private static final long serialVersionUID = 1L;
+    public static final IFunctionDescriptorFactory FACTORY = ATimeDefaultNullConstructorDescriptor::new;
+
+    @Override
+    public IScalarEvaluatorFactory createEvaluatorFactory(final IScalarEvaluatorFactory[] args) {
+        return new IScalarEvaluatorFactory() {
+            private static final long serialVersionUID = 1L;
+
+            @Override
+            public IScalarEvaluator createScalarEvaluator(IEvaluatorContext ctx) throws HyracksDataException {
+                return new AbstractTimeConstructorEvaluator(ctx, args[0].createScalarEvaluator(ctx), sourceLoc) {
+
+                    @Override
+                    protected FunctionIdentifier getIdentifier() {
+                        return ATimeDefaultNullConstructorDescriptor.this.getIdentifier();
+                    }
+
+                    @Override
+                    protected boolean checkAndSetMissingOrNull(IPointable result) throws HyracksDataException {
+                        return PointableHelper.checkAndSetNull(result, inputArg);
+                    }
+                };
+            }
+        };
+    }
+
+    @Override
+    public FunctionIdentifier getIdentifier() {
+        return BuiltinFunctions.TIME_DEFAULT_NULL_CONSTRUCTOR;
+    }
+}
diff --git a/asterixdb/asterix-runtime/src/main/java/org/apache/asterix/runtime/evaluators/constructors/ATimeDefaultNullConstructorWithFormatDescriptor.java b/asterixdb/asterix-runtime/src/main/java/org/apache/asterix/runtime/evaluators/constructors/ATimeDefaultNullConstructorWithFormatDescriptor.java
new file mode 100644
index 0000000..cc1ef88
--- /dev/null
+++ b/asterixdb/asterix-runtime/src/main/java/org/apache/asterix/runtime/evaluators/constructors/ATimeDefaultNullConstructorWithFormatDescriptor.java
@@ -0,0 +1,67 @@
+/*
+ * 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 org.apache.asterix.om.functions.BuiltinFunctions;
+import org.apache.asterix.om.functions.IFunctionDescriptorFactory;
+import org.apache.asterix.runtime.evaluators.base.AbstractScalarFunctionDynamicDescriptor;
+import org.apache.asterix.runtime.evaluators.functions.PointableHelper;
+import org.apache.hyracks.algebricks.core.algebra.functions.FunctionIdentifier;
+import org.apache.hyracks.algebricks.runtime.base.IEvaluatorContext;
+import org.apache.hyracks.algebricks.runtime.base.IScalarEvaluator;
+import org.apache.hyracks.algebricks.runtime.base.IScalarEvaluatorFactory;
+import org.apache.hyracks.api.exceptions.HyracksDataException;
+import org.apache.hyracks.data.std.api.IPointable;
+
+public class ATimeDefaultNullConstructorWithFormatDescriptor extends AbstractScalarFunctionDynamicDescriptor {
+    private static final long serialVersionUID = 1L;
+    public static final IFunctionDescriptorFactory FACTORY = ATimeDefaultNullConstructorWithFormatDescriptor::new;
+
+    @Override
+    public IScalarEvaluatorFactory createEvaluatorFactory(final IScalarEvaluatorFactory[] args) {
+        return new IScalarEvaluatorFactory() {
+            private static final long serialVersionUID = 1L;
+
+            @Override
+            public IScalarEvaluator createScalarEvaluator(IEvaluatorContext ctx) throws HyracksDataException {
+                return new AbstractTimeWithFormatConstructorEvaluator(ctx, args, sourceLoc) {
+
+                    @Override
+                    protected FunctionIdentifier getIdentifier() {
+                        return ATimeDefaultNullConstructorWithFormatDescriptor.this.getIdentifier();
+                    }
+
+                    @Override
+                    protected boolean checkAndSetMissingOrNull(IPointable result) throws HyracksDataException {
+                        if (PointableHelper.checkAndSetNull(result, inputArg)) {
+                            return true;
+                        }
+                        return super.checkAndSetMissingOrNull(result);
+                    }
+                };
+            }
+        };
+    }
+
+    @Override
+    public FunctionIdentifier getIdentifier() {
+        return BuiltinFunctions.TIME_DEFAULT_NULL_CONSTRUCTOR_WITH_FORMAT;
+    }
+}
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 ec2b9db..299c928 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
@@ -19,23 +19,14 @@
 package org.apache.asterix.runtime.evaluators.constructors;
 
 import org.apache.asterix.common.annotations.MissingNullInOutFunction;
-import org.apache.asterix.formats.nontagged.SerializerDeserializerProvider;
-import org.apache.asterix.om.base.AMutableUUID;
-import org.apache.asterix.om.base.AUUID;
 import org.apache.asterix.om.functions.BuiltinFunctions;
 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.om.types.EnumDeserializer;
 import org.apache.asterix.runtime.evaluators.base.AbstractScalarFunctionDynamicDescriptor;
 import org.apache.hyracks.algebricks.core.algebra.functions.FunctionIdentifier;
 import org.apache.hyracks.algebricks.runtime.base.IEvaluatorContext;
 import org.apache.hyracks.algebricks.runtime.base.IScalarEvaluator;
 import org.apache.hyracks.algebricks.runtime.base.IScalarEvaluatorFactory;
-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.UTF8StringPointable;
 
 /**
  * Receives a canonical representation of UUID and construct a UUID value.
@@ -55,44 +46,8 @@
 
             @Override
             public IScalarEvaluator createScalarEvaluator(IEvaluatorContext ctx) throws HyracksDataException {
-                return new AbstractConstructorEvaluator(ctx, args[0].createScalarEvaluator(ctx), sourceLoc) {
-
-                    private final AMutableUUID uuid = new AMutableUUID();
-                    @SuppressWarnings("unchecked")
-                    private final ISerializerDeserializer<AUUID> uuidSerde =
-                            SerializerDeserializerProvider.INSTANCE.getSerializerDeserializer(BuiltinType.AUUID);
-                    private final UTF8StringPointable utf8Ptr = new UTF8StringPointable();
-
-                    @Override
-                    protected void evaluateImpl(IPointable result) throws HyracksDataException {
-                        byte[] bytes = inputArg.getByteArray();
-                        int startOffset = inputArg.getStartOffset();
-                        int len = inputArg.getLength();
-                        ATypeTag inputType = EnumDeserializer.ATYPETAGDESERIALIZER.deserialize(bytes[startOffset]);
-                        switch (inputType) {
-                            case UUID:
-                                result.set(inputArg);
-                                break;
-                            case STRING:
-                                utf8Ptr.set(bytes, startOffset + 1, len - 1);
-                                if (parseUUID(utf8Ptr, uuid)) {
-                                    resultStorage.reset();
-                                    uuidSerde.serialize(uuid, out);
-                                    result.set(resultStorage);
-                                } else {
-                                    handleParseError(utf8Ptr, result);
-                                }
-                                break;
-                            default:
-                                handleUnsupportedType(inputType, result);
-                                break;
-                        }
-                    }
-
-                    @Override
-                    protected BuiltinType getTargetType() {
-                        return BuiltinType.AUUID;
-                    }
+                return new AbstractUUIDFromStringConstructorEvaluator(ctx, args[0].createScalarEvaluator(ctx),
+                        sourceLoc) {
 
                     @Override
                     protected FunctionIdentifier getIdentifier() {
@@ -103,16 +58,6 @@
         };
     }
 
-    private static boolean parseUUID(UTF8StringPointable textPtr, AMutableUUID result) {
-        try {
-            // first byte: tag, next x bytes: length
-            result.parseUUIDHexBytes(textPtr.getByteArray(), textPtr.getCharStartOffset());
-            return true;
-        } catch (HyracksDataException e) {
-            return false;
-        }
-    }
-
     @Override
     public FunctionIdentifier getIdentifier() {
         return BuiltinFunctions.UUID_CONSTRUCTOR;
diff --git a/asterixdb/asterix-runtime/src/main/java/org/apache/asterix/runtime/evaluators/constructors/AUUIDFromStringDefaultNullConstructorDescriptor.java b/asterixdb/asterix-runtime/src/main/java/org/apache/asterix/runtime/evaluators/constructors/AUUIDFromStringDefaultNullConstructorDescriptor.java
new file mode 100644
index 0000000..ac64e81
--- /dev/null
+++ b/asterixdb/asterix-runtime/src/main/java/org/apache/asterix/runtime/evaluators/constructors/AUUIDFromStringDefaultNullConstructorDescriptor.java
@@ -0,0 +1,72 @@
+/*
+ * 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 org.apache.asterix.common.annotations.MissingNullInOutFunction;
+import org.apache.asterix.om.functions.BuiltinFunctions;
+import org.apache.asterix.om.functions.IFunctionDescriptorFactory;
+import org.apache.asterix.runtime.evaluators.base.AbstractScalarFunctionDynamicDescriptor;
+import org.apache.asterix.runtime.evaluators.functions.PointableHelper;
+import org.apache.hyracks.algebricks.core.algebra.functions.FunctionIdentifier;
+import org.apache.hyracks.algebricks.runtime.base.IEvaluatorContext;
+import org.apache.hyracks.algebricks.runtime.base.IScalarEvaluator;
+import org.apache.hyracks.algebricks.runtime.base.IScalarEvaluatorFactory;
+import org.apache.hyracks.api.exceptions.HyracksDataException;
+import org.apache.hyracks.data.std.api.IPointable;
+
+/**
+ * Receives a canonical representation of UUID and construct a UUID value.
+ * a UUID is represented by 32 lowercase hexadecimal digits (8-4-4-4-12). (E.g.
+ * uuid("02a199ca-bf58-412e-bd9f-60a0c975a8ac"))
+ */
+
+@MissingNullInOutFunction
+public class AUUIDFromStringDefaultNullConstructorDescriptor extends AbstractScalarFunctionDynamicDescriptor {
+    private static final long serialVersionUID = 1L;
+    public static final IFunctionDescriptorFactory FACTORY = AUUIDFromStringDefaultNullConstructorDescriptor::new;
+
+    @Override
+    public IScalarEvaluatorFactory createEvaluatorFactory(final IScalarEvaluatorFactory[] args) {
+        return new IScalarEvaluatorFactory() {
+            private static final long serialVersionUID = 1L;
+
+            @Override
+            public IScalarEvaluator createScalarEvaluator(IEvaluatorContext ctx) throws HyracksDataException {
+                return new AbstractUUIDFromStringConstructorEvaluator(ctx, args[0].createScalarEvaluator(ctx),
+                        sourceLoc) {
+
+                    @Override
+                    protected FunctionIdentifier getIdentifier() {
+                        return AUUIDFromStringDefaultNullConstructorDescriptor.this.getIdentifier();
+                    }
+
+                    @Override
+                    protected boolean checkAndSetMissingOrNull(IPointable result) throws HyracksDataException {
+                        return PointableHelper.checkAndSetNull(result, inputArg);
+                    }
+                };
+            }
+        };
+    }
+
+    @Override
+    public FunctionIdentifier getIdentifier() {
+        return BuiltinFunctions.UUID_DEFAULT_NULL_CONSTRUCTOR;
+    }
+}
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 5a64f28..5adb725 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,26 +19,14 @@
 package org.apache.asterix.runtime.evaluators.constructors;
 
 import org.apache.asterix.common.annotations.MissingNullInOutFunction;
-import org.apache.asterix.dataflow.data.nontagged.serde.ADurationSerializerDeserializer;
-import org.apache.asterix.formats.nontagged.SerializerDeserializerProvider;
-import org.apache.asterix.om.base.AMutableYearMonthDuration;
-import org.apache.asterix.om.base.AYearMonthDuration;
-import org.apache.asterix.om.base.temporal.ADurationParserFactory;
-import org.apache.asterix.om.base.temporal.ADurationParserFactory.ADurationParseOption;
 import org.apache.asterix.om.functions.BuiltinFunctions;
 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.om.types.EnumDeserializer;
 import org.apache.asterix.runtime.evaluators.base.AbstractScalarFunctionDynamicDescriptor;
 import org.apache.hyracks.algebricks.core.algebra.functions.FunctionIdentifier;
 import org.apache.hyracks.algebricks.runtime.base.IEvaluatorContext;
 import org.apache.hyracks.algebricks.runtime.base.IScalarEvaluator;
 import org.apache.hyracks.algebricks.runtime.base.IScalarEvaluatorFactory;
-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.UTF8StringPointable;
 
 @MissingNullInOutFunction
 public class AYearMonthDurationConstructorDescriptor extends AbstractScalarFunctionDynamicDescriptor {
@@ -52,52 +40,8 @@
 
             @Override
             public IScalarEvaluator createScalarEvaluator(IEvaluatorContext ctx) throws HyracksDataException {
-                return new AbstractConstructorEvaluator(ctx, args[0].createScalarEvaluator(ctx), sourceLoc) {
-
-                    private final AMutableYearMonthDuration aYearMonthDuration = new AMutableYearMonthDuration(0);
-                    @SuppressWarnings("unchecked")
-                    private final ISerializerDeserializer<AYearMonthDuration> yearMonthDurationSerde =
-                            SerializerDeserializerProvider.INSTANCE
-                                    .getSerializerDeserializer(BuiltinType.AYEARMONTHDURATION);
-                    private final UTF8StringPointable utf8Ptr = new UTF8StringPointable();
-
-                    @Override
-                    protected void evaluateImpl(IPointable result) throws HyracksDataException {
-                        byte[] bytes = inputArg.getByteArray();
-                        int startOffset = inputArg.getStartOffset();
-                        int len = inputArg.getLength();
-                        ATypeTag inputType = EnumDeserializer.ATYPETAGDESERIALIZER.deserialize(bytes[startOffset]);
-                        switch (inputType) {
-                            case YEARMONTHDURATION:
-                                result.set(inputArg);
-                                break;
-                            case DURATION:
-                                int months = ADurationSerializerDeserializer.getYearMonth(bytes, startOffset + 1);
-                                aYearMonthDuration.setMonths(months);
-                                resultStorage.reset();
-                                yearMonthDurationSerde.serialize(aYearMonthDuration, out);
-                                result.set(resultStorage);
-                                break;
-                            case STRING:
-                                utf8Ptr.set(bytes, startOffset + 1, len - 1);
-                                if (parseYearMonthDuration(utf8Ptr, aYearMonthDuration)) {
-                                    resultStorage.reset();
-                                    yearMonthDurationSerde.serialize(aYearMonthDuration, out);
-                                    result.set(resultStorage);
-                                } else {
-                                    handleParseError(utf8Ptr, result);
-                                }
-                                break;
-                            default:
-                                handleUnsupportedType(inputType, result);
-                                break;
-                        }
-                    }
-
-                    @Override
-                    protected BuiltinType getTargetType() {
-                        return BuiltinType.AYEARMONTHDURATION;
-                    }
+                return new AbstractYearMonthDurationConstructorEvaluator(ctx, args[0].createScalarEvaluator(ctx),
+                        sourceLoc) {
 
                     @Override
                     protected FunctionIdentifier getIdentifier() {
@@ -108,16 +52,6 @@
         };
     }
 
-    private static boolean parseYearMonthDuration(UTF8StringPointable textPtr, AMutableYearMonthDuration result) {
-        try {
-            ADurationParserFactory.parseDuration(textPtr.getByteArray(), textPtr.getCharStartOffset(),
-                    textPtr.getUTF8Length(), result, ADurationParseOption.YEAR_MONTH);
-            return true;
-        } catch (HyracksDataException e) {
-            return false;
-        }
-    }
-
     @Override
     public FunctionIdentifier getIdentifier() {
         return BuiltinFunctions.YEAR_MONTH_DURATION_CONSTRUCTOR;
diff --git a/asterixdb/asterix-runtime/src/main/java/org/apache/asterix/runtime/evaluators/constructors/AYearMonthDurationDefaultNullConstructorDescriptor.java b/asterixdb/asterix-runtime/src/main/java/org/apache/asterix/runtime/evaluators/constructors/AYearMonthDurationDefaultNullConstructorDescriptor.java
new file mode 100644
index 0000000..529306a
--- /dev/null
+++ b/asterixdb/asterix-runtime/src/main/java/org/apache/asterix/runtime/evaluators/constructors/AYearMonthDurationDefaultNullConstructorDescriptor.java
@@ -0,0 +1,67 @@
+/*
+ * 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 org.apache.asterix.common.annotations.MissingNullInOutFunction;
+import org.apache.asterix.om.functions.BuiltinFunctions;
+import org.apache.asterix.om.functions.IFunctionDescriptorFactory;
+import org.apache.asterix.runtime.evaluators.base.AbstractScalarFunctionDynamicDescriptor;
+import org.apache.asterix.runtime.evaluators.functions.PointableHelper;
+import org.apache.hyracks.algebricks.core.algebra.functions.FunctionIdentifier;
+import org.apache.hyracks.algebricks.runtime.base.IEvaluatorContext;
+import org.apache.hyracks.algebricks.runtime.base.IScalarEvaluator;
+import org.apache.hyracks.algebricks.runtime.base.IScalarEvaluatorFactory;
+import org.apache.hyracks.api.exceptions.HyracksDataException;
+import org.apache.hyracks.data.std.api.IPointable;
+
+@MissingNullInOutFunction
+public class AYearMonthDurationDefaultNullConstructorDescriptor extends AbstractScalarFunctionDynamicDescriptor {
+    private static final long serialVersionUID = 1L;
+    public static final IFunctionDescriptorFactory FACTORY = AYearMonthDurationDefaultNullConstructorDescriptor::new;
+
+    @Override
+    public IScalarEvaluatorFactory createEvaluatorFactory(final IScalarEvaluatorFactory[] args) {
+        return new IScalarEvaluatorFactory() {
+            private static final long serialVersionUID = 1L;
+
+            @Override
+            public IScalarEvaluator createScalarEvaluator(IEvaluatorContext ctx) throws HyracksDataException {
+                return new AbstractYearMonthDurationConstructorEvaluator(ctx, args[0].createScalarEvaluator(ctx),
+                        sourceLoc) {
+
+                    @Override
+                    protected FunctionIdentifier getIdentifier() {
+                        return AYearMonthDurationDefaultNullConstructorDescriptor.this.getIdentifier();
+                    }
+
+                    @Override
+                    protected boolean checkAndSetMissingOrNull(IPointable result) throws HyracksDataException {
+                        return PointableHelper.checkAndSetNull(result, inputArg);
+                    }
+                };
+            }
+        };
+    }
+
+    @Override
+    public FunctionIdentifier getIdentifier() {
+        return BuiltinFunctions.YEAR_MONTH_DURATION_DEFAULT_NULL_CONSTRUCTOR;
+    }
+
+}
diff --git a/asterixdb/asterix-runtime/src/main/java/org/apache/asterix/runtime/evaluators/constructors/AbstractDateConstructorWithFormatEvaluator.java b/asterixdb/asterix-runtime/src/main/java/org/apache/asterix/runtime/evaluators/constructors/AbstractDateConstructorWithFormatEvaluator.java
new file mode 100644
index 0000000..f02ddec
--- /dev/null
+++ b/asterixdb/asterix-runtime/src/main/java/org/apache/asterix/runtime/evaluators/constructors/AbstractDateConstructorWithFormatEvaluator.java
@@ -0,0 +1,87 @@
+/*
+ * 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 org.apache.asterix.om.base.AMutableDate;
+import org.apache.asterix.om.base.AMutableInt64;
+import org.apache.asterix.om.base.temporal.AsterixTemporalTypeParseException;
+import org.apache.asterix.om.base.temporal.DateTimeFormatUtils;
+import org.apache.asterix.om.base.temporal.GregorianCalendarSystem;
+import org.apache.asterix.om.types.ATypeTag;
+import org.apache.asterix.runtime.evaluators.functions.PointableHelper;
+import org.apache.hyracks.algebricks.runtime.base.IEvaluatorContext;
+import org.apache.hyracks.algebricks.runtime.base.IScalarEvaluator;
+import org.apache.hyracks.algebricks.runtime.base.IScalarEvaluatorFactory;
+import org.apache.hyracks.api.exceptions.HyracksDataException;
+import org.apache.hyracks.api.exceptions.SourceLocation;
+import org.apache.hyracks.data.std.api.IPointable;
+import org.apache.hyracks.data.std.primitive.UTF8StringPointable;
+import org.apache.hyracks.data.std.primitive.VoidPointable;
+import org.apache.hyracks.dataflow.common.data.accessors.IFrameTupleReference;
+
+public abstract class AbstractDateConstructorWithFormatEvaluator extends AbstractDateConstructorEvaluator {
+
+    private final IScalarEvaluator formatEval;
+    private final IPointable formatArg = new VoidPointable();
+    private final UTF8StringPointable formatTextPtr = new UTF8StringPointable();
+    private final AMutableInt64 aInt64 = new AMutableInt64(0);
+
+    protected AbstractDateConstructorWithFormatEvaluator(IEvaluatorContext ctx, IScalarEvaluatorFactory[] args,
+            SourceLocation sourceLoc) throws HyracksDataException {
+        super(ctx, args[0].createScalarEvaluator(ctx), sourceLoc);
+        formatEval = args[1].createScalarEvaluator(ctx);
+    }
+
+    @Override
+    protected void evaluateInput(IFrameTupleReference tuple) throws HyracksDataException {
+        super.evaluateInput(tuple);
+        formatEval.evaluate(tuple, formatArg);
+    }
+
+    @Override
+    protected boolean checkAndSetMissingOrNull(IPointable result) throws HyracksDataException {
+        return PointableHelper.checkAndSetMissingOrNull(result, inputArg, formatArg);
+    }
+
+    @Override
+    protected boolean parseDate(UTF8StringPointable textPtr, AMutableDate result) {
+        byte[] formatBytes = formatArg.getByteArray();
+        int formatStartOffset = formatArg.getStartOffset();
+        int formatLength = formatArg.getLength();
+        if (formatBytes[formatStartOffset] != ATypeTag.SERIALIZED_STRING_TYPE_TAG) {
+            return false;
+        }
+        formatTextPtr.set(formatBytes, formatStartOffset + 1, formatLength - 1);
+        try {
+            if (DateTimeFormatUtils.getInstance().parseDateTime(aInt64, textPtr.getByteArray(),
+                    textPtr.getCharStartOffset(), textPtr.getUTF8Length(), formatBytes,
+                    formatTextPtr.getCharStartOffset(), formatTextPtr.getUTF8Length(),
+                    DateTimeFormatUtils.DateTimeParseMode.DATE_ONLY, false)) {
+                result.setValue((int) (aInt64.getLongValue() / GregorianCalendarSystem.CHRONON_OF_DAY));
+                return true;
+            } else {
+                return false;
+            }
+        } catch (AsterixTemporalTypeParseException e) {
+            // shouldn't happen
+            return false;
+        }
+    }
+}
diff --git a/asterixdb/asterix-runtime/src/main/java/org/apache/asterix/runtime/evaluators/constructors/AbstractDateTimeConstructorWithFormatEvaluator.java b/asterixdb/asterix-runtime/src/main/java/org/apache/asterix/runtime/evaluators/constructors/AbstractDateTimeConstructorWithFormatEvaluator.java
new file mode 100644
index 0000000..899e7e6
--- /dev/null
+++ b/asterixdb/asterix-runtime/src/main/java/org/apache/asterix/runtime/evaluators/constructors/AbstractDateTimeConstructorWithFormatEvaluator.java
@@ -0,0 +1,86 @@
+/*
+ * 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 org.apache.asterix.om.base.AMutableDateTime;
+import org.apache.asterix.om.base.AMutableInt64;
+import org.apache.asterix.om.base.temporal.AsterixTemporalTypeParseException;
+import org.apache.asterix.om.base.temporal.DateTimeFormatUtils;
+import org.apache.asterix.om.types.ATypeTag;
+import org.apache.asterix.runtime.evaluators.functions.PointableHelper;
+import org.apache.hyracks.algebricks.runtime.base.IEvaluatorContext;
+import org.apache.hyracks.algebricks.runtime.base.IScalarEvaluator;
+import org.apache.hyracks.algebricks.runtime.base.IScalarEvaluatorFactory;
+import org.apache.hyracks.api.exceptions.HyracksDataException;
+import org.apache.hyracks.api.exceptions.SourceLocation;
+import org.apache.hyracks.data.std.api.IPointable;
+import org.apache.hyracks.data.std.primitive.UTF8StringPointable;
+import org.apache.hyracks.data.std.primitive.VoidPointable;
+import org.apache.hyracks.dataflow.common.data.accessors.IFrameTupleReference;
+
+public abstract class AbstractDateTimeConstructorWithFormatEvaluator extends AbstractDateTimeConstructorEvaluator {
+
+    private final IScalarEvaluator formatEval;
+    private final IPointable formatArg = new VoidPointable();
+    private final UTF8StringPointable formatTextPtr = new UTF8StringPointable();
+    private final AMutableInt64 aInt64 = new AMutableInt64(0);
+
+    protected AbstractDateTimeConstructorWithFormatEvaluator(IEvaluatorContext ctx, IScalarEvaluatorFactory[] args,
+            SourceLocation sourceLoc) throws HyracksDataException {
+        super(ctx, args[0].createScalarEvaluator(ctx), sourceLoc);
+        formatEval = args[1].createScalarEvaluator(ctx);
+    }
+
+    @Override
+    protected void evaluateInput(IFrameTupleReference tuple) throws HyracksDataException {
+        super.evaluateInput(tuple);
+        formatEval.evaluate(tuple, formatArg);
+    }
+
+    @Override
+    protected boolean checkAndSetMissingOrNull(IPointable result) throws HyracksDataException {
+        return PointableHelper.checkAndSetMissingOrNull(result, inputArg, formatArg);
+    }
+
+    @Override
+    protected boolean parseDateTime(UTF8StringPointable textPtr, AMutableDateTime result) {
+        byte[] formatBytes = formatArg.getByteArray();
+        int formatStartOffset = formatArg.getStartOffset();
+        int formatLength = formatArg.getLength();
+        if (formatBytes[formatStartOffset] != ATypeTag.SERIALIZED_STRING_TYPE_TAG) {
+            return false;
+        }
+        formatTextPtr.set(formatBytes, formatStartOffset + 1, formatLength - 1);
+        try {
+            if (DateTimeFormatUtils.getInstance().parseDateTime(aInt64, textPtr.getByteArray(),
+                    textPtr.getCharStartOffset(), textPtr.getUTF8Length(), formatBytes,
+                    formatTextPtr.getCharStartOffset(), formatTextPtr.getUTF8Length(),
+                    DateTimeFormatUtils.DateTimeParseMode.DATETIME, false)) {
+                result.setValue(aInt64.getLongValue());
+                return true;
+            } else {
+                return false;
+            }
+        } catch (AsterixTemporalTypeParseException e) {
+            // shouldn't happen
+            return false;
+        }
+    }
+}
diff --git a/asterixdb/asterix-runtime/src/main/java/org/apache/asterix/runtime/evaluators/constructors/AbstractDayTimeDurationConstructorEvaluator.java b/asterixdb/asterix-runtime/src/main/java/org/apache/asterix/runtime/evaluators/constructors/AbstractDayTimeDurationConstructorEvaluator.java
new file mode 100644
index 0000000..2706b5e
--- /dev/null
+++ b/asterixdb/asterix-runtime/src/main/java/org/apache/asterix/runtime/evaluators/constructors/AbstractDayTimeDurationConstructorEvaluator.java
@@ -0,0 +1,98 @@
+/*
+ * 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 org.apache.asterix.dataflow.data.nontagged.serde.ADurationSerializerDeserializer;
+import org.apache.asterix.formats.nontagged.SerializerDeserializerProvider;
+import org.apache.asterix.om.base.ADayTimeDuration;
+import org.apache.asterix.om.base.AMutableDayTimeDuration;
+import org.apache.asterix.om.base.temporal.ADurationParserFactory;
+import org.apache.asterix.om.types.ATypeTag;
+import org.apache.asterix.om.types.BuiltinType;
+import org.apache.asterix.om.types.EnumDeserializer;
+import org.apache.hyracks.algebricks.runtime.base.IEvaluatorContext;
+import org.apache.hyracks.algebricks.runtime.base.IScalarEvaluator;
+import org.apache.hyracks.api.dataflow.value.ISerializerDeserializer;
+import org.apache.hyracks.api.exceptions.HyracksDataException;
+import org.apache.hyracks.api.exceptions.SourceLocation;
+import org.apache.hyracks.data.std.api.IPointable;
+import org.apache.hyracks.data.std.primitive.UTF8StringPointable;
+
+public abstract class AbstractDayTimeDurationConstructorEvaluator extends AbstractConstructorEvaluator {
+
+    private final AMutableDayTimeDuration aDayTimeDuration = new AMutableDayTimeDuration(0);
+    @SuppressWarnings("unchecked")
+    private final ISerializerDeserializer<ADayTimeDuration> dayTimeDurationSerde =
+            SerializerDeserializerProvider.INSTANCE.getSerializerDeserializer(BuiltinType.ADAYTIMEDURATION);
+    private final UTF8StringPointable utf8Ptr = new UTF8StringPointable();
+
+    protected AbstractDayTimeDurationConstructorEvaluator(IEvaluatorContext ctx, IScalarEvaluator inputEval,
+            SourceLocation sourceLoc) {
+        super(ctx, inputEval, sourceLoc);
+    }
+
+    @Override
+    protected void evaluateImpl(IPointable result) throws HyracksDataException {
+        byte[] bytes = inputArg.getByteArray();
+        int startOffset = inputArg.getStartOffset();
+        int len = inputArg.getLength();
+        ATypeTag inputType = EnumDeserializer.ATYPETAGDESERIALIZER.deserialize(bytes[startOffset]);
+        switch (inputType) {
+            case DAYTIMEDURATION:
+                result.set(inputArg);
+                break;
+            case DURATION:
+                long millis = ADurationSerializerDeserializer.getDayTime(bytes, startOffset + 1);
+                aDayTimeDuration.setMilliseconds(millis);
+                resultStorage.reset();
+                dayTimeDurationSerde.serialize(aDayTimeDuration, out);
+                result.set(resultStorage);
+                break;
+            case STRING:
+                utf8Ptr.set(bytes, startOffset + 1, len - 1);
+                if (parseDayTimeDuration(utf8Ptr, aDayTimeDuration)) {
+                    resultStorage.reset();
+                    dayTimeDurationSerde.serialize(aDayTimeDuration, out);
+                    result.set(resultStorage);
+                } else {
+                    handleParseError(utf8Ptr, result);
+                }
+                break;
+            default:
+                handleUnsupportedType(inputType, result);
+                break;
+        }
+    }
+
+    @Override
+    protected final BuiltinType getTargetType() {
+        return BuiltinType.ADAYTIMEDURATION;
+    }
+
+    private static boolean parseDayTimeDuration(UTF8StringPointable textPtr, ADayTimeDuration result) {
+        try {
+            ADurationParserFactory.parseDuration(textPtr.getByteArray(), textPtr.getCharStartOffset(),
+                    textPtr.getUTF8Length(), result, ADurationParserFactory.ADurationParseOption.DAY_TIME);
+            return true;
+        } catch (HyracksDataException e) {
+            return false;
+        }
+    }
+}
diff --git a/asterixdb/asterix-runtime/src/main/java/org/apache/asterix/runtime/evaluators/constructors/AbstractDurationConstructorEvaluator.java b/asterixdb/asterix-runtime/src/main/java/org/apache/asterix/runtime/evaluators/constructors/AbstractDurationConstructorEvaluator.java
new file mode 100644
index 0000000..ee0affd
--- /dev/null
+++ b/asterixdb/asterix-runtime/src/main/java/org/apache/asterix/runtime/evaluators/constructors/AbstractDurationConstructorEvaluator.java
@@ -0,0 +1,106 @@
+/*
+ * 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 org.apache.asterix.dataflow.data.nontagged.serde.ADayTimeDurationSerializerDeserializer;
+import org.apache.asterix.dataflow.data.nontagged.serde.AYearMonthDurationSerializerDeserializer;
+import org.apache.asterix.formats.nontagged.SerializerDeserializerProvider;
+import org.apache.asterix.om.base.ADuration;
+import org.apache.asterix.om.base.AMutableDuration;
+import org.apache.asterix.om.base.temporal.ADurationParserFactory;
+import org.apache.asterix.om.types.ATypeTag;
+import org.apache.asterix.om.types.BuiltinType;
+import org.apache.asterix.om.types.EnumDeserializer;
+import org.apache.hyracks.algebricks.runtime.base.IEvaluatorContext;
+import org.apache.hyracks.algebricks.runtime.base.IScalarEvaluator;
+import org.apache.hyracks.api.dataflow.value.ISerializerDeserializer;
+import org.apache.hyracks.api.exceptions.HyracksDataException;
+import org.apache.hyracks.api.exceptions.SourceLocation;
+import org.apache.hyracks.data.std.api.IPointable;
+import org.apache.hyracks.data.std.primitive.UTF8StringPointable;
+
+public abstract class AbstractDurationConstructorEvaluator extends AbstractConstructorEvaluator {
+
+    private final AMutableDuration aDuration = new AMutableDuration(0, 0);
+    @SuppressWarnings("unchecked")
+    private final ISerializerDeserializer<ADuration> durationSerde =
+            SerializerDeserializerProvider.INSTANCE.getSerializerDeserializer(BuiltinType.ADURATION);
+    private final UTF8StringPointable utf8Ptr = new UTF8StringPointable();
+
+    protected AbstractDurationConstructorEvaluator(IEvaluatorContext ctx, IScalarEvaluator inputEval,
+            SourceLocation sourceLoc) {
+        super(ctx, inputEval, sourceLoc);
+    }
+
+    @Override
+    protected void evaluateImpl(IPointable result) throws HyracksDataException {
+        byte[] bytes = inputArg.getByteArray();
+        int startOffset = inputArg.getStartOffset();
+        int len = inputArg.getLength();
+        ATypeTag inputType = EnumDeserializer.ATYPETAGDESERIALIZER.deserialize(bytes[startOffset]);
+        switch (inputType) {
+            case DURATION:
+                result.set(inputArg);
+                break;
+            case YEARMONTHDURATION:
+                int months = AYearMonthDurationSerializerDeserializer.getYearMonth(bytes, startOffset + 1);
+                aDuration.setValue(months, 0);
+                resultStorage.reset();
+                durationSerde.serialize(aDuration, out);
+                result.set(resultStorage);
+                break;
+            case DAYTIMEDURATION:
+                long millis = ADayTimeDurationSerializerDeserializer.getDayTime(bytes, startOffset + 1);
+                aDuration.setValue(0, millis);
+                resultStorage.reset();
+                durationSerde.serialize(aDuration, out);
+                result.set(resultStorage);
+                break;
+            case STRING:
+                utf8Ptr.set(bytes, startOffset + 1, len - 1);
+                if (parseDuration(utf8Ptr, aDuration)) {
+                    resultStorage.reset();
+                    durationSerde.serialize(aDuration, out);
+                    result.set(resultStorage);
+                } else {
+                    handleParseError(utf8Ptr, result);
+                }
+                break;
+            default:
+                handleUnsupportedType(inputType, result);
+                break;
+        }
+    }
+
+    @Override
+    protected final BuiltinType getTargetType() {
+        return BuiltinType.ADURATION;
+    }
+
+    private static boolean parseDuration(UTF8StringPointable textPtr, ADuration result) {
+        try {
+            ADurationParserFactory.parseDuration(textPtr.getByteArray(), textPtr.getCharStartOffset(),
+                    textPtr.getUTF8Length(), result, ADurationParserFactory.ADurationParseOption.All);
+            return true;
+        } catch (HyracksDataException e) {
+            return false;
+        }
+    }
+}
diff --git a/asterixdb/asterix-runtime/src/main/java/org/apache/asterix/runtime/evaluators/constructors/AbstractFloatConstructorEvaluator.java b/asterixdb/asterix-runtime/src/main/java/org/apache/asterix/runtime/evaluators/constructors/AbstractFloatConstructorEvaluator.java
new file mode 100644
index 0000000..3d50a6c
--- /dev/null
+++ b/asterixdb/asterix-runtime/src/main/java/org/apache/asterix/runtime/evaluators/constructors/AbstractFloatConstructorEvaluator.java
@@ -0,0 +1,114 @@
+/*
+ * 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.IOException;
+
+import org.apache.asterix.dataflow.data.nontagged.serde.ABooleanSerializerDeserializer;
+import org.apache.asterix.formats.nontagged.SerializerDeserializerProvider;
+import org.apache.asterix.om.base.AFloat;
+import org.apache.asterix.om.base.AMutableFloat;
+import org.apache.asterix.om.types.ATypeTag;
+import org.apache.asterix.om.types.BuiltinType;
+import org.apache.asterix.om.types.EnumDeserializer;
+import org.apache.asterix.om.types.hierachy.ATypeHierarchy;
+import org.apache.asterix.runtime.evaluators.common.NumberUtils;
+import org.apache.hyracks.algebricks.runtime.base.IEvaluatorContext;
+import org.apache.hyracks.algebricks.runtime.base.IScalarEvaluator;
+import org.apache.hyracks.api.dataflow.value.ISerializerDeserializer;
+import org.apache.hyracks.api.exceptions.HyracksDataException;
+import org.apache.hyracks.api.exceptions.SourceLocation;
+import org.apache.hyracks.data.std.api.IPointable;
+import org.apache.hyracks.data.std.primitive.UTF8StringPointable;
+
+public abstract class AbstractFloatConstructorEvaluator extends AbstractConstructorEvaluator {
+
+    private final AMutableFloat aFloat = new AMutableFloat(0);
+    @SuppressWarnings("unchecked")
+    private final ISerializerDeserializer<AFloat> floatSerde =
+            SerializerDeserializerProvider.INSTANCE.getSerializerDeserializer(BuiltinType.AFLOAT);
+    private final UTF8StringPointable utf8Ptr = new UTF8StringPointable();
+
+    protected AbstractFloatConstructorEvaluator(IEvaluatorContext ctx, IScalarEvaluator inputEval,
+            SourceLocation sourceLoc) {
+        super(ctx, inputEval, sourceLoc);
+    }
+
+    @Override
+    protected void evaluateImpl(IPointable result) throws HyracksDataException {
+        byte[] bytes = inputArg.getByteArray();
+        int startOffset = inputArg.getStartOffset();
+        int len = inputArg.getLength();
+        ATypeTag inputType = EnumDeserializer.ATYPETAGDESERIALIZER.deserialize(bytes[startOffset]);
+        switch (inputType) {
+            case FLOAT:
+                result.set(inputArg);
+                break;
+            case TINYINT:
+            case SMALLINT:
+            case INTEGER:
+            case BIGINT:
+                resultStorage.reset();
+                try {
+                    ATypeHierarchy.getTypePromoteComputer(inputType, ATypeTag.FLOAT).convertType(bytes, startOffset + 1,
+                            len - 1, out);
+                } catch (IOException e) {
+                    throw HyracksDataException.create(e);
+                }
+                result.set(resultStorage);
+                break;
+            case DOUBLE:
+                resultStorage.reset();
+                try {
+                    ATypeHierarchy.getTypeDemoteComputer(inputType, ATypeTag.FLOAT, false).convertType(bytes,
+                            startOffset + 1, len - 1, out);
+                } catch (IOException e) {
+                    throw HyracksDataException.create(e);
+                }
+                result.set(resultStorage);
+                break;
+            case BOOLEAN:
+                boolean b = ABooleanSerializerDeserializer.getBoolean(bytes, startOffset + 1);
+                aFloat.setValue(b ? 1 : 0);
+                resultStorage.reset();
+                floatSerde.serialize(aFloat, out);
+                result.set(resultStorage);
+                break;
+            case STRING:
+                utf8Ptr.set(bytes, startOffset + 1, len - 1);
+                if (NumberUtils.parseFloat(utf8Ptr, aFloat)) {
+                    resultStorage.reset();
+                    floatSerde.serialize(aFloat, out);
+                    result.set(resultStorage);
+                } else {
+                    handleParseError(utf8Ptr, result);
+                }
+                break;
+            default:
+                handleUnsupportedType(inputType, result);
+                break;
+        }
+    }
+
+    @Override
+    protected final BuiltinType getTargetType() {
+        return BuiltinType.AFLOAT;
+    }
+}
diff --git a/asterixdb/asterix-runtime/src/main/java/org/apache/asterix/runtime/evaluators/constructors/AbstractInt16ConstructorEvaluator.java b/asterixdb/asterix-runtime/src/main/java/org/apache/asterix/runtime/evaluators/constructors/AbstractInt16ConstructorEvaluator.java
new file mode 100644
index 0000000..5e2755b
--- /dev/null
+++ b/asterixdb/asterix-runtime/src/main/java/org/apache/asterix/runtime/evaluators/constructors/AbstractInt16ConstructorEvaluator.java
@@ -0,0 +1,114 @@
+/*
+ * 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.IOException;
+
+import org.apache.asterix.dataflow.data.nontagged.serde.ABooleanSerializerDeserializer;
+import org.apache.asterix.formats.nontagged.SerializerDeserializerProvider;
+import org.apache.asterix.om.base.AInt16;
+import org.apache.asterix.om.base.AMutableInt16;
+import org.apache.asterix.om.types.ATypeTag;
+import org.apache.asterix.om.types.BuiltinType;
+import org.apache.asterix.om.types.EnumDeserializer;
+import org.apache.asterix.om.types.hierachy.ATypeHierarchy;
+import org.apache.asterix.runtime.evaluators.common.NumberUtils;
+import org.apache.hyracks.algebricks.runtime.base.IEvaluatorContext;
+import org.apache.hyracks.algebricks.runtime.base.IScalarEvaluator;
+import org.apache.hyracks.api.dataflow.value.ISerializerDeserializer;
+import org.apache.hyracks.api.exceptions.HyracksDataException;
+import org.apache.hyracks.api.exceptions.SourceLocation;
+import org.apache.hyracks.data.std.api.IPointable;
+import org.apache.hyracks.data.std.primitive.UTF8StringPointable;
+
+public abstract class AbstractInt16ConstructorEvaluator extends AbstractConstructorEvaluator {
+
+    private final AMutableInt16 aInt16 = new AMutableInt16((short) 0);
+    @SuppressWarnings("unchecked")
+    private final ISerializerDeserializer<AInt16> int16Serde =
+            SerializerDeserializerProvider.INSTANCE.getSerializerDeserializer(BuiltinType.AINT16);
+    private final UTF8StringPointable utf8Ptr = new UTF8StringPointable();
+
+    protected AbstractInt16ConstructorEvaluator(IEvaluatorContext ctx, IScalarEvaluator inputEval,
+            SourceLocation sourceLoc) {
+        super(ctx, inputEval, sourceLoc);
+    }
+
+    @Override
+    protected void evaluateImpl(IPointable result) throws HyracksDataException {
+        byte[] bytes = inputArg.getByteArray();
+        int startOffset = inputArg.getStartOffset();
+        int len = inputArg.getLength();
+        ATypeTag inputType = EnumDeserializer.ATYPETAGDESERIALIZER.deserialize(bytes[startOffset]);
+        switch (inputType) {
+            case SMALLINT:
+                result.set(inputArg);
+                break;
+            case TINYINT:
+                resultStorage.reset();
+                try {
+                    ATypeHierarchy.getTypePromoteComputer(inputType, ATypeTag.SMALLINT).convertType(bytes,
+                            startOffset + 1, len - 1, out);
+                } catch (IOException e) {
+                    throw HyracksDataException.create(e);
+                }
+                result.set(resultStorage);
+                break;
+            case INTEGER:
+            case BIGINT:
+            case FLOAT:
+            case DOUBLE:
+                resultStorage.reset();
+                try {
+                    ATypeHierarchy.getTypeDemoteComputer(inputType, ATypeTag.SMALLINT, false).convertType(bytes,
+                            startOffset + 1, len - 1, out);
+                } catch (IOException e) {
+                    throw HyracksDataException.create(e);
+                }
+                result.set(resultStorage);
+                break;
+            case BOOLEAN:
+                boolean b = ABooleanSerializerDeserializer.getBoolean(bytes, startOffset + 1);
+                aInt16.setValue((short) (b ? 1 : 0));
+                resultStorage.reset();
+                int16Serde.serialize(aInt16, out);
+                result.set(resultStorage);
+                break;
+            case STRING:
+                utf8Ptr.set(bytes, startOffset + 1, len - 1);
+                if (NumberUtils.parseInt16(utf8Ptr, aInt16)) {
+                    resultStorage.reset();
+                    int16Serde.serialize(aInt16, out);
+                    result.set(resultStorage);
+                } else {
+                    handleParseError(utf8Ptr, result);
+                }
+                break;
+            default:
+                handleUnsupportedType(inputType, result);
+                break;
+        }
+    }
+
+    @Override
+    protected final BuiltinType getTargetType() {
+        return BuiltinType.AINT16;
+    }
+}
diff --git a/asterixdb/asterix-runtime/src/main/java/org/apache/asterix/runtime/evaluators/constructors/AbstractInt32ConstructorEvaluator.java b/asterixdb/asterix-runtime/src/main/java/org/apache/asterix/runtime/evaluators/constructors/AbstractInt32ConstructorEvaluator.java
new file mode 100644
index 0000000..7d36307
--- /dev/null
+++ b/asterixdb/asterix-runtime/src/main/java/org/apache/asterix/runtime/evaluators/constructors/AbstractInt32ConstructorEvaluator.java
@@ -0,0 +1,114 @@
+/*
+ * 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.IOException;
+
+import org.apache.asterix.dataflow.data.nontagged.serde.ABooleanSerializerDeserializer;
+import org.apache.asterix.formats.nontagged.SerializerDeserializerProvider;
+import org.apache.asterix.om.base.AInt32;
+import org.apache.asterix.om.base.AMutableInt32;
+import org.apache.asterix.om.types.ATypeTag;
+import org.apache.asterix.om.types.BuiltinType;
+import org.apache.asterix.om.types.EnumDeserializer;
+import org.apache.asterix.om.types.hierachy.ATypeHierarchy;
+import org.apache.asterix.runtime.evaluators.common.NumberUtils;
+import org.apache.hyracks.algebricks.runtime.base.IEvaluatorContext;
+import org.apache.hyracks.algebricks.runtime.base.IScalarEvaluator;
+import org.apache.hyracks.api.dataflow.value.ISerializerDeserializer;
+import org.apache.hyracks.api.exceptions.HyracksDataException;
+import org.apache.hyracks.api.exceptions.SourceLocation;
+import org.apache.hyracks.data.std.api.IPointable;
+import org.apache.hyracks.data.std.primitive.UTF8StringPointable;
+
+public abstract class AbstractInt32ConstructorEvaluator extends AbstractConstructorEvaluator {
+
+    private final AMutableInt32 aInt32 = new AMutableInt32(0);
+    @SuppressWarnings("unchecked")
+    private final ISerializerDeserializer<AInt32> int32Serde =
+            SerializerDeserializerProvider.INSTANCE.getSerializerDeserializer(BuiltinType.AINT32);
+    private final UTF8StringPointable utf8Ptr = new UTF8StringPointable();
+
+    protected AbstractInt32ConstructorEvaluator(IEvaluatorContext ctx, IScalarEvaluator inputEval,
+            SourceLocation sourceLoc) {
+        super(ctx, inputEval, sourceLoc);
+    }
+
+    @Override
+    protected void evaluateImpl(IPointable result) throws HyracksDataException {
+        byte[] bytes = inputArg.getByteArray();
+        int startOffset = inputArg.getStartOffset();
+        int len = inputArg.getLength();
+        ATypeTag inputType = EnumDeserializer.ATYPETAGDESERIALIZER.deserialize(bytes[startOffset]);
+        switch (inputType) {
+            case INTEGER:
+                result.set(inputArg);
+                break;
+            case TINYINT:
+            case SMALLINT:
+                resultStorage.reset();
+                try {
+                    ATypeHierarchy.getTypePromoteComputer(inputType, ATypeTag.INTEGER).convertType(bytes,
+                            startOffset + 1, len - 1, out);
+                } catch (IOException e) {
+                    throw HyracksDataException.create(e);
+                }
+                result.set(resultStorage);
+                break;
+            case BIGINT:
+            case FLOAT:
+            case DOUBLE:
+                resultStorage.reset();
+                try {
+                    ATypeHierarchy.getTypeDemoteComputer(inputType, ATypeTag.INTEGER, false).convertType(bytes,
+                            startOffset + 1, len - 1, out);
+                } catch (IOException e) {
+                    throw HyracksDataException.create(e);
+                }
+                result.set(resultStorage);
+                break;
+            case BOOLEAN:
+                boolean b = ABooleanSerializerDeserializer.getBoolean(bytes, startOffset + 1);
+                aInt32.setValue(b ? 1 : 0);
+                resultStorage.reset();
+                int32Serde.serialize(aInt32, out);
+                result.set(resultStorage);
+                break;
+            case STRING:
+                utf8Ptr.set(bytes, startOffset + 1, len - 1);
+                if (NumberUtils.parseInt32(utf8Ptr, aInt32)) {
+                    resultStorage.reset();
+                    int32Serde.serialize(aInt32, out);
+                    result.set(resultStorage);
+                } else {
+                    handleParseError(utf8Ptr, result);
+                }
+                break;
+            default:
+                handleUnsupportedType(inputType, result);
+                break;
+        }
+    }
+
+    @Override
+    protected final BuiltinType getTargetType() {
+        return BuiltinType.AINT32;
+    }
+}
diff --git a/asterixdb/asterix-runtime/src/main/java/org/apache/asterix/runtime/evaluators/constructors/AbstractInt8ConstructorEvaluator.java b/asterixdb/asterix-runtime/src/main/java/org/apache/asterix/runtime/evaluators/constructors/AbstractInt8ConstructorEvaluator.java
new file mode 100644
index 0000000..d236076
--- /dev/null
+++ b/asterixdb/asterix-runtime/src/main/java/org/apache/asterix/runtime/evaluators/constructors/AbstractInt8ConstructorEvaluator.java
@@ -0,0 +1,105 @@
+/*
+ * 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.IOException;
+
+import org.apache.asterix.dataflow.data.nontagged.serde.ABooleanSerializerDeserializer;
+import org.apache.asterix.formats.nontagged.SerializerDeserializerProvider;
+import org.apache.asterix.om.base.AInt8;
+import org.apache.asterix.om.base.AMutableInt8;
+import org.apache.asterix.om.types.ATypeTag;
+import org.apache.asterix.om.types.BuiltinType;
+import org.apache.asterix.om.types.EnumDeserializer;
+import org.apache.asterix.om.types.hierachy.ATypeHierarchy;
+import org.apache.asterix.runtime.evaluators.common.NumberUtils;
+import org.apache.hyracks.algebricks.runtime.base.IEvaluatorContext;
+import org.apache.hyracks.algebricks.runtime.base.IScalarEvaluator;
+import org.apache.hyracks.api.dataflow.value.ISerializerDeserializer;
+import org.apache.hyracks.api.exceptions.HyracksDataException;
+import org.apache.hyracks.api.exceptions.SourceLocation;
+import org.apache.hyracks.data.std.api.IPointable;
+import org.apache.hyracks.data.std.primitive.UTF8StringPointable;
+
+public abstract class AbstractInt8ConstructorEvaluator extends AbstractConstructorEvaluator {
+
+    private final AMutableInt8 aInt8 = new AMutableInt8((byte) 0);
+    @SuppressWarnings("unchecked")
+    private final ISerializerDeserializer<AInt8> int8Serde =
+            SerializerDeserializerProvider.INSTANCE.getSerializerDeserializer(BuiltinType.AINT8);
+    private final UTF8StringPointable utf8Ptr = new UTF8StringPointable();
+
+    protected AbstractInt8ConstructorEvaluator(IEvaluatorContext ctx, IScalarEvaluator inputEval,
+            SourceLocation sourceLoc) {
+        super(ctx, inputEval, sourceLoc);
+    }
+
+    @Override
+    protected void evaluateImpl(IPointable result) throws HyracksDataException {
+        byte[] bytes = inputArg.getByteArray();
+        int startOffset = inputArg.getStartOffset();
+        int len = inputArg.getLength();
+        ATypeTag inputType = EnumDeserializer.ATYPETAGDESERIALIZER.deserialize(bytes[startOffset]);
+        switch (inputType) {
+            case TINYINT:
+                result.set(inputArg);
+                break;
+            case SMALLINT:
+            case INTEGER:
+            case BIGINT:
+            case FLOAT:
+            case DOUBLE:
+                resultStorage.reset();
+                try {
+                    ATypeHierarchy.getTypeDemoteComputer(inputType, ATypeTag.TINYINT, false).convertType(bytes,
+                            startOffset + 1, len - 1, out);
+                } catch (IOException e) {
+                    throw HyracksDataException.create(e);
+                }
+                result.set(resultStorage);
+                break;
+            case BOOLEAN:
+                boolean b = ABooleanSerializerDeserializer.getBoolean(bytes, startOffset + 1);
+                aInt8.setValue((byte) (b ? 1 : 0));
+                resultStorage.reset();
+                int8Serde.serialize(aInt8, out);
+                result.set(resultStorage);
+                break;
+            case STRING:
+                utf8Ptr.set(bytes, startOffset + 1, len - 1);
+                if (NumberUtils.parseInt8(utf8Ptr, aInt8)) {
+                    resultStorage.reset();
+                    int8Serde.serialize(aInt8, out);
+                    result.set(resultStorage);
+                } else {
+                    handleParseError(utf8Ptr, result);
+                }
+                break;
+            default:
+                handleUnsupportedType(inputType, result);
+                break;
+        }
+    }
+
+    @Override
+    protected final BuiltinType getTargetType() {
+        return BuiltinType.AINT8;
+    }
+}
diff --git a/asterixdb/asterix-runtime/src/main/java/org/apache/asterix/runtime/evaluators/constructors/AbstractTimeWithFormatConstructorEvaluator.java b/asterixdb/asterix-runtime/src/main/java/org/apache/asterix/runtime/evaluators/constructors/AbstractTimeWithFormatConstructorEvaluator.java
new file mode 100644
index 0000000..d70e3bb
--- /dev/null
+++ b/asterixdb/asterix-runtime/src/main/java/org/apache/asterix/runtime/evaluators/constructors/AbstractTimeWithFormatConstructorEvaluator.java
@@ -0,0 +1,86 @@
+/*
+ * 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 org.apache.asterix.om.base.AMutableInt64;
+import org.apache.asterix.om.base.AMutableTime;
+import org.apache.asterix.om.base.temporal.AsterixTemporalTypeParseException;
+import org.apache.asterix.om.base.temporal.DateTimeFormatUtils;
+import org.apache.asterix.om.types.ATypeTag;
+import org.apache.asterix.runtime.evaluators.functions.PointableHelper;
+import org.apache.hyracks.algebricks.runtime.base.IEvaluatorContext;
+import org.apache.hyracks.algebricks.runtime.base.IScalarEvaluator;
+import org.apache.hyracks.algebricks.runtime.base.IScalarEvaluatorFactory;
+import org.apache.hyracks.api.exceptions.HyracksDataException;
+import org.apache.hyracks.api.exceptions.SourceLocation;
+import org.apache.hyracks.data.std.api.IPointable;
+import org.apache.hyracks.data.std.primitive.UTF8StringPointable;
+import org.apache.hyracks.data.std.primitive.VoidPointable;
+import org.apache.hyracks.dataflow.common.data.accessors.IFrameTupleReference;
+
+public abstract class AbstractTimeWithFormatConstructorEvaluator extends AbstractTimeConstructorEvaluator {
+
+    private final IScalarEvaluator formatEval;
+    private final IPointable formatArg = new VoidPointable();
+    private final UTF8StringPointable formatTextPtr = new UTF8StringPointable();
+    private final AMutableInt64 aInt64 = new AMutableInt64(0);
+
+    protected AbstractTimeWithFormatConstructorEvaluator(IEvaluatorContext ctx, IScalarEvaluatorFactory[] args,
+            SourceLocation sourceLoc) throws HyracksDataException {
+        super(ctx, args[0].createScalarEvaluator(ctx), sourceLoc);
+        formatEval = args[1].createScalarEvaluator(ctx);
+    }
+
+    @Override
+    protected void evaluateInput(IFrameTupleReference tuple) throws HyracksDataException {
+        super.evaluateInput(tuple);
+        formatEval.evaluate(tuple, formatArg);
+    }
+
+    @Override
+    protected boolean checkAndSetMissingOrNull(IPointable result) throws HyracksDataException {
+        return PointableHelper.checkAndSetMissingOrNull(result, inputArg, formatArg);
+    }
+
+    @Override
+    protected boolean parseTime(UTF8StringPointable textPtr, AMutableTime result) {
+        byte[] formatBytes = formatArg.getByteArray();
+        int formatStartOffset = formatArg.getStartOffset();
+        int formatLength = formatArg.getLength();
+        if (formatBytes[formatStartOffset] != ATypeTag.SERIALIZED_STRING_TYPE_TAG) {
+            return false;
+        }
+        formatTextPtr.set(formatBytes, formatStartOffset + 1, formatLength - 1);
+        try {
+            if (DateTimeFormatUtils.getInstance().parseDateTime(aInt64, textPtr.getByteArray(),
+                    textPtr.getCharStartOffset(), textPtr.getUTF8Length(), formatBytes,
+                    formatTextPtr.getCharStartOffset(), formatTextPtr.getUTF8Length(),
+                    DateTimeFormatUtils.DateTimeParseMode.TIME_ONLY, false)) {
+                result.setValue((int) aInt64.getLongValue());
+                return true;
+            } else {
+                return false;
+            }
+        } catch (AsterixTemporalTypeParseException e) {
+            // shouldn't happen
+            return false;
+        }
+    }
+}
diff --git a/asterixdb/asterix-runtime/src/main/java/org/apache/asterix/runtime/evaluators/constructors/AbstractUUIDFromStringConstructorEvaluator.java b/asterixdb/asterix-runtime/src/main/java/org/apache/asterix/runtime/evaluators/constructors/AbstractUUIDFromStringConstructorEvaluator.java
new file mode 100644
index 0000000..e429c1d
--- /dev/null
+++ b/asterixdb/asterix-runtime/src/main/java/org/apache/asterix/runtime/evaluators/constructors/AbstractUUIDFromStringConstructorEvaluator.java
@@ -0,0 +1,89 @@
+/*
+ * 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 org.apache.asterix.formats.nontagged.SerializerDeserializerProvider;
+import org.apache.asterix.om.base.AMutableUUID;
+import org.apache.asterix.om.base.AUUID;
+import org.apache.asterix.om.types.ATypeTag;
+import org.apache.asterix.om.types.BuiltinType;
+import org.apache.asterix.om.types.EnumDeserializer;
+import org.apache.hyracks.algebricks.runtime.base.IEvaluatorContext;
+import org.apache.hyracks.algebricks.runtime.base.IScalarEvaluator;
+import org.apache.hyracks.api.dataflow.value.ISerializerDeserializer;
+import org.apache.hyracks.api.exceptions.HyracksDataException;
+import org.apache.hyracks.api.exceptions.SourceLocation;
+import org.apache.hyracks.data.std.api.IPointable;
+import org.apache.hyracks.data.std.primitive.UTF8StringPointable;
+
+public abstract class AbstractUUIDFromStringConstructorEvaluator extends AbstractConstructorEvaluator {
+
+    private final AMutableUUID uuid = new AMutableUUID();
+    @SuppressWarnings("unchecked")
+    private final ISerializerDeserializer<AUUID> uuidSerde =
+            SerializerDeserializerProvider.INSTANCE.getSerializerDeserializer(BuiltinType.AUUID);
+    private final UTF8StringPointable utf8Ptr = new UTF8StringPointable();
+
+    protected AbstractUUIDFromStringConstructorEvaluator(IEvaluatorContext ctx, IScalarEvaluator inputEval,
+            SourceLocation sourceLoc) {
+        super(ctx, inputEval, sourceLoc);
+    }
+
+    @Override
+    protected void evaluateImpl(IPointable result) throws HyracksDataException {
+        byte[] bytes = inputArg.getByteArray();
+        int startOffset = inputArg.getStartOffset();
+        int len = inputArg.getLength();
+        ATypeTag inputType = EnumDeserializer.ATYPETAGDESERIALIZER.deserialize(bytes[startOffset]);
+        switch (inputType) {
+            case UUID:
+                result.set(inputArg);
+                break;
+            case STRING:
+                utf8Ptr.set(bytes, startOffset + 1, len - 1);
+                if (parseUUID(utf8Ptr, uuid)) {
+                    resultStorage.reset();
+                    uuidSerde.serialize(uuid, out);
+                    result.set(resultStorage);
+                } else {
+                    handleParseError(utf8Ptr, result);
+                }
+                break;
+            default:
+                handleUnsupportedType(inputType, result);
+                break;
+        }
+    }
+
+    @Override
+    protected final BuiltinType getTargetType() {
+        return BuiltinType.AUUID;
+    }
+
+    private static boolean parseUUID(UTF8StringPointable textPtr, AMutableUUID result) {
+        try {
+            // first byte: tag, next x bytes: length
+            result.parseUUIDHexBytes(textPtr.getByteArray(), textPtr.getCharStartOffset());
+            return true;
+        } catch (HyracksDataException e) {
+            return false;
+        }
+    }
+}
diff --git a/asterixdb/asterix-runtime/src/main/java/org/apache/asterix/runtime/evaluators/constructors/AbstractYearMonthDurationConstructorEvaluator.java b/asterixdb/asterix-runtime/src/main/java/org/apache/asterix/runtime/evaluators/constructors/AbstractYearMonthDurationConstructorEvaluator.java
new file mode 100644
index 0000000..5c39367
--- /dev/null
+++ b/asterixdb/asterix-runtime/src/main/java/org/apache/asterix/runtime/evaluators/constructors/AbstractYearMonthDurationConstructorEvaluator.java
@@ -0,0 +1,98 @@
+/*
+ * 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 org.apache.asterix.dataflow.data.nontagged.serde.ADurationSerializerDeserializer;
+import org.apache.asterix.formats.nontagged.SerializerDeserializerProvider;
+import org.apache.asterix.om.base.AMutableYearMonthDuration;
+import org.apache.asterix.om.base.AYearMonthDuration;
+import org.apache.asterix.om.base.temporal.ADurationParserFactory;
+import org.apache.asterix.om.types.ATypeTag;
+import org.apache.asterix.om.types.BuiltinType;
+import org.apache.asterix.om.types.EnumDeserializer;
+import org.apache.hyracks.algebricks.runtime.base.IEvaluatorContext;
+import org.apache.hyracks.algebricks.runtime.base.IScalarEvaluator;
+import org.apache.hyracks.api.dataflow.value.ISerializerDeserializer;
+import org.apache.hyracks.api.exceptions.HyracksDataException;
+import org.apache.hyracks.api.exceptions.SourceLocation;
+import org.apache.hyracks.data.std.api.IPointable;
+import org.apache.hyracks.data.std.primitive.UTF8StringPointable;
+
+public abstract class AbstractYearMonthDurationConstructorEvaluator extends AbstractConstructorEvaluator {
+
+    private final AMutableYearMonthDuration aYearMonthDuration = new AMutableYearMonthDuration(0);
+    @SuppressWarnings("unchecked")
+    private final ISerializerDeserializer<AYearMonthDuration> yearMonthDurationSerde =
+            SerializerDeserializerProvider.INSTANCE.getSerializerDeserializer(BuiltinType.AYEARMONTHDURATION);
+    private final UTF8StringPointable utf8Ptr = new UTF8StringPointable();
+
+    protected AbstractYearMonthDurationConstructorEvaluator(IEvaluatorContext ctx, IScalarEvaluator inputEval,
+            SourceLocation sourceLoc) {
+        super(ctx, inputEval, sourceLoc);
+    }
+
+    @Override
+    protected void evaluateImpl(IPointable result) throws HyracksDataException {
+        byte[] bytes = inputArg.getByteArray();
+        int startOffset = inputArg.getStartOffset();
+        int len = inputArg.getLength();
+        ATypeTag inputType = EnumDeserializer.ATYPETAGDESERIALIZER.deserialize(bytes[startOffset]);
+        switch (inputType) {
+            case YEARMONTHDURATION:
+                result.set(inputArg);
+                break;
+            case DURATION:
+                int months = ADurationSerializerDeserializer.getYearMonth(bytes, startOffset + 1);
+                aYearMonthDuration.setMonths(months);
+                resultStorage.reset();
+                yearMonthDurationSerde.serialize(aYearMonthDuration, out);
+                result.set(resultStorage);
+                break;
+            case STRING:
+                utf8Ptr.set(bytes, startOffset + 1, len - 1);
+                if (parseYearMonthDuration(utf8Ptr, aYearMonthDuration)) {
+                    resultStorage.reset();
+                    yearMonthDurationSerde.serialize(aYearMonthDuration, out);
+                    result.set(resultStorage);
+                } else {
+                    handleParseError(utf8Ptr, result);
+                }
+                break;
+            default:
+                handleUnsupportedType(inputType, result);
+                break;
+        }
+    }
+
+    @Override
+    protected final BuiltinType getTargetType() {
+        return BuiltinType.AYEARMONTHDURATION;
+    }
+
+    private static boolean parseYearMonthDuration(UTF8StringPointable textPtr, AMutableYearMonthDuration result) {
+        try {
+            ADurationParserFactory.parseDuration(textPtr.getByteArray(), textPtr.getCharStartOffset(),
+                    textPtr.getUTF8Length(), result, ADurationParserFactory.ADurationParseOption.YEAR_MONTH);
+            return true;
+        } catch (HyracksDataException e) {
+            return false;
+        }
+    }
+}
diff --git a/asterixdb/asterix-runtime/src/main/java/org/apache/asterix/runtime/evaluators/functions/PointableHelper.java b/asterixdb/asterix-runtime/src/main/java/org/apache/asterix/runtime/evaluators/functions/PointableHelper.java
index 4a4c36c..e0fbe5c 100644
--- a/asterixdb/asterix-runtime/src/main/java/org/apache/asterix/runtime/evaluators/functions/PointableHelper.java
+++ b/asterixdb/asterix-runtime/src/main/java/org/apache/asterix/runtime/evaluators/functions/PointableHelper.java
@@ -308,6 +308,26 @@
     }
 
     /**
+     * Checks whether the pointable {@param pointable1} is null or missing, and if true, assigns null to the
+     * {@param result}.
+     *
+     * @param result the result pointable that will hold the null value
+     * @param pointable1 the pointable to be checked
+     *
+     * @return {@code true} if the {@param pointable1} value is missing or null, {@code false} otherwise.
+     */
+    public static boolean checkAndSetNull(IPointable result, IPointable pointable1) throws HyracksDataException {
+        switch (getPointableValueState(pointable1, null)) {
+            case MISSING:
+            case NULL:
+                setNull(result);
+                return true;
+            default:
+                return false;
+        }
+    }
+
+    /**
      * This method checks and returns the pointable value state.
      *
      * If a ListAccessor is passed to this function, it will check if the passed pointable is a list, and if so, it
diff --git a/asterixdb/asterix-runtime/src/main/java/org/apache/asterix/runtime/functions/FunctionCollection.java b/asterixdb/asterix-runtime/src/main/java/org/apache/asterix/runtime/functions/FunctionCollection.java
index b32d0db..f2d1f7a 100644
--- a/asterixdb/asterix-runtime/src/main/java/org/apache/asterix/runtime/functions/FunctionCollection.java
+++ b/asterixdb/asterix-runtime/src/main/java/org/apache/asterix/runtime/functions/FunctionCollection.java
@@ -272,21 +272,35 @@
 import org.apache.asterix.runtime.evaluators.comparisons.NullIfEqualsDescriptor;
 import org.apache.asterix.runtime.evaluators.comparisons.PosInfIfEqualsDescriptor;
 import org.apache.asterix.runtime.evaluators.constructors.ABinaryBase64StringConstructorDescriptor;
+import org.apache.asterix.runtime.evaluators.constructors.ABinaryBase64StringDefaultNullConstructorDescriptor;
 import org.apache.asterix.runtime.evaluators.constructors.ABinaryHexStringConstructorDescriptor;
 import org.apache.asterix.runtime.evaluators.constructors.ABooleanConstructorDescriptor;
+import org.apache.asterix.runtime.evaluators.constructors.ABooleanDefaultNullConstructorDescriptor;
 import org.apache.asterix.runtime.evaluators.constructors.ACircleConstructorDescriptor;
 import org.apache.asterix.runtime.evaluators.constructors.ADateConstructorDescriptor;
 import org.apache.asterix.runtime.evaluators.constructors.ADateConstructorWithFormatDescriptor;
+import org.apache.asterix.runtime.evaluators.constructors.ADateDefaultNullConstructorDescriptor;
+import org.apache.asterix.runtime.evaluators.constructors.ADateDefaultNullConstructorWithFormatDescriptor;
 import org.apache.asterix.runtime.evaluators.constructors.ADateTimeConstructorDescriptor;
 import org.apache.asterix.runtime.evaluators.constructors.ADateTimeConstructorWithFormatDescriptor;
+import org.apache.asterix.runtime.evaluators.constructors.ADateTimeDefaultNullConstructorDescriptor;
+import org.apache.asterix.runtime.evaluators.constructors.ADateTimeDefaultNullConstructorWithFormatDescriptor;
 import org.apache.asterix.runtime.evaluators.constructors.ADayTimeDurationConstructorDescriptor;
+import org.apache.asterix.runtime.evaluators.constructors.ADayTimeDurationDefaultNullConstructorDescriptor;
 import org.apache.asterix.runtime.evaluators.constructors.ADoubleConstructorDescriptor;
+import org.apache.asterix.runtime.evaluators.constructors.ADoubleDefaultNullConstructorDescriptor;
 import org.apache.asterix.runtime.evaluators.constructors.ADurationConstructorDescriptor;
+import org.apache.asterix.runtime.evaluators.constructors.ADurationDefaultNullConstructorDescriptor;
 import org.apache.asterix.runtime.evaluators.constructors.AFloatConstructorDescriptor;
+import org.apache.asterix.runtime.evaluators.constructors.AFloatDefaultNullConstructorDescriptor;
 import org.apache.asterix.runtime.evaluators.constructors.AInt16ConstructorDescriptor;
+import org.apache.asterix.runtime.evaluators.constructors.AInt16DefaultNullConstructorDescriptor;
 import org.apache.asterix.runtime.evaluators.constructors.AInt32ConstructorDescriptor;
+import org.apache.asterix.runtime.evaluators.constructors.AInt32DefaultNullConstructorDescriptor;
 import org.apache.asterix.runtime.evaluators.constructors.AInt64ConstructorDescriptor;
+import org.apache.asterix.runtime.evaluators.constructors.AInt64DefaultNullConstructorDescriptor;
 import org.apache.asterix.runtime.evaluators.constructors.AInt8ConstructorDescriptor;
+import org.apache.asterix.runtime.evaluators.constructors.AInt8DefaultNullConstructorDescriptor;
 import org.apache.asterix.runtime.evaluators.constructors.AIntervalConstructorDescriptor;
 import org.apache.asterix.runtime.evaluators.constructors.AIntervalStartFromDateConstructorDescriptor;
 import org.apache.asterix.runtime.evaluators.constructors.AIntervalStartFromDateTimeConstructorDescriptor;
@@ -297,10 +311,15 @@
 import org.apache.asterix.runtime.evaluators.constructors.APolygonConstructorDescriptor;
 import org.apache.asterix.runtime.evaluators.constructors.ARectangleConstructorDescriptor;
 import org.apache.asterix.runtime.evaluators.constructors.AStringConstructorDescriptor;
+import org.apache.asterix.runtime.evaluators.constructors.AStringDefaultNullConstructorDescriptor;
 import org.apache.asterix.runtime.evaluators.constructors.ATimeConstructorDescriptor;
 import org.apache.asterix.runtime.evaluators.constructors.ATimeConstructorWithFormatDescriptor;
+import org.apache.asterix.runtime.evaluators.constructors.ATimeDefaultNullConstructorDescriptor;
+import org.apache.asterix.runtime.evaluators.constructors.ATimeDefaultNullConstructorWithFormatDescriptor;
 import org.apache.asterix.runtime.evaluators.constructors.AUUIDFromStringConstructorDescriptor;
+import org.apache.asterix.runtime.evaluators.constructors.AUUIDFromStringDefaultNullConstructorDescriptor;
 import org.apache.asterix.runtime.evaluators.constructors.AYearMonthDurationConstructorDescriptor;
+import org.apache.asterix.runtime.evaluators.constructors.AYearMonthDurationDefaultNullConstructorDescriptor;
 import org.apache.asterix.runtime.evaluators.constructors.ClosedRecordConstructorDescriptor;
 import org.apache.asterix.runtime.evaluators.constructors.OpenRecordConstructorDescriptor;
 import org.apache.asterix.runtime.evaluators.constructors.OrderedListConstructorDescriptor;
@@ -1082,15 +1101,24 @@
 
         // Constructors
         fc.add(ABooleanConstructorDescriptor.FACTORY);
+        fc.add(ABooleanDefaultNullConstructorDescriptor.FACTORY);
         fc.add(ABinaryHexStringConstructorDescriptor.FACTORY);
         fc.add(ABinaryBase64StringConstructorDescriptor.FACTORY);
+        fc.add(ABinaryBase64StringDefaultNullConstructorDescriptor.FACTORY);
         fc.add(AStringConstructorDescriptor.FACTORY);
+        fc.add(AStringDefaultNullConstructorDescriptor.FACTORY);
         fc.add(AInt8ConstructorDescriptor.FACTORY);
+        fc.add(AInt8DefaultNullConstructorDescriptor.FACTORY);
         fc.add(AInt16ConstructorDescriptor.FACTORY);
+        fc.add(AInt16DefaultNullConstructorDescriptor.FACTORY);
         fc.add(AInt32ConstructorDescriptor.FACTORY);
+        fc.add(AInt32DefaultNullConstructorDescriptor.FACTORY);
         fc.add(AInt64ConstructorDescriptor.FACTORY);
+        fc.add(AInt64DefaultNullConstructorDescriptor.FACTORY);
         fc.add(AFloatConstructorDescriptor.FACTORY);
+        fc.add(AFloatDefaultNullConstructorDescriptor.FACTORY);
         fc.add(ADoubleConstructorDescriptor.FACTORY);
+        fc.add(ADoubleDefaultNullConstructorDescriptor.FACTORY);
         fc.add(APointConstructorDescriptor.FACTORY);
         fc.add(APoint3DConstructorDescriptor.FACTORY);
         fc.add(ALineConstructorDescriptor.FACTORY);
@@ -1098,15 +1126,25 @@
         fc.add(ACircleConstructorDescriptor.FACTORY);
         fc.add(ARectangleConstructorDescriptor.FACTORY);
         fc.add(ATimeConstructorDescriptor.FACTORY);
+        fc.add(ATimeDefaultNullConstructorDescriptor.FACTORY);
         fc.add(ATimeConstructorWithFormatDescriptor.FACTORY);
+        fc.add(ATimeDefaultNullConstructorWithFormatDescriptor.FACTORY);
         fc.add(ADateConstructorDescriptor.FACTORY);
+        fc.add(ADateDefaultNullConstructorDescriptor.FACTORY);
         fc.add(ADateConstructorWithFormatDescriptor.FACTORY);
+        fc.add(ADateDefaultNullConstructorWithFormatDescriptor.FACTORY);
         fc.add(ADateTimeConstructorDescriptor.FACTORY);
+        fc.add(ADateTimeDefaultNullConstructorDescriptor.FACTORY);
         fc.add(ADateTimeConstructorWithFormatDescriptor.FACTORY);
+        fc.add(ADateTimeDefaultNullConstructorWithFormatDescriptor.FACTORY);
         fc.add(ADurationConstructorDescriptor.FACTORY);
+        fc.add(ADurationDefaultNullConstructorDescriptor.FACTORY);
         fc.add(AYearMonthDurationConstructorDescriptor.FACTORY);
+        fc.add(AYearMonthDurationDefaultNullConstructorDescriptor.FACTORY);
         fc.add(ADayTimeDurationConstructorDescriptor.FACTORY);
+        fc.add(ADayTimeDurationDefaultNullConstructorDescriptor.FACTORY);
         fc.add(AUUIDFromStringConstructorDescriptor.FACTORY);
+        fc.add(AUUIDFromStringDefaultNullConstructorDescriptor.FACTORY);
         fc.add(AIntervalConstructorDescriptor.FACTORY);
         fc.add(AIntervalStartFromDateConstructorDescriptor.FACTORY);
         fc.add(AIntervalStartFromDateTimeConstructorDescriptor.FACTORY);

-- 
To view, visit https://asterix-gerrit.ics.uci.edu/c/asterixdb/+/14027
To unsubscribe, or for help writing mail filters, visit https://asterix-gerrit.ics.uci.edu/settings

Gerrit-Project: asterixdb
Gerrit-Branch: master
Gerrit-Change-Id: I120d18c4c7bbcf098fceaa6784cce265a2811e3b
Gerrit-Change-Number: 14027
Gerrit-PatchSet: 5
Gerrit-Owner: Ali Alsuliman <al...@gmail.com>
Gerrit-Reviewer: Ali Alsuliman <al...@gmail.com>
Gerrit-Reviewer: Anon. E. Moose #1000171
Gerrit-Reviewer: Dmitry Lychagin <dm...@couchbase.com>
Gerrit-Reviewer: Jenkins <je...@fulliautomatix.ics.uci.edu>
Gerrit-MessageType: merged

Change in asterixdb[master]: [NO ISSUE][FUN] Add cast-null functions for constructors

Posted by AsterixDB Code Review <do...@asterix-gerrit.ics.uci.edu>.
Anon. E. Moose #1000171 has posted comments on this change. ( https://asterix-gerrit.ics.uci.edu/c/asterixdb/+/14027 )

Change subject: [NO ISSUE][FUN] Add cast-null functions for constructors
......................................................................


Patch Set 2:

Analytics Compatibility Compilation Successful
https://cbjenkins.page.link/uxBshKL1rLW4ftAM9 : SUCCESS


-- 
To view, visit https://asterix-gerrit.ics.uci.edu/c/asterixdb/+/14027
To unsubscribe, or for help writing mail filters, visit https://asterix-gerrit.ics.uci.edu/settings

Gerrit-Project: asterixdb
Gerrit-Branch: master
Gerrit-Change-Id: I120d18c4c7bbcf098fceaa6784cce265a2811e3b
Gerrit-Change-Number: 14027
Gerrit-PatchSet: 2
Gerrit-Owner: Ali Alsuliman <al...@gmail.com>
Gerrit-Reviewer: Anon. E. Moose #1000171
Gerrit-Reviewer: Jenkins <je...@fulliautomatix.ics.uci.edu>
Gerrit-Comment-Date: Thu, 11 Nov 2021 17:12:06 +0000
Gerrit-HasComments: No
Gerrit-Has-Labels: No
Gerrit-MessageType: comment

Change in asterixdb[master]: [NO ISSUE][FUN] Add cast-null functions for constructors

Posted by AsterixDB Code Review <do...@asterix-gerrit.ics.uci.edu>.
Anon. E. Moose #1000171 has posted comments on this change. ( https://asterix-gerrit.ics.uci.edu/c/asterixdb/+/14027 )

Change subject: [NO ISSUE][FUN] Add cast-null functions for constructors
......................................................................


Patch Set 1:

Analytics Compatibility Compilation Successful
https://cbjenkins.page.link/5zYUra2AABvs6Wfz9 : SUCCESS


-- 
To view, visit https://asterix-gerrit.ics.uci.edu/c/asterixdb/+/14027
To unsubscribe, or for help writing mail filters, visit https://asterix-gerrit.ics.uci.edu/settings

Gerrit-Project: asterixdb
Gerrit-Branch: master
Gerrit-Change-Id: I120d18c4c7bbcf098fceaa6784cce265a2811e3b
Gerrit-Change-Number: 14027
Gerrit-PatchSet: 1
Gerrit-Owner: Ali Alsuliman <al...@gmail.com>
Gerrit-CC: Anon. E. Moose #1000171
Gerrit-CC: Jenkins <je...@fulliautomatix.ics.uci.edu>
Gerrit-Comment-Date: Thu, 11 Nov 2021 04:40:50 +0000
Gerrit-HasComments: No
Gerrit-Has-Labels: No
Gerrit-MessageType: comment

Change in asterixdb[master]: [NO ISSUE][FUN] Add cast-null functions for constructors

Posted by AsterixDB Code Review <do...@asterix-gerrit.ics.uci.edu>.
From Dmitry Lychagin <dm...@couchbase.com>:

Dmitry Lychagin has posted comments on this change. ( https://asterix-gerrit.ics.uci.edu/c/asterixdb/+/14027 )

Change subject: [NO ISSUE][FUN] Add cast-null functions for constructors
......................................................................


Patch Set 3:

(2 comments)

https://asterix-gerrit.ics.uci.edu/c/asterixdb/+/14027/3/asterixdb/asterix-metadata/src/main/java/org/apache/asterix/metadata/utils/TypeUtil.java 
File asterixdb/asterix-metadata/src/main/java/org/apache/asterix/metadata/utils/TypeUtil.java:

https://asterix-gerrit.ics.uci.edu/c/asterixdb/+/14027/3/asterixdb/asterix-metadata/src/main/java/org/apache/asterix/metadata/utils/TypeUtil.java@70 
PS3, Line 70:     public static FunctionIdentifier getTypeConstructor(IAType type) {
We should rename it to getTypeConstructorDefaultNull() to avoid possible confusion


https://asterix-gerrit.ics.uci.edu/c/asterixdb/+/14027/3/asterixdb/asterix-metadata/src/main/java/org/apache/asterix/metadata/utils/TypeUtil.java@114 
PS3, Line 114:     public static FunctionIdentifier getTypeConstructorWithFormat(IAType type) {
We should rename it to getTypeConstructorWithFormatDefaultNull() to avoid possible confusion



-- 
To view, visit https://asterix-gerrit.ics.uci.edu/c/asterixdb/+/14027
To unsubscribe, or for help writing mail filters, visit https://asterix-gerrit.ics.uci.edu/settings

Gerrit-Project: asterixdb
Gerrit-Branch: master
Gerrit-Change-Id: I120d18c4c7bbcf098fceaa6784cce265a2811e3b
Gerrit-Change-Number: 14027
Gerrit-PatchSet: 3
Gerrit-Owner: Ali Alsuliman <al...@gmail.com>
Gerrit-Reviewer: Ali Alsuliman <al...@gmail.com>
Gerrit-Reviewer: Anon. E. Moose #1000171
Gerrit-Reviewer: Dmitry Lychagin <dm...@couchbase.com>
Gerrit-Reviewer: Jenkins <je...@fulliautomatix.ics.uci.edu>
Gerrit-Comment-Date: Thu, 11 Nov 2021 20:08:37 +0000
Gerrit-HasComments: Yes
Gerrit-Has-Labels: No
Gerrit-MessageType: comment

Change in asterixdb[master]: [NO ISSUE][FUN] Add cast-null functions for constructors

Posted by AsterixDB Code Review <do...@asterix-gerrit.ics.uci.edu>.
Anon. E. Moose #1000171 has posted comments on this change. ( https://asterix-gerrit.ics.uci.edu/c/asterixdb/+/14027 )

Change subject: [NO ISSUE][FUN] Add cast-null functions for constructors
......................................................................


Patch Set 4:

Analytics Compatibility Compilation Successful
https://cbjenkins.page.link/GCZwcaqsUPbJCBxF7 : SUCCESS


-- 
To view, visit https://asterix-gerrit.ics.uci.edu/c/asterixdb/+/14027
To unsubscribe, or for help writing mail filters, visit https://asterix-gerrit.ics.uci.edu/settings

Gerrit-Project: asterixdb
Gerrit-Branch: master
Gerrit-Change-Id: I120d18c4c7bbcf098fceaa6784cce265a2811e3b
Gerrit-Change-Number: 14027
Gerrit-PatchSet: 4
Gerrit-Owner: Ali Alsuliman <al...@gmail.com>
Gerrit-Reviewer: Ali Alsuliman <al...@gmail.com>
Gerrit-Reviewer: Anon. E. Moose #1000171
Gerrit-Reviewer: Dmitry Lychagin <dm...@couchbase.com>
Gerrit-Reviewer: Jenkins <je...@fulliautomatix.ics.uci.edu>
Gerrit-Comment-Date: Thu, 11 Nov 2021 21:05:21 +0000
Gerrit-HasComments: No
Gerrit-Has-Labels: No
Gerrit-MessageType: comment

Change in asterixdb[master]: [NO ISSUE][FUN] Add cast-null functions for constructors

Posted by AsterixDB Code Review <do...@asterix-gerrit.ics.uci.edu>.
Anon. E. Moose #1000171 has posted comments on this change. ( https://asterix-gerrit.ics.uci.edu/c/asterixdb/+/14027 )

Change subject: [NO ISSUE][FUN] Add cast-null functions for constructors
......................................................................


Patch Set 3: Contrib-2

Analytics Compatibility Tests Failed
https://cbjenkins.page.link/924VXjndh4dE6aMh9 : UNSTABLE


-- 
To view, visit https://asterix-gerrit.ics.uci.edu/c/asterixdb/+/14027
To unsubscribe, or for help writing mail filters, visit https://asterix-gerrit.ics.uci.edu/settings

Gerrit-Project: asterixdb
Gerrit-Branch: master
Gerrit-Change-Id: I120d18c4c7bbcf098fceaa6784cce265a2811e3b
Gerrit-Change-Number: 14027
Gerrit-PatchSet: 3
Gerrit-Owner: Ali Alsuliman <al...@gmail.com>
Gerrit-Reviewer: Ali Alsuliman <al...@gmail.com>
Gerrit-Reviewer: Anon. E. Moose #1000171
Gerrit-Reviewer: Dmitry Lychagin <dm...@couchbase.com>
Gerrit-Reviewer: Jenkins <je...@fulliautomatix.ics.uci.edu>
Gerrit-Comment-Date: Thu, 11 Nov 2021 20:37:03 +0000
Gerrit-HasComments: No
Gerrit-Has-Labels: Yes
Gerrit-MessageType: comment

Change in asterixdb[master]: [NO ISSUE][FUN] Add cast-null functions for constructors

Posted by AsterixDB Code Review <do...@asterix-gerrit.ics.uci.edu>.
Anon. E. Moose #1000171 has posted comments on this change. ( https://asterix-gerrit.ics.uci.edu/c/asterixdb/+/14027 )

Change subject: [NO ISSUE][FUN] Add cast-null functions for constructors
......................................................................


Patch Set 4: Contrib-2

Analytics Compatibility Tests Failed
https://cbjenkins.page.link/2BXfKzFof2tfSpHE6 : UNSTABLE


-- 
To view, visit https://asterix-gerrit.ics.uci.edu/c/asterixdb/+/14027
To unsubscribe, or for help writing mail filters, visit https://asterix-gerrit.ics.uci.edu/settings

Gerrit-Project: asterixdb
Gerrit-Branch: master
Gerrit-Change-Id: I120d18c4c7bbcf098fceaa6784cce265a2811e3b
Gerrit-Change-Number: 14027
Gerrit-PatchSet: 4
Gerrit-Owner: Ali Alsuliman <al...@gmail.com>
Gerrit-Reviewer: Ali Alsuliman <al...@gmail.com>
Gerrit-Reviewer: Anon. E. Moose #1000171
Gerrit-Reviewer: Dmitry Lychagin <dm...@couchbase.com>
Gerrit-Reviewer: Jenkins <je...@fulliautomatix.ics.uci.edu>
Gerrit-Comment-Date: Thu, 11 Nov 2021 23:20:01 +0000
Gerrit-HasComments: No
Gerrit-Has-Labels: Yes
Gerrit-MessageType: comment

Change in asterixdb[master]: [NO ISSUE][FUN] Add cast-null functions for constructors

Posted by AsterixDB Code Review <do...@asterix-gerrit.ics.uci.edu>.
From Ali Alsuliman <al...@gmail.com>:

Hello Dmitry Lychagin, Jenkins, Anon. E. Moose #1000171, 

I'd like you to reexamine a change. Please visit

    https://asterix-gerrit.ics.uci.edu/c/asterixdb/+/14027

to look at the new patch set (#4).

Change subject: [NO ISSUE][FUN] Add cast-null functions for constructors
......................................................................

[NO ISSUE][FUN] Add cast-null functions for constructors

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

Details:
- Add cast-null type constructors that produce null for missing input.
- Make views use these types of constructors.
- Make secondary indexes with CAST (DEFAULT NULL) modifier use
  these types of constructors.

Change-Id: I120d18c4c7bbcf098fceaa6784cce265a2811e3b
---
M asterixdb/asterix-algebra/src/main/java/org/apache/asterix/optimizer/rules/IntroduceSecondaryIndexInsertDeleteRule.java
M asterixdb/asterix-app/src/test/java/org/apache/asterix/test/runtime/NullMissingExceptionTest.java
M asterixdb/asterix-app/src/test/java/org/apache/asterix/test/runtime/NullMissingTest.java
M asterixdb/asterix-app/src/test/resources/runtimets/testsuite_sqlpp.xml
M asterixdb/asterix-lang-common/src/main/java/org/apache/asterix/lang/common/util/ViewUtil.java
M asterixdb/asterix-lang-sqlpp/src/main/java/org/apache/asterix/lang/sqlpp/rewrites/SqlppFunctionBodyRewriter.java
M asterixdb/asterix-metadata/src/main/java/org/apache/asterix/metadata/utils/SecondaryBTreeOperationsHelper.java
M asterixdb/asterix-metadata/src/main/java/org/apache/asterix/metadata/utils/TypeUtil.java
M asterixdb/asterix-om/src/main/java/org/apache/asterix/om/functions/BuiltinFunctions.java
M asterixdb/asterix-runtime/src/main/java/org/apache/asterix/runtime/evaluators/constructors/ABinaryBase64StringConstructorDescriptor.java
A asterixdb/asterix-runtime/src/main/java/org/apache/asterix/runtime/evaluators/constructors/ABinaryBase64StringDefaultNullConstructorDescriptor.java
A asterixdb/asterix-runtime/src/main/java/org/apache/asterix/runtime/evaluators/constructors/ABooleanDefaultNullConstructorDescriptor.java
M asterixdb/asterix-runtime/src/main/java/org/apache/asterix/runtime/evaluators/constructors/ADateConstructorWithFormatDescriptor.java
A asterixdb/asterix-runtime/src/main/java/org/apache/asterix/runtime/evaluators/constructors/ADateDefaultNullConstructorDescriptor.java
A asterixdb/asterix-runtime/src/main/java/org/apache/asterix/runtime/evaluators/constructors/ADateDefaultNullConstructorWithFormatDescriptor.java
M asterixdb/asterix-runtime/src/main/java/org/apache/asterix/runtime/evaluators/constructors/ADateTimeConstructorWithFormatDescriptor.java
A asterixdb/asterix-runtime/src/main/java/org/apache/asterix/runtime/evaluators/constructors/ADateTimeDefaultNullConstructorDescriptor.java
A asterixdb/asterix-runtime/src/main/java/org/apache/asterix/runtime/evaluators/constructors/ADateTimeDefaultNullConstructorWithFormatDescriptor.java
M asterixdb/asterix-runtime/src/main/java/org/apache/asterix/runtime/evaluators/constructors/ADayTimeDurationConstructorDescriptor.java
A asterixdb/asterix-runtime/src/main/java/org/apache/asterix/runtime/evaluators/constructors/ADayTimeDurationDefaultNullConstructorDescriptor.java
A asterixdb/asterix-runtime/src/main/java/org/apache/asterix/runtime/evaluators/constructors/ADoubleDefaultNullConstructorDescriptor.java
M asterixdb/asterix-runtime/src/main/java/org/apache/asterix/runtime/evaluators/constructors/ADurationConstructorDescriptor.java
A asterixdb/asterix-runtime/src/main/java/org/apache/asterix/runtime/evaluators/constructors/ADurationDefaultNullConstructorDescriptor.java
M asterixdb/asterix-runtime/src/main/java/org/apache/asterix/runtime/evaluators/constructors/AFloatConstructorDescriptor.java
A asterixdb/asterix-runtime/src/main/java/org/apache/asterix/runtime/evaluators/constructors/AFloatDefaultNullConstructorDescriptor.java
M asterixdb/asterix-runtime/src/main/java/org/apache/asterix/runtime/evaluators/constructors/AInt16ConstructorDescriptor.java
A asterixdb/asterix-runtime/src/main/java/org/apache/asterix/runtime/evaluators/constructors/AInt16DefaultNullConstructorDescriptor.java
M asterixdb/asterix-runtime/src/main/java/org/apache/asterix/runtime/evaluators/constructors/AInt32ConstructorDescriptor.java
A asterixdb/asterix-runtime/src/main/java/org/apache/asterix/runtime/evaluators/constructors/AInt32DefaultNullConstructorDescriptor.java
A asterixdb/asterix-runtime/src/main/java/org/apache/asterix/runtime/evaluators/constructors/AInt64DefaultNullConstructorDescriptor.java
M asterixdb/asterix-runtime/src/main/java/org/apache/asterix/runtime/evaluators/constructors/AInt8ConstructorDescriptor.java
A asterixdb/asterix-runtime/src/main/java/org/apache/asterix/runtime/evaluators/constructors/AInt8DefaultNullConstructorDescriptor.java
A asterixdb/asterix-runtime/src/main/java/org/apache/asterix/runtime/evaluators/constructors/AStringDefaultNullConstructorDescriptor.java
M asterixdb/asterix-runtime/src/main/java/org/apache/asterix/runtime/evaluators/constructors/ATimeConstructorWithFormatDescriptor.java
A asterixdb/asterix-runtime/src/main/java/org/apache/asterix/runtime/evaluators/constructors/ATimeDefaultNullConstructorDescriptor.java
A asterixdb/asterix-runtime/src/main/java/org/apache/asterix/runtime/evaluators/constructors/ATimeDefaultNullConstructorWithFormatDescriptor.java
M asterixdb/asterix-runtime/src/main/java/org/apache/asterix/runtime/evaluators/constructors/AUUIDFromStringConstructorDescriptor.java
A asterixdb/asterix-runtime/src/main/java/org/apache/asterix/runtime/evaluators/constructors/AUUIDFromStringDefaultNullConstructorDescriptor.java
M asterixdb/asterix-runtime/src/main/java/org/apache/asterix/runtime/evaluators/constructors/AYearMonthDurationConstructorDescriptor.java
A asterixdb/asterix-runtime/src/main/java/org/apache/asterix/runtime/evaluators/constructors/AYearMonthDurationDefaultNullConstructorDescriptor.java
A asterixdb/asterix-runtime/src/main/java/org/apache/asterix/runtime/evaluators/constructors/AbstractDateConstructorWithFormatEvaluator.java
A asterixdb/asterix-runtime/src/main/java/org/apache/asterix/runtime/evaluators/constructors/AbstractDateTimeConstructorWithFormatEvaluator.java
A asterixdb/asterix-runtime/src/main/java/org/apache/asterix/runtime/evaluators/constructors/AbstractDayTimeDurationConstructorEvaluator.java
A asterixdb/asterix-runtime/src/main/java/org/apache/asterix/runtime/evaluators/constructors/AbstractDurationConstructorEvaluator.java
A asterixdb/asterix-runtime/src/main/java/org/apache/asterix/runtime/evaluators/constructors/AbstractFloatConstructorEvaluator.java
A asterixdb/asterix-runtime/src/main/java/org/apache/asterix/runtime/evaluators/constructors/AbstractInt16ConstructorEvaluator.java
A asterixdb/asterix-runtime/src/main/java/org/apache/asterix/runtime/evaluators/constructors/AbstractInt32ConstructorEvaluator.java
A asterixdb/asterix-runtime/src/main/java/org/apache/asterix/runtime/evaluators/constructors/AbstractInt8ConstructorEvaluator.java
A asterixdb/asterix-runtime/src/main/java/org/apache/asterix/runtime/evaluators/constructors/AbstractTimeWithFormatConstructorEvaluator.java
A asterixdb/asterix-runtime/src/main/java/org/apache/asterix/runtime/evaluators/constructors/AbstractUUIDFromStringConstructorEvaluator.java
A asterixdb/asterix-runtime/src/main/java/org/apache/asterix/runtime/evaluators/constructors/AbstractYearMonthDurationConstructorEvaluator.java
M asterixdb/asterix-runtime/src/main/java/org/apache/asterix/runtime/evaluators/functions/PointableHelper.java
M asterixdb/asterix-runtime/src/main/java/org/apache/asterix/runtime/functions/FunctionCollection.java
53 files changed, 2,575 insertions(+), 848 deletions(-)


  git pull ssh://asterix-gerrit.ics.uci.edu:29418/asterixdb refs/changes/27/14027/4
-- 
To view, visit https://asterix-gerrit.ics.uci.edu/c/asterixdb/+/14027
To unsubscribe, or for help writing mail filters, visit https://asterix-gerrit.ics.uci.edu/settings

Gerrit-Project: asterixdb
Gerrit-Branch: master
Gerrit-Change-Id: I120d18c4c7bbcf098fceaa6784cce265a2811e3b
Gerrit-Change-Number: 14027
Gerrit-PatchSet: 4
Gerrit-Owner: Ali Alsuliman <al...@gmail.com>
Gerrit-Reviewer: Ali Alsuliman <al...@gmail.com>
Gerrit-Reviewer: Anon. E. Moose #1000171
Gerrit-Reviewer: Dmitry Lychagin <dm...@couchbase.com>
Gerrit-Reviewer: Jenkins <je...@fulliautomatix.ics.uci.edu>
Gerrit-MessageType: newpatchset

Change in asterixdb[master]: [NO ISSUE][FUN] Add cast-null functions for constructors

Posted by AsterixDB Code Review <do...@asterix-gerrit.ics.uci.edu>.
From Jenkins <je...@fulliautomatix.ics.uci.edu>:

Jenkins has posted comments on this change. ( https://asterix-gerrit.ics.uci.edu/c/asterixdb/+/14027 )

Change subject: [NO ISSUE][FUN] Add cast-null functions for constructors
......................................................................


Patch Set 1: Integration-Tests+1

Integration Tests Successful

https://asterix-jenkins.ics.uci.edu/job/asterix-gerrit-integration-tests/12699/ : SUCCESS


-- 
To view, visit https://asterix-gerrit.ics.uci.edu/c/asterixdb/+/14027
To unsubscribe, or for help writing mail filters, visit https://asterix-gerrit.ics.uci.edu/settings

Gerrit-Project: asterixdb
Gerrit-Branch: master
Gerrit-Change-Id: I120d18c4c7bbcf098fceaa6784cce265a2811e3b
Gerrit-Change-Number: 14027
Gerrit-PatchSet: 1
Gerrit-Owner: Ali Alsuliman <al...@gmail.com>
Gerrit-Reviewer: Jenkins <je...@fulliautomatix.ics.uci.edu>
Gerrit-CC: Anon. E. Moose #1000171
Gerrit-Comment-Date: Thu, 11 Nov 2021 05:50:57 +0000
Gerrit-HasComments: No
Gerrit-Has-Labels: Yes
Gerrit-MessageType: comment

Change in asterixdb[master]: [NO ISSUE][FUN] Add cast-null functions for constructors

Posted by AsterixDB Code Review <do...@asterix-gerrit.ics.uci.edu>.
Anon. E. Moose #1000171 has posted comments on this change. ( https://asterix-gerrit.ics.uci.edu/c/asterixdb/+/14027 )

Change subject: [NO ISSUE][FUN] Add cast-null functions for constructors
......................................................................


Patch Set 3:

Analytics Compatibility Compilation Successful
https://cbjenkins.page.link/ohJhE5qcV8gkX4K87 : SUCCESS


-- 
To view, visit https://asterix-gerrit.ics.uci.edu/c/asterixdb/+/14027
To unsubscribe, or for help writing mail filters, visit https://asterix-gerrit.ics.uci.edu/settings

Gerrit-Project: asterixdb
Gerrit-Branch: master
Gerrit-Change-Id: I120d18c4c7bbcf098fceaa6784cce265a2811e3b
Gerrit-Change-Number: 14027
Gerrit-PatchSet: 3
Gerrit-Owner: Ali Alsuliman <al...@gmail.com>
Gerrit-Reviewer: Ali Alsuliman <al...@gmail.com>
Gerrit-Reviewer: Anon. E. Moose #1000171
Gerrit-Reviewer: Dmitry Lychagin <dm...@couchbase.com>
Gerrit-Reviewer: Jenkins <je...@fulliautomatix.ics.uci.edu>
Gerrit-Comment-Date: Thu, 11 Nov 2021 17:44:43 +0000
Gerrit-HasComments: No
Gerrit-Has-Labels: No
Gerrit-MessageType: comment