Move to non-copy-based evaluator interfaces for all function implementations, including:
- scalar functions,
- aggregate functions,
- running aggregate functions,
- unnesting functions

Change-Id: If132857cf8d707ce96951f12ba6dd86f54aa4069
Reviewed-on: https://asterix-gerrit.ics.uci.edu/615
Tested-by: Jenkins <jenkins@fulliautomatix.ics.uci.edu>
Reviewed-by: Till Westmann <tillw@apache.org>
diff --git a/asterix-algebra/src/main/java/org/apache/asterix/jobgen/QueryLogicalExpressionJobGen.java b/asterix-algebra/src/main/java/org/apache/asterix/jobgen/QueryLogicalExpressionJobGen.java
index 0d7955d..5ebabf3 100644
--- a/asterix-algebra/src/main/java/org/apache/asterix/jobgen/QueryLogicalExpressionJobGen.java
+++ b/asterix-algebra/src/main/java/org/apache/asterix/jobgen/QueryLogicalExpressionJobGen.java
@@ -46,11 +46,11 @@
 import org.apache.hyracks.algebricks.core.algebra.functions.FunctionIdentifier;
 import org.apache.hyracks.algebricks.core.algebra.operators.logical.IOperatorSchema;
 import org.apache.hyracks.algebricks.core.jobgen.impl.JobGenContext;
-import org.apache.hyracks.algebricks.runtime.base.ICopyAggregateFunctionFactory;
-import org.apache.hyracks.algebricks.runtime.base.ICopyEvaluatorFactory;
-import org.apache.hyracks.algebricks.runtime.base.ICopyRunningAggregateFunctionFactory;
-import org.apache.hyracks.algebricks.runtime.base.ICopySerializableAggregateFunctionFactory;
-import org.apache.hyracks.algebricks.runtime.base.ICopyUnnestingFunctionFactory;
+import org.apache.hyracks.algebricks.runtime.base.IAggregateEvaluatorFactory;
+import org.apache.hyracks.algebricks.runtime.base.IScalarEvaluatorFactory;
+import org.apache.hyracks.algebricks.runtime.base.IRunningAggregateEvaluatorFactory;
+import org.apache.hyracks.algebricks.runtime.base.ISerializedAggregateEvaluatorFactory;
+import org.apache.hyracks.algebricks.runtime.base.IUnnestingEvaluatorFactory;
 import org.apache.hyracks.algebricks.runtime.evaluators.ColumnAccessEvalFactory;
 
 public class QueryLogicalExpressionJobGen implements ILogicalExpressionJobGen {
@@ -61,16 +61,16 @@
     }
 
     @Override
-    public ICopyAggregateFunctionFactory createAggregateFunctionFactory(AggregateFunctionCallExpression expr,
+    public IAggregateEvaluatorFactory createAggregateFunctionFactory(AggregateFunctionCallExpression expr,
             IVariableTypeEnvironment env, IOperatorSchema[] inputSchemas, JobGenContext context)
                     throws AlgebricksException {
-        ICopyEvaluatorFactory[] args = codegenArguments(expr, env, inputSchemas, context);
+        IScalarEvaluatorFactory[] args = codegenArguments(expr, env, inputSchemas, context);
         IFunctionDescriptor fd = getFunctionDescriptor(expr, env, context);
         switch (fd.getFunctionDescriptorTag()) {
             case SERIALAGGREGATE:
                 return null;
             case AGGREGATE:
-                return fd.createAggregateFunctionFactory(args);
+                return fd.createAggregateEvaluatorFactory(args);
             default:
                 throw new IllegalStateException(
                         "Invalid function descriptor " + fd.getFunctionDescriptorTag() + " expected "
@@ -79,25 +79,25 @@
     }
 
     @Override
-    public ICopyRunningAggregateFunctionFactory createRunningAggregateFunctionFactory(
+    public IRunningAggregateEvaluatorFactory createRunningAggregateFunctionFactory(
             StatefulFunctionCallExpression expr, IVariableTypeEnvironment env, IOperatorSchema[] inputSchemas,
             JobGenContext context) throws AlgebricksException {
-        ICopyEvaluatorFactory[] args = codegenArguments(expr, env, inputSchemas, context);
-        return getFunctionDescriptor(expr, env, context).createRunningAggregateFunctionFactory(args);
+        IScalarEvaluatorFactory[] args = codegenArguments(expr, env, inputSchemas, context);
+        return getFunctionDescriptor(expr, env, context).createRunningAggregateEvaluatorFactory(args);
     }
 
     @Override
-    public ICopyUnnestingFunctionFactory createUnnestingFunctionFactory(UnnestingFunctionCallExpression expr,
+    public IUnnestingEvaluatorFactory createUnnestingFunctionFactory(UnnestingFunctionCallExpression expr,
             IVariableTypeEnvironment env, IOperatorSchema[] inputSchemas, JobGenContext context)
                     throws AlgebricksException {
-        ICopyEvaluatorFactory[] args = codegenArguments(expr, env, inputSchemas, context);
-        return getFunctionDescriptor(expr, env, context).createUnnestingFunctionFactory(args);
+        IScalarEvaluatorFactory[] args = codegenArguments(expr, env, inputSchemas, context);
+        return getFunctionDescriptor(expr, env, context).createUnnestingEvaluatorFactory(args);
     }
 
     @Override
-    public ICopyEvaluatorFactory createEvaluatorFactory(ILogicalExpression expr, IVariableTypeEnvironment env,
+    public IScalarEvaluatorFactory createEvaluatorFactory(ILogicalExpression expr, IVariableTypeEnvironment env,
             IOperatorSchema[] inputSchemas, JobGenContext context) throws AlgebricksException {
-        ICopyEvaluatorFactory copyEvaluatorFactory = null;
+        IScalarEvaluatorFactory copyEvaluatorFactory = null;
         switch (expr.getExpressionTag()) {
             case VARIABLE: {
                 VariableReferenceExpression v = (VariableReferenceExpression) expr;
@@ -120,7 +120,7 @@
 
     }
 
-    private ICopyEvaluatorFactory createVariableEvaluatorFactory(VariableReferenceExpression expr,
+    private IScalarEvaluatorFactory createVariableEvaluatorFactory(VariableReferenceExpression expr,
             IOperatorSchema[] inputSchemas, JobGenContext context) throws AlgebricksException {
         LogicalVariable variable = expr.getVariableReference();
         for (IOperatorSchema scm : inputSchemas) {
@@ -132,10 +132,10 @@
         throw new AlgebricksException("Variable " + variable + " could not be found in any input schema.");
     }
 
-    private ICopyEvaluatorFactory createScalarFunctionEvaluatorFactory(AbstractFunctionCallExpression expr,
+    private IScalarEvaluatorFactory createScalarFunctionEvaluatorFactory(AbstractFunctionCallExpression expr,
             IVariableTypeEnvironment env, IOperatorSchema[] inputSchemas, JobGenContext context)
                     throws AlgebricksException {
-        ICopyEvaluatorFactory[] args = codegenArguments(expr, env, inputSchemas, context);
+        IScalarEvaluatorFactory[] args = codegenArguments(expr, env, inputSchemas, context);
         FunctionIdentifier fi = expr.getFunctionIdentifier();
         ComparisonKind ck = AlgebricksBuiltinFunctions.getComparisonType(fi);
         if (ck != null) {
@@ -157,17 +157,17 @@
         return fd.createEvaluatorFactory(args);
     }
 
-    private ICopyEvaluatorFactory createConstantEvaluatorFactory(ConstantExpression expr,
+    private IScalarEvaluatorFactory createConstantEvaluatorFactory(ConstantExpression expr,
             IOperatorSchema[] inputSchemas, JobGenContext context) throws AlgebricksException {
         IDataFormat format = FormatUtils.getDefaultFormat();
         return format.getConstantEvalFactory(expr.getValue());
     }
 
-    private ICopyEvaluatorFactory[] codegenArguments(AbstractFunctionCallExpression expr, IVariableTypeEnvironment env,
+    private IScalarEvaluatorFactory[] codegenArguments(AbstractFunctionCallExpression expr, IVariableTypeEnvironment env,
             IOperatorSchema[] inputSchemas, JobGenContext context) throws AlgebricksException {
         List<Mutable<ILogicalExpression>> arguments = expr.getArguments();
         int n = arguments.size();
-        ICopyEvaluatorFactory[] args = new ICopyEvaluatorFactory[n];
+        IScalarEvaluatorFactory[] args = new IScalarEvaluatorFactory[n];
         int i = 0;
         for (Mutable<ILogicalExpression> a : arguments) {
             args[i++] = createEvaluatorFactory(a.getValue(), env, inputSchemas, context);
@@ -176,10 +176,10 @@
     }
 
     @Override
-    public ICopySerializableAggregateFunctionFactory createSerializableAggregateFunctionFactory(
+    public ISerializedAggregateEvaluatorFactory createSerializableAggregateFunctionFactory(
             AggregateFunctionCallExpression expr, IVariableTypeEnvironment env, IOperatorSchema[] inputSchemas,
             JobGenContext context) throws AlgebricksException {
-        ICopyEvaluatorFactory[] args = codegenArguments(expr, env, inputSchemas, context);
+        IScalarEvaluatorFactory[] args = codegenArguments(expr, env, inputSchemas, context);
         IFunctionDescriptor fd = getFunctionDescriptor(expr, env, context);
 
         switch (fd.getFunctionDescriptorTag()) {
@@ -188,7 +188,7 @@
                     AggregateFunctionCallExpression serialAggExpr = AsterixBuiltinFunctions
                             .makeSerializableAggregateFunctionExpression(fd.getIdentifier(), expr.getArguments());
                     IFunctionDescriptor afdd = getFunctionDescriptor(serialAggExpr, env, context);
-                    return afdd.createSerializableAggregateFunctionFactory(args);
+                    return afdd.createSerializableAggregateEvaluatorFactory(args);
                 } else {
                     throw new AlgebricksException(
                             "Trying to create a serializable aggregate from a non-serializable aggregate function descriptor. (fi="
@@ -196,7 +196,7 @@
                 }
             }
             case SERIALAGGREGATE: {
-                return fd.createSerializableAggregateFunctionFactory(args);
+                return fd.createSerializableAggregateEvaluatorFactory(args);
             }
 
             default:
diff --git a/asterix-algebra/src/main/java/org/apache/asterix/translator/AqlPlusExpressionToPlanTranslator.java b/asterix-algebra/src/main/java/org/apache/asterix/translator/AqlPlusExpressionToPlanTranslator.java
index 9425254..45933f4 100644
--- a/asterix-algebra/src/main/java/org/apache/asterix/translator/AqlPlusExpressionToPlanTranslator.java
+++ b/asterix-algebra/src/main/java/org/apache/asterix/translator/AqlPlusExpressionToPlanTranslator.java
@@ -159,7 +159,7 @@
 import org.apache.hyracks.algebricks.core.algebra.operators.logical.UnnestOperator;
 import org.apache.hyracks.algebricks.core.algebra.operators.logical.WriteOperator;
 import org.apache.hyracks.algebricks.core.algebra.plan.ALogicalPlanImpl;
-import org.apache.hyracks.algebricks.runtime.base.ICopyEvaluatorFactory;
+import org.apache.hyracks.algebricks.runtime.base.IScalarEvaluatorFactory;
 
 /**
  * Each visit returns a pair of an operator and a variable. The variable
@@ -276,7 +276,7 @@
             ArrayList<Mutable<ILogicalExpression>> exprs = new ArrayList<Mutable<ILogicalExpression>>();
             List<Mutable<ILogicalExpression>> varRefsForLoading = new ArrayList<Mutable<ILogicalExpression>>();
             for (List<String> partitioningKey : partitioningKeys) {
-                Triple<ICopyEvaluatorFactory, ScalarFunctionCallExpression, IAType> partitioner = format
+                Triple<IScalarEvaluatorFactory, ScalarFunctionCallExpression, IAType> partitioner = format
                         .partitioningEvaluatorFactory(itemType, partitioningKey);
                 AbstractFunctionCallExpression f = partitioner.second.cloneExpression();
                 f.substituteVar(METADATA_DUMMY_VAR, resVar);
diff --git a/asterix-app/src/main/java/org/apache/asterix/file/SecondaryBTreeOperationsHelper.java b/asterix-app/src/main/java/org/apache/asterix/file/SecondaryBTreeOperationsHelper.java
index 6d23f3c..5512577 100644
--- a/asterix-app/src/main/java/org/apache/asterix/file/SecondaryBTreeOperationsHelper.java
+++ b/asterix-app/src/main/java/org/apache/asterix/file/SecondaryBTreeOperationsHelper.java
@@ -49,7 +49,7 @@
 import org.apache.hyracks.algebricks.data.IBinaryComparatorFactoryProvider;
 import org.apache.hyracks.algebricks.data.ISerializerDeserializerProvider;
 import org.apache.hyracks.algebricks.data.ITypeTraitProvider;
-import org.apache.hyracks.algebricks.runtime.base.ICopyEvaluatorFactory;
+import org.apache.hyracks.algebricks.runtime.base.IScalarEvaluatorFactory;
 import org.apache.hyracks.algebricks.runtime.base.IPushRuntimeFactory;
 import org.apache.hyracks.algebricks.runtime.operators.base.SinkRuntimeFactory;
 import org.apache.hyracks.algebricks.runtime.operators.meta.AlgebricksMetaOperatorDescriptor;
@@ -302,7 +302,7 @@
     protected void setSecondaryRecDescAndComparators(IndexType indexType, List<List<String>> secondaryKeyFields,
             List<IAType> secondaryKeyTypes, int gramLength, AqlMetadataProvider metadataProvider)
             throws AlgebricksException, AsterixException {
-        secondaryFieldAccessEvalFactories = new ICopyEvaluatorFactory[numSecondaryKeys + numFilterFields];
+        secondaryFieldAccessEvalFactories = new IScalarEvaluatorFactory[numSecondaryKeys + numFilterFields];
         secondaryComparatorFactories = new IBinaryComparatorFactory[numSecondaryKeys + numPrimaryKeys];
         secondaryBloomFilterKeyFields = new int[numSecondaryKeys];
         ISerializerDeserializer[] secondaryRecFields = new ISerializerDeserializer[numPrimaryKeys + numSecondaryKeys
diff --git a/asterix-app/src/main/java/org/apache/asterix/file/SecondaryIndexOperationsHelper.java b/asterix-app/src/main/java/org/apache/asterix/file/SecondaryIndexOperationsHelper.java
index d67ca0d..54cac09 100644
--- a/asterix-app/src/main/java/org/apache/asterix/file/SecondaryIndexOperationsHelper.java
+++ b/asterix-app/src/main/java/org/apache/asterix/file/SecondaryIndexOperationsHelper.java
@@ -64,10 +64,8 @@
 import org.apache.hyracks.algebricks.common.constraints.AlgebricksPartitionConstraintHelper;
 import org.apache.hyracks.algebricks.common.exceptions.AlgebricksException;
 import org.apache.hyracks.algebricks.common.utils.Pair;
-import org.apache.hyracks.algebricks.core.algebra.expressions.LogicalExpressionJobGenToExpressionRuntimeProviderAdapter;
 import org.apache.hyracks.algebricks.core.rewriter.base.PhysicalOptimizationConfig;
 import org.apache.hyracks.algebricks.data.ISerializerDeserializerProvider;
-import org.apache.hyracks.algebricks.runtime.base.ICopyEvaluatorFactory;
 import org.apache.hyracks.algebricks.runtime.base.IPushRuntimeFactory;
 import org.apache.hyracks.algebricks.runtime.base.IScalarEvaluatorFactory;
 import org.apache.hyracks.algebricks.runtime.evaluators.ColumnAccessEvalFactory;
@@ -126,7 +124,7 @@
     protected ITypeTraits[] secondaryTypeTraits;
     protected int[] secondaryBloomFilterKeyFields;
     protected RecordDescriptor secondaryRecDesc;
-    protected ICopyEvaluatorFactory[] secondaryFieldAccessEvalFactories;
+    protected IScalarEvaluatorFactory[] secondaryFieldAccessEvalFactories;
 
     protected IAsterixPropertiesProvider propertiesProvider;
     protected ILSMMergePolicyFactory mergePolicyFactory;
@@ -152,10 +150,10 @@
     }
 
     public static SecondaryIndexOperationsHelper createIndexOperationsHelper(IndexType indexType, String dataverseName,
-            String datasetName, String indexName, List<List<String>> secondaryKeyFields,
-            List<IAType> secondaryKeyTypes, boolean isEnforced, int gramLength, AqlMetadataProvider metadataProvider,
+            String datasetName, String indexName, List<List<String>> secondaryKeyFields, List<IAType> secondaryKeyTypes,
+            boolean isEnforced, int gramLength, AqlMetadataProvider metadataProvider,
             PhysicalOptimizationConfig physOptConf, ARecordType recType, ARecordType enforcedType)
-            throws AsterixException, AlgebricksException {
+                    throws AsterixException, AlgebricksException {
         IAsterixPropertiesProvider asterixPropertiesProvider = AsterixAppContextInfo.getInstance();
         SecondaryIndexOperationsHelper indexOperationsHelper = null;
         switch (indexType) {
@@ -286,8 +284,8 @@
                 throw new AlgebricksException(e);
             }
             primaryRecFields[i] = serdeProvider.getSerializerDeserializer(keyType);
-            primaryComparatorFactories[i] = AqlBinaryComparatorFactoryProvider.INSTANCE.getBinaryComparatorFactory(
-                    keyType, true);
+            primaryComparatorFactories[i] = AqlBinaryComparatorFactoryProvider.INSTANCE
+                    .getBinaryComparatorFactory(keyType, true);
             primaryTypeTraits[i] = AqlTypeTraitProvider.INSTANCE.getTypeTrait(keyType);
             primaryBloomFilterKeyFields[i] = i;
         }
@@ -300,8 +298,8 @@
             List<List<String>> secondaryKeyFields, List<IAType> secondaryKeyTypes, int gramLength,
             AqlMetadataProvider metadataProvider) throws AlgebricksException, AsterixException;
 
-    protected AbstractOperatorDescriptor createDummyKeyProviderOp(JobSpecification spec) throws AsterixException,
-            AlgebricksException {
+    protected AbstractOperatorDescriptor createDummyKeyProviderOp(JobSpecification spec)
+            throws AsterixException, AlgebricksException {
         // Build dummy tuple containing one field with a dummy value inside.
         ArrayTupleBuilder tb = new ArrayTupleBuilder(1);
         DataOutput dos = tb.getDataOutput();
@@ -345,12 +343,12 @@
                 primaryFileSplitProvider, primaryRecDesc.getTypeTraits(), primaryComparatorFactories,
                 primaryBloomFilterKeyFields, lowKeyFields, highKeyFields, true, true,
                 new LSMBTreeDataflowHelperFactory(new AsterixVirtualBufferCacheProvider(dataset.getDatasetId()),
-                        mergePolicyFactory, mergePolicyFactoryProperties, new PrimaryIndexOperationTrackerProvider(
-                                dataset.getDatasetId()), AsterixRuntimeComponentsProvider.RUNTIME_PROVIDER,
-                        LSMBTreeIOOperationCallbackFactory.INSTANCE, storageProperties
-                                .getBloomFilterFalsePositiveRate(), true, filterTypeTraits, filterCmpFactories,
-                        primaryBTreeFields, primaryFilterFields, !temp), false, false, null,
-                searchCallbackFactory, null, null);
+                        mergePolicyFactory, mergePolicyFactoryProperties,
+                        new PrimaryIndexOperationTrackerProvider(dataset.getDatasetId()),
+                        AsterixRuntimeComponentsProvider.RUNTIME_PROVIDER, LSMBTreeIOOperationCallbackFactory.INSTANCE,
+                        storageProperties.getBloomFilterFalsePositiveRate(), true, filterTypeTraits, filterCmpFactories,
+                        primaryBTreeFields, primaryFilterFields, !temp),
+                false, false, null, searchCallbackFactory, null, null);
 
         AlgebricksPartitionConstraintHelper.setPartitionConstraintInJobSpec(spec, primarySearchOp,
                 primaryPartitionConstraint);
@@ -377,8 +375,7 @@
 
         IScalarEvaluatorFactory[] sefs = new IScalarEvaluatorFactory[secondaryFieldAccessEvalFactories.length];
         for (int i = 0; i < secondaryFieldAccessEvalFactories.length; ++i) {
-            sefs[i] = new LogicalExpressionJobGenToExpressionRuntimeProviderAdapter.ScalarEvaluatorFactoryAdapter(
-                    secondaryFieldAccessEvalFactories[i]);
+            sefs[i] = secondaryFieldAccessEvalFactories[i];
         }
         AssignRuntimeFactory assign = new AssignRuntimeFactory(outColumns, sefs, projectionList);
         AlgebricksMetaOperatorDescriptor asterixAssignOp = new AlgebricksMetaOperatorDescriptor(spec, 1, 1,
@@ -408,10 +405,10 @@
         for (int i = 0; i <= numPrimaryKeys; i++) {
             projectionList[i] = i;
         }
-        ICopyEvaluatorFactory[] castEvalFact = new ICopyEvaluatorFactory[] { new ColumnAccessEvalFactory(recordIdx) };
+        IScalarEvaluatorFactory[] castEvalFact = new IScalarEvaluatorFactory[] {
+                new ColumnAccessEvalFactory(recordIdx) };
         IScalarEvaluatorFactory[] sefs = new IScalarEvaluatorFactory[1];
-        sefs[0] = new LogicalExpressionJobGenToExpressionRuntimeProviderAdapter.ScalarEvaluatorFactoryAdapter(
-                castFuncDesc.createEvaluatorFactory(castEvalFact));
+        sefs[0] = castFuncDesc.createEvaluatorFactory(castEvalFact);
         AssignRuntimeFactory castAssign = new AssignRuntimeFactory(outColumns, sefs, projectionList);
         AlgebricksMetaOperatorDescriptor castRecAssignOp = new AlgebricksMetaOperatorDescriptor(spec, 1, 1,
                 new IPushRuntimeFactory[] { castAssign }, new RecordDescriptor[] { enforcedRecDesc });
@@ -433,7 +430,7 @@
 
     protected TreeIndexBulkLoadOperatorDescriptor createTreeIndexBulkLoadOp(JobSpecification spec,
             int numSecondaryKeyFields, IIndexDataflowHelperFactory dataflowHelperFactory, float fillFactor)
-            throws MetadataException, AlgebricksException {
+                    throws MetadataException, AlgebricksException {
         int[] fieldPermutation = new int[numSecondaryKeyFields + numPrimaryKeys + numFilterFields];
         for (int i = 0; i < fieldPermutation.length; i++) {
             fieldPermutation[i] = i;
@@ -450,19 +447,19 @@
 
     public AlgebricksMetaOperatorDescriptor createFilterNullsSelectOp(JobSpecification spec, int numSecondaryKeyFields)
             throws AlgebricksException {
-        ICopyEvaluatorFactory[] andArgsEvalFactories = new ICopyEvaluatorFactory[numSecondaryKeyFields];
+        IScalarEvaluatorFactory[] andArgsEvalFactories = new IScalarEvaluatorFactory[numSecondaryKeyFields];
         NotDescriptor notDesc = new NotDescriptor();
         IsNullDescriptor isNullDesc = new IsNullDescriptor();
         for (int i = 0; i < numSecondaryKeyFields; i++) {
             // Access column i, and apply 'is not null'.
             ColumnAccessEvalFactory columnAccessEvalFactory = new ColumnAccessEvalFactory(i);
-            ICopyEvaluatorFactory isNullEvalFactory = isNullDesc
-                    .createEvaluatorFactory(new ICopyEvaluatorFactory[] { columnAccessEvalFactory });
-            ICopyEvaluatorFactory notEvalFactory = notDesc
-                    .createEvaluatorFactory(new ICopyEvaluatorFactory[] { isNullEvalFactory });
+            IScalarEvaluatorFactory isNullEvalFactory = isNullDesc
+                    .createEvaluatorFactory(new IScalarEvaluatorFactory[] { columnAccessEvalFactory });
+            IScalarEvaluatorFactory notEvalFactory = notDesc
+                    .createEvaluatorFactory(new IScalarEvaluatorFactory[] { isNullEvalFactory });
             andArgsEvalFactories[i] = notEvalFactory;
         }
-        ICopyEvaluatorFactory selectCond = null;
+        IScalarEvaluatorFactory selectCond = null;
         if (numSecondaryKeyFields > 1) {
             // Create conjunctive condition where all secondary index keys must
             // satisfy 'is not null'.
@@ -471,9 +468,8 @@
         } else {
             selectCond = andArgsEvalFactories[0];
         }
-        StreamSelectRuntimeFactory select = new StreamSelectRuntimeFactory(
-                new LogicalExpressionJobGenToExpressionRuntimeProviderAdapter.ScalarEvaluatorFactoryAdapter(selectCond),
-                null, AqlBinaryBooleanInspectorImpl.FACTORY, false, -1, null);
+        StreamSelectRuntimeFactory select = new StreamSelectRuntimeFactory(selectCond, null,
+                AqlBinaryBooleanInspectorImpl.FACTORY, false, -1, null);
         AlgebricksMetaOperatorDescriptor asterixSelectOp = new AlgebricksMetaOperatorDescriptor(spec, 1, 1,
                 new IPushRuntimeFactory[] { select }, new RecordDescriptor[] { secondaryRecDesc });
         AlgebricksPartitionConstraintHelper.setPartitionConstraintInJobSpec(spec, asterixSelectOp,
@@ -525,8 +521,7 @@
 
         IScalarEvaluatorFactory[] sefs = new IScalarEvaluatorFactory[secondaryFieldAccessEvalFactories.length];
         for (int i = 0; i < secondaryFieldAccessEvalFactories.length; ++i) {
-            sefs[i] = new LogicalExpressionJobGenToExpressionRuntimeProviderAdapter.ScalarEvaluatorFactoryAdapter(
-                    secondaryFieldAccessEvalFactories[i]);
+            sefs[i] = secondaryFieldAccessEvalFactories[i];
         }
         //add External RIDs to the projection list
         for (int i = 0; i < numPrimaryKeys; i++) {
@@ -541,7 +536,7 @@
 
     protected ExternalIndexBulkModifyOperatorDescriptor createExternalIndexBulkModifyOp(JobSpecification spec,
             int numSecondaryKeyFields, IIndexDataflowHelperFactory dataflowHelperFactory, float fillFactor)
-            throws MetadataException, AlgebricksException {
+                    throws MetadataException, AlgebricksException {
         int[] fieldPermutation = new int[numSecondaryKeyFields + numPrimaryKeys];
         for (int i = 0; i < numSecondaryKeyFields + numPrimaryKeys; i++) {
             fieldPermutation[i] = i;
@@ -549,8 +544,9 @@
         // create a list of file ids
         int numOfDeletedFiles = 0;
         for (ExternalFile file : externalFiles) {
-            if (file.getPendingOp() == ExternalFilePendingOp.PENDING_DROP_OP)
+            if (file.getPendingOp() == ExternalFilePendingOp.PENDING_DROP_OP) {
                 numOfDeletedFiles++;
+            }
         }
         int[] deletedFiles = new int[numOfDeletedFiles];
         int i = 0;
diff --git a/asterix-app/src/main/java/org/apache/asterix/file/SecondaryInvertedIndexOperationsHelper.java b/asterix-app/src/main/java/org/apache/asterix/file/SecondaryInvertedIndexOperationsHelper.java
index 3521752..4b9eff7 100644
--- a/asterix-app/src/main/java/org/apache/asterix/file/SecondaryInvertedIndexOperationsHelper.java
+++ b/asterix-app/src/main/java/org/apache/asterix/file/SecondaryInvertedIndexOperationsHelper.java
@@ -43,7 +43,7 @@
 import org.apache.hyracks.algebricks.core.rewriter.base.PhysicalOptimizationConfig;
 import org.apache.hyracks.algebricks.data.ISerializerDeserializerProvider;
 import org.apache.hyracks.algebricks.data.ITypeTraitProvider;
-import org.apache.hyracks.algebricks.runtime.base.ICopyEvaluatorFactory;
+import org.apache.hyracks.algebricks.runtime.base.IScalarEvaluatorFactory;
 import org.apache.hyracks.algebricks.runtime.base.IPushRuntimeFactory;
 import org.apache.hyracks.algebricks.runtime.operators.base.SinkRuntimeFactory;
 import org.apache.hyracks.algebricks.runtime.operators.meta.AlgebricksMetaOperatorDescriptor;
@@ -112,7 +112,7 @@
         }
         // Prepare record descriptor used in the assign op, and the optional
         // select op.
-        secondaryFieldAccessEvalFactories = new ICopyEvaluatorFactory[numSecondaryKeys + numFilterFields];
+        secondaryFieldAccessEvalFactories = new IScalarEvaluatorFactory[numSecondaryKeys + numFilterFields];
         ISerializerDeserializer[] secondaryRecFields = new ISerializerDeserializer[numPrimaryKeys + numSecondaryKeys
                 + numFilterFields];
         ISerializerDeserializer[] enforcedRecFields = new ISerializerDeserializer[1 + numPrimaryKeys + numFilterFields];
diff --git a/asterix-app/src/test/resources/runtimets/results/string/substring-after-4/substring-after-4.1.adm b/asterix-app/src/test/resources/runtimets/results/string/substring-after-4/substring-after-4.1.adm
index 9406ef5..455e3da 100644
--- a/asterix-app/src/test/resources/runtimets/results/string/substring-after-4/substring-after-4.1.adm
+++ b/asterix-app/src/test/resources/runtimets/results/string/substring-after-4/substring-after-4.1.adm
@@ -1 +1 @@
-{ "result1": "HEllow", "result2": "HEllow", "result3": "", "result4": "", "result5": "" }
+{ "result1": "HEllow", "result2": null, "result3": null, "result4": "", "result5": null }
diff --git a/asterix-app/src/test/resources/runtimets/results/string/substring-before-3/substring-before-3.1.adm b/asterix-app/src/test/resources/runtimets/results/string/substring-before-3/substring-before-3.1.adm
index 9ce64e4..eba5495 100644
--- a/asterix-app/src/test/resources/runtimets/results/string/substring-before-3/substring-before-3.1.adm
+++ b/asterix-app/src/test/resources/runtimets/results/string/substring-before-3/substring-before-3.1.adm
@@ -1 +1 @@
-{ "result1": "", "result2": "", "result3": "", "result4": "", "result5": "" }
+{ "result1": "", "result2": null, "result3": null, "result4": "", "result5": null }
diff --git a/asterix-external-data/src/main/java/org/apache/asterix/external/library/ExternalFunction.java b/asterix-external-data/src/main/java/org/apache/asterix/external/library/ExternalFunction.java
index fd3d9e3..7f416c7 100755
--- a/asterix-external-data/src/main/java/org/apache/asterix/external/library/ExternalFunction.java
+++ b/asterix-external-data/src/main/java/org/apache/asterix/external/library/ExternalFunction.java
@@ -30,10 +30,12 @@
 import org.apache.asterix.om.types.EnumDeserializer;
 import org.apache.asterix.om.types.hierachy.ATypeHierarchy;
 import org.apache.hyracks.algebricks.common.exceptions.AlgebricksException;
-import org.apache.hyracks.algebricks.runtime.base.ICopyEvaluator;
-import org.apache.hyracks.algebricks.runtime.base.ICopyEvaluatorFactory;
+import org.apache.hyracks.algebricks.runtime.base.IScalarEvaluator;
+import org.apache.hyracks.algebricks.runtime.base.IScalarEvaluatorFactory;
+import org.apache.hyracks.api.context.IHyracksTaskContext;
 import org.apache.hyracks.api.dataflow.value.ISerializerDeserializer;
-import org.apache.hyracks.data.std.api.IDataOutputProvider;
+import org.apache.hyracks.data.std.api.IPointable;
+import org.apache.hyracks.data.std.primitive.VoidPointable;
 import org.apache.hyracks.data.std.util.ArrayBackedValueStorage;
 import org.apache.hyracks.dataflow.common.data.accessors.IFrameTupleReference;
 
@@ -42,23 +44,22 @@
     protected final IExternalFunctionInfo finfo;
     protected final IFunctionFactory externalFunctionFactory;
     protected final IExternalFunction externalFunction;
-    protected final ICopyEvaluatorFactory[] evaluatorFactories;
-    protected final IDataOutputProvider out;
-    protected final ArrayBackedValueStorage inputVal = new ArrayBackedValueStorage();
+    protected final IScalarEvaluatorFactory[] evaluatorFactories;
+    protected final IPointable inputVal = new VoidPointable();
+    protected final ArrayBackedValueStorage resultBuffer = new ArrayBackedValueStorage();
     protected final ArrayBackedValueStorage castBuffer = new ArrayBackedValueStorage();
-    protected final ICopyEvaluator[] argumentEvaluators;
+    protected final IScalarEvaluator[] argumentEvaluators;
     protected final JavaFunctionHelper functionHelper;
 
-    public ExternalFunction(IExternalFunctionInfo finfo, ICopyEvaluatorFactory args[],
-            IDataOutputProvider outputProvider) throws AlgebricksException {
+    public ExternalFunction(IExternalFunctionInfo finfo, IScalarEvaluatorFactory args[], IHyracksTaskContext context)
+            throws AlgebricksException {
         this.finfo = finfo;
         this.evaluatorFactories = args;
-        this.out = outputProvider;
-        argumentEvaluators = new ICopyEvaluator[args.length];
+        argumentEvaluators = new IScalarEvaluator[args.length];
         for (int i = 0; i < args.length; i++) {
-            argumentEvaluators[i] = args[i].createEvaluator(inputVal);
+            argumentEvaluators[i] = args[i].createScalarEvaluator(context);
         }
-        functionHelper = new JavaFunctionHelper(finfo, outputProvider);
+        functionHelper = new JavaFunctionHelper(finfo, resultBuffer);
 
         String[] fnameComponents = finfo.getFunctionIdentifier().getName().split("#");
         String functionLibary = fnameComponents[0];
@@ -85,8 +86,7 @@
 
     public void setArguments(IFrameTupleReference tuple) throws AlgebricksException, IOException, AsterixException {
         for (int i = 0; i < evaluatorFactories.length; i++) {
-            inputVal.reset();
-            argumentEvaluators[i].evaluate(tuple);
+            argumentEvaluators[i].evaluate(tuple, inputVal);
 
             // Type-cast the source array based on the input type that this function wants to receive.
             ATypeTag targetTypeTag = finfo.getParamList().get(i).getTypeTag();
diff --git a/asterix-external-data/src/main/java/org/apache/asterix/external/library/ExternalFunctionDescriptorProvider.java b/asterix-external-data/src/main/java/org/apache/asterix/external/library/ExternalFunctionDescriptorProvider.java
index be9f9c1..877ce77 100755
--- a/asterix-external-data/src/main/java/org/apache/asterix/external/library/ExternalFunctionDescriptorProvider.java
+++ b/asterix-external-data/src/main/java/org/apache/asterix/external/library/ExternalFunctionDescriptorProvider.java
@@ -25,7 +25,7 @@
 import org.apache.hyracks.algebricks.common.exceptions.AlgebricksException;
 import org.apache.hyracks.algebricks.core.algebra.functions.FunctionIdentifier;
 import org.apache.hyracks.algebricks.core.algebra.functions.IFunctionInfo;
-import org.apache.hyracks.algebricks.runtime.base.ICopyEvaluatorFactory;
+import org.apache.hyracks.algebricks.runtime.base.IScalarEvaluatorFactory;
 
 public class ExternalFunctionDescriptorProvider {
 
@@ -48,10 +48,10 @@
 class ExternalScalarFunctionDescriptor extends AbstractScalarFunctionDynamicDescriptor implements IFunctionDescriptor {
     private static final long serialVersionUID = 1L;
     private final IFunctionInfo finfo;
-    private ICopyEvaluatorFactory evaluatorFactory;
+    private IScalarEvaluatorFactory evaluatorFactory;
 
     @Override
-    public ICopyEvaluatorFactory createEvaluatorFactory(ICopyEvaluatorFactory[] args) throws AlgebricksException {
+    public IScalarEvaluatorFactory createEvaluatorFactory(IScalarEvaluatorFactory[] args) throws AlgebricksException {
         evaluatorFactory = new ExternalScalarFunctionEvaluatorFactory((IExternalFunctionInfo) finfo, args);
         return evaluatorFactory;
     }
diff --git a/asterix-external-data/src/main/java/org/apache/asterix/external/library/ExternalFunctionProvider.java b/asterix-external-data/src/main/java/org/apache/asterix/external/library/ExternalFunctionProvider.java
index e2cf013..3dea50c 100755
--- a/asterix-external-data/src/main/java/org/apache/asterix/external/library/ExternalFunctionProvider.java
+++ b/asterix-external-data/src/main/java/org/apache/asterix/external/library/ExternalFunctionProvider.java
@@ -24,19 +24,19 @@
 import org.apache.asterix.om.functions.IExternalFunctionInfo;
 import org.apache.asterix.om.types.ATypeTag;
 import org.apache.hyracks.algebricks.common.exceptions.AlgebricksException;
-import org.apache.hyracks.algebricks.runtime.base.ICopyEvaluator;
-import org.apache.hyracks.algebricks.runtime.base.ICopyEvaluatorFactory;
-import org.apache.hyracks.data.std.api.IDataOutputProvider;
-import org.apache.hyracks.data.std.util.ArrayBackedValueStorage;
+import org.apache.hyracks.algebricks.runtime.base.IScalarEvaluator;
+import org.apache.hyracks.algebricks.runtime.base.IScalarEvaluatorFactory;
+import org.apache.hyracks.api.context.IHyracksTaskContext;
+import org.apache.hyracks.data.std.api.IPointable;
 import org.apache.hyracks.dataflow.common.data.accessors.IFrameTupleReference;
 
 public class ExternalFunctionProvider {
 
     public static IExternalFunction getExternalFunctionEvaluator(IExternalFunctionInfo finfo,
-            ICopyEvaluatorFactory args[], IDataOutputProvider outputProvider) throws AlgebricksException {
+            IScalarEvaluatorFactory args[], IHyracksTaskContext context) throws AlgebricksException {
         switch (finfo.getKind()) {
             case SCALAR:
-                return new ExternalScalarFunction(finfo, args, outputProvider);
+                return new ExternalScalarFunction(finfo, args, context);
             case AGGREGATE:
             case UNNEST:
                 throw new IllegalArgumentException(" UDF of kind" + finfo.getKind() + " not supported.");
@@ -46,10 +46,11 @@
     }
 }
 
-class ExternalScalarFunction extends ExternalFunction implements IExternalScalarFunction, ICopyEvaluator {
-    public ExternalScalarFunction(IExternalFunctionInfo finfo, ICopyEvaluatorFactory args[],
-            IDataOutputProvider outputProvider) throws AlgebricksException {
-        super(finfo, args, outputProvider);
+class ExternalScalarFunction extends ExternalFunction implements IExternalScalarFunction, IScalarEvaluator {
+
+    public ExternalScalarFunction(IExternalFunctionInfo finfo, IScalarEvaluatorFactory args[],
+            IHyracksTaskContext context) throws AlgebricksException {
+        super(finfo, args, context);
         try {
             initialize(functionHelper);
         } catch (Exception e) {
@@ -58,11 +59,12 @@
     }
 
     @Override
-    public void evaluate(IFrameTupleReference tuple) throws AlgebricksException {
+    public void evaluate(IFrameTupleReference tuple, IPointable result) throws AlgebricksException {
         try {
             setArguments(tuple);
             evaluate(functionHelper);
             functionHelper.reset();
+            result.set(resultBuffer.getByteArray(), resultBuffer.getStartOffset(), resultBuffer.getLength());
         } catch (Exception e) {
             e.printStackTrace();
             throw new AlgebricksException(e);
@@ -77,9 +79,9 @@
          * or the result object is null we let Hyracks storage manager know
          * we want to discard a null object
          */
-        byte byteOutput = ((ArrayBackedValueStorage) out).getByteArray()[0];
+        byte byteOutput = resultBuffer.getByteArray()[0];
         if (!argumentProvider.isValidResult() || byteOutput == ATypeTag.SERIALIZED_NULL_TYPE_TAG) {
-            out.getDataOutput().writeByte(ATypeTag.SERIALIZED_NULL_TYPE_TAG);
+            resultBuffer.getDataOutput().writeByte(ATypeTag.SERIALIZED_NULL_TYPE_TAG);
         }
     }
 
diff --git a/asterix-external-data/src/main/java/org/apache/asterix/external/library/ExternalScalarFunctionEvaluatorFactory.java b/asterix-external-data/src/main/java/org/apache/asterix/external/library/ExternalScalarFunctionEvaluatorFactory.java
index c7f98a8..7c1ce4b 100755
--- a/asterix-external-data/src/main/java/org/apache/asterix/external/library/ExternalScalarFunctionEvaluatorFactory.java
+++ b/asterix-external-data/src/main/java/org/apache/asterix/external/library/ExternalScalarFunctionEvaluatorFactory.java
@@ -20,25 +20,25 @@
 
 import org.apache.asterix.om.functions.IExternalFunctionInfo;
 import org.apache.hyracks.algebricks.common.exceptions.AlgebricksException;
-import org.apache.hyracks.algebricks.runtime.base.ICopyEvaluator;
-import org.apache.hyracks.algebricks.runtime.base.ICopyEvaluatorFactory;
-import org.apache.hyracks.data.std.api.IDataOutputProvider;
+import org.apache.hyracks.algebricks.runtime.base.IScalarEvaluator;
+import org.apache.hyracks.algebricks.runtime.base.IScalarEvaluatorFactory;
+import org.apache.hyracks.api.context.IHyracksTaskContext;
 
-public class ExternalScalarFunctionEvaluatorFactory implements ICopyEvaluatorFactory {
+public class ExternalScalarFunctionEvaluatorFactory implements IScalarEvaluatorFactory {
 
     private static final long serialVersionUID = 1L;
     private final IExternalFunctionInfo finfo;
-    private final ICopyEvaluatorFactory[] args;
+    private final IScalarEvaluatorFactory[] args;
 
-    public ExternalScalarFunctionEvaluatorFactory(IExternalFunctionInfo finfo, ICopyEvaluatorFactory[] args)
+    public ExternalScalarFunctionEvaluatorFactory(IExternalFunctionInfo finfo, IScalarEvaluatorFactory[] args)
             throws AlgebricksException {
         this.finfo = finfo;
         this.args = args;
     }
 
     @Override
-    public ICopyEvaluator createEvaluator(IDataOutputProvider output) throws AlgebricksException {
-        return (ExternalScalarFunction) ExternalFunctionProvider.getExternalFunctionEvaluator(finfo, args, output);
+    public IScalarEvaluator createScalarEvaluator(IHyracksTaskContext ctx) throws AlgebricksException {
+        return (ExternalScalarFunction) ExternalFunctionProvider.getExternalFunctionEvaluator(finfo, args, ctx);
     }
 
 }
diff --git a/asterix-fuzzyjoin/src/main/java/org/apache/asterix/fuzzyjoin/similarity/SimilarityMetricEditDistance.java b/asterix-fuzzyjoin/src/main/java/org/apache/asterix/fuzzyjoin/similarity/SimilarityMetricEditDistance.java
index ea57fd2..9dce89e 100644
--- a/asterix-fuzzyjoin/src/main/java/org/apache/asterix/fuzzyjoin/similarity/SimilarityMetricEditDistance.java
+++ b/asterix-fuzzyjoin/src/main/java/org/apache/asterix/fuzzyjoin/similarity/SimilarityMetricEditDistance.java
@@ -155,13 +155,12 @@
     }
 
     // faster implementation for common case of string edit distance
-    public int UTF8StringEditDistance(byte[] bytes, int fsStart, int ssStart) {
+    public int UTF8StringEditDistance(byte[] leftBytes, int fsStart, byte[] rightBytes, int ssStart) {
+        int fsLen = UTF8StringUtil.getStringLength(leftBytes, fsStart);
+        int ssLen = UTF8StringUtil.getStringLength(rightBytes, ssStart);
 
-        int fsLen = UTF8StringUtil.getStringLength(bytes, fsStart);
-        int ssLen = UTF8StringUtil.getStringLength(bytes, ssStart);
-
-        int fsUtfLen = UTF8StringUtil.getUTFLength(bytes, fsStart);
-        int ssUtfLen = UTF8StringUtil.getUTFLength(bytes, ssStart);
+        int fsUtfLen = UTF8StringUtil.getUTFLength(leftBytes, fsStart);
+        int ssUtfLen = UTF8StringUtil.getUTFLength(rightBytes, ssStart);
         int fsMetaLen = UTF8StringUtil.getNumBytesToStoreLength(fsUtfLen);
         int ssMetaLen = UTF8StringUtil.getNumBytesToStoreLength(ssUtfLen);
 
@@ -186,35 +185,30 @@
         int fsPos = fsDataStart;
         for (int i = 1; i <= fsLen; i++) {
             matrix[currRow][0] = i;
-            char fsChar = Character.toLowerCase(UTF8StringUtil.charAt(bytes, fsPos));
-
+            char fsChar = Character.toLowerCase(UTF8StringUtil.charAt(leftBytes, fsPos));
             int ssPos = ssDataStart;
             for (int j = 1; j <= ssLen; j++) {
-                char ssChar = Character.toLowerCase(UTF8StringUtil.charAt(bytes, ssPos));
+                char ssChar = Character.toLowerCase(UTF8StringUtil.charAt(rightBytes, ssPos));
 
                 matrix[currRow][j] = Math.min(Math.min(matrix[prevRow][j] + 1, matrix[currRow][j - 1] + 1),
                         matrix[prevRow][j - 1] + (fsChar == ssChar ? 0 : 1));
 
-                ssPos += UTF8StringUtil.charSize(bytes, ssPos);
+                ssPos += UTF8StringUtil.charSize(rightBytes, ssPos);
             }
-
-            fsPos += UTF8StringUtil.charSize(bytes, fsPos);
-
+            fsPos += UTF8StringUtil.charSize(leftBytes, fsPos);
             int tmp = currRow;
             currRow = prevRow;
             prevRow = tmp;
         }
-
         return matrix[prevRow][ssLen];
     }
 
-    public int UTF8StringEditDistance(byte[] bytes, int fsStart, int ssStart, int edThresh) {
+    public int UTF8StringEditDistance(byte[] bytesLeft, int fsStart, byte[] bytesRight, int ssStart, int edThresh) {
+        int fsStrLen = UTF8StringUtil.getStringLength(bytesLeft, fsStart);
+        int ssStrLen = UTF8StringUtil.getStringLength(bytesRight, ssStart);
 
-        int fsStrLen = UTF8StringUtil.getStringLength(bytes, fsStart);
-        int ssStrLen = UTF8StringUtil.getStringLength(bytes, ssStart);
-
-        int fsUtfLen = UTF8StringUtil.getUTFLength(bytes, fsStart);
-        int ssUtfLen = UTF8StringUtil.getUTFLength(bytes, ssStart);
+        int fsUtfLen = UTF8StringUtil.getUTFLength(bytesLeft, fsStart);
+        int ssUtfLen = UTF8StringUtil.getUTFLength(bytesRight, ssStart);
         int fsMetaLen = UTF8StringUtil.getNumBytesToStoreLength(fsUtfLen);
         int ssMetaLen = UTF8StringUtil.getNumBytesToStoreLength(ssUtfLen);
 
@@ -231,22 +225,22 @@
         int fsPos = fsStart + fsMetaLen;
         int fsEnd = fsPos + fsUtfLen;;
         while (fsPos < fsEnd) {
-            char c = Character.toLowerCase(UTF8StringUtil.charAt(bytes, fsPos));
+            char c = Character.toLowerCase(UTF8StringUtil.charAt(bytesLeft, fsPos));
             if (c < 128) {
                 fsLcCount[c]++;
             }
-            fsPos += UTF8StringUtil.charSize(bytes, fsPos);
+            fsPos += UTF8StringUtil.charSize(bytesLeft, fsPos);
         }
 
         // compute letter counts for second string
         int ssPos = ssStart + ssMetaLen;
         int ssEnd = ssPos + ssUtfLen;
         while (ssPos < ssEnd) {
-            char c = Character.toLowerCase(UTF8StringUtil.charAt(bytes, ssPos));
+            char c = Character.toLowerCase(UTF8StringUtil.charAt(bytesRight, ssPos));
             if (c < 128) {
                 ssLcCount[c]++;
             }
-            ssPos += UTF8StringUtil.charSize(bytes, ssPos);
+            ssPos += UTF8StringUtil.charSize(bytesRight, ssPos);
         }
 
         // apply filter
@@ -266,7 +260,7 @@
             }
         }
 
-        int ed = UTF8StringEditDistance(bytes, fsStart, ssStart);
+        int ed = UTF8StringEditDistance(bytesLeft, fsStart, bytesRight, ssStart);
         if (ed > edThresh) {
             return -1;
         } else {
@@ -275,15 +269,16 @@
     }
 
     // checks whether the first string contains a similar string to the second string
-    public int UTF8StringEditDistanceContains(byte[] bytes, int stringStart, int patternStart, int edThresh) {
+    public int UTF8StringEditDistanceContains(byte[] strBytes, int stringStart, byte[] pattenBytes, int patternStart,
+            int edThresh) {
 
-        int stringLen = UTF8StringUtil.getStringLength(bytes, stringStart);
-        int patternLen = UTF8StringUtil.getStringLength(bytes, patternStart);
+        int stringLen = UTF8StringUtil.getStringLength(strBytes, stringStart);
+        int patternLen = UTF8StringUtil.getStringLength(pattenBytes, patternStart);
 
-        int stringUTFLen = UTF8StringUtil.getUTFLength(bytes, stringStart);
+        int stringUTFLen = UTF8StringUtil.getUTFLength(strBytes, stringStart);
         int stringMetaLen = UTF8StringUtil.getNumBytesToStoreLength(stringUTFLen);
 
-        int patternUTFLen = UTF8StringUtil.getUTFLength(bytes, patternStart);
+        int patternUTFLen = UTF8StringUtil.getUTFLength(pattenBytes, patternStart);
         int patternMetaLen = UTF8StringUtil.getNumBytesToStoreLength(patternUTFLen);
 
         // reuse existing matrix if possible
@@ -292,7 +287,7 @@
             matrix = new int[rows][cols];
         }
 
-        int stringDataStart = stringStart +  stringMetaLen;
+        int stringDataStart = stringStart + stringMetaLen;
         int patternDataStart = patternStart + patternMetaLen;
 
         // init matrix
@@ -307,24 +302,20 @@
         int stringPos = stringDataStart;
         for (int i = 1; i <= stringLen; i++) {
             matrix[currRow][0] = 0;
-            char stringChar = Character.toLowerCase(UTF8StringUtil.charAt(bytes, stringPos));
+            char stringChar = Character.toLowerCase(UTF8StringUtil.charAt(strBytes, stringPos));
 
             int patternPos = patternDataStart;
             for (int j = 1; j <= patternLen; j++) {
-                char patternChar = Character.toLowerCase(UTF8StringUtil.charAt(bytes, patternPos));
-
+                char patternChar = Character.toLowerCase(UTF8StringUtil.charAt(pattenBytes, patternPos));
                 matrix[currRow][j] = Math.min(Math.min(matrix[prevRow][j] + 1, matrix[currRow][j - 1] + 1),
                         matrix[prevRow][j - 1] + (stringChar == patternChar ? 0 : 1));
-
-                patternPos += UTF8StringUtil.charSize(bytes, patternPos);
-
+                patternPos += UTF8StringUtil.charSize(pattenBytes, patternPos);
                 if (j == patternLen && matrix[currRow][patternLen] < minEd) {
                     minEd = matrix[currRow][patternLen];
                 }
             }
 
-            stringPos += UTF8StringUtil.charSize(bytes, stringPos);
-
+            stringPos += UTF8StringUtil.charSize(strBytes, stringPos);
             int tmp = currRow;
             currRow = prevRow;
             prevRow = tmp;
diff --git a/asterix-om/src/main/java/org/apache/asterix/builders/AbstractListBuilder.java b/asterix-om/src/main/java/org/apache/asterix/builders/AbstractListBuilder.java
index 2b05761..59e669a 100644
--- a/asterix-om/src/main/java/org/apache/asterix/builders/AbstractListBuilder.java
+++ b/asterix-om/src/main/java/org/apache/asterix/builders/AbstractListBuilder.java
@@ -77,13 +77,15 @@
     @Override
     public void addItem(IValueReference item) throws HyracksDataException {
         try {
-            if (!fixedSize && (item.getByteArray()[0] != ATypeTag.SERIALIZED_NULL_TYPE_TAG || itemTypeTag == ATypeTag.ANY))
+            if (!fixedSize && (item.getByteArray()[item.getStartOffset()] != ATypeTag.SERIALIZED_NULL_TYPE_TAG
+                    || itemTypeTag == ATypeTag.ANY)) {
                 this.offsets.add(outputStorage.getLength());
-            if (itemTypeTag == ATypeTag.ANY
-                    || (itemTypeTag == ATypeTag.NULL && item.getByteArray()[0] == ATypeTag.SERIALIZED_NULL_TYPE_TAG)) {
+            }
+            if (itemTypeTag == ATypeTag.ANY || (itemTypeTag == ATypeTag.NULL
+                    && item.getByteArray()[item.getStartOffset()] == ATypeTag.SERIALIZED_NULL_TYPE_TAG)) {
                 this.numberOfItems++;
                 this.outputStream.write(item.getByteArray(), item.getStartOffset(), item.getLength());
-            } else if (item.getByteArray()[0] != ATypeTag.SERIALIZED_NULL_TYPE_TAG) {
+            } else if (item.getByteArray()[item.getStartOffset()] != ATypeTag.SERIALIZED_NULL_TYPE_TAG) {
                 this.numberOfItems++;
                 this.outputStream.write(item.getByteArray(), item.getStartOffset() + 1, item.getLength() - 1);
             }
@@ -95,10 +97,12 @@
     @Override
     public void write(DataOutput out, boolean writeTypeTag) throws HyracksDataException {
         try {
-            if (!fixedSize)
+            if (!fixedSize) {
                 metadataInfoSize += offsets.size() * 4;
-            if (offsetArray == null || offsetArray.length < metadataInfoSize)
+            }
+            if (offsetArray == null || offsetArray.length < metadataInfoSize) {
                 offsetArray = new byte[metadataInfoSize];
+            }
 
             SerializerDeserializerUtil.writeIntToByteArray(offsetArray,
                     headerSize + metadataInfoSize + outputStorage.getLength(), offsetPosition);
diff --git a/asterix-om/src/main/java/org/apache/asterix/dataflow/data/nontagged/comparators/ABinaryComparator.java b/asterix-om/src/main/java/org/apache/asterix/dataflow/data/nontagged/comparators/ABinaryComparator.java
index c69d4cd..ec337eb 100644
--- a/asterix-om/src/main/java/org/apache/asterix/dataflow/data/nontagged/comparators/ABinaryComparator.java
+++ b/asterix-om/src/main/java/org/apache/asterix/dataflow/data/nontagged/comparators/ABinaryComparator.java
@@ -32,7 +32,8 @@
 
     public static ComparableResultCode isComparable(byte[] b1, int s1, int l1, byte[] b2, int s2, int l2) {
         // NULL Check. If one type is NULL, then we return NULL
-        if (b1[s1] == ATypeTag.NULL.serialize() || b2[s2] == ATypeTag.NULL.serialize() || b1[s1] == 0 || b1[s2] == 0) {
+        if (b1[s1] == ATypeTag.SERIALIZED_NULL_TYPE_TAG || b2[s2] == ATypeTag.SERIALIZED_NULL_TYPE_TAG || b1[s1] == 0
+                || b2[s2] == 0) {
             return ComparableResultCode.UNKNOWN;
         }
 
@@ -49,6 +50,7 @@
 
     }
 
+    @Override
     public abstract int compare(byte[] b1, int s1, int l1, byte[] b2, int s2, int l2) throws HyracksDataException;
 
 }
diff --git a/asterix-om/src/main/java/org/apache/asterix/dataflow/data/nontagged/serde/AOrderedListSerializerDeserializer.java b/asterix-om/src/main/java/org/apache/asterix/dataflow/data/nontagged/serde/AOrderedListSerializerDeserializer.java
index fba898d..364b2d6 100644
--- a/asterix-om/src/main/java/org/apache/asterix/dataflow/data/nontagged/serde/AOrderedListSerializerDeserializer.java
+++ b/asterix-om/src/main/java/org/apache/asterix/dataflow/data/nontagged/serde/AOrderedListSerializerDeserializer.java
@@ -118,10 +118,6 @@
         return AInt32SerializerDeserializer.getInt(serOrderedList, offset + 1);
     }
 
-    public static int getNumberOfItems(byte[] serOrderedList) {
-        return getNumberOfItems(serOrderedList, 0);
-    }
-
     public static int getNumberOfItems(byte[] serOrderedList, int offset) {
         if (serOrderedList[offset] == ATypeTag.ORDEREDLIST.serialize())
             // 6 = tag (1) + itemTag (1) + list size (4)
@@ -144,8 +140,4 @@
             return -1;
     }
 
-    public static int getItemOffset(byte[] serOrderedList, int itemIndex) throws AsterixException {
-        return getItemOffset(serOrderedList, 0, itemIndex);
-    }
-
 }
diff --git a/asterix-om/src/main/java/org/apache/asterix/dataflow/data/nontagged/serde/ARecordSerializerDeserializer.java b/asterix-om/src/main/java/org/apache/asterix/dataflow/data/nontagged/serde/ARecordSerializerDeserializer.java
index 53943b8..b65a12d 100644
--- a/asterix-om/src/main/java/org/apache/asterix/dataflow/data/nontagged/serde/ARecordSerializerDeserializer.java
+++ b/asterix-om/src/main/java/org/apache/asterix/dataflow/data/nontagged/serde/ARecordSerializerDeserializer.java
@@ -105,10 +105,12 @@
             } else {
                 if (recordType.isOpen()) {
                     isExpanded = in.readBoolean();
-                    if (isExpanded)
+                    if (isExpanded) {
                         in.readInt(); // openPartOffset
-                } else
+                    }
+                } else {
                     isExpanded = false;
+                }
             }
             IAObject[] closedFields = null;
             if (numberOfSchemaFields > 0) {
@@ -232,57 +234,64 @@
                     if (nullBitmapSize > 0) {
                         // 14 = tag (1) + record Size (4) + isExpanded (1) +
                         // offset of openPart (4) + number of closed fields (4)
-                        if ((serRecord[14 + offset + fieldId / 8] & (1 << (7 - (fieldId % 8)))) == 0)
+                        if ((serRecord[14 + offset + fieldId / 8] & (1 << (7 - (fieldId % 8)))) == 0) {
                             // the field value is null
                             return 0;
+                        }
                     }
-                    return AInt32SerializerDeserializer.getInt(serRecord, 14 + offset + nullBitmapSize + (4 * fieldId));
+                    return offset + AInt32SerializerDeserializer.getInt(serRecord,
+                            14 + offset + nullBitmapSize + (4 * fieldId));
                 } else {
                     if (nullBitmapSize > 0) {
                         // 9 = tag (1) + record Size (4) + isExpanded (1) +
                         // number of closed fields (4)
-                        if ((serRecord[10 + offset + fieldId / 8] & (1 << (7 - (fieldId % 8)))) == 0)
+                        if ((serRecord[10 + offset + fieldId / 8] & (1 << (7 - (fieldId % 8)))) == 0) {
                             // the field value is null
                             return 0;
+                        }
                     }
-                    return AInt32SerializerDeserializer.getInt(serRecord, 10 + offset + nullBitmapSize + (4 * fieldId));
+                    return offset + AInt32SerializerDeserializer.getInt(serRecord,
+                            10 + offset + nullBitmapSize + (4 * fieldId));
                 }
-            } else
+            } else {
                 return -1;
+            }
         } else {
-            if (serRecord[0 + offset] == ATypeTag.RECORD.serialize()) {
-                if (nullBitmapSize > 0)
+            if (serRecord[offset] == ATypeTag.SERIALIZED_RECORD_TYPE_TAG) {
+                if (nullBitmapSize > 0) {
                     // 9 = tag (1) + record Size (4) + number of closed fields
                     // (4)
-                    if ((serRecord[9 + offset + fieldId / 8] & (1 << (7 - (fieldId % 8)))) == 0)
+                    if ((serRecord[9 + offset + fieldId / 8] & (1 << (7 - (fieldId % 8)))) == 0) {
                         // the field value is null
                         return 0;
-                return AInt32SerializerDeserializer.getInt(serRecord, 9 + offset + nullBitmapSize + (4 * fieldId));
-            } else
+                    }
+                }
+                return offset
+                        + AInt32SerializerDeserializer.getInt(serRecord, 9 + offset + nullBitmapSize + (4 * fieldId));
+            } else {
                 return -1;
+            }
         }
     }
 
-    public static final int getFieldOffsetById(byte[] serRecord, int fieldId, int nullBitmapSize, boolean isOpen) {
-        return getFieldOffsetById(serRecord, 0, fieldId, nullBitmapSize, isOpen);
-    }
-
-    public static final int getFieldOffsetByName(byte[] serRecord, byte[] fieldName) throws HyracksDataException {
-
+    public static final int getFieldOffsetByName(byte[] serRecord, int start, int len, byte[] fieldName, int nstart)
+            throws HyracksDataException {
         int openPartOffset = 0;
-        if (serRecord[0] == ATypeTag.RECORD.serialize())
+        if (serRecord[start] == ATypeTag.SERIALIZED_RECORD_TYPE_TAG) {
             // 5 is the index of the byte that determines whether the record is
             // expanded or not, i.e. it has an open part.
-            if (serRecord[5] == 1) { // true
+            if (serRecord[start + 5] == 1) { // true
                 // 6 is the index of the first byte of the openPartOffset value.
-                openPartOffset = AInt32SerializerDeserializer.getInt(serRecord, 6);
-            } else
+                openPartOffset = start + AInt32SerializerDeserializer.getInt(serRecord, start + 6);
+            } else {
                 return -1; // this record does not have an open part
-        else
+            }
+        } else {
             return -1; // this record does not have an open part
+        }
 
         int numberOfOpenField = AInt32SerializerDeserializer.getInt(serRecord, openPartOffset);
-        int fieldUtflength = UTF8StringUtil.getUTFLength(fieldName, 1);
+        int fieldUtflength = UTF8StringUtil.getUTFLength(fieldName, nstart + 1);
         int fieldUtfMetaLen = UTF8StringUtil.getNumBytesToStoreLength(fieldUtflength);
 
         IBinaryHashFunction utf8HashFunction = AqlBinaryHashFunctionFactoryProvider.UTF8STRING_POINTABLE_INSTANCE
@@ -291,7 +300,7 @@
         IBinaryComparator utf8BinaryComparator = AqlBinaryComparatorFactoryProvider.UTF8STRING_POINTABLE_INSTANCE
                 .createBinaryComparator();
 
-        int fieldNameHashCode = utf8HashFunction.hash(fieldName, 1, fieldUtflength + fieldUtfMetaLen);
+        int fieldNameHashCode = utf8HashFunction.hash(fieldName, nstart + 1, fieldUtflength + fieldUtfMetaLen);
 
         int offset = openPartOffset + 4;
         int fieldOffset = -1;
@@ -303,29 +312,32 @@
             // 8 = hash code (4) + offset to the (name + tag + value ) of the field (4).
             int h = AInt32SerializerDeserializer.getInt(serRecord, offset + (8 * mid));
             if (h == fieldNameHashCode) {
-                fieldOffset = AInt32SerializerDeserializer.getInt(serRecord, offset + (8 * mid) + 4);
+                fieldOffset = start + AInt32SerializerDeserializer.getInt(serRecord, offset + (8 * mid) + 4);
                 // the utf8 comparator do not require to put the precise length, we can just pass a estimated limit.
-                if (utf8BinaryComparator.compare(serRecord, fieldOffset, serRecord.length, fieldName, 1,
-                        fieldUtflength + fieldUtfMetaLen) == 0)
+                if (utf8BinaryComparator.compare(serRecord, fieldOffset, len, fieldName, nstart + 1,
+                        fieldUtflength + fieldUtfMetaLen) == 0) {
                     // since they are equal, we can directly use the meta length and the utf length.
                     return fieldOffset + fieldUtfMetaLen + fieldUtflength;
-                else { // this else part has not been tested yet
+                } else { // this else part has not been tested yet
                     for (int j = mid + 1; j < numberOfOpenField; j++) {
                         h = AInt32SerializerDeserializer.getInt(serRecord, offset + (8 * j));
                         if (h == fieldNameHashCode) {
-                            fieldOffset = AInt32SerializerDeserializer.getInt(serRecord, offset + (8 * j) + 4);
-                            if (utf8BinaryComparator.compare(serRecord, fieldOffset, serRecord.length, fieldName, 1,
-                                    fieldUtflength) == 0)
+                            fieldOffset = start + AInt32SerializerDeserializer.getInt(serRecord, offset + (8 * j) + 4);
+                            if (utf8BinaryComparator.compare(serRecord, fieldOffset, len, fieldName, nstart + 1,
+                                    fieldUtflength) == 0) {
                                 return fieldOffset + fieldUtfMetaLen + fieldUtflength;
-                        } else
+                            }
+                        } else {
                             break;
+                        }
                     }
                 }
             }
-            if (fieldNameHashCode > h)
+            if (fieldNameHashCode > h) {
                 low = mid + 1;
-            else
+            } else {
                 high = mid - 1;
+            }
 
         }
         return -1; // no field with this name.
diff --git a/asterix-om/src/main/java/org/apache/asterix/dataflow/data/nontagged/serde/AUnorderedListSerializerDeserializer.java b/asterix-om/src/main/java/org/apache/asterix/dataflow/data/nontagged/serde/AUnorderedListSerializerDeserializer.java
index 9475e6a..46dc73d 100644
--- a/asterix-om/src/main/java/org/apache/asterix/dataflow/data/nontagged/serde/AUnorderedListSerializerDeserializer.java
+++ b/asterix-om/src/main/java/org/apache/asterix/dataflow/data/nontagged/serde/AUnorderedListSerializerDeserializer.java
@@ -120,10 +120,6 @@
         return AInt32SerializerDeserializer.getInt(serOrderedList, offset + 1);
     }
 
-    public static int getNumberOfItems(byte[] serOrderedList) {
-        return getNumberOfItems(serOrderedList, 0);
-    }
-
     public static int getNumberOfItems(byte[] serOrderedList, int offset) {
         if (serOrderedList[offset] == ATypeTag.UNORDEREDLIST.serialize())
             // 6 = tag (1) + itemTag (1) + list size (4)
@@ -146,8 +142,4 @@
             return -1;
     }
 
-    public static int getItemOffset(byte[] serOrderedList, int itemIndex) throws AsterixException {
-        return getItemOffset(serOrderedList, 0, itemIndex);
-    }
-
 }
diff --git a/asterix-om/src/main/java/org/apache/asterix/formats/base/IDataFormat.java b/asterix-om/src/main/java/org/apache/asterix/formats/base/IDataFormat.java
index 4872ede..01897d4 100644
--- a/asterix-om/src/main/java/org/apache/asterix/formats/base/IDataFormat.java
+++ b/asterix-om/src/main/java/org/apache/asterix/formats/base/IDataFormat.java
@@ -39,7 +39,7 @@
 import org.apache.hyracks.algebricks.data.IPrinterFactoryProvider;
 import org.apache.hyracks.algebricks.data.ISerializerDeserializerProvider;
 import org.apache.hyracks.algebricks.data.ITypeTraitProvider;
-import org.apache.hyracks.algebricks.runtime.base.ICopyEvaluatorFactory;
+import org.apache.hyracks.algebricks.runtime.base.IScalarEvaluatorFactory;
 import org.apache.hyracks.api.dataflow.value.INullWriterFactory;
 import org.apache.hyracks.api.dataflow.value.IPredicateEvaluatorFactoryProvider;
 
@@ -69,18 +69,18 @@
 
     public INullWriterFactory getNullWriterFactory();
 
-    public Triple<ICopyEvaluatorFactory, ScalarFunctionCallExpression, IAType> partitioningEvaluatorFactory(
+    public Triple<IScalarEvaluatorFactory, ScalarFunctionCallExpression, IAType> partitioningEvaluatorFactory(
             ARecordType recType, List<String> fldName) throws AlgebricksException;
 
-    public ICopyEvaluatorFactory getFieldAccessEvaluatorFactory(ARecordType recType, List<String> fldName,
+    public IScalarEvaluatorFactory getFieldAccessEvaluatorFactory(ARecordType recType, List<String> fldName,
             int recordColumn) throws AlgebricksException;
 
     public IFunctionDescriptor resolveFunction(ILogicalExpression expr, IVariableTypeEnvironment typeEnvironment)
             throws AlgebricksException;
 
-    public ICopyEvaluatorFactory getConstantEvalFactory(IAlgebricksConstantValue value) throws AlgebricksException;
+    public IScalarEvaluatorFactory getConstantEvalFactory(IAlgebricksConstantValue value) throws AlgebricksException;
 
-    public ICopyEvaluatorFactory[] createMBRFactory(ARecordType recType, List<String> fldName, int recordColumn,
+    public IScalarEvaluatorFactory[] createMBRFactory(ARecordType recType, List<String> fldName, int recordColumn,
             int dimension, List<String> filterFieldName) throws AlgebricksException;
 
     public IExpressionEvalSizeComputer getExpressionEvalSizeComputer();
diff --git a/asterix-om/src/main/java/org/apache/asterix/om/functions/AbstractFunctionDescriptor.java b/asterix-om/src/main/java/org/apache/asterix/om/functions/AbstractFunctionDescriptor.java
index 99da847..c070719 100644
--- a/asterix-om/src/main/java/org/apache/asterix/om/functions/AbstractFunctionDescriptor.java
+++ b/asterix-om/src/main/java/org/apache/asterix/om/functions/AbstractFunctionDescriptor.java
@@ -22,11 +22,11 @@
 import org.apache.hyracks.algebricks.common.exceptions.AlgebricksException;
 import org.apache.hyracks.algebricks.common.exceptions.NotImplementedException;
 import org.apache.hyracks.algebricks.core.algebra.functions.FunctionIdentifier;
-import org.apache.hyracks.algebricks.runtime.base.ICopyAggregateFunctionFactory;
-import org.apache.hyracks.algebricks.runtime.base.ICopyEvaluatorFactory;
-import org.apache.hyracks.algebricks.runtime.base.ICopyRunningAggregateFunctionFactory;
-import org.apache.hyracks.algebricks.runtime.base.ICopySerializableAggregateFunctionFactory;
-import org.apache.hyracks.algebricks.runtime.base.ICopyUnnestingFunctionFactory;
+import org.apache.hyracks.algebricks.runtime.base.IAggregateEvaluatorFactory;
+import org.apache.hyracks.algebricks.runtime.base.IScalarEvaluatorFactory;
+import org.apache.hyracks.algebricks.runtime.base.IRunningAggregateEvaluatorFactory;
+import org.apache.hyracks.algebricks.runtime.base.ISerializedAggregateEvaluatorFactory;
+import org.apache.hyracks.algebricks.runtime.base.IUnnestingEvaluatorFactory;
 
 public abstract class AbstractFunctionDescriptor implements IFunctionDescriptor {
 
@@ -39,30 +39,30 @@
     public abstract FunctionDescriptorTag getFunctionDescriptorTag();
 
     @Override
-    public ICopyEvaluatorFactory createEvaluatorFactory(ICopyEvaluatorFactory[] args) throws AlgebricksException {
+    public IScalarEvaluatorFactory createEvaluatorFactory(IScalarEvaluatorFactory[] args) throws AlgebricksException {
         throw new NotImplementedException("Not Implemented");
     }
 
     @Override
-    public ICopyRunningAggregateFunctionFactory createRunningAggregateFunctionFactory(ICopyEvaluatorFactory[] args)
+    public IRunningAggregateEvaluatorFactory createRunningAggregateEvaluatorFactory(IScalarEvaluatorFactory[] args)
             throws AlgebricksException {
         throw new NotImplementedException("Not Implemented");
     }
 
     @Override
-    public ICopySerializableAggregateFunctionFactory createSerializableAggregateFunctionFactory(
-            ICopyEvaluatorFactory[] args) throws AlgebricksException {
+    public ISerializedAggregateEvaluatorFactory createSerializableAggregateEvaluatorFactory(
+            IScalarEvaluatorFactory[] args) throws AlgebricksException {
         throw new NotImplementedException("Not Implemented");
     }
 
     @Override
-    public ICopyUnnestingFunctionFactory createUnnestingFunctionFactory(ICopyEvaluatorFactory[] args)
+    public IUnnestingEvaluatorFactory createUnnestingEvaluatorFactory(IScalarEvaluatorFactory[] args)
             throws AlgebricksException {
         throw new NotImplementedException("Not Implemented");
     }
 
     @Override
-    public ICopyAggregateFunctionFactory createAggregateFunctionFactory(ICopyEvaluatorFactory[] args)
+    public IAggregateEvaluatorFactory createAggregateEvaluatorFactory(IScalarEvaluatorFactory[] args)
             throws AlgebricksException {
         throw new NotImplementedException("Not Implemented");
     }
diff --git a/asterix-om/src/main/java/org/apache/asterix/om/functions/IFunctionDescriptor.java b/asterix-om/src/main/java/org/apache/asterix/om/functions/IFunctionDescriptor.java
index 01313cf..afdaaeb 100644
--- a/asterix-om/src/main/java/org/apache/asterix/om/functions/IFunctionDescriptor.java
+++ b/asterix-om/src/main/java/org/apache/asterix/om/functions/IFunctionDescriptor.java
@@ -23,29 +23,29 @@
 import org.apache.asterix.common.functions.FunctionDescriptorTag;
 import org.apache.hyracks.algebricks.common.exceptions.AlgebricksException;
 import org.apache.hyracks.algebricks.core.algebra.functions.FunctionIdentifier;
-import org.apache.hyracks.algebricks.runtime.base.ICopyAggregateFunctionFactory;
-import org.apache.hyracks.algebricks.runtime.base.ICopyEvaluatorFactory;
-import org.apache.hyracks.algebricks.runtime.base.ICopyRunningAggregateFunctionFactory;
-import org.apache.hyracks.algebricks.runtime.base.ICopySerializableAggregateFunctionFactory;
-import org.apache.hyracks.algebricks.runtime.base.ICopyUnnestingFunctionFactory;
+import org.apache.hyracks.algebricks.runtime.base.IAggregateEvaluatorFactory;
+import org.apache.hyracks.algebricks.runtime.base.IScalarEvaluatorFactory;
+import org.apache.hyracks.algebricks.runtime.base.IRunningAggregateEvaluatorFactory;
+import org.apache.hyracks.algebricks.runtime.base.ISerializedAggregateEvaluatorFactory;
+import org.apache.hyracks.algebricks.runtime.base.IUnnestingEvaluatorFactory;
 
 public interface IFunctionDescriptor extends Serializable {
     public FunctionIdentifier getIdentifier();
 
     public FunctionDescriptorTag getFunctionDescriptorTag();
 
-    public ICopyEvaluatorFactory createEvaluatorFactory(ICopyEvaluatorFactory[] args) throws AlgebricksException;
+    public IScalarEvaluatorFactory createEvaluatorFactory(IScalarEvaluatorFactory[] args) throws AlgebricksException;
 
-    public ICopyRunningAggregateFunctionFactory createRunningAggregateFunctionFactory(final ICopyEvaluatorFactory[] args)
+    public IRunningAggregateEvaluatorFactory createRunningAggregateEvaluatorFactory(final IScalarEvaluatorFactory[] args)
             throws AlgebricksException;
 
-    public ICopySerializableAggregateFunctionFactory createSerializableAggregateFunctionFactory(
-            final ICopyEvaluatorFactory[] args) throws AlgebricksException;
+    public ISerializedAggregateEvaluatorFactory createSerializableAggregateEvaluatorFactory(
+            final IScalarEvaluatorFactory[] args) throws AlgebricksException;
 
-    public ICopyUnnestingFunctionFactory createUnnestingFunctionFactory(final ICopyEvaluatorFactory[] args)
+    public IUnnestingEvaluatorFactory createUnnestingEvaluatorFactory(final IScalarEvaluatorFactory[] args)
             throws AlgebricksException;
 
-    public ICopyAggregateFunctionFactory createAggregateFunctionFactory(final ICopyEvaluatorFactory[] args)
+    public IAggregateEvaluatorFactory createAggregateEvaluatorFactory(final IScalarEvaluatorFactory[] args)
             throws AlgebricksException;
 
 }
\ No newline at end of file
diff --git a/asterix-om/src/main/java/org/apache/asterix/om/pointables/nonvisitor/ARecordPointable.java b/asterix-om/src/main/java/org/apache/asterix/om/pointables/nonvisitor/ARecordPointable.java
index ac50312..e3e09d8 100644
--- a/asterix-om/src/main/java/org/apache/asterix/om/pointables/nonvisitor/ARecordPointable.java
+++ b/asterix-om/src/main/java/org/apache/asterix/om/pointables/nonvisitor/ARecordPointable.java
@@ -21,7 +21,6 @@
 
 import java.io.DataOutput;
 import java.io.IOException;
-import java.util.Arrays;
 
 import org.apache.asterix.common.exceptions.AsterixException;
 import org.apache.asterix.om.types.ARecordType;
@@ -166,10 +165,6 @@
         return (isOpen(recordType)) ? EXPANDED_SIZE : 0;
     }
 
-    public int getOpenPart(ARecordType recordType) {
-        return IntegerPointable.getInteger(bytes, getOpenPartOffset(recordType));
-    }
-
     public int getOpenPartOffset(ARecordType recordType) {
         return getExpendedOffset(recordType) + getExpandedSize(recordType);
     }
@@ -190,13 +185,6 @@
         return CLOSED_COUNT_SIZE;
     }
 
-    public byte[] getNullBitmap(ARecordType recordType) {
-        if (getNullBitmapSize(recordType) > 0) {
-            return Arrays.copyOfRange(bytes, getNullBitmapOffset(recordType), getNullBitmapSize(recordType));
-        }
-        return null;
-    }
-
     public int getNullBitmapOffset(ARecordType recordType) {
         return getClosedFieldCountOffset(recordType) + getClosedFieldCountSize(recordType);
     }
@@ -258,7 +246,7 @@
 
     public int getClosedFieldOffset(ARecordType recordType, int fieldId) {
         int offset = getNullBitmapOffset(recordType) + getNullBitmapSize(recordType) + fieldId * FIELD_OFFSET_SIZE;
-        return IntegerPointable.getInteger(bytes, offset);
+        return start + IntegerPointable.getInteger(bytes, offset);
     }
 
     // -----------------------
@@ -274,7 +262,7 @@
     }
 
     public int getOpenFieldCountOffset(ARecordType recordType) {
-        return getOpenPart(recordType);
+        return start + IntegerPointable.getInteger(bytes, getOpenPartOffset(recordType));
     }
 
     // -----------------------
@@ -327,7 +315,7 @@
     }
 
     public int getOpenFieldOffset(ARecordType recordType, int fieldId) {
-        return IntegerPointable.getInteger(bytes, getOpenFieldOffsetOffset(recordType, fieldId));
+        return start + IntegerPointable.getInteger(bytes, getOpenFieldOffsetOffset(recordType, fieldId));
     }
 
     public int getOpenFieldOffsetOffset(ARecordType recordType, int fieldId) {
diff --git a/asterix-om/src/main/java/org/apache/asterix/om/types/ATypeTag.java b/asterix-om/src/main/java/org/apache/asterix/om/types/ATypeTag.java
index 6196c60..641a6dd 100644
--- a/asterix-om/src/main/java/org/apache/asterix/om/types/ATypeTag.java
+++ b/asterix-om/src/main/java/org/apache/asterix/om/types/ATypeTag.java
@@ -95,6 +95,7 @@
     public static final byte SERIALIZED_INT16_TYPE_TAG = INT16.serialize();
     public static final byte SERIALIZED_INT64_TYPE_TAG = INT64.serialize();
     public static final byte SERIALIZED_FLOAT_TYPE_TAG = FLOAT.serialize();
+    public static final byte SERIALIZED_BINARY_TYPE_TAG = BINARY.serialize();
     /*
      * Serialized Tags end
      */
@@ -124,10 +125,8 @@
     }
 
     public boolean isDerivedType() {
-        if (this == ATypeTag.RECORD || this == ATypeTag.ORDEREDLIST || this == ATypeTag.UNORDEREDLIST
-                || this == ATypeTag.UNION)
-            return true;
-        return false;
+        return this == ATypeTag.RECORD || this == ATypeTag.ORDEREDLIST || this == ATypeTag.UNORDEREDLIST
+                || this == ATypeTag.UNION;
     }
 
 }
\ No newline at end of file
diff --git a/asterix-om/src/main/java/org/apache/asterix/om/types/hierachy/ATypeHierarchy.java b/asterix-om/src/main/java/org/apache/asterix/om/types/hierachy/ATypeHierarchy.java
index 0b6b45d..f85aa50 100644
--- a/asterix-om/src/main/java/org/apache/asterix/om/types/hierachy/ATypeHierarchy.java
+++ b/asterix-om/src/main/java/org/apache/asterix/om/types/hierachy/ATypeHierarchy.java
@@ -125,10 +125,12 @@
     public static boolean isSameTypeDomain(ATypeTag tag1, ATypeTag tag2, boolean useListDomain) {
         Domain tagHierarchy1 = hierarchyDomains.get(tag1);
         Domain tagHierarchy2 = hierarchyDomains.get(tag2);
-        if (tagHierarchy1 == null || tagHierarchy2 == null)
+        if (tagHierarchy1 == null || tagHierarchy2 == null) {
             return false;
-        if (useListDomain && tagHierarchy1 == Domain.LIST && tagHierarchy2 == Domain.LIST)
+        }
+        if (useListDomain && tagHierarchy1 == Domain.LIST && tagHierarchy2 == Domain.LIST) {
             return true;
+        }
         return tagHierarchy1.equals(tagHierarchy2) && !useListDomain;
     }
 
@@ -189,24 +191,24 @@
         if (sourceTypeTag != targetTypeTag) {
 
             switch (targetTypeTag) {
-            //Target Field Type:INT64
+                //Target Field Type:INT64
                 case INT64:
 
                     // Change the Constant Type to INT64 Type
                     switch (sourceTypeTag) {
                         case INT8:
-                            asterixNewConstantValue = new AsterixConstantValue(new AInt64(
-                                    (long) ((AInt8) sourceObject).getByteValue()));
+                            asterixNewConstantValue = new AsterixConstantValue(
+                                    new AInt64((long) ((AInt8) sourceObject).getByteValue()));
                             break;
 
                         case INT16:
-                            asterixNewConstantValue = new AsterixConstantValue(new AInt64(
-                                    (long) ((AInt16) sourceObject).getShortValue()));
+                            asterixNewConstantValue = new AsterixConstantValue(
+                                    new AInt64((long) ((AInt16) sourceObject).getShortValue()));
                             break;
 
                         case INT32:
-                            asterixNewConstantValue = new AsterixConstantValue(new AInt64(
-                                    (long) ((AInt32) sourceObject).getIntegerValue()));
+                            asterixNewConstantValue = new AsterixConstantValue(
+                                    new AInt64((long) ((AInt32) sourceObject).getIntegerValue()));
                             break;
 
                         case FLOAT:
@@ -235,13 +237,13 @@
                     // Change the Constant Type to INT32 Type
                     switch (sourceTypeTag) {
                         case INT8:
-                            asterixNewConstantValue = new AsterixConstantValue(new AInt32(
-                                    (int) ((AInt8) sourceObject).getByteValue()));
+                            asterixNewConstantValue = new AsterixConstantValue(
+                                    new AInt32(((AInt8) sourceObject).getByteValue()));
                             break;
 
                         case INT16:
-                            asterixNewConstantValue = new AsterixConstantValue(new AInt32(
-                                    (int) ((AInt16) sourceObject).getShortValue()));
+                            asterixNewConstantValue = new AsterixConstantValue(
+                                    new AInt32(((AInt16) sourceObject).getShortValue()));
                             break;
 
                         case INT64:
@@ -321,8 +323,8 @@
                     // Change the Constant Type to INT16 Type
                     switch (sourceTypeTag) {
                         case INT8:
-                            asterixNewConstantValue = new AsterixConstantValue(new AInt16(
-                                    (short) ((AInt8) sourceObject).getByteValue()));
+                            asterixNewConstantValue = new AsterixConstantValue(
+                                    new AInt16(((AInt8) sourceObject).getByteValue()));
                             break;
 
                         case INT32:
@@ -363,23 +365,23 @@
                     // Change the Constant Type to FLOAT Type
                     switch (sourceTypeTag) {
                         case INT8:
-                            asterixNewConstantValue = new AsterixConstantValue(new AFloat(
-                                    (float) ((AInt8) sourceObject).getByteValue()));
+                            asterixNewConstantValue = new AsterixConstantValue(
+                                    new AFloat(((AInt8) sourceObject).getByteValue()));
                             break;
 
                         case INT16:
-                            asterixNewConstantValue = new AsterixConstantValue(new AFloat(
-                                    (float) ((AInt16) sourceObject).getShortValue()));
+                            asterixNewConstantValue = new AsterixConstantValue(
+                                    new AFloat(((AInt16) sourceObject).getShortValue()));
                             break;
 
                         case INT32:
-                            asterixNewConstantValue = new AsterixConstantValue(new AFloat(
-                                    (float) (int) ((AInt32) sourceObject).getIntegerValue()));
+                            asterixNewConstantValue = new AsterixConstantValue(
+                                    new AFloat(((AInt32) sourceObject).getIntegerValue()));
                             break;
 
                         case INT64:
-                            asterixNewConstantValue = new AsterixConstantValue(new AFloat(
-                                    (float) ((AInt64) sourceObject).getLongValue()));
+                            asterixNewConstantValue = new AsterixConstantValue(
+                                    new AFloat(((AInt64) sourceObject).getLongValue()));
                             break;
 
                         case DOUBLE:
@@ -399,28 +401,28 @@
                     // Change the Constant Type to DOUBLE Type
                     switch (sourceTypeTag) {
                         case INT8:
-                            asterixNewConstantValue = new AsterixConstantValue(new ADouble(
-                                    (double) ((AInt8) sourceObject).getByteValue()));
+                            asterixNewConstantValue = new AsterixConstantValue(
+                                    new ADouble(((AInt8) sourceObject).getByteValue()));
                             break;
 
                         case INT16:
-                            asterixNewConstantValue = new AsterixConstantValue(new ADouble(
-                                    (double) ((AInt16) sourceObject).getShortValue()));
+                            asterixNewConstantValue = new AsterixConstantValue(
+                                    new ADouble(((AInt16) sourceObject).getShortValue()));
                             break;
 
                         case INT32:
-                            asterixNewConstantValue = new AsterixConstantValue(new ADouble(
-                                    (double) (int) ((AInt32) sourceObject).getIntegerValue()));
+                            asterixNewConstantValue = new AsterixConstantValue(
+                                    new ADouble(((AInt32) sourceObject).getIntegerValue()));
                             break;
 
                         case INT64:
-                            asterixNewConstantValue = new AsterixConstantValue(new ADouble(
-                                    (double) ((AInt64) sourceObject).getLongValue()));
+                            asterixNewConstantValue = new AsterixConstantValue(
+                                    new ADouble(((AInt64) sourceObject).getLongValue()));
                             break;
 
                         case FLOAT:
-                            asterixNewConstantValue = new AsterixConstantValue(new ADouble(
-                                    (double) ((AFloat) sourceObject).getFloatValue()));
+                            asterixNewConstantValue = new AsterixConstantValue(
+                                    new ADouble(((AFloat) sourceObject).getFloatValue()));
                             break;
 
                         default:
@@ -494,18 +496,18 @@
                     case INT8:
                         return sourceObject;
                     case INT16:
-                        return new AInt16((short) ((AInt8) sourceObject).getByteValue());
+                        return new AInt16(((AInt8) sourceObject).getByteValue());
                     case INT32:
-                        return new AInt32((int) ((AInt8) sourceObject).getByteValue());
+                        return new AInt32(((AInt8) sourceObject).getByteValue());
                     case INT64:
                         return new AInt64((long) ((AInt8) sourceObject).getByteValue());
                     case FLOAT:
-                        return new AFloat((float) ((AInt8) sourceObject).getByteValue());
+                        return new AFloat(((AInt8) sourceObject).getByteValue());
                     case DOUBLE:
-                        return new ADouble((double) ((AInt8) sourceObject).getByteValue());
+                        return new ADouble(((AInt8) sourceObject).getByteValue());
                     default:
-                        throw new AsterixException("Can't convert the " + sourceTypeTag + " type to the "
-                                + targetTypeTag + " type.");
+                        throw new AsterixException(
+                                "Can't convert the " + sourceTypeTag + " type to the " + targetTypeTag + " type.");
                 }
             case INT16:
                 switch (targetTypeTag) {
@@ -515,37 +517,37 @@
                     case INT16:
                         return sourceObject;
                     case INT32:
-                        return new AInt32((int) ((AInt16) sourceObject).getShortValue());
+                        return new AInt32(((AInt16) sourceObject).getShortValue());
                     case INT64:
                         return new AInt64((long) ((AInt16) sourceObject).getShortValue());
                     case FLOAT:
-                        return new AFloat((float) ((AInt16) sourceObject).getShortValue());
+                        return new AFloat(((AInt16) sourceObject).getShortValue());
                     case DOUBLE:
-                        return new ADouble((double) ((AInt16) sourceObject).getShortValue());
+                        return new ADouble(((AInt16) sourceObject).getShortValue());
                     default:
-                        throw new AsterixException("Can't convert the " + sourceTypeTag + " type to the "
-                                + targetTypeTag + " type.");
+                        throw new AsterixException(
+                                "Can't convert the " + sourceTypeTag + " type to the " + targetTypeTag + " type.");
                 }
 
             case INT32:
                 switch (targetTypeTag) {
                     case INT8:
                         // an exception can happen because of a type demotion from INT32 to INT8
-                        return new AInt8((byte) ((AInt32) sourceObject).getIntegerValue().byteValue());
+                        return new AInt8(((AInt32) sourceObject).getIntegerValue().byteValue());
                     case INT16:
                         // an exception can happen because of a type demotion from INT32 to INT16
-                        return new AInt16((short) ((AInt32) sourceObject).getIntegerValue().shortValue());
+                        return new AInt16(((AInt32) sourceObject).getIntegerValue().shortValue());
                     case INT32:
                         return sourceObject;
                     case INT64:
                         return new AInt64((long) ((AInt32) sourceObject).getIntegerValue());
                     case FLOAT:
-                        return new AFloat((float) ((AInt32) sourceObject).getIntegerValue());
+                        return new AFloat(((AInt32) sourceObject).getIntegerValue());
                     case DOUBLE:
-                        return new ADouble((double) ((AInt32) sourceObject).getIntegerValue());
+                        return new ADouble(((AInt32) sourceObject).getIntegerValue());
                     default:
-                        throw new AsterixException("Can't convert the " + sourceTypeTag + " type to the "
-                                + targetTypeTag + " type.");
+                        throw new AsterixException(
+                                "Can't convert the " + sourceTypeTag + " type to the " + targetTypeTag + " type.");
                 }
 
             case INT64:
@@ -562,12 +564,12 @@
                     case INT64:
                         return sourceObject;
                     case FLOAT:
-                        return new AFloat((float) ((AInt64) sourceObject).getLongValue());
+                        return new AFloat(((AInt64) sourceObject).getLongValue());
                     case DOUBLE:
-                        return new ADouble((double) ((AInt64) sourceObject).getLongValue());
+                        return new ADouble(((AInt64) sourceObject).getLongValue());
                     default:
-                        throw new AsterixException("Can't convert the " + sourceTypeTag + " type to the "
-                                + targetTypeTag + " type.");
+                        throw new AsterixException(
+                                "Can't convert the " + sourceTypeTag + " type to the " + targetTypeTag + " type.");
                 }
             case FLOAT:
                 switch (targetTypeTag) {
@@ -586,10 +588,10 @@
                     case FLOAT:
                         return sourceObject;
                     case DOUBLE:
-                        return new ADouble((double) ((AFloat) sourceObject).getFloatValue());
+                        return new ADouble(((AFloat) sourceObject).getFloatValue());
                     default:
-                        throw new AsterixException("Can't convert the " + sourceTypeTag + " type to the "
-                                + targetTypeTag + " type.");
+                        throw new AsterixException(
+                                "Can't convert the " + sourceTypeTag + " type to the " + targetTypeTag + " type.");
                 }
             case DOUBLE:
                 switch (targetTypeTag) {
@@ -611,8 +613,8 @@
                     case DOUBLE:
                         return sourceObject;
                     default:
-                        throw new AsterixException("Can't convert the " + sourceTypeTag + " type to the "
-                                + targetTypeTag + " type.");
+                        throw new AsterixException(
+                                "Can't convert the " + sourceTypeTag + " type to the " + targetTypeTag + " type.");
                 }
             default:
                 throw new AsterixException("Source type is not a numeric type.");
@@ -636,7 +638,8 @@
                 convertComputer = ATypeHierarchy.getTypeDemoteComputer(sourceTypeTag, targetTypeTag);;
                 convertComputer.convertType(sourceByteArray, s1 + 1, l1 - 1, out);
             } else {
-                throw new IOException("Can't convert the " + sourceTypeTag + " type to the " + targetTypeTag + " type.");
+                throw new IOException(
+                        "Can't convert the " + sourceTypeTag + " type to the " + targetTypeTag + " type.");
             }
         }
 
@@ -662,10 +665,10 @@
                 value = IntegerPointable.getInteger(bytes, offset);
                 break;
             case INT8:
-                value = (int) bytes[offset];
+                value = bytes[offset];
                 break;
             case INT16:
-                value = (int) ShortPointable.getShort(bytes, offset);
+                value = ShortPointable.getShort(bytes, offset);
                 break;
             case FLOAT:
                 value = (int) FloatPointable.getFloat(bytes, offset);
@@ -699,13 +702,13 @@
                 value = LongPointable.getLong(bytes, offset);
                 break;
             case INT32:
-                value = (long) IntegerPointable.getInteger(bytes, offset);
+                value = IntegerPointable.getInteger(bytes, offset);
                 break;
             case INT8:
-                value = (long) bytes[offset];
+                value = bytes[offset];
                 break;
             case INT16:
-                value = (long) ShortPointable.getShort(bytes, offset);
+                value = ShortPointable.getShort(bytes, offset);
                 break;
             case FLOAT:
                 value = (long) FloatPointable.getFloat(bytes, offset);
@@ -736,16 +739,16 @@
 
         switch (sourceTypeTag) {
             case INT64:
-                value = (float) LongPointable.getLong(bytes, offset);
+                value = LongPointable.getLong(bytes, offset);
                 break;
             case INT32:
-                value = (float) IntegerPointable.getInteger(bytes, offset);
+                value = IntegerPointable.getInteger(bytes, offset);
                 break;
             case INT8:
-                value = (float) bytes[offset];
+                value = bytes[offset];
                 break;
             case INT16:
-                value = (float) ShortPointable.getShort(bytes, offset);
+                value = ShortPointable.getShort(bytes, offset);
                 break;
             case FLOAT:
                 value = FloatPointable.getFloat(bytes, offset);
@@ -776,19 +779,19 @@
 
         switch (sourceTypeTag) {
             case INT64:
-                value = (double) LongPointable.getLong(bytes, offset);
+                value = LongPointable.getLong(bytes, offset);
                 break;
             case INT32:
-                value = (double) IntegerPointable.getInteger(bytes, offset);
+                value = IntegerPointable.getInteger(bytes, offset);
                 break;
             case INT8:
-                value = (double) bytes[offset];
+                value = bytes[offset];
                 break;
             case INT16:
-                value = (double) ShortPointable.getShort(bytes, offset);
+                value = ShortPointable.getShort(bytes, offset);
                 break;
             case FLOAT:
-                value = (double) FloatPointable.getFloat(bytes, offset);
+                value = FloatPointable.getFloat(bytes, offset);
                 break;
             case DOUBLE:
                 value = DoublePointable.getDouble(bytes, offset);
diff --git a/asterix-runtime/src/main/java/org/apache/asterix/runtime/aggregates/collections/ListifyAggregateDescriptor.java b/asterix-runtime/src/main/java/org/apache/asterix/runtime/aggregates/collections/ListifyAggregateDescriptor.java
index b835988..aeb10a7 100644
--- a/asterix-runtime/src/main/java/org/apache/asterix/runtime/aggregates/collections/ListifyAggregateDescriptor.java
+++ b/asterix-runtime/src/main/java/org/apache/asterix/runtime/aggregates/collections/ListifyAggregateDescriptor.java
@@ -25,13 +25,14 @@
 import org.apache.asterix.runtime.aggregates.base.AbstractAggregateFunctionDynamicDescriptor;
 import org.apache.hyracks.algebricks.common.exceptions.AlgebricksException;
 import org.apache.hyracks.algebricks.core.algebra.functions.FunctionIdentifier;
-import org.apache.hyracks.algebricks.runtime.base.ICopyAggregateFunctionFactory;
-import org.apache.hyracks.algebricks.runtime.base.ICopyEvaluatorFactory;
+import org.apache.hyracks.algebricks.runtime.base.IAggregateEvaluatorFactory;
+import org.apache.hyracks.algebricks.runtime.base.IScalarEvaluatorFactory;
 
 public class ListifyAggregateDescriptor extends AbstractAggregateFunctionDynamicDescriptor {
 
     private static final long serialVersionUID = 1L;
     public static final IFunctionDescriptorFactory FACTORY = new IFunctionDescriptorFactory() {
+        @Override
         public IFunctionDescriptor createFunctionDescriptor() {
             return new ListifyAggregateDescriptor();
         }
@@ -49,7 +50,7 @@
     }
 
     @Override
-    public ICopyAggregateFunctionFactory createAggregateFunctionFactory(final ICopyEvaluatorFactory[] args)
+    public IAggregateEvaluatorFactory createAggregateEvaluatorFactory(final IScalarEvaluatorFactory[] args)
             throws AlgebricksException {
         return new ListifyAggregateFunctionEvalFactory(args, oltype);
     }
diff --git a/asterix-runtime/src/main/java/org/apache/asterix/runtime/aggregates/collections/ListifyAggregateFunctionEvalFactory.java b/asterix-runtime/src/main/java/org/apache/asterix/runtime/aggregates/collections/ListifyAggregateFunctionEvalFactory.java
index a3f5df9..6a12423 100644
--- a/asterix-runtime/src/main/java/org/apache/asterix/runtime/aggregates/collections/ListifyAggregateFunctionEvalFactory.java
+++ b/asterix-runtime/src/main/java/org/apache/asterix/runtime/aggregates/collections/ListifyAggregateFunctionEvalFactory.java
@@ -18,40 +18,40 @@
  */
 package org.apache.asterix.runtime.aggregates.collections;
 
-import java.io.DataOutput;
 import java.io.IOException;
 
 import org.apache.asterix.builders.OrderedListBuilder;
 import org.apache.asterix.om.types.AOrderedListType;
 import org.apache.hyracks.algebricks.common.exceptions.AlgebricksException;
-import org.apache.hyracks.algebricks.runtime.base.ICopyAggregateFunction;
-import org.apache.hyracks.algebricks.runtime.base.ICopyAggregateFunctionFactory;
-import org.apache.hyracks.algebricks.runtime.base.ICopyEvaluator;
-import org.apache.hyracks.algebricks.runtime.base.ICopyEvaluatorFactory;
-import org.apache.hyracks.data.std.api.IDataOutputProvider;
+import org.apache.hyracks.algebricks.runtime.base.IAggregateEvaluator;
+import org.apache.hyracks.algebricks.runtime.base.IAggregateEvaluatorFactory;
+import org.apache.hyracks.algebricks.runtime.base.IScalarEvaluator;
+import org.apache.hyracks.algebricks.runtime.base.IScalarEvaluatorFactory;
+import org.apache.hyracks.api.context.IHyracksTaskContext;
+import org.apache.hyracks.data.std.api.IPointable;
+import org.apache.hyracks.data.std.primitive.VoidPointable;
 import org.apache.hyracks.data.std.util.ArrayBackedValueStorage;
 import org.apache.hyracks.dataflow.common.data.accessors.IFrameTupleReference;
 
-public class ListifyAggregateFunctionEvalFactory implements ICopyAggregateFunctionFactory {
+public class ListifyAggregateFunctionEvalFactory implements IAggregateEvaluatorFactory {
 
     private static final long serialVersionUID = 1L;
-    private ICopyEvaluatorFactory[] args;
+    private IScalarEvaluatorFactory[] args;
     private final AOrderedListType orderedlistType;
 
-    public ListifyAggregateFunctionEvalFactory(ICopyEvaluatorFactory[] args, AOrderedListType type) {
+    public ListifyAggregateFunctionEvalFactory(IScalarEvaluatorFactory[] args, AOrderedListType type) {
         this.args = args;
         this.orderedlistType = type;
     }
 
     @Override
-    public ICopyAggregateFunction createAggregateFunction(final IDataOutputProvider provider)
-            throws AlgebricksException {
+    public IAggregateEvaluator createAggregateEvaluator(final IHyracksTaskContext ctx) throws AlgebricksException {
 
-        return new ICopyAggregateFunction() {
+        return new IAggregateEvaluator() {
 
-            private ArrayBackedValueStorage inputVal = new ArrayBackedValueStorage();
-            private ICopyEvaluator eval = args[0].createEvaluator(inputVal);
-            private DataOutput out = provider.getDataOutput();
+            private IPointable inputVal = new VoidPointable();
+            private IScalarEvaluator eval = args[0].createScalarEvaluator(ctx);
+            private ArrayBackedValueStorage resultStorage = new ArrayBackedValueStorage();
             private OrderedListBuilder builder = new OrderedListBuilder();
 
             @Override
@@ -62,8 +62,7 @@
             @Override
             public void step(IFrameTupleReference tuple) throws AlgebricksException {
                 try {
-                    inputVal.reset();
-                    eval.evaluate(tuple);
+                    eval.evaluate(tuple, inputVal);
                     builder.addItem(inputVal);
                 } catch (IOException e) {
                     throw new AlgebricksException(e);
@@ -71,17 +70,19 @@
             }
 
             @Override
-            public void finish() throws AlgebricksException {
+            public void finish(IPointable result) throws AlgebricksException {
+                resultStorage.reset();
                 try {
-                    builder.write(out, true);
+                    builder.write(resultStorage.getDataOutput(), true);
                 } catch (IOException e) {
                     throw new AlgebricksException(e);
                 }
+                result.set(resultStorage);
             }
 
             @Override
-            public void finishPartial() throws AlgebricksException {
-                finish();
+            public void finishPartial(IPointable result) throws AlgebricksException {
+                finish(result);
             }
 
         };
diff --git a/asterix-runtime/src/main/java/org/apache/asterix/runtime/aggregates/scalar/AbstractScalarAggregateDescriptor.java b/asterix-runtime/src/main/java/org/apache/asterix/runtime/aggregates/scalar/AbstractScalarAggregateDescriptor.java
index 55ed77b..eed79ac 100644
--- a/asterix-runtime/src/main/java/org/apache/asterix/runtime/aggregates/scalar/AbstractScalarAggregateDescriptor.java
+++ b/asterix-runtime/src/main/java/org/apache/asterix/runtime/aggregates/scalar/AbstractScalarAggregateDescriptor.java
@@ -27,39 +27,40 @@
 import org.apache.asterix.runtime.unnestingfunctions.std.ScanCollectionDescriptor.ScanCollectionUnnestingFunctionFactory;
 import org.apache.hyracks.algebricks.common.exceptions.AlgebricksException;
 import org.apache.hyracks.algebricks.core.algebra.functions.FunctionIdentifier;
-import org.apache.hyracks.algebricks.runtime.base.ICopyAggregateFunctionFactory;
-import org.apache.hyracks.algebricks.runtime.base.ICopyEvaluator;
-import org.apache.hyracks.algebricks.runtime.base.ICopyEvaluatorFactory;
+import org.apache.hyracks.algebricks.runtime.base.IAggregateEvaluatorFactory;
+import org.apache.hyracks.algebricks.runtime.base.IScalarEvaluator;
+import org.apache.hyracks.algebricks.runtime.base.IScalarEvaluatorFactory;
 import org.apache.hyracks.algebricks.runtime.evaluators.ColumnAccessEvalFactory;
-import org.apache.hyracks.data.std.api.IDataOutputProvider;
+import org.apache.hyracks.api.context.IHyracksTaskContext;
 
 public abstract class AbstractScalarAggregateDescriptor extends AbstractScalarFunctionDynamicDescriptor {
     private static final long serialVersionUID = 1L;
 
     @Override
-    public ICopyEvaluatorFactory createEvaluatorFactory(final ICopyEvaluatorFactory[] args) throws AlgebricksException {
+    public IScalarEvaluatorFactory createEvaluatorFactory(final IScalarEvaluatorFactory[] args)
+            throws AlgebricksException {
 
         // The aggregate function will get a SingleFieldFrameTupleReference that points to the result of the ScanCollection.
         // The list-item will always reside in the first field (column) of the SingleFieldFrameTupleReference.
-        ICopyEvaluatorFactory[] aggFuncArgs = new ICopyEvaluatorFactory[1];
+        IScalarEvaluatorFactory[] aggFuncArgs = new IScalarEvaluatorFactory[1];
         aggFuncArgs[0] = new ColumnAccessEvalFactory(0);
         // Create aggregate function from this scalar version.
         FunctionIdentifier fid = AsterixBuiltinFunctions.getAggregateFunction(getIdentifier());
         IFunctionManager mgr = FunctionManagerHolder.getFunctionManager();
         IFunctionDescriptor fd = mgr.lookupFunction(fid);
         AbstractAggregateFunctionDynamicDescriptor aggFuncDesc = (AbstractAggregateFunctionDynamicDescriptor) fd;
-        final ICopyAggregateFunctionFactory aggFuncFactory = aggFuncDesc.createAggregateFunctionFactory(aggFuncArgs);
+        final IAggregateEvaluatorFactory aggFuncFactory = aggFuncDesc.createAggregateEvaluatorFactory(aggFuncArgs);
 
-        return new ICopyEvaluatorFactory() {
+        return new IScalarEvaluatorFactory() {
             private static final long serialVersionUID = 1L;
 
             @Override
-            public ICopyEvaluator createEvaluator(IDataOutputProvider output) throws AlgebricksException {
+            public IScalarEvaluator createScalarEvaluator(IHyracksTaskContext ctx) throws AlgebricksException {
                 // Use ScanCollection to iterate over list items.
                 ScanCollectionUnnestingFunctionFactory scanCollectionFactory = new ScanCollectionUnnestingFunctionFactory(
                         args[0]);
-                return new GenericScalarAggregateFunction(aggFuncFactory.createAggregateFunction(output),
-                        scanCollectionFactory);
+                return new GenericScalarAggregateFunction(aggFuncFactory.createAggregateEvaluator(ctx),
+                        scanCollectionFactory, ctx);
             }
         };
     }
diff --git a/asterix-runtime/src/main/java/org/apache/asterix/runtime/aggregates/scalar/GenericScalarAggregateFunction.java b/asterix-runtime/src/main/java/org/apache/asterix/runtime/aggregates/scalar/GenericScalarAggregateFunction.java
index 8ca3540..8e14473 100644
--- a/asterix-runtime/src/main/java/org/apache/asterix/runtime/aggregates/scalar/GenericScalarAggregateFunction.java
+++ b/asterix-runtime/src/main/java/org/apache/asterix/runtime/aggregates/scalar/GenericScalarAggregateFunction.java
@@ -20,41 +20,41 @@
 
 import org.apache.asterix.runtime.aggregates.base.SingleFieldFrameTupleReference;
 import org.apache.hyracks.algebricks.common.exceptions.AlgebricksException;
-import org.apache.hyracks.algebricks.runtime.base.ICopyAggregateFunction;
-import org.apache.hyracks.algebricks.runtime.base.ICopyEvaluator;
-import org.apache.hyracks.algebricks.runtime.base.ICopyUnnestingFunction;
-import org.apache.hyracks.algebricks.runtime.base.ICopyUnnestingFunctionFactory;
-import org.apache.hyracks.data.std.util.ArrayBackedValueStorage;
+import org.apache.hyracks.algebricks.runtime.base.IAggregateEvaluator;
+import org.apache.hyracks.algebricks.runtime.base.IScalarEvaluator;
+import org.apache.hyracks.algebricks.runtime.base.IUnnestingEvaluator;
+import org.apache.hyracks.algebricks.runtime.base.IUnnestingEvaluatorFactory;
+import org.apache.hyracks.api.context.IHyracksTaskContext;
+import org.apache.hyracks.data.std.api.IPointable;
+import org.apache.hyracks.data.std.primitive.VoidPointable;
 import org.apache.hyracks.dataflow.common.data.accessors.IFrameTupleReference;
 
 /**
  * Implements scalar aggregates by iterating over a collection with the ScanCollection unnesting function,
  * and applying the corresponding ICopyAggregateFunction to each collection-item.
  */
-public class GenericScalarAggregateFunction implements ICopyEvaluator {
+public class GenericScalarAggregateFunction implements IScalarEvaluator {
 
-    private final ArrayBackedValueStorage listItemOut = new ArrayBackedValueStorage();
-    private final ICopyAggregateFunction aggFunc;
-    private final ICopyUnnestingFunction scanCollection;
+    private final IPointable listItemOut = new VoidPointable();
+    private final IAggregateEvaluator aggFunc;
+    private final IUnnestingEvaluator scanCollection;
 
     private final SingleFieldFrameTupleReference itemTuple = new SingleFieldFrameTupleReference();
 
-    public GenericScalarAggregateFunction(ICopyAggregateFunction aggFunc,
-            ICopyUnnestingFunctionFactory scanCollectionFactory) throws AlgebricksException {
+    public GenericScalarAggregateFunction(IAggregateEvaluator aggFunc, IUnnestingEvaluatorFactory scanCollectionFactory,
+            IHyracksTaskContext context) throws AlgebricksException {
         this.aggFunc = aggFunc;
-        this.scanCollection = scanCollectionFactory.createUnnestingFunction(listItemOut);
-        listItemOut.reset();
+        this.scanCollection = scanCollectionFactory.createUnnestingEvaluator(context);
     }
 
     @Override
-    public void evaluate(IFrameTupleReference tuple) throws AlgebricksException {
+    public void evaluate(IFrameTupleReference tuple, IPointable result) throws AlgebricksException {
         scanCollection.init(tuple);
         aggFunc.init();
-        while (scanCollection.step()) {
-            itemTuple.reset(listItemOut.getByteArray(), 0, listItemOut.getLength());
+        while (scanCollection.step(listItemOut)) {
+            itemTuple.reset(listItemOut.getByteArray(), listItemOut.getStartOffset(), listItemOut.getLength());
             aggFunc.step(itemTuple);
-            listItemOut.reset();
         }
-        aggFunc.finish();
+        aggFunc.finish(result);
     }
 }
diff --git a/asterix-runtime/src/main/java/org/apache/asterix/runtime/aggregates/serializable/std/AbstractSerializableAvgAggregateFunction.java b/asterix-runtime/src/main/java/org/apache/asterix/runtime/aggregates/serializable/std/AbstractSerializableAvgAggregateFunction.java
index 24e6cb7..c3b9b47 100644
--- a/asterix-runtime/src/main/java/org/apache/asterix/runtime/aggregates/serializable/std/AbstractSerializableAvgAggregateFunction.java
+++ b/asterix-runtime/src/main/java/org/apache/asterix/runtime/aggregates/serializable/std/AbstractSerializableAvgAggregateFunction.java
@@ -46,15 +46,17 @@
 import org.apache.asterix.runtime.evaluators.common.ClosedRecordConstructorEvalFactory.ClosedRecordConstructorEval;
 import org.apache.hyracks.algebricks.common.exceptions.AlgebricksException;
 import org.apache.hyracks.algebricks.common.exceptions.NotImplementedException;
-import org.apache.hyracks.algebricks.runtime.base.ICopyEvaluator;
-import org.apache.hyracks.algebricks.runtime.base.ICopyEvaluatorFactory;
-import org.apache.hyracks.algebricks.runtime.base.ICopySerializableAggregateFunction;
+import org.apache.hyracks.algebricks.runtime.base.ISerializedAggregateEvaluator;
+import org.apache.hyracks.algebricks.runtime.base.IScalarEvaluator;
+import org.apache.hyracks.algebricks.runtime.base.IScalarEvaluatorFactory;
+import org.apache.hyracks.api.context.IHyracksTaskContext;
 import org.apache.hyracks.api.dataflow.value.ISerializerDeserializer;
-import org.apache.hyracks.data.std.util.ArrayBackedValueStorage;
+import org.apache.hyracks.data.std.api.IPointable;
+import org.apache.hyracks.data.std.primitive.VoidPointable;
 import org.apache.hyracks.data.std.util.ByteArrayAccessibleOutputStream;
 import org.apache.hyracks.dataflow.common.data.accessors.IFrameTupleReference;
 
-public abstract class AbstractSerializableAvgAggregateFunction implements ICopySerializableAggregateFunction {
+public abstract class AbstractSerializableAvgAggregateFunction implements ISerializedAggregateEvaluator {
     private static final int SUM_FIELD_ID = 0;
     private static final int COUNT_FIELD_ID = 1;
 
@@ -62,18 +64,18 @@
     private static final int COUNT_OFFSET = 8;
     protected static final int AGG_TYPE_OFFSET = 16;
 
-    private ArrayBackedValueStorage inputVal = new ArrayBackedValueStorage();
-    private ICopyEvaluator eval;
+    private IPointable inputVal = new VoidPointable();
+    private IScalarEvaluator eval;
     private AMutableDouble aDouble = new AMutableDouble(0);
     private AMutableInt64 aInt64 = new AMutableInt64(0);
 
-    private ArrayBackedValueStorage avgBytes = new ArrayBackedValueStorage();
+    private IPointable avgBytes = new VoidPointable();
     private ByteArrayAccessibleOutputStream sumBytes = new ByteArrayAccessibleOutputStream();
     private DataOutput sumBytesOutput = new DataOutputStream(sumBytes);
     private ByteArrayAccessibleOutputStream countBytes = new ByteArrayAccessibleOutputStream();
     private DataOutput countBytesOutput = new DataOutputStream(countBytes);
-    private ICopyEvaluator evalSum = new AccessibleByteArrayEval(avgBytes.getDataOutput(), sumBytes);
-    private ICopyEvaluator evalCount = new AccessibleByteArrayEval(avgBytes.getDataOutput(), countBytes);
+    private IScalarEvaluator evalSum = new AccessibleByteArrayEval(sumBytes);
+    private IScalarEvaluator evalCount = new AccessibleByteArrayEval(countBytes);
     private ClosedRecordConstructorEval recordEval;
 
     @SuppressWarnings("unchecked")
@@ -86,8 +88,9 @@
     private ISerializerDeserializer<ANull> nullSerde = AqlSerializerDeserializerProvider.INSTANCE
             .getSerializerDeserializer(BuiltinType.ANULL);
 
-    public AbstractSerializableAvgAggregateFunction(ICopyEvaluatorFactory[] args) throws AlgebricksException {
-        eval = args[0].createEvaluator(inputVal);
+    public AbstractSerializableAvgAggregateFunction(IScalarEvaluatorFactory[] args, IHyracksTaskContext context)
+            throws AlgebricksException {
+        eval = args[0].createScalarEvaluator(context);
     }
 
     @Override
@@ -117,11 +120,13 @@
         if (skipStep(state, start)) {
             return;
         }
-        inputVal.reset();
-        eval.evaluate(tuple);
+        eval.evaluate(tuple, inputVal);
+        byte[] bytes = inputVal.getByteArray();
+        int offset = inputVal.getStartOffset();
+
         double sum = BufferSerDeUtil.getDouble(state, start + SUM_OFFSET);
         long count = BufferSerDeUtil.getLong(state, start + COUNT_OFFSET);
-        ATypeTag typeTag = EnumDeserializer.ATYPETAGDESERIALIZER.deserialize(inputVal.getByteArray()[0]);
+        ATypeTag typeTag = EnumDeserializer.ATYPETAGDESERIALIZER.deserialize(bytes[offset]);
         ATypeTag aggType = EnumDeserializer.ATYPETAGDESERIALIZER.deserialize(state[start + AGG_TYPE_OFFSET]);
         if (typeTag == ATypeTag.NULL) {
             processNull(state, start);
@@ -137,32 +142,32 @@
         ++count;
         switch (typeTag) {
             case INT8: {
-                byte val = AInt8SerializerDeserializer.getByte(inputVal.getByteArray(), 1);
+                byte val = AInt8SerializerDeserializer.getByte(bytes, offset + 1);
                 sum += val;
                 break;
             }
             case INT16: {
-                short val = AInt16SerializerDeserializer.getShort(inputVal.getByteArray(), 1);
+                short val = AInt16SerializerDeserializer.getShort(bytes, offset + 1);
                 sum += val;
                 break;
             }
             case INT32: {
-                int val = AInt32SerializerDeserializer.getInt(inputVal.getByteArray(), 1);
+                int val = AInt32SerializerDeserializer.getInt(bytes, offset + 1);
                 sum += val;
                 break;
             }
             case INT64: {
-                long val = AInt64SerializerDeserializer.getLong(inputVal.getByteArray(), 1);
+                long val = AInt64SerializerDeserializer.getLong(bytes, offset + 1);
                 sum += val;
                 break;
             }
             case FLOAT: {
-                float val = AFloatSerializerDeserializer.getFloat(inputVal.getByteArray(), 1);
+                float val = AFloatSerializerDeserializer.getFloat(bytes, offset + 1);
                 sum += val;
                 break;
             }
             case DOUBLE: {
-                double val = ADoubleSerializerDeserializer.getDouble(inputVal.getByteArray(), 1);
+                double val = ADoubleSerializerDeserializer.getDouble(bytes, offset + 1);
                 sum += val;
                 break;
             }
@@ -170,7 +175,6 @@
                 throw new NotImplementedException("Cannot compute AVG for values of type " + typeTag);
             }
         }
-        inputVal.reset();
         BufferSerDeUtil.writeDouble(sum, state, start + SUM_OFFSET);
         BufferSerDeUtil.writeLong(count, state, start + COUNT_OFFSET);
         state[start + AGG_TYPE_OFFSET] = aggType.serialize();
@@ -184,8 +188,7 @@
         if (recordEval == null) {
             ARecordType recType = new ARecordType(null, new String[] { "sum", "count" },
                     new IAType[] { BuiltinType.ADOUBLE, BuiltinType.AINT64 }, false);
-            recordEval = new ClosedRecordConstructorEval(recType, new ICopyEvaluator[] { evalSum, evalCount }, avgBytes,
-                    result);
+            recordEval = new ClosedRecordConstructorEval(recType, new IScalarEvaluator[] { evalSum, evalCount });
         }
 
         try {
@@ -203,7 +206,8 @@
                 countBytes.reset();
                 aInt64.setValue(count);
                 longSerde.serialize(aInt64, countBytesOutput);
-                recordEval.evaluate(null);
+                recordEval.evaluate(null, avgBytes);
+                result.write(avgBytes.getByteArray(), avgBytes.getStartOffset(), avgBytes.getLength());
             }
         } catch (IOException e) {
             throw new AlgebricksException(e);
@@ -219,10 +223,11 @@
         long count = BufferSerDeUtil.getLong(state, start + COUNT_OFFSET);
         ATypeTag aggType = EnumDeserializer.ATYPETAGDESERIALIZER.deserialize(state[start + AGG_TYPE_OFFSET]);
 
-        inputVal.reset();
-        eval.evaluate(tuple);
+        eval.evaluate(tuple, inputVal);
         byte[] serBytes = inputVal.getByteArray();
-        ATypeTag typeTag = EnumDeserializer.ATYPETAGDESERIALIZER.deserialize(serBytes[0]);
+        int offset = inputVal.getStartOffset();
+
+        ATypeTag typeTag = EnumDeserializer.ATYPETAGDESERIALIZER.deserialize(serBytes[offset]);
         switch (typeTag) {
             case NULL: {
                 processNull(state, start);
@@ -236,11 +241,11 @@
                 // Expected.
                 aggType = ATypeTag.DOUBLE;
                 int nullBitmapSize = 0;
-                int offset1 = ARecordSerializerDeserializer.getFieldOffsetById(serBytes, SUM_FIELD_ID, nullBitmapSize,
-                        false);
+                int offset1 = ARecordSerializerDeserializer.getFieldOffsetById(serBytes, offset, SUM_FIELD_ID,
+                        nullBitmapSize, false);
                 sum += ADoubleSerializerDeserializer.getDouble(serBytes, offset1);
-                int offset2 = ARecordSerializerDeserializer.getFieldOffsetById(serBytes, COUNT_FIELD_ID, nullBitmapSize,
-                        false);
+                int offset2 = ARecordSerializerDeserializer.getFieldOffsetById(serBytes, offset, COUNT_FIELD_ID,
+                        nullBitmapSize, false);
                 count += AInt64SerializerDeserializer.getLong(serBytes, offset2);
 
                 BufferSerDeUtil.writeDouble(sum, state, start + SUM_OFFSET);
@@ -250,7 +255,7 @@
             }
             default: {
                 throw new AlgebricksException("Global-Avg is not defined for values of type "
-                        + EnumDeserializer.ATYPETAGDESERIALIZER.deserialize(serBytes[0]));
+                        + EnumDeserializer.ATYPETAGDESERIALIZER.deserialize(serBytes[offset]));
             }
         }
     }
@@ -259,11 +264,10 @@
         double sum = BufferSerDeUtil.getDouble(state, start + SUM_OFFSET);
         long count = BufferSerDeUtil.getLong(state, start + COUNT_OFFSET);
         ATypeTag aggType = EnumDeserializer.ATYPETAGDESERIALIZER.deserialize(state[start + AGG_TYPE_OFFSET]);
-
         try {
-            if (count == 0 || aggType == ATypeTag.NULL)
+            if (count == 0 || aggType == ATypeTag.NULL) {
                 nullSerde.serialize(ANull.NULL, result);
-            else {
+            } else {
                 aDouble.setValue(sum / count);
                 doubleSerde.serialize(aDouble, result);
             }
diff --git a/asterix-runtime/src/main/java/org/apache/asterix/runtime/aggregates/serializable/std/AbstractSerializableCountAggregateFunction.java b/asterix-runtime/src/main/java/org/apache/asterix/runtime/aggregates/serializable/std/AbstractSerializableCountAggregateFunction.java
index aa67d0c..6270e78 100644
--- a/asterix-runtime/src/main/java/org/apache/asterix/runtime/aggregates/serializable/std/AbstractSerializableCountAggregateFunction.java
+++ b/asterix-runtime/src/main/java/org/apache/asterix/runtime/aggregates/serializable/std/AbstractSerializableCountAggregateFunction.java
@@ -29,17 +29,19 @@
 import org.apache.asterix.om.types.BuiltinType;
 import org.apache.asterix.om.types.EnumDeserializer;
 import org.apache.hyracks.algebricks.common.exceptions.AlgebricksException;
-import org.apache.hyracks.algebricks.runtime.base.ICopyEvaluator;
-import org.apache.hyracks.algebricks.runtime.base.ICopyEvaluatorFactory;
-import org.apache.hyracks.algebricks.runtime.base.ICopySerializableAggregateFunction;
+import org.apache.hyracks.algebricks.runtime.base.ISerializedAggregateEvaluator;
+import org.apache.hyracks.algebricks.runtime.base.IScalarEvaluator;
+import org.apache.hyracks.algebricks.runtime.base.IScalarEvaluatorFactory;
+import org.apache.hyracks.api.context.IHyracksTaskContext;
 import org.apache.hyracks.api.dataflow.value.ISerializerDeserializer;
-import org.apache.hyracks.data.std.util.ArrayBackedValueStorage;
+import org.apache.hyracks.data.std.api.IPointable;
+import org.apache.hyracks.data.std.primitive.VoidPointable;
 import org.apache.hyracks.dataflow.common.data.accessors.IFrameTupleReference;
 
 /**
  * count(NULL) returns NULL.
  */
-public abstract class AbstractSerializableCountAggregateFunction implements ICopySerializableAggregateFunction {
+public abstract class AbstractSerializableCountAggregateFunction implements ISerializedAggregateEvaluator {
     private static final int MET_NULL_OFFSET = 0;
     private static final int COUNT_OFFSET = 1;
 
@@ -50,11 +52,12 @@
     @SuppressWarnings("unchecked")
     private ISerializerDeserializer<ANull> nullSerde = AqlSerializerDeserializerProvider.INSTANCE
             .getSerializerDeserializer(BuiltinType.ANULL);
-    private ArrayBackedValueStorage inputVal = new ArrayBackedValueStorage();
-    private ICopyEvaluator eval;
+    private IPointable inputVal = new VoidPointable();
+    private IScalarEvaluator eval;
 
-    public AbstractSerializableCountAggregateFunction(ICopyEvaluatorFactory[] args) throws AlgebricksException {
-        eval = args[0].createEvaluator(inputVal);
+    public AbstractSerializableCountAggregateFunction(IScalarEvaluatorFactory[] args, IHyracksTaskContext context)
+            throws AlgebricksException {
+        eval = args[0].createScalarEvaluator(context);
     }
 
     @Override
@@ -71,9 +74,9 @@
     public void step(IFrameTupleReference tuple, byte[] state, int start, int len) throws AlgebricksException {
         boolean metNull = BufferSerDeUtil.getBoolean(state, start);
         long cnt = BufferSerDeUtil.getLong(state, start + 1);
-        inputVal.reset();
-        eval.evaluate(tuple);
-        ATypeTag typeTag = EnumDeserializer.ATYPETAGDESERIALIZER.deserialize(inputVal.getByteArray()[0]);
+        eval.evaluate(tuple, inputVal);
+        ATypeTag typeTag = EnumDeserializer.ATYPETAGDESERIALIZER
+                .deserialize(inputVal.getByteArray()[inputVal.getStartOffset()]);
         if (typeTag == ATypeTag.NULL) {
             processNull(state, start);
         } else {
diff --git a/asterix-runtime/src/main/java/org/apache/asterix/runtime/aggregates/serializable/std/AbstractSerializableSumAggregateFunction.java b/asterix-runtime/src/main/java/org/apache/asterix/runtime/aggregates/serializable/std/AbstractSerializableSumAggregateFunction.java
index 5e6ca46..03eb2d3 100644
--- a/asterix-runtime/src/main/java/org/apache/asterix/runtime/aggregates/serializable/std/AbstractSerializableSumAggregateFunction.java
+++ b/asterix-runtime/src/main/java/org/apache/asterix/runtime/aggregates/serializable/std/AbstractSerializableSumAggregateFunction.java
@@ -41,19 +41,21 @@
 import org.apache.asterix.om.types.hierachy.ATypeHierarchy;
 import org.apache.hyracks.algebricks.common.exceptions.AlgebricksException;
 import org.apache.hyracks.algebricks.common.exceptions.NotImplementedException;
-import org.apache.hyracks.algebricks.runtime.base.ICopyEvaluator;
-import org.apache.hyracks.algebricks.runtime.base.ICopyEvaluatorFactory;
-import org.apache.hyracks.algebricks.runtime.base.ICopySerializableAggregateFunction;
+import org.apache.hyracks.algebricks.runtime.base.ISerializedAggregateEvaluator;
+import org.apache.hyracks.algebricks.runtime.base.IScalarEvaluator;
+import org.apache.hyracks.algebricks.runtime.base.IScalarEvaluatorFactory;
+import org.apache.hyracks.api.context.IHyracksTaskContext;
 import org.apache.hyracks.api.dataflow.value.ISerializerDeserializer;
-import org.apache.hyracks.data.std.util.ArrayBackedValueStorage;
+import org.apache.hyracks.data.std.api.IPointable;
+import org.apache.hyracks.data.std.primitive.VoidPointable;
 import org.apache.hyracks.dataflow.common.data.accessors.IFrameTupleReference;
 
-public abstract class AbstractSerializableSumAggregateFunction implements ICopySerializableAggregateFunction {
+public abstract class AbstractSerializableSumAggregateFunction implements ISerializedAggregateEvaluator {
     protected static final int AGG_TYPE_OFFSET = 0;
     private static final int SUM_OFFSET = 1;
 
-    private ArrayBackedValueStorage inputVal = new ArrayBackedValueStorage();
-    private ICopyEvaluator eval;
+    private IPointable inputVal = new VoidPointable();
+    private IScalarEvaluator eval;
     private AMutableDouble aDouble = new AMutableDouble(0);
     private AMutableFloat aFloat = new AMutableFloat(0);
     private AMutableInt64 aInt64 = new AMutableInt64(0);
@@ -63,8 +65,9 @@
     @SuppressWarnings("rawtypes")
     public ISerializerDeserializer serde;
 
-    public AbstractSerializableSumAggregateFunction(ICopyEvaluatorFactory[] args) throws AlgebricksException {
-        eval = args[0].createEvaluator(inputVal);
+    public AbstractSerializableSumAggregateFunction(IScalarEvaluatorFactory[] args, IHyracksTaskContext context)
+            throws AlgebricksException {
+        eval = args[0].createScalarEvaluator(context);
     }
 
     @Override
@@ -84,9 +87,11 @@
         }
         ATypeTag aggType = EnumDeserializer.ATYPETAGDESERIALIZER.deserialize(state[start + AGG_TYPE_OFFSET]);
         double sum = BufferSerDeUtil.getDouble(state, start + SUM_OFFSET);
-        inputVal.reset();
-        eval.evaluate(tuple);
-        ATypeTag typeTag = EnumDeserializer.ATYPETAGDESERIALIZER.deserialize(inputVal.getByteArray()[0]);
+        eval.evaluate(tuple, inputVal);
+        byte[] bytes = inputVal.getByteArray();
+        int offset = inputVal.getStartOffset();
+
+        ATypeTag typeTag = EnumDeserializer.ATYPETAGDESERIALIZER.deserialize(bytes[offset]);
         if (typeTag == ATypeTag.NULL) {
             processNull(state, start);
             return;
@@ -103,32 +108,32 @@
 
         switch (typeTag) {
             case INT8: {
-                byte val = AInt8SerializerDeserializer.getByte(inputVal.getByteArray(), 1);
+                byte val = AInt8SerializerDeserializer.getByte(bytes, offset + 1);
                 sum += val;
                 break;
             }
             case INT16: {
-                short val = AInt16SerializerDeserializer.getShort(inputVal.getByteArray(), 1);
+                short val = AInt16SerializerDeserializer.getShort(bytes, offset + 1);
                 sum += val;
                 break;
             }
             case INT32: {
-                int val = AInt32SerializerDeserializer.getInt(inputVal.getByteArray(), 1);
+                int val = AInt32SerializerDeserializer.getInt(bytes, offset + 1);
                 sum += val;
                 break;
             }
             case INT64: {
-                long val = AInt64SerializerDeserializer.getLong(inputVal.getByteArray(), 1);
+                long val = AInt64SerializerDeserializer.getLong(bytes, offset + 1);
                 sum += val;
                 break;
             }
             case FLOAT: {
-                float val = AFloatSerializerDeserializer.getFloat(inputVal.getByteArray(), 1);
+                float val = AFloatSerializerDeserializer.getFloat(bytes, offset + 1);
                 sum += val;
                 break;
             }
             case DOUBLE: {
-                double val = ADoubleSerializerDeserializer.getDouble(inputVal.getByteArray(), 1);
+                double val = ADoubleSerializerDeserializer.getDouble(bytes, offset + 1);
                 sum += val;
                 break;
             }
diff --git a/asterix-runtime/src/main/java/org/apache/asterix/runtime/aggregates/serializable/std/SerializableAvgAggregateDescriptor.java b/asterix-runtime/src/main/java/org/apache/asterix/runtime/aggregates/serializable/std/SerializableAvgAggregateDescriptor.java
index 0459b7b..b05ff19 100644
--- a/asterix-runtime/src/main/java/org/apache/asterix/runtime/aggregates/serializable/std/SerializableAvgAggregateDescriptor.java
+++ b/asterix-runtime/src/main/java/org/apache/asterix/runtime/aggregates/serializable/std/SerializableAvgAggregateDescriptor.java
@@ -24,14 +24,16 @@
 import org.apache.asterix.runtime.aggregates.base.AbstractSerializableAggregateFunctionDynamicDescriptor;
 import org.apache.hyracks.algebricks.common.exceptions.AlgebricksException;
 import org.apache.hyracks.algebricks.core.algebra.functions.FunctionIdentifier;
-import org.apache.hyracks.algebricks.runtime.base.ICopyEvaluatorFactory;
-import org.apache.hyracks.algebricks.runtime.base.ICopySerializableAggregateFunction;
-import org.apache.hyracks.algebricks.runtime.base.ICopySerializableAggregateFunctionFactory;
+import org.apache.hyracks.algebricks.runtime.base.IScalarEvaluatorFactory;
+import org.apache.hyracks.algebricks.runtime.base.ISerializedAggregateEvaluator;
+import org.apache.hyracks.algebricks.runtime.base.ISerializedAggregateEvaluatorFactory;
+import org.apache.hyracks.api.context.IHyracksTaskContext;
 
 public class SerializableAvgAggregateDescriptor extends AbstractSerializableAggregateFunctionDynamicDescriptor {
 
     private static final long serialVersionUID = 1L;
     public static final IFunctionDescriptorFactory FACTORY = new IFunctionDescriptorFactory() {
+        @Override
         public IFunctionDescriptor createFunctionDescriptor() {
             return new SerializableAvgAggregateDescriptor();
         }
@@ -43,14 +45,15 @@
     }
 
     @Override
-    public ICopySerializableAggregateFunctionFactory createSerializableAggregateFunctionFactory(
-            final ICopyEvaluatorFactory[] args) throws AlgebricksException {
-        return new ICopySerializableAggregateFunctionFactory() {
+    public ISerializedAggregateEvaluatorFactory createSerializableAggregateEvaluatorFactory(
+            final IScalarEvaluatorFactory[] args) throws AlgebricksException {
+        return new ISerializedAggregateEvaluatorFactory() {
             private static final long serialVersionUID = 1L;
 
             @Override
-            public ICopySerializableAggregateFunction createAggregateFunction() throws AlgebricksException {
-                return new SerializableAvgAggregateFunction(args);
+            public ISerializedAggregateEvaluator createAggregateEvaluator(IHyracksTaskContext ctx)
+                    throws AlgebricksException {
+                return new SerializableAvgAggregateFunction(args, ctx);
             }
         };
     }
diff --git a/asterix-runtime/src/main/java/org/apache/asterix/runtime/aggregates/serializable/std/SerializableAvgAggregateFunction.java b/asterix-runtime/src/main/java/org/apache/asterix/runtime/aggregates/serializable/std/SerializableAvgAggregateFunction.java
index 9773272..d8c7fe2 100644
--- a/asterix-runtime/src/main/java/org/apache/asterix/runtime/aggregates/serializable/std/SerializableAvgAggregateFunction.java
+++ b/asterix-runtime/src/main/java/org/apache/asterix/runtime/aggregates/serializable/std/SerializableAvgAggregateFunction.java
@@ -23,13 +23,15 @@
 import org.apache.asterix.om.types.ATypeTag;
 import org.apache.asterix.om.types.EnumDeserializer;
 import org.apache.hyracks.algebricks.common.exceptions.AlgebricksException;
-import org.apache.hyracks.algebricks.runtime.base.ICopyEvaluatorFactory;
+import org.apache.hyracks.algebricks.runtime.base.IScalarEvaluatorFactory;
+import org.apache.hyracks.api.context.IHyracksTaskContext;
 import org.apache.hyracks.dataflow.common.data.accessors.IFrameTupleReference;
 
 public class SerializableAvgAggregateFunction extends AbstractSerializableAvgAggregateFunction {
 
-    public SerializableAvgAggregateFunction(ICopyEvaluatorFactory[] args) throws AlgebricksException {
-        super(args);
+    public SerializableAvgAggregateFunction(IScalarEvaluatorFactory[] args, IHyracksTaskContext context)
+            throws AlgebricksException {
+        super(args, context);
     }
 
     @Override
diff --git a/asterix-runtime/src/main/java/org/apache/asterix/runtime/aggregates/serializable/std/SerializableCountAggregateDescriptor.java b/asterix-runtime/src/main/java/org/apache/asterix/runtime/aggregates/serializable/std/SerializableCountAggregateDescriptor.java
index 484ca9c..d60fb7f 100644
--- a/asterix-runtime/src/main/java/org/apache/asterix/runtime/aggregates/serializable/std/SerializableCountAggregateDescriptor.java
+++ b/asterix-runtime/src/main/java/org/apache/asterix/runtime/aggregates/serializable/std/SerializableCountAggregateDescriptor.java
@@ -24,9 +24,10 @@
 import org.apache.asterix.runtime.aggregates.base.AbstractSerializableAggregateFunctionDynamicDescriptor;
 import org.apache.hyracks.algebricks.common.exceptions.AlgebricksException;
 import org.apache.hyracks.algebricks.core.algebra.functions.FunctionIdentifier;
-import org.apache.hyracks.algebricks.runtime.base.ICopyEvaluatorFactory;
-import org.apache.hyracks.algebricks.runtime.base.ICopySerializableAggregateFunction;
-import org.apache.hyracks.algebricks.runtime.base.ICopySerializableAggregateFunctionFactory;
+import org.apache.hyracks.algebricks.runtime.base.IScalarEvaluatorFactory;
+import org.apache.hyracks.algebricks.runtime.base.ISerializedAggregateEvaluator;
+import org.apache.hyracks.algebricks.runtime.base.ISerializedAggregateEvaluatorFactory;
+import org.apache.hyracks.api.context.IHyracksTaskContext;
 
 /**
  * count(NULL) returns NULL.
@@ -35,6 +36,7 @@
 
     private static final long serialVersionUID = 1L;
     public static final IFunctionDescriptorFactory FACTORY = new IFunctionDescriptorFactory() {
+        @Override
         public IFunctionDescriptor createFunctionDescriptor() {
             return new SerializableCountAggregateDescriptor();
         }
@@ -46,14 +48,15 @@
     }
 
     @Override
-    public ICopySerializableAggregateFunctionFactory createSerializableAggregateFunctionFactory(
-            final ICopyEvaluatorFactory[] args) throws AlgebricksException {
-        return new ICopySerializableAggregateFunctionFactory() {
+    public ISerializedAggregateEvaluatorFactory createSerializableAggregateEvaluatorFactory(
+            final IScalarEvaluatorFactory[] args) throws AlgebricksException {
+        return new ISerializedAggregateEvaluatorFactory() {
             private static final long serialVersionUID = 1L;
 
             @Override
-            public ICopySerializableAggregateFunction createAggregateFunction() throws AlgebricksException {
-                return new SerializableCountAggregateFunction(args);
+            public ISerializedAggregateEvaluator createAggregateEvaluator(IHyracksTaskContext ctx)
+                    throws AlgebricksException {
+                return new SerializableCountAggregateFunction(args, ctx);
             }
         };
     }
diff --git a/asterix-runtime/src/main/java/org/apache/asterix/runtime/aggregates/serializable/std/SerializableCountAggregateFunction.java b/asterix-runtime/src/main/java/org/apache/asterix/runtime/aggregates/serializable/std/SerializableCountAggregateFunction.java
index 37afd58..2f6cadf 100644
--- a/asterix-runtime/src/main/java/org/apache/asterix/runtime/aggregates/serializable/std/SerializableCountAggregateFunction.java
+++ b/asterix-runtime/src/main/java/org/apache/asterix/runtime/aggregates/serializable/std/SerializableCountAggregateFunction.java
@@ -19,13 +19,15 @@
 package org.apache.asterix.runtime.aggregates.serializable.std;
 
 import org.apache.hyracks.algebricks.common.exceptions.AlgebricksException;
-import org.apache.hyracks.algebricks.runtime.base.ICopyEvaluatorFactory;
+import org.apache.hyracks.algebricks.runtime.base.IScalarEvaluatorFactory;
+import org.apache.hyracks.api.context.IHyracksTaskContext;
 
 /**
  * count(NULL) returns NULL.
  */
 public class SerializableCountAggregateFunction extends AbstractSerializableCountAggregateFunction {
-    public SerializableCountAggregateFunction(ICopyEvaluatorFactory[] args) throws AlgebricksException {
-        super(args);
+    public SerializableCountAggregateFunction(IScalarEvaluatorFactory[] args, IHyracksTaskContext context)
+            throws AlgebricksException {
+        super(args, context);
     }
 }
\ No newline at end of file
diff --git a/asterix-runtime/src/main/java/org/apache/asterix/runtime/aggregates/serializable/std/SerializableGlobalAvgAggregateDescriptor.java b/asterix-runtime/src/main/java/org/apache/asterix/runtime/aggregates/serializable/std/SerializableGlobalAvgAggregateDescriptor.java
index c98fe64..6f11b66 100644
--- a/asterix-runtime/src/main/java/org/apache/asterix/runtime/aggregates/serializable/std/SerializableGlobalAvgAggregateDescriptor.java
+++ b/asterix-runtime/src/main/java/org/apache/asterix/runtime/aggregates/serializable/std/SerializableGlobalAvgAggregateDescriptor.java
@@ -25,14 +25,16 @@
 import org.apache.asterix.runtime.aggregates.base.AbstractSerializableAggregateFunctionDynamicDescriptor;
 import org.apache.hyracks.algebricks.common.exceptions.AlgebricksException;
 import org.apache.hyracks.algebricks.core.algebra.functions.FunctionIdentifier;
-import org.apache.hyracks.algebricks.runtime.base.ICopyEvaluatorFactory;
-import org.apache.hyracks.algebricks.runtime.base.ICopySerializableAggregateFunction;
-import org.apache.hyracks.algebricks.runtime.base.ICopySerializableAggregateFunctionFactory;
+import org.apache.hyracks.algebricks.runtime.base.IScalarEvaluatorFactory;
+import org.apache.hyracks.algebricks.runtime.base.ISerializedAggregateEvaluator;
+import org.apache.hyracks.algebricks.runtime.base.ISerializedAggregateEvaluatorFactory;
+import org.apache.hyracks.api.context.IHyracksTaskContext;
 
 public class SerializableGlobalAvgAggregateDescriptor extends AbstractSerializableAggregateFunctionDynamicDescriptor {
 
     private static final long serialVersionUID = 1L;
     public static final IFunctionDescriptorFactory FACTORY = new IFunctionDescriptorFactory() {
+        @Override
         public IFunctionDescriptor createFunctionDescriptor() {
             return new SerializableGlobalAvgAggregateDescriptor();
         }
@@ -44,14 +46,15 @@
     }
 
     @Override
-    public ICopySerializableAggregateFunctionFactory createSerializableAggregateFunctionFactory(
-            final ICopyEvaluatorFactory[] args) throws AlgebricksException {
-        return new ICopySerializableAggregateFunctionFactory() {
+    public ISerializedAggregateEvaluatorFactory createSerializableAggregateEvaluatorFactory(
+            final IScalarEvaluatorFactory[] args) throws AlgebricksException {
+        return new ISerializedAggregateEvaluatorFactory() {
             private static final long serialVersionUID = 1L;
 
             @Override
-            public ICopySerializableAggregateFunction createAggregateFunction() throws AlgebricksException {
-                return new SerializableGlobalAvgAggregateFunction(args);
+            public ISerializedAggregateEvaluator createAggregateEvaluator(IHyracksTaskContext ctx)
+                    throws AlgebricksException {
+                return new SerializableGlobalAvgAggregateFunction(args, ctx);
             }
         };
     }
diff --git a/asterix-runtime/src/main/java/org/apache/asterix/runtime/aggregates/serializable/std/SerializableGlobalAvgAggregateFunction.java b/asterix-runtime/src/main/java/org/apache/asterix/runtime/aggregates/serializable/std/SerializableGlobalAvgAggregateFunction.java
index 3a1298c..83a856c 100644
--- a/asterix-runtime/src/main/java/org/apache/asterix/runtime/aggregates/serializable/std/SerializableGlobalAvgAggregateFunction.java
+++ b/asterix-runtime/src/main/java/org/apache/asterix/runtime/aggregates/serializable/std/SerializableGlobalAvgAggregateFunction.java
@@ -24,13 +24,15 @@
 import org.apache.asterix.om.types.ATypeTag;
 import org.apache.asterix.om.types.EnumDeserializer;
 import org.apache.hyracks.algebricks.common.exceptions.AlgebricksException;
-import org.apache.hyracks.algebricks.runtime.base.ICopyEvaluatorFactory;
+import org.apache.hyracks.algebricks.runtime.base.IScalarEvaluatorFactory;
+import org.apache.hyracks.api.context.IHyracksTaskContext;
 import org.apache.hyracks.dataflow.common.data.accessors.IFrameTupleReference;
 
 public class SerializableGlobalAvgAggregateFunction extends AbstractSerializableAvgAggregateFunction {
 
-    public SerializableGlobalAvgAggregateFunction(ICopyEvaluatorFactory[] args) throws AlgebricksException {
-        super(args);
+    public SerializableGlobalAvgAggregateFunction(IScalarEvaluatorFactory[] args, IHyracksTaskContext context)
+            throws AlgebricksException {
+        super(args, context);
     }
 
     @Override
diff --git a/asterix-runtime/src/main/java/org/apache/asterix/runtime/aggregates/serializable/std/SerializableGlobalSqlAvgAggregateDescriptor.java b/asterix-runtime/src/main/java/org/apache/asterix/runtime/aggregates/serializable/std/SerializableGlobalSqlAvgAggregateDescriptor.java
index 88585fb..b7507b1 100644
--- a/asterix-runtime/src/main/java/org/apache/asterix/runtime/aggregates/serializable/std/SerializableGlobalSqlAvgAggregateDescriptor.java
+++ b/asterix-runtime/src/main/java/org/apache/asterix/runtime/aggregates/serializable/std/SerializableGlobalSqlAvgAggregateDescriptor.java
@@ -25,14 +25,17 @@
 import org.apache.asterix.runtime.aggregates.base.AbstractSerializableAggregateFunctionDynamicDescriptor;
 import org.apache.hyracks.algebricks.common.exceptions.AlgebricksException;
 import org.apache.hyracks.algebricks.core.algebra.functions.FunctionIdentifier;
-import org.apache.hyracks.algebricks.runtime.base.ICopyEvaluatorFactory;
-import org.apache.hyracks.algebricks.runtime.base.ICopySerializableAggregateFunction;
-import org.apache.hyracks.algebricks.runtime.base.ICopySerializableAggregateFunctionFactory;
+import org.apache.hyracks.algebricks.runtime.base.IScalarEvaluatorFactory;
+import org.apache.hyracks.algebricks.runtime.base.ISerializedAggregateEvaluator;
+import org.apache.hyracks.algebricks.runtime.base.ISerializedAggregateEvaluatorFactory;
+import org.apache.hyracks.api.context.IHyracksTaskContext;
 
-public class SerializableGlobalSqlAvgAggregateDescriptor extends AbstractSerializableAggregateFunctionDynamicDescriptor {
+public class SerializableGlobalSqlAvgAggregateDescriptor
+        extends AbstractSerializableAggregateFunctionDynamicDescriptor {
 
     private static final long serialVersionUID = 1L;
     public static final IFunctionDescriptorFactory FACTORY = new IFunctionDescriptorFactory() {
+        @Override
         public IFunctionDescriptor createFunctionDescriptor() {
             return new SerializableGlobalSqlAvgAggregateDescriptor();
         }
@@ -44,14 +47,15 @@
     }
 
     @Override
-    public ICopySerializableAggregateFunctionFactory createSerializableAggregateFunctionFactory(
-            final ICopyEvaluatorFactory[] args) throws AlgebricksException {
-        return new ICopySerializableAggregateFunctionFactory() {
+    public ISerializedAggregateEvaluatorFactory createSerializableAggregateEvaluatorFactory(
+            final IScalarEvaluatorFactory[] args) throws AlgebricksException {
+        return new ISerializedAggregateEvaluatorFactory() {
             private static final long serialVersionUID = 1L;
 
             @Override
-            public ICopySerializableAggregateFunction createAggregateFunction() throws AlgebricksException {
-                return new SerializableGlobalSqlAvgAggregateFunction(args);
+            public ISerializedAggregateEvaluator createAggregateEvaluator(IHyracksTaskContext ctx)
+                    throws AlgebricksException {
+                return new SerializableGlobalSqlAvgAggregateFunction(args, ctx);
             }
         };
     }
diff --git a/asterix-runtime/src/main/java/org/apache/asterix/runtime/aggregates/serializable/std/SerializableGlobalSqlAvgAggregateFunction.java b/asterix-runtime/src/main/java/org/apache/asterix/runtime/aggregates/serializable/std/SerializableGlobalSqlAvgAggregateFunction.java
index d2cc167..ebd8e89 100644
--- a/asterix-runtime/src/main/java/org/apache/asterix/runtime/aggregates/serializable/std/SerializableGlobalSqlAvgAggregateFunction.java
+++ b/asterix-runtime/src/main/java/org/apache/asterix/runtime/aggregates/serializable/std/SerializableGlobalSqlAvgAggregateFunction.java
@@ -22,13 +22,15 @@
 import java.io.DataOutput;
 
 import org.apache.hyracks.algebricks.common.exceptions.AlgebricksException;
-import org.apache.hyracks.algebricks.runtime.base.ICopyEvaluatorFactory;
+import org.apache.hyracks.algebricks.runtime.base.IScalarEvaluatorFactory;
+import org.apache.hyracks.api.context.IHyracksTaskContext;
 import org.apache.hyracks.dataflow.common.data.accessors.IFrameTupleReference;
 
 public class SerializableGlobalSqlAvgAggregateFunction extends AbstractSerializableAvgAggregateFunction {
 
-    public SerializableGlobalSqlAvgAggregateFunction(ICopyEvaluatorFactory[] args) throws AlgebricksException {
-        super(args);
+    public SerializableGlobalSqlAvgAggregateFunction(IScalarEvaluatorFactory[] args, IHyracksTaskContext context)
+            throws AlgebricksException {
+        super(args, context);
     }
 
     @Override
diff --git a/asterix-runtime/src/main/java/org/apache/asterix/runtime/aggregates/serializable/std/SerializableIntermediateAvgAggregateDescriptor.java b/asterix-runtime/src/main/java/org/apache/asterix/runtime/aggregates/serializable/std/SerializableIntermediateAvgAggregateDescriptor.java
index 1956c7d..e9920e2 100644
--- a/asterix-runtime/src/main/java/org/apache/asterix/runtime/aggregates/serializable/std/SerializableIntermediateAvgAggregateDescriptor.java
+++ b/asterix-runtime/src/main/java/org/apache/asterix/runtime/aggregates/serializable/std/SerializableIntermediateAvgAggregateDescriptor.java
@@ -25,15 +25,17 @@
 import org.apache.asterix.runtime.aggregates.base.AbstractSerializableAggregateFunctionDynamicDescriptor;
 import org.apache.hyracks.algebricks.common.exceptions.AlgebricksException;
 import org.apache.hyracks.algebricks.core.algebra.functions.FunctionIdentifier;
-import org.apache.hyracks.algebricks.runtime.base.ICopyEvaluatorFactory;
-import org.apache.hyracks.algebricks.runtime.base.ICopySerializableAggregateFunction;
-import org.apache.hyracks.algebricks.runtime.base.ICopySerializableAggregateFunctionFactory;
+import org.apache.hyracks.algebricks.runtime.base.IScalarEvaluatorFactory;
+import org.apache.hyracks.algebricks.runtime.base.ISerializedAggregateEvaluator;
+import org.apache.hyracks.algebricks.runtime.base.ISerializedAggregateEvaluatorFactory;
+import org.apache.hyracks.api.context.IHyracksTaskContext;
 
-public class SerializableIntermediateAvgAggregateDescriptor extends
-        AbstractSerializableAggregateFunctionDynamicDescriptor {
+public class SerializableIntermediateAvgAggregateDescriptor
+        extends AbstractSerializableAggregateFunctionDynamicDescriptor {
 
     private static final long serialVersionUID = 1L;
     public static final IFunctionDescriptorFactory FACTORY = new IFunctionDescriptorFactory() {
+        @Override
         public IFunctionDescriptor createFunctionDescriptor() {
             return new SerializableIntermediateAvgAggregateDescriptor();
         }
@@ -45,13 +47,15 @@
     }
 
     @Override
-    public ICopySerializableAggregateFunctionFactory createSerializableAggregateFunctionFactory(
-            final ICopyEvaluatorFactory[] args) throws AlgebricksException {
-        return new ICopySerializableAggregateFunctionFactory() {
+    public ISerializedAggregateEvaluatorFactory createSerializableAggregateEvaluatorFactory(
+            final IScalarEvaluatorFactory[] args) throws AlgebricksException {
+        return new ISerializedAggregateEvaluatorFactory() {
             private static final long serialVersionUID = 1L;
 
-            public ICopySerializableAggregateFunction createAggregateFunction() throws AlgebricksException {
-                return new SerializableIntermediateAvgAggregateFunction(args);
+            @Override
+            public ISerializedAggregateEvaluator createAggregateEvaluator(IHyracksTaskContext ctx)
+                    throws AlgebricksException {
+                return new SerializableIntermediateAvgAggregateFunction(args, ctx);
             }
         };
     }
diff --git a/asterix-runtime/src/main/java/org/apache/asterix/runtime/aggregates/serializable/std/SerializableIntermediateAvgAggregateFunction.java b/asterix-runtime/src/main/java/org/apache/asterix/runtime/aggregates/serializable/std/SerializableIntermediateAvgAggregateFunction.java
index af21c9f..3ea3d76 100644
--- a/asterix-runtime/src/main/java/org/apache/asterix/runtime/aggregates/serializable/std/SerializableIntermediateAvgAggregateFunction.java
+++ b/asterix-runtime/src/main/java/org/apache/asterix/runtime/aggregates/serializable/std/SerializableIntermediateAvgAggregateFunction.java
@@ -24,13 +24,15 @@
 import org.apache.asterix.om.types.ATypeTag;
 import org.apache.asterix.om.types.EnumDeserializer;
 import org.apache.hyracks.algebricks.common.exceptions.AlgebricksException;
-import org.apache.hyracks.algebricks.runtime.base.ICopyEvaluatorFactory;
+import org.apache.hyracks.algebricks.runtime.base.IScalarEvaluatorFactory;
+import org.apache.hyracks.api.context.IHyracksTaskContext;
 import org.apache.hyracks.dataflow.common.data.accessors.IFrameTupleReference;
 
 public class SerializableIntermediateAvgAggregateFunction extends AbstractSerializableAvgAggregateFunction {
 
-    public SerializableIntermediateAvgAggregateFunction(ICopyEvaluatorFactory[] args) throws AlgebricksException {
-        super(args);
+    public SerializableIntermediateAvgAggregateFunction(IScalarEvaluatorFactory[] args, IHyracksTaskContext context)
+            throws AlgebricksException {
+        super(args, context);
     }
 
     @Override
diff --git a/asterix-runtime/src/main/java/org/apache/asterix/runtime/aggregates/serializable/std/SerializableIntermediateSqlAvgAggregateDescriptor.java b/asterix-runtime/src/main/java/org/apache/asterix/runtime/aggregates/serializable/std/SerializableIntermediateSqlAvgAggregateDescriptor.java
index 91f6f4e..aa4d699 100644
--- a/asterix-runtime/src/main/java/org/apache/asterix/runtime/aggregates/serializable/std/SerializableIntermediateSqlAvgAggregateDescriptor.java
+++ b/asterix-runtime/src/main/java/org/apache/asterix/runtime/aggregates/serializable/std/SerializableIntermediateSqlAvgAggregateDescriptor.java
@@ -25,14 +25,17 @@
 import org.apache.asterix.runtime.aggregates.base.AbstractSerializableAggregateFunctionDynamicDescriptor;
 import org.apache.hyracks.algebricks.common.exceptions.AlgebricksException;
 import org.apache.hyracks.algebricks.core.algebra.functions.FunctionIdentifier;
-import org.apache.hyracks.algebricks.runtime.base.ICopyEvaluatorFactory;
-import org.apache.hyracks.algebricks.runtime.base.ICopySerializableAggregateFunction;
-import org.apache.hyracks.algebricks.runtime.base.ICopySerializableAggregateFunctionFactory;
+import org.apache.hyracks.algebricks.runtime.base.IScalarEvaluatorFactory;
+import org.apache.hyracks.algebricks.runtime.base.ISerializedAggregateEvaluator;
+import org.apache.hyracks.algebricks.runtime.base.ISerializedAggregateEvaluatorFactory;
+import org.apache.hyracks.api.context.IHyracksTaskContext;
 
-public class SerializableIntermediateSqlAvgAggregateDescriptor extends AbstractSerializableAggregateFunctionDynamicDescriptor {
+public class SerializableIntermediateSqlAvgAggregateDescriptor
+        extends AbstractSerializableAggregateFunctionDynamicDescriptor {
 
     private static final long serialVersionUID = 1L;
     public static final IFunctionDescriptorFactory FACTORY = new IFunctionDescriptorFactory() {
+        @Override
         public IFunctionDescriptor createFunctionDescriptor() {
             return new SerializableIntermediateSqlAvgAggregateDescriptor();
         }
@@ -44,14 +47,15 @@
     }
 
     @Override
-    public ICopySerializableAggregateFunctionFactory createSerializableAggregateFunctionFactory(
-            final ICopyEvaluatorFactory[] args) throws AlgebricksException {
-        return new ICopySerializableAggregateFunctionFactory() {
+    public ISerializedAggregateEvaluatorFactory createSerializableAggregateEvaluatorFactory(
+            final IScalarEvaluatorFactory[] args) throws AlgebricksException {
+        return new ISerializedAggregateEvaluatorFactory() {
             private static final long serialVersionUID = 1L;
 
             @Override
-            public ICopySerializableAggregateFunction createAggregateFunction() throws AlgebricksException {
-                return new SerializableIntermediateSqlAvgAggregateFunction(args);
+            public ISerializedAggregateEvaluator createAggregateEvaluator(IHyracksTaskContext ctx)
+                    throws AlgebricksException {
+                return new SerializableIntermediateSqlAvgAggregateFunction(args, ctx);
             }
         };
     }
diff --git a/asterix-runtime/src/main/java/org/apache/asterix/runtime/aggregates/serializable/std/SerializableIntermediateSqlAvgAggregateFunction.java b/asterix-runtime/src/main/java/org/apache/asterix/runtime/aggregates/serializable/std/SerializableIntermediateSqlAvgAggregateFunction.java
index 920dae2..bd58214 100644
--- a/asterix-runtime/src/main/java/org/apache/asterix/runtime/aggregates/serializable/std/SerializableIntermediateSqlAvgAggregateFunction.java
+++ b/asterix-runtime/src/main/java/org/apache/asterix/runtime/aggregates/serializable/std/SerializableIntermediateSqlAvgAggregateFunction.java
@@ -22,13 +22,15 @@
 import java.io.DataOutput;
 
 import org.apache.hyracks.algebricks.common.exceptions.AlgebricksException;
-import org.apache.hyracks.algebricks.runtime.base.ICopyEvaluatorFactory;
+import org.apache.hyracks.algebricks.runtime.base.IScalarEvaluatorFactory;
+import org.apache.hyracks.api.context.IHyracksTaskContext;
 import org.apache.hyracks.dataflow.common.data.accessors.IFrameTupleReference;
 
 public class SerializableIntermediateSqlAvgAggregateFunction extends AbstractSerializableAvgAggregateFunction {
 
-    public SerializableIntermediateSqlAvgAggregateFunction(ICopyEvaluatorFactory[] args) throws AlgebricksException {
-        super(args);
+    public SerializableIntermediateSqlAvgAggregateFunction(IScalarEvaluatorFactory[] args, IHyracksTaskContext context)
+            throws AlgebricksException {
+        super(args, context);
     }
 
     @Override
diff --git a/asterix-runtime/src/main/java/org/apache/asterix/runtime/aggregates/serializable/std/SerializableLocalAvgAggregateDescriptor.java b/asterix-runtime/src/main/java/org/apache/asterix/runtime/aggregates/serializable/std/SerializableLocalAvgAggregateDescriptor.java
index a29c37a..8fd080a 100644
--- a/asterix-runtime/src/main/java/org/apache/asterix/runtime/aggregates/serializable/std/SerializableLocalAvgAggregateDescriptor.java
+++ b/asterix-runtime/src/main/java/org/apache/asterix/runtime/aggregates/serializable/std/SerializableLocalAvgAggregateDescriptor.java
@@ -25,14 +25,16 @@
 import org.apache.asterix.runtime.aggregates.base.AbstractSerializableAggregateFunctionDynamicDescriptor;
 import org.apache.hyracks.algebricks.common.exceptions.AlgebricksException;
 import org.apache.hyracks.algebricks.core.algebra.functions.FunctionIdentifier;
-import org.apache.hyracks.algebricks.runtime.base.ICopyEvaluatorFactory;
-import org.apache.hyracks.algebricks.runtime.base.ICopySerializableAggregateFunction;
-import org.apache.hyracks.algebricks.runtime.base.ICopySerializableAggregateFunctionFactory;
+import org.apache.hyracks.algebricks.runtime.base.IScalarEvaluatorFactory;
+import org.apache.hyracks.algebricks.runtime.base.ISerializedAggregateEvaluator;
+import org.apache.hyracks.algebricks.runtime.base.ISerializedAggregateEvaluatorFactory;
+import org.apache.hyracks.api.context.IHyracksTaskContext;
 
 public class SerializableLocalAvgAggregateDescriptor extends AbstractSerializableAggregateFunctionDynamicDescriptor {
 
     private static final long serialVersionUID = 1L;
     public static final IFunctionDescriptorFactory FACTORY = new IFunctionDescriptorFactory() {
+        @Override
         public IFunctionDescriptor createFunctionDescriptor() {
             return new SerializableLocalAvgAggregateDescriptor();
         }
@@ -44,13 +46,15 @@
     }
 
     @Override
-    public ICopySerializableAggregateFunctionFactory createSerializableAggregateFunctionFactory(
-            final ICopyEvaluatorFactory[] args) throws AlgebricksException {
-        return new ICopySerializableAggregateFunctionFactory() {
+    public ISerializedAggregateEvaluatorFactory createSerializableAggregateEvaluatorFactory(
+            final IScalarEvaluatorFactory[] args) throws AlgebricksException {
+        return new ISerializedAggregateEvaluatorFactory() {
             private static final long serialVersionUID = 1L;
 
-            public ICopySerializableAggregateFunction createAggregateFunction() throws AlgebricksException {
-                return new SerializableLocalAvgAggregateFunction(args);
+            @Override
+            public ISerializedAggregateEvaluator createAggregateEvaluator(IHyracksTaskContext ctx)
+                    throws AlgebricksException {
+                return new SerializableLocalAvgAggregateFunction(args, ctx);
             }
         };
     }
diff --git a/asterix-runtime/src/main/java/org/apache/asterix/runtime/aggregates/serializable/std/SerializableLocalAvgAggregateFunction.java b/asterix-runtime/src/main/java/org/apache/asterix/runtime/aggregates/serializable/std/SerializableLocalAvgAggregateFunction.java
index 1b7772f..c15a937 100644
--- a/asterix-runtime/src/main/java/org/apache/asterix/runtime/aggregates/serializable/std/SerializableLocalAvgAggregateFunction.java
+++ b/asterix-runtime/src/main/java/org/apache/asterix/runtime/aggregates/serializable/std/SerializableLocalAvgAggregateFunction.java
@@ -24,13 +24,15 @@
 import org.apache.asterix.om.types.ATypeTag;
 import org.apache.asterix.om.types.EnumDeserializer;
 import org.apache.hyracks.algebricks.common.exceptions.AlgebricksException;
-import org.apache.hyracks.algebricks.runtime.base.ICopyEvaluatorFactory;
+import org.apache.hyracks.algebricks.runtime.base.IScalarEvaluatorFactory;
+import org.apache.hyracks.api.context.IHyracksTaskContext;
 import org.apache.hyracks.dataflow.common.data.accessors.IFrameTupleReference;
 
 public class SerializableLocalAvgAggregateFunction extends AbstractSerializableAvgAggregateFunction {
 
-    public SerializableLocalAvgAggregateFunction(ICopyEvaluatorFactory[] args) throws AlgebricksException {
-        super(args);
+    public SerializableLocalAvgAggregateFunction(IScalarEvaluatorFactory[] args, IHyracksTaskContext context)
+            throws AlgebricksException {
+        super(args, context);
     }
 
     @Override
diff --git a/asterix-runtime/src/main/java/org/apache/asterix/runtime/aggregates/serializable/std/SerializableLocalSqlAvgAggregateDescriptor.java b/asterix-runtime/src/main/java/org/apache/asterix/runtime/aggregates/serializable/std/SerializableLocalSqlAvgAggregateDescriptor.java
index b31e69f..f96a053 100644
--- a/asterix-runtime/src/main/java/org/apache/asterix/runtime/aggregates/serializable/std/SerializableLocalSqlAvgAggregateDescriptor.java
+++ b/asterix-runtime/src/main/java/org/apache/asterix/runtime/aggregates/serializable/std/SerializableLocalSqlAvgAggregateDescriptor.java
@@ -25,14 +25,16 @@
 import org.apache.asterix.runtime.aggregates.base.AbstractSerializableAggregateFunctionDynamicDescriptor;
 import org.apache.hyracks.algebricks.common.exceptions.AlgebricksException;
 import org.apache.hyracks.algebricks.core.algebra.functions.FunctionIdentifier;
-import org.apache.hyracks.algebricks.runtime.base.ICopyEvaluatorFactory;
-import org.apache.hyracks.algebricks.runtime.base.ICopySerializableAggregateFunction;
-import org.apache.hyracks.algebricks.runtime.base.ICopySerializableAggregateFunctionFactory;
+import org.apache.hyracks.algebricks.runtime.base.IScalarEvaluatorFactory;
+import org.apache.hyracks.algebricks.runtime.base.ISerializedAggregateEvaluator;
+import org.apache.hyracks.algebricks.runtime.base.ISerializedAggregateEvaluatorFactory;
+import org.apache.hyracks.api.context.IHyracksTaskContext;
 
 public class SerializableLocalSqlAvgAggregateDescriptor extends AbstractSerializableAggregateFunctionDynamicDescriptor {
 
     private static final long serialVersionUID = 1L;
     public static final IFunctionDescriptorFactory FACTORY = new IFunctionDescriptorFactory() {
+        @Override
         public IFunctionDescriptor createFunctionDescriptor() {
             return new SerializableLocalSqlAvgAggregateDescriptor();
         }
@@ -44,13 +46,15 @@
     }
 
     @Override
-    public ICopySerializableAggregateFunctionFactory createSerializableAggregateFunctionFactory(
-            final ICopyEvaluatorFactory[] args) throws AlgebricksException {
-        return new ICopySerializableAggregateFunctionFactory() {
+    public ISerializedAggregateEvaluatorFactory createSerializableAggregateEvaluatorFactory(
+            final IScalarEvaluatorFactory[] args) throws AlgebricksException {
+        return new ISerializedAggregateEvaluatorFactory() {
             private static final long serialVersionUID = 1L;
 
-            public ICopySerializableAggregateFunction createAggregateFunction() throws AlgebricksException {
-                return new SerializableLocalSqlAvgAggregateFunction(args);
+            @Override
+            public ISerializedAggregateEvaluator createAggregateEvaluator(IHyracksTaskContext ctx)
+                    throws AlgebricksException {
+                return new SerializableLocalSqlAvgAggregateFunction(args, ctx);
             }
         };
     }
diff --git a/asterix-runtime/src/main/java/org/apache/asterix/runtime/aggregates/serializable/std/SerializableLocalSqlAvgAggregateFunction.java b/asterix-runtime/src/main/java/org/apache/asterix/runtime/aggregates/serializable/std/SerializableLocalSqlAvgAggregateFunction.java
index e2f40e5..3609050 100644
--- a/asterix-runtime/src/main/java/org/apache/asterix/runtime/aggregates/serializable/std/SerializableLocalSqlAvgAggregateFunction.java
+++ b/asterix-runtime/src/main/java/org/apache/asterix/runtime/aggregates/serializable/std/SerializableLocalSqlAvgAggregateFunction.java
@@ -22,13 +22,15 @@
 import java.io.DataOutput;
 
 import org.apache.hyracks.algebricks.common.exceptions.AlgebricksException;
-import org.apache.hyracks.algebricks.runtime.base.ICopyEvaluatorFactory;
+import org.apache.hyracks.algebricks.runtime.base.IScalarEvaluatorFactory;
+import org.apache.hyracks.api.context.IHyracksTaskContext;
 import org.apache.hyracks.dataflow.common.data.accessors.IFrameTupleReference;
 
 public class SerializableLocalSqlAvgAggregateFunction extends AbstractSerializableAvgAggregateFunction {
 
-    public SerializableLocalSqlAvgAggregateFunction(ICopyEvaluatorFactory[] args) throws AlgebricksException {
-        super(args);
+    public SerializableLocalSqlAvgAggregateFunction(IScalarEvaluatorFactory[] args, IHyracksTaskContext context)
+            throws AlgebricksException {
+        super(args, context);
     }
 
     @Override
diff --git a/asterix-runtime/src/main/java/org/apache/asterix/runtime/aggregates/serializable/std/SerializableLocalSqlSumAggregateDescriptor.java b/asterix-runtime/src/main/java/org/apache/asterix/runtime/aggregates/serializable/std/SerializableLocalSqlSumAggregateDescriptor.java
index 3b8bf0a..4392e6e 100644
--- a/asterix-runtime/src/main/java/org/apache/asterix/runtime/aggregates/serializable/std/SerializableLocalSqlSumAggregateDescriptor.java
+++ b/asterix-runtime/src/main/java/org/apache/asterix/runtime/aggregates/serializable/std/SerializableLocalSqlSumAggregateDescriptor.java
@@ -24,14 +24,16 @@
 import org.apache.asterix.runtime.aggregates.base.AbstractSerializableAggregateFunctionDynamicDescriptor;
 import org.apache.hyracks.algebricks.common.exceptions.AlgebricksException;
 import org.apache.hyracks.algebricks.core.algebra.functions.FunctionIdentifier;
-import org.apache.hyracks.algebricks.runtime.base.ICopyEvaluatorFactory;
-import org.apache.hyracks.algebricks.runtime.base.ICopySerializableAggregateFunction;
-import org.apache.hyracks.algebricks.runtime.base.ICopySerializableAggregateFunctionFactory;
+import org.apache.hyracks.algebricks.runtime.base.IScalarEvaluatorFactory;
+import org.apache.hyracks.algebricks.runtime.base.ISerializedAggregateEvaluator;
+import org.apache.hyracks.algebricks.runtime.base.ISerializedAggregateEvaluatorFactory;
+import org.apache.hyracks.api.context.IHyracksTaskContext;
 
 public class SerializableLocalSqlSumAggregateDescriptor extends AbstractSerializableAggregateFunctionDynamicDescriptor {
 
     private static final long serialVersionUID = 1L;
     public static final IFunctionDescriptorFactory FACTORY = new IFunctionDescriptorFactory() {
+        @Override
         public IFunctionDescriptor createFunctionDescriptor() {
             return new SerializableLocalSqlSumAggregateDescriptor();
         }
@@ -43,14 +45,15 @@
     }
 
     @Override
-    public ICopySerializableAggregateFunctionFactory createSerializableAggregateFunctionFactory(
-            final ICopyEvaluatorFactory[] args) throws AlgebricksException {
-        return new ICopySerializableAggregateFunctionFactory() {
+    public ISerializedAggregateEvaluatorFactory createSerializableAggregateEvaluatorFactory(
+            final IScalarEvaluatorFactory[] args) throws AlgebricksException {
+        return new ISerializedAggregateEvaluatorFactory() {
             private static final long serialVersionUID = 1L;
 
             @Override
-            public ICopySerializableAggregateFunction createAggregateFunction() throws AlgebricksException {
-                return new SerializableSqlSumAggregateFunction(args, true);
+            public ISerializedAggregateEvaluator createAggregateEvaluator(IHyracksTaskContext ctx)
+                    throws AlgebricksException {
+                return new SerializableSqlSumAggregateFunction(args, true, ctx);
             }
         };
     }
diff --git a/asterix-runtime/src/main/java/org/apache/asterix/runtime/aggregates/serializable/std/SerializableLocalSumAggregateDescriptor.java b/asterix-runtime/src/main/java/org/apache/asterix/runtime/aggregates/serializable/std/SerializableLocalSumAggregateDescriptor.java
index b2fab9c..e610077 100644
--- a/asterix-runtime/src/main/java/org/apache/asterix/runtime/aggregates/serializable/std/SerializableLocalSumAggregateDescriptor.java
+++ b/asterix-runtime/src/main/java/org/apache/asterix/runtime/aggregates/serializable/std/SerializableLocalSumAggregateDescriptor.java
@@ -24,14 +24,16 @@
 import org.apache.asterix.runtime.aggregates.base.AbstractSerializableAggregateFunctionDynamicDescriptor;
 import org.apache.hyracks.algebricks.common.exceptions.AlgebricksException;
 import org.apache.hyracks.algebricks.core.algebra.functions.FunctionIdentifier;
-import org.apache.hyracks.algebricks.runtime.base.ICopyEvaluatorFactory;
-import org.apache.hyracks.algebricks.runtime.base.ICopySerializableAggregateFunction;
-import org.apache.hyracks.algebricks.runtime.base.ICopySerializableAggregateFunctionFactory;
+import org.apache.hyracks.algebricks.runtime.base.IScalarEvaluatorFactory;
+import org.apache.hyracks.algebricks.runtime.base.ISerializedAggregateEvaluator;
+import org.apache.hyracks.algebricks.runtime.base.ISerializedAggregateEvaluatorFactory;
+import org.apache.hyracks.api.context.IHyracksTaskContext;
 
 public class SerializableLocalSumAggregateDescriptor extends AbstractSerializableAggregateFunctionDynamicDescriptor {
 
     private static final long serialVersionUID = 1L;
     public static final IFunctionDescriptorFactory FACTORY = new IFunctionDescriptorFactory() {
+        @Override
         public IFunctionDescriptor createFunctionDescriptor() {
             return new SerializableLocalSumAggregateDescriptor();
         }
@@ -43,14 +45,15 @@
     }
 
     @Override
-    public ICopySerializableAggregateFunctionFactory createSerializableAggregateFunctionFactory(
-            final ICopyEvaluatorFactory[] args) throws AlgebricksException {
-        return new ICopySerializableAggregateFunctionFactory() {
+    public ISerializedAggregateEvaluatorFactory createSerializableAggregateEvaluatorFactory(
+            final IScalarEvaluatorFactory[] args) throws AlgebricksException {
+        return new ISerializedAggregateEvaluatorFactory() {
             private static final long serialVersionUID = 1L;
 
             @Override
-            public ICopySerializableAggregateFunction createAggregateFunction() throws AlgebricksException {
-                return new SerializableSumAggregateFunction(args, true);
+            public ISerializedAggregateEvaluator createAggregateEvaluator(IHyracksTaskContext ctx)
+                    throws AlgebricksException {
+                return new SerializableSumAggregateFunction(args, true, ctx);
             }
         };
     }
diff --git a/asterix-runtime/src/main/java/org/apache/asterix/runtime/aggregates/serializable/std/SerializableSqlAvgAggregateDescriptor.java b/asterix-runtime/src/main/java/org/apache/asterix/runtime/aggregates/serializable/std/SerializableSqlAvgAggregateDescriptor.java
index 55151dc..ef1914a 100644
--- a/asterix-runtime/src/main/java/org/apache/asterix/runtime/aggregates/serializable/std/SerializableSqlAvgAggregateDescriptor.java
+++ b/asterix-runtime/src/main/java/org/apache/asterix/runtime/aggregates/serializable/std/SerializableSqlAvgAggregateDescriptor.java
@@ -24,14 +24,16 @@
 import org.apache.asterix.runtime.aggregates.base.AbstractSerializableAggregateFunctionDynamicDescriptor;
 import org.apache.hyracks.algebricks.common.exceptions.AlgebricksException;
 import org.apache.hyracks.algebricks.core.algebra.functions.FunctionIdentifier;
-import org.apache.hyracks.algebricks.runtime.base.ICopyEvaluatorFactory;
-import org.apache.hyracks.algebricks.runtime.base.ICopySerializableAggregateFunction;
-import org.apache.hyracks.algebricks.runtime.base.ICopySerializableAggregateFunctionFactory;
+import org.apache.hyracks.algebricks.runtime.base.IScalarEvaluatorFactory;
+import org.apache.hyracks.algebricks.runtime.base.ISerializedAggregateEvaluator;
+import org.apache.hyracks.algebricks.runtime.base.ISerializedAggregateEvaluatorFactory;
+import org.apache.hyracks.api.context.IHyracksTaskContext;
 
 public class SerializableSqlAvgAggregateDescriptor extends AbstractSerializableAggregateFunctionDynamicDescriptor {
 
     private static final long serialVersionUID = 1L;
     public static final IFunctionDescriptorFactory FACTORY = new IFunctionDescriptorFactory() {
+        @Override
         public IFunctionDescriptor createFunctionDescriptor() {
             return new SerializableSqlAvgAggregateDescriptor();
         }
@@ -43,13 +45,15 @@
     }
 
     @Override
-    public ICopySerializableAggregateFunctionFactory createSerializableAggregateFunctionFactory(
-            final ICopyEvaluatorFactory[] args) throws AlgebricksException {
-        return new ICopySerializableAggregateFunctionFactory() {
+    public ISerializedAggregateEvaluatorFactory createSerializableAggregateEvaluatorFactory(
+            final IScalarEvaluatorFactory[] args) throws AlgebricksException {
+        return new ISerializedAggregateEvaluatorFactory() {
             private static final long serialVersionUID = 1L;
 
-            public ICopySerializableAggregateFunction createAggregateFunction() throws AlgebricksException {
-                return new SerializableSqlAvgAggregateFunction(args);
+            @Override
+            public ISerializedAggregateEvaluator createAggregateEvaluator(IHyracksTaskContext ctx)
+                    throws AlgebricksException {
+                return new SerializableSqlAvgAggregateFunction(args, ctx);
             }
         };
     }
diff --git a/asterix-runtime/src/main/java/org/apache/asterix/runtime/aggregates/serializable/std/SerializableSqlAvgAggregateFunction.java b/asterix-runtime/src/main/java/org/apache/asterix/runtime/aggregates/serializable/std/SerializableSqlAvgAggregateFunction.java
index e7205ac..8b62efb 100644
--- a/asterix-runtime/src/main/java/org/apache/asterix/runtime/aggregates/serializable/std/SerializableSqlAvgAggregateFunction.java
+++ b/asterix-runtime/src/main/java/org/apache/asterix/runtime/aggregates/serializable/std/SerializableSqlAvgAggregateFunction.java
@@ -21,13 +21,15 @@
 import java.io.DataOutput;
 
 import org.apache.hyracks.algebricks.common.exceptions.AlgebricksException;
-import org.apache.hyracks.algebricks.runtime.base.ICopyEvaluatorFactory;
+import org.apache.hyracks.algebricks.runtime.base.IScalarEvaluatorFactory;
+import org.apache.hyracks.api.context.IHyracksTaskContext;
 import org.apache.hyracks.dataflow.common.data.accessors.IFrameTupleReference;
 
 public class SerializableSqlAvgAggregateFunction extends AbstractSerializableAvgAggregateFunction {
 
-    public SerializableSqlAvgAggregateFunction(ICopyEvaluatorFactory[] args) throws AlgebricksException {
-        super(args);
+    public SerializableSqlAvgAggregateFunction(IScalarEvaluatorFactory[] args, IHyracksTaskContext context)
+            throws AlgebricksException {
+        super(args, context);
     }
 
     @Override
diff --git a/asterix-runtime/src/main/java/org/apache/asterix/runtime/aggregates/serializable/std/SerializableSqlCountAggregateDescriptor.java b/asterix-runtime/src/main/java/org/apache/asterix/runtime/aggregates/serializable/std/SerializableSqlCountAggregateDescriptor.java
index 1998e18..2a5bc53 100644
--- a/asterix-runtime/src/main/java/org/apache/asterix/runtime/aggregates/serializable/std/SerializableSqlCountAggregateDescriptor.java
+++ b/asterix-runtime/src/main/java/org/apache/asterix/runtime/aggregates/serializable/std/SerializableSqlCountAggregateDescriptor.java
@@ -24,9 +24,10 @@
 import org.apache.asterix.runtime.aggregates.base.AbstractSerializableAggregateFunctionDynamicDescriptor;
 import org.apache.hyracks.algebricks.common.exceptions.AlgebricksException;
 import org.apache.hyracks.algebricks.core.algebra.functions.FunctionIdentifier;
-import org.apache.hyracks.algebricks.runtime.base.ICopyEvaluatorFactory;
-import org.apache.hyracks.algebricks.runtime.base.ICopySerializableAggregateFunction;
-import org.apache.hyracks.algebricks.runtime.base.ICopySerializableAggregateFunctionFactory;
+import org.apache.hyracks.algebricks.runtime.base.IScalarEvaluatorFactory;
+import org.apache.hyracks.algebricks.runtime.base.ISerializedAggregateEvaluator;
+import org.apache.hyracks.algebricks.runtime.base.ISerializedAggregateEvaluatorFactory;
+import org.apache.hyracks.api.context.IHyracksTaskContext;
 
 /**
  * count(NULL) returns NULL.
@@ -35,6 +36,7 @@
 
     private static final long serialVersionUID = 1L;
     public static final IFunctionDescriptorFactory FACTORY = new IFunctionDescriptorFactory() {
+        @Override
         public IFunctionDescriptor createFunctionDescriptor() {
             return new SerializableSqlCountAggregateDescriptor();
         }
@@ -46,14 +48,15 @@
     }
 
     @Override
-    public ICopySerializableAggregateFunctionFactory createSerializableAggregateFunctionFactory(
-            final ICopyEvaluatorFactory[] args) throws AlgebricksException {
-        return new ICopySerializableAggregateFunctionFactory() {
+    public ISerializedAggregateEvaluatorFactory createSerializableAggregateEvaluatorFactory(
+            final IScalarEvaluatorFactory[] args) throws AlgebricksException {
+        return new ISerializedAggregateEvaluatorFactory() {
             private static final long serialVersionUID = 1L;
 
             @Override
-            public ICopySerializableAggregateFunction createAggregateFunction() throws AlgebricksException {
-                return new SerializableSqlCountAggregateFunction(args);
+            public ISerializedAggregateEvaluator createAggregateEvaluator(IHyracksTaskContext ctx)
+                    throws AlgebricksException {
+                return new SerializableSqlCountAggregateFunction(args, ctx);
             }
         };
     }
diff --git a/asterix-runtime/src/main/java/org/apache/asterix/runtime/aggregates/serializable/std/SerializableSqlCountAggregateFunction.java b/asterix-runtime/src/main/java/org/apache/asterix/runtime/aggregates/serializable/std/SerializableSqlCountAggregateFunction.java
index aaf9df7..24cd674 100644
--- a/asterix-runtime/src/main/java/org/apache/asterix/runtime/aggregates/serializable/std/SerializableSqlCountAggregateFunction.java
+++ b/asterix-runtime/src/main/java/org/apache/asterix/runtime/aggregates/serializable/std/SerializableSqlCountAggregateFunction.java
@@ -19,14 +19,16 @@
 package org.apache.asterix.runtime.aggregates.serializable.std;
 
 import org.apache.hyracks.algebricks.common.exceptions.AlgebricksException;
-import org.apache.hyracks.algebricks.runtime.base.ICopyEvaluatorFactory;
+import org.apache.hyracks.algebricks.runtime.base.IScalarEvaluatorFactory;
+import org.apache.hyracks.api.context.IHyracksTaskContext;
 
 /**
  * count(NULL) returns NULL.
  */
 public class SerializableSqlCountAggregateFunction extends AbstractSerializableCountAggregateFunction {
-    public SerializableSqlCountAggregateFunction(ICopyEvaluatorFactory[] args) throws AlgebricksException {
-        super(args);
+    public SerializableSqlCountAggregateFunction(IScalarEvaluatorFactory[] args, IHyracksTaskContext context)
+            throws AlgebricksException {
+        super(args, context);
     }
 
     @Override
diff --git a/asterix-runtime/src/main/java/org/apache/asterix/runtime/aggregates/serializable/std/SerializableSqlSumAggregateDescriptor.java b/asterix-runtime/src/main/java/org/apache/asterix/runtime/aggregates/serializable/std/SerializableSqlSumAggregateDescriptor.java
index 9813ad7..dec2688 100644
--- a/asterix-runtime/src/main/java/org/apache/asterix/runtime/aggregates/serializable/std/SerializableSqlSumAggregateDescriptor.java
+++ b/asterix-runtime/src/main/java/org/apache/asterix/runtime/aggregates/serializable/std/SerializableSqlSumAggregateDescriptor.java
@@ -24,14 +24,16 @@
 import org.apache.asterix.runtime.aggregates.base.AbstractSerializableAggregateFunctionDynamicDescriptor;
 import org.apache.hyracks.algebricks.common.exceptions.AlgebricksException;
 import org.apache.hyracks.algebricks.core.algebra.functions.FunctionIdentifier;
-import org.apache.hyracks.algebricks.runtime.base.ICopyEvaluatorFactory;
-import org.apache.hyracks.algebricks.runtime.base.ICopySerializableAggregateFunction;
-import org.apache.hyracks.algebricks.runtime.base.ICopySerializableAggregateFunctionFactory;
+import org.apache.hyracks.algebricks.runtime.base.IScalarEvaluatorFactory;
+import org.apache.hyracks.algebricks.runtime.base.ISerializedAggregateEvaluator;
+import org.apache.hyracks.algebricks.runtime.base.ISerializedAggregateEvaluatorFactory;
+import org.apache.hyracks.api.context.IHyracksTaskContext;
 
 public class SerializableSqlSumAggregateDescriptor extends AbstractSerializableAggregateFunctionDynamicDescriptor {
 
     private static final long serialVersionUID = 1L;
     public static final IFunctionDescriptorFactory FACTORY = new IFunctionDescriptorFactory() {
+        @Override
         public IFunctionDescriptor createFunctionDescriptor() {
             return new SerializableSqlSumAggregateDescriptor();
         }
@@ -43,14 +45,15 @@
     }
 
     @Override
-    public ICopySerializableAggregateFunctionFactory createSerializableAggregateFunctionFactory(
-            final ICopyEvaluatorFactory[] args) throws AlgebricksException {
-        return new ICopySerializableAggregateFunctionFactory() {
+    public ISerializedAggregateEvaluatorFactory createSerializableAggregateEvaluatorFactory(
+            final IScalarEvaluatorFactory[] args) throws AlgebricksException {
+        return new ISerializedAggregateEvaluatorFactory() {
             private static final long serialVersionUID = 1L;
 
             @Override
-            public ICopySerializableAggregateFunction createAggregateFunction() throws AlgebricksException {
-                return new SerializableSqlSumAggregateFunction(args, false);
+            public ISerializedAggregateEvaluator createAggregateEvaluator(IHyracksTaskContext ctx)
+                    throws AlgebricksException {
+                return new SerializableSqlSumAggregateFunction(args, false, ctx);
             }
         };
     }
diff --git a/asterix-runtime/src/main/java/org/apache/asterix/runtime/aggregates/serializable/std/SerializableSqlSumAggregateFunction.java b/asterix-runtime/src/main/java/org/apache/asterix/runtime/aggregates/serializable/std/SerializableSqlSumAggregateFunction.java
index 8d82dde..f34d1be 100644
--- a/asterix-runtime/src/main/java/org/apache/asterix/runtime/aggregates/serializable/std/SerializableSqlSumAggregateFunction.java
+++ b/asterix-runtime/src/main/java/org/apache/asterix/runtime/aggregates/serializable/std/SerializableSqlSumAggregateFunction.java
@@ -26,14 +26,15 @@
 import org.apache.asterix.om.types.ATypeTag;
 import org.apache.asterix.om.types.BuiltinType;
 import org.apache.hyracks.algebricks.common.exceptions.AlgebricksException;
-import org.apache.hyracks.algebricks.runtime.base.ICopyEvaluatorFactory;
+import org.apache.hyracks.algebricks.runtime.base.IScalarEvaluatorFactory;
+import org.apache.hyracks.api.context.IHyracksTaskContext;
 
 public class SerializableSqlSumAggregateFunction extends AbstractSerializableSumAggregateFunction {
     private final boolean isLocalAgg;
 
-    public SerializableSqlSumAggregateFunction(ICopyEvaluatorFactory[] args, boolean isLocalAgg)
-            throws AlgebricksException {
-        super(args);
+    public SerializableSqlSumAggregateFunction(IScalarEvaluatorFactory[] args, boolean isLocalAgg,
+            IHyracksTaskContext context) throws AlgebricksException {
+        super(args, context);
         this.isLocalAgg = isLocalAgg;
     }
 
diff --git a/asterix-runtime/src/main/java/org/apache/asterix/runtime/aggregates/serializable/std/SerializableSumAggregateDescriptor.java b/asterix-runtime/src/main/java/org/apache/asterix/runtime/aggregates/serializable/std/SerializableSumAggregateDescriptor.java
index 74717ed..8a7cdef 100644
--- a/asterix-runtime/src/main/java/org/apache/asterix/runtime/aggregates/serializable/std/SerializableSumAggregateDescriptor.java
+++ b/asterix-runtime/src/main/java/org/apache/asterix/runtime/aggregates/serializable/std/SerializableSumAggregateDescriptor.java
@@ -24,14 +24,16 @@
 import org.apache.asterix.runtime.aggregates.base.AbstractSerializableAggregateFunctionDynamicDescriptor;
 import org.apache.hyracks.algebricks.common.exceptions.AlgebricksException;
 import org.apache.hyracks.algebricks.core.algebra.functions.FunctionIdentifier;
-import org.apache.hyracks.algebricks.runtime.base.ICopyEvaluatorFactory;
-import org.apache.hyracks.algebricks.runtime.base.ICopySerializableAggregateFunction;
-import org.apache.hyracks.algebricks.runtime.base.ICopySerializableAggregateFunctionFactory;
+import org.apache.hyracks.algebricks.runtime.base.IScalarEvaluatorFactory;
+import org.apache.hyracks.algebricks.runtime.base.ISerializedAggregateEvaluator;
+import org.apache.hyracks.algebricks.runtime.base.ISerializedAggregateEvaluatorFactory;
+import org.apache.hyracks.api.context.IHyracksTaskContext;
 
 public class SerializableSumAggregateDescriptor extends AbstractSerializableAggregateFunctionDynamicDescriptor {
 
     private static final long serialVersionUID = 1L;
     public static final IFunctionDescriptorFactory FACTORY = new IFunctionDescriptorFactory() {
+        @Override
         public IFunctionDescriptor createFunctionDescriptor() {
             return new SerializableSumAggregateDescriptor();
         }
@@ -43,14 +45,15 @@
     }
 
     @Override
-    public ICopySerializableAggregateFunctionFactory createSerializableAggregateFunctionFactory(
-            final ICopyEvaluatorFactory[] args) throws AlgebricksException {
-        return new ICopySerializableAggregateFunctionFactory() {
+    public ISerializedAggregateEvaluatorFactory createSerializableAggregateEvaluatorFactory(
+            final IScalarEvaluatorFactory[] args) throws AlgebricksException {
+        return new ISerializedAggregateEvaluatorFactory() {
             private static final long serialVersionUID = 1L;
 
             @Override
-            public ICopySerializableAggregateFunction createAggregateFunction() throws AlgebricksException {
-                return new SerializableSumAggregateFunction(args, false);
+            public ISerializedAggregateEvaluator createAggregateEvaluator(IHyracksTaskContext ctx)
+                    throws AlgebricksException {
+                return new SerializableSumAggregateFunction(args, false, ctx);
             }
         };
     }
diff --git a/asterix-runtime/src/main/java/org/apache/asterix/runtime/aggregates/serializable/std/SerializableSumAggregateFunction.java b/asterix-runtime/src/main/java/org/apache/asterix/runtime/aggregates/serializable/std/SerializableSumAggregateFunction.java
index ef0dc3b..e5190ae 100644
--- a/asterix-runtime/src/main/java/org/apache/asterix/runtime/aggregates/serializable/std/SerializableSumAggregateFunction.java
+++ b/asterix-runtime/src/main/java/org/apache/asterix/runtime/aggregates/serializable/std/SerializableSumAggregateFunction.java
@@ -27,14 +27,15 @@
 import org.apache.asterix.om.types.BuiltinType;
 import org.apache.asterix.om.types.EnumDeserializer;
 import org.apache.hyracks.algebricks.common.exceptions.AlgebricksException;
-import org.apache.hyracks.algebricks.runtime.base.ICopyEvaluatorFactory;
+import org.apache.hyracks.algebricks.runtime.base.IScalarEvaluatorFactory;
+import org.apache.hyracks.api.context.IHyracksTaskContext;
 
 public class SerializableSumAggregateFunction extends AbstractSerializableSumAggregateFunction {
     private final boolean isLocalAgg;
 
-    public SerializableSumAggregateFunction(ICopyEvaluatorFactory[] args, boolean isLocalAgg)
-            throws AlgebricksException {
-        super(args);
+    public SerializableSumAggregateFunction(IScalarEvaluatorFactory[] args, boolean isLocalAgg,
+            IHyracksTaskContext context) throws AlgebricksException {
+        super(args, context);
         this.isLocalAgg = isLocalAgg;
     }
 
diff --git a/asterix-runtime/src/main/java/org/apache/asterix/runtime/aggregates/std/AbstractAvgAggregateFunction.java b/asterix-runtime/src/main/java/org/apache/asterix/runtime/aggregates/std/AbstractAvgAggregateFunction.java
index 37d4b05..a57aacd 100644
--- a/asterix-runtime/src/main/java/org/apache/asterix/runtime/aggregates/std/AbstractAvgAggregateFunction.java
+++ b/asterix-runtime/src/main/java/org/apache/asterix/runtime/aggregates/std/AbstractAvgAggregateFunction.java
@@ -46,37 +46,39 @@
 import org.apache.asterix.runtime.evaluators.common.ClosedRecordConstructorEvalFactory.ClosedRecordConstructorEval;
 import org.apache.hyracks.algebricks.common.exceptions.AlgebricksException;
 import org.apache.hyracks.algebricks.common.exceptions.NotImplementedException;
-import org.apache.hyracks.algebricks.runtime.base.ICopyAggregateFunction;
-import org.apache.hyracks.algebricks.runtime.base.ICopyEvaluator;
-import org.apache.hyracks.algebricks.runtime.base.ICopyEvaluatorFactory;
+import org.apache.hyracks.algebricks.runtime.base.IAggregateEvaluator;
+import org.apache.hyracks.algebricks.runtime.base.IScalarEvaluator;
+import org.apache.hyracks.algebricks.runtime.base.IScalarEvaluatorFactory;
+import org.apache.hyracks.api.context.IHyracksTaskContext;
 import org.apache.hyracks.api.dataflow.value.ISerializerDeserializer;
-import org.apache.hyracks.data.std.api.IDataOutputProvider;
+import org.apache.hyracks.data.std.api.IPointable;
+import org.apache.hyracks.data.std.primitive.VoidPointable;
 import org.apache.hyracks.data.std.util.ArrayBackedValueStorage;
 import org.apache.hyracks.data.std.util.ByteArrayAccessibleOutputStream;
 import org.apache.hyracks.dataflow.common.data.accessors.IFrameTupleReference;
 
-public abstract class AbstractAvgAggregateFunction implements ICopyAggregateFunction {
+public abstract class AbstractAvgAggregateFunction implements IAggregateEvaluator {
     private static final int SUM_FIELD_ID = 0;
     private static final int COUNT_FIELD_ID = 1;
 
     private final ARecordType recType;
 
-    private DataOutput out;
-    private ArrayBackedValueStorage inputVal = new ArrayBackedValueStorage();
-    private ICopyEvaluator eval;
+    private ArrayBackedValueStorage resultStorage = new ArrayBackedValueStorage();
+    private IPointable inputVal = new VoidPointable();
+    private IScalarEvaluator eval;
     protected ATypeTag aggType;
     private double sum;
     private long count;
     private AMutableDouble aDouble = new AMutableDouble(0);
     private AMutableInt64 aInt64 = new AMutableInt64(0);
 
-    private ArrayBackedValueStorage avgBytes = new ArrayBackedValueStorage();
+    private IPointable avgBytes = new VoidPointable();
     private ByteArrayAccessibleOutputStream sumBytes = new ByteArrayAccessibleOutputStream();
     private DataOutput sumBytesOutput = new DataOutputStream(sumBytes);
     private ByteArrayAccessibleOutputStream countBytes = new ByteArrayAccessibleOutputStream();
     private DataOutput countBytesOutput = new DataOutputStream(countBytes);
-    private ICopyEvaluator evalSum = new AccessibleByteArrayEval(avgBytes.getDataOutput(), sumBytes);
-    private ICopyEvaluator evalCount = new AccessibleByteArrayEval(avgBytes.getDataOutput(), countBytes);
+    private IScalarEvaluator evalSum = new AccessibleByteArrayEval(sumBytes);
+    private IScalarEvaluator evalCount = new AccessibleByteArrayEval(countBytes);
     private ClosedRecordConstructorEval recordEval;
 
     @SuppressWarnings("unchecked")
@@ -89,15 +91,13 @@
     private ISerializerDeserializer<ANull> nullSerde = AqlSerializerDeserializerProvider.INSTANCE
             .getSerializerDeserializer(BuiltinType.ANULL);
 
-    public AbstractAvgAggregateFunction(ICopyEvaluatorFactory[] args, IDataOutputProvider output)
+    public AbstractAvgAggregateFunction(IScalarEvaluatorFactory[] args, IHyracksTaskContext context)
             throws AlgebricksException {
-        eval = args[0].createEvaluator(inputVal);
-        out = output.getDataOutput();
+        eval = args[0].createScalarEvaluator(context);
 
         recType = new ARecordType(null, new String[] { "sum", "count" },
                 new IAType[] { BuiltinType.ADOUBLE, BuiltinType.AINT64 }, false);
-        recordEval = new ClosedRecordConstructorEval(recType, new ICopyEvaluator[] { evalSum, evalCount }, avgBytes,
-                out);
+        recordEval = new ClosedRecordConstructorEval(recType, new IScalarEvaluator[] { evalSum, evalCount });
     }
 
     @Override
@@ -111,10 +111,10 @@
     public abstract void step(IFrameTupleReference tuple) throws AlgebricksException;
 
     @Override
-    public abstract void finish() throws AlgebricksException;
+    public abstract void finish(IPointable result) throws AlgebricksException;
 
     @Override
-    public abstract void finishPartial() throws AlgebricksException;
+    public abstract void finishPartial(IPointable result) throws AlgebricksException;
 
     protected abstract void processNull();
 
@@ -122,9 +122,11 @@
         if (skipStep()) {
             return;
         }
-        inputVal.reset();
-        eval.evaluate(tuple);
-        ATypeTag typeTag = EnumDeserializer.ATYPETAGDESERIALIZER.deserialize(inputVal.getByteArray()[0]);
+        eval.evaluate(tuple, inputVal);
+        byte[] data = inputVal.getByteArray();
+        int offset = inputVal.getStartOffset();
+
+        ATypeTag typeTag = EnumDeserializer.ATYPETAGDESERIALIZER.deserialize(data[offset]);
         if (typeTag == ATypeTag.NULL) {
             processNull();
             return;
@@ -139,32 +141,32 @@
         ++count;
         switch (typeTag) {
             case INT8: {
-                byte val = AInt8SerializerDeserializer.getByte(inputVal.getByteArray(), 1);
+                byte val = AInt8SerializerDeserializer.getByte(data, offset + 1);
                 sum += val;
                 break;
             }
             case INT16: {
-                short val = AInt16SerializerDeserializer.getShort(inputVal.getByteArray(), 1);
+                short val = AInt16SerializerDeserializer.getShort(data, offset + 1);
                 sum += val;
                 break;
             }
             case INT32: {
-                int val = AInt32SerializerDeserializer.getInt(inputVal.getByteArray(), 1);
+                int val = AInt32SerializerDeserializer.getInt(data, offset + 1);
                 sum += val;
                 break;
             }
             case INT64: {
-                long val = AInt64SerializerDeserializer.getLong(inputVal.getByteArray(), 1);
+                long val = AInt64SerializerDeserializer.getLong(data, offset + 1);
                 sum += val;
                 break;
             }
             case FLOAT: {
-                float val = AFloatSerializerDeserializer.getFloat(inputVal.getByteArray(), 1);
+                float val = AFloatSerializerDeserializer.getFloat(data, offset + 1);
                 sum += val;
                 break;
             }
             case DOUBLE: {
-                double val = ADoubleSerializerDeserializer.getDouble(inputVal.getByteArray(), 1);
+                double val = ADoubleSerializerDeserializer.getDouble(data, offset + 1);
                 sum += val;
                 break;
             }
@@ -172,19 +174,21 @@
                 throw new NotImplementedException("Cannot compute AVG for values of type " + typeTag);
             }
         }
-        inputVal.reset();
     }
 
-    protected void finishPartialResults() throws AlgebricksException {
+    protected void finishPartialResults(IPointable result) throws AlgebricksException {
+        resultStorage.reset();
         try {
             // Double check that count 0 is accounted
             if (aggType == ATypeTag.SYSTEM_NULL) {
                 if (GlobalConfig.DEBUG) {
                     GlobalConfig.ASTERIX_LOGGER.finest("AVG aggregate ran over empty input.");
                 }
-                out.writeByte(ATypeTag.SERIALIZED_SYSTEM_NULL_TYPE_TAG);
+                resultStorage.getDataOutput().writeByte(ATypeTag.SERIALIZED_SYSTEM_NULL_TYPE_TAG);
+                result.set(resultStorage);
             } else if (aggType == ATypeTag.NULL) {
-                out.writeByte(ATypeTag.SERIALIZED_NULL_TYPE_TAG);
+                resultStorage.getDataOutput().writeByte(ATypeTag.SERIALIZED_NULL_TYPE_TAG);
+                result.set(resultStorage);
             } else {
                 sumBytes.reset();
                 aDouble.setValue(sum);
@@ -192,7 +196,8 @@
                 countBytes.reset();
                 aInt64.setValue(count);
                 longSerde.serialize(aInt64, countBytesOutput);
-                recordEval.evaluate(null);
+                recordEval.evaluate(null, avgBytes);
+                result.set(avgBytes);
             }
         } catch (IOException e) {
             throw new AlgebricksException(e);
@@ -203,10 +208,10 @@
         if (skipStep()) {
             return;
         }
-        inputVal.reset();
-        eval.evaluate(tuple);
+        eval.evaluate(tuple, inputVal);
         byte[] serBytes = inputVal.getByteArray();
-        ATypeTag typeTag = EnumDeserializer.ATYPETAGDESERIALIZER.deserialize(serBytes[0]);
+        int offset = inputVal.getStartOffset();
+        ATypeTag typeTag = EnumDeserializer.ATYPETAGDESERIALIZER.deserialize(serBytes[offset]);
         switch (typeTag) {
             case NULL: {
                 processNull();
@@ -220,11 +225,11 @@
                 // Expected.
                 aggType = ATypeTag.DOUBLE;
                 int nullBitmapSize = 0;
-                int offset1 = ARecordSerializerDeserializer.getFieldOffsetById(serBytes, SUM_FIELD_ID, nullBitmapSize,
-                        false);
+                int offset1 = ARecordSerializerDeserializer.getFieldOffsetById(serBytes, offset, SUM_FIELD_ID,
+                        nullBitmapSize, false);
                 sum += ADoubleSerializerDeserializer.getDouble(serBytes, offset1);
-                int offset2 = ARecordSerializerDeserializer.getFieldOffsetById(serBytes, COUNT_FIELD_ID, nullBitmapSize,
-                        false);
+                int offset2 = ARecordSerializerDeserializer.getFieldOffsetById(serBytes, offset, COUNT_FIELD_ID,
+                        nullBitmapSize, false);
                 count += AInt64SerializerDeserializer.getLong(serBytes, offset2);
                 break;
             }
@@ -235,17 +240,19 @@
         }
     }
 
-    protected void finishFinalResults() throws AlgebricksException {
+    protected void finishFinalResults(IPointable result) throws AlgebricksException {
+        resultStorage.reset();
         try {
             if (count == 0 || aggType == ATypeTag.NULL) {
-                nullSerde.serialize(ANull.NULL, out);
+                nullSerde.serialize(ANull.NULL, resultStorage.getDataOutput());
             } else {
                 aDouble.setValue(sum / count);
-                doubleSerde.serialize(aDouble, out);
+                doubleSerde.serialize(aDouble, resultStorage.getDataOutput());
             }
         } catch (IOException e) {
             throw new AlgebricksException(e);
         }
+        result.set(resultStorage);
     }
 
     protected boolean skipStep() {
diff --git a/asterix-runtime/src/main/java/org/apache/asterix/runtime/aggregates/std/AbstractCountAggregateFunction.java b/asterix-runtime/src/main/java/org/apache/asterix/runtime/aggregates/std/AbstractCountAggregateFunction.java
index 9523d90..f93617d 100644
--- a/asterix-runtime/src/main/java/org/apache/asterix/runtime/aggregates/std/AbstractCountAggregateFunction.java
+++ b/asterix-runtime/src/main/java/org/apache/asterix/runtime/aggregates/std/AbstractCountAggregateFunction.java
@@ -18,7 +18,6 @@
  */
 package org.apache.asterix.runtime.aggregates.std;
 
-import java.io.DataOutput;
 import java.io.IOException;
 
 import org.apache.asterix.formats.nontagged.AqlSerializerDeserializerProvider;
@@ -28,31 +27,33 @@
 import org.apache.asterix.om.types.BuiltinType;
 import org.apache.asterix.om.types.EnumDeserializer;
 import org.apache.hyracks.algebricks.common.exceptions.AlgebricksException;
-import org.apache.hyracks.algebricks.runtime.base.ICopyAggregateFunction;
-import org.apache.hyracks.algebricks.runtime.base.ICopyEvaluator;
-import org.apache.hyracks.algebricks.runtime.base.ICopyEvaluatorFactory;
+import org.apache.hyracks.algebricks.runtime.base.IAggregateEvaluator;
+import org.apache.hyracks.algebricks.runtime.base.IScalarEvaluator;
+import org.apache.hyracks.algebricks.runtime.base.IScalarEvaluatorFactory;
+import org.apache.hyracks.api.context.IHyracksTaskContext;
 import org.apache.hyracks.api.dataflow.value.ISerializerDeserializer;
-import org.apache.hyracks.data.std.api.IDataOutputProvider;
+import org.apache.hyracks.data.std.api.IPointable;
+import org.apache.hyracks.data.std.primitive.VoidPointable;
 import org.apache.hyracks.data.std.util.ArrayBackedValueStorage;
 import org.apache.hyracks.dataflow.common.data.accessors.IFrameTupleReference;
 
 /**
  * COUNT returns the number of items in the given list. Note that COUNT(NULL) is not allowed.
  */
-public abstract class AbstractCountAggregateFunction implements ICopyAggregateFunction {
+public abstract class AbstractCountAggregateFunction implements IAggregateEvaluator {
     private AMutableInt64 result = new AMutableInt64(-1);
     @SuppressWarnings("unchecked")
     private ISerializerDeserializer<AInt64> int64Serde = AqlSerializerDeserializerProvider.INSTANCE
             .getSerializerDeserializer(BuiltinType.AINT64);
-    private ArrayBackedValueStorage inputVal = new ArrayBackedValueStorage();
-    private ICopyEvaluator eval;
+    private IPointable inputVal = new VoidPointable();
+    private IScalarEvaluator eval;
     protected long cnt;
-    private DataOutput out;
 
-    public AbstractCountAggregateFunction(ICopyEvaluatorFactory[] args, IDataOutputProvider output)
+    private ArrayBackedValueStorage resultStorage = new ArrayBackedValueStorage();
+
+    public AbstractCountAggregateFunction(IScalarEvaluatorFactory[] args, IHyracksTaskContext context)
             throws AlgebricksException {
-        eval = args[0].createEvaluator(inputVal);
-        out = output.getDataOutput();
+        eval = args[0].createScalarEvaluator(context);
     }
 
     @Override
@@ -62,9 +63,9 @@
 
     @Override
     public void step(IFrameTupleReference tuple) throws AlgebricksException {
-        inputVal.reset();
-        eval.evaluate(tuple);
-        ATypeTag typeTag = EnumDeserializer.ATYPETAGDESERIALIZER.deserialize(inputVal.getByteArray()[0]);
+        eval.evaluate(tuple, inputVal);
+        ATypeTag typeTag = EnumDeserializer.ATYPETAGDESERIALIZER
+                .deserialize(inputVal.getByteArray()[inputVal.getStartOffset()]);
         // Ignore SYSTEM_NULL.
         if (typeTag == ATypeTag.NULL) {
             processNull();
@@ -74,18 +75,20 @@
     }
 
     @Override
-    public void finish() throws AlgebricksException {
+    public void finish(IPointable resultPointable) throws AlgebricksException {
+        resultStorage.reset();
         try {
             result.setValue(cnt);
-            int64Serde.serialize(result, out);
+            int64Serde.serialize(result, resultStorage.getDataOutput());
         } catch (IOException e) {
             throw new AlgebricksException(e);
         }
+        resultPointable.set(resultStorage);
     }
 
     @Override
-    public void finishPartial() throws AlgebricksException {
-        finish();
+    public void finishPartial(IPointable resultPointable) throws AlgebricksException {
+        finish(resultPointable);
     }
 
     protected abstract void processNull();
diff --git a/asterix-runtime/src/main/java/org/apache/asterix/runtime/aggregates/std/AbstractMinMaxAggregateFunction.java b/asterix-runtime/src/main/java/org/apache/asterix/runtime/aggregates/std/AbstractMinMaxAggregateFunction.java
index e934ddb..c5a0104 100644
--- a/asterix-runtime/src/main/java/org/apache/asterix/runtime/aggregates/std/AbstractMinMaxAggregateFunction.java
+++ b/asterix-runtime/src/main/java/org/apache/asterix/runtime/aggregates/std/AbstractMinMaxAggregateFunction.java
@@ -18,7 +18,6 @@
  */
 package org.apache.asterix.runtime.aggregates.std;
 
-import java.io.DataOutput;
 import java.io.IOException;
 
 import org.apache.asterix.formats.nontagged.AqlBinaryComparatorFactoryProvider;
@@ -27,46 +26,48 @@
 import org.apache.asterix.om.types.hierachy.ATypeHierarchy;
 import org.apache.asterix.om.types.hierachy.ITypeConvertComputer;
 import org.apache.hyracks.algebricks.common.exceptions.AlgebricksException;
-import org.apache.hyracks.algebricks.runtime.base.ICopyAggregateFunction;
-import org.apache.hyracks.algebricks.runtime.base.ICopyEvaluator;
-import org.apache.hyracks.algebricks.runtime.base.ICopyEvaluatorFactory;
+import org.apache.hyracks.algebricks.runtime.base.IAggregateEvaluator;
+import org.apache.hyracks.algebricks.runtime.base.IScalarEvaluator;
+import org.apache.hyracks.algebricks.runtime.base.IScalarEvaluatorFactory;
+import org.apache.hyracks.api.context.IHyracksTaskContext;
 import org.apache.hyracks.api.dataflow.value.IBinaryComparator;
 import org.apache.hyracks.api.dataflow.value.IBinaryComparatorFactory;
 import org.apache.hyracks.api.exceptions.HyracksDataException;
-import org.apache.hyracks.data.std.api.IDataOutputProvider;
+import org.apache.hyracks.data.std.api.IPointable;
+import org.apache.hyracks.data.std.primitive.VoidPointable;
 import org.apache.hyracks.data.std.util.ArrayBackedValueStorage;
 import org.apache.hyracks.dataflow.common.data.accessors.IFrameTupleReference;
 
-public abstract class AbstractMinMaxAggregateFunction implements ICopyAggregateFunction {
-    private ArrayBackedValueStorage inputVal = new ArrayBackedValueStorage();
+public abstract class AbstractMinMaxAggregateFunction implements IAggregateEvaluator {
+    private IPointable inputVal = new VoidPointable();
     private ArrayBackedValueStorage outputVal = new ArrayBackedValueStorage();
     private ArrayBackedValueStorage tempValForCasting = new ArrayBackedValueStorage();
-    protected DataOutput out;
-    private ICopyEvaluator eval;
+
+    protected ArrayBackedValueStorage resultStorage = new ArrayBackedValueStorage();
+    private IScalarEvaluator eval;
     protected ATypeTag aggType;
     private IBinaryComparator cmp;
     private ITypeConvertComputer tpc;
     private final boolean isMin;
 
-    public AbstractMinMaxAggregateFunction(ICopyEvaluatorFactory[] args, IDataOutputProvider provider, boolean isMin)
+    public AbstractMinMaxAggregateFunction(IScalarEvaluatorFactory[] args, IHyracksTaskContext context, boolean isMin)
             throws AlgebricksException {
-        out = provider.getDataOutput();
-        eval = args[0].createEvaluator(inputVal);
+        eval = args[0].createScalarEvaluator(context);
         this.isMin = isMin;
     }
 
     @Override
     public void init() {
         aggType = ATypeTag.SYSTEM_NULL;
-        outputVal.reset();
         tempValForCasting.reset();
     }
 
     @Override
     public void step(IFrameTupleReference tuple) throws AlgebricksException {
-        inputVal.reset();
-        eval.evaluate(tuple);
-        ATypeTag typeTag = EnumDeserializer.ATYPETAGDESERIALIZER.deserialize(inputVal.getByteArray()[0]);
+        eval.evaluate(tuple, inputVal);
+
+        ATypeTag typeTag = EnumDeserializer.ATYPETAGDESERIALIZER
+                .deserialize(inputVal.getByteArray()[inputVal.getStartOffset()]);
         if (typeTag == ATypeTag.NULL) {
             processNull();
             return;
@@ -110,7 +111,6 @@
                     } catch (IOException e) {
                         throw new AlgebricksException(e);
                     }
-                    outputVal.reset();
                     outputVal.assign(tempValForCasting);
                 }
                 try {
@@ -157,19 +157,22 @@
     }
 
     @Override
-    public void finish() throws AlgebricksException {
+    public void finish(IPointable result) throws AlgebricksException {
+        resultStorage.reset();
         try {
             switch (aggType) {
                 case NULL: {
-                    out.writeByte(ATypeTag.SERIALIZED_NULL_TYPE_TAG);
+                    resultStorage.getDataOutput().writeByte(ATypeTag.SERIALIZED_NULL_TYPE_TAG);
+                    result.set(resultStorage);
                     break;
                 }
                 case SYSTEM_NULL: {
                     finishSystemNull();
+                    result.set(resultStorage);
                     break;
                 }
                 default: {
-                    out.write(outputVal.getByteArray(), outputVal.getStartOffset(), outputVal.getLength());
+                    result.set(outputVal);
                     break;
                 }
             }
@@ -179,8 +182,8 @@
     }
 
     @Override
-    public void finishPartial() throws AlgebricksException {
-        finish();
+    public void finishPartial(IPointable result) throws AlgebricksException {
+        finish(result);
     }
 
     protected boolean skipStep() {
diff --git a/asterix-runtime/src/main/java/org/apache/asterix/runtime/aggregates/std/AbstractSumAggregateFunction.java b/asterix-runtime/src/main/java/org/apache/asterix/runtime/aggregates/std/AbstractSumAggregateFunction.java
index fcf1850..2948887 100644
--- a/asterix-runtime/src/main/java/org/apache/asterix/runtime/aggregates/std/AbstractSumAggregateFunction.java
+++ b/asterix-runtime/src/main/java/org/apache/asterix/runtime/aggregates/std/AbstractSumAggregateFunction.java
@@ -18,7 +18,6 @@
  */
 package org.apache.asterix.runtime.aggregates.std;
 
-import java.io.DataOutput;
 import java.io.IOException;
 
 import org.apache.asterix.dataflow.data.nontagged.serde.ADoubleSerializerDeserializer;
@@ -41,18 +40,20 @@
 import org.apache.asterix.om.types.hierachy.ATypeHierarchy;
 import org.apache.hyracks.algebricks.common.exceptions.AlgebricksException;
 import org.apache.hyracks.algebricks.common.exceptions.NotImplementedException;
-import org.apache.hyracks.algebricks.runtime.base.ICopyAggregateFunction;
-import org.apache.hyracks.algebricks.runtime.base.ICopyEvaluator;
-import org.apache.hyracks.algebricks.runtime.base.ICopyEvaluatorFactory;
+import org.apache.hyracks.algebricks.runtime.base.IAggregateEvaluator;
+import org.apache.hyracks.algebricks.runtime.base.IScalarEvaluator;
+import org.apache.hyracks.algebricks.runtime.base.IScalarEvaluatorFactory;
+import org.apache.hyracks.api.context.IHyracksTaskContext;
 import org.apache.hyracks.api.dataflow.value.ISerializerDeserializer;
-import org.apache.hyracks.data.std.api.IDataOutputProvider;
+import org.apache.hyracks.data.std.api.IPointable;
+import org.apache.hyracks.data.std.primitive.VoidPointable;
 import org.apache.hyracks.data.std.util.ArrayBackedValueStorage;
 import org.apache.hyracks.dataflow.common.data.accessors.IFrameTupleReference;
 
-public abstract class AbstractSumAggregateFunction implements ICopyAggregateFunction {
-    protected DataOutput out;
-    private ArrayBackedValueStorage inputVal = new ArrayBackedValueStorage();
-    private ICopyEvaluator eval;
+public abstract class AbstractSumAggregateFunction implements IAggregateEvaluator {
+    protected ArrayBackedValueStorage resultStorage = new ArrayBackedValueStorage();
+    private IPointable inputVal = new VoidPointable();
+    private IScalarEvaluator eval;
     private double sum;
     protected ATypeTag aggType;
     private AMutableDouble aDouble = new AMutableDouble(0);
@@ -64,10 +65,9 @@
     @SuppressWarnings("rawtypes")
     protected ISerializerDeserializer serde;
 
-    public AbstractSumAggregateFunction(ICopyEvaluatorFactory[] args, IDataOutputProvider provider)
+    public AbstractSumAggregateFunction(IScalarEvaluatorFactory[] args, IHyracksTaskContext context)
             throws AlgebricksException {
-        out = provider.getDataOutput();
-        eval = args[0].createEvaluator(inputVal);
+        eval = args[0].createScalarEvaluator(context);
     }
 
     @Override
@@ -81,9 +81,11 @@
         if (skipStep()) {
             return;
         }
-        inputVal.reset();
-        eval.evaluate(tuple);
-        ATypeTag typeTag = EnumDeserializer.ATYPETAGDESERIALIZER.deserialize(inputVal.getByteArray()[0]);
+        eval.evaluate(tuple, inputVal);
+        byte[] data = inputVal.getByteArray();
+        int offset = inputVal.getStartOffset();
+
+        ATypeTag typeTag = EnumDeserializer.ATYPETAGDESERIALIZER.deserialize(data[offset]);
         if (typeTag == ATypeTag.NULL) {
             processNull();
             return;
@@ -100,32 +102,32 @@
 
         switch (typeTag) {
             case INT8: {
-                byte val = AInt8SerializerDeserializer.getByte(inputVal.getByteArray(), 1);
+                byte val = AInt8SerializerDeserializer.getByte(data, offset + 1);
                 sum += val;
                 break;
             }
             case INT16: {
-                short val = AInt16SerializerDeserializer.getShort(inputVal.getByteArray(), 1);
+                short val = AInt16SerializerDeserializer.getShort(data, offset + 1);
                 sum += val;
                 break;
             }
             case INT32: {
-                int val = AInt32SerializerDeserializer.getInt(inputVal.getByteArray(), 1);
+                int val = AInt32SerializerDeserializer.getInt(data, offset + 1);
                 sum += val;
                 break;
             }
             case INT64: {
-                long val = AInt64SerializerDeserializer.getLong(inputVal.getByteArray(), 1);
+                long val = AInt64SerializerDeserializer.getLong(data, offset + 1);
                 sum += val;
                 break;
             }
             case FLOAT: {
-                float val = AFloatSerializerDeserializer.getFloat(inputVal.getByteArray(), 1);
+                float val = AFloatSerializerDeserializer.getFloat(data, offset + 1);
                 sum += val;
                 break;
             }
             case DOUBLE: {
-                double val = ADoubleSerializerDeserializer.getDouble(inputVal.getByteArray(), 1);
+                double val = ADoubleSerializerDeserializer.getDouble(data, offset + 1);
                 sum += val;
                 break;
             }
@@ -144,48 +146,49 @@
 
     @SuppressWarnings("unchecked")
     @Override
-    public void finish() throws AlgebricksException {
+    public void finish(IPointable result) throws AlgebricksException {
+        resultStorage.reset();
         try {
             switch (aggType) {
                 case INT8: {
                     serde = AqlSerializerDeserializerProvider.INSTANCE.getSerializerDeserializer(BuiltinType.AINT8);
                     aInt8.setValue((byte) sum);
-                    serde.serialize(aInt8, out);
+                    serde.serialize(aInt8, resultStorage.getDataOutput());
                     break;
                 }
                 case INT16: {
                     serde = AqlSerializerDeserializerProvider.INSTANCE.getSerializerDeserializer(BuiltinType.AINT16);
                     aInt16.setValue((short) sum);
-                    serde.serialize(aInt16, out);
+                    serde.serialize(aInt16, resultStorage.getDataOutput());
                     break;
                 }
                 case INT32: {
                     serde = AqlSerializerDeserializerProvider.INSTANCE.getSerializerDeserializer(BuiltinType.AINT32);
                     aInt32.setValue((int) sum);
-                    serde.serialize(aInt32, out);
+                    serde.serialize(aInt32, resultStorage.getDataOutput());
                     break;
                 }
                 case INT64: {
                     serde = AqlSerializerDeserializerProvider.INSTANCE.getSerializerDeserializer(BuiltinType.AINT64);
                     aInt64.setValue((long) sum);
-                    serde.serialize(aInt64, out);
+                    serde.serialize(aInt64, resultStorage.getDataOutput());
                     break;
                 }
                 case FLOAT: {
                     serde = AqlSerializerDeserializerProvider.INSTANCE.getSerializerDeserializer(BuiltinType.AFLOAT);
                     aFloat.setValue((float) sum);
-                    serde.serialize(aFloat, out);
+                    serde.serialize(aFloat, resultStorage.getDataOutput());
                     break;
                 }
                 case DOUBLE: {
                     serde = AqlSerializerDeserializerProvider.INSTANCE.getSerializerDeserializer(BuiltinType.ADOUBLE);
                     aDouble.setValue(sum);
-                    serde.serialize(aDouble, out);
+                    serde.serialize(aDouble, resultStorage.getDataOutput());
                     break;
                 }
                 case NULL: {
                     serde = AqlSerializerDeserializerProvider.INSTANCE.getSerializerDeserializer(BuiltinType.ANULL);
-                    serde.serialize(ANull.NULL, out);
+                    serde.serialize(ANull.NULL, resultStorage.getDataOutput());
                     break;
                 }
                 case SYSTEM_NULL: {
@@ -193,23 +196,27 @@
                     break;
                 }
                 default:
-                    throw new AlgebricksException("SumAggregationFunction: incompatible type for the result ("
-                            + aggType + "). ");
+                    throw new AlgebricksException(
+                            "SumAggregationFunction: incompatible type for the result (" + aggType + "). ");
             }
         } catch (IOException e) {
             throw new AlgebricksException(e);
         }
+        result.set(resultStorage);
     }
 
     @Override
-    public void finishPartial() throws AlgebricksException {
-        finish();
+    public void finishPartial(IPointable result) throws AlgebricksException {
+        finish(result);
     }
 
     protected boolean skipStep() {
         return false;
     }
+
     protected abstract void processNull();
+
     protected abstract void processSystemNull() throws AlgebricksException;
+
     protected abstract void finishSystemNull() throws IOException;
 }
diff --git a/asterix-runtime/src/main/java/org/apache/asterix/runtime/aggregates/std/AvgAggregateDescriptor.java b/asterix-runtime/src/main/java/org/apache/asterix/runtime/aggregates/std/AvgAggregateDescriptor.java
index 0c24ef1..2b5c9bb 100644
--- a/asterix-runtime/src/main/java/org/apache/asterix/runtime/aggregates/std/AvgAggregateDescriptor.java
+++ b/asterix-runtime/src/main/java/org/apache/asterix/runtime/aggregates/std/AvgAggregateDescriptor.java
@@ -25,15 +25,16 @@
 import org.apache.asterix.runtime.aggregates.base.AbstractAggregateFunctionDynamicDescriptor;
 import org.apache.hyracks.algebricks.common.exceptions.AlgebricksException;
 import org.apache.hyracks.algebricks.core.algebra.functions.FunctionIdentifier;
-import org.apache.hyracks.algebricks.runtime.base.ICopyAggregateFunction;
-import org.apache.hyracks.algebricks.runtime.base.ICopyAggregateFunctionFactory;
-import org.apache.hyracks.algebricks.runtime.base.ICopyEvaluatorFactory;
-import org.apache.hyracks.data.std.api.IDataOutputProvider;
+import org.apache.hyracks.algebricks.runtime.base.IAggregateEvaluator;
+import org.apache.hyracks.algebricks.runtime.base.IAggregateEvaluatorFactory;
+import org.apache.hyracks.algebricks.runtime.base.IScalarEvaluatorFactory;
+import org.apache.hyracks.api.context.IHyracksTaskContext;
 
 public class AvgAggregateDescriptor extends AbstractAggregateFunctionDynamicDescriptor {
 
     private static final long serialVersionUID = 1L;
     public static final IFunctionDescriptorFactory FACTORY = new IFunctionDescriptorFactory() {
+        @Override
         public IFunctionDescriptor createFunctionDescriptor() {
             return new AvgAggregateDescriptor();
         }
@@ -45,15 +46,15 @@
     }
 
     @Override
-    public ICopyAggregateFunctionFactory createAggregateFunctionFactory(final ICopyEvaluatorFactory[] args)
+    public IAggregateEvaluatorFactory createAggregateEvaluatorFactory(final IScalarEvaluatorFactory[] args)
             throws AlgebricksException {
-        return new ICopyAggregateFunctionFactory() {
+        return new IAggregateEvaluatorFactory() {
             private static final long serialVersionUID = 1L;
 
             @Override
-            public ICopyAggregateFunction createAggregateFunction(final IDataOutputProvider provider)
+            public IAggregateEvaluator createAggregateEvaluator(final IHyracksTaskContext ctx)
                     throws AlgebricksException {
-                return new AvgAggregateFunction(args, provider);
+                return new AvgAggregateFunction(args, ctx);
             }
         };
     }
diff --git a/asterix-runtime/src/main/java/org/apache/asterix/runtime/aggregates/std/AvgAggregateFunction.java b/asterix-runtime/src/main/java/org/apache/asterix/runtime/aggregates/std/AvgAggregateFunction.java
index d62c4f1..fd52df3 100644
--- a/asterix-runtime/src/main/java/org/apache/asterix/runtime/aggregates/std/AvgAggregateFunction.java
+++ b/asterix-runtime/src/main/java/org/apache/asterix/runtime/aggregates/std/AvgAggregateFunction.java
@@ -21,14 +21,16 @@
 
 import org.apache.asterix.om.types.ATypeTag;
 import org.apache.hyracks.algebricks.common.exceptions.AlgebricksException;
-import org.apache.hyracks.algebricks.runtime.base.ICopyEvaluatorFactory;
-import org.apache.hyracks.data.std.api.IDataOutputProvider;
+import org.apache.hyracks.algebricks.runtime.base.IScalarEvaluatorFactory;
+import org.apache.hyracks.api.context.IHyracksTaskContext;
+import org.apache.hyracks.data.std.api.IPointable;
 import org.apache.hyracks.dataflow.common.data.accessors.IFrameTupleReference;
 
 public class AvgAggregateFunction extends AbstractAvgAggregateFunction {
 
-    public AvgAggregateFunction(ICopyEvaluatorFactory[] args, IDataOutputProvider output) throws AlgebricksException {
-        super(args, output);
+    public AvgAggregateFunction(IScalarEvaluatorFactory[] args, IHyracksTaskContext context)
+            throws AlgebricksException {
+        super(args, context);
     }
 
     @Override
@@ -37,13 +39,13 @@
     }
 
     @Override
-    public void finish() throws AlgebricksException {
-        finishFinalResults();
+    public void finish(IPointable result) throws AlgebricksException {
+        finishFinalResults(result);
     }
 
     @Override
-    public void finishPartial() throws AlgebricksException {
-        finish();
+    public void finishPartial(IPointable result) throws AlgebricksException {
+        finish(result);
     }
 
     @Override
diff --git a/asterix-runtime/src/main/java/org/apache/asterix/runtime/aggregates/std/CountAggregateDescriptor.java b/asterix-runtime/src/main/java/org/apache/asterix/runtime/aggregates/std/CountAggregateDescriptor.java
index 223e31b..f61da19 100644
--- a/asterix-runtime/src/main/java/org/apache/asterix/runtime/aggregates/std/CountAggregateDescriptor.java
+++ b/asterix-runtime/src/main/java/org/apache/asterix/runtime/aggregates/std/CountAggregateDescriptor.java
@@ -24,10 +24,10 @@
 import org.apache.asterix.runtime.aggregates.base.AbstractAggregateFunctionDynamicDescriptor;
 import org.apache.hyracks.algebricks.common.exceptions.AlgebricksException;
 import org.apache.hyracks.algebricks.core.algebra.functions.FunctionIdentifier;
-import org.apache.hyracks.algebricks.runtime.base.ICopyAggregateFunction;
-import org.apache.hyracks.algebricks.runtime.base.ICopyAggregateFunctionFactory;
-import org.apache.hyracks.algebricks.runtime.base.ICopyEvaluatorFactory;
-import org.apache.hyracks.data.std.api.IDataOutputProvider;
+import org.apache.hyracks.algebricks.runtime.base.IAggregateEvaluator;
+import org.apache.hyracks.algebricks.runtime.base.IAggregateEvaluatorFactory;
+import org.apache.hyracks.algebricks.runtime.base.IScalarEvaluatorFactory;
+import org.apache.hyracks.api.context.IHyracksTaskContext;
 
 /**
  * NULLs are also counted.
@@ -36,6 +36,7 @@
 
     private static final long serialVersionUID = 1L;
     public static final IFunctionDescriptorFactory FACTORY = new IFunctionDescriptorFactory() {
+        @Override
         public IFunctionDescriptor createFunctionDescriptor() {
             return new CountAggregateDescriptor();
         }
@@ -47,16 +48,15 @@
     }
 
     @Override
-    public ICopyAggregateFunctionFactory createAggregateFunctionFactory(final ICopyEvaluatorFactory[] args)
+    public IAggregateEvaluatorFactory createAggregateEvaluatorFactory(final IScalarEvaluatorFactory[] args)
             throws AlgebricksException {
-        return new ICopyAggregateFunctionFactory() {
+        return new IAggregateEvaluatorFactory() {
 
             private static final long serialVersionUID = 1L;
 
             @Override
-            public ICopyAggregateFunction createAggregateFunction(IDataOutputProvider provider)
-                    throws AlgebricksException {
-                return new CountAggregateFunction(args, provider);
+            public IAggregateEvaluator createAggregateEvaluator(IHyracksTaskContext ctx) throws AlgebricksException {
+                return new CountAggregateFunction(args, ctx);
             }
         };
     }
diff --git a/asterix-runtime/src/main/java/org/apache/asterix/runtime/aggregates/std/CountAggregateFunction.java b/asterix-runtime/src/main/java/org/apache/asterix/runtime/aggregates/std/CountAggregateFunction.java
index e594a5b..95fbca3 100644
--- a/asterix-runtime/src/main/java/org/apache/asterix/runtime/aggregates/std/CountAggregateFunction.java
+++ b/asterix-runtime/src/main/java/org/apache/asterix/runtime/aggregates/std/CountAggregateFunction.java
@@ -19,18 +19,20 @@
 package org.apache.asterix.runtime.aggregates.std;
 
 import org.apache.hyracks.algebricks.common.exceptions.AlgebricksException;
-import org.apache.hyracks.algebricks.runtime.base.ICopyEvaluatorFactory;
-import org.apache.hyracks.data.std.api.IDataOutputProvider;
+import org.apache.hyracks.algebricks.runtime.base.IScalarEvaluatorFactory;
+import org.apache.hyracks.api.context.IHyracksTaskContext;
 
 /**
  * COUNT returns the number of items in the given list. Note that COUNT(NULL) is not allowed.
  */
 public class CountAggregateFunction extends AbstractCountAggregateFunction {
 
-    public CountAggregateFunction(ICopyEvaluatorFactory[] args, IDataOutputProvider output) throws AlgebricksException {
-        super(args, output);
+    public CountAggregateFunction(IScalarEvaluatorFactory[] args, IHyracksTaskContext context)
+            throws AlgebricksException {
+        super(args, context);
     }
 
+    @Override
     protected void processNull() {
         cnt++;
     }
diff --git a/asterix-runtime/src/main/java/org/apache/asterix/runtime/aggregates/std/GlobalAvgAggregateDescriptor.java b/asterix-runtime/src/main/java/org/apache/asterix/runtime/aggregates/std/GlobalAvgAggregateDescriptor.java
index 10e6f86..edb55dc 100644
--- a/asterix-runtime/src/main/java/org/apache/asterix/runtime/aggregates/std/GlobalAvgAggregateDescriptor.java
+++ b/asterix-runtime/src/main/java/org/apache/asterix/runtime/aggregates/std/GlobalAvgAggregateDescriptor.java
@@ -25,16 +25,17 @@
 import org.apache.asterix.runtime.aggregates.base.AbstractAggregateFunctionDynamicDescriptor;
 import org.apache.hyracks.algebricks.common.exceptions.AlgebricksException;
 import org.apache.hyracks.algebricks.core.algebra.functions.FunctionIdentifier;
-import org.apache.hyracks.algebricks.runtime.base.ICopyAggregateFunction;
-import org.apache.hyracks.algebricks.runtime.base.ICopyAggregateFunctionFactory;
-import org.apache.hyracks.algebricks.runtime.base.ICopyEvaluatorFactory;
-import org.apache.hyracks.data.std.api.IDataOutputProvider;
+import org.apache.hyracks.algebricks.runtime.base.IAggregateEvaluator;
+import org.apache.hyracks.algebricks.runtime.base.IAggregateEvaluatorFactory;
+import org.apache.hyracks.algebricks.runtime.base.IScalarEvaluatorFactory;
+import org.apache.hyracks.api.context.IHyracksTaskContext;
 
 public class GlobalAvgAggregateDescriptor extends AbstractAggregateFunctionDynamicDescriptor {
 
     private static final long serialVersionUID = 1L;
 
     public static final IFunctionDescriptorFactory FACTORY = new IFunctionDescriptorFactory() {
+        @Override
         public IFunctionDescriptor createFunctionDescriptor() {
             return new GlobalAvgAggregateDescriptor();
         }
@@ -46,15 +47,15 @@
     }
 
     @Override
-    public ICopyAggregateFunctionFactory createAggregateFunctionFactory(final ICopyEvaluatorFactory[] args)
+    public IAggregateEvaluatorFactory createAggregateEvaluatorFactory(final IScalarEvaluatorFactory[] args)
             throws AlgebricksException {
-        return new ICopyAggregateFunctionFactory() {
+        return new IAggregateEvaluatorFactory() {
             private static final long serialVersionUID = 1L;
 
             @Override
-            public ICopyAggregateFunction createAggregateFunction(final IDataOutputProvider provider)
+            public IAggregateEvaluator createAggregateEvaluator(final IHyracksTaskContext ctx)
                     throws AlgebricksException {
-                return new GlobalAvgAggregateFunction(args, provider);
+                return new GlobalAvgAggregateFunction(args, ctx);
             }
         };
     }
diff --git a/asterix-runtime/src/main/java/org/apache/asterix/runtime/aggregates/std/GlobalAvgAggregateFunction.java b/asterix-runtime/src/main/java/org/apache/asterix/runtime/aggregates/std/GlobalAvgAggregateFunction.java
index 3e58d32..db01fde 100644
--- a/asterix-runtime/src/main/java/org/apache/asterix/runtime/aggregates/std/GlobalAvgAggregateFunction.java
+++ b/asterix-runtime/src/main/java/org/apache/asterix/runtime/aggregates/std/GlobalAvgAggregateFunction.java
@@ -21,15 +21,16 @@
 
 import org.apache.asterix.om.types.ATypeTag;
 import org.apache.hyracks.algebricks.common.exceptions.AlgebricksException;
-import org.apache.hyracks.algebricks.runtime.base.ICopyEvaluatorFactory;
-import org.apache.hyracks.data.std.api.IDataOutputProvider;
+import org.apache.hyracks.algebricks.runtime.base.IScalarEvaluatorFactory;
+import org.apache.hyracks.api.context.IHyracksTaskContext;
+import org.apache.hyracks.data.std.api.IPointable;
 import org.apache.hyracks.dataflow.common.data.accessors.IFrameTupleReference;
 
 public class GlobalAvgAggregateFunction extends AbstractAvgAggregateFunction {
 
-    public GlobalAvgAggregateFunction(ICopyEvaluatorFactory[] args, IDataOutputProvider output)
+    public GlobalAvgAggregateFunction(IScalarEvaluatorFactory[] args, IHyracksTaskContext context)
             throws AlgebricksException {
-        super(args, output);
+        super(args, context);
     }
 
     @Override
@@ -38,13 +39,13 @@
     }
 
     @Override
-    public void finish() throws AlgebricksException {
-        finishFinalResults();
+    public void finish(IPointable result) throws AlgebricksException {
+        finishFinalResults(result);
     }
 
     @Override
-    public void finishPartial() throws AlgebricksException {
-        finishPartialResults();
+    public void finishPartial(IPointable result) throws AlgebricksException {
+        finishPartialResults(result);
     }
 
     @Override
diff --git a/asterix-runtime/src/main/java/org/apache/asterix/runtime/aggregates/std/GlobalSqlAvgAggregateDescriptor.java b/asterix-runtime/src/main/java/org/apache/asterix/runtime/aggregates/std/GlobalSqlAvgAggregateDescriptor.java
index 6575d00..4fdec36 100644
--- a/asterix-runtime/src/main/java/org/apache/asterix/runtime/aggregates/std/GlobalSqlAvgAggregateDescriptor.java
+++ b/asterix-runtime/src/main/java/org/apache/asterix/runtime/aggregates/std/GlobalSqlAvgAggregateDescriptor.java
@@ -25,16 +25,17 @@
 import org.apache.asterix.runtime.aggregates.base.AbstractAggregateFunctionDynamicDescriptor;
 import org.apache.hyracks.algebricks.common.exceptions.AlgebricksException;
 import org.apache.hyracks.algebricks.core.algebra.functions.FunctionIdentifier;
-import org.apache.hyracks.algebricks.runtime.base.ICopyAggregateFunction;
-import org.apache.hyracks.algebricks.runtime.base.ICopyAggregateFunctionFactory;
-import org.apache.hyracks.algebricks.runtime.base.ICopyEvaluatorFactory;
-import org.apache.hyracks.data.std.api.IDataOutputProvider;
+import org.apache.hyracks.algebricks.runtime.base.IAggregateEvaluator;
+import org.apache.hyracks.algebricks.runtime.base.IAggregateEvaluatorFactory;
+import org.apache.hyracks.algebricks.runtime.base.IScalarEvaluatorFactory;
+import org.apache.hyracks.api.context.IHyracksTaskContext;
 
 public class GlobalSqlAvgAggregateDescriptor extends AbstractAggregateFunctionDynamicDescriptor {
 
     private static final long serialVersionUID = 1L;
 
     public static final IFunctionDescriptorFactory FACTORY = new IFunctionDescriptorFactory() {
+        @Override
         public IFunctionDescriptor createFunctionDescriptor() {
             return new GlobalSqlAvgAggregateDescriptor();
         }
@@ -46,15 +47,15 @@
     }
 
     @Override
-    public ICopyAggregateFunctionFactory createAggregateFunctionFactory(final ICopyEvaluatorFactory[] args)
+    public IAggregateEvaluatorFactory createAggregateEvaluatorFactory(final IScalarEvaluatorFactory[] args)
             throws AlgebricksException {
-        return new ICopyAggregateFunctionFactory() {
+        return new IAggregateEvaluatorFactory() {
             private static final long serialVersionUID = 1L;
 
             @Override
-            public ICopyAggregateFunction createAggregateFunction(final IDataOutputProvider provider)
+            public IAggregateEvaluator createAggregateEvaluator(final IHyracksTaskContext ctx)
                     throws AlgebricksException {
-                return new GlobalSqlAvgAggregateFunction(args, provider);
+                return new GlobalSqlAvgAggregateFunction(args, ctx);
             }
         };
     }
diff --git a/asterix-runtime/src/main/java/org/apache/asterix/runtime/aggregates/std/GlobalSqlAvgAggregateFunction.java b/asterix-runtime/src/main/java/org/apache/asterix/runtime/aggregates/std/GlobalSqlAvgAggregateFunction.java
index e91ca21..aa3d23d 100644
--- a/asterix-runtime/src/main/java/org/apache/asterix/runtime/aggregates/std/GlobalSqlAvgAggregateFunction.java
+++ b/asterix-runtime/src/main/java/org/apache/asterix/runtime/aggregates/std/GlobalSqlAvgAggregateFunction.java
@@ -20,15 +20,16 @@
 package org.apache.asterix.runtime.aggregates.std;
 
 import org.apache.hyracks.algebricks.common.exceptions.AlgebricksException;
-import org.apache.hyracks.algebricks.runtime.base.ICopyEvaluatorFactory;
-import org.apache.hyracks.data.std.api.IDataOutputProvider;
+import org.apache.hyracks.algebricks.runtime.base.IScalarEvaluatorFactory;
+import org.apache.hyracks.api.context.IHyracksTaskContext;
+import org.apache.hyracks.data.std.api.IPointable;
 import org.apache.hyracks.dataflow.common.data.accessors.IFrameTupleReference;
 
 public class GlobalSqlAvgAggregateFunction extends AbstractAvgAggregateFunction {
 
-    public GlobalSqlAvgAggregateFunction(ICopyEvaluatorFactory[] args, IDataOutputProvider output)
+    public GlobalSqlAvgAggregateFunction(IScalarEvaluatorFactory[] args, IHyracksTaskContext context)
             throws AlgebricksException {
-        super(args, output);
+        super(args, context);
     }
 
     @Override
@@ -37,13 +38,13 @@
     }
 
     @Override
-    public void finish() throws AlgebricksException {
-        finishFinalResults();
+    public void finish(IPointable result) throws AlgebricksException {
+        finishFinalResults(result);
     }
 
     @Override
-    public void finishPartial() throws AlgebricksException {
-        finishPartialResults();
+    public void finishPartial(IPointable result) throws AlgebricksException {
+        finishPartialResults(result);
     }
 
     @Override
diff --git a/asterix-runtime/src/main/java/org/apache/asterix/runtime/aggregates/std/IntermediateAvgAggregateDescriptor.java b/asterix-runtime/src/main/java/org/apache/asterix/runtime/aggregates/std/IntermediateAvgAggregateDescriptor.java
index 80e784e..31fc059 100644
--- a/asterix-runtime/src/main/java/org/apache/asterix/runtime/aggregates/std/IntermediateAvgAggregateDescriptor.java
+++ b/asterix-runtime/src/main/java/org/apache/asterix/runtime/aggregates/std/IntermediateAvgAggregateDescriptor.java
@@ -25,16 +25,17 @@
 import org.apache.asterix.runtime.aggregates.base.AbstractAggregateFunctionDynamicDescriptor;
 import org.apache.hyracks.algebricks.common.exceptions.AlgebricksException;
 import org.apache.hyracks.algebricks.core.algebra.functions.FunctionIdentifier;
-import org.apache.hyracks.algebricks.runtime.base.ICopyAggregateFunction;
-import org.apache.hyracks.algebricks.runtime.base.ICopyAggregateFunctionFactory;
-import org.apache.hyracks.algebricks.runtime.base.ICopyEvaluatorFactory;
-import org.apache.hyracks.data.std.api.IDataOutputProvider;
+import org.apache.hyracks.algebricks.runtime.base.IAggregateEvaluator;
+import org.apache.hyracks.algebricks.runtime.base.IAggregateEvaluatorFactory;
+import org.apache.hyracks.algebricks.runtime.base.IScalarEvaluatorFactory;
+import org.apache.hyracks.api.context.IHyracksTaskContext;
 
 public class IntermediateAvgAggregateDescriptor extends AbstractAggregateFunctionDynamicDescriptor {
 
     private static final long serialVersionUID = 1L;
 
     public static final IFunctionDescriptorFactory FACTORY = new IFunctionDescriptorFactory() {
+        @Override
         public IFunctionDescriptor createFunctionDescriptor() {
             return new IntermediateAvgAggregateDescriptor();
         }
@@ -46,15 +47,15 @@
     }
 
     @Override
-    public ICopyAggregateFunctionFactory createAggregateFunctionFactory(final ICopyEvaluatorFactory[] args)
+    public IAggregateEvaluatorFactory createAggregateEvaluatorFactory(final IScalarEvaluatorFactory[] args)
             throws AlgebricksException {
-        return new ICopyAggregateFunctionFactory() {
+        return new IAggregateEvaluatorFactory() {
             private static final long serialVersionUID = 1L;
 
             @Override
-            public ICopyAggregateFunction createAggregateFunction(final IDataOutputProvider provider)
+            public IAggregateEvaluator createAggregateEvaluator(final IHyracksTaskContext ctx)
                     throws AlgebricksException {
-                return new IntermediateAvgAggregateFunction(args, provider);
+                return new IntermediateAvgAggregateFunction(args, ctx);
             }
         };
     }
diff --git a/asterix-runtime/src/main/java/org/apache/asterix/runtime/aggregates/std/IntermediateAvgAggregateFunction.java b/asterix-runtime/src/main/java/org/apache/asterix/runtime/aggregates/std/IntermediateAvgAggregateFunction.java
index 8c52803..1543f95 100644
--- a/asterix-runtime/src/main/java/org/apache/asterix/runtime/aggregates/std/IntermediateAvgAggregateFunction.java
+++ b/asterix-runtime/src/main/java/org/apache/asterix/runtime/aggregates/std/IntermediateAvgAggregateFunction.java
@@ -21,15 +21,16 @@
 
 import org.apache.asterix.om.types.ATypeTag;
 import org.apache.hyracks.algebricks.common.exceptions.AlgebricksException;
-import org.apache.hyracks.algebricks.runtime.base.ICopyEvaluatorFactory;
-import org.apache.hyracks.data.std.api.IDataOutputProvider;
+import org.apache.hyracks.algebricks.runtime.base.IScalarEvaluatorFactory;
+import org.apache.hyracks.api.context.IHyracksTaskContext;
+import org.apache.hyracks.data.std.api.IPointable;
 import org.apache.hyracks.dataflow.common.data.accessors.IFrameTupleReference;
 
 public class IntermediateAvgAggregateFunction extends AbstractAvgAggregateFunction {
 
-    public IntermediateAvgAggregateFunction(ICopyEvaluatorFactory[] args, IDataOutputProvider output)
+    public IntermediateAvgAggregateFunction(IScalarEvaluatorFactory[] args, IHyracksTaskContext context)
             throws AlgebricksException {
-        super(args, output);
+        super(args, context);
     }
 
     @Override
@@ -38,13 +39,13 @@
     }
 
     @Override
-    public void finish() throws AlgebricksException {
-        finishPartialResults();
+    public void finish(IPointable result) throws AlgebricksException {
+        finishPartialResults(result);
     }
 
     @Override
-    public void finishPartial() throws AlgebricksException {
-        finishPartialResults();
+    public void finishPartial(IPointable result) throws AlgebricksException {
+        finishPartialResults(result);
     }
 
     @Override
diff --git a/asterix-runtime/src/main/java/org/apache/asterix/runtime/aggregates/std/IntermediateSqlAvgAggregateDescriptor.java b/asterix-runtime/src/main/java/org/apache/asterix/runtime/aggregates/std/IntermediateSqlAvgAggregateDescriptor.java
index 437e522..b58c14f 100644
--- a/asterix-runtime/src/main/java/org/apache/asterix/runtime/aggregates/std/IntermediateSqlAvgAggregateDescriptor.java
+++ b/asterix-runtime/src/main/java/org/apache/asterix/runtime/aggregates/std/IntermediateSqlAvgAggregateDescriptor.java
@@ -25,15 +25,16 @@
 import org.apache.asterix.runtime.aggregates.base.AbstractAggregateFunctionDynamicDescriptor;
 import org.apache.hyracks.algebricks.common.exceptions.AlgebricksException;
 import org.apache.hyracks.algebricks.core.algebra.functions.FunctionIdentifier;
-import org.apache.hyracks.algebricks.runtime.base.ICopyAggregateFunction;
-import org.apache.hyracks.algebricks.runtime.base.ICopyAggregateFunctionFactory;
-import org.apache.hyracks.algebricks.runtime.base.ICopyEvaluatorFactory;
-import org.apache.hyracks.data.std.api.IDataOutputProvider;
+import org.apache.hyracks.algebricks.runtime.base.IAggregateEvaluator;
+import org.apache.hyracks.algebricks.runtime.base.IAggregateEvaluatorFactory;
+import org.apache.hyracks.algebricks.runtime.base.IScalarEvaluatorFactory;
+import org.apache.hyracks.api.context.IHyracksTaskContext;
 
 public class IntermediateSqlAvgAggregateDescriptor extends AbstractAggregateFunctionDynamicDescriptor {
 
     private static final long serialVersionUID = 1L;
     public static final IFunctionDescriptorFactory FACTORY = new IFunctionDescriptorFactory() {
+        @Override
         public IFunctionDescriptor createFunctionDescriptor() {
             return new IntermediateSqlAvgAggregateDescriptor();
         }
@@ -45,15 +46,15 @@
     }
 
     @Override
-    public ICopyAggregateFunctionFactory createAggregateFunctionFactory(final ICopyEvaluatorFactory[] args)
+    public IAggregateEvaluatorFactory createAggregateEvaluatorFactory(final IScalarEvaluatorFactory[] args)
             throws AlgebricksException {
-        return new ICopyAggregateFunctionFactory() {
+        return new IAggregateEvaluatorFactory() {
             private static final long serialVersionUID = 1L;
 
             @Override
-            public ICopyAggregateFunction createAggregateFunction(final IDataOutputProvider provider)
+            public IAggregateEvaluator createAggregateEvaluator(final IHyracksTaskContext ctx)
                     throws AlgebricksException {
-                return new IntermediateSqlAvgAggregateFunction(args, provider);
+                return new IntermediateSqlAvgAggregateFunction(args, ctx);
             }
         };
     }
diff --git a/asterix-runtime/src/main/java/org/apache/asterix/runtime/aggregates/std/IntermediateSqlAvgAggregateFunction.java b/asterix-runtime/src/main/java/org/apache/asterix/runtime/aggregates/std/IntermediateSqlAvgAggregateFunction.java
index a1bcf7c..39da960 100644
--- a/asterix-runtime/src/main/java/org/apache/asterix/runtime/aggregates/std/IntermediateSqlAvgAggregateFunction.java
+++ b/asterix-runtime/src/main/java/org/apache/asterix/runtime/aggregates/std/IntermediateSqlAvgAggregateFunction.java
@@ -20,14 +20,16 @@
 package org.apache.asterix.runtime.aggregates.std;
 
 import org.apache.hyracks.algebricks.common.exceptions.AlgebricksException;
-import org.apache.hyracks.algebricks.runtime.base.ICopyEvaluatorFactory;
-import org.apache.hyracks.data.std.api.IDataOutputProvider;
+import org.apache.hyracks.algebricks.runtime.base.IScalarEvaluatorFactory;
+import org.apache.hyracks.api.context.IHyracksTaskContext;
+import org.apache.hyracks.data.std.api.IPointable;
 import org.apache.hyracks.dataflow.common.data.accessors.IFrameTupleReference;
 
 public class IntermediateSqlAvgAggregateFunction extends AbstractAvgAggregateFunction {
 
-    public IntermediateSqlAvgAggregateFunction(ICopyEvaluatorFactory[] args, IDataOutputProvider output) throws AlgebricksException {
-        super(args, output);
+    public IntermediateSqlAvgAggregateFunction(IScalarEvaluatorFactory[] args, IHyracksTaskContext context)
+            throws AlgebricksException {
+        super(args, context);
     }
 
     @Override
@@ -36,13 +38,13 @@
     }
 
     @Override
-    public void finish() throws AlgebricksException {
-        finishPartialResults();
+    public void finish(IPointable result) throws AlgebricksException {
+        finishPartialResults(result);
     }
 
     @Override
-    public void finishPartial() throws AlgebricksException {
-        finishPartialResults();
+    public void finishPartial(IPointable result) throws AlgebricksException {
+        finishPartialResults(result);
     }
 
     @Override
diff --git a/asterix-runtime/src/main/java/org/apache/asterix/runtime/aggregates/std/LocalAvgAggregateDescriptor.java b/asterix-runtime/src/main/java/org/apache/asterix/runtime/aggregates/std/LocalAvgAggregateDescriptor.java
index a47d0d8..acb6493 100644
--- a/asterix-runtime/src/main/java/org/apache/asterix/runtime/aggregates/std/LocalAvgAggregateDescriptor.java
+++ b/asterix-runtime/src/main/java/org/apache/asterix/runtime/aggregates/std/LocalAvgAggregateDescriptor.java
@@ -25,15 +25,16 @@
 import org.apache.asterix.runtime.aggregates.base.AbstractAggregateFunctionDynamicDescriptor;
 import org.apache.hyracks.algebricks.common.exceptions.AlgebricksException;
 import org.apache.hyracks.algebricks.core.algebra.functions.FunctionIdentifier;
-import org.apache.hyracks.algebricks.runtime.base.ICopyAggregateFunction;
-import org.apache.hyracks.algebricks.runtime.base.ICopyAggregateFunctionFactory;
-import org.apache.hyracks.algebricks.runtime.base.ICopyEvaluatorFactory;
-import org.apache.hyracks.data.std.api.IDataOutputProvider;
+import org.apache.hyracks.algebricks.runtime.base.IAggregateEvaluator;
+import org.apache.hyracks.algebricks.runtime.base.IAggregateEvaluatorFactory;
+import org.apache.hyracks.algebricks.runtime.base.IScalarEvaluatorFactory;
+import org.apache.hyracks.api.context.IHyracksTaskContext;
 
 public class LocalAvgAggregateDescriptor extends AbstractAggregateFunctionDynamicDescriptor {
 
     private static final long serialVersionUID = 1L;
     public static final IFunctionDescriptorFactory FACTORY = new IFunctionDescriptorFactory() {
+        @Override
         public IFunctionDescriptor createFunctionDescriptor() {
             return new LocalAvgAggregateDescriptor();
         }
@@ -45,15 +46,15 @@
     }
 
     @Override
-    public ICopyAggregateFunctionFactory createAggregateFunctionFactory(final ICopyEvaluatorFactory[] args)
+    public IAggregateEvaluatorFactory createAggregateEvaluatorFactory(final IScalarEvaluatorFactory[] args)
             throws AlgebricksException {
-        return new ICopyAggregateFunctionFactory() {
+        return new IAggregateEvaluatorFactory() {
             private static final long serialVersionUID = 1L;
 
             @Override
-            public ICopyAggregateFunction createAggregateFunction(final IDataOutputProvider provider)
+            public IAggregateEvaluator createAggregateEvaluator(final IHyracksTaskContext ctx)
                     throws AlgebricksException {
-                return new LocalAvgAggregateFunction(args, provider);
+                return new LocalAvgAggregateFunction(args, ctx);
             }
         };
     }
diff --git a/asterix-runtime/src/main/java/org/apache/asterix/runtime/aggregates/std/LocalAvgAggregateFunction.java b/asterix-runtime/src/main/java/org/apache/asterix/runtime/aggregates/std/LocalAvgAggregateFunction.java
index 230119f..0b19900 100644
--- a/asterix-runtime/src/main/java/org/apache/asterix/runtime/aggregates/std/LocalAvgAggregateFunction.java
+++ b/asterix-runtime/src/main/java/org/apache/asterix/runtime/aggregates/std/LocalAvgAggregateFunction.java
@@ -21,15 +21,16 @@
 
 import org.apache.asterix.om.types.ATypeTag;
 import org.apache.hyracks.algebricks.common.exceptions.AlgebricksException;
-import org.apache.hyracks.algebricks.runtime.base.ICopyEvaluatorFactory;
-import org.apache.hyracks.data.std.api.IDataOutputProvider;
+import org.apache.hyracks.algebricks.runtime.base.IScalarEvaluatorFactory;
+import org.apache.hyracks.api.context.IHyracksTaskContext;
+import org.apache.hyracks.data.std.api.IPointable;
 import org.apache.hyracks.dataflow.common.data.accessors.IFrameTupleReference;
 
 public class LocalAvgAggregateFunction extends AbstractAvgAggregateFunction {
 
-    public LocalAvgAggregateFunction(ICopyEvaluatorFactory[] args, IDataOutputProvider output)
+    public LocalAvgAggregateFunction(IScalarEvaluatorFactory[] args, IHyracksTaskContext context)
             throws AlgebricksException {
-        super(args, output);
+        super(args, context);
     }
 
     @Override
@@ -38,13 +39,13 @@
     }
 
     @Override
-    public void finish() throws AlgebricksException {
-        finishPartialResults();
+    public void finish(IPointable result) throws AlgebricksException {
+        finishPartialResults(result);
     }
 
     @Override
-    public void finishPartial() throws AlgebricksException {
-        finish();
+    public void finishPartial(IPointable result) throws AlgebricksException {
+        finish(result);
     }
 
     @Override
diff --git a/asterix-runtime/src/main/java/org/apache/asterix/runtime/aggregates/std/LocalMaxAggregateDescriptor.java b/asterix-runtime/src/main/java/org/apache/asterix/runtime/aggregates/std/LocalMaxAggregateDescriptor.java
index de12fc8..4b74121 100644
--- a/asterix-runtime/src/main/java/org/apache/asterix/runtime/aggregates/std/LocalMaxAggregateDescriptor.java
+++ b/asterix-runtime/src/main/java/org/apache/asterix/runtime/aggregates/std/LocalMaxAggregateDescriptor.java
@@ -24,10 +24,10 @@
 import org.apache.asterix.runtime.aggregates.base.AbstractAggregateFunctionDynamicDescriptor;
 import org.apache.hyracks.algebricks.common.exceptions.AlgebricksException;
 import org.apache.hyracks.algebricks.core.algebra.functions.FunctionIdentifier;
-import org.apache.hyracks.algebricks.runtime.base.ICopyAggregateFunction;
-import org.apache.hyracks.algebricks.runtime.base.ICopyAggregateFunctionFactory;
-import org.apache.hyracks.algebricks.runtime.base.ICopyEvaluatorFactory;
-import org.apache.hyracks.data.std.api.IDataOutputProvider;
+import org.apache.hyracks.algebricks.runtime.base.IAggregateEvaluator;
+import org.apache.hyracks.algebricks.runtime.base.IAggregateEvaluatorFactory;
+import org.apache.hyracks.algebricks.runtime.base.IScalarEvaluatorFactory;
+import org.apache.hyracks.api.context.IHyracksTaskContext;
 
 public class LocalMaxAggregateDescriptor extends AbstractAggregateFunctionDynamicDescriptor {
 
@@ -35,6 +35,7 @@
     private final static FunctionIdentifier FID = AsterixBuiltinFunctions.LOCAL_MAX;
 
     public static final IFunctionDescriptorFactory FACTORY = new IFunctionDescriptorFactory() {
+        @Override
         public IFunctionDescriptor createFunctionDescriptor() {
             return new LocalMaxAggregateDescriptor();
         }
@@ -46,15 +47,15 @@
     }
 
     @Override
-    public ICopyAggregateFunctionFactory createAggregateFunctionFactory(final ICopyEvaluatorFactory[] args)
+    public IAggregateEvaluatorFactory createAggregateEvaluatorFactory(final IScalarEvaluatorFactory[] args)
             throws AlgebricksException {
-        return new ICopyAggregateFunctionFactory() {
+        return new IAggregateEvaluatorFactory() {
             private static final long serialVersionUID = 1L;
 
             @Override
-            public ICopyAggregateFunction createAggregateFunction(final IDataOutputProvider provider)
+            public IAggregateEvaluator createAggregateEvaluator(final IHyracksTaskContext ctx)
                     throws AlgebricksException {
-                return new MinMaxAggregateFunction(args, provider, false, true);
+                return new MinMaxAggregateFunction(args, ctx, false, true);
             }
         };
     }
diff --git a/asterix-runtime/src/main/java/org/apache/asterix/runtime/aggregates/std/LocalMinAggregateDescriptor.java b/asterix-runtime/src/main/java/org/apache/asterix/runtime/aggregates/std/LocalMinAggregateDescriptor.java
index be67e3e..9c2a3e8 100644
--- a/asterix-runtime/src/main/java/org/apache/asterix/runtime/aggregates/std/LocalMinAggregateDescriptor.java
+++ b/asterix-runtime/src/main/java/org/apache/asterix/runtime/aggregates/std/LocalMinAggregateDescriptor.java
@@ -24,16 +24,17 @@
 import org.apache.asterix.runtime.aggregates.base.AbstractAggregateFunctionDynamicDescriptor;
 import org.apache.hyracks.algebricks.common.exceptions.AlgebricksException;
 import org.apache.hyracks.algebricks.core.algebra.functions.FunctionIdentifier;
-import org.apache.hyracks.algebricks.runtime.base.ICopyAggregateFunction;
-import org.apache.hyracks.algebricks.runtime.base.ICopyAggregateFunctionFactory;
-import org.apache.hyracks.algebricks.runtime.base.ICopyEvaluatorFactory;
-import org.apache.hyracks.data.std.api.IDataOutputProvider;
+import org.apache.hyracks.algebricks.runtime.base.IAggregateEvaluator;
+import org.apache.hyracks.algebricks.runtime.base.IAggregateEvaluatorFactory;
+import org.apache.hyracks.algebricks.runtime.base.IScalarEvaluatorFactory;
+import org.apache.hyracks.api.context.IHyracksTaskContext;
 
 public class LocalMinAggregateDescriptor extends AbstractAggregateFunctionDynamicDescriptor {
 
     private static final long serialVersionUID = 1L;
     private final static FunctionIdentifier FID = AsterixBuiltinFunctions.LOCAL_MIN;
     public static final IFunctionDescriptorFactory FACTORY = new IFunctionDescriptorFactory() {
+        @Override
         public IFunctionDescriptor createFunctionDescriptor() {
             return new LocalMinAggregateDescriptor();
         }
@@ -45,15 +46,15 @@
     }
 
     @Override
-    public ICopyAggregateFunctionFactory createAggregateFunctionFactory(final ICopyEvaluatorFactory[] args)
+    public IAggregateEvaluatorFactory createAggregateEvaluatorFactory(final IScalarEvaluatorFactory[] args)
             throws AlgebricksException {
-        return new ICopyAggregateFunctionFactory() {
+        return new IAggregateEvaluatorFactory() {
             private static final long serialVersionUID = 1L;
 
             @Override
-            public ICopyAggregateFunction createAggregateFunction(final IDataOutputProvider provider)
+            public IAggregateEvaluator createAggregateEvaluator(final IHyracksTaskContext ctx)
                     throws AlgebricksException {
-                return new MinMaxAggregateFunction(args, provider, true, true);
+                return new MinMaxAggregateFunction(args, ctx, true, true);
             }
         };
     }
diff --git a/asterix-runtime/src/main/java/org/apache/asterix/runtime/aggregates/std/LocalSqlAvgAggregateDescriptor.java b/asterix-runtime/src/main/java/org/apache/asterix/runtime/aggregates/std/LocalSqlAvgAggregateDescriptor.java
index 9c3bb58..5e13b55 100644
--- a/asterix-runtime/src/main/java/org/apache/asterix/runtime/aggregates/std/LocalSqlAvgAggregateDescriptor.java
+++ b/asterix-runtime/src/main/java/org/apache/asterix/runtime/aggregates/std/LocalSqlAvgAggregateDescriptor.java
@@ -25,15 +25,16 @@
 import org.apache.asterix.runtime.aggregates.base.AbstractAggregateFunctionDynamicDescriptor;
 import org.apache.hyracks.algebricks.common.exceptions.AlgebricksException;
 import org.apache.hyracks.algebricks.core.algebra.functions.FunctionIdentifier;
-import org.apache.hyracks.algebricks.runtime.base.ICopyAggregateFunction;
-import org.apache.hyracks.algebricks.runtime.base.ICopyAggregateFunctionFactory;
-import org.apache.hyracks.algebricks.runtime.base.ICopyEvaluatorFactory;
-import org.apache.hyracks.data.std.api.IDataOutputProvider;
+import org.apache.hyracks.algebricks.runtime.base.IAggregateEvaluator;
+import org.apache.hyracks.algebricks.runtime.base.IAggregateEvaluatorFactory;
+import org.apache.hyracks.algebricks.runtime.base.IScalarEvaluatorFactory;
+import org.apache.hyracks.api.context.IHyracksTaskContext;
 
 public class LocalSqlAvgAggregateDescriptor extends AbstractAggregateFunctionDynamicDescriptor {
 
     private static final long serialVersionUID = 1L;
     public static final IFunctionDescriptorFactory FACTORY = new IFunctionDescriptorFactory() {
+        @Override
         public IFunctionDescriptor createFunctionDescriptor() {
             return new LocalSqlAvgAggregateDescriptor();
         }
@@ -45,15 +46,15 @@
     }
 
     @Override
-    public ICopyAggregateFunctionFactory createAggregateFunctionFactory(final ICopyEvaluatorFactory[] args)
+    public IAggregateEvaluatorFactory createAggregateEvaluatorFactory(final IScalarEvaluatorFactory[] args)
             throws AlgebricksException {
-        return new ICopyAggregateFunctionFactory() {
+        return new IAggregateEvaluatorFactory() {
             private static final long serialVersionUID = 1L;
 
             @Override
-            public ICopyAggregateFunction createAggregateFunction(final IDataOutputProvider provider)
+            public IAggregateEvaluator createAggregateEvaluator(final IHyracksTaskContext ctx)
                     throws AlgebricksException {
-                return new LocalSqlAvgAggregateFunction(args, provider);
+                return new LocalSqlAvgAggregateFunction(args, ctx);
             }
         };
     }
diff --git a/asterix-runtime/src/main/java/org/apache/asterix/runtime/aggregates/std/LocalSqlAvgAggregateFunction.java b/asterix-runtime/src/main/java/org/apache/asterix/runtime/aggregates/std/LocalSqlAvgAggregateFunction.java
index ddee2ac..1aaba7b 100644
--- a/asterix-runtime/src/main/java/org/apache/asterix/runtime/aggregates/std/LocalSqlAvgAggregateFunction.java
+++ b/asterix-runtime/src/main/java/org/apache/asterix/runtime/aggregates/std/LocalSqlAvgAggregateFunction.java
@@ -20,15 +20,16 @@
 package org.apache.asterix.runtime.aggregates.std;
 
 import org.apache.hyracks.algebricks.common.exceptions.AlgebricksException;
-import org.apache.hyracks.algebricks.runtime.base.ICopyEvaluatorFactory;
-import org.apache.hyracks.data.std.api.IDataOutputProvider;
+import org.apache.hyracks.algebricks.runtime.base.IScalarEvaluatorFactory;
+import org.apache.hyracks.api.context.IHyracksTaskContext;
+import org.apache.hyracks.data.std.api.IPointable;
 import org.apache.hyracks.dataflow.common.data.accessors.IFrameTupleReference;
 
 public class LocalSqlAvgAggregateFunction extends AbstractAvgAggregateFunction {
 
-    public LocalSqlAvgAggregateFunction(ICopyEvaluatorFactory[] args, IDataOutputProvider output)
+    public LocalSqlAvgAggregateFunction(IScalarEvaluatorFactory[] args, IHyracksTaskContext context)
             throws AlgebricksException {
-        super(args, output);
+        super(args, context);
     }
 
     @Override
@@ -37,13 +38,13 @@
     }
 
     @Override
-    public void finish() throws AlgebricksException {
-        finishPartialResults();
+    public void finish(IPointable result) throws AlgebricksException {
+        finishPartialResults(result);
     }
 
     @Override
-    public void finishPartial() throws AlgebricksException {
-        finish();
+    public void finishPartial(IPointable result) throws AlgebricksException {
+        finish(result);
     }
 
     @Override
diff --git a/asterix-runtime/src/main/java/org/apache/asterix/runtime/aggregates/std/LocalSqlMaxAggregateDescriptor.java b/asterix-runtime/src/main/java/org/apache/asterix/runtime/aggregates/std/LocalSqlMaxAggregateDescriptor.java
index 1bfd230..4e5ba88 100644
--- a/asterix-runtime/src/main/java/org/apache/asterix/runtime/aggregates/std/LocalSqlMaxAggregateDescriptor.java
+++ b/asterix-runtime/src/main/java/org/apache/asterix/runtime/aggregates/std/LocalSqlMaxAggregateDescriptor.java
@@ -24,10 +24,10 @@
 import org.apache.asterix.runtime.aggregates.base.AbstractAggregateFunctionDynamicDescriptor;
 import org.apache.hyracks.algebricks.common.exceptions.AlgebricksException;
 import org.apache.hyracks.algebricks.core.algebra.functions.FunctionIdentifier;
-import org.apache.hyracks.algebricks.runtime.base.ICopyAggregateFunction;
-import org.apache.hyracks.algebricks.runtime.base.ICopyAggregateFunctionFactory;
-import org.apache.hyracks.algebricks.runtime.base.ICopyEvaluatorFactory;
-import org.apache.hyracks.data.std.api.IDataOutputProvider;
+import org.apache.hyracks.algebricks.runtime.base.IAggregateEvaluator;
+import org.apache.hyracks.algebricks.runtime.base.IAggregateEvaluatorFactory;
+import org.apache.hyracks.algebricks.runtime.base.IScalarEvaluatorFactory;
+import org.apache.hyracks.api.context.IHyracksTaskContext;
 
 public class LocalSqlMaxAggregateDescriptor extends AbstractAggregateFunctionDynamicDescriptor {
 
@@ -35,6 +35,7 @@
     private final static FunctionIdentifier FID = AsterixBuiltinFunctions.LOCAL_SQL_MAX;
 
     public static final IFunctionDescriptorFactory FACTORY = new IFunctionDescriptorFactory() {
+        @Override
         public IFunctionDescriptor createFunctionDescriptor() {
             return new LocalSqlMaxAggregateDescriptor();
         }
@@ -46,15 +47,15 @@
     }
 
     @Override
-    public ICopyAggregateFunctionFactory createAggregateFunctionFactory(final ICopyEvaluatorFactory[] args)
+    public IAggregateEvaluatorFactory createAggregateEvaluatorFactory(final IScalarEvaluatorFactory[] args)
             throws AlgebricksException {
-        return new ICopyAggregateFunctionFactory() {
+        return new IAggregateEvaluatorFactory() {
             private static final long serialVersionUID = 1L;
 
             @Override
-            public ICopyAggregateFunction createAggregateFunction(final IDataOutputProvider provider)
+            public IAggregateEvaluator createAggregateEvaluator(final IHyracksTaskContext ctx)
                     throws AlgebricksException {
-                return new SqlMinMaxAggregateFunction(args, provider, false, true);
+                return new SqlMinMaxAggregateFunction(args, ctx, false, true);
             }
         };
     }
diff --git a/asterix-runtime/src/main/java/org/apache/asterix/runtime/aggregates/std/LocalSqlMinAggregateDescriptor.java b/asterix-runtime/src/main/java/org/apache/asterix/runtime/aggregates/std/LocalSqlMinAggregateDescriptor.java
index 53e6387..8a2036b 100644
--- a/asterix-runtime/src/main/java/org/apache/asterix/runtime/aggregates/std/LocalSqlMinAggregateDescriptor.java
+++ b/asterix-runtime/src/main/java/org/apache/asterix/runtime/aggregates/std/LocalSqlMinAggregateDescriptor.java
@@ -24,16 +24,17 @@
 import org.apache.asterix.runtime.aggregates.base.AbstractAggregateFunctionDynamicDescriptor;
 import org.apache.hyracks.algebricks.common.exceptions.AlgebricksException;
 import org.apache.hyracks.algebricks.core.algebra.functions.FunctionIdentifier;
-import org.apache.hyracks.algebricks.runtime.base.ICopyAggregateFunction;
-import org.apache.hyracks.algebricks.runtime.base.ICopyAggregateFunctionFactory;
-import org.apache.hyracks.algebricks.runtime.base.ICopyEvaluatorFactory;
-import org.apache.hyracks.data.std.api.IDataOutputProvider;
+import org.apache.hyracks.algebricks.runtime.base.IAggregateEvaluator;
+import org.apache.hyracks.algebricks.runtime.base.IAggregateEvaluatorFactory;
+import org.apache.hyracks.algebricks.runtime.base.IScalarEvaluatorFactory;
+import org.apache.hyracks.api.context.IHyracksTaskContext;
 
 public class LocalSqlMinAggregateDescriptor extends AbstractAggregateFunctionDynamicDescriptor {
 
     private static final long serialVersionUID = 1L;
     private final static FunctionIdentifier FID = AsterixBuiltinFunctions.LOCAL_SQL_MIN;
     public static final IFunctionDescriptorFactory FACTORY = new IFunctionDescriptorFactory() {
+        @Override
         public IFunctionDescriptor createFunctionDescriptor() {
             return new LocalSqlMinAggregateDescriptor();
         }
@@ -45,15 +46,15 @@
     }
 
     @Override
-    public ICopyAggregateFunctionFactory createAggregateFunctionFactory(final ICopyEvaluatorFactory[] args)
+    public IAggregateEvaluatorFactory createAggregateEvaluatorFactory(final IScalarEvaluatorFactory[] args)
             throws AlgebricksException {
-        return new ICopyAggregateFunctionFactory() {
+        return new IAggregateEvaluatorFactory() {
             private static final long serialVersionUID = 1L;
 
             @Override
-            public ICopyAggregateFunction createAggregateFunction(final IDataOutputProvider provider)
+            public IAggregateEvaluator createAggregateEvaluator(final IHyracksTaskContext ctx)
                     throws AlgebricksException {
-                return new SqlMinMaxAggregateFunction(args, provider, true, true);
+                return new SqlMinMaxAggregateFunction(args, ctx, true, true);
             }
         };
     }
diff --git a/asterix-runtime/src/main/java/org/apache/asterix/runtime/aggregates/std/LocalSqlSumAggregateDescriptor.java b/asterix-runtime/src/main/java/org/apache/asterix/runtime/aggregates/std/LocalSqlSumAggregateDescriptor.java
index 3ad8456..b163428 100644
--- a/asterix-runtime/src/main/java/org/apache/asterix/runtime/aggregates/std/LocalSqlSumAggregateDescriptor.java
+++ b/asterix-runtime/src/main/java/org/apache/asterix/runtime/aggregates/std/LocalSqlSumAggregateDescriptor.java
@@ -24,16 +24,17 @@
 import org.apache.asterix.runtime.aggregates.base.AbstractAggregateFunctionDynamicDescriptor;
 import org.apache.hyracks.algebricks.common.exceptions.AlgebricksException;
 import org.apache.hyracks.algebricks.core.algebra.functions.FunctionIdentifier;
-import org.apache.hyracks.algebricks.runtime.base.ICopyAggregateFunction;
-import org.apache.hyracks.algebricks.runtime.base.ICopyAggregateFunctionFactory;
-import org.apache.hyracks.algebricks.runtime.base.ICopyEvaluatorFactory;
-import org.apache.hyracks.data.std.api.IDataOutputProvider;
+import org.apache.hyracks.algebricks.runtime.base.IAggregateEvaluator;
+import org.apache.hyracks.algebricks.runtime.base.IAggregateEvaluatorFactory;
+import org.apache.hyracks.algebricks.runtime.base.IScalarEvaluatorFactory;
+import org.apache.hyracks.api.context.IHyracksTaskContext;
 
 public class LocalSqlSumAggregateDescriptor extends AbstractAggregateFunctionDynamicDescriptor {
 
     private static final long serialVersionUID = 1L;
     private final static FunctionIdentifier FID = AsterixBuiltinFunctions.LOCAL_SQL_SUM;
     public static final IFunctionDescriptorFactory FACTORY = new IFunctionDescriptorFactory() {
+        @Override
         public IFunctionDescriptor createFunctionDescriptor() {
             return new LocalSqlSumAggregateDescriptor();
         }
@@ -45,15 +46,15 @@
     }
 
     @Override
-    public ICopyAggregateFunctionFactory createAggregateFunctionFactory(final ICopyEvaluatorFactory[] args)
+    public IAggregateEvaluatorFactory createAggregateEvaluatorFactory(final IScalarEvaluatorFactory[] args)
             throws AlgebricksException {
-        return new ICopyAggregateFunctionFactory() {
+        return new IAggregateEvaluatorFactory() {
             private static final long serialVersionUID = 1L;
 
             @Override
-            public ICopyAggregateFunction createAggregateFunction(final IDataOutputProvider provider)
+            public IAggregateEvaluator createAggregateEvaluator(final IHyracksTaskContext ctx)
                     throws AlgebricksException {
-                return new SqlSumAggregateFunction(args, provider, true);
+                return new SqlSumAggregateFunction(args, ctx, true);
             };
         };
     }
diff --git a/asterix-runtime/src/main/java/org/apache/asterix/runtime/aggregates/std/LocalSumAggregateDescriptor.java b/asterix-runtime/src/main/java/org/apache/asterix/runtime/aggregates/std/LocalSumAggregateDescriptor.java
index fc75f33..54c27da 100644
--- a/asterix-runtime/src/main/java/org/apache/asterix/runtime/aggregates/std/LocalSumAggregateDescriptor.java
+++ b/asterix-runtime/src/main/java/org/apache/asterix/runtime/aggregates/std/LocalSumAggregateDescriptor.java
@@ -24,16 +24,17 @@
 import org.apache.asterix.runtime.aggregates.base.AbstractAggregateFunctionDynamicDescriptor;
 import org.apache.hyracks.algebricks.common.exceptions.AlgebricksException;
 import org.apache.hyracks.algebricks.core.algebra.functions.FunctionIdentifier;
-import org.apache.hyracks.algebricks.runtime.base.ICopyAggregateFunction;
-import org.apache.hyracks.algebricks.runtime.base.ICopyAggregateFunctionFactory;
-import org.apache.hyracks.algebricks.runtime.base.ICopyEvaluatorFactory;
-import org.apache.hyracks.data.std.api.IDataOutputProvider;
+import org.apache.hyracks.algebricks.runtime.base.IAggregateEvaluator;
+import org.apache.hyracks.algebricks.runtime.base.IAggregateEvaluatorFactory;
+import org.apache.hyracks.algebricks.runtime.base.IScalarEvaluatorFactory;
+import org.apache.hyracks.api.context.IHyracksTaskContext;
 
 public class LocalSumAggregateDescriptor extends AbstractAggregateFunctionDynamicDescriptor {
 
     private static final long serialVersionUID = 1L;
     private final static FunctionIdentifier FID = AsterixBuiltinFunctions.LOCAL_SUM;
     public static final IFunctionDescriptorFactory FACTORY = new IFunctionDescriptorFactory() {
+        @Override
         public IFunctionDescriptor createFunctionDescriptor() {
             return new LocalSumAggregateDescriptor();
         }
@@ -45,15 +46,15 @@
     }
 
     @Override
-    public ICopyAggregateFunctionFactory createAggregateFunctionFactory(final ICopyEvaluatorFactory[] args)
+    public IAggregateEvaluatorFactory createAggregateEvaluatorFactory(final IScalarEvaluatorFactory[] args)
             throws AlgebricksException {
-        return new ICopyAggregateFunctionFactory() {
+        return new IAggregateEvaluatorFactory() {
             private static final long serialVersionUID = 1L;
 
             @Override
-            public ICopyAggregateFunction createAggregateFunction(final IDataOutputProvider provider)
+            public IAggregateEvaluator createAggregateEvaluator(final IHyracksTaskContext ctx)
                     throws AlgebricksException {
-                return new SumAggregateFunction(args, provider, true);
+                return new SumAggregateFunction(args, ctx, true);
             };
         };
     }
diff --git a/asterix-runtime/src/main/java/org/apache/asterix/runtime/aggregates/std/MaxAggregateDescriptor.java b/asterix-runtime/src/main/java/org/apache/asterix/runtime/aggregates/std/MaxAggregateDescriptor.java
index fcc7253..bf136ea 100644
--- a/asterix-runtime/src/main/java/org/apache/asterix/runtime/aggregates/std/MaxAggregateDescriptor.java
+++ b/asterix-runtime/src/main/java/org/apache/asterix/runtime/aggregates/std/MaxAggregateDescriptor.java
@@ -24,15 +24,16 @@
 import org.apache.asterix.runtime.aggregates.base.AbstractAggregateFunctionDynamicDescriptor;
 import org.apache.hyracks.algebricks.common.exceptions.AlgebricksException;
 import org.apache.hyracks.algebricks.core.algebra.functions.FunctionIdentifier;
-import org.apache.hyracks.algebricks.runtime.base.ICopyAggregateFunction;
-import org.apache.hyracks.algebricks.runtime.base.ICopyAggregateFunctionFactory;
-import org.apache.hyracks.algebricks.runtime.base.ICopyEvaluatorFactory;
-import org.apache.hyracks.data.std.api.IDataOutputProvider;
+import org.apache.hyracks.algebricks.runtime.base.IAggregateEvaluator;
+import org.apache.hyracks.algebricks.runtime.base.IAggregateEvaluatorFactory;
+import org.apache.hyracks.algebricks.runtime.base.IScalarEvaluatorFactory;
+import org.apache.hyracks.api.context.IHyracksTaskContext;
 
 public class MaxAggregateDescriptor extends AbstractAggregateFunctionDynamicDescriptor {
 
     private static final long serialVersionUID = 1L;
     public static final IFunctionDescriptorFactory FACTORY = new IFunctionDescriptorFactory() {
+        @Override
         public IFunctionDescriptor createFunctionDescriptor() {
             return new MaxAggregateDescriptor();
         }
@@ -44,15 +45,15 @@
     }
 
     @Override
-    public ICopyAggregateFunctionFactory createAggregateFunctionFactory(final ICopyEvaluatorFactory[] args)
+    public IAggregateEvaluatorFactory createAggregateEvaluatorFactory(final IScalarEvaluatorFactory[] args)
             throws AlgebricksException {
-        return new ICopyAggregateFunctionFactory() {
+        return new IAggregateEvaluatorFactory() {
             private static final long serialVersionUID = 1L;
 
             @Override
-            public ICopyAggregateFunction createAggregateFunction(final IDataOutputProvider provider)
+            public IAggregateEvaluator createAggregateEvaluator(final IHyracksTaskContext ctx)
                     throws AlgebricksException {
-                return new MinMaxAggregateFunction(args, provider, false, false);
+                return new MinMaxAggregateFunction(args, ctx, false, false);
             }
         };
     }
diff --git a/asterix-runtime/src/main/java/org/apache/asterix/runtime/aggregates/std/MinAggregateDescriptor.java b/asterix-runtime/src/main/java/org/apache/asterix/runtime/aggregates/std/MinAggregateDescriptor.java
index d9866ee..f1fd7ce 100644
--- a/asterix-runtime/src/main/java/org/apache/asterix/runtime/aggregates/std/MinAggregateDescriptor.java
+++ b/asterix-runtime/src/main/java/org/apache/asterix/runtime/aggregates/std/MinAggregateDescriptor.java
@@ -24,15 +24,16 @@
 import org.apache.asterix.runtime.aggregates.base.AbstractAggregateFunctionDynamicDescriptor;
 import org.apache.hyracks.algebricks.common.exceptions.AlgebricksException;
 import org.apache.hyracks.algebricks.core.algebra.functions.FunctionIdentifier;
-import org.apache.hyracks.algebricks.runtime.base.ICopyAggregateFunction;
-import org.apache.hyracks.algebricks.runtime.base.ICopyAggregateFunctionFactory;
-import org.apache.hyracks.algebricks.runtime.base.ICopyEvaluatorFactory;
-import org.apache.hyracks.data.std.api.IDataOutputProvider;
+import org.apache.hyracks.algebricks.runtime.base.IAggregateEvaluator;
+import org.apache.hyracks.algebricks.runtime.base.IAggregateEvaluatorFactory;
+import org.apache.hyracks.algebricks.runtime.base.IScalarEvaluatorFactory;
+import org.apache.hyracks.api.context.IHyracksTaskContext;
 
 public class MinAggregateDescriptor extends AbstractAggregateFunctionDynamicDescriptor {
 
     private static final long serialVersionUID = 1L;
     public static final IFunctionDescriptorFactory FACTORY = new IFunctionDescriptorFactory() {
+        @Override
         public IFunctionDescriptor createFunctionDescriptor() {
             return new MinAggregateDescriptor();
         }
@@ -44,15 +45,15 @@
     }
 
     @Override
-    public ICopyAggregateFunctionFactory createAggregateFunctionFactory(final ICopyEvaluatorFactory[] args)
+    public IAggregateEvaluatorFactory createAggregateEvaluatorFactory(final IScalarEvaluatorFactory[] args)
             throws AlgebricksException {
-        return new ICopyAggregateFunctionFactory() {
+        return new IAggregateEvaluatorFactory() {
             private static final long serialVersionUID = 1L;
 
             @Override
-            public ICopyAggregateFunction createAggregateFunction(final IDataOutputProvider provider)
+            public IAggregateEvaluator createAggregateEvaluator(final IHyracksTaskContext ctx)
                     throws AlgebricksException {
-                return new MinMaxAggregateFunction(args, provider, true, false);
+                return new MinMaxAggregateFunction(args, ctx, true, false);
             }
         };
     }
diff --git a/asterix-runtime/src/main/java/org/apache/asterix/runtime/aggregates/std/MinMaxAggregateFunction.java b/asterix-runtime/src/main/java/org/apache/asterix/runtime/aggregates/std/MinMaxAggregateFunction.java
index e0281bf..65ecc32 100644
--- a/asterix-runtime/src/main/java/org/apache/asterix/runtime/aggregates/std/MinMaxAggregateFunction.java
+++ b/asterix-runtime/src/main/java/org/apache/asterix/runtime/aggregates/std/MinMaxAggregateFunction.java
@@ -22,15 +22,15 @@
 
 import org.apache.asterix.om.types.ATypeTag;
 import org.apache.hyracks.algebricks.common.exceptions.AlgebricksException;
-import org.apache.hyracks.algebricks.runtime.base.ICopyEvaluatorFactory;
-import org.apache.hyracks.data.std.api.IDataOutputProvider;
+import org.apache.hyracks.algebricks.runtime.base.IScalarEvaluatorFactory;
+import org.apache.hyracks.api.context.IHyracksTaskContext;
 
 public class MinMaxAggregateFunction extends AbstractMinMaxAggregateFunction {
     private final boolean isLocalAgg;
 
-    public MinMaxAggregateFunction(ICopyEvaluatorFactory[] args, IDataOutputProvider provider, boolean isMin,
+    public MinMaxAggregateFunction(IScalarEvaluatorFactory[] args, IHyracksTaskContext context, boolean isMin,
             boolean isLocalAgg) throws AlgebricksException {
-        super(args, provider, isMin);
+        super(args, context, isMin);
         this.isLocalAgg = isLocalAgg;
     }
 
@@ -55,9 +55,9 @@
     protected void finishSystemNull() throws IOException {
         // Empty stream. For local agg return system null. For global agg return null.
         if (isLocalAgg) {
-            out.writeByte(ATypeTag.SERIALIZED_SYSTEM_NULL_TYPE_TAG);
+            resultStorage.getDataOutput().writeByte(ATypeTag.SERIALIZED_SYSTEM_NULL_TYPE_TAG);
         } else {
-            out.writeByte(ATypeTag.SERIALIZED_NULL_TYPE_TAG);
+            resultStorage.getDataOutput().writeByte(ATypeTag.SERIALIZED_NULL_TYPE_TAG);
         }
     }
 
diff --git a/asterix-runtime/src/main/java/org/apache/asterix/runtime/aggregates/std/SqlAvgAggregateDescriptor.java b/asterix-runtime/src/main/java/org/apache/asterix/runtime/aggregates/std/SqlAvgAggregateDescriptor.java
index 34371be..b83d638 100644
--- a/asterix-runtime/src/main/java/org/apache/asterix/runtime/aggregates/std/SqlAvgAggregateDescriptor.java
+++ b/asterix-runtime/src/main/java/org/apache/asterix/runtime/aggregates/std/SqlAvgAggregateDescriptor.java
@@ -25,15 +25,16 @@
 import org.apache.asterix.runtime.aggregates.base.AbstractAggregateFunctionDynamicDescriptor;
 import org.apache.hyracks.algebricks.common.exceptions.AlgebricksException;
 import org.apache.hyracks.algebricks.core.algebra.functions.FunctionIdentifier;
-import org.apache.hyracks.algebricks.runtime.base.ICopyAggregateFunction;
-import org.apache.hyracks.algebricks.runtime.base.ICopyAggregateFunctionFactory;
-import org.apache.hyracks.algebricks.runtime.base.ICopyEvaluatorFactory;
-import org.apache.hyracks.data.std.api.IDataOutputProvider;
+import org.apache.hyracks.algebricks.runtime.base.IAggregateEvaluator;
+import org.apache.hyracks.algebricks.runtime.base.IAggregateEvaluatorFactory;
+import org.apache.hyracks.algebricks.runtime.base.IScalarEvaluatorFactory;
+import org.apache.hyracks.api.context.IHyracksTaskContext;
 
 public class SqlAvgAggregateDescriptor extends AbstractAggregateFunctionDynamicDescriptor {
 
     private static final long serialVersionUID = 1L;
     public static final IFunctionDescriptorFactory FACTORY = new IFunctionDescriptorFactory() {
+        @Override
         public IFunctionDescriptor createFunctionDescriptor() {
             return new SqlAvgAggregateDescriptor();
         }
@@ -45,15 +46,15 @@
     }
 
     @Override
-    public ICopyAggregateFunctionFactory createAggregateFunctionFactory(final ICopyEvaluatorFactory[] args)
+    public IAggregateEvaluatorFactory createAggregateEvaluatorFactory(final IScalarEvaluatorFactory[] args)
             throws AlgebricksException {
-        return new ICopyAggregateFunctionFactory() {
+        return new IAggregateEvaluatorFactory() {
             private static final long serialVersionUID = 1L;
 
             @Override
-            public ICopyAggregateFunction createAggregateFunction(final IDataOutputProvider provider)
+            public IAggregateEvaluator createAggregateEvaluator(final IHyracksTaskContext ctx)
                     throws AlgebricksException {
-                return new SqlAvgAggregateFunction(args, provider);
+                return new SqlAvgAggregateFunction(args, ctx);
             }
         };
     }
diff --git a/asterix-runtime/src/main/java/org/apache/asterix/runtime/aggregates/std/SqlAvgAggregateFunction.java b/asterix-runtime/src/main/java/org/apache/asterix/runtime/aggregates/std/SqlAvgAggregateFunction.java
index 2f3058e..dda677a 100644
--- a/asterix-runtime/src/main/java/org/apache/asterix/runtime/aggregates/std/SqlAvgAggregateFunction.java
+++ b/asterix-runtime/src/main/java/org/apache/asterix/runtime/aggregates/std/SqlAvgAggregateFunction.java
@@ -20,14 +20,16 @@
 package org.apache.asterix.runtime.aggregates.std;
 
 import org.apache.hyracks.algebricks.common.exceptions.AlgebricksException;
-import org.apache.hyracks.algebricks.runtime.base.ICopyEvaluatorFactory;
-import org.apache.hyracks.data.std.api.IDataOutputProvider;
+import org.apache.hyracks.algebricks.runtime.base.IScalarEvaluatorFactory;
+import org.apache.hyracks.api.context.IHyracksTaskContext;
+import org.apache.hyracks.data.std.api.IPointable;
 import org.apache.hyracks.dataflow.common.data.accessors.IFrameTupleReference;
 
 public class SqlAvgAggregateFunction extends AbstractAvgAggregateFunction {
 
-    public SqlAvgAggregateFunction(ICopyEvaluatorFactory[] args, IDataOutputProvider output) throws AlgebricksException {
-        super(args, output);
+    public SqlAvgAggregateFunction(IScalarEvaluatorFactory[] args, IHyracksTaskContext context)
+            throws AlgebricksException {
+        super(args, context);
     }
 
     @Override
@@ -36,13 +38,13 @@
     }
 
     @Override
-    public void finish() throws AlgebricksException {
-        finishFinalResults();
+    public void finish(IPointable result) throws AlgebricksException {
+        finishFinalResults(result);
     }
 
     @Override
-    public void finishPartial() throws AlgebricksException {
-        finish();
+    public void finishPartial(IPointable result) throws AlgebricksException {
+        finish(result);
     }
 
     @Override
diff --git a/asterix-runtime/src/main/java/org/apache/asterix/runtime/aggregates/std/SqlCountAggregateDescriptor.java b/asterix-runtime/src/main/java/org/apache/asterix/runtime/aggregates/std/SqlCountAggregateDescriptor.java
index bf03c30..2b76854 100644
--- a/asterix-runtime/src/main/java/org/apache/asterix/runtime/aggregates/std/SqlCountAggregateDescriptor.java
+++ b/asterix-runtime/src/main/java/org/apache/asterix/runtime/aggregates/std/SqlCountAggregateDescriptor.java
@@ -24,10 +24,10 @@
 import org.apache.asterix.runtime.aggregates.base.AbstractAggregateFunctionDynamicDescriptor;
 import org.apache.hyracks.algebricks.common.exceptions.AlgebricksException;
 import org.apache.hyracks.algebricks.core.algebra.functions.FunctionIdentifier;
-import org.apache.hyracks.algebricks.runtime.base.ICopyAggregateFunction;
-import org.apache.hyracks.algebricks.runtime.base.ICopyAggregateFunctionFactory;
-import org.apache.hyracks.algebricks.runtime.base.ICopyEvaluatorFactory;
-import org.apache.hyracks.data.std.api.IDataOutputProvider;
+import org.apache.hyracks.algebricks.runtime.base.IAggregateEvaluator;
+import org.apache.hyracks.algebricks.runtime.base.IAggregateEvaluatorFactory;
+import org.apache.hyracks.algebricks.runtime.base.IScalarEvaluatorFactory;
+import org.apache.hyracks.api.context.IHyracksTaskContext;
 
 /**
  * NULLs are also counted.
@@ -36,6 +36,7 @@
 
     private static final long serialVersionUID = 1L;
     public static final IFunctionDescriptorFactory FACTORY = new IFunctionDescriptorFactory() {
+        @Override
         public IFunctionDescriptor createFunctionDescriptor() {
             return new SqlCountAggregateDescriptor();
         }
@@ -47,16 +48,15 @@
     }
 
     @Override
-    public ICopyAggregateFunctionFactory createAggregateFunctionFactory(final ICopyEvaluatorFactory[] args)
+    public IAggregateEvaluatorFactory createAggregateEvaluatorFactory(final IScalarEvaluatorFactory[] args)
             throws AlgebricksException {
-        return new ICopyAggregateFunctionFactory() {
+        return new IAggregateEvaluatorFactory() {
 
             private static final long serialVersionUID = 1L;
 
             @Override
-            public ICopyAggregateFunction createAggregateFunction(IDataOutputProvider provider)
-                    throws AlgebricksException {
-                return new SqlCountAggregateFunction(args, provider);
+            public IAggregateEvaluator createAggregateEvaluator(IHyracksTaskContext ctx) throws AlgebricksException {
+                return new SqlCountAggregateFunction(args, ctx);
             }
         };
     }
diff --git a/asterix-runtime/src/main/java/org/apache/asterix/runtime/aggregates/std/SqlCountAggregateFunction.java b/asterix-runtime/src/main/java/org/apache/asterix/runtime/aggregates/std/SqlCountAggregateFunction.java
index 4298e92..45e9125 100644
--- a/asterix-runtime/src/main/java/org/apache/asterix/runtime/aggregates/std/SqlCountAggregateFunction.java
+++ b/asterix-runtime/src/main/java/org/apache/asterix/runtime/aggregates/std/SqlCountAggregateFunction.java
@@ -19,17 +19,17 @@
 package org.apache.asterix.runtime.aggregates.std;
 
 import org.apache.hyracks.algebricks.common.exceptions.AlgebricksException;
-import org.apache.hyracks.algebricks.runtime.base.ICopyEvaluatorFactory;
-import org.apache.hyracks.data.std.api.IDataOutputProvider;
+import org.apache.hyracks.algebricks.runtime.base.IScalarEvaluatorFactory;
+import org.apache.hyracks.api.context.IHyracksTaskContext;
 
 /**
  * COUNT returns the number of non-null items in the given list. Note that COUNT(NULL) is not allowed.
  */
 public class SqlCountAggregateFunction extends AbstractCountAggregateFunction {
 
-    public SqlCountAggregateFunction(ICopyEvaluatorFactory[] args, IDataOutputProvider output)
+    public SqlCountAggregateFunction(IScalarEvaluatorFactory[] args, IHyracksTaskContext context)
             throws AlgebricksException {
-        super(args, output);
+        super(args, context);
     }
 
     @Override
diff --git a/asterix-runtime/src/main/java/org/apache/asterix/runtime/aggregates/std/SqlMaxAggregateDescriptor.java b/asterix-runtime/src/main/java/org/apache/asterix/runtime/aggregates/std/SqlMaxAggregateDescriptor.java
index a51135c..cc553e2 100644
--- a/asterix-runtime/src/main/java/org/apache/asterix/runtime/aggregates/std/SqlMaxAggregateDescriptor.java
+++ b/asterix-runtime/src/main/java/org/apache/asterix/runtime/aggregates/std/SqlMaxAggregateDescriptor.java
@@ -24,15 +24,16 @@
 import org.apache.asterix.runtime.aggregates.base.AbstractAggregateFunctionDynamicDescriptor;
 import org.apache.hyracks.algebricks.common.exceptions.AlgebricksException;
 import org.apache.hyracks.algebricks.core.algebra.functions.FunctionIdentifier;
-import org.apache.hyracks.algebricks.runtime.base.ICopyAggregateFunction;
-import org.apache.hyracks.algebricks.runtime.base.ICopyAggregateFunctionFactory;
-import org.apache.hyracks.algebricks.runtime.base.ICopyEvaluatorFactory;
-import org.apache.hyracks.data.std.api.IDataOutputProvider;
+import org.apache.hyracks.algebricks.runtime.base.IAggregateEvaluator;
+import org.apache.hyracks.algebricks.runtime.base.IAggregateEvaluatorFactory;
+import org.apache.hyracks.algebricks.runtime.base.IScalarEvaluatorFactory;
+import org.apache.hyracks.api.context.IHyracksTaskContext;
 
 public class SqlMaxAggregateDescriptor extends AbstractAggregateFunctionDynamicDescriptor {
 
     private static final long serialVersionUID = 1L;
     public static final IFunctionDescriptorFactory FACTORY = new IFunctionDescriptorFactory() {
+        @Override
         public IFunctionDescriptor createFunctionDescriptor() {
             return new SqlMaxAggregateDescriptor();
         }
@@ -44,15 +45,15 @@
     }
 
     @Override
-    public ICopyAggregateFunctionFactory createAggregateFunctionFactory(final ICopyEvaluatorFactory[] args)
+    public IAggregateEvaluatorFactory createAggregateEvaluatorFactory(final IScalarEvaluatorFactory[] args)
             throws AlgebricksException {
-        return new ICopyAggregateFunctionFactory() {
+        return new IAggregateEvaluatorFactory() {
             private static final long serialVersionUID = 1L;
 
             @Override
-            public ICopyAggregateFunction createAggregateFunction(final IDataOutputProvider provider)
+            public IAggregateEvaluator createAggregateEvaluator(final IHyracksTaskContext ctx)
                     throws AlgebricksException {
-                return new SqlMinMaxAggregateFunction(args, provider, false, false);
+                return new SqlMinMaxAggregateFunction(args, ctx, false, false);
             }
         };
     }
diff --git a/asterix-runtime/src/main/java/org/apache/asterix/runtime/aggregates/std/SqlMinAggregateDescriptor.java b/asterix-runtime/src/main/java/org/apache/asterix/runtime/aggregates/std/SqlMinAggregateDescriptor.java
index 5e62f2d..9d34474 100644
--- a/asterix-runtime/src/main/java/org/apache/asterix/runtime/aggregates/std/SqlMinAggregateDescriptor.java
+++ b/asterix-runtime/src/main/java/org/apache/asterix/runtime/aggregates/std/SqlMinAggregateDescriptor.java
@@ -24,15 +24,16 @@
 import org.apache.asterix.runtime.aggregates.base.AbstractAggregateFunctionDynamicDescriptor;
 import org.apache.hyracks.algebricks.common.exceptions.AlgebricksException;
 import org.apache.hyracks.algebricks.core.algebra.functions.FunctionIdentifier;
-import org.apache.hyracks.algebricks.runtime.base.ICopyAggregateFunction;
-import org.apache.hyracks.algebricks.runtime.base.ICopyAggregateFunctionFactory;
-import org.apache.hyracks.algebricks.runtime.base.ICopyEvaluatorFactory;
-import org.apache.hyracks.data.std.api.IDataOutputProvider;
+import org.apache.hyracks.algebricks.runtime.base.IAggregateEvaluator;
+import org.apache.hyracks.algebricks.runtime.base.IAggregateEvaluatorFactory;
+import org.apache.hyracks.algebricks.runtime.base.IScalarEvaluatorFactory;
+import org.apache.hyracks.api.context.IHyracksTaskContext;
 
 public class SqlMinAggregateDescriptor extends AbstractAggregateFunctionDynamicDescriptor {
 
     private static final long serialVersionUID = 1L;
     public static final IFunctionDescriptorFactory FACTORY = new IFunctionDescriptorFactory() {
+        @Override
         public IFunctionDescriptor createFunctionDescriptor() {
             return new SqlMinAggregateDescriptor();
         }
@@ -44,15 +45,15 @@
     }
 
     @Override
-    public ICopyAggregateFunctionFactory createAggregateFunctionFactory(final ICopyEvaluatorFactory[] args)
+    public IAggregateEvaluatorFactory createAggregateEvaluatorFactory(final IScalarEvaluatorFactory[] args)
             throws AlgebricksException {
-        return new ICopyAggregateFunctionFactory() {
+        return new IAggregateEvaluatorFactory() {
             private static final long serialVersionUID = 1L;
 
             @Override
-            public ICopyAggregateFunction createAggregateFunction(final IDataOutputProvider provider)
+            public IAggregateEvaluator createAggregateEvaluator(final IHyracksTaskContext ctx)
                     throws AlgebricksException {
-                return new SqlMinMaxAggregateFunction(args, provider, true, false);
+                return new SqlMinMaxAggregateFunction(args, ctx, true, false);
             }
         };
     }
diff --git a/asterix-runtime/src/main/java/org/apache/asterix/runtime/aggregates/std/SqlMinMaxAggregateFunction.java b/asterix-runtime/src/main/java/org/apache/asterix/runtime/aggregates/std/SqlMinMaxAggregateFunction.java
index 1841ed0..dd4ec85 100644
--- a/asterix-runtime/src/main/java/org/apache/asterix/runtime/aggregates/std/SqlMinMaxAggregateFunction.java
+++ b/asterix-runtime/src/main/java/org/apache/asterix/runtime/aggregates/std/SqlMinMaxAggregateFunction.java
@@ -22,15 +22,15 @@
 
 import org.apache.asterix.om.types.ATypeTag;
 import org.apache.hyracks.algebricks.common.exceptions.AlgebricksException;
-import org.apache.hyracks.algebricks.runtime.base.ICopyEvaluatorFactory;
-import org.apache.hyracks.data.std.api.IDataOutputProvider;
+import org.apache.hyracks.algebricks.runtime.base.IScalarEvaluatorFactory;
+import org.apache.hyracks.api.context.IHyracksTaskContext;
 
 public class SqlMinMaxAggregateFunction extends AbstractMinMaxAggregateFunction {
     private final boolean isLocalAgg;
 
-    public SqlMinMaxAggregateFunction(ICopyEvaluatorFactory[] args, IDataOutputProvider provider, boolean isMin,
+    public SqlMinMaxAggregateFunction(IScalarEvaluatorFactory[] args, IHyracksTaskContext context, boolean isMin,
             boolean isLocalAgg) throws AlgebricksException {
-        super(args, provider, isMin);
+        super(args, context, isMin);
         this.isLocalAgg = isLocalAgg;
     }
 
@@ -49,9 +49,9 @@
     protected void finishSystemNull() throws IOException {
         // Empty stream. For local agg return system null. For global agg return null.
         if (isLocalAgg) {
-            out.writeByte(ATypeTag.SERIALIZED_SYSTEM_NULL_TYPE_TAG);
+            resultStorage.getDataOutput().writeByte(ATypeTag.SERIALIZED_SYSTEM_NULL_TYPE_TAG);
         } else {
-            out.writeByte(ATypeTag.SERIALIZED_NULL_TYPE_TAG);
+            resultStorage.getDataOutput().writeByte(ATypeTag.SERIALIZED_NULL_TYPE_TAG);
         }
     }
 }
diff --git a/asterix-runtime/src/main/java/org/apache/asterix/runtime/aggregates/std/SqlSumAggregateDescriptor.java b/asterix-runtime/src/main/java/org/apache/asterix/runtime/aggregates/std/SqlSumAggregateDescriptor.java
index 6d7fbca..9eee26a 100644
--- a/asterix-runtime/src/main/java/org/apache/asterix/runtime/aggregates/std/SqlSumAggregateDescriptor.java
+++ b/asterix-runtime/src/main/java/org/apache/asterix/runtime/aggregates/std/SqlSumAggregateDescriptor.java
@@ -24,15 +24,16 @@
 import org.apache.asterix.runtime.aggregates.base.AbstractAggregateFunctionDynamicDescriptor;
 import org.apache.hyracks.algebricks.common.exceptions.AlgebricksException;
 import org.apache.hyracks.algebricks.core.algebra.functions.FunctionIdentifier;
-import org.apache.hyracks.algebricks.runtime.base.ICopyAggregateFunction;
-import org.apache.hyracks.algebricks.runtime.base.ICopyAggregateFunctionFactory;
-import org.apache.hyracks.algebricks.runtime.base.ICopyEvaluatorFactory;
-import org.apache.hyracks.data.std.api.IDataOutputProvider;
+import org.apache.hyracks.algebricks.runtime.base.IAggregateEvaluator;
+import org.apache.hyracks.algebricks.runtime.base.IAggregateEvaluatorFactory;
+import org.apache.hyracks.algebricks.runtime.base.IScalarEvaluatorFactory;
+import org.apache.hyracks.api.context.IHyracksTaskContext;
 
 public class SqlSumAggregateDescriptor extends AbstractAggregateFunctionDynamicDescriptor {
 
     private static final long serialVersionUID = 1L;
     public static final IFunctionDescriptorFactory FACTORY = new IFunctionDescriptorFactory() {
+        @Override
         public IFunctionDescriptor createFunctionDescriptor() {
             return new SqlSumAggregateDescriptor();
         }
@@ -44,15 +45,15 @@
     }
 
     @Override
-    public ICopyAggregateFunctionFactory createAggregateFunctionFactory(final ICopyEvaluatorFactory[] args)
+    public IAggregateEvaluatorFactory createAggregateEvaluatorFactory(final IScalarEvaluatorFactory[] args)
             throws AlgebricksException {
-        return new ICopyAggregateFunctionFactory() {
+        return new IAggregateEvaluatorFactory() {
             private static final long serialVersionUID = 1L;
 
             @Override
-            public ICopyAggregateFunction createAggregateFunction(final IDataOutputProvider provider)
+            public IAggregateEvaluator createAggregateEvaluator(final IHyracksTaskContext ctx)
                     throws AlgebricksException {
-                return new SqlSumAggregateFunction(args, provider, false);
+                return new SqlSumAggregateFunction(args, ctx, false);
             };
         };
     }
diff --git a/asterix-runtime/src/main/java/org/apache/asterix/runtime/aggregates/std/SqlSumAggregateFunction.java b/asterix-runtime/src/main/java/org/apache/asterix/runtime/aggregates/std/SqlSumAggregateFunction.java
index f6a7c4a..3536370 100644
--- a/asterix-runtime/src/main/java/org/apache/asterix/runtime/aggregates/std/SqlSumAggregateFunction.java
+++ b/asterix-runtime/src/main/java/org/apache/asterix/runtime/aggregates/std/SqlSumAggregateFunction.java
@@ -25,15 +25,15 @@
 import org.apache.asterix.om.types.ATypeTag;
 import org.apache.asterix.om.types.BuiltinType;
 import org.apache.hyracks.algebricks.common.exceptions.AlgebricksException;
-import org.apache.hyracks.algebricks.runtime.base.ICopyEvaluatorFactory;
-import org.apache.hyracks.data.std.api.IDataOutputProvider;
+import org.apache.hyracks.algebricks.runtime.base.IScalarEvaluatorFactory;
+import org.apache.hyracks.api.context.IHyracksTaskContext;
 
 public class SqlSumAggregateFunction extends AbstractSumAggregateFunction {
     private final boolean isLocalAgg;
 
-    public SqlSumAggregateFunction(ICopyEvaluatorFactory[] args, IDataOutputProvider provider, boolean isLocalAgg)
+    public SqlSumAggregateFunction(IScalarEvaluatorFactory[] args, IHyracksTaskContext context, boolean isLocalAgg)
             throws AlgebricksException {
-        super(args, provider);
+        super(args, context);
         this.isLocalAgg = isLocalAgg;
     }
 
@@ -56,10 +56,10 @@
     protected void finishSystemNull() throws IOException {
         // Empty stream. For local agg return system null. For global agg return null.
         if (isLocalAgg) {
-            out.writeByte(ATypeTag.SYSTEM_NULL.serialize());
+            resultStorage.getDataOutput().writeByte(ATypeTag.SYSTEM_NULL.serialize());
         } else {
             serde = AqlSerializerDeserializerProvider.INSTANCE.getSerializerDeserializer(BuiltinType.ANULL);
-            serde.serialize(ANull.NULL, out);
+            serde.serialize(ANull.NULL, resultStorage.getDataOutput());
         }
     }
 }
diff --git a/asterix-runtime/src/main/java/org/apache/asterix/runtime/aggregates/std/SumAggregateDescriptor.java b/asterix-runtime/src/main/java/org/apache/asterix/runtime/aggregates/std/SumAggregateDescriptor.java
index 1c70ee1..be1b7a4 100644
--- a/asterix-runtime/src/main/java/org/apache/asterix/runtime/aggregates/std/SumAggregateDescriptor.java
+++ b/asterix-runtime/src/main/java/org/apache/asterix/runtime/aggregates/std/SumAggregateDescriptor.java
@@ -24,15 +24,16 @@
 import org.apache.asterix.runtime.aggregates.base.AbstractAggregateFunctionDynamicDescriptor;
 import org.apache.hyracks.algebricks.common.exceptions.AlgebricksException;
 import org.apache.hyracks.algebricks.core.algebra.functions.FunctionIdentifier;
-import org.apache.hyracks.algebricks.runtime.base.ICopyAggregateFunction;
-import org.apache.hyracks.algebricks.runtime.base.ICopyAggregateFunctionFactory;
-import org.apache.hyracks.algebricks.runtime.base.ICopyEvaluatorFactory;
-import org.apache.hyracks.data.std.api.IDataOutputProvider;
+import org.apache.hyracks.algebricks.runtime.base.IAggregateEvaluator;
+import org.apache.hyracks.algebricks.runtime.base.IAggregateEvaluatorFactory;
+import org.apache.hyracks.algebricks.runtime.base.IScalarEvaluatorFactory;
+import org.apache.hyracks.api.context.IHyracksTaskContext;
 
 public class SumAggregateDescriptor extends AbstractAggregateFunctionDynamicDescriptor {
 
     private static final long serialVersionUID = 1L;
     public static final IFunctionDescriptorFactory FACTORY = new IFunctionDescriptorFactory() {
+        @Override
         public IFunctionDescriptor createFunctionDescriptor() {
             return new SumAggregateDescriptor();
         }
@@ -44,15 +45,15 @@
     }
 
     @Override
-    public ICopyAggregateFunctionFactory createAggregateFunctionFactory(final ICopyEvaluatorFactory[] args)
+    public IAggregateEvaluatorFactory createAggregateEvaluatorFactory(final IScalarEvaluatorFactory[] args)
             throws AlgebricksException {
-        return new ICopyAggregateFunctionFactory() {
+        return new IAggregateEvaluatorFactory() {
             private static final long serialVersionUID = 1L;
 
             @Override
-            public ICopyAggregateFunction createAggregateFunction(final IDataOutputProvider provider)
+            public IAggregateEvaluator createAggregateEvaluator(final IHyracksTaskContext ctx)
                     throws AlgebricksException {
-                return new SumAggregateFunction(args, provider, false);
+                return new SumAggregateFunction(args, ctx, false);
             };
         };
     }
diff --git a/asterix-runtime/src/main/java/org/apache/asterix/runtime/aggregates/std/SumAggregateFunction.java b/asterix-runtime/src/main/java/org/apache/asterix/runtime/aggregates/std/SumAggregateFunction.java
index 959a71d..87f3cb3 100644
--- a/asterix-runtime/src/main/java/org/apache/asterix/runtime/aggregates/std/SumAggregateFunction.java
+++ b/asterix-runtime/src/main/java/org/apache/asterix/runtime/aggregates/std/SumAggregateFunction.java
@@ -25,15 +25,15 @@
 import org.apache.asterix.om.types.ATypeTag;
 import org.apache.asterix.om.types.BuiltinType;
 import org.apache.hyracks.algebricks.common.exceptions.AlgebricksException;
-import org.apache.hyracks.algebricks.runtime.base.ICopyEvaluatorFactory;
-import org.apache.hyracks.data.std.api.IDataOutputProvider;
+import org.apache.hyracks.algebricks.runtime.base.IScalarEvaluatorFactory;
+import org.apache.hyracks.api.context.IHyracksTaskContext;
 
 public class SumAggregateFunction extends AbstractSumAggregateFunction {
     private final boolean isLocalAgg;
 
-    public SumAggregateFunction(ICopyEvaluatorFactory[] args, IDataOutputProvider provider, boolean isLocalAgg)
+    public SumAggregateFunction(IScalarEvaluatorFactory[] args, IHyracksTaskContext context, boolean isLocalAgg)
             throws AlgebricksException {
-        super(args, provider);
+        super(args, context);
         this.isLocalAgg = isLocalAgg;
     }
 
@@ -62,10 +62,10 @@
     protected void finishSystemNull() throws IOException {
         // Empty stream. For local agg return system null. For global agg return null.
         if (isLocalAgg) {
-            out.writeByte(ATypeTag.SYSTEM_NULL.serialize());
+            resultStorage.getDataOutput().writeByte(ATypeTag.SYSTEM_NULL.serialize());
         } else {
             serde = AqlSerializerDeserializerProvider.INSTANCE.getSerializerDeserializer(BuiltinType.ANULL);
-            serde.serialize(ANull.NULL, out);
+            serde.serialize(ANull.NULL, resultStorage.getDataOutput());
         }
     }
 }
diff --git a/asterix-runtime/src/main/java/org/apache/asterix/runtime/aggregates/stream/EmptyStreamAggregateDescriptor.java b/asterix-runtime/src/main/java/org/apache/asterix/runtime/aggregates/stream/EmptyStreamAggregateDescriptor.java
index f64c888..998404f 100644
--- a/asterix-runtime/src/main/java/org/apache/asterix/runtime/aggregates/stream/EmptyStreamAggregateDescriptor.java
+++ b/asterix-runtime/src/main/java/org/apache/asterix/runtime/aggregates/stream/EmptyStreamAggregateDescriptor.java
@@ -18,8 +18,6 @@
  */
 package org.apache.asterix.runtime.aggregates.stream;
 
-import java.io.DataOutput;
-
 import org.apache.asterix.formats.nontagged.AqlSerializerDeserializerProvider;
 import org.apache.asterix.om.base.ABoolean;
 import org.apache.asterix.om.functions.AsterixBuiltinFunctions;
@@ -29,12 +27,14 @@
 import org.apache.asterix.runtime.aggregates.base.AbstractAggregateFunctionDynamicDescriptor;
 import org.apache.hyracks.algebricks.common.exceptions.AlgebricksException;
 import org.apache.hyracks.algebricks.core.algebra.functions.FunctionIdentifier;
-import org.apache.hyracks.algebricks.runtime.base.ICopyAggregateFunction;
-import org.apache.hyracks.algebricks.runtime.base.ICopyAggregateFunctionFactory;
-import org.apache.hyracks.algebricks.runtime.base.ICopyEvaluatorFactory;
+import org.apache.hyracks.algebricks.runtime.base.IAggregateEvaluator;
+import org.apache.hyracks.algebricks.runtime.base.IAggregateEvaluatorFactory;
+import org.apache.hyracks.algebricks.runtime.base.IScalarEvaluatorFactory;
+import org.apache.hyracks.api.context.IHyracksTaskContext;
 import org.apache.hyracks.api.dataflow.value.ISerializerDeserializer;
 import org.apache.hyracks.api.exceptions.HyracksDataException;
-import org.apache.hyracks.data.std.api.IDataOutputProvider;
+import org.apache.hyracks.data.std.api.IPointable;
+import org.apache.hyracks.data.std.util.ArrayBackedValueStorage;
 import org.apache.hyracks.dataflow.common.data.accessors.IFrameTupleReference;
 
 public class EmptyStreamAggregateDescriptor extends AbstractAggregateFunctionDynamicDescriptor {
@@ -50,19 +50,19 @@
     };
 
     @Override
-    public ICopyAggregateFunctionFactory createAggregateFunctionFactory(ICopyEvaluatorFactory[] args)
+    public IAggregateEvaluatorFactory createAggregateEvaluatorFactory(IScalarEvaluatorFactory[] args)
             throws AlgebricksException {
-        return new ICopyAggregateFunctionFactory() {
+        return new IAggregateEvaluatorFactory() {
 
             private static final long serialVersionUID = 1L;
 
             @Override
-            public ICopyAggregateFunction createAggregateFunction(final IDataOutputProvider provider)
+            public IAggregateEvaluator createAggregateEvaluator(final IHyracksTaskContext ctx)
                     throws AlgebricksException {
 
-                return new ICopyAggregateFunction() {
+                return new IAggregateEvaluator() {
 
-                    private DataOutput out = provider.getDataOutput();
+                    private ArrayBackedValueStorage resultStorage = new ArrayBackedValueStorage();
                     @SuppressWarnings("rawtypes")
                     private ISerializerDeserializer serde = AqlSerializerDeserializerProvider.INSTANCE
                             .getSerializerDeserializer(BuiltinType.ABOOLEAN);
@@ -81,18 +81,20 @@
 
                     @SuppressWarnings("unchecked")
                     @Override
-                    public void finish() throws AlgebricksException {
+                    public void finish(IPointable result) throws AlgebricksException {
+                        resultStorage.reset();
                         ABoolean b = res ? ABoolean.TRUE : ABoolean.FALSE;
                         try {
-                            serde.serialize(b, out);
+                            serde.serialize(b, resultStorage.getDataOutput());
                         } catch (HyracksDataException e) {
                             throw new AlgebricksException(e);
                         }
+                        result.set(resultStorage);
                     }
 
                     @Override
-                    public void finishPartial() throws AlgebricksException {
-                        finish();
+                    public void finishPartial(IPointable result) throws AlgebricksException {
+                        finish(result);
                     }
                 };
             }
diff --git a/asterix-runtime/src/main/java/org/apache/asterix/runtime/aggregates/stream/NonEmptyStreamAggregateDescriptor.java b/asterix-runtime/src/main/java/org/apache/asterix/runtime/aggregates/stream/NonEmptyStreamAggregateDescriptor.java
index 69117bb..3d484b2 100644
--- a/asterix-runtime/src/main/java/org/apache/asterix/runtime/aggregates/stream/NonEmptyStreamAggregateDescriptor.java
+++ b/asterix-runtime/src/main/java/org/apache/asterix/runtime/aggregates/stream/NonEmptyStreamAggregateDescriptor.java
@@ -18,8 +18,6 @@
  */
 package org.apache.asterix.runtime.aggregates.stream;
 
-import java.io.DataOutput;
-
 import org.apache.asterix.formats.nontagged.AqlSerializerDeserializerProvider;
 import org.apache.asterix.om.base.ABoolean;
 import org.apache.asterix.om.functions.AsterixBuiltinFunctions;
@@ -29,12 +27,14 @@
 import org.apache.asterix.runtime.aggregates.base.AbstractAggregateFunctionDynamicDescriptor;
 import org.apache.hyracks.algebricks.common.exceptions.AlgebricksException;
 import org.apache.hyracks.algebricks.core.algebra.functions.FunctionIdentifier;
-import org.apache.hyracks.algebricks.runtime.base.ICopyAggregateFunction;
-import org.apache.hyracks.algebricks.runtime.base.ICopyAggregateFunctionFactory;
-import org.apache.hyracks.algebricks.runtime.base.ICopyEvaluatorFactory;
+import org.apache.hyracks.algebricks.runtime.base.IAggregateEvaluator;
+import org.apache.hyracks.algebricks.runtime.base.IAggregateEvaluatorFactory;
+import org.apache.hyracks.algebricks.runtime.base.IScalarEvaluatorFactory;
+import org.apache.hyracks.api.context.IHyracksTaskContext;
 import org.apache.hyracks.api.dataflow.value.ISerializerDeserializer;
 import org.apache.hyracks.api.exceptions.HyracksDataException;
-import org.apache.hyracks.data.std.api.IDataOutputProvider;
+import org.apache.hyracks.data.std.api.IPointable;
+import org.apache.hyracks.data.std.util.ArrayBackedValueStorage;
 import org.apache.hyracks.dataflow.common.data.accessors.IFrameTupleReference;
 
 public class NonEmptyStreamAggregateDescriptor extends AbstractAggregateFunctionDynamicDescriptor {
@@ -42,25 +42,26 @@
     private static final long serialVersionUID = 1L;
 
     public static final IFunctionDescriptorFactory FACTORY = new IFunctionDescriptorFactory() {
+        @Override
         public IFunctionDescriptor createFunctionDescriptor() {
             return new NonEmptyStreamAggregateDescriptor();
         }
     };
 
     @Override
-    public ICopyAggregateFunctionFactory createAggregateFunctionFactory(ICopyEvaluatorFactory[] args)
+    public IAggregateEvaluatorFactory createAggregateEvaluatorFactory(IScalarEvaluatorFactory[] args)
             throws AlgebricksException {
-        return new ICopyAggregateFunctionFactory() {
+        return new IAggregateEvaluatorFactory() {
 
             private static final long serialVersionUID = 1L;
 
             @Override
-            public ICopyAggregateFunction createAggregateFunction(final IDataOutputProvider provider)
+            public IAggregateEvaluator createAggregateEvaluator(final IHyracksTaskContext ctx)
                     throws AlgebricksException {
 
-                return new ICopyAggregateFunction() {
+                return new IAggregateEvaluator() {
 
-                    private DataOutput out = provider.getDataOutput();
+                    private ArrayBackedValueStorage resultStorage = new ArrayBackedValueStorage();
                     @SuppressWarnings("rawtypes")
                     private ISerializerDeserializer serde = AqlSerializerDeserializerProvider.INSTANCE
                             .getSerializerDeserializer(BuiltinType.ABOOLEAN);
@@ -79,18 +80,20 @@
 
                     @SuppressWarnings("unchecked")
                     @Override
-                    public void finish() throws AlgebricksException {
+                    public void finish(IPointable result) throws AlgebricksException {
+                        resultStorage.reset();
                         ABoolean b = res ? ABoolean.TRUE : ABoolean.FALSE;
                         try {
-                            serde.serialize(b, out);
+                            serde.serialize(b, resultStorage.getDataOutput());
                         } catch (HyracksDataException e) {
                             throw new AlgebricksException(e);
                         }
+                        result.set(resultStorage);
                     }
 
                     @Override
-                    public void finishPartial() throws AlgebricksException {
-                        finish();
+                    public void finishPartial(IPointable result) throws AlgebricksException {
+                        finish(result);
                     }
                 };
             }
diff --git a/asterix-runtime/src/main/java/org/apache/asterix/runtime/evaluators/accessors/CircleCenterAccessor.java b/asterix-runtime/src/main/java/org/apache/asterix/runtime/evaluators/accessors/CircleCenterAccessor.java
index 7bddb09..fba132a 100644
--- a/asterix-runtime/src/main/java/org/apache/asterix/runtime/evaluators/accessors/CircleCenterAccessor.java
+++ b/asterix-runtime/src/main/java/org/apache/asterix/runtime/evaluators/accessors/CircleCenterAccessor.java
@@ -36,10 +36,12 @@
 import org.apache.asterix.runtime.evaluators.base.AbstractScalarFunctionDynamicDescriptor;
 import org.apache.hyracks.algebricks.common.exceptions.AlgebricksException;
 import org.apache.hyracks.algebricks.core.algebra.functions.FunctionIdentifier;
-import org.apache.hyracks.algebricks.runtime.base.ICopyEvaluator;
-import org.apache.hyracks.algebricks.runtime.base.ICopyEvaluatorFactory;
+import org.apache.hyracks.algebricks.runtime.base.IScalarEvaluator;
+import org.apache.hyracks.algebricks.runtime.base.IScalarEvaluatorFactory;
+import org.apache.hyracks.api.context.IHyracksTaskContext;
 import org.apache.hyracks.api.dataflow.value.ISerializerDeserializer;
-import org.apache.hyracks.data.std.api.IDataOutputProvider;
+import org.apache.hyracks.data.std.api.IPointable;
+import org.apache.hyracks.data.std.primitive.VoidPointable;
 import org.apache.hyracks.data.std.util.ArrayBackedValueStorage;
 import org.apache.hyracks.dataflow.common.data.accessors.IFrameTupleReference;
 
@@ -56,17 +58,19 @@
     };
 
     @Override
-    public ICopyEvaluatorFactory createEvaluatorFactory(final ICopyEvaluatorFactory[] args) throws AlgebricksException {
-        return new ICopyEvaluatorFactory() {
+    public IScalarEvaluatorFactory createEvaluatorFactory(final IScalarEvaluatorFactory[] args)
+            throws AlgebricksException {
+        return new IScalarEvaluatorFactory() {
 
             private static final long serialVersionUID = 1L;
 
             @Override
-            public ICopyEvaluator createEvaluator(final IDataOutputProvider output) throws AlgebricksException {
-                return new ICopyEvaluator() {
-                    private final DataOutput out = output.getDataOutput();
-                    private final ArrayBackedValueStorage argOut = new ArrayBackedValueStorage();
-                    private final ICopyEvaluator eval = args[0].createEvaluator(argOut);
+            public IScalarEvaluator createScalarEvaluator(final IHyracksTaskContext ctx) throws AlgebricksException {
+                return new IScalarEvaluator() {
+                    private final ArrayBackedValueStorage resultStorage = new ArrayBackedValueStorage();
+                    private final DataOutput out = resultStorage.getDataOutput();
+                    private final IPointable argPtr = new VoidPointable();
+                    private final IScalarEvaluator eval = args[0].createScalarEvaluator(ctx);
 
                     @SuppressWarnings("unchecked")
                     private final ISerializerDeserializer<ANull> nullSerde = AqlSerializerDeserializerProvider.INSTANCE
@@ -77,31 +81,32 @@
                             .getSerializerDeserializer(BuiltinType.APOINT);
 
                     @Override
-                    public void evaluate(IFrameTupleReference tuple) throws AlgebricksException {
-                        argOut.reset();
-                        eval.evaluate(tuple);
-                        byte[] bytes = argOut.getByteArray();
+                    public void evaluate(IFrameTupleReference tuple, IPointable result) throws AlgebricksException {
+                        eval.evaluate(tuple, argPtr);
+                        byte[] bytes = argPtr.getByteArray();
+                        int startOffset = argPtr.getStartOffset();
+                        resultStorage.reset();
 
                         try {
                             double cX;
                             double cY;
-                            if (bytes[0] == ATypeTag.SERIALIZED_CIRCLE_TYPE_TAG) {
-                                cX = ADoubleSerializerDeserializer.getDouble(bytes,
-                                        ACircleSerializerDeserializer.getCenterPointCoordinateOffset(Coordinate.X));
-                                cY = ADoubleSerializerDeserializer.getDouble(bytes,
-                                        ACircleSerializerDeserializer.getCenterPointCoordinateOffset(Coordinate.Y));
+                            if (bytes[startOffset] == ATypeTag.SERIALIZED_CIRCLE_TYPE_TAG) {
+                                cX = ADoubleSerializerDeserializer.getDouble(bytes, startOffset
+                                        + ACircleSerializerDeserializer.getCenterPointCoordinateOffset(Coordinate.X));
+                                cY = ADoubleSerializerDeserializer.getDouble(bytes, startOffset
+                                        + ACircleSerializerDeserializer.getCenterPointCoordinateOffset(Coordinate.Y));
                                 aPoint.setValue(cX, cY);
                                 pointSerde.serialize(aPoint, out);
-                            } else if (bytes[0] == ATypeTag.SERIALIZED_NULL_TYPE_TAG) {
+                            } else if (bytes[startOffset] == ATypeTag.SERIALIZED_NULL_TYPE_TAG) {
                                 nullSerde.serialize(ANull.NULL, out);
                             } else {
-                                throw new AlgebricksException("get-center does not support the type: " + bytes[0]
-                                        + " It is only implemented for CIRCLE.");
+                                throw new AlgebricksException("get-center does not support the type: "
+                                        + bytes[startOffset] + " It is only implemented for CIRCLE.");
                             }
-
                         } catch (IOException e) {
                             throw new AlgebricksException(e);
                         }
+                        result.set(resultStorage);
                     }
                 };
             }
diff --git a/asterix-runtime/src/main/java/org/apache/asterix/runtime/evaluators/accessors/CircleRadiusAccessor.java b/asterix-runtime/src/main/java/org/apache/asterix/runtime/evaluators/accessors/CircleRadiusAccessor.java
index d44f43a..714d51b 100644
--- a/asterix-runtime/src/main/java/org/apache/asterix/runtime/evaluators/accessors/CircleRadiusAccessor.java
+++ b/asterix-runtime/src/main/java/org/apache/asterix/runtime/evaluators/accessors/CircleRadiusAccessor.java
@@ -35,10 +35,12 @@
 import org.apache.asterix.runtime.evaluators.base.AbstractScalarFunctionDynamicDescriptor;
 import org.apache.hyracks.algebricks.common.exceptions.AlgebricksException;
 import org.apache.hyracks.algebricks.core.algebra.functions.FunctionIdentifier;
-import org.apache.hyracks.algebricks.runtime.base.ICopyEvaluator;
-import org.apache.hyracks.algebricks.runtime.base.ICopyEvaluatorFactory;
+import org.apache.hyracks.algebricks.runtime.base.IScalarEvaluator;
+import org.apache.hyracks.algebricks.runtime.base.IScalarEvaluatorFactory;
+import org.apache.hyracks.api.context.IHyracksTaskContext;
 import org.apache.hyracks.api.dataflow.value.ISerializerDeserializer;
-import org.apache.hyracks.data.std.api.IDataOutputProvider;
+import org.apache.hyracks.data.std.api.IPointable;
+import org.apache.hyracks.data.std.primitive.VoidPointable;
 import org.apache.hyracks.data.std.util.ArrayBackedValueStorage;
 import org.apache.hyracks.dataflow.common.data.accessors.IFrameTupleReference;
 
@@ -54,17 +56,19 @@
     };
 
     @Override
-    public ICopyEvaluatorFactory createEvaluatorFactory(final ICopyEvaluatorFactory[] args) throws AlgebricksException {
-        return new ICopyEvaluatorFactory() {
+    public IScalarEvaluatorFactory createEvaluatorFactory(final IScalarEvaluatorFactory[] args)
+            throws AlgebricksException {
+        return new IScalarEvaluatorFactory() {
 
             private static final long serialVersionUID = 1L;
 
             @Override
-            public ICopyEvaluator createEvaluator(final IDataOutputProvider output) throws AlgebricksException {
-                return new ICopyEvaluator() {
-                    private final DataOutput out = output.getDataOutput();
-                    private final ArrayBackedValueStorage argOut = new ArrayBackedValueStorage();
-                    private final ICopyEvaluator eval = args[0].createEvaluator(argOut);
+            public IScalarEvaluator createScalarEvaluator(IHyracksTaskContext ctx) throws AlgebricksException {
+                return new IScalarEvaluator() {
+                    private final ArrayBackedValueStorage resultStorage = new ArrayBackedValueStorage();
+                    private final DataOutput out = resultStorage.getDataOutput();
+                    private final IPointable argPtr = new VoidPointable();
+                    private final IScalarEvaluator eval = args[0].createScalarEvaluator(ctx);
 
                     @SuppressWarnings("unchecked")
                     private final ISerializerDeserializer<ANull> nullSerde = AqlSerializerDeserializerProvider.INSTANCE
@@ -75,28 +79,29 @@
                             .getSerializerDeserializer(BuiltinType.ADOUBLE);
 
                     @Override
-                    public void evaluate(IFrameTupleReference tuple) throws AlgebricksException {
-                        argOut.reset();
-                        eval.evaluate(tuple);
-                        byte[] bytes = argOut.getByteArray();
+                    public void evaluate(IFrameTupleReference tuple, IPointable result) throws AlgebricksException {
+                        eval.evaluate(tuple, argPtr);
+                        byte[] bytes = argPtr.getByteArray();
+                        int startOffset = argPtr.getStartOffset();
+                        resultStorage.reset();
 
                         try {
                             double radius;
-                            if (bytes[0] == ATypeTag.SERIALIZED_CIRCLE_TYPE_TAG) {
+                            if (bytes[startOffset] == ATypeTag.SERIALIZED_CIRCLE_TYPE_TAG) {
                                 radius = ADoubleSerializerDeserializer.getDouble(bytes,
-                                        ACircleSerializerDeserializer.getRadiusOffset());
+                                        startOffset + ACircleSerializerDeserializer.getRadiusOffset());
                                 aDouble.setValue(radius);
                                 doubleSerde.serialize(aDouble, out);
-                            } else if (bytes[0] == ATypeTag.SERIALIZED_NULL_TYPE_TAG) {
+                            } else if (bytes[startOffset] == ATypeTag.SERIALIZED_NULL_TYPE_TAG) {
                                 nullSerde.serialize(ANull.NULL, out);
                             } else {
-                                throw new AlgebricksException("get-radius does not support the type: " + bytes[0]
-                                        + " It is only implemented for CIRCLE.");
+                                throw new AlgebricksException("get-radius does not support the type: "
+                                        + bytes[startOffset] + " It is only implemented for CIRCLE.");
                             }
-
                         } catch (IOException e) {
                             throw new AlgebricksException(e);
                         }
+                        result.set(resultStorage);
                     }
                 };
             }
diff --git a/asterix-runtime/src/main/java/org/apache/asterix/runtime/evaluators/accessors/LineRectanglePolygonAccessor.java b/asterix-runtime/src/main/java/org/apache/asterix/runtime/evaluators/accessors/LineRectanglePolygonAccessor.java
index b9f7248..a3b6456 100644
--- a/asterix-runtime/src/main/java/org/apache/asterix/runtime/evaluators/accessors/LineRectanglePolygonAccessor.java
+++ b/asterix-runtime/src/main/java/org/apache/asterix/runtime/evaluators/accessors/LineRectanglePolygonAccessor.java
@@ -41,11 +41,13 @@
 import org.apache.asterix.runtime.evaluators.base.AbstractScalarFunctionDynamicDescriptor;
 import org.apache.hyracks.algebricks.common.exceptions.AlgebricksException;
 import org.apache.hyracks.algebricks.core.algebra.functions.FunctionIdentifier;
-import org.apache.hyracks.algebricks.runtime.base.ICopyEvaluator;
-import org.apache.hyracks.algebricks.runtime.base.ICopyEvaluatorFactory;
+import org.apache.hyracks.algebricks.runtime.base.IScalarEvaluator;
+import org.apache.hyracks.algebricks.runtime.base.IScalarEvaluatorFactory;
+import org.apache.hyracks.api.context.IHyracksTaskContext;
 import org.apache.hyracks.api.dataflow.value.ISerializerDeserializer;
 import org.apache.hyracks.api.exceptions.HyracksDataException;
-import org.apache.hyracks.data.std.api.IDataOutputProvider;
+import org.apache.hyracks.data.std.api.IPointable;
+import org.apache.hyracks.data.std.primitive.VoidPointable;
 import org.apache.hyracks.data.std.util.ArrayBackedValueStorage;
 import org.apache.hyracks.dataflow.common.data.accessors.IFrameTupleReference;
 
@@ -61,17 +63,19 @@
     };
 
     @Override
-    public ICopyEvaluatorFactory createEvaluatorFactory(final ICopyEvaluatorFactory[] args) throws AlgebricksException {
-        return new ICopyEvaluatorFactory() {
+    public IScalarEvaluatorFactory createEvaluatorFactory(final IScalarEvaluatorFactory[] args)
+            throws AlgebricksException {
+        return new IScalarEvaluatorFactory() {
 
             private static final long serialVersionUID = 1L;
 
             @Override
-            public ICopyEvaluator createEvaluator(final IDataOutputProvider output) throws AlgebricksException {
-                return new ICopyEvaluator() {
-                    private final DataOutput out = output.getDataOutput();
-                    private final ArrayBackedValueStorage argOut = new ArrayBackedValueStorage();
-                    private final ICopyEvaluator eval = args[0].createEvaluator(argOut);
+            public IScalarEvaluator createScalarEvaluator(IHyracksTaskContext ctx) throws AlgebricksException {
+                return new IScalarEvaluator() {
+                    private final ArrayBackedValueStorage resultStorage = new ArrayBackedValueStorage();
+                    private final DataOutput out = resultStorage.getDataOutput();
+                    private final IPointable argPtr = new VoidPointable();
+                    private final IScalarEvaluator eval = args[0].createScalarEvaluator(ctx);
 
                     private final OrderedListBuilder listBuilder = new OrderedListBuilder();
                     private final ArrayBackedValueStorage inputVal = new ArrayBackedValueStorage();
@@ -86,59 +90,57 @@
                             .getSerializerDeserializer(BuiltinType.APOINT);
 
                     @Override
-                    public void evaluate(IFrameTupleReference tuple) throws AlgebricksException {
-                        argOut.reset();
-                        eval.evaluate(tuple);
-                        byte[] bytes = argOut.getByteArray();
+                    public void evaluate(IFrameTupleReference tuple, IPointable result) throws AlgebricksException {
+                        eval.evaluate(tuple, argPtr);
+                        byte[] bytes = argPtr.getByteArray();
+                        int startOffset = argPtr.getStartOffset();
+                        resultStorage.reset();
 
                         try {
-                            if (bytes[0] == ATypeTag.SERIALIZED_LINE_TYPE_TAG) {
+                            if (bytes[startOffset] == ATypeTag.SERIALIZED_LINE_TYPE_TAG) {
                                 listBuilder.reset(pointListType);
 
                                 inputVal.reset();
-                                double startX = ADoubleSerializerDeserializer.getDouble(bytes,
-                                        ALineSerializerDeserializer.getStartPointCoordinateOffset(Coordinate.X));
-                                double startY = ADoubleSerializerDeserializer.getDouble(bytes,
-                                        ALineSerializerDeserializer.getStartPointCoordinateOffset(Coordinate.Y));
+                                double startX = ADoubleSerializerDeserializer.getDouble(bytes, startOffset
+                                        + ALineSerializerDeserializer.getStartPointCoordinateOffset(Coordinate.X));
+                                double startY = ADoubleSerializerDeserializer.getDouble(bytes, startOffset
+                                        + ALineSerializerDeserializer.getStartPointCoordinateOffset(Coordinate.Y));
                                 aPoint.setValue(startX, startY);
                                 pointSerde.serialize(aPoint, inputVal.getDataOutput());
                                 listBuilder.addItem(inputVal);
 
                                 inputVal.reset();
-                                double endX = ADoubleSerializerDeserializer.getDouble(bytes,
-                                        ALineSerializerDeserializer.getEndPointCoordinateOffset(Coordinate.X));
-                                double endY = ADoubleSerializerDeserializer.getDouble(bytes,
-                                        ALineSerializerDeserializer.getEndPointCoordinateOffset(Coordinate.Y));
+                                double endX = ADoubleSerializerDeserializer.getDouble(bytes, startOffset
+                                        + ALineSerializerDeserializer.getEndPointCoordinateOffset(Coordinate.X));
+                                double endY = ADoubleSerializerDeserializer.getDouble(bytes, startOffset
+                                        + ALineSerializerDeserializer.getEndPointCoordinateOffset(Coordinate.Y));
                                 aPoint.setValue(endX, endY);
                                 pointSerde.serialize(aPoint, inputVal.getDataOutput());
                                 listBuilder.addItem(inputVal);
                                 listBuilder.write(out, true);
-
-                            } else if (bytes[0] == ATypeTag.SERIALIZED_RECTANGLE_TYPE_TAG) {
+                            } else if (bytes[startOffset] == ATypeTag.SERIALIZED_RECTANGLE_TYPE_TAG) {
                                 listBuilder.reset(pointListType);
-
                                 inputVal.reset();
-                                double x1 = ADoubleSerializerDeserializer.getDouble(bytes,
-                                        ARectangleSerializerDeserializer.getBottomLeftCoordinateOffset(Coordinate.X));
-                                double y1 = ADoubleSerializerDeserializer.getDouble(bytes,
-                                        ARectangleSerializerDeserializer.getBottomLeftCoordinateOffset(Coordinate.Y));
+                                double x1 = ADoubleSerializerDeserializer.getDouble(bytes, startOffset
+                                        + ARectangleSerializerDeserializer.getBottomLeftCoordinateOffset(Coordinate.X));
+                                double y1 = ADoubleSerializerDeserializer.getDouble(bytes, startOffset
+                                        + ARectangleSerializerDeserializer.getBottomLeftCoordinateOffset(Coordinate.Y));
                                 aPoint.setValue(x1, y1);
                                 pointSerde.serialize(aPoint, inputVal.getDataOutput());
                                 listBuilder.addItem(inputVal);
 
                                 inputVal.reset();
-                                double x2 = ADoubleSerializerDeserializer.getDouble(bytes,
-                                        ARectangleSerializerDeserializer.getUpperRightCoordinateOffset(Coordinate.X));
-                                double y2 = ADoubleSerializerDeserializer.getDouble(bytes,
-                                        ARectangleSerializerDeserializer.getUpperRightCoordinateOffset(Coordinate.Y));
+                                double x2 = ADoubleSerializerDeserializer.getDouble(bytes, startOffset
+                                        + ARectangleSerializerDeserializer.getUpperRightCoordinateOffset(Coordinate.X));
+                                double y2 = ADoubleSerializerDeserializer.getDouble(bytes, startOffset
+                                        + ARectangleSerializerDeserializer.getUpperRightCoordinateOffset(Coordinate.Y));
                                 aPoint.setValue(x2, y2);
                                 pointSerde.serialize(aPoint, inputVal.getDataOutput());
                                 listBuilder.addItem(inputVal);
                                 listBuilder.write(out, true);
-
-                            } else if (bytes[0] == ATypeTag.SERIALIZED_POLYGON_TYPE_TAG) {
+                            } else if (bytes[startOffset] == ATypeTag.SERIALIZED_POLYGON_TYPE_TAG) {
                                 int numOfPoints = AInt16SerializerDeserializer.getShort(bytes,
-                                        APolygonSerializerDeserializer.getNumberOfPointsOffset());
+                                        startOffset + APolygonSerializerDeserializer.getNumberOfPointsOffset());
 
                                 if (numOfPoints < 3) {
                                     throw new HyracksDataException("Polygon must have at least 3 points.");
@@ -146,24 +148,26 @@
                                 listBuilder.reset(pointListType);
                                 for (int i = 0; i < numOfPoints; ++i) {
                                     inputVal.reset();
-                                    double x = ADoubleSerializerDeserializer.getDouble(bytes,
-                                            APolygonSerializerDeserializer.getCoordinateOffset(i, Coordinate.X));
-                                    double y = ADoubleSerializerDeserializer.getDouble(bytes,
-                                            APolygonSerializerDeserializer.getCoordinateOffset(i, Coordinate.Y));
+                                    double x = ADoubleSerializerDeserializer.getDouble(bytes, startOffset
+                                            + APolygonSerializerDeserializer.getCoordinateOffset(i, Coordinate.X));
+                                    double y = ADoubleSerializerDeserializer.getDouble(bytes, startOffset
+                                            + APolygonSerializerDeserializer.getCoordinateOffset(i, Coordinate.Y));
                                     aPoint.setValue(x, y);
                                     pointSerde.serialize(aPoint, inputVal.getDataOutput());
                                     listBuilder.addItem(inputVal);
                                 }
                                 listBuilder.write(out, true);
-                            } else if (bytes[0] == ATypeTag.SERIALIZED_NULL_TYPE_TAG) {
+                            } else if (bytes[startOffset] == ATypeTag.SERIALIZED_NULL_TYPE_TAG) {
                                 nullSerde.serialize(ANull.NULL, out);
                             } else {
-                                throw new AlgebricksException("get-points does not support the type: " + bytes[0]
-                                        + " It is only implemented for LINE, RECTANGLE, or POLYGON.");
+                                throw new AlgebricksException(
+                                        "get-points does not support the type: " + bytes[startOffset]
+                                                + " It is only implemented for LINE, RECTANGLE, or POLYGON.");
                             }
                         } catch (IOException e) {
                             throw new AlgebricksException(e);
                         }
+                        result.set(resultStorage);
                     }
                 };
             }
diff --git a/asterix-runtime/src/main/java/org/apache/asterix/runtime/evaluators/accessors/PointXCoordinateAccessor.java b/asterix-runtime/src/main/java/org/apache/asterix/runtime/evaluators/accessors/PointXCoordinateAccessor.java
index b84ff77..bcb74b8 100644
--- a/asterix-runtime/src/main/java/org/apache/asterix/runtime/evaluators/accessors/PointXCoordinateAccessor.java
+++ b/asterix-runtime/src/main/java/org/apache/asterix/runtime/evaluators/accessors/PointXCoordinateAccessor.java
@@ -36,10 +36,12 @@
 import org.apache.asterix.runtime.evaluators.base.AbstractScalarFunctionDynamicDescriptor;
 import org.apache.hyracks.algebricks.common.exceptions.AlgebricksException;
 import org.apache.hyracks.algebricks.core.algebra.functions.FunctionIdentifier;
-import org.apache.hyracks.algebricks.runtime.base.ICopyEvaluator;
-import org.apache.hyracks.algebricks.runtime.base.ICopyEvaluatorFactory;
+import org.apache.hyracks.algebricks.runtime.base.IScalarEvaluator;
+import org.apache.hyracks.algebricks.runtime.base.IScalarEvaluatorFactory;
+import org.apache.hyracks.api.context.IHyracksTaskContext;
 import org.apache.hyracks.api.dataflow.value.ISerializerDeserializer;
-import org.apache.hyracks.data.std.api.IDataOutputProvider;
+import org.apache.hyracks.data.std.api.IPointable;
+import org.apache.hyracks.data.std.primitive.VoidPointable;
 import org.apache.hyracks.data.std.util.ArrayBackedValueStorage;
 import org.apache.hyracks.dataflow.common.data.accessors.IFrameTupleReference;
 
@@ -55,17 +57,19 @@
     };
 
     @Override
-    public ICopyEvaluatorFactory createEvaluatorFactory(final ICopyEvaluatorFactory[] args) throws AlgebricksException {
-        return new ICopyEvaluatorFactory() {
+    public IScalarEvaluatorFactory createEvaluatorFactory(final IScalarEvaluatorFactory[] args)
+            throws AlgebricksException {
+        return new IScalarEvaluatorFactory() {
 
             private static final long serialVersionUID = 1L;
 
             @Override
-            public ICopyEvaluator createEvaluator(final IDataOutputProvider output) throws AlgebricksException {
-                return new ICopyEvaluator() {
-                    private final DataOutput out = output.getDataOutput();
-                    private final ArrayBackedValueStorage argOut = new ArrayBackedValueStorage();
-                    private final ICopyEvaluator eval = args[0].createEvaluator(argOut);
+            public IScalarEvaluator createScalarEvaluator(IHyracksTaskContext ctx) throws AlgebricksException {
+                return new IScalarEvaluator() {
+                    private final ArrayBackedValueStorage resultStorage = new ArrayBackedValueStorage();
+                    private final DataOutput out = resultStorage.getDataOutput();
+                    private final IPointable argPtr = new VoidPointable();
+                    private final IScalarEvaluator eval = args[0].createScalarEvaluator(ctx);
 
                     @SuppressWarnings("unchecked")
                     private final ISerializerDeserializer<ANull> nullSerde = AqlSerializerDeserializerProvider.INSTANCE
@@ -76,28 +80,29 @@
                             .getSerializerDeserializer(BuiltinType.ADOUBLE);
 
                     @Override
-                    public void evaluate(IFrameTupleReference tuple) throws AlgebricksException {
-                        argOut.reset();
-                        eval.evaluate(tuple);
-                        byte[] bytes = argOut.getByteArray();
+                    public void evaluate(IFrameTupleReference tuple, IPointable result) throws AlgebricksException {
+                        eval.evaluate(tuple, argPtr);
+                        byte[] bytes = argPtr.getByteArray();
+                        int startOffset = argPtr.getStartOffset();
 
+                        resultStorage.reset();
                         try {
                             double x;
-                            if (bytes[0] == ATypeTag.SERIALIZED_POINT_TYPE_TAG) {
+                            if (bytes[startOffset] == ATypeTag.SERIALIZED_POINT_TYPE_TAG) {
                                 x = ADoubleSerializerDeserializer.getDouble(bytes,
-                                        APointSerializerDeserializer.getCoordinateOffset(Coordinate.X));
+                                        startOffset + APointSerializerDeserializer.getCoordinateOffset(Coordinate.X));
                                 aDouble.setValue(x);
                                 doubleSerde.serialize(aDouble, out);
-                            } else if (bytes[0] == ATypeTag.SERIALIZED_NULL_TYPE_TAG) {
+                            } else if (bytes[startOffset] == ATypeTag.SERIALIZED_NULL_TYPE_TAG) {
                                 nullSerde.serialize(ANull.NULL, out);
                             } else {
-                                throw new AlgebricksException("get-x does not support the type: " + bytes[0]
+                                throw new AlgebricksException("get-x does not support the type: " + bytes[startOffset]
                                         + " It is only implemented for POINT.");
                             }
-
                         } catch (IOException e) {
                             throw new AlgebricksException(e);
                         }
+                        result.set(resultStorage);
                     }
                 };
             }
diff --git a/asterix-runtime/src/main/java/org/apache/asterix/runtime/evaluators/accessors/PointYCoordinateAccessor.java b/asterix-runtime/src/main/java/org/apache/asterix/runtime/evaluators/accessors/PointYCoordinateAccessor.java
index c03758d..09926aa 100644
--- a/asterix-runtime/src/main/java/org/apache/asterix/runtime/evaluators/accessors/PointYCoordinateAccessor.java
+++ b/asterix-runtime/src/main/java/org/apache/asterix/runtime/evaluators/accessors/PointYCoordinateAccessor.java
@@ -36,10 +36,12 @@
 import org.apache.asterix.runtime.evaluators.base.AbstractScalarFunctionDynamicDescriptor;
 import org.apache.hyracks.algebricks.common.exceptions.AlgebricksException;
 import org.apache.hyracks.algebricks.core.algebra.functions.FunctionIdentifier;
-import org.apache.hyracks.algebricks.runtime.base.ICopyEvaluator;
-import org.apache.hyracks.algebricks.runtime.base.ICopyEvaluatorFactory;
+import org.apache.hyracks.algebricks.runtime.base.IScalarEvaluator;
+import org.apache.hyracks.algebricks.runtime.base.IScalarEvaluatorFactory;
+import org.apache.hyracks.api.context.IHyracksTaskContext;
 import org.apache.hyracks.api.dataflow.value.ISerializerDeserializer;
-import org.apache.hyracks.data.std.api.IDataOutputProvider;
+import org.apache.hyracks.data.std.api.IPointable;
+import org.apache.hyracks.data.std.primitive.VoidPointable;
 import org.apache.hyracks.data.std.util.ArrayBackedValueStorage;
 import org.apache.hyracks.dataflow.common.data.accessors.IFrameTupleReference;
 
@@ -58,17 +60,19 @@
     };
 
     @Override
-    public ICopyEvaluatorFactory createEvaluatorFactory(final ICopyEvaluatorFactory[] args) throws AlgebricksException {
-        return new ICopyEvaluatorFactory() {
+    public IScalarEvaluatorFactory createEvaluatorFactory(final IScalarEvaluatorFactory[] args)
+            throws AlgebricksException {
+        return new IScalarEvaluatorFactory() {
 
             private static final long serialVersionUID = 1L;
 
             @Override
-            public ICopyEvaluator createEvaluator(final IDataOutputProvider output) throws AlgebricksException {
-                return new ICopyEvaluator() {
-                    private final DataOutput out = output.getDataOutput();
-                    private final ArrayBackedValueStorage argOut = new ArrayBackedValueStorage();
-                    private final ICopyEvaluator eval = args[0].createEvaluator(argOut);
+            public IScalarEvaluator createScalarEvaluator(IHyracksTaskContext ctx) throws AlgebricksException {
+                return new IScalarEvaluator() {
+                    private final ArrayBackedValueStorage resultStorage = new ArrayBackedValueStorage();
+                    private final DataOutput out = resultStorage.getDataOutput();
+                    private final IPointable argPtr = new VoidPointable();
+                    private final IScalarEvaluator eval = args[0].createScalarEvaluator(ctx);
 
                     @SuppressWarnings("unchecked")
                     private final ISerializerDeserializer<ANull> nullSerde = AqlSerializerDeserializerProvider.INSTANCE
@@ -79,28 +83,29 @@
                             .getSerializerDeserializer(BuiltinType.ADOUBLE);
 
                     @Override
-                    public void evaluate(IFrameTupleReference tuple) throws AlgebricksException {
-                        argOut.reset();
-                        eval.evaluate(tuple);
-                        byte[] bytes = argOut.getByteArray();
+                    public void evaluate(IFrameTupleReference tuple, IPointable result) throws AlgebricksException {
+                        eval.evaluate(tuple, argPtr);
+                        byte[] bytes = argPtr.getByteArray();
+                        int startOffset = argPtr.getStartOffset();
 
+                        resultStorage.reset();
                         try {
                             double y;
-                            if (bytes[0] == ATypeTag.SERIALIZED_POINT_TYPE_TAG) {
+                            if (bytes[startOffset] == ATypeTag.SERIALIZED_POINT_TYPE_TAG) {
                                 y = ADoubleSerializerDeserializer.getDouble(bytes,
-                                        APointSerializerDeserializer.getCoordinateOffset(Coordinate.Y));
+                                        startOffset + APointSerializerDeserializer.getCoordinateOffset(Coordinate.Y));
                                 aDouble.setValue(y);
                                 doubleSerde.serialize(aDouble, out);
-                            } else if (bytes[0] == ATypeTag.SERIALIZED_NULL_TYPE_TAG) {
+                            } else if (bytes[startOffset] == ATypeTag.SERIALIZED_NULL_TYPE_TAG) {
                                 nullSerde.serialize(ANull.NULL, out);
                             } else {
-                                throw new AlgebricksException("get-y does not support the type: " + bytes[0]
+                                throw new AlgebricksException("get-y does not support the type: " + bytes[startOffset]
                                         + " It is only implemented for POINT.");
                             }
-
                         } catch (IOException e) {
                             throw new AlgebricksException(e);
                         }
+                        result.set(resultStorage);
                     }
                 };
             }
diff --git a/asterix-runtime/src/main/java/org/apache/asterix/runtime/evaluators/accessors/TemporalDayAccessor.java b/asterix-runtime/src/main/java/org/apache/asterix/runtime/evaluators/accessors/TemporalDayAccessor.java
index b8f76d1..1dcb6c9 100644
--- a/asterix-runtime/src/main/java/org/apache/asterix/runtime/evaluators/accessors/TemporalDayAccessor.java
+++ b/asterix-runtime/src/main/java/org/apache/asterix/runtime/evaluators/accessors/TemporalDayAccessor.java
@@ -38,10 +38,12 @@
 import org.apache.asterix.runtime.evaluators.base.AbstractScalarFunctionDynamicDescriptor;
 import org.apache.hyracks.algebricks.common.exceptions.AlgebricksException;
 import org.apache.hyracks.algebricks.core.algebra.functions.FunctionIdentifier;
-import org.apache.hyracks.algebricks.runtime.base.ICopyEvaluator;
-import org.apache.hyracks.algebricks.runtime.base.ICopyEvaluatorFactory;
+import org.apache.hyracks.algebricks.runtime.base.IScalarEvaluator;
+import org.apache.hyracks.algebricks.runtime.base.IScalarEvaluatorFactory;
+import org.apache.hyracks.api.context.IHyracksTaskContext;
 import org.apache.hyracks.api.dataflow.value.ISerializerDeserializer;
-import org.apache.hyracks.data.std.api.IDataOutputProvider;
+import org.apache.hyracks.data.std.api.IPointable;
+import org.apache.hyracks.data.std.primitive.VoidPointable;
 import org.apache.hyracks.data.std.util.ArrayBackedValueStorage;
 import org.apache.hyracks.dataflow.common.data.accessors.IFrameTupleReference;
 
@@ -58,23 +60,22 @@
     };
 
     /* (non-Javadoc)
-     * @see org.apache.asterix.runtime.base.IScalarFunctionDynamicDescriptor#createEvaluatorFactory(org.apache.hyracks.algebricks.runtime.base.ICopyEvaluatorFactory[])
+     * @see org.apache.asterix.om.function.IFunctionDescriptor#createEvaluatorFactory(org.apache.hyracks.algebricks.runtime.base.IScalarEvaluatorFactory[])
      */
     @Override
-    public ICopyEvaluatorFactory createEvaluatorFactory(final ICopyEvaluatorFactory[] args) throws AlgebricksException {
-        return new ICopyEvaluatorFactory() {
+    public IScalarEvaluatorFactory createEvaluatorFactory(final IScalarEvaluatorFactory[] args)
+            throws AlgebricksException {
+        return new IScalarEvaluatorFactory() {
 
             private static final long serialVersionUID = 1L;
 
             @Override
-            public ICopyEvaluator createEvaluator(final IDataOutputProvider output) throws AlgebricksException {
-                return new ICopyEvaluator() {
-
-                    private final DataOutput out = output.getDataOutput();
-
-                    private final ArrayBackedValueStorage argOut = new ArrayBackedValueStorage();
-
-                    private final ICopyEvaluator eval = args[0].createEvaluator(argOut);
+            public IScalarEvaluator createScalarEvaluator(IHyracksTaskContext ctx) throws AlgebricksException {
+                return new IScalarEvaluator() {
+                    private final ArrayBackedValueStorage resultStorage = new ArrayBackedValueStorage();
+                    private final DataOutput out = resultStorage.getDataOutput();
+                    private final IPointable argPtr = new VoidPointable();
+                    private final IScalarEvaluator eval = args[0].createScalarEvaluator(ctx);
 
                     private final GregorianCalendarSystem calSystem = GregorianCalendarSystem.getInstance();
 
@@ -88,38 +89,40 @@
                             .getSerializerDeserializer(BuiltinType.ANULL);
 
                     @Override
-                    public void evaluate(IFrameTupleReference tuple) throws AlgebricksException {
-                        argOut.reset();
-                        eval.evaluate(tuple);
-                        byte[] bytes = argOut.getByteArray();
+                    public void evaluate(IFrameTupleReference tuple, IPointable result) throws AlgebricksException {
+                        eval.evaluate(tuple, argPtr);
+                        byte[] bytes = argPtr.getByteArray();
+                        int startOffset = argPtr.getStartOffset();
 
+                        resultStorage.reset();
                         try {
-
-                            if (bytes[0] == ATypeTag.SERIALIZED_DURATION_TYPE_TAG) {
-                                aMutableInt64.setValue(
-                                        calSystem.getDurationDay(ADurationSerializerDeserializer.getDayTime(bytes, 1)));
+                            if (bytes[startOffset] == ATypeTag.SERIALIZED_DURATION_TYPE_TAG) {
+                                aMutableInt64.setValue(calSystem.getDurationDay(
+                                        ADurationSerializerDeserializer.getDayTime(bytes, startOffset + 1)));
                                 intSerde.serialize(aMutableInt64, out);
+                                result.set(resultStorage);
                                 return;
                             }
-
-                            if (bytes[0] == ATypeTag.SERIALIZED_DAY_TIME_DURATION_TYPE_TAG) {
-                                aMutableInt64.setValue(calSystem
-                                        .getDurationDay(ADayTimeDurationSerializerDeserializer.getDayTime(bytes, 1)));
+                            if (bytes[startOffset] == ATypeTag.SERIALIZED_DAY_TIME_DURATION_TYPE_TAG) {
+                                aMutableInt64.setValue(calSystem.getDurationDay(
+                                        ADayTimeDurationSerializerDeserializer.getDayTime(bytes, startOffset + 1)));
                                 intSerde.serialize(aMutableInt64, out);
+                                result.set(resultStorage);
                                 return;
                             }
 
                             long chrononTimeInMs = 0;
-                            if (bytes[0] == ATypeTag.SERIALIZED_DATE_TYPE_TAG) {
-                                chrononTimeInMs = AInt32SerializerDeserializer.getInt(bytes, 1)
+                            if (bytes[startOffset] == ATypeTag.SERIALIZED_DATE_TYPE_TAG) {
+                                chrononTimeInMs = AInt32SerializerDeserializer.getInt(bytes, startOffset + 1)
                                         * GregorianCalendarSystem.CHRONON_OF_DAY;
-                            } else if (bytes[0] == ATypeTag.SERIALIZED_DATETIME_TYPE_TAG) {
-                                chrononTimeInMs = AInt64SerializerDeserializer.getLong(bytes, 1);
-                            } else if (bytes[0] == ATypeTag.SERIALIZED_NULL_TYPE_TAG) {
+                            } else if (bytes[startOffset] == ATypeTag.SERIALIZED_DATETIME_TYPE_TAG) {
+                                chrononTimeInMs = AInt64SerializerDeserializer.getLong(bytes, startOffset + 1);
+                            } else if (bytes[startOffset] == ATypeTag.SERIALIZED_NULL_TYPE_TAG) {
                                 nullSerde.serialize(ANull.NULL, out);
+                                result.set(resultStorage);
                                 return;
                             } else {
-                                throw new AlgebricksException("Inapplicable input type: " + bytes[0]);
+                                throw new AlgebricksException("Inapplicable input type: " + bytes[startOffset]);
                             }
 
                             int year = calSystem.getYear(chrononTimeInMs);
@@ -128,10 +131,10 @@
 
                             aMutableInt64.setValue(day);
                             intSerde.serialize(aMutableInt64, out);
-
                         } catch (IOException e) {
                             throw new AlgebricksException(e);
                         }
+                        result.set(resultStorage);
                     }
                 };
             }
diff --git a/asterix-runtime/src/main/java/org/apache/asterix/runtime/evaluators/accessors/TemporalHourAccessor.java b/asterix-runtime/src/main/java/org/apache/asterix/runtime/evaluators/accessors/TemporalHourAccessor.java
index 6b7dbdb..969dfe9 100644
--- a/asterix-runtime/src/main/java/org/apache/asterix/runtime/evaluators/accessors/TemporalHourAccessor.java
+++ b/asterix-runtime/src/main/java/org/apache/asterix/runtime/evaluators/accessors/TemporalHourAccessor.java
@@ -38,10 +38,12 @@
 import org.apache.asterix.runtime.evaluators.base.AbstractScalarFunctionDynamicDescriptor;
 import org.apache.hyracks.algebricks.common.exceptions.AlgebricksException;
 import org.apache.hyracks.algebricks.core.algebra.functions.FunctionIdentifier;
-import org.apache.hyracks.algebricks.runtime.base.ICopyEvaluator;
-import org.apache.hyracks.algebricks.runtime.base.ICopyEvaluatorFactory;
+import org.apache.hyracks.algebricks.runtime.base.IScalarEvaluator;
+import org.apache.hyracks.algebricks.runtime.base.IScalarEvaluatorFactory;
+import org.apache.hyracks.api.context.IHyracksTaskContext;
 import org.apache.hyracks.api.dataflow.value.ISerializerDeserializer;
-import org.apache.hyracks.data.std.api.IDataOutputProvider;
+import org.apache.hyracks.data.std.api.IPointable;
+import org.apache.hyracks.data.std.primitive.VoidPointable;
 import org.apache.hyracks.data.std.util.ArrayBackedValueStorage;
 import org.apache.hyracks.dataflow.common.data.accessors.IFrameTupleReference;
 
@@ -59,23 +61,22 @@
     };
 
     /* (non-Javadoc)
-     * @see org.apache.asterix.runtime.base.IScalarFunctionDynamicDescriptor#createEvaluatorFactory(org.apache.hyracks.algebricks.runtime.base.ICopyEvaluatorFactory[])
+     * @see org.apache.asterix.om.function.IFunctionDescriptor#createEvaluatorFactory(org.apache.hyracks.algebricks.runtime.base.IScalarEvaluatorFactory[])
      */
     @Override
-    public ICopyEvaluatorFactory createEvaluatorFactory(final ICopyEvaluatorFactory[] args) throws AlgebricksException {
-        return new ICopyEvaluatorFactory() {
+    public IScalarEvaluatorFactory createEvaluatorFactory(final IScalarEvaluatorFactory[] args)
+            throws AlgebricksException {
+        return new IScalarEvaluatorFactory() {
 
             private static final long serialVersionUID = 1L;
 
             @Override
-            public ICopyEvaluator createEvaluator(final IDataOutputProvider output) throws AlgebricksException {
-                return new ICopyEvaluator() {
-
-                    private final DataOutput out = output.getDataOutput();
-
-                    private final ArrayBackedValueStorage argOut = new ArrayBackedValueStorage();
-
-                    private final ICopyEvaluator eval = args[0].createEvaluator(argOut);
+            public IScalarEvaluator createScalarEvaluator(IHyracksTaskContext ctx) throws AlgebricksException {
+                return new IScalarEvaluator() {
+                    private final ArrayBackedValueStorage resultStorage = new ArrayBackedValueStorage();
+                    private final DataOutput out = resultStorage.getDataOutput();
+                    private final IPointable argPtr = new VoidPointable();
+                    private final IScalarEvaluator eval = args[0].createScalarEvaluator(ctx);
 
                     private final GregorianCalendarSystem calSystem = GregorianCalendarSystem.getInstance();
 
@@ -89,47 +90,48 @@
                             .getSerializerDeserializer(BuiltinType.ANULL);
 
                     @Override
-                    public void evaluate(IFrameTupleReference tuple) throws AlgebricksException {
-                        argOut.reset();
-                        eval.evaluate(tuple);
-                        byte[] bytes = argOut.getByteArray();
+                    public void evaluate(IFrameTupleReference tuple, IPointable result) throws AlgebricksException {
+                        eval.evaluate(tuple, argPtr);
+                        byte[] bytes = argPtr.getByteArray();
+                        int startOffset = argPtr.getStartOffset();
 
+                        resultStorage.reset();
                         try {
-
-                            if (bytes[0] == ATypeTag.SERIALIZED_DURATION_TYPE_TAG) {
-                                aMutableInt64.setValue(calSystem
-                                        .getDurationHour(ADurationSerializerDeserializer.getDayTime(bytes, 1)));
+                            if (bytes[startOffset] == ATypeTag.SERIALIZED_DURATION_TYPE_TAG) {
+                                aMutableInt64.setValue(calSystem.getDurationHour(
+                                        ADurationSerializerDeserializer.getDayTime(bytes, startOffset + 1)));
                                 intSerde.serialize(aMutableInt64, out);
+                                result.set(resultStorage);
                                 return;
                             }
-
-                            if (bytes[0] == ATypeTag.SERIALIZED_DAY_TIME_DURATION_TYPE_TAG) {
-                                aMutableInt64.setValue(calSystem
-                                        .getDurationHour(ADayTimeDurationSerializerDeserializer.getDayTime(bytes, 1)));
+                            if (bytes[startOffset] == ATypeTag.SERIALIZED_DAY_TIME_DURATION_TYPE_TAG) {
+                                aMutableInt64.setValue(calSystem.getDurationHour(
+                                        ADayTimeDurationSerializerDeserializer.getDayTime(bytes, startOffset + 1)));
                                 intSerde.serialize(aMutableInt64, out);
+                                result.set(resultStorage);
                                 return;
                             }
 
                             long chrononTimeInMs = 0;
-                            if (bytes[0] == ATypeTag.SERIALIZED_TIME_TYPE_TAG) {
-                                chrononTimeInMs = AInt32SerializerDeserializer.getInt(bytes, 1);
-                            } else if (bytes[0] == ATypeTag.SERIALIZED_DATETIME_TYPE_TAG) {
-                                chrononTimeInMs = AInt64SerializerDeserializer.getLong(bytes, 1);
-                            } else if (bytes[0] == ATypeTag.SERIALIZED_NULL_TYPE_TAG) {
+                            if (bytes[startOffset] == ATypeTag.SERIALIZED_TIME_TYPE_TAG) {
+                                chrononTimeInMs = AInt32SerializerDeserializer.getInt(bytes, startOffset + 1);
+                            } else if (bytes[startOffset] == ATypeTag.SERIALIZED_DATETIME_TYPE_TAG) {
+                                chrononTimeInMs = AInt64SerializerDeserializer.getLong(bytes, startOffset + 1);
+                            } else if (bytes[startOffset] == ATypeTag.SERIALIZED_NULL_TYPE_TAG) {
                                 nullSerde.serialize(ANull.NULL, out);
+                                result.set(resultStorage);
                                 return;
                             } else {
-                                throw new AlgebricksException("Inapplicable input type: " + bytes[0]);
+                                throw new AlgebricksException("Inapplicable input type: " + bytes[startOffset]);
                             }
 
                             int hour = calSystem.getHourOfDay(chrononTimeInMs);
-
                             aMutableInt64.setValue(hour);
                             intSerde.serialize(aMutableInt64, out);
-
                         } catch (IOException e) {
                             throw new AlgebricksException(e);
                         }
+                        result.set(resultStorage);
                     }
                 };
             }
diff --git a/asterix-runtime/src/main/java/org/apache/asterix/runtime/evaluators/accessors/TemporalIntervalEndAccessor.java b/asterix-runtime/src/main/java/org/apache/asterix/runtime/evaluators/accessors/TemporalIntervalEndAccessor.java
index 8e42b79..d8525dd 100644
--- a/asterix-runtime/src/main/java/org/apache/asterix/runtime/evaluators/accessors/TemporalIntervalEndAccessor.java
+++ b/asterix-runtime/src/main/java/org/apache/asterix/runtime/evaluators/accessors/TemporalIntervalEndAccessor.java
@@ -39,10 +39,12 @@
 import org.apache.asterix.runtime.evaluators.base.AbstractScalarFunctionDynamicDescriptor;
 import org.apache.hyracks.algebricks.common.exceptions.AlgebricksException;
 import org.apache.hyracks.algebricks.core.algebra.functions.FunctionIdentifier;
-import org.apache.hyracks.algebricks.runtime.base.ICopyEvaluator;
-import org.apache.hyracks.algebricks.runtime.base.ICopyEvaluatorFactory;
+import org.apache.hyracks.algebricks.runtime.base.IScalarEvaluator;
+import org.apache.hyracks.algebricks.runtime.base.IScalarEvaluatorFactory;
+import org.apache.hyracks.api.context.IHyracksTaskContext;
 import org.apache.hyracks.api.dataflow.value.ISerializerDeserializer;
-import org.apache.hyracks.data.std.api.IDataOutputProvider;
+import org.apache.hyracks.data.std.api.IPointable;
+import org.apache.hyracks.data.std.primitive.VoidPointable;
 import org.apache.hyracks.data.std.util.ArrayBackedValueStorage;
 import org.apache.hyracks.dataflow.common.data.accessors.IFrameTupleReference;
 
@@ -59,20 +61,19 @@
     };
 
     @Override
-    public ICopyEvaluatorFactory createEvaluatorFactory(final ICopyEvaluatorFactory[] args) throws AlgebricksException {
-        return new ICopyEvaluatorFactory() {
+    public IScalarEvaluatorFactory createEvaluatorFactory(final IScalarEvaluatorFactory[] args)
+            throws AlgebricksException {
+        return new IScalarEvaluatorFactory() {
 
             private static final long serialVersionUID = 1L;
 
             @Override
-            public ICopyEvaluator createEvaluator(final IDataOutputProvider output) throws AlgebricksException {
-                return new ICopyEvaluator() {
-
-                    private final DataOutput out = output.getDataOutput();
-
-                    private final ArrayBackedValueStorage argOut = new ArrayBackedValueStorage();
-
-                    private final ICopyEvaluator eval = args[0].createEvaluator(argOut);
+            public IScalarEvaluator createScalarEvaluator(IHyracksTaskContext ctx) throws AlgebricksException {
+                return new IScalarEvaluator() {
+                    private final ArrayBackedValueStorage resultStorage = new ArrayBackedValueStorage();
+                    private final DataOutput out = resultStorage.getDataOutput();
+                    private final IPointable argPtr = new VoidPointable();
+                    private final IScalarEvaluator eval = args[0].createScalarEvaluator(ctx);
 
                     // possible output
                     @SuppressWarnings("unchecked")
@@ -92,18 +93,21 @@
                             .getSerializerDeserializer(BuiltinType.ANULL);
 
                     @Override
-                    public void evaluate(IFrameTupleReference tuple) throws AlgebricksException {
-                        argOut.reset();
-                        eval.evaluate(tuple);
-                        byte[] bytes = argOut.getByteArray();
+                    public void evaluate(IFrameTupleReference tuple, IPointable result) throws AlgebricksException {
+                        eval.evaluate(tuple, argPtr);
+                        byte[] bytes = argPtr.getByteArray();
+                        int startOffset = argPtr.getStartOffset();
 
+                        resultStorage.reset();
                         try {
-                            if (bytes[0] == ATypeTag.SERIALIZED_NULL_TYPE_TAG) {
+                            if (bytes[startOffset] == ATypeTag.SERIALIZED_NULL_TYPE_TAG) {
                                 nullSerde.serialize(ANull.NULL, out);
+                                result.set(resultStorage);
                                 return;
-                            } else if (bytes[0] == ATypeTag.SERIALIZED_INTERVAL_TYPE_TAG) {
-                                byte timeType = AIntervalSerializerDeserializer.getIntervalTimeType(bytes, 1);
-                                long endTime = AIntervalSerializerDeserializer.getIntervalEnd(bytes, 1);
+                            } else if (bytes[startOffset] == ATypeTag.SERIALIZED_INTERVAL_TYPE_TAG) {
+                                byte timeType = AIntervalSerializerDeserializer.getIntervalTimeType(bytes,
+                                        startOffset + 1);
+                                long endTime = AIntervalSerializerDeserializer.getIntervalEnd(bytes, startOffset + 1);
                                 if (timeType == ATypeTag.SERIALIZED_DATE_TYPE_TAG) {
                                     aDate.setValue((int) (endTime));
                                     dateSerde.serialize(aDate, out);
@@ -116,11 +120,12 @@
                                 }
                             } else {
                                 throw new AlgebricksException(FID.getName() + ": expects NULL/INTERVAL, but got "
-                                        + EnumDeserializer.ATYPETAGDESERIALIZER.deserialize(bytes[0]));
+                                        + EnumDeserializer.ATYPETAGDESERIALIZER.deserialize(bytes[startOffset]));
                             }
                         } catch (IOException e) {
                             throw new AlgebricksException(e);
                         }
+                        result.set(resultStorage);
                     }
                 };
             }
diff --git a/asterix-runtime/src/main/java/org/apache/asterix/runtime/evaluators/accessors/TemporalIntervalEndDateAccessor.java b/asterix-runtime/src/main/java/org/apache/asterix/runtime/evaluators/accessors/TemporalIntervalEndDateAccessor.java
index 38141a2..3a9aa5a 100644
--- a/asterix-runtime/src/main/java/org/apache/asterix/runtime/evaluators/accessors/TemporalIntervalEndDateAccessor.java
+++ b/asterix-runtime/src/main/java/org/apache/asterix/runtime/evaluators/accessors/TemporalIntervalEndDateAccessor.java
@@ -35,10 +35,12 @@
 import org.apache.asterix.runtime.evaluators.base.AbstractScalarFunctionDynamicDescriptor;
 import org.apache.hyracks.algebricks.common.exceptions.AlgebricksException;
 import org.apache.hyracks.algebricks.core.algebra.functions.FunctionIdentifier;
-import org.apache.hyracks.algebricks.runtime.base.ICopyEvaluator;
-import org.apache.hyracks.algebricks.runtime.base.ICopyEvaluatorFactory;
+import org.apache.hyracks.algebricks.runtime.base.IScalarEvaluator;
+import org.apache.hyracks.algebricks.runtime.base.IScalarEvaluatorFactory;
+import org.apache.hyracks.api.context.IHyracksTaskContext;
 import org.apache.hyracks.api.dataflow.value.ISerializerDeserializer;
-import org.apache.hyracks.data.std.api.IDataOutputProvider;
+import org.apache.hyracks.data.std.api.IPointable;
+import org.apache.hyracks.data.std.primitive.VoidPointable;
 import org.apache.hyracks.data.std.util.ArrayBackedValueStorage;
 import org.apache.hyracks.dataflow.common.data.accessors.IFrameTupleReference;
 
@@ -54,20 +56,19 @@
     };
 
     @Override
-    public ICopyEvaluatorFactory createEvaluatorFactory(final ICopyEvaluatorFactory[] args) throws AlgebricksException {
-        return new ICopyEvaluatorFactory() {
+    public IScalarEvaluatorFactory createEvaluatorFactory(final IScalarEvaluatorFactory[] args)
+            throws AlgebricksException {
+        return new IScalarEvaluatorFactory() {
 
             private static final long serialVersionUID = 1L;
 
             @Override
-            public ICopyEvaluator createEvaluator(final IDataOutputProvider output) throws AlgebricksException {
-                return new ICopyEvaluator() {
-
-                    private final DataOutput out = output.getDataOutput();
-
-                    private final ArrayBackedValueStorage argOut = new ArrayBackedValueStorage();
-
-                    private final ICopyEvaluator eval = args[0].createEvaluator(argOut);
+            public IScalarEvaluator createScalarEvaluator(IHyracksTaskContext ctx) throws AlgebricksException {
+                return new IScalarEvaluator() {
+                    private final ArrayBackedValueStorage resultStorage = new ArrayBackedValueStorage();
+                    private final DataOutput out = resultStorage.getDataOutput();
+                    private final IPointable argPtr = new VoidPointable();
+                    private final IScalarEvaluator eval = args[0].createScalarEvaluator(ctx);
 
                     // possible output
                     @SuppressWarnings("unchecked")
@@ -80,34 +81,38 @@
                             .getSerializerDeserializer(BuiltinType.ANULL);
 
                     @Override
-                    public void evaluate(IFrameTupleReference tuple) throws AlgebricksException {
-                        argOut.reset();
-                        eval.evaluate(tuple);
-                        byte[] bytes = argOut.getByteArray();
+                    public void evaluate(IFrameTupleReference tuple, IPointable result) throws AlgebricksException {
+                        eval.evaluate(tuple, argPtr);
+                        byte[] bytes = argPtr.getByteArray();
+                        int startOffset = argPtr.getStartOffset();
 
+                        resultStorage.reset();
                         try {
-                            if (bytes[0] == ATypeTag.SERIALIZED_NULL_TYPE_TAG) {
+                            if (bytes[startOffset] == ATypeTag.SERIALIZED_NULL_TYPE_TAG) {
                                 nullSerde.serialize(ANull.NULL, out);
+                                result.set(resultStorage);
                                 return;
-                            } else if (bytes[0] == ATypeTag.SERIALIZED_INTERVAL_TYPE_TAG) {
-                                byte timeType = AIntervalSerializerDeserializer.getIntervalTimeType(bytes, 1);
-                                long endTime = AIntervalSerializerDeserializer.getIntervalEnd(bytes, 1);
+                            } else if (bytes[startOffset] == ATypeTag.SERIALIZED_INTERVAL_TYPE_TAG) {
+                                byte timeType = AIntervalSerializerDeserializer.getIntervalTimeType(bytes,
+                                        startOffset + 1);
+                                long endTime = AIntervalSerializerDeserializer.getIntervalEnd(bytes, startOffset + 1);
                                 if (timeType == ATypeTag.SERIALIZED_DATE_TYPE_TAG) {
                                     aDate.setValue((int) (endTime));
                                     dateSerde.serialize(aDate, out);
                                 } else {
-                                    throw new AlgebricksException(
-                                            FID.getName() + ": expects NULL/INTERVAL(of DATE), but got "
-                                                    + EnumDeserializer.ATYPETAGDESERIALIZER.deserialize(bytes[0]));
+                                    throw new AlgebricksException(FID.getName()
+                                            + ": expects NULL/INTERVAL(of DATE), but got "
+                                            + EnumDeserializer.ATYPETAGDESERIALIZER.deserialize(bytes[startOffset]));
                                 }
                             } else {
-                                throw new AlgebricksException(
-                                        FID.getName() + ": expects NULL/INTERVAL(of DATE), but got "
-                                                + EnumDeserializer.ATYPETAGDESERIALIZER.deserialize(bytes[0]));
+                                throw new AlgebricksException(FID.getName()
+                                        + ": expects NULL/INTERVAL(of DATE), but got "
+                                        + EnumDeserializer.ATYPETAGDESERIALIZER.deserialize(bytes[startOffset]));
                             }
                         } catch (IOException e) {
                             throw new AlgebricksException(e);
                         }
+                        result.set(resultStorage);
                     }
                 };
             }
diff --git a/asterix-runtime/src/main/java/org/apache/asterix/runtime/evaluators/accessors/TemporalIntervalEndDatetimeAccessor.java b/asterix-runtime/src/main/java/org/apache/asterix/runtime/evaluators/accessors/TemporalIntervalEndDatetimeAccessor.java
index e610363..925d88d 100644
--- a/asterix-runtime/src/main/java/org/apache/asterix/runtime/evaluators/accessors/TemporalIntervalEndDatetimeAccessor.java
+++ b/asterix-runtime/src/main/java/org/apache/asterix/runtime/evaluators/accessors/TemporalIntervalEndDatetimeAccessor.java
@@ -35,10 +35,12 @@
 import org.apache.asterix.runtime.evaluators.base.AbstractScalarFunctionDynamicDescriptor;
 import org.apache.hyracks.algebricks.common.exceptions.AlgebricksException;
 import org.apache.hyracks.algebricks.core.algebra.functions.FunctionIdentifier;
-import org.apache.hyracks.algebricks.runtime.base.ICopyEvaluator;
-import org.apache.hyracks.algebricks.runtime.base.ICopyEvaluatorFactory;
+import org.apache.hyracks.algebricks.runtime.base.IScalarEvaluator;
+import org.apache.hyracks.algebricks.runtime.base.IScalarEvaluatorFactory;
+import org.apache.hyracks.api.context.IHyracksTaskContext;
 import org.apache.hyracks.api.dataflow.value.ISerializerDeserializer;
-import org.apache.hyracks.data.std.api.IDataOutputProvider;
+import org.apache.hyracks.data.std.api.IPointable;
+import org.apache.hyracks.data.std.primitive.VoidPointable;
 import org.apache.hyracks.data.std.util.ArrayBackedValueStorage;
 import org.apache.hyracks.dataflow.common.data.accessors.IFrameTupleReference;
 
@@ -56,20 +58,19 @@
     };
 
     @Override
-    public ICopyEvaluatorFactory createEvaluatorFactory(final ICopyEvaluatorFactory[] args) throws AlgebricksException {
-        return new ICopyEvaluatorFactory() {
+    public IScalarEvaluatorFactory createEvaluatorFactory(final IScalarEvaluatorFactory[] args)
+            throws AlgebricksException {
+        return new IScalarEvaluatorFactory() {
 
             private static final long serialVersionUID = 1L;
 
             @Override
-            public ICopyEvaluator createEvaluator(final IDataOutputProvider output) throws AlgebricksException {
-                return new ICopyEvaluator() {
-
-                    private final DataOutput out = output.getDataOutput();
-
-                    private final ArrayBackedValueStorage argOut = new ArrayBackedValueStorage();
-
-                    private final ICopyEvaluator eval = args[0].createEvaluator(argOut);
+            public IScalarEvaluator createScalarEvaluator(IHyracksTaskContext ctx) throws AlgebricksException {
+                return new IScalarEvaluator() {
+                    private final ArrayBackedValueStorage resultStorage = new ArrayBackedValueStorage();
+                    private final DataOutput out = resultStorage.getDataOutput();
+                    private final IPointable argPtr = new VoidPointable();
+                    private final IScalarEvaluator eval = args[0].createScalarEvaluator(ctx);
 
                     // possible output
                     @SuppressWarnings("unchecked")
@@ -81,18 +82,21 @@
                             .getSerializerDeserializer(BuiltinType.ANULL);
 
                     @Override
-                    public void evaluate(IFrameTupleReference tuple) throws AlgebricksException {
-                        argOut.reset();
-                        eval.evaluate(tuple);
-                        byte[] bytes = argOut.getByteArray();
+                    public void evaluate(IFrameTupleReference tuple, IPointable result) throws AlgebricksException {
+                        eval.evaluate(tuple, argPtr);
+                        byte[] bytes = argPtr.getByteArray();
+                        int startOffset = argPtr.getStartOffset();
 
+                        resultStorage.reset();
                         try {
-                            if (bytes[0] == ATypeTag.SERIALIZED_NULL_TYPE_TAG) {
+                            if (bytes[startOffset] == ATypeTag.SERIALIZED_NULL_TYPE_TAG) {
                                 nullSerde.serialize(ANull.NULL, out);
+                                result.set(resultStorage);
                                 return;
-                            } else if (bytes[0] == ATypeTag.SERIALIZED_INTERVAL_TYPE_TAG) {
-                                byte timeType = AIntervalSerializerDeserializer.getIntervalTimeType(bytes, 1);
-                                long endTime = AIntervalSerializerDeserializer.getIntervalEnd(bytes, 1);
+                            } else if (bytes[startOffset] == ATypeTag.SERIALIZED_INTERVAL_TYPE_TAG) {
+                                byte timeType = AIntervalSerializerDeserializer.getIntervalTimeType(bytes,
+                                        startOffset + 1);
+                                long endTime = AIntervalSerializerDeserializer.getIntervalEnd(bytes, startOffset + 1);
                                 if (timeType == ATypeTag.SERIALIZED_DATETIME_TYPE_TAG) {
                                     aDateTime.setValue(endTime);
                                     datetimeSerde.serialize(aDateTime, out);
@@ -102,13 +106,14 @@
                                             + EnumDeserializer.ATYPETAGDESERIALIZER.deserialize(timeType) + ")");
                                 }
                             } else {
-                                throw new AlgebricksException(
-                                        FID.getName() + ": expects NULL/INTERVAL(of DATETIME), but got "
-                                                + EnumDeserializer.ATYPETAGDESERIALIZER.deserialize(bytes[0]));
+                                throw new AlgebricksException(FID.getName()
+                                        + ": expects NULL/INTERVAL(of DATETIME), but got "
+                                        + EnumDeserializer.ATYPETAGDESERIALIZER.deserialize(bytes[startOffset]));
                             }
                         } catch (IOException e) {
                             throw new AlgebricksException(e);
                         }
+                        result.set(resultStorage);
                     }
                 };
             }
diff --git a/asterix-runtime/src/main/java/org/apache/asterix/runtime/evaluators/accessors/TemporalIntervalEndTimeAccessor.java b/asterix-runtime/src/main/java/org/apache/asterix/runtime/evaluators/accessors/TemporalIntervalEndTimeAccessor.java
index dc5ff7e..a393846 100644
--- a/asterix-runtime/src/main/java/org/apache/asterix/runtime/evaluators/accessors/TemporalIntervalEndTimeAccessor.java
+++ b/asterix-runtime/src/main/java/org/apache/asterix/runtime/evaluators/accessors/TemporalIntervalEndTimeAccessor.java
@@ -35,10 +35,12 @@
 import org.apache.asterix.runtime.evaluators.base.AbstractScalarFunctionDynamicDescriptor;
 import org.apache.hyracks.algebricks.common.exceptions.AlgebricksException;
 import org.apache.hyracks.algebricks.core.algebra.functions.FunctionIdentifier;
-import org.apache.hyracks.algebricks.runtime.base.ICopyEvaluator;
-import org.apache.hyracks.algebricks.runtime.base.ICopyEvaluatorFactory;
+import org.apache.hyracks.algebricks.runtime.base.IScalarEvaluator;
+import org.apache.hyracks.algebricks.runtime.base.IScalarEvaluatorFactory;
+import org.apache.hyracks.api.context.IHyracksTaskContext;
 import org.apache.hyracks.api.dataflow.value.ISerializerDeserializer;
-import org.apache.hyracks.data.std.api.IDataOutputProvider;
+import org.apache.hyracks.data.std.api.IPointable;
+import org.apache.hyracks.data.std.primitive.VoidPointable;
 import org.apache.hyracks.data.std.util.ArrayBackedValueStorage;
 import org.apache.hyracks.dataflow.common.data.accessors.IFrameTupleReference;
 
@@ -54,20 +56,19 @@
     };
 
     @Override
-    public ICopyEvaluatorFactory createEvaluatorFactory(final ICopyEvaluatorFactory[] args) throws AlgebricksException {
-        return new ICopyEvaluatorFactory() {
+    public IScalarEvaluatorFactory createEvaluatorFactory(final IScalarEvaluatorFactory[] args)
+            throws AlgebricksException {
+        return new IScalarEvaluatorFactory() {
 
             private static final long serialVersionUID = 1L;
 
             @Override
-            public ICopyEvaluator createEvaluator(final IDataOutputProvider output) throws AlgebricksException {
-                return new ICopyEvaluator() {
-
-                    private final DataOutput out = output.getDataOutput();
-
-                    private final ArrayBackedValueStorage argOut = new ArrayBackedValueStorage();
-
-                    private final ICopyEvaluator eval = args[0].createEvaluator(argOut);
+            public IScalarEvaluator createScalarEvaluator(IHyracksTaskContext ctx) throws AlgebricksException {
+                return new IScalarEvaluator() {
+                    private final ArrayBackedValueStorage resultStorage = new ArrayBackedValueStorage();
+                    private final DataOutput out = resultStorage.getDataOutput();
+                    private final IPointable argPtr = new VoidPointable();
+                    private final IScalarEvaluator eval = args[0].createScalarEvaluator(ctx);
 
                     // possible output
                     @SuppressWarnings("unchecked")
@@ -79,18 +80,21 @@
                             .getSerializerDeserializer(BuiltinType.ANULL);
 
                     @Override
-                    public void evaluate(IFrameTupleReference tuple) throws AlgebricksException {
-                        argOut.reset();
-                        eval.evaluate(tuple);
-                        byte[] bytes = argOut.getByteArray();
+                    public void evaluate(IFrameTupleReference tuple, IPointable result) throws AlgebricksException {
+                        eval.evaluate(tuple, argPtr);
+                        byte[] bytes = argPtr.getByteArray();
+                        int startOffset = argPtr.getStartOffset();
 
+                        resultStorage.reset();
                         try {
-                            if (bytes[0] == ATypeTag.SERIALIZED_NULL_TYPE_TAG) {
+                            if (bytes[startOffset] == ATypeTag.SERIALIZED_NULL_TYPE_TAG) {
                                 nullSerde.serialize(ANull.NULL, out);
+                                result.set(resultStorage);
                                 return;
-                            } else if (bytes[0] == ATypeTag.SERIALIZED_INTERVAL_TYPE_TAG) {
-                                byte timeType = AIntervalSerializerDeserializer.getIntervalTimeType(bytes, 1);
-                                long endTime = AIntervalSerializerDeserializer.getIntervalEnd(bytes, 1);
+                            } else if (bytes[startOffset] == ATypeTag.SERIALIZED_INTERVAL_TYPE_TAG) {
+                                byte timeType = AIntervalSerializerDeserializer.getIntervalTimeType(bytes,
+                                        startOffset + 1);
+                                long endTime = AIntervalSerializerDeserializer.getIntervalEnd(bytes, startOffset + 1);
                                 if (timeType == ATypeTag.SERIALIZED_TIME_TYPE_TAG) {
                                     aTime.setValue((int) (endTime));
                                     timeSerde.serialize(aTime, out);
@@ -100,13 +104,14 @@
                                             + EnumDeserializer.ATYPETAGDESERIALIZER.deserialize(timeType) + ")");
                                 }
                             } else {
-                                throw new AlgebricksException(
-                                        FID.getName() + ": expects NULL/INTERVAL(of TIME), but got "
-                                                + EnumDeserializer.ATYPETAGDESERIALIZER.deserialize(bytes[0]));
+                                throw new AlgebricksException(FID.getName()
+                                        + ": expects NULL/INTERVAL(of TIME), but got "
+                                        + EnumDeserializer.ATYPETAGDESERIALIZER.deserialize(bytes[startOffset]));
                             }
                         } catch (IOException e) {
                             throw new AlgebricksException(e);
                         }
+                        result.set(resultStorage);
                     }
                 };
             }
diff --git a/asterix-runtime/src/main/java/org/apache/asterix/runtime/evaluators/accessors/TemporalIntervalStartAccessor.java b/asterix-runtime/src/main/java/org/apache/asterix/runtime/evaluators/accessors/TemporalIntervalStartAccessor.java
index 3c2440b..ef391b2 100644
--- a/asterix-runtime/src/main/java/org/apache/asterix/runtime/evaluators/accessors/TemporalIntervalStartAccessor.java
+++ b/asterix-runtime/src/main/java/org/apache/asterix/runtime/evaluators/accessors/TemporalIntervalStartAccessor.java
@@ -39,10 +39,12 @@
 import org.apache.asterix.runtime.evaluators.base.AbstractScalarFunctionDynamicDescriptor;
 import org.apache.hyracks.algebricks.common.exceptions.AlgebricksException;
 import org.apache.hyracks.algebricks.core.algebra.functions.FunctionIdentifier;
-import org.apache.hyracks.algebricks.runtime.base.ICopyEvaluator;
-import org.apache.hyracks.algebricks.runtime.base.ICopyEvaluatorFactory;
+import org.apache.hyracks.algebricks.runtime.base.IScalarEvaluator;
+import org.apache.hyracks.algebricks.runtime.base.IScalarEvaluatorFactory;
+import org.apache.hyracks.api.context.IHyracksTaskContext;
 import org.apache.hyracks.api.dataflow.value.ISerializerDeserializer;
-import org.apache.hyracks.data.std.api.IDataOutputProvider;
+import org.apache.hyracks.data.std.api.IPointable;
+import org.apache.hyracks.data.std.primitive.VoidPointable;
 import org.apache.hyracks.data.std.util.ArrayBackedValueStorage;
 import org.apache.hyracks.dataflow.common.data.accessors.IFrameTupleReference;
 
@@ -59,20 +61,18 @@
     };
 
     @Override
-    public ICopyEvaluatorFactory createEvaluatorFactory(final ICopyEvaluatorFactory[] args) throws AlgebricksException {
-        return new ICopyEvaluatorFactory() {
-
+    public IScalarEvaluatorFactory createEvaluatorFactory(final IScalarEvaluatorFactory[] args)
+            throws AlgebricksException {
+        return new IScalarEvaluatorFactory() {
             private static final long serialVersionUID = 1L;
 
             @Override
-            public ICopyEvaluator createEvaluator(final IDataOutputProvider output) throws AlgebricksException {
-                return new ICopyEvaluator() {
-
-                    private final DataOutput out = output.getDataOutput();
-
-                    private final ArrayBackedValueStorage argOut = new ArrayBackedValueStorage();
-
-                    private final ICopyEvaluator eval = args[0].createEvaluator(argOut);
+            public IScalarEvaluator createScalarEvaluator(IHyracksTaskContext ctx) throws AlgebricksException {
+                return new IScalarEvaluator() {
+                    private final ArrayBackedValueStorage resultStorage = new ArrayBackedValueStorage();
+                    private final DataOutput out = resultStorage.getDataOutput();
+                    private final IPointable argPtr = new VoidPointable();
+                    private final IScalarEvaluator eval = args[0].createScalarEvaluator(ctx);
 
                     // possible output
                     @SuppressWarnings("unchecked")
@@ -92,18 +92,22 @@
                             .getSerializerDeserializer(BuiltinType.ANULL);
 
                     @Override
-                    public void evaluate(IFrameTupleReference tuple) throws AlgebricksException {
-                        argOut.reset();
-                        eval.evaluate(tuple);
-                        byte[] bytes = argOut.getByteArray();
+                    public void evaluate(IFrameTupleReference tuple, IPointable result) throws AlgebricksException {
+                        eval.evaluate(tuple, argPtr);
+                        byte[] bytes = argPtr.getByteArray();
+                        int startOffset = argPtr.getStartOffset();
 
+                        resultStorage.reset();
                         try {
-                            if (bytes[0] == ATypeTag.SERIALIZED_NULL_TYPE_TAG) {
+                            if (bytes[startOffset] == ATypeTag.SERIALIZED_NULL_TYPE_TAG) {
                                 nullSerde.serialize(ANull.NULL, out);
+                                result.set(resultStorage);
                                 return;
-                            } else if (bytes[0] == ATypeTag.SERIALIZED_INTERVAL_TYPE_TAG) {
-                                byte timeType = AIntervalSerializerDeserializer.getIntervalTimeType(bytes, 1);
-                                long startTime = AIntervalSerializerDeserializer.getIntervalStart(bytes, 1);
+                            } else if (bytes[startOffset] == ATypeTag.SERIALIZED_INTERVAL_TYPE_TAG) {
+                                byte timeType = AIntervalSerializerDeserializer.getIntervalTimeType(bytes,
+                                        startOffset + 1);
+                                long startTime = AIntervalSerializerDeserializer.getIntervalStart(bytes,
+                                        startOffset + 1);
                                 if (timeType == ATypeTag.SERIALIZED_DATE_TYPE_TAG) {
                                     aDate.setValue((int) (startTime));
                                     dateSerde.serialize(aDate, out);
@@ -116,11 +120,12 @@
                                 }
                             } else {
                                 throw new AlgebricksException(FID.getName() + ": expects NULL/INTERVAL, but got "
-                                        + EnumDeserializer.ATYPETAGDESERIALIZER.deserialize(bytes[0]));
+                                        + EnumDeserializer.ATYPETAGDESERIALIZER.deserialize(bytes[startOffset]));
                             }
                         } catch (IOException e) {
                             throw new AlgebricksException(e);
                         }
+                        result.set(resultStorage);
                     }
                 };
             }
diff --git a/asterix-runtime/src/main/java/org/apache/asterix/runtime/evaluators/accessors/TemporalIntervalStartDateAccessor.java b/asterix-runtime/src/main/java/org/apache/asterix/runtime/evaluators/accessors/TemporalIntervalStartDateAccessor.java
index ff2a92b..e2d8883 100644
--- a/asterix-runtime/src/main/java/org/apache/asterix/runtime/evaluators/accessors/TemporalIntervalStartDateAccessor.java
+++ b/asterix-runtime/src/main/java/org/apache/asterix/runtime/evaluators/accessors/TemporalIntervalStartDateAccessor.java
@@ -35,10 +35,12 @@
 import org.apache.asterix.runtime.evaluators.base.AbstractScalarFunctionDynamicDescriptor;
 import org.apache.hyracks.algebricks.common.exceptions.AlgebricksException;
 import org.apache.hyracks.algebricks.core.algebra.functions.FunctionIdentifier;
-import org.apache.hyracks.algebricks.runtime.base.ICopyEvaluator;
-import org.apache.hyracks.algebricks.runtime.base.ICopyEvaluatorFactory;
+import org.apache.hyracks.algebricks.runtime.base.IScalarEvaluator;
+import org.apache.hyracks.algebricks.runtime.base.IScalarEvaluatorFactory;
+import org.apache.hyracks.api.context.IHyracksTaskContext;
 import org.apache.hyracks.api.dataflow.value.ISerializerDeserializer;
-import org.apache.hyracks.data.std.api.IDataOutputProvider;
+import org.apache.hyracks.data.std.api.IPointable;
+import org.apache.hyracks.data.std.primitive.VoidPointable;
 import org.apache.hyracks.data.std.util.ArrayBackedValueStorage;
 import org.apache.hyracks.dataflow.common.data.accessors.IFrameTupleReference;
 
@@ -55,20 +57,18 @@
     };
 
     @Override
-    public ICopyEvaluatorFactory createEvaluatorFactory(final ICopyEvaluatorFactory[] args) throws AlgebricksException {
-        return new ICopyEvaluatorFactory() {
-
+    public IScalarEvaluatorFactory createEvaluatorFactory(final IScalarEvaluatorFactory[] args)
+            throws AlgebricksException {
+        return new IScalarEvaluatorFactory() {
             private static final long serialVersionUID = 1L;
 
             @Override
-            public ICopyEvaluator createEvaluator(final IDataOutputProvider output) throws AlgebricksException {
-                return new ICopyEvaluator() {
-
-                    private final DataOutput out = output.getDataOutput();
-
-                    private final ArrayBackedValueStorage argOut = new ArrayBackedValueStorage();
-
-                    private final ICopyEvaluator eval = args[0].createEvaluator(argOut);
+            public IScalarEvaluator createScalarEvaluator(IHyracksTaskContext ctx) throws AlgebricksException {
+                return new IScalarEvaluator() {
+                    private final ArrayBackedValueStorage resultStorage = new ArrayBackedValueStorage();
+                    private final DataOutput out = resultStorage.getDataOutput();
+                    private final IPointable argPtr = new VoidPointable();
+                    private final IScalarEvaluator eval = args[0].createScalarEvaluator(ctx);
 
                     // possible output
                     @SuppressWarnings("unchecked")
@@ -80,18 +80,22 @@
                             .getSerializerDeserializer(BuiltinType.ANULL);
 
                     @Override
-                    public void evaluate(IFrameTupleReference tuple) throws AlgebricksException {
-                        argOut.reset();
-                        eval.evaluate(tuple);
-                        byte[] bytes = argOut.getByteArray();
+                    public void evaluate(IFrameTupleReference tuple, IPointable result) throws AlgebricksException {
+                        eval.evaluate(tuple, argPtr);
+                        byte[] bytes = argPtr.getByteArray();
+                        int startOffset = argPtr.getStartOffset();
 
+                        resultStorage.reset();
                         try {
-                            if (bytes[0] == ATypeTag.SERIALIZED_NULL_TYPE_TAG) {
+                            if (bytes[startOffset] == ATypeTag.SERIALIZED_NULL_TYPE_TAG) {
                                 nullSerde.serialize(ANull.NULL, out);
+                                result.set(resultStorage);
                                 return;
-                            } else if (bytes[0] == ATypeTag.SERIALIZED_INTERVAL_TYPE_TAG) {
-                                byte timeType = AIntervalSerializerDeserializer.getIntervalTimeType(bytes, 1);
-                                long startTime = AIntervalSerializerDeserializer.getIntervalStart(bytes, 1);
+                            } else if (bytes[startOffset] == ATypeTag.SERIALIZED_INTERVAL_TYPE_TAG) {
+                                byte timeType = AIntervalSerializerDeserializer.getIntervalTimeType(bytes,
+                                        startOffset + 1);
+                                long startTime = AIntervalSerializerDeserializer.getIntervalStart(bytes,
+                                        startOffset + 1);
                                 if (timeType == ATypeTag.SERIALIZED_DATE_TYPE_TAG) {
                                     aDate.setValue((int) (startTime));
                                     dateSerde.serialize(aDate, out);
@@ -101,13 +105,14 @@
                                             + EnumDeserializer.ATYPETAGDESERIALIZER.deserialize(timeType) + ")");
                                 }
                             } else {
-                                throw new AlgebricksException(
-                                        FID.getName() + ": expects NULL/INTERVAL(of DATE), but got "
-                                                + EnumDeserializer.ATYPETAGDESERIALIZER.deserialize(bytes[0]));
+                                throw new AlgebricksException(FID.getName()
+                                        + ": expects NULL/INTERVAL(of DATE), but got "
+                                        + EnumDeserializer.ATYPETAGDESERIALIZER.deserialize(bytes[startOffset]));
                             }
                         } catch (IOException e) {
                             throw new AlgebricksException(e);
                         }
+                        result.set(resultStorage);
                     }
                 };
             }
diff --git a/asterix-runtime/src/main/java/org/apache/asterix/runtime/evaluators/accessors/TemporalIntervalStartDatetimeAccessor.java b/asterix-runtime/src/main/java/org/apache/asterix/runtime/evaluators/accessors/TemporalIntervalStartDatetimeAccessor.java
index c88b8f0..b3a89c1 100644
--- a/asterix-runtime/src/main/java/org/apache/asterix/runtime/evaluators/accessors/TemporalIntervalStartDatetimeAccessor.java
+++ b/asterix-runtime/src/main/java/org/apache/asterix/runtime/evaluators/accessors/TemporalIntervalStartDatetimeAccessor.java
@@ -35,10 +35,12 @@
 import org.apache.asterix.runtime.evaluators.base.AbstractScalarFunctionDynamicDescriptor;
 import org.apache.hyracks.algebricks.common.exceptions.AlgebricksException;
 import org.apache.hyracks.algebricks.core.algebra.functions.FunctionIdentifier;
-import org.apache.hyracks.algebricks.runtime.base.ICopyEvaluator;
-import org.apache.hyracks.algebricks.runtime.base.ICopyEvaluatorFactory;
+import org.apache.hyracks.algebricks.runtime.base.IScalarEvaluator;
+import org.apache.hyracks.algebricks.runtime.base.IScalarEvaluatorFactory;
+import org.apache.hyracks.api.context.IHyracksTaskContext;
 import org.apache.hyracks.api.dataflow.value.ISerializerDeserializer;
-import org.apache.hyracks.data.std.api.IDataOutputProvider;
+import org.apache.hyracks.data.std.api.IPointable;
+import org.apache.hyracks.data.std.primitive.VoidPointable;
 import org.apache.hyracks.data.std.util.ArrayBackedValueStorage;
 import org.apache.hyracks.dataflow.common.data.accessors.IFrameTupleReference;
 
@@ -54,20 +56,19 @@
     };
 
     @Override
-    public ICopyEvaluatorFactory createEvaluatorFactory(final ICopyEvaluatorFactory[] args) throws AlgebricksException {
-        return new ICopyEvaluatorFactory() {
+    public IScalarEvaluatorFactory createEvaluatorFactory(final IScalarEvaluatorFactory[] args)
+            throws AlgebricksException {
+        return new IScalarEvaluatorFactory() {
 
             private static final long serialVersionUID = 1L;
 
             @Override
-            public ICopyEvaluator createEvaluator(final IDataOutputProvider output) throws AlgebricksException {
-                return new ICopyEvaluator() {
-
-                    private final DataOutput out = output.getDataOutput();
-
-                    private final ArrayBackedValueStorage argOut = new ArrayBackedValueStorage();
-
-                    private final ICopyEvaluator eval = args[0].createEvaluator(argOut);
+            public IScalarEvaluator createScalarEvaluator(IHyracksTaskContext ctx) throws AlgebricksException {
+                return new IScalarEvaluator() {
+                    private final ArrayBackedValueStorage resultStorage = new ArrayBackedValueStorage();
+                    private final DataOutput out = resultStorage.getDataOutput();
+                    private final IPointable argPtr = new VoidPointable();
+                    private final IScalarEvaluator eval = args[0].createScalarEvaluator(ctx);
 
                     // possible output
                     @SuppressWarnings("unchecked")
@@ -79,18 +80,22 @@
                             .getSerializerDeserializer(BuiltinType.ANULL);
 
                     @Override
-                    public void evaluate(IFrameTupleReference tuple) throws AlgebricksException {
-                        argOut.reset();
-                        eval.evaluate(tuple);
-                        byte[] bytes = argOut.getByteArray();
+                    public void evaluate(IFrameTupleReference tuple, IPointable result) throws AlgebricksException {
+                        eval.evaluate(tuple, argPtr);
+                        byte[] bytes = argPtr.getByteArray();
+                        int startOffset = argPtr.getStartOffset();
 
+                        resultStorage.reset();
                         try {
-                            if (bytes[0] == ATypeTag.SERIALIZED_NULL_TYPE_TAG) {
+                            if (bytes[startOffset] == ATypeTag.SERIALIZED_NULL_TYPE_TAG) {
                                 nullSerde.serialize(ANull.NULL, out);
+                                result.set(resultStorage);
                                 return;
-                            } else if (bytes[0] == ATypeTag.SERIALIZED_INTERVAL_TYPE_TAG) {
-                                byte timeType = AIntervalSerializerDeserializer.getIntervalTimeType(bytes, 1);
-                                long startTime = AIntervalSerializerDeserializer.getIntervalStart(bytes, 1);
+                            } else if (bytes[startOffset] == ATypeTag.SERIALIZED_INTERVAL_TYPE_TAG) {
+                                byte timeType = AIntervalSerializerDeserializer.getIntervalTimeType(bytes,
+                                        startOffset + 1);
+                                long startTime = AIntervalSerializerDeserializer.getIntervalStart(bytes,
+                                        startOffset + 1);
                                 if (timeType == ATypeTag.SERIALIZED_DATETIME_TYPE_TAG) {
                                     aDateTime.setValue(startTime);
                                     datetimeSerde.serialize(aDateTime, out);
@@ -100,13 +105,14 @@
                                             + EnumDeserializer.ATYPETAGDESERIALIZER.deserialize(timeType) + ")");
                                 }
                             } else {
-                                throw new AlgebricksException(
-                                        FID.getName() + ": expects NULL/INTERVAL(of DATETIME), but got "
-                                                + EnumDeserializer.ATYPETAGDESERIALIZER.deserialize(bytes[0]));
+                                throw new AlgebricksException(FID.getName()
+                                        + ": expects NULL/INTERVAL(of DATETIME), but got "
+                                        + EnumDeserializer.ATYPETAGDESERIALIZER.deserialize(bytes[startOffset]));
                             }
                         } catch (IOException e) {
                             throw new AlgebricksException(e);
                         }
+                        result.set(resultStorage);
                     }
                 };
             }
diff --git a/asterix-runtime/src/main/java/org/apache/asterix/runtime/evaluators/accessors/TemporalIntervalStartTimeAccessor.java b/asterix-runtime/src/main/java/org/apache/asterix/runtime/evaluators/accessors/TemporalIntervalStartTimeAccessor.java
index 8308d1f..12ee1f0 100644
--- a/asterix-runtime/src/main/java/org/apache/asterix/runtime/evaluators/accessors/TemporalIntervalStartTimeAccessor.java
+++ b/asterix-runtime/src/main/java/org/apache/asterix/runtime/evaluators/accessors/TemporalIntervalStartTimeAccessor.java
@@ -35,10 +35,12 @@
 import org.apache.asterix.runtime.evaluators.base.AbstractScalarFunctionDynamicDescriptor;
 import org.apache.hyracks.algebricks.common.exceptions.AlgebricksException;
 import org.apache.hyracks.algebricks.core.algebra.functions.FunctionIdentifier;
-import org.apache.hyracks.algebricks.runtime.base.ICopyEvaluator;
-import org.apache.hyracks.algebricks.runtime.base.ICopyEvaluatorFactory;
+import org.apache.hyracks.algebricks.runtime.base.IScalarEvaluator;
+import org.apache.hyracks.algebricks.runtime.base.IScalarEvaluatorFactory;
+import org.apache.hyracks.api.context.IHyracksTaskContext;
 import org.apache.hyracks.api.dataflow.value.ISerializerDeserializer;
-import org.apache.hyracks.data.std.api.IDataOutputProvider;
+import org.apache.hyracks.data.std.api.IPointable;
+import org.apache.hyracks.data.std.primitive.VoidPointable;
 import org.apache.hyracks.data.std.util.ArrayBackedValueStorage;
 import org.apache.hyracks.dataflow.common.data.accessors.IFrameTupleReference;
 
@@ -55,20 +57,18 @@
     };
 
     @Override
-    public ICopyEvaluatorFactory createEvaluatorFactory(final ICopyEvaluatorFactory[] args) throws AlgebricksException {
-        return new ICopyEvaluatorFactory() {
-
+    public IScalarEvaluatorFactory createEvaluatorFactory(final IScalarEvaluatorFactory[] args)
+            throws AlgebricksException {
+        return new IScalarEvaluatorFactory() {
             private static final long serialVersionUID = 1L;
 
             @Override
-            public ICopyEvaluator createEvaluator(final IDataOutputProvider output) throws AlgebricksException {
-                return new ICopyEvaluator() {
-
-                    private final DataOutput out = output.getDataOutput();
-
-                    private final ArrayBackedValueStorage argOut = new ArrayBackedValueStorage();
-
-                    private final ICopyEvaluator eval = args[0].createEvaluator(argOut);
+            public IScalarEvaluator createScalarEvaluator(IHyracksTaskContext ctx) throws AlgebricksException {
+                return new IScalarEvaluator() {
+                    private final ArrayBackedValueStorage resultStorage = new ArrayBackedValueStorage();
+                    private final DataOutput out = resultStorage.getDataOutput();
+                    private final IPointable argPtr = new VoidPointable();
+                    private final IScalarEvaluator eval = args[0].createScalarEvaluator(ctx);
 
                     // possible output
                     @SuppressWarnings("unchecked")
@@ -80,33 +80,39 @@
                             .getSerializerDeserializer(BuiltinType.ANULL);
 
                     @Override
-                    public void evaluate(IFrameTupleReference tuple) throws AlgebricksException {
-                        argOut.reset();
-                        eval.evaluate(tuple);
-                        byte[] bytes = argOut.getByteArray();
+                    public void evaluate(IFrameTupleReference tuple, IPointable result) throws AlgebricksException {
+                        eval.evaluate(tuple, argPtr);
+                        byte[] bytes = argPtr.getByteArray();
+                        int startOffset = argPtr.getStartOffset();
 
+                        resultStorage.reset();
                         try {
-                            if (bytes[0] == ATypeTag.SERIALIZED_NULL_TYPE_TAG) {
+                            if (bytes[startOffset] == ATypeTag.SERIALIZED_NULL_TYPE_TAG) {
                                 nullSerde.serialize(ANull.NULL, out);
+                                result.set(resultStorage);
                                 return;
-                            } else if (bytes[0] == ATypeTag.SERIALIZED_INTERVAL_TYPE_TAG) {
-                                byte timeType = AIntervalSerializerDeserializer.getIntervalTimeType(bytes, 1);
-                                long startTime = AIntervalSerializerDeserializer.getIntervalStart(bytes, 1);
+                            } else if (bytes[startOffset] == ATypeTag.SERIALIZED_INTERVAL_TYPE_TAG) {
+                                byte timeType = AIntervalSerializerDeserializer.getIntervalTimeType(bytes,
+                                        startOffset + 1);
+                                long startTime = AIntervalSerializerDeserializer.getIntervalStart(bytes,
+                                        startOffset + 1);
                                 if (timeType == ATypeTag.SERIALIZED_TIME_TYPE_TAG) {
                                     aTime.setValue((int) (startTime));
                                     timeSerde.serialize(aTime, out);
                                 } else {
                                     throw new AlgebricksException(FID.getName()
                                             + ": expects NULL/INTERVAL(of TIME), but got INTERVAL(of "
-                                            + EnumDeserializer.ATYPETAGDESERIALIZER.deserialize(bytes[0]) + ")");
+                                            + EnumDeserializer.ATYPETAGDESERIALIZER.deserialize(bytes[startOffset])
+                                            + ")");
                                 }
                             } else {
                                 throw new AlgebricksException(FID.getName() + ": expects NULL/INTERVAL, but got "
-                                        + EnumDeserializer.ATYPETAGDESERIALIZER.deserialize(bytes[0]));
+                                        + EnumDeserializer.ATYPETAGDESERIALIZER.deserialize(bytes[startOffset]));
                             }
                         } catch (IOException e) {
                             throw new AlgebricksException(e);
                         }
+                        result.set(resultStorage);
                     }
                 };
             }
diff --git a/asterix-runtime/src/main/java/org/apache/asterix/runtime/evaluators/accessors/TemporalMillisecondAccessor.java b/asterix-runtime/src/main/java/org/apache/asterix/runtime/evaluators/accessors/TemporalMillisecondAccessor.java
index a20e541..a0bef32 100644
--- a/asterix-runtime/src/main/java/org/apache/asterix/runtime/evaluators/accessors/TemporalMillisecondAccessor.java
+++ b/asterix-runtime/src/main/java/org/apache/asterix/runtime/evaluators/accessors/TemporalMillisecondAccessor.java
@@ -38,10 +38,12 @@
 import org.apache.asterix.runtime.evaluators.base.AbstractScalarFunctionDynamicDescriptor;
 import org.apache.hyracks.algebricks.common.exceptions.AlgebricksException;
 import org.apache.hyracks.algebricks.core.algebra.functions.FunctionIdentifier;
-import org.apache.hyracks.algebricks.runtime.base.ICopyEvaluator;
-import org.apache.hyracks.algebricks.runtime.base.ICopyEvaluatorFactory;
+import org.apache.hyracks.algebricks.runtime.base.IScalarEvaluator;
+import org.apache.hyracks.algebricks.runtime.base.IScalarEvaluatorFactory;
+import org.apache.hyracks.api.context.IHyracksTaskContext;
 import org.apache.hyracks.api.dataflow.value.ISerializerDeserializer;
-import org.apache.hyracks.data.std.api.IDataOutputProvider;
+import org.apache.hyracks.data.std.api.IPointable;
+import org.apache.hyracks.data.std.primitive.VoidPointable;
 import org.apache.hyracks.data.std.util.ArrayBackedValueStorage;
 import org.apache.hyracks.dataflow.common.data.accessors.IFrameTupleReference;
 
@@ -61,20 +63,19 @@
      * @see org.apache.asterix.runtime.base.IScalarFunctionDynamicDescriptor#createEvaluatorFactory(org.apache.hyracks.algebricks.runtime.base.ICopyEvaluatorFactory[])
      */
     @Override
-    public ICopyEvaluatorFactory createEvaluatorFactory(final ICopyEvaluatorFactory[] args) throws AlgebricksException {
-        return new ICopyEvaluatorFactory() {
+    public IScalarEvaluatorFactory createEvaluatorFactory(final IScalarEvaluatorFactory[] args)
+            throws AlgebricksException {
+        return new IScalarEvaluatorFactory() {
 
             private static final long serialVersionUID = 1L;
 
             @Override
-            public ICopyEvaluator createEvaluator(final IDataOutputProvider output) throws AlgebricksException {
-                return new ICopyEvaluator() {
-
-                    private final DataOutput out = output.getDataOutput();
-
-                    private final ArrayBackedValueStorage argOut = new ArrayBackedValueStorage();
-
-                    private final ICopyEvaluator eval = args[0].createEvaluator(argOut);
+            public IScalarEvaluator createScalarEvaluator(IHyracksTaskContext ctx) throws AlgebricksException {
+                return new IScalarEvaluator() {
+                    private final ArrayBackedValueStorage resultStorage = new ArrayBackedValueStorage();
+                    private final DataOutput out = resultStorage.getDataOutput();
+                    private final IPointable argPtr = new VoidPointable();
+                    private final IScalarEvaluator eval = args[0].createScalarEvaluator(ctx);
 
                     private final GregorianCalendarSystem calSystem = GregorianCalendarSystem.getInstance();
 
@@ -88,47 +89,48 @@
                             .getSerializerDeserializer(BuiltinType.ANULL);
 
                     @Override
-                    public void evaluate(IFrameTupleReference tuple) throws AlgebricksException {
-                        argOut.reset();
-                        eval.evaluate(tuple);
-                        byte[] bytes = argOut.getByteArray();
+                    public void evaluate(IFrameTupleReference tuple, IPointable result) throws AlgebricksException {
+                        eval.evaluate(tuple, argPtr);
+                        byte[] bytes = argPtr.getByteArray();
+                        int startOffset = argPtr.getStartOffset();
 
+                        resultStorage.reset();
                         try {
-
-                            if (bytes[0] == ATypeTag.SERIALIZED_DURATION_TYPE_TAG) {
-                                aMutableInt64.setValue(calSystem
-                                        .getDurationMillisecond(ADurationSerializerDeserializer.getDayTime(bytes, 1)));
+                            if (bytes[startOffset] == ATypeTag.SERIALIZED_DURATION_TYPE_TAG) {
+                                aMutableInt64.setValue(calSystem.getDurationMillisecond(
+                                        ADurationSerializerDeserializer.getDayTime(bytes, startOffset + 1)));
                                 intSerde.serialize(aMutableInt64, out);
+                                result.set(resultStorage);
                                 return;
                             }
-
-                            if (bytes[0] == ATypeTag.SERIALIZED_DAY_TIME_DURATION_TYPE_TAG) {
+                            if (bytes[startOffset] == ATypeTag.SERIALIZED_DAY_TIME_DURATION_TYPE_TAG) {
                                 aMutableInt64.setValue(calSystem.getDurationMillisecond(
-                                        ADayTimeDurationSerializerDeserializer.getDayTime(bytes, 1)));
+                                        ADayTimeDurationSerializerDeserializer.getDayTime(bytes, startOffset + 1)));
                                 intSerde.serialize(aMutableInt64, out);
+                                result.set(resultStorage);
                                 return;
                             }
 
                             long chrononTimeInMs = 0;
-                            if (bytes[0] == ATypeTag.SERIALIZED_TIME_TYPE_TAG) {
-                                chrononTimeInMs = AInt32SerializerDeserializer.getInt(bytes, 1);
-                            } else if (bytes[0] == ATypeTag.SERIALIZED_DATETIME_TYPE_TAG) {
-                                chrononTimeInMs = AInt64SerializerDeserializer.getLong(bytes, 1);
-                            } else if (bytes[0] == ATypeTag.SERIALIZED_NULL_TYPE_TAG) {
+                            if (bytes[startOffset] == ATypeTag.SERIALIZED_TIME_TYPE_TAG) {
+                                chrononTimeInMs = AInt32SerializerDeserializer.getInt(bytes, startOffset + 1);
+                            } else if (bytes[startOffset] == ATypeTag.SERIALIZED_DATETIME_TYPE_TAG) {
+                                chrononTimeInMs = AInt64SerializerDeserializer.getLong(bytes, startOffset + 1);
+                            } else if (bytes[startOffset] == ATypeTag.SERIALIZED_NULL_TYPE_TAG) {
                                 nullSerde.serialize(ANull.NULL, out);
+                                result.set(resultStorage);
                                 return;
                             } else {
-                                throw new AlgebricksException("Inapplicable input type: " + bytes[0]);
+                                throw new AlgebricksException("Inapplicable input type: " + bytes[startOffset]);
                             }
 
                             int ms = calSystem.getMillisOfSec(chrononTimeInMs);
-
                             aMutableInt64.setValue(ms);
                             intSerde.serialize(aMutableInt64, out);
-
                         } catch (IOException e) {
                             throw new AlgebricksException(e);
                         }
+                        result.set(resultStorage);
                     }
                 };
             }
diff --git a/asterix-runtime/src/main/java/org/apache/asterix/runtime/evaluators/accessors/TemporalMinuteAccessor.java b/asterix-runtime/src/main/java/org/apache/asterix/runtime/evaluators/accessors/TemporalMinuteAccessor.java
index 07e7c2d..cdd0f8a 100644
--- a/asterix-runtime/src/main/java/org/apache/asterix/runtime/evaluators/accessors/TemporalMinuteAccessor.java
+++ b/asterix-runtime/src/main/java/org/apache/asterix/runtime/evaluators/accessors/TemporalMinuteAccessor.java
@@ -38,10 +38,12 @@
 import org.apache.asterix.runtime.evaluators.base.AbstractScalarFunctionDynamicDescriptor;
 import org.apache.hyracks.algebricks.common.exceptions.AlgebricksException;
 import org.apache.hyracks.algebricks.core.algebra.functions.FunctionIdentifier;
-import org.apache.hyracks.algebricks.runtime.base.ICopyEvaluator;
-import org.apache.hyracks.algebricks.runtime.base.ICopyEvaluatorFactory;
+import org.apache.hyracks.algebricks.runtime.base.IScalarEvaluator;
+import org.apache.hyracks.algebricks.runtime.base.IScalarEvaluatorFactory;
+import org.apache.hyracks.api.context.IHyracksTaskContext;
 import org.apache.hyracks.api.dataflow.value.ISerializerDeserializer;
-import org.apache.hyracks.data.std.api.IDataOutputProvider;
+import org.apache.hyracks.data.std.api.IPointable;
+import org.apache.hyracks.data.std.primitive.VoidPointable;
 import org.apache.hyracks.data.std.util.ArrayBackedValueStorage;
 import org.apache.hyracks.dataflow.common.data.accessors.IFrameTupleReference;
 
@@ -64,20 +66,19 @@
      * @see org.apache.asterix.runtime.base.IScalarFunctionDynamicDescriptor#createEvaluatorFactory(org.apache.hyracks.algebricks.runtime.base.ICopyEvaluatorFactory[])
      */
     @Override
-    public ICopyEvaluatorFactory createEvaluatorFactory(final ICopyEvaluatorFactory[] args) throws AlgebricksException {
-        return new ICopyEvaluatorFactory() {
+    public IScalarEvaluatorFactory createEvaluatorFactory(final IScalarEvaluatorFactory[] args)
+            throws AlgebricksException {
+        return new IScalarEvaluatorFactory() {
 
             private static final long serialVersionUID = 1L;
 
             @Override
-            public ICopyEvaluator createEvaluator(final IDataOutputProvider output) throws AlgebricksException {
-                return new ICopyEvaluator() {
-
-                    private final DataOutput out = output.getDataOutput();
-
-                    private final ArrayBackedValueStorage argOut = new ArrayBackedValueStorage();
-
-                    private final ICopyEvaluator eval = args[0].createEvaluator(argOut);
+            public IScalarEvaluator createScalarEvaluator(IHyracksTaskContext ctx) throws AlgebricksException {
+                return new IScalarEvaluator() {
+                    private final ArrayBackedValueStorage resultStorage = new ArrayBackedValueStorage();
+                    private final DataOutput out = resultStorage.getDataOutput();
+                    private final IPointable argPtr = new VoidPointable();
+                    private final IScalarEvaluator eval = args[0].createScalarEvaluator(ctx);
 
                     private final GregorianCalendarSystem calSystem = GregorianCalendarSystem.getInstance();
 
@@ -91,47 +92,48 @@
                             .getSerializerDeserializer(BuiltinType.ANULL);
 
                     @Override
-                    public void evaluate(IFrameTupleReference tuple) throws AlgebricksException {
-                        argOut.reset();
-                        eval.evaluate(tuple);
-                        byte[] bytes = argOut.getByteArray();
+                    public void evaluate(IFrameTupleReference tuple, IPointable result) throws AlgebricksException {
+                        eval.evaluate(tuple, argPtr);
+                        byte[] bytes = argPtr.getByteArray();
+                        int startOffset = argPtr.getStartOffset();
 
+                        resultStorage.reset();
                         try {
-
-                            if (bytes[0] == ATypeTag.SERIALIZED_DURATION_TYPE_TAG) {
-                                aMutableInt64.setValue(calSystem
-                                        .getDurationMinute(ADurationSerializerDeserializer.getDayTime(bytes, 1)));
+                            if (bytes[startOffset] == ATypeTag.SERIALIZED_DURATION_TYPE_TAG) {
+                                aMutableInt64.setValue(calSystem.getDurationMinute(
+                                        ADurationSerializerDeserializer.getDayTime(bytes, startOffset + 1)));
                                 intSerde.serialize(aMutableInt64, out);
+                                result.set(resultStorage);
                                 return;
                             }
-
-                            if (bytes[0] == ATypeTag.SERIALIZED_DAY_TIME_DURATION_TYPE_TAG) {
+                            if (bytes[startOffset] == ATypeTag.SERIALIZED_DAY_TIME_DURATION_TYPE_TAG) {
                                 aMutableInt64.setValue(calSystem.getDurationMinute(
-                                        ADayTimeDurationSerializerDeserializer.getDayTime(bytes, 1)));
+                                        ADayTimeDurationSerializerDeserializer.getDayTime(bytes, startOffset + 1)));
                                 intSerde.serialize(aMutableInt64, out);
+                                result.set(resultStorage);
                                 return;
                             }
 
                             long chrononTimeInMs = 0;
-                            if (bytes[0] == ATypeTag.SERIALIZED_TIME_TYPE_TAG) {
-                                chrononTimeInMs = AInt32SerializerDeserializer.getInt(bytes, 1);
-                            } else if (bytes[0] == ATypeTag.SERIALIZED_DATETIME_TYPE_TAG) {
-                                chrononTimeInMs = AInt64SerializerDeserializer.getLong(bytes, 1);
-                            } else if (bytes[0] == ATypeTag.SERIALIZED_NULL_TYPE_TAG) {
+                            if (bytes[startOffset] == ATypeTag.SERIALIZED_TIME_TYPE_TAG) {
+                                chrononTimeInMs = AInt32SerializerDeserializer.getInt(bytes, startOffset + 1);
+                            } else if (bytes[startOffset] == ATypeTag.SERIALIZED_DATETIME_TYPE_TAG) {
+                                chrononTimeInMs = AInt64SerializerDeserializer.getLong(bytes, startOffset + 1);
+                            } else if (bytes[startOffset] == ATypeTag.SERIALIZED_NULL_TYPE_TAG) {
                                 nullSerde.serialize(ANull.NULL, out);
+                                result.set(resultStorage);
                                 return;
                             } else {
-                                throw new AlgebricksException("Inapplicable input type: " + bytes[0]);
+                                throw new AlgebricksException("Inapplicable input type: " + bytes[startOffset]);
                             }
 
                             int min = calSystem.getMinOfHour(chrononTimeInMs);
-
                             aMutableInt64.setValue(min);
                             intSerde.serialize(aMutableInt64, out);
-
                         } catch (IOException e) {
                             throw new AlgebricksException(e);
                         }
+                        result.set(resultStorage);
                     }
                 };
             }
diff --git a/asterix-runtime/src/main/java/org/apache/asterix/runtime/evaluators/accessors/TemporalMonthAccessor.java b/asterix-runtime/src/main/java/org/apache/asterix/runtime/evaluators/accessors/TemporalMonthAccessor.java
index 5d721c4..4a27e82 100644
--- a/asterix-runtime/src/main/java/org/apache/asterix/runtime/evaluators/accessors/TemporalMonthAccessor.java
+++ b/asterix-runtime/src/main/java/org/apache/asterix/runtime/evaluators/accessors/TemporalMonthAccessor.java
@@ -38,10 +38,12 @@
 import org.apache.asterix.runtime.evaluators.base.AbstractScalarFunctionDynamicDescriptor;
 import org.apache.hyracks.algebricks.common.exceptions.AlgebricksException;
 import org.apache.hyracks.algebricks.core.algebra.functions.FunctionIdentifier;
-import org.apache.hyracks.algebricks.runtime.base.ICopyEvaluator;
-import org.apache.hyracks.algebricks.runtime.base.ICopyEvaluatorFactory;
+import org.apache.hyracks.algebricks.runtime.base.IScalarEvaluator;
+import org.apache.hyracks.algebricks.runtime.base.IScalarEvaluatorFactory;
+import org.apache.hyracks.api.context.IHyracksTaskContext;
 import org.apache.hyracks.api.dataflow.value.ISerializerDeserializer;
-import org.apache.hyracks.data.std.api.IDataOutputProvider;
+import org.apache.hyracks.data.std.api.IPointable;
+import org.apache.hyracks.data.std.primitive.VoidPointable;
 import org.apache.hyracks.data.std.util.ArrayBackedValueStorage;
 import org.apache.hyracks.dataflow.common.data.accessors.IFrameTupleReference;
 
@@ -61,20 +63,19 @@
      * @see org.apache.asterix.runtime.base.IScalarFunctionDynamicDescriptor#createEvaluatorFactory(org.apache.hyracks.algebricks.runtime.base.ICopyEvaluatorFactory[])
      */
     @Override
-    public ICopyEvaluatorFactory createEvaluatorFactory(final ICopyEvaluatorFactory[] args) throws AlgebricksException {
-        return new ICopyEvaluatorFactory() {
+    public IScalarEvaluatorFactory createEvaluatorFactory(final IScalarEvaluatorFactory[] args)
+            throws AlgebricksException {
+        return new IScalarEvaluatorFactory() {
 
             private static final long serialVersionUID = 1L;
 
             @Override
-            public ICopyEvaluator createEvaluator(final IDataOutputProvider output) throws AlgebricksException {
-                return new ICopyEvaluator() {
-
-                    private final DataOutput out = output.getDataOutput();
-
-                    private final ArrayBackedValueStorage argOut = new ArrayBackedValueStorage();
-
-                    private final ICopyEvaluator eval = args[0].createEvaluator(argOut);
+            public IScalarEvaluator createScalarEvaluator(IHyracksTaskContext ctx) throws AlgebricksException {
+                return new IScalarEvaluator() {
+                    private final ArrayBackedValueStorage resultStorage = new ArrayBackedValueStorage();
+                    private final DataOutput out = resultStorage.getDataOutput();
+                    private final IPointable argPtr = new VoidPointable();
+                    private final IScalarEvaluator eval = args[0].createScalarEvaluator(ctx);
 
                     private final GregorianCalendarSystem calSystem = GregorianCalendarSystem.getInstance();
 
@@ -88,38 +89,40 @@
                             .getSerializerDeserializer(BuiltinType.ANULL);
 
                     @Override
-                    public void evaluate(IFrameTupleReference tuple) throws AlgebricksException {
-                        argOut.reset();
-                        eval.evaluate(tuple);
-                        byte[] bytes = argOut.getByteArray();
+                    public void evaluate(IFrameTupleReference tuple, IPointable result) throws AlgebricksException {
+                        eval.evaluate(tuple, argPtr);
+                        byte[] bytes = argPtr.getByteArray();
+                        int startOffset = argPtr.getStartOffset();
 
+                        resultStorage.reset();
                         try {
-
-                            if (bytes[0] == ATypeTag.SERIALIZED_DURATION_TYPE_TAG) {
-                                aMutableInt64.setValue(calSystem
-                                        .getDurationMonth(ADurationSerializerDeserializer.getYearMonth(bytes, 1)));
+                            if (bytes[startOffset] == ATypeTag.SERIALIZED_DURATION_TYPE_TAG) {
+                                aMutableInt64.setValue(calSystem.getDurationMonth(
+                                        ADurationSerializerDeserializer.getYearMonth(bytes, startOffset + 1)));
                                 intSerde.serialize(aMutableInt64, out);
+                                result.set(resultStorage);
                                 return;
                             }
-
-                            if (bytes[0] == ATypeTag.SERIALIZED_YEAR_MONTH_DURATION_TYPE_TAG) {
+                            if (bytes[startOffset] == ATypeTag.SERIALIZED_YEAR_MONTH_DURATION_TYPE_TAG) {
                                 aMutableInt64.setValue(calSystem.getDurationMonth(
-                                        AYearMonthDurationSerializerDeserializer.getYearMonth(bytes, 1)));
+                                        AYearMonthDurationSerializerDeserializer.getYearMonth(bytes, startOffset + 1)));
                                 intSerde.serialize(aMutableInt64, out);
+                                result.set(resultStorage);
                                 return;
                             }
 
                             long chrononTimeInMs = 0;
-                            if (bytes[0] == ATypeTag.SERIALIZED_DATE_TYPE_TAG) {
-                                chrononTimeInMs = AInt32SerializerDeserializer.getInt(bytes, 1)
+                            if (bytes[startOffset] == ATypeTag.SERIALIZED_DATE_TYPE_TAG) {
+                                chrononTimeInMs = AInt32SerializerDeserializer.getInt(bytes, startOffset + 1)
                                         * GregorianCalendarSystem.CHRONON_OF_DAY;
-                            } else if (bytes[0] == ATypeTag.SERIALIZED_DATETIME_TYPE_TAG) {
-                                chrononTimeInMs = AInt64SerializerDeserializer.getLong(bytes, 1);
-                            } else if (bytes[0] == ATypeTag.SERIALIZED_NULL_TYPE_TAG) {
+                            } else if (bytes[startOffset] == ATypeTag.SERIALIZED_DATETIME_TYPE_TAG) {
+                                chrononTimeInMs = AInt64SerializerDeserializer.getLong(bytes, startOffset + 1);
+                            } else if (bytes[startOffset] == ATypeTag.SERIALIZED_NULL_TYPE_TAG) {
                                 nullSerde.serialize(ANull.NULL, out);
+                                result.set(resultStorage);
                                 return;
                             } else {
-                                throw new AlgebricksException("Inapplicable input type: " + bytes[0]);
+                                throw new AlgebricksException("Inapplicable input type: " + bytes[startOffset]);
                             }
 
                             int year = calSystem.getYear(chrononTimeInMs);
@@ -127,10 +130,10 @@
 
                             aMutableInt64.setValue(month);
                             intSerde.serialize(aMutableInt64, out);
-
                         } catch (IOException e) {
                             throw new AlgebricksException(e);
                         }
+                        result.set(resultStorage);
                     }
                 };
             }
diff --git a/asterix-runtime/src/main/java/org/apache/asterix/runtime/evaluators/accessors/TemporalSecondAccessor.java b/asterix-runtime/src/main/java/org/apache/asterix/runtime/evaluators/accessors/TemporalSecondAccessor.java
index 49db89d..6abe7a39 100644
--- a/asterix-runtime/src/main/java/org/apache/asterix/runtime/evaluators/accessors/TemporalSecondAccessor.java
+++ b/asterix-runtime/src/main/java/org/apache/asterix/runtime/evaluators/accessors/TemporalSecondAccessor.java
@@ -38,10 +38,12 @@
 import org.apache.asterix.runtime.evaluators.base.AbstractScalarFunctionDynamicDescriptor;
 import org.apache.hyracks.algebricks.common.exceptions.AlgebricksException;
 import org.apache.hyracks.algebricks.core.algebra.functions.FunctionIdentifier;
-import org.apache.hyracks.algebricks.runtime.base.ICopyEvaluator;
-import org.apache.hyracks.algebricks.runtime.base.ICopyEvaluatorFactory;
+import org.apache.hyracks.algebricks.runtime.base.IScalarEvaluator;
+import org.apache.hyracks.algebricks.runtime.base.IScalarEvaluatorFactory;
+import org.apache.hyracks.api.context.IHyracksTaskContext;
 import org.apache.hyracks.api.dataflow.value.ISerializerDeserializer;
-import org.apache.hyracks.data.std.api.IDataOutputProvider;
+import org.apache.hyracks.data.std.api.IPointable;
+import org.apache.hyracks.data.std.primitive.VoidPointable;
 import org.apache.hyracks.data.std.util.ArrayBackedValueStorage;
 import org.apache.hyracks.dataflow.common.data.accessors.IFrameTupleReference;
 
@@ -61,20 +63,19 @@
      * @see org.apache.asterix.runtime.base.IScalarFunctionDynamicDescriptor#createEvaluatorFactory(org.apache.hyracks.algebricks.runtime.base.ICopyEvaluatorFactory[])
      */
     @Override
-    public ICopyEvaluatorFactory createEvaluatorFactory(final ICopyEvaluatorFactory[] args) throws AlgebricksException {
-        return new ICopyEvaluatorFactory() {
+    public IScalarEvaluatorFactory createEvaluatorFactory(final IScalarEvaluatorFactory[] args)
+            throws AlgebricksException {
+        return new IScalarEvaluatorFactory() {
 
             private static final long serialVersionUID = 1L;
 
             @Override
-            public ICopyEvaluator createEvaluator(final IDataOutputProvider output) throws AlgebricksException {
-                return new ICopyEvaluator() {
-
-                    private final DataOutput out = output.getDataOutput();
-
-                    private final ArrayBackedValueStorage argOut = new ArrayBackedValueStorage();
-
-                    private final ICopyEvaluator eval = args[0].createEvaluator(argOut);
+            public IScalarEvaluator createScalarEvaluator(IHyracksTaskContext ctx) throws AlgebricksException {
+                return new IScalarEvaluator() {
+                    private final ArrayBackedValueStorage resultStorage = new ArrayBackedValueStorage();
+                    private final DataOutput out = resultStorage.getDataOutput();
+                    private final IPointable argPtr = new VoidPointable();
+                    private final IScalarEvaluator eval = args[0].createScalarEvaluator(ctx);
 
                     private final GregorianCalendarSystem calSystem = GregorianCalendarSystem.getInstance();
 
@@ -88,47 +89,50 @@
                             .getSerializerDeserializer(BuiltinType.ANULL);
 
                     @Override
-                    public void evaluate(IFrameTupleReference tuple) throws AlgebricksException {
-                        argOut.reset();
-                        eval.evaluate(tuple);
-                        byte[] bytes = argOut.getByteArray();
+                    public void evaluate(IFrameTupleReference tuple, IPointable result) throws AlgebricksException {
+                        eval.evaluate(tuple, argPtr);
+                        byte[] bytes = argPtr.getByteArray();
+                        int startOffset = argPtr.getStartOffset();
 
+                        resultStorage.reset();
                         try {
-
-                            if (bytes[0] == ATypeTag.SERIALIZED_DURATION_TYPE_TAG) {
-                                aMutableInt64.setValue(calSystem
-                                        .getDurationSecond(ADurationSerializerDeserializer.getDayTime(bytes, 1)));
+                            if (bytes[startOffset] == ATypeTag.SERIALIZED_DURATION_TYPE_TAG) {
+                                aMutableInt64.setValue(calSystem.getDurationSecond(
+                                        ADurationSerializerDeserializer.getDayTime(bytes, startOffset + 1)));
                                 intSerde.serialize(aMutableInt64, out);
+                                result.set(resultStorage);
                                 return;
                             }
 
-                            if (bytes[0] == ATypeTag.SERIALIZED_DAY_TIME_DURATION_TYPE_TAG) {
+                            if (bytes[startOffset] == ATypeTag.SERIALIZED_DAY_TIME_DURATION_TYPE_TAG) {
                                 aMutableInt64.setValue(calSystem.getDurationSecond(
-                                        ADayTimeDurationSerializerDeserializer.getDayTime(bytes, 1)));
+                                        ADayTimeDurationSerializerDeserializer.getDayTime(bytes, startOffset + 1)));
                                 intSerde.serialize(aMutableInt64, out);
+                                result.set(resultStorage);
                                 return;
                             }
 
                             long chrononTimeInMs = 0;
-                            if (bytes[0] == ATypeTag.SERIALIZED_TIME_TYPE_TAG) {
-                                chrononTimeInMs = AInt32SerializerDeserializer.getInt(bytes, 1);
-                            } else if (bytes[0] == ATypeTag.SERIALIZED_DATETIME_TYPE_TAG) {
-                                chrononTimeInMs = AInt64SerializerDeserializer.getLong(bytes, 1);
-                            } else if (bytes[0] == ATypeTag.SERIALIZED_NULL_TYPE_TAG) {
+                            if (bytes[startOffset] == ATypeTag.SERIALIZED_TIME_TYPE_TAG) {
+                                chrononTimeInMs = AInt32SerializerDeserializer.getInt(bytes, startOffset + 1);
+                            } else if (bytes[startOffset] == ATypeTag.SERIALIZED_DATETIME_TYPE_TAG) {
+                                chrononTimeInMs = AInt64SerializerDeserializer.getLong(bytes, startOffset + 1);
+                            } else if (bytes[startOffset] == ATypeTag.SERIALIZED_NULL_TYPE_TAG) {
                                 nullSerde.serialize(ANull.NULL, out);
+                                result.set(resultStorage);
                                 return;
                             } else {
-                                throw new AlgebricksException("Inapplicable input type: " + bytes[0]);
+                                throw new AlgebricksException("Inapplicable input type: " + bytes[startOffset]);
                             }
 
                             int sec = calSystem.getSecOfMin(chrononTimeInMs);
 
                             aMutableInt64.setValue(sec);
                             intSerde.serialize(aMutableInt64, out);
-
                         } catch (IOException e) {
                             throw new AlgebricksException(e);
                         }
+                        result.set(resultStorage);
                     }
                 };
             }
diff --git a/asterix-runtime/src/main/java/org/apache/asterix/runtime/evaluators/accessors/TemporalYearAccessor.java b/asterix-runtime/src/main/java/org/apache/asterix/runtime/evaluators/accessors/TemporalYearAccessor.java
index 928d6ea..ccf54c6 100644
--- a/asterix-runtime/src/main/java/org/apache/asterix/runtime/evaluators/accessors/TemporalYearAccessor.java
+++ b/asterix-runtime/src/main/java/org/apache/asterix/runtime/evaluators/accessors/TemporalYearAccessor.java
@@ -38,11 +38,13 @@
 import org.apache.asterix.runtime.evaluators.base.AbstractScalarFunctionDynamicDescriptor;
 import org.apache.hyracks.algebricks.common.exceptions.AlgebricksException;
 import org.apache.hyracks.algebricks.core.algebra.functions.FunctionIdentifier;
-import org.apache.hyracks.algebricks.runtime.base.ICopyEvaluator;
-import org.apache.hyracks.algebricks.runtime.base.ICopyEvaluatorFactory;
+import org.apache.hyracks.algebricks.runtime.base.IScalarEvaluator;
+import org.apache.hyracks.algebricks.runtime.base.IScalarEvaluatorFactory;
+import org.apache.hyracks.api.context.IHyracksTaskContext;
 import org.apache.hyracks.api.dataflow.value.ISerializerDeserializer;
-import org.apache.hyracks.data.std.api.IDataOutputProvider;
+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.data.std.util.ArrayBackedValueStorage;
 import org.apache.hyracks.data.std.util.UTF8StringCharacterIterator;
 import org.apache.hyracks.dataflow.common.data.accessors.IFrameTupleReference;
@@ -59,20 +61,19 @@
     };
 
     @Override
-    public ICopyEvaluatorFactory createEvaluatorFactory(final ICopyEvaluatorFactory[] args) throws AlgebricksException {
-        return new ICopyEvaluatorFactory() {
+    public IScalarEvaluatorFactory createEvaluatorFactory(final IScalarEvaluatorFactory[] args)
+            throws AlgebricksException {
+        return new IScalarEvaluatorFactory() {
 
             private static final long serialVersionUID = 1L;
 
             @Override
-            public ICopyEvaluator createEvaluator(final IDataOutputProvider output) throws AlgebricksException {
-                return new ICopyEvaluator() {
-
-                    private final DataOutput out = output.getDataOutput();
-
-                    private final ArrayBackedValueStorage argOut = new ArrayBackedValueStorage();
-
-                    private final ICopyEvaluator eval = args[0].createEvaluator(argOut);
+            public IScalarEvaluator createScalarEvaluator(IHyracksTaskContext ctx) throws AlgebricksException {
+                return new IScalarEvaluator() {
+                    private final ArrayBackedValueStorage resultStorage = new ArrayBackedValueStorage();
+                    private final DataOutput out = resultStorage.getDataOutput();
+                    private final IPointable argPtr = new VoidPointable();
+                    private final IScalarEvaluator eval = args[0].createScalarEvaluator(ctx);
 
                     private final GregorianCalendarSystem calSystem = GregorianCalendarSystem.getInstance();
 
@@ -89,39 +90,42 @@
                             .getSerializerDeserializer(BuiltinType.ANULL);
 
                     @Override
-                    public void evaluate(IFrameTupleReference tuple) throws AlgebricksException {
-                        argOut.reset();
-                        eval.evaluate(tuple);
-                        byte[] bytes = argOut.getByteArray();
+                    public void evaluate(IFrameTupleReference tuple, IPointable result) throws AlgebricksException {
+                        eval.evaluate(tuple, argPtr);
+                        byte[] bytes = argPtr.getByteArray();
+                        int startOffset = argPtr.getStartOffset();
+                        int len = argPtr.getLength();
 
+                        resultStorage.reset();
                         try {
-
-                            if (bytes[0] == ATypeTag.SERIALIZED_DURATION_TYPE_TAG) {
-                                aMutableInt64.setValue(calSystem
-                                        .getDurationYear(ADurationSerializerDeserializer.getYearMonth(bytes, 1)));
+                            if (bytes[startOffset] == ATypeTag.SERIALIZED_DURATION_TYPE_TAG) {
+                                aMutableInt64.setValue(calSystem.getDurationYear(
+                                        ADurationSerializerDeserializer.getYearMonth(bytes, startOffset + 1)));
                                 intSerde.serialize(aMutableInt64, out);
+                                result.set(resultStorage);
                                 return;
                             }
-
-                            if (bytes[0] == ATypeTag.SERIALIZED_YEAR_MONTH_DURATION_TYPE_TAG) {
+                            if (bytes[startOffset] == ATypeTag.SERIALIZED_YEAR_MONTH_DURATION_TYPE_TAG) {
                                 aMutableInt64.setValue(calSystem.getDurationYear(
-                                        AYearMonthDurationSerializerDeserializer.getYearMonth(bytes, 1)));
+                                        AYearMonthDurationSerializerDeserializer.getYearMonth(bytes, startOffset + 1)));
                                 intSerde.serialize(aMutableInt64, out);
+                                result.set(resultStorage);
                                 return;
                             }
 
                             long chrononTimeInMs = 0;
-                            if (bytes[0] == ATypeTag.SERIALIZED_DATE_TYPE_TAG) {
-                                chrononTimeInMs = AInt32SerializerDeserializer.getInt(bytes, 1)
+                            if (bytes[startOffset] == ATypeTag.SERIALIZED_DATE_TYPE_TAG) {
+                                chrononTimeInMs = AInt32SerializerDeserializer.getInt(bytes, startOffset + 1)
                                         * GregorianCalendarSystem.CHRONON_OF_DAY;
-                            } else if (bytes[0] == ATypeTag.SERIALIZED_DATETIME_TYPE_TAG) {
-                                chrononTimeInMs = AInt64SerializerDeserializer.getLong(bytes, 1);
-                            } else if (bytes[0] == ATypeTag.SERIALIZED_NULL_TYPE_TAG) {
+                            } else if (bytes[startOffset] == ATypeTag.SERIALIZED_DATETIME_TYPE_TAG) {
+                                chrononTimeInMs = AInt64SerializerDeserializer.getLong(bytes, startOffset + 1);
+                            } else if (bytes[startOffset] == ATypeTag.SERIALIZED_NULL_TYPE_TAG) {
                                 nullSerde.serialize(ANull.NULL, out);
+                                result.set(resultStorage);
                                 return;
-                            } else if (bytes[0] == ATypeTag.SERIALIZED_STRING_TYPE_TAG) {
+                            } else if (bytes[startOffset] == ATypeTag.SERIALIZED_STRING_TYPE_TAG) {
                                 int year;
-                                strExprPtr.set(bytes, 1, bytes.length);
+                                strExprPtr.set(bytes, startOffset + 1, len - 1);
                                 strIter.reset(strExprPtr);
                                 char firstChar = strIter.next();
                                 if (firstChar == '-') {
@@ -134,16 +138,17 @@
                                 }
                                 aMutableInt64.setValue(year);
                                 intSerde.serialize(aMutableInt64, out);
+                                result.set(resultStorage);
                                 return;
                             } else {
-                                throw new AlgebricksException("Inapplicable input type: " + bytes[0]);
+                                throw new AlgebricksException("Inapplicable input type: " + bytes[startOffset]);
                             }
 
                             int year = calSystem.getYear(chrononTimeInMs);
 
                             aMutableInt64.setValue(year);
                             intSerde.serialize(aMutableInt64, out);
-
+                            result.set(resultStorage);
                         } catch (IOException e) {
                             throw new AlgebricksException(e);
                         }
diff --git a/asterix-runtime/src/main/java/org/apache/asterix/runtime/evaluators/common/AccessibleByteArrayEval.java b/asterix-runtime/src/main/java/org/apache/asterix/runtime/evaluators/common/AccessibleByteArrayEval.java
index 92a5d4e..f621241 100644
--- a/asterix-runtime/src/main/java/org/apache/asterix/runtime/evaluators/common/AccessibleByteArrayEval.java
+++ b/asterix-runtime/src/main/java/org/apache/asterix/runtime/evaluators/common/AccessibleByteArrayEval.java
@@ -20,27 +20,19 @@
 
 import java.io.DataOutput;
 import java.io.DataOutputStream;
-import java.io.IOException;
 
 import org.apache.hyracks.algebricks.common.exceptions.AlgebricksException;
-import org.apache.hyracks.algebricks.runtime.base.ICopyEvaluator;
+import org.apache.hyracks.algebricks.runtime.base.IScalarEvaluator;
+import org.apache.hyracks.data.std.api.IPointable;
 import org.apache.hyracks.data.std.util.ByteArrayAccessibleOutputStream;
 import org.apache.hyracks.dataflow.common.data.accessors.IFrameTupleReference;
 
-public class AccessibleByteArrayEval implements ICopyEvaluator {
+public class AccessibleByteArrayEval implements IScalarEvaluator {
 
-    private DataOutput out;
     private ByteArrayAccessibleOutputStream baaos;
     private DataOutput dataOutput;
 
-    public AccessibleByteArrayEval(DataOutput out) {
-        this.out = out;
-        this.baaos = new ByteArrayAccessibleOutputStream();
-        this.dataOutput = new DataOutputStream(baaos);
-    }
-
-    public AccessibleByteArrayEval(DataOutput out, ByteArrayAccessibleOutputStream baaos) {
-        this.out = out;
+    public AccessibleByteArrayEval(ByteArrayAccessibleOutputStream baaos) {
         this.baaos = baaos;
         this.dataOutput = new DataOutputStream(baaos);
     }
@@ -50,16 +42,8 @@
     }
 
     @Override
-    public void evaluate(IFrameTupleReference tuple) throws AlgebricksException {
-        try {
-            out.write(baaos.getByteArray(), 0, baaos.size());
-        } catch (IOException e) {
-            throw new AlgebricksException(e);
-        }
-    }
-
-    public void setBaaos(ByteArrayAccessibleOutputStream baaos) {
-        this.baaos = baaos;
+    public void evaluate(IFrameTupleReference tuple, IPointable result) throws AlgebricksException {
+        result.set(baaos.getByteArray(), 0, baaos.size());
     }
 
     public ByteArrayAccessibleOutputStream getBaaos() {
diff --git a/asterix-runtime/src/main/java/org/apache/asterix/runtime/evaluators/common/ClosedRecordConstructorEvalFactory.java b/asterix-runtime/src/main/java/org/apache/asterix/runtime/evaluators/common/ClosedRecordConstructorEvalFactory.java
index ed8ce03..6ebb684 100644
--- a/asterix-runtime/src/main/java/org/apache/asterix/runtime/evaluators/common/ClosedRecordConstructorEvalFactory.java
+++ b/asterix-runtime/src/main/java/org/apache/asterix/runtime/evaluators/common/ClosedRecordConstructorEvalFactory.java
@@ -20,78 +20,75 @@
 package org.apache.asterix.runtime.evaluators.common;
 
 import java.io.DataOutput;
-import java.io.IOException;
 
 import org.apache.asterix.builders.IARecordBuilder;
 import org.apache.asterix.builders.RecordBuilder;
-import org.apache.asterix.common.exceptions.AsterixException;
 import org.apache.asterix.om.types.ARecordType;
 import org.apache.asterix.om.types.ATypeTag;
 import org.apache.hyracks.algebricks.common.exceptions.AlgebricksException;
-import org.apache.hyracks.algebricks.runtime.base.ICopyEvaluator;
-import org.apache.hyracks.algebricks.runtime.base.ICopyEvaluatorFactory;
+import org.apache.hyracks.algebricks.runtime.base.IScalarEvaluator;
+import org.apache.hyracks.algebricks.runtime.base.IScalarEvaluatorFactory;
+import org.apache.hyracks.api.context.IHyracksTaskContext;
 import org.apache.hyracks.api.exceptions.HyracksDataException;
-import org.apache.hyracks.data.std.api.IDataOutputProvider;
+import org.apache.hyracks.data.std.api.IPointable;
+import org.apache.hyracks.data.std.primitive.VoidPointable;
 import org.apache.hyracks.data.std.util.ArrayBackedValueStorage;
 import org.apache.hyracks.dataflow.common.data.accessors.IFrameTupleReference;
 
-public class ClosedRecordConstructorEvalFactory implements ICopyEvaluatorFactory {
+public class ClosedRecordConstructorEvalFactory implements IScalarEvaluatorFactory {
 
     private static final long serialVersionUID = 1L;
 
-    private ICopyEvaluatorFactory[] args;
+    private IScalarEvaluatorFactory[] args;
     private ARecordType recType;
 
-    public ClosedRecordConstructorEvalFactory(ICopyEvaluatorFactory[] args, ARecordType recType) {
+    public ClosedRecordConstructorEvalFactory(IScalarEvaluatorFactory[] args, ARecordType recType) {
         this.args = args;
         this.recType = recType;
     }
 
     @Override
-    public ICopyEvaluator createEvaluator(final IDataOutputProvider output) throws AlgebricksException {
+    public IScalarEvaluator createScalarEvaluator(IHyracksTaskContext ctx) throws AlgebricksException {
         int n = args.length / 2;
-        ICopyEvaluator[] evalFields = new ICopyEvaluator[n];
-        ArrayBackedValueStorage fieldValueBuffer = new ArrayBackedValueStorage();
+        IScalarEvaluator[] evalFields = new IScalarEvaluator[n];
         for (int i = 0; i < n; i++) {
-            evalFields[i] = args[2 * i + 1].createEvaluator(fieldValueBuffer);
+            evalFields[i] = args[2 * i + 1].createScalarEvaluator(ctx);
         }
-        DataOutput out = output.getDataOutput();
-        return new ClosedRecordConstructorEval(recType, evalFields, fieldValueBuffer, out);
+        return new ClosedRecordConstructorEval(recType, evalFields);
     }
 
-    public static class ClosedRecordConstructorEval implements ICopyEvaluator {
-
-        private ICopyEvaluator[] evalFields;
-        private DataOutput out;
-        private IARecordBuilder recBuilder = new RecordBuilder();
-        private ARecordType recType;
-        private ArrayBackedValueStorage fieldValueBuffer = new ArrayBackedValueStorage();
+    public static class ClosedRecordConstructorEval implements IScalarEvaluator {
+        private IScalarEvaluator[] evalFields;
+        private final ArrayBackedValueStorage resultStorage = new ArrayBackedValueStorage();
+        private final DataOutput out = resultStorage.getDataOutput();
+        private final IARecordBuilder recBuilder = new RecordBuilder();
+        private final ARecordType recType;
+        private final IPointable fieldValuePointable = new VoidPointable();
         private boolean first = true;
 
-        public ClosedRecordConstructorEval(ARecordType recType, ICopyEvaluator[] evalFields,
-                ArrayBackedValueStorage fieldValueBuffer, DataOutput out) {
+        public ClosedRecordConstructorEval(ARecordType recType, IScalarEvaluator[] evalFields) {
             this.evalFields = evalFields;
-            this.fieldValueBuffer = fieldValueBuffer;
-            this.out = out;
             this.recType = recType;
         }
 
         @Override
-        public void evaluate(IFrameTupleReference tuple) throws AlgebricksException {
+        public void evaluate(IFrameTupleReference tuple, IPointable result) throws AlgebricksException {
             try {
+                resultStorage.reset();
                 if (first) {
                     first = false;
                     recBuilder.reset(this.recType);
                 }
                 recBuilder.init();
                 for (int i = 0; i < evalFields.length; i++) {
-                    fieldValueBuffer.reset();
-                    evalFields[i].evaluate(tuple);
-                    if (fieldValueBuffer.getByteArray()[0] != ATypeTag.SERIALIZED_NULL_TYPE_TAG) {
-                        recBuilder.addField(i, fieldValueBuffer);
+                    evalFields[i].evaluate(tuple, fieldValuePointable);
+                    if (fieldValuePointable.getByteArray()[fieldValuePointable
+                            .getStartOffset()] != ATypeTag.SERIALIZED_NULL_TYPE_TAG) {
+                        recBuilder.addField(i, fieldValuePointable);
                     }
                 }
                 recBuilder.write(out, true);
+                result.set(resultStorage);
             } catch (HyracksDataException e) {
                 throw new AlgebricksException(e);
             }
diff --git a/asterix-runtime/src/main/java/org/apache/asterix/runtime/evaluators/common/CreateMBREvalFactory.java b/asterix-runtime/src/main/java/org/apache/asterix/runtime/evaluators/common/CreateMBREvalFactory.java
index d4563a8..c92daa2 100644
--- a/asterix-runtime/src/main/java/org/apache/asterix/runtime/evaluators/common/CreateMBREvalFactory.java
+++ b/asterix-runtime/src/main/java/org/apache/asterix/runtime/evaluators/common/CreateMBREvalFactory.java
@@ -34,82 +34,85 @@
 import org.apache.asterix.om.types.EnumDeserializer;
 import org.apache.hyracks.algebricks.common.exceptions.AlgebricksException;
 import org.apache.hyracks.algebricks.common.exceptions.NotImplementedException;
-import org.apache.hyracks.algebricks.runtime.base.ICopyEvaluator;
-import org.apache.hyracks.algebricks.runtime.base.ICopyEvaluatorFactory;
+import org.apache.hyracks.algebricks.runtime.base.IScalarEvaluator;
+import org.apache.hyracks.algebricks.runtime.base.IScalarEvaluatorFactory;
+import org.apache.hyracks.api.context.IHyracksTaskContext;
 import org.apache.hyracks.api.exceptions.HyracksDataException;
-import org.apache.hyracks.data.std.api.IDataOutputProvider;
+import org.apache.hyracks.data.std.api.IPointable;
+import org.apache.hyracks.data.std.primitive.VoidPointable;
 import org.apache.hyracks.data.std.util.ArrayBackedValueStorage;
 import org.apache.hyracks.dataflow.common.data.accessors.IFrameTupleReference;
 
-public class CreateMBREvalFactory implements ICopyEvaluatorFactory {
+public class CreateMBREvalFactory implements IScalarEvaluatorFactory {
 
     private static final long serialVersionUID = 1L;
 
-    private ICopyEvaluatorFactory recordEvalFactory;
-    private ICopyEvaluatorFactory dimensionEvalFactory;
-    private ICopyEvaluatorFactory coordinateEvalFactory;
+    private IScalarEvaluatorFactory recordEvalFactory;
+    private IScalarEvaluatorFactory dimensionEvalFactory;
+    private IScalarEvaluatorFactory coordinateEvalFactory;
 
-    public CreateMBREvalFactory(ICopyEvaluatorFactory recordEvalFactory, ICopyEvaluatorFactory dimensionEvalFactory,
-            ICopyEvaluatorFactory coordinateEvalFactory) {
+    public CreateMBREvalFactory(IScalarEvaluatorFactory recordEvalFactory, IScalarEvaluatorFactory dimensionEvalFactory,
+            IScalarEvaluatorFactory coordinateEvalFactory) {
         this.recordEvalFactory = recordEvalFactory;
         this.dimensionEvalFactory = dimensionEvalFactory;
         this.coordinateEvalFactory = coordinateEvalFactory;
     }
 
     @Override
-    public ICopyEvaluator createEvaluator(final IDataOutputProvider output) throws AlgebricksException {
-        return new ICopyEvaluator() {
+    public IScalarEvaluator createScalarEvaluator(IHyracksTaskContext ctx) throws AlgebricksException {
+        return new IScalarEvaluator() {
+            private final ArrayBackedValueStorage resultStorage = new ArrayBackedValueStorage();
+            private final DataOutput out = resultStorage.getDataOutput();
+            private final IPointable inputArg0 = new VoidPointable();
+            private final IPointable inputArg1 = new VoidPointable();
+            private final IPointable inputArg2 = new VoidPointable();
 
-            private DataOutput out = output.getDataOutput();
-
-            private ArrayBackedValueStorage outInput0 = new ArrayBackedValueStorage();
-            private ArrayBackedValueStorage outInput1 = new ArrayBackedValueStorage();
-            private ArrayBackedValueStorage outInput2 = new ArrayBackedValueStorage();
-
-            private ICopyEvaluator eval0 = recordEvalFactory.createEvaluator(outInput0);
-            private ICopyEvaluator eval1 = dimensionEvalFactory.createEvaluator(outInput1);
-            private ICopyEvaluator eval2 = coordinateEvalFactory.createEvaluator(outInput2);
+            private IScalarEvaluator eval0 = recordEvalFactory.createScalarEvaluator(ctx);
+            private IScalarEvaluator eval1 = dimensionEvalFactory.createScalarEvaluator(ctx);
+            private IScalarEvaluator eval2 = coordinateEvalFactory.createScalarEvaluator(ctx);
 
             @Override
-            public void evaluate(IFrameTupleReference tuple) throws AlgebricksException {
-                outInput0.reset();
-                eval0.evaluate(tuple);
-                outInput1.reset();
-                eval1.evaluate(tuple);
-                outInput2.reset();
-                eval2.evaluate(tuple);
+            public void evaluate(IFrameTupleReference tuple, IPointable result) throws AlgebricksException {
+                eval0.evaluate(tuple, inputArg0);
+                eval1.evaluate(tuple, inputArg1);
+                eval2.evaluate(tuple, inputArg2);
+                int startOffset0 = inputArg0.getStartOffset();
+                int startOffset1 = inputArg1.getStartOffset();
+                int startOffset2 = inputArg2.getStartOffset();
 
+                resultStorage.reset();
                 // type-check: (Point/Line/Polygon/Circle/Rectangle/Null, Int32, Int32)
-                if (outInput1.getByteArray()[0] != ATypeTag.SERIALIZED_INT32_TYPE_TAG
-                        || outInput2.getByteArray()[0] != ATypeTag.SERIALIZED_INT32_TYPE_TAG) {
+                if (inputArg1.getByteArray()[startOffset1] != ATypeTag.SERIALIZED_INT32_TYPE_TAG
+                        || inputArg2.getByteArray()[startOffset2] != ATypeTag.SERIALIZED_INT32_TYPE_TAG) {
                     throw new AlgebricksException(
                             "Expects Types: (Point/Line/Polygon/Circle/Rectangle/Null, Int32, Int32).");
                 }
 
                 try {
-
-                    int dimension = AInt32SerializerDeserializer.getInt(outInput1.getByteArray(), 1);
-                    int coordinate = AInt32SerializerDeserializer.getInt(outInput2.getByteArray(), 1);
+                    int dimension = AInt32SerializerDeserializer.getInt(inputArg1.getByteArray(), startOffset1 + 1);
+                    int coordinate = AInt32SerializerDeserializer.getInt(inputArg2.getByteArray(), startOffset2 + 1);
                     double value;
                     if (dimension == 2) {
-                        ATypeTag tag = EnumDeserializer.ATYPETAGDESERIALIZER.deserialize(outInput0.getByteArray()[0]);
+                        ATypeTag tag = EnumDeserializer.ATYPETAGDESERIALIZER
+                                .deserialize(inputArg0.getByteArray()[startOffset0]);
                         switch (tag) {
                             case POINT:
                                 switch (coordinate) {
                                     case 0: // 0 is for min x, 1 is for min y, 2
-                                           // for
-                                           // max x, and 3 for max y
+                                            // for
+                                            // max x, and 3 for max y
                                     case 2: {
-                                        double x = ADoubleSerializerDeserializer.getDouble(outInput0.getByteArray(),
-                                                APointSerializerDeserializer.getCoordinateOffset(Coordinate.X));
-
+                                        double x = ADoubleSerializerDeserializer.getDouble(inputArg0.getByteArray(),
+                                                startOffset0 + APointSerializerDeserializer
+                                                        .getCoordinateOffset(Coordinate.X));
                                         value = x;
                                     }
                                         break;
                                     case 1:
                                     case 3: {
-                                        double y = ADoubleSerializerDeserializer.getDouble(outInput0.getByteArray(),
-                                                APointSerializerDeserializer.getCoordinateOffset(Coordinate.Y));
+                                        double y = ADoubleSerializerDeserializer.getDouble(inputArg0.getByteArray(),
+                                                startOffset0 + APointSerializerDeserializer
+                                                        .getCoordinateOffset(Coordinate.Y));
 
                                         value = y;
                                     }
@@ -125,44 +128,48 @@
                                 switch (coordinate) {
                                     case 0: {
                                         value = Double.MAX_VALUE;
-                                        double startX = ADoubleSerializerDeserializer
-                                                .getDouble(outInput0.getByteArray(), ALineSerializerDeserializer
+                                        double startX = ADoubleSerializerDeserializer.getDouble(
+                                                inputArg0.getByteArray(), startOffset0 + ALineSerializerDeserializer
                                                         .getStartPointCoordinateOffset(Coordinate.X));
-                                        double endX = ADoubleSerializerDeserializer.getDouble(outInput0.getByteArray(),
-                                                ALineSerializerDeserializer.getEndPointCoordinateOffset(Coordinate.X));
+                                        double endX = ADoubleSerializerDeserializer.getDouble(inputArg0.getByteArray(),
+                                                startOffset0 + ALineSerializerDeserializer
+                                                        .getEndPointCoordinateOffset(Coordinate.X));
 
                                         value = Math.min(Math.min(startX, endX), value);
                                     }
                                         break;
                                     case 1: {
                                         value = Double.MAX_VALUE;
-                                        double startY = ADoubleSerializerDeserializer
-                                                .getDouble(outInput0.getByteArray(), ALineSerializerDeserializer
+                                        double startY = ADoubleSerializerDeserializer.getDouble(
+                                                inputArg0.getByteArray(), startOffset0 + ALineSerializerDeserializer
                                                         .getStartPointCoordinateOffset(Coordinate.Y));
-                                        double endY = ADoubleSerializerDeserializer.getDouble(outInput0.getByteArray(),
-                                                ALineSerializerDeserializer.getEndPointCoordinateOffset(Coordinate.Y));
+                                        double endY = ADoubleSerializerDeserializer.getDouble(inputArg0.getByteArray(),
+                                                startOffset0 + ALineSerializerDeserializer
+                                                        .getEndPointCoordinateOffset(Coordinate.Y));
 
                                         value = Math.min(Math.min(startY, endY), value);
                                     }
                                         break;
                                     case 2: {
                                         value = Double.MIN_VALUE;
-                                        double startX = ADoubleSerializerDeserializer
-                                                .getDouble(outInput0.getByteArray(), ALineSerializerDeserializer
+                                        double startX = ADoubleSerializerDeserializer.getDouble(
+                                                inputArg0.getByteArray(), startOffset0 + ALineSerializerDeserializer
                                                         .getStartPointCoordinateOffset(Coordinate.X));
-                                        double endX = ADoubleSerializerDeserializer.getDouble(outInput0.getByteArray(),
-                                                ALineSerializerDeserializer.getEndPointCoordinateOffset(Coordinate.X));
+                                        double endX = ADoubleSerializerDeserializer.getDouble(inputArg0.getByteArray(),
+                                                startOffset0 + ALineSerializerDeserializer
+                                                        .getEndPointCoordinateOffset(Coordinate.X));
 
                                         value = Math.max(Math.min(startX, endX), value);
                                     }
                                         break;
                                     case 3: {
                                         value = Double.MIN_VALUE;
-                                        double startY = ADoubleSerializerDeserializer
-                                                .getDouble(outInput0.getByteArray(), ALineSerializerDeserializer
+                                        double startY = ADoubleSerializerDeserializer.getDouble(
+                                                inputArg0.getByteArray(), startOffset0 + ALineSerializerDeserializer
                                                         .getStartPointCoordinateOffset(Coordinate.Y));
-                                        double endY = ADoubleSerializerDeserializer.getDouble(outInput0.getByteArray(),
-                                                ALineSerializerDeserializer.getEndPointCoordinateOffset(Coordinate.Y));
+                                        double endY = ADoubleSerializerDeserializer.getDouble(inputArg0.getByteArray(),
+                                                startOffset0 + ALineSerializerDeserializer
+                                                        .getEndPointCoordinateOffset(Coordinate.Y));
 
                                         value = Math.max(Math.min(startY, endY), value);
                                     }
@@ -174,14 +181,14 @@
                                 }
                                 break;
                             case POLYGON:
-                                int numOfPoints = AInt16SerializerDeserializer.getShort(outInput0.getByteArray(),
-                                        APolygonSerializerDeserializer.getNumberOfPointsOffset());
+                                int numOfPoints = AInt16SerializerDeserializer.getShort(inputArg0.getByteArray(),
+                                        startOffset0 + APolygonSerializerDeserializer.getNumberOfPointsOffset());
                                 switch (coordinate) {
                                     case 0: {
                                         value = Double.MAX_VALUE;
                                         for (int i = 0; i < numOfPoints; i++) {
-                                            double x = ADoubleSerializerDeserializer.getDouble(outInput0.getByteArray(),
-                                                    APolygonSerializerDeserializer.getCoordinateOffset(i,
+                                            double x = ADoubleSerializerDeserializer.getDouble(inputArg0.getByteArray(),
+                                                    startOffset0 + APolygonSerializerDeserializer.getCoordinateOffset(i,
                                                             Coordinate.X));
                                             value = Math.min(x, value);
                                         }
@@ -190,8 +197,8 @@
                                     case 1: {
                                         value = Double.MAX_VALUE;
                                         for (int i = 0; i < numOfPoints; i++) {
-                                            double y = ADoubleSerializerDeserializer.getDouble(outInput0.getByteArray(),
-                                                    APolygonSerializerDeserializer.getCoordinateOffset(i,
+                                            double y = ADoubleSerializerDeserializer.getDouble(inputArg0.getByteArray(),
+                                                    startOffset0 + APolygonSerializerDeserializer.getCoordinateOffset(i,
                                                             Coordinate.Y));
                                             value = Math.min(y, value);
                                         }
@@ -200,8 +207,8 @@
                                     case 2: {
                                         value = Double.MIN_VALUE;
                                         for (int i = 0; i < numOfPoints; i++) {
-                                            double x = ADoubleSerializerDeserializer.getDouble(outInput0.getByteArray(),
-                                                    APolygonSerializerDeserializer.getCoordinateOffset(i,
+                                            double x = ADoubleSerializerDeserializer.getDouble(inputArg0.getByteArray(),
+                                                    startOffset0 + APolygonSerializerDeserializer.getCoordinateOffset(i,
                                                             Coordinate.X));
                                             value = Math.max(x, value);
                                         }
@@ -210,8 +217,8 @@
                                     case 3: {
                                         value = Double.MIN_VALUE;
                                         for (int i = 0; i < numOfPoints; i++) {
-                                            double y = ADoubleSerializerDeserializer.getDouble(outInput0.getByteArray(),
-                                                    APolygonSerializerDeserializer.getCoordinateOffset(i,
+                                            double y = ADoubleSerializerDeserializer.getDouble(inputArg0.getByteArray(),
+                                                    startOffset0 + APolygonSerializerDeserializer.getCoordinateOffset(i,
                                                             Coordinate.Y));
                                             value = Math.max(y, value);
                                         }
@@ -226,45 +233,44 @@
                             case CIRCLE:
                                 switch (coordinate) {
                                     case 0: {
-                                        double x = ADoubleSerializerDeserializer.getDouble(outInput0.getByteArray(),
-                                                ACircleSerializerDeserializer
+                                        double x = ADoubleSerializerDeserializer.getDouble(inputArg0.getByteArray(),
+                                                startOffset0 + ACircleSerializerDeserializer
                                                         .getCenterPointCoordinateOffset(Coordinate.X));
                                         double radius = ADoubleSerializerDeserializer.getDouble(
-                                                outInput0.getByteArray(),
-                                                ACircleSerializerDeserializer.getRadiusOffset());
-
+                                                inputArg0.getByteArray(),
+                                                startOffset0 + ACircleSerializerDeserializer.getRadiusOffset());
                                         value = x - radius;
                                     }
                                         break;
                                     case 1: {
-                                        double y = ADoubleSerializerDeserializer.getDouble(outInput0.getByteArray(),
-                                                ACircleSerializerDeserializer
+                                        double y = ADoubleSerializerDeserializer.getDouble(inputArg0.getByteArray(),
+                                                startOffset0 + ACircleSerializerDeserializer
                                                         .getCenterPointCoordinateOffset(Coordinate.Y));
                                         double radius = ADoubleSerializerDeserializer.getDouble(
-                                                outInput0.getByteArray(),
-                                                ACircleSerializerDeserializer.getRadiusOffset());
+                                                inputArg0.getByteArray(),
+                                                startOffset0 + ACircleSerializerDeserializer.getRadiusOffset());
 
                                         value = y - radius;
                                     }
                                         break;
                                     case 2: {
-                                        double x = ADoubleSerializerDeserializer.getDouble(outInput0.getByteArray(),
-                                                ACircleSerializerDeserializer
+                                        double x = ADoubleSerializerDeserializer.getDouble(inputArg0.getByteArray(),
+                                                startOffset0 + ACircleSerializerDeserializer
                                                         .getCenterPointCoordinateOffset(Coordinate.X));
                                         double radius = ADoubleSerializerDeserializer.getDouble(
-                                                outInput0.getByteArray(),
-                                                ACircleSerializerDeserializer.getRadiusOffset());
+                                                inputArg0.getByteArray(),
+                                                startOffset0 + ACircleSerializerDeserializer.getRadiusOffset());
 
                                         value = x + radius;
                                     }
                                         break;
                                     case 3: {
-                                        double y = ADoubleSerializerDeserializer.getDouble(outInput0.getByteArray(),
-                                                ACircleSerializerDeserializer
+                                        double y = ADoubleSerializerDeserializer.getDouble(inputArg0.getByteArray(),
+                                                startOffset0 + ACircleSerializerDeserializer
                                                         .getCenterPointCoordinateOffset(Coordinate.Y));
                                         double radius = ADoubleSerializerDeserializer.getDouble(
-                                                outInput0.getByteArray(),
-                                                ACircleSerializerDeserializer.getRadiusOffset());
+                                                inputArg0.getByteArray(),
+                                                startOffset0 + ACircleSerializerDeserializer.getRadiusOffset());
 
                                         value = y + radius;
                                     }
@@ -279,26 +285,26 @@
                                 value = Double.MAX_VALUE;
                                 switch (coordinate) {
                                     case 0: {
-                                        value = ADoubleSerializerDeserializer.getDouble(outInput0.getByteArray(),
-                                                ARectangleSerializerDeserializer
+                                        value = ADoubleSerializerDeserializer.getDouble(inputArg0.getByteArray(),
+                                                startOffset0 + ARectangleSerializerDeserializer
                                                         .getBottomLeftCoordinateOffset(Coordinate.X));
                                     }
                                         break;
                                     case 1: {
-                                        value = ADoubleSerializerDeserializer.getDouble(outInput0.getByteArray(),
-                                                ARectangleSerializerDeserializer
+                                        value = ADoubleSerializerDeserializer.getDouble(inputArg0.getByteArray(),
+                                                startOffset0 + ARectangleSerializerDeserializer
                                                         .getBottomLeftCoordinateOffset(Coordinate.Y));
                                     }
                                         break;
                                     case 2: {
-                                        value = ADoubleSerializerDeserializer.getDouble(outInput0.getByteArray(),
-                                                ARectangleSerializerDeserializer
+                                        value = ADoubleSerializerDeserializer.getDouble(inputArg0.getByteArray(),
+                                                startOffset0 + ARectangleSerializerDeserializer
                                                         .getUpperRightCoordinateOffset(Coordinate.X));
                                     }
                                         break;
                                     case 3: {
-                                        value = ADoubleSerializerDeserializer.getDouble(outInput0.getByteArray(),
-                                                ARectangleSerializerDeserializer
+                                        value = ADoubleSerializerDeserializer.getDouble(inputArg0.getByteArray(),
+                                                startOffset0 + ARectangleSerializerDeserializer
                                                         .getUpperRightCoordinateOffset(Coordinate.Y));
                                     }
                                         break;
@@ -310,6 +316,7 @@
                                 break;
                             case NULL: {
                                 out.writeByte(ATypeTag.SERIALIZED_NULL_TYPE_TAG);
+                                result.set(resultStorage);
                                 return;
                             }
                             default:
@@ -328,6 +335,7 @@
                 } catch (IOException e) {
                     throw new AlgebricksException(e);
                 }
+                result.set(resultStorage);
             }
         };
     }
diff --git a/asterix-runtime/src/main/java/org/apache/asterix/runtime/evaluators/common/EditDistanceCheckEvaluator.java b/asterix-runtime/src/main/java/org/apache/asterix/runtime/evaluators/common/EditDistanceCheckEvaluator.java
index b002195..915ff53 100644
--- a/asterix-runtime/src/main/java/org/apache/asterix/runtime/evaluators/common/EditDistanceCheckEvaluator.java
+++ b/asterix-runtime/src/main/java/org/apache/asterix/runtime/evaluators/common/EditDistanceCheckEvaluator.java
@@ -29,29 +29,31 @@
 import org.apache.asterix.om.types.BuiltinType;
 import org.apache.asterix.om.types.hierachy.ATypeHierarchy;
 import org.apache.hyracks.algebricks.common.exceptions.AlgebricksException;
-import org.apache.hyracks.algebricks.runtime.base.ICopyEvaluator;
-import org.apache.hyracks.algebricks.runtime.base.ICopyEvaluatorFactory;
+import org.apache.hyracks.algebricks.runtime.base.IScalarEvaluator;
+import org.apache.hyracks.algebricks.runtime.base.IScalarEvaluatorFactory;
+import org.apache.hyracks.api.context.IHyracksTaskContext;
 import org.apache.hyracks.api.dataflow.value.ISerializerDeserializer;
 import org.apache.hyracks.api.exceptions.HyracksDataException;
-import org.apache.hyracks.data.std.api.IDataOutputProvider;
+import org.apache.hyracks.data.std.api.IPointable;
+import org.apache.hyracks.data.std.primitive.VoidPointable;
 import org.apache.hyracks.data.std.util.ArrayBackedValueStorage;
 import org.apache.hyracks.dataflow.common.data.accessors.IFrameTupleReference;
 
 public class EditDistanceCheckEvaluator extends EditDistanceEvaluator {
 
-    protected final ICopyEvaluator edThreshEval;
-    protected long edThresh = -1;
+    protected final IScalarEvaluator edThreshEval;
+    protected int edThresh;
+    private final IPointable argPtrThreshold = new VoidPointable();
     protected final OrderedListBuilder listBuilder;
     protected ArrayBackedValueStorage listItemVal;
     @SuppressWarnings("unchecked")
     protected final ISerializerDeserializer<ABoolean> booleanSerde = AqlSerializerDeserializerProvider.INSTANCE
             .getSerializerDeserializer(BuiltinType.ABOOLEAN);
-    protected final static byte SER_INT32_TYPE_TAG = ATypeTag.INT32.serialize();
 
-    public EditDistanceCheckEvaluator(ICopyEvaluatorFactory[] args, IDataOutputProvider output)
+    public EditDistanceCheckEvaluator(IScalarEvaluatorFactory[] args, IHyracksTaskContext context)
             throws AlgebricksException {
-        super(args, output);
-        edThreshEval = args[2].createEvaluator(argOut);
+        super(args, context);
+        edThreshEval = args[2].createScalarEvaluator(context);
         listBuilder = new OrderedListBuilder();
         listItemVal = new ArrayBackedValueStorage();
     }
@@ -59,28 +61,30 @@
     @Override
     protected void runArgEvals(IFrameTupleReference tuple) throws AlgebricksException {
         super.runArgEvals(tuple);
-        int edThreshStart = argOut.getLength();
-        edThreshEval.evaluate(tuple);
+        edThreshEval.evaluate(tuple, argPtrThreshold);
         try {
-            edThresh = ATypeHierarchy.getIntegerValue(argOut.getByteArray(), edThreshStart);
+            edThresh = ATypeHierarchy.getIntegerValue(argPtrThreshold.getByteArray(), argPtrThreshold.getStartOffset());
         } catch (HyracksDataException e) {
             throw new AlgebricksException(e);
         }
     }
 
     @Override
-    protected int computeResult(byte[] bytes, int firstStart, int secondStart, ATypeTag argType)
+    protected int computeResult(IPointable left, IPointable right, ATypeTag argType)
             throws AlgebricksException, HyracksDataException {
+        byte[] leftBytes = left.getByteArray();
+        int leftStartOffset = left.getStartOffset();
+        byte[] rightBytes = right.getByteArray();
+        int rightStartOffset = right.getStartOffset();
         switch (argType) {
-
             case STRING: {
-                return ed.UTF8StringEditDistance(bytes, firstStart + typeIndicatorSize,
-                        secondStart + typeIndicatorSize, (int) edThresh);
+                return ed.UTF8StringEditDistance(leftBytes, leftStartOffset + typeIndicatorSize, rightBytes,
+                        rightStartOffset + typeIndicatorSize, edThresh);
             }
 
             case ORDEREDLIST: {
-                firstOrdListIter.reset(bytes, firstStart);
-                secondOrdListIter.reset(bytes, secondStart);
+                firstOrdListIter.reset(leftBytes, leftStartOffset);
+                secondOrdListIter.reset(rightBytes, rightStartOffset);
                 return (int) ed.getSimilarity(firstOrdListIter, secondOrdListIter, edThresh);
             }
 
@@ -94,7 +98,6 @@
 
     @Override
     protected void writeResult(int ed) throws IOException {
-
         listBuilder.reset(new AOrderedListType(BuiltinType.ANY, "list"));
         boolean matches = (ed < 0) ? false : true;
         listItemVal.reset();
@@ -105,7 +108,6 @@
         aInt64.setValue((matches) ? ed : Integer.MAX_VALUE);
         int64Serde.serialize(aInt64, listItemVal.getDataOutput());
         listBuilder.addItem(listItemVal);
-
         listBuilder.write(out, true);
     }
 }
diff --git a/asterix-runtime/src/main/java/org/apache/asterix/runtime/evaluators/common/EditDistanceContainsEvaluator.java b/asterix-runtime/src/main/java/org/apache/asterix/runtime/evaluators/common/EditDistanceContainsEvaluator.java
index 25ac28f..4ad06d8 100644
--- a/asterix-runtime/src/main/java/org/apache/asterix/runtime/evaluators/common/EditDistanceContainsEvaluator.java
+++ b/asterix-runtime/src/main/java/org/apache/asterix/runtime/evaluators/common/EditDistanceContainsEvaluator.java
@@ -21,42 +21,43 @@
 import org.apache.asterix.om.functions.AsterixBuiltinFunctions;
 import org.apache.asterix.om.types.ATypeTag;
 import org.apache.hyracks.algebricks.common.exceptions.AlgebricksException;
-import org.apache.hyracks.algebricks.runtime.base.ICopyEvaluatorFactory;
+import org.apache.hyracks.algebricks.runtime.base.IScalarEvaluatorFactory;
+import org.apache.hyracks.api.context.IHyracksTaskContext;
 import org.apache.hyracks.api.exceptions.HyracksDataException;
-import org.apache.hyracks.data.std.api.IDataOutputProvider;
+import org.apache.hyracks.data.std.api.IPointable;
 
 public class EditDistanceContainsEvaluator extends EditDistanceCheckEvaluator {
 
-    public EditDistanceContainsEvaluator(ICopyEvaluatorFactory[] args, IDataOutputProvider output)
+    public EditDistanceContainsEvaluator(IScalarEvaluatorFactory[] args, IHyracksTaskContext context)
             throws AlgebricksException {
-        super(args, output);
+        super(args, context);
     }
 
     @Override
-    protected int computeResult(byte[] bytes, int firstStart, int secondStart, ATypeTag argType)
-            throws AlgebricksException {
+    protected int computeResult(IPointable left, IPointable right, ATypeTag argType) throws AlgebricksException {
+        byte[] leftBytes = left.getByteArray();
+        int leftStartOffset = left.getStartOffset();
+        byte[] rightBytes = right.getByteArray();
+        int rightStartOffset = right.getStartOffset();
+
         switch (argType) {
-
             case STRING: {
-                return ed.UTF8StringEditDistanceContains(argOut.getByteArray(), firstStart + typeIndicatorSize,
-                        secondStart + typeIndicatorSize, (int) edThresh);
+                return ed.UTF8StringEditDistanceContains(leftBytes, leftStartOffset + typeIndicatorSize, rightBytes,
+                        rightStartOffset + typeIndicatorSize, edThresh);
             }
-
             case ORDEREDLIST: {
-                firstOrdListIter.reset(bytes, firstStart);
-                secondOrdListIter.reset(bytes, secondStart);
+                firstOrdListIter.reset(leftBytes, leftStartOffset);
+                secondOrdListIter.reset(rightBytes, rightStartOffset);
                 try {
-                    return ed.getSimilarityContains(firstOrdListIter, secondOrdListIter, (int) edThresh);
+                    return ed.getSimilarityContains(firstOrdListIter, secondOrdListIter, edThresh);
                 } catch (HyracksDataException e) {
                     throw new AlgebricksException(e);
                 }
             }
-
             default: {
                 throw new AlgebricksException(AsterixBuiltinFunctions.EDIT_DISTANCE_CONTAINS.getName()
                         + ": expects input type as STRING or ORDEREDLIST but got " + argType + ".");
             }
-
         }
     }
 }
diff --git a/asterix-runtime/src/main/java/org/apache/asterix/runtime/evaluators/common/EditDistanceEvaluator.java b/asterix-runtime/src/main/java/org/apache/asterix/runtime/evaluators/common/EditDistanceEvaluator.java
index 2f588c7..f6345d6 100644
--- a/asterix-runtime/src/main/java/org/apache/asterix/runtime/evaluators/common/EditDistanceEvaluator.java
+++ b/asterix-runtime/src/main/java/org/apache/asterix/runtime/evaluators/common/EditDistanceEvaluator.java
@@ -30,23 +30,27 @@
 import org.apache.asterix.om.types.BuiltinType;
 import org.apache.asterix.om.types.EnumDeserializer;
 import org.apache.hyracks.algebricks.common.exceptions.AlgebricksException;
-import org.apache.hyracks.algebricks.runtime.base.ICopyEvaluator;
-import org.apache.hyracks.algebricks.runtime.base.ICopyEvaluatorFactory;
+import org.apache.hyracks.algebricks.runtime.base.IScalarEvaluator;
+import org.apache.hyracks.algebricks.runtime.base.IScalarEvaluatorFactory;
+import org.apache.hyracks.api.context.IHyracksTaskContext;
 import org.apache.hyracks.api.dataflow.value.ISerializerDeserializer;
 import org.apache.hyracks.api.exceptions.HyracksDataException;
-import org.apache.hyracks.data.std.api.IDataOutputProvider;
+import org.apache.hyracks.data.std.api.IPointable;
+import org.apache.hyracks.data.std.primitive.VoidPointable;
 import org.apache.hyracks.data.std.util.ArrayBackedValueStorage;
 import org.apache.hyracks.dataflow.common.data.accessors.IFrameTupleReference;
 
-public class EditDistanceEvaluator implements ICopyEvaluator {
+public class EditDistanceEvaluator implements IScalarEvaluator {
 
     // assuming type indicator in serde format
     protected final int typeIndicatorSize = 1;
 
-    protected final DataOutput out;
-    protected final ArrayBackedValueStorage argOut = new ArrayBackedValueStorage();
-    protected final ICopyEvaluator firstStringEval;
-    protected final ICopyEvaluator secondStringEval;
+    protected final ArrayBackedValueStorage resultStorage = new ArrayBackedValueStorage();
+    protected final DataOutput out = resultStorage.getDataOutput();
+    protected final IPointable argPtr1 = new VoidPointable();
+    protected final IPointable argPtr2 = new VoidPointable();
+    protected final IScalarEvaluator firstStringEval;
+    protected final IScalarEvaluator secondStringEval;
     protected final SimilarityMetricEditDistance ed = new SimilarityMetricEditDistance();
     protected final AsterixOrderedListIterator firstOrdListIter = new AsterixOrderedListIterator();
     protected final AsterixOrderedListIterator secondOrdListIter = new AsterixOrderedListIterator();
@@ -60,27 +64,26 @@
             .getSerializerDeserializer(BuiltinType.ANULL);
     protected ATypeTag itemTypeTag;
 
-    protected int firstStart = -1;
-    protected int secondStart = -1;
     protected ATypeTag firstTypeTag;
     protected ATypeTag secondTypeTag;
 
-    public EditDistanceEvaluator(ICopyEvaluatorFactory[] args, IDataOutputProvider output) throws AlgebricksException {
-        out = output.getDataOutput();
-        firstStringEval = args[0].createEvaluator(argOut);
-        secondStringEval = args[1].createEvaluator(argOut);
+    public EditDistanceEvaluator(IScalarEvaluatorFactory[] args, IHyracksTaskContext context)
+            throws AlgebricksException {
+        firstStringEval = args[0].createScalarEvaluator(context);
+        secondStringEval = args[1].createScalarEvaluator(context);
     }
 
     @Override
-    public void evaluate(IFrameTupleReference tuple) throws AlgebricksException {
-
+    public void evaluate(IFrameTupleReference tuple, IPointable result) throws AlgebricksException {
+        resultStorage.reset();
         runArgEvals(tuple);
-
-        if (!checkArgTypes(firstTypeTag, secondTypeTag))
+        if (!checkArgTypes(firstTypeTag, secondTypeTag)) {
+            result.set(resultStorage);
             return;
+        }
 
         try {
-            editDistance = computeResult(argOut.getByteArray(), firstStart, secondStart, firstTypeTag);
+            editDistance = computeResult(argPtr1, argPtr2, firstTypeTag);
         } catch (HyracksDataException e1) {
             throw new AlgebricksException(e1);
         }
@@ -90,32 +93,33 @@
         } catch (IOException e) {
             throw new AlgebricksException(e);
         }
+        result.set(resultStorage);
     }
 
     protected void runArgEvals(IFrameTupleReference tuple) throws AlgebricksException {
-        argOut.reset();
-
-        firstStart = argOut.getLength();
-        firstStringEval.evaluate(tuple);
-        secondStart = argOut.getLength();
-        secondStringEval.evaluate(tuple);
-
-        firstTypeTag = EnumDeserializer.ATYPETAGDESERIALIZER.deserialize(argOut.getByteArray()[firstStart]);
-        secondTypeTag = EnumDeserializer.ATYPETAGDESERIALIZER.deserialize(argOut.getByteArray()[secondStart]);
+        firstStringEval.evaluate(tuple, argPtr1);
+        firstTypeTag = EnumDeserializer.ATYPETAGDESERIALIZER
+                .deserialize(argPtr1.getByteArray()[argPtr1.getStartOffset()]);
+        secondStringEval.evaluate(tuple, argPtr2);
+        secondTypeTag = EnumDeserializer.ATYPETAGDESERIALIZER
+                .deserialize(argPtr2.getByteArray()[argPtr2.getStartOffset()]);
     }
 
-    protected int computeResult(byte[] bytes, int firstStart, int secondStart, ATypeTag argType)
+    protected int computeResult(IPointable left, IPointable right, ATypeTag argType)
             throws AlgebricksException, HyracksDataException {
+        byte[] leftBytes = left.getByteArray();
+        int leftStartOffset = left.getStartOffset();
+        byte[] rightBytes = right.getByteArray();
+        int rightStartOffset = right.getStartOffset();
+
         switch (argType) {
-
             case STRING: {
-                return ed
-                        .UTF8StringEditDistance(bytes, firstStart + typeIndicatorSize, secondStart + typeIndicatorSize);
+                return ed.UTF8StringEditDistance(leftBytes, leftStartOffset + typeIndicatorSize, rightBytes,
+                        rightStartOffset + typeIndicatorSize);
             }
-
             case ORDEREDLIST: {
-                firstOrdListIter.reset(bytes, firstStart);
-                secondOrdListIter.reset(bytes, secondStart);
+                firstOrdListIter.reset(leftBytes, leftStartOffset);
+                secondOrdListIter.reset(rightBytes, rightStartOffset);
                 try {
                     return (int) ed.getSimilarity(firstOrdListIter, secondOrdListIter);
                 } catch (HyracksDataException e) {
@@ -124,8 +128,8 @@
             }
 
             default: {
-                throw new AlgebricksException("Invalid type " + argType
-                        + " passed as argument to edit distance function.");
+                throw new AlgebricksException(
+                        "Invalid type " + argType + " passed as argument to edit distance function.");
             }
 
         }
@@ -143,8 +147,8 @@
         }
 
         if (typeTag1 != typeTag2) {
-            throw new AlgebricksException("Incompatible argument types given in edit distance: " + typeTag1 + " "
-                    + typeTag2);
+            throw new AlgebricksException(
+                    "Incompatible argument types given in edit distance: " + typeTag1 + " " + typeTag2);
         }
 
         // Since they are equal, check one tag is enough.
@@ -154,15 +158,17 @@
         }
 
         if (typeTag1 == ATypeTag.ORDEREDLIST) {
-            itemTypeTag = EnumDeserializer.ATYPETAGDESERIALIZER.deserialize(argOut.getByteArray()[firstStart + 1]);
-            if (itemTypeTag == ATypeTag.ANY)
+            itemTypeTag = EnumDeserializer.ATYPETAGDESERIALIZER
+                    .deserialize(argPtr1.getByteArray()[argPtr1.getStartOffset() + 1]);
+            if (itemTypeTag == ATypeTag.ANY) {
                 throw new AlgebricksException("\n Edit Distance can only be called on homogenous lists");
-
-            itemTypeTag = EnumDeserializer.ATYPETAGDESERIALIZER.deserialize(argOut.getByteArray()[secondStart + 1]);
-            if (itemTypeTag == ATypeTag.ANY)
+            }
+            itemTypeTag = EnumDeserializer.ATYPETAGDESERIALIZER
+                    .deserialize(argPtr2.getByteArray()[argPtr2.getStartOffset() + 1]);
+            if (itemTypeTag == ATypeTag.ANY) {
                 throw new AlgebricksException("\n Edit Distance can only be called on homogenous lists");
+            }
         }
-
         return true;
     }
 
diff --git a/asterix-runtime/src/main/java/org/apache/asterix/runtime/evaluators/common/GramTokensEvaluator.java b/asterix-runtime/src/main/java/org/apache/asterix/runtime/evaluators/common/GramTokensEvaluator.java
index 03f8cb1..ed20b26 100644
--- a/asterix-runtime/src/main/java/org/apache/asterix/runtime/evaluators/common/GramTokensEvaluator.java
+++ b/asterix-runtime/src/main/java/org/apache/asterix/runtime/evaluators/common/GramTokensEvaluator.java
@@ -26,63 +26,64 @@
 import org.apache.asterix.om.types.BuiltinType;
 import org.apache.asterix.om.types.hierachy.ATypeHierarchy;
 import org.apache.hyracks.algebricks.common.exceptions.AlgebricksException;
-import org.apache.hyracks.algebricks.runtime.base.ICopyEvaluator;
-import org.apache.hyracks.algebricks.runtime.base.ICopyEvaluatorFactory;
+import org.apache.hyracks.algebricks.runtime.base.IScalarEvaluator;
+import org.apache.hyracks.algebricks.runtime.base.IScalarEvaluatorFactory;
+import org.apache.hyracks.api.context.IHyracksTaskContext;
 import org.apache.hyracks.api.exceptions.HyracksDataException;
-import org.apache.hyracks.data.std.api.IDataOutputProvider;
+import org.apache.hyracks.data.std.api.IPointable;
 import org.apache.hyracks.data.std.primitive.BooleanPointable;
+import org.apache.hyracks.data.std.primitive.VoidPointable;
 import org.apache.hyracks.data.std.util.ArrayBackedValueStorage;
 import org.apache.hyracks.dataflow.common.data.accessors.IFrameTupleReference;
 import org.apache.hyracks.storage.am.lsm.invertedindex.tokenizers.IBinaryTokenizer;
 import org.apache.hyracks.storage.am.lsm.invertedindex.tokenizers.NGramUTF8StringBinaryTokenizer;
 
-public class GramTokensEvaluator implements ICopyEvaluator {
+public class GramTokensEvaluator implements IScalarEvaluator {
 
     // assuming type indicator in serde format
     private final int typeIndicatorSize = 1;
 
-    private final DataOutput out;
-    private final ArrayBackedValueStorage argOut = new ArrayBackedValueStorage();
-    private final ICopyEvaluator stringEval;
-    private final ICopyEvaluator gramLengthEval;
-    private final ICopyEvaluator prePostEval;
+    private final ArrayBackedValueStorage resultStorage = new ArrayBackedValueStorage();
+    private final DataOutput out = resultStorage.getDataOutput();
+    private final IPointable stringArg = new VoidPointable();
+    private final IPointable gramLengthArg = new VoidPointable();
+    private final IPointable prePostArg = new VoidPointable();
+    private final IScalarEvaluator stringEval;
+    private final IScalarEvaluator gramLengthEval;
+    private final IScalarEvaluator prePostEval;
 
     private final NGramUTF8StringBinaryTokenizer tokenizer;
     private final OrderedListBuilder listBuilder = new OrderedListBuilder();
     private final AOrderedListType listType;
 
-    public GramTokensEvaluator(ICopyEvaluatorFactory[] args, IDataOutputProvider output, IBinaryTokenizer tokenizer,
+    public GramTokensEvaluator(IScalarEvaluatorFactory[] args, IHyracksTaskContext context, IBinaryTokenizer tokenizer,
             BuiltinType itemType) throws AlgebricksException {
-        out = output.getDataOutput();
-        stringEval = args[0].createEvaluator(argOut);
-        gramLengthEval = args[1].createEvaluator(argOut);
-        prePostEval = args[2].createEvaluator(argOut);
+        stringEval = args[0].createScalarEvaluator(context);
+        gramLengthEval = args[1].createScalarEvaluator(context);
+        prePostEval = args[2].createScalarEvaluator(context);
         this.tokenizer = (NGramUTF8StringBinaryTokenizer) tokenizer;
         this.listType = new AOrderedListType(itemType, null);
     }
 
     @Override
-    public void evaluate(IFrameTupleReference tuple) throws AlgebricksException {
-        argOut.reset();
-        stringEval.evaluate(tuple);
-        int gramLengthOff = argOut.getLength();
-        gramLengthEval.evaluate(tuple);
-        int prePostOff = argOut.getLength();
-        prePostEval.evaluate(tuple);
+    public void evaluate(IFrameTupleReference tuple, IPointable result) throws AlgebricksException {
+        resultStorage.reset();
+        stringEval.evaluate(tuple, stringArg);
+        gramLengthEval.evaluate(tuple, gramLengthArg);
+        prePostEval.evaluate(tuple, prePostArg);
 
-        byte[] bytes = argOut.getByteArray();
         int gramLength = 0;
-
         try {
-            gramLength = ATypeHierarchy.getIntegerValue(bytes, gramLengthOff);
+            gramLength = ATypeHierarchy.getIntegerValue(gramLengthArg.getByteArray(), gramLengthArg.getStartOffset());
         } catch (HyracksDataException e1) {
             throw new AlgebricksException(e1);
         }
 
         tokenizer.setGramlength(gramLength);
-        boolean prePost = BooleanPointable.getBoolean(bytes, prePostOff + typeIndicatorSize);
+        boolean prePost = BooleanPointable.getBoolean(prePostArg.getByteArray(),
+                prePostArg.getStartOffset() + typeIndicatorSize);
         tokenizer.setPrePost(prePost);
-        tokenizer.reset(bytes, 0, gramLengthOff);
+        tokenizer.reset(stringArg.getByteArray(), stringArg.getStartOffset(), stringArg.getLength());
 
         try {
             listBuilder.reset(listType);
@@ -94,5 +95,6 @@
         } catch (IOException e) {
             throw new AlgebricksException(e);
         }
+        result.set(resultStorage);
     }
 }
diff --git a/asterix-runtime/src/main/java/org/apache/asterix/runtime/evaluators/common/SimilarityFiltersCache.java b/asterix-runtime/src/main/java/org/apache/asterix/runtime/evaluators/common/SimilarityFiltersCache.java
index 7180df0..52988a0 100644
--- a/asterix-runtime/src/main/java/org/apache/asterix/runtime/evaluators/common/SimilarityFiltersCache.java
+++ b/asterix-runtime/src/main/java/org/apache/asterix/runtime/evaluators/common/SimilarityFiltersCache.java
@@ -39,19 +39,20 @@
     private byte[] similarityNameBytesCached = null;
     private SimilarityFilters similarityFiltersCached = null;
 
-    public SimilarityFilters get(float similarityThreshold, byte[] similarityNameBytes) throws AlgebricksException {
+    public SimilarityFilters get(float similarityThreshold, byte[] similarityNameBytes, int startOffset, int len)
+            throws AlgebricksException {
         if (similarityThreshold != similarityThresholdCached || similarityNameBytesCached == null
                 || !Arrays.equals(similarityNameBytes, similarityNameBytesCached)) {
-            bbis.setByteBuffer(ByteBuffer.wrap(similarityNameBytes), 1);
+            bbis.setByteBuffer(ByteBuffer.wrap(similarityNameBytes), startOffset + 1);
             String similarityName;
             try {
                 similarityName = utf8SerDer.deserialize(dis);
             } catch (HyracksDataException e) {
                 throw new AlgebricksException(e);
             }
-            similarityNameBytesCached = Arrays.copyOf(similarityNameBytes, similarityNameBytes.length);
-            similarityFiltersCached = SimilarityFiltersFactory
-                    .getSimilarityFilters(similarityName, similarityThreshold);
+            similarityNameBytesCached = Arrays.copyOfRange(similarityNameBytes, startOffset, len);
+            similarityFiltersCached = SimilarityFiltersFactory.getSimilarityFilters(similarityName,
+                    similarityThreshold);
         }
         return similarityFiltersCached;
     }
diff --git a/asterix-runtime/src/main/java/org/apache/asterix/runtime/evaluators/common/SimilarityJaccardCheckEvaluator.java b/asterix-runtime/src/main/java/org/apache/asterix/runtime/evaluators/common/SimilarityJaccardCheckEvaluator.java
index 94ff35f..b2eca6d 100644
--- a/asterix-runtime/src/main/java/org/apache/asterix/runtime/evaluators/common/SimilarityJaccardCheckEvaluator.java
+++ b/asterix-runtime/src/main/java/org/apache/asterix/runtime/evaluators/common/SimilarityJaccardCheckEvaluator.java
@@ -28,19 +28,22 @@
 import org.apache.asterix.om.types.BuiltinType;
 import org.apache.asterix.runtime.evaluators.functions.BinaryHashMap.BinaryEntry;
 import org.apache.hyracks.algebricks.common.exceptions.AlgebricksException;
-import org.apache.hyracks.algebricks.runtime.base.ICopyEvaluator;
-import org.apache.hyracks.algebricks.runtime.base.ICopyEvaluatorFactory;
+import org.apache.hyracks.algebricks.runtime.base.IScalarEvaluator;
+import org.apache.hyracks.algebricks.runtime.base.IScalarEvaluatorFactory;
+import org.apache.hyracks.api.context.IHyracksTaskContext;
 import org.apache.hyracks.api.dataflow.value.ISerializerDeserializer;
 import org.apache.hyracks.api.exceptions.HyracksDataException;
-import org.apache.hyracks.data.std.api.IDataOutputProvider;
+import org.apache.hyracks.data.std.api.IPointable;
 import org.apache.hyracks.data.std.primitive.IntegerPointable;
+import org.apache.hyracks.data.std.primitive.VoidPointable;
 import org.apache.hyracks.data.std.util.ArrayBackedValueStorage;
 import org.apache.hyracks.dataflow.common.data.accessors.IFrameTupleReference;
 
 public class SimilarityJaccardCheckEvaluator extends SimilarityJaccardEvaluator {
 
-    protected final ICopyEvaluator jaccThreshEval;
+    protected final IScalarEvaluator jaccThreshEval;
     protected float jaccThresh = -1f;
+    protected IPointable jaccThreshPointable = new VoidPointable();
 
     protected OrderedListBuilder listBuilder;
     protected ArrayBackedValueStorage inputVal;
@@ -49,10 +52,10 @@
             .getSerializerDeserializer(BuiltinType.ABOOLEAN);
     protected final AOrderedListType listType = new AOrderedListType(BuiltinType.ANY, "list");
 
-    public SimilarityJaccardCheckEvaluator(ICopyEvaluatorFactory[] args, IDataOutputProvider output)
+    public SimilarityJaccardCheckEvaluator(IScalarEvaluatorFactory[] args, IHyracksTaskContext context)
             throws AlgebricksException {
-        super(args, output);
-        jaccThreshEval = args[2].createEvaluator(argOut);
+        super(args, context);
+        jaccThreshEval = args[2].createScalarEvaluator(context);
         listBuilder = new OrderedListBuilder();
         inputVal = new ArrayBackedValueStorage();
     }
@@ -60,10 +63,9 @@
     @Override
     protected void runArgEvals(IFrameTupleReference tuple) throws AlgebricksException {
         super.runArgEvals(tuple);
-        int jaccThreshStart = argOut.getLength();
-        jaccThreshEval.evaluate(tuple);
-        jaccThresh = (float) AFloatSerializerDeserializer.getFloat(argOut.getByteArray(), jaccThreshStart
-                + TYPE_INDICATOR_SIZE);
+        jaccThreshEval.evaluate(tuple, jaccThreshPointable);
+        jaccThresh = (float) AFloatSerializerDeserializer.getFloat(jaccThreshPointable.getByteArray(),
+                jaccThreshPointable.getStartOffset() + TYPE_INDICATOR_SIZE);
     }
 
     @Override
@@ -71,7 +73,8 @@
             throws HyracksDataException {
         // Apply length filter.
         int lengthLowerBound = (int) Math.ceil(jaccThresh * probeListSize);
-        if ((lengthLowerBound > buildListSize) || (buildListSize > (int) Math.floor(1.0f / jaccThresh * probeListSize))) {
+        if ((lengthLowerBound > buildListSize)
+                || (buildListSize > (int) Math.floor(1.0f / jaccThresh * probeListSize))) {
             return -1;
         }
         // Probe phase: Probe items from second list, and compute intersection size.
diff --git a/asterix-runtime/src/main/java/org/apache/asterix/runtime/evaluators/common/SimilarityJaccardEvaluator.java b/asterix-runtime/src/main/java/org/apache/asterix/runtime/evaluators/common/SimilarityJaccardEvaluator.java
index 4481819..9aa0cdb 100644
--- a/asterix-runtime/src/main/java/org/apache/asterix/runtime/evaluators/common/SimilarityJaccardEvaluator.java
+++ b/asterix-runtime/src/main/java/org/apache/asterix/runtime/evaluators/common/SimilarityJaccardEvaluator.java
@@ -33,18 +33,20 @@
 import org.apache.asterix.runtime.evaluators.functions.BinaryHashMap;
 import org.apache.asterix.runtime.evaluators.functions.BinaryHashMap.BinaryEntry;
 import org.apache.hyracks.algebricks.common.exceptions.AlgebricksException;
-import org.apache.hyracks.algebricks.runtime.base.ICopyEvaluator;
-import org.apache.hyracks.algebricks.runtime.base.ICopyEvaluatorFactory;
+import org.apache.hyracks.algebricks.runtime.base.IScalarEvaluator;
+import org.apache.hyracks.algebricks.runtime.base.IScalarEvaluatorFactory;
+import org.apache.hyracks.api.context.IHyracksTaskContext;
 import org.apache.hyracks.api.dataflow.value.IBinaryComparator;
 import org.apache.hyracks.api.dataflow.value.IBinaryHashFunction;
 import org.apache.hyracks.api.dataflow.value.ISerializerDeserializer;
 import org.apache.hyracks.api.exceptions.HyracksDataException;
-import org.apache.hyracks.data.std.api.IDataOutputProvider;
+import org.apache.hyracks.data.std.api.IPointable;
 import org.apache.hyracks.data.std.primitive.IntegerPointable;
+import org.apache.hyracks.data.std.primitive.VoidPointable;
 import org.apache.hyracks.data.std.util.ArrayBackedValueStorage;
 import org.apache.hyracks.dataflow.common.data.accessors.IFrameTupleReference;
 
-public class SimilarityJaccardEvaluator implements ICopyEvaluator {
+public class SimilarityJaccardEvaluator implements IScalarEvaluator {
 
     // Parameters for hash table.
     protected final int TABLE_SIZE = 100;
@@ -53,10 +55,12 @@
     // Assuming type indicator in serde format.
     protected final int TYPE_INDICATOR_SIZE = 1;
 
-    protected final DataOutput out;
-    protected final ArrayBackedValueStorage argOut = new ArrayBackedValueStorage();
-    protected final ICopyEvaluator firstOrdListEval;
-    protected final ICopyEvaluator secondOrdListEval;
+    protected final ArrayBackedValueStorage resultStorage = new ArrayBackedValueStorage();
+    protected final DataOutput out = resultStorage.getDataOutput();
+    protected final IPointable argPtr1 = new VoidPointable();
+    protected final IPointable argPtr2 = new VoidPointable();
+    protected final IScalarEvaluator firstOrdListEval;
+    protected final IScalarEvaluator secondOrdListEval;
 
     protected final AsterixOrderedListIterator fstOrdListIter = new AsterixOrderedListIterator();
     protected final AsterixOrderedListIterator sndOrdListIter = new AsterixOrderedListIterator();
@@ -73,8 +77,6 @@
 
     protected ATypeTag firstTypeTag;
     protected ATypeTag secondTypeTag;
-    protected int firstStart = -1;
-    protected int secondStart = -1;
     protected float jaccSim = 0.0f;
     protected ATypeTag firstItemTypeTag;
     protected ATypeTag secondItemTypeTag;
@@ -86,24 +88,25 @@
     // Ignore case for strings. Defaults to true.
     protected final boolean ignoreCase = true;
 
-    public SimilarityJaccardEvaluator(ICopyEvaluatorFactory[] args, IDataOutputProvider output)
+    public SimilarityJaccardEvaluator(IScalarEvaluatorFactory[] args, IHyracksTaskContext context)
             throws AlgebricksException {
-        out = output.getDataOutput();
-        firstOrdListEval = args[0].createEvaluator(argOut);
-        secondOrdListEval = args[1].createEvaluator(argOut);
+        firstOrdListEval = args[0].createScalarEvaluator(context);
+        secondOrdListEval = args[1].createScalarEvaluator(context);
         byte[] emptyValBuf = new byte[8];
         Arrays.fill(emptyValBuf, (byte) 0);
         valEntry.set(emptyValBuf, 0, 8);
     }
 
     @Override
-    public void evaluate(IFrameTupleReference tuple) throws AlgebricksException {
+    public void evaluate(IFrameTupleReference tuple, IPointable result) throws AlgebricksException {
+        resultStorage.reset();
         runArgEvals(tuple);
         if (!checkArgTypes(firstTypeTag, secondTypeTag)) {
+            result.set(resultStorage);
             return;
         }
-        if (prepareLists(argOut.getByteArray(), firstStart, secondStart, firstTypeTag)) {
-            jaccSim = computeResult(argOut.getByteArray(), firstStart, secondStart, firstTypeTag);
+        if (prepareLists(argPtr1, argPtr2, firstTypeTag)) {
+            jaccSim = computeResult();
         } else {
             jaccSim = 0.0f;
         }
@@ -112,32 +115,34 @@
         } catch (IOException e) {
             throw new AlgebricksException(e);
         }
+        result.set(resultStorage);
     }
 
     protected void runArgEvals(IFrameTupleReference tuple) throws AlgebricksException {
-        argOut.reset();
+        firstOrdListEval.evaluate(tuple, argPtr1);
+        secondOrdListEval.evaluate(tuple, argPtr2);
 
-        firstStart = argOut.getLength();
-        firstOrdListEval.evaluate(tuple);
-        secondStart = argOut.getLength();
-        secondOrdListEval.evaluate(tuple);
+        firstTypeTag = EnumDeserializer.ATYPETAGDESERIALIZER
+                .deserialize(argPtr1.getByteArray()[argPtr1.getStartOffset()]);
+        secondTypeTag = EnumDeserializer.ATYPETAGDESERIALIZER
+                .deserialize(argPtr2.getByteArray()[argPtr2.getStartOffset()]);
 
-        firstTypeTag = EnumDeserializer.ATYPETAGDESERIALIZER.deserialize(argOut.getByteArray()[firstStart]);
-        secondTypeTag = EnumDeserializer.ATYPETAGDESERIALIZER.deserialize(argOut.getByteArray()[secondStart]);
-
-        if (firstTypeTag == ATypeTag.NULL)
+        if (firstTypeTag == ATypeTag.NULL) {
             return;
-        if (secondTypeTag == ATypeTag.NULL)
+        }
+        if (secondTypeTag == ATypeTag.NULL) {
             return;
+        }
 
-        firstItemTypeTag = EnumDeserializer.ATYPETAGDESERIALIZER.deserialize(argOut.getByteArray()[firstStart + 1]);
-        secondItemTypeTag = EnumDeserializer.ATYPETAGDESERIALIZER.deserialize(argOut.getByteArray()[secondStart + 1]);
+        firstItemTypeTag = EnumDeserializer.ATYPETAGDESERIALIZER
+                .deserialize(argPtr1.getByteArray()[argPtr1.getStartOffset() + 1]);
+        secondItemTypeTag = EnumDeserializer.ATYPETAGDESERIALIZER
+                .deserialize(argPtr2.getByteArray()[argPtr2.getStartOffset() + 1]);
     }
 
-    protected boolean prepareLists(byte[] bytes, int firstStart, int secondStart, ATypeTag argType)
-            throws AlgebricksException {
-        firstListIter.reset(bytes, firstStart);
-        secondListIter.reset(bytes, secondStart);
+    protected boolean prepareLists(IPointable left, IPointable right, ATypeTag argType) throws AlgebricksException {
+        firstListIter.reset(left.getByteArray(), left.getStartOffset());
+        secondListIter.reset(right.getByteArray(), right.getStartOffset());
         // Check for special case where one of the lists is empty, since list
         // types won't match.
         if (firstListIter.size() == 0 || secondListIter.size() == 0) {
@@ -147,8 +152,7 @@
         return true;
     }
 
-    protected float computeResult(byte[] bytes, int firstStart, int secondStart, ATypeTag argType)
-            throws AlgebricksException {
+    protected float computeResult() throws AlgebricksException {
         // We will subtract the intersection size later to get the real union size.
         int firstListSize = firstListIter.size();
         int secondListSize = secondListIter.size();
@@ -161,7 +165,7 @@
         ATypeTag buildItemTypeTag = (buildList == firstListIter) ? firstItemTypeTag : secondItemTypeTag;
         ATypeTag probeItemTypeTag = (probeList == firstListIter) ? firstItemTypeTag : secondItemTypeTag;
 
-        setHashMap(bytes, buildItemTypeTag, probeItemTypeTag);
+        setHashMap(buildItemTypeTag, probeItemTypeTag);
         try {
             buildHashMap(buildList);
             int intersectionSize = probeHashMap(probeList, buildListSize, probeListSize);
@@ -225,16 +229,16 @@
         return intersectionSize;
     }
 
-    protected void setHashMap(byte[] bytes, ATypeTag buildItemTypeTag, ATypeTag probeItemTypeTag) {
+    protected void setHashMap(ATypeTag buildItemTypeTag, ATypeTag probeItemTypeTag) {
         if (hashMap != null) {
             hashMap.clear();
             return;
         }
 
-        IBinaryHashFunction putHashFunc = ListItemBinaryHashFunctionFactory.INSTANCE.createBinaryHashFunction(
-                buildItemTypeTag, ignoreCase);
-        IBinaryHashFunction getHashFunc = ListItemBinaryHashFunctionFactory.INSTANCE.createBinaryHashFunction(
-                probeItemTypeTag, ignoreCase);
+        IBinaryHashFunction putHashFunc = ListItemBinaryHashFunctionFactory.INSTANCE
+                .createBinaryHashFunction(buildItemTypeTag, ignoreCase);
+        IBinaryHashFunction getHashFunc = ListItemBinaryHashFunctionFactory.INSTANCE
+                .createBinaryHashFunction(probeItemTypeTag, ignoreCase);
         IBinaryComparator cmp = ListItemBinaryComparatorFactory.INSTANCE.createBinaryComparator(buildItemTypeTag,
                 probeItemTypeTag, ignoreCase);
         hashMap = new BinaryHashMap(TABLE_SIZE, TABLE_FRAME_SIZE, putHashFunc, getHashFunc, cmp);
diff --git a/asterix-runtime/src/main/java/org/apache/asterix/runtime/evaluators/common/SimilarityJaccardPrefixEvaluator.java b/asterix-runtime/src/main/java/org/apache/asterix/runtime/evaluators/common/SimilarityJaccardPrefixEvaluator.java
index c287ba9..946c806 100644
--- a/asterix-runtime/src/main/java/org/apache/asterix/runtime/evaluators/common/SimilarityJaccardPrefixEvaluator.java
+++ b/asterix-runtime/src/main/java/org/apache/asterix/runtime/evaluators/common/SimilarityJaccardPrefixEvaluator.java
@@ -37,33 +37,32 @@
 import org.apache.asterix.om.types.EnumDeserializer;
 import org.apache.asterix.om.types.hierachy.ATypeHierarchy;
 import org.apache.hyracks.algebricks.common.exceptions.AlgebricksException;
-import org.apache.hyracks.algebricks.runtime.base.ICopyEvaluator;
-import org.apache.hyracks.algebricks.runtime.base.ICopyEvaluatorFactory;
+import org.apache.hyracks.algebricks.runtime.base.IScalarEvaluator;
+import org.apache.hyracks.algebricks.runtime.base.IScalarEvaluatorFactory;
+import org.apache.hyracks.api.context.IHyracksTaskContext;
 import org.apache.hyracks.api.dataflow.value.ISerializerDeserializer;
 import org.apache.hyracks.api.exceptions.HyracksDataException;
-import org.apache.hyracks.data.std.api.IDataOutputProvider;
+import org.apache.hyracks.data.std.api.IPointable;
+import org.apache.hyracks.data.std.primitive.VoidPointable;
 import org.apache.hyracks.data.std.util.ArrayBackedValueStorage;
 import org.apache.hyracks.dataflow.common.data.accessors.IFrameTupleReference;
 
-public class SimilarityJaccardPrefixEvaluator implements ICopyEvaluator {
+public class SimilarityJaccardPrefixEvaluator implements IScalarEvaluator {
     // assuming type indicator in serde format
     protected final int typeIndicatorSize = 1;
 
-    protected final DataOutput out;
-    protected final ArrayBackedValueStorage inputVal = new ArrayBackedValueStorage();
-    protected final ICopyEvaluator evalLen1;
-    protected final ICopyEvaluator evalTokens1;
-    protected final ICopyEvaluator evalLen2;
-    protected final ICopyEvaluator evalTokens2;
-    protected final ICopyEvaluator evalTokenPrefix;
-    protected final ICopyEvaluator evalThreshold;
+    protected final ArrayBackedValueStorage resultStorage = new ArrayBackedValueStorage();
+    protected final DataOutput out = resultStorage.getDataOutput();
+    protected final IPointable inputVal = new VoidPointable();
+    protected final IScalarEvaluator evalLen1;
+    protected final IScalarEvaluator evalTokens1;
+    protected final IScalarEvaluator evalLen2;
+    protected final IScalarEvaluator evalTokens2;
+    protected final IScalarEvaluator evalTokenPrefix;
+    protected final IScalarEvaluator evalThreshold;
 
     protected float similarityThresholdCache;
     protected SimilarityFiltersJaccard similarityFilters;
-
-    private final static byte SER_ORDEREDLIST_TYPE_TAG = ATypeTag.ORDEREDLIST.serialize();
-    private final static byte SER_UNORDEREDLIST_TYPE_TAG = ATypeTag.UNORDEREDLIST.serialize();
-
     protected final IntArray tokens1 = new IntArray();
     protected final IntArray tokens2 = new IntArray();
     protected final PartialIntersect parInter = new PartialIntersect();
@@ -76,46 +75,43 @@
     protected final ISerializerDeserializer<AFloat> reusSerde = AqlSerializerDeserializerProvider.INSTANCE
             .getSerializerDeserializer(BuiltinType.AFLOAT);
 
-    public SimilarityJaccardPrefixEvaluator(ICopyEvaluatorFactory[] args, IDataOutputProvider output)
+    public SimilarityJaccardPrefixEvaluator(IScalarEvaluatorFactory[] args, IHyracksTaskContext context)
             throws AlgebricksException {
-        out = output.getDataOutput();
-        evalLen1 = args[0].createEvaluator(inputVal);
-        evalTokens1 = args[1].createEvaluator(inputVal);
-        evalLen2 = args[2].createEvaluator(inputVal);
-        evalTokens2 = args[3].createEvaluator(inputVal);
-        evalTokenPrefix = args[4].createEvaluator(inputVal);
-        evalThreshold = args[5].createEvaluator(inputVal);
+        evalLen1 = args[0].createScalarEvaluator(context);
+        evalTokens1 = args[1].createScalarEvaluator(context);
+        evalLen2 = args[2].createScalarEvaluator(context);
+        evalTokens2 = args[3].createScalarEvaluator(context);
+        evalTokenPrefix = args[4].createScalarEvaluator(context);
+        evalThreshold = args[5].createScalarEvaluator(context);
     }
 
     @Override
-    public void evaluate(IFrameTupleReference tuple) throws AlgebricksException {
+    public void evaluate(IFrameTupleReference tuple, IPointable result) throws AlgebricksException {
+        resultStorage.reset();
         // similarity threshold
         sim = 0;
-        inputVal.reset();
-        evalThreshold.evaluate(tuple);
-        float similarityThreshold = AFloatSerializerDeserializer.getFloat(inputVal.getByteArray(), 1);
+        evalThreshold.evaluate(tuple, inputVal);
+        float similarityThreshold = AFloatSerializerDeserializer.getFloat(inputVal.getByteArray(),
+                inputVal.getStartOffset() + 1);
 
         if (similarityThreshold != similarityThresholdCache || similarityFilters == null) {
             similarityFilters = new SimilarityFiltersJaccard(similarityThreshold);
             similarityThresholdCache = similarityThreshold;
         }
 
-        inputVal.reset();
-        evalLen1.evaluate(tuple);
+        evalLen1.evaluate(tuple, inputVal);
         int length1 = 0;
-
         try {
-            length1 = ATypeHierarchy.getIntegerValue(inputVal.getByteArray(), 0);
+            length1 = ATypeHierarchy.getIntegerValue(inputVal.getByteArray(), inputVal.getStartOffset());
         } catch (HyracksDataException e1) {
             throw new AlgebricksException(e1);
         }
 
-        inputVal.reset();
-        evalLen2.evaluate(tuple);
+        evalLen2.evaluate(tuple, inputVal);
         int length2 = 0;
 
         try {
-            length2 = ATypeHierarchy.getIntegerValue(inputVal.getByteArray(), 0);
+            length2 = ATypeHierarchy.getIntegerValue(inputVal.getByteArray(), inputVal.getStartOffset());
         } catch (HyracksDataException e1) {
             throw new AlgebricksException(e1);
         }
@@ -128,50 +124,55 @@
             // -- - tokens1 - --
             int i;
             tokens1.reset();
-            inputVal.reset();
-            evalTokens1.evaluate(tuple);
+            evalTokens1.evaluate(tuple, inputVal);
 
             byte[] serList = inputVal.getByteArray();
-            if (serList[0] != SER_ORDEREDLIST_TYPE_TAG && serList[0] != SER_UNORDEREDLIST_TYPE_TAG) {
+            int startOffset = inputVal.getStartOffset();
+            if (serList[startOffset] != ATypeTag.SERIALIZED_ORDEREDLIST_TYPE_TAG
+                    && serList[startOffset] != ATypeTag.SERIALIZED_UNORDEREDLIST_TYPE_TAG) {
                 throw new AlgebricksException("Scan collection is not defined for values of type"
-                        + EnumDeserializer.ATYPETAGDESERIALIZER.deserialize(serList[0]));
+                        + EnumDeserializer.ATYPETAGDESERIALIZER.deserialize(serList[startOffset]));
             }
 
             int lengthTokens1;
-            if (serList[0] == SER_ORDEREDLIST_TYPE_TAG) {
-                lengthTokens1 = AOrderedListSerializerDeserializer.getNumberOfItems(inputVal.getByteArray());
+            if (serList[startOffset] == ATypeTag.SERIALIZED_ORDEREDLIST_TYPE_TAG) {
+                lengthTokens1 = AOrderedListSerializerDeserializer.getNumberOfItems(inputVal.getByteArray(),
+                        startOffset);
                 // read tokens
                 for (i = 0; i < lengthTokens1; i++) {
                     int itemOffset;
                     int token;
                     try {
-                        itemOffset = AOrderedListSerializerDeserializer.getItemOffset(serList, i);
+                        itemOffset = AOrderedListSerializerDeserializer.getItemOffset(serList, startOffset, i);
                     } catch (AsterixException e) {
                         throw new AlgebricksException(e);
                     }
 
                     try {
-                        token = ATypeHierarchy.getIntegerValueWithDifferentTypeTagPosition(serList, itemOffset, 1);
+                        token = ATypeHierarchy.getIntegerValueWithDifferentTypeTagPosition(serList, itemOffset,
+                                startOffset + 1);
                     } catch (HyracksDataException e) {
                         throw new AlgebricksException(e);
                     }
                     tokens1.add(token);
                 }
             } else {
-                lengthTokens1 = AUnorderedListSerializerDeserializer.getNumberOfItems(inputVal.getByteArray());
+                lengthTokens1 = AUnorderedListSerializerDeserializer.getNumberOfItems(inputVal.getByteArray(),
+                        startOffset);
                 // read tokens
                 for (i = 0; i < lengthTokens1; i++) {
                     int itemOffset;
                     int token;
 
                     try {
-                        itemOffset = AUnorderedListSerializerDeserializer.getItemOffset(serList, i);
+                        itemOffset = AUnorderedListSerializerDeserializer.getItemOffset(serList, startOffset, i);
                     } catch (AsterixException e) {
                         throw new AlgebricksException(e);
                     }
 
                     try {
-                        token = ATypeHierarchy.getIntegerValueWithDifferentTypeTagPosition(serList, itemOffset, 1);
+                        token = ATypeHierarchy.getIntegerValueWithDifferentTypeTagPosition(serList, itemOffset,
+                                startOffset + 1);
                     } catch (HyracksDataException e) {
                         throw new AlgebricksException(e);
                     }
@@ -185,51 +186,56 @@
 
             // -- - tokens2 - --
             tokens2.reset();
-            inputVal.reset();
-            evalTokens2.evaluate(tuple);
+            evalTokens2.evaluate(tuple, inputVal);
 
             serList = inputVal.getByteArray();
-            if (serList[0] != SER_ORDEREDLIST_TYPE_TAG && serList[0] != SER_UNORDEREDLIST_TYPE_TAG) {
+            startOffset = inputVal.getStartOffset();
+            if (serList[startOffset] != ATypeTag.SERIALIZED_ORDEREDLIST_TYPE_TAG
+                    && serList[startOffset] != ATypeTag.SERIALIZED_UNORDEREDLIST_TYPE_TAG) {
                 throw new AlgebricksException("Scan collection is not defined for values of type"
-                        + EnumDeserializer.ATYPETAGDESERIALIZER.deserialize(serList[0]));
+                        + EnumDeserializer.ATYPETAGDESERIALIZER.deserialize(serList[startOffset]));
             }
 
             int lengthTokens2;
-            if (serList[0] == SER_ORDEREDLIST_TYPE_TAG) {
-                lengthTokens2 = AOrderedListSerializerDeserializer.getNumberOfItems(inputVal.getByteArray());
+            if (serList[startOffset] == ATypeTag.SERIALIZED_ORDEREDLIST_TYPE_TAG) {
+                lengthTokens2 = AOrderedListSerializerDeserializer.getNumberOfItems(inputVal.getByteArray(),
+                        startOffset);
                 // read tokens
                 for (i = 0; i < lengthTokens2; i++) {
                     int itemOffset;
                     int token;
 
                     try {
-                        itemOffset = AOrderedListSerializerDeserializer.getItemOffset(serList, i);
+                        itemOffset = AOrderedListSerializerDeserializer.getItemOffset(serList, startOffset, i);
                     } catch (AsterixException e) {
                         throw new AlgebricksException(e);
                     }
 
                     try {
-                        token = ATypeHierarchy.getIntegerValueWithDifferentTypeTagPosition(serList, itemOffset, 1);
+                        token = ATypeHierarchy.getIntegerValueWithDifferentTypeTagPosition(serList, itemOffset,
+                                startOffset + 1);
                     } catch (HyracksDataException e) {
                         throw new AlgebricksException(e);
                     }
                     tokens2.add(token);
                 }
             } else {
-                lengthTokens2 = AUnorderedListSerializerDeserializer.getNumberOfItems(inputVal.getByteArray());
+                lengthTokens2 = AUnorderedListSerializerDeserializer.getNumberOfItems(inputVal.getByteArray(),
+                        startOffset);
                 // read tokens
                 for (i = 0; i < lengthTokens2; i++) {
                     int itemOffset;
                     int token;
 
                     try {
-                        itemOffset = AUnorderedListSerializerDeserializer.getItemOffset(serList, i);
+                        itemOffset = AUnorderedListSerializerDeserializer.getItemOffset(serList, startOffset, i);
                     } catch (AsterixException e) {
                         throw new AlgebricksException(e);
                     }
 
                     try {
-                        token = ATypeHierarchy.getIntegerValueWithDifferentTypeTagPosition(serList, itemOffset, 1);
+                        token = ATypeHierarchy.getIntegerValueWithDifferentTypeTagPosition(serList, itemOffset,
+                                startOffset + 1);
                     } catch (HyracksDataException e) {
                         throw new AlgebricksException(e);
                     }
@@ -242,13 +248,11 @@
             }
 
             // -- - token prefix - --
-            inputVal.reset();
-            evalTokenPrefix.evaluate(tuple);
-
+            evalTokenPrefix.evaluate(tuple, inputVal);
             int tokenPrefix = 0;
 
             try {
-                tokenPrefix = ATypeHierarchy.getIntegerValue(inputVal.getByteArray(), 0);
+                tokenPrefix = ATypeHierarchy.getIntegerValue(inputVal.getByteArray(), inputVal.getStartOffset());
             } catch (HyracksDataException e) {
                 throw new AlgebricksException(e);
             }
@@ -279,6 +283,7 @@
         } catch (IOException e) {
             throw new AlgebricksException(e);
         }
+        result.set(resultStorage);
     }
 
     public void writeResult() throws AlgebricksException, IOException {
diff --git a/asterix-runtime/src/main/java/org/apache/asterix/runtime/evaluators/common/SimilarityJaccardSortedCheckEvaluator.java b/asterix-runtime/src/main/java/org/apache/asterix/runtime/evaluators/common/SimilarityJaccardSortedCheckEvaluator.java
index 6c59801..d0b0f7d 100644
--- a/asterix-runtime/src/main/java/org/apache/asterix/runtime/evaluators/common/SimilarityJaccardSortedCheckEvaluator.java
+++ b/asterix-runtime/src/main/java/org/apache/asterix/runtime/evaluators/common/SimilarityJaccardSortedCheckEvaluator.java
@@ -19,24 +19,22 @@
 package org.apache.asterix.runtime.evaluators.common;
 
 import org.apache.asterix.fuzzyjoin.similarity.SimilarityMetricJaccard;
-import org.apache.asterix.om.types.ATypeTag;
 import org.apache.hyracks.algebricks.common.exceptions.AlgebricksException;
-import org.apache.hyracks.algebricks.runtime.base.ICopyEvaluatorFactory;
+import org.apache.hyracks.algebricks.runtime.base.IScalarEvaluatorFactory;
+import org.apache.hyracks.api.context.IHyracksTaskContext;
 import org.apache.hyracks.api.exceptions.HyracksDataException;
-import org.apache.hyracks.data.std.api.IDataOutputProvider;
 
 public class SimilarityJaccardSortedCheckEvaluator extends SimilarityJaccardCheckEvaluator {
 
     protected final SimilarityMetricJaccard jaccard = new SimilarityMetricJaccard();
 
-    public SimilarityJaccardSortedCheckEvaluator(ICopyEvaluatorFactory[] args, IDataOutputProvider output)
+    public SimilarityJaccardSortedCheckEvaluator(IScalarEvaluatorFactory[] args, IHyracksTaskContext context)
             throws AlgebricksException {
-        super(args, output);
+        super(args, context);
     }
 
     @Override
-    protected float computeResult(byte[] bytes, int firstStart, int secondStart, ATypeTag argType)
-            throws AlgebricksException {
+    protected float computeResult() throws AlgebricksException {
         try {
             return jaccard.getSimilarity(firstListIter, secondListIter, jaccThresh);
         } catch (HyracksDataException e) {
diff --git a/asterix-runtime/src/main/java/org/apache/asterix/runtime/evaluators/common/SimilarityJaccardSortedEvaluator.java b/asterix-runtime/src/main/java/org/apache/asterix/runtime/evaluators/common/SimilarityJaccardSortedEvaluator.java
index d99565d..05965d6 100644
--- a/asterix-runtime/src/main/java/org/apache/asterix/runtime/evaluators/common/SimilarityJaccardSortedEvaluator.java
+++ b/asterix-runtime/src/main/java/org/apache/asterix/runtime/evaluators/common/SimilarityJaccardSortedEvaluator.java
@@ -19,24 +19,23 @@
 package org.apache.asterix.runtime.evaluators.common;
 
 import org.apache.asterix.fuzzyjoin.similarity.SimilarityMetricJaccard;
-import org.apache.asterix.om.types.ATypeTag;
 import org.apache.hyracks.algebricks.common.exceptions.AlgebricksException;
-import org.apache.hyracks.algebricks.runtime.base.ICopyEvaluatorFactory;
+import org.apache.hyracks.algebricks.runtime.base.IScalarEvaluatorFactory;
+import org.apache.hyracks.api.context.IHyracksTaskContext;
 import org.apache.hyracks.api.exceptions.HyracksDataException;
-import org.apache.hyracks.data.std.api.IDataOutputProvider;
 
 // Assumes that both arguments are sorted by the same ordering.
 public class SimilarityJaccardSortedEvaluator extends SimilarityJaccardEvaluator {
 
     protected final SimilarityMetricJaccard jaccard = new SimilarityMetricJaccard();
 
-    public SimilarityJaccardSortedEvaluator(ICopyEvaluatorFactory[] args, IDataOutputProvider output)
+    public SimilarityJaccardSortedEvaluator(IScalarEvaluatorFactory[] args, IHyracksTaskContext context)
             throws AlgebricksException {
-        super(args, output);
+        super(args, context);
     }
 
-    protected float computeResult(byte[] bytes, int firstStart, int secondStart, ATypeTag argType)
-            throws AlgebricksException {
+    @Override
+    protected float computeResult() throws AlgebricksException {
         try {
             return jaccard.getSimilarity(firstListIter, secondListIter);
         } catch (HyracksDataException e) {
diff --git a/asterix-runtime/src/main/java/org/apache/asterix/runtime/evaluators/common/SpatialUtils.java b/asterix-runtime/src/main/java/org/apache/asterix/runtime/evaluators/common/SpatialUtils.java
index 90f67a2..8e492c3 100644
--- a/asterix-runtime/src/main/java/org/apache/asterix/runtime/evaluators/common/SpatialUtils.java
+++ b/asterix-runtime/src/main/java/org/apache/asterix/runtime/evaluators/common/SpatialUtils.java
@@ -92,26 +92,26 @@
     }
 
     // Warning: The caller is responsible of taking the absolute value
-    public final static double polygonArea(byte[] bytes, int numOfPoints) throws HyracksDataException {
+    public final static double polygonArea(byte[] bytes, int offset, int numOfPoints) throws HyracksDataException {
         double area = 0.0;
         for (int i = 0; i < numOfPoints; i++) {
 
             double x1 = ADoubleSerializerDeserializer.getDouble(bytes,
-                    APolygonSerializerDeserializer.getCoordinateOffset(i, Coordinate.X));
+                    offset + APolygonSerializerDeserializer.getCoordinateOffset(i, Coordinate.X));
             double y1 = ADoubleSerializerDeserializer.getDouble(bytes,
-                    APolygonSerializerDeserializer.getCoordinateOffset(i, Coordinate.Y));
+                    offset + APolygonSerializerDeserializer.getCoordinateOffset(i, Coordinate.Y));
             double x2;
             double y2;
             if (i + 1 == numOfPoints) {
                 x2 = ADoubleSerializerDeserializer.getDouble(bytes,
-                        APolygonSerializerDeserializer.getCoordinateOffset(0, Coordinate.X));
+                        offset + APolygonSerializerDeserializer.getCoordinateOffset(0, Coordinate.X));
                 y2 = ADoubleSerializerDeserializer.getDouble(bytes,
-                        APolygonSerializerDeserializer.getCoordinateOffset(0, Coordinate.Y));
+                        offset + APolygonSerializerDeserializer.getCoordinateOffset(0, Coordinate.Y));
             } else {
                 x2 = ADoubleSerializerDeserializer.getDouble(bytes,
-                        APolygonSerializerDeserializer.getCoordinateOffset(i + 1, Coordinate.X));
+                        offset + APolygonSerializerDeserializer.getCoordinateOffset(i + 1, Coordinate.X));
                 y2 = ADoubleSerializerDeserializer.getDouble(bytes,
-                        APolygonSerializerDeserializer.getCoordinateOffset(i + 1, Coordinate.Y));
+                        offset + APolygonSerializerDeserializer.getCoordinateOffset(i + 1, Coordinate.Y));
             }
             area += (x1 * y2) - (x2 * y1);
         }
@@ -128,10 +128,11 @@
             temp = getTriangleXCoordinate(trianglesX, triangleId, i) * xAxis
                     + getTriangleYCoordinate(trianglesY, triangleId, i) * yAxis;
 
-            if (temp > max)
+            if (temp > max) {
                 max = temp;
-            else if (temp < min)
+            } else if (temp < min) {
                 min = temp;
+            }
         }
         setMinProjection(min);
         setMaxProjection(max);
diff --git a/asterix-runtime/src/main/java/org/apache/asterix/runtime/evaluators/common/WordTokensEvaluator.java b/asterix-runtime/src/main/java/org/apache/asterix/runtime/evaluators/common/WordTokensEvaluator.java
index d8eceaa..faace0e 100644
--- a/asterix-runtime/src/main/java/org/apache/asterix/runtime/evaluators/common/WordTokensEvaluator.java
+++ b/asterix-runtime/src/main/java/org/apache/asterix/runtime/evaluators/common/WordTokensEvaluator.java
@@ -25,36 +25,37 @@
 import org.apache.asterix.om.types.AOrderedListType;
 import org.apache.asterix.om.types.BuiltinType;
 import org.apache.hyracks.algebricks.common.exceptions.AlgebricksException;
-import org.apache.hyracks.algebricks.runtime.base.ICopyEvaluator;
-import org.apache.hyracks.algebricks.runtime.base.ICopyEvaluatorFactory;
-import org.apache.hyracks.data.std.api.IDataOutputProvider;
+import org.apache.hyracks.algebricks.runtime.base.IScalarEvaluator;
+import org.apache.hyracks.algebricks.runtime.base.IScalarEvaluatorFactory;
+import org.apache.hyracks.api.context.IHyracksTaskContext;
+import org.apache.hyracks.data.std.api.IPointable;
+import org.apache.hyracks.data.std.primitive.VoidPointable;
 import org.apache.hyracks.data.std.util.ArrayBackedValueStorage;
 import org.apache.hyracks.dataflow.common.data.accessors.IFrameTupleReference;
 import org.apache.hyracks.storage.am.lsm.invertedindex.tokenizers.IBinaryTokenizer;
 
-public class WordTokensEvaluator implements ICopyEvaluator {
-    private final DataOutput out;
-    private final ArrayBackedValueStorage argOut = new ArrayBackedValueStorage();
-    private final ICopyEvaluator stringEval;
+public class WordTokensEvaluator implements IScalarEvaluator {
+    private final ArrayBackedValueStorage resultStorage = new ArrayBackedValueStorage();
+    private final DataOutput out = resultStorage.getDataOutput();
+    private final IPointable argPtr = new VoidPointable();
+    private final IScalarEvaluator stringEval;
 
     private final IBinaryTokenizer tokenizer;
     private final OrderedListBuilder listBuilder = new OrderedListBuilder();
     private final AOrderedListType listType;
 
-    public WordTokensEvaluator(ICopyEvaluatorFactory[] args, IDataOutputProvider output, IBinaryTokenizer tokenizer,
+    public WordTokensEvaluator(IScalarEvaluatorFactory[] args, IHyracksTaskContext context, IBinaryTokenizer tokenizer,
             BuiltinType itemType) throws AlgebricksException {
-        out = output.getDataOutput();
-        stringEval = args[0].createEvaluator(argOut);
+        stringEval = args[0].createScalarEvaluator(context);
         this.tokenizer = tokenizer;
         this.listType = new AOrderedListType(itemType, null);
     }
 
     @Override
-    public void evaluate(IFrameTupleReference tuple) throws AlgebricksException {
-        argOut.reset();
-        stringEval.evaluate(tuple);
-        byte[] bytes = argOut.getByteArray();
-        tokenizer.reset(bytes, 0, argOut.getLength());
+    public void evaluate(IFrameTupleReference tuple, IPointable result) throws AlgebricksException {
+        resultStorage.reset();
+        stringEval.evaluate(tuple, argPtr);
+        tokenizer.reset(argPtr.getByteArray(), argPtr.getStartOffset(), argPtr.getLength());
         try {
             listBuilder.reset(listType);
             while (tokenizer.hasNext()) {
@@ -65,5 +66,6 @@
         } catch (IOException e) {
             throw new AlgebricksException(e);
         }
+        result.set(resultStorage);
     }
 }
diff --git a/asterix-runtime/src/main/java/org/apache/asterix/runtime/evaluators/comparisons/AbstractComparisonEvaluator.java b/asterix-runtime/src/main/java/org/apache/asterix/runtime/evaluators/comparisons/AbstractComparisonEvaluator.java
index b2a91ea..b4e391f 100644
--- a/asterix-runtime/src/main/java/org/apache/asterix/runtime/evaluators/comparisons/AbstractComparisonEvaluator.java
+++ b/asterix-runtime/src/main/java/org/apache/asterix/runtime/evaluators/comparisons/AbstractComparisonEvaluator.java
@@ -44,20 +44,23 @@
 import org.apache.asterix.om.types.BuiltinType;
 import org.apache.asterix.om.types.EnumDeserializer;
 import org.apache.hyracks.algebricks.common.exceptions.AlgebricksException;
-import org.apache.hyracks.algebricks.runtime.base.ICopyEvaluator;
-import org.apache.hyracks.algebricks.runtime.base.ICopyEvaluatorFactory;
+import org.apache.hyracks.algebricks.runtime.base.IScalarEvaluator;
+import org.apache.hyracks.algebricks.runtime.base.IScalarEvaluatorFactory;
+import org.apache.hyracks.api.context.IHyracksTaskContext;
 import org.apache.hyracks.api.dataflow.value.BinaryComparatorConstant.ComparableResultCode;
 import org.apache.hyracks.api.dataflow.value.IBinaryComparator;
 import org.apache.hyracks.api.dataflow.value.ISerializerDeserializer;
 import org.apache.hyracks.api.exceptions.HyracksDataException;
 import org.apache.hyracks.data.std.accessors.PointableBinaryComparatorFactory;
+import org.apache.hyracks.data.std.api.IPointable;
 import org.apache.hyracks.data.std.primitive.ByteArrayPointable;
 import org.apache.hyracks.data.std.primitive.FloatPointable;
 import org.apache.hyracks.data.std.primitive.IntegerPointable;
+import org.apache.hyracks.data.std.primitive.VoidPointable;
 import org.apache.hyracks.data.std.util.ArrayBackedValueStorage;
 import org.apache.hyracks.dataflow.common.data.accessors.IFrameTupleReference;
 
-public abstract class AbstractComparisonEvaluator implements ICopyEvaluator {
+public abstract class AbstractComparisonEvaluator implements IScalarEvaluator {
 
     protected enum ComparisonResult {
         LESS_THAN,
@@ -66,13 +69,12 @@
         UNKNOWN
     }
 
-    ;
-
-    protected DataOutput out;
-    protected ArrayBackedValueStorage outLeft = new ArrayBackedValueStorage();
-    protected ArrayBackedValueStorage outRight = new ArrayBackedValueStorage();
-    protected ICopyEvaluator evalLeft;
-    protected ICopyEvaluator evalRight;
+    protected ArrayBackedValueStorage resultStorage = new ArrayBackedValueStorage();
+    protected DataOutput out = resultStorage.getDataOutput();
+    protected IPointable outLeft = new VoidPointable();
+    protected IPointable outRight = new VoidPointable();
+    protected IScalarEvaluator evalLeft;
+    protected IScalarEvaluator evalRight;
     @SuppressWarnings("unchecked")
     protected ISerializerDeserializer<ABoolean> serde = AqlSerializerDeserializerProvider.INSTANCE
             .getSerializerDeserializer(BuiltinType.ABOOLEAN);
@@ -103,25 +105,23 @@
     protected final IBinaryComparator byteArrayComparator = new PointableBinaryComparatorFactory(
             ByteArrayPointable.FACTORY).createBinaryComparator();
 
-    public AbstractComparisonEvaluator(DataOutput out, ICopyEvaluatorFactory evalLeftFactory,
-            ICopyEvaluatorFactory evalRightFactory) throws AlgebricksException {
-        this.out = out;
-        this.evalLeft = evalLeftFactory.createEvaluator(outLeft);
-        this.evalRight = evalRightFactory.createEvaluator(outRight);
+    public AbstractComparisonEvaluator(IScalarEvaluatorFactory evalLeftFactory,
+            IScalarEvaluatorFactory evalRightFactory, IHyracksTaskContext context) throws AlgebricksException {
+        this.evalLeft = evalLeftFactory.createScalarEvaluator(context);
+        this.evalRight = evalRightFactory.createScalarEvaluator(context);
     }
 
     protected void evalInputs(IFrameTupleReference tuple) throws AlgebricksException {
-        outLeft.reset();
-        evalLeft.evaluate(tuple);
-        outRight.reset();
-        evalRight.evaluate(tuple);
+        evalLeft.evaluate(tuple, outLeft);
+        evalRight.evaluate(tuple, outRight);
     }
 
     // checks whether we can apply >, >=, <, and <= operations to the given type since
     // these operations can not be defined for certain types.
     protected void checkTotallyOrderable() throws AlgebricksException {
         if (outLeft.getLength() != 0) {
-            ATypeTag typeTag = EnumDeserializer.ATYPETAGDESERIALIZER.deserialize(outLeft.getByteArray()[0]);
+            ATypeTag typeTag = EnumDeserializer.ATYPETAGDESERIALIZER
+                    .deserialize(outLeft.getByteArray()[outLeft.getStartOffset()]);
             switch (typeTag) {
                 case DURATION:
                 case INTERVAL:
@@ -142,7 +142,8 @@
     // checks whether two types are comparable
     protected ComparableResultCode comparabilityCheck() {
         // just check TypeTags
-        return ABinaryComparator.isComparable(outLeft.getByteArray(), 0, 1, outRight.getByteArray(), 0, 1);
+        return ABinaryComparator.isComparable(outLeft.getByteArray(), outLeft.getStartOffset(), 1,
+                outRight.getByteArray(), outRight.getStartOffset(), 1);
     }
 
     protected ComparisonResult compareResults() throws AlgebricksException {
@@ -151,10 +152,15 @@
         ATypeTag typeTag1 = null;
         ATypeTag typeTag2 = null;
 
+        byte[] leftBytes = outLeft.getByteArray();
+        int leftStartOffset = outLeft.getStartOffset();
+        byte[] rightBytes = outRight.getByteArray();
+        int rightStartOffset = outRight.getStartOffset();
+
         if (outLeft.getLength() == 0) {
             isLeftNull = true;
         } else {
-            typeTag1 = EnumDeserializer.ATYPETAGDESERIALIZER.deserialize(outLeft.getByteArray()[0]);
+            typeTag1 = EnumDeserializer.ATYPETAGDESERIALIZER.deserialize(leftBytes[leftStartOffset]);
             if (typeTag1 == ATypeTag.NULL) {
                 isLeftNull = true;
             }
@@ -162,7 +168,7 @@
         if (outRight.getLength() == 0) {
             isRightNull = true;
         } else {
-            typeTag2 = EnumDeserializer.ATYPETAGDESERIALIZER.deserialize(outRight.getByteArray()[0]);
+            typeTag2 = EnumDeserializer.ATYPETAGDESERIALIZER.deserialize(rightBytes[rightStartOffset]);
             if (typeTag2 == ATypeTag.NULL) {
                 isRightNull = true;
             }
@@ -211,58 +217,65 @@
                     "Comparison is undefined between " + expectedTypeTag + " and " + actualTypeTag + ".");
         }
         int result = 0;
+        byte[] leftBytes = outLeft.getByteArray();
+        int leftOffset = outLeft.getStartOffset() + 1;
+        int leftLen = outLeft.getLength() - 1;
+        byte[] rightBytes = outRight.getByteArray();
+        int rightOffset = outRight.getStartOffset() + 1;
+        int rightLen = outRight.getLength() - 1;
+
         try {
             switch (actualTypeTag) {
                 case YEARMONTHDURATION:
                 case TIME:
                 case DATE:
-                    result = Integer.compare(AInt32SerializerDeserializer.getInt(outLeft.getByteArray(), 1),
-                            AInt32SerializerDeserializer.getInt(outRight.getByteArray(), 1));
+                    result = Integer.compare(AInt32SerializerDeserializer.getInt(leftBytes, leftOffset),
+                            AInt32SerializerDeserializer.getInt(rightBytes, rightOffset));
                     break;
                 case DAYTIMEDURATION:
                 case DATETIME:
-                    result = Long.compare(AInt64SerializerDeserializer.getLong(outLeft.getByteArray(), 1),
-                            AInt64SerializerDeserializer.getLong(outRight.getByteArray(), 1));
+                    result = Long.compare(AInt64SerializerDeserializer.getLong(leftBytes, leftOffset),
+                            AInt64SerializerDeserializer.getLong(rightBytes, rightOffset));
                     break;
                 case CIRCLE:
-                    result = circleBinaryComp.compare(outLeft.getByteArray(), 1, outLeft.getLength() - 1,
-                            outRight.getByteArray(), 1, outRight.getLength() - 1);
+                    result = circleBinaryComp.compare(leftBytes, leftOffset, leftLen, rightBytes, rightOffset,
+                            rightLen);
                     break;
                 case LINE:
-                    result = lineBinaryComparator.compare(outLeft.getByteArray(), 1, outLeft.getLength() - 1,
-                            outRight.getByteArray(), 1, outRight.getLength() - 1);
+                    result = lineBinaryComparator.compare(leftBytes, leftOffset, leftLen, rightBytes, rightOffset,
+                            rightLen);
                     break;
                 case POINT:
-                    result = pointBinaryComparator.compare(outLeft.getByteArray(), 1, outLeft.getLength() - 1,
-                            outRight.getByteArray(), 1, outRight.getLength() - 1);
+                    result = pointBinaryComparator.compare(leftBytes, leftOffset, leftLen, rightBytes, rightOffset,
+                            rightLen);
                     break;
                 case POINT3D:
-                    result = point3DBinaryComparator.compare(outLeft.getByteArray(), 1, outLeft.getLength() - 1,
-                            outRight.getByteArray(), 1, outRight.getLength() - 1);
+                    result = point3DBinaryComparator.compare(leftBytes, leftOffset, leftLen, rightBytes, rightOffset,
+                            rightLen);
                     break;
                 case POLYGON:
-                    result = polygonBinaryComparator.compare(outLeft.getByteArray(), 1, outLeft.getLength() - 1,
-                            outRight.getByteArray(), 1, outRight.getLength() - 1);
+                    result = polygonBinaryComparator.compare(leftBytes, leftOffset, leftLen, rightBytes, rightOffset,
+                            rightLen);
                     break;
                 case DURATION:
-                    result = durationBinaryComp.compare(outLeft.getByteArray(), 1, outLeft.getLength() - 1,
-                            outRight.getByteArray(), 1, outRight.getLength() - 1);
+                    result = durationBinaryComp.compare(leftBytes, leftOffset, leftLen, rightBytes, rightOffset,
+                            rightLen);
                     break;
                 case INTERVAL:
-                    result = intervalBinaryComp.compare(outLeft.getByteArray(), 1, outLeft.getLength() - 1,
-                            outRight.getByteArray(), 1, outRight.getLength() - 1);
+                    result = intervalBinaryComp.compare(leftBytes, leftOffset, leftLen, rightBytes, rightOffset,
+                            rightLen);
                     break;
                 case RECTANGLE:
-                    result = rectangleBinaryComparator.compare(outLeft.getByteArray(), 1, outLeft.getLength() - 1,
-                            outRight.getByteArray(), 1, outRight.getLength() - 1);
+                    result = rectangleBinaryComparator.compare(leftBytes, leftOffset, leftLen, rightBytes, rightOffset,
+                            rightLen);
                     break;
                 case BINARY:
-                    result = byteArrayComparator.compare(outLeft.getByteArray(), 1, outLeft.getLength() - 1,
-                            outRight.getByteArray(), 1, outRight.getLength() - 1);
+                    result = byteArrayComparator.compare(leftBytes, leftOffset, leftLen, rightBytes, rightOffset,
+                            rightLen);
                     break;
                 case UUID:
-                    result = uuidBinaryComparator.compare(outLeft.getByteArray(), 1, outLeft.getLength() - 1,
-                            outRight.getByteArray(), 1, outRight.getLength() - 1);
+                    result = uuidBinaryComparator.compare(leftBytes, leftOffset, leftLen, rightBytes, rightOffset,
+                            rightLen);
                     break;
                 default:
                     throw new AlgebricksException("Comparison for " + actualTypeTag + " is not supported.");
@@ -281,8 +294,8 @@
 
     private ComparisonResult compareBooleanWithArg(ATypeTag typeTag2) throws AlgebricksException {
         if (typeTag2 == ATypeTag.BOOLEAN) {
-            byte b0 = outLeft.getByteArray()[1];
-            byte b1 = outRight.getByteArray()[1];
+            byte b0 = outLeft.getByteArray()[outLeft.getStartOffset() + 1];
+            byte b1 = outRight.getByteArray()[outRight.getStartOffset() + 1];
             return compareByte(b0, b1);
         }
         throw new AlgebricksException("Comparison is undefined between types ABoolean and " + typeTag2 + " .");
@@ -292,8 +305,9 @@
         if (typeTag2 == ATypeTag.STRING) {
             int result;
             try {
-                result = strBinaryComp.compare(outLeft.getByteArray(), 1, outLeft.getLength() - 1,
-                        outRight.getByteArray(), 1, outRight.getLength() - 1);
+                result = strBinaryComp.compare(outLeft.getByteArray(), outLeft.getStartOffset() + 1,
+                        outLeft.getLength() - 1, outRight.getByteArray(), outRight.getStartOffset() + 1,
+                        outRight.getLength() - 1);
             } catch (HyracksDataException e) {
                 throw new AlgebricksException(e);
             }
@@ -309,30 +323,35 @@
     }
 
     private ComparisonResult compareDoubleWithArg(ATypeTag typeTag2) throws AlgebricksException {
-        double s = ADoubleSerializerDeserializer.getDouble(outLeft.getByteArray(), 1);
+        byte[] leftBytes = outLeft.getByteArray();
+        int leftOffset = outLeft.getStartOffset() + 1;
+        byte[] rightBytes = outRight.getByteArray();
+        int rightOffset = outRight.getStartOffset() + 1;
+
+        double s = ADoubleSerializerDeserializer.getDouble(leftBytes, leftOffset);
         switch (typeTag2) {
             case INT8: {
-                byte v2 = AInt8SerializerDeserializer.getByte(outRight.getByteArray(), 1);
+                byte v2 = AInt8SerializerDeserializer.getByte(rightBytes, rightOffset);
                 return compareDouble(s, v2);
             }
             case INT16: {
-                short v2 = AInt16SerializerDeserializer.getShort(outRight.getByteArray(), 1);
+                short v2 = AInt16SerializerDeserializer.getShort(rightBytes, rightOffset);
                 return compareDouble(s, v2);
             }
             case INT32: {
-                int v2 = AInt32SerializerDeserializer.getInt(outRight.getByteArray(), 1);
+                int v2 = AInt32SerializerDeserializer.getInt(rightBytes, rightOffset);
                 return compareDouble(s, v2);
             }
             case INT64: {
-                long v2 = AInt64SerializerDeserializer.getLong(outRight.getByteArray(), 1);
+                long v2 = AInt64SerializerDeserializer.getLong(rightBytes, rightOffset);
                 return compareDouble(s, v2);
             }
             case FLOAT: {
-                float v2 = AFloatSerializerDeserializer.getFloat(outRight.getByteArray(), 1);
+                float v2 = AFloatSerializerDeserializer.getFloat(rightBytes, rightOffset);
                 return compareDouble(s, v2);
             }
             case DOUBLE: {
-                double v2 = ADoubleSerializerDeserializer.getDouble(outRight.getByteArray(), 1);
+                double v2 = ADoubleSerializerDeserializer.getDouble(rightBytes, rightOffset);
                 return compareDouble(s, v2);
             }
             default: {
@@ -342,30 +361,35 @@
     }
 
     private ComparisonResult compareFloatWithArg(ATypeTag typeTag2) throws AlgebricksException {
-        float s = FloatPointable.getFloat(outLeft.getByteArray(), 1);
+        byte[] leftBytes = outLeft.getByteArray();
+        int leftOffset = outLeft.getStartOffset() + 1;
+        byte[] rightBytes = outRight.getByteArray();
+        int rightOffset = outRight.getStartOffset() + 1;
+
+        float s = FloatPointable.getFloat(leftBytes, leftOffset);
         switch (typeTag2) {
             case INT8: {
-                byte v2 = AInt8SerializerDeserializer.getByte(outRight.getByteArray(), 1);
+                byte v2 = AInt8SerializerDeserializer.getByte(rightBytes, rightOffset);
                 return compareFloat(s, v2);
             }
             case INT16: {
-                short v2 = AInt16SerializerDeserializer.getShort(outRight.getByteArray(), 1);
+                short v2 = AInt16SerializerDeserializer.getShort(rightBytes, rightOffset);
                 return compareFloat(s, v2);
             }
             case INT32: {
-                int v2 = AInt32SerializerDeserializer.getInt(outRight.getByteArray(), 1);
+                int v2 = AInt32SerializerDeserializer.getInt(rightBytes, rightOffset);
                 return compareFloat(s, v2);
             }
             case INT64: {
-                long v2 = AInt64SerializerDeserializer.getLong(outRight.getByteArray(), 1);
+                long v2 = AInt64SerializerDeserializer.getLong(rightBytes, rightOffset);
                 return compareFloat(s, v2);
             }
             case FLOAT: {
-                float v2 = AFloatSerializerDeserializer.getFloat(outRight.getByteArray(), 1);
+                float v2 = AFloatSerializerDeserializer.getFloat(rightBytes, rightOffset);
                 return compareFloat(s, v2);
             }
             case DOUBLE: {
-                double v2 = ADoubleSerializerDeserializer.getDouble(outRight.getByteArray(), 1);
+                double v2 = ADoubleSerializerDeserializer.getDouble(rightBytes, rightOffset);
                 return compareDouble(s, v2);
             }
             default: {
@@ -375,30 +399,35 @@
     }
 
     private ComparisonResult compareInt64WithArg(ATypeTag typeTag2) throws AlgebricksException {
-        long s = AInt64SerializerDeserializer.getLong(outLeft.getByteArray(), 1);
+        byte[] leftBytes = outLeft.getByteArray();
+        int leftOffset = outLeft.getStartOffset() + 1;
+        byte[] rightBytes = outRight.getByteArray();
+        int rightOffset = outRight.getStartOffset() + 1;
+
+        long s = AInt64SerializerDeserializer.getLong(leftBytes, leftOffset);
         switch (typeTag2) {
             case INT8: {
-                byte v2 = AInt8SerializerDeserializer.getByte(outRight.getByteArray(), 1);
+                byte v2 = AInt8SerializerDeserializer.getByte(rightBytes, rightOffset);
                 return compareLong(s, v2);
             }
             case INT16: {
-                short v2 = AInt16SerializerDeserializer.getShort(outRight.getByteArray(), 1);
+                short v2 = AInt16SerializerDeserializer.getShort(rightBytes, rightOffset);
                 return compareLong(s, v2);
             }
             case INT32: {
-                int v2 = AInt32SerializerDeserializer.getInt(outRight.getByteArray(), 1);
+                int v2 = AInt32SerializerDeserializer.getInt(rightBytes, rightOffset);
                 return compareLong(s, v2);
             }
             case INT64: {
-                long v2 = AInt64SerializerDeserializer.getLong(outRight.getByteArray(), 1);
+                long v2 = AInt64SerializerDeserializer.getLong(rightBytes, rightOffset);
                 return compareLong(s, v2);
             }
             case FLOAT: {
-                float v2 = AFloatSerializerDeserializer.getFloat(outRight.getByteArray(), 1);
+                float v2 = AFloatSerializerDeserializer.getFloat(rightBytes, rightOffset);
                 return compareFloat(s, v2);
             }
             case DOUBLE: {
-                double v2 = ADoubleSerializerDeserializer.getDouble(outRight.getByteArray(), 1);
+                double v2 = ADoubleSerializerDeserializer.getDouble(rightBytes, rightOffset);
                 return compareDouble(s, v2);
             }
             default: {
@@ -408,30 +437,35 @@
     }
 
     private ComparisonResult compareInt32WithArg(ATypeTag typeTag2) throws AlgebricksException {
-        int s = IntegerPointable.getInteger(outLeft.getByteArray(), 1);
+        byte[] leftBytes = outLeft.getByteArray();
+        int leftOffset = outLeft.getStartOffset() + 1;
+        byte[] rightBytes = outRight.getByteArray();
+        int rightOffset = outRight.getStartOffset() + 1;
+
+        int s = IntegerPointable.getInteger(leftBytes, leftOffset);
         switch (typeTag2) {
             case INT8: {
-                byte v2 = AInt8SerializerDeserializer.getByte(outRight.getByteArray(), 1);
+                byte v2 = AInt8SerializerDeserializer.getByte(rightBytes, rightOffset);
                 return compareInt(s, v2);
             }
             case INT16: {
-                short v2 = AInt16SerializerDeserializer.getShort(outRight.getByteArray(), 1);
+                short v2 = AInt16SerializerDeserializer.getShort(rightBytes, rightOffset);
                 return compareInt(s, v2);
             }
             case INT32: {
-                int v2 = AInt32SerializerDeserializer.getInt(outRight.getByteArray(), 1);
+                int v2 = AInt32SerializerDeserializer.getInt(rightBytes, rightOffset);
                 return compareInt(s, v2);
             }
             case INT64: {
-                long v2 = AInt64SerializerDeserializer.getLong(outRight.getByteArray(), 1);
+                long v2 = AInt64SerializerDeserializer.getLong(rightBytes, rightOffset);
                 return compareLong(s, v2);
             }
             case FLOAT: {
-                float v2 = AFloatSerializerDeserializer.getFloat(outRight.getByteArray(), 1);
+                float v2 = AFloatSerializerDeserializer.getFloat(rightBytes, rightOffset);
                 return compareFloat(s, v2);
             }
             case DOUBLE: {
-                double v2 = ADoubleSerializerDeserializer.getDouble(outRight.getByteArray(), 1);
+                double v2 = ADoubleSerializerDeserializer.getDouble(rightBytes, rightOffset);
                 return compareDouble(s, v2);
             }
             default: {
@@ -441,30 +475,35 @@
     }
 
     private ComparisonResult compareInt16WithArg(ATypeTag typeTag2) throws AlgebricksException {
-        short s = AInt16SerializerDeserializer.getShort(outLeft.getByteArray(), 1);
+        byte[] leftBytes = outLeft.getByteArray();
+        int leftOffset = outLeft.getStartOffset() + 1;
+        byte[] rightBytes = outRight.getByteArray();
+        int rightOffset = outRight.getStartOffset() + 1;
+
+        short s = AInt16SerializerDeserializer.getShort(leftBytes, leftOffset);
         switch (typeTag2) {
             case INT8: {
-                byte v2 = AInt8SerializerDeserializer.getByte(outRight.getByteArray(), 1);
+                byte v2 = AInt8SerializerDeserializer.getByte(rightBytes, rightOffset);
                 return compareShort(s, v2);
             }
             case INT16: {
-                short v2 = AInt16SerializerDeserializer.getShort(outRight.getByteArray(), 1);
+                short v2 = AInt16SerializerDeserializer.getShort(rightBytes, rightOffset);
                 return compareShort(s, v2);
             }
             case INT32: {
-                int v2 = AInt32SerializerDeserializer.getInt(outRight.getByteArray(), 1);
+                int v2 = AInt32SerializerDeserializer.getInt(rightBytes, rightOffset);
                 return compareInt(s, v2);
             }
             case INT64: {
-                long v2 = AInt64SerializerDeserializer.getLong(outRight.getByteArray(), 1);
+                long v2 = AInt64SerializerDeserializer.getLong(rightBytes, rightOffset);
                 return compareLong(s, v2);
             }
             case FLOAT: {
-                float v2 = AFloatSerializerDeserializer.getFloat(outRight.getByteArray(), 1);
+                float v2 = AFloatSerializerDeserializer.getFloat(rightBytes, rightOffset);
                 return compareFloat(s, v2);
             }
             case DOUBLE: {
-                double v2 = ADoubleSerializerDeserializer.getDouble(outRight.getByteArray(), 1);
+                double v2 = ADoubleSerializerDeserializer.getDouble(rightBytes, rightOffset);
                 return compareDouble(s, v2);
             }
             default: {
@@ -474,30 +513,35 @@
     }
 
     private ComparisonResult compareInt8WithArg(ATypeTag typeTag2) throws AlgebricksException {
-        byte s = AInt8SerializerDeserializer.getByte(outLeft.getByteArray(), 1);
+        byte[] leftBytes = outLeft.getByteArray();
+        int leftStart = outLeft.getStartOffset() + 1;
+        byte[] rightBytes = outRight.getByteArray();
+        int rightStart = outRight.getStartOffset() + 1;
+
+        byte s = AInt8SerializerDeserializer.getByte(leftBytes, leftStart);
         switch (typeTag2) {
             case INT8: {
-                byte v2 = AInt8SerializerDeserializer.getByte(outRight.getByteArray(), 1);
+                byte v2 = AInt8SerializerDeserializer.getByte(rightBytes, rightStart);
                 return compareByte(s, v2);
             }
             case INT16: {
-                short v2 = AInt16SerializerDeserializer.getShort(outRight.getByteArray(), 1);
+                short v2 = AInt16SerializerDeserializer.getShort(rightBytes, rightStart);
                 return compareShort(s, v2);
             }
             case INT32: {
-                int v2 = AInt32SerializerDeserializer.getInt(outRight.getByteArray(), 1);
+                int v2 = AInt32SerializerDeserializer.getInt(rightBytes, rightStart);
                 return compareInt(s, v2);
             }
             case INT64: {
-                long v2 = AInt64SerializerDeserializer.getLong(outRight.getByteArray(), 1);
+                long v2 = AInt64SerializerDeserializer.getLong(rightBytes, rightStart);
                 return compareLong(s, v2);
             }
             case FLOAT: {
-                float v2 = AFloatSerializerDeserializer.getFloat(outRight.getByteArray(), 1);
+                float v2 = AFloatSerializerDeserializer.getFloat(rightBytes, rightStart);
                 return compareFloat(s, v2);
             }
             case DOUBLE: {
-                double v2 = ADoubleSerializerDeserializer.getDouble(outRight.getByteArray(), 1);
+                double v2 = ADoubleSerializerDeserializer.getDouble(rightBytes, rightStart);
                 return compareDouble(s, v2);
             }
             default: {
diff --git a/asterix-runtime/src/main/java/org/apache/asterix/runtime/evaluators/comparisons/ComparisonEvalFactory.java b/asterix-runtime/src/main/java/org/apache/asterix/runtime/evaluators/comparisons/ComparisonEvalFactory.java
index bc210c5..8c515b9 100644
--- a/asterix-runtime/src/main/java/org/apache/asterix/runtime/evaluators/comparisons/ComparisonEvalFactory.java
+++ b/asterix-runtime/src/main/java/org/apache/asterix/runtime/evaluators/comparisons/ComparisonEvalFactory.java
@@ -18,27 +18,25 @@
  */
 package org.apache.asterix.runtime.evaluators.comparisons;
 
-import java.io.DataOutput;
-
 import org.apache.asterix.om.base.ABoolean;
 import org.apache.asterix.om.base.ANull;
 import org.apache.hyracks.algebricks.common.exceptions.AlgebricksException;
 import org.apache.hyracks.algebricks.core.algebra.functions.AlgebricksBuiltinFunctions.ComparisonKind;
-import org.apache.hyracks.algebricks.runtime.base.ICopyEvaluator;
-import org.apache.hyracks.algebricks.runtime.base.ICopyEvaluatorFactory;
+import org.apache.hyracks.algebricks.runtime.base.IScalarEvaluator;
+import org.apache.hyracks.algebricks.runtime.base.IScalarEvaluatorFactory;
+import org.apache.hyracks.api.context.IHyracksTaskContext;
 import org.apache.hyracks.api.exceptions.HyracksDataException;
-import org.apache.hyracks.data.std.api.IDataOutputProvider;
+import org.apache.hyracks.data.std.api.IPointable;
 import org.apache.hyracks.dataflow.common.data.accessors.IFrameTupleReference;
 
-public class ComparisonEvalFactory implements ICopyEvaluatorFactory {
-
+public class ComparisonEvalFactory implements IScalarEvaluatorFactory {
     private static final long serialVersionUID = 1L;
 
-    private ICopyEvaluatorFactory evalLeftFactory;
-    private ICopyEvaluatorFactory evalRightFactory;
+    private IScalarEvaluatorFactory evalLeftFactory;
+    private IScalarEvaluatorFactory evalRightFactory;
     private ComparisonKind comparisonKind;
 
-    public ComparisonEvalFactory(ICopyEvaluatorFactory evalLeftFactory, ICopyEvaluatorFactory evalRightFactory,
+    public ComparisonEvalFactory(IScalarEvaluatorFactory evalLeftFactory, IScalarEvaluatorFactory evalRightFactory,
             ComparisonKind comparisonKind) {
         this.evalLeftFactory = evalLeftFactory;
         this.evalRightFactory = evalRightFactory;
@@ -46,27 +44,26 @@
     }
 
     @Override
-    public ICopyEvaluator createEvaluator(IDataOutputProvider output) throws AlgebricksException {
-        DataOutput out = output.getDataOutput();
+    public IScalarEvaluator createScalarEvaluator(IHyracksTaskContext ctx) throws AlgebricksException {
         switch (comparisonKind) {
-        // Should we do any normalization?
+            // Should we do any normalization?
             case EQ: {
-                return new EqualityComparisonEvaluator(out, evalLeftFactory, evalRightFactory);
+                return new EqualityComparisonEvaluator(evalLeftFactory, evalRightFactory, ctx);
             }
             case GE: {
-                return new GreaterThanOrEqualComparisonEvaluator(out, evalLeftFactory, evalRightFactory);
+                return new GreaterThanOrEqualComparisonEvaluator(evalLeftFactory, evalRightFactory, ctx);
             }
             case GT: {
-                return new GreaterThanComparisonEvaluator(out, evalLeftFactory, evalRightFactory);
+                return new GreaterThanComparisonEvaluator(evalLeftFactory, evalRightFactory, ctx);
             }
             case LE: {
-                return new LessThanOrEqualComparisonEvaluator(out, evalLeftFactory, evalRightFactory);
+                return new LessThanOrEqualComparisonEvaluator(evalLeftFactory, evalRightFactory, ctx);
             }
             case LT: {
-                return new LessThanComparisonEvaluator(out, evalLeftFactory, evalRightFactory);
+                return new LessThanComparisonEvaluator(evalLeftFactory, evalRightFactory, ctx);
             }
             case NEQ: {
-                return new InequalityComparisonEvaluator(out, evalLeftFactory, evalRightFactory);
+                return new InequalityComparisonEvaluator(evalLeftFactory, evalRightFactory, ctx);
             }
             default: {
                 throw new IllegalStateException();
@@ -75,21 +72,22 @@
     }
 
     static class EqualityComparisonEvaluator extends AbstractComparisonEvaluator {
-        public EqualityComparisonEvaluator(DataOutput out, ICopyEvaluatorFactory evalLeftFactory,
-                ICopyEvaluatorFactory evalRightFactory) throws AlgebricksException {
-            super(out, evalLeftFactory, evalRightFactory);
+        public EqualityComparisonEvaluator(IScalarEvaluatorFactory evalLeftFactory,
+                IScalarEvaluatorFactory evalRightFactory, IHyracksTaskContext context) throws AlgebricksException {
+            super(evalLeftFactory, evalRightFactory, context);
         }
 
         @Override
-        public void evaluate(IFrameTupleReference tuple) throws AlgebricksException {
+        public void evaluate(IFrameTupleReference tuple, IPointable result) throws AlgebricksException {
+            resultStorage.reset();
             evalInputs(tuple);
-
             // Checks whether two types are comparable
             switch (comparabilityCheck()) {
                 case UNKNOWN:
                     // result:UNKNOWN - NULL value found
                     try {
                         nullSerde.serialize(ANull.NULL, out);
+                        result.set(resultStorage);
                         return;
                     } catch (HyracksDataException e) {
                         throw new AlgebricksException(e);
@@ -117,19 +115,20 @@
                     throw new AlgebricksException(
                             "Equality Comparison cannot be processed. The return code from ComparabilityCheck is not correct.");
             }
-
+            result.set(resultStorage);
         }
 
     }
 
     static class InequalityComparisonEvaluator extends AbstractComparisonEvaluator {
-        public InequalityComparisonEvaluator(DataOutput out, ICopyEvaluatorFactory evalLeftFactory,
-                ICopyEvaluatorFactory evalRightFactory) throws AlgebricksException {
-            super(out, evalLeftFactory, evalRightFactory);
+        public InequalityComparisonEvaluator(IScalarEvaluatorFactory evalLeftFactory,
+                IScalarEvaluatorFactory evalRightFactory, IHyracksTaskContext context) throws AlgebricksException {
+            super(evalLeftFactory, evalRightFactory, context);
         }
 
         @Override
-        public void evaluate(IFrameTupleReference tuple) throws AlgebricksException {
+        public void evaluate(IFrameTupleReference tuple, IPointable result) throws AlgebricksException {
+            resultStorage.reset();
             evalInputs(tuple);
 
             // Checks whether two types are comparable
@@ -138,6 +137,7 @@
                     // result:UNKNOWN - NULL value found
                     try {
                         nullSerde.serialize(ANull.NULL, out);
+                        result.set(resultStorage);
                         return;
                     } catch (HyracksDataException e) {
                         throw new AlgebricksException(e);
@@ -165,19 +165,20 @@
                     throw new AlgebricksException(
                             "Inequality Comparison cannot be processed. The return code from ComparabilityCheck is not correct.");
             }
-
+            result.set(resultStorage);
         }
 
     }
 
     static class GreaterThanOrEqualComparisonEvaluator extends AbstractComparisonEvaluator {
-        public GreaterThanOrEqualComparisonEvaluator(DataOutput out, ICopyEvaluatorFactory evalLeftFactory,
-                ICopyEvaluatorFactory evalRightFactory) throws AlgebricksException {
-            super(out, evalLeftFactory, evalRightFactory);
+        public GreaterThanOrEqualComparisonEvaluator(IScalarEvaluatorFactory evalLeftFactory,
+                IScalarEvaluatorFactory evalRightFactory, IHyracksTaskContext context) throws AlgebricksException {
+            super(evalLeftFactory, evalRightFactory, context);
         }
 
         @Override
-        public void evaluate(IFrameTupleReference tuple) throws AlgebricksException {
+        public void evaluate(IFrameTupleReference tuple, IPointable result) throws AlgebricksException {
+            resultStorage.reset();
             evalInputs(tuple);
 
             // checks whether we can apply >, >=, <, and <= to the given type since
@@ -190,6 +191,7 @@
                     // result:UNKNOWN - NULL value found
                     try {
                         nullSerde.serialize(ANull.NULL, out);
+                        result.set(resultStorage);
                         return;
                     } catch (HyracksDataException e) {
                         throw new AlgebricksException(e);
@@ -218,19 +220,20 @@
                     throw new AlgebricksException(
                             "Inequality Comparison cannot be processed. The return code from ComparabilityCheck is not correct.");
             }
-
+            result.set(resultStorage);
         }
 
     }
 
     static class GreaterThanComparisonEvaluator extends AbstractComparisonEvaluator {
-        public GreaterThanComparisonEvaluator(DataOutput out, ICopyEvaluatorFactory evalLeftFactory,
-                ICopyEvaluatorFactory evalRightFactory) throws AlgebricksException {
-            super(out, evalLeftFactory, evalRightFactory);
+        public GreaterThanComparisonEvaluator(IScalarEvaluatorFactory evalLeftFactory,
+                IScalarEvaluatorFactory evalRightFactory, IHyracksTaskContext context) throws AlgebricksException {
+            super(evalLeftFactory, evalRightFactory, context);
         }
 
         @Override
-        public void evaluate(IFrameTupleReference tuple) throws AlgebricksException {
+        public void evaluate(IFrameTupleReference tuple, IPointable result) throws AlgebricksException {
+            resultStorage.reset();
             evalInputs(tuple);
 
             // checks whether we can apply >, >=, <, and <= to the given type since
@@ -243,6 +246,7 @@
                     // result:UNKNOWN - NULL value found
                     try {
                         nullSerde.serialize(ANull.NULL, out);
+                        result.set(resultStorage);
                         return;
                     } catch (HyracksDataException e) {
                         throw new AlgebricksException(e);
@@ -270,19 +274,20 @@
                     throw new AlgebricksException(
                             "Inequality Comparison cannot be processed. The return code from ComparabilityCheck is not correct.");
             }
-
+            result.set(resultStorage);
         }
 
     }
 
     static class LessThanOrEqualComparisonEvaluator extends AbstractComparisonEvaluator {
-        public LessThanOrEqualComparisonEvaluator(DataOutput out, ICopyEvaluatorFactory evalLeftFactory,
-                ICopyEvaluatorFactory evalRightFactory) throws AlgebricksException {
-            super(out, evalLeftFactory, evalRightFactory);
+        public LessThanOrEqualComparisonEvaluator(IScalarEvaluatorFactory evalLeftFactory,
+                IScalarEvaluatorFactory evalRightFactory, IHyracksTaskContext context) throws AlgebricksException {
+            super(evalLeftFactory, evalRightFactory, context);
         }
 
         @Override
-        public void evaluate(IFrameTupleReference tuple) throws AlgebricksException {
+        public void evaluate(IFrameTupleReference tuple, IPointable result) throws AlgebricksException {
+            resultStorage.reset();
             evalInputs(tuple);
 
             // checks whether we can apply >, >=, <, and <= to the given type since
@@ -295,6 +300,7 @@
                     // result:UNKNOWN - NULL value found
                     try {
                         nullSerde.serialize(ANull.NULL, out);
+                        result.set(resultStorage);
                         return;
                     } catch (HyracksDataException e) {
                         throw new AlgebricksException(e);
@@ -323,19 +329,20 @@
                     throw new AlgebricksException(
                             "Inequality Comparison cannot be processed. The return code from ComparabilityCheck is not correct.");
             }
-
+            result.set(resultStorage);
         }
 
     }
 
     static class LessThanComparisonEvaluator extends AbstractComparisonEvaluator {
-        public LessThanComparisonEvaluator(DataOutput out, ICopyEvaluatorFactory evalLeftFactory,
-                ICopyEvaluatorFactory evalRightFactory) throws AlgebricksException {
-            super(out, evalLeftFactory, evalRightFactory);
+        public LessThanComparisonEvaluator(IScalarEvaluatorFactory evalLeftFactory,
+                IScalarEvaluatorFactory evalRightFactory, IHyracksTaskContext context) throws AlgebricksException {
+            super(evalLeftFactory, evalRightFactory, context);
         }
 
         @Override
-        public void evaluate(IFrameTupleReference tuple) throws AlgebricksException {
+        public void evaluate(IFrameTupleReference tuple, IPointable result) throws AlgebricksException {
+            resultStorage.reset();
             evalInputs(tuple);
 
             // checks whether we can apply >, >=, <, and <= to the given type since
@@ -348,6 +355,7 @@
                     // result:UNKNOWN - NULL value found
                     try {
                         nullSerde.serialize(ANull.NULL, out);
+                        result.set(resultStorage);
                         return;
                     } catch (HyracksDataException e) {
                         throw new AlgebricksException(e);
@@ -375,7 +383,7 @@
                     throw new AlgebricksException(
                             "Inequality Comparison cannot be processed. The return code from ComparabilityCheck is not correct.");
             }
-
+            result.set(resultStorage);
         }
 
     }
diff --git a/asterix-runtime/src/main/java/org/apache/asterix/runtime/evaluators/constructors/ABinaryBase64StringConstructorDescriptor.java b/asterix-runtime/src/main/java/org/apache/asterix/runtime/evaluators/constructors/ABinaryBase64StringConstructorDescriptor.java
index a589aa7..2d1155b 100644
--- a/asterix-runtime/src/main/java/org/apache/asterix/runtime/evaluators/constructors/ABinaryBase64StringConstructorDescriptor.java
+++ b/asterix-runtime/src/main/java/org/apache/asterix/runtime/evaluators/constructors/ABinaryBase64StringConstructorDescriptor.java
@@ -24,9 +24,9 @@
 import org.apache.asterix.runtime.evaluators.base.AbstractScalarFunctionDynamicDescriptor;
 import org.apache.hyracks.algebricks.common.exceptions.AlgebricksException;
 import org.apache.hyracks.algebricks.core.algebra.functions.FunctionIdentifier;
-import org.apache.hyracks.algebricks.runtime.base.ICopyEvaluator;
-import org.apache.hyracks.algebricks.runtime.base.ICopyEvaluatorFactory;
-import org.apache.hyracks.data.std.api.IDataOutputProvider;
+import org.apache.hyracks.algebricks.runtime.base.IScalarEvaluator;
+import org.apache.hyracks.algebricks.runtime.base.IScalarEvaluatorFactory;
+import org.apache.hyracks.api.context.IHyracksTaskContext;
 import org.apache.hyracks.dataflow.common.data.parsers.ByteArrayBase64ParserFactory;
 
 public class ABinaryBase64StringConstructorDescriptor extends AbstractScalarFunctionDynamicDescriptor {
@@ -39,14 +39,15 @@
     };
 
     @Override
-    public ICopyEvaluatorFactory createEvaluatorFactory(final ICopyEvaluatorFactory[] args) throws AlgebricksException {
-        return new ICopyEvaluatorFactory() {
+    public IScalarEvaluatorFactory createEvaluatorFactory(final IScalarEvaluatorFactory[] args)
+            throws AlgebricksException {
+        return new IScalarEvaluatorFactory() {
             private static final long serialVersionUID = 1L;
 
             @Override
-            public ICopyEvaluator createEvaluator(IDataOutputProvider output) throws AlgebricksException {
-                return new ABinaryHexStringConstructorDescriptor.ABinaryConstructorEvaluator(output, args[0],
-                        ByteArrayBase64ParserFactory.INSTANCE);
+            public IScalarEvaluator createScalarEvaluator(IHyracksTaskContext ctx) throws AlgebricksException {
+                return new ABinaryHexStringConstructorDescriptor.ABinaryConstructorEvaluator(args[0],
+                        ByteArrayBase64ParserFactory.INSTANCE, ctx);
             }
         };
     }
diff --git a/asterix-runtime/src/main/java/org/apache/asterix/runtime/evaluators/constructors/ABinaryHexStringConstructorDescriptor.java b/asterix-runtime/src/main/java/org/apache/asterix/runtime/evaluators/constructors/ABinaryHexStringConstructorDescriptor.java
index 7b38f50..422f325 100644
--- a/asterix-runtime/src/main/java/org/apache/asterix/runtime/evaluators/constructors/ABinaryHexStringConstructorDescriptor.java
+++ b/asterix-runtime/src/main/java/org/apache/asterix/runtime/evaluators/constructors/ABinaryHexStringConstructorDescriptor.java
@@ -32,11 +32,13 @@
 import org.apache.asterix.runtime.evaluators.base.AbstractScalarFunctionDynamicDescriptor;
 import org.apache.hyracks.algebricks.common.exceptions.AlgebricksException;
 import org.apache.hyracks.algebricks.core.algebra.functions.FunctionIdentifier;
-import org.apache.hyracks.algebricks.runtime.base.ICopyEvaluator;
-import org.apache.hyracks.algebricks.runtime.base.ICopyEvaluatorFactory;
+import org.apache.hyracks.algebricks.runtime.base.IScalarEvaluator;
+import org.apache.hyracks.algebricks.runtime.base.IScalarEvaluatorFactory;
+import org.apache.hyracks.api.context.IHyracksTaskContext;
 import org.apache.hyracks.api.dataflow.value.ISerializerDeserializer;
-import org.apache.hyracks.data.std.api.IDataOutputProvider;
+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.data.std.util.ArrayBackedValueStorage;
 import org.apache.hyracks.dataflow.common.data.accessors.IFrameTupleReference;
 import org.apache.hyracks.dataflow.common.data.parsers.ByteArrayHexParserFactory;
@@ -53,13 +55,14 @@
     };
 
     @Override
-    public ICopyEvaluatorFactory createEvaluatorFactory(final ICopyEvaluatorFactory[] args) throws AlgebricksException {
-        return new ICopyEvaluatorFactory() {
+    public IScalarEvaluatorFactory createEvaluatorFactory(final IScalarEvaluatorFactory[] args)
+            throws AlgebricksException {
+        return new IScalarEvaluatorFactory() {
             private static final long serialVersionUID = 1L;
 
             @Override
-            public ICopyEvaluator createEvaluator(final IDataOutputProvider output) throws AlgebricksException {
-                return new ABinaryConstructorEvaluator(output, args[0], ByteArrayHexParserFactory.INSTANCE);
+            public IScalarEvaluator createScalarEvaluator(IHyracksTaskContext ctx) throws AlgebricksException {
+                return new ABinaryConstructorEvaluator(args[0], ByteArrayHexParserFactory.INSTANCE, ctx);
             }
         };
     }
@@ -69,10 +72,11 @@
         return AsterixBuiltinFunctions.BINARY_HEX_CONSTRUCTOR;
     }
 
-    static class ABinaryConstructorEvaluator implements ICopyEvaluator {
-        private DataOutput out;
-        private ArrayBackedValueStorage outInput;
-        private ICopyEvaluator eval;
+    static class ABinaryConstructorEvaluator implements IScalarEvaluator {
+        private ArrayBackedValueStorage resultStorage = new ArrayBackedValueStorage();
+        private final DataOutput out = resultStorage.getDataOutput();
+        private final IPointable inputArg = new VoidPointable();
+        private final IScalarEvaluator eval;
         private IValueParser byteArrayParser;
         private UTF8StringPointable utf8Ptr = new UTF8StringPointable();
 
@@ -80,33 +84,34 @@
         private ISerializerDeserializer<ANull> nullSerde = AqlSerializerDeserializerProvider.INSTANCE
                 .getSerializerDeserializer(BuiltinType.ANULL);
 
-        public ABinaryConstructorEvaluator(final IDataOutputProvider output, ICopyEvaluatorFactory copyEvaluatorFactory,
-                IValueParserFactory valueParserFactory) throws AlgebricksException {
-            out = output.getDataOutput();
-            outInput = new ArrayBackedValueStorage();
-            eval = copyEvaluatorFactory.createEvaluator(outInput);
+        public ABinaryConstructorEvaluator(IScalarEvaluatorFactory copyEvaluatorFactory,
+                IValueParserFactory valueParserFactory, IHyracksTaskContext context) throws AlgebricksException {
+            eval = copyEvaluatorFactory.createScalarEvaluator(context);
             byteArrayParser = valueParserFactory.createValueParser();
         }
 
         @Override
-        public void evaluate(IFrameTupleReference tuple) throws AlgebricksException {
-
+        public void evaluate(IFrameTupleReference tuple, IPointable result) throws AlgebricksException {
             try {
-                outInput.reset();
-                eval.evaluate(tuple);
-                byte[] binary = outInput.getByteArray();
+                eval.evaluate(tuple, inputArg);
+                byte[] binary = inputArg.getByteArray();
+                int startOffset = inputArg.getStartOffset();
+                int len = inputArg.getLength();
 
-                ATypeTag tt = ATypeTag.VALUE_TYPE_MAPPING[binary[0]];
+                ATypeTag tt = ATypeTag.VALUE_TYPE_MAPPING[binary[startOffset]];
                 if (tt == ATypeTag.NULL) {
+                    resultStorage.reset();
                     nullSerde.serialize(ANull.NULL, out);
+                    result.set(resultStorage);
                 } else if (tt == ATypeTag.BINARY) {
-                    out.write(outInput.getByteArray(), outInput.getStartOffset(), outInput.getLength());
+                    result.set(inputArg);
                 } else if (tt == ATypeTag.STRING) {
-                    utf8Ptr.set(outInput.getByteArray(), 1, outInput.getLength() - 1);
-
+                    resultStorage.reset();
+                    utf8Ptr.set(inputArg.getByteArray(), startOffset + 1, len - 1);
                     char[] buffer = utf8Ptr.toString().toCharArray();
                     out.write(ATypeTag.BINARY.serialize());
                     byteArrayParser.parse(buffer, 0, buffer.length, out);
+                    result.set(resultStorage);
                 } else {
                     throw new AlgebricksException("binary type of " + tt + "haven't implemented yet.");
                 }
diff --git a/asterix-runtime/src/main/java/org/apache/asterix/runtime/evaluators/constructors/ABooleanConstructorDescriptor.java b/asterix-runtime/src/main/java/org/apache/asterix/runtime/evaluators/constructors/ABooleanConstructorDescriptor.java
index c07d6f4..0f36310 100644
--- a/asterix-runtime/src/main/java/org/apache/asterix/runtime/evaluators/constructors/ABooleanConstructorDescriptor.java
+++ b/asterix-runtime/src/main/java/org/apache/asterix/runtime/evaluators/constructors/ABooleanConstructorDescriptor.java
@@ -33,11 +33,13 @@
 import org.apache.asterix.runtime.evaluators.base.AbstractScalarFunctionDynamicDescriptor;
 import org.apache.hyracks.algebricks.common.exceptions.AlgebricksException;
 import org.apache.hyracks.algebricks.core.algebra.functions.FunctionIdentifier;
-import org.apache.hyracks.algebricks.runtime.base.ICopyEvaluator;
-import org.apache.hyracks.algebricks.runtime.base.ICopyEvaluatorFactory;
+import org.apache.hyracks.algebricks.runtime.base.IScalarEvaluator;
+import org.apache.hyracks.algebricks.runtime.base.IScalarEvaluatorFactory;
+import org.apache.hyracks.api.context.IHyracksTaskContext;
 import org.apache.hyracks.api.dataflow.value.IBinaryComparator;
 import org.apache.hyracks.api.dataflow.value.ISerializerDeserializer;
-import org.apache.hyracks.data.std.api.IDataOutputProvider;
+import org.apache.hyracks.data.std.api.IPointable;
+import org.apache.hyracks.data.std.primitive.VoidPointable;
 import org.apache.hyracks.data.std.util.ArrayBackedValueStorage;
 import org.apache.hyracks.dataflow.common.data.accessors.IFrameTupleReference;
 import org.apache.hyracks.util.string.UTF8StringUtil;
@@ -52,17 +54,17 @@
     };
 
     @Override
-    public ICopyEvaluatorFactory createEvaluatorFactory(final ICopyEvaluatorFactory[] args) {
-        return new ICopyEvaluatorFactory() {
+    public IScalarEvaluatorFactory createEvaluatorFactory(final IScalarEvaluatorFactory[] args) {
+        return new IScalarEvaluatorFactory() {
             private static final long serialVersionUID = 1L;
 
             @Override
-            public ICopyEvaluator createEvaluator(final IDataOutputProvider output) throws AlgebricksException {
-                return new ICopyEvaluator() {
-
-                    private DataOutput out = output.getDataOutput();
-                    private ArrayBackedValueStorage outInput = new ArrayBackedValueStorage();
-                    private ICopyEvaluator eval = args[0].createEvaluator(outInput);
+            public IScalarEvaluator createScalarEvaluator(IHyracksTaskContext ctx) throws AlgebricksException {
+                return new IScalarEvaluator() {
+                    private ArrayBackedValueStorage resultStorage = new ArrayBackedValueStorage();
+                    private DataOutput out = resultStorage.getDataOutput();
+                    private IPointable inputArg = new VoidPointable();
+                    private IScalarEvaluator eval = args[0].createScalarEvaluator(ctx);
                     private String errorMessage = "This can not be an instance of boolean";
                     private final byte[] TRUE = UTF8StringUtil.writeStringToBytes("true");
                     private final byte[] FALSE = UTF8StringUtil.writeStringToBytes("false");
@@ -76,28 +78,34 @@
                             .getSerializerDeserializer(BuiltinType.ANULL);
 
                     @Override
-                    public void evaluate(IFrameTupleReference tuple) throws AlgebricksException {
-
+                    public void evaluate(IFrameTupleReference tuple, IPointable result) throws AlgebricksException {
                         try {
-                            outInput.reset();
-                            eval.evaluate(tuple);
-                            byte[] serString = outInput.getByteArray();
-                            if (serString[0] == ATypeTag.SERIALIZED_STRING_TYPE_TAG) {
-                                if (utf8BinaryComparator.compare(serString, 1, outInput.getLength(), TRUE, 0,
+                            resultStorage.reset();
+                            eval.evaluate(tuple, inputArg);
+                            byte[] serString = inputArg.getByteArray();
+                            int startOffset = inputArg.getStartOffset();
+                            int len = inputArg.getLength();
+
+                            if (serString[startOffset] == ATypeTag.SERIALIZED_STRING_TYPE_TAG) {
+                                if (utf8BinaryComparator.compare(serString, startOffset + 1, len - 1, TRUE, 0,
                                         TRUE.length) == 0) {
                                     booleanSerde.serialize(ABoolean.TRUE, out);
+                                    result.set(resultStorage);
                                     return;
-                                } else if (utf8BinaryComparator.compare(serString, 1, outInput.getLength(), FALSE, 0,
+                                } else if (utf8BinaryComparator.compare(serString, startOffset + 1, len - 1, FALSE, 0,
                                         FALSE.length) == 0) {
                                     booleanSerde.serialize(ABoolean.FALSE, out);
+                                    result.set(resultStorage);
                                     return;
-                                } else
+                                } else {
                                     throw new AlgebricksException(errorMessage);
-
-                            } else if (serString[0] == ATypeTag.SERIALIZED_NULL_TYPE_TAG)
+                                }
+                            } else if (serString[startOffset] == ATypeTag.SERIALIZED_NULL_TYPE_TAG) {
                                 nullSerde.serialize(ANull.NULL, out);
-                            else
+                            } else {
                                 throw new AlgebricksException(errorMessage);
+                            }
+                            result.set(resultStorage);
                         } catch (IOException e1) {
                             throw new AlgebricksException(errorMessage);
                         }
@@ -105,6 +113,7 @@
                 };
             }
         };
+
     }
 
     @Override
diff --git a/asterix-runtime/src/main/java/org/apache/asterix/runtime/evaluators/constructors/ACircleConstructorDescriptor.java b/asterix-runtime/src/main/java/org/apache/asterix/runtime/evaluators/constructors/ACircleConstructorDescriptor.java
index e91cf0d..3c9c04f 100644
--- a/asterix-runtime/src/main/java/org/apache/asterix/runtime/evaluators/constructors/ACircleConstructorDescriptor.java
+++ b/asterix-runtime/src/main/java/org/apache/asterix/runtime/evaluators/constructors/ACircleConstructorDescriptor.java
@@ -34,11 +34,13 @@
 import org.apache.asterix.runtime.evaluators.base.AbstractScalarFunctionDynamicDescriptor;
 import org.apache.hyracks.algebricks.common.exceptions.AlgebricksException;
 import org.apache.hyracks.algebricks.core.algebra.functions.FunctionIdentifier;
-import org.apache.hyracks.algebricks.runtime.base.ICopyEvaluator;
-import org.apache.hyracks.algebricks.runtime.base.ICopyEvaluatorFactory;
+import org.apache.hyracks.algebricks.runtime.base.IScalarEvaluator;
+import org.apache.hyracks.algebricks.runtime.base.IScalarEvaluatorFactory;
+import org.apache.hyracks.api.context.IHyracksTaskContext;
 import org.apache.hyracks.api.dataflow.value.ISerializerDeserializer;
-import org.apache.hyracks.data.std.api.IDataOutputProvider;
+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.data.std.util.ArrayBackedValueStorage;
 import org.apache.hyracks.dataflow.common.data.accessors.IFrameTupleReference;
 
@@ -53,20 +55,19 @@
     };
 
     @Override
-    public ICopyEvaluatorFactory createEvaluatorFactory(final ICopyEvaluatorFactory[] args) {
-        return new ICopyEvaluatorFactory() {
+    public IScalarEvaluatorFactory createEvaluatorFactory(final IScalarEvaluatorFactory[] args) {
+        return new IScalarEvaluatorFactory() {
             private static final long serialVersionUID = 1L;
 
             @Override
-            public ICopyEvaluator createEvaluator(final IDataOutputProvider output) throws AlgebricksException {
-                return new ICopyEvaluator() {
-
-                    private DataOutput out = output.getDataOutput();
-
-                    private ArrayBackedValueStorage outInput = new ArrayBackedValueStorage();
-                    private ICopyEvaluator eval = args[0].createEvaluator(outInput);
-                    private String errorMessage = "This can not be an instance of circle";
-                    private AMutablePoint aPoint = new AMutablePoint(0, 0);
+            public IScalarEvaluator createScalarEvaluator(IHyracksTaskContext ctx) throws AlgebricksException {
+                return new IScalarEvaluator() {
+                    private final ArrayBackedValueStorage resultStorage = new ArrayBackedValueStorage();
+                    private final DataOutput out = resultStorage.getDataOutput();
+                    private final IPointable inputArg = new VoidPointable();
+                    private final IScalarEvaluator eval = args[0].createScalarEvaluator(ctx);
+                    private final String errorMessage = "This can not be an instance of circle";
+                    private final AMutablePoint aPoint = new AMutablePoint(0, 0);
                     private AMutableCircle aCircle = new AMutableCircle(null, 0);
                     @SuppressWarnings("unchecked")
                     private ISerializerDeserializer<ACircle> circleSerde = AqlSerializerDeserializerProvider.INSTANCE
@@ -78,14 +79,17 @@
                     private final UTF8StringPointable utf8Ptr = new UTF8StringPointable();
 
                     @Override
-                    public void evaluate(IFrameTupleReference tuple) throws AlgebricksException {
-
+                    public void evaluate(IFrameTupleReference tuple, IPointable result) throws AlgebricksException {
                         try {
-                            outInput.reset();
-                            eval.evaluate(tuple);
-                            byte[] serString = outInput.getByteArray();
-                            if (serString[0] == ATypeTag.SERIALIZED_STRING_TYPE_TAG) {
-                                utf8Ptr.set(serString, 1, outInput.getLength() - 1);
+                            resultStorage.reset();
+                            eval.evaluate(tuple, inputArg);
+
+                            byte[] serString = inputArg.getByteArray();
+                            int offset = inputArg.getStartOffset();
+                            int len = inputArg.getLength();
+
+                            if (serString[offset] == ATypeTag.SERIALIZED_STRING_TYPE_TAG) {
+                                utf8Ptr.set(serString, offset + 1, len - 1);
                                 String s = utf8Ptr.toString();
                                 int commaIndex = s.indexOf(',');
                                 int spaceIndex = s.indexOf(' ', commaIndex + 1);
@@ -93,10 +97,12 @@
                                         Double.parseDouble(s.substring(commaIndex + 1, spaceIndex)));
                                 aCircle.setValue(aPoint, Double.parseDouble(s.substring(spaceIndex + 1, s.length())));
                                 circleSerde.serialize(aCircle, out);
-                            } else if (serString[0] == ATypeTag.SERIALIZED_NULL_TYPE_TAG)
+                            } else if (serString[offset] == ATypeTag.SERIALIZED_NULL_TYPE_TAG) {
                                 nullSerde.serialize(ANull.NULL, out);
-                            else
+                            } else {
                                 throw new AlgebricksException(errorMessage);
+                            }
+                            result.set(resultStorage);
                         } catch (IOException e1) {
                             throw new AlgebricksException(errorMessage);
                         }
@@ -104,6 +110,7 @@
                 };
             }
         };
+
     }
 
     @Override
diff --git a/asterix-runtime/src/main/java/org/apache/asterix/runtime/evaluators/constructors/ADateConstructorDescriptor.java b/asterix-runtime/src/main/java/org/apache/asterix/runtime/evaluators/constructors/ADateConstructorDescriptor.java
index 5c43f15..fcd2c00 100644
--- a/asterix-runtime/src/main/java/org/apache/asterix/runtime/evaluators/constructors/ADateConstructorDescriptor.java
+++ b/asterix-runtime/src/main/java/org/apache/asterix/runtime/evaluators/constructors/ADateConstructorDescriptor.java
@@ -35,11 +35,13 @@
 import org.apache.asterix.runtime.evaluators.base.AbstractScalarFunctionDynamicDescriptor;
 import org.apache.hyracks.algebricks.common.exceptions.AlgebricksException;
 import org.apache.hyracks.algebricks.core.algebra.functions.FunctionIdentifier;
-import org.apache.hyracks.algebricks.runtime.base.ICopyEvaluator;
-import org.apache.hyracks.algebricks.runtime.base.ICopyEvaluatorFactory;
+import org.apache.hyracks.algebricks.runtime.base.IScalarEvaluator;
+import org.apache.hyracks.algebricks.runtime.base.IScalarEvaluatorFactory;
+import org.apache.hyracks.api.context.IHyracksTaskContext;
 import org.apache.hyracks.api.dataflow.value.ISerializerDeserializer;
-import org.apache.hyracks.data.std.api.IDataOutputProvider;
+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.data.std.util.ArrayBackedValueStorage;
 import org.apache.hyracks.dataflow.common.data.accessors.IFrameTupleReference;
 
@@ -53,18 +55,18 @@
     };
 
     @Override
-    public ICopyEvaluatorFactory createEvaluatorFactory(final ICopyEvaluatorFactory[] args) {
-        return new ICopyEvaluatorFactory() {
+    public IScalarEvaluatorFactory createEvaluatorFactory(final IScalarEvaluatorFactory[] args) {
+        return new IScalarEvaluatorFactory() {
             private static final long serialVersionUID = 1L;
 
             @Override
-            public ICopyEvaluator createEvaluator(final IDataOutputProvider output) throws AlgebricksException {
-                return new ICopyEvaluator() {
+            public IScalarEvaluator createScalarEvaluator(IHyracksTaskContext ctx) throws AlgebricksException {
+                return new IScalarEvaluator() {
 
-                    private DataOutput out = output.getDataOutput();
-
-                    private ArrayBackedValueStorage outInput = new ArrayBackedValueStorage();
-                    private ICopyEvaluator eval = args[0].createEvaluator(outInput);
+                    private ArrayBackedValueStorage resultStorage = new ArrayBackedValueStorage();
+                    private DataOutput out = resultStorage.getDataOutput();
+                    private IPointable inputArg = new VoidPointable();
+                    private IScalarEvaluator eval = args[0].createScalarEvaluator(ctx);
                     private String errorMessage = "This can not be an instance of date";
                     private AMutableDate aDate = new AMutableDate(0);
                     @SuppressWarnings("unchecked")
@@ -77,15 +79,16 @@
                     private final UTF8StringPointable utf8Ptr = new UTF8StringPointable();
 
                     @Override
-                    public void evaluate(IFrameTupleReference tuple) throws AlgebricksException {
-
+                    public void evaluate(IFrameTupleReference tuple, IPointable result) throws AlgebricksException {
                         try {
-                            outInput.reset();
-                            eval.evaluate(tuple);
-                            byte[] serString = outInput.getByteArray();
-                            if (serString[0] == ATypeTag.SERIALIZED_STRING_TYPE_TAG) {
+                            resultStorage.reset();
+                            eval.evaluate(tuple, inputArg);
+                            byte[] serString = inputArg.getByteArray();
+                            int offset = inputArg.getStartOffset();
+                            int len = inputArg.getLength();
 
-                                utf8Ptr.set(serString, 1, outInput.getLength() - 1);
+                            if (serString[offset] == ATypeTag.SERIALIZED_STRING_TYPE_TAG) {
+                                utf8Ptr.set(serString, offset + 1, len - 1);
                                 int stringLength = utf8Ptr.getUTF8Length();
 
                                 // the string to be parsed should be at least 8 characters: YYYYMMDD
@@ -116,11 +119,12 @@
                                 aDate.setValue((int) (chrononTimeInMs / GregorianCalendarSystem.CHRONON_OF_DAY) - temp);
 
                                 dateSerde.serialize(aDate, out);
-                            } else if (serString[0] == ATypeTag.SERIALIZED_NULL_TYPE_TAG) {
+                            } else if (serString[offset] == ATypeTag.SERIALIZED_NULL_TYPE_TAG) {
                                 nullSerde.serialize(ANull.NULL, out);
                             } else {
                                 throw new AlgebricksException(errorMessage);
                             }
+                            result.set(resultStorage);
                         } catch (IOException e1) {
                             throw new AlgebricksException(errorMessage);
                         }
diff --git a/asterix-runtime/src/main/java/org/apache/asterix/runtime/evaluators/constructors/ADateTimeConstructorDescriptor.java b/asterix-runtime/src/main/java/org/apache/asterix/runtime/evaluators/constructors/ADateTimeConstructorDescriptor.java
index 3f6a746..722dd73 100644
--- a/asterix-runtime/src/main/java/org/apache/asterix/runtime/evaluators/constructors/ADateTimeConstructorDescriptor.java
+++ b/asterix-runtime/src/main/java/org/apache/asterix/runtime/evaluators/constructors/ADateTimeConstructorDescriptor.java
@@ -35,11 +35,13 @@
 import org.apache.asterix.runtime.evaluators.base.AbstractScalarFunctionDynamicDescriptor;
 import org.apache.hyracks.algebricks.common.exceptions.AlgebricksException;
 import org.apache.hyracks.algebricks.core.algebra.functions.FunctionIdentifier;
-import org.apache.hyracks.algebricks.runtime.base.ICopyEvaluator;
-import org.apache.hyracks.algebricks.runtime.base.ICopyEvaluatorFactory;
+import org.apache.hyracks.algebricks.runtime.base.IScalarEvaluator;
+import org.apache.hyracks.algebricks.runtime.base.IScalarEvaluatorFactory;
+import org.apache.hyracks.api.context.IHyracksTaskContext;
 import org.apache.hyracks.api.dataflow.value.ISerializerDeserializer;
-import org.apache.hyracks.data.std.api.IDataOutputProvider;
+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.data.std.util.ArrayBackedValueStorage;
 import org.apache.hyracks.dataflow.common.data.accessors.IFrameTupleReference;
 
@@ -53,18 +55,17 @@
     };
 
     @Override
-    public ICopyEvaluatorFactory createEvaluatorFactory(final ICopyEvaluatorFactory[] args) {
-        return new ICopyEvaluatorFactory() {
+    public IScalarEvaluatorFactory createEvaluatorFactory(final IScalarEvaluatorFactory[] args) {
+        return new IScalarEvaluatorFactory() {
             private static final long serialVersionUID = 1L;
 
             @Override
-            public ICopyEvaluator createEvaluator(final IDataOutputProvider output) throws AlgebricksException {
-                return new ICopyEvaluator() {
-
-                    private DataOutput out = output.getDataOutput();
-
-                    private ArrayBackedValueStorage outInput = new ArrayBackedValueStorage();
-                    private ICopyEvaluator eval = args[0].createEvaluator(outInput);
+            public IScalarEvaluator createScalarEvaluator(IHyracksTaskContext ctx) throws AlgebricksException {
+                return new IScalarEvaluator() {
+                    private ArrayBackedValueStorage resultStorage = new ArrayBackedValueStorage();
+                    private DataOutput out = resultStorage.getDataOutput();
+                    private IPointable inputArg = new VoidPointable();
+                    private IScalarEvaluator eval = args[0].createScalarEvaluator(ctx);
                     private String errorMessage = "This can not be an instance of datetime";
                     private AMutableDateTime aDateTime = new AMutableDateTime(0L);
                     @SuppressWarnings("unchecked")
@@ -76,15 +77,16 @@
                     private final UTF8StringPointable utf8Ptr = new UTF8StringPointable();
 
                     @Override
-                    public void evaluate(IFrameTupleReference tuple) throws AlgebricksException {
-
+                    public void evaluate(IFrameTupleReference tuple, IPointable result) throws AlgebricksException {
                         try {
-                            outInput.reset();
-                            eval.evaluate(tuple);
-                            byte[] serString = outInput.getByteArray();
-                            if (serString[0] == ATypeTag.SERIALIZED_STRING_TYPE_TAG) {
+                            resultStorage.reset();
+                            eval.evaluate(tuple, inputArg);
+                            byte[] serString = inputArg.getByteArray();
+                            int offset = inputArg.getStartOffset();
+                            int len = inputArg.getLength();
 
-                                utf8Ptr.set(serString, 1, outInput.getLength() - 1);
+                            if (serString[offset] == ATypeTag.SERIALIZED_STRING_TYPE_TAG) {
+                                utf8Ptr.set(serString, offset + 1, len - 1);
                                 int stringLength = utf8Ptr.getUTF8Length();
                                 int startOffset = utf8Ptr.getCharStartOffset();
                                 // the string to be parsed should be at least 14 characters: YYYYMMDDhhmmss
@@ -113,11 +115,12 @@
 
                                 aDateTime.setValue(chrononTimeInMs);
                                 datetimeSerde.serialize(aDateTime, out);
-                            } else if (serString[0] == ATypeTag.SERIALIZED_NULL_TYPE_TAG) {
+                            } else if (serString[offset] == ATypeTag.SERIALIZED_NULL_TYPE_TAG) {
                                 nullSerde.serialize(ANull.NULL, out);
                             } else {
                                 throw new AlgebricksException(errorMessage);
                             }
+                            result.set(resultStorage);
                         } catch (IOException e1) {
                             throw new AlgebricksException(errorMessage);
                         }
diff --git a/asterix-runtime/src/main/java/org/apache/asterix/runtime/evaluators/constructors/ADayTimeDurationConstructorDescriptor.java b/asterix-runtime/src/main/java/org/apache/asterix/runtime/evaluators/constructors/ADayTimeDurationConstructorDescriptor.java
index 0054848..31ceb9f 100644
--- a/asterix-runtime/src/main/java/org/apache/asterix/runtime/evaluators/constructors/ADayTimeDurationConstructorDescriptor.java
+++ b/asterix-runtime/src/main/java/org/apache/asterix/runtime/evaluators/constructors/ADayTimeDurationConstructorDescriptor.java
@@ -34,11 +34,13 @@
 import org.apache.asterix.runtime.evaluators.base.AbstractScalarFunctionDynamicDescriptor;
 import org.apache.hyracks.algebricks.common.exceptions.AlgebricksException;
 import org.apache.hyracks.algebricks.core.algebra.functions.FunctionIdentifier;
-import org.apache.hyracks.algebricks.runtime.base.ICopyEvaluator;
-import org.apache.hyracks.algebricks.runtime.base.ICopyEvaluatorFactory;
+import org.apache.hyracks.algebricks.runtime.base.IScalarEvaluator;
+import org.apache.hyracks.algebricks.runtime.base.IScalarEvaluatorFactory;
+import org.apache.hyracks.api.context.IHyracksTaskContext;
 import org.apache.hyracks.api.dataflow.value.ISerializerDeserializer;
-import org.apache.hyracks.data.std.api.IDataOutputProvider;
+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.data.std.util.ArrayBackedValueStorage;
 import org.apache.hyracks.dataflow.common.data.accessors.IFrameTupleReference;
 
@@ -54,18 +56,18 @@
     };
 
     @Override
-    public ICopyEvaluatorFactory createEvaluatorFactory(final ICopyEvaluatorFactory[] args) {
-        return new ICopyEvaluatorFactory() {
+    public IScalarEvaluatorFactory createEvaluatorFactory(final IScalarEvaluatorFactory[] args) {
+        return new IScalarEvaluatorFactory() {
             private static final long serialVersionUID = 1L;
 
             @Override
-            public ICopyEvaluator createEvaluator(final IDataOutputProvider output) throws AlgebricksException {
-                return new ICopyEvaluator() {
+            public IScalarEvaluator createScalarEvaluator(IHyracksTaskContext ctx) throws AlgebricksException {
+                return new IScalarEvaluator() {
 
-                    private DataOutput out = output.getDataOutput();
-
-                    private ArrayBackedValueStorage outInput = new ArrayBackedValueStorage();
-                    private ICopyEvaluator eval = args[0].createEvaluator(outInput);
+                    private ArrayBackedValueStorage resultStorage = new ArrayBackedValueStorage();
+                    private DataOutput out = resultStorage.getDataOutput();
+                    private IPointable inputArg = new VoidPointable();
+                    private IScalarEvaluator eval = args[0].createScalarEvaluator(ctx);
                     private String errorMessage = "This can not be an instance of day-time-duration";
                     private AMutableDayTimeDuration aDayTimeDuration = new AMutableDayTimeDuration(0);
                     @SuppressWarnings("unchecked")
@@ -77,15 +79,16 @@
                     private final UTF8StringPointable utf8Ptr = new UTF8StringPointable();
 
                     @Override
-                    public void evaluate(IFrameTupleReference tuple) throws AlgebricksException {
+                    public void evaluate(IFrameTupleReference tuple, IPointable result) throws AlgebricksException {
                         try {
-                            outInput.reset();
-                            eval.evaluate(tuple);
-                            byte[] serString = outInput.getByteArray();
+                            resultStorage.reset();
+                            eval.evaluate(tuple, inputArg);
+                            byte[] serString = inputArg.getByteArray();
+                            int offset = inputArg.getStartOffset();
+                            int len = inputArg.getLength();
 
-                            if (serString[0] == ATypeTag.SERIALIZED_STRING_TYPE_TAG) {
-
-                                utf8Ptr.set(serString, 1, outInput.getLength() - 1);
+                            if (serString[offset] == ATypeTag.SERIALIZED_STRING_TYPE_TAG) {
+                                utf8Ptr.set(serString, offset + 1, len - 1);
                                 int stringLength = utf8Ptr.getUTF8Length();
                                 int startOffset = utf8Ptr.getCharStartOffset();
 
@@ -93,11 +96,12 @@
                                         aDayTimeDuration, ADurationParseOption.DAY_TIME);
 
                                 dayTimeDurationSerde.serialize(aDayTimeDuration, out);
-                            } else if (serString[0] == ATypeTag.SERIALIZED_NULL_TYPE_TAG) {
+                            } else if (serString[offset] == ATypeTag.SERIALIZED_NULL_TYPE_TAG) {
                                 nullSerde.serialize(ANull.NULL, out);
                             } else {
                                 throw new AlgebricksException(errorMessage);
                             }
+                            result.set(resultStorage);
                         } catch (Exception e1) {
                             throw new AlgebricksException(e1);
                         }
diff --git a/asterix-runtime/src/main/java/org/apache/asterix/runtime/evaluators/constructors/ADoubleConstructorDescriptor.java b/asterix-runtime/src/main/java/org/apache/asterix/runtime/evaluators/constructors/ADoubleConstructorDescriptor.java
index 16eea9d..f2dbf20 100644
--- a/asterix-runtime/src/main/java/org/apache/asterix/runtime/evaluators/constructors/ADoubleConstructorDescriptor.java
+++ b/asterix-runtime/src/main/java/org/apache/asterix/runtime/evaluators/constructors/ADoubleConstructorDescriptor.java
@@ -34,12 +34,14 @@
 import org.apache.asterix.runtime.evaluators.base.AbstractScalarFunctionDynamicDescriptor;
 import org.apache.hyracks.algebricks.common.exceptions.AlgebricksException;
 import org.apache.hyracks.algebricks.core.algebra.functions.FunctionIdentifier;
-import org.apache.hyracks.algebricks.runtime.base.ICopyEvaluator;
-import org.apache.hyracks.algebricks.runtime.base.ICopyEvaluatorFactory;
+import org.apache.hyracks.algebricks.runtime.base.IScalarEvaluator;
+import org.apache.hyracks.algebricks.runtime.base.IScalarEvaluatorFactory;
+import org.apache.hyracks.api.context.IHyracksTaskContext;
 import org.apache.hyracks.api.dataflow.value.IBinaryComparator;
 import org.apache.hyracks.api.dataflow.value.ISerializerDeserializer;
-import org.apache.hyracks.data.std.api.IDataOutputProvider;
+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.data.std.util.ArrayBackedValueStorage;
 import org.apache.hyracks.dataflow.common.data.accessors.IFrameTupleReference;
 import org.apache.hyracks.util.string.UTF8StringUtil;
@@ -54,18 +56,17 @@
     };
 
     @Override
-    public ICopyEvaluatorFactory createEvaluatorFactory(final ICopyEvaluatorFactory[] args) {
-        return new ICopyEvaluatorFactory() {
+    public IScalarEvaluatorFactory createEvaluatorFactory(final IScalarEvaluatorFactory[] args) {
+        return new IScalarEvaluatorFactory() {
             private static final long serialVersionUID = 1L;
 
             @Override
-            public ICopyEvaluator createEvaluator(final IDataOutputProvider output) throws AlgebricksException {
-                return new ICopyEvaluator() {
-
-                    private DataOutput out = output.getDataOutput();
-
-                    private ArrayBackedValueStorage outInput = new ArrayBackedValueStorage();
-                    private ICopyEvaluator eval = args[0].createEvaluator(outInput);
+            public IScalarEvaluator createScalarEvaluator(IHyracksTaskContext ctx) throws AlgebricksException {
+                return new IScalarEvaluator() {
+                    private final ArrayBackedValueStorage resultStorage = new ArrayBackedValueStorage();
+                    private final DataOutput out = resultStorage.getDataOutput();
+                    private final IPointable inputArg = new VoidPointable();
+                    private IScalarEvaluator eval = args[0].createScalarEvaluator(ctx);
                     private String errorMessage = "This can not be an instance of double";
                     private final byte[] POSITIVE_INF = UTF8StringUtil.writeStringToBytes("INF");
                     private final byte[] NEGATIVE_INF = UTF8StringUtil.writeStringToBytes("-INF");
@@ -83,32 +84,35 @@
                     private final UTF8StringPointable utf8Ptr = new UTF8StringPointable();
 
                     @Override
-                    public void evaluate(IFrameTupleReference tuple) throws AlgebricksException {
-
+                    public void evaluate(IFrameTupleReference tuple, IPointable result) throws AlgebricksException {
                         try {
-                            outInput.reset();
-                            eval.evaluate(tuple);
-                            byte[] serString = outInput.getByteArray();
-                            if (serString[0] == ATypeTag.SERIALIZED_STRING_TYPE_TAG) {
+                            resultStorage.reset();
+                            eval.evaluate(tuple, inputArg);
+                            byte[] serString = inputArg.getByteArray();
+                            int offset = inputArg.getStartOffset();
+                            int len = inputArg.getLength();
 
-                                if (utf8BinaryComparator.compare(serString, 1, outInput.getLength(), POSITIVE_INF, 0,
+                            if (serString[offset] == ATypeTag.SERIALIZED_STRING_TYPE_TAG) {
+                                if (utf8BinaryComparator.compare(serString, offset + 1, len - 1, POSITIVE_INF, 0,
                                         5) == 0) {
                                     aDouble.setValue(Double.POSITIVE_INFINITY);
-                                } else if (utf8BinaryComparator.compare(serString, 1, outInput.getLength(),
-                                        NEGATIVE_INF, 0, 6) == 0) {
+                                } else if (utf8BinaryComparator.compare(serString, offset + 1, len - 1, NEGATIVE_INF, 0,
+                                        6) == 0) {
                                     aDouble.setValue(Double.NEGATIVE_INFINITY);
-                                } else if (utf8BinaryComparator.compare(serString, 1, outInput.getLength(), NAN, 0,
+                                } else if (utf8BinaryComparator.compare(serString, offset + 1, len - 1, NAN, 0,
                                         5) == 0) {
                                     aDouble.setValue(Double.NaN);
                                 } else {
-                                    utf8Ptr.set(serString, 1, outInput.getLength() - 1);
+                                    utf8Ptr.set(serString, offset + 1, len - 1);
                                     aDouble.setValue(Double.parseDouble(utf8Ptr.toString()));
                                 }
                                 doubleSerde.serialize(aDouble, out);
-                            } else if (serString[0] == ATypeTag.SERIALIZED_NULL_TYPE_TAG)
+                            } else if (serString[offset] == ATypeTag.SERIALIZED_NULL_TYPE_TAG) {
                                 nullSerde.serialize(ANull.NULL, out);
-                            else
+                            } else {
                                 throw new AlgebricksException(errorMessage);
+                            }
+                            result.set(resultStorage);
                         } catch (IOException e1) {
                             throw new AlgebricksException(errorMessage);
                         }
diff --git a/asterix-runtime/src/main/java/org/apache/asterix/runtime/evaluators/constructors/ADurationConstructorDescriptor.java b/asterix-runtime/src/main/java/org/apache/asterix/runtime/evaluators/constructors/ADurationConstructorDescriptor.java
index 2f95a2f..7ca7ecc 100644
--- a/asterix-runtime/src/main/java/org/apache/asterix/runtime/evaluators/constructors/ADurationConstructorDescriptor.java
+++ b/asterix-runtime/src/main/java/org/apache/asterix/runtime/evaluators/constructors/ADurationConstructorDescriptor.java
@@ -34,11 +34,13 @@
 import org.apache.asterix.runtime.evaluators.base.AbstractScalarFunctionDynamicDescriptor;
 import org.apache.hyracks.algebricks.common.exceptions.AlgebricksException;
 import org.apache.hyracks.algebricks.core.algebra.functions.FunctionIdentifier;
-import org.apache.hyracks.algebricks.runtime.base.ICopyEvaluator;
-import org.apache.hyracks.algebricks.runtime.base.ICopyEvaluatorFactory;
+import org.apache.hyracks.algebricks.runtime.base.IScalarEvaluator;
+import org.apache.hyracks.algebricks.runtime.base.IScalarEvaluatorFactory;
+import org.apache.hyracks.api.context.IHyracksTaskContext;
 import org.apache.hyracks.api.dataflow.value.ISerializerDeserializer;
-import org.apache.hyracks.data.std.api.IDataOutputProvider;
+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.data.std.util.ArrayBackedValueStorage;
 import org.apache.hyracks.dataflow.common.data.accessors.IFrameTupleReference;
 
@@ -52,18 +54,17 @@
     };
 
     @Override
-    public ICopyEvaluatorFactory createEvaluatorFactory(final ICopyEvaluatorFactory[] args) {
-        return new ICopyEvaluatorFactory() {
+    public IScalarEvaluatorFactory createEvaluatorFactory(final IScalarEvaluatorFactory[] args) {
+        return new IScalarEvaluatorFactory() {
             private static final long serialVersionUID = 1L;
 
             @Override
-            public ICopyEvaluator createEvaluator(final IDataOutputProvider output) throws AlgebricksException {
-                return new ICopyEvaluator() {
-
-                    private DataOutput out = output.getDataOutput();
-
-                    private ArrayBackedValueStorage outInput = new ArrayBackedValueStorage();
-                    private ICopyEvaluator eval = args[0].createEvaluator(outInput);
+            public IScalarEvaluator createScalarEvaluator(IHyracksTaskContext ctx) throws AlgebricksException {
+                return new IScalarEvaluator() {
+                    private ArrayBackedValueStorage resultStorage = new ArrayBackedValueStorage();
+                    private DataOutput out = resultStorage.getDataOutput();
+                    private IPointable inputArg = new VoidPointable();
+                    private IScalarEvaluator eval = args[0].createScalarEvaluator(ctx);
                     private String errorMessage = "This can not be an instance of duration";
                     private AMutableDuration aDuration = new AMutableDuration(0, 0);
                     @SuppressWarnings("unchecked")
@@ -75,27 +76,26 @@
                     private final UTF8StringPointable utf8Ptr = new UTF8StringPointable();
 
                     @Override
-                    public void evaluate(IFrameTupleReference tuple) throws AlgebricksException {
-
+                    public void evaluate(IFrameTupleReference tuple, IPointable result) throws AlgebricksException {
                         try {
-                            outInput.reset();
-                            eval.evaluate(tuple);
-                            byte[] serString = outInput.getByteArray();
+                            resultStorage.reset();
+                            eval.evaluate(tuple, inputArg);
+                            byte[] serString = inputArg.getByteArray();
+                            int offset = inputArg.getStartOffset();
+                            int len = inputArg.getLength();
 
-                            if (serString[0] == ATypeTag.SERIALIZED_STRING_TYPE_TAG) {
-
-                                utf8Ptr.set(serString, 1, outInput.getLength() - 1);
+                            if (serString[offset] == ATypeTag.SERIALIZED_STRING_TYPE_TAG) {
+                                utf8Ptr.set(serString, offset + 1, len - 1);
                                 int stringLength = utf8Ptr.getUTF8Length();
-
                                 ADurationParserFactory.parseDuration(serString, utf8Ptr.getCharStartOffset(),
                                         stringLength, aDuration, ADurationParseOption.All);
-
                                 durationSerde.serialize(aDuration, out);
-                            } else if (serString[0] == ATypeTag.SERIALIZED_NULL_TYPE_TAG) {
+                            } else if (serString[offset] == ATypeTag.SERIALIZED_NULL_TYPE_TAG) {
                                 nullSerde.serialize(ANull.NULL, out);
                             } else {
                                 throw new AlgebricksException(errorMessage);
                             }
+                            result.set(resultStorage);
                         } catch (Exception e1) {
                             throw new AlgebricksException(e1);
                         }
diff --git a/asterix-runtime/src/main/java/org/apache/asterix/runtime/evaluators/constructors/AFloatConstructorDescriptor.java b/asterix-runtime/src/main/java/org/apache/asterix/runtime/evaluators/constructors/AFloatConstructorDescriptor.java
index d5c2b8c..8e92116 100644
--- a/asterix-runtime/src/main/java/org/apache/asterix/runtime/evaluators/constructors/AFloatConstructorDescriptor.java
+++ b/asterix-runtime/src/main/java/org/apache/asterix/runtime/evaluators/constructors/AFloatConstructorDescriptor.java
@@ -34,12 +34,14 @@
 import org.apache.asterix.runtime.evaluators.base.AbstractScalarFunctionDynamicDescriptor;
 import org.apache.hyracks.algebricks.common.exceptions.AlgebricksException;
 import org.apache.hyracks.algebricks.core.algebra.functions.FunctionIdentifier;
-import org.apache.hyracks.algebricks.runtime.base.ICopyEvaluator;
-import org.apache.hyracks.algebricks.runtime.base.ICopyEvaluatorFactory;
+import org.apache.hyracks.algebricks.runtime.base.IScalarEvaluator;
+import org.apache.hyracks.algebricks.runtime.base.IScalarEvaluatorFactory;
+import org.apache.hyracks.api.context.IHyracksTaskContext;
 import org.apache.hyracks.api.dataflow.value.IBinaryComparator;
 import org.apache.hyracks.api.dataflow.value.ISerializerDeserializer;
-import org.apache.hyracks.data.std.api.IDataOutputProvider;
+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.data.std.util.ArrayBackedValueStorage;
 import org.apache.hyracks.dataflow.common.data.accessors.IFrameTupleReference;
 import org.apache.hyracks.util.string.UTF8StringUtil;
@@ -54,17 +56,17 @@
     };
 
     @Override
-    public ICopyEvaluatorFactory createEvaluatorFactory(final ICopyEvaluatorFactory[] args) {
-        return new ICopyEvaluatorFactory() {
+    public IScalarEvaluatorFactory createEvaluatorFactory(final IScalarEvaluatorFactory[] args) {
+        return new IScalarEvaluatorFactory() {
             private static final long serialVersionUID = 1L;
 
             @Override
-            public ICopyEvaluator createEvaluator(final IDataOutputProvider output) throws AlgebricksException {
-                return new ICopyEvaluator() {
-
-                    private DataOutput out = output.getDataOutput();
-                    private ArrayBackedValueStorage outInput = new ArrayBackedValueStorage();
-                    private ICopyEvaluator eval = args[0].createEvaluator(outInput);
+            public IScalarEvaluator createScalarEvaluator(IHyracksTaskContext ctx) throws AlgebricksException {
+                return new IScalarEvaluator() {
+                    private ArrayBackedValueStorage resultStorage = new ArrayBackedValueStorage();
+                    private DataOutput out = resultStorage.getDataOutput();
+                    private IPointable inputArg = new VoidPointable();
+                    private IScalarEvaluator eval = args[0].createScalarEvaluator(ctx);
                     private String errorMessage = "This can not be an instance of float";
                     private final byte[] POSITIVE_INF = UTF8StringUtil.writeStringToBytes("INF");
                     private final byte[] NEGATIVE_INF = UTF8StringUtil.writeStringToBytes("-INF");
@@ -90,131 +92,39 @@
                     private final UTF8StringPointable utf8Ptr = new UTF8StringPointable();
 
                     @Override
-                    public void evaluate(IFrameTupleReference tuple) throws AlgebricksException {
-
+                    public void evaluate(IFrameTupleReference tuple, IPointable result) throws AlgebricksException {
                         try {
-                            outInput.reset();
-                            eval.evaluate(tuple);
-                            byte[] serString = outInput.getByteArray();
-                            if (serString[0] == ATypeTag.SERIALIZED_STRING_TYPE_TAG) {
-                                if (utf8BinaryComparator.compare(serString, 1, outInput.getLength(), POSITIVE_INF, 0,
+                            resultStorage.reset();
+                            eval.evaluate(tuple, inputArg);
+                            byte[] serString = inputArg.getByteArray();
+                            int offset = inputArg.getStartOffset();
+                            int len = inputArg.getLength();
+
+                            if (serString[offset] == ATypeTag.SERIALIZED_STRING_TYPE_TAG) {
+                                if (utf8BinaryComparator.compare(serString, offset + 1, len - 1, POSITIVE_INF, 0,
                                         5) == 0) {
                                     aFloat.setValue(Float.POSITIVE_INFINITY);
-                                } else if (utf8BinaryComparator.compare(serString, 1, outInput.getLength(),
-                                        NEGATIVE_INF, 0, 6) == 0) {
+                                } else if (utf8BinaryComparator.compare(serString, offset + 1, len - 1, NEGATIVE_INF, 0,
+                                        6) == 0) {
                                     aFloat.setValue(Float.NEGATIVE_INFINITY);
-                                } else if (utf8BinaryComparator.compare(serString, 1, outInput.getLength(), NAN, 0,
+                                } else if (utf8BinaryComparator.compare(serString, offset + 1, len - 1, NAN, 0,
                                         5) == 0) {
                                     aFloat.setValue(Float.NaN);
                                 } else {
-                                    utf8Ptr.set(serString, 1, outInput.getLength() - 1);
+                                    utf8Ptr.set(serString, offset + 1, len - 1);
                                     aFloat.setValue(Float.parseFloat(utf8Ptr.toString()));
                                 }
                                 floatSerde.serialize(aFloat, out);
-
-                            } else if (serString[0] == ATypeTag.SERIALIZED_NULL_TYPE_TAG)
+                            } else if (serString[offset] == ATypeTag.SERIALIZED_NULL_TYPE_TAG) {
                                 nullSerde.serialize(ANull.NULL, out);
-                            else
+                            } else {
                                 throw new AlgebricksException(errorMessage);
+                            }
+                            result.set(resultStorage);
                         } catch (IOException e1) {
                             throw new AlgebricksException(errorMessage);
                         }
                     }
-
-                    // private float parseFloat(byte[] serString) throws
-                    // AlgebricksException {
-                    //
-                    // if (serString[offset] == '+')
-                    // offset++;
-                    // else if (serString[offset] == '-') {
-                    // offset++;
-                    // positiveInteger = false;
-                    // }
-                    //
-                    // if ((serString[offset] == '.') || (serString[offset] ==
-                    // 'e') || (serString[offset] == 'E')
-                    // || (serString[outInput.getLength() - 1] == '.')
-                    // || (serString[outInput.getLength() - 1] == 'E')
-                    // || (serString[outInput.getLength() - 1] == 'e'))
-                    // throw new AlgebricksException(errorMessage);
-                    //
-                    // for (; offset < outInput.getLength(); offset++) {
-                    // if (serString[offset] >= '0' && serString[offset] <= '9')
-                    // {
-                    // value = value * 10 + serString[offset] - '0';
-                    // } else
-                    // switch (serString[offset]) {
-                    // case '.':
-                    // if (expectingInteger) {
-                    // if (serString[offset + 1] < '0' || serString[offset + 1]
-                    // > '9')
-                    // throw new AlgebricksException(errorMessage);
-                    // expectingInteger = false;
-                    // expectingFraction = true;
-                    // integerPart = value;
-                    // value = 0;
-                    // pointIndex = offset;
-                    // eIndex = outInput.getLength();
-                    // } else
-                    // throw new AlgebricksException(errorMessage);
-                    // break;
-                    // case 'e':
-                    // case 'E':
-                    // if (expectingInteger) {
-                    // expectingInteger = false;
-                    // integerPart = value;
-                    // pointIndex = offset - 1;
-                    // eIndex = offset;
-                    // value = 0;
-                    // expectingExponent = true;
-                    // } else if (expectingFraction) {
-                    //
-                    // expectingFraction = false;
-                    // fractionPart = value;
-                    // eIndex = offset;
-                    // value = 0;
-                    // expectingExponent = true;
-                    // } else
-                    // throw new AlgebricksException();
-                    //
-                    // if (serString[offset + 1] == '+')
-                    // offset++;
-                    // else if (serString[offset + 1] == '-') {
-                    // offset++;
-                    // positiveExponent = false;
-                    // } else if (serString[offset + 1] < '0' ||
-                    // serString[offset + 1] > '9')
-                    // throw new AlgebricksException(errorMessage);
-                    // break;
-                    // default:
-                    // throw new AlgebricksException(errorMessage);
-                    // }
-                    // }
-                    //
-                    // if (expectingInteger)
-                    // integerPart = value;
-                    // else if (expectingFraction)
-                    // fractionPart = value;
-                    // else if (expectingExponent)
-                    // exponentPart = value * (positiveExponent ? 1 : -1);
-                    //
-                    // // floatValue = (float) ( integerPart + ( fractionPart *
-                    // (1.0f / Math.pow(10.0f, eIndex - pointIndex - 1))));
-                    // // floatValue *= (float) Math.pow(10.0f, exponentPart);
-                    //
-                    // floatValue = Float.parseFloat(integerPart+"."+
-                    // fractionPart+"e"+ exponentPart);
-                    //
-                    // if (integerPart != 0
-                    // && (floatValue == Float.POSITIVE_INFINITY || floatValue
-                    // == Float.NEGATIVE_INFINITY || floatValue == 0))
-                    // throw new AlgebricksException(errorMessage);
-                    //
-                    // if (floatValue > 0 && !positiveInteger)
-                    // floatValue *= -1;
-                    //
-                    // return floatValue;
-                    // }
                 };
             }
         };
diff --git a/asterix-runtime/src/main/java/org/apache/asterix/runtime/evaluators/constructors/AInt16ConstructorDescriptor.java b/asterix-runtime/src/main/java/org/apache/asterix/runtime/evaluators/constructors/AInt16ConstructorDescriptor.java
index 1919344..46bfbb2 100644
--- a/asterix-runtime/src/main/java/org/apache/asterix/runtime/evaluators/constructors/AInt16ConstructorDescriptor.java
+++ b/asterix-runtime/src/main/java/org/apache/asterix/runtime/evaluators/constructors/AInt16ConstructorDescriptor.java
@@ -33,11 +33,13 @@
 import org.apache.asterix.runtime.evaluators.base.AbstractScalarFunctionDynamicDescriptor;
 import org.apache.hyracks.algebricks.common.exceptions.AlgebricksException;
 import org.apache.hyracks.algebricks.core.algebra.functions.FunctionIdentifier;
-import org.apache.hyracks.algebricks.runtime.base.ICopyEvaluator;
-import org.apache.hyracks.algebricks.runtime.base.ICopyEvaluatorFactory;
+import org.apache.hyracks.algebricks.runtime.base.IScalarEvaluator;
+import org.apache.hyracks.algebricks.runtime.base.IScalarEvaluatorFactory;
+import org.apache.hyracks.api.context.IHyracksTaskContext;
 import org.apache.hyracks.api.dataflow.value.ISerializerDeserializer;
-import org.apache.hyracks.data.std.api.IDataOutputProvider;
+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.data.std.util.ArrayBackedValueStorage;
 import org.apache.hyracks.dataflow.common.data.accessors.IFrameTupleReference;
 
@@ -52,18 +54,17 @@
     };
 
     @Override
-    public ICopyEvaluatorFactory createEvaluatorFactory(final ICopyEvaluatorFactory[] args) {
-        return new ICopyEvaluatorFactory() {
+    public IScalarEvaluatorFactory createEvaluatorFactory(final IScalarEvaluatorFactory[] args) {
+        return new IScalarEvaluatorFactory() {
             private static final long serialVersionUID = 1L;
 
             @Override
-            public ICopyEvaluator createEvaluator(final IDataOutputProvider output) throws AlgebricksException {
-                return new ICopyEvaluator() {
-
-                    private DataOutput out = output.getDataOutput();
-
-                    private ArrayBackedValueStorage outInput = new ArrayBackedValueStorage();
-                    private ICopyEvaluator eval = args[0].createEvaluator(outInput);
+            public IScalarEvaluator createScalarEvaluator(IHyracksTaskContext ctx) throws AlgebricksException {
+                return new IScalarEvaluator() {
+                    private ArrayBackedValueStorage resultStorage = new ArrayBackedValueStorage();
+                    private DataOutput out = resultStorage.getDataOutput();
+                    private IPointable inputArg = new VoidPointable();
+                    private IScalarEvaluator eval = args[0].createScalarEvaluator(ctx);
                     private short value;
                     private int offset;
                     private boolean positive;
@@ -78,43 +79,51 @@
                     private final UTF8StringPointable utf8Ptr = new UTF8StringPointable();
 
                     @Override
-                    public void evaluate(IFrameTupleReference tuple) throws AlgebricksException {
-
+                    public void evaluate(IFrameTupleReference tuple, IPointable result) throws AlgebricksException {
                         try {
-                            outInput.reset();
-                            eval.evaluate(tuple);
-                            byte[] serString = outInput.getByteArray();
-                            if (serString[0] == ATypeTag.SERIALIZED_STRING_TYPE_TAG) {
-                                utf8Ptr.set(serString, 1, outInput.getLength() - 1);
+                            resultStorage.reset();
+                            eval.evaluate(tuple, inputArg);
+                            byte[] serString = inputArg.getByteArray();
+                            int startOffset = inputArg.getStartOffset();
+                            int len = inputArg.getLength();
+
+                            if (serString[startOffset] == ATypeTag.SERIALIZED_STRING_TYPE_TAG) {
+                                utf8Ptr.set(serString, startOffset + 1, len - 1);
                                 offset = utf8Ptr.getCharStartOffset();
                                 value = 0;
                                 positive = true;
-                                if (serString[offset] == '+')
+                                if (serString[offset] == '+') {
                                     offset++;
-                                else if (serString[offset] == '-') {
+                                } else if (serString[offset] == '-') {
                                     offset++;
                                     positive = false;
                                 }
-                                for (; offset < outInput.getLength(); offset++) {
-                                    if (serString[offset] >= '0' && serString[offset] <= '9')
+                                int end = startOffset + len;
+                                for (; offset < end; offset++) {
+                                    if (serString[offset] >= '0' && serString[offset] <= '9') {
                                         value = (short) (value * 10 + serString[offset] - '0');
-                                    else if (serString[offset] == 'i' && serString[offset + 1] == '1'
-                                            && serString[offset + 2] == '6' && offset + 3 == outInput.getLength())
+                                    } else if (serString[offset] == 'i' && serString[offset + 1] == '1'
+                                            && serString[offset + 2] == '6' && offset + 3 == end) {
                                         break;
-                                    else
+                                    } else {
                                         throw new AlgebricksException(errorMessage);
+                                    }
                                 }
-                                if (value < 0)
+                                if (value < 0) {
                                     throw new AlgebricksException(errorMessage);
-                                if (value > 0 && !positive)
+                                }
+                                if (value > 0 && !positive) {
                                     value *= -1;
+                                }
 
                                 aInt16.setValue(value);
                                 int16Serde.serialize(aInt16, out);
-                            } else if (serString[0] == ATypeTag.SERIALIZED_NULL_TYPE_TAG)
+                            } else if (serString[startOffset] == ATypeTag.SERIALIZED_NULL_TYPE_TAG) {
                                 nullSerde.serialize(ANull.NULL, out);
-                            else
+                            } else {
                                 throw new AlgebricksException(errorMessage);
+                            }
+                            result.set(resultStorage);
                         } catch (IOException e1) {
                             throw new AlgebricksException(errorMessage);
                         }
@@ -122,6 +131,7 @@
                 };
             }
         };
+
     }
 
     @Override
diff --git a/asterix-runtime/src/main/java/org/apache/asterix/runtime/evaluators/constructors/AInt32ConstructorDescriptor.java b/asterix-runtime/src/main/java/org/apache/asterix/runtime/evaluators/constructors/AInt32ConstructorDescriptor.java
index 40e1289..9a7fe94 100644
--- a/asterix-runtime/src/main/java/org/apache/asterix/runtime/evaluators/constructors/AInt32ConstructorDescriptor.java
+++ b/asterix-runtime/src/main/java/org/apache/asterix/runtime/evaluators/constructors/AInt32ConstructorDescriptor.java
@@ -33,11 +33,13 @@
 import org.apache.asterix.runtime.evaluators.base.AbstractScalarFunctionDynamicDescriptor;
 import org.apache.hyracks.algebricks.common.exceptions.AlgebricksException;
 import org.apache.hyracks.algebricks.core.algebra.functions.FunctionIdentifier;
-import org.apache.hyracks.algebricks.runtime.base.ICopyEvaluator;
-import org.apache.hyracks.algebricks.runtime.base.ICopyEvaluatorFactory;
+import org.apache.hyracks.algebricks.runtime.base.IScalarEvaluator;
+import org.apache.hyracks.algebricks.runtime.base.IScalarEvaluatorFactory;
+import org.apache.hyracks.api.context.IHyracksTaskContext;
 import org.apache.hyracks.api.dataflow.value.ISerializerDeserializer;
-import org.apache.hyracks.data.std.api.IDataOutputProvider;
+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.data.std.util.ArrayBackedValueStorage;
 import org.apache.hyracks.dataflow.common.data.accessors.IFrameTupleReference;
 
@@ -51,18 +53,18 @@
     };
 
     @Override
-    public ICopyEvaluatorFactory createEvaluatorFactory(final ICopyEvaluatorFactory[] args) {
-        return new ICopyEvaluatorFactory() {
+    public IScalarEvaluatorFactory createEvaluatorFactory(final IScalarEvaluatorFactory[] args) {
+        return new IScalarEvaluatorFactory() {
             private static final long serialVersionUID = 1L;
 
             @Override
-            public ICopyEvaluator createEvaluator(final IDataOutputProvider output) throws AlgebricksException {
-                return new ICopyEvaluator() {
+            public IScalarEvaluator createScalarEvaluator(IHyracksTaskContext ctx) throws AlgebricksException {
+                return new IScalarEvaluator() {
 
-                    private DataOutput out = output.getDataOutput();
-
-                    private ArrayBackedValueStorage outInput = new ArrayBackedValueStorage();
-                    private ICopyEvaluator eval = args[0].createEvaluator(outInput);
+                    private ArrayBackedValueStorage resultStorage = new ArrayBackedValueStorage();
+                    private DataOutput out = resultStorage.getDataOutput();
+                    private IPointable inputArg = new VoidPointable();
+                    private IScalarEvaluator eval = args[0].createScalarEvaluator(ctx);
                     private int value, offset;
                     private boolean positive;
                     private String errorMessage = "This can not be an instance of int32";
@@ -76,43 +78,51 @@
                     private final UTF8StringPointable utf8Ptr = new UTF8StringPointable();
 
                     @Override
-                    public void evaluate(IFrameTupleReference tuple) throws AlgebricksException {
-
+                    public void evaluate(IFrameTupleReference tuple, IPointable result) throws AlgebricksException {
                         try {
-                            outInput.reset();
-                            eval.evaluate(tuple);
-                            byte[] serString = outInput.getByteArray();
-                            if (serString[0] == ATypeTag.SERIALIZED_STRING_TYPE_TAG) {
-                                utf8Ptr.set(serString, 1, outInput.getLength() - 1);
+                            resultStorage.reset();
+                            eval.evaluate(tuple, inputArg);
+                            byte[] serString = inputArg.getByteArray();
+                            int startOffset = inputArg.getStartOffset();
+                            int len = inputArg.getLength();
+
+                            if (serString[startOffset] == ATypeTag.SERIALIZED_STRING_TYPE_TAG) {
+                                utf8Ptr.set(serString, startOffset + 1, len - 1);
                                 offset = utf8Ptr.getCharStartOffset();
                                 value = 0;
                                 positive = true;
-                                if (serString[offset] == '+')
+                                if (serString[offset] == '+') {
                                     offset++;
-                                else if (serString[offset] == '-') {
+                                } else if (serString[offset] == '-') {
                                     offset++;
                                     positive = false;
                                 }
-                                for (; offset < outInput.getLength(); offset++) {
-                                    if (serString[offset] >= '0' && serString[offset] <= '9')
+                                int end = startOffset + len;
+                                for (; offset < end; offset++) {
+                                    if (serString[offset] >= '0' && serString[offset] <= '9') {
                                         value = value * 10 + serString[offset] - '0';
-                                    else if (serString[offset] == 'i' && serString[offset + 1] == '3'
-                                            && serString[offset + 2] == '2' && offset + 3 == outInput.getLength())
+                                    } else if (serString[offset] == 'i' && serString[offset + 1] == '3'
+                                            && serString[offset + 2] == '2' && offset + 3 == end) {
                                         break;
-                                    else
+                                    } else {
                                         throw new AlgebricksException(errorMessage);
+                                    }
                                 }
-                                if (value < 0)
+                                if (value < 0) {
                                     throw new AlgebricksException(errorMessage);
-                                if (value > 0 && !positive)
+                                }
+                                if (value > 0 && !positive) {
                                     value *= -1;
+                                }
 
                                 aInt32.setValue(value);
                                 int32Serde.serialize(aInt32, out);
-                            } else if (serString[0] == ATypeTag.SERIALIZED_NULL_TYPE_TAG)
+                            } else if (serString[offset] == ATypeTag.SERIALIZED_NULL_TYPE_TAG) {
                                 nullSerde.serialize(ANull.NULL, out);
-                            else
+                            } else {
                                 throw new AlgebricksException(errorMessage);
+                            }
+                            result.set(resultStorage);
                         } catch (IOException e1) {
                             throw new AlgebricksException(errorMessage);
                         }
diff --git a/asterix-runtime/src/main/java/org/apache/asterix/runtime/evaluators/constructors/AInt64ConstructorDescriptor.java b/asterix-runtime/src/main/java/org/apache/asterix/runtime/evaluators/constructors/AInt64ConstructorDescriptor.java
index 2de9463..fc82129 100644
--- a/asterix-runtime/src/main/java/org/apache/asterix/runtime/evaluators/constructors/AInt64ConstructorDescriptor.java
+++ b/asterix-runtime/src/main/java/org/apache/asterix/runtime/evaluators/constructors/AInt64ConstructorDescriptor.java
@@ -33,11 +33,13 @@
 import org.apache.asterix.runtime.evaluators.base.AbstractScalarFunctionDynamicDescriptor;
 import org.apache.hyracks.algebricks.common.exceptions.AlgebricksException;
 import org.apache.hyracks.algebricks.core.algebra.functions.FunctionIdentifier;
-import org.apache.hyracks.algebricks.runtime.base.ICopyEvaluator;
-import org.apache.hyracks.algebricks.runtime.base.ICopyEvaluatorFactory;
+import org.apache.hyracks.algebricks.runtime.base.IScalarEvaluator;
+import org.apache.hyracks.algebricks.runtime.base.IScalarEvaluatorFactory;
+import org.apache.hyracks.api.context.IHyracksTaskContext;
 import org.apache.hyracks.api.dataflow.value.ISerializerDeserializer;
-import org.apache.hyracks.data.std.api.IDataOutputProvider;
+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.data.std.util.ArrayBackedValueStorage;
 import org.apache.hyracks.dataflow.common.data.accessors.IFrameTupleReference;
 
@@ -51,18 +53,18 @@
     };
 
     @Override
-    public ICopyEvaluatorFactory createEvaluatorFactory(final ICopyEvaluatorFactory[] args) {
-        return new ICopyEvaluatorFactory() {
+    public IScalarEvaluatorFactory createEvaluatorFactory(final IScalarEvaluatorFactory[] args) {
+        return new IScalarEvaluatorFactory() {
             private static final long serialVersionUID = 1L;
 
             @Override
-            public ICopyEvaluator createEvaluator(final IDataOutputProvider output) throws AlgebricksException {
-                return new ICopyEvaluator() {
+            public IScalarEvaluator createScalarEvaluator(IHyracksTaskContext ctx) throws AlgebricksException {
+                return new IScalarEvaluator() {
 
-                    private DataOutput out = output.getDataOutput();
-
-                    private ArrayBackedValueStorage outInput = new ArrayBackedValueStorage();
-                    private ICopyEvaluator eval = args[0].createEvaluator(outInput);
+                    private ArrayBackedValueStorage resultStorage = new ArrayBackedValueStorage();
+                    private DataOutput out = resultStorage.getDataOutput();
+                    private IPointable inputArg = new VoidPointable();
+                    private IScalarEvaluator eval = args[0].createScalarEvaluator(ctx);
                     private long value;
                     private int offset;
                     private boolean positive;
@@ -77,44 +79,51 @@
                     private final UTF8StringPointable utf8Ptr = new UTF8StringPointable();
 
                     @Override
-                    public void evaluate(IFrameTupleReference tuple) throws AlgebricksException {
-
+                    public void evaluate(IFrameTupleReference tuple, IPointable result) throws AlgebricksException {
                         try {
-                            outInput.reset();
-                            eval.evaluate(tuple);
-                            byte[] serString = outInput.getByteArray();
-                            if (serString[0] == ATypeTag.SERIALIZED_STRING_TYPE_TAG) {
-                                utf8Ptr.set(serString, 1, outInput.getLength() - 1);
+                            resultStorage.reset();
+                            eval.evaluate(tuple, inputArg);
+                            byte[] serString = inputArg.getByteArray();
+                            int startOffset = inputArg.getStartOffset();
+                            int len = inputArg.getLength();
+
+                            if (serString[startOffset] == ATypeTag.SERIALIZED_STRING_TYPE_TAG) {
+                                utf8Ptr.set(serString, startOffset + 1, len - 1);
                                 offset = utf8Ptr.getCharStartOffset();
                                 value = 0;
                                 positive = true;
-                                if (serString[offset] == '+')
+                                if (serString[offset] == '+') {
                                     offset++;
-                                else if (serString[offset] == '-') {
+                                } else if (serString[offset] == '-') {
                                     offset++;
                                     positive = false;
                                 }
-                                for (; offset < outInput.getLength(); offset++) {
-                                    if (serString[offset] >= '0' && serString[offset] <= '9')
+                                int end = startOffset + len;
+                                for (; offset < end; offset++) {
+                                    if (serString[offset] >= '0' && serString[offset] <= '9') {
                                         value = value * 10 + serString[offset] - '0';
-                                    else if (serString[offset] == 'i' && serString[offset + 1] == '6'
-                                            && serString[offset + 2] == '4' && offset + 3 == outInput.getLength())
+                                    } else if (serString[offset] == 'i' && serString[offset + 1] == '6'
+                                            && serString[offset + 2] == '4' && offset + 3 == end) {
                                         break;
-                                    else
+                                    } else {
                                         throw new AlgebricksException(errorMessage);
+                                    }
                                 }
                                 if (value < 0 && value != -9223372036854775808L) {
                                     throw new AlgebricksException(errorMessage);
                                 }
-                                if (value > 0 && !positive)
+                                if (value > 0 && !positive) {
                                     value *= -1;
+                                }
 
                                 aInt64.setValue(value);
                                 int64Serde.serialize(aInt64, out);
-                            } else if (serString[0] == ATypeTag.SERIALIZED_NULL_TYPE_TAG)
+                            } else if (serString[offset] == ATypeTag.SERIALIZED_NULL_TYPE_TAG) {
                                 nullSerde.serialize(ANull.NULL, out);
-                            else
+                            } else {
                                 throw new AlgebricksException(errorMessage);
+                            }
+                            result.set(resultStorage);
                         } catch (IOException e1) {
                             throw new AlgebricksException(errorMessage);
                         }
@@ -122,6 +131,7 @@
                 };
             }
         };
+
     }
 
     @Override
diff --git a/asterix-runtime/src/main/java/org/apache/asterix/runtime/evaluators/constructors/AInt8ConstructorDescriptor.java b/asterix-runtime/src/main/java/org/apache/asterix/runtime/evaluators/constructors/AInt8ConstructorDescriptor.java
index 106464b..c8adda0 100644
--- a/asterix-runtime/src/main/java/org/apache/asterix/runtime/evaluators/constructors/AInt8ConstructorDescriptor.java
+++ b/asterix-runtime/src/main/java/org/apache/asterix/runtime/evaluators/constructors/AInt8ConstructorDescriptor.java
@@ -33,11 +33,13 @@
 import org.apache.asterix.runtime.evaluators.base.AbstractScalarFunctionDynamicDescriptor;
 import org.apache.hyracks.algebricks.common.exceptions.AlgebricksException;
 import org.apache.hyracks.algebricks.core.algebra.functions.FunctionIdentifier;
-import org.apache.hyracks.algebricks.runtime.base.ICopyEvaluator;
-import org.apache.hyracks.algebricks.runtime.base.ICopyEvaluatorFactory;
+import org.apache.hyracks.algebricks.runtime.base.IScalarEvaluator;
+import org.apache.hyracks.algebricks.runtime.base.IScalarEvaluatorFactory;
+import org.apache.hyracks.api.context.IHyracksTaskContext;
 import org.apache.hyracks.api.dataflow.value.ISerializerDeserializer;
-import org.apache.hyracks.data.std.api.IDataOutputProvider;
+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.data.std.util.ArrayBackedValueStorage;
 import org.apache.hyracks.dataflow.common.data.accessors.IFrameTupleReference;
 
@@ -51,18 +53,18 @@
     };
 
     @Override
-    public ICopyEvaluatorFactory createEvaluatorFactory(final ICopyEvaluatorFactory[] args) {
-        return new ICopyEvaluatorFactory() {
+    public IScalarEvaluatorFactory createEvaluatorFactory(final IScalarEvaluatorFactory[] args) {
+        return new IScalarEvaluatorFactory() {
             private static final long serialVersionUID = 1L;
 
             @Override
-            public ICopyEvaluator createEvaluator(final IDataOutputProvider output) throws AlgebricksException {
-                return new ICopyEvaluator() {
+            public IScalarEvaluator createScalarEvaluator(IHyracksTaskContext ctx) throws AlgebricksException {
+                return new IScalarEvaluator() {
 
-                    private DataOutput out = output.getDataOutput();
-
-                    private ArrayBackedValueStorage outInput = new ArrayBackedValueStorage();
-                    private ICopyEvaluator eval = args[0].createEvaluator(outInput);
+                    private ArrayBackedValueStorage resultStorage = new ArrayBackedValueStorage();
+                    private DataOutput out = resultStorage.getDataOutput();
+                    private IPointable inputArg = new VoidPointable();
+                    private IScalarEvaluator eval = args[0].createScalarEvaluator(ctx);
                     private byte value;
                     private int offset;
                     private boolean positive;
@@ -77,43 +79,51 @@
                     private final UTF8StringPointable utf8Ptr = new UTF8StringPointable();
 
                     @Override
-                    public void evaluate(IFrameTupleReference tuple) throws AlgebricksException {
-
+                    public void evaluate(IFrameTupleReference tuple, IPointable result) throws AlgebricksException {
                         try {
-                            outInput.reset();
-                            eval.evaluate(tuple);
-                            byte[] serString = outInput.getByteArray();
-                            if (serString[0] == ATypeTag.SERIALIZED_STRING_TYPE_TAG) {
-                                utf8Ptr.set(serString, 1, outInput.getLength() - 1);
+                            resultStorage.reset();
+                            eval.evaluate(tuple, inputArg);
+                            byte[] serString = inputArg.getByteArray();
+                            int startOffset = inputArg.getStartOffset();
+                            int len = inputArg.getLength();
+
+                            if (serString[startOffset] == ATypeTag.SERIALIZED_STRING_TYPE_TAG) {
+                                utf8Ptr.set(serString, startOffset + 1, len - 1);
                                 offset = utf8Ptr.getCharStartOffset();
                                 value = 0;
                                 positive = true;
-                                if (serString[offset] == '+')
+                                if (serString[offset] == '+') {
                                     offset++;
-                                else if (serString[offset] == '-') {
+                                } else if (serString[offset] == '-') {
                                     offset++;
                                     positive = false;
                                 }
-                                for (; offset < outInput.getLength(); offset++) {
-                                    if (serString[offset] >= '0' && serString[offset] <= '9')
+                                int end = startOffset + len;
+                                for (; offset < end; offset++) {
+                                    if (serString[offset] >= '0' && serString[offset] <= '9') {
                                         value = (byte) (value * 10 + serString[offset] - '0');
-                                    else if (serString[offset] == 'i' && serString[offset + 1] == '8'
-                                            && offset + 2 == outInput.getLength())
+                                    } else if (serString[offset] == 'i' && serString[offset + 1] == '8'
+                                            && offset + 2 == end) {
                                         break;
-                                    else
+                                    } else {
                                         throw new AlgebricksException(errorMessage);
+                                    }
                                 }
-                                if (value < 0)
+                                if (value < 0) {
                                     throw new AlgebricksException(errorMessage);
-                                if (value > 0 && !positive)
+                                }
+                                if (value > 0 && !positive) {
                                     value *= -1;
+                                }
 
                                 aInt8.setValue(value);
                                 int8Serde.serialize(aInt8, out);
-                            } else if (serString[0] == ATypeTag.SERIALIZED_NULL_TYPE_TAG)
+                            } else if (serString[offset] == ATypeTag.SERIALIZED_NULL_TYPE_TAG) {
                                 nullSerde.serialize(ANull.NULL, out);
-                            else
+                            } else {
                                 throw new AlgebricksException(errorMessage);
+                            }
+                            result.set(resultStorage);
                         } catch (IOException e1) {
                             throw new AlgebricksException(errorMessage);
                         }
@@ -121,6 +131,7 @@
                 };
             }
         };
+
     }
 
     @Override
diff --git a/asterix-runtime/src/main/java/org/apache/asterix/runtime/evaluators/constructors/AIntervalConstructorDescriptor.java b/asterix-runtime/src/main/java/org/apache/asterix/runtime/evaluators/constructors/AIntervalConstructorDescriptor.java
index a342b70..b5b6ddf 100644
--- a/asterix-runtime/src/main/java/org/apache/asterix/runtime/evaluators/constructors/AIntervalConstructorDescriptor.java
+++ b/asterix-runtime/src/main/java/org/apache/asterix/runtime/evaluators/constructors/AIntervalConstructorDescriptor.java
@@ -37,10 +37,12 @@
 import org.apache.asterix.runtime.evaluators.base.AbstractScalarFunctionDynamicDescriptor;
 import org.apache.hyracks.algebricks.common.exceptions.AlgebricksException;
 import org.apache.hyracks.algebricks.core.algebra.functions.FunctionIdentifier;
-import org.apache.hyracks.algebricks.runtime.base.ICopyEvaluator;
-import org.apache.hyracks.algebricks.runtime.base.ICopyEvaluatorFactory;
+import org.apache.hyracks.algebricks.runtime.base.IScalarEvaluator;
+import org.apache.hyracks.algebricks.runtime.base.IScalarEvaluatorFactory;
+import org.apache.hyracks.api.context.IHyracksTaskContext;
 import org.apache.hyracks.api.dataflow.value.ISerializerDeserializer;
-import org.apache.hyracks.data.std.api.IDataOutputProvider;
+import org.apache.hyracks.data.std.api.IPointable;
+import org.apache.hyracks.data.std.primitive.VoidPointable;
 import org.apache.hyracks.data.std.util.ArrayBackedValueStorage;
 import org.apache.hyracks.dataflow.common.data.accessors.IFrameTupleReference;
 
@@ -55,19 +57,19 @@
     };
 
     @Override
-    public ICopyEvaluatorFactory createEvaluatorFactory(final ICopyEvaluatorFactory[] args) {
-        return new ICopyEvaluatorFactory() {
+    public IScalarEvaluatorFactory createEvaluatorFactory(final IScalarEvaluatorFactory[] args) {
+        return new IScalarEvaluatorFactory() {
             private static final long serialVersionUID = 1L;
 
             @Override
-            public ICopyEvaluator createEvaluator(final IDataOutputProvider output) throws AlgebricksException {
-                return new ICopyEvaluator() {
-
-                    private DataOutput out = output.getDataOutput();
-                    private ArrayBackedValueStorage argOut0 = new ArrayBackedValueStorage();
-                    private ArrayBackedValueStorage argOut1 = new ArrayBackedValueStorage();
-                    private ICopyEvaluator eval0 = args[0].createEvaluator(argOut0);
-                    private ICopyEvaluator eval1 = args[1].createEvaluator(argOut1);
+            public IScalarEvaluator createScalarEvaluator(IHyracksTaskContext ctx) throws AlgebricksException {
+                return new IScalarEvaluator() {
+                    private ArrayBackedValueStorage resultStorage = new ArrayBackedValueStorage();
+                    private DataOutput out = resultStorage.getDataOutput();
+                    private IPointable argPtr0 = new VoidPointable();
+                    private IPointable argPtr1 = new VoidPointable();
+                    private IScalarEvaluator eval0 = args[0].createScalarEvaluator(ctx);
+                    private IScalarEvaluator eval1 = args[1].createScalarEvaluator(ctx);
                     private String errorMessage = "This can not be an instance of interval (only support Date/Time/Datetime)";
                     private AMutableInterval aInterval = new AMutableInterval(0L, 0L, (byte) 0);
                     @SuppressWarnings("unchecked")
@@ -78,48 +80,46 @@
                             .getSerializerDeserializer(BuiltinType.ANULL);
 
                     @Override
-                    public void evaluate(IFrameTupleReference tuple) throws AlgebricksException {
+                    public void evaluate(IFrameTupleReference tuple, IPointable result) throws AlgebricksException {
+                        resultStorage.reset();
+                        eval0.evaluate(tuple, argPtr0);
+                        eval1.evaluate(tuple, argPtr1);
 
-                        argOut0.reset();
-                        argOut1.reset();
-                        eval0.evaluate(tuple);
-                        eval1.evaluate(tuple);
+                        byte[] bytes0 = argPtr0.getByteArray();
+                        int offset0 = argPtr0.getStartOffset();
+                        byte[] bytes1 = argPtr1.getByteArray();
+                        int offset1 = argPtr1.getStartOffset();
 
                         try {
-
-                            if (argOut0.getByteArray()[0] == ATypeTag.SERIALIZED_NULL_TYPE_TAG
-                                    || argOut1.getByteArray()[0] == ATypeTag.SERIALIZED_NULL_TYPE_TAG) {
+                            if (bytes0[offset0] == ATypeTag.SERIALIZED_NULL_TYPE_TAG
+                                    || bytes1[offset1] == ATypeTag.SERIALIZED_NULL_TYPE_TAG) {
                                 nullSerde.serialize(ANull.NULL, out);
+                                result.set(resultStorage);
                                 return;
                             }
 
-                            if (argOut0.getByteArray()[0] != argOut1.getByteArray()[0]) {
-                                throw new AlgebricksException(
-                                        FID.getName()
-                                                + ": expects both arguments to be of the same type. Either DATE/TIME/DATETIME, but got "
-                                                + EnumDeserializer.ATYPETAGDESERIALIZER.deserialize(
-                                                        argOut0.getByteArray()[0])
-                                                + " and " + EnumDeserializer.ATYPETAGDESERIALIZER
-                                                        .deserialize(argOut0.getByteArray()[1]));
+                            if (bytes0[offset0] != bytes1[offset1]) {
+                                throw new AlgebricksException(FID.getName()
+                                        + ": expects both arguments to be of the same type. Either DATE/TIME/DATETIME, but got "
+                                        + EnumDeserializer.ATYPETAGDESERIALIZER.deserialize(bytes0[offset0]) + " and "
+                                        + EnumDeserializer.ATYPETAGDESERIALIZER.deserialize(bytes1[offset1]));
                             }
 
                             long intervalStart = 0, intervalEnd = 0;
-                            ATypeTag intervalType = EnumDeserializer.ATYPETAGDESERIALIZER
-                                    .deserialize(argOut0.getByteArray()[0]);
+                            ATypeTag intervalType = EnumDeserializer.ATYPETAGDESERIALIZER.deserialize(bytes0[offset0]);
 
                             switch (intervalType) {
                                 case DATE:
-                                    intervalStart = ADateSerializerDeserializer.getChronon(argOut0.getByteArray(), 1);
-                                    intervalEnd = ADateSerializerDeserializer.getChronon(argOut1.getByteArray(), 1);
+                                    intervalStart = ADateSerializerDeserializer.getChronon(bytes0, offset0 + 1);
+                                    intervalEnd = ADateSerializerDeserializer.getChronon(bytes1, offset1 + 1);
                                     break;
                                 case TIME:
-                                    intervalStart = ATimeSerializerDeserializer.getChronon(argOut0.getByteArray(), 1);
-                                    intervalEnd = ATimeSerializerDeserializer.getChronon(argOut1.getByteArray(), 1);
+                                    intervalStart = ATimeSerializerDeserializer.getChronon(bytes0, offset0 + 1);
+                                    intervalEnd = ATimeSerializerDeserializer.getChronon(bytes1, offset1 + 1);
                                     break;
                                 case DATETIME:
-                                    intervalStart = ADateTimeSerializerDeserializer.getChronon(argOut0.getByteArray(),
-                                            1);
-                                    intervalEnd = ADateTimeSerializerDeserializer.getChronon(argOut1.getByteArray(), 1);
+                                    intervalStart = ADateTimeSerializerDeserializer.getChronon(bytes0, offset0 + 1);
+                                    intervalEnd = ADateTimeSerializerDeserializer.getChronon(bytes1, offset1 + 1);
                                     break;
                                 default:
                                     throw new AlgebricksException(
@@ -134,12 +134,12 @@
 
                             aInterval.setValue(intervalStart, intervalEnd, intervalType.serialize());
                             intervalSerde.serialize(aInterval, out);
-
                         } catch (IOException e1) {
                             throw new AlgebricksException(errorMessage);
                         } catch (Exception e2) {
                             throw new AlgebricksException(e2);
                         }
+                        result.set(resultStorage);
                     }
                 };
             }
diff --git a/asterix-runtime/src/main/java/org/apache/asterix/runtime/evaluators/constructors/AIntervalStartFromDateConstructorDescriptor.java b/asterix-runtime/src/main/java/org/apache/asterix/runtime/evaluators/constructors/AIntervalStartFromDateConstructorDescriptor.java
index 5638227..7c1096a 100644
--- a/asterix-runtime/src/main/java/org/apache/asterix/runtime/evaluators/constructors/AIntervalStartFromDateConstructorDescriptor.java
+++ b/asterix-runtime/src/main/java/org/apache/asterix/runtime/evaluators/constructors/AIntervalStartFromDateConstructorDescriptor.java
@@ -44,11 +44,13 @@
 import org.apache.asterix.runtime.evaluators.base.AbstractScalarFunctionDynamicDescriptor;
 import org.apache.hyracks.algebricks.common.exceptions.AlgebricksException;
 import org.apache.hyracks.algebricks.core.algebra.functions.FunctionIdentifier;
-import org.apache.hyracks.algebricks.runtime.base.ICopyEvaluator;
-import org.apache.hyracks.algebricks.runtime.base.ICopyEvaluatorFactory;
+import org.apache.hyracks.algebricks.runtime.base.IScalarEvaluator;
+import org.apache.hyracks.algebricks.runtime.base.IScalarEvaluatorFactory;
+import org.apache.hyracks.api.context.IHyracksTaskContext;
 import org.apache.hyracks.api.dataflow.value.ISerializerDeserializer;
-import org.apache.hyracks.data.std.api.IDataOutputProvider;
+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.data.std.util.ArrayBackedValueStorage;
 import org.apache.hyracks.dataflow.common.data.accessors.IFrameTupleReference;
 
@@ -64,20 +66,20 @@
     };
 
     @Override
-    public ICopyEvaluatorFactory createEvaluatorFactory(final ICopyEvaluatorFactory[] args) {
-        return new ICopyEvaluatorFactory() {
+    public IScalarEvaluatorFactory createEvaluatorFactory(final IScalarEvaluatorFactory[] args) {
+        return new IScalarEvaluatorFactory() {
             private static final long serialVersionUID = 1L;
 
             @Override
-            public ICopyEvaluator createEvaluator(final IDataOutputProvider output) throws AlgebricksException {
-                return new ICopyEvaluator() {
+            public IScalarEvaluator createScalarEvaluator(IHyracksTaskContext ctx) throws AlgebricksException {
+                return new IScalarEvaluator() {
 
-                    private DataOutput out = output.getDataOutput();
-
-                    private ArrayBackedValueStorage argOut0 = new ArrayBackedValueStorage();
-                    private ArrayBackedValueStorage argOut1 = new ArrayBackedValueStorage();
-                    private ICopyEvaluator eval0 = args[0].createEvaluator(argOut0);
-                    private ICopyEvaluator eval1 = args[1].createEvaluator(argOut1);
+                    private ArrayBackedValueStorage resultStorage = new ArrayBackedValueStorage();
+                    private DataOutput out = resultStorage.getDataOutput();
+                    private IPointable argPtr0 = new VoidPointable();
+                    private IPointable argPtr1 = new VoidPointable();
+                    private IScalarEvaluator eval0 = args[0].createScalarEvaluator(ctx);
+                    private IScalarEvaluator eval1 = args[1].createScalarEvaluator(ctx);
                     private String errorMessage = "This can not be an instance of interval (from Date)";
 
                     private AMutableInterval aInterval = new AMutableInterval(0L, 0L, (byte) 0);
@@ -91,66 +93,66 @@
                     private final UTF8StringPointable utf8Ptr = new UTF8StringPointable();
 
                     @Override
-                    public void evaluate(IFrameTupleReference tuple) throws AlgebricksException {
+                    public void evaluate(IFrameTupleReference tuple, IPointable result) throws AlgebricksException {
+                        resultStorage.reset();
+                        eval0.evaluate(tuple, argPtr0);
+                        eval1.evaluate(tuple, argPtr1);
 
-                        argOut0.reset();
-                        argOut1.reset();
-                        eval0.evaluate(tuple);
-                        eval1.evaluate(tuple);
+                        byte[] bytes0 = argPtr0.getByteArray();
+                        int offset0 = argPtr0.getStartOffset();
+                        int len0 = argPtr0.getLength();
+                        byte[] bytes1 = argPtr1.getByteArray();
+                        int offset1 = argPtr1.getStartOffset();
+                        int len1 = argPtr1.getLength();
 
                         try {
-
-                            if (argOut0.getByteArray()[0] == ATypeTag.SERIALIZED_NULL_TYPE_TAG
-                                    || argOut1.getByteArray()[0] == ATypeTag.SERIALIZED_NULL_TYPE_TAG) {
+                            if (bytes0[offset0] == ATypeTag.SERIALIZED_NULL_TYPE_TAG
+                                    || bytes1[offset1] == ATypeTag.SERIALIZED_NULL_TYPE_TAG) {
                                 nullSerde.serialize(ANull.NULL, out);
+                                result.set(resultStorage);
                                 return;
                             }
 
                             long intervalStart = 0, intervalEnd = 0;
-
-                            if (argOut0.getByteArray()[0] == ATypeTag.SERIALIZED_DATE_TYPE_TAG) {
-                                intervalStart = ADateSerializerDeserializer.getChronon(argOut0.getByteArray(), 1)
+                            if (bytes0[offset0] == ATypeTag.SERIALIZED_DATE_TYPE_TAG) {
+                                intervalStart = ADateSerializerDeserializer.getChronon(bytes0, offset0 + 1)
                                         * GregorianCalendarSystem.CHRONON_OF_DAY;
-                            } else if (argOut0.getByteArray()[0] == ATypeTag.SERIALIZED_STRING_TYPE_TAG) {
-                                utf8Ptr.set(argOut0.getByteArray(), 1, argOut0.getLength() - 1);
+                            } else if (bytes0[offset0] == ATypeTag.SERIALIZED_STRING_TYPE_TAG) {
+                                utf8Ptr.set(bytes0, offset0 + 1, len0 - 1);
                                 // start date
                                 int stringLength = utf8Ptr.getUTF8Length();
                                 int startOffset = utf8Ptr.getCharStartOffset();
-                                intervalStart = ADateParserFactory.parseDatePart(argOut0.getByteArray(), startOffset,
-                                        stringLength);
+                                intervalStart = ADateParserFactory.parseDatePart(bytes0, startOffset, stringLength);
                             } else {
-                                throw new AlgebricksException(FID.getName()
-                                        + ": expects NULL/STRING/DATE for the first argument, but got "
-                                        + EnumDeserializer.ATYPETAGDESERIALIZER.deserialize(argOut0.getByteArray()[0]));
+                                throw new AlgebricksException(
+                                        FID.getName() + ": expects NULL/STRING/DATE for the first argument, but got "
+                                                + EnumDeserializer.ATYPETAGDESERIALIZER.deserialize(bytes0[offset0]));
                             }
 
-                            if (argOut1.getByteArray()[0] == ATypeTag.SERIALIZED_DURATION_TYPE_TAG) {
+                            if (bytes1[offset1] == ATypeTag.SERIALIZED_DURATION_TYPE_TAG) {
                                 intervalEnd = DurationArithmeticOperations.addDuration(intervalStart,
-                                        ADurationSerializerDeserializer.getYearMonth(argOut1.getByteArray(), 1),
-                                        ADurationSerializerDeserializer.getDayTime(argOut1.getByteArray(), 1), false);
-                            } else if (argOut1.getByteArray()[0] == ATypeTag.SERIALIZED_DAY_TIME_DURATION_TYPE_TAG) {
+                                        ADurationSerializerDeserializer.getYearMonth(bytes1, offset1 + 1),
+                                        ADurationSerializerDeserializer.getDayTime(bytes1, offset1 + 1), false);
+                            } else if (bytes1[offset1] == ATypeTag.SERIALIZED_DAY_TIME_DURATION_TYPE_TAG) {
                                 intervalEnd = DurationArithmeticOperations.addDuration(intervalStart, 0,
-                                        ADayTimeDurationSerializerDeserializer.getDayTime(argOut1.getByteArray(), 1),
-                                        false);
-                            } else if (argOut1.getByteArray()[0] == ATypeTag.SERIALIZED_YEAR_MONTH_DURATION_TYPE_TAG) {
+                                        ADayTimeDurationSerializerDeserializer.getDayTime(bytes1, offset1 + 1), false);
+                            } else if (bytes1[offset1] == ATypeTag.SERIALIZED_YEAR_MONTH_DURATION_TYPE_TAG) {
                                 intervalEnd = DurationArithmeticOperations.addDuration(intervalStart,
-                                        AYearMonthDurationSerializerDeserializer.getYearMonth(argOut1.getByteArray(),
-                                                1),
-                                        0, false);
-                            } else if (argOut1.getByteArray()[0] == ATypeTag.SERIALIZED_STRING_TYPE_TAG) {
+                                        AYearMonthDurationSerializerDeserializer.getYearMonth(bytes1, offset1 + 1), 0,
+                                        false);
+                            } else if (bytes1[offset1] == ATypeTag.SERIALIZED_STRING_TYPE_TAG) {
                                 // duration
-                                utf8Ptr.set(argOut1.getByteArray(), 1, argOut1.getLength() - 1);
+                                utf8Ptr.set(bytes1, offset1 + 1, len1 - 1);
                                 int stringLength = utf8Ptr.getUTF8Length();
 
-                                ADurationParserFactory.parseDuration(argOut1.getByteArray(),
-                                        utf8Ptr.getCharStartOffset(), stringLength, aDuration,
-                                        ADurationParseOption.All);
+                                ADurationParserFactory.parseDuration(bytes1, utf8Ptr.getCharStartOffset(), stringLength,
+                                        aDuration, ADurationParseOption.All);
                                 intervalEnd = DurationArithmeticOperations.addDuration(intervalStart,
                                         aDuration.getMonths(), aDuration.getMilliseconds(), false);
                             } else {
                                 throw new AlgebricksException(FID.getName()
                                         + ": expects NULL/STRING/DURATION for the second argument, but got "
-                                        + EnumDeserializer.ATYPETAGDESERIALIZER.deserialize(argOut1.getByteArray()[0]));
+                                        + EnumDeserializer.ATYPETAGDESERIALIZER.deserialize(bytes1[offset1]));
                             }
 
                             intervalStart = GregorianCalendarSystem.getChrononInDays(intervalStart);
@@ -169,6 +171,7 @@
                         } catch (Exception e2) {
                             throw new AlgebricksException(e2);
                         }
+                        result.set(resultStorage);
                     }
                 };
             }
diff --git a/asterix-runtime/src/main/java/org/apache/asterix/runtime/evaluators/constructors/AIntervalStartFromDateTimeConstructorDescriptor.java b/asterix-runtime/src/main/java/org/apache/asterix/runtime/evaluators/constructors/AIntervalStartFromDateTimeConstructorDescriptor.java
index 3588c7c..57b507f 100644
--- a/asterix-runtime/src/main/java/org/apache/asterix/runtime/evaluators/constructors/AIntervalStartFromDateTimeConstructorDescriptor.java
+++ b/asterix-runtime/src/main/java/org/apache/asterix/runtime/evaluators/constructors/AIntervalStartFromDateTimeConstructorDescriptor.java
@@ -44,11 +44,13 @@
 import org.apache.asterix.runtime.evaluators.base.AbstractScalarFunctionDynamicDescriptor;
 import org.apache.hyracks.algebricks.common.exceptions.AlgebricksException;
 import org.apache.hyracks.algebricks.core.algebra.functions.FunctionIdentifier;
-import org.apache.hyracks.algebricks.runtime.base.ICopyEvaluator;
-import org.apache.hyracks.algebricks.runtime.base.ICopyEvaluatorFactory;
+import org.apache.hyracks.algebricks.runtime.base.IScalarEvaluator;
+import org.apache.hyracks.algebricks.runtime.base.IScalarEvaluatorFactory;
+import org.apache.hyracks.api.context.IHyracksTaskContext;
 import org.apache.hyracks.api.dataflow.value.ISerializerDeserializer;
-import org.apache.hyracks.data.std.api.IDataOutputProvider;
+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.data.std.util.ArrayBackedValueStorage;
 import org.apache.hyracks.dataflow.common.data.accessors.IFrameTupleReference;
 
@@ -63,20 +65,19 @@
     };
 
     @Override
-    public ICopyEvaluatorFactory createEvaluatorFactory(final ICopyEvaluatorFactory[] args) {
-        return new ICopyEvaluatorFactory() {
+    public IScalarEvaluatorFactory createEvaluatorFactory(final IScalarEvaluatorFactory[] args) {
+        return new IScalarEvaluatorFactory() {
             private static final long serialVersionUID = 1L;
 
             @Override
-            public ICopyEvaluator createEvaluator(final IDataOutputProvider output) throws AlgebricksException {
-                return new ICopyEvaluator() {
-
-                    private DataOutput out = output.getDataOutput();
-
-                    private ArrayBackedValueStorage argOut0 = new ArrayBackedValueStorage();
-                    private ArrayBackedValueStorage argOut1 = new ArrayBackedValueStorage();
-                    private ICopyEvaluator eval0 = args[0].createEvaluator(argOut0);
-                    private ICopyEvaluator eval1 = args[1].createEvaluator(argOut1);
+            public IScalarEvaluator createScalarEvaluator(IHyracksTaskContext ctx) throws AlgebricksException {
+                return new IScalarEvaluator() {
+                    private ArrayBackedValueStorage resultStorage = new ArrayBackedValueStorage();
+                    private DataOutput out = resultStorage.getDataOutput();
+                    private IPointable argPtr0 = new VoidPointable();
+                    private IPointable argPtr1 = new VoidPointable();
+                    private IScalarEvaluator eval0 = args[0].createScalarEvaluator(ctx);
+                    private IScalarEvaluator eval1 = args[1].createScalarEvaluator(ctx);
                     private String errorMessage = "This can not be an instance of interval (from Date)";
 
                     private AMutableInterval aInterval = new AMutableInterval(0L, 0L, (byte) 0);
@@ -90,82 +91,78 @@
                     private final UTF8StringPointable utf8Ptr = new UTF8StringPointable();
 
                     @Override
-                    public void evaluate(IFrameTupleReference tuple) throws AlgebricksException {
+                    public void evaluate(IFrameTupleReference tuple, IPointable result) throws AlgebricksException {
+                        eval0.evaluate(tuple, argPtr0);
+                        eval1.evaluate(tuple, argPtr1);
 
-                        argOut0.reset();
-                        argOut1.reset();
-                        eval0.evaluate(tuple);
-                        eval1.evaluate(tuple);
+                        byte[] bytes0 = argPtr0.getByteArray();
+                        int offset0 = argPtr0.getStartOffset();
+                        int len0 = argPtr0.getLength();
+                        byte[] bytes1 = argPtr1.getByteArray();
+                        int offset1 = argPtr1.getStartOffset();
+                        int len1 = argPtr1.getLength();
 
                         try {
-
-                            if (argOut0.getByteArray()[0] == ATypeTag.SERIALIZED_NULL_TYPE_TAG
-                                    || argOut1.getByteArray()[0] == ATypeTag.SERIALIZED_NULL_TYPE_TAG) {
+                            if (bytes0[offset0] == ATypeTag.SERIALIZED_NULL_TYPE_TAG
+                                    || bytes1[offset1] == ATypeTag.SERIALIZED_NULL_TYPE_TAG) {
                                 nullSerde.serialize(ANull.NULL, out);
+                                result.set(resultStorage);
                                 return;
                             }
 
                             long intervalStart = 0, intervalEnd = 0;
-
-                            if (argOut0.getByteArray()[0] == ATypeTag.SERIALIZED_DATETIME_TYPE_TAG) {
-                                intervalStart = ADateTimeSerializerDeserializer.getChronon(argOut0.getByteArray(), 1);
-                            } else if (argOut0.getByteArray()[0] == ATypeTag.SERIALIZED_STRING_TYPE_TAG) {
-                                utf8Ptr.set(argOut0.getByteArray(), 1, argOut0.getLength() - 1);
+                            if (bytes0[offset0] == ATypeTag.SERIALIZED_DATETIME_TYPE_TAG) {
+                                intervalStart = ADateTimeSerializerDeserializer.getChronon(bytes0, offset0 + 1);
+                            } else if (bytes0[offset0] == ATypeTag.SERIALIZED_STRING_TYPE_TAG) {
+                                utf8Ptr.set(bytes0, offset0 + 1, len0 - 1);
 
                                 int stringLength = utf8Ptr.getUTF8Length();
                                 int startOffset = utf8Ptr.getCharStartOffset();
 
                                 // get offset for time part: +1 if it is negative (-)
-                                short timeOffset = (short) ((argOut0.getByteArray()[startOffset] == '-') ? 1 : 0);
+                                short timeOffset = (short) ((bytes0[startOffset] == '-') ? 1 : 0);
 
                                 timeOffset += 8;
 
-                                if (argOut0.getByteArray()[startOffset + timeOffset] != 'T') {
+                                if (bytes0[startOffset + timeOffset] != 'T') {
                                     timeOffset += 2;
-                                    if (argOut0.getByteArray()[startOffset + timeOffset] != 'T') {
+                                    if (argPtr0.getByteArray()[startOffset + timeOffset] != 'T') {
                                         throw new AlgebricksException(errorMessage + ": missing T");
                                     }
                                 }
 
-                                intervalStart = ADateParserFactory.parseDatePart(argOut0.getByteArray(), startOffset,
-                                        timeOffset);
-                                intervalStart += ATimeParserFactory.parseTimePart(argOut0.getByteArray(),
-                                        startOffset + timeOffset + 1, stringLength - timeOffset - 1);
+                                intervalStart = ADateParserFactory.parseDatePart(bytes0, startOffset, timeOffset);
+                                intervalStart += ATimeParserFactory.parseTimePart(bytes0, startOffset + timeOffset + 1,
+                                        stringLength - timeOffset - 1);
                             } else {
-                                throw new AlgebricksException(FID.getName()
-                                        + ": expects NULL/STRING/DATETIME for the first argument but got "
-                                        + EnumDeserializer.ATYPETAGDESERIALIZER.deserialize(argOut0.getByteArray()[0]));
+                                throw new AlgebricksException(
+                                        FID.getName() + ": expects NULL/STRING/DATETIME for the first argument but got "
+                                                + EnumDeserializer.ATYPETAGDESERIALIZER.deserialize(bytes0[offset0]));
                             }
 
-                            if (argOut1.getByteArray()[0] == ATypeTag.SERIALIZED_DURATION_TYPE_TAG) {
+                            if (bytes1[offset1] == ATypeTag.SERIALIZED_DURATION_TYPE_TAG) {
                                 intervalEnd = DurationArithmeticOperations.addDuration(intervalStart,
-                                        ADurationSerializerDeserializer.getYearMonth(argOut1.getByteArray(), 1),
-                                        ADurationSerializerDeserializer.getDayTime(argOut1.getByteArray(), 1), false);
-                            } else if (argOut1.getByteArray()[0] == ATypeTag.SERIALIZED_YEAR_MONTH_DURATION_TYPE_TAG) {
+                                        ADurationSerializerDeserializer.getYearMonth(bytes1, offset1 + 1),
+                                        ADurationSerializerDeserializer.getDayTime(bytes1, offset1 + 1), false);
+                            } else if (bytes1[offset1] == ATypeTag.SERIALIZED_YEAR_MONTH_DURATION_TYPE_TAG) {
                                 intervalEnd = DurationArithmeticOperations.addDuration(intervalStart,
-                                        AYearMonthDurationSerializerDeserializer.getYearMonth(argOut1.getByteArray(),
-                                                1),
-                                        0, false);
-                            } else if (argOut1.getByteArray()[0] == ATypeTag.SERIALIZED_DAY_TIME_DURATION_TYPE_TAG) {
-                                intervalEnd = DurationArithmeticOperations.addDuration(intervalStart, 0,
-                                        ADayTimeDurationSerializerDeserializer.getDayTime(argOut1.getByteArray(), 1),
+                                        AYearMonthDurationSerializerDeserializer.getYearMonth(bytes1, offset1 + 1), 0,
                                         false);
-                            } else if (argOut1.getByteArray()[0] == ATypeTag.SERIALIZED_STRING_TYPE_TAG) {
-
+                            } else if (bytes1[offset1] == ATypeTag.SERIALIZED_DAY_TIME_DURATION_TYPE_TAG) {
+                                intervalEnd = DurationArithmeticOperations.addDuration(intervalStart, 0,
+                                        ADayTimeDurationSerializerDeserializer.getDayTime(bytes1, offset1 + 1), false);
+                            } else if (bytes1[offset1] == ATypeTag.SERIALIZED_STRING_TYPE_TAG) {
                                 // duration
-                                utf8Ptr.set(argOut1.getByteArray(), 1, argOut1.getLength() - 1);
+                                utf8Ptr.set(bytes1, offset1 + 1, len1 - 1);
                                 int stringLength = utf8Ptr.getUTF8Length();
-
-                                ADurationParserFactory.parseDuration(argOut1.getByteArray(),
-                                        utf8Ptr.getCharStartOffset(), stringLength, aDuration,
-                                        ADurationParseOption.All);
-
+                                ADurationParserFactory.parseDuration(bytes1, utf8Ptr.getCharStartOffset(), stringLength,
+                                        aDuration, ADurationParseOption.All);
                                 intervalEnd = DurationArithmeticOperations.addDuration(intervalStart,
                                         aDuration.getMonths(), aDuration.getMilliseconds(), false);
                             } else {
                                 throw new AlgebricksException(FID.getName()
                                         + ": expects NULL/STRING/DURATION for the second argument but got "
-                                        + EnumDeserializer.ATYPETAGDESERIALIZER.deserialize(argOut1.getByteArray()[0]));
+                                        + EnumDeserializer.ATYPETAGDESERIALIZER.deserialize(bytes1[offset1]));
                             }
 
                             if (intervalEnd < intervalStart) {
@@ -181,6 +178,7 @@
                         } catch (Exception e2) {
                             throw new AlgebricksException(e2);
                         }
+                        result.set(resultStorage);
                     }
                 };
             }
diff --git a/asterix-runtime/src/main/java/org/apache/asterix/runtime/evaluators/constructors/AIntervalStartFromTimeConstructorDescriptor.java b/asterix-runtime/src/main/java/org/apache/asterix/runtime/evaluators/constructors/AIntervalStartFromTimeConstructorDescriptor.java
index 78cdae2..7ccc515 100644
--- a/asterix-runtime/src/main/java/org/apache/asterix/runtime/evaluators/constructors/AIntervalStartFromTimeConstructorDescriptor.java
+++ b/asterix-runtime/src/main/java/org/apache/asterix/runtime/evaluators/constructors/AIntervalStartFromTimeConstructorDescriptor.java
@@ -43,11 +43,13 @@
 import org.apache.asterix.runtime.evaluators.base.AbstractScalarFunctionDynamicDescriptor;
 import org.apache.hyracks.algebricks.common.exceptions.AlgebricksException;
 import org.apache.hyracks.algebricks.core.algebra.functions.FunctionIdentifier;
-import org.apache.hyracks.algebricks.runtime.base.ICopyEvaluator;
-import org.apache.hyracks.algebricks.runtime.base.ICopyEvaluatorFactory;
+import org.apache.hyracks.algebricks.runtime.base.IScalarEvaluator;
+import org.apache.hyracks.algebricks.runtime.base.IScalarEvaluatorFactory;
+import org.apache.hyracks.api.context.IHyracksTaskContext;
 import org.apache.hyracks.api.dataflow.value.ISerializerDeserializer;
-import org.apache.hyracks.data.std.api.IDataOutputProvider;
+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.data.std.util.ArrayBackedValueStorage;
 import org.apache.hyracks.dataflow.common.data.accessors.IFrameTupleReference;
 
@@ -62,20 +64,20 @@
     };
 
     @Override
-    public ICopyEvaluatorFactory createEvaluatorFactory(final ICopyEvaluatorFactory[] args) {
-        return new ICopyEvaluatorFactory() {
+    public IScalarEvaluatorFactory createEvaluatorFactory(final IScalarEvaluatorFactory[] args) {
+        return new IScalarEvaluatorFactory() {
             private static final long serialVersionUID = 1L;
 
             @Override
-            public ICopyEvaluator createEvaluator(final IDataOutputProvider output) throws AlgebricksException {
-                return new ICopyEvaluator() {
+            public IScalarEvaluator createScalarEvaluator(IHyracksTaskContext ctx) throws AlgebricksException {
+                return new IScalarEvaluator() {
 
-                    private DataOutput out = output.getDataOutput();
-
-                    private ArrayBackedValueStorage argOut0 = new ArrayBackedValueStorage();
-                    private ArrayBackedValueStorage argOut1 = new ArrayBackedValueStorage();
-                    private ICopyEvaluator eval0 = args[0].createEvaluator(argOut0);
-                    private ICopyEvaluator eval1 = args[1].createEvaluator(argOut1);
+                    private ArrayBackedValueStorage resultStorage = new ArrayBackedValueStorage();
+                    private DataOutput out = resultStorage.getDataOutput();
+                    private IPointable argPtr0 = new VoidPointable();
+                    private IPointable argPtr1 = new VoidPointable();
+                    private IScalarEvaluator eval0 = args[0].createScalarEvaluator(ctx);
+                    private IScalarEvaluator eval1 = args[1].createScalarEvaluator(ctx);
                     private String errorMessage = "This can not be an instance of interval (from Date)";
 
                     private AMutableInterval aInterval = new AMutableInterval(0L, 0L, (byte) 0);
@@ -89,68 +91,63 @@
                     private final UTF8StringPointable utf8Ptr = new UTF8StringPointable();
 
                     @Override
-                    public void evaluate(IFrameTupleReference tuple) throws AlgebricksException {
+                    public void evaluate(IFrameTupleReference tuple, IPointable result) throws AlgebricksException {
+                        resultStorage.reset();
+                        eval0.evaluate(tuple, argPtr0);
+                        eval1.evaluate(tuple, argPtr1);
 
-                        argOut0.reset();
-                        argOut1.reset();
-                        eval0.evaluate(tuple);
-                        eval1.evaluate(tuple);
+                        byte[] bytes0 = argPtr0.getByteArray();
+                        int offset0 = argPtr0.getStartOffset();
+                        int len0 = argPtr0.getLength();
+                        byte[] bytes1 = argPtr1.getByteArray();
+                        int offset1 = argPtr1.getStartOffset();
+                        int len1 = argPtr1.getLength();
 
                         try {
-
-                            if (argOut0.getByteArray()[0] == ATypeTag.SERIALIZED_NULL_TYPE_TAG
-                                    || argOut1.getByteArray()[0] == ATypeTag.SERIALIZED_NULL_TYPE_TAG) {
+                            if (bytes0[offset0] == ATypeTag.SERIALIZED_NULL_TYPE_TAG
+                                    || bytes1[offset1] == ATypeTag.SERIALIZED_NULL_TYPE_TAG) {
                                 nullSerde.serialize(ANull.NULL, out);
+                                result.set(resultStorage);
                                 return;
                             }
 
                             long intervalStart = 0, intervalEnd = 0;
-
-                            if (argOut0.getByteArray()[0] == ATypeTag.SERIALIZED_TIME_TYPE_TAG) {
-                                intervalStart = ATimeSerializerDeserializer.getChronon(argOut0.getByteArray(), 1);
-                            } else if (argOut0.getByteArray()[0] == ATypeTag.SERIALIZED_STRING_TYPE_TAG) {
-                                utf8Ptr.set(argOut0.getByteArray(), 1, argOut0.getLength() - 1);
+                            if (bytes0[offset0] == ATypeTag.SERIALIZED_TIME_TYPE_TAG) {
+                                intervalStart = ATimeSerializerDeserializer.getChronon(bytes0, offset0 + 1);
+                            } else if (bytes0[offset0] == ATypeTag.SERIALIZED_STRING_TYPE_TAG) {
+                                utf8Ptr.set(bytes0, offset0 + 1, len0 - 1);
 
                                 int stringLength = utf8Ptr.getUTF8Length();
 
-                                intervalStart = ATimeParserFactory.parseTimePart(argOut0.getByteArray(),
-                                        utf8Ptr.getCharStartOffset(), stringLength);
+                                intervalStart = ATimeParserFactory.parseTimePart(bytes0, utf8Ptr.getCharStartOffset(),
+                                        stringLength);
                             } else {
-                                throw new AlgebricksException(FID.getName()
-                                        + ": expects NULL/STRING/TIME for the first argument, but got "
-                                        + EnumDeserializer.ATYPETAGDESERIALIZER.deserialize(argOut0.getByteArray()[0]));
+                                throw new AlgebricksException(
+                                        FID.getName() + ": expects NULL/STRING/TIME for the first argument, but got "
+                                                + EnumDeserializer.ATYPETAGDESERIALIZER.deserialize(bytes0[offset0]));
                             }
 
                             if (intervalStart < 0) {
                                 intervalStart += GregorianCalendarSystem.CHRONON_OF_DAY;
                             }
 
-                            if (argOut1.getByteArray()[0] == ATypeTag.SERIALIZED_DURATION_TYPE_TAG) {
-
-                                if (ADurationSerializerDeserializer.getYearMonth(argOut1.getByteArray(), 1) != 0) {
+                            if (bytes1[offset1] == ATypeTag.SERIALIZED_DURATION_TYPE_TAG) {
+                                if (ADurationSerializerDeserializer.getYearMonth(bytes1, offset1 + 1) != 0) {
                                     throw new AlgebricksException(
                                             FID.getName() + ": cannot add a year-month duration to a time value.");
                                 }
 
                                 intervalEnd = DurationArithmeticOperations.addDuration(intervalStart, 0,
-                                        ADurationSerializerDeserializer.getDayTime(argOut1.getByteArray(), 1), false);
-
-                            } else if (argOut1.getByteArray()[0] == ATypeTag.SERIALIZED_DAY_TIME_DURATION_TYPE_TAG) {
-
+                                        ADurationSerializerDeserializer.getDayTime(bytes1, offset1 + 1), false);
+                            } else if (bytes1[offset1] == ATypeTag.SERIALIZED_DAY_TIME_DURATION_TYPE_TAG) {
                                 intervalEnd = DurationArithmeticOperations.addDuration(intervalStart, 0,
-                                        ADayTimeDurationSerializerDeserializer.getDayTime(argOut1.getByteArray(), 1),
-                                        false);
-
-                            } else if (argOut1.getByteArray()[0] == ATypeTag.SERIALIZED_STRING_TYPE_TAG) {
+                                        ADayTimeDurationSerializerDeserializer.getDayTime(bytes1, offset1 + 1), false);
+                            } else if (bytes1[offset1] == ATypeTag.SERIALIZED_STRING_TYPE_TAG) {
                                 // duration
-
-                                utf8Ptr.set(argOut1.getByteArray(), 1, argOut1.getLength() - 1);
+                                utf8Ptr.set(bytes1, offset1 + 1, len1 - 1);
                                 int stringLength = utf8Ptr.getUTF8Length();
-
-                                ADurationParserFactory.parseDuration(argOut1.getByteArray(),
-                                        utf8Ptr.getCharStartOffset(), stringLength, aDuration,
-                                        ADurationParseOption.All);
-
+                                ADurationParserFactory.parseDuration(bytes1, utf8Ptr.getCharStartOffset(), stringLength,
+                                        aDuration, ADurationParseOption.All);
                                 if (aDuration.getMonths() != 0) {
                                     throw new AlgebricksException(
                                             FID.getName() + ": cannot add a year-month duration to a time value.");
@@ -179,6 +176,7 @@
                         } catch (Exception e2) {
                             throw new AlgebricksException(e2);
                         }
+                        result.set(resultStorage);
                     }
                 };
             }
diff --git a/asterix-runtime/src/main/java/org/apache/asterix/runtime/evaluators/constructors/ALineConstructorDescriptor.java b/asterix-runtime/src/main/java/org/apache/asterix/runtime/evaluators/constructors/ALineConstructorDescriptor.java
index 44e09ce..80bd22f 100644
--- a/asterix-runtime/src/main/java/org/apache/asterix/runtime/evaluators/constructors/ALineConstructorDescriptor.java
+++ b/asterix-runtime/src/main/java/org/apache/asterix/runtime/evaluators/constructors/ALineConstructorDescriptor.java
@@ -34,11 +34,13 @@
 import org.apache.asterix.runtime.evaluators.base.AbstractScalarFunctionDynamicDescriptor;
 import org.apache.hyracks.algebricks.common.exceptions.AlgebricksException;
 import org.apache.hyracks.algebricks.core.algebra.functions.FunctionIdentifier;
-import org.apache.hyracks.algebricks.runtime.base.ICopyEvaluator;
-import org.apache.hyracks.algebricks.runtime.base.ICopyEvaluatorFactory;
+import org.apache.hyracks.algebricks.runtime.base.IScalarEvaluator;
+import org.apache.hyracks.algebricks.runtime.base.IScalarEvaluatorFactory;
+import org.apache.hyracks.api.context.IHyracksTaskContext;
 import org.apache.hyracks.api.dataflow.value.ISerializerDeserializer;
-import org.apache.hyracks.data.std.api.IDataOutputProvider;
+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.data.std.util.ArrayBackedValueStorage;
 import org.apache.hyracks.dataflow.common.data.accessors.IFrameTupleReference;
 
@@ -53,18 +55,18 @@
     };
 
     @Override
-    public ICopyEvaluatorFactory createEvaluatorFactory(final ICopyEvaluatorFactory[] args) {
-        return new ICopyEvaluatorFactory() {
+    public IScalarEvaluatorFactory createEvaluatorFactory(final IScalarEvaluatorFactory[] args) {
+        return new IScalarEvaluatorFactory() {
             private static final long serialVersionUID = 1L;
 
             @Override
-            public ICopyEvaluator createEvaluator(final IDataOutputProvider output) throws AlgebricksException {
-                return new ICopyEvaluator() {
+            public IScalarEvaluator createScalarEvaluator(IHyracksTaskContext ctx) throws AlgebricksException {
+                return new IScalarEvaluator() {
 
-                    private DataOutput out = output.getDataOutput();
-
-                    private ArrayBackedValueStorage outInput = new ArrayBackedValueStorage();
-                    private ICopyEvaluator eval = args[0].createEvaluator(outInput);
+                    private ArrayBackedValueStorage resultStorage = new ArrayBackedValueStorage();
+                    private DataOutput out = resultStorage.getDataOutput();
+                    private IPointable inputArg = new VoidPointable();
+                    private IScalarEvaluator eval = args[0].createScalarEvaluator(ctx);
                     private String errorMessage = "This can not be an instance of line";
                     private AMutableLine aLine = new AMutableLine(null, null);
                     private AMutablePoint[] aPoint = { new AMutablePoint(0, 0), new AMutablePoint(0, 0) };
@@ -77,14 +79,16 @@
                     private final UTF8StringPointable utf8Ptr = new UTF8StringPointable();
 
                     @Override
-                    public void evaluate(IFrameTupleReference tuple) throws AlgebricksException {
-
+                    public void evaluate(IFrameTupleReference tuple, IPointable result) throws AlgebricksException {
                         try {
-                            outInput.reset();
-                            eval.evaluate(tuple);
-                            byte[] serString = outInput.getByteArray();
-                            if (serString[0] == ATypeTag.SERIALIZED_STRING_TYPE_TAG) {
-                                utf8Ptr.set(serString, 1, outInput.getLength() - 1);
+                            resultStorage.reset();
+                            eval.evaluate(tuple, inputArg);
+                            byte[] serString = inputArg.getByteArray();
+                            int offset = inputArg.getStartOffset();
+                            int len = inputArg.getLength();
+
+                            if (serString[offset] == ATypeTag.SERIALIZED_STRING_TYPE_TAG) {
+                                utf8Ptr.set(serString, offset + 1, len - 1);
                                 String s = utf8Ptr.toString();
                                 int commaIndex = s.indexOf(',');
                                 int spaceIndex = s.indexOf(' ', commaIndex + 1);
@@ -95,10 +99,12 @@
                                         Double.parseDouble(s.substring(commaIndex + 1, s.length())));
                                 aLine.setValue(aPoint[0], aPoint[1]);
                                 lineSerde.serialize(aLine, out);
-                            } else if (serString[0] == ATypeTag.SERIALIZED_NULL_TYPE_TAG)
+                            } else if (serString[offset] == ATypeTag.SERIALIZED_NULL_TYPE_TAG) {
                                 nullSerde.serialize(ANull.NULL, out);
-                            else
+                            } else {
                                 throw new AlgebricksException(errorMessage);
+                            }
+                            result.set(resultStorage);
                         } catch (IOException e1) {
                             throw new AlgebricksException(errorMessage);
                         }
diff --git a/asterix-runtime/src/main/java/org/apache/asterix/runtime/evaluators/constructors/ANullConstructorDescriptor.java b/asterix-runtime/src/main/java/org/apache/asterix/runtime/evaluators/constructors/ANullConstructorDescriptor.java
index 15779b5..d127ec6 100644
--- a/asterix-runtime/src/main/java/org/apache/asterix/runtime/evaluators/constructors/ANullConstructorDescriptor.java
+++ b/asterix-runtime/src/main/java/org/apache/asterix/runtime/evaluators/constructors/ANullConstructorDescriptor.java
@@ -32,11 +32,13 @@
 import org.apache.asterix.runtime.evaluators.base.AbstractScalarFunctionDynamicDescriptor;
 import org.apache.hyracks.algebricks.common.exceptions.AlgebricksException;
 import org.apache.hyracks.algebricks.core.algebra.functions.FunctionIdentifier;
-import org.apache.hyracks.algebricks.runtime.base.ICopyEvaluator;
-import org.apache.hyracks.algebricks.runtime.base.ICopyEvaluatorFactory;
+import org.apache.hyracks.algebricks.runtime.base.IScalarEvaluator;
+import org.apache.hyracks.algebricks.runtime.base.IScalarEvaluatorFactory;
+import org.apache.hyracks.api.context.IHyracksTaskContext;
 import org.apache.hyracks.api.dataflow.value.IBinaryComparator;
 import org.apache.hyracks.api.dataflow.value.ISerializerDeserializer;
-import org.apache.hyracks.data.std.api.IDataOutputProvider;
+import org.apache.hyracks.data.std.api.IPointable;
+import org.apache.hyracks.data.std.primitive.VoidPointable;
 import org.apache.hyracks.data.std.util.ArrayBackedValueStorage;
 import org.apache.hyracks.dataflow.common.data.accessors.IFrameTupleReference;
 import org.apache.hyracks.util.string.UTF8StringUtil;
@@ -51,17 +53,18 @@
     };
 
     @Override
-    public ICopyEvaluatorFactory createEvaluatorFactory(final ICopyEvaluatorFactory[] args) {
-        return new ICopyEvaluatorFactory() {
+    public IScalarEvaluatorFactory createEvaluatorFactory(final IScalarEvaluatorFactory[] args) {
+        return new IScalarEvaluatorFactory() {
             private static final long serialVersionUID = 1L;
 
             @Override
-            public ICopyEvaluator createEvaluator(final IDataOutputProvider output) throws AlgebricksException {
-                return new ICopyEvaluator() {
+            public IScalarEvaluator createScalarEvaluator(IHyracksTaskContext ctx) throws AlgebricksException {
+                return new IScalarEvaluator() {
 
-                    private DataOutput out = output.getDataOutput();
-                    private ArrayBackedValueStorage outInput = new ArrayBackedValueStorage();
-                    private ICopyEvaluator eval = args[0].createEvaluator(outInput);
+                    private ArrayBackedValueStorage resultStorage = new ArrayBackedValueStorage();
+                    private DataOutput out = resultStorage.getDataOutput();
+                    private IPointable inputArg = new VoidPointable();
+                    private IScalarEvaluator eval = args[0].createScalarEvaluator(ctx);
                     private String errorMessage = "This can not be an instance of null";
                     private final byte[] NULL = UTF8StringUtil.writeStringToBytes("null");
                     IBinaryComparator utf8BinaryComparator = AqlBinaryComparatorFactoryProvider.UTF8STRING_POINTABLE_INSTANCE
@@ -71,21 +74,26 @@
                             .getSerializerDeserializer(BuiltinType.ANULL);
 
                     @Override
-                    public void evaluate(IFrameTupleReference tuple) throws AlgebricksException {
-
+                    public void evaluate(IFrameTupleReference tuple, IPointable result) throws AlgebricksException {
                         try {
-                            outInput.reset();
-                            eval.evaluate(tuple);
-                            byte[] serString = outInput.getByteArray();
-                            if (serString[0] == ATypeTag.SERIALIZED_STRING_TYPE_TAG) {
-                                if (utf8BinaryComparator.compare(serString, 1, outInput.getLength(), NULL, 0,
+                            eval.evaluate(tuple, inputArg);
+                            byte[] serString = inputArg.getByteArray();
+                            int offset = inputArg.getStartOffset();
+                            int len = inputArg.getLength();
+
+                            if (serString[offset] == ATypeTag.SERIALIZED_STRING_TYPE_TAG) {
+                                if (utf8BinaryComparator.compare(serString, offset + 1, len - 1, NULL, 0,
                                         NULL.length) == 0) {
+                                    resultStorage.reset();
                                     nullSerde.serialize(ANull.NULL, out);
+                                    result.set(resultStorage);
                                     return;
-                                } else
+                                } else {
                                     throw new AlgebricksException(errorMessage);
-                            } else
+                                }
+                            } else {
                                 throw new AlgebricksException(errorMessage);
+                            }
                         } catch (IOException e1) {
                             throw new AlgebricksException(errorMessage);
                         }
diff --git a/asterix-runtime/src/main/java/org/apache/asterix/runtime/evaluators/constructors/APoint3DConstructorDescriptor.java b/asterix-runtime/src/main/java/org/apache/asterix/runtime/evaluators/constructors/APoint3DConstructorDescriptor.java
index f1004bc..7c3ae04 100644
--- a/asterix-runtime/src/main/java/org/apache/asterix/runtime/evaluators/constructors/APoint3DConstructorDescriptor.java
+++ b/asterix-runtime/src/main/java/org/apache/asterix/runtime/evaluators/constructors/APoint3DConstructorDescriptor.java
@@ -33,11 +33,13 @@
 import org.apache.asterix.runtime.evaluators.base.AbstractScalarFunctionDynamicDescriptor;
 import org.apache.hyracks.algebricks.common.exceptions.AlgebricksException;
 import org.apache.hyracks.algebricks.core.algebra.functions.FunctionIdentifier;
-import org.apache.hyracks.algebricks.runtime.base.ICopyEvaluator;
-import org.apache.hyracks.algebricks.runtime.base.ICopyEvaluatorFactory;
+import org.apache.hyracks.algebricks.runtime.base.IScalarEvaluator;
+import org.apache.hyracks.algebricks.runtime.base.IScalarEvaluatorFactory;
+import org.apache.hyracks.api.context.IHyracksTaskContext;
 import org.apache.hyracks.api.dataflow.value.ISerializerDeserializer;
-import org.apache.hyracks.data.std.api.IDataOutputProvider;
+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.data.std.util.ArrayBackedValueStorage;
 import org.apache.hyracks.dataflow.common.data.accessors.IFrameTupleReference;
 
@@ -52,18 +54,18 @@
     };
 
     @Override
-    public ICopyEvaluatorFactory createEvaluatorFactory(final ICopyEvaluatorFactory[] args) {
-        return new ICopyEvaluatorFactory() {
+    public IScalarEvaluatorFactory createEvaluatorFactory(final IScalarEvaluatorFactory[] args) {
+        return new IScalarEvaluatorFactory() {
             private static final long serialVersionUID = 1L;
 
             @Override
-            public ICopyEvaluator createEvaluator(final IDataOutputProvider output) throws AlgebricksException {
-                return new ICopyEvaluator() {
+            public IScalarEvaluator createScalarEvaluator(IHyracksTaskContext ctx) throws AlgebricksException {
+                return new IScalarEvaluator() {
 
-                    private DataOutput out = output.getDataOutput();
-
-                    private ArrayBackedValueStorage outInput = new ArrayBackedValueStorage();
-                    private ICopyEvaluator eval = args[0].createEvaluator(outInput);
+                    private ArrayBackedValueStorage resultStorage = new ArrayBackedValueStorage();
+                    private DataOutput out = resultStorage.getDataOutput();
+                    private IPointable inputArg = new VoidPointable();
+                    private IScalarEvaluator eval = args[0].createScalarEvaluator(ctx);
                     private String errorMessage = "This can not be an instance of point3d";
                     private AMutablePoint3D aPoint3D = new AMutablePoint3D(0, 0, 0);
                     @SuppressWarnings("unchecked")
@@ -75,14 +77,16 @@
                     private final UTF8StringPointable utf8Ptr = new UTF8StringPointable();
 
                     @Override
-                    public void evaluate(IFrameTupleReference tuple) throws AlgebricksException {
-
+                    public void evaluate(IFrameTupleReference tuple, IPointable result) throws AlgebricksException {
                         try {
-                            outInput.reset();
-                            eval.evaluate(tuple);
-                            byte[] serString = outInput.getByteArray();
-                            if (serString[0] == ATypeTag.SERIALIZED_STRING_TYPE_TAG) {
-                                utf8Ptr.set(serString, 1, outInput.getLength() - 1);
+                            resultStorage.reset();
+                            eval.evaluate(tuple, inputArg);
+                            byte[] serString = inputArg.getByteArray();
+                            int offset = inputArg.getStartOffset();
+                            int len = inputArg.getLength();
+
+                            if (serString[offset] == ATypeTag.SERIALIZED_STRING_TYPE_TAG) {
+                                utf8Ptr.set(serString, offset + 1, len - 1);
                                 String s = utf8Ptr.toString();
                                 int firstCommaIndex = s.indexOf(',');
                                 int secondCommaIndex = s.indexOf(',', firstCommaIndex + 1);
@@ -90,11 +94,12 @@
                                         Double.parseDouble(s.substring(firstCommaIndex + 1, secondCommaIndex)),
                                         Double.parseDouble(s.substring(secondCommaIndex + 1, s.length())));
                                 point3DSerde.serialize(aPoint3D, out);
-
-                            } else if (serString[0] == ATypeTag.SERIALIZED_NULL_TYPE_TAG)
+                            } else if (serString[offset] == ATypeTag.SERIALIZED_NULL_TYPE_TAG) {
                                 nullSerde.serialize(ANull.NULL, out);
-                            else
+                            } else {
                                 throw new AlgebricksException(errorMessage);
+                            }
+                            result.set(resultStorage);
                         } catch (IOException e1) {
                             throw new AlgebricksException(errorMessage);
                         }
diff --git a/asterix-runtime/src/main/java/org/apache/asterix/runtime/evaluators/constructors/APointConstructorDescriptor.java b/asterix-runtime/src/main/java/org/apache/asterix/runtime/evaluators/constructors/APointConstructorDescriptor.java
index 43882c9..38c4ccf 100644
--- a/asterix-runtime/src/main/java/org/apache/asterix/runtime/evaluators/constructors/APointConstructorDescriptor.java
+++ b/asterix-runtime/src/main/java/org/apache/asterix/runtime/evaluators/constructors/APointConstructorDescriptor.java
@@ -33,11 +33,13 @@
 import org.apache.asterix.runtime.evaluators.base.AbstractScalarFunctionDynamicDescriptor;
 import org.apache.hyracks.algebricks.common.exceptions.AlgebricksException;
 import org.apache.hyracks.algebricks.core.algebra.functions.FunctionIdentifier;
-import org.apache.hyracks.algebricks.runtime.base.ICopyEvaluator;
-import org.apache.hyracks.algebricks.runtime.base.ICopyEvaluatorFactory;
+import org.apache.hyracks.algebricks.runtime.base.IScalarEvaluator;
+import org.apache.hyracks.algebricks.runtime.base.IScalarEvaluatorFactory;
+import org.apache.hyracks.api.context.IHyracksTaskContext;
 import org.apache.hyracks.api.dataflow.value.ISerializerDeserializer;
-import org.apache.hyracks.data.std.api.IDataOutputProvider;
+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.data.std.util.ArrayBackedValueStorage;
 import org.apache.hyracks.dataflow.common.data.accessors.IFrameTupleReference;
 
@@ -51,18 +53,18 @@
     };
 
     @Override
-    public ICopyEvaluatorFactory createEvaluatorFactory(final ICopyEvaluatorFactory[] args) {
-        return new ICopyEvaluatorFactory() {
+    public IScalarEvaluatorFactory createEvaluatorFactory(final IScalarEvaluatorFactory[] args) {
+        return new IScalarEvaluatorFactory() {
             private static final long serialVersionUID = 1L;
 
             @Override
-            public ICopyEvaluator createEvaluator(final IDataOutputProvider output) throws AlgebricksException {
-                return new ICopyEvaluator() {
+            public IScalarEvaluator createScalarEvaluator(IHyracksTaskContext ctx) throws AlgebricksException {
+                return new IScalarEvaluator() {
 
-                    private DataOutput out = output.getDataOutput();
-
-                    private ArrayBackedValueStorage outInput = new ArrayBackedValueStorage();
-                    private ICopyEvaluator eval = args[0].createEvaluator(outInput);
+                    private ArrayBackedValueStorage resultStorage = new ArrayBackedValueStorage();
+                    private DataOutput out = resultStorage.getDataOutput();
+                    private IPointable inputArg = new VoidPointable();
+                    private IScalarEvaluator eval = args[0].createScalarEvaluator(ctx);
                     private String errorMessage = "This can not be an instance of point";
                     private AMutablePoint aPoint = new AMutablePoint(0, 0);
                     @SuppressWarnings("unchecked")
@@ -74,22 +76,27 @@
                     private final UTF8StringPointable utf8Ptr = new UTF8StringPointable();
 
                     @Override
-                    public void evaluate(IFrameTupleReference tuple) throws AlgebricksException {
+                    public void evaluate(IFrameTupleReference tuple, IPointable result) throws AlgebricksException {
 
                         try {
-                            outInput.reset();
-                            eval.evaluate(tuple);
-                            byte[] serString = outInput.getByteArray();
-                            if (serString[0] == ATypeTag.SERIALIZED_STRING_TYPE_TAG) {
-                                utf8Ptr.set(serString, 1, outInput.getLength() - 1);
+                            resultStorage.reset();
+                            eval.evaluate(tuple, inputArg);
+                            byte[] serString = inputArg.getByteArray();
+                            int offset = inputArg.getStartOffset();
+                            int len = inputArg.getLength();
+
+                            if (serString[offset] == ATypeTag.SERIALIZED_STRING_TYPE_TAG) {
+                                utf8Ptr.set(serString, offset + 1, len - 1);
                                 String s = utf8Ptr.toString();
                                 aPoint.setValue(Double.parseDouble(s.substring(0, s.indexOf(','))),
                                         Double.parseDouble(s.substring(s.indexOf(',') + 1, s.length())));
                                 pointSerde.serialize(aPoint, out);
-                            } else if (serString[0] == ATypeTag.SERIALIZED_NULL_TYPE_TAG)
+                            } else if (serString[offset] == ATypeTag.SERIALIZED_NULL_TYPE_TAG) {
                                 nullSerde.serialize(ANull.NULL, out);
-                            else
+                            } else {
                                 throw new AlgebricksException(errorMessage);
+                            }
+                            result.set(resultStorage);
                         } catch (IOException e1) {
                             throw new AlgebricksException(errorMessage);
                         }
diff --git a/asterix-runtime/src/main/java/org/apache/asterix/runtime/evaluators/constructors/APolygonConstructorDescriptor.java b/asterix-runtime/src/main/java/org/apache/asterix/runtime/evaluators/constructors/APolygonConstructorDescriptor.java
index 4b91e18..065c731 100644
--- a/asterix-runtime/src/main/java/org/apache/asterix/runtime/evaluators/constructors/APolygonConstructorDescriptor.java
+++ b/asterix-runtime/src/main/java/org/apache/asterix/runtime/evaluators/constructors/APolygonConstructorDescriptor.java
@@ -32,11 +32,13 @@
 import org.apache.asterix.runtime.evaluators.base.AbstractScalarFunctionDynamicDescriptor;
 import org.apache.hyracks.algebricks.common.exceptions.AlgebricksException;
 import org.apache.hyracks.algebricks.core.algebra.functions.FunctionIdentifier;
-import org.apache.hyracks.algebricks.runtime.base.ICopyEvaluator;
-import org.apache.hyracks.algebricks.runtime.base.ICopyEvaluatorFactory;
+import org.apache.hyracks.algebricks.runtime.base.IScalarEvaluator;
+import org.apache.hyracks.algebricks.runtime.base.IScalarEvaluatorFactory;
+import org.apache.hyracks.api.context.IHyracksTaskContext;
 import org.apache.hyracks.api.dataflow.value.ISerializerDeserializer;
-import org.apache.hyracks.data.std.api.IDataOutputProvider;
+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.data.std.util.ArrayBackedValueStorage;
 import org.apache.hyracks.dataflow.common.data.accessors.IFrameTupleReference;
 
@@ -50,18 +52,18 @@
     };
 
     @Override
-    public ICopyEvaluatorFactory createEvaluatorFactory(final ICopyEvaluatorFactory[] args) {
-        return new ICopyEvaluatorFactory() {
+    public IScalarEvaluatorFactory createEvaluatorFactory(final IScalarEvaluatorFactory[] args) {
+        return new IScalarEvaluatorFactory() {
             private static final long serialVersionUID = 1L;
 
             @Override
-            public ICopyEvaluator createEvaluator(final IDataOutputProvider output) throws AlgebricksException {
-                return new ICopyEvaluator() {
+            public IScalarEvaluator createScalarEvaluator(IHyracksTaskContext ctx) throws AlgebricksException {
+                return new IScalarEvaluator() {
 
-                    private DataOutput out = output.getDataOutput();
-
-                    private ArrayBackedValueStorage outInput = new ArrayBackedValueStorage();
-                    private ICopyEvaluator eval = args[0].createEvaluator(outInput);
+                    private ArrayBackedValueStorage resultStorage = new ArrayBackedValueStorage();
+                    private DataOutput out = resultStorage.getDataOutput();
+                    private IPointable inputArg = new VoidPointable();
+                    private IScalarEvaluator eval = args[0].createScalarEvaluator(ctx);
                     private String errorMessage = "This can not be an instance of polygon";
                     @SuppressWarnings("unchecked")
                     private ISerializerDeserializer<ANull> nullSerde = AqlSerializerDeserializerProvider.INSTANCE
@@ -69,27 +71,34 @@
                     private final UTF8StringPointable utf8Ptr = new UTF8StringPointable();
 
                     @Override
-                    public void evaluate(IFrameTupleReference tuple) throws AlgebricksException {
+                    public void evaluate(IFrameTupleReference tuple, IPointable result) throws AlgebricksException {
 
                         try {
-                            outInput.reset();
-                            eval.evaluate(tuple);
-                            byte[] serString = outInput.getByteArray();
-                            if (serString[0] == ATypeTag.SERIALIZED_STRING_TYPE_TAG) {
-                                utf8Ptr.set(serString, 1, outInput.getLength() - 1);
+                            resultStorage.reset();
+                            eval.evaluate(tuple, inputArg);
+                            byte[] serString = inputArg.getByteArray();
+                            int offset = inputArg.getStartOffset();
+                            int len = inputArg.getLength();
+
+                            if (serString[offset] == ATypeTag.SERIALIZED_STRING_TYPE_TAG) {
+                                utf8Ptr.set(serString, offset + 1, len - 1);
                                 String s = utf8Ptr.toString();
                                 String[] points = s.split(" ");
-                                if (points.length <= 2)
+                                if (points.length <= 2) {
                                     throw new AlgebricksException(errorMessage);
+                                }
                                 out.writeByte(ATypeTag.SERIALIZED_POLYGON_TYPE_TAG);
                                 out.writeShort(points.length);
-                                for (int i = 0; i < points.length; i++)
+                                for (int i = 0; i < points.length; i++) {
                                     APointSerializerDeserializer.serialize(Double.parseDouble(points[i].split(",")[0]),
                                             Double.parseDouble(points[i].split(",")[1]), out);
-                            } else if (serString[0] == ATypeTag.SERIALIZED_NULL_TYPE_TAG)
+                                }
+                            } else if (serString[offset] == ATypeTag.SERIALIZED_NULL_TYPE_TAG) {
                                 nullSerde.serialize(ANull.NULL, out);
-                            else
+                            } else {
                                 throw new AlgebricksException(errorMessage);
+                            }
+                            result.set(resultStorage);
                         } catch (IOException e1) {
                             throw new AlgebricksException(errorMessage);
                         }
diff --git a/asterix-runtime/src/main/java/org/apache/asterix/runtime/evaluators/constructors/ARectangleConstructorDescriptor.java b/asterix-runtime/src/main/java/org/apache/asterix/runtime/evaluators/constructors/ARectangleConstructorDescriptor.java
index 5ffa0af..b90e322 100644
--- a/asterix-runtime/src/main/java/org/apache/asterix/runtime/evaluators/constructors/ARectangleConstructorDescriptor.java
+++ b/asterix-runtime/src/main/java/org/apache/asterix/runtime/evaluators/constructors/ARectangleConstructorDescriptor.java
@@ -34,11 +34,13 @@
 import org.apache.asterix.runtime.evaluators.base.AbstractScalarFunctionDynamicDescriptor;
 import org.apache.hyracks.algebricks.common.exceptions.AlgebricksException;
 import org.apache.hyracks.algebricks.core.algebra.functions.FunctionIdentifier;
-import org.apache.hyracks.algebricks.runtime.base.ICopyEvaluator;
-import org.apache.hyracks.algebricks.runtime.base.ICopyEvaluatorFactory;
+import org.apache.hyracks.algebricks.runtime.base.IScalarEvaluator;
+import org.apache.hyracks.algebricks.runtime.base.IScalarEvaluatorFactory;
+import org.apache.hyracks.api.context.IHyracksTaskContext;
 import org.apache.hyracks.api.dataflow.value.ISerializerDeserializer;
-import org.apache.hyracks.data.std.api.IDataOutputProvider;
+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.data.std.util.ArrayBackedValueStorage;
 import org.apache.hyracks.dataflow.common.data.accessors.IFrameTupleReference;
 
@@ -52,18 +54,18 @@
     };
 
     @Override
-    public ICopyEvaluatorFactory createEvaluatorFactory(final ICopyEvaluatorFactory[] args) {
-        return new ICopyEvaluatorFactory() {
+    public IScalarEvaluatorFactory createEvaluatorFactory(final IScalarEvaluatorFactory[] args) {
+        return new IScalarEvaluatorFactory() {
             private static final long serialVersionUID = 1L;
 
             @Override
-            public ICopyEvaluator createEvaluator(final IDataOutputProvider output) throws AlgebricksException {
-                return new ICopyEvaluator() {
+            public IScalarEvaluator createScalarEvaluator(IHyracksTaskContext ctx) throws AlgebricksException {
+                return new IScalarEvaluator() {
 
-                    private DataOutput out = output.getDataOutput();
-
-                    private ArrayBackedValueStorage outInput = new ArrayBackedValueStorage();
-                    private ICopyEvaluator eval = args[0].createEvaluator(outInput);
+                    private ArrayBackedValueStorage resultStorage = new ArrayBackedValueStorage();
+                    private DataOutput out = resultStorage.getDataOutput();
+                    private IPointable inputArg = new VoidPointable();
+                    private IScalarEvaluator eval = args[0].createScalarEvaluator(ctx);
                     private String errorMessage = "This can not be an instance of rectangle";
                     private AMutableRectangle aRectangle = new AMutableRectangle(null, null);
                     private AMutablePoint[] aPoint = { new AMutablePoint(0, 0), new AMutablePoint(0, 0) };
@@ -76,14 +78,17 @@
                     private final UTF8StringPointable utf8Ptr = new UTF8StringPointable();
 
                     @Override
-                    public void evaluate(IFrameTupleReference tuple) throws AlgebricksException {
+                    public void evaluate(IFrameTupleReference tuple, IPointable result) throws AlgebricksException {
 
                         try {
-                            outInput.reset();
-                            eval.evaluate(tuple);
-                            byte[] serString = outInput.getByteArray();
-                            if (serString[0] == ATypeTag.SERIALIZED_STRING_TYPE_TAG) {
-                                utf8Ptr.set(serString, 1, outInput.getLength() - 1);
+                            resultStorage.reset();
+                            eval.evaluate(tuple, inputArg);
+                            byte[] serString = inputArg.getByteArray();
+                            int offset = inputArg.getStartOffset();
+                            int len = inputArg.getLength();
+
+                            if (serString[offset] == ATypeTag.SERIALIZED_STRING_TYPE_TAG) {
+                                utf8Ptr.set(serString, offset + 1, len - 1);
                                 String s = utf8Ptr.toString();
                                 int commaIndex = s.indexOf(',');
                                 int spaceIndex = s.indexOf(' ', commaIndex + 1);
@@ -101,10 +106,12 @@
                                             "Rectangle arugment must be either (bottom left point, top right point) or (top right point, bottom left point)");
                                 }
                                 rectangle2DSerde.serialize(aRectangle, out);
-                            } else if (serString[0] == ATypeTag.SERIALIZED_NULL_TYPE_TAG)
+                            } else if (serString[offset] == ATypeTag.SERIALIZED_NULL_TYPE_TAG) {
                                 nullSerde.serialize(ANull.NULL, out);
-                            else
+                            } else {
                                 throw new AlgebricksException(errorMessage);
+                            }
+                            result.set(resultStorage);
                         } catch (IOException e1) {
                             throw new AlgebricksException(errorMessage);
                         }
diff --git a/asterix-runtime/src/main/java/org/apache/asterix/runtime/evaluators/constructors/AStringConstructorDescriptor.java b/asterix-runtime/src/main/java/org/apache/asterix/runtime/evaluators/constructors/AStringConstructorDescriptor.java
index 1355ed5..4cd0f19 100644
--- a/asterix-runtime/src/main/java/org/apache/asterix/runtime/evaluators/constructors/AStringConstructorDescriptor.java
+++ b/asterix-runtime/src/main/java/org/apache/asterix/runtime/evaluators/constructors/AStringConstructorDescriptor.java
@@ -38,10 +38,12 @@
 import org.apache.asterix.runtime.evaluators.base.AbstractScalarFunctionDynamicDescriptor;
 import org.apache.hyracks.algebricks.common.exceptions.AlgebricksException;
 import org.apache.hyracks.algebricks.core.algebra.functions.FunctionIdentifier;
-import org.apache.hyracks.algebricks.runtime.base.ICopyEvaluator;
-import org.apache.hyracks.algebricks.runtime.base.ICopyEvaluatorFactory;
+import org.apache.hyracks.algebricks.runtime.base.IScalarEvaluator;
+import org.apache.hyracks.algebricks.runtime.base.IScalarEvaluatorFactory;
+import org.apache.hyracks.api.context.IHyracksTaskContext;
 import org.apache.hyracks.api.dataflow.value.ISerializerDeserializer;
-import org.apache.hyracks.data.std.api.IDataOutputProvider;
+import org.apache.hyracks.data.std.api.IPointable;
+import org.apache.hyracks.data.std.primitive.VoidPointable;
 import org.apache.hyracks.data.std.util.ArrayBackedValueStorage;
 import org.apache.hyracks.data.std.util.GrowableArray;
 import org.apache.hyracks.data.std.util.UTF8StringBuilder;
@@ -58,17 +60,18 @@
     };
 
     @Override
-    public ICopyEvaluatorFactory createEvaluatorFactory(final ICopyEvaluatorFactory[] args) {
-        return new ICopyEvaluatorFactory() {
+    public IScalarEvaluatorFactory createEvaluatorFactory(final IScalarEvaluatorFactory[] args) {
+        return new IScalarEvaluatorFactory() {
             private static final long serialVersionUID = 1L;
 
             @Override
-            public ICopyEvaluator createEvaluator(final IDataOutputProvider output) throws AlgebricksException {
-                return new ICopyEvaluator() {
+            public IScalarEvaluator createScalarEvaluator(IHyracksTaskContext ctx) throws AlgebricksException {
+                return new IScalarEvaluator() {
 
-                    private DataOutput out = output.getDataOutput();
-                    private ArrayBackedValueStorage outInput = new ArrayBackedValueStorage();
-                    private ICopyEvaluator eval = args[0].createEvaluator(outInput);
+                    private ArrayBackedValueStorage resultStorage = new ArrayBackedValueStorage();
+                    private DataOutput out = resultStorage.getDataOutput();
+                    private IPointable inputArg = new VoidPointable();
+                    private IScalarEvaluator eval = args[0].createScalarEvaluator(ctx);
                     @SuppressWarnings("unchecked")
                     private ISerializerDeserializer<ANull> nullSerde = AqlSerializerDeserializerProvider.INSTANCE
                             .getSerializerDeserializer(BuiltinType.ANULL);
@@ -76,54 +79,57 @@
                     private GrowableArray baaos = new GrowableArray();
 
                     @Override
-                    public void evaluate(IFrameTupleReference tuple) throws AlgebricksException {
+                    public void evaluate(IFrameTupleReference tuple, IPointable result) throws AlgebricksException {
                         try {
-                            outInput.reset();
+                            resultStorage.reset();
                             baaos.reset();
-                            eval.evaluate(tuple);
-                            byte[] serString = outInput.getByteArray();
+                            eval.evaluate(tuple, inputArg);
+                            byte[] serString = inputArg.getByteArray();
+                            int offset = inputArg.getStartOffset();
+                            int len = inputArg.getLength();
 
-                            ATypeTag tt = ATypeTag.VALUE_TYPE_MAPPING[serString[0]];
+                            ATypeTag tt = ATypeTag.VALUE_TYPE_MAPPING[serString[offset]];
                             if (tt == ATypeTag.NULL) {
                                 nullSerde.serialize(ANull.NULL, out);
+                                result.set(resultStorage);
                             } else if (tt == ATypeTag.STRING) {
-                                out.write(outInput.getByteArray(), outInput.getStartOffset(), outInput.getLength());
+                                result.set(inputArg);
                             } else {
-                                builder.reset(baaos, outInput.getLength());
+                                builder.reset(baaos, len);
+                                int startOffset = offset + 1;
                                 switch (tt) {
                                     case INT8: {
-                                        int i = AInt8SerializerDeserializer.getByte(outInput.getByteArray(), 1);
+                                        int i = AInt8SerializerDeserializer.getByte(serString, startOffset);
                                         builder.appendString(String.valueOf(i));
                                         break;
                                     }
                                     case INT16: {
-                                        int i = AInt16SerializerDeserializer.getShort(outInput.getByteArray(), 1);
+                                        int i = AInt16SerializerDeserializer.getShort(serString, startOffset);
                                         builder.appendString(String.valueOf(i));
                                         break;
                                     }
                                     case INT32: {
-                                        int i = AInt32SerializerDeserializer.getInt(outInput.getByteArray(), 1);
+                                        int i = AInt32SerializerDeserializer.getInt(serString, startOffset);
                                         builder.appendString(String.valueOf(i));
                                         break;
                                     }
                                     case INT64: {
-                                        long l = AInt64SerializerDeserializer.getLong(outInput.getByteArray(), 1);
+                                        long l = AInt64SerializerDeserializer.getLong(serString, startOffset);
                                         builder.appendString(String.valueOf(l));
                                         break;
                                     }
                                     case DOUBLE: {
-                                        double d = ADoubleSerializerDeserializer.getDouble(outInput.getByteArray(), 1);
+                                        double d = ADoubleSerializerDeserializer.getDouble(serString, startOffset);
                                         builder.appendString(String.valueOf(d));
                                         break;
                                     }
                                     case FLOAT: {
-                                        float f = AFloatSerializerDeserializer.getFloat(outInput.getByteArray(), 1);
+                                        float f = AFloatSerializerDeserializer.getFloat(serString, startOffset);
                                         builder.appendString(String.valueOf(f));
                                         break;
                                     }
                                     case BOOLEAN: {
-                                        boolean b = ABooleanSerializerDeserializer.getBoolean(outInput.getByteArray(),
-                                                1);
+                                        boolean b = ABooleanSerializerDeserializer.getBoolean(serString, startOffset);
                                         builder.appendString(String.valueOf(b));
                                         break;
                                     }
@@ -152,6 +158,7 @@
                                 builder.finish();
                                 out.write(ATypeTag.SERIALIZED_STRING_TYPE_TAG);
                                 out.write(baaos.getByteArray(), 0, baaos.getLength());
+                                result.set(resultStorage);
                             }
                         } catch (IOException e) {
                             throw new AlgebricksException(e);
diff --git a/asterix-runtime/src/main/java/org/apache/asterix/runtime/evaluators/constructors/ATimeConstructorDescriptor.java b/asterix-runtime/src/main/java/org/apache/asterix/runtime/evaluators/constructors/ATimeConstructorDescriptor.java
index acfc1d0..6651b8e 100644
--- a/asterix-runtime/src/main/java/org/apache/asterix/runtime/evaluators/constructors/ATimeConstructorDescriptor.java
+++ b/asterix-runtime/src/main/java/org/apache/asterix/runtime/evaluators/constructors/ATimeConstructorDescriptor.java
@@ -35,11 +35,13 @@
 import org.apache.asterix.runtime.evaluators.base.AbstractScalarFunctionDynamicDescriptor;
 import org.apache.hyracks.algebricks.common.exceptions.AlgebricksException;
 import org.apache.hyracks.algebricks.core.algebra.functions.FunctionIdentifier;
-import org.apache.hyracks.algebricks.runtime.base.ICopyEvaluator;
-import org.apache.hyracks.algebricks.runtime.base.ICopyEvaluatorFactory;
+import org.apache.hyracks.algebricks.runtime.base.IScalarEvaluator;
+import org.apache.hyracks.algebricks.runtime.base.IScalarEvaluatorFactory;
+import org.apache.hyracks.api.context.IHyracksTaskContext;
 import org.apache.hyracks.api.dataflow.value.ISerializerDeserializer;
-import org.apache.hyracks.data.std.api.IDataOutputProvider;
+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.data.std.util.ArrayBackedValueStorage;
 import org.apache.hyracks.dataflow.common.data.accessors.IFrameTupleReference;
 
@@ -53,18 +55,18 @@
     };
 
     @Override
-    public ICopyEvaluatorFactory createEvaluatorFactory(final ICopyEvaluatorFactory[] args) {
-        return new ICopyEvaluatorFactory() {
+    public IScalarEvaluatorFactory createEvaluatorFactory(final IScalarEvaluatorFactory[] args) {
+        return new IScalarEvaluatorFactory() {
             private static final long serialVersionUID = 1L;
 
             @Override
-            public ICopyEvaluator createEvaluator(final IDataOutputProvider output) throws AlgebricksException {
-                return new ICopyEvaluator() {
+            public IScalarEvaluator createScalarEvaluator(IHyracksTaskContext ctx) throws AlgebricksException {
+                return new IScalarEvaluator() {
 
-                    private DataOutput out = output.getDataOutput();
-
-                    private ArrayBackedValueStorage outInput = new ArrayBackedValueStorage();
-                    private ICopyEvaluator eval = args[0].createEvaluator(outInput);
+                    private ArrayBackedValueStorage resultStorage = new ArrayBackedValueStorage();
+                    private DataOutput out = resultStorage.getDataOutput();
+                    private IPointable inputArg = new VoidPointable();
+                    private IScalarEvaluator eval = args[0].createScalarEvaluator(ctx);
                     private String errorMessage = "This can not be an instance of time";
                     private AMutableTime aTime = new AMutableTime(0);
                     @SuppressWarnings("unchecked")
@@ -76,15 +78,17 @@
                     private final UTF8StringPointable utf8Ptr = new UTF8StringPointable();
 
                     @Override
-                    public void evaluate(IFrameTupleReference tuple) throws AlgebricksException {
+                    public void evaluate(IFrameTupleReference tuple, IPointable result) throws AlgebricksException {
 
                         try {
-                            outInput.reset();
-                            eval.evaluate(tuple);
-                            byte[] serString = outInput.getByteArray();
-                            if (serString[0] == ATypeTag.SERIALIZED_STRING_TYPE_TAG) {
+                            resultStorage.reset();
+                            eval.evaluate(tuple, inputArg);
+                            byte[] serString = inputArg.getByteArray();
+                            int offset = inputArg.getStartOffset();
+                            int len = inputArg.getLength();
 
-                                utf8Ptr.set(serString, 1, outInput.getLength() - 1);
+                            if (serString[offset] == ATypeTag.SERIALIZED_STRING_TYPE_TAG) {
+                                utf8Ptr.set(serString, offset + 1, len - 1);
                                 int stringLength = utf8Ptr.getUTF8Length();
                                 int startOffset = utf8Ptr.getCharStartOffset();
 
@@ -105,11 +109,12 @@
                                 aTime.setValue(chrononTimeInMs);
                                 timeSerde.serialize(aTime, out);
 
-                            } else if (serString[0] == ATypeTag.SERIALIZED_NULL_TYPE_TAG) {
+                            } else if (serString[offset] == ATypeTag.SERIALIZED_NULL_TYPE_TAG) {
                                 nullSerde.serialize(ANull.NULL, out);
                             } else {
                                 throw new AlgebricksException(errorMessage);
                             }
+                            result.set(resultStorage);
                         } catch (IOException e1) {
                             throw new AlgebricksException(errorMessage);
                         }
diff --git a/asterix-runtime/src/main/java/org/apache/asterix/runtime/evaluators/constructors/AUUIDFromStringConstructorDescriptor.java b/asterix-runtime/src/main/java/org/apache/asterix/runtime/evaluators/constructors/AUUIDFromStringConstructorDescriptor.java
index b5caf18..1e87fee 100644
--- a/asterix-runtime/src/main/java/org/apache/asterix/runtime/evaluators/constructors/AUUIDFromStringConstructorDescriptor.java
+++ b/asterix-runtime/src/main/java/org/apache/asterix/runtime/evaluators/constructors/AUUIDFromStringConstructorDescriptor.java
@@ -33,11 +33,13 @@
 import org.apache.asterix.runtime.evaluators.base.AbstractScalarFunctionDynamicDescriptor;
 import org.apache.hyracks.algebricks.common.exceptions.AlgebricksException;
 import org.apache.hyracks.algebricks.core.algebra.functions.FunctionIdentifier;
-import org.apache.hyracks.algebricks.runtime.base.ICopyEvaluator;
-import org.apache.hyracks.algebricks.runtime.base.ICopyEvaluatorFactory;
+import org.apache.hyracks.algebricks.runtime.base.IScalarEvaluator;
+import org.apache.hyracks.algebricks.runtime.base.IScalarEvaluatorFactory;
+import org.apache.hyracks.api.context.IHyracksTaskContext;
 import org.apache.hyracks.api.dataflow.value.ISerializerDeserializer;
-import org.apache.hyracks.data.std.api.IDataOutputProvider;
+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.data.std.util.ArrayBackedValueStorage;
 import org.apache.hyracks.dataflow.common.data.accessors.IFrameTupleReference;
 
@@ -56,18 +58,18 @@
     };
 
     @Override
-    public ICopyEvaluatorFactory createEvaluatorFactory(final ICopyEvaluatorFactory[] args) {
-        return new ICopyEvaluatorFactory() {
+    public IScalarEvaluatorFactory createEvaluatorFactory(final IScalarEvaluatorFactory[] args) {
+        return new IScalarEvaluatorFactory() {
             private static final long serialVersionUID = 1L;
 
             @Override
-            public ICopyEvaluator createEvaluator(final IDataOutputProvider output) throws AlgebricksException {
-                return new ICopyEvaluator() {
+            public IScalarEvaluator createScalarEvaluator(IHyracksTaskContext ctx) throws AlgebricksException {
+                return new IScalarEvaluator() {
 
-                    private DataOutput out = output.getDataOutput();
-
-                    private ArrayBackedValueStorage outInput = new ArrayBackedValueStorage();
-                    private ICopyEvaluator eval = args[0].createEvaluator(outInput);
+                    private ArrayBackedValueStorage resultStorage = new ArrayBackedValueStorage();
+                    private DataOutput out = resultStorage.getDataOutput();
+                    private IPointable inputArg = new VoidPointable();
+                    private IScalarEvaluator eval = args[0].createScalarEvaluator(ctx);
                     private String errorMessage = "This can not be an instance of UUID";
                     private AMutableUUID uuid = new AMutableUUID();
                     @SuppressWarnings("unchecked")
@@ -77,29 +79,29 @@
                     private ISerializerDeserializer<ANull> nullSerde = AqlSerializerDeserializerProvider.INSTANCE
                             .getSerializerDeserializer(BuiltinType.ANULL);
 
-
-
                     private final UTF8StringPointable utf8Ptr = new UTF8StringPointable();
 
                     @Override
-                    public void evaluate(IFrameTupleReference tuple) throws AlgebricksException {
+                    public void evaluate(IFrameTupleReference tuple, IPointable result) throws AlgebricksException {
                         try {
-                            outInput.reset();
-                            eval.evaluate(tuple);
-                            byte[] serString = outInput.getByteArray();
-                            if (serString[0] == ATypeTag.SERIALIZED_STRING_TYPE_TAG) {
-                                utf8Ptr.set(serString, 1, outInput.getLength() - 1);
+                            resultStorage.reset();
+                            eval.evaluate(tuple, inputArg);
+                            byte[] serString = inputArg.getByteArray();
+                            int start = inputArg.getStartOffset();
+                            int len = inputArg.getLength();
+                            if (serString[start] == ATypeTag.SERIALIZED_STRING_TYPE_TAG) {
+                                utf8Ptr.set(serString, start + 1, len - 1);
 
                                 // first byte: tag, next x bytes: length
                                 int offset = utf8Ptr.getCharStartOffset();
-
                                 uuid.parseUUIDHexBytes(serString, offset);
                                 uuidSerde.serialize(uuid, out);
-
-                            } else if (serString[0] == ATypeTag.SERIALIZED_NULL_TYPE_TAG)
+                            } else if (serString[start] == ATypeTag.SERIALIZED_NULL_TYPE_TAG) {
                                 nullSerde.serialize(ANull.NULL, out);
-                            else
+                            } else {
                                 throw new AlgebricksException(errorMessage);
+                            }
+                            result.set(resultStorage);
                         } catch (IOException e1) {
                             throw new AlgebricksException(errorMessage);
                         }
@@ -107,6 +109,7 @@
 
                 };
             }
+
         };
     }
 
diff --git a/asterix-runtime/src/main/java/org/apache/asterix/runtime/evaluators/constructors/AYearMonthDurationConstructorDescriptor.java b/asterix-runtime/src/main/java/org/apache/asterix/runtime/evaluators/constructors/AYearMonthDurationConstructorDescriptor.java
index ed193d6..eaf8257 100644
--- a/asterix-runtime/src/main/java/org/apache/asterix/runtime/evaluators/constructors/AYearMonthDurationConstructorDescriptor.java
+++ b/asterix-runtime/src/main/java/org/apache/asterix/runtime/evaluators/constructors/AYearMonthDurationConstructorDescriptor.java
@@ -34,11 +34,13 @@
 import org.apache.asterix.runtime.evaluators.base.AbstractScalarFunctionDynamicDescriptor;
 import org.apache.hyracks.algebricks.common.exceptions.AlgebricksException;
 import org.apache.hyracks.algebricks.core.algebra.functions.FunctionIdentifier;
-import org.apache.hyracks.algebricks.runtime.base.ICopyEvaluator;
-import org.apache.hyracks.algebricks.runtime.base.ICopyEvaluatorFactory;
+import org.apache.hyracks.algebricks.runtime.base.IScalarEvaluator;
+import org.apache.hyracks.algebricks.runtime.base.IScalarEvaluatorFactory;
+import org.apache.hyracks.api.context.IHyracksTaskContext;
 import org.apache.hyracks.api.dataflow.value.ISerializerDeserializer;
-import org.apache.hyracks.data.std.api.IDataOutputProvider;
+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.data.std.util.ArrayBackedValueStorage;
 import org.apache.hyracks.dataflow.common.data.accessors.IFrameTupleReference;
 
@@ -53,18 +55,18 @@
     };
 
     @Override
-    public ICopyEvaluatorFactory createEvaluatorFactory(final ICopyEvaluatorFactory[] args) {
-        return new ICopyEvaluatorFactory() {
+    public IScalarEvaluatorFactory createEvaluatorFactory(final IScalarEvaluatorFactory[] args) {
+        return new IScalarEvaluatorFactory() {
             private static final long serialVersionUID = 1L;
 
             @Override
-            public ICopyEvaluator createEvaluator(final IDataOutputProvider output) throws AlgebricksException {
-                return new ICopyEvaluator() {
+            public IScalarEvaluator createScalarEvaluator(IHyracksTaskContext ctx) throws AlgebricksException {
+                return new IScalarEvaluator() {
 
-                    private DataOutput out = output.getDataOutput();
-
-                    private ArrayBackedValueStorage outInput = new ArrayBackedValueStorage();
-                    private ICopyEvaluator eval = args[0].createEvaluator(outInput);
+                    private ArrayBackedValueStorage resultStorage = new ArrayBackedValueStorage();
+                    private DataOutput out = resultStorage.getDataOutput();
+                    private IPointable inputArg = new VoidPointable();
+                    private IScalarEvaluator eval = args[0].createScalarEvaluator(ctx);
                     private String errorMessage = "This can not be an instance of year-month-duration";
                     private AMutableYearMonthDuration aYearMonthDuration = new AMutableYearMonthDuration(0);
                     @SuppressWarnings("unchecked")
@@ -76,25 +78,26 @@
                     private final UTF8StringPointable utf8Ptr = new UTF8StringPointable();
 
                     @Override
-                    public void evaluate(IFrameTupleReference tuple) throws AlgebricksException {
+                    public void evaluate(IFrameTupleReference tuple, IPointable result) throws AlgebricksException {
                         try {
-                            outInput.reset();
-                            eval.evaluate(tuple);
-                            byte[] serString = outInput.getByteArray();
+                            resultStorage.reset();
+                            eval.evaluate(tuple, inputArg);
+                            byte[] serString = inputArg.getByteArray();
+                            int offset = inputArg.getStartOffset();
+                            int len = inputArg.getLength();
 
-                            if (serString[0] == ATypeTag.SERIALIZED_STRING_TYPE_TAG) {
-                                utf8Ptr.set(serString, 1, outInput.getLength() - 1);
+                            if (serString[offset] == ATypeTag.SERIALIZED_STRING_TYPE_TAG) {
+                                utf8Ptr.set(serString, offset + 1, len - 1);
                                 int stringLength = utf8Ptr.getUTF8Length();
-
                                 ADurationParserFactory.parseDuration(serString, utf8Ptr.getCharStartOffset(),
                                         stringLength, aYearMonthDuration, ADurationParseOption.YEAR_MONTH);
-
                                 yearMonthDurationSerde.serialize(aYearMonthDuration, out);
-                            } else if (serString[0] == ATypeTag.SERIALIZED_NULL_TYPE_TAG) {
+                            } else if (serString[offset] == ATypeTag.SERIALIZED_NULL_TYPE_TAG) {
                                 nullSerde.serialize(ANull.NULL, out);
                             } else {
                                 throw new AlgebricksException(errorMessage);
                             }
+                            result.set(resultStorage);
                         } catch (Exception e1) {
                             throw new AlgebricksException(e1);
                         }
diff --git a/asterix-runtime/src/main/java/org/apache/asterix/runtime/evaluators/constructors/ClosedRecordConstructorDescriptor.java b/asterix-runtime/src/main/java/org/apache/asterix/runtime/evaluators/constructors/ClosedRecordConstructorDescriptor.java
index 316f321..5f54a67 100644
--- a/asterix-runtime/src/main/java/org/apache/asterix/runtime/evaluators/constructors/ClosedRecordConstructorDescriptor.java
+++ b/asterix-runtime/src/main/java/org/apache/asterix/runtime/evaluators/constructors/ClosedRecordConstructorDescriptor.java
@@ -25,7 +25,7 @@
 import org.apache.asterix.runtime.evaluators.base.AbstractScalarFunctionDynamicDescriptor;
 import org.apache.asterix.runtime.evaluators.common.ClosedRecordConstructorEvalFactory;
 import org.apache.hyracks.algebricks.core.algebra.functions.FunctionIdentifier;
-import org.apache.hyracks.algebricks.runtime.base.ICopyEvaluatorFactory;
+import org.apache.hyracks.algebricks.runtime.base.IScalarEvaluatorFactory;
 
 public class ClosedRecordConstructorDescriptor extends AbstractScalarFunctionDynamicDescriptor {
 
@@ -49,7 +49,7 @@
     }
 
     @Override
-    public ICopyEvaluatorFactory createEvaluatorFactory(final ICopyEvaluatorFactory[] args) {
+    public IScalarEvaluatorFactory createEvaluatorFactory(final IScalarEvaluatorFactory[] args) {
         return new ClosedRecordConstructorEvalFactory(args, recType);
     }
 
diff --git a/asterix-runtime/src/main/java/org/apache/asterix/runtime/evaluators/constructors/OpenRecordConstructorDescriptor.java b/asterix-runtime/src/main/java/org/apache/asterix/runtime/evaluators/constructors/OpenRecordConstructorDescriptor.java
index 66631d5..af3ba54 100644
--- a/asterix-runtime/src/main/java/org/apache/asterix/runtime/evaluators/constructors/OpenRecordConstructorDescriptor.java
+++ b/asterix-runtime/src/main/java/org/apache/asterix/runtime/evaluators/constructors/OpenRecordConstructorDescriptor.java
@@ -20,10 +20,8 @@
 package org.apache.asterix.runtime.evaluators.constructors;
 
 import java.io.DataOutput;
-import java.io.IOException;
 
 import org.apache.asterix.builders.RecordBuilder;
-import org.apache.asterix.common.exceptions.AsterixException;
 import org.apache.asterix.om.functions.AsterixBuiltinFunctions;
 import org.apache.asterix.om.functions.IFunctionDescriptor;
 import org.apache.asterix.om.functions.IFunctionDescriptorFactory;
@@ -32,10 +30,12 @@
 import org.apache.asterix.runtime.evaluators.base.AbstractScalarFunctionDynamicDescriptor;
 import org.apache.hyracks.algebricks.common.exceptions.AlgebricksException;
 import org.apache.hyracks.algebricks.core.algebra.functions.FunctionIdentifier;
-import org.apache.hyracks.algebricks.runtime.base.ICopyEvaluator;
-import org.apache.hyracks.algebricks.runtime.base.ICopyEvaluatorFactory;
+import org.apache.hyracks.algebricks.runtime.base.IScalarEvaluator;
+import org.apache.hyracks.algebricks.runtime.base.IScalarEvaluatorFactory;
+import org.apache.hyracks.api.context.IHyracksTaskContext;
 import org.apache.hyracks.api.exceptions.HyracksDataException;
-import org.apache.hyracks.data.std.api.IDataOutputProvider;
+import org.apache.hyracks.data.std.api.IPointable;
+import org.apache.hyracks.data.std.primitive.VoidPointable;
 import org.apache.hyracks.data.std.util.ArrayBackedValueStorage;
 import org.apache.hyracks.dataflow.common.data.accessors.IFrameTupleReference;
 
@@ -63,30 +63,32 @@
     }
 
     @Override
-    public ICopyEvaluatorFactory createEvaluatorFactory(final ICopyEvaluatorFactory[] args) {
-        return new ICopyEvaluatorFactory() {
+    public IScalarEvaluatorFactory createEvaluatorFactory(final IScalarEvaluatorFactory[] args) {
+        return new IScalarEvaluatorFactory() {
             private static final long serialVersionUID = 1L;
 
             @Override
-            public ICopyEvaluator createEvaluator(final IDataOutputProvider output) throws AlgebricksException {
+            public IScalarEvaluator createScalarEvaluator(IHyracksTaskContext ctx) throws AlgebricksException {
                 int n = args.length / 2;
-                final ICopyEvaluator[] evalNames = new ICopyEvaluator[n];
-                final ICopyEvaluator[] evalFields = new ICopyEvaluator[n];
-                final ArrayBackedValueStorage fieldNameBuffer = new ArrayBackedValueStorage();
-                final ArrayBackedValueStorage fieldValueBuffer = new ArrayBackedValueStorage();
+                final IScalarEvaluator[] evalNames = new IScalarEvaluator[n];
+                final IScalarEvaluator[] evalFields = new IScalarEvaluator[n];
+                final IPointable fieldNamePointable = new VoidPointable();
+                final IPointable fieldValuePointable = new VoidPointable();
                 for (int i = 0; i < n; i++) {
-                    evalNames[i] = args[2 * i].createEvaluator(fieldNameBuffer);
-                    evalFields[i] = args[2 * i + 1].createEvaluator(fieldValueBuffer);
+                    evalNames[i] = args[2 * i].createScalarEvaluator(ctx);
+                    evalFields[i] = args[2 * i + 1].createScalarEvaluator(ctx);
                 }
-                final DataOutput out = output.getDataOutput();
-                return new ICopyEvaluator() {
+                final ArrayBackedValueStorage resultStorage = new ArrayBackedValueStorage();
+                final DataOutput out = resultStorage.getDataOutput();
+                return new IScalarEvaluator() {
                     private RecordBuilder recBuilder = new RecordBuilder();
                     private int closedFieldId;
                     private boolean first = true;
 
                     @Override
-                    public void evaluate(IFrameTupleReference tuple) throws AlgebricksException {
+                    public void evaluate(IFrameTupleReference tuple, IPointable result) throws AlgebricksException {
                         try {
+                            resultStorage.reset();
                             closedFieldId = 0;
                             if (first) {
                                 first = false;
@@ -94,20 +96,20 @@
                             }
                             recBuilder.init();
                             for (int i = 0; i < evalFields.length; i++) {
-                                fieldValueBuffer.reset();
-                                evalFields[i].evaluate(tuple);
+                                evalFields[i].evaluate(tuple, fieldValuePointable);
                                 if (openFields[i]) {
-                                    fieldNameBuffer.reset();
-                                    evalNames[i].evaluate(tuple);
-                                    recBuilder.addField(fieldNameBuffer, fieldValueBuffer);
+                                    evalNames[i].evaluate(tuple, fieldNamePointable);
+                                    recBuilder.addField(fieldNamePointable, fieldValuePointable);
                                 } else {
-                                    if (fieldValueBuffer.getByteArray()[0] != ATypeTag.SERIALIZED_NULL_TYPE_TAG) {
-                                        recBuilder.addField(closedFieldId, fieldValueBuffer);
+                                    if (fieldValuePointable.getByteArray()[fieldValuePointable
+                                            .getStartOffset()] != ATypeTag.NULL.serialize()) {
+                                        recBuilder.addField(closedFieldId, fieldValuePointable);
                                     }
                                     closedFieldId++;
                                 }
                             }
                             recBuilder.write(out, true);
+                            result.set(resultStorage);
                         } catch (HyracksDataException e) {
                             throw new AlgebricksException(e);
                         }
diff --git a/asterix-runtime/src/main/java/org/apache/asterix/runtime/evaluators/functions/AbstractBinaryStringBoolEval.java b/asterix-runtime/src/main/java/org/apache/asterix/runtime/evaluators/functions/AbstractBinaryStringBoolEval.java
index a6f9183..4a5c59a 100644
--- a/asterix-runtime/src/main/java/org/apache/asterix/runtime/evaluators/functions/AbstractBinaryStringBoolEval.java
+++ b/asterix-runtime/src/main/java/org/apache/asterix/runtime/evaluators/functions/AbstractBinaryStringBoolEval.java
@@ -28,20 +28,26 @@
 import org.apache.asterix.om.types.EnumDeserializer;
 import org.apache.hyracks.algebricks.common.exceptions.AlgebricksException;
 import org.apache.hyracks.algebricks.core.algebra.functions.FunctionIdentifier;
-import org.apache.hyracks.algebricks.runtime.base.ICopyEvaluator;
-import org.apache.hyracks.algebricks.runtime.base.ICopyEvaluatorFactory;
+import org.apache.hyracks.algebricks.runtime.base.IScalarEvaluator;
+import org.apache.hyracks.algebricks.runtime.base.IScalarEvaluatorFactory;
+import org.apache.hyracks.api.context.IHyracksTaskContext;
 import org.apache.hyracks.api.dataflow.value.ISerializerDeserializer;
 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.data.std.util.ArrayBackedValueStorage;
 import org.apache.hyracks.dataflow.common.data.accessors.IFrameTupleReference;
 
-public abstract class AbstractBinaryStringBoolEval implements ICopyEvaluator {
-    private DataOutput dout;
-    private ArrayBackedValueStorage array0 = new ArrayBackedValueStorage();
-    private ArrayBackedValueStorage array1 = new ArrayBackedValueStorage();
-    private ICopyEvaluator evalLeft;
-    private ICopyEvaluator evalRight;
+public abstract class AbstractBinaryStringBoolEval implements IScalarEvaluator {
+
+    private ArrayBackedValueStorage resultStorage = new ArrayBackedValueStorage();
+    private DataOutput dout = resultStorage.getDataOutput();
+
+    private IPointable ptr0 = new VoidPointable();
+    private IPointable ptr1 = new VoidPointable();
+    private IScalarEvaluator evalLeft;
+    private IScalarEvaluator evalRight;
     private final FunctionIdentifier funcID;
 
     private final UTF8StringPointable leftPtr = new UTF8StringPointable();
@@ -54,39 +60,45 @@
     private final ISerializerDeserializer<ANull> nullSerde = AqlSerializerDeserializerProvider.INSTANCE
             .getSerializerDeserializer(BuiltinType.ANULL);
 
-    public AbstractBinaryStringBoolEval(DataOutput dout, ICopyEvaluatorFactory evalLeftFactory,
-            ICopyEvaluatorFactory evalRightFactory, FunctionIdentifier funcID) throws AlgebricksException {
-        this.dout = dout;
-        this.evalLeft = evalLeftFactory.createEvaluator(array0);
-        this.evalRight = evalRightFactory.createEvaluator(array1);
+    public AbstractBinaryStringBoolEval(IHyracksTaskContext context, IScalarEvaluatorFactory evalLeftFactory,
+            IScalarEvaluatorFactory evalRightFactory, FunctionIdentifier funcID) throws AlgebricksException {
+        this.evalLeft = evalLeftFactory.createScalarEvaluator(context);
+        this.evalRight = evalRightFactory.createScalarEvaluator(context);
         this.funcID = funcID;
     }
 
     @SuppressWarnings("unchecked")
     @Override
-    public void evaluate(IFrameTupleReference tuple) throws AlgebricksException {
-        array0.reset();
-        evalLeft.evaluate(tuple);
-        array1.reset();
-        evalRight.evaluate(tuple);
+    public void evaluate(IFrameTupleReference tuple, IPointable result) throws AlgebricksException {
+        evalLeft.evaluate(tuple, ptr0);
+        evalRight.evaluate(tuple, ptr1);
 
+        byte[] bytes0 = ptr0.getByteArray();
+        int offset0 = ptr0.getStartOffset();
+        int len0 = ptr0.getLength();
+        byte[] bytes1 = ptr1.getByteArray();
+        int offset1 = ptr1.getStartOffset();
+        int len1 = ptr1.getLength();
+
+        resultStorage.reset();
         try {
-            if (array0.getByteArray()[0] == ATypeTag.SERIALIZED_NULL_TYPE_TAG
-                    || array1.getByteArray()[0] == ATypeTag.SERIALIZED_NULL_TYPE_TAG) {
+            if (bytes0[offset0] == ATypeTag.SERIALIZED_NULL_TYPE_TAG
+                    || bytes1[offset1] == ATypeTag.SERIALIZED_NULL_TYPE_TAG) {
                 nullSerde.serialize(ANull.NULL, dout);
+                result.set(resultStorage);
                 return;
-            } else if (array0.getByteArray()[0] != ATypeTag.SERIALIZED_STRING_TYPE_TAG
-                    || array1.getByteArray()[0] != ATypeTag.SERIALIZED_STRING_TYPE_TAG) {
+            } else if (bytes0[offset0] != ATypeTag.SERIALIZED_STRING_TYPE_TAG
+                    || bytes1[offset1] != ATypeTag.SERIALIZED_STRING_TYPE_TAG) {
                 throw new AlgebricksException(funcID.getName() + ": expects input type STRING or NULL, but got "
-                        + EnumDeserializer.ATYPETAGDESERIALIZER.deserialize(array0.getByteArray()[0]) + " and "
-                        + EnumDeserializer.ATYPETAGDESERIALIZER.deserialize(array1.getByteArray()[0]) + ")!");
+                        + EnumDeserializer.ATYPETAGDESERIALIZER.deserialize(bytes0[offset0]) + " and "
+                        + EnumDeserializer.ATYPETAGDESERIALIZER.deserialize(bytes1[offset1]) + ")!");
             }
         } catch (HyracksDataException e) {
             throw new AlgebricksException(e);
         }
 
-        leftPtr.set(array0.getByteArray(), array0.getStartOffset() + 1, array0.getLength());
-        rightPtr.set(array1.getByteArray(), array1.getStartOffset() + 1, array1.getLength());
+        leftPtr.set(bytes0, offset0 + 1, len0 - 1);
+        rightPtr.set(bytes1, offset1 + 1, len1 - 1);
 
         ABoolean res = compute(leftPtr, rightPtr) ? ABoolean.TRUE : ABoolean.FALSE;
         try {
@@ -94,6 +106,7 @@
         } catch (HyracksDataException e) {
             throw new AlgebricksException(e);
         }
+        result.set(resultStorage);
     }
 
     protected abstract boolean compute(UTF8StringPointable left, UTF8StringPointable right) throws AlgebricksException;
diff --git a/asterix-runtime/src/main/java/org/apache/asterix/runtime/evaluators/functions/AbstractNumericArithmeticEval.java b/asterix-runtime/src/main/java/org/apache/asterix/runtime/evaluators/functions/AbstractNumericArithmeticEval.java
index 780ec99..0d262fb 100644
--- a/asterix-runtime/src/main/java/org/apache/asterix/runtime/evaluators/functions/AbstractNumericArithmeticEval.java
+++ b/asterix-runtime/src/main/java/org/apache/asterix/runtime/evaluators/functions/AbstractNumericArithmeticEval.java
@@ -51,11 +51,13 @@
 import org.apache.asterix.runtime.evaluators.base.AbstractScalarFunctionDynamicDescriptor;
 import org.apache.hyracks.algebricks.common.exceptions.AlgebricksException;
 import org.apache.hyracks.algebricks.common.exceptions.NotImplementedException;
-import org.apache.hyracks.algebricks.runtime.base.ICopyEvaluator;
-import org.apache.hyracks.algebricks.runtime.base.ICopyEvaluatorFactory;
+import org.apache.hyracks.algebricks.runtime.base.IScalarEvaluator;
+import org.apache.hyracks.algebricks.runtime.base.IScalarEvaluatorFactory;
+import org.apache.hyracks.api.context.IHyracksTaskContext;
 import org.apache.hyracks.api.dataflow.value.ISerializerDeserializer;
 import org.apache.hyracks.api.exceptions.HyracksDataException;
-import org.apache.hyracks.data.std.api.IDataOutputProvider;
+import org.apache.hyracks.data.std.api.IPointable;
+import org.apache.hyracks.data.std.primitive.VoidPointable;
 import org.apache.hyracks.data.std.util.ArrayBackedValueStorage;
 import org.apache.hyracks.dataflow.common.data.accessors.IFrameTupleReference;
 
@@ -76,8 +78,8 @@
      * @return
      * @throws HyracksDataException
      */
-    abstract protected long evaluateTimeDurationArithmetic(long chronon, int yearMonth, long dayTime, boolean isTimeOnly)
-            throws HyracksDataException;
+    abstract protected long evaluateTimeDurationArithmetic(long chronon, int yearMonth, long dayTime,
+            boolean isTimeOnly) throws HyracksDataException;
 
     /**
      * abstract method for arithmetic operation between two time instances (date/time/datetime)
@@ -90,20 +92,21 @@
     abstract protected long evaluateTimeInstanceArithmetic(long chronon0, long chronon1) throws HyracksDataException;
 
     @Override
-    public ICopyEvaluatorFactory createEvaluatorFactory(final ICopyEvaluatorFactory[] args) throws AlgebricksException {
-        return new ICopyEvaluatorFactory() {
+    public IScalarEvaluatorFactory createEvaluatorFactory(final IScalarEvaluatorFactory[] args)
+            throws AlgebricksException {
+        return new IScalarEvaluatorFactory() {
             private static final long serialVersionUID = 1L;
 
             @Override
-            public ICopyEvaluator createEvaluator(final IDataOutputProvider output) throws AlgebricksException {
+            public IScalarEvaluator createScalarEvaluator(IHyracksTaskContext ctx) throws AlgebricksException {
 
-                return new ICopyEvaluator() {
-                    private DataOutput out = output.getDataOutput();
-                    // one temp. buffer re-used by both children
-                    private ArrayBackedValueStorage argOut0 = new ArrayBackedValueStorage();
-                    private ArrayBackedValueStorage argOut1 = new ArrayBackedValueStorage();
-                    private ICopyEvaluator evalLeft = args[0].createEvaluator(argOut0);
-                    private ICopyEvaluator evalRight = args[1].createEvaluator(argOut1);
+                return new IScalarEvaluator() {
+                    private ArrayBackedValueStorage resultStorage = new ArrayBackedValueStorage();
+                    private DataOutput out = resultStorage.getDataOutput();
+                    private IPointable argPtr0 = new VoidPointable();
+                    private IPointable argPtr1 = new VoidPointable();
+                    private IScalarEvaluator evalLeft = args[0].createScalarEvaluator(ctx);
+                    private IScalarEvaluator evalRight = args[1].createScalarEvaluator(ctx);
                     private double[] operandsFloating = new double[args.length];
                     private long[] operandsInteger = new long[args.length];
                     private int resultType;
@@ -132,66 +135,60 @@
 
                     @SuppressWarnings("unchecked")
                     @Override
-                    public void evaluate(IFrameTupleReference tuple) throws AlgebricksException {
+                    public void evaluate(IFrameTupleReference tuple, IPointable result) throws AlgebricksException {
 
                         try {
+                            resultStorage.reset();
                             resultType = 0;
                             int currentType = 0;
                             for (int i = 0; i < args.length; i++) {
-                                ArrayBackedValueStorage argOut;
+                                IPointable argPtr;
                                 if (i == 0) {
-                                    argOut0.reset();
-                                    evalLeft.evaluate(tuple);
-                                    argOut = argOut0;
+                                    evalLeft.evaluate(tuple, argPtr0);
+                                    argPtr = argPtr0;
                                 } else {
-                                    argOut1.reset();
-                                    evalRight.evaluate(tuple);
-                                    argOut = argOut1;
+                                    evalRight.evaluate(tuple, argPtr1);
+                                    argPtr = argPtr1;
                                 }
-                                typeTag = EnumDeserializer.ATYPETAGDESERIALIZER.deserialize(argOut.getByteArray()[0]);
+
+                                byte[] bytes = argPtr.getByteArray();
+                                int offset = argPtr.getStartOffset();
+
+                                typeTag = EnumDeserializer.ATYPETAGDESERIALIZER.deserialize(bytes[offset]);
                                 switch (typeTag) {
                                     case INT8: {
                                         currentType = typeInt8;
-                                        operandsInteger[i] = AInt8SerializerDeserializer.getByte(argOut.getByteArray(),
-                                                1);
-                                        operandsFloating[i] = AInt8SerializerDeserializer.getByte(
-                                                argOut.getByteArray(), 1);
+                                        operandsInteger[i] = AInt8SerializerDeserializer.getByte(bytes, offset + 1);
+                                        operandsFloating[i] = operandsInteger[i];
                                         break;
                                     }
                                     case INT16: {
                                         currentType = typeInt16;
-                                        operandsInteger[i] = AInt16SerializerDeserializer.getShort(
-                                                argOut.getByteArray(), 1);
-                                        operandsFloating[i] = AInt16SerializerDeserializer.getShort(
-                                                argOut.getByteArray(), 1);
+                                        operandsInteger[i] = AInt16SerializerDeserializer.getShort(bytes, offset + 1);
+                                        operandsFloating[i] = operandsInteger[i];
                                         break;
                                     }
                                     case INT32: {
                                         currentType = typeInt32;
-                                        operandsInteger[i] = AInt32SerializerDeserializer.getInt(argOut.getByteArray(),
-                                                1);
-                                        operandsFloating[i] = AInt32SerializerDeserializer.getInt(
-                                                argOut.getByteArray(), 1);
+                                        operandsInteger[i] = AInt32SerializerDeserializer.getInt(bytes, offset + 1);
+                                        operandsFloating[i] = operandsInteger[i];
                                         break;
                                     }
                                     case INT64: {
                                         currentType = typeInt64;
-                                        operandsInteger[i] = AInt64SerializerDeserializer.getLong(
-                                                argOut.getByteArray(), 1);
-                                        operandsFloating[i] = AInt64SerializerDeserializer.getLong(
-                                                argOut.getByteArray(), 1);
+                                        operandsInteger[i] = AInt64SerializerDeserializer.getLong(bytes, offset + 1);
+                                        operandsFloating[i] = operandsInteger[i];
                                         break;
                                     }
                                     case FLOAT: {
                                         currentType = typeFloat;
-                                        operandsFloating[i] = AFloatSerializerDeserializer.getFloat(
-                                                argOut.getByteArray(), 1);
+                                        operandsFloating[i] = AFloatSerializerDeserializer.getFloat(bytes, offset + 1);
                                         break;
                                     }
                                     case DOUBLE: {
                                         currentType = typeDouble;
-                                        operandsFloating[i] = ADoubleSerializerDeserializer.getDouble(
-                                                argOut.getByteArray(), 1);
+                                        operandsFloating[i] = ADoubleSerializerDeserializer.getDouble(bytes,
+                                                offset + 1);
                                         break;
                                     }
                                     case DATE:
@@ -201,19 +198,20 @@
                                     case YEARMONTHDURATION:
                                     case DAYTIMEDURATION:
                                         evaluateTemporalArthmeticOperation(typeTag, tuple);
+                                        result.set(resultStorage);
                                         return;
                                     case NULL: {
                                         serde = AqlSerializerDeserializerProvider.INSTANCE
                                                 .getSerializerDeserializer(BuiltinType.ANULL);
                                         serde.serialize(ANull.NULL, out);
+                                        result.set(resultStorage);
                                         return;
                                     }
                                     default: {
                                         throw new NotImplementedException(getIdentifier().getName()
                                                 + (i == 0 ? ": Left" : ": Right")
                                                 + " operand expects INT8/INT16/INT32/INT64/FLOAT/DOUBLE/NULL, but got "
-                                                + EnumDeserializer.ATYPETAGDESERIALIZER.deserialize(argOut
-                                                        .getByteArray()[0]));
+                                                + EnumDeserializer.ATYPETAGDESERIALIZER.deserialize(bytes[offset]));
                                     }
                                 }
 
@@ -291,6 +289,7 @@
                                     serde.serialize(aDouble, out);
                                     break;
                             }
+                            result.set(resultStorage);
                         } catch (HyracksDataException hde) {
                             throw new AlgebricksException(hde);
                         }
@@ -299,10 +298,12 @@
                     @SuppressWarnings("unchecked")
                     private void evaluateTemporalArthmeticOperation(ATypeTag leftType, IFrameTupleReference tuple)
                             throws HyracksDataException, AlgebricksException {
-                        argOut1.reset();
-                        evalRight.evaluate(tuple);
-                        ATypeTag rightType = EnumDeserializer.ATYPETAGDESERIALIZER
-                                .deserialize(argOut1.getByteArray()[0]);
+                        evalRight.evaluate(tuple, argPtr1);
+                        byte[] bytes1 = argPtr1.getByteArray();
+                        int offset1 = argPtr1.getStartOffset();
+                        ATypeTag rightType = EnumDeserializer.ATYPETAGDESERIALIZER.deserialize(bytes1[offset1]);
+                        byte[] bytes0 = argPtr0.getByteArray();
+                        int offset0 = argPtr0.getStartOffset();
 
                         if (leftType == ATypeTag.NULL || rightType == ATypeTag.NULL) {
                             serde = AqlSerializerDeserializerProvider.INSTANCE
@@ -322,33 +323,30 @@
 
                             switch (leftType) {
                                 case DATE:
-                                    leftChronon = ADateSerializerDeserializer.getChronon(argOut0.getByteArray(), 1)
+                                    leftChronon = ADateSerializerDeserializer.getChronon(bytes0, offset0 + 1)
                                             * GregorianCalendarSystem.CHRONON_OF_DAY;
-                                    rightChronon = ADateSerializerDeserializer.getChronon(argOut1.getByteArray(), 1)
+                                    rightChronon = ADateSerializerDeserializer.getChronon(bytes1, offset1 + 1)
                                             * GregorianCalendarSystem.CHRONON_OF_DAY;
 
                                     break;
                                 case TIME:
-                                    leftChronon = ATimeSerializerDeserializer.getChronon(argOut0.getByteArray(), 1);
-                                    rightChronon = ATimeSerializerDeserializer.getChronon(argOut1.getByteArray(), 1);
+                                    leftChronon = ATimeSerializerDeserializer.getChronon(bytes0, offset0 + 1);
+                                    rightChronon = ATimeSerializerDeserializer.getChronon(bytes1, offset1 + 1);
                                     break;
                                 case DATETIME:
-                                    leftChronon = ADateTimeSerializerDeserializer.getChronon(argOut0.getByteArray(), 1);
-                                    rightChronon = ADateTimeSerializerDeserializer
-                                            .getChronon(argOut1.getByteArray(), 1);
+                                    leftChronon = ADateTimeSerializerDeserializer.getChronon(bytes0, offset0 + 1);
+                                    rightChronon = ADateTimeSerializerDeserializer.getChronon(bytes1, offset1 + 1);
                                     break;
                                 case YEARMONTHDURATION:
                                     yearMonth = (int) evaluateTimeInstanceArithmetic(
-                                            AYearMonthDurationSerializerDeserializer.getYearMonth(
-                                                    argOut0.getByteArray(), 1),
-                                            AYearMonthDurationSerializerDeserializer.getYearMonth(
-                                                    argOut1.getByteArray(), 1));
+                                            AYearMonthDurationSerializerDeserializer.getYearMonth(bytes0, offset0 + 1),
+                                            AYearMonthDurationSerializerDeserializer.getYearMonth(bytes1, offset1 + 1));
                                     break;
                                 case DAYTIMEDURATION:
-                                    leftChronon = ADayTimeDurationSerializerDeserializer.getDayTime(
-                                            argOut0.getByteArray(), 1);
-                                    rightChronon = ADayTimeDurationSerializerDeserializer.getDayTime(
-                                            argOut1.getByteArray(), 1);
+                                    leftChronon = ADayTimeDurationSerializerDeserializer.getDayTime(bytes0,
+                                            offset0 + 1);
+                                    rightChronon = ADayTimeDurationSerializerDeserializer.getDayTime(bytes1,
+                                            offset1 + 1);
                                     break;
                                 default:
                                     throw new NotImplementedException();
@@ -371,19 +369,18 @@
                                 case TIME:
                                     serde = AqlSerializerDeserializerProvider.INSTANCE
                                             .getSerializerDeserializer(BuiltinType.ATIME);
-                                    chronon = ATimeSerializerDeserializer.getChronon(argOut0.getByteArray(), 1);
+                                    chronon = ATimeSerializerDeserializer.getChronon(bytes0, offset0 + 1);
                                     isTimeOnly = true;
                                     resultType = ATypeTag.TIME;
                                     switch (rightType) {
                                         case DAYTIMEDURATION:
-                                            dayTime = ADayTimeDurationSerializerDeserializer.getDayTime(
-                                                    argOut1.getByteArray(), 1);
+                                            dayTime = ADayTimeDurationSerializerDeserializer.getDayTime(bytes1,
+                                                    offset1 + 1);
                                             break;
                                         case DURATION:
-                                            dayTime = ADurationSerializerDeserializer.getDayTime(
-                                                    argOut1.getByteArray(), 1);
-                                            yearMonth = ADurationSerializerDeserializer.getYearMonth(
-                                                    argOut1.getByteArray(), 1);
+                                            dayTime = ADurationSerializerDeserializer.getDayTime(bytes1, offset1 + 1);
+                                            yearMonth = ADurationSerializerDeserializer.getYearMonth(bytes1,
+                                                    offset1 + 1);
                                             break;
                                         default:
                                             throw new NotImplementedException(getIdentifier().getName()
@@ -395,29 +392,28 @@
                                     serde = AqlSerializerDeserializerProvider.INSTANCE
                                             .getSerializerDeserializer(BuiltinType.ADATE);
                                     resultType = ATypeTag.DATE;
-                                    chronon = ADateSerializerDeserializer.getChronon(argOut0.getByteArray(), 1)
+                                    chronon = ADateSerializerDeserializer.getChronon(bytes0, offset0 + 1)
                                             * GregorianCalendarSystem.CHRONON_OF_DAY;
                                 case DATETIME:
                                     if (leftType == ATypeTag.DATETIME) {
                                         serde = AqlSerializerDeserializerProvider.INSTANCE
                                                 .getSerializerDeserializer(BuiltinType.ADATETIME);
                                         resultType = ATypeTag.DATETIME;
-                                        chronon = ADateTimeSerializerDeserializer.getChronon(argOut0.getByteArray(), 1);
+                                        chronon = ADateTimeSerializerDeserializer.getChronon(bytes0, offset0 + 1);
                                     }
                                     switch (rightType) {
                                         case DURATION:
-                                            yearMonth = ADurationSerializerDeserializer.getYearMonth(
-                                                    argOut1.getByteArray(), 1);
-                                            dayTime = ADurationSerializerDeserializer.getDayTime(
-                                                    argOut1.getByteArray(), 1);
+                                            yearMonth = ADurationSerializerDeserializer.getYearMonth(bytes1,
+                                                    offset1 + 1);
+                                            dayTime = ADurationSerializerDeserializer.getDayTime(bytes1, offset1 + 1);
                                             break;
                                         case YEARMONTHDURATION:
-                                            yearMonth = AYearMonthDurationSerializerDeserializer.getYearMonth(
-                                                    argOut1.getByteArray(), 1);
+                                            yearMonth = AYearMonthDurationSerializerDeserializer.getYearMonth(bytes1,
+                                                    offset1 + 1);
                                             break;
                                         case DAYTIMEDURATION:
-                                            dayTime = ADayTimeDurationSerializerDeserializer.getDayTime(
-                                                    argOut1.getByteArray(), 1);
+                                            dayTime = ADayTimeDurationSerializerDeserializer.getDayTime(bytes1,
+                                                    offset1 + 1);
                                             break;
                                         default:
                                             throw new NotImplementedException(getIdentifier().getName()
@@ -426,21 +422,20 @@
                                     }
                                     break;
                                 case YEARMONTHDURATION:
-                                    yearMonth = AYearMonthDurationSerializerDeserializer.getYearMonth(
-                                            argOut0.getByteArray(), 1);
+                                    yearMonth = AYearMonthDurationSerializerDeserializer.getYearMonth(bytes0,
+                                            offset0 + 1);
                                     switch (rightType) {
                                         case DATETIME:
                                             serde = AqlSerializerDeserializerProvider.INSTANCE
                                                     .getSerializerDeserializer(BuiltinType.ADATETIME);
                                             resultType = ATypeTag.DATETIME;
-                                            chronon = ADateTimeSerializerDeserializer.getChronon(
-                                                    argOut1.getByteArray(), 1);
+                                            chronon = ADateTimeSerializerDeserializer.getChronon(bytes1, offset1 + 1);
                                             break;
                                         case DATE:
                                             serde = AqlSerializerDeserializerProvider.INSTANCE
                                                     .getSerializerDeserializer(BuiltinType.ADATE);
                                             resultType = ATypeTag.DATE;
-                                            chronon = ADateSerializerDeserializer.getChronon(argOut1.getByteArray(), 1)
+                                            chronon = ADateSerializerDeserializer.getChronon(bytes1, offset1 + 1)
                                                     * GregorianCalendarSystem.CHRONON_OF_DAY;
                                             break;
                                         default:
@@ -450,26 +445,25 @@
                                     }
                                     break;
                                 case DURATION:
-                                    yearMonth = ADurationSerializerDeserializer.getYearMonth(argOut0.getByteArray(), 1);
-                                    dayTime = ADurationSerializerDeserializer.getDayTime(argOut0.getByteArray(), 1);
+                                    yearMonth = ADurationSerializerDeserializer.getYearMonth(bytes0, offset0 + 1);
+                                    dayTime = ADurationSerializerDeserializer.getDayTime(bytes0, offset0 + 1);
                                 case DAYTIMEDURATION:
                                     if (leftType == ATypeTag.DAYTIMEDURATION) {
-                                        dayTime = ADayTimeDurationSerializerDeserializer.getDayTime(
-                                                argOut0.getByteArray(), 1);
+                                        dayTime = ADayTimeDurationSerializerDeserializer.getDayTime(bytes0,
+                                                offset0 + 1);
                                     }
                                     switch (rightType) {
                                         case DATETIME:
                                             serde = AqlSerializerDeserializerProvider.INSTANCE
                                                     .getSerializerDeserializer(BuiltinType.ADATETIME);
                                             resultType = ATypeTag.DATETIME;
-                                            chronon = ADateTimeSerializerDeserializer.getChronon(
-                                                    argOut1.getByteArray(), 1);
+                                            chronon = ADateTimeSerializerDeserializer.getChronon(bytes1, offset1 + 1);
                                             break;
                                         case DATE:
                                             serde = AqlSerializerDeserializerProvider.INSTANCE
                                                     .getSerializerDeserializer(BuiltinType.ADATE);
                                             resultType = ATypeTag.DATE;
-                                            chronon = ADateSerializerDeserializer.getChronon(argOut1.getByteArray(), 1)
+                                            chronon = ADateSerializerDeserializer.getChronon(bytes1, offset1 + 1)
                                                     * GregorianCalendarSystem.CHRONON_OF_DAY;
                                             break;
                                         case TIME:
@@ -477,8 +471,7 @@
                                                 serde = AqlSerializerDeserializerProvider.INSTANCE
                                                         .getSerializerDeserializer(BuiltinType.ATIME);
                                                 resultType = ATypeTag.TIME;
-                                                chronon = ATimeSerializerDeserializer.getChronon(
-                                                        argOut1.getByteArray(), 1);
+                                                chronon = ATimeSerializerDeserializer.getChronon(bytes1, offset1 + 1);
                                                 isTimeOnly = true;
                                                 break;
                                             }
@@ -489,9 +482,9 @@
                                     }
                                     break;
                                 default:
-                                    throw new NotImplementedException(getIdentifier().getName()
-                                            + ": arithmetic operation between " + leftType + " and a " + rightType
-                                            + " value is not supported.");
+                                    throw new NotImplementedException(
+                                            getIdentifier().getName() + ": arithmetic operation between " + leftType
+                                                    + " and a " + rightType + " value is not supported.");
                             }
 
                             chronon = evaluateTimeDurationArithmetic(chronon, yearMonth, dayTime, isTimeOnly);
@@ -516,9 +509,9 @@
                                     serde.serialize(aDatetime, out);
                                     break;
                                 default:
-                                    throw new NotImplementedException(getIdentifier().getName()
-                                            + ": arithmetic operation between " + leftType + " and a " + rightType
-                                            + " value is not supported.");
+                                    throw new NotImplementedException(
+                                            getIdentifier().getName() + ": arithmetic operation between " + leftType
+                                                    + " and a " + rightType + " value is not supported.");
 
                             }
                         }
diff --git a/asterix-runtime/src/main/java/org/apache/asterix/runtime/evaluators/functions/AbstractQuadStringStringEval.java b/asterix-runtime/src/main/java/org/apache/asterix/runtime/evaluators/functions/AbstractQuadStringStringEval.java
index a08551f..0085461 100644
--- a/asterix-runtime/src/main/java/org/apache/asterix/runtime/evaluators/functions/AbstractQuadStringStringEval.java
+++ b/asterix-runtime/src/main/java/org/apache/asterix/runtime/evaluators/functions/AbstractQuadStringStringEval.java
@@ -32,25 +32,29 @@
 import org.apache.asterix.om.types.EnumDeserializer;
 import org.apache.hyracks.algebricks.common.exceptions.AlgebricksException;
 import org.apache.hyracks.algebricks.core.algebra.functions.FunctionIdentifier;
-import org.apache.hyracks.algebricks.runtime.base.ICopyEvaluator;
-import org.apache.hyracks.algebricks.runtime.base.ICopyEvaluatorFactory;
+import org.apache.hyracks.algebricks.runtime.base.IScalarEvaluator;
+import org.apache.hyracks.algebricks.runtime.base.IScalarEvaluatorFactory;
+import org.apache.hyracks.api.context.IHyracksTaskContext;
 import org.apache.hyracks.api.dataflow.value.ISerializerDeserializer;
 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.data.std.util.ArrayBackedValueStorage;
 import org.apache.hyracks.dataflow.common.data.accessors.IFrameTupleReference;
 
-public abstract class AbstractQuadStringStringEval implements ICopyEvaluator {
+public abstract class AbstractQuadStringStringEval implements IScalarEvaluator {
 
-    private DataOutput dout;
-    private ArrayBackedValueStorage array0 = new ArrayBackedValueStorage();
-    private ArrayBackedValueStorage array1 = new ArrayBackedValueStorage();
-    private ArrayBackedValueStorage array2 = new ArrayBackedValueStorage();
-    private ArrayBackedValueStorage array3 = new ArrayBackedValueStorage();
-    private ICopyEvaluator eval0;
-    private ICopyEvaluator eval1;
-    private ICopyEvaluator eval2;
-    private ICopyEvaluator eval3;
+    private ArrayBackedValueStorage resultStorage = new ArrayBackedValueStorage();
+    private DataOutput dout = resultStorage.getDataOutput();
+    private IPointable array0 = new VoidPointable();
+    private IPointable array1 = new VoidPointable();
+    private IPointable array2 = new VoidPointable();
+    private IPointable array3 = new VoidPointable();
+    private IScalarEvaluator eval0;
+    private IScalarEvaluator eval1;
+    private IScalarEvaluator eval2;
+    private IScalarEvaluator eval3;
 
     private final FunctionIdentifier funcID;
 
@@ -67,46 +71,50 @@
     private final UTF8StringPointable strPtr3rd = new UTF8StringPointable();
     private final UTF8StringPointable strPtr4th = new UTF8StringPointable();
 
-    public AbstractQuadStringStringEval(DataOutput dout, ICopyEvaluatorFactory eval0, ICopyEvaluatorFactory eval1,
-            ICopyEvaluatorFactory eval2, ICopyEvaluatorFactory eval3, FunctionIdentifier funcID)
-                    throws AlgebricksException {
-        this.dout = dout;
-        this.eval0 = eval0.createEvaluator(array0);
-        this.eval1 = eval1.createEvaluator(array1);
-        this.eval2 = eval2.createEvaluator(array2);
-        this.eval3 = eval3.createEvaluator(array3);
+    public AbstractQuadStringStringEval(IHyracksTaskContext context, IScalarEvaluatorFactory eval0,
+            IScalarEvaluatorFactory eval1, IScalarEvaluatorFactory eval2, IScalarEvaluatorFactory eval3,
+            FunctionIdentifier funcID) throws AlgebricksException {
+        this.eval0 = eval0.createScalarEvaluator(context);
+        this.eval1 = eval1.createScalarEvaluator(context);
+        this.eval2 = eval2.createScalarEvaluator(context);
+        this.eval3 = eval3.createScalarEvaluator(context);
         this.funcID = funcID;
     }
 
     @SuppressWarnings("unchecked")
     @Override
-    public void evaluate(IFrameTupleReference tuple) throws AlgebricksException {
-        array0.reset();
-        eval0.evaluate(tuple);
-        array1.reset();
-        eval1.evaluate(tuple);
-        array2.reset();
-        eval2.evaluate(tuple);
-        array3.reset();
-        eval3.evaluate(tuple);
+    public void evaluate(IFrameTupleReference tuple, IPointable result) throws AlgebricksException {
+        eval0.evaluate(tuple, array0);
+        eval1.evaluate(tuple, array1);
+        eval2.evaluate(tuple, array2);
+        eval3.evaluate(tuple, array3);
 
+        resultStorage.reset();
         try {
-            if (array0.getByteArray()[0] == ATypeTag.SERIALIZED_NULL_TYPE_TAG
-                    || array1.getByteArray()[0] == ATypeTag.SERIALIZED_NULL_TYPE_TAG
-                    || array2.getByteArray()[0] == ATypeTag.SERIALIZED_NULL_TYPE_TAG
-                    || array3.getByteArray()[0] == ATypeTag.SERIALIZED_NULL_TYPE_TAG) {
+            if (array0.getByteArray()[array0.getStartOffset()] == ATypeTag.SERIALIZED_NULL_TYPE_TAG
+                    || array1.getByteArray()[array1.getStartOffset()] == ATypeTag.SERIALIZED_NULL_TYPE_TAG
+                    || array2.getByteArray()[array2.getStartOffset()] == ATypeTag.SERIALIZED_NULL_TYPE_TAG
+                    || array3.getByteArray()[array3.getStartOffset()] == ATypeTag.SERIALIZED_NULL_TYPE_TAG) {
                 nullSerde.serialize(ANull.NULL, dout);
+                result.set(resultStorage);
                 return;
-            } else if (array0.getByteArray()[0] != ATypeTag.SERIALIZED_STRING_TYPE_TAG
-                    || array1.getByteArray()[0] != ATypeTag.SERIALIZED_STRING_TYPE_TAG
-                    || array2.getByteArray()[0] != ATypeTag.SERIALIZED_STRING_TYPE_TAG
-                    || array3.getByteArray()[0] != ATypeTag.SERIALIZED_STRING_TYPE_TAG) {
+            } else if (array0.getByteArray()[array0.getStartOffset()] != ATypeTag.SERIALIZED_STRING_TYPE_TAG
+                    || array1.getByteArray()[array1.getStartOffset()] != ATypeTag.SERIALIZED_STRING_TYPE_TAG
+                    || array2.getByteArray()[array2.getStartOffset()] != ATypeTag.SERIALIZED_STRING_TYPE_TAG
+                    || array3.getByteArray()[array3.getStartOffset()] != ATypeTag.SERIALIZED_STRING_TYPE_TAG) {
                 throw new AlgebricksException(funcID.getName()
                         + ": expects input type (STRING/NULL, STRING/NULL, STRING/NULL, STRING/NULL), but got ("
-                        + EnumDeserializer.ATYPETAGDESERIALIZER.deserialize(array0.getByteArray()[0]) + ", "
-                        + EnumDeserializer.ATYPETAGDESERIALIZER.deserialize(array1.getByteArray()[0]) + ", "
-                        + EnumDeserializer.ATYPETAGDESERIALIZER.deserialize(array2.getByteArray()[0]) + ", "
-                        + EnumDeserializer.ATYPETAGDESERIALIZER.deserialize(array3.getByteArray()[0]) + ".");
+                        + EnumDeserializer.ATYPETAGDESERIALIZER
+                                .deserialize(array0.getByteArray()[array0.getStartOffset()])
+                        + ", "
+                        + EnumDeserializer.ATYPETAGDESERIALIZER
+                                .deserialize(array1.getByteArray()[array1.getStartOffset()])
+                        + ", "
+                        + EnumDeserializer.ATYPETAGDESERIALIZER
+                                .deserialize(array2.getByteArray()[array2.getStartOffset()])
+                        + ", " + EnumDeserializer.ATYPETAGDESERIALIZER
+                                .deserialize(array3.getByteArray()[array3.getStartOffset()])
+                        + ".");
             }
         } catch (HyracksDataException e) {
             throw new AlgebricksException(e);
@@ -124,6 +132,7 @@
         } catch (HyracksDataException e) {
             throw new AlgebricksException(e);
         }
+        result.set(resultStorage);
     }
 
     protected abstract String compute(UTF8StringPointable strPtr1st, UTF8StringPointable strPtr2nd,
diff --git a/asterix-runtime/src/main/java/org/apache/asterix/runtime/evaluators/functions/AbstractTripleStringBoolEval.java b/asterix-runtime/src/main/java/org/apache/asterix/runtime/evaluators/functions/AbstractTripleStringBoolEval.java
index eb32ac2..f1f07dd 100644
--- a/asterix-runtime/src/main/java/org/apache/asterix/runtime/evaluators/functions/AbstractTripleStringBoolEval.java
+++ b/asterix-runtime/src/main/java/org/apache/asterix/runtime/evaluators/functions/AbstractTripleStringBoolEval.java
@@ -28,23 +28,28 @@
 import org.apache.asterix.om.types.EnumDeserializer;
 import org.apache.hyracks.algebricks.common.exceptions.AlgebricksException;
 import org.apache.hyracks.algebricks.core.algebra.functions.FunctionIdentifier;
-import org.apache.hyracks.algebricks.runtime.base.ICopyEvaluator;
-import org.apache.hyracks.algebricks.runtime.base.ICopyEvaluatorFactory;
+import org.apache.hyracks.algebricks.runtime.base.IScalarEvaluator;
+import org.apache.hyracks.algebricks.runtime.base.IScalarEvaluatorFactory;
+import org.apache.hyracks.api.context.IHyracksTaskContext;
 import org.apache.hyracks.api.dataflow.value.ISerializerDeserializer;
 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.data.std.util.ArrayBackedValueStorage;
 import org.apache.hyracks.dataflow.common.data.accessors.IFrameTupleReference;
 
-public abstract class AbstractTripleStringBoolEval implements ICopyEvaluator {
+public abstract class AbstractTripleStringBoolEval implements IScalarEvaluator {
 
-    private DataOutput dout;
-    private ArrayBackedValueStorage array0 = new ArrayBackedValueStorage();
-    private ArrayBackedValueStorage array1 = new ArrayBackedValueStorage();
-    private ArrayBackedValueStorage array2 = new ArrayBackedValueStorage();
-    private ICopyEvaluator eval0;
-    private ICopyEvaluator eval1;
-    private ICopyEvaluator eval2;
+    private ArrayBackedValueStorage resultStorage = new ArrayBackedValueStorage();
+    private DataOutput dout = resultStorage.getDataOutput();
+    private IPointable array0 = new VoidPointable();
+    private IPointable array1 = new VoidPointable();
+    private IPointable array2 = new VoidPointable();
+    private IScalarEvaluator eval0;
+    private IScalarEvaluator eval1;
+    private IScalarEvaluator eval2;
+
     @SuppressWarnings("rawtypes")
     private ISerializerDeserializer boolSerde = AqlSerializerDeserializerProvider.INSTANCE
             .getSerializerDeserializer(BuiltinType.ABOOLEAN);
@@ -58,41 +63,45 @@
     private final UTF8StringPointable strPtr2nd = new UTF8StringPointable();
     private final UTF8StringPointable strPtr3rd = new UTF8StringPointable();
 
-    public AbstractTripleStringBoolEval(DataOutput dout, ICopyEvaluatorFactory eval0, ICopyEvaluatorFactory eval1,
-            ICopyEvaluatorFactory eval2, FunctionIdentifier funcID) throws AlgebricksException {
-        this.dout = dout;
-        this.eval0 = eval0.createEvaluator(array0);
-        this.eval1 = eval1.createEvaluator(array1);
-        this.eval2 = eval2.createEvaluator(array2);
+    public AbstractTripleStringBoolEval(IHyracksTaskContext context, IScalarEvaluatorFactory eval0,
+            IScalarEvaluatorFactory eval1, IScalarEvaluatorFactory eval2, FunctionIdentifier funcID)
+                    throws AlgebricksException {
+        this.eval0 = eval0.createScalarEvaluator(context);
+        this.eval1 = eval1.createScalarEvaluator(context);
+        this.eval2 = eval2.createScalarEvaluator(context);
         this.funcID = funcID;
     }
 
     @SuppressWarnings("unchecked")
     @Override
-    public void evaluate(IFrameTupleReference tuple) throws AlgebricksException {
-        array0.reset();
-        eval0.evaluate(tuple);
-        array1.reset();
-        eval1.evaluate(tuple);
-        array2.reset();
-        eval2.evaluate(tuple);
+    public void evaluate(IFrameTupleReference tuple, IPointable result) throws AlgebricksException {
+        eval0.evaluate(tuple, array0);
+        eval1.evaluate(tuple, array1);
+        eval2.evaluate(tuple, array2);
 
+        resultStorage.reset();
         try {
-            if (array0.getByteArray()[0] == ATypeTag.SERIALIZED_NULL_TYPE_TAG
-                    || array1.getByteArray()[0] == ATypeTag.SERIALIZED_NULL_TYPE_TAG
-                    || array2.getByteArray()[0] == ATypeTag.SERIALIZED_NULL_TYPE_TAG) {
+            if (array0.getByteArray()[array0.getStartOffset()] == ATypeTag.SERIALIZED_NULL_TYPE_TAG
+                    || array1.getByteArray()[array1.getStartOffset()] == ATypeTag.SERIALIZED_NULL_TYPE_TAG
+                    || array2.getByteArray()[array2.getStartOffset()] == ATypeTag.SERIALIZED_NULL_TYPE_TAG) {
                 nullSerde.serialize(ANull.NULL, dout);
+                result.set(resultStorage);
                 return;
             }
 
-            if (array0.getByteArray()[0] != ATypeTag.SERIALIZED_STRING_TYPE_TAG
-                    || array1.getByteArray()[0] != ATypeTag.SERIALIZED_STRING_TYPE_TAG
-                    || array2.getByteArray()[0] != ATypeTag.SERIALIZED_STRING_TYPE_TAG) {
+            if (array0.getByteArray()[array0.getStartOffset()] != ATypeTag.SERIALIZED_STRING_TYPE_TAG
+                    || array1.getByteArray()[array1.getStartOffset()] != ATypeTag.SERIALIZED_STRING_TYPE_TAG
+                    || array2.getByteArray()[array2.getStartOffset()] != ATypeTag.SERIALIZED_STRING_TYPE_TAG) {
                 throw new AlgebricksException(
                         funcID.getName() + ": expects iput type (STRING/NULL, STRING/NULL, STRING) but got ("
-                                + EnumDeserializer.ATYPETAGDESERIALIZER.deserialize(array0.getByteArray()[0]) + ", "
-                                + EnumDeserializer.ATYPETAGDESERIALIZER.deserialize(array1.getByteArray()[0]) + ", "
-                                + EnumDeserializer.ATYPETAGDESERIALIZER.deserialize(array2.getByteArray()[0]) + ")");
+                                + EnumDeserializer.ATYPETAGDESERIALIZER
+                                        .deserialize(array0.getByteArray()[array0.getStartOffset()])
+                                + ", "
+                                + EnumDeserializer.ATYPETAGDESERIALIZER
+                                        .deserialize(array1.getByteArray()[array1.getStartOffset()])
+                                + ", " + EnumDeserializer.ATYPETAGDESERIALIZER
+                                        .deserialize(array2.getByteArray()[array2.getStartOffset()])
+                                + ")");
             }
 
         } catch (HyracksDataException e) {
@@ -109,6 +118,7 @@
         } catch (HyracksDataException e) {
             throw new AlgebricksException(e);
         }
+        result.set(resultStorage);
     }
 
     protected abstract boolean compute(UTF8StringPointable strPtr1st, UTF8StringPointable strPtr2nd,
diff --git a/asterix-runtime/src/main/java/org/apache/asterix/runtime/evaluators/functions/AbstractTripleStringStringEval.java b/asterix-runtime/src/main/java/org/apache/asterix/runtime/evaluators/functions/AbstractTripleStringStringEval.java
index bc602c3..7511b82 100644
--- a/asterix-runtime/src/main/java/org/apache/asterix/runtime/evaluators/functions/AbstractTripleStringStringEval.java
+++ b/asterix-runtime/src/main/java/org/apache/asterix/runtime/evaluators/functions/AbstractTripleStringStringEval.java
@@ -28,22 +28,27 @@
 import org.apache.asterix.om.types.EnumDeserializer;
 import org.apache.hyracks.algebricks.common.exceptions.AlgebricksException;
 import org.apache.hyracks.algebricks.core.algebra.functions.FunctionIdentifier;
-import org.apache.hyracks.algebricks.runtime.base.ICopyEvaluator;
-import org.apache.hyracks.algebricks.runtime.base.ICopyEvaluatorFactory;
+import org.apache.hyracks.algebricks.runtime.base.IScalarEvaluator;
+import org.apache.hyracks.algebricks.runtime.base.IScalarEvaluatorFactory;
+import org.apache.hyracks.api.context.IHyracksTaskContext;
 import org.apache.hyracks.api.dataflow.value.ISerializerDeserializer;
 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.data.std.util.ArrayBackedValueStorage;
 import org.apache.hyracks.dataflow.common.data.accessors.IFrameTupleReference;
 
-public abstract class AbstractTripleStringStringEval implements ICopyEvaluator {
-    private DataOutput dout;
-    private ArrayBackedValueStorage array0 = new ArrayBackedValueStorage();
-    private ArrayBackedValueStorage array1 = new ArrayBackedValueStorage();
-    private ArrayBackedValueStorage array2 = new ArrayBackedValueStorage();
-    private ICopyEvaluator eval0;
-    private ICopyEvaluator eval1;
-    private ICopyEvaluator eval2;
+public abstract class AbstractTripleStringStringEval implements IScalarEvaluator {
+
+    private ArrayBackedValueStorage resultStorage = new ArrayBackedValueStorage();
+    private DataOutput dout = resultStorage.getDataOutput();
+    private IPointable array0 = new VoidPointable();
+    private IPointable array1 = new VoidPointable();
+    private IPointable array2 = new VoidPointable();
+    private IScalarEvaluator eval0;
+    private IScalarEvaluator eval1;
+    private IScalarEvaluator eval2;
 
     private AMutableString resultBuffer = new AMutableString("");
     @SuppressWarnings("rawtypes")
@@ -59,39 +64,43 @@
 
     private final FunctionIdentifier funcID;
 
-    public AbstractTripleStringStringEval(DataOutput dout, ICopyEvaluatorFactory eval0, ICopyEvaluatorFactory eval1,
-            ICopyEvaluatorFactory eval2, FunctionIdentifier funcID) throws AlgebricksException {
-        this.dout = dout;
-        this.eval0 = eval0.createEvaluator(array0);
-        this.eval1 = eval1.createEvaluator(array1);
-        this.eval2 = eval2.createEvaluator(array2);
+    public AbstractTripleStringStringEval(IHyracksTaskContext context, IScalarEvaluatorFactory eval0,
+            IScalarEvaluatorFactory eval1, IScalarEvaluatorFactory eval2, FunctionIdentifier funcID)
+                    throws AlgebricksException {
+        this.eval0 = eval0.createScalarEvaluator(context);
+        this.eval1 = eval1.createScalarEvaluator(context);
+        this.eval2 = eval2.createScalarEvaluator(context);
         this.funcID = funcID;
     }
 
     @SuppressWarnings("unchecked")
     @Override
-    public void evaluate(IFrameTupleReference tuple) throws AlgebricksException {
-        array0.reset();
-        eval0.evaluate(tuple);
-        array1.reset();
-        eval1.evaluate(tuple);
-        array2.reset();
-        eval2.evaluate(tuple);
+    public void evaluate(IFrameTupleReference tuple, IPointable result) throws AlgebricksException {
+        eval0.evaluate(tuple, array0);
+        eval1.evaluate(tuple, array1);
+        eval2.evaluate(tuple, array2);
 
+        resultStorage.reset();
         try {
-            if (array0.getByteArray()[0] == ATypeTag.SERIALIZED_NULL_TYPE_TAG
-                    || array1.getByteArray()[0] == ATypeTag.SERIALIZED_NULL_TYPE_TAG
-                    || array2.getByteArray()[0] == ATypeTag.SERIALIZED_NULL_TYPE_TAG) {
+            if (array0.getByteArray()[array0.getStartOffset()] == ATypeTag.SERIALIZED_NULL_TYPE_TAG
+                    || array1.getByteArray()[array1.getStartOffset()] == ATypeTag.SERIALIZED_NULL_TYPE_TAG
+                    || array2.getByteArray()[array2.getStartOffset()] == ATypeTag.SERIALIZED_NULL_TYPE_TAG) {
                 nullSerde.serialize(ANull.NULL, dout);
+                result.set(resultStorage);
                 return;
-            } else if (array0.getByteArray()[0] != ATypeTag.SERIALIZED_STRING_TYPE_TAG
-                    || array1.getByteArray()[0] != ATypeTag.SERIALIZED_STRING_TYPE_TAG
-                    || array2.getByteArray()[0] != ATypeTag.SERIALIZED_STRING_TYPE_TAG) {
+            } else if (array0.getByteArray()[array0.getStartOffset()] != ATypeTag.SERIALIZED_STRING_TYPE_TAG
+                    || array1.getByteArray()[array1.getStartOffset()] != ATypeTag.SERIALIZED_STRING_TYPE_TAG
+                    || array2.getByteArray()[array2.getStartOffset()] != ATypeTag.SERIALIZED_STRING_TYPE_TAG) {
                 throw new AlgebricksException(
                         funcID.getName() + ": expects input type (STRING/NULL, STRING/NULL, STRING/NULL), but got ("
-                                + EnumDeserializer.ATYPETAGDESERIALIZER.deserialize(array0.getByteArray()[0]) + ", "
-                                + EnumDeserializer.ATYPETAGDESERIALIZER.deserialize(array1.getByteArray()[0]) + ", "
-                                + EnumDeserializer.ATYPETAGDESERIALIZER.deserialize(array2.getByteArray()[0]) + ".");
+                                + EnumDeserializer.ATYPETAGDESERIALIZER
+                                        .deserialize(array0.getByteArray()[array0.getStartOffset()])
+                                + ", "
+                                + EnumDeserializer.ATYPETAGDESERIALIZER
+                                        .deserialize(array1.getByteArray()[array1.getStartOffset()])
+                                + ", " + EnumDeserializer.ATYPETAGDESERIALIZER
+                                        .deserialize(array2.getByteArray()[array2.getStartOffset()])
+                                + ".");
             }
         } catch (HyracksDataException e) {
             throw new AlgebricksException(e);
@@ -108,6 +117,7 @@
         } catch (HyracksDataException e) {
             throw new AlgebricksException(e);
         }
+        result.set(resultStorage);
     }
 
     protected abstract String compute(UTF8StringPointable strPtr1st, UTF8StringPointable strPtr2nd,
diff --git a/asterix-runtime/src/main/java/org/apache/asterix/runtime/evaluators/functions/AndDescriptor.java b/asterix-runtime/src/main/java/org/apache/asterix/runtime/evaluators/functions/AndDescriptor.java
index e310953..01abb1b 100644
--- a/asterix-runtime/src/main/java/org/apache/asterix/runtime/evaluators/functions/AndDescriptor.java
+++ b/asterix-runtime/src/main/java/org/apache/asterix/runtime/evaluators/functions/AndDescriptor.java
@@ -18,6 +18,8 @@
  */
 package org.apache.asterix.runtime.evaluators.functions;
 
+import java.io.DataOutput;
+
 import org.apache.asterix.dataflow.data.nontagged.serde.ABooleanSerializerDeserializer;
 import org.apache.asterix.formats.nontagged.AqlSerializerDeserializerProvider;
 import org.apache.asterix.om.base.ABoolean;
@@ -30,11 +32,13 @@
 import org.apache.asterix.runtime.evaluators.base.AbstractScalarFunctionDynamicDescriptor;
 import org.apache.hyracks.algebricks.common.exceptions.AlgebricksException;
 import org.apache.hyracks.algebricks.core.algebra.functions.FunctionIdentifier;
-import org.apache.hyracks.algebricks.runtime.base.ICopyEvaluator;
-import org.apache.hyracks.algebricks.runtime.base.ICopyEvaluatorFactory;
+import org.apache.hyracks.algebricks.runtime.base.IScalarEvaluator;
+import org.apache.hyracks.algebricks.runtime.base.IScalarEvaluatorFactory;
+import org.apache.hyracks.api.context.IHyracksTaskContext;
 import org.apache.hyracks.api.dataflow.value.ISerializerDeserializer;
 import org.apache.hyracks.api.exceptions.HyracksDataException;
-import org.apache.hyracks.data.std.api.IDataOutputProvider;
+import org.apache.hyracks.data.std.api.IPointable;
+import org.apache.hyracks.data.std.primitive.VoidPointable;
 import org.apache.hyracks.data.std.util.ArrayBackedValueStorage;
 import org.apache.hyracks.dataflow.common.data.accessors.IFrameTupleReference;
 
@@ -53,21 +57,23 @@
     }
 
     @Override
-    public ICopyEvaluatorFactory createEvaluatorFactory(final ICopyEvaluatorFactory[] args) throws AlgebricksException {
+    public IScalarEvaluatorFactory createEvaluatorFactory(final IScalarEvaluatorFactory[] args)
+            throws AlgebricksException {
 
-        return new ICopyEvaluatorFactory() {
+        return new IScalarEvaluatorFactory() {
             private static final long serialVersionUID = 1L;
 
             @Override
-            public ICopyEvaluator createEvaluator(final IDataOutputProvider output) throws AlgebricksException {
-                // one temp. buffer re-used by all children
-                final ArrayBackedValueStorage argOut = new ArrayBackedValueStorage();
-                final ICopyEvaluator[] evals = new ICopyEvaluator[args.length];
+            public IScalarEvaluator createScalarEvaluator(IHyracksTaskContext ctx) throws AlgebricksException {
+                final ArrayBackedValueStorage resultStorage = new ArrayBackedValueStorage();
+                final DataOutput out = resultStorage.getDataOutput();
+                final IPointable argPtr = new VoidPointable();
+                final IScalarEvaluator[] evals = new IScalarEvaluator[args.length];
                 for (int i = 0; i < evals.length; i++) {
-                    evals[i] = args[i].createEvaluator(argOut);
+                    evals[i] = args[i].createScalarEvaluator(ctx);
                 }
 
-                return new ICopyEvaluator() {
+                return new IScalarEvaluator() {
                     @SuppressWarnings("unchecked")
                     private ISerializerDeserializer<ABoolean> booleanSerde = AqlSerializerDeserializerProvider.INSTANCE
                             .getSerializerDeserializer(BuiltinType.ABOOLEAN);
@@ -76,31 +82,36 @@
                             .getSerializerDeserializer(BuiltinType.ANULL);
 
                     @Override
-                    public void evaluate(IFrameTupleReference tuple) throws AlgebricksException {
+                    public void evaluate(IFrameTupleReference tuple, IPointable result) throws AlgebricksException {
                         try {
+                            resultStorage.reset();
                             int n = args.length;
                             boolean res = true;
                             boolean metNull = false;
                             for (int i = 0; i < n; i++) {
-                                argOut.reset();
-                                evals[i].evaluate(tuple);
-                                if (argOut.getByteArray()[0] == ATypeTag.SERIALIZED_NULL_TYPE_TAG) {
+                                evals[i].evaluate(tuple, argPtr);
+                                byte[] bytes = argPtr.getByteArray();
+                                int offset = argPtr.getStartOffset();
+
+                                if (bytes[offset] == ATypeTag.SERIALIZED_NULL_TYPE_TAG) {
                                     metNull = true;
                                     continue;
                                 }
-                                boolean argResult = ABooleanSerializerDeserializer.getBoolean(argOut.getByteArray(), 1);
+                                boolean argResult = ABooleanSerializerDeserializer.getBoolean(bytes, offset + 1);
                                 res = res && argResult;
                             }
                             if (metNull) {
                                 if (!res) {
                                     ABoolean aResult = ABoolean.FALSE;
-                                    booleanSerde.serialize(aResult, output.getDataOutput());
-                                } else
-                                    nullSerde.serialize(ANull.NULL, output.getDataOutput());
+                                    booleanSerde.serialize(aResult, out);
+                                } else {
+                                    nullSerde.serialize(ANull.NULL, out);
+                                }
                             } else {
                                 ABoolean aResult = res ? (ABoolean.TRUE) : (ABoolean.FALSE);
-                                booleanSerde.serialize(aResult, output.getDataOutput());
+                                booleanSerde.serialize(aResult, out);
                             }
+                            result.set(resultStorage);
                         } catch (HyracksDataException hde) {
                             throw new AlgebricksException(hde);
                         }
diff --git a/asterix-runtime/src/main/java/org/apache/asterix/runtime/evaluators/functions/AnyCollectionMemberDescriptor.java b/asterix-runtime/src/main/java/org/apache/asterix/runtime/evaluators/functions/AnyCollectionMemberDescriptor.java
index bc5d26c..546eebd 100644
--- a/asterix-runtime/src/main/java/org/apache/asterix/runtime/evaluators/functions/AnyCollectionMemberDescriptor.java
+++ b/asterix-runtime/src/main/java/org/apache/asterix/runtime/evaluators/functions/AnyCollectionMemberDescriptor.java
@@ -36,10 +36,12 @@
 import org.apache.asterix.runtime.evaluators.base.AbstractScalarFunctionDynamicDescriptor;
 import org.apache.hyracks.algebricks.common.exceptions.AlgebricksException;
 import org.apache.hyracks.algebricks.core.algebra.functions.FunctionIdentifier;
-import org.apache.hyracks.algebricks.runtime.base.ICopyEvaluator;
-import org.apache.hyracks.algebricks.runtime.base.ICopyEvaluatorFactory;
+import org.apache.hyracks.algebricks.runtime.base.IScalarEvaluator;
+import org.apache.hyracks.algebricks.runtime.base.IScalarEvaluatorFactory;
+import org.apache.hyracks.api.context.IHyracksTaskContext;
 import org.apache.hyracks.api.dataflow.value.ISerializerDeserializer;
-import org.apache.hyracks.data.std.api.IDataOutputProvider;
+import org.apache.hyracks.data.std.api.IPointable;
+import org.apache.hyracks.data.std.primitive.VoidPointable;
 import org.apache.hyracks.data.std.util.ArrayBackedValueStorage;
 import org.apache.hyracks.dataflow.common.data.accessors.IFrameTupleReference;
 
@@ -54,7 +56,7 @@
     };
 
     @Override
-    public ICopyEvaluatorFactory createEvaluatorFactory(final ICopyEvaluatorFactory[] args) {
+    public IScalarEvaluatorFactory createEvaluatorFactory(final IScalarEvaluatorFactory[] args) {
         return new AnyCollectionMemberEvalFactory(args[0]);
     }
 
@@ -63,25 +65,27 @@
         return AsterixBuiltinFunctions.ANY_COLLECTION_MEMBER;
     }
 
-    private static class AnyCollectionMemberEvalFactory implements ICopyEvaluatorFactory {
+    private static class AnyCollectionMemberEvalFactory implements IScalarEvaluatorFactory {
 
         private static final long serialVersionUID = 1L;
-        private ICopyEvaluatorFactory listEvalFactory;
+
+        private IScalarEvaluatorFactory listEvalFactory;
         private byte serItemTypeTag;
         private ATypeTag itemTag;
         private boolean selfDescList = false;
 
-        public AnyCollectionMemberEvalFactory(ICopyEvaluatorFactory arg) {
+        public AnyCollectionMemberEvalFactory(IScalarEvaluatorFactory arg) {
             this.listEvalFactory = arg;
         }
 
         @Override
-        public ICopyEvaluator createEvaluator(final IDataOutputProvider output) throws AlgebricksException {
-            return new ICopyEvaluator() {
+        public IScalarEvaluator createScalarEvaluator(IHyracksTaskContext ctx) throws AlgebricksException {
+            return new IScalarEvaluator() {
 
-                private DataOutput out = output.getDataOutput();
-                private ArrayBackedValueStorage outInputList = new ArrayBackedValueStorage();
-                private ICopyEvaluator evalList = listEvalFactory.createEvaluator(outInputList);
+                private ArrayBackedValueStorage resultStorage = new ArrayBackedValueStorage();
+                private DataOutput out = resultStorage.getDataOutput();
+                private IPointable inputArgList = new VoidPointable();
+                private IScalarEvaluator evalList = listEvalFactory.createScalarEvaluator(ctx);
                 @SuppressWarnings("unchecked")
                 private ISerializerDeserializer<ANull> nullSerde = AqlSerializerDeserializerProvider.INSTANCE
                         .getSerializerDeserializer(BuiltinType.ANULL);
@@ -89,54 +93,60 @@
                 private int itemLength;
 
                 @Override
-                public void evaluate(IFrameTupleReference tuple) throws AlgebricksException {
+                public void evaluate(IFrameTupleReference tuple, IPointable result) throws AlgebricksException {
 
                     try {
-                        outInputList.reset();
-                        evalList.evaluate(tuple);
-                        byte[] serList = outInputList.getByteArray();
+                        resultStorage.reset();
+                        evalList.evaluate(tuple, inputArgList);
+                        byte[] serList = inputArgList.getByteArray();
+                        int offset = inputArgList.getStartOffset();
 
-                        if (serList[0] == ATypeTag.SERIALIZED_NULL_TYPE_TAG) {
+                        if (serList[offset] == ATypeTag.SERIALIZED_NULL_TYPE_TAG) {
                             nullSerde.serialize(ANull.NULL, out);
+                            result.set(resultStorage);
                             return;
                         }
 
-                        if (serList[0] != ATypeTag.SERIALIZED_ORDEREDLIST_TYPE_TAG
-                                && serList[0] != ATypeTag.SERIALIZED_UNORDEREDLIST_TYPE_TAG) {
+                        if (serList[offset] != ATypeTag.SERIALIZED_ORDEREDLIST_TYPE_TAG
+                                && serList[offset] != ATypeTag.SERIALIZED_UNORDEREDLIST_TYPE_TAG) {
                             throw new AlgebricksException(AsterixBuiltinFunctions.ANY_COLLECTION_MEMBER.getName()
                                     + ": expects input type ORDEREDLIST/UNORDEREDLIST, but got "
-                                    + EnumDeserializer.ATYPETAGDESERIALIZER.deserialize(serList[0]));
+                                    + EnumDeserializer.ATYPETAGDESERIALIZER.deserialize(serList[offset]));
                         }
 
-                        if (serList[0] == ATypeTag.SERIALIZED_ORDEREDLIST_TYPE_TAG) {
-                            if (AOrderedListSerializerDeserializer.getNumberOfItems(serList) == 0) {
+                        if (serList[offset] == ATypeTag.SERIALIZED_ORDEREDLIST_TYPE_TAG) {
+                            if (AOrderedListSerializerDeserializer.getNumberOfItems(serList, offset) == 0) {
                                 out.writeByte(ATypeTag.SERIALIZED_NULL_TYPE_TAG);
+                                result.set(resultStorage);
                                 return;
                             }
-                            itemOffset = AOrderedListSerializerDeserializer.getItemOffset(serList, 0);
+                            itemOffset = AOrderedListSerializerDeserializer.getItemOffset(serList, offset, 0);
                         } else {
-                            if (AUnorderedListSerializerDeserializer.getNumberOfItems(serList) == 0) {
+                            if (AUnorderedListSerializerDeserializer.getNumberOfItems(serList, offset) == 0) {
                                 out.writeByte(ATypeTag.SERIALIZED_NULL_TYPE_TAG);
+                                result.set(resultStorage);
                                 return;
                             }
-                            itemOffset = AUnorderedListSerializerDeserializer.getItemOffset(serList, 0);
+                            itemOffset = AUnorderedListSerializerDeserializer.getItemOffset(serList, offset, 0);
                         }
 
-                        itemTag = EnumDeserializer.ATYPETAGDESERIALIZER.deserialize(serList[1]);
-                        if (itemTag == ATypeTag.ANY)
+                        itemTag = EnumDeserializer.ATYPETAGDESERIALIZER.deserialize(serList[offset + 1]);
+                        if (itemTag == ATypeTag.ANY) {
                             selfDescList = true;
-                        else
-                            serItemTypeTag = serList[1];
+                        } else {
+                            serItemTypeTag = serList[offset + 1];
+                        }
 
                         if (selfDescList) {
                             itemTag = EnumDeserializer.ATYPETAGDESERIALIZER.deserialize(serList[itemOffset]);
                             itemLength = NonTaggedFormatUtil.getFieldValueLength(serList, itemOffset, itemTag, true)
                                     + 1;
-                            out.write(serList, itemOffset, itemLength);
+                            result.set(serList, itemOffset, itemLength);
                         } else {
                             itemLength = NonTaggedFormatUtil.getFieldValueLength(serList, itemOffset, itemTag, false);
                             out.writeByte(serItemTypeTag);
                             out.write(serList, itemOffset, itemLength);
+                            result.set(resultStorage);
                         }
                     } catch (IOException e) {
                         throw new AlgebricksException(e);
diff --git a/asterix-runtime/src/main/java/org/apache/asterix/runtime/evaluators/functions/CastListDescriptor.java b/asterix-runtime/src/main/java/org/apache/asterix/runtime/evaluators/functions/CastListDescriptor.java
index e024014..f776d1d 100644
--- a/asterix-runtime/src/main/java/org/apache/asterix/runtime/evaluators/functions/CastListDescriptor.java
+++ b/asterix-runtime/src/main/java/org/apache/asterix/runtime/evaluators/functions/CastListDescriptor.java
@@ -19,8 +19,6 @@
 
 package org.apache.asterix.runtime.evaluators.functions;
 
-import java.io.DataOutput;
-
 import org.apache.asterix.om.functions.AsterixBuiltinFunctions;
 import org.apache.asterix.om.functions.IFunctionDescriptor;
 import org.apache.asterix.om.functions.IFunctionDescriptorFactory;
@@ -33,10 +31,11 @@
 import org.apache.hyracks.algebricks.common.exceptions.AlgebricksException;
 import org.apache.hyracks.algebricks.common.utils.Triple;
 import org.apache.hyracks.algebricks.core.algebra.functions.FunctionIdentifier;
-import org.apache.hyracks.algebricks.runtime.base.ICopyEvaluator;
-import org.apache.hyracks.algebricks.runtime.base.ICopyEvaluatorFactory;
-import org.apache.hyracks.data.std.api.IDataOutputProvider;
-import org.apache.hyracks.data.std.util.ArrayBackedValueStorage;
+import org.apache.hyracks.algebricks.runtime.base.IScalarEvaluator;
+import org.apache.hyracks.algebricks.runtime.base.IScalarEvaluatorFactory;
+import org.apache.hyracks.api.context.IHyracksTaskContext;
+import org.apache.hyracks.data.std.api.IPointable;
+import org.apache.hyracks.data.std.primitive.VoidPointable;
 import org.apache.hyracks.dataflow.common.data.accessors.IFrameTupleReference;
 
 /**
@@ -47,6 +46,7 @@
 public class CastListDescriptor extends AbstractScalarFunctionDynamicDescriptor {
 
     public static final IFunctionDescriptorFactory FACTORY = new IFunctionDescriptorFactory() {
+        @Override
         public IFunctionDescriptor createFunctionDescriptor() {
             return new CastListDescriptor();
         }
@@ -67,19 +67,18 @@
     }
 
     @Override
-    public ICopyEvaluatorFactory createEvaluatorFactory(final ICopyEvaluatorFactory[] args) {
-        final ICopyEvaluatorFactory recordEvalFactory = args[0];
+    public IScalarEvaluatorFactory createEvaluatorFactory(final IScalarEvaluatorFactory[] args) {
+        final IScalarEvaluatorFactory recordEvalFactory = args[0];
 
-        return new ICopyEvaluatorFactory() {
+        return new IScalarEvaluatorFactory() {
             private static final long serialVersionUID = 1L;
 
             @Override
-            public ICopyEvaluator createEvaluator(final IDataOutputProvider output) throws AlgebricksException {
-                final DataOutput out = output.getDataOutput();
-                final ArrayBackedValueStorage recordBuffer = new ArrayBackedValueStorage();
-                final ICopyEvaluator recEvaluator = recordEvalFactory.createEvaluator(recordBuffer);
+            public IScalarEvaluator createScalarEvaluator(IHyracksTaskContext ctx) throws AlgebricksException {
+                final IPointable recordPtr = new VoidPointable();
+                final IScalarEvaluator recEvaluator = recordEvalFactory.createScalarEvaluator(ctx);
 
-                return new ICopyEvaluator() {
+                return new IScalarEvaluator() {
                     // pointable allocator
                     private PointableAllocator allocator = new PointableAllocator();
                     final IVisitablePointable recAccessor = allocator.allocateListValue(inputType);
@@ -89,14 +88,12 @@
                             resultAccessor, reqType, Boolean.FALSE);
 
                     @Override
-                    public void evaluate(IFrameTupleReference tuple) throws AlgebricksException {
+                    public void evaluate(IFrameTupleReference tuple, IPointable result) throws AlgebricksException {
                         try {
-                            recordBuffer.reset();
-                            recEvaluator.evaluate(tuple);
-                            recAccessor.set(recordBuffer);
+                            recEvaluator.evaluate(tuple, recordPtr);
+                            recAccessor.set(recordPtr);
                             recAccessor.accept(castVisitor, arg);
-                            out.write(resultAccessor.getByteArray(), resultAccessor.getStartOffset(),
-                                    resultAccessor.getLength());
+                            result.set(resultAccessor);
                         } catch (Exception ioe) {
                             throw new AlgebricksException(ioe);
                         }
diff --git a/asterix-runtime/src/main/java/org/apache/asterix/runtime/evaluators/functions/CastRecordDescriptor.java b/asterix-runtime/src/main/java/org/apache/asterix/runtime/evaluators/functions/CastRecordDescriptor.java
index 5d1ac2c..9bc43be 100644
--- a/asterix-runtime/src/main/java/org/apache/asterix/runtime/evaluators/functions/CastRecordDescriptor.java
+++ b/asterix-runtime/src/main/java/org/apache/asterix/runtime/evaluators/functions/CastRecordDescriptor.java
@@ -18,8 +18,6 @@
  */
 package org.apache.asterix.runtime.evaluators.functions;
 
-import java.io.DataOutput;
-
 import org.apache.asterix.om.functions.AsterixBuiltinFunctions;
 import org.apache.asterix.om.functions.IFunctionDescriptor;
 import org.apache.asterix.om.functions.IFunctionDescriptorFactory;
@@ -32,15 +30,17 @@
 import org.apache.hyracks.algebricks.common.exceptions.AlgebricksException;
 import org.apache.hyracks.algebricks.common.utils.Triple;
 import org.apache.hyracks.algebricks.core.algebra.functions.FunctionIdentifier;
-import org.apache.hyracks.algebricks.runtime.base.ICopyEvaluator;
-import org.apache.hyracks.algebricks.runtime.base.ICopyEvaluatorFactory;
-import org.apache.hyracks.data.std.api.IDataOutputProvider;
-import org.apache.hyracks.data.std.util.ArrayBackedValueStorage;
+import org.apache.hyracks.algebricks.runtime.base.IScalarEvaluator;
+import org.apache.hyracks.algebricks.runtime.base.IScalarEvaluatorFactory;
+import org.apache.hyracks.api.context.IHyracksTaskContext;
+import org.apache.hyracks.data.std.api.IPointable;
+import org.apache.hyracks.data.std.primitive.VoidPointable;
 import org.apache.hyracks.dataflow.common.data.accessors.IFrameTupleReference;
 
 public class CastRecordDescriptor extends AbstractScalarFunctionDynamicDescriptor {
 
     public static final IFunctionDescriptorFactory FACTORY = new IFunctionDescriptorFactory() {
+        @Override
         public IFunctionDescriptor createFunctionDescriptor() {
             return new CastRecordDescriptor();
         }
@@ -61,19 +61,18 @@
     }
 
     @Override
-    public ICopyEvaluatorFactory createEvaluatorFactory(final ICopyEvaluatorFactory[] args) {
-        final ICopyEvaluatorFactory recordEvalFactory = args[0];
+    public IScalarEvaluatorFactory createEvaluatorFactory(final IScalarEvaluatorFactory[] args) {
+        final IScalarEvaluatorFactory recordEvalFactory = args[0];
 
-        return new ICopyEvaluatorFactory() {
+        return new IScalarEvaluatorFactory() {
             private static final long serialVersionUID = 1L;
 
             @Override
-            public ICopyEvaluator createEvaluator(final IDataOutputProvider output) throws AlgebricksException {
-                final DataOutput out = output.getDataOutput();
-                final ArrayBackedValueStorage recordBuffer = new ArrayBackedValueStorage();
-                final ICopyEvaluator recEvaluator = recordEvalFactory.createEvaluator(recordBuffer);
+            public IScalarEvaluator createScalarEvaluator(IHyracksTaskContext ctx) throws AlgebricksException {
+                final IPointable recordPtr = new VoidPointable();
+                final IScalarEvaluator recEvaluator = recordEvalFactory.createScalarEvaluator(ctx);
 
-                return new ICopyEvaluator() {
+                return new IScalarEvaluator() {
                     // pointable allocator
                     private PointableAllocator allocator = new PointableAllocator();
                     final IVisitablePointable recAccessor = allocator.allocateRecordValue(inputType);
@@ -83,14 +82,12 @@
                             resultAccessor, reqType, Boolean.FALSE);
 
                     @Override
-                    public void evaluate(IFrameTupleReference tuple) throws AlgebricksException {
+                    public void evaluate(IFrameTupleReference tuple, IPointable result) throws AlgebricksException {
                         try {
-                            recordBuffer.reset();
-                            recEvaluator.evaluate(tuple);
-                            recAccessor.set(recordBuffer);
+                            recEvaluator.evaluate(tuple, recordPtr);
+                            recAccessor.set(recordPtr);
                             recAccessor.accept(castVisitor, arg);
-                            out.write(resultAccessor.getByteArray(), resultAccessor.getStartOffset(),
-                                    resultAccessor.getLength());
+                            result.set(resultAccessor);
                         } catch (Exception ioe) {
                             throw new AlgebricksException(ioe);
                         }
diff --git a/asterix-runtime/src/main/java/org/apache/asterix/runtime/evaluators/functions/CodePointToStringDescriptor.java b/asterix-runtime/src/main/java/org/apache/asterix/runtime/evaluators/functions/CodePointToStringDescriptor.java
index 6e46a23..789d2c6 100644
--- a/asterix-runtime/src/main/java/org/apache/asterix/runtime/evaluators/functions/CodePointToStringDescriptor.java
+++ b/asterix-runtime/src/main/java/org/apache/asterix/runtime/evaluators/functions/CodePointToStringDescriptor.java
@@ -32,9 +32,11 @@
 import org.apache.asterix.runtime.evaluators.base.AbstractScalarFunctionDynamicDescriptor;
 import org.apache.hyracks.algebricks.common.exceptions.AlgebricksException;
 import org.apache.hyracks.algebricks.core.algebra.functions.FunctionIdentifier;
-import org.apache.hyracks.algebricks.runtime.base.ICopyEvaluator;
-import org.apache.hyracks.algebricks.runtime.base.ICopyEvaluatorFactory;
-import org.apache.hyracks.data.std.api.IDataOutputProvider;
+import org.apache.hyracks.algebricks.runtime.base.IScalarEvaluator;
+import org.apache.hyracks.algebricks.runtime.base.IScalarEvaluatorFactory;
+import org.apache.hyracks.api.context.IHyracksTaskContext;
+import org.apache.hyracks.data.std.api.IPointable;
+import org.apache.hyracks.data.std.primitive.VoidPointable;
 import org.apache.hyracks.data.std.util.ArrayBackedValueStorage;
 import org.apache.hyracks.dataflow.common.data.accessors.IFrameTupleReference;
 import org.apache.hyracks.util.string.UTF8StringUtil;
@@ -50,36 +52,38 @@
     };
 
     @Override
-    public ICopyEvaluatorFactory createEvaluatorFactory(final ICopyEvaluatorFactory[] args) {
-        return new ICopyEvaluatorFactory() {
+    public IScalarEvaluatorFactory createEvaluatorFactory(final IScalarEvaluatorFactory[] args) {
+        return new IScalarEvaluatorFactory() {
 
             private static final long serialVersionUID = 1L;
 
             @Override
-            public ICopyEvaluator createEvaluator(final IDataOutputProvider output) throws AlgebricksException {
-                return new ICopyEvaluator() {
+            public IScalarEvaluator createScalarEvaluator(IHyracksTaskContext ctx) throws AlgebricksException {
+                return new IScalarEvaluator() {
 
-                    private DataOutput out = output.getDataOutput();
-                    private ICopyEvaluatorFactory listEvalFactory = args[0];
-                    private ArrayBackedValueStorage outInputList = new ArrayBackedValueStorage();
-                    private ICopyEvaluator evalList = listEvalFactory.createEvaluator(outInputList);
+                    private ArrayBackedValueStorage resultStorage = new ArrayBackedValueStorage();
+                    private DataOutput out = resultStorage.getDataOutput();
+                    private IScalarEvaluatorFactory listEvalFactory = args[0];
+                    private IPointable inputArgList = new VoidPointable();
+                    private IScalarEvaluator evalList = listEvalFactory.createScalarEvaluator(ctx);
 
                     private final byte[] currentUTF8 = new byte[6];
                     private final byte[] tempStoreForLength = new byte[5];
                     private final byte stringTypeTag = ATypeTag.SERIALIZED_STRING_TYPE_TAG;
 
                     @Override
-                    public void evaluate(IFrameTupleReference tuple) throws AlgebricksException {
+                    public void evaluate(IFrameTupleReference tuple, IPointable result) throws AlgebricksException {
                         try {
-                            outInputList.reset();
-                            evalList.evaluate(tuple);
-                            byte[] serOrderedList = outInputList.getByteArray();
+                            resultStorage.reset();
+                            evalList.evaluate(tuple, inputArgList);
+                            byte[] serOrderedList = inputArgList.getByteArray();
+                            int offset = inputArgList.getStartOffset();
                             int size = 0;
 
-                            if (ATypeTag.VALUE_TYPE_MAPPING[serOrderedList[0]] != ATypeTag.ORDEREDLIST) {
-                                cannotProcessException(serOrderedList[0], serOrderedList[1]);
+                            if (ATypeTag.VALUE_TYPE_MAPPING[serOrderedList[offset]] != ATypeTag.ORDEREDLIST) {
+                                cannotProcessException(serOrderedList[offset], serOrderedList[offset + 1]);
                             } else {
-                                switch (ATypeTag.VALUE_TYPE_MAPPING[serOrderedList[1]]) {
+                                switch (ATypeTag.VALUE_TYPE_MAPPING[serOrderedList[offset + 1]]) {
                                     case INT8:
                                     case INT16:
                                     case INT32:
@@ -87,10 +91,11 @@
                                     case FLOAT:
                                     case DOUBLE:
                                     case ANY:
-                                        size = AOrderedListSerializerDeserializer.getNumberOfItems(serOrderedList);
+                                        size = AOrderedListSerializerDeserializer.getNumberOfItems(serOrderedList,
+                                                offset);
                                         break;
                                     default:
-                                        cannotProcessException(serOrderedList[0], serOrderedList[1]);
+                                        cannotProcessException(serOrderedList[offset], serOrderedList[offset + 1]);
                                 }
                             }
 
@@ -99,25 +104,26 @@
                                 int utf_8_len = 0;
                                 for (int i = 0; i < size; i++) {
                                     int itemOffset = AOrderedListSerializerDeserializer.getItemOffset(serOrderedList,
-                                            i);
+                                            offset, i);
                                     int codePoint = 0;
-                                    codePoint = ATypeHierarchy
-                                            .getIntegerValueWithDifferentTypeTagPosition(serOrderedList, itemOffset, 1);
+                                    codePoint = ATypeHierarchy.getIntegerValueWithDifferentTypeTagPosition(
+                                            serOrderedList, itemOffset, offset + 1);
                                     utf_8_len += UTF8StringUtil.codePointToUTF8(codePoint, currentUTF8);
                                 }
                                 out.writeByte(stringTypeTag);
                                 UTF8StringUtil.writeUTF8Length(utf_8_len, tempStoreForLength, out);
                                 for (int i = 0; i < size; i++) {
                                     int itemOffset = AOrderedListSerializerDeserializer.getItemOffset(serOrderedList,
-                                            i);
+                                            offset, i);
                                     int codePoint = 0;
-                                    codePoint = ATypeHierarchy
-                                            .getIntegerValueWithDifferentTypeTagPosition(serOrderedList, itemOffset, 1);
+                                    codePoint = ATypeHierarchy.getIntegerValueWithDifferentTypeTagPosition(
+                                            serOrderedList, itemOffset, offset + 1);
                                     utf_8_len = UTF8StringUtil.codePointToUTF8(codePoint, currentUTF8);
                                     for (int j = 0; j < utf_8_len; j++) {
                                         out.writeByte(currentUTF8[j]);
                                     }
                                 }
+                                result.set(resultStorage);
                             } catch (AsterixException ex) {
                                 throw new AlgebricksException(ex);
                             }
diff --git a/asterix-runtime/src/main/java/org/apache/asterix/runtime/evaluators/functions/CountHashedGramTokensDescriptor.java b/asterix-runtime/src/main/java/org/apache/asterix/runtime/evaluators/functions/CountHashedGramTokensDescriptor.java
index b8492ca..7aa39bd 100644
--- a/asterix-runtime/src/main/java/org/apache/asterix/runtime/evaluators/functions/CountHashedGramTokensDescriptor.java
+++ b/asterix-runtime/src/main/java/org/apache/asterix/runtime/evaluators/functions/CountHashedGramTokensDescriptor.java
@@ -26,9 +26,9 @@
 import org.apache.asterix.runtime.evaluators.common.GramTokensEvaluator;
 import org.apache.hyracks.algebricks.common.exceptions.AlgebricksException;
 import org.apache.hyracks.algebricks.core.algebra.functions.FunctionIdentifier;
-import org.apache.hyracks.algebricks.runtime.base.ICopyEvaluator;
-import org.apache.hyracks.algebricks.runtime.base.ICopyEvaluatorFactory;
-import org.apache.hyracks.data.std.api.IDataOutputProvider;
+import org.apache.hyracks.algebricks.runtime.base.IScalarEvaluator;
+import org.apache.hyracks.algebricks.runtime.base.IScalarEvaluatorFactory;
+import org.apache.hyracks.api.context.IHyracksTaskContext;
 import org.apache.hyracks.storage.am.lsm.invertedindex.tokenizers.HashedUTF8NGramTokenFactory;
 import org.apache.hyracks.storage.am.lsm.invertedindex.tokenizers.ITokenFactory;
 import org.apache.hyracks.storage.am.lsm.invertedindex.tokenizers.NGramUTF8StringBinaryTokenizer;
@@ -37,6 +37,7 @@
 
     private static final long serialVersionUID = 1L;
     public static final IFunctionDescriptorFactory FACTORY = new IFunctionDescriptorFactory() {
+        @Override
         public IFunctionDescriptor createFunctionDescriptor() {
             return new CountHashedGramTokensDescriptor();
         }
@@ -48,16 +49,17 @@
     }
 
     @Override
-    public ICopyEvaluatorFactory createEvaluatorFactory(final ICopyEvaluatorFactory[] args) throws AlgebricksException {
-        return new ICopyEvaluatorFactory() {
+    public IScalarEvaluatorFactory createEvaluatorFactory(final IScalarEvaluatorFactory[] args)
+            throws AlgebricksException {
+        return new IScalarEvaluatorFactory() {
             private static final long serialVersionUID = 1L;
 
             @Override
-            public ICopyEvaluator createEvaluator(IDataOutputProvider output) throws AlgebricksException {
+            public IScalarEvaluator createScalarEvaluator(IHyracksTaskContext ctx) throws AlgebricksException {
                 ITokenFactory tokenFactory = new HashedUTF8NGramTokenFactory();
                 NGramUTF8StringBinaryTokenizer tokenizer = new NGramUTF8StringBinaryTokenizer(3, true, false, true,
                         tokenFactory);
-                return new GramTokensEvaluator(args, output, tokenizer, BuiltinType.AINT32);
+                return new GramTokensEvaluator(args, ctx, tokenizer, BuiltinType.AINT32);
             }
         };
     }
diff --git a/asterix-runtime/src/main/java/org/apache/asterix/runtime/evaluators/functions/CountHashedWordTokensDescriptor.java b/asterix-runtime/src/main/java/org/apache/asterix/runtime/evaluators/functions/CountHashedWordTokensDescriptor.java
index b986db6..8a11e48 100644
--- a/asterix-runtime/src/main/java/org/apache/asterix/runtime/evaluators/functions/CountHashedWordTokensDescriptor.java
+++ b/asterix-runtime/src/main/java/org/apache/asterix/runtime/evaluators/functions/CountHashedWordTokensDescriptor.java
@@ -26,9 +26,9 @@
 import org.apache.asterix.runtime.evaluators.common.WordTokensEvaluator;
 import org.apache.hyracks.algebricks.common.exceptions.AlgebricksException;
 import org.apache.hyracks.algebricks.core.algebra.functions.FunctionIdentifier;
-import org.apache.hyracks.algebricks.runtime.base.ICopyEvaluator;
-import org.apache.hyracks.algebricks.runtime.base.ICopyEvaluatorFactory;
-import org.apache.hyracks.data.std.api.IDataOutputProvider;
+import org.apache.hyracks.algebricks.runtime.base.IScalarEvaluator;
+import org.apache.hyracks.algebricks.runtime.base.IScalarEvaluatorFactory;
+import org.apache.hyracks.api.context.IHyracksTaskContext;
 import org.apache.hyracks.storage.am.lsm.invertedindex.tokenizers.DelimitedUTF8StringBinaryTokenizer;
 import org.apache.hyracks.storage.am.lsm.invertedindex.tokenizers.HashedUTF8WordTokenFactory;
 import org.apache.hyracks.storage.am.lsm.invertedindex.tokenizers.IBinaryTokenizer;
@@ -38,6 +38,7 @@
 
     private static final long serialVersionUID = 1L;
     public static final IFunctionDescriptorFactory FACTORY = new IFunctionDescriptorFactory() {
+        @Override
         public IFunctionDescriptor createFunctionDescriptor() {
             return new CountHashedWordTokensDescriptor();
         }
@@ -49,15 +50,16 @@
     }
 
     @Override
-    public ICopyEvaluatorFactory createEvaluatorFactory(final ICopyEvaluatorFactory[] args) throws AlgebricksException {
-        return new ICopyEvaluatorFactory() {
+    public IScalarEvaluatorFactory createEvaluatorFactory(final IScalarEvaluatorFactory[] args)
+            throws AlgebricksException {
+        return new IScalarEvaluatorFactory() {
             private static final long serialVersionUID = 1L;
 
             @Override
-            public ICopyEvaluator createEvaluator(IDataOutputProvider output) throws AlgebricksException {
+            public IScalarEvaluator createScalarEvaluator(IHyracksTaskContext ctx) throws AlgebricksException {
                 ITokenFactory tokenFactory = new HashedUTF8WordTokenFactory();
                 IBinaryTokenizer tokenizer = new DelimitedUTF8StringBinaryTokenizer(false, true, tokenFactory);
-                return new WordTokensEvaluator(args, output, tokenizer, BuiltinType.AINT32);
+                return new WordTokensEvaluator(args, ctx, tokenizer, BuiltinType.AINT32);
             }
         };
     }
diff --git a/asterix-runtime/src/main/java/org/apache/asterix/runtime/evaluators/functions/CreateCircleDescriptor.java b/asterix-runtime/src/main/java/org/apache/asterix/runtime/evaluators/functions/CreateCircleDescriptor.java
index 41e0371..c933174 100644
--- a/asterix-runtime/src/main/java/org/apache/asterix/runtime/evaluators/functions/CreateCircleDescriptor.java
+++ b/asterix-runtime/src/main/java/org/apache/asterix/runtime/evaluators/functions/CreateCircleDescriptor.java
@@ -37,10 +37,12 @@
 import org.apache.asterix.runtime.evaluators.base.AbstractScalarFunctionDynamicDescriptor;
 import org.apache.hyracks.algebricks.common.exceptions.AlgebricksException;
 import org.apache.hyracks.algebricks.core.algebra.functions.FunctionIdentifier;
-import org.apache.hyracks.algebricks.runtime.base.ICopyEvaluator;
-import org.apache.hyracks.algebricks.runtime.base.ICopyEvaluatorFactory;
+import org.apache.hyracks.algebricks.runtime.base.IScalarEvaluator;
+import org.apache.hyracks.algebricks.runtime.base.IScalarEvaluatorFactory;
+import org.apache.hyracks.api.context.IHyracksTaskContext;
 import org.apache.hyracks.api.dataflow.value.ISerializerDeserializer;
-import org.apache.hyracks.data.std.api.IDataOutputProvider;
+import org.apache.hyracks.data.std.api.IPointable;
+import org.apache.hyracks.data.std.primitive.VoidPointable;
 import org.apache.hyracks.data.std.util.ArrayBackedValueStorage;
 import org.apache.hyracks.dataflow.common.data.accessors.IFrameTupleReference;
 
@@ -48,30 +50,29 @@
 
     private static final long serialVersionUID = 1L;
 
-    private static final byte SER_DOUBLE_TYPE_TAG = ATypeTag.DOUBLE.serialize();
-    private static final byte SER_POINT_TYPE_TAG = ATypeTag.POINT.serialize();
-
     public static final IFunctionDescriptorFactory FACTORY = new IFunctionDescriptorFactory() {
+        @Override
         public IFunctionDescriptor createFunctionDescriptor() {
             return new CreateCircleDescriptor();
         }
     };
 
     @Override
-    public ICopyEvaluatorFactory createEvaluatorFactory(final ICopyEvaluatorFactory[] args) throws AlgebricksException {
-        return new ICopyEvaluatorFactory() {
+    public IScalarEvaluatorFactory createEvaluatorFactory(final IScalarEvaluatorFactory[] args)
+            throws AlgebricksException {
+        return new IScalarEvaluatorFactory() {
             private static final long serialVersionUID = 1L;
 
             @Override
-            public ICopyEvaluator createEvaluator(final IDataOutputProvider output) throws AlgebricksException {
-                return new ICopyEvaluator() {
+            public IScalarEvaluator createScalarEvaluator(IHyracksTaskContext ctx) throws AlgebricksException {
+                return new IScalarEvaluator() {
 
-                    private DataOutput out = output.getDataOutput();
-
-                    private ArrayBackedValueStorage outInput0 = new ArrayBackedValueStorage();
-                    private ArrayBackedValueStorage outInput1 = new ArrayBackedValueStorage();
-                    private ICopyEvaluator eval0 = args[0].createEvaluator(outInput0);
-                    private ICopyEvaluator eval1 = args[1].createEvaluator(outInput1);
+                    private ArrayBackedValueStorage resultStorage = new ArrayBackedValueStorage();
+                    private DataOutput out = resultStorage.getDataOutput();
+                    private IPointable inputArg0 = new VoidPointable();
+                    private IPointable inputArg1 = new VoidPointable();
+                    private IScalarEvaluator eval0 = args[0].createScalarEvaluator(ctx);
+                    private IScalarEvaluator eval1 = args[1].createScalarEvaluator(ctx);
                     private AMutablePoint aPoint = new AMutablePoint(0, 0);
                     private AMutableCircle aCircle = new AMutableCircle(null, 0);
                     @SuppressWarnings("unchecked")
@@ -79,34 +80,37 @@
                             .getSerializerDeserializer(BuiltinType.ACIRCLE);
 
                     @Override
-                    public void evaluate(IFrameTupleReference tuple) throws AlgebricksException {
-                        outInput0.reset();
-                        eval0.evaluate(tuple);
-                        outInput1.reset();
-                        eval1.evaluate(tuple);
+                    public void evaluate(IFrameTupleReference tuple, IPointable result) throws AlgebricksException {
+                        resultStorage.reset();
+                        eval0.evaluate(tuple, inputArg0);
+                        eval1.evaluate(tuple, inputArg1);
+
+                        byte[] bytes0 = inputArg0.getByteArray();
+                        int offset0 = inputArg0.getStartOffset();
+                        byte[] bytes1 = inputArg1.getByteArray();
+                        int offset1 = inputArg1.getStartOffset();
 
                         // Type check: (point, double)
-                        if (outInput0.getByteArray()[0] != SER_POINT_TYPE_TAG
-                                || outInput1.getByteArray()[0] != SER_DOUBLE_TYPE_TAG) {
+                        if (bytes0[offset0] != ATypeTag.SERIALIZED_POINT_TYPE_TAG
+                                || bytes1[offset1] != ATypeTag.SERIALIZED_DOUBLE_TYPE_TAG) {
                             throw new AlgebricksException(AsterixBuiltinFunctions.CREATE_CIRCLE.getName()
                                     + ": expects input type (POINT, DOUBLE) but got ("
-                                    + EnumDeserializer.ATYPETAGDESERIALIZER.deserialize(outInput0.getByteArray()[0])
-                                    + ", "
-                                    + EnumDeserializer.ATYPETAGDESERIALIZER.deserialize(outInput1.getByteArray()[0])
-                                    + ")");
+                                    + EnumDeserializer.ATYPETAGDESERIALIZER.deserialize(bytes0[offset0]) + ", "
+                                    + EnumDeserializer.ATYPETAGDESERIALIZER.deserialize(bytes1[offset1]) + ")");
                         }
 
                         try {
-                            aPoint.setValue(ADoubleSerializerDeserializer.getDouble(outInput0.getByteArray(),
-                                    APointSerializerDeserializer.getCoordinateOffset(Coordinate.X)),
-                                    ADoubleSerializerDeserializer.getDouble(outInput0.getByteArray(),
-                                            APointSerializerDeserializer.getCoordinateOffset(Coordinate.Y)));
-                            aCircle.setValue(aPoint,
-                                    ADoubleSerializerDeserializer.getDouble(outInput1.getByteArray(), 1));
+                            aPoint.setValue(
+                                    ADoubleSerializerDeserializer.getDouble(bytes0,
+                                            offset0 + APointSerializerDeserializer.getCoordinateOffset(Coordinate.X)),
+                                    ADoubleSerializerDeserializer.getDouble(bytes0,
+                                            offset0 + APointSerializerDeserializer.getCoordinateOffset(Coordinate.Y)));
+                            aCircle.setValue(aPoint, ADoubleSerializerDeserializer.getDouble(bytes1, offset1 + 1));
                             circleSerde.serialize(aCircle, out);
                         } catch (IOException e1) {
                             throw new AlgebricksException(e1);
                         }
+                        result.set(resultStorage);
                     }
                 };
             }
diff --git a/asterix-runtime/src/main/java/org/apache/asterix/runtime/evaluators/functions/CreateLineDescriptor.java b/asterix-runtime/src/main/java/org/apache/asterix/runtime/evaluators/functions/CreateLineDescriptor.java
index 2a3e837..47e7111 100644
--- a/asterix-runtime/src/main/java/org/apache/asterix/runtime/evaluators/functions/CreateLineDescriptor.java
+++ b/asterix-runtime/src/main/java/org/apache/asterix/runtime/evaluators/functions/CreateLineDescriptor.java
@@ -37,10 +37,12 @@
 import org.apache.asterix.runtime.evaluators.base.AbstractScalarFunctionDynamicDescriptor;
 import org.apache.hyracks.algebricks.common.exceptions.AlgebricksException;
 import org.apache.hyracks.algebricks.core.algebra.functions.FunctionIdentifier;
-import org.apache.hyracks.algebricks.runtime.base.ICopyEvaluator;
-import org.apache.hyracks.algebricks.runtime.base.ICopyEvaluatorFactory;
+import org.apache.hyracks.algebricks.runtime.base.IScalarEvaluator;
+import org.apache.hyracks.algebricks.runtime.base.IScalarEvaluatorFactory;
+import org.apache.hyracks.api.context.IHyracksTaskContext;
 import org.apache.hyracks.api.dataflow.value.ISerializerDeserializer;
-import org.apache.hyracks.data.std.api.IDataOutputProvider;
+import org.apache.hyracks.data.std.api.IPointable;
+import org.apache.hyracks.data.std.primitive.VoidPointable;
 import org.apache.hyracks.data.std.util.ArrayBackedValueStorage;
 import org.apache.hyracks.dataflow.common.data.accessors.IFrameTupleReference;
 
@@ -48,30 +50,29 @@
 
     private static final long serialVersionUID = 1L;
 
-    // allowed input type
-    private static final byte SER_POINT_TYPE_TAG = ATypeTag.POINT.serialize();
-
     public static final IFunctionDescriptorFactory FACTORY = new IFunctionDescriptorFactory() {
+        @Override
         public IFunctionDescriptor createFunctionDescriptor() {
             return new CreateLineDescriptor();
         }
     };
 
     @Override
-    public ICopyEvaluatorFactory createEvaluatorFactory(final ICopyEvaluatorFactory[] args) throws AlgebricksException {
-        return new ICopyEvaluatorFactory() {
+    public IScalarEvaluatorFactory createEvaluatorFactory(final IScalarEvaluatorFactory[] args)
+            throws AlgebricksException {
+        return new IScalarEvaluatorFactory() {
             private static final long serialVersionUID = 1L;
 
             @Override
-            public ICopyEvaluator createEvaluator(final IDataOutputProvider output) throws AlgebricksException {
-                return new ICopyEvaluator() {
+            public IScalarEvaluator createScalarEvaluator(IHyracksTaskContext ctx) throws AlgebricksException {
+                return new IScalarEvaluator() {
 
-                    private DataOutput out = output.getDataOutput();
-
-                    private ArrayBackedValueStorage outInput0 = new ArrayBackedValueStorage();
-                    private ArrayBackedValueStorage outInput1 = new ArrayBackedValueStorage();
-                    private ICopyEvaluator eval0 = args[0].createEvaluator(outInput0);
-                    private ICopyEvaluator eval1 = args[1].createEvaluator(outInput1);
+                    private ArrayBackedValueStorage resultStorage = new ArrayBackedValueStorage();
+                    private DataOutput out = resultStorage.getDataOutput();
+                    private IPointable inputArg0 = new VoidPointable();
+                    private IPointable inputArg1 = new VoidPointable();
+                    private IScalarEvaluator eval0 = args[0].createScalarEvaluator(ctx);
+                    private IScalarEvaluator eval1 = args[1].createScalarEvaluator(ctx);
                     private AMutableLine aLine = new AMutableLine(null, null);
                     private AMutablePoint[] aPoint = { new AMutablePoint(0, 0), new AMutablePoint(0, 0) };
                     @SuppressWarnings("unchecked")
@@ -79,37 +80,45 @@
                             .getSerializerDeserializer(BuiltinType.ALINE);
 
                     @Override
-                    public void evaluate(IFrameTupleReference tuple) throws AlgebricksException {
-                        outInput0.reset();
-                        eval0.evaluate(tuple);
-                        outInput1.reset();
-                        eval1.evaluate(tuple);
+                    public void evaluate(IFrameTupleReference tuple, IPointable result) throws AlgebricksException {
+                        resultStorage.reset();
+                        eval0.evaluate(tuple, inputArg0);
+                        eval1.evaluate(tuple, inputArg1);
+                        byte[] bytes0 = inputArg0.getByteArray();
+                        int offset0 = inputArg0.getStartOffset();
+                        byte[] bytes1 = inputArg1.getByteArray();
+                        int offset1 = inputArg1.getStartOffset();
 
                         // type-check: (point, point)
-                        if (outInput0.getByteArray()[0] != SER_POINT_TYPE_TAG
-                                || outInput1.getByteArray()[0] != SER_POINT_TYPE_TAG) {
+                        if (bytes0[offset0] != ATypeTag.SERIALIZED_POINT_TYPE_TAG
+                                || bytes1[offset1] != ATypeTag.SERIALIZED_POINT_TYPE_TAG) {
                             throw new AlgebricksException(AsterixBuiltinFunctions.CREATE_LINE.getName()
                                     + ": expects input type: (POINT, POINT) but got ("
-                                    + EnumDeserializer.ATYPETAGDESERIALIZER.deserialize(outInput0.getByteArray()[0])
-                                    + ", "
-                                    + EnumDeserializer.ATYPETAGDESERIALIZER.deserialize(outInput1.getByteArray()[0])
-                                    + ").");
+                                    + EnumDeserializer.ATYPETAGDESERIALIZER.deserialize(bytes0[offset0]) + ", "
+                                    + EnumDeserializer.ATYPETAGDESERIALIZER.deserialize(bytes1[offset1]) + ").");
                         }
 
                         try {
-                            aPoint[0].setValue(ADoubleSerializerDeserializer.getDouble(outInput0.getByteArray(),
-                                    APointSerializerDeserializer.getCoordinateOffset(Coordinate.X)),
-                                    ADoubleSerializerDeserializer.getDouble(outInput0.getByteArray(),
-                                            APointSerializerDeserializer.getCoordinateOffset(Coordinate.Y)));
-                            aPoint[1].setValue(ADoubleSerializerDeserializer.getDouble(outInput1.getByteArray(),
-                                    APointSerializerDeserializer.getCoordinateOffset(Coordinate.X)),
-                                    ADoubleSerializerDeserializer.getDouble(outInput1.getByteArray(),
-                                            APointSerializerDeserializer.getCoordinateOffset(Coordinate.Y)));
+                            aPoint[0]
+                                    .setValue(
+                                            ADoubleSerializerDeserializer.getDouble(bytes0,
+                                                    offset0 + APointSerializerDeserializer
+                                                            .getCoordinateOffset(Coordinate.X)),
+                                    ADoubleSerializerDeserializer.getDouble(bytes0,
+                                            offset0 + APointSerializerDeserializer.getCoordinateOffset(Coordinate.Y)));
+                            aPoint[1]
+                                    .setValue(
+                                            ADoubleSerializerDeserializer.getDouble(bytes1,
+                                                    offset1 + APointSerializerDeserializer
+                                                            .getCoordinateOffset(Coordinate.X)),
+                                    ADoubleSerializerDeserializer.getDouble(bytes1,
+                                            offset1 + APointSerializerDeserializer.getCoordinateOffset(Coordinate.Y)));
                             aLine.setValue(aPoint[0], aPoint[1]);
                             lineSerde.serialize(aLine, out);
                         } catch (IOException e1) {
                             throw new AlgebricksException(e1);
                         }
+                        result.set(resultStorage);
                     }
                 };
             }
diff --git a/asterix-runtime/src/main/java/org/apache/asterix/runtime/evaluators/functions/CreateMBRDescriptor.java b/asterix-runtime/src/main/java/org/apache/asterix/runtime/evaluators/functions/CreateMBRDescriptor.java
index 8a136ca..3923af7 100644
--- a/asterix-runtime/src/main/java/org/apache/asterix/runtime/evaluators/functions/CreateMBRDescriptor.java
+++ b/asterix-runtime/src/main/java/org/apache/asterix/runtime/evaluators/functions/CreateMBRDescriptor.java
@@ -25,7 +25,7 @@
 import org.apache.asterix.runtime.evaluators.common.CreateMBREvalFactory;
 import org.apache.hyracks.algebricks.common.exceptions.AlgebricksException;
 import org.apache.hyracks.algebricks.core.algebra.functions.FunctionIdentifier;
-import org.apache.hyracks.algebricks.runtime.base.ICopyEvaluatorFactory;
+import org.apache.hyracks.algebricks.runtime.base.IScalarEvaluatorFactory;
 
 public class CreateMBRDescriptor extends AbstractScalarFunctionDynamicDescriptor {
 
@@ -37,7 +37,7 @@
     };
 
     @Override
-    public ICopyEvaluatorFactory createEvaluatorFactory(final ICopyEvaluatorFactory[] args) throws AlgebricksException {
+    public IScalarEvaluatorFactory createEvaluatorFactory(final IScalarEvaluatorFactory[] args) throws AlgebricksException {
         return new CreateMBREvalFactory(args[0], args[1], args[2]);
     }
 
diff --git a/asterix-runtime/src/main/java/org/apache/asterix/runtime/evaluators/functions/CreatePointDescriptor.java b/asterix-runtime/src/main/java/org/apache/asterix/runtime/evaluators/functions/CreatePointDescriptor.java
index 7311e90..ca8ae58 100644
--- a/asterix-runtime/src/main/java/org/apache/asterix/runtime/evaluators/functions/CreatePointDescriptor.java
+++ b/asterix-runtime/src/main/java/org/apache/asterix/runtime/evaluators/functions/CreatePointDescriptor.java
@@ -22,6 +22,7 @@
 import java.io.IOException;
 
 import org.apache.asterix.dataflow.data.nontagged.serde.ADoubleSerializerDeserializer;
+import org.apache.asterix.dataflow.data.nontagged.serde.ANullSerializerDeserializer;
 import org.apache.asterix.formats.nontagged.AqlSerializerDeserializerProvider;
 import org.apache.asterix.om.base.AMutablePoint;
 import org.apache.asterix.om.base.ANull;
@@ -35,10 +36,12 @@
 import org.apache.asterix.runtime.evaluators.base.AbstractScalarFunctionDynamicDescriptor;
 import org.apache.hyracks.algebricks.common.exceptions.AlgebricksException;
 import org.apache.hyracks.algebricks.core.algebra.functions.FunctionIdentifier;
-import org.apache.hyracks.algebricks.runtime.base.ICopyEvaluator;
-import org.apache.hyracks.algebricks.runtime.base.ICopyEvaluatorFactory;
+import org.apache.hyracks.algebricks.runtime.base.IScalarEvaluator;
+import org.apache.hyracks.algebricks.runtime.base.IScalarEvaluatorFactory;
+import org.apache.hyracks.api.context.IHyracksTaskContext;
 import org.apache.hyracks.api.dataflow.value.ISerializerDeserializer;
-import org.apache.hyracks.data.std.api.IDataOutputProvider;
+import org.apache.hyracks.data.std.api.IPointable;
+import org.apache.hyracks.data.std.primitive.VoidPointable;
 import org.apache.hyracks.data.std.util.ArrayBackedValueStorage;
 import org.apache.hyracks.dataflow.common.data.accessors.IFrameTupleReference;
 
@@ -52,60 +55,61 @@
     };
 
     @Override
-    public ICopyEvaluatorFactory createEvaluatorFactory(final ICopyEvaluatorFactory[] args) throws AlgebricksException {
-        return new ICopyEvaluatorFactory() {
+    public IScalarEvaluatorFactory createEvaluatorFactory(final IScalarEvaluatorFactory[] args)
+            throws AlgebricksException {
+        return new IScalarEvaluatorFactory() {
             private static final long serialVersionUID = 1L;
 
             @Override
-            public ICopyEvaluator createEvaluator(final IDataOutputProvider output) throws AlgebricksException {
-                return new ICopyEvaluator() {
+            public IScalarEvaluator createScalarEvaluator(IHyracksTaskContext ctx) throws AlgebricksException {
+                return new IScalarEvaluator() {
 
-                    private DataOutput out = output.getDataOutput();
-
-                    private ArrayBackedValueStorage outInput0 = new ArrayBackedValueStorage();
-                    private ArrayBackedValueStorage outInput1 = new ArrayBackedValueStorage();
-                    private ICopyEvaluator eval0 = args[0].createEvaluator(outInput0);
-                    private ICopyEvaluator eval1 = args[1].createEvaluator(outInput1);
+                    private ArrayBackedValueStorage resultStorage = new ArrayBackedValueStorage();
+                    private DataOutput out = resultStorage.getDataOutput();
+                    private IPointable inputArg0 = new VoidPointable();
+                    private IPointable inputArg1 = new VoidPointable();
+                    private IScalarEvaluator eval0 = args[0].createScalarEvaluator(ctx);
+                    private IScalarEvaluator eval1 = args[1].createScalarEvaluator(ctx);
                     private AMutablePoint aPoint = new AMutablePoint(0, 0);
                     @SuppressWarnings("unchecked")
                     private ISerializerDeserializer<APoint> pointSerde = AqlSerializerDeserializerProvider.INSTANCE
                             .getSerializerDeserializer(BuiltinType.APOINT);
 
                     @Override
-                    public void evaluate(IFrameTupleReference tuple) throws AlgebricksException {
-                        outInput0.reset();
-                        eval0.evaluate(tuple);
-                        outInput1.reset();
-                        eval1.evaluate(tuple);
+                    public void evaluate(IFrameTupleReference tuple, IPointable result) throws AlgebricksException {
+                        eval0.evaluate(tuple, inputArg0);
+                        eval1.evaluate(tuple, inputArg1);
+
+                        byte[] bytes0 = inputArg0.getByteArray();
+                        int offset0 = inputArg0.getStartOffset();
+                        byte[] bytes1 = inputArg1.getByteArray();
+                        int offset1 = inputArg0.getStartOffset();
 
                         // type-check: (double, double)
-                        if ((outInput0.getByteArray()[0] != ATypeTag.SERIALIZED_DOUBLE_TYPE_TAG
-                                && outInput0.getByteArray()[0] != ATypeTag.SERIALIZED_NULL_TYPE_TAG)
-                                || (outInput1.getByteArray()[0] != ATypeTag.SERIALIZED_DOUBLE_TYPE_TAG
-                                        && outInput1.getByteArray()[0] != ATypeTag.SERIALIZED_NULL_TYPE_TAG)) {
-                            throw new AlgebricksException(
-                                    AsterixBuiltinFunctions.CREATE_POINT.getName()
-                                            + ": expects input type: (DOUBLE, DOUBLE) but got ("
-                                            + EnumDeserializer.ATYPETAGDESERIALIZER.deserialize(
-                                                    outInput0.getByteArray()[0])
-                                            + ", " + EnumDeserializer.ATYPETAGDESERIALIZER
-                                                    .deserialize(outInput1.getByteArray()[0])
-                                            + ").");
+                        if ((bytes0[offset0] != ATypeTag.SERIALIZED_DOUBLE_TYPE_TAG
+                                && bytes0[offset0] != ATypeTag.SERIALIZED_NULL_TYPE_TAG)
+                                || (bytes1[offset1] != ATypeTag.SERIALIZED_DOUBLE_TYPE_TAG
+                                        && bytes1[offset1] != ATypeTag.SERIALIZED_NULL_TYPE_TAG)) {
+                            throw new AlgebricksException(AsterixBuiltinFunctions.CREATE_POINT.getName()
+                                    + ": expects input type: (DOUBLE, DOUBLE) but got ("
+                                    + EnumDeserializer.ATYPETAGDESERIALIZER.deserialize(bytes0[offset0]) + ", "
+                                    + EnumDeserializer.ATYPETAGDESERIALIZER.deserialize(bytes1[offset1]) + ").");
                         }
 
+                        resultStorage.reset();
                         try {
-                            if (outInput0.getByteArray()[0] == ATypeTag.SERIALIZED_NULL_TYPE_TAG
-                                    || outInput1.getByteArray()[0] == ATypeTag.SERIALIZED_NULL_TYPE_TAG) {
-                                AqlSerializerDeserializerProvider.INSTANCE.getSerializerDeserializer(BuiltinType.ANULL)
-                                        .serialize(ANull.NULL, out);
+                            if (bytes0[offset0] == ATypeTag.SERIALIZED_NULL_TYPE_TAG
+                                    || bytes1[offset1] == ATypeTag.SERIALIZED_NULL_TYPE_TAG) {
+                                ANullSerializerDeserializer.INSTANCE.serialize(ANull.NULL, out);
                             } else {
-                                aPoint.setValue(ADoubleSerializerDeserializer.getDouble(outInput0.getByteArray(), 1),
-                                        ADoubleSerializerDeserializer.getDouble(outInput1.getByteArray(), 1));
+                                aPoint.setValue(ADoubleSerializerDeserializer.getDouble(bytes0, offset0 + 1),
+                                        ADoubleSerializerDeserializer.getDouble(bytes1, offset1 + 1));
                                 pointSerde.serialize(aPoint, out);
                             }
                         } catch (IOException e1) {
                             throw new AlgebricksException(e1);
                         }
+                        result.set(resultStorage);
                     }
                 };
             }
diff --git a/asterix-runtime/src/main/java/org/apache/asterix/runtime/evaluators/functions/CreatePolygonDescriptor.java b/asterix-runtime/src/main/java/org/apache/asterix/runtime/evaluators/functions/CreatePolygonDescriptor.java
index bba4478..53958b4 100644
--- a/asterix-runtime/src/main/java/org/apache/asterix/runtime/evaluators/functions/CreatePolygonDescriptor.java
+++ b/asterix-runtime/src/main/java/org/apache/asterix/runtime/evaluators/functions/CreatePolygonDescriptor.java
@@ -36,10 +36,12 @@
 import org.apache.asterix.runtime.evaluators.common.AsterixListAccessor;
 import org.apache.hyracks.algebricks.common.exceptions.AlgebricksException;
 import org.apache.hyracks.algebricks.core.algebra.functions.FunctionIdentifier;
-import org.apache.hyracks.algebricks.runtime.base.ICopyEvaluator;
-import org.apache.hyracks.algebricks.runtime.base.ICopyEvaluatorFactory;
+import org.apache.hyracks.algebricks.runtime.base.IScalarEvaluator;
+import org.apache.hyracks.algebricks.runtime.base.IScalarEvaluatorFactory;
+import org.apache.hyracks.api.context.IHyracksTaskContext;
 import org.apache.hyracks.api.dataflow.value.ISerializerDeserializer;
-import org.apache.hyracks.data.std.api.IDataOutputProvider;
+import org.apache.hyracks.data.std.api.IPointable;
+import org.apache.hyracks.data.std.primitive.VoidPointable;
 import org.apache.hyracks.data.std.util.ArrayBackedValueStorage;
 import org.apache.hyracks.dataflow.common.data.accessors.IFrameTupleReference;
 
@@ -54,37 +56,40 @@
     };
 
     @Override
-    public ICopyEvaluatorFactory createEvaluatorFactory(final ICopyEvaluatorFactory[] args) {
-        return new ICopyEvaluatorFactory() {
+    public IScalarEvaluatorFactory createEvaluatorFactory(final IScalarEvaluatorFactory[] args) {
+        return new IScalarEvaluatorFactory() {
 
             private static final long serialVersionUID = 1L;
 
             @Override
-            public ICopyEvaluator createEvaluator(final IDataOutputProvider output) throws AlgebricksException {
-                return new ICopyEvaluator() {
+            public IScalarEvaluator createScalarEvaluator(IHyracksTaskContext ctx) throws AlgebricksException {
+                return new IScalarEvaluator() {
 
                     private final AsterixListAccessor listAccessor = new AsterixListAccessor();
-                    private final DataOutput out = output.getDataOutput();
-                    private final ICopyEvaluatorFactory listEvalFactory = args[0];
-                    private final ArrayBackedValueStorage outInputList = new ArrayBackedValueStorage();
-                    private final ICopyEvaluator evalList = listEvalFactory.createEvaluator(outInputList);
+                    private final ArrayBackedValueStorage resultStorage = new ArrayBackedValueStorage();
+                    private final DataOutput out = resultStorage.getDataOutput();
+                    private final IScalarEvaluatorFactory listEvalFactory = args[0];
+                    private final IPointable inputArgList = new VoidPointable();
+                    private final IScalarEvaluator evalList = listEvalFactory.createScalarEvaluator(ctx);
                     @SuppressWarnings("unchecked")
                     private final ISerializerDeserializer<ANull> nullSerde = AqlSerializerDeserializerProvider.INSTANCE
                             .getSerializerDeserializer(BuiltinType.ANULL);
 
                     @Override
-                    public void evaluate(IFrameTupleReference tuple) throws AlgebricksException {
+                    public void evaluate(IFrameTupleReference tuple, IPointable result) throws AlgebricksException {
                         try {
-                            outInputList.reset();
-                            evalList.evaluate(tuple);
-                            byte[] listBytes = outInputList.getByteArray();
-                            if (listBytes[0] != ATypeTag.SERIALIZED_ORDEREDLIST_TYPE_TAG) {
+                            resultStorage.reset();
+                            evalList.evaluate(tuple, inputArgList);
+                            byte[] listBytes = inputArgList.getByteArray();
+                            int offset = inputArgList.getStartOffset();
+
+                            if (listBytes[offset] != ATypeTag.SERIALIZED_ORDEREDLIST_TYPE_TAG) {
                                 throw new AlgebricksException(AsterixBuiltinFunctions.CREATE_POLYGON.getName()
                                         + ": expects input type ORDEREDLIST, but got "
-                                        + EnumDeserializer.ATYPETAGDESERIALIZER.deserialize(listBytes[0]));
+                                        + EnumDeserializer.ATYPETAGDESERIALIZER.deserialize(listBytes[offset]));
                             }
                             try {
-                                listAccessor.reset(listBytes, 0);
+                                listAccessor.reset(listBytes, offset);
                             } catch (AsterixException e) {
                                 throw new AlgebricksException(e);
                             }
@@ -122,6 +127,7 @@
                                             ADoubleSerializerDeserializer.getDouble(listBytes, secondDobuleOffset),
                                             out);
                                 }
+                                result.set(resultStorage);
                             } catch (AsterixException ex) {
                                 throw new AlgebricksException(ex);
                             }
diff --git a/asterix-runtime/src/main/java/org/apache/asterix/runtime/evaluators/functions/CreateRectangleDescriptor.java b/asterix-runtime/src/main/java/org/apache/asterix/runtime/evaluators/functions/CreateRectangleDescriptor.java
index a164a0e..1762446 100644
--- a/asterix-runtime/src/main/java/org/apache/asterix/runtime/evaluators/functions/CreateRectangleDescriptor.java
+++ b/asterix-runtime/src/main/java/org/apache/asterix/runtime/evaluators/functions/CreateRectangleDescriptor.java
@@ -37,10 +37,12 @@
 import org.apache.asterix.runtime.evaluators.base.AbstractScalarFunctionDynamicDescriptor;
 import org.apache.hyracks.algebricks.common.exceptions.AlgebricksException;
 import org.apache.hyracks.algebricks.core.algebra.functions.FunctionIdentifier;
-import org.apache.hyracks.algebricks.runtime.base.ICopyEvaluator;
-import org.apache.hyracks.algebricks.runtime.base.ICopyEvaluatorFactory;
+import org.apache.hyracks.algebricks.runtime.base.IScalarEvaluator;
+import org.apache.hyracks.algebricks.runtime.base.IScalarEvaluatorFactory;
+import org.apache.hyracks.api.context.IHyracksTaskContext;
 import org.apache.hyracks.api.dataflow.value.ISerializerDeserializer;
-import org.apache.hyracks.data.std.api.IDataOutputProvider;
+import org.apache.hyracks.data.std.api.IPointable;
+import org.apache.hyracks.data.std.primitive.VoidPointable;
 import org.apache.hyracks.data.std.util.ArrayBackedValueStorage;
 import org.apache.hyracks.dataflow.common.data.accessors.IFrameTupleReference;
 
@@ -48,29 +50,29 @@
 
     private static final long serialVersionUID = 1L;
 
-    // allowed input type
-    private static final byte SER_POINT_TYPE_TAG = ATypeTag.POINT.serialize();
-
     public static final IFunctionDescriptorFactory FACTORY = new IFunctionDescriptorFactory() {
+        @Override
         public IFunctionDescriptor createFunctionDescriptor() {
             return new CreateRectangleDescriptor();
         }
     };
 
     @Override
-    public ICopyEvaluatorFactory createEvaluatorFactory(final ICopyEvaluatorFactory[] args) throws AlgebricksException {
-        return new ICopyEvaluatorFactory() {
+    public IScalarEvaluatorFactory createEvaluatorFactory(final IScalarEvaluatorFactory[] args)
+            throws AlgebricksException {
+        return new IScalarEvaluatorFactory() {
             private static final long serialVersionUID = 1L;
 
             @Override
-            public ICopyEvaluator createEvaluator(final IDataOutputProvider output) throws AlgebricksException {
-                return new ICopyEvaluator() {
-                    private DataOutput out = output.getDataOutput();
+            public IScalarEvaluator createScalarEvaluator(IHyracksTaskContext ctx) throws AlgebricksException {
+                return new IScalarEvaluator() {
+                    private ArrayBackedValueStorage resultStorage = new ArrayBackedValueStorage();
+                    private DataOutput out = resultStorage.getDataOutput();
 
-                    private ArrayBackedValueStorage outInput0 = new ArrayBackedValueStorage();
-                    private ArrayBackedValueStorage outInput1 = new ArrayBackedValueStorage();
-                    private ICopyEvaluator eval0 = args[0].createEvaluator(outInput0);
-                    private ICopyEvaluator eval1 = args[1].createEvaluator(outInput1);
+                    private IPointable inputArg0 = new VoidPointable();
+                    private IPointable inputArg1 = new VoidPointable();
+                    private IScalarEvaluator eval0 = args[0].createScalarEvaluator(ctx);
+                    private IScalarEvaluator eval1 = args[1].createScalarEvaluator(ctx);
                     private AMutableRectangle aRectangle = new AMutableRectangle(null, null);
                     private AMutablePoint[] aPoint = { new AMutablePoint(0, 0), new AMutablePoint(0, 0) };
                     @SuppressWarnings("unchecked")
@@ -78,31 +80,39 @@
                             .getSerializerDeserializer(BuiltinType.ARECTANGLE);
 
                     @Override
-                    public void evaluate(IFrameTupleReference tuple) throws AlgebricksException {
-                        outInput0.reset();
-                        eval0.evaluate(tuple);
-                        outInput1.reset();
-                        eval1.evaluate(tuple);
+                    public void evaluate(IFrameTupleReference tuple, IPointable result) throws AlgebricksException {
+                        eval0.evaluate(tuple, inputArg0);
+                        eval1.evaluate(tuple, inputArg1);
 
-                        if (outInput0.getByteArray()[0] != SER_POINT_TYPE_TAG
-                                || outInput1.getByteArray()[0] != SER_POINT_TYPE_TAG) {
+                        byte[] bytes0 = inputArg0.getByteArray();
+                        int offset0 = inputArg0.getStartOffset();
+                        byte[] bytes1 = inputArg1.getByteArray();
+                        int offset1 = inputArg1.getStartOffset();
+
+                        resultStorage.reset();
+                        if (bytes0[offset0] != ATypeTag.SERIALIZED_POINT_TYPE_TAG
+                                || bytes1[offset1] != ATypeTag.SERIALIZED_POINT_TYPE_TAG) {
                             throw new AlgebricksException(AsterixBuiltinFunctions.CREATE_RECTANGLE.getName()
                                     + ": expects input type: (POINT, POINT) but got ("
-                                    + EnumDeserializer.ATYPETAGDESERIALIZER.deserialize(outInput0.getByteArray()[0])
-                                    + ", "
-                                    + EnumDeserializer.ATYPETAGDESERIALIZER.deserialize(outInput1.getByteArray()[0])
-                                    + ".");
+                                    + EnumDeserializer.ATYPETAGDESERIALIZER.deserialize(bytes0[offset0]) + ", "
+                                    + EnumDeserializer.ATYPETAGDESERIALIZER.deserialize(bytes1[offset1]) + ".");
                         }
 
                         try {
-                            aPoint[0].setValue(ADoubleSerializerDeserializer.getDouble(outInput0.getByteArray(),
-                                    APointSerializerDeserializer.getCoordinateOffset(Coordinate.X)),
-                                    ADoubleSerializerDeserializer.getDouble(outInput0.getByteArray(),
-                                            APointSerializerDeserializer.getCoordinateOffset(Coordinate.Y)));
-                            aPoint[1].setValue(ADoubleSerializerDeserializer.getDouble(outInput1.getByteArray(),
-                                    APointSerializerDeserializer.getCoordinateOffset(Coordinate.X)),
-                                    ADoubleSerializerDeserializer.getDouble(outInput1.getByteArray(),
-                                            APointSerializerDeserializer.getCoordinateOffset(Coordinate.Y)));
+                            aPoint[0]
+                                    .setValue(
+                                            ADoubleSerializerDeserializer.getDouble(bytes0,
+                                                    offset0 + APointSerializerDeserializer
+                                                            .getCoordinateOffset(Coordinate.X)),
+                                    ADoubleSerializerDeserializer.getDouble(bytes0,
+                                            offset0 + APointSerializerDeserializer.getCoordinateOffset(Coordinate.Y)));
+                            aPoint[1]
+                                    .setValue(
+                                            ADoubleSerializerDeserializer.getDouble(bytes1,
+                                                    offset1 + APointSerializerDeserializer
+                                                            .getCoordinateOffset(Coordinate.X)),
+                                    ADoubleSerializerDeserializer.getDouble(bytes1,
+                                            offset1 + APointSerializerDeserializer.getCoordinateOffset(Coordinate.Y)));
                             if (aPoint[0].getX() > aPoint[1].getX() && aPoint[0].getY() > aPoint[1].getY()) {
                                 aRectangle.setValue(aPoint[1], aPoint[0]);
                             } else if (aPoint[0].getX() < aPoint[1].getX() && aPoint[0].getY() < aPoint[1].getY()) {
@@ -112,6 +122,7 @@
                                         "Rectangle arugment must be either (bottom left point, top right point) or (top right point, bottom left point)");
                             }
                             rectangle2DSerde.serialize(aRectangle, out);
+                            result.set(resultStorage);
                         } catch (IOException e1) {
                             throw new AlgebricksException(e1);
                         }
diff --git a/asterix-runtime/src/main/java/org/apache/asterix/runtime/evaluators/functions/CreateUUIDDescriptor.java b/asterix-runtime/src/main/java/org/apache/asterix/runtime/evaluators/functions/CreateUUIDDescriptor.java
index be2f700..cde092d 100644
--- a/asterix-runtime/src/main/java/org/apache/asterix/runtime/evaluators/functions/CreateUUIDDescriptor.java
+++ b/asterix-runtime/src/main/java/org/apache/asterix/runtime/evaluators/functions/CreateUUIDDescriptor.java
@@ -18,6 +18,8 @@
  */
 package org.apache.asterix.runtime.evaluators.functions;
 
+import java.io.DataOutput;
+
 import org.apache.asterix.formats.nontagged.AqlSerializerDeserializerProvider;
 import org.apache.asterix.om.base.AGeneratedUUID;
 import org.apache.asterix.om.base.AUUID;
@@ -28,11 +30,13 @@
 import org.apache.asterix.runtime.evaluators.base.AbstractScalarFunctionDynamicDescriptor;
 import org.apache.hyracks.algebricks.common.exceptions.AlgebricksException;
 import org.apache.hyracks.algebricks.core.algebra.functions.FunctionIdentifier;
-import org.apache.hyracks.algebricks.runtime.base.ICopyEvaluator;
-import org.apache.hyracks.algebricks.runtime.base.ICopyEvaluatorFactory;
+import org.apache.hyracks.algebricks.runtime.base.IScalarEvaluator;
+import org.apache.hyracks.algebricks.runtime.base.IScalarEvaluatorFactory;
+import org.apache.hyracks.api.context.IHyracksTaskContext;
 import org.apache.hyracks.api.dataflow.value.ISerializerDeserializer;
 import org.apache.hyracks.api.exceptions.HyracksDataException;
-import org.apache.hyracks.data.std.api.IDataOutputProvider;
+import org.apache.hyracks.data.std.api.IPointable;
+import org.apache.hyracks.data.std.util.ArrayBackedValueStorage;
 import org.apache.hyracks.dataflow.common.data.accessors.IFrameTupleReference;
 
 public class CreateUUIDDescriptor extends AbstractScalarFunctionDynamicDescriptor {
@@ -40,14 +44,15 @@
     private static final long serialVersionUID = 1L;
 
     public static final IFunctionDescriptorFactory FACTORY = new IFunctionDescriptorFactory() {
+        @Override
         public IFunctionDescriptor createFunctionDescriptor() {
             return new CreateUUIDDescriptor();
         }
     };
 
     @Override
-    public ICopyEvaluatorFactory createEvaluatorFactory(ICopyEvaluatorFactory[] args) throws AlgebricksException {
-        return new ICopyEvaluatorFactory() {
+    public IScalarEvaluatorFactory createEvaluatorFactory(IScalarEvaluatorFactory[] args) throws AlgebricksException {
+        return new IScalarEvaluatorFactory() {
 
             private static final long serialVersionUID = 1L;
 
@@ -56,15 +61,19 @@
                     .getSerializerDeserializer(BuiltinType.AUUID);
 
             @Override
-            public ICopyEvaluator createEvaluator(final IDataOutputProvider output) throws AlgebricksException {
-                return new ICopyEvaluator() {
-                    final AGeneratedUUID uuid = new AGeneratedUUID();
+            public IScalarEvaluator createScalarEvaluator(IHyracksTaskContext ctx) throws AlgebricksException {
+                return new IScalarEvaluator() {
+                    private final ArrayBackedValueStorage resultStorage = new ArrayBackedValueStorage();
+                    private final DataOutput output = resultStorage.getDataOutput();
+                    private final AGeneratedUUID uuid = new AGeneratedUUID();
 
                     @Override
-                    public void evaluate(IFrameTupleReference tuple) throws AlgebricksException {
+                    public void evaluate(IFrameTupleReference tuple, IPointable result) throws AlgebricksException {
                         uuid.nextUUID();
                         try {
-                            uuidSerDe.serialize(uuid, output.getDataOutput());
+                            resultStorage.reset();
+                            uuidSerDe.serialize(uuid, output);
+                            result.set(resultStorage);
                         } catch (HyracksDataException e) {
                             throw new AlgebricksException(e);
                         }
diff --git a/asterix-runtime/src/main/java/org/apache/asterix/runtime/evaluators/functions/DeepEqualityDescriptor.java b/asterix-runtime/src/main/java/org/apache/asterix/runtime/evaluators/functions/DeepEqualityDescriptor.java
index e6a4232..174deb1 100644
--- a/asterix-runtime/src/main/java/org/apache/asterix/runtime/evaluators/functions/DeepEqualityDescriptor.java
+++ b/asterix-runtime/src/main/java/org/apache/asterix/runtime/evaluators/functions/DeepEqualityDescriptor.java
@@ -34,15 +34,17 @@
 import org.apache.asterix.runtime.evaluators.comparisons.DeepEqualAssessor;
 import org.apache.hyracks.algebricks.common.exceptions.AlgebricksException;
 import org.apache.hyracks.algebricks.core.algebra.functions.FunctionIdentifier;
-import org.apache.hyracks.algebricks.runtime.base.ICopyEvaluator;
-import org.apache.hyracks.algebricks.runtime.base.ICopyEvaluatorFactory;
+import org.apache.hyracks.algebricks.runtime.base.IScalarEvaluator;
+import org.apache.hyracks.algebricks.runtime.base.IScalarEvaluatorFactory;
+import org.apache.hyracks.api.context.IHyracksTaskContext;
 import org.apache.hyracks.api.dataflow.value.ISerializerDeserializer;
-import org.apache.hyracks.data.std.api.IDataOutputProvider;
+import org.apache.hyracks.data.std.api.IPointable;
 import org.apache.hyracks.data.std.util.ArrayBackedValueStorage;
 import org.apache.hyracks.dataflow.common.data.accessors.IFrameTupleReference;
 
 public class DeepEqualityDescriptor extends AbstractScalarFunctionDynamicDescriptor {
     public static final IFunctionDescriptorFactory FACTORY = new IFunctionDescriptorFactory() {
+        @Override
         public IFunctionDescriptor createFunctionDescriptor() {
             return new DeepEqualityDescriptor();
         }
@@ -58,45 +60,42 @@
     }
 
     @Override
-    public ICopyEvaluatorFactory createEvaluatorFactory(final ICopyEvaluatorFactory[] args) {
-        final ICopyEvaluatorFactory evalFactoryLeft = args[0];
-        final ICopyEvaluatorFactory evalFactoryRight = args[1];
+    public IScalarEvaluatorFactory createEvaluatorFactory(final IScalarEvaluatorFactory[] args) {
+        final IScalarEvaluatorFactory evalFactoryLeft = args[0];
+        final IScalarEvaluatorFactory evalFactoryRight = args[1];
 
-        return new ICopyEvaluatorFactory() {
+        return new IScalarEvaluatorFactory() {
             private static final long serialVersionUID = 1L;
-            private final ISerializerDeserializer boolSerde = AqlSerializerDeserializerProvider.INSTANCE
+            @SuppressWarnings("unchecked")
+            private final ISerializerDeserializer<ABoolean> boolSerde = AqlSerializerDeserializerProvider.INSTANCE
                     .getSerializerDeserializer(BuiltinType.ABOOLEAN);
 
             @Override
-            public ICopyEvaluator createEvaluator(final IDataOutputProvider output) throws AlgebricksException {
-                final DataOutput out = output.getDataOutput();
-                final ArrayBackedValueStorage abvsLeft = new ArrayBackedValueStorage();
-                final ICopyEvaluator evalLeft = evalFactoryLeft.createEvaluator(abvsLeft);
-
-                final ArrayBackedValueStorage abvsRight = new ArrayBackedValueStorage();
-                final ICopyEvaluator evalRight = evalFactoryRight.createEvaluator(abvsRight);
+            public IScalarEvaluator createScalarEvaluator(IHyracksTaskContext ctx) throws AlgebricksException {
+                final ArrayBackedValueStorage resultStorage = new ArrayBackedValueStorage();
+                final DataOutput out = resultStorage.getDataOutput();
+                final IScalarEvaluator evalLeft = evalFactoryLeft.createScalarEvaluator(ctx);
+                final IScalarEvaluator evalRight = evalFactoryRight.createScalarEvaluator(ctx);
                 final DeepEqualAssessor deepEqualAssessor = new DeepEqualAssessor();
 
-                return new ICopyEvaluator() {
+                return new IScalarEvaluator() {
                     private final PointableAllocator allocator = new PointableAllocator();
                     private final IVisitablePointable pointableLeft = allocator.allocateFieldValue(inputTypeLeft);
                     private final IVisitablePointable pointableRight = allocator.allocateFieldValue(inputTypeRight);
 
                     @Override
-                    public void evaluate(IFrameTupleReference tuple) throws AlgebricksException {
+                    public void evaluate(IFrameTupleReference tuple, IPointable result) throws AlgebricksException {
                         try {
-                            abvsLeft.reset();
-                            abvsRight.reset();
-                            evalLeft.evaluate(tuple);
-                            evalRight.evaluate(tuple);
-                            pointableLeft.set(abvsLeft);
-                            pointableRight.set(abvsRight);
+                            evalLeft.evaluate(tuple, pointableLeft);
+                            evalRight.evaluate(tuple, pointableRight);
 
                             // Using deep equality assessment to assess the equality of the two values
                             boolean isEqual = deepEqualAssessor.isEqual(pointableLeft, pointableRight);
-                            ABoolean result = isEqual ? ABoolean.TRUE : ABoolean.FALSE;
+                            ABoolean resultBit = isEqual ? ABoolean.TRUE : ABoolean.FALSE;
 
-                            boolSerde.serialize(result, out);
+                            resultStorage.reset();
+                            boolSerde.serialize(resultBit, out);
+                            result.set(resultStorage);
                         } catch (Exception ioe) {
                             throw new AlgebricksException(ioe);
                         }
diff --git a/asterix-runtime/src/main/java/org/apache/asterix/runtime/evaluators/functions/EditDistanceCheckDescriptor.java b/asterix-runtime/src/main/java/org/apache/asterix/runtime/evaluators/functions/EditDistanceCheckDescriptor.java
index 6fdf1de..f1cc899 100644
--- a/asterix-runtime/src/main/java/org/apache/asterix/runtime/evaluators/functions/EditDistanceCheckDescriptor.java
+++ b/asterix-runtime/src/main/java/org/apache/asterix/runtime/evaluators/functions/EditDistanceCheckDescriptor.java
@@ -25,27 +25,29 @@
 import org.apache.asterix.runtime.evaluators.common.EditDistanceCheckEvaluator;
 import org.apache.hyracks.algebricks.common.exceptions.AlgebricksException;
 import org.apache.hyracks.algebricks.core.algebra.functions.FunctionIdentifier;
-import org.apache.hyracks.algebricks.runtime.base.ICopyEvaluator;
-import org.apache.hyracks.algebricks.runtime.base.ICopyEvaluatorFactory;
-import org.apache.hyracks.data.std.api.IDataOutputProvider;
+import org.apache.hyracks.algebricks.runtime.base.IScalarEvaluator;
+import org.apache.hyracks.algebricks.runtime.base.IScalarEvaluatorFactory;
+import org.apache.hyracks.api.context.IHyracksTaskContext;
 
 public class EditDistanceCheckDescriptor extends AbstractScalarFunctionDynamicDescriptor {
 
     private static final long serialVersionUID = 1L;
     public static final IFunctionDescriptorFactory FACTORY = new IFunctionDescriptorFactory() {
+        @Override
         public IFunctionDescriptor createFunctionDescriptor() {
             return new EditDistanceCheckDescriptor();
         }
     };
 
     @Override
-    public ICopyEvaluatorFactory createEvaluatorFactory(final ICopyEvaluatorFactory[] args) throws AlgebricksException {
-        return new ICopyEvaluatorFactory() {
+    public IScalarEvaluatorFactory createEvaluatorFactory(final IScalarEvaluatorFactory[] args)
+            throws AlgebricksException {
+        return new IScalarEvaluatorFactory() {
             private static final long serialVersionUID = 1L;
 
             @Override
-            public ICopyEvaluator createEvaluator(IDataOutputProvider output) throws AlgebricksException {
-                return new EditDistanceCheckEvaluator(args, output);
+            public IScalarEvaluator createScalarEvaluator(IHyracksTaskContext ctx) throws AlgebricksException {
+                return new EditDistanceCheckEvaluator(args, ctx);
             }
         };
     }
diff --git a/asterix-runtime/src/main/java/org/apache/asterix/runtime/evaluators/functions/EditDistanceContainsDescriptor.java b/asterix-runtime/src/main/java/org/apache/asterix/runtime/evaluators/functions/EditDistanceContainsDescriptor.java
index 965c5ef..7bdc178 100644
--- a/asterix-runtime/src/main/java/org/apache/asterix/runtime/evaluators/functions/EditDistanceContainsDescriptor.java
+++ b/asterix-runtime/src/main/java/org/apache/asterix/runtime/evaluators/functions/EditDistanceContainsDescriptor.java
@@ -25,27 +25,29 @@
 import org.apache.asterix.runtime.evaluators.common.EditDistanceContainsEvaluator;
 import org.apache.hyracks.algebricks.common.exceptions.AlgebricksException;
 import org.apache.hyracks.algebricks.core.algebra.functions.FunctionIdentifier;
-import org.apache.hyracks.algebricks.runtime.base.ICopyEvaluator;
-import org.apache.hyracks.algebricks.runtime.base.ICopyEvaluatorFactory;
-import org.apache.hyracks.data.std.api.IDataOutputProvider;
+import org.apache.hyracks.algebricks.runtime.base.IScalarEvaluator;
+import org.apache.hyracks.algebricks.runtime.base.IScalarEvaluatorFactory;
+import org.apache.hyracks.api.context.IHyracksTaskContext;
 
 public class EditDistanceContainsDescriptor extends AbstractScalarFunctionDynamicDescriptor {
 
     private static final long serialVersionUID = 1L;
     public static final IFunctionDescriptorFactory FACTORY = new IFunctionDescriptorFactory() {
+        @Override
         public IFunctionDescriptor createFunctionDescriptor() {
             return new EditDistanceContainsDescriptor();
         }
     };
 
     @Override
-    public ICopyEvaluatorFactory createEvaluatorFactory(final ICopyEvaluatorFactory[] args) throws AlgebricksException {
-        return new ICopyEvaluatorFactory() {
+    public IScalarEvaluatorFactory createEvaluatorFactory(final IScalarEvaluatorFactory[] args)
+            throws AlgebricksException {
+        return new IScalarEvaluatorFactory() {
             private static final long serialVersionUID = 1L;
 
             @Override
-            public ICopyEvaluator createEvaluator(IDataOutputProvider output) throws AlgebricksException {
-                return new EditDistanceContainsEvaluator(args, output);
+            public IScalarEvaluator createScalarEvaluator(IHyracksTaskContext ctx) throws AlgebricksException {
+                return new EditDistanceContainsEvaluator(args, ctx);
             }
         };
     }
diff --git a/asterix-runtime/src/main/java/org/apache/asterix/runtime/evaluators/functions/EditDistanceDescriptor.java b/asterix-runtime/src/main/java/org/apache/asterix/runtime/evaluators/functions/EditDistanceDescriptor.java
index be610ed..88b9b31 100644
--- a/asterix-runtime/src/main/java/org/apache/asterix/runtime/evaluators/functions/EditDistanceDescriptor.java
+++ b/asterix-runtime/src/main/java/org/apache/asterix/runtime/evaluators/functions/EditDistanceDescriptor.java
@@ -25,27 +25,29 @@
 import org.apache.asterix.runtime.evaluators.common.EditDistanceEvaluator;
 import org.apache.hyracks.algebricks.common.exceptions.AlgebricksException;
 import org.apache.hyracks.algebricks.core.algebra.functions.FunctionIdentifier;
-import org.apache.hyracks.algebricks.runtime.base.ICopyEvaluator;
-import org.apache.hyracks.algebricks.runtime.base.ICopyEvaluatorFactory;
-import org.apache.hyracks.data.std.api.IDataOutputProvider;
+import org.apache.hyracks.algebricks.runtime.base.IScalarEvaluator;
+import org.apache.hyracks.algebricks.runtime.base.IScalarEvaluatorFactory;
+import org.apache.hyracks.api.context.IHyracksTaskContext;
 
 public class EditDistanceDescriptor extends AbstractScalarFunctionDynamicDescriptor {
 
     private static final long serialVersionUID = 1L;
     public static final IFunctionDescriptorFactory FACTORY = new IFunctionDescriptorFactory() {
+        @Override
         public IFunctionDescriptor createFunctionDescriptor() {
             return new EditDistanceDescriptor();
         }
     };
 
     @Override
-    public ICopyEvaluatorFactory createEvaluatorFactory(final ICopyEvaluatorFactory[] args) throws AlgebricksException {
-        return new ICopyEvaluatorFactory() {
+    public IScalarEvaluatorFactory createEvaluatorFactory(final IScalarEvaluatorFactory[] args)
+            throws AlgebricksException {
+        return new IScalarEvaluatorFactory() {
             private static final long serialVersionUID = 1L;
 
             @Override
-            public ICopyEvaluator createEvaluator(IDataOutputProvider output) throws AlgebricksException {
-                return new EditDistanceEvaluator(args, output);
+            public IScalarEvaluator createScalarEvaluator(IHyracksTaskContext ctx) throws AlgebricksException {
+                return new EditDistanceEvaluator(args, ctx);
             }
         };
     }
diff --git a/asterix-runtime/src/main/java/org/apache/asterix/runtime/evaluators/functions/EditDistanceListIsFilterable.java b/asterix-runtime/src/main/java/org/apache/asterix/runtime/evaluators/functions/EditDistanceListIsFilterable.java
index c1936a6..01ddb55 100644
--- a/asterix-runtime/src/main/java/org/apache/asterix/runtime/evaluators/functions/EditDistanceListIsFilterable.java
+++ b/asterix-runtime/src/main/java/org/apache/asterix/runtime/evaluators/functions/EditDistanceListIsFilterable.java
@@ -18,6 +18,7 @@
  */
 package org.apache.asterix.runtime.evaluators.functions;
 
+import java.io.DataOutput;
 import java.io.IOException;
 
 import org.apache.asterix.dataflow.data.nontagged.serde.AOrderedListSerializerDeserializer;
@@ -34,11 +35,13 @@
 import org.apache.asterix.runtime.evaluators.base.AbstractScalarFunctionDynamicDescriptor;
 import org.apache.hyracks.algebricks.common.exceptions.AlgebricksException;
 import org.apache.hyracks.algebricks.core.algebra.functions.FunctionIdentifier;
-import org.apache.hyracks.algebricks.runtime.base.ICopyEvaluator;
-import org.apache.hyracks.algebricks.runtime.base.ICopyEvaluatorFactory;
+import org.apache.hyracks.algebricks.runtime.base.IScalarEvaluator;
+import org.apache.hyracks.algebricks.runtime.base.IScalarEvaluatorFactory;
+import org.apache.hyracks.api.context.IHyracksTaskContext;
 import org.apache.hyracks.api.dataflow.value.ISerializerDeserializer;
 import org.apache.hyracks.api.exceptions.HyracksDataException;
-import org.apache.hyracks.data.std.api.IDataOutputProvider;
+import org.apache.hyracks.data.std.api.IPointable;
+import org.apache.hyracks.data.std.primitive.VoidPointable;
 import org.apache.hyracks.data.std.util.ArrayBackedValueStorage;
 import org.apache.hyracks.dataflow.common.data.accessors.IFrameTupleReference;
 
@@ -54,19 +57,21 @@
     private static final long serialVersionUID = 1L;
 
     public static final IFunctionDescriptorFactory FACTORY = new IFunctionDescriptorFactory() {
+        @Override
         public IFunctionDescriptor createFunctionDescriptor() {
             return new EditDistanceListIsFilterable();
         }
     };
 
     @Override
-    public ICopyEvaluatorFactory createEvaluatorFactory(final ICopyEvaluatorFactory[] args) throws AlgebricksException {
-        return new ICopyEvaluatorFactory() {
+    public IScalarEvaluatorFactory createEvaluatorFactory(final IScalarEvaluatorFactory[] args)
+            throws AlgebricksException {
+        return new IScalarEvaluatorFactory() {
             private static final long serialVersionUID = 1L;
 
             @Override
-            public ICopyEvaluator createEvaluator(IDataOutputProvider output) throws AlgebricksException {
-                return new EditDistanceListIsFilterableEvaluator(args, output);
+            public IScalarEvaluator createScalarEvaluator(IHyracksTaskContext ctx) throws AlgebricksException {
+                return new EditDistanceListIsFilterableEvaluator(args, ctx);
             }
         };
     }
@@ -76,41 +81,44 @@
         return AsterixBuiltinFunctions.EDIT_DISTANCE_LIST_IS_FILTERABLE;
     }
 
-    private static class EditDistanceListIsFilterableEvaluator implements ICopyEvaluator {
+    private static class EditDistanceListIsFilterableEvaluator implements IScalarEvaluator {
 
-        protected final ArrayBackedValueStorage argBuf = new ArrayBackedValueStorage();
-        protected final IDataOutputProvider output;
+        protected final IPointable argPtr = new VoidPointable();
+        protected final ArrayBackedValueStorage resultStorage = new ArrayBackedValueStorage();
+        protected final DataOutput output = resultStorage.getDataOutput();
 
-        protected final ICopyEvaluator listEval;
-        protected final ICopyEvaluator edThreshEval;
+        protected final IScalarEvaluator listEval;
+        protected final IScalarEvaluator edThreshEval;
 
         @SuppressWarnings("unchecked")
         private final ISerializerDeserializer<ABoolean> booleanSerde = AqlSerializerDeserializerProvider.INSTANCE
                 .getSerializerDeserializer(BuiltinType.ABOOLEAN);
 
-        public EditDistanceListIsFilterableEvaluator(ICopyEvaluatorFactory[] args, IDataOutputProvider output)
+        public EditDistanceListIsFilterableEvaluator(IScalarEvaluatorFactory[] args, IHyracksTaskContext context)
                 throws AlgebricksException {
-            this.output = output;
-            listEval = args[0].createEvaluator(argBuf);
-            edThreshEval = args[1].createEvaluator(argBuf);
+            listEval = args[0].createScalarEvaluator(context);
+            edThreshEval = args[1].createScalarEvaluator(context);
         }
 
         @Override
-        public void evaluate(IFrameTupleReference tuple) throws AlgebricksException {
+        public void evaluate(IFrameTupleReference tuple, IPointable result) throws AlgebricksException {
+            resultStorage.reset();
             ATypeTag typeTag = null;
 
             // Check type and compute string length.
-            argBuf.reset();
-            listEval.evaluate(tuple);
-            typeTag = EnumDeserializer.ATYPETAGDESERIALIZER.deserialize(argBuf.getByteArray()[0]);
+            listEval.evaluate(tuple, argPtr);
+            byte[] bytes = argPtr.getByteArray();
+            int offset = argPtr.getStartOffset();
+
+            typeTag = EnumDeserializer.ATYPETAGDESERIALIZER.deserialize(bytes[offset]);
             long listLen = 0;
             switch (typeTag) {
                 case UNORDEREDLIST: {
-                    listLen = AUnorderedListSerializerDeserializer.getNumberOfItems(argBuf.getByteArray(), 0);
+                    listLen = AUnorderedListSerializerDeserializer.getNumberOfItems(bytes, offset);
                     break;
                 }
                 case ORDEREDLIST: {
-                    listLen = AOrderedListSerializerDeserializer.getNumberOfItems(argBuf.getByteArray(), 0);
+                    listLen = AOrderedListSerializerDeserializer.getNumberOfItems(bytes, offset);
                     break;
                 }
                 default: {
@@ -121,13 +129,14 @@
             }
 
             // Check type and extract edit-distance threshold.
-            argBuf.reset();
-            edThreshEval.evaluate(tuple);
-            typeTag = EnumDeserializer.ATYPETAGDESERIALIZER.deserialize(argBuf.getByteArray()[0]);
+            edThreshEval.evaluate(tuple, argPtr);
+            bytes = argPtr.getByteArray();
+            offset = argPtr.getStartOffset();
+            typeTag = EnumDeserializer.ATYPETAGDESERIALIZER.deserialize(bytes[offset]);
             long edThresh;
 
             try {
-                edThresh = ATypeHierarchy.getIntegerValue(argBuf.getByteArray(), 0);
+                edThresh = ATypeHierarchy.getIntegerValue(bytes, offset);
             } catch (HyracksDataException e1) {
                 throw new AlgebricksException(e1);
             }
@@ -136,13 +145,14 @@
             long lowerBound = listLen - edThresh;
             try {
                 if (lowerBound <= 0) {
-                    booleanSerde.serialize(ABoolean.FALSE, output.getDataOutput());
+                    booleanSerde.serialize(ABoolean.FALSE, output);
                 } else {
-                    booleanSerde.serialize(ABoolean.TRUE, output.getDataOutput());
+                    booleanSerde.serialize(ABoolean.TRUE, output);
                 }
             } catch (IOException e) {
                 throw new AlgebricksException(e);
             }
+            result.set(resultStorage);
         }
     }
 }
diff --git a/asterix-runtime/src/main/java/org/apache/asterix/runtime/evaluators/functions/EditDistanceStringIsFilterable.java b/asterix-runtime/src/main/java/org/apache/asterix/runtime/evaluators/functions/EditDistanceStringIsFilterable.java
index 15ce3d4..a707e46 100644
--- a/asterix-runtime/src/main/java/org/apache/asterix/runtime/evaluators/functions/EditDistanceStringIsFilterable.java
+++ b/asterix-runtime/src/main/java/org/apache/asterix/runtime/evaluators/functions/EditDistanceStringIsFilterable.java
@@ -18,6 +18,7 @@
  */
 package org.apache.asterix.runtime.evaluators.functions;
 
+import java.io.DataOutput;
 import java.io.IOException;
 
 import org.apache.asterix.formats.nontagged.AqlSerializerDeserializerProvider;
@@ -32,13 +33,15 @@
 import org.apache.asterix.runtime.evaluators.base.AbstractScalarFunctionDynamicDescriptor;
 import org.apache.hyracks.algebricks.common.exceptions.AlgebricksException;
 import org.apache.hyracks.algebricks.core.algebra.functions.FunctionIdentifier;
-import org.apache.hyracks.algebricks.runtime.base.ICopyEvaluator;
-import org.apache.hyracks.algebricks.runtime.base.ICopyEvaluatorFactory;
+import org.apache.hyracks.algebricks.runtime.base.IScalarEvaluator;
+import org.apache.hyracks.algebricks.runtime.base.IScalarEvaluatorFactory;
+import org.apache.hyracks.api.context.IHyracksTaskContext;
 import org.apache.hyracks.api.dataflow.value.ISerializerDeserializer;
 import org.apache.hyracks.api.exceptions.HyracksDataException;
-import org.apache.hyracks.data.std.api.IDataOutputProvider;
+import org.apache.hyracks.data.std.api.IPointable;
 import org.apache.hyracks.data.std.primitive.BooleanPointable;
 import org.apache.hyracks.data.std.primitive.UTF8StringPointable;
+import org.apache.hyracks.data.std.primitive.VoidPointable;
 import org.apache.hyracks.data.std.util.ArrayBackedValueStorage;
 import org.apache.hyracks.dataflow.common.data.accessors.IFrameTupleReference;
 
@@ -53,19 +56,21 @@
 
     private static final long serialVersionUID = 1L;
     public static final IFunctionDescriptorFactory FACTORY = new IFunctionDescriptorFactory() {
+        @Override
         public IFunctionDescriptor createFunctionDescriptor() {
             return new EditDistanceStringIsFilterable();
         }
     };
 
     @Override
-    public ICopyEvaluatorFactory createEvaluatorFactory(final ICopyEvaluatorFactory[] args) throws AlgebricksException {
-        return new ICopyEvaluatorFactory() {
+    public IScalarEvaluatorFactory createEvaluatorFactory(final IScalarEvaluatorFactory[] args)
+            throws AlgebricksException {
+        return new IScalarEvaluatorFactory() {
             private static final long serialVersionUID = 1L;
 
             @Override
-            public ICopyEvaluator createEvaluator(IDataOutputProvider output) throws AlgebricksException {
-                return new EditDistanceStringIsFilterableEvaluator(args, output);
+            public IScalarEvaluator createScalarEvaluator(IHyracksTaskContext ctx) throws AlgebricksException {
+                return new EditDistanceStringIsFilterableEvaluator(args, ctx);
             }
         };
     }
@@ -75,15 +80,16 @@
         return AsterixBuiltinFunctions.EDIT_DISTANCE_STRING_IS_FILTERABLE;
     }
 
-    private static class EditDistanceStringIsFilterableEvaluator implements ICopyEvaluator {
+    private static class EditDistanceStringIsFilterableEvaluator implements IScalarEvaluator {
 
-        protected final ArrayBackedValueStorage argBuf = new ArrayBackedValueStorage();
-        protected final IDataOutputProvider output;
+        protected final ArrayBackedValueStorage resultStorage = new ArrayBackedValueStorage();
+        protected final DataOutput output = resultStorage.getDataOutput();
+        protected final IPointable argPtr = new VoidPointable();
 
-        protected final ICopyEvaluator stringEval;
-        protected final ICopyEvaluator edThreshEval;
-        protected final ICopyEvaluator gramLenEval;
-        protected final ICopyEvaluator usePrePostEval;
+        protected final IScalarEvaluator stringEval;
+        protected final IScalarEvaluator edThreshEval;
+        protected final IScalarEvaluator gramLenEval;
+        protected final IScalarEvaluator usePrePostEval;
 
         @SuppressWarnings("unchecked")
         private final ISerializerDeserializer<ABoolean> booleanSerde = AqlSerializerDeserializerProvider.INSTANCE
@@ -91,78 +97,75 @@
 
         private final UTF8StringPointable utf8Ptr = new UTF8StringPointable();
 
-        public EditDistanceStringIsFilterableEvaluator(ICopyEvaluatorFactory[] args, IDataOutputProvider output)
+        public EditDistanceStringIsFilterableEvaluator(IScalarEvaluatorFactory[] args, IHyracksTaskContext context)
                 throws AlgebricksException {
-            this.output = output;
-            stringEval = args[0].createEvaluator(argBuf);
-            edThreshEval = args[1].createEvaluator(argBuf);
-            gramLenEval = args[2].createEvaluator(argBuf);
-            usePrePostEval = args[3].createEvaluator(argBuf);
+            stringEval = args[0].createScalarEvaluator(context);
+            edThreshEval = args[1].createScalarEvaluator(context);
+            gramLenEval = args[2].createScalarEvaluator(context);
+            usePrePostEval = args[3].createScalarEvaluator(context);
         }
 
         @Override
-        public void evaluate(IFrameTupleReference tuple) throws AlgebricksException {
+        public void evaluate(IFrameTupleReference tuple, IPointable result) throws AlgebricksException {
+            resultStorage.reset();
             ATypeTag typeTag = null;
 
             // Check type and compute string length.
-            argBuf.reset();
-            stringEval.evaluate(tuple);
-            typeTag = EnumDeserializer.ATYPETAGDESERIALIZER.deserialize(argBuf.getByteArray()[0]);
+            stringEval.evaluate(tuple, argPtr);
+            typeTag = EnumDeserializer.ATYPETAGDESERIALIZER.deserialize(argPtr.getByteArray()[argPtr.getStartOffset()]);
             if (!typeTag.equals(ATypeTag.STRING)) {
                 throw new AlgebricksException(AsterixBuiltinFunctions.EDIT_DISTANCE_STRING_IS_FILTERABLE.getName()
                         + ": expects input type STRING as first argument, but got " + typeTag + ".");
             }
 
-            utf8Ptr.set(argBuf.getByteArray(), 1, argBuf.getLength());
+            utf8Ptr.set(argPtr.getByteArray(), argPtr.getStartOffset() + 1, argPtr.getLength());
             int strLen = utf8Ptr.getStringLength();
 
             // Check type and extract edit-distance threshold.
-            argBuf.reset();
-            edThreshEval.evaluate(tuple);
-            typeTag = EnumDeserializer.ATYPETAGDESERIALIZER.deserialize(argBuf.getByteArray()[0]);
+            edThreshEval.evaluate(tuple, argPtr);
+            typeTag = EnumDeserializer.ATYPETAGDESERIALIZER.deserialize(argPtr.getByteArray()[argPtr.getStartOffset()]);
 
             long edThresh = 0;
 
             try {
-                edThresh = ATypeHierarchy.getIntegerValue(argBuf.getByteArray(), 0);
+                edThresh = ATypeHierarchy.getIntegerValue(argPtr.getByteArray(), argPtr.getStartOffset());
             } catch (HyracksDataException e1) {
                 throw new AlgebricksException(e1);
             }
 
             // Check type and extract gram length.
-            argBuf.reset();
-            gramLenEval.evaluate(tuple);
-            typeTag = EnumDeserializer.ATYPETAGDESERIALIZER.deserialize(argBuf.getByteArray()[0]);
+            gramLenEval.evaluate(tuple, argPtr);
+            typeTag = EnumDeserializer.ATYPETAGDESERIALIZER.deserialize(argPtr.getByteArray()[argPtr.getStartOffset()]);
 
             long gramLen = 0;
             try {
-                gramLen = ATypeHierarchy.getIntegerValue(argBuf.getByteArray(), 0);
+                gramLen = ATypeHierarchy.getIntegerValue(argPtr.getByteArray(), argPtr.getStartOffset());
             } catch (HyracksDataException e1) {
                 throw new AlgebricksException(e1);
             }
 
             // Check type and extract usePrePost flag.
-            argBuf.reset();
-            usePrePostEval.evaluate(tuple);
-            typeTag = EnumDeserializer.ATYPETAGDESERIALIZER.deserialize(argBuf.getByteArray()[0]);
+            usePrePostEval.evaluate(tuple, argPtr);
+            typeTag = EnumDeserializer.ATYPETAGDESERIALIZER.deserialize(argPtr.getByteArray()[argPtr.getStartOffset()]);
             if (!typeTag.equals(ATypeTag.BOOLEAN)) {
                 throw new AlgebricksException(AsterixBuiltinFunctions.EDIT_DISTANCE_STRING_IS_FILTERABLE.getName()
                         + ": expects input type BOOLEAN as fourth argument, but got " + typeTag + ".");
             }
-            boolean usePrePost = BooleanPointable.getBoolean(argBuf.getByteArray(), 1);
+            boolean usePrePost = BooleanPointable.getBoolean(argPtr.getByteArray(), argPtr.getStartOffset() + 1);
 
             // Compute result.
             long numGrams = (usePrePost) ? strLen + gramLen - 1 : strLen - gramLen + 1;
             long lowerBound = numGrams - edThresh * gramLen;
             try {
                 if (lowerBound <= 0 || strLen == 0) {
-                    booleanSerde.serialize(ABoolean.FALSE, output.getDataOutput());
+                    booleanSerde.serialize(ABoolean.FALSE, output);
                 } else {
-                    booleanSerde.serialize(ABoolean.TRUE, output.getDataOutput());
+                    booleanSerde.serialize(ABoolean.TRUE, output);
                 }
             } catch (IOException e) {
                 throw new AlgebricksException(e);
             }
+            result.set(resultStorage);
         }
     }
 }
diff --git a/asterix-runtime/src/main/java/org/apache/asterix/runtime/evaluators/functions/EmbedTypeDescriptor.java b/asterix-runtime/src/main/java/org/apache/asterix/runtime/evaluators/functions/EmbedTypeDescriptor.java
index 4773f7d..0bfa5a8 100644
--- a/asterix-runtime/src/main/java/org/apache/asterix/runtime/evaluators/functions/EmbedTypeDescriptor.java
+++ b/asterix-runtime/src/main/java/org/apache/asterix/runtime/evaluators/functions/EmbedTypeDescriptor.java
@@ -25,15 +25,17 @@
 import org.apache.asterix.runtime.evaluators.base.AbstractScalarFunctionDynamicDescriptor;
 import org.apache.hyracks.algebricks.common.exceptions.AlgebricksException;
 import org.apache.hyracks.algebricks.core.algebra.functions.FunctionIdentifier;
-import org.apache.hyracks.algebricks.runtime.base.ICopyEvaluator;
-import org.apache.hyracks.algebricks.runtime.base.ICopyEvaluatorFactory;
-import org.apache.hyracks.data.std.api.IDataOutputProvider;
+import org.apache.hyracks.algebricks.runtime.base.IScalarEvaluator;
+import org.apache.hyracks.algebricks.runtime.base.IScalarEvaluatorFactory;
+import org.apache.hyracks.api.context.IHyracksTaskContext;
+import org.apache.hyracks.data.std.api.IPointable;
 import org.apache.hyracks.dataflow.common.data.accessors.IFrameTupleReference;
 
 public class EmbedTypeDescriptor extends AbstractScalarFunctionDynamicDescriptor {
 
     private static final long serialVersionUID = 1L;
     public static final IFunctionDescriptorFactory FACTORY = new IFunctionDescriptorFactory() {
+        @Override
         public IFunctionDescriptor createFunctionDescriptor() {
             return new EmbedTypeDescriptor();
         }
@@ -47,18 +49,18 @@
     }
 
     @Override
-    public ICopyEvaluatorFactory createEvaluatorFactory(final ICopyEvaluatorFactory[] args) {
-        return new ICopyEvaluatorFactory() {
+    public IScalarEvaluatorFactory createEvaluatorFactory(final IScalarEvaluatorFactory[] args) {
+        return new IScalarEvaluatorFactory() {
 
             private static final long serialVersionUID = 1L;
 
             @Override
-            public ICopyEvaluator createEvaluator(IDataOutputProvider output) throws AlgebricksException {
+            public IScalarEvaluator createScalarEvaluator(IHyracksTaskContext ctx) throws AlgebricksException {
                 // TODO Auto-generated method stub
-                return new ICopyEvaluator() {
+                return new IScalarEvaluator() {
 
                     @Override
-                    public void evaluate(IFrameTupleReference tuple) throws AlgebricksException {
+                    public void evaluate(IFrameTupleReference tuple, IPointable result) throws AlgebricksException {
                         // TODO Auto-generated method stub
 
                     }
diff --git a/asterix-runtime/src/main/java/org/apache/asterix/runtime/evaluators/functions/FlowRecordDescriptor.java b/asterix-runtime/src/main/java/org/apache/asterix/runtime/evaluators/functions/FlowRecordDescriptor.java
index ec30302..5c9d8ef 100644
--- a/asterix-runtime/src/main/java/org/apache/asterix/runtime/evaluators/functions/FlowRecordDescriptor.java
+++ b/asterix-runtime/src/main/java/org/apache/asterix/runtime/evaluators/functions/FlowRecordDescriptor.java
@@ -19,8 +19,6 @@
 
 package org.apache.asterix.runtime.evaluators.functions;
 
-import java.io.DataOutput;
-
 import org.apache.asterix.om.functions.AsterixBuiltinFunctions;
 import org.apache.asterix.om.functions.IFunctionDescriptor;
 import org.apache.asterix.om.functions.IFunctionDescriptorFactory;
@@ -30,15 +28,17 @@
 import org.apache.asterix.runtime.evaluators.base.AbstractScalarFunctionDynamicDescriptor;
 import org.apache.hyracks.algebricks.common.exceptions.AlgebricksException;
 import org.apache.hyracks.algebricks.core.algebra.functions.FunctionIdentifier;
-import org.apache.hyracks.algebricks.runtime.base.ICopyEvaluator;
-import org.apache.hyracks.algebricks.runtime.base.ICopyEvaluatorFactory;
-import org.apache.hyracks.data.std.api.IDataOutputProvider;
-import org.apache.hyracks.data.std.util.ArrayBackedValueStorage;
+import org.apache.hyracks.algebricks.runtime.base.IScalarEvaluator;
+import org.apache.hyracks.algebricks.runtime.base.IScalarEvaluatorFactory;
+import org.apache.hyracks.api.context.IHyracksTaskContext;
+import org.apache.hyracks.data.std.api.IPointable;
+import org.apache.hyracks.data.std.primitive.VoidPointable;
 import org.apache.hyracks.dataflow.common.data.accessors.IFrameTupleReference;
 
 public class FlowRecordDescriptor extends AbstractScalarFunctionDynamicDescriptor {
 
     public static final IFunctionDescriptorFactory FACTORY = new IFunctionDescriptorFactory() {
+        @Override
         public IFunctionDescriptor createFunctionDescriptor() {
             return new FlowRecordDescriptor();
         }
@@ -57,30 +57,28 @@
     }
 
     @Override
-    public ICopyEvaluatorFactory createEvaluatorFactory(final ICopyEvaluatorFactory[] args) {
-        final ICopyEvaluatorFactory recordEvalFactory = args[0];
+    public IScalarEvaluatorFactory createEvaluatorFactory(final IScalarEvaluatorFactory[] args) {
+        final IScalarEvaluatorFactory recordEvalFactory = args[0];
 
-        return new ICopyEvaluatorFactory() {
+        return new IScalarEvaluatorFactory() {
             private static final long serialVersionUID = 1L;
 
             @Override
-            public ICopyEvaluator createEvaluator(final IDataOutputProvider output) throws AlgebricksException {
-                final DataOutput out = output.getDataOutput();
-                final ArrayBackedValueStorage recordBuffer = new ArrayBackedValueStorage();
-                final ICopyEvaluator recEvaluator = recordEvalFactory.createEvaluator(recordBuffer);
+            public IScalarEvaluator createScalarEvaluator(final IHyracksTaskContext ctx) throws AlgebricksException {
+                final IPointable recordPtr = new VoidPointable();
+                final IScalarEvaluator recEvaluator = recordEvalFactory.createScalarEvaluator(ctx);
 
-                return new ICopyEvaluator() {
+                return new IScalarEvaluator() {
                     // pointable allocator
                     private PointableAllocator allocator = new PointableAllocator();
                     final IVisitablePointable recAccessor = allocator.allocateRecordValue(inputType);
 
                     @Override
-                    public void evaluate(IFrameTupleReference tuple) throws AlgebricksException {
+                    public void evaluate(IFrameTupleReference tuple, IPointable result) throws AlgebricksException {
                         try {
-                            recordBuffer.reset();
-                            recEvaluator.evaluate(tuple);
-                            recAccessor.set(recordBuffer);
-                            out.write(recAccessor.getByteArray(), recAccessor.getStartOffset(), recAccessor.getLength());
+                            recEvaluator.evaluate(tuple, recordPtr);
+                            recAccessor.set(recordPtr);
+                            result.set(recAccessor);
                         } catch (Exception ioe) {
                             throw new AlgebricksException(ioe);
                         }
diff --git a/asterix-runtime/src/main/java/org/apache/asterix/runtime/evaluators/functions/FuzzyEqDescriptor.java b/asterix-runtime/src/main/java/org/apache/asterix/runtime/evaluators/functions/FuzzyEqDescriptor.java
index 350e629..eaa6028 100644
--- a/asterix-runtime/src/main/java/org/apache/asterix/runtime/evaluators/functions/FuzzyEqDescriptor.java
+++ b/asterix-runtime/src/main/java/org/apache/asterix/runtime/evaluators/functions/FuzzyEqDescriptor.java
@@ -25,7 +25,7 @@
 import org.apache.hyracks.algebricks.common.exceptions.AlgebricksException;
 import org.apache.hyracks.algebricks.common.exceptions.NotImplementedException;
 import org.apache.hyracks.algebricks.core.algebra.functions.FunctionIdentifier;
-import org.apache.hyracks.algebricks.runtime.base.ICopyEvaluatorFactory;
+import org.apache.hyracks.algebricks.runtime.base.IScalarEvaluatorFactory;
 
 public class FuzzyEqDescriptor extends AbstractScalarFunctionDynamicDescriptor {
 
@@ -37,7 +37,7 @@
     };
 
     @Override
-    public ICopyEvaluatorFactory createEvaluatorFactory(ICopyEvaluatorFactory[] args) throws AlgebricksException {
+    public IScalarEvaluatorFactory createEvaluatorFactory(IScalarEvaluatorFactory[] args) throws AlgebricksException {
         throw new NotImplementedException();
     }
 
diff --git a/asterix-runtime/src/main/java/org/apache/asterix/runtime/evaluators/functions/GetItemDescriptor.java b/asterix-runtime/src/main/java/org/apache/asterix/runtime/evaluators/functions/GetItemDescriptor.java
index ab58da2..020336f 100644
--- a/asterix-runtime/src/main/java/org/apache/asterix/runtime/evaluators/functions/GetItemDescriptor.java
+++ b/asterix-runtime/src/main/java/org/apache/asterix/runtime/evaluators/functions/GetItemDescriptor.java
@@ -23,23 +23,21 @@
 
 import org.apache.asterix.common.exceptions.AsterixException;
 import org.apache.asterix.dataflow.data.nontagged.serde.AOrderedListSerializerDeserializer;
-import org.apache.asterix.formats.nontagged.AqlSerializerDeserializerProvider;
-import org.apache.asterix.om.base.ANull;
 import org.apache.asterix.om.functions.AsterixBuiltinFunctions;
 import org.apache.asterix.om.functions.IFunctionDescriptor;
 import org.apache.asterix.om.functions.IFunctionDescriptorFactory;
 import org.apache.asterix.om.types.ATypeTag;
-import org.apache.asterix.om.types.BuiltinType;
 import org.apache.asterix.om.types.EnumDeserializer;
 import org.apache.asterix.om.types.hierachy.ATypeHierarchy;
 import org.apache.asterix.om.util.NonTaggedFormatUtil;
 import org.apache.asterix.runtime.evaluators.base.AbstractScalarFunctionDynamicDescriptor;
 import org.apache.hyracks.algebricks.common.exceptions.AlgebricksException;
 import org.apache.hyracks.algebricks.core.algebra.functions.FunctionIdentifier;
-import org.apache.hyracks.algebricks.runtime.base.ICopyEvaluator;
-import org.apache.hyracks.algebricks.runtime.base.ICopyEvaluatorFactory;
-import org.apache.hyracks.api.dataflow.value.ISerializerDeserializer;
-import org.apache.hyracks.data.std.api.IDataOutputProvider;
+import org.apache.hyracks.algebricks.runtime.base.IScalarEvaluator;
+import org.apache.hyracks.algebricks.runtime.base.IScalarEvaluatorFactory;
+import org.apache.hyracks.api.context.IHyracksTaskContext;
+import org.apache.hyracks.data.std.api.IPointable;
+import org.apache.hyracks.data.std.primitive.VoidPointable;
 import org.apache.hyracks.data.std.util.ArrayBackedValueStorage;
 import org.apache.hyracks.dataflow.common.data.accessors.IFrameTupleReference;
 
@@ -54,7 +52,7 @@
     };
 
     @Override
-    public ICopyEvaluatorFactory createEvaluatorFactory(final ICopyEvaluatorFactory[] args) {
+    public IScalarEvaluatorFactory createEvaluatorFactory(final IScalarEvaluatorFactory[] args) {
         return new GetItemEvalFactory(args);
     }
 
@@ -63,88 +61,94 @@
         return AsterixBuiltinFunctions.GET_ITEM;
     }
 
-    private static class GetItemEvalFactory implements ICopyEvaluatorFactory {
+    private static class GetItemEvalFactory implements IScalarEvaluatorFactory {
 
         private static final long serialVersionUID = 1L;
-
-        private ICopyEvaluatorFactory listEvalFactory;
-        private ICopyEvaluatorFactory indexEvalFactory;
+        private IScalarEvaluatorFactory listEvalFactory;
+        private IScalarEvaluatorFactory indexEvalFactory;
         private byte serItemTypeTag;
         private ATypeTag itemTag;
         private boolean selfDescList = false;
 
-        public GetItemEvalFactory(ICopyEvaluatorFactory[] args) {
+        public GetItemEvalFactory(IScalarEvaluatorFactory[] args) {
             this.listEvalFactory = args[0];
             this.indexEvalFactory = args[1];
         }
 
         @Override
-        public ICopyEvaluator createEvaluator(final IDataOutputProvider output) throws AlgebricksException {
-            return new ICopyEvaluator() {
+        public IScalarEvaluator createScalarEvaluator(final IHyracksTaskContext ctx) throws AlgebricksException {
+            return new IScalarEvaluator() {
 
-                private DataOutput out = output.getDataOutput();
-                private ArrayBackedValueStorage outInputList = new ArrayBackedValueStorage();
-                private ArrayBackedValueStorage outInputIdx = new ArrayBackedValueStorage();
-                private ICopyEvaluator evalList = listEvalFactory.createEvaluator(outInputList);
-                private ICopyEvaluator evalIdx = indexEvalFactory.createEvaluator(outInputIdx);
-                @SuppressWarnings("unchecked")
-                private ISerializerDeserializer<ANull> nullSerde = AqlSerializerDeserializerProvider.INSTANCE
-                        .getSerializerDeserializer(BuiltinType.ANULL);
+                private final ArrayBackedValueStorage resultStorage = new ArrayBackedValueStorage();
+                private final DataOutput output = resultStorage.getDataOutput();
+                private IPointable inputArgList = new VoidPointable();
+                private IPointable inputArgIdx = new VoidPointable();
+                private IScalarEvaluator evalList = listEvalFactory.createScalarEvaluator(ctx);
+                private IScalarEvaluator evalIdx = indexEvalFactory.createScalarEvaluator(ctx);
+                private byte[] nullBytes = new byte[] { ATypeTag.SERIALIZED_NULL_TYPE_TAG };
                 private int itemIndex;
                 private int itemOffset;
                 private int itemLength;
 
                 @Override
-                public void evaluate(IFrameTupleReference tuple) throws AlgebricksException {
+                public void evaluate(IFrameTupleReference tuple, IPointable result) throws AlgebricksException {
 
                     try {
-                        outInputList.reset();
-                        evalList.evaluate(tuple);
-                        outInputIdx.reset();
-                        evalIdx.evaluate(tuple);
-                        byte[] serOrderedList = outInputList.getByteArray();
+                        evalList.evaluate(tuple, inputArgList);
+                        evalIdx.evaluate(tuple, inputArgIdx);
 
-                        if (serOrderedList[0] == ATypeTag.SERIALIZED_NULL_TYPE_TAG) {
-                            nullSerde.serialize(ANull.NULL, out);
+                        byte[] serOrderedList = inputArgList.getByteArray();
+                        int offset = inputArgList.getStartOffset();
+                        byte[] indexBytes = inputArgIdx.getByteArray();
+                        int indexOffset = inputArgIdx.getStartOffset();
+
+                        if (serOrderedList[offset] == ATypeTag.SERIALIZED_NULL_TYPE_TAG) {
+                            result.set(nullBytes, 0, 1);
                             return;
                         }
 
-                        if (serOrderedList[0] == ATypeTag.SERIALIZED_ORDEREDLIST_TYPE_TAG) {
-                            itemIndex = ATypeHierarchy.getIntegerValue(outInputIdx.getByteArray(), 0);
+                        if (serOrderedList[offset] == ATypeTag.SERIALIZED_ORDEREDLIST_TYPE_TAG) {
+                            itemIndex = ATypeHierarchy.getIntegerValue(indexBytes, indexOffset);
                         } else {
                             throw new AlgebricksException(AsterixBuiltinFunctions.GET_ITEM.getName()
                                     + ": expects input type (NULL/ORDEREDLIST, [INT8/16/32/64/FLOAT/DOUBLE]), but got ("
-                                    + EnumDeserializer.ATYPETAGDESERIALIZER.deserialize(serOrderedList[0]) + ", "
-                                    + EnumDeserializer.ATYPETAGDESERIALIZER.deserialize(outInputIdx.getByteArray()[0])
+                                    + EnumDeserializer.ATYPETAGDESERIALIZER.deserialize(serOrderedList[offset]) + ", "
+                                    + EnumDeserializer.ATYPETAGDESERIALIZER
+                                            .deserialize(inputArgIdx.getByteArray()[offset])
                                     + ").");
                         }
 
-                        if (itemIndex >= AOrderedListSerializerDeserializer.getNumberOfItems(serOrderedList)) {
-                            out.writeByte(ATypeTag.SERIALIZED_NULL_TYPE_TAG);
+                        if (itemIndex >= AOrderedListSerializerDeserializer.getNumberOfItems(serOrderedList, offset)) {
+                            result.set(nullBytes, 0, 1);
                             return;
                         }
-                        if (itemIndex < 0)
+                        if (itemIndex < 0) {
                             throw new AlgebricksException(
                                     AsterixBuiltinFunctions.GET_ITEM.getName() + ": item index cannot be negative!");
+                        }
 
-                        itemTag = EnumDeserializer.ATYPETAGDESERIALIZER.deserialize(serOrderedList[1]);
-                        if (itemTag == ATypeTag.ANY)
+                        itemTag = EnumDeserializer.ATYPETAGDESERIALIZER.deserialize(serOrderedList[offset + 1]);
+                        if (itemTag == ATypeTag.ANY) {
                             selfDescList = true;
-                        else
-                            serItemTypeTag = serOrderedList[1];
+                        } else {
+                            serItemTypeTag = serOrderedList[offset + 1];
+                        }
 
-                        itemOffset = AOrderedListSerializerDeserializer.getItemOffset(serOrderedList, itemIndex);
+                        itemOffset = AOrderedListSerializerDeserializer.getItemOffset(serOrderedList, offset,
+                                itemIndex);
 
                         if (selfDescList) {
                             itemTag = EnumDeserializer.ATYPETAGDESERIALIZER.deserialize(serOrderedList[itemOffset]);
                             itemLength = NonTaggedFormatUtil.getFieldValueLength(serOrderedList, itemOffset, itemTag,
                                     true) + 1;
-                            out.write(serOrderedList, itemOffset, itemLength);
+                            result.set(serOrderedList, itemOffset, itemLength);
                         } else {
                             itemLength = NonTaggedFormatUtil.getFieldValueLength(serOrderedList, itemOffset, itemTag,
                                     false);
-                            out.writeByte(serItemTypeTag);
-                            out.write(serOrderedList, itemOffset, itemLength);
+                            resultStorage.reset();
+                            output.writeByte(serItemTypeTag);
+                            output.write(serOrderedList, itemOffset, itemLength);
+                            result.set(resultStorage);
                         }
                     } catch (IOException e) {
                         throw new AlgebricksException(e);
diff --git a/asterix-runtime/src/main/java/org/apache/asterix/runtime/evaluators/functions/GramTokensDescriptor.java b/asterix-runtime/src/main/java/org/apache/asterix/runtime/evaluators/functions/GramTokensDescriptor.java
index 87aa1f6..3b7941e 100644
--- a/asterix-runtime/src/main/java/org/apache/asterix/runtime/evaluators/functions/GramTokensDescriptor.java
+++ b/asterix-runtime/src/main/java/org/apache/asterix/runtime/evaluators/functions/GramTokensDescriptor.java
@@ -26,9 +26,9 @@
 import org.apache.asterix.runtime.evaluators.common.GramTokensEvaluator;
 import org.apache.hyracks.algebricks.common.exceptions.AlgebricksException;
 import org.apache.hyracks.algebricks.core.algebra.functions.FunctionIdentifier;
-import org.apache.hyracks.algebricks.runtime.base.ICopyEvaluator;
-import org.apache.hyracks.algebricks.runtime.base.ICopyEvaluatorFactory;
-import org.apache.hyracks.data.std.api.IDataOutputProvider;
+import org.apache.hyracks.algebricks.runtime.base.IScalarEvaluator;
+import org.apache.hyracks.algebricks.runtime.base.IScalarEvaluatorFactory;
+import org.apache.hyracks.api.context.IHyracksTaskContext;
 import org.apache.hyracks.storage.am.lsm.invertedindex.tokenizers.ITokenFactory;
 import org.apache.hyracks.storage.am.lsm.invertedindex.tokenizers.NGramUTF8StringBinaryTokenizer;
 import org.apache.hyracks.storage.am.lsm.invertedindex.tokenizers.UTF8NGramTokenFactory;
@@ -37,6 +37,7 @@
 
     private static final long serialVersionUID = 1L;
     public static final IFunctionDescriptorFactory FACTORY = new IFunctionDescriptorFactory() {
+        @Override
         public IFunctionDescriptor createFunctionDescriptor() {
             return new GramTokensDescriptor();
         }
@@ -48,16 +49,17 @@
     }
 
     @Override
-    public ICopyEvaluatorFactory createEvaluatorFactory(final ICopyEvaluatorFactory[] args) throws AlgebricksException {
-        return new ICopyEvaluatorFactory() {
+    public IScalarEvaluatorFactory createEvaluatorFactory(final IScalarEvaluatorFactory[] args)
+            throws AlgebricksException {
+        return new IScalarEvaluatorFactory() {
             private static final long serialVersionUID = 1L;
 
             @Override
-            public ICopyEvaluator createEvaluator(IDataOutputProvider output) throws AlgebricksException {
+            public IScalarEvaluator createScalarEvaluator(IHyracksTaskContext ctx) throws AlgebricksException {
                 ITokenFactory tokenFactory = new UTF8NGramTokenFactory();
                 NGramUTF8StringBinaryTokenizer tokenizer = new NGramUTF8StringBinaryTokenizer(3, true, true, true,
                         tokenFactory);
-                return new GramTokensEvaluator(args, output, tokenizer, BuiltinType.ASTRING);
+                return new GramTokensEvaluator(args, ctx, tokenizer, BuiltinType.ASTRING);
             }
         };
     }
diff --git a/asterix-runtime/src/main/java/org/apache/asterix/runtime/evaluators/functions/HashedGramTokensDescriptor.java b/asterix-runtime/src/main/java/org/apache/asterix/runtime/evaluators/functions/HashedGramTokensDescriptor.java
index 74ffc67..575dacf 100644
--- a/asterix-runtime/src/main/java/org/apache/asterix/runtime/evaluators/functions/HashedGramTokensDescriptor.java
+++ b/asterix-runtime/src/main/java/org/apache/asterix/runtime/evaluators/functions/HashedGramTokensDescriptor.java
@@ -26,9 +26,9 @@
 import org.apache.asterix.runtime.evaluators.common.GramTokensEvaluator;
 import org.apache.hyracks.algebricks.common.exceptions.AlgebricksException;
 import org.apache.hyracks.algebricks.core.algebra.functions.FunctionIdentifier;
-import org.apache.hyracks.algebricks.runtime.base.ICopyEvaluator;
-import org.apache.hyracks.algebricks.runtime.base.ICopyEvaluatorFactory;
-import org.apache.hyracks.data.std.api.IDataOutputProvider;
+import org.apache.hyracks.algebricks.runtime.base.IScalarEvaluator;
+import org.apache.hyracks.algebricks.runtime.base.IScalarEvaluatorFactory;
+import org.apache.hyracks.api.context.IHyracksTaskContext;
 import org.apache.hyracks.storage.am.lsm.invertedindex.tokenizers.HashedUTF8NGramTokenFactory;
 import org.apache.hyracks.storage.am.lsm.invertedindex.tokenizers.ITokenFactory;
 import org.apache.hyracks.storage.am.lsm.invertedindex.tokenizers.NGramUTF8StringBinaryTokenizer;
@@ -37,6 +37,7 @@
 
     private static final long serialVersionUID = 1L;
     public static final IFunctionDescriptorFactory FACTORY = new IFunctionDescriptorFactory() {
+        @Override
         public IFunctionDescriptor createFunctionDescriptor() {
             return new HashedGramTokensDescriptor();
         }
@@ -48,16 +49,17 @@
     }
 
     @Override
-    public ICopyEvaluatorFactory createEvaluatorFactory(final ICopyEvaluatorFactory[] args) throws AlgebricksException {
-        return new ICopyEvaluatorFactory() {
+    public IScalarEvaluatorFactory createEvaluatorFactory(final IScalarEvaluatorFactory[] args)
+            throws AlgebricksException {
+        return new IScalarEvaluatorFactory() {
             private static final long serialVersionUID = 1L;
 
             @Override
-            public ICopyEvaluator createEvaluator(IDataOutputProvider output) throws AlgebricksException {
+            public IScalarEvaluator createScalarEvaluator(IHyracksTaskContext ctx) throws AlgebricksException {
                 ITokenFactory tokenFactory = new HashedUTF8NGramTokenFactory();
                 NGramUTF8StringBinaryTokenizer tokenizer = new NGramUTF8StringBinaryTokenizer(3, true, true, true,
                         tokenFactory);
-                return new GramTokensEvaluator(args, output, tokenizer, BuiltinType.AINT32);
+                return new GramTokensEvaluator(args, ctx, tokenizer, BuiltinType.AINT32);
             }
         };
     }
diff --git a/asterix-runtime/src/main/java/org/apache/asterix/runtime/evaluators/functions/HashedWordTokensDescriptor.java b/asterix-runtime/src/main/java/org/apache/asterix/runtime/evaluators/functions/HashedWordTokensDescriptor.java
index 33706ce..c32c6ae 100644
--- a/asterix-runtime/src/main/java/org/apache/asterix/runtime/evaluators/functions/HashedWordTokensDescriptor.java
+++ b/asterix-runtime/src/main/java/org/apache/asterix/runtime/evaluators/functions/HashedWordTokensDescriptor.java
@@ -26,9 +26,9 @@
 import org.apache.asterix.runtime.evaluators.common.WordTokensEvaluator;
 import org.apache.hyracks.algebricks.common.exceptions.AlgebricksException;
 import org.apache.hyracks.algebricks.core.algebra.functions.FunctionIdentifier;
-import org.apache.hyracks.algebricks.runtime.base.ICopyEvaluator;
-import org.apache.hyracks.algebricks.runtime.base.ICopyEvaluatorFactory;
-import org.apache.hyracks.data.std.api.IDataOutputProvider;
+import org.apache.hyracks.algebricks.runtime.base.IScalarEvaluator;
+import org.apache.hyracks.algebricks.runtime.base.IScalarEvaluatorFactory;
+import org.apache.hyracks.api.context.IHyracksTaskContext;
 import org.apache.hyracks.storage.am.lsm.invertedindex.tokenizers.DelimitedUTF8StringBinaryTokenizer;
 import org.apache.hyracks.storage.am.lsm.invertedindex.tokenizers.HashedUTF8WordTokenFactory;
 import org.apache.hyracks.storage.am.lsm.invertedindex.tokenizers.IBinaryTokenizer;
@@ -38,6 +38,7 @@
 
     private static final long serialVersionUID = 1L;
     public static final IFunctionDescriptorFactory FACTORY = new IFunctionDescriptorFactory() {
+        @Override
         public IFunctionDescriptor createFunctionDescriptor() {
             return new HashedWordTokensDescriptor();
         }
@@ -49,15 +50,16 @@
     }
 
     @Override
-    public ICopyEvaluatorFactory createEvaluatorFactory(final ICopyEvaluatorFactory[] args) throws AlgebricksException {
-        return new ICopyEvaluatorFactory() {
+    public IScalarEvaluatorFactory createEvaluatorFactory(final IScalarEvaluatorFactory[] args)
+            throws AlgebricksException {
+        return new IScalarEvaluatorFactory() {
             private static final long serialVersionUID = 1L;
 
             @Override
-            public ICopyEvaluator createEvaluator(IDataOutputProvider output) throws AlgebricksException {
+            public IScalarEvaluator createScalarEvaluator(IHyracksTaskContext ctx) throws AlgebricksException {
                 ITokenFactory tokenFactory = new HashedUTF8WordTokenFactory();
                 IBinaryTokenizer tokenizer = new DelimitedUTF8StringBinaryTokenizer(true, true, tokenFactory);
-                return new WordTokensEvaluator(args, output, tokenizer, BuiltinType.AINT32);
+                return new WordTokensEvaluator(args, ctx, tokenizer, BuiltinType.AINT32);
             }
         };
     }
diff --git a/asterix-runtime/src/main/java/org/apache/asterix/runtime/evaluators/functions/InjectFailureDescriptor.java b/asterix-runtime/src/main/java/org/apache/asterix/runtime/evaluators/functions/InjectFailureDescriptor.java
index f402cec..0d1cf4d 100644
--- a/asterix-runtime/src/main/java/org/apache/asterix/runtime/evaluators/functions/InjectFailureDescriptor.java
+++ b/asterix-runtime/src/main/java/org/apache/asterix/runtime/evaluators/functions/InjectFailureDescriptor.java
@@ -18,8 +18,6 @@
  */
 package org.apache.asterix.runtime.evaluators.functions;
 
-import java.io.IOException;
-
 import org.apache.asterix.dataflow.data.nontagged.serde.ABooleanSerializerDeserializer;
 import org.apache.asterix.om.functions.AsterixBuiltinFunctions;
 import org.apache.asterix.om.functions.IFunctionDescriptor;
@@ -29,16 +27,18 @@
 import org.apache.asterix.runtime.evaluators.base.AbstractScalarFunctionDynamicDescriptor;
 import org.apache.hyracks.algebricks.common.exceptions.AlgebricksException;
 import org.apache.hyracks.algebricks.core.algebra.functions.FunctionIdentifier;
-import org.apache.hyracks.algebricks.runtime.base.ICopyEvaluator;
-import org.apache.hyracks.algebricks.runtime.base.ICopyEvaluatorFactory;
-import org.apache.hyracks.data.std.api.IDataOutputProvider;
-import org.apache.hyracks.data.std.util.ArrayBackedValueStorage;
+import org.apache.hyracks.algebricks.runtime.base.IScalarEvaluator;
+import org.apache.hyracks.algebricks.runtime.base.IScalarEvaluatorFactory;
+import org.apache.hyracks.api.context.IHyracksTaskContext;
+import org.apache.hyracks.data.std.api.IPointable;
+import org.apache.hyracks.data.std.primitive.VoidPointable;
 import org.apache.hyracks.dataflow.common.data.accessors.IFrameTupleReference;
 
 public class InjectFailureDescriptor extends AbstractScalarFunctionDynamicDescriptor {
 
     private static final long serialVersionUID = 1L;
     public static final IFunctionDescriptorFactory FACTORY = new IFunctionDescriptorFactory() {
+        @Override
         public IFunctionDescriptor createFunctionDescriptor() {
             return new InjectFailureDescriptor();
         }
@@ -50,44 +50,39 @@
     }
 
     @Override
-    public ICopyEvaluatorFactory createEvaluatorFactory(final ICopyEvaluatorFactory[] args) throws AlgebricksException {
+    public IScalarEvaluatorFactory createEvaluatorFactory(final IScalarEvaluatorFactory[] args)
+            throws AlgebricksException {
 
-        return new ICopyEvaluatorFactory() {
+        return new IScalarEvaluatorFactory() {
             private static final long serialVersionUID = 1L;
 
             @Override
-            public ICopyEvaluator createEvaluator(final IDataOutputProvider output) throws AlgebricksException {
+            public IScalarEvaluator createScalarEvaluator(final IHyracksTaskContext ctx) throws AlgebricksException {
 
-                final ArrayBackedValueStorage argOut = new ArrayBackedValueStorage();
-                final ICopyEvaluator[] evals = new ICopyEvaluator[args.length];
-                evals[0] = args[0].createEvaluator(argOut);
-                evals[1] = args[1].createEvaluator(argOut);
+                final IPointable argPtr = new VoidPointable();
+                final IScalarEvaluator[] evals = new IScalarEvaluator[args.length];
+                evals[0] = args[0].createScalarEvaluator(ctx);
+                evals[1] = args[1].createScalarEvaluator(ctx);
 
-                return new ICopyEvaluator() {
+                return new IScalarEvaluator() {
 
                     @Override
-                    public void evaluate(IFrameTupleReference tuple) throws AlgebricksException {
-                        try {
-                            // evaluator the failure condition
-                            argOut.reset();
-                            evals[1].evaluate(tuple);
-                            ATypeTag typeTag = EnumDeserializer.ATYPETAGDESERIALIZER
-                                    .deserialize(argOut.getByteArray()[0]);
-                            if (typeTag == ATypeTag.BOOLEAN) {
-                                boolean argResult = ABooleanSerializerDeserializer.getBoolean(argOut.getByteArray(), 1);
-                                if (argResult)
-                                    throw new AlgebricksException(AsterixBuiltinFunctions.INJECT_FAILURE
-                                            + ": injecting a intended failure");
+                    public void evaluate(IFrameTupleReference tuple, IPointable result) throws AlgebricksException {
+                        evals[1].evaluate(tuple, argPtr);
+                        ATypeTag typeTag = EnumDeserializer.ATYPETAGDESERIALIZER
+                                .deserialize(argPtr.getByteArray()[argPtr.getStartOffset()]);
+                        if (typeTag == ATypeTag.BOOLEAN) {
+                            boolean argResult = ABooleanSerializerDeserializer.getBoolean(argPtr.getByteArray(),
+                                    argPtr.getStartOffset() + 1);
+                            if (argResult) {
+                                throw new AlgebricksException(
+                                        AsterixBuiltinFunctions.INJECT_FAILURE + ": injecting a intended failure");
                             }
-
-                            // evaluate the real evaluator
-                            argOut.reset();
-                            evals[0].evaluate(tuple);
-                            output.getDataOutput().write(argOut.getByteArray(), argOut.getStartOffset(),
-                                    argOut.getLength());
-                        } catch (IOException e) {
-                            throw new AlgebricksException(e);
                         }
+
+                        // evaluate the real evaluator
+                        evals[0].evaluate(tuple, argPtr);
+                        result.set(argPtr.getByteArray(), argPtr.getStartOffset(), argPtr.getLength());
                     }
 
                 };
diff --git a/asterix-runtime/src/main/java/org/apache/asterix/runtime/evaluators/functions/IsNullDescriptor.java b/asterix-runtime/src/main/java/org/apache/asterix/runtime/evaluators/functions/IsNullDescriptor.java
index 17065e8..a528dae 100644
--- a/asterix-runtime/src/main/java/org/apache/asterix/runtime/evaluators/functions/IsNullDescriptor.java
+++ b/asterix-runtime/src/main/java/org/apache/asterix/runtime/evaluators/functions/IsNullDescriptor.java
@@ -29,10 +29,12 @@
 import org.apache.asterix.runtime.evaluators.base.AbstractScalarFunctionDynamicDescriptor;
 import org.apache.hyracks.algebricks.common.exceptions.AlgebricksException;
 import org.apache.hyracks.algebricks.core.algebra.functions.FunctionIdentifier;
-import org.apache.hyracks.algebricks.runtime.base.ICopyEvaluator;
-import org.apache.hyracks.algebricks.runtime.base.ICopyEvaluatorFactory;
+import org.apache.hyracks.algebricks.runtime.base.IScalarEvaluator;
+import org.apache.hyracks.algebricks.runtime.base.IScalarEvaluatorFactory;
+import org.apache.hyracks.api.context.IHyracksTaskContext;
 import org.apache.hyracks.api.exceptions.HyracksDataException;
-import org.apache.hyracks.data.std.api.IDataOutputProvider;
+import org.apache.hyracks.data.std.api.IPointable;
+import org.apache.hyracks.data.std.primitive.VoidPointable;
 import org.apache.hyracks.data.std.util.ArrayBackedValueStorage;
 import org.apache.hyracks.dataflow.common.data.accessors.IFrameTupleReference;
 
@@ -46,29 +48,32 @@
     };
 
     @Override
-    public ICopyEvaluatorFactory createEvaluatorFactory(final ICopyEvaluatorFactory[] args) throws AlgebricksException {
-        return new ICopyEvaluatorFactory() {
+    public IScalarEvaluatorFactory createEvaluatorFactory(final IScalarEvaluatorFactory[] args)
+            throws AlgebricksException {
+        return new IScalarEvaluatorFactory() {
 
             private static final long serialVersionUID = 1L;
 
             @Override
-            public ICopyEvaluator createEvaluator(final IDataOutputProvider output) throws AlgebricksException {
-                return new ICopyEvaluator() {
+            public IScalarEvaluator createScalarEvaluator(final IHyracksTaskContext ctx) throws AlgebricksException {
+                return new IScalarEvaluator() {
 
-                    private DataOutput out = output.getDataOutput();
-                    private ArrayBackedValueStorage argOut = new ArrayBackedValueStorage();
-                    private ICopyEvaluator eval = args[0].createEvaluator(argOut);
+                    private ArrayBackedValueStorage resultStorage = new ArrayBackedValueStorage();
+                    private DataOutput out = resultStorage.getDataOutput();
+                    private IPointable argPtr = new VoidPointable();
+                    private IScalarEvaluator eval = args[0].createScalarEvaluator(ctx);
                     private final AObjectSerializerDeserializer aObjSerDer = AObjectSerializerDeserializer.INSTANCE;
 
                     @Override
-                    public void evaluate(IFrameTupleReference tuple) throws AlgebricksException {
-                        argOut.reset();
-                        eval.evaluate(tuple);
-                        boolean isNull = argOut.getByteArray()[argOut
+                    public void evaluate(IFrameTupleReference tuple, IPointable result) throws AlgebricksException {
+                        eval.evaluate(tuple, argPtr);
+                        boolean isNull = argPtr.getByteArray()[argPtr
                                 .getStartOffset()] == ATypeTag.SERIALIZED_NULL_TYPE_TAG;
                         ABoolean res = isNull ? ABoolean.TRUE : ABoolean.FALSE;
                         try {
+                            resultStorage.reset();
                             aObjSerDer.serialize(res, out);
+                            result.set(resultStorage);
                         } catch (HyracksDataException e) {
                             throw new AlgebricksException(e);
                         }
diff --git a/asterix-runtime/src/main/java/org/apache/asterix/runtime/evaluators/functions/IsSystemNullDescriptor.java b/asterix-runtime/src/main/java/org/apache/asterix/runtime/evaluators/functions/IsSystemNullDescriptor.java
index 40fac14..7ff2c5f 100644
--- a/asterix-runtime/src/main/java/org/apache/asterix/runtime/evaluators/functions/IsSystemNullDescriptor.java
+++ b/asterix-runtime/src/main/java/org/apache/asterix/runtime/evaluators/functions/IsSystemNullDescriptor.java
@@ -29,18 +29,18 @@
 import org.apache.asterix.runtime.evaluators.base.AbstractScalarFunctionDynamicDescriptor;
 import org.apache.hyracks.algebricks.common.exceptions.AlgebricksException;
 import org.apache.hyracks.algebricks.core.algebra.functions.FunctionIdentifier;
-import org.apache.hyracks.algebricks.runtime.base.ICopyEvaluator;
-import org.apache.hyracks.algebricks.runtime.base.ICopyEvaluatorFactory;
+import org.apache.hyracks.algebricks.runtime.base.IScalarEvaluator;
+import org.apache.hyracks.algebricks.runtime.base.IScalarEvaluatorFactory;
+import org.apache.hyracks.api.context.IHyracksTaskContext;
 import org.apache.hyracks.api.exceptions.HyracksDataException;
-import org.apache.hyracks.data.std.api.IDataOutputProvider;
+import org.apache.hyracks.data.std.api.IPointable;
+import org.apache.hyracks.data.std.primitive.VoidPointable;
 import org.apache.hyracks.data.std.util.ArrayBackedValueStorage;
 import org.apache.hyracks.dataflow.common.data.accessors.IFrameTupleReference;
 
 public class IsSystemNullDescriptor extends AbstractScalarFunctionDynamicDescriptor {
 
     private static final long serialVersionUID = 1L;
-
-    private final static byte SER_SYSTEM_NULL_TYPE_TAG = ATypeTag.SYSTEM_NULL.serialize();
     public static final IFunctionDescriptorFactory FACTORY = new IFunctionDescriptorFactory() {
         @Override
         public IFunctionDescriptor createFunctionDescriptor() {
@@ -49,26 +49,27 @@
     };
 
     @Override
-    public ICopyEvaluatorFactory createEvaluatorFactory(final ICopyEvaluatorFactory[] args) throws AlgebricksException {
-        return new ICopyEvaluatorFactory() {
+    public IScalarEvaluatorFactory createEvaluatorFactory(final IScalarEvaluatorFactory[] args)
+            throws AlgebricksException {
+        return new IScalarEvaluatorFactory() {
 
             private static final long serialVersionUID = 1L;
 
             @Override
-            public ICopyEvaluator createEvaluator(final IDataOutputProvider output) throws AlgebricksException {
-                return new ICopyEvaluator() {
+            public IScalarEvaluator createScalarEvaluator(final IHyracksTaskContext ctx) throws AlgebricksException {
+                return new IScalarEvaluator() {
 
-                    private DataOutput out = output.getDataOutput();
-                    private ArrayBackedValueStorage argOut = new ArrayBackedValueStorage();
-                    private ICopyEvaluator eval = args[0].createEvaluator(argOut);
+                    private ArrayBackedValueStorage resultStorage = new ArrayBackedValueStorage();
+                    private DataOutput out = resultStorage.getDataOutput();
+                    private IPointable argPtr = new VoidPointable();
+                    private IScalarEvaluator eval = args[0].createScalarEvaluator(ctx);
                     private final AObjectSerializerDeserializer aObjSerDer = AObjectSerializerDeserializer.INSTANCE;
 
                     @Override
-                    public void evaluate(IFrameTupleReference tuple) throws AlgebricksException {
-                        argOut.reset();
-                        eval.evaluate(tuple);
-                        boolean isSystemNull = argOut.getByteArray()[argOut
-                                .getStartOffset()] == SER_SYSTEM_NULL_TYPE_TAG;
+                    public void evaluate(IFrameTupleReference tuple, IPointable result) throws AlgebricksException {
+                        eval.evaluate(tuple, argPtr);
+                        boolean isSystemNull = argPtr.getByteArray()[argPtr
+                                .getStartOffset()] == ATypeTag.SERIALIZED_SYSTEM_NULL_TYPE_TAG;
                         ABoolean res = isSystemNull ? ABoolean.TRUE : ABoolean.FALSE;
                         try {
                             aObjSerDer.serialize(res, out);
diff --git a/asterix-runtime/src/main/java/org/apache/asterix/runtime/evaluators/functions/LenDescriptor.java b/asterix-runtime/src/main/java/org/apache/asterix/runtime/evaluators/functions/LenDescriptor.java
index bfe6a5c..d42d96f 100644
--- a/asterix-runtime/src/main/java/org/apache/asterix/runtime/evaluators/functions/LenDescriptor.java
+++ b/asterix-runtime/src/main/java/org/apache/asterix/runtime/evaluators/functions/LenDescriptor.java
@@ -36,11 +36,13 @@
 import org.apache.asterix.runtime.evaluators.base.AbstractScalarFunctionDynamicDescriptor;
 import org.apache.hyracks.algebricks.common.exceptions.AlgebricksException;
 import org.apache.hyracks.algebricks.core.algebra.functions.FunctionIdentifier;
-import org.apache.hyracks.algebricks.runtime.base.ICopyEvaluator;
-import org.apache.hyracks.algebricks.runtime.base.ICopyEvaluatorFactory;
+import org.apache.hyracks.algebricks.runtime.base.IScalarEvaluator;
+import org.apache.hyracks.algebricks.runtime.base.IScalarEvaluatorFactory;
+import org.apache.hyracks.api.context.IHyracksTaskContext;
 import org.apache.hyracks.api.dataflow.value.ISerializerDeserializer;
 import org.apache.hyracks.api.exceptions.HyracksDataException;
-import org.apache.hyracks.data.std.api.IDataOutputProvider;
+import org.apache.hyracks.data.std.api.IPointable;
+import org.apache.hyracks.data.std.primitive.VoidPointable;
 import org.apache.hyracks.data.std.util.ArrayBackedValueStorage;
 import org.apache.hyracks.dataflow.common.data.accessors.IFrameTupleReference;
 
@@ -54,19 +56,21 @@
     };
 
     @Override
-    public ICopyEvaluatorFactory createEvaluatorFactory(final ICopyEvaluatorFactory[] args) throws AlgebricksException {
+    public IScalarEvaluatorFactory createEvaluatorFactory(final IScalarEvaluatorFactory[] args)
+            throws AlgebricksException {
 
-        return new ICopyEvaluatorFactory() {
+        return new IScalarEvaluatorFactory() {
             private static final long serialVersionUID = 1L;
 
             @Override
-            public ICopyEvaluator createEvaluator(final IDataOutputProvider output) throws AlgebricksException {
+            public IScalarEvaluator createScalarEvaluator(final IHyracksTaskContext ctx) throws AlgebricksException {
 
-                return new ICopyEvaluator() {
+                return new IScalarEvaluator() {
 
-                    private final DataOutput out = output.getDataOutput();
-                    private final ArrayBackedValueStorage inputVal = new ArrayBackedValueStorage();
-                    private final ICopyEvaluator evalList = args[0].createEvaluator(inputVal);
+                    private final ArrayBackedValueStorage resultStorage = new ArrayBackedValueStorage();
+                    private final DataOutput out = resultStorage.getDataOutput();
+                    private final IPointable inputVal = new VoidPointable();
+                    private final IScalarEvaluator evalList = args[0].createScalarEvaluator(ctx);
 
                     // result
                     private final AMutableInt64 res = new AMutableInt64(0);
@@ -78,33 +82,35 @@
                             .getSerializerDeserializer(BuiltinType.ANULL);
 
                     @Override
-                    public void evaluate(IFrameTupleReference tuple) throws AlgebricksException {
-                        inputVal.reset();
-                        evalList.evaluate(tuple);
-
+                    public void evaluate(IFrameTupleReference tuple, IPointable result) throws AlgebricksException {
+                        resultStorage.reset();
+                        evalList.evaluate(tuple, inputVal);
                         byte[] serList = inputVal.getByteArray();
+                        int offset = inputVal.getStartOffset();
 
-                        if (serList[0] == ATypeTag.SERIALIZED_NULL_TYPE_TAG) {
+                        if (serList[offset] == ATypeTag.SERIALIZED_NULL_TYPE_TAG) {
                             try {
                                 nullSerde.serialize(ANull.NULL, out);
                             } catch (HyracksDataException e) {
                                 throw new AlgebricksException(e);
                             }
+                            result.set(resultStorage);
                             return;
                         }
 
-                        if (serList[0] != ATypeTag.SERIALIZED_ORDEREDLIST_TYPE_TAG
-                                && serList[0] != ATypeTag.SERIALIZED_UNORDEREDLIST_TYPE_TAG) {
+                        if (serList[offset] != ATypeTag.SERIALIZED_ORDEREDLIST_TYPE_TAG
+                                && serList[offset] != ATypeTag.SERIALIZED_UNORDEREDLIST_TYPE_TAG) {
                             throw new AlgebricksException(AsterixBuiltinFunctions.LEN.getName()
                                     + ": expects input type ORDEREDLIST/UNORDEREDLIST but got "
-                                    + EnumDeserializer.ATYPETAGDESERIALIZER.deserialize(serList[0]));
+                                    + EnumDeserializer.ATYPETAGDESERIALIZER.deserialize(serList[offset]));
                         }
 
                         int numberOfitems = 0;
-                        if (serList[0] == ATypeTag.SERIALIZED_ORDEREDLIST_TYPE_TAG)
-                            numberOfitems = AOrderedListSerializerDeserializer.getNumberOfItems(serList);
-                        else
-                            numberOfitems = AUnorderedListSerializerDeserializer.getNumberOfItems(serList);
+                        if (serList[offset] == ATypeTag.SERIALIZED_ORDEREDLIST_TYPE_TAG) {
+                            numberOfitems = AOrderedListSerializerDeserializer.getNumberOfItems(serList, offset);
+                        } else {
+                            numberOfitems = AUnorderedListSerializerDeserializer.getNumberOfItems(serList, offset);
+                        }
 
                         res.setValue(numberOfitems);
                         try {
@@ -112,6 +118,7 @@
                         } catch (IOException e) {
                             throw new AlgebricksException(e);
                         }
+                        result.set(resultStorage);
                     }
                 };
             }
diff --git a/asterix-runtime/src/main/java/org/apache/asterix/runtime/evaluators/functions/NotDescriptor.java b/asterix-runtime/src/main/java/org/apache/asterix/runtime/evaluators/functions/NotDescriptor.java
index 1f97509..f05c2ed 100644
--- a/asterix-runtime/src/main/java/org/apache/asterix/runtime/evaluators/functions/NotDescriptor.java
+++ b/asterix-runtime/src/main/java/org/apache/asterix/runtime/evaluators/functions/NotDescriptor.java
@@ -32,11 +32,13 @@
 import org.apache.asterix.runtime.evaluators.base.AbstractScalarFunctionDynamicDescriptor;
 import org.apache.hyracks.algebricks.common.exceptions.AlgebricksException;
 import org.apache.hyracks.algebricks.core.algebra.functions.FunctionIdentifier;
-import org.apache.hyracks.algebricks.runtime.base.ICopyEvaluator;
-import org.apache.hyracks.algebricks.runtime.base.ICopyEvaluatorFactory;
+import org.apache.hyracks.algebricks.runtime.base.IScalarEvaluator;
+import org.apache.hyracks.algebricks.runtime.base.IScalarEvaluatorFactory;
+import org.apache.hyracks.api.context.IHyracksTaskContext;
 import org.apache.hyracks.api.dataflow.value.ISerializerDeserializer;
 import org.apache.hyracks.api.exceptions.HyracksDataException;
-import org.apache.hyracks.data.std.api.IDataOutputProvider;
+import org.apache.hyracks.data.std.api.IPointable;
+import org.apache.hyracks.data.std.primitive.VoidPointable;
 import org.apache.hyracks.data.std.util.ArrayBackedValueStorage;
 import org.apache.hyracks.dataflow.common.data.accessors.IFrameTupleReference;
 
@@ -55,18 +57,20 @@
     }
 
     @Override
-    public ICopyEvaluatorFactory createEvaluatorFactory(final ICopyEvaluatorFactory[] args) throws AlgebricksException {
-        return new ICopyEvaluatorFactory() {
+    public IScalarEvaluatorFactory createEvaluatorFactory(final IScalarEvaluatorFactory[] args)
+            throws AlgebricksException {
+        return new IScalarEvaluatorFactory() {
             private static final long serialVersionUID = 1L;
 
             @Override
-            public ICopyEvaluator createEvaluator(IDataOutputProvider output) throws AlgebricksException {
-                final DataOutput out = output.getDataOutput();
+            public IScalarEvaluator createScalarEvaluator(IHyracksTaskContext ctx) throws AlgebricksException {
 
-                return new ICopyEvaluator() {
+                return new IScalarEvaluator() {
 
-                    private ArrayBackedValueStorage argOut = new ArrayBackedValueStorage();
-                    private ICopyEvaluator eval = args[0].createEvaluator(argOut);
+                    private ArrayBackedValueStorage resultStorage = new ArrayBackedValueStorage();
+                    private DataOutput out = resultStorage.getDataOutput();
+                    private IPointable argPtr = new VoidPointable();
+                    private IScalarEvaluator eval = args[0].createScalarEvaluator(ctx);
 
                     private String errorMessage = AsterixBuiltinFunctions.NOT.getName()
                             + ": expects input type BOOLEAN/NULL";
@@ -78,21 +82,27 @@
                             .getSerializerDeserializer(BuiltinType.ANULL);
 
                     @Override
-                    public void evaluate(IFrameTupleReference tuple) throws AlgebricksException {
-                        argOut.reset();
-                        eval.evaluate(tuple);
+                    public void evaluate(IFrameTupleReference tuple, IPointable result) throws AlgebricksException {
+                        resultStorage.reset();
+                        eval.evaluate(tuple, argPtr);
+
+                        byte[] bytes = argPtr.getByteArray();
+                        int offset = argPtr.getStartOffset();
+
                         try {
-                            if (argOut.getByteArray()[0] == ATypeTag.SERIALIZED_BOOLEAN_TYPE_TAG) {
-                                boolean argRes = ABooleanSerializerDeserializer.getBoolean(argOut.getByteArray(), 1);
+                            if (bytes[offset] == ATypeTag.SERIALIZED_BOOLEAN_TYPE_TAG) {
+                                boolean argRes = ABooleanSerializerDeserializer.getBoolean(bytes, offset + 1);
                                 ABoolean aResult = argRes ? (ABoolean.FALSE) : (ABoolean.TRUE);
                                 booleanSerde.serialize(aResult, out);
-                            } else if (argOut.getByteArray()[0] == ATypeTag.SERIALIZED_NULL_TYPE_TAG)
+                            } else if (bytes[offset] == ATypeTag.SERIALIZED_NULL_TYPE_TAG) {
                                 nullSerde.serialize(ANull.NULL, out);
-                            else
+                            } else {
                                 throw new AlgebricksException(errorMessage);
+                            }
                         } catch (HyracksDataException hde) {
                             throw new AlgebricksException(hde);
                         }
+                        result.set(resultStorage);
                     }
                 };
             }
diff --git a/asterix-runtime/src/main/java/org/apache/asterix/runtime/evaluators/functions/NotNullDescriptor.java b/asterix-runtime/src/main/java/org/apache/asterix/runtime/evaluators/functions/NotNullDescriptor.java
index b0e3640..090a56b 100644
--- a/asterix-runtime/src/main/java/org/apache/asterix/runtime/evaluators/functions/NotNullDescriptor.java
+++ b/asterix-runtime/src/main/java/org/apache/asterix/runtime/evaluators/functions/NotNullDescriptor.java
@@ -19,9 +19,6 @@
 
 package org.apache.asterix.runtime.evaluators.functions;
 
-import java.io.DataOutput;
-import java.io.IOException;
-
 import org.apache.asterix.om.functions.AsterixBuiltinFunctions;
 import org.apache.asterix.om.functions.IFunctionDescriptor;
 import org.apache.asterix.om.functions.IFunctionDescriptorFactory;
@@ -29,10 +26,11 @@
 import org.apache.asterix.runtime.evaluators.base.AbstractScalarFunctionDynamicDescriptor;
 import org.apache.hyracks.algebricks.common.exceptions.AlgebricksException;
 import org.apache.hyracks.algebricks.core.algebra.functions.FunctionIdentifier;
-import org.apache.hyracks.algebricks.runtime.base.ICopyEvaluator;
-import org.apache.hyracks.algebricks.runtime.base.ICopyEvaluatorFactory;
-import org.apache.hyracks.data.std.api.IDataOutputProvider;
-import org.apache.hyracks.data.std.util.ArrayBackedValueStorage;
+import org.apache.hyracks.algebricks.runtime.base.IScalarEvaluator;
+import org.apache.hyracks.algebricks.runtime.base.IScalarEvaluatorFactory;
+import org.apache.hyracks.api.context.IHyracksTaskContext;
+import org.apache.hyracks.data.std.api.IPointable;
+import org.apache.hyracks.data.std.primitive.VoidPointable;
 import org.apache.hyracks.dataflow.common.data.accessors.IFrameTupleReference;
 
 /**
@@ -51,33 +49,28 @@
     };
 
     @Override
-    public ICopyEvaluatorFactory createEvaluatorFactory(final ICopyEvaluatorFactory[] args) {
-        return new ICopyEvaluatorFactory() {
+    public IScalarEvaluatorFactory createEvaluatorFactory(final IScalarEvaluatorFactory[] args) {
+        return new IScalarEvaluatorFactory() {
             private static final long serialVersionUID = 1L;
 
             @Override
-            public ICopyEvaluator createEvaluator(final IDataOutputProvider output) throws AlgebricksException {
-                return new ICopyEvaluator() {
-                    private DataOutput out = output.getDataOutput();
-                    private ArrayBackedValueStorage outInput = new ArrayBackedValueStorage();
-                    private ICopyEvaluator eval = args[0].createEvaluator(outInput);
+            public IScalarEvaluator createScalarEvaluator(final IHyracksTaskContext ctx) throws AlgebricksException {
+                return new IScalarEvaluator() {
+                    private IPointable inputArg = new VoidPointable();
+                    private IScalarEvaluator eval = args[0].createScalarEvaluator(ctx);
                     private String errorMessage = AsterixBuiltinFunctions.NOT_NULL
                             + ": the input value cannot be NULL.";
 
                     @Override
-                    public void evaluate(IFrameTupleReference tuple) throws AlgebricksException {
+                    public void evaluate(IFrameTupleReference tuple, IPointable result) throws AlgebricksException {
+                        eval.evaluate(tuple, inputArg);
+                        byte[] data = inputArg.getByteArray();
+                        int offset = inputArg.getStartOffset();
 
-                        try {
-                            outInput.reset();
-                            eval.evaluate(tuple);
-                            byte[] data = outInput.getByteArray();
-                            if (data[outInput.getStartOffset()] == ATypeTag.SERIALIZED_NULL_TYPE_TAG) {
-                                throw new AlgebricksException(errorMessage);
-                            }
-                            out.write(data, outInput.getStartOffset(), outInput.getLength());
-                        } catch (IOException e1) {
+                        if (data[offset] == ATypeTag.SERIALIZED_NULL_TYPE_TAG) {
                             throw new AlgebricksException(errorMessage);
                         }
+                        result.set(inputArg);
                     }
                 };
             }
diff --git a/asterix-runtime/src/main/java/org/apache/asterix/runtime/evaluators/functions/NumericAbsDescriptor.java b/asterix-runtime/src/main/java/org/apache/asterix/runtime/evaluators/functions/NumericAbsDescriptor.java
index d1f6a2d..47c78d6 100644
--- a/asterix-runtime/src/main/java/org/apache/asterix/runtime/evaluators/functions/NumericAbsDescriptor.java
+++ b/asterix-runtime/src/main/java/org/apache/asterix/runtime/evaluators/functions/NumericAbsDescriptor.java
@@ -49,11 +49,13 @@
 import org.apache.hyracks.algebricks.common.exceptions.AlgebricksException;
 import org.apache.hyracks.algebricks.common.exceptions.NotImplementedException;
 import org.apache.hyracks.algebricks.core.algebra.functions.FunctionIdentifier;
-import org.apache.hyracks.algebricks.runtime.base.ICopyEvaluator;
-import org.apache.hyracks.algebricks.runtime.base.ICopyEvaluatorFactory;
+import org.apache.hyracks.algebricks.runtime.base.IScalarEvaluator;
+import org.apache.hyracks.algebricks.runtime.base.IScalarEvaluatorFactory;
+import org.apache.hyracks.api.context.IHyracksTaskContext;
 import org.apache.hyracks.api.dataflow.value.ISerializerDeserializer;
 import org.apache.hyracks.api.exceptions.HyracksDataException;
-import org.apache.hyracks.data.std.api.IDataOutputProvider;
+import org.apache.hyracks.data.std.api.IPointable;
+import org.apache.hyracks.data.std.primitive.VoidPointable;
 import org.apache.hyracks.data.std.util.ArrayBackedValueStorage;
 import org.apache.hyracks.dataflow.common.data.accessors.IFrameTupleReference;
 
@@ -72,19 +74,19 @@
     }
 
     @Override
-    public ICopyEvaluatorFactory createEvaluatorFactory(final ICopyEvaluatorFactory[] args) {
-        return new ICopyEvaluatorFactory() {
+    public IScalarEvaluatorFactory createEvaluatorFactory(final IScalarEvaluatorFactory[] args) {
+        return new IScalarEvaluatorFactory() {
             private static final long serialVersionUID = 1L;
 
             @Override
-            public ICopyEvaluator createEvaluator(final IDataOutputProvider output) throws AlgebricksException {
+            public IScalarEvaluator createScalarEvaluator(final IHyracksTaskContext ctx) throws AlgebricksException {
 
-                return new ICopyEvaluator() {
+                return new IScalarEvaluator() {
 
-                    private DataOutput out = output.getDataOutput();
-                    private ArrayBackedValueStorage argOut = new ArrayBackedValueStorage();
-                    private ICopyEvaluator eval = args[0].createEvaluator(argOut);
-
+                    private ArrayBackedValueStorage resultStorage = new ArrayBackedValueStorage();
+                    private DataOutput out = resultStorage.getDataOutput();
+                    private IPointable argPtr = new VoidPointable();
+                    private IScalarEvaluator eval = args[0].createScalarEvaluator(ctx);
                     private AMutableDouble aDouble = new AMutableDouble(0);
                     private AMutableFloat aFloat = new AMutableFloat(0);
                     private AMutableInt64 aInt64 = new AMutableInt64(0);
@@ -96,58 +98,62 @@
 
                     @SuppressWarnings("unchecked")
                     @Override
-                    public void evaluate(IFrameTupleReference tuple) throws AlgebricksException {
-                        argOut.reset();
-                        eval.evaluate(tuple);
+                    public void evaluate(IFrameTupleReference tuple, IPointable result) throws AlgebricksException {
+                        resultStorage.reset();
+                        eval.evaluate(tuple, argPtr);
+                        byte[] data = argPtr.getByteArray();
+                        int offset = argPtr.getStartOffset();
+
                         try {
-                            if (argOut.getByteArray()[0] == ATypeTag.SERIALIZED_NULL_TYPE_TAG) {
+                            if (data[offset] == ATypeTag.SERIALIZED_NULL_TYPE_TAG) {
                                 serde = AqlSerializerDeserializerProvider.INSTANCE
                                         .getSerializerDeserializer(BuiltinType.ANULL);
                                 serde.serialize(ANull.NULL, out);
-                            } else if (argOut.getByteArray()[0] == ATypeTag.SERIALIZED_INT8_TYPE_TAG) {
+                            } else if (data[offset] == ATypeTag.SERIALIZED_INT8_TYPE_TAG) {
                                 serde = AqlSerializerDeserializerProvider.INSTANCE
                                         .getSerializerDeserializer(BuiltinType.AINT8);
-                                byte val = AInt8SerializerDeserializer.getByte(argOut.getByteArray(), 1);
+                                byte val = AInt8SerializerDeserializer.getByte(data, offset + 1);
                                 aInt8.setValue((val <= 0) ? (byte) (0 - val) : val);
                                 serde.serialize(aInt8, out);
-                            } else if (argOut.getByteArray()[0] == ATypeTag.SERIALIZED_INT16_TYPE_TAG) {
+                            } else if (data[offset] == ATypeTag.SERIALIZED_INT16_TYPE_TAG) {
                                 serde = AqlSerializerDeserializerProvider.INSTANCE
                                         .getSerializerDeserializer(BuiltinType.AINT16);
-                                short val = AInt16SerializerDeserializer.getShort(argOut.getByteArray(), 1);
+                                short val = AInt16SerializerDeserializer.getShort(data, offset + 1);
                                 aInt16.setValue((val <= 0) ? (short) (0 - val) : val);
                                 serde.serialize(aInt16, out);
-                            } else if (argOut.getByteArray()[0] == ATypeTag.SERIALIZED_INT32_TYPE_TAG) {
+                            } else if (data[offset] == ATypeTag.SERIALIZED_INT32_TYPE_TAG) {
                                 serde = AqlSerializerDeserializerProvider.INSTANCE
                                         .getSerializerDeserializer(BuiltinType.AINT32);
-                                int val = AInt32SerializerDeserializer.getInt(argOut.getByteArray(), 1);
+                                int val = AInt32SerializerDeserializer.getInt(data, offset + 1);
                                 aInt32.setValue((val <= 0) ? (0 - val) : val);
                                 serde.serialize(aInt32, out);
-                            } else if (argOut.getByteArray()[0] == ATypeTag.SERIALIZED_INT64_TYPE_TAG) {
+                            } else if (data[offset] == ATypeTag.SERIALIZED_INT64_TYPE_TAG) {
                                 serde = AqlSerializerDeserializerProvider.INSTANCE
                                         .getSerializerDeserializer(BuiltinType.AINT64);
-                                long val = AInt64SerializerDeserializer.getLong(argOut.getByteArray(), 1);
+                                long val = AInt64SerializerDeserializer.getLong(data, offset + 1);
                                 aInt64.setValue((val <= 0L) ? (0L - val) : val);
                                 serde.serialize(aInt64, out);
-                            } else if (argOut.getByteArray()[0] == ATypeTag.SERIALIZED_FLOAT_TYPE_TAG) {
+                            } else if (data[offset] == ATypeTag.SERIALIZED_FLOAT_TYPE_TAG) {
                                 serde = AqlSerializerDeserializerProvider.INSTANCE
                                         .getSerializerDeserializer(BuiltinType.AFLOAT);
-                                float val = AFloatSerializerDeserializer.getFloat(argOut.getByteArray(), 1);
+                                float val = AFloatSerializerDeserializer.getFloat(data, offset + 1);
                                 aFloat.setValue((val <= 0.0f) ? 0.0f - val : val);
                                 serde.serialize(aFloat, out);
-                            } else if (argOut.getByteArray()[0] == ATypeTag.SERIALIZED_DOUBLE_TYPE_TAG) {
+                            } else if (data[offset] == ATypeTag.SERIALIZED_DOUBLE_TYPE_TAG) {
                                 serde = AqlSerializerDeserializerProvider.INSTANCE
                                         .getSerializerDeserializer(BuiltinType.ADOUBLE);
-                                double val = ADoubleSerializerDeserializer.getDouble(argOut.getByteArray(), 1);
+                                double val = ADoubleSerializerDeserializer.getDouble(data, offset + 1);
                                 aDouble.setValue((val <= 0.0D) ? 0.0D - val : val);
                                 serde.serialize(aDouble, out);
                             } else {
-                                throw new NotImplementedException(AsterixBuiltinFunctions.NUMERIC_ABS.getName()
-                                        + ": not implemented for "
-                                        + EnumDeserializer.ATYPETAGDESERIALIZER.deserialize(argOut.getByteArray()[0]));
+                                throw new NotImplementedException(
+                                        AsterixBuiltinFunctions.NUMERIC_ABS.getName() + ": not implemented for "
+                                                + EnumDeserializer.ATYPETAGDESERIALIZER.deserialize(data[offset]));
                             }
                         } catch (HyracksDataException e) {
                             throw new AlgebricksException(e);
                         }
+                        result.set(resultStorage);
                     }
                 };
             }
diff --git a/asterix-runtime/src/main/java/org/apache/asterix/runtime/evaluators/functions/NumericCeilingDescriptor.java b/asterix-runtime/src/main/java/org/apache/asterix/runtime/evaluators/functions/NumericCeilingDescriptor.java
index ed4353a..0a42ffb 100644
--- a/asterix-runtime/src/main/java/org/apache/asterix/runtime/evaluators/functions/NumericCeilingDescriptor.java
+++ b/asterix-runtime/src/main/java/org/apache/asterix/runtime/evaluators/functions/NumericCeilingDescriptor.java
@@ -49,11 +49,13 @@
 import org.apache.hyracks.algebricks.common.exceptions.AlgebricksException;
 import org.apache.hyracks.algebricks.common.exceptions.NotImplementedException;
 import org.apache.hyracks.algebricks.core.algebra.functions.FunctionIdentifier;
-import org.apache.hyracks.algebricks.runtime.base.ICopyEvaluator;
-import org.apache.hyracks.algebricks.runtime.base.ICopyEvaluatorFactory;
+import org.apache.hyracks.algebricks.runtime.base.IScalarEvaluator;
+import org.apache.hyracks.algebricks.runtime.base.IScalarEvaluatorFactory;
+import org.apache.hyracks.api.context.IHyracksTaskContext;
 import org.apache.hyracks.api.dataflow.value.ISerializerDeserializer;
 import org.apache.hyracks.api.exceptions.HyracksDataException;
-import org.apache.hyracks.data.std.api.IDataOutputProvider;
+import org.apache.hyracks.data.std.api.IPointable;
+import org.apache.hyracks.data.std.primitive.VoidPointable;
 import org.apache.hyracks.data.std.util.ArrayBackedValueStorage;
 import org.apache.hyracks.dataflow.common.data.accessors.IFrameTupleReference;
 
@@ -73,17 +75,19 @@
     }
 
     @Override
-    public ICopyEvaluatorFactory createEvaluatorFactory(final ICopyEvaluatorFactory[] args) {
-        return new ICopyEvaluatorFactory() {
+    public IScalarEvaluatorFactory createEvaluatorFactory(final IScalarEvaluatorFactory[] args) {
+        return new IScalarEvaluatorFactory() {
             private static final long serialVersionUID = 1L;
 
             @Override
-            public ICopyEvaluator createEvaluator(final IDataOutputProvider output) throws AlgebricksException {
+            public IScalarEvaluator createScalarEvaluator(final IHyracksTaskContext ctx) throws AlgebricksException {
 
-                return new ICopyEvaluator() {
-                    private DataOutput out = output.getDataOutput();
-                    private ArrayBackedValueStorage argOut = new ArrayBackedValueStorage();
-                    private ICopyEvaluator eval = args[0].createEvaluator(argOut);
+                return new IScalarEvaluator() {
+
+                    private ArrayBackedValueStorage resultStorage = new ArrayBackedValueStorage();
+                    private DataOutput out = resultStorage.getDataOutput();
+                    private IPointable argPtr = new VoidPointable();
+                    private IScalarEvaluator eval = args[0].createScalarEvaluator(ctx);
                     private AMutableDouble aDouble = new AMutableDouble(0);
                     private AMutableFloat aFloat = new AMutableFloat(0);
                     private AMutableInt64 aInt64 = new AMutableInt64(0);
@@ -95,55 +99,59 @@
 
                     @SuppressWarnings("unchecked")
                     @Override
-                    public void evaluate(IFrameTupleReference tuple) throws AlgebricksException {
-                        argOut.reset();
-                        eval.evaluate(tuple);
+                    public void evaluate(IFrameTupleReference tuple, IPointable result) throws AlgebricksException {
+                        resultStorage.reset();
+                        eval.evaluate(tuple, argPtr);
+                        byte[] data = argPtr.getByteArray();
+                        int offset = argPtr.getStartOffset();
+
                         try {
-                            if (argOut.getByteArray()[0] == ATypeTag.SERIALIZED_NULL_TYPE_TAG) {
+                            if (data[offset] == ATypeTag.SERIALIZED_NULL_TYPE_TAG) {
                                 serde = AqlSerializerDeserializerProvider.INSTANCE
                                         .getSerializerDeserializer(BuiltinType.ANULL);
                                 serde.serialize(ANull.NULL, out);
-                            } else if (argOut.getByteArray()[0] == ATypeTag.SERIALIZED_INT8_TYPE_TAG) {
+                            } else if (data[offset] == ATypeTag.SERIALIZED_INT8_TYPE_TAG) {
                                 serde = AqlSerializerDeserializerProvider.INSTANCE
                                         .getSerializerDeserializer(BuiltinType.AINT8);
-                                byte val = AInt8SerializerDeserializer.getByte(argOut.getByteArray(), 1);
+                                byte val = AInt8SerializerDeserializer.getByte(data, offset + 1);
                                 aInt8.setValue(val);
                                 serde.serialize(aInt8, out);
-                            } else if (argOut.getByteArray()[0] == ATypeTag.SERIALIZED_INT16_TYPE_TAG) {
+                            } else if (data[offset] == ATypeTag.SERIALIZED_INT16_TYPE_TAG) {
                                 serde = AqlSerializerDeserializerProvider.INSTANCE
                                         .getSerializerDeserializer(BuiltinType.AINT16);
-                                short val = AInt16SerializerDeserializer.getShort(argOut.getByteArray(), 1);
+                                short val = AInt16SerializerDeserializer.getShort(data, offset + 1);
                                 aInt16.setValue(val);
                                 serde.serialize(aInt16, out);
-                            } else if (argOut.getByteArray()[0] == ATypeTag.SERIALIZED_INT32_TYPE_TAG) {
+                            } else if (data[offset] == ATypeTag.SERIALIZED_INT32_TYPE_TAG) {
                                 serde = AqlSerializerDeserializerProvider.INSTANCE
                                         .getSerializerDeserializer(BuiltinType.AINT32);
-                                int val = AInt32SerializerDeserializer.getInt(argOut.getByteArray(), 1);
+                                int val = AInt32SerializerDeserializer.getInt(data, offset + 1);
                                 aInt32.setValue(val);
                                 serde.serialize(aInt32, out);
-                            } else if (argOut.getByteArray()[0] == ATypeTag.SERIALIZED_INT64_TYPE_TAG) {
+                            } else if (data[offset] == ATypeTag.SERIALIZED_INT64_TYPE_TAG) {
                                 serde = AqlSerializerDeserializerProvider.INSTANCE
                                         .getSerializerDeserializer(BuiltinType.AINT64);
-                                long val = AInt64SerializerDeserializer.getLong(argOut.getByteArray(), 1);
+                                long val = AInt64SerializerDeserializer.getLong(data, offset + 1);
                                 aInt64.setValue(val);
                                 serde.serialize(aInt64, out);
-                            } else if (argOut.getByteArray()[0] == ATypeTag.SERIALIZED_FLOAT_TYPE_TAG) {
+                            } else if (data[offset] == ATypeTag.SERIALIZED_FLOAT_TYPE_TAG) {
                                 serde = AqlSerializerDeserializerProvider.INSTANCE
                                         .getSerializerDeserializer(BuiltinType.AFLOAT);
-                                float val = AFloatSerializerDeserializer.getFloat(argOut.getByteArray(), 1);
+                                float val = AFloatSerializerDeserializer.getFloat(data, offset + 1);
                                 aFloat.setValue((float) Math.ceil(val));
                                 serde.serialize(aFloat, out);
-                            } else if (argOut.getByteArray()[0] == ATypeTag.SERIALIZED_DOUBLE_TYPE_TAG) {
+                            } else if (data[offset] == ATypeTag.SERIALIZED_DOUBLE_TYPE_TAG) {
                                 serde = AqlSerializerDeserializerProvider.INSTANCE
                                         .getSerializerDeserializer(BuiltinType.ADOUBLE);
-                                double val = ADoubleSerializerDeserializer.getDouble(argOut.getByteArray(), 1);
+                                double val = ADoubleSerializerDeserializer.getDouble(data, offset + 1);
                                 aDouble.setValue(Math.ceil(val));
                                 serde.serialize(aDouble, out);
                             } else {
-                                throw new NotImplementedException(AsterixBuiltinFunctions.NUMERIC_CEILING.getName()
-                                        + ": not implemented for "
-                                        + EnumDeserializer.ATYPETAGDESERIALIZER.deserialize(argOut.getByteArray()[0]));
+                                throw new NotImplementedException(
+                                        AsterixBuiltinFunctions.NUMERIC_CEILING.getName() + ": not implemented for "
+                                                + EnumDeserializer.ATYPETAGDESERIALIZER.deserialize(data[offset]));
                             }
+                            result.set(resultStorage);
                         } catch (HyracksDataException e) {
                             throw new AlgebricksException(e);
                         }
diff --git a/asterix-runtime/src/main/java/org/apache/asterix/runtime/evaluators/functions/NumericFloorDescriptor.java b/asterix-runtime/src/main/java/org/apache/asterix/runtime/evaluators/functions/NumericFloorDescriptor.java
index c9f1974..0c6aae9 100644
--- a/asterix-runtime/src/main/java/org/apache/asterix/runtime/evaluators/functions/NumericFloorDescriptor.java
+++ b/asterix-runtime/src/main/java/org/apache/asterix/runtime/evaluators/functions/NumericFloorDescriptor.java
@@ -49,11 +49,13 @@
 import org.apache.hyracks.algebricks.common.exceptions.AlgebricksException;
 import org.apache.hyracks.algebricks.common.exceptions.NotImplementedException;
 import org.apache.hyracks.algebricks.core.algebra.functions.FunctionIdentifier;
-import org.apache.hyracks.algebricks.runtime.base.ICopyEvaluator;
-import org.apache.hyracks.algebricks.runtime.base.ICopyEvaluatorFactory;
+import org.apache.hyracks.algebricks.runtime.base.IScalarEvaluator;
+import org.apache.hyracks.algebricks.runtime.base.IScalarEvaluatorFactory;
+import org.apache.hyracks.api.context.IHyracksTaskContext;
 import org.apache.hyracks.api.dataflow.value.ISerializerDeserializer;
 import org.apache.hyracks.api.exceptions.HyracksDataException;
-import org.apache.hyracks.data.std.api.IDataOutputProvider;
+import org.apache.hyracks.data.std.api.IPointable;
+import org.apache.hyracks.data.std.primitive.VoidPointable;
 import org.apache.hyracks.data.std.util.ArrayBackedValueStorage;
 import org.apache.hyracks.dataflow.common.data.accessors.IFrameTupleReference;
 
@@ -72,18 +74,19 @@
     }
 
     @Override
-    public ICopyEvaluatorFactory createEvaluatorFactory(final ICopyEvaluatorFactory[] args) {
-        return new ICopyEvaluatorFactory() {
+    public IScalarEvaluatorFactory createEvaluatorFactory(final IScalarEvaluatorFactory[] args) {
+        return new IScalarEvaluatorFactory() {
             private static final long serialVersionUID = 1L;
 
             @Override
-            public ICopyEvaluator createEvaluator(final IDataOutputProvider output) throws AlgebricksException {
+            public IScalarEvaluator createScalarEvaluator(final IHyracksTaskContext ctx) throws AlgebricksException {
 
-                return new ICopyEvaluator() {
+                return new IScalarEvaluator() {
 
-                    private DataOutput out = output.getDataOutput();
-                    private ArrayBackedValueStorage argOut = new ArrayBackedValueStorage();
-                    private ICopyEvaluator eval = args[0].createEvaluator(argOut);
+                    private ArrayBackedValueStorage resultStorage = new ArrayBackedValueStorage();
+                    private DataOutput out = resultStorage.getDataOutput();
+                    private IPointable argPtr = new VoidPointable();
+                    private IScalarEvaluator eval = args[0].createScalarEvaluator(ctx);
                     private AMutableDouble aDouble = new AMutableDouble(0);
                     private AMutableFloat aFloat = new AMutableFloat(0);
                     private AMutableInt64 aInt64 = new AMutableInt64(0);
@@ -95,55 +98,59 @@
 
                     @SuppressWarnings("unchecked")
                     @Override
-                    public void evaluate(IFrameTupleReference tuple) throws AlgebricksException {
-                        argOut.reset();
-                        eval.evaluate(tuple);
+                    public void evaluate(IFrameTupleReference tuple, IPointable result) throws AlgebricksException {
+                        resultStorage.reset();
+                        eval.evaluate(tuple, argPtr);
+                        byte[] data = argPtr.getByteArray();
+                        int offset = argPtr.getStartOffset();
+
                         try {
-                            if (argOut.getByteArray()[0] == ATypeTag.SERIALIZED_NULL_TYPE_TAG) {
+                            if (data[offset] == ATypeTag.SERIALIZED_NULL_TYPE_TAG) {
                                 serde = AqlSerializerDeserializerProvider.INSTANCE
                                         .getSerializerDeserializer(BuiltinType.ANULL);
                                 serde.serialize(ANull.NULL, out);
-                            } else if (argOut.getByteArray()[0] == ATypeTag.SERIALIZED_INT8_TYPE_TAG) {
+                            } else if (data[offset] == ATypeTag.SERIALIZED_INT8_TYPE_TAG) {
                                 serde = AqlSerializerDeserializerProvider.INSTANCE
                                         .getSerializerDeserializer(BuiltinType.AINT8);
-                                byte val = AInt8SerializerDeserializer.getByte(argOut.getByteArray(), 1);
+                                byte val = AInt8SerializerDeserializer.getByte(data, offset + 1);
                                 aInt8.setValue(val);
                                 serde.serialize(aInt8, out);
-                            } else if (argOut.getByteArray()[0] == ATypeTag.SERIALIZED_INT16_TYPE_TAG) {
+                            } else if (data[offset] == ATypeTag.SERIALIZED_INT16_TYPE_TAG) {
                                 serde = AqlSerializerDeserializerProvider.INSTANCE
                                         .getSerializerDeserializer(BuiltinType.AINT16);
-                                short val = AInt16SerializerDeserializer.getShort(argOut.getByteArray(), 1);
+                                short val = AInt16SerializerDeserializer.getShort(data, offset + 1);
                                 aInt16.setValue(val);
                                 serde.serialize(aInt16, out);
-                            } else if (argOut.getByteArray()[0] == ATypeTag.SERIALIZED_INT32_TYPE_TAG) {
+                            } else if (data[offset] == ATypeTag.SERIALIZED_INT32_TYPE_TAG) {
                                 serde = AqlSerializerDeserializerProvider.INSTANCE
                                         .getSerializerDeserializer(BuiltinType.AINT32);
-                                int val = AInt32SerializerDeserializer.getInt(argOut.getByteArray(), 1);
+                                int val = AInt32SerializerDeserializer.getInt(data, offset + 1);
                                 aInt32.setValue(val);
                                 serde.serialize(aInt32, out);
-                            } else if (argOut.getByteArray()[0] == ATypeTag.SERIALIZED_INT64_TYPE_TAG) {
+                            } else if (data[offset] == ATypeTag.SERIALIZED_INT64_TYPE_TAG) {
                                 serde = AqlSerializerDeserializerProvider.INSTANCE
                                         .getSerializerDeserializer(BuiltinType.AINT64);
-                                long val = AInt64SerializerDeserializer.getLong(argOut.getByteArray(), 1);
+                                long val = AInt64SerializerDeserializer.getLong(data, offset + 1);
                                 aInt64.setValue(val);
                                 serde.serialize(aInt64, out);
-                            } else if (argOut.getByteArray()[0] == ATypeTag.SERIALIZED_FLOAT_TYPE_TAG) {
+                            } else if (data[offset] == ATypeTag.SERIALIZED_FLOAT_TYPE_TAG) {
                                 serde = AqlSerializerDeserializerProvider.INSTANCE
                                         .getSerializerDeserializer(BuiltinType.AFLOAT);
-                                float val = AFloatSerializerDeserializer.getFloat(argOut.getByteArray(), 1);
+                                float val = AFloatSerializerDeserializer.getFloat(data, offset + 1);
                                 aFloat.setValue((float) Math.floor(val));
                                 serde.serialize(aFloat, out);
-                            } else if (argOut.getByteArray()[0] == ATypeTag.SERIALIZED_DOUBLE_TYPE_TAG) {
+                            } else if (data[offset] == ATypeTag.SERIALIZED_DOUBLE_TYPE_TAG) {
                                 serde = AqlSerializerDeserializerProvider.INSTANCE
                                         .getSerializerDeserializer(BuiltinType.ADOUBLE);
-                                double val = ADoubleSerializerDeserializer.getDouble(argOut.getByteArray(), 1);
+                                double val = ADoubleSerializerDeserializer.getDouble(data, offset + 1);
                                 aDouble.setValue(Math.floor(val));
                                 serde.serialize(aDouble, out);
                             } else {
-                                throw new NotImplementedException(AsterixBuiltinFunctions.NUMERIC_FLOOR.getName()
-                                        + ": not implemented for "
-                                        + EnumDeserializer.ATYPETAGDESERIALIZER.deserialize(argOut.getByteArray()[0]));
+                                throw new NotImplementedException(
+                                        AsterixBuiltinFunctions.NUMERIC_FLOOR.getName() + ": not implemented for "
+                                                + EnumDeserializer.ATYPETAGDESERIALIZER.deserialize(data[offset]));
                             }
+                            result.set(resultStorage);
                         } catch (HyracksDataException e) {
                             throw new AlgebricksException(e);
                         }
diff --git a/asterix-runtime/src/main/java/org/apache/asterix/runtime/evaluators/functions/NumericModuloDescriptor.java b/asterix-runtime/src/main/java/org/apache/asterix/runtime/evaluators/functions/NumericModuloDescriptor.java
index d770e03..1bc936c 100644
--- a/asterix-runtime/src/main/java/org/apache/asterix/runtime/evaluators/functions/NumericModuloDescriptor.java
+++ b/asterix-runtime/src/main/java/org/apache/asterix/runtime/evaluators/functions/NumericModuloDescriptor.java
@@ -44,11 +44,13 @@
 import org.apache.hyracks.algebricks.common.exceptions.AlgebricksException;
 import org.apache.hyracks.algebricks.common.exceptions.NotImplementedException;
 import org.apache.hyracks.algebricks.core.algebra.functions.FunctionIdentifier;
-import org.apache.hyracks.algebricks.runtime.base.ICopyEvaluator;
-import org.apache.hyracks.algebricks.runtime.base.ICopyEvaluatorFactory;
+import org.apache.hyracks.algebricks.runtime.base.IScalarEvaluator;
+import org.apache.hyracks.algebricks.runtime.base.IScalarEvaluatorFactory;
+import org.apache.hyracks.api.context.IHyracksTaskContext;
 import org.apache.hyracks.api.dataflow.value.ISerializerDeserializer;
 import org.apache.hyracks.api.exceptions.HyracksDataException;
-import org.apache.hyracks.data.std.api.IDataOutputProvider;
+import org.apache.hyracks.data.std.api.IPointable;
+import org.apache.hyracks.data.std.primitive.VoidPointable;
 import org.apache.hyracks.data.std.util.ArrayBackedValueStorage;
 import org.apache.hyracks.dataflow.common.data.accessors.IFrameTupleReference;
 
@@ -59,6 +61,7 @@
 
     private static final long serialVersionUID = 1L;
     public static final IFunctionDescriptorFactory FACTORY = new IFunctionDescriptorFactory() {
+        @Override
         public IFunctionDescriptor createFunctionDescriptor() {
             return new NumericModuloDescriptor();
         }
@@ -70,19 +73,21 @@
     }
 
     @Override
-    public ICopyEvaluatorFactory createEvaluatorFactory(final ICopyEvaluatorFactory[] args) throws AlgebricksException {
-        return new ICopyEvaluatorFactory() {
+    public IScalarEvaluatorFactory createEvaluatorFactory(final IScalarEvaluatorFactory[] args)
+            throws AlgebricksException {
+        return new IScalarEvaluatorFactory() {
             private static final long serialVersionUID = 1L;
 
             @Override
-            public ICopyEvaluator createEvaluator(final IDataOutputProvider output) throws AlgebricksException {
+            public IScalarEvaluator createScalarEvaluator(final IHyracksTaskContext ctx) throws AlgebricksException {
 
-                return new ICopyEvaluator() {
-                    private DataOutput out = output.getDataOutput();
+                return new IScalarEvaluator() {
+                    private ArrayBackedValueStorage resultStorage = new ArrayBackedValueStorage();
+                    private DataOutput out = resultStorage.getDataOutput();
                     // one temp. buffer re-used by both children
-                    private ArrayBackedValueStorage argOut = new ArrayBackedValueStorage();
-                    private ICopyEvaluator evalLeft = args[0].createEvaluator(argOut);
-                    private ICopyEvaluator evalRight = args[1].createEvaluator(argOut);
+                    private IPointable argPtr = new VoidPointable();
+                    private IScalarEvaluator evalLeft = args[0].createScalarEvaluator(ctx);
+                    private IScalarEvaluator evalRight = args[1].createScalarEvaluator(ctx);
                     private double[] operands = new double[args.length];
                     private boolean metInt8 = false, metInt16 = false, metInt32 = false, metInt64 = false,
                             metFloat = false, metDouble = false;
@@ -98,59 +103,61 @@
 
                     @SuppressWarnings("unchecked")
                     @Override
-                    public void evaluate(IFrameTupleReference tuple) throws AlgebricksException {
+                    public void evaluate(IFrameTupleReference tuple, IPointable result) throws AlgebricksException {
 
                         try {
+                            resultStorage.reset();
                             for (int i = 0; i < args.length; i++) {
-                                argOut.reset();
-                                if (i == 0)
-                                    evalLeft.evaluate(tuple);
-                                else
-                                    evalRight.evaluate(tuple);
-                                typeTag = EnumDeserializer.ATYPETAGDESERIALIZER.deserialize(argOut.getByteArray()[0]);
+                                if (i == 0) {
+                                    evalLeft.evaluate(tuple, argPtr);
+                                } else {
+                                    evalRight.evaluate(tuple, argPtr);
+                                }
+                                byte[] data = argPtr.getByteArray();
+                                int offset = argPtr.getStartOffset();
+                                typeTag = EnumDeserializer.ATYPETAGDESERIALIZER.deserialize(data[offset]);
                                 switch (typeTag) {
                                     case INT8: {
                                         metInt8 = true;
-                                        operands[i] = AInt8SerializerDeserializer.getByte(argOut.getByteArray(), 1);
+                                        operands[i] = AInt8SerializerDeserializer.getByte(data, offset + 1);
                                         break;
                                     }
                                     case INT16: {
                                         metInt16 = true;
-                                        operands[i] = AInt16SerializerDeserializer.getShort(argOut.getByteArray(), 1);
+                                        operands[i] = AInt16SerializerDeserializer.getShort(data, offset + 1);
                                         break;
                                     }
                                     case INT32: {
                                         metInt32 = true;
-                                        operands[i] = AInt32SerializerDeserializer.getInt(argOut.getByteArray(), 1);
+                                        operands[i] = AInt32SerializerDeserializer.getInt(data, offset + 1);
                                         break;
                                     }
                                     case INT64: {
                                         metInt64 = true;
-                                        operands[i] = AInt64SerializerDeserializer.getLong(argOut.getByteArray(), 1);
+                                        operands[i] = AInt64SerializerDeserializer.getLong(data, offset + 1);
                                         break;
                                     }
                                     case FLOAT: {
                                         metFloat = true;
-                                        operands[i] = AFloatSerializerDeserializer.getFloat(argOut.getByteArray(), 1);
+                                        operands[i] = AFloatSerializerDeserializer.getFloat(data, offset + 1);
                                         break;
                                     }
                                     case DOUBLE: {
                                         metDouble = true;
-                                        operands[i] = ADoubleSerializerDeserializer.getDouble(argOut.getByteArray(), 1);
+                                        operands[i] = ADoubleSerializerDeserializer.getDouble(data, offset + 1);
                                         break;
                                     }
                                     case NULL: {
                                         serde = AqlSerializerDeserializerProvider.INSTANCE
                                                 .getSerializerDeserializer(BuiltinType.ANULL);
                                         serde.serialize(ANull.NULL, out);
+                                        result.set(resultStorage);
                                         return;
                                     }
                                     default: {
                                         throw new NotImplementedException(AsterixBuiltinFunctions.NUMERIC_MOD.getName()
-                                                + (i == 0 ? ": left" : ": right")
-                                                + " operand can not be "
-                                                + EnumDeserializer.ATYPETAGDESERIALIZER.deserialize(argOut
-                                                        .getByteArray()[0]));
+                                                + (i == 0 ? ": left" : ": right") + " operand can not be "
+                                                + EnumDeserializer.ATYPETAGDESERIALIZER.deserialize(data[offset]));
                                     }
                                 }
                             }
@@ -186,7 +193,7 @@
                                 aInt8.setValue((byte) (operands[0] % operands[1]));
                                 serde.serialize(aInt8, out);
                             }
-
+                            result.set(resultStorage);
                         } catch (HyracksDataException hde) {
                             throw new AlgebricksException(hde);
                         }
diff --git a/asterix-runtime/src/main/java/org/apache/asterix/runtime/evaluators/functions/NumericRoundDescriptor.java b/asterix-runtime/src/main/java/org/apache/asterix/runtime/evaluators/functions/NumericRoundDescriptor.java
index 23bfad8..b05ff65 100644
--- a/asterix-runtime/src/main/java/org/apache/asterix/runtime/evaluators/functions/NumericRoundDescriptor.java
+++ b/asterix-runtime/src/main/java/org/apache/asterix/runtime/evaluators/functions/NumericRoundDescriptor.java
@@ -49,11 +49,13 @@
 import org.apache.hyracks.algebricks.common.exceptions.AlgebricksException;
 import org.apache.hyracks.algebricks.common.exceptions.NotImplementedException;
 import org.apache.hyracks.algebricks.core.algebra.functions.FunctionIdentifier;
-import org.apache.hyracks.algebricks.runtime.base.ICopyEvaluator;
-import org.apache.hyracks.algebricks.runtime.base.ICopyEvaluatorFactory;
+import org.apache.hyracks.algebricks.runtime.base.IScalarEvaluator;
+import org.apache.hyracks.algebricks.runtime.base.IScalarEvaluatorFactory;
+import org.apache.hyracks.api.context.IHyracksTaskContext;
 import org.apache.hyracks.api.dataflow.value.ISerializerDeserializer;
 import org.apache.hyracks.api.exceptions.HyracksDataException;
-import org.apache.hyracks.data.std.api.IDataOutputProvider;
+import org.apache.hyracks.data.std.api.IPointable;
+import org.apache.hyracks.data.std.primitive.VoidPointable;
 import org.apache.hyracks.data.std.util.ArrayBackedValueStorage;
 import org.apache.hyracks.dataflow.common.data.accessors.IFrameTupleReference;
 
@@ -72,18 +74,19 @@
     }
 
     @Override
-    public ICopyEvaluatorFactory createEvaluatorFactory(final ICopyEvaluatorFactory[] args) {
-        return new ICopyEvaluatorFactory() {
+    public IScalarEvaluatorFactory createEvaluatorFactory(final IScalarEvaluatorFactory[] args) {
+        return new IScalarEvaluatorFactory() {
             private static final long serialVersionUID = 1L;
 
             @Override
-            public ICopyEvaluator createEvaluator(final IDataOutputProvider output) throws AlgebricksException {
+            public IScalarEvaluator createScalarEvaluator(final IHyracksTaskContext ctx) throws AlgebricksException {
 
-                return new ICopyEvaluator() {
+                return new IScalarEvaluator() {
 
-                    private DataOutput out = output.getDataOutput();
-                    private ArrayBackedValueStorage argOut = new ArrayBackedValueStorage();
-                    private ICopyEvaluator eval = args[0].createEvaluator(argOut);
+                    private ArrayBackedValueStorage resultStorage = new ArrayBackedValueStorage();
+                    private DataOutput out = resultStorage.getDataOutput();
+                    private IPointable argPtr = new VoidPointable();
+                    private IScalarEvaluator eval = args[0].createScalarEvaluator(ctx);
                     private AMutableDouble aDouble = new AMutableDouble(0);
                     private AMutableFloat aFloat = new AMutableFloat(0);
                     private AMutableInt64 aInt64 = new AMutableInt64(0);
@@ -95,60 +98,64 @@
 
                     @SuppressWarnings("unchecked")
                     @Override
-                    public void evaluate(IFrameTupleReference tuple) throws AlgebricksException {
-                        argOut.reset();
-                        eval.evaluate(tuple);
+                    public void evaluate(IFrameTupleReference tuple, IPointable result) throws AlgebricksException {
+                        resultStorage.reset();
+                        eval.evaluate(tuple, argPtr);
+                        byte[] data = argPtr.getByteArray();
+                        int offset = argPtr.getStartOffset();
+
                         try {
-                            if (argOut.getByteArray()[0] == ATypeTag.SERIALIZED_NULL_TYPE_TAG) {
+                            if (data[offset] == ATypeTag.SERIALIZED_NULL_TYPE_TAG) {
                                 serde = AqlSerializerDeserializerProvider.INSTANCE
                                         .getSerializerDeserializer(BuiltinType.ANULL);
                                 serde.serialize(ANull.NULL, out);
-                            } else if (argOut.getByteArray()[0] == ATypeTag.SERIALIZED_INT8_TYPE_TAG) {
+                            } else if (data[offset] == ATypeTag.SERIALIZED_INT8_TYPE_TAG) {
                                 serde = AqlSerializerDeserializerProvider.INSTANCE
                                         .getSerializerDeserializer(BuiltinType.AINT8);
-                                byte val = AInt8SerializerDeserializer.getByte(argOut.getByteArray(), 1);
+                                byte val = AInt8SerializerDeserializer.getByte(data, offset + 1);
                                 aInt8.setValue(val);
                                 serde.serialize(aInt8, out);
-                            } else if (argOut.getByteArray()[0] == ATypeTag.SERIALIZED_INT16_TYPE_TAG) {
+                            } else if (data[offset] == ATypeTag.SERIALIZED_INT16_TYPE_TAG) {
                                 serde = AqlSerializerDeserializerProvider.INSTANCE
                                         .getSerializerDeserializer(BuiltinType.AINT16);
-                                short val = AInt16SerializerDeserializer.getShort(argOut.getByteArray(), 1);
+                                short val = AInt16SerializerDeserializer.getShort(data, offset + 1);
                                 aInt16.setValue(val);
                                 serde.serialize(aInt16, out);
-                            } else if (argOut.getByteArray()[0] == ATypeTag.SERIALIZED_INT32_TYPE_TAG) {
+                            } else if (data[offset] == ATypeTag.SERIALIZED_INT32_TYPE_TAG) {
                                 serde = AqlSerializerDeserializerProvider.INSTANCE
                                         .getSerializerDeserializer(BuiltinType.AINT32);
-                                int val = AInt32SerializerDeserializer.getInt(argOut.getByteArray(), 1);
+                                int val = AInt32SerializerDeserializer.getInt(data, offset + 1);
                                 aInt32.setValue(val);
                                 serde.serialize(aInt32, out);
-                            } else if (argOut.getByteArray()[0] == ATypeTag.SERIALIZED_INT64_TYPE_TAG) {
+                            } else if (data[offset] == ATypeTag.SERIALIZED_INT64_TYPE_TAG) {
                                 serde = AqlSerializerDeserializerProvider.INSTANCE
                                         .getSerializerDeserializer(BuiltinType.AINT64);
-                                long val = AInt64SerializerDeserializer.getLong(argOut.getByteArray(), 1);
+                                long val = AInt64SerializerDeserializer.getLong(data, offset + 1);
                                 aInt64.setValue(val);
                                 serde.serialize(aInt64, out);
-                            } else if (argOut.getByteArray()[0] == ATypeTag.SERIALIZED_FLOAT_TYPE_TAG) {
+                            } else if (data[offset] == ATypeTag.SERIALIZED_FLOAT_TYPE_TAG) {
                                 serde = AqlSerializerDeserializerProvider.INSTANCE
                                         .getSerializerDeserializer(BuiltinType.AFLOAT);
-                                float val = AFloatSerializerDeserializer.getFloat(argOut.getByteArray(), 1);
+                                float val = AFloatSerializerDeserializer.getFloat(data, offset + 1);
                                 val = Math.round(val);
                                 aFloat.setValue(val);
                                 serde.serialize(aFloat, out);
-                            } else if (argOut.getByteArray()[0] == ATypeTag.SERIALIZED_DOUBLE_TYPE_TAG) {
+                            } else if (data[offset] == ATypeTag.SERIALIZED_DOUBLE_TYPE_TAG) {
                                 serde = AqlSerializerDeserializerProvider.INSTANCE
                                         .getSerializerDeserializer(BuiltinType.ADOUBLE);
-                                double val = ADoubleSerializerDeserializer.getDouble(argOut.getByteArray(), 1);
+                                double val = ADoubleSerializerDeserializer.getDouble(data, offset + 1);
                                 val = Math.round(val);
                                 aDouble.setValue(val);
                                 serde.serialize(aDouble, out);
                             } else {
-                                throw new NotImplementedException(AsterixBuiltinFunctions.NUMERIC_ROUND.getName()
-                                        + ": not implemented for "
-                                        + EnumDeserializer.ATYPETAGDESERIALIZER.deserialize(argOut.getByteArray()[0]));
+                                throw new NotImplementedException(
+                                        AsterixBuiltinFunctions.NUMERIC_ROUND.getName() + ": not implemented for "
+                                                + EnumDeserializer.ATYPETAGDESERIALIZER.deserialize(data[offset]));
                             }
                         } catch (HyracksDataException e) {
                             throw new AlgebricksException(e);
                         }
+                        result.set(resultStorage);
                     }
                 };
             }
diff --git a/asterix-runtime/src/main/java/org/apache/asterix/runtime/evaluators/functions/NumericRoundHalfToEven2Descriptor.java b/asterix-runtime/src/main/java/org/apache/asterix/runtime/evaluators/functions/NumericRoundHalfToEven2Descriptor.java
index cdf9115..a1acb14 100644
--- a/asterix-runtime/src/main/java/org/apache/asterix/runtime/evaluators/functions/NumericRoundHalfToEven2Descriptor.java
+++ b/asterix-runtime/src/main/java/org/apache/asterix/runtime/evaluators/functions/NumericRoundHalfToEven2Descriptor.java
@@ -50,11 +50,13 @@
 import org.apache.hyracks.algebricks.common.exceptions.AlgebricksException;
 import org.apache.hyracks.algebricks.common.exceptions.NotImplementedException;
 import org.apache.hyracks.algebricks.core.algebra.functions.FunctionIdentifier;
-import org.apache.hyracks.algebricks.runtime.base.ICopyEvaluator;
-import org.apache.hyracks.algebricks.runtime.base.ICopyEvaluatorFactory;
+import org.apache.hyracks.algebricks.runtime.base.IScalarEvaluator;
+import org.apache.hyracks.algebricks.runtime.base.IScalarEvaluatorFactory;
+import org.apache.hyracks.api.context.IHyracksTaskContext;
 import org.apache.hyracks.api.dataflow.value.ISerializerDeserializer;
 import org.apache.hyracks.api.exceptions.HyracksDataException;
-import org.apache.hyracks.data.std.api.IDataOutputProvider;
+import org.apache.hyracks.data.std.api.IPointable;
+import org.apache.hyracks.data.std.primitive.VoidPointable;
 import org.apache.hyracks.data.std.util.ArrayBackedValueStorage;
 import org.apache.hyracks.dataflow.common.data.accessors.IFrameTupleReference;
 
@@ -74,19 +76,20 @@
     }
 
     @Override
-    public ICopyEvaluatorFactory createEvaluatorFactory(final ICopyEvaluatorFactory[] args) {
-        return new ICopyEvaluatorFactory() {
+    public IScalarEvaluatorFactory createEvaluatorFactory(final IScalarEvaluatorFactory[] args) {
+        return new IScalarEvaluatorFactory() {
             private static final long serialVersionUID = 1L;
 
             @Override
-            public ICopyEvaluator createEvaluator(final IDataOutputProvider output) throws AlgebricksException {
+            public IScalarEvaluator createScalarEvaluator(final IHyracksTaskContext ctx) throws AlgebricksException {
 
-                return new ICopyEvaluator() {
+                return new IScalarEvaluator() {
 
-                    private DataOutput out = output.getDataOutput();
-                    private ArrayBackedValueStorage argOut = new ArrayBackedValueStorage();
-                    private ICopyEvaluator eval = args[0].createEvaluator(argOut);
-                    private ICopyEvaluator precision = args[1].createEvaluator(argOut);
+                    private ArrayBackedValueStorage resultStorage = new ArrayBackedValueStorage();
+                    private DataOutput out = resultStorage.getDataOutput();
+                    private IPointable argPtr = new VoidPointable();
+                    private IScalarEvaluator eval = args[0].createScalarEvaluator(ctx);
+                    private IScalarEvaluator precision = args[1].createScalarEvaluator(ctx);
                     private AMutableDouble aDouble = new AMutableDouble(0);
                     private AMutableFloat aFloat = new AMutableFloat(0);
                     private AMutableInt64 aInt64 = new AMutableInt64(0);
@@ -97,17 +100,19 @@
                     private ISerializerDeserializer serde;
 
                     private int getPrecision(IFrameTupleReference tuple) throws AlgebricksException {
-                        argOut.reset();
-                        precision.evaluate(tuple);
+                        resultStorage.reset();
+                        precision.evaluate(tuple, argPtr);
+                        byte[] bytes = argPtr.getByteArray();
+                        int offset = argPtr.getStartOffset();
 
-                        if (argOut.getByteArray()[0] == ATypeTag.SERIALIZED_INT8_TYPE_TAG) {
-                            return AInt8SerializerDeserializer.getByte(argOut.getByteArray(), 1);
-                        } else if (argOut.getByteArray()[0] == ATypeTag.SERIALIZED_INT16_TYPE_TAG) {
-                            return AInt16SerializerDeserializer.getShort(argOut.getByteArray(), 1);
-                        } else if (argOut.getByteArray()[0] == ATypeTag.SERIALIZED_INT32_TYPE_TAG) {
-                            return AInt32SerializerDeserializer.getInt(argOut.getByteArray(), 1);
-                        } else if (argOut.getByteArray()[0] == ATypeTag.SERIALIZED_INT64_TYPE_TAG) {
-                            return (int) AInt64SerializerDeserializer.getLong(argOut.getByteArray(), 1);
+                        if (bytes[offset] == ATypeTag.SERIALIZED_INT8_TYPE_TAG) {
+                            return AInt8SerializerDeserializer.getByte(bytes, offset + 1);
+                        } else if (bytes[offset] == ATypeTag.SERIALIZED_INT16_TYPE_TAG) {
+                            return AInt16SerializerDeserializer.getShort(bytes, offset + 1);
+                        } else if (bytes[offset] == ATypeTag.SERIALIZED_INT32_TYPE_TAG) {
+                            return AInt32SerializerDeserializer.getInt(bytes, offset + 1);
+                        } else if (bytes[offset] == ATypeTag.SERIALIZED_INT64_TYPE_TAG) {
+                            return (int) AInt64SerializerDeserializer.getLong(bytes, offset + 1);
                         } else {
                             throw new AlgebricksException(AsterixBuiltinFunctions.NUMERIC_ROUND_HALF_TO_EVEN2.getName()
                                     + ": the precision argument should be an INT8/INT16/INT32/INT64.");
@@ -116,43 +121,45 @@
 
                     @SuppressWarnings("unchecked")
                     @Override
-                    public void evaluate(IFrameTupleReference tuple) throws AlgebricksException {
-                        argOut.reset();
-                        eval.evaluate(tuple);
+                    public void evaluate(IFrameTupleReference tuple, IPointable result) throws AlgebricksException {
+                        resultStorage.reset();
+                        eval.evaluate(tuple, argPtr);
+                        byte[] data = argPtr.getByteArray();
+                        int offset = argPtr.getStartOffset();
 
                         try {
-                            if (argOut.getByteArray()[0] == ATypeTag.SERIALIZED_NULL_TYPE_TAG) {
+                            if (data[offset] == ATypeTag.SERIALIZED_NULL_TYPE_TAG) {
                                 serde = AqlSerializerDeserializerProvider.INSTANCE
                                         .getSerializerDeserializer(BuiltinType.ANULL);
                                 serde.serialize(ANull.NULL, out);
-                            } else if (argOut.getByteArray()[0] == ATypeTag.SERIALIZED_INT8_TYPE_TAG) {
+                            } else if (data[offset] == ATypeTag.SERIALIZED_INT8_TYPE_TAG) {
                                 serde = AqlSerializerDeserializerProvider.INSTANCE
                                         .getSerializerDeserializer(BuiltinType.AINT8);
-                                byte val = AInt8SerializerDeserializer.getByte(argOut.getByteArray(), 1);
+                                byte val = AInt8SerializerDeserializer.getByte(data, offset + 1);
                                 aInt8.setValue(val);
                                 serde.serialize(aInt8, out);
-                            } else if (argOut.getByteArray()[0] == ATypeTag.SERIALIZED_INT16_TYPE_TAG) {
+                            } else if (data[offset] == ATypeTag.SERIALIZED_INT16_TYPE_TAG) {
                                 serde = AqlSerializerDeserializerProvider.INSTANCE
                                         .getSerializerDeserializer(BuiltinType.AINT16);
-                                short val = AInt16SerializerDeserializer.getShort(argOut.getByteArray(), 1);
+                                short val = AInt16SerializerDeserializer.getShort(data, offset + 1);
                                 aInt16.setValue(val);
                                 serde.serialize(aInt16, out);
-                            } else if (argOut.getByteArray()[0] == ATypeTag.SERIALIZED_INT32_TYPE_TAG) {
+                            } else if (data[offset] == ATypeTag.SERIALIZED_INT32_TYPE_TAG) {
                                 serde = AqlSerializerDeserializerProvider.INSTANCE
                                         .getSerializerDeserializer(BuiltinType.AINT32);
-                                int val = AInt32SerializerDeserializer.getInt(argOut.getByteArray(), 1);
+                                int val = AInt32SerializerDeserializer.getInt(data, offset + 1);
                                 aInt32.setValue(val);
                                 serde.serialize(aInt32, out);
-                            } else if (argOut.getByteArray()[0] == ATypeTag.SERIALIZED_INT64_TYPE_TAG) {
+                            } else if (data[offset] == ATypeTag.SERIALIZED_INT64_TYPE_TAG) {
                                 serde = AqlSerializerDeserializerProvider.INSTANCE
                                         .getSerializerDeserializer(BuiltinType.AINT64);
-                                long val = AInt64SerializerDeserializer.getLong(argOut.getByteArray(), 1);
+                                long val = AInt64SerializerDeserializer.getLong(data, offset + 1);
                                 aInt64.setValue(val);
                                 serde.serialize(aInt64, out);
-                            } else if (argOut.getByteArray()[0] == ATypeTag.SERIALIZED_FLOAT_TYPE_TAG) {
+                            } else if (data[offset] == ATypeTag.SERIALIZED_FLOAT_TYPE_TAG) {
                                 serde = AqlSerializerDeserializerProvider.INSTANCE
                                         .getSerializerDeserializer(BuiltinType.AFLOAT);
-                                float val = AFloatSerializerDeserializer.getFloat(argOut.getByteArray(), 1);
+                                float val = AFloatSerializerDeserializer.getFloat(data, offset + 1);
                                 if (Float.isNaN(val) || Float.isInfinite(val) || val == -0.0F || val == 0.0F) {
                                     aFloat.setValue(val);
                                     serde.serialize(aFloat, out);
@@ -162,10 +169,10 @@
                                             r.setScale(getPrecision(tuple), BigDecimal.ROUND_HALF_EVEN).floatValue());
                                     serde.serialize(aFloat, out);
                                 }
-                            } else if (argOut.getByteArray()[0] == ATypeTag.SERIALIZED_DOUBLE_TYPE_TAG) {
+                            } else if (data[offset] == ATypeTag.SERIALIZED_DOUBLE_TYPE_TAG) {
                                 serde = AqlSerializerDeserializerProvider.INSTANCE
                                         .getSerializerDeserializer(BuiltinType.ADOUBLE);
-                                double val = ADoubleSerializerDeserializer.getDouble(argOut.getByteArray(), 1);
+                                double val = ADoubleSerializerDeserializer.getDouble(data, offset + 1);
                                 if (Double.isNaN(val) || Double.isInfinite(val) || val == -0.0D || val == 0.0D) {
                                     aDouble.setValue(val);
                                     serde.serialize(aDouble, out);
@@ -176,13 +183,15 @@
                                     serde.serialize(aDouble, out);
                                 }
                             } else {
-                                throw new NotImplementedException(AsterixBuiltinFunctions.NUMERIC_ROUND_HALF_TO_EVEN2
-                                        .getName() + ": not implemented for "
-                                        + EnumDeserializer.ATYPETAGDESERIALIZER.deserialize(argOut.getByteArray()[0]));
+                                throw new NotImplementedException(
+                                        AsterixBuiltinFunctions.NUMERIC_ROUND_HALF_TO_EVEN2.getName()
+                                                + ": not implemented for "
+                                                + EnumDeserializer.ATYPETAGDESERIALIZER.deserialize(data[offset]));
                             }
                         } catch (HyracksDataException e) {
                             throw new AlgebricksException(e);
                         }
+                        result.set(resultStorage);
                     }
                 };
             }
diff --git a/asterix-runtime/src/main/java/org/apache/asterix/runtime/evaluators/functions/NumericRoundHalfToEvenDescriptor.java b/asterix-runtime/src/main/java/org/apache/asterix/runtime/evaluators/functions/NumericRoundHalfToEvenDescriptor.java
index edae3fe..0d18b24 100644
--- a/asterix-runtime/src/main/java/org/apache/asterix/runtime/evaluators/functions/NumericRoundHalfToEvenDescriptor.java
+++ b/asterix-runtime/src/main/java/org/apache/asterix/runtime/evaluators/functions/NumericRoundHalfToEvenDescriptor.java
@@ -49,11 +49,13 @@
 import org.apache.hyracks.algebricks.common.exceptions.AlgebricksException;
 import org.apache.hyracks.algebricks.common.exceptions.NotImplementedException;
 import org.apache.hyracks.algebricks.core.algebra.functions.FunctionIdentifier;
-import org.apache.hyracks.algebricks.runtime.base.ICopyEvaluator;
-import org.apache.hyracks.algebricks.runtime.base.ICopyEvaluatorFactory;
+import org.apache.hyracks.algebricks.runtime.base.IScalarEvaluator;
+import org.apache.hyracks.algebricks.runtime.base.IScalarEvaluatorFactory;
+import org.apache.hyracks.api.context.IHyracksTaskContext;
 import org.apache.hyracks.api.dataflow.value.ISerializerDeserializer;
 import org.apache.hyracks.api.exceptions.HyracksDataException;
-import org.apache.hyracks.data.std.api.IDataOutputProvider;
+import org.apache.hyracks.data.std.api.IPointable;
+import org.apache.hyracks.data.std.primitive.VoidPointable;
 import org.apache.hyracks.data.std.util.ArrayBackedValueStorage;
 import org.apache.hyracks.dataflow.common.data.accessors.IFrameTupleReference;
 
@@ -72,18 +74,19 @@
     }
 
     @Override
-    public ICopyEvaluatorFactory createEvaluatorFactory(final ICopyEvaluatorFactory[] args) {
-        return new ICopyEvaluatorFactory() {
+    public IScalarEvaluatorFactory createEvaluatorFactory(final IScalarEvaluatorFactory[] args) {
+        return new IScalarEvaluatorFactory() {
             private static final long serialVersionUID = 1L;
 
             @Override
-            public ICopyEvaluator createEvaluator(final IDataOutputProvider output) throws AlgebricksException {
+            public IScalarEvaluator createScalarEvaluator(final IHyracksTaskContext ctx) throws AlgebricksException {
 
-                return new ICopyEvaluator() {
+                return new IScalarEvaluator() {
 
-                    private DataOutput out = output.getDataOutput();
-                    private ArrayBackedValueStorage argOut = new ArrayBackedValueStorage();
-                    private ICopyEvaluator eval = args[0].createEvaluator(argOut);
+                    private ArrayBackedValueStorage resultStorage = new ArrayBackedValueStorage();
+                    private DataOutput out = resultStorage.getDataOutput();
+                    private IPointable argPtr = new VoidPointable();
+                    private IScalarEvaluator eval = args[0].createScalarEvaluator(ctx);
                     private AMutableDouble aDouble = new AMutableDouble(0);
                     private AMutableFloat aFloat = new AMutableFloat(0);
                     private AMutableInt64 aInt64 = new AMutableInt64(0);
@@ -95,56 +98,62 @@
 
                     @SuppressWarnings("unchecked")
                     @Override
-                    public void evaluate(IFrameTupleReference tuple) throws AlgebricksException {
-                        argOut.reset();
-                        eval.evaluate(tuple);
+                    public void evaluate(IFrameTupleReference tuple, IPointable result) throws AlgebricksException {
+                        resultStorage.reset();
+                        eval.evaluate(tuple, argPtr);
+                        byte[] data = argPtr.getByteArray();
+                        int offset = argPtr.getStartOffset();
+
                         try {
-                            if (argOut.getByteArray()[0] == ATypeTag.SERIALIZED_NULL_TYPE_TAG) {
+                            if (data[offset] == ATypeTag.SERIALIZED_NULL_TYPE_TAG) {
                                 serde = AqlSerializerDeserializerProvider.INSTANCE
                                         .getSerializerDeserializer(BuiltinType.ANULL);
                                 serde.serialize(ANull.NULL, out);
+                                result.set(resultStorage);
                                 return;
-                            } else if (argOut.getByteArray()[0] == ATypeTag.SERIALIZED_INT8_TYPE_TAG) {
+                            } else if (data[offset] == ATypeTag.SERIALIZED_INT8_TYPE_TAG) {
                                 serde = AqlSerializerDeserializerProvider.INSTANCE
                                         .getSerializerDeserializer(BuiltinType.AINT8);
-                                byte val = AInt8SerializerDeserializer.getByte(argOut.getByteArray(), 1);
+                                byte val = AInt8SerializerDeserializer.getByte(data, offset + 1);
                                 aInt8.setValue(val);
                                 serde.serialize(aInt8, out);
-                            } else if (argOut.getByteArray()[0] == ATypeTag.SERIALIZED_INT16_TYPE_TAG) {
+                            } else if (data[offset] == ATypeTag.SERIALIZED_INT16_TYPE_TAG) {
                                 serde = AqlSerializerDeserializerProvider.INSTANCE
                                         .getSerializerDeserializer(BuiltinType.AINT16);
-                                short val = AInt16SerializerDeserializer.getShort(argOut.getByteArray(), 1);
+                                short val = AInt16SerializerDeserializer.getShort(data, offset + 1);
                                 aInt16.setValue(val);
                                 serde.serialize(aInt16, out);
-                            } else if (argOut.getByteArray()[0] == ATypeTag.SERIALIZED_INT32_TYPE_TAG) {
+                            } else if (data[offset] == ATypeTag.SERIALIZED_INT32_TYPE_TAG) {
                                 serde = AqlSerializerDeserializerProvider.INSTANCE
                                         .getSerializerDeserializer(BuiltinType.AINT32);
-                                int val = AInt32SerializerDeserializer.getInt(argOut.getByteArray(), 1);
+                                int val = AInt32SerializerDeserializer.getInt(data, offset + 1);
                                 aInt32.setValue(val);
                                 serde.serialize(aInt32, out);
-                            } else if (argOut.getByteArray()[0] == ATypeTag.SERIALIZED_INT64_TYPE_TAG) {
+                            } else if (data[offset] == ATypeTag.SERIALIZED_INT64_TYPE_TAG) {
                                 serde = AqlSerializerDeserializerProvider.INSTANCE
                                         .getSerializerDeserializer(BuiltinType.AINT64);
-                                long val = AInt64SerializerDeserializer.getLong(argOut.getByteArray(), 1);
+                                long val = AInt64SerializerDeserializer.getLong(data, offset + 1);
                                 aInt64.setValue(val);
                                 serde.serialize(aInt64, out);
-                            } else if (argOut.getByteArray()[0] == ATypeTag.SERIALIZED_FLOAT_TYPE_TAG) {
+                            } else if (data[offset] == ATypeTag.SERIALIZED_FLOAT_TYPE_TAG) {
                                 serde = AqlSerializerDeserializerProvider.INSTANCE
                                         .getSerializerDeserializer(BuiltinType.AFLOAT);
-                                float val = AFloatSerializerDeserializer.getFloat(argOut.getByteArray(), 1);
+                                float val = AFloatSerializerDeserializer.getFloat(data, offset + 1);
                                 aFloat.setValue((float) Math.rint(val));
                                 serde.serialize(aFloat, out);
-                            } else if (argOut.getByteArray()[0] == ATypeTag.SERIALIZED_DOUBLE_TYPE_TAG) {
+                            } else if (data[offset] == ATypeTag.SERIALIZED_DOUBLE_TYPE_TAG) {
                                 serde = AqlSerializerDeserializerProvider.INSTANCE
                                         .getSerializerDeserializer(BuiltinType.ADOUBLE);
-                                double val = ADoubleSerializerDeserializer.getDouble(argOut.getByteArray(), 1);
+                                double val = ADoubleSerializerDeserializer.getDouble(data, offset + 1);
                                 aDouble.setValue(Math.rint(val));
                                 serde.serialize(aDouble, out);
                             } else {
-                                throw new NotImplementedException(AsterixBuiltinFunctions.NUMERIC_ROUND_HALF_TO_EVEN
-                                        .getName() + ": not implemented for "
-                                        + EnumDeserializer.ATYPETAGDESERIALIZER.deserialize(argOut.getByteArray()[0]));
+                                throw new NotImplementedException(
+                                        AsterixBuiltinFunctions.NUMERIC_ROUND_HALF_TO_EVEN.getName()
+                                                + ": not implemented for "
+                                                + EnumDeserializer.ATYPETAGDESERIALIZER.deserialize(data[offset]));
                             }
+                            result.set(resultStorage);
                         } catch (HyracksDataException e) {
                             throw new AlgebricksException(e);
                         }
diff --git a/asterix-runtime/src/main/java/org/apache/asterix/runtime/evaluators/functions/NumericSubtractDescriptor.java b/asterix-runtime/src/main/java/org/apache/asterix/runtime/evaluators/functions/NumericSubtractDescriptor.java
index 5267e19..b850f91 100644
--- a/asterix-runtime/src/main/java/org/apache/asterix/runtime/evaluators/functions/NumericSubtractDescriptor.java
+++ b/asterix-runtime/src/main/java/org/apache/asterix/runtime/evaluators/functions/NumericSubtractDescriptor.java
@@ -44,11 +44,13 @@
 import org.apache.hyracks.algebricks.common.exceptions.AlgebricksException;
 import org.apache.hyracks.algebricks.common.exceptions.NotImplementedException;
 import org.apache.hyracks.algebricks.core.algebra.functions.FunctionIdentifier;
-import org.apache.hyracks.algebricks.runtime.base.ICopyEvaluator;
-import org.apache.hyracks.algebricks.runtime.base.ICopyEvaluatorFactory;
+import org.apache.hyracks.algebricks.runtime.base.IScalarEvaluator;
+import org.apache.hyracks.algebricks.runtime.base.IScalarEvaluatorFactory;
+import org.apache.hyracks.api.context.IHyracksTaskContext;
 import org.apache.hyracks.api.dataflow.value.ISerializerDeserializer;
 import org.apache.hyracks.api.exceptions.HyracksDataException;
-import org.apache.hyracks.data.std.api.IDataOutputProvider;
+import org.apache.hyracks.data.std.api.IPointable;
+import org.apache.hyracks.data.std.primitive.VoidPointable;
 import org.apache.hyracks.data.std.util.ArrayBackedValueStorage;
 import org.apache.hyracks.dataflow.common.data.accessors.IFrameTupleReference;
 
@@ -56,6 +58,7 @@
 
     private static final long serialVersionUID = 1L;
     public static final IFunctionDescriptorFactory FACTORY = new IFunctionDescriptorFactory() {
+        @Override
         public IFunctionDescriptor createFunctionDescriptor() {
             return new NumericSubtractDescriptor();
         }
@@ -67,19 +70,21 @@
     }
 
     @Override
-    public ICopyEvaluatorFactory createEvaluatorFactory(final ICopyEvaluatorFactory[] args) throws AlgebricksException {
-        return new ICopyEvaluatorFactory() {
+    public IScalarEvaluatorFactory createEvaluatorFactory(final IScalarEvaluatorFactory[] args)
+            throws AlgebricksException {
+        return new IScalarEvaluatorFactory() {
             private static final long serialVersionUID = 1L;
 
             @Override
-            public ICopyEvaluator createEvaluator(final IDataOutputProvider output) throws AlgebricksException {
+            public IScalarEvaluator createScalarEvaluator(final IHyracksTaskContext ctx) throws AlgebricksException {
 
-                return new ICopyEvaluator() {
-                    private DataOutput out = output.getDataOutput();
+                return new IScalarEvaluator() {
+                    private ArrayBackedValueStorage resultStorage = new ArrayBackedValueStorage();
+                    private DataOutput out = resultStorage.getDataOutput();
                     // one temp. buffer re-used by both children
-                    private ArrayBackedValueStorage argOut = new ArrayBackedValueStorage();
-                    private ICopyEvaluator evalLeft = args[0].createEvaluator(argOut);
-                    private ICopyEvaluator evalRight = args[1].createEvaluator(argOut);
+                    private IPointable argPtr = new VoidPointable();
+                    private IScalarEvaluator evalLeft = args[0].createScalarEvaluator(ctx);
+                    private IScalarEvaluator evalRight = args[1].createScalarEvaluator(ctx);
                     private double[] operands = new double[args.length];
                     private boolean metInt8 = false, metInt16 = false, metInt32 = false, metInt64 = false,
                             metFloat = false, metDouble = false;
@@ -95,60 +100,60 @@
 
                     @SuppressWarnings("unchecked")
                     @Override
-                    public void evaluate(IFrameTupleReference tuple) throws AlgebricksException {
-
+                    public void evaluate(IFrameTupleReference tuple, IPointable result) throws AlgebricksException {
                         try {
+                            resultStorage.reset();
                             for (int i = 0; i < args.length; i++) {
-                                argOut.reset();
-                                if (i == 0)
-                                    evalLeft.evaluate(tuple);
-                                else
-                                    evalRight.evaluate(tuple);
-                                typeTag = EnumDeserializer.ATYPETAGDESERIALIZER.deserialize(argOut.getByteArray()[0]);
+                                if (i == 0) {
+                                    evalLeft.evaluate(tuple, argPtr);
+                                } else {
+                                    evalRight.evaluate(tuple, argPtr);
+                                }
+                                byte[] data = argPtr.getByteArray();
+                                int offset = argPtr.getStartOffset();
+                                typeTag = EnumDeserializer.ATYPETAGDESERIALIZER.deserialize(data[offset]);
                                 switch (typeTag) {
                                     case INT8: {
                                         metInt8 = true;
-                                        operands[i] = AInt8SerializerDeserializer.getByte(argOut.getByteArray(), 1);
+                                        operands[i] = AInt8SerializerDeserializer.getByte(data, offset + 1);
                                         break;
                                     }
                                     case INT16: {
                                         metInt16 = true;
-                                        operands[i] = AInt16SerializerDeserializer.getShort(argOut.getByteArray(), 1);
+                                        operands[i] = AInt16SerializerDeserializer.getShort(data, offset + 1);
                                         break;
                                     }
                                     case INT32: {
                                         metInt32 = true;
-                                        operands[i] = AInt32SerializerDeserializer.getInt(argOut.getByteArray(), 1);
+                                        operands[i] = AInt32SerializerDeserializer.getInt(data, offset + 1);
                                         break;
                                     }
                                     case INT64: {
                                         metInt64 = true;
-                                        operands[i] = AInt64SerializerDeserializer.getLong(argOut.getByteArray(), 1);
+                                        operands[i] = AInt64SerializerDeserializer.getLong(data, offset + 1);
                                         break;
                                     }
                                     case FLOAT: {
                                         metFloat = true;
-                                        operands[i] = AFloatSerializerDeserializer.getFloat(argOut.getByteArray(), 1);
+                                        operands[i] = AFloatSerializerDeserializer.getFloat(data, offset + 1);
                                         break;
                                     }
                                     case DOUBLE: {
                                         metDouble = true;
-                                        operands[i] = ADoubleSerializerDeserializer.getDouble(argOut.getByteArray(), 1);
+                                        operands[i] = ADoubleSerializerDeserializer.getDouble(data, offset + 1);
                                         break;
                                     }
                                     case NULL: {
                                         serde = AqlSerializerDeserializerProvider.INSTANCE
                                                 .getSerializerDeserializer(BuiltinType.ANULL);
                                         serde.serialize(ANull.NULL, out);
+                                        result.set(resultStorage);
                                         return;
                                     }
                                     default: {
-                                        throw new NotImplementedException(
-                                                AsterixBuiltinFunctions.NUMERIC_SUBTRACT.getName()
-                                                        + (i == 0 ? ": left" : ": right")
-                                                        + " operand can not be "
-                                                        + EnumDeserializer.ATYPETAGDESERIALIZER.deserialize(argOut
-                                                                .getByteArray()[0]));
+                                        throw new NotImplementedException(AsterixBuiltinFunctions.NUMERIC_SUBTRACT
+                                                .getName() + (i == 0 ? ": left" : ": right") + " operand can not be "
+                                                + EnumDeserializer.ATYPETAGDESERIALIZER.deserialize(data[offset]));
                                     }
                                 }
                             }
@@ -184,7 +189,7 @@
                                 aInt8.setValue((byte) (operands[0] - operands[1]));
                                 serde.serialize(aInt8, out);
                             }
-
+                            result.set(resultStorage);
                         } catch (HyracksDataException hde) {
                             throw new AlgebricksException(hde);
                         }
diff --git a/asterix-runtime/src/main/java/org/apache/asterix/runtime/evaluators/functions/NumericUnaryMinusDescriptor.java b/asterix-runtime/src/main/java/org/apache/asterix/runtime/evaluators/functions/NumericUnaryMinusDescriptor.java
index ba60873..50e657d 100644
--- a/asterix-runtime/src/main/java/org/apache/asterix/runtime/evaluators/functions/NumericUnaryMinusDescriptor.java
+++ b/asterix-runtime/src/main/java/org/apache/asterix/runtime/evaluators/functions/NumericUnaryMinusDescriptor.java
@@ -44,11 +44,13 @@
 import org.apache.hyracks.algebricks.common.exceptions.AlgebricksException;
 import org.apache.hyracks.algebricks.common.exceptions.NotImplementedException;
 import org.apache.hyracks.algebricks.core.algebra.functions.FunctionIdentifier;
-import org.apache.hyracks.algebricks.runtime.base.ICopyEvaluator;
-import org.apache.hyracks.algebricks.runtime.base.ICopyEvaluatorFactory;
+import org.apache.hyracks.algebricks.runtime.base.IScalarEvaluator;
+import org.apache.hyracks.algebricks.runtime.base.IScalarEvaluatorFactory;
+import org.apache.hyracks.api.context.IHyracksTaskContext;
 import org.apache.hyracks.api.dataflow.value.ISerializerDeserializer;
 import org.apache.hyracks.api.exceptions.HyracksDataException;
-import org.apache.hyracks.data.std.api.IDataOutputProvider;
+import org.apache.hyracks.data.std.api.IPointable;
+import org.apache.hyracks.data.std.primitive.VoidPointable;
 import org.apache.hyracks.data.std.util.ArrayBackedValueStorage;
 import org.apache.hyracks.dataflow.common.data.accessors.IFrameTupleReference;
 
@@ -63,18 +65,19 @@
     };
 
     @Override
-    public ICopyEvaluatorFactory createEvaluatorFactory(final ICopyEvaluatorFactory[] args) {
-        return new ICopyEvaluatorFactory() {
+    public IScalarEvaluatorFactory createEvaluatorFactory(final IScalarEvaluatorFactory[] args) {
+        return new IScalarEvaluatorFactory() {
             private static final long serialVersionUID = 1L;
 
             @Override
-            public ICopyEvaluator createEvaluator(final IDataOutputProvider output) throws AlgebricksException {
+            public IScalarEvaluator createScalarEvaluator(final IHyracksTaskContext ctx) throws AlgebricksException {
 
-                return new ICopyEvaluator() {
+                return new IScalarEvaluator() {
 
-                    private DataOutput out = output.getDataOutput();
-                    private ArrayBackedValueStorage argOut = new ArrayBackedValueStorage();
-                    private ICopyEvaluator eval = args[0].createEvaluator(argOut);
+                    private ArrayBackedValueStorage resultStorage = new ArrayBackedValueStorage();
+                    private DataOutput out = resultStorage.getDataOutput();
+                    private IPointable argPtr = new VoidPointable();
+                    private IScalarEvaluator eval = args[0].createScalarEvaluator(ctx);
                     private AMutableDouble aDouble = new AMutableDouble(0);
                     private AMutableFloat aFloat = new AMutableFloat(0);
                     private AMutableInt64 aInt64 = new AMutableInt64(0);
@@ -86,54 +89,56 @@
 
                     @SuppressWarnings("unchecked")
                     @Override
-                    public void evaluate(IFrameTupleReference tuple) throws AlgebricksException {
-                        argOut.reset();
-                        eval.evaluate(tuple);
+                    public void evaluate(IFrameTupleReference tuple, IPointable result) throws AlgebricksException {
+                        resultStorage.reset();
+                        eval.evaluate(tuple, argPtr);
+                        byte[] data = argPtr.getByteArray();
+                        int offset = argPtr.getStartOffset();
+
                         try {
-                            if (argOut.getByteArray()[0] == ATypeTag.SERIALIZED_NULL_TYPE_TAG) {
+                            if (data[offset] == ATypeTag.SERIALIZED_NULL_TYPE_TAG) {
                                 serde = AqlSerializerDeserializerProvider.INSTANCE
                                         .getSerializerDeserializer(BuiltinType.ANULL);
                                 serde.serialize(ANull.NULL, out);
-                                return;
-                            } else if (argOut.getByteArray()[0] == ATypeTag.SERIALIZED_INT8_TYPE_TAG) {
+                            } else if (data[offset] == ATypeTag.SERIALIZED_INT8_TYPE_TAG) {
                                 serde = AqlSerializerDeserializerProvider.INSTANCE
                                         .getSerializerDeserializer(BuiltinType.AINT8);
-                                aInt8.setValue((byte) -AInt8SerializerDeserializer.getByte(argOut.getByteArray(), 1));
+                                aInt8.setValue((byte) -AInt8SerializerDeserializer.getByte(data, offset + 1));
                                 serde.serialize(aInt8, out);
-                            } else if (argOut.getByteArray()[0] == ATypeTag.SERIALIZED_INT16_TYPE_TAG) {
+                            } else if (data[offset] == ATypeTag.SERIALIZED_INT16_TYPE_TAG) {
                                 serde = AqlSerializerDeserializerProvider.INSTANCE
                                         .getSerializerDeserializer(BuiltinType.AINT16);
-                                aInt16.setValue(
-                                        (short) -AInt16SerializerDeserializer.getShort(argOut.getByteArray(), 1));
+                                aInt16.setValue((short) -AInt16SerializerDeserializer.getShort(data, offset + 1));
                                 serde.serialize(aInt16, out);
-                            } else if (argOut.getByteArray()[0] == ATypeTag.SERIALIZED_INT32_TYPE_TAG) {
+                            } else if (data[offset] == ATypeTag.SERIALIZED_INT32_TYPE_TAG) {
                                 serde = AqlSerializerDeserializerProvider.INSTANCE
                                         .getSerializerDeserializer(BuiltinType.AINT32);
-                                aInt32.setValue(-AInt32SerializerDeserializer.getInt(argOut.getByteArray(), 1));
+                                aInt32.setValue(-AInt32SerializerDeserializer.getInt(data, offset + 1));
                                 serde.serialize(aInt32, out);
-                            } else if (argOut.getByteArray()[0] == ATypeTag.SERIALIZED_INT64_TYPE_TAG) {
+                            } else if (data[offset] == ATypeTag.SERIALIZED_INT64_TYPE_TAG) {
                                 serde = AqlSerializerDeserializerProvider.INSTANCE
                                         .getSerializerDeserializer(BuiltinType.AINT64);
-                                aInt64.setValue(-AInt64SerializerDeserializer.getLong(argOut.getByteArray(), 1));
+                                aInt64.setValue(-AInt64SerializerDeserializer.getLong(data, offset + 1));
                                 serde.serialize(aInt64, out);
-                            } else if (argOut.getByteArray()[0] == ATypeTag.SERIALIZED_FLOAT_TYPE_TAG) {
+                            } else if (data[offset] == ATypeTag.SERIALIZED_FLOAT_TYPE_TAG) {
                                 serde = AqlSerializerDeserializerProvider.INSTANCE
                                         .getSerializerDeserializer(BuiltinType.AFLOAT);
-                                aFloat.setValue(-AFloatSerializerDeserializer.getFloat(argOut.getByteArray(), 1));
+                                aFloat.setValue(-AFloatSerializerDeserializer.getFloat(data, offset + 1));
                                 serde.serialize(aFloat, out);
-                            } else if (argOut.getByteArray()[0] == ATypeTag.SERIALIZED_DOUBLE_TYPE_TAG) {
+                            } else if (data[offset] == ATypeTag.SERIALIZED_DOUBLE_TYPE_TAG) {
                                 serde = AqlSerializerDeserializerProvider.INSTANCE
                                         .getSerializerDeserializer(BuiltinType.ADOUBLE);
-                                aDouble.setValue(-ADoubleSerializerDeserializer.getDouble(argOut.getByteArray(), 1));
+                                aDouble.setValue(-ADoubleSerializerDeserializer.getDouble(data, offset + 1));
                                 serde.serialize(aDouble, out);
                             } else {
-                                throw new NotImplementedException(AsterixBuiltinFunctions.NUMERIC_UNARY_MINUS.getName()
-                                        + ": not implemented for "
-                                        + EnumDeserializer.ATYPETAGDESERIALIZER.deserialize(argOut.getByteArray()[0]));
+                                throw new NotImplementedException(
+                                        AsterixBuiltinFunctions.NUMERIC_UNARY_MINUS.getName() + ": not implemented for "
+                                                + EnumDeserializer.ATYPETAGDESERIALIZER.deserialize(data[offset]));
                             }
                         } catch (HyracksDataException e) {
                             throw new AlgebricksException(e);
                         }
+                        result.set(resultStorage);
                     }
                 };
             }
diff --git a/asterix-runtime/src/main/java/org/apache/asterix/runtime/evaluators/functions/OrDescriptor.java b/asterix-runtime/src/main/java/org/apache/asterix/runtime/evaluators/functions/OrDescriptor.java
index f6ea1f2..cbf4dcc 100644
--- a/asterix-runtime/src/main/java/org/apache/asterix/runtime/evaluators/functions/OrDescriptor.java
+++ b/asterix-runtime/src/main/java/org/apache/asterix/runtime/evaluators/functions/OrDescriptor.java
@@ -18,6 +18,8 @@
  */
 package org.apache.asterix.runtime.evaluators.functions;
 
+import java.io.DataOutput;
+
 import org.apache.asterix.dataflow.data.nontagged.serde.ABooleanSerializerDeserializer;
 import org.apache.asterix.formats.nontagged.AqlSerializerDeserializerProvider;
 import org.apache.asterix.om.base.ABoolean;
@@ -30,11 +32,13 @@
 import org.apache.asterix.runtime.evaluators.base.AbstractScalarFunctionDynamicDescriptor;
 import org.apache.hyracks.algebricks.common.exceptions.AlgebricksException;
 import org.apache.hyracks.algebricks.core.algebra.functions.FunctionIdentifier;
-import org.apache.hyracks.algebricks.runtime.base.ICopyEvaluator;
-import org.apache.hyracks.algebricks.runtime.base.ICopyEvaluatorFactory;
+import org.apache.hyracks.algebricks.runtime.base.IScalarEvaluator;
+import org.apache.hyracks.algebricks.runtime.base.IScalarEvaluatorFactory;
+import org.apache.hyracks.api.context.IHyracksTaskContext;
 import org.apache.hyracks.api.dataflow.value.ISerializerDeserializer;
 import org.apache.hyracks.api.exceptions.HyracksDataException;
-import org.apache.hyracks.data.std.api.IDataOutputProvider;
+import org.apache.hyracks.data.std.api.IPointable;
+import org.apache.hyracks.data.std.primitive.VoidPointable;
 import org.apache.hyracks.data.std.util.ArrayBackedValueStorage;
 import org.apache.hyracks.dataflow.common.data.accessors.IFrameTupleReference;
 
@@ -53,21 +57,23 @@
     }
 
     @Override
-    public ICopyEvaluatorFactory createEvaluatorFactory(final ICopyEvaluatorFactory[] args) throws AlgebricksException {
+    public IScalarEvaluatorFactory createEvaluatorFactory(final IScalarEvaluatorFactory[] args)
+            throws AlgebricksException {
 
-        return new ICopyEvaluatorFactory() {
+        return new IScalarEvaluatorFactory() {
             private static final long serialVersionUID = 1L;
 
             @Override
-            public ICopyEvaluator createEvaluator(final IDataOutputProvider output) throws AlgebricksException {
-                // one temp. buffer re-used by all children
-                final ArrayBackedValueStorage argOut = new ArrayBackedValueStorage();
-                final ICopyEvaluator[] evals = new ICopyEvaluator[args.length];
+            public IScalarEvaluator createScalarEvaluator(final IHyracksTaskContext ctx) throws AlgebricksException {
+                final IPointable argPtr = new VoidPointable();
+                final IScalarEvaluator[] evals = new IScalarEvaluator[args.length];
                 for (int i = 0; i < evals.length; i++) {
-                    evals[i] = args[i].createEvaluator(argOut);
+                    evals[i] = args[i].createScalarEvaluator(ctx);
                 }
 
-                return new ICopyEvaluator() {
+                return new IScalarEvaluator() {
+                    private ArrayBackedValueStorage resultStorage = new ArrayBackedValueStorage();
+                    private DataOutput output = resultStorage.getDataOutput();
                     @SuppressWarnings("unchecked")
                     private ISerializerDeserializer<ABoolean> booleanSerde = AqlSerializerDeserializerProvider.INSTANCE
                             .getSerializerDeserializer(BuiltinType.ABOOLEAN);
@@ -76,19 +82,21 @@
                             .getSerializerDeserializer(BuiltinType.ANULL);
 
                     @Override
-                    public void evaluate(IFrameTupleReference tuple) throws AlgebricksException {
+                    public void evaluate(IFrameTupleReference tuple, IPointable result) throws AlgebricksException {
                         try {
+                            resultStorage.reset();
                             int n = args.length;
                             boolean res = false;
                             boolean metNull = false;
                             for (int i = 0; i < n; i++) {
-                                argOut.reset();
-                                evals[i].evaluate(tuple);
-                                if (argOut.getByteArray()[0] == ATypeTag.SERIALIZED_NULL_TYPE_TAG) {
+                                evals[i].evaluate(tuple, argPtr);
+                                byte[] data = argPtr.getByteArray();
+                                int offset = argPtr.getStartOffset();
+                                if (data[offset] == ATypeTag.SERIALIZED_NULL_TYPE_TAG) {
                                     metNull = true;
                                     continue;
                                 }
-                                boolean argResult = ABooleanSerializerDeserializer.getBoolean(argOut.getByteArray(), 1);
+                                boolean argResult = ABooleanSerializerDeserializer.getBoolean(data, offset + 1);
                                 if (argResult == true) {
                                     res = true;
                                     break;
@@ -97,13 +105,15 @@
                             if (metNull) {
                                 if (!res) {
                                     ABoolean aResult = ABoolean.FALSE;
-                                    booleanSerde.serialize(aResult, output.getDataOutput());
-                                } else
-                                    nullSerde.serialize(ANull.NULL, output.getDataOutput());
+                                    booleanSerde.serialize(aResult, output);
+                                } else {
+                                    nullSerde.serialize(ANull.NULL, output);
+                                }
                             } else {
                                 ABoolean aResult = res ? (ABoolean.TRUE) : (ABoolean.FALSE);
-                                booleanSerde.serialize(aResult, output.getDataOutput());
+                                booleanSerde.serialize(aResult, output);
                             }
+                            result.set(resultStorage);
                         } catch (HyracksDataException hde) {
                             throw new AlgebricksException(hde);
                         }
diff --git a/asterix-runtime/src/main/java/org/apache/asterix/runtime/evaluators/functions/OrderedListConstructorDescriptor.java b/asterix-runtime/src/main/java/org/apache/asterix/runtime/evaluators/functions/OrderedListConstructorDescriptor.java
index 0674d42..ffb8432 100644
--- a/asterix-runtime/src/main/java/org/apache/asterix/runtime/evaluators/functions/OrderedListConstructorDescriptor.java
+++ b/asterix-runtime/src/main/java/org/apache/asterix/runtime/evaluators/functions/OrderedListConstructorDescriptor.java
@@ -30,9 +30,11 @@
 import org.apache.asterix.runtime.evaluators.base.AbstractScalarFunctionDynamicDescriptor;
 import org.apache.hyracks.algebricks.common.exceptions.AlgebricksException;
 import org.apache.hyracks.algebricks.core.algebra.functions.FunctionIdentifier;
-import org.apache.hyracks.algebricks.runtime.base.ICopyEvaluator;
-import org.apache.hyracks.algebricks.runtime.base.ICopyEvaluatorFactory;
-import org.apache.hyracks.data.std.api.IDataOutputProvider;
+import org.apache.hyracks.algebricks.runtime.base.IScalarEvaluator;
+import org.apache.hyracks.algebricks.runtime.base.IScalarEvaluatorFactory;
+import org.apache.hyracks.api.context.IHyracksTaskContext;
+import org.apache.hyracks.data.std.api.IPointable;
+import org.apache.hyracks.data.std.primitive.VoidPointable;
 import org.apache.hyracks.data.std.util.ArrayBackedValueStorage;
 import org.apache.hyracks.dataflow.common.data.accessors.IFrameTupleReference;
 
@@ -40,6 +42,7 @@
 
     private static final long serialVersionUID = 1L;
     public static final IFunctionDescriptorFactory FACTORY = new IFunctionDescriptorFactory() {
+        @Override
         public IFunctionDescriptor createFunctionDescriptor() {
             return new OrderedListConstructorDescriptor();
         }
@@ -57,20 +60,20 @@
     }
 
     @Override
-    public ICopyEvaluatorFactory createEvaluatorFactory(final ICopyEvaluatorFactory[] args) {
+    public IScalarEvaluatorFactory createEvaluatorFactory(final IScalarEvaluatorFactory[] args) {
         return new OrderedListConstructorEvaluatorFactory(args, oltype);
     }
 
-    private static class OrderedListConstructorEvaluatorFactory implements ICopyEvaluatorFactory {
+    private static class OrderedListConstructorEvaluatorFactory implements IScalarEvaluatorFactory {
 
         private static final long serialVersionUID = 1L;
-        private ICopyEvaluatorFactory[] args;
+        private IScalarEvaluatorFactory[] args;
 
         private boolean selfDescList = false;
 
         private AOrderedListType orderedlistType;
 
-        public OrderedListConstructorEvaluatorFactory(ICopyEvaluatorFactory[] args, AOrderedListType type) {
+        public OrderedListConstructorEvaluatorFactory(IScalarEvaluatorFactory[] args, AOrderedListType type) {
             this.args = args;
 
             this.orderedlistType = type;
@@ -80,21 +83,22 @@
         }
 
         @Override
-        public ICopyEvaluator createEvaluator(IDataOutputProvider output) throws AlgebricksException {
-            final DataOutput out = output.getDataOutput();
-            final ArrayBackedValueStorage inputVal = new ArrayBackedValueStorage();
-            final ICopyEvaluator[] argEvals = new ICopyEvaluator[args.length];
+        public IScalarEvaluator createScalarEvaluator(IHyracksTaskContext ctx) throws AlgebricksException {
+            final IScalarEvaluator[] argEvals = new IScalarEvaluator[args.length];
             for (int i = 0; i < args.length; i++) {
-                argEvals[i] = args[i].createEvaluator(inputVal);
+                argEvals[i] = args[i].createScalarEvaluator(ctx);
             }
 
-            return new ICopyEvaluator() {
-
-                private OrderedListBuilder builder = new OrderedListBuilder();
+            return new IScalarEvaluator() {
+                private final ArrayBackedValueStorage resultStorage = new ArrayBackedValueStorage();
+                private final DataOutput out = resultStorage.getDataOutput();
+                private final IPointable inputVal = new VoidPointable();
+                private final OrderedListBuilder builder = new OrderedListBuilder();
 
                 @Override
-                public void evaluate(IFrameTupleReference tuple) throws AlgebricksException {
+                public void evaluate(IFrameTupleReference tuple, IPointable result) throws AlgebricksException {
                     try {
+                        resultStorage.reset();
                         builder.reset(orderedlistType);
                         if (selfDescList) {
                             this.writeUntypedItems(tuple);
@@ -102,6 +106,7 @@
                             this.writeTypedItems(tuple);
                         }
                         builder.write(out, true);
+                        result.set(resultStorage);
                     } catch (IOException ioe) {
                         throw new AlgebricksException(ioe);
                     }
@@ -111,8 +116,7 @@
 
                     try {
                         for (int i = 0; i < argEvals.length; i++) {
-                            inputVal.reset();
-                            argEvals[i].evaluate(tuple);
+                            argEvals[i].evaluate(tuple, inputVal);
                             builder.addItem(inputVal);
                         }
 
@@ -125,8 +129,7 @@
 
                     try {
                         for (int i = 0; i < argEvals.length; i++) {
-                            inputVal.reset();
-                            argEvals[i].evaluate(tuple);
+                            argEvals[i].evaluate(tuple, inputVal);
                             builder.addItem(inputVal);
                         }
 
diff --git a/asterix-runtime/src/main/java/org/apache/asterix/runtime/evaluators/functions/PrefixLenDescriptor.java b/asterix-runtime/src/main/java/org/apache/asterix/runtime/evaluators/functions/PrefixLenDescriptor.java
index af8ab19..8bfcfae 100644
--- a/asterix-runtime/src/main/java/org/apache/asterix/runtime/evaluators/functions/PrefixLenDescriptor.java
+++ b/asterix-runtime/src/main/java/org/apache/asterix/runtime/evaluators/functions/PrefixLenDescriptor.java
@@ -36,11 +36,13 @@
 import org.apache.asterix.runtime.evaluators.common.SimilarityFiltersCache;
 import org.apache.hyracks.algebricks.common.exceptions.AlgebricksException;
 import org.apache.hyracks.algebricks.core.algebra.functions.FunctionIdentifier;
-import org.apache.hyracks.algebricks.runtime.base.ICopyEvaluator;
-import org.apache.hyracks.algebricks.runtime.base.ICopyEvaluatorFactory;
+import org.apache.hyracks.algebricks.runtime.base.IScalarEvaluator;
+import org.apache.hyracks.algebricks.runtime.base.IScalarEvaluatorFactory;
+import org.apache.hyracks.api.context.IHyracksTaskContext;
 import org.apache.hyracks.api.dataflow.value.ISerializerDeserializer;
-import org.apache.hyracks.data.std.api.IDataOutputProvider;
+import org.apache.hyracks.data.std.api.IPointable;
 import org.apache.hyracks.data.std.primitive.IntegerPointable;
+import org.apache.hyracks.data.std.primitive.VoidPointable;
 import org.apache.hyracks.data.std.util.ArrayBackedValueStorage;
 import org.apache.hyracks.dataflow.common.data.accessors.IFrameTupleReference;
 
@@ -57,21 +59,23 @@
     };
 
     @Override
-    public ICopyEvaluatorFactory createEvaluatorFactory(final ICopyEvaluatorFactory[] args) throws AlgebricksException {
+    public IScalarEvaluatorFactory createEvaluatorFactory(final IScalarEvaluatorFactory[] args)
+            throws AlgebricksException {
 
-        return new ICopyEvaluatorFactory() {
+        return new IScalarEvaluatorFactory() {
             private static final long serialVersionUID = 1L;
 
             @Override
-            public ICopyEvaluator createEvaluator(final IDataOutputProvider output) throws AlgebricksException {
+            public IScalarEvaluator createScalarEvaluator(final IHyracksTaskContext ctx) throws AlgebricksException {
 
-                return new ICopyEvaluator() {
+                return new IScalarEvaluator() {
 
-                    private final DataOutput out = output.getDataOutput();
-                    private final ArrayBackedValueStorage inputVal = new ArrayBackedValueStorage();
-                    private final ICopyEvaluator evalLen = args[0].createEvaluator(inputVal);
-                    private final ICopyEvaluator evalSimilarity = args[1].createEvaluator(inputVal);
-                    private final ICopyEvaluator evalThreshold = args[2].createEvaluator(inputVal);
+                    private final ArrayBackedValueStorage resultStorage = new ArrayBackedValueStorage();
+                    private final DataOutput out = resultStorage.getDataOutput();
+                    private final IPointable inputVal = new VoidPointable();
+                    private final IScalarEvaluator evalLen = args[0].createScalarEvaluator(ctx);
+                    private final IScalarEvaluator evalSimilarity = args[1].createScalarEvaluator(ctx);
+                    private final IScalarEvaluator evalThreshold = args[2].createScalarEvaluator(ctx);
 
                     private final SimilarityFiltersCache similarityFiltersCache = new SimilarityFiltersCache();
 
@@ -82,38 +86,42 @@
                             .getSerializerDeserializer(BuiltinType.AINT32);
 
                     @Override
-                    public void evaluate(IFrameTupleReference tuple) throws AlgebricksException {
+                    public void evaluate(IFrameTupleReference tuple, IPointable result) throws AlgebricksException {
+                        resultStorage.reset();
                         // length
-                        inputVal.reset();
-                        evalLen.evaluate(tuple);
-                        if (inputVal.getByteArray()[0] != ATypeTag.SERIALIZED_INT32_TYPE_TAG) {
-                            throw new AlgebricksException(FID.getName()
-                                    + ": expects type Int32 for the first argument, but got "
-                                    + EnumDeserializer.ATYPETAGDESERIALIZER.deserialize(inputVal.getByteArray()[0]));
+                        evalLen.evaluate(tuple, inputVal);
+                        byte[] data = inputVal.getByteArray();
+                        int offset = inputVal.getStartOffset();
+                        if (data[offset] != ATypeTag.SERIALIZED_INT32_TYPE_TAG) {
+                            throw new AlgebricksException(
+                                    FID.getName() + ": expects type Int32 for the first argument, but got "
+                                            + EnumDeserializer.ATYPETAGDESERIALIZER.deserialize(data[offset]));
                         }
-                        int length = IntegerPointable.getInteger(inputVal.getByteArray(), 1);
+                        int length = IntegerPointable.getInteger(data, offset + 1);
 
                         // similarity threshold
-                        inputVal.reset();
-                        evalThreshold.evaluate(tuple);
-                        if (inputVal.getByteArray()[0] != ATypeTag.SERIALIZED_DOUBLE_TYPE_TAG) {
-                            throw new AlgebricksException(FID.getName()
-                                    + ": expects type DOUBLE for the second argument, but got "
-                                    + EnumDeserializer.ATYPETAGDESERIALIZER.deserialize(inputVal.getByteArray()[0]));
+                        evalThreshold.evaluate(tuple, inputVal);
+                        data = inputVal.getByteArray();
+                        offset = inputVal.getStartOffset();
+                        if (data[offset] != ATypeTag.SERIALIZED_DOUBLE_TYPE_TAG) {
+                            throw new AlgebricksException(
+                                    FID.getName() + ": expects type DOUBLE for the second argument, but got "
+                                            + EnumDeserializer.ATYPETAGDESERIALIZER.deserialize(data[offset]));
                         }
-                        float similarityThreshold = (float) ADoubleSerializerDeserializer
-                                .getDouble(inputVal.getByteArray(), 1);
+                        float similarityThreshold = (float) ADoubleSerializerDeserializer.getDouble(data, offset + 1);
 
                         // similarity name
-                        inputVal.reset();
-                        evalSimilarity.evaluate(tuple);
-                        if (inputVal.getByteArray()[0] != ATypeTag.SERIALIZED_STRING_TYPE_TAG) {
-                            throw new AlgebricksException(FID.getName()
-                                    + ": expects type STRING for the third argument, but got "
-                                    + EnumDeserializer.ATYPETAGDESERIALIZER.deserialize(inputVal.getByteArray()[0]));
+                        evalSimilarity.evaluate(tuple, inputVal);
+                        data = inputVal.getByteArray();
+                        offset = inputVal.getStartOffset();
+                        int len = inputVal.getLength();
+                        if (data[offset] != ATypeTag.SERIALIZED_STRING_TYPE_TAG) {
+                            throw new AlgebricksException(
+                                    FID.getName() + ": expects type STRING for the third argument, but got "
+                                            + EnumDeserializer.ATYPETAGDESERIALIZER.deserialize(data[offset]));
                         }
-                        SimilarityFilters similarityFilters = similarityFiltersCache.get(similarityThreshold,
-                                inputVal.getByteArray());
+                        SimilarityFilters similarityFilters = similarityFiltersCache.get(similarityThreshold, data,
+                                offset, len);
 
                         int prefixLength = similarityFilters.getPrefixLength(length);
                         res.setValue(prefixLength);
@@ -123,6 +131,7 @@
                         } catch (IOException e) {
                             throw new AlgebricksException(e);
                         }
+                        result.set(resultStorage);
                     }
                 };
             }
diff --git a/asterix-runtime/src/main/java/org/apache/asterix/runtime/evaluators/functions/PrefixLenJaccardDescriptor.java b/asterix-runtime/src/main/java/org/apache/asterix/runtime/evaluators/functions/PrefixLenJaccardDescriptor.java
index 8fc715e..9a7017a 100644
--- a/asterix-runtime/src/main/java/org/apache/asterix/runtime/evaluators/functions/PrefixLenJaccardDescriptor.java
+++ b/asterix-runtime/src/main/java/org/apache/asterix/runtime/evaluators/functions/PrefixLenJaccardDescriptor.java
@@ -36,20 +36,19 @@
 import org.apache.asterix.runtime.evaluators.base.AbstractScalarFunctionDynamicDescriptor;
 import org.apache.hyracks.algebricks.common.exceptions.AlgebricksException;
 import org.apache.hyracks.algebricks.core.algebra.functions.FunctionIdentifier;
-import org.apache.hyracks.algebricks.runtime.base.ICopyEvaluator;
-import org.apache.hyracks.algebricks.runtime.base.ICopyEvaluatorFactory;
+import org.apache.hyracks.algebricks.runtime.base.IScalarEvaluator;
+import org.apache.hyracks.algebricks.runtime.base.IScalarEvaluatorFactory;
+import org.apache.hyracks.api.context.IHyracksTaskContext;
 import org.apache.hyracks.api.dataflow.value.ISerializerDeserializer;
 import org.apache.hyracks.api.exceptions.HyracksDataException;
-import org.apache.hyracks.data.std.api.IDataOutputProvider;
+import org.apache.hyracks.data.std.api.IPointable;
+import org.apache.hyracks.data.std.primitive.VoidPointable;
 import org.apache.hyracks.data.std.util.ArrayBackedValueStorage;
 import org.apache.hyracks.dataflow.common.data.accessors.IFrameTupleReference;
 
 public class PrefixLenJaccardDescriptor extends AbstractScalarFunctionDynamicDescriptor {
 
     private static final long serialVersionUID = 1L;
-
-    private final static byte SER_FLOAT_TYPE_TAG = ATypeTag.FLOAT.serialize();
-
     public static final IFunctionDescriptorFactory FACTORY = new IFunctionDescriptorFactory() {
         @Override
         public IFunctionDescriptor createFunctionDescriptor() {
@@ -58,20 +57,22 @@
     };
 
     @Override
-    public ICopyEvaluatorFactory createEvaluatorFactory(final ICopyEvaluatorFactory[] args) throws AlgebricksException {
+    public IScalarEvaluatorFactory createEvaluatorFactory(final IScalarEvaluatorFactory[] args)
+            throws AlgebricksException {
 
-        return new ICopyEvaluatorFactory() {
+        return new IScalarEvaluatorFactory() {
             private static final long serialVersionUID = 1L;
 
             @Override
-            public ICopyEvaluator createEvaluator(final IDataOutputProvider output) throws AlgebricksException {
+            public IScalarEvaluator createScalarEvaluator(final IHyracksTaskContext ctx) throws AlgebricksException {
 
-                return new ICopyEvaluator() {
+                return new IScalarEvaluator() {
 
-                    private final DataOutput out = output.getDataOutput();
-                    private final ArrayBackedValueStorage inputVal = new ArrayBackedValueStorage();
-                    private final ICopyEvaluator evalLen = args[0].createEvaluator(inputVal);
-                    private final ICopyEvaluator evalThreshold = args[1].createEvaluator(inputVal);
+                    private final ArrayBackedValueStorage resultStorage = new ArrayBackedValueStorage();
+                    private final DataOutput out = resultStorage.getDataOutput();
+                    private final IPointable inputVal = new VoidPointable();
+                    private final IScalarEvaluator evalLen = args[0].createScalarEvaluator(ctx);
+                    private final IScalarEvaluator evalThreshold = args[1].createScalarEvaluator(ctx);
 
                     private float similarityThresholdCache;
                     private SimilarityFiltersJaccard similarityFilters;
@@ -83,26 +84,27 @@
                             .getSerializerDeserializer(BuiltinType.AINT32);
 
                     @Override
-                    public void evaluate(IFrameTupleReference tuple) throws AlgebricksException {
+                    public void evaluate(IFrameTupleReference tuple, IPointable result) throws AlgebricksException {
+                        resultStorage.reset();
                         // length
-                        inputVal.reset();
-                        evalLen.evaluate(tuple);
+                        evalLen.evaluate(tuple, inputVal);
                         int length = 0;
                         try {
-                            length = ATypeHierarchy.getIntegerValue(inputVal.getByteArray(), 0);
+                            length = ATypeHierarchy.getIntegerValue(inputVal.getByteArray(), inputVal.getStartOffset());
                         } catch (HyracksDataException e1) {
                             throw new AlgebricksException(e1);
                         }
 
                         // similarity threshold
-                        inputVal.reset();
-                        evalThreshold.evaluate(tuple);
-                        if (inputVal.getByteArray()[0] != SER_FLOAT_TYPE_TAG) {
+                        evalThreshold.evaluate(tuple, inputVal);
+                        byte[] data = inputVal.getByteArray();
+                        int offset = inputVal.getStartOffset();
+                        if (data[offset] != ATypeTag.SERIALIZED_FLOAT_TYPE_TAG) {
                             throw new AlgebricksException(AsterixBuiltinFunctions.PREFIX_LEN_JACCARD.getName()
                                     + ": expects type FLOAT the first argument but got "
-                                    + EnumDeserializer.ATYPETAGDESERIALIZER.deserialize(inputVal.getByteArray()[0]));
+                                    + EnumDeserializer.ATYPETAGDESERIALIZER.deserialize(data[offset]));
                         }
-                        float similarityThreshold = AFloatSerializerDeserializer.getFloat(inputVal.getByteArray(), 1);
+                        float similarityThreshold = AFloatSerializerDeserializer.getFloat(data, offset + 1);
 
                         if (similarityThreshold != similarityThresholdCache || similarityFilters == null) {
                             similarityFilters = new SimilarityFiltersJaccard(similarityThreshold);
@@ -116,6 +118,7 @@
                         } catch (IOException e) {
                             throw new AlgebricksException(e);
                         }
+                        result.set(resultStorage);
                     }
                 };
             }
diff --git a/asterix-runtime/src/main/java/org/apache/asterix/runtime/evaluators/functions/RegExpDescriptor.java b/asterix-runtime/src/main/java/org/apache/asterix/runtime/evaluators/functions/RegExpDescriptor.java
index 82071e3..a0829fd 100644
--- a/asterix-runtime/src/main/java/org/apache/asterix/runtime/evaluators/functions/RegExpDescriptor.java
+++ b/asterix-runtime/src/main/java/org/apache/asterix/runtime/evaluators/functions/RegExpDescriptor.java
@@ -38,13 +38,15 @@
 import org.apache.asterix.runtime.evaluators.base.AbstractScalarFunctionDynamicDescriptor;
 import org.apache.hyracks.algebricks.common.exceptions.AlgebricksException;
 import org.apache.hyracks.algebricks.core.algebra.functions.FunctionIdentifier;
-import org.apache.hyracks.algebricks.runtime.base.ICopyEvaluator;
-import org.apache.hyracks.algebricks.runtime.base.ICopyEvaluatorFactory;
+import org.apache.hyracks.algebricks.runtime.base.IScalarEvaluator;
+import org.apache.hyracks.algebricks.runtime.base.IScalarEvaluatorFactory;
+import org.apache.hyracks.api.context.IHyracksTaskContext;
 import org.apache.hyracks.api.dataflow.value.IBinaryComparator;
 import org.apache.hyracks.api.dataflow.value.ISerializerDeserializer;
 import org.apache.hyracks.api.exceptions.HyracksDataException;
-import org.apache.hyracks.data.std.api.IDataOutputProvider;
+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.data.std.util.ArrayBackedValueStorage;
 import org.apache.hyracks.data.std.util.ByteArrayAccessibleOutputStream;
 import org.apache.hyracks.data.std.util.UTF8CharSequence;
@@ -70,22 +72,23 @@
     }
 
     @Override
-    public ICopyEvaluatorFactory createEvaluatorFactory(final ICopyEvaluatorFactory[] args) throws AlgebricksException {
+    public IScalarEvaluatorFactory createEvaluatorFactory(final IScalarEvaluatorFactory[] args)
+            throws AlgebricksException {
 
-        return new ICopyEvaluatorFactory() {
+        return new IScalarEvaluatorFactory() {
             private static final long serialVersionUID = 1L;
 
             @Override
-            public ICopyEvaluator createEvaluator(IDataOutputProvider output) throws AlgebricksException {
+            public IScalarEvaluator createScalarEvaluator(IHyracksTaskContext ctx) throws AlgebricksException {
 
-                final DataOutput dout = output.getDataOutput();
+                return new IScalarEvaluator() {
 
-                return new ICopyEvaluator() {
-
+                    private ArrayBackedValueStorage resultStorage = new ArrayBackedValueStorage();
+                    private DataOutput dout = resultStorage.getDataOutput();
                     private boolean first = true;
-                    private ArrayBackedValueStorage array0 = new ArrayBackedValueStorage();
-                    private ICopyEvaluator evalString = args[0].createEvaluator(array0);
-                    private ICopyEvaluator evalPattern = args[1].createEvaluator(array0);
+                    private IPointable array0 = new VoidPointable();
+                    private IScalarEvaluator evalString = args[0].createScalarEvaluator(ctx);
+                    private IScalarEvaluator evalPattern = args[1].createScalarEvaluator(ctx);
                     private ByteArrayAccessibleOutputStream lastPattern = new ByteArrayAccessibleOutputStream();
                     private UTF8CharSequence carSeq = new UTF8CharSequence();
                     private UTF8StringPointable utf8Ptr = new UTF8StringPointable();
@@ -104,34 +107,40 @@
                     private Pattern pattern;
 
                     @Override
-                    public void evaluate(IFrameTupleReference tuple) throws AlgebricksException {
+                    public void evaluate(IFrameTupleReference tuple, IPointable result) throws AlgebricksException {
+                        resultStorage.reset();
                         // evaluate the pattern first
                         try {
-                            array0.reset();
-                            evalPattern.evaluate(tuple);
-                            if (array0.getByteArray()[0] == ATypeTag.SERIALIZED_NULL_TYPE_TAG) {
+                            evalPattern.evaluate(tuple, array0);
+                            byte[] patternBytes = array0.getByteArray();
+                            int patternOffset = array0.getStartOffset();
+                            int patternLen = array0.getLength();
+
+                            if (patternBytes[patternOffset] == ATypeTag.SERIALIZED_NULL_TYPE_TAG) {
                                 nullSerde.serialize(ANull.NULL, dout);
+                                result.set(resultStorage);
                                 return;
                             }
-                            if (array0.getByteArray()[0] != ATypeTag.SERIALIZED_STRING_TYPE_TAG) {
+                            if (patternBytes[patternOffset] != ATypeTag.SERIALIZED_STRING_TYPE_TAG) {
                                 throw new AlgebricksException(AsterixBuiltinFunctions.REG_EXP.getName()
                                         + ": expects type STRING/NULL for the first input argument but got "
-                                        + EnumDeserializer.ATYPETAGDESERIALIZER.deserialize(array0.getByteArray()[0]));
+                                        + EnumDeserializer.ATYPETAGDESERIALIZER
+                                                .deserialize(patternBytes[patternOffset]));
                             }
                             boolean newPattern = false;
                             if (first) {
                                 first = false;
                                 newPattern = true;
                             } else {
-                                int c = strComp.compare(array0.getByteArray(), array0.getStartOffset(),
-                                        array0.getLength(), lastPattern.getByteArray(), 0, lastPattern.size());
+                                int c = strComp.compare(patternBytes, patternOffset, patternLen,
+                                        lastPattern.getByteArray(), 0, lastPattern.size());
                                 if (c != 0) {
                                     newPattern = true;
                                 }
                             }
                             if (newPattern) {
                                 lastPattern.reset();
-                                lastPattern.write(array0.getByteArray(), array0.getStartOffset(), array0.getLength());
+                                lastPattern.write(patternBytes, patternOffset, patternLen);
                                 // ! object creation !
                                 DataInputStream di = new DataInputStream(
                                         new ByteArrayInputStream(lastPattern.getByteArray()));
@@ -139,18 +148,21 @@
                                 pattern = Pattern.compile(strPattern.getStringValue());
 
                             }
-                            array0.reset();
-                            evalString.evaluate(tuple);
-                            if (array0.getByteArray()[0] == ATypeTag.SERIALIZED_NULL_TYPE_TAG) {
+                            evalString.evaluate(tuple, array0);
+                            byte[] data = array0.getByteArray();
+                            int offset = array0.getStartOffset();
+                            int len = array0.getLength();
+                            if (data[offset] == ATypeTag.SERIALIZED_NULL_TYPE_TAG) {
                                 nullSerde.serialize(ANull.NULL, dout);
+                                result.set(resultStorage);
                                 return;
                             }
-                            if (array0.getByteArray()[0] != ATypeTag.SERIALIZED_STRING_TYPE_TAG) {
+                            if (data[offset] != ATypeTag.SERIALIZED_STRING_TYPE_TAG) {
                                 throw new AlgebricksException(AsterixBuiltinFunctions.REG_EXP.getName()
                                         + ": expects type STRING/NULL for the second input argument but got "
-                                        + EnumDeserializer.ATYPETAGDESERIALIZER.deserialize(array0.getByteArray()[0]));
+                                        + EnumDeserializer.ATYPETAGDESERIALIZER.deserialize(data[offset]));
                             }
-                            utf8Ptr.set(array0.getByteArray(), 1, array0.getLength() - 1);
+                            utf8Ptr.set(data, offset + 1, len - 1);
                             carSeq.reset(utf8Ptr);
                             if (newPattern) {
                                 matcher = pattern.matcher(carSeq);
@@ -159,6 +171,7 @@
                             }
                             ABoolean res = (matcher.find(0)) ? ABoolean.TRUE : ABoolean.FALSE;
                             booleanSerde.serialize(res, dout);
+                            result.set(resultStorage);
                         } catch (HyracksDataException e) {
                             throw new AlgebricksException(e);
                         }
diff --git a/asterix-runtime/src/main/java/org/apache/asterix/runtime/evaluators/functions/SimilarityDescriptor.java b/asterix-runtime/src/main/java/org/apache/asterix/runtime/evaluators/functions/SimilarityDescriptor.java
index e66fceb..d1d0a3c 100644
--- a/asterix-runtime/src/main/java/org/apache/asterix/runtime/evaluators/functions/SimilarityDescriptor.java
+++ b/asterix-runtime/src/main/java/org/apache/asterix/runtime/evaluators/functions/SimilarityDescriptor.java
@@ -42,11 +42,13 @@
 import org.apache.asterix.runtime.evaluators.common.SimilarityFiltersCache;
 import org.apache.hyracks.algebricks.common.exceptions.AlgebricksException;
 import org.apache.hyracks.algebricks.core.algebra.functions.FunctionIdentifier;
-import org.apache.hyracks.algebricks.runtime.base.ICopyEvaluator;
-import org.apache.hyracks.algebricks.runtime.base.ICopyEvaluatorFactory;
+import org.apache.hyracks.algebricks.runtime.base.IScalarEvaluator;
+import org.apache.hyracks.algebricks.runtime.base.IScalarEvaluatorFactory;
+import org.apache.hyracks.api.context.IHyracksTaskContext;
 import org.apache.hyracks.api.dataflow.value.ISerializerDeserializer;
-import org.apache.hyracks.data.std.api.IDataOutputProvider;
+import org.apache.hyracks.data.std.api.IPointable;
 import org.apache.hyracks.data.std.primitive.IntegerPointable;
+import org.apache.hyracks.data.std.primitive.VoidPointable;
 import org.apache.hyracks.data.std.util.ArrayBackedValueStorage;
 import org.apache.hyracks.dataflow.common.data.accessors.IFrameTupleReference;
 
@@ -63,25 +65,27 @@
     };
 
     @Override
-    public ICopyEvaluatorFactory createEvaluatorFactory(final ICopyEvaluatorFactory[] args) throws AlgebricksException {
+    public IScalarEvaluatorFactory createEvaluatorFactory(final IScalarEvaluatorFactory[] args)
+            throws AlgebricksException {
 
-        return new ICopyEvaluatorFactory() {
+        return new IScalarEvaluatorFactory() {
             private static final long serialVersionUID = 1L;
 
             @Override
-            public ICopyEvaluator createEvaluator(final IDataOutputProvider output) throws AlgebricksException {
+            public IScalarEvaluator createScalarEvaluator(final IHyracksTaskContext ctx) throws AlgebricksException {
 
-                return new ICopyEvaluator() {
+                return new IScalarEvaluator() {
 
-                    private final DataOutput out = output.getDataOutput();
-                    private final ArrayBackedValueStorage inputVal = new ArrayBackedValueStorage();
-                    private final ICopyEvaluator evalLen1 = args[0].createEvaluator(inputVal);
-                    private final ICopyEvaluator evalTokens1 = args[1].createEvaluator(inputVal);
-                    private final ICopyEvaluator evalLen2 = args[2].createEvaluator(inputVal);
-                    private final ICopyEvaluator evalTokens2 = args[3].createEvaluator(inputVal);
-                    private final ICopyEvaluator evalTokenPrefix = args[4].createEvaluator(inputVal);
-                    private final ICopyEvaluator evalSimilarity = args[5].createEvaluator(inputVal);
-                    private final ICopyEvaluator evalThreshold = args[6].createEvaluator(inputVal);
+                    private final ArrayBackedValueStorage resultStorage = new ArrayBackedValueStorage();
+                    private final DataOutput out = resultStorage.getDataOutput();
+                    private final IPointable inputVal = new VoidPointable();
+                    private final IScalarEvaluator evalLen1 = args[0].createScalarEvaluator(ctx);
+                    private final IScalarEvaluator evalTokens1 = args[1].createScalarEvaluator(ctx);
+                    private final IScalarEvaluator evalLen2 = args[2].createScalarEvaluator(ctx);
+                    private final IScalarEvaluator evalTokens2 = args[3].createScalarEvaluator(ctx);
+                    private final IScalarEvaluator evalTokenPrefix = args[4].createScalarEvaluator(ctx);
+                    private final IScalarEvaluator evalSimilarity = args[5].createScalarEvaluator(ctx);
+                    private final IScalarEvaluator evalThreshold = args[6].createScalarEvaluator(ctx);
 
                     private final SimilarityFiltersCache similarityFiltersCache = new SimilarityFiltersCache();
 
@@ -96,46 +100,52 @@
                             .getSerializerDeserializer(BuiltinType.ADOUBLE);
 
                     @Override
-                    public void evaluate(IFrameTupleReference tuple) throws AlgebricksException {
+                    public void evaluate(IFrameTupleReference tuple, IPointable result) throws AlgebricksException {
+                        resultStorage.reset();
                         // similarity threshold
-                        inputVal.reset();
-                        evalThreshold.evaluate(tuple);
-                        if (inputVal.getByteArray()[0] != ATypeTag.SERIALIZED_DOUBLE_TYPE_TAG) {
-                            throw new AlgebricksException(FID.getName()
-                                    + ": expects type DOUBLE for the first argument but got "
-                                    + EnumDeserializer.ATYPETAGDESERIALIZER.deserialize(inputVal.getByteArray()[0]));
+                        evalThreshold.evaluate(tuple, inputVal);
+                        byte[] data = inputVal.getByteArray();
+                        int offset = inputVal.getStartOffset();
+
+                        if (data[offset] != ATypeTag.SERIALIZED_DOUBLE_TYPE_TAG) {
+                            throw new AlgebricksException(
+                                    FID.getName() + ": expects type DOUBLE for the first argument but got "
+                                            + EnumDeserializer.ATYPETAGDESERIALIZER.deserialize(data[offset]));
                         }
-                        float similarityThreshold = (float) ADoubleSerializerDeserializer
-                                .getDouble(inputVal.getByteArray(), 1);
+                        float similarityThreshold = (float) ADoubleSerializerDeserializer.getDouble(data, offset + 1);
 
                         // similarity name
-                        inputVal.reset();
-                        evalSimilarity.evaluate(tuple);
-                        if (inputVal.getByteArray()[0] != ATypeTag.SERIALIZED_STRING_TYPE_TAG) {
-                            throw new AlgebricksException(FID.getName()
-                                    + ": expects type STRING for the second argument but got "
-                                    + EnumDeserializer.ATYPETAGDESERIALIZER.deserialize(inputVal.getByteArray()[0]));
+                        evalSimilarity.evaluate(tuple, inputVal);
+                        data = inputVal.getByteArray();
+                        offset = inputVal.getStartOffset();
+                        int len = inputVal.getLength();
+                        if (data[offset] != ATypeTag.SERIALIZED_STRING_TYPE_TAG) {
+                            throw new AlgebricksException(
+                                    FID.getName() + ": expects type STRING for the second argument but got "
+                                            + EnumDeserializer.ATYPETAGDESERIALIZER.deserialize(data[offset]));
                         }
-                        SimilarityFilters similarityFilters = similarityFiltersCache.get(similarityThreshold,
-                                inputVal.getByteArray());
+                        SimilarityFilters similarityFilters = similarityFiltersCache.get(similarityThreshold, data,
+                                offset, len);
 
-                        inputVal.reset();
-                        evalLen1.evaluate(tuple);
-                        if (inputVal.getByteArray()[0] != ATypeTag.SERIALIZED_INT32_TYPE_TAG) {
-                            throw new AlgebricksException(FID.getName()
-                                    + ": expects type INT32 for the thrid argument but got "
-                                    + EnumDeserializer.ATYPETAGDESERIALIZER.deserialize(inputVal.getByteArray()[0]));
+                        evalLen1.evaluate(tuple, inputVal);
+                        data = inputVal.getByteArray();
+                        offset = inputVal.getStartOffset();
+                        if (data[offset] != ATypeTag.SERIALIZED_INT32_TYPE_TAG) {
+                            throw new AlgebricksException(
+                                    FID.getName() + ": expects type INT32 for the thrid argument but got "
+                                            + EnumDeserializer.ATYPETAGDESERIALIZER.deserialize(data[offset]));
                         }
-                        int length1 = IntegerPointable.getInteger(inputVal.getByteArray(), 1);
+                        int length1 = IntegerPointable.getInteger(data, offset + 1);
 
-                        inputVal.reset();
-                        evalLen2.evaluate(tuple);
-                        if (inputVal.getByteArray()[0] != ATypeTag.SERIALIZED_INT32_TYPE_TAG) {
-                            throw new AlgebricksException(FID.getName()
-                                    + ": expects type INT32 for the fourth argument but got "
-                                    + EnumDeserializer.ATYPETAGDESERIALIZER.deserialize(inputVal.getByteArray()[0]));
+                        evalLen2.evaluate(tuple, inputVal);
+                        data = inputVal.getByteArray();
+                        offset = inputVal.getStartOffset();
+                        if (data[offset] != ATypeTag.SERIALIZED_INT32_TYPE_TAG) {
+                            throw new AlgebricksException(
+                                    FID.getName() + ": expects type INT32 for the fourth argument but got "
+                                            + EnumDeserializer.ATYPETAGDESERIALIZER.deserialize(data[offset]));
                         }
-                        int length2 = IntegerPointable.getInteger(inputVal.getByteArray(), 1);
+                        int length2 = IntegerPointable.getInteger(data, offset + 1);
 
                         float sim = 0;
 
@@ -147,38 +157,38 @@
                             // -- - tokens1 - --
                             int i;
                             tokens1.reset();
-                            inputVal.reset();
-                            evalTokens1.evaluate(tuple);
-
+                            evalTokens1.evaluate(tuple, inputVal);
                             byte[] serList = inputVal.getByteArray();
-                            if (serList[0] != ATypeTag.SERIALIZED_ORDEREDLIST_TYPE_TAG
-                                    && serList[0] != ATypeTag.SERIALIZED_UNORDEREDLIST_TYPE_TAG) {
+                            offset = inputVal.getStartOffset();
+
+                            if (serList[offset] != ATypeTag.SERIALIZED_ORDEREDLIST_TYPE_TAG
+                                    && serList[offset] != ATypeTag.SERIALIZED_UNORDEREDLIST_TYPE_TAG) {
                                 throw new AlgebricksException(FID.getName() + ": not defined for values of type"
-                                        + EnumDeserializer.ATYPETAGDESERIALIZER.deserialize(serList[0]));
+                                        + EnumDeserializer.ATYPETAGDESERIALIZER.deserialize(serList[offset]));
                             }
 
                             int lengthTokens1;
-                            if (serList[0] == ATypeTag.SERIALIZED_ORDEREDLIST_TYPE_TAG) {
-                                lengthTokens1 = AOrderedListSerializerDeserializer
-                                        .getNumberOfItems(inputVal.getByteArray());
+                            if (serList[offset] == ATypeTag.SERIALIZED_ORDEREDLIST_TYPE_TAG) {
+                                lengthTokens1 = AOrderedListSerializerDeserializer.getNumberOfItems(serList, offset);
                                 // read tokens
                                 for (i = 0; i < lengthTokens1; i++) {
                                     int itemOffset;
                                     try {
-                                        itemOffset = AOrderedListSerializerDeserializer.getItemOffset(serList, i);
+                                        itemOffset = AOrderedListSerializerDeserializer.getItemOffset(serList, offset,
+                                                i);
                                     } catch (AsterixException e) {
                                         throw new AlgebricksException(e);
                                     }
                                     tokens1.add(IntegerPointable.getInteger(serList, itemOffset));
                                 }
                             } else {
-                                lengthTokens1 = AUnorderedListSerializerDeserializer
-                                        .getNumberOfItems(inputVal.getByteArray());
+                                lengthTokens1 = AUnorderedListSerializerDeserializer.getNumberOfItems(serList, offset);
                                 // read tokens
                                 for (i = 0; i < lengthTokens1; i++) {
                                     int itemOffset;
                                     try {
-                                        itemOffset = AUnorderedListSerializerDeserializer.getItemOffset(serList, i);
+                                        itemOffset = AUnorderedListSerializerDeserializer.getItemOffset(serList, offset,
+                                                i);
                                     } catch (AsterixException e) {
                                         throw new AlgebricksException(e);
                                     }
@@ -192,38 +202,38 @@
 
                             // -- - tokens2 - --
                             tokens2.reset();
-                            inputVal.reset();
-                            evalTokens2.evaluate(tuple);
-
+                            evalTokens2.evaluate(tuple, inputVal);
                             serList = inputVal.getByteArray();
-                            if (serList[0] != ATypeTag.SERIALIZED_ORDEREDLIST_TYPE_TAG
-                                    && serList[0] != ATypeTag.SERIALIZED_UNORDEREDLIST_TYPE_TAG) {
+                            offset = inputVal.getStartOffset();
+
+                            if (serList[offset] != ATypeTag.SERIALIZED_ORDEREDLIST_TYPE_TAG
+                                    && serList[offset] != ATypeTag.SERIALIZED_UNORDEREDLIST_TYPE_TAG) {
                                 throw new AlgebricksException(FID.getName() + ": not defined for values of type"
-                                        + EnumDeserializer.ATYPETAGDESERIALIZER.deserialize(serList[0]));
+                                        + EnumDeserializer.ATYPETAGDESERIALIZER.deserialize(serList[offset]));
                             }
 
                             int lengthTokens2;
                             if (serList[0] == ATypeTag.SERIALIZED_ORDEREDLIST_TYPE_TAG) {
-                                lengthTokens2 = AOrderedListSerializerDeserializer
-                                        .getNumberOfItems(inputVal.getByteArray());
+                                lengthTokens2 = AOrderedListSerializerDeserializer.getNumberOfItems(serList, offset);
                                 // read tokens
                                 for (i = 0; i < lengthTokens2; i++) {
                                     int itemOffset;
                                     try {
-                                        itemOffset = AOrderedListSerializerDeserializer.getItemOffset(serList, i);
+                                        itemOffset = AOrderedListSerializerDeserializer.getItemOffset(serList, offset,
+                                                i);
                                     } catch (AsterixException e) {
                                         throw new AlgebricksException(e);
                                     }
                                     tokens2.add(IntegerPointable.getInteger(serList, itemOffset));
                                 }
                             } else {
-                                lengthTokens2 = AUnorderedListSerializerDeserializer
-                                        .getNumberOfItems(inputVal.getByteArray());
+                                lengthTokens2 = AUnorderedListSerializerDeserializer.getNumberOfItems(serList, offset);
                                 // read tokens
                                 for (i = 0; i < lengthTokens2; i++) {
                                     int itemOffset;
                                     try {
-                                        itemOffset = AUnorderedListSerializerDeserializer.getItemOffset(serList, i);
+                                        itemOffset = AUnorderedListSerializerDeserializer.getItemOffset(serList, offset,
+                                                i);
                                     } catch (AsterixException e) {
                                         throw new AlgebricksException(e);
                                     }
@@ -236,9 +246,9 @@
                             }
 
                             // -- - token prefix - --
-                            inputVal.reset();
-                            evalTokenPrefix.evaluate(tuple);
-                            int tokenPrefix = IntegerPointable.getInteger(inputVal.getByteArray(), 1);
+                            evalTokenPrefix.evaluate(tuple, inputVal);
+                            int tokenPrefix = IntegerPointable.getInteger(inputVal.getByteArray(),
+                                    inputVal.getStartOffset() + 1);
 
                             //
                             // -- - position filter - --
@@ -268,6 +278,7 @@
                         } catch (IOException e) {
                             throw new AlgebricksException(e);
                         }
+                        result.set(resultStorage);
                     }
                 };
             }
diff --git a/asterix-runtime/src/main/java/org/apache/asterix/runtime/evaluators/functions/SimilarityJaccardCheckDescriptor.java b/asterix-runtime/src/main/java/org/apache/asterix/runtime/evaluators/functions/SimilarityJaccardCheckDescriptor.java
index bc29156..29a6f6f 100644
--- a/asterix-runtime/src/main/java/org/apache/asterix/runtime/evaluators/functions/SimilarityJaccardCheckDescriptor.java
+++ b/asterix-runtime/src/main/java/org/apache/asterix/runtime/evaluators/functions/SimilarityJaccardCheckDescriptor.java
@@ -25,27 +25,29 @@
 import org.apache.asterix.runtime.evaluators.common.SimilarityJaccardCheckEvaluator;
 import org.apache.hyracks.algebricks.common.exceptions.AlgebricksException;
 import org.apache.hyracks.algebricks.core.algebra.functions.FunctionIdentifier;
-import org.apache.hyracks.algebricks.runtime.base.ICopyEvaluator;
-import org.apache.hyracks.algebricks.runtime.base.ICopyEvaluatorFactory;
-import org.apache.hyracks.data.std.api.IDataOutputProvider;
+import org.apache.hyracks.algebricks.runtime.base.IScalarEvaluator;
+import org.apache.hyracks.algebricks.runtime.base.IScalarEvaluatorFactory;
+import org.apache.hyracks.api.context.IHyracksTaskContext;
 
 public class SimilarityJaccardCheckDescriptor extends AbstractScalarFunctionDynamicDescriptor {
 
     private static final long serialVersionUID = 1L;
     public static final IFunctionDescriptorFactory FACTORY = new IFunctionDescriptorFactory() {
+        @Override
         public IFunctionDescriptor createFunctionDescriptor() {
             return new SimilarityJaccardCheckDescriptor();
         }
     };
 
     @Override
-    public ICopyEvaluatorFactory createEvaluatorFactory(final ICopyEvaluatorFactory[] args) throws AlgebricksException {
-        return new ICopyEvaluatorFactory() {
+    public IScalarEvaluatorFactory createEvaluatorFactory(final IScalarEvaluatorFactory[] args)
+            throws AlgebricksException {
+        return new IScalarEvaluatorFactory() {
             private static final long serialVersionUID = 1L;
 
             @Override
-            public ICopyEvaluator createEvaluator(IDataOutputProvider output) throws AlgebricksException {
-                return new SimilarityJaccardCheckEvaluator(args, output);
+            public IScalarEvaluator createScalarEvaluator(IHyracksTaskContext ctx) throws AlgebricksException {
+                return new SimilarityJaccardCheckEvaluator(args, ctx);
             }
         };
     }
diff --git a/asterix-runtime/src/main/java/org/apache/asterix/runtime/evaluators/functions/SimilarityJaccardDescriptor.java b/asterix-runtime/src/main/java/org/apache/asterix/runtime/evaluators/functions/SimilarityJaccardDescriptor.java
index c2287c2..6c3847a 100644
--- a/asterix-runtime/src/main/java/org/apache/asterix/runtime/evaluators/functions/SimilarityJaccardDescriptor.java
+++ b/asterix-runtime/src/main/java/org/apache/asterix/runtime/evaluators/functions/SimilarityJaccardDescriptor.java
@@ -25,27 +25,29 @@
 import org.apache.asterix.runtime.evaluators.common.SimilarityJaccardEvaluator;
 import org.apache.hyracks.algebricks.common.exceptions.AlgebricksException;
 import org.apache.hyracks.algebricks.core.algebra.functions.FunctionIdentifier;
-import org.apache.hyracks.algebricks.runtime.base.ICopyEvaluator;
-import org.apache.hyracks.algebricks.runtime.base.ICopyEvaluatorFactory;
-import org.apache.hyracks.data.std.api.IDataOutputProvider;
+import org.apache.hyracks.algebricks.runtime.base.IScalarEvaluator;
+import org.apache.hyracks.algebricks.runtime.base.IScalarEvaluatorFactory;
+import org.apache.hyracks.api.context.IHyracksTaskContext;
 
 public class SimilarityJaccardDescriptor extends AbstractScalarFunctionDynamicDescriptor {
 
     private static final long serialVersionUID = 1L;
     public static final IFunctionDescriptorFactory FACTORY = new IFunctionDescriptorFactory() {
+        @Override
         public IFunctionDescriptor createFunctionDescriptor() {
             return new SimilarityJaccardDescriptor();
         }
     };
 
     @Override
-    public ICopyEvaluatorFactory createEvaluatorFactory(final ICopyEvaluatorFactory[] args) throws AlgebricksException {
-        return new ICopyEvaluatorFactory() {
+    public IScalarEvaluatorFactory createEvaluatorFactory(final IScalarEvaluatorFactory[] args)
+            throws AlgebricksException {
+        return new IScalarEvaluatorFactory() {
             private static final long serialVersionUID = 1L;
 
             @Override
-            public ICopyEvaluator createEvaluator(IDataOutputProvider output) throws AlgebricksException {
-                return new SimilarityJaccardEvaluator(args, output);
+            public IScalarEvaluator createScalarEvaluator(IHyracksTaskContext ctx) throws AlgebricksException {
+                return new SimilarityJaccardEvaluator(args, ctx);
             }
         };
     }
diff --git a/asterix-runtime/src/main/java/org/apache/asterix/runtime/evaluators/functions/SimilarityJaccardPrefixCheckDescriptor.java b/asterix-runtime/src/main/java/org/apache/asterix/runtime/evaluators/functions/SimilarityJaccardPrefixCheckDescriptor.java
index 14619c8..e28a784 100644
--- a/asterix-runtime/src/main/java/org/apache/asterix/runtime/evaluators/functions/SimilarityJaccardPrefixCheckDescriptor.java
+++ b/asterix-runtime/src/main/java/org/apache/asterix/runtime/evaluators/functions/SimilarityJaccardPrefixCheckDescriptor.java
@@ -34,10 +34,10 @@
 import org.apache.asterix.runtime.evaluators.common.SimilarityJaccardPrefixEvaluator;
 import org.apache.hyracks.algebricks.common.exceptions.AlgebricksException;
 import org.apache.hyracks.algebricks.core.algebra.functions.FunctionIdentifier;
-import org.apache.hyracks.algebricks.runtime.base.ICopyEvaluator;
-import org.apache.hyracks.algebricks.runtime.base.ICopyEvaluatorFactory;
+import org.apache.hyracks.algebricks.runtime.base.IScalarEvaluator;
+import org.apache.hyracks.algebricks.runtime.base.IScalarEvaluatorFactory;
+import org.apache.hyracks.api.context.IHyracksTaskContext;
 import org.apache.hyracks.api.dataflow.value.ISerializerDeserializer;
-import org.apache.hyracks.data.std.api.IDataOutputProvider;
 import org.apache.hyracks.data.std.util.ArrayBackedValueStorage;
 
 public class SimilarityJaccardPrefixCheckDescriptor extends AbstractScalarFunctionDynamicDescriptor {
@@ -45,19 +45,21 @@
     private static final long serialVersionUID = 1L;
 
     public static final IFunctionDescriptorFactory FACTORY = new IFunctionDescriptorFactory() {
+        @Override
         public IFunctionDescriptor createFunctionDescriptor() {
             return new SimilarityJaccardPrefixCheckDescriptor();
         }
     };
 
     @Override
-    public ICopyEvaluatorFactory createEvaluatorFactory(final ICopyEvaluatorFactory[] args) throws AlgebricksException {
-        return new ICopyEvaluatorFactory() {
+    public IScalarEvaluatorFactory createEvaluatorFactory(final IScalarEvaluatorFactory[] args)
+            throws AlgebricksException {
+        return new IScalarEvaluatorFactory() {
             private static final long serialVersionUID = 1L;
 
             @Override
-            public ICopyEvaluator createEvaluator(final IDataOutputProvider output) throws AlgebricksException {
-                return new SimilarityJaccardPrefixCheckEvaluator(args, output);
+            public IScalarEvaluator createScalarEvaluator(final IHyracksTaskContext ctx) throws AlgebricksException {
+                return new SimilarityJaccardPrefixCheckEvaluator(args, ctx);
             }
         };
     }
@@ -81,9 +83,9 @@
 
         private final AOrderedListType listType = new AOrderedListType(BuiltinType.ANY, "list");
 
-        public SimilarityJaccardPrefixCheckEvaluator(ICopyEvaluatorFactory[] args, IDataOutputProvider output)
+        public SimilarityJaccardPrefixCheckEvaluator(IScalarEvaluatorFactory[] args, IHyracksTaskContext context)
                 throws AlgebricksException {
-            super(args, output);
+            super(args, context);
             listBuilder = new OrderedListBuilder();
             inputVal = new ArrayBackedValueStorage();
         }
@@ -104,7 +106,6 @@
             listBuilder.addItem(inputVal);
 
             listBuilder.write(out, true);
-
         }
     }
 
diff --git a/asterix-runtime/src/main/java/org/apache/asterix/runtime/evaluators/functions/SimilarityJaccardPrefixDescriptor.java b/asterix-runtime/src/main/java/org/apache/asterix/runtime/evaluators/functions/SimilarityJaccardPrefixDescriptor.java
index 826f621..144a328 100644
--- a/asterix-runtime/src/main/java/org/apache/asterix/runtime/evaluators/functions/SimilarityJaccardPrefixDescriptor.java
+++ b/asterix-runtime/src/main/java/org/apache/asterix/runtime/evaluators/functions/SimilarityJaccardPrefixDescriptor.java
@@ -25,27 +25,29 @@
 import org.apache.asterix.runtime.evaluators.common.SimilarityJaccardPrefixEvaluator;
 import org.apache.hyracks.algebricks.common.exceptions.AlgebricksException;
 import org.apache.hyracks.algebricks.core.algebra.functions.FunctionIdentifier;
-import org.apache.hyracks.algebricks.runtime.base.ICopyEvaluator;
-import org.apache.hyracks.algebricks.runtime.base.ICopyEvaluatorFactory;
-import org.apache.hyracks.data.std.api.IDataOutputProvider;
+import org.apache.hyracks.algebricks.runtime.base.IScalarEvaluator;
+import org.apache.hyracks.algebricks.runtime.base.IScalarEvaluatorFactory;
+import org.apache.hyracks.api.context.IHyracksTaskContext;
 
 public class SimilarityJaccardPrefixDescriptor extends AbstractScalarFunctionDynamicDescriptor {
 
     private static final long serialVersionUID = 1L;
     public static final IFunctionDescriptorFactory FACTORY = new IFunctionDescriptorFactory() {
+        @Override
         public IFunctionDescriptor createFunctionDescriptor() {
             return new SimilarityJaccardPrefixDescriptor();
         }
     };
 
     @Override
-    public ICopyEvaluatorFactory createEvaluatorFactory(final ICopyEvaluatorFactory[] args) throws AlgebricksException {
-        return new ICopyEvaluatorFactory() {
+    public IScalarEvaluatorFactory createEvaluatorFactory(final IScalarEvaluatorFactory[] args)
+            throws AlgebricksException {
+        return new IScalarEvaluatorFactory() {
             private static final long serialVersionUID = 1L;
 
             @Override
-            public ICopyEvaluator createEvaluator(final IDataOutputProvider output) throws AlgebricksException {
-                return new SimilarityJaccardPrefixEvaluator(args, output);
+            public IScalarEvaluator createScalarEvaluator(final IHyracksTaskContext ctx) throws AlgebricksException {
+                return new SimilarityJaccardPrefixEvaluator(args, ctx);
             }
         };
     }
diff --git a/asterix-runtime/src/main/java/org/apache/asterix/runtime/evaluators/functions/SimilarityJaccardSortedCheckDescriptor.java b/asterix-runtime/src/main/java/org/apache/asterix/runtime/evaluators/functions/SimilarityJaccardSortedCheckDescriptor.java
index 06433a3..6e34ffb 100644
--- a/asterix-runtime/src/main/java/org/apache/asterix/runtime/evaluators/functions/SimilarityJaccardSortedCheckDescriptor.java
+++ b/asterix-runtime/src/main/java/org/apache/asterix/runtime/evaluators/functions/SimilarityJaccardSortedCheckDescriptor.java
@@ -25,28 +25,30 @@
 import org.apache.asterix.runtime.evaluators.common.SimilarityJaccardSortedCheckEvaluator;
 import org.apache.hyracks.algebricks.common.exceptions.AlgebricksException;
 import org.apache.hyracks.algebricks.core.algebra.functions.FunctionIdentifier;
-import org.apache.hyracks.algebricks.runtime.base.ICopyEvaluator;
-import org.apache.hyracks.algebricks.runtime.base.ICopyEvaluatorFactory;
-import org.apache.hyracks.data.std.api.IDataOutputProvider;
+import org.apache.hyracks.algebricks.runtime.base.IScalarEvaluator;
+import org.apache.hyracks.algebricks.runtime.base.IScalarEvaluatorFactory;
+import org.apache.hyracks.api.context.IHyracksTaskContext;
 
 // Assumes that both arguments are sorted by the same ordering.
 public class SimilarityJaccardSortedCheckDescriptor extends AbstractScalarFunctionDynamicDescriptor {
 
     private static final long serialVersionUID = 1L;
     public static final IFunctionDescriptorFactory FACTORY = new IFunctionDescriptorFactory() {
+        @Override
         public IFunctionDescriptor createFunctionDescriptor() {
             return new SimilarityJaccardSortedCheckDescriptor();
         }
     };
 
     @Override
-    public ICopyEvaluatorFactory createEvaluatorFactory(final ICopyEvaluatorFactory[] args) throws AlgebricksException {
-        return new ICopyEvaluatorFactory() {
+    public IScalarEvaluatorFactory createEvaluatorFactory(final IScalarEvaluatorFactory[] args)
+            throws AlgebricksException {
+        return new IScalarEvaluatorFactory() {
             private static final long serialVersionUID = 1L;
 
             @Override
-            public ICopyEvaluator createEvaluator(IDataOutputProvider output) throws AlgebricksException {
-                return new SimilarityJaccardSortedCheckEvaluator(args, output);
+            public IScalarEvaluator createScalarEvaluator(IHyracksTaskContext ctx) throws AlgebricksException {
+                return new SimilarityJaccardSortedCheckEvaluator(args, ctx);
             }
         };
     }
diff --git a/asterix-runtime/src/main/java/org/apache/asterix/runtime/evaluators/functions/SimilarityJaccardSortedDescriptor.java b/asterix-runtime/src/main/java/org/apache/asterix/runtime/evaluators/functions/SimilarityJaccardSortedDescriptor.java
index 6cdfcca..4995e25 100644
--- a/asterix-runtime/src/main/java/org/apache/asterix/runtime/evaluators/functions/SimilarityJaccardSortedDescriptor.java
+++ b/asterix-runtime/src/main/java/org/apache/asterix/runtime/evaluators/functions/SimilarityJaccardSortedDescriptor.java
@@ -25,28 +25,30 @@
 import org.apache.asterix.runtime.evaluators.common.SimilarityJaccardSortedEvaluator;
 import org.apache.hyracks.algebricks.common.exceptions.AlgebricksException;
 import org.apache.hyracks.algebricks.core.algebra.functions.FunctionIdentifier;
-import org.apache.hyracks.algebricks.runtime.base.ICopyEvaluator;
-import org.apache.hyracks.algebricks.runtime.base.ICopyEvaluatorFactory;
-import org.apache.hyracks.data.std.api.IDataOutputProvider;
+import org.apache.hyracks.algebricks.runtime.base.IScalarEvaluator;
+import org.apache.hyracks.algebricks.runtime.base.IScalarEvaluatorFactory;
+import org.apache.hyracks.api.context.IHyracksTaskContext;
 
 // Assumes that both arguments are sorted by the same ordering.
 public class SimilarityJaccardSortedDescriptor extends AbstractScalarFunctionDynamicDescriptor {
 
     private static final long serialVersionUID = 1L;
     public static final IFunctionDescriptorFactory FACTORY = new IFunctionDescriptorFactory() {
+        @Override
         public IFunctionDescriptor createFunctionDescriptor() {
             return new SimilarityJaccardSortedDescriptor();
         }
     };
 
     @Override
-    public ICopyEvaluatorFactory createEvaluatorFactory(final ICopyEvaluatorFactory[] args) throws AlgebricksException {
-        return new ICopyEvaluatorFactory() {
+    public IScalarEvaluatorFactory createEvaluatorFactory(final IScalarEvaluatorFactory[] args)
+            throws AlgebricksException {
+        return new IScalarEvaluatorFactory() {
             private static final long serialVersionUID = 1L;
 
             @Override
-            public ICopyEvaluator createEvaluator(IDataOutputProvider output) throws AlgebricksException {
-                return new SimilarityJaccardSortedEvaluator(args, output);
+            public IScalarEvaluator createScalarEvaluator(IHyracksTaskContext ctx) throws AlgebricksException {
+                return new SimilarityJaccardSortedEvaluator(args, ctx);
             }
         };
     }
diff --git a/asterix-runtime/src/main/java/org/apache/asterix/runtime/evaluators/functions/SpatialAreaDescriptor.java b/asterix-runtime/src/main/java/org/apache/asterix/runtime/evaluators/functions/SpatialAreaDescriptor.java
index a3ad867..3e2e02d 100644
--- a/asterix-runtime/src/main/java/org/apache/asterix/runtime/evaluators/functions/SpatialAreaDescriptor.java
+++ b/asterix-runtime/src/main/java/org/apache/asterix/runtime/evaluators/functions/SpatialAreaDescriptor.java
@@ -39,11 +39,13 @@
 import org.apache.hyracks.algebricks.common.exceptions.AlgebricksException;
 import org.apache.hyracks.algebricks.common.exceptions.NotImplementedException;
 import org.apache.hyracks.algebricks.core.algebra.functions.FunctionIdentifier;
-import org.apache.hyracks.algebricks.runtime.base.ICopyEvaluator;
-import org.apache.hyracks.algebricks.runtime.base.ICopyEvaluatorFactory;
+import org.apache.hyracks.algebricks.runtime.base.IScalarEvaluator;
+import org.apache.hyracks.algebricks.runtime.base.IScalarEvaluatorFactory;
+import org.apache.hyracks.api.context.IHyracksTaskContext;
 import org.apache.hyracks.api.dataflow.value.ISerializerDeserializer;
 import org.apache.hyracks.api.exceptions.HyracksDataException;
-import org.apache.hyracks.data.std.api.IDataOutputProvider;
+import org.apache.hyracks.data.std.api.IPointable;
+import org.apache.hyracks.data.std.primitive.VoidPointable;
 import org.apache.hyracks.data.std.util.ArrayBackedValueStorage;
 import org.apache.hyracks.dataflow.common.data.accessors.IFrameTupleReference;
 
@@ -58,64 +60,67 @@
     };
 
     @Override
-    public ICopyEvaluatorFactory createEvaluatorFactory(final ICopyEvaluatorFactory[] args) throws AlgebricksException {
-        return new ICopyEvaluatorFactory() {
+    public IScalarEvaluatorFactory createEvaluatorFactory(final IScalarEvaluatorFactory[] args)
+            throws AlgebricksException {
+        return new IScalarEvaluatorFactory() {
             private static final long serialVersionUID = 1L;
 
             @Override
-            public ICopyEvaluator createEvaluator(final IDataOutputProvider output) throws AlgebricksException {
-                return new ICopyEvaluator() {
+            public IScalarEvaluator createScalarEvaluator(final IHyracksTaskContext ctx) throws AlgebricksException {
+                return new IScalarEvaluator() {
 
-                    private final DataOutput out = output.getDataOutput();
-                    private final ArrayBackedValueStorage argOut = new ArrayBackedValueStorage();
-                    private final ICopyEvaluator eval = args[0].createEvaluator(argOut);
+                    private final ArrayBackedValueStorage resultStorage = new ArrayBackedValueStorage();
+                    private final DataOutput out = resultStorage.getDataOutput();
+                    private final IPointable argPtr = new VoidPointable();
+                    private final IScalarEvaluator eval = args[0].createScalarEvaluator(ctx);
 
                     @SuppressWarnings("unchecked")
                     private final ISerializerDeserializer<ANull> nullSerde = AqlSerializerDeserializerProvider.INSTANCE
                             .getSerializerDeserializer(BuiltinType.ANULL);
 
                     @Override
-                    public void evaluate(IFrameTupleReference tuple) throws AlgebricksException {
-                        argOut.reset();
-                        eval.evaluate(tuple);
+                    public void evaluate(IFrameTupleReference tuple, IPointable result) throws AlgebricksException {
+                        resultStorage.reset();
+                        eval.evaluate(tuple, argPtr);
 
                         try {
-                            byte[] bytes = argOut.getByteArray();
-                            ATypeTag tag = EnumDeserializer.ATYPETAGDESERIALIZER.deserialize(bytes[0]);
+                            byte[] bytes = argPtr.getByteArray();
+                            int offset = argPtr.getStartOffset();
+                            ATypeTag tag = EnumDeserializer.ATYPETAGDESERIALIZER.deserialize(bytes[offset]);
                             double area = 0.0;
 
                             switch (tag) {
                                 case POLYGON:
-                                    int numOfPoints = AInt16SerializerDeserializer.getShort(argOut.getByteArray(), 1);
+                                    int numOfPoints = AInt16SerializerDeserializer.getShort(bytes, offset + 1);
 
                                     if (numOfPoints < 3) {
                                         throw new AlgebricksException(AsterixBuiltinFunctions.SPATIAL_AREA.getName()
                                                 + ": polygon must have at least 3 points");
                                     }
-                                    area = Math.abs(SpatialUtils.polygonArea(argOut.getByteArray(), numOfPoints));
+                                    area = Math.abs(SpatialUtils.polygonArea(bytes, offset, numOfPoints));
                                     out.writeByte(ATypeTag.SERIALIZED_DOUBLE_TYPE_TAG);
                                     out.writeDouble(area);
                                     break;
                                 case CIRCLE:
-                                    double radius = ADoubleSerializerDeserializer.getDouble(argOut.getByteArray(),
-                                            ACircleSerializerDeserializer.getRadiusOffset());
+                                    double radius = ADoubleSerializerDeserializer.getDouble(bytes,
+                                            offset + ACircleSerializerDeserializer.getRadiusOffset());
                                     area = SpatialUtils.pi() * radius * radius;
                                     out.writeByte(ATypeTag.SERIALIZED_DOUBLE_TYPE_TAG);
                                     out.writeDouble(area);
                                     break;
                                 case RECTANGLE:
-                                    double x1 = ADoubleSerializerDeserializer.getDouble(argOut.getByteArray(),
-                                            ARectangleSerializerDeserializer
+                                    double x1 = ADoubleSerializerDeserializer.getDouble(bytes,
+                                            offset + ARectangleSerializerDeserializer
                                                     .getBottomLeftCoordinateOffset(Coordinate.X));
-                                    double y1 = ADoubleSerializerDeserializer.getDouble(argOut.getByteArray(),
-                                            ARectangleSerializerDeserializer
+                                    double y1 = ADoubleSerializerDeserializer.getDouble(bytes,
+                                            offset + ARectangleSerializerDeserializer
                                                     .getBottomLeftCoordinateOffset(Coordinate.Y));
 
-                                    double x2 = ADoubleSerializerDeserializer.getDouble(argOut.getByteArray(),
-                                            ARectangleSerializerDeserializer
+                                    double x2 = ADoubleSerializerDeserializer.getDouble(bytes,
+                                            offset + ARectangleSerializerDeserializer
                                                     .getUpperRightCoordinateOffset(Coordinate.X));
-                                    double y2 = ADoubleSerializerDeserializer.getDouble(argOut.getByteArray(),
-                                            ARectangleSerializerDeserializer
+                                    double y2 = ADoubleSerializerDeserializer.getDouble(bytes,
+                                            offset + ARectangleSerializerDeserializer
                                                     .getUpperRightCoordinateOffset(Coordinate.Y));
                                     area = (x2 - x1) * (y2 - y1);
                                     out.writeByte(ATypeTag.SERIALIZED_DOUBLE_TYPE_TAG);
@@ -134,6 +139,7 @@
                         } catch (IOException e) {
                             throw new AlgebricksException(e);
                         }
+                        result.set(resultStorage);
                     }
                 };
             }
diff --git a/asterix-runtime/src/main/java/org/apache/asterix/runtime/evaluators/functions/SpatialCellDescriptor.java b/asterix-runtime/src/main/java/org/apache/asterix/runtime/evaluators/functions/SpatialCellDescriptor.java
index ef4bf6f..6bea2d1 100644
--- a/asterix-runtime/src/main/java/org/apache/asterix/runtime/evaluators/functions/SpatialCellDescriptor.java
+++ b/asterix-runtime/src/main/java/org/apache/asterix/runtime/evaluators/functions/SpatialCellDescriptor.java
@@ -38,10 +38,12 @@
 import org.apache.asterix.runtime.evaluators.base.AbstractScalarFunctionDynamicDescriptor;
 import org.apache.hyracks.algebricks.common.exceptions.AlgebricksException;
 import org.apache.hyracks.algebricks.core.algebra.functions.FunctionIdentifier;
-import org.apache.hyracks.algebricks.runtime.base.ICopyEvaluator;
-import org.apache.hyracks.algebricks.runtime.base.ICopyEvaluatorFactory;
+import org.apache.hyracks.algebricks.runtime.base.IScalarEvaluator;
+import org.apache.hyracks.algebricks.runtime.base.IScalarEvaluatorFactory;
+import org.apache.hyracks.api.context.IHyracksTaskContext;
 import org.apache.hyracks.api.dataflow.value.ISerializerDeserializer;
-import org.apache.hyracks.data.std.api.IDataOutputProvider;
+import org.apache.hyracks.data.std.api.IPointable;
+import org.apache.hyracks.data.std.primitive.VoidPointable;
 import org.apache.hyracks.data.std.util.ArrayBackedValueStorage;
 import org.apache.hyracks.dataflow.common.data.accessors.IFrameTupleReference;
 
@@ -49,30 +51,32 @@
 
     private static final long serialVersionUID = 1L;
     public static final IFunctionDescriptorFactory FACTORY = new IFunctionDescriptorFactory() {
+        @Override
         public IFunctionDescriptor createFunctionDescriptor() {
             return new SpatialCellDescriptor();
         }
     };
 
     @Override
-    public ICopyEvaluatorFactory createEvaluatorFactory(final ICopyEvaluatorFactory[] args) throws AlgebricksException {
-        return new ICopyEvaluatorFactory() {
+    public IScalarEvaluatorFactory createEvaluatorFactory(final IScalarEvaluatorFactory[] args)
+            throws AlgebricksException {
+        return new IScalarEvaluatorFactory() {
             private static final long serialVersionUID = 1L;
 
             @Override
-            public ICopyEvaluator createEvaluator(final IDataOutputProvider output) throws AlgebricksException {
-                return new ICopyEvaluator() {
+            public IScalarEvaluator createScalarEvaluator(final IHyracksTaskContext ctx) throws AlgebricksException {
+                return new IScalarEvaluator() {
 
-                    private final DataOutput out = output.getDataOutput();
-
-                    private final ArrayBackedValueStorage outInput0 = new ArrayBackedValueStorage();
-                    private final ArrayBackedValueStorage outInput1 = new ArrayBackedValueStorage();
-                    private final ArrayBackedValueStorage outInput2 = new ArrayBackedValueStorage();
-                    private final ArrayBackedValueStorage outInput3 = new ArrayBackedValueStorage();
-                    private final ICopyEvaluator eval0 = args[0].createEvaluator(outInput0);
-                    private final ICopyEvaluator eval1 = args[1].createEvaluator(outInput1);
-                    private final ICopyEvaluator eval2 = args[2].createEvaluator(outInput2);
-                    private final ICopyEvaluator eval3 = args[3].createEvaluator(outInput3);
+                    private final ArrayBackedValueStorage resultStorage = new ArrayBackedValueStorage();
+                    private final DataOutput out = resultStorage.getDataOutput();
+                    private final IPointable inputArg0 = new VoidPointable();
+                    private final IPointable inputArg1 = new VoidPointable();
+                    private final IPointable inputArg2 = new VoidPointable();
+                    private final IPointable inputArg3 = new VoidPointable();
+                    private final IScalarEvaluator eval0 = args[0].createScalarEvaluator(ctx);
+                    private final IScalarEvaluator eval1 = args[1].createScalarEvaluator(ctx);
+                    private final IScalarEvaluator eval2 = args[2].createScalarEvaluator(ctx);
+                    private final IScalarEvaluator eval3 = args[3].createScalarEvaluator(ctx);
                     private final AMutableRectangle aRectangle = new AMutableRectangle(null, null);
                     private final AMutablePoint[] aPoint = { new AMutablePoint(0, 0), new AMutablePoint(0, 0) };
 
@@ -84,39 +88,41 @@
                             .getSerializerDeserializer(BuiltinType.ARECTANGLE);
 
                     @Override
-                    public void evaluate(IFrameTupleReference tuple) throws AlgebricksException {
-                        outInput0.reset();
-                        eval0.evaluate(tuple);
-                        outInput1.reset();
-                        eval1.evaluate(tuple);
-                        outInput2.reset();
-                        eval2.evaluate(tuple);
-                        outInput3.reset();
-                        eval3.evaluate(tuple);
+                    public void evaluate(IFrameTupleReference tuple, IPointable result) throws AlgebricksException {
+                        resultStorage.reset();
+                        eval0.evaluate(tuple, inputArg0);
+                        eval1.evaluate(tuple, inputArg1);
+                        eval2.evaluate(tuple, inputArg2);
+                        eval3.evaluate(tuple, inputArg3);
+
+                        byte[] bytes0 = inputArg0.getByteArray();
+                        byte[] bytes1 = inputArg1.getByteArray();
+                        byte[] bytes2 = inputArg2.getByteArray();
+                        byte[] bytes3 = inputArg3.getByteArray();
+                        int offset0 = inputArg0.getStartOffset();
+                        int offset1 = inputArg1.getStartOffset();
+                        int offset2 = inputArg2.getStartOffset();
+                        int offset3 = inputArg3.getStartOffset();
 
                         try {
-                            ATypeTag tag0 = EnumDeserializer.ATYPETAGDESERIALIZER
-                                    .deserialize(outInput0.getByteArray()[0]);
-                            ATypeTag tag1 = EnumDeserializer.ATYPETAGDESERIALIZER
-                                    .deserialize(outInput1.getByteArray()[0]);
-                            ATypeTag tag2 = EnumDeserializer.ATYPETAGDESERIALIZER
-                                    .deserialize(outInput2.getByteArray()[0]);
-                            ATypeTag tag3 = EnumDeserializer.ATYPETAGDESERIALIZER
-                                    .deserialize(outInput3.getByteArray()[0]);
+                            ATypeTag tag0 = EnumDeserializer.ATYPETAGDESERIALIZER.deserialize(bytes0[offset0]);
+                            ATypeTag tag1 = EnumDeserializer.ATYPETAGDESERIALIZER.deserialize(bytes1[offset1]);
+                            ATypeTag tag2 = EnumDeserializer.ATYPETAGDESERIALIZER.deserialize(bytes2[offset2]);
+                            ATypeTag tag3 = EnumDeserializer.ATYPETAGDESERIALIZER.deserialize(bytes3[offset3]);
                             if (tag0 == ATypeTag.POINT && tag1 == ATypeTag.POINT && tag2 == ATypeTag.DOUBLE
                                     && tag3 == ATypeTag.DOUBLE) {
-                                double xLoc = ADoubleSerializerDeserializer.getDouble(outInput0.getByteArray(),
-                                        APointSerializerDeserializer.getCoordinateOffset(Coordinate.X));
-                                double yLoc = ADoubleSerializerDeserializer.getDouble(outInput0.getByteArray(),
-                                        APointSerializerDeserializer.getCoordinateOffset(Coordinate.Y));
+                                double xLoc = ADoubleSerializerDeserializer.getDouble(bytes0,
+                                        offset0 + APointSerializerDeserializer.getCoordinateOffset(Coordinate.X));
+                                double yLoc = ADoubleSerializerDeserializer.getDouble(bytes0,
+                                        offset0 + APointSerializerDeserializer.getCoordinateOffset(Coordinate.Y));
 
-                                double xOrigin = ADoubleSerializerDeserializer.getDouble(outInput1.getByteArray(),
-                                        APointSerializerDeserializer.getCoordinateOffset(Coordinate.X));
-                                double yOrigin = ADoubleSerializerDeserializer.getDouble(outInput1.getByteArray(),
-                                        APointSerializerDeserializer.getCoordinateOffset(Coordinate.Y));
+                                double xOrigin = ADoubleSerializerDeserializer.getDouble(bytes1,
+                                        offset1 + APointSerializerDeserializer.getCoordinateOffset(Coordinate.X));
+                                double yOrigin = ADoubleSerializerDeserializer.getDouble(bytes1,
+                                        offset1 + APointSerializerDeserializer.getCoordinateOffset(Coordinate.Y));
 
-                                double xInc = ADoubleSerializerDeserializer.getDouble(outInput2.getByteArray(), 1);
-                                double yInc = ADoubleSerializerDeserializer.getDouble(outInput3.getByteArray(), 1);
+                                double xInc = ADoubleSerializerDeserializer.getDouble(bytes2, offset2 + 1);
+                                double yInc = ADoubleSerializerDeserializer.getDouble(bytes3, offset3 + 1);
 
                                 double x = xOrigin + (Math.floor((xLoc - xOrigin) / xInc)) * xInc;
                                 double y = yOrigin + (Math.floor((yLoc - yOrigin) / yInc)) * yInc;
@@ -128,21 +134,14 @@
                                     || tag3 == ATypeTag.NULL) {
                                 nullSerde.serialize(ANull.NULL, out);
                             } else {
-                                throw new AlgebricksException(
-                                        AsterixBuiltinFunctions.SPATIAL_CELL.getName()
-                                                + ": expects input type: (POINT, POINT, DOUBLE, DOUBLE) but got ("
-                                                + EnumDeserializer.ATYPETAGDESERIALIZER.deserialize(outInput0
-                                                        .getByteArray()[0])
-                                                + ", "
-                                                + EnumDeserializer.ATYPETAGDESERIALIZER.deserialize(outInput1
-                                                        .getByteArray()[0])
-                                                + ", "
-                                                + EnumDeserializer.ATYPETAGDESERIALIZER.deserialize(outInput2
-                                                        .getByteArray()[0])
-                                                + ", "
-                                                + EnumDeserializer.ATYPETAGDESERIALIZER.deserialize(outInput3
-                                                        .getByteArray()[0]) + ").");
+                                throw new AlgebricksException(AsterixBuiltinFunctions.SPATIAL_CELL.getName()
+                                        + ": expects input type: (POINT, POINT, DOUBLE, DOUBLE) but got ("
+                                        + EnumDeserializer.ATYPETAGDESERIALIZER.deserialize(bytes0[offset0]) + ", "
+                                        + EnumDeserializer.ATYPETAGDESERIALIZER.deserialize(bytes1[offset1]) + ", "
+                                        + EnumDeserializer.ATYPETAGDESERIALIZER.deserialize(bytes2[offset2]) + ", "
+                                        + EnumDeserializer.ATYPETAGDESERIALIZER.deserialize(bytes3[offset3]) + ").");
                             }
+                            result.set(resultStorage);
                         } catch (IOException e1) {
                             throw new AlgebricksException(e1);
                         }
diff --git a/asterix-runtime/src/main/java/org/apache/asterix/runtime/evaluators/functions/SpatialDistanceDescriptor.java b/asterix-runtime/src/main/java/org/apache/asterix/runtime/evaluators/functions/SpatialDistanceDescriptor.java
index 70adde4..ffcd4f1 100644
--- a/asterix-runtime/src/main/java/org/apache/asterix/runtime/evaluators/functions/SpatialDistanceDescriptor.java
+++ b/asterix-runtime/src/main/java/org/apache/asterix/runtime/evaluators/functions/SpatialDistanceDescriptor.java
@@ -36,11 +36,13 @@
 import org.apache.hyracks.algebricks.common.exceptions.AlgebricksException;
 import org.apache.hyracks.algebricks.common.exceptions.NotImplementedException;
 import org.apache.hyracks.algebricks.core.algebra.functions.FunctionIdentifier;
-import org.apache.hyracks.algebricks.runtime.base.ICopyEvaluator;
-import org.apache.hyracks.algebricks.runtime.base.ICopyEvaluatorFactory;
+import org.apache.hyracks.algebricks.runtime.base.IScalarEvaluator;
+import org.apache.hyracks.algebricks.runtime.base.IScalarEvaluatorFactory;
+import org.apache.hyracks.api.context.IHyracksTaskContext;
 import org.apache.hyracks.api.dataflow.value.ISerializerDeserializer;
 import org.apache.hyracks.api.exceptions.HyracksDataException;
-import org.apache.hyracks.data.std.api.IDataOutputProvider;
+import org.apache.hyracks.data.std.api.IPointable;
+import org.apache.hyracks.data.std.primitive.VoidPointable;
 import org.apache.hyracks.data.std.util.ArrayBackedValueStorage;
 import org.apache.hyracks.dataflow.common.data.accessors.IFrameTupleReference;
 
@@ -55,47 +57,51 @@
     };
 
     @Override
-    public ICopyEvaluatorFactory createEvaluatorFactory(final ICopyEvaluatorFactory[] args) throws AlgebricksException {
-        return new ICopyEvaluatorFactory() {
+    public IScalarEvaluatorFactory createEvaluatorFactory(final IScalarEvaluatorFactory[] args)
+            throws AlgebricksException {
+        return new IScalarEvaluatorFactory() {
             private static final long serialVersionUID = 1L;
 
             @Override
-            public ICopyEvaluator createEvaluator(final IDataOutputProvider output) throws AlgebricksException {
-                return new ICopyEvaluator() {
+            public IScalarEvaluator createScalarEvaluator(final IHyracksTaskContext ctx) throws AlgebricksException {
+                return new IScalarEvaluator() {
 
-                    private final DataOutput out = output.getDataOutput();
-                    private final ArrayBackedValueStorage outInput0 = new ArrayBackedValueStorage();
-                    private final ArrayBackedValueStorage outInput1 = new ArrayBackedValueStorage();
-                    private final ICopyEvaluator eval0 = args[0].createEvaluator(outInput0);
-                    private final ICopyEvaluator eval1 = args[1].createEvaluator(outInput1);
+                    private final ArrayBackedValueStorage resultStorage = new ArrayBackedValueStorage();
+                    private final DataOutput out = resultStorage.getDataOutput();
+                    private final IPointable inputArg0 = new VoidPointable();
+                    private final IPointable inputArg1 = new VoidPointable();
+                    private final IScalarEvaluator eval0 = args[0].createScalarEvaluator(ctx);
+                    private final IScalarEvaluator eval1 = args[1].createScalarEvaluator(ctx);
 
                     @SuppressWarnings("unchecked")
                     private final ISerializerDeserializer<ANull> nullSerde = AqlSerializerDeserializerProvider.INSTANCE
                             .getSerializerDeserializer(BuiltinType.ANULL);
 
                     @Override
-                    public void evaluate(IFrameTupleReference tuple) throws AlgebricksException {
-                        outInput0.reset();
-                        eval0.evaluate(tuple);
-                        outInput1.reset();
-                        eval1.evaluate(tuple);
+                    public void evaluate(IFrameTupleReference tuple, IPointable result) throws AlgebricksException {
+                        resultStorage.reset();
+                        eval0.evaluate(tuple, inputArg0);
+                        eval1.evaluate(tuple, inputArg1);
 
                         try {
-                            byte[] bytes0 = outInput0.getByteArray();
-                            byte[] bytes1 = outInput1.getByteArray();
-                            ATypeTag tag0 = EnumDeserializer.ATYPETAGDESERIALIZER.deserialize(bytes0[0]);
-                            ATypeTag tag1 = EnumDeserializer.ATYPETAGDESERIALIZER.deserialize(bytes1[0]);
+                            byte[] bytes0 = inputArg0.getByteArray();
+                            byte[] bytes1 = inputArg1.getByteArray();
+                            int offset0 = inputArg0.getStartOffset();
+                            int offset1 = inputArg1.getStartOffset();
+
+                            ATypeTag tag0 = EnumDeserializer.ATYPETAGDESERIALIZER.deserialize(bytes0[offset0]);
+                            ATypeTag tag1 = EnumDeserializer.ATYPETAGDESERIALIZER.deserialize(bytes1[offset1]);
                             double distance = 0.0;
                             if (tag0 == ATypeTag.POINT) {
                                 if (tag1 == ATypeTag.POINT) {
-                                    double x1 = ADoubleSerializerDeserializer.getDouble(outInput0.getByteArray(),
-                                            APointSerializerDeserializer.getCoordinateOffset(Coordinate.X));
-                                    double y1 = ADoubleSerializerDeserializer.getDouble(outInput0.getByteArray(),
-                                            APointSerializerDeserializer.getCoordinateOffset(Coordinate.Y));
-                                    double x2 = ADoubleSerializerDeserializer.getDouble(outInput1.getByteArray(),
-                                            APointSerializerDeserializer.getCoordinateOffset(Coordinate.X));
-                                    double y2 = ADoubleSerializerDeserializer.getDouble(outInput1.getByteArray(),
-                                            APointSerializerDeserializer.getCoordinateOffset(Coordinate.Y));
+                                    double x1 = ADoubleSerializerDeserializer.getDouble(bytes0,
+                                            offset0 + APointSerializerDeserializer.getCoordinateOffset(Coordinate.X));
+                                    double y1 = ADoubleSerializerDeserializer.getDouble(bytes0,
+                                            offset0 + APointSerializerDeserializer.getCoordinateOffset(Coordinate.Y));
+                                    double x2 = ADoubleSerializerDeserializer.getDouble(bytes1,
+                                            offset1 + APointSerializerDeserializer.getCoordinateOffset(Coordinate.X));
+                                    double y2 = ADoubleSerializerDeserializer.getDouble(bytes1,
+                                            offset1 + APointSerializerDeserializer.getCoordinateOffset(Coordinate.Y));
                                     distance = Math.sqrt(Math.pow(x2 - x1, 2) + Math.pow(y2 - y1, 2));
                                 } else {
                                     throw new NotImplementedException(AsterixBuiltinFunctions.SPATIAL_DISTANCE.getName()
@@ -116,6 +122,7 @@
                         } catch (IOException e) {
                             throw new AlgebricksException(e);
                         }
+                        result.set(resultStorage);
                     }
                 };
             }
diff --git a/asterix-runtime/src/main/java/org/apache/asterix/runtime/evaluators/functions/SpatialIntersectDescriptor.java b/asterix-runtime/src/main/java/org/apache/asterix/runtime/evaluators/functions/SpatialIntersectDescriptor.java
index bec1f79..93eeee9 100644
--- a/asterix-runtime/src/main/java/org/apache/asterix/runtime/evaluators/functions/SpatialIntersectDescriptor.java
+++ b/asterix-runtime/src/main/java/org/apache/asterix/runtime/evaluators/functions/SpatialIntersectDescriptor.java
@@ -43,11 +43,13 @@
 import org.apache.hyracks.algebricks.common.exceptions.AlgebricksException;
 import org.apache.hyracks.algebricks.common.exceptions.NotImplementedException;
 import org.apache.hyracks.algebricks.core.algebra.functions.FunctionIdentifier;
-import org.apache.hyracks.algebricks.runtime.base.ICopyEvaluator;
-import org.apache.hyracks.algebricks.runtime.base.ICopyEvaluatorFactory;
+import org.apache.hyracks.algebricks.runtime.base.IScalarEvaluator;
+import org.apache.hyracks.algebricks.runtime.base.IScalarEvaluatorFactory;
+import org.apache.hyracks.api.context.IHyracksTaskContext;
 import org.apache.hyracks.api.dataflow.value.IBinaryComparator;
 import org.apache.hyracks.api.exceptions.HyracksDataException;
-import org.apache.hyracks.data.std.api.IDataOutputProvider;
+import org.apache.hyracks.data.std.api.IPointable;
+import org.apache.hyracks.data.std.primitive.VoidPointable;
 import org.apache.hyracks.data.std.util.ArrayBackedValueStorage;
 import org.apache.hyracks.dataflow.common.data.accessors.IFrameTupleReference;
 
@@ -63,19 +65,21 @@
     };
 
     @Override
-    public ICopyEvaluatorFactory createEvaluatorFactory(final ICopyEvaluatorFactory[] args) throws AlgebricksException {
-        return new ICopyEvaluatorFactory() {
+    public IScalarEvaluatorFactory createEvaluatorFactory(final IScalarEvaluatorFactory[] args)
+            throws AlgebricksException {
+        return new IScalarEvaluatorFactory() {
             private static final long serialVersionUID = 1L;
 
             @Override
-            public ICopyEvaluator createEvaluator(final IDataOutputProvider output) throws AlgebricksException {
-                return new ICopyEvaluator() {
+            public IScalarEvaluator createScalarEvaluator(final IHyracksTaskContext ctx) throws AlgebricksException {
+                return new IScalarEvaluator() {
 
-                    private final DataOutput out = output.getDataOutput();
-                    private final ArrayBackedValueStorage outInput0 = new ArrayBackedValueStorage();
-                    private final ArrayBackedValueStorage outInput1 = new ArrayBackedValueStorage();
-                    private final ICopyEvaluator eval0 = args[0].createEvaluator(outInput0);
-                    private final ICopyEvaluator eval1 = args[1].createEvaluator(outInput1);
+                    private final ArrayBackedValueStorage resultStorage = new ArrayBackedValueStorage();
+                    private final DataOutput out = resultStorage.getDataOutput();
+                    private final IPointable inputArg0 = new VoidPointable();
+                    private final IPointable inputArg1 = new VoidPointable();
+                    private final IScalarEvaluator eval0 = args[0].createScalarEvaluator(ctx);
+                    private final IScalarEvaluator eval1 = args[1].createScalarEvaluator(ctx);
                     private final IBinaryComparator ascDoubleComp = AqlBinaryComparatorFactoryProvider.DOUBLE_POINTABLE_INSTANCE
                             .createBinaryComparator();
                     private final SpatialUtils spatialUtils = new SpatialUtils();
@@ -108,14 +112,15 @@
                         return true;
                     }
 
-                    private boolean pointInPolygon(byte[] bytes0, byte[] bytes1) throws HyracksDataException { // ray casting
+                    private boolean pointInPolygon(byte[] bytes0, int offset0, byte[] bytes1, int offset1)
+                            throws HyracksDataException { // ray casting
 
                         double pX = ADoubleSerializerDeserializer.getDouble(bytes0,
-                                APointSerializerDeserializer.getCoordinateOffset(Coordinate.X));
+                                offset0 + APointSerializerDeserializer.getCoordinateOffset(Coordinate.X));
                         double pY = ADoubleSerializerDeserializer.getDouble(bytes0,
-                                APointSerializerDeserializer.getCoordinateOffset(Coordinate.Y));
+                                offset0 + APointSerializerDeserializer.getCoordinateOffset(Coordinate.Y));
                         int numOfPoints1 = AInt16SerializerDeserializer.getShort(bytes1,
-                                APolygonSerializerDeserializer.getNumberOfPointsOffset());
+                                offset1 + APolygonSerializerDeserializer.getNumberOfPointsOffset());
 
                         if (numOfPoints1 < 3) {
                             throw new HyracksDataException(AsterixBuiltinFunctions.SPATIAL_INTERSECT.getName()
@@ -126,21 +131,21 @@
                         double xInters;
                         double x1, x2, y1, y2;
                         x1 = ADoubleSerializerDeserializer.getDouble(bytes1,
-                                APolygonSerializerDeserializer.getCoordinateOffset(0, Coordinate.X));
+                                offset1 + APolygonSerializerDeserializer.getCoordinateOffset(0, Coordinate.X));
                         y1 = ADoubleSerializerDeserializer.getDouble(bytes1,
-                                APolygonSerializerDeserializer.getCoordinateOffset(0, Coordinate.Y));
+                                offset1 + APolygonSerializerDeserializer.getCoordinateOffset(0, Coordinate.Y));
 
                         for (int i = 1; i <= numOfPoints1; i++) {
                             if (i == numOfPoints1) {
                                 x2 = ADoubleSerializerDeserializer.getDouble(bytes1,
-                                        APolygonSerializerDeserializer.getCoordinateOffset(0, Coordinate.X));
+                                        offset1 + APolygonSerializerDeserializer.getCoordinateOffset(0, Coordinate.X));
                                 y2 = ADoubleSerializerDeserializer.getDouble(bytes1,
-                                        APolygonSerializerDeserializer.getCoordinateOffset(0, Coordinate.Y));
+                                        offset1 + APolygonSerializerDeserializer.getCoordinateOffset(0, Coordinate.Y));
                             } else {
                                 x2 = ADoubleSerializerDeserializer.getDouble(bytes1,
-                                        APolygonSerializerDeserializer.getCoordinateOffset(i, Coordinate.X));
+                                        offset1 + APolygonSerializerDeserializer.getCoordinateOffset(i, Coordinate.X));
                                 y2 = ADoubleSerializerDeserializer.getDouble(bytes1,
-                                        APolygonSerializerDeserializer.getCoordinateOffset(i, Coordinate.Y));
+                                        offset1 + APolygonSerializerDeserializer.getCoordinateOffset(i, Coordinate.Y));
                             }
 
                             if (!pointOnLine(pX, pY, x1, y1, x2, y2)) {
@@ -167,18 +172,19 @@
                         }
                     }
 
-                    private boolean pointInCircle(byte[] bytes0, byte[] bytes1) throws HyracksDataException {
+                    private boolean pointInCircle(byte[] bytes0, int offset0, byte[] bytes1, int offset1)
+                            throws HyracksDataException {
                         double x = ADoubleSerializerDeserializer.getDouble(bytes0,
-                                APointSerializerDeserializer.getCoordinateOffset(Coordinate.X));
+                                offset0 + APointSerializerDeserializer.getCoordinateOffset(Coordinate.X));
                         double y = ADoubleSerializerDeserializer.getDouble(bytes0,
-                                APointSerializerDeserializer.getCoordinateOffset(Coordinate.Y));
+                                offset0 + APointSerializerDeserializer.getCoordinateOffset(Coordinate.Y));
 
                         double cX = ADoubleSerializerDeserializer.getDouble(bytes1,
-                                ACircleSerializerDeserializer.getCenterPointCoordinateOffset(Coordinate.X));
+                                offset1 + ACircleSerializerDeserializer.getCenterPointCoordinateOffset(Coordinate.X));
                         double cY = ADoubleSerializerDeserializer.getDouble(bytes1,
-                                ACircleSerializerDeserializer.getCenterPointCoordinateOffset(Coordinate.Y));
+                                offset1 + ACircleSerializerDeserializer.getCenterPointCoordinateOffset(Coordinate.Y));
                         double radius = ADoubleSerializerDeserializer.getDouble(bytes1,
-                                ACircleSerializerDeserializer.getRadiusOffset());
+                                offset1 + ACircleSerializerDeserializer.getRadiusOffset());
 
                         if ((x - cX) * (x - cX) + (y - cY) * (y - cY) <= (radius * radius)) {
                             return true;
@@ -212,18 +218,19 @@
                         return false;
                     }
 
-                    private boolean linePolygonIntersection(byte[] bytes0, byte[] bytes1) throws HyracksDataException {
+                    private boolean linePolygonIntersection(byte[] bytes0, int offset0, byte[] bytes1, int offset1)
+                            throws HyracksDataException {
                         double startX1 = ADoubleSerializerDeserializer.getDouble(bytes0,
-                                ALineSerializerDeserializer.getStartPointCoordinateOffset(Coordinate.X));
+                                offset0 + ALineSerializerDeserializer.getStartPointCoordinateOffset(Coordinate.X));
                         double startY1 = ADoubleSerializerDeserializer.getDouble(bytes0,
-                                ALineSerializerDeserializer.getStartPointCoordinateOffset(Coordinate.Y));
+                                offset0 + ALineSerializerDeserializer.getStartPointCoordinateOffset(Coordinate.Y));
                         double endX1 = ADoubleSerializerDeserializer.getDouble(bytes0,
-                                ALineSerializerDeserializer.getEndPointCoordinateOffset(Coordinate.X));
+                                offset0 + ALineSerializerDeserializer.getEndPointCoordinateOffset(Coordinate.X));
                         double endY1 = ADoubleSerializerDeserializer.getDouble(bytes0,
-                                ALineSerializerDeserializer.getEndPointCoordinateOffset(Coordinate.Y));
+                                offset0 + ALineSerializerDeserializer.getEndPointCoordinateOffset(Coordinate.Y));
 
                         int numOfPoints1 = AInt16SerializerDeserializer.getShort(bytes1,
-                                APolygonSerializerDeserializer.getNumberOfPointsOffset());
+                                offset1 + APolygonSerializerDeserializer.getNumberOfPointsOffset());
 
                         if (numOfPoints1 < 3) {
                             throw new HyracksDataException(AsterixBuiltinFunctions.SPATIAL_INTERSECT.getName()
@@ -231,22 +238,22 @@
                         }
                         for (int i = 0; i < numOfPoints1; i++) {
                             double startX2 = ADoubleSerializerDeserializer.getDouble(bytes1,
-                                    APolygonSerializerDeserializer.getCoordinateOffset(i, Coordinate.X));
+                                    offset1 + APolygonSerializerDeserializer.getCoordinateOffset(i, Coordinate.X));
                             double startY2 = ADoubleSerializerDeserializer.getDouble(bytes1,
-                                    APolygonSerializerDeserializer.getCoordinateOffset(i, Coordinate.Y));
+                                    offset1 + APolygonSerializerDeserializer.getCoordinateOffset(i, Coordinate.Y));
 
                             double endX2;
                             double endY2;
                             if (i + 1 == numOfPoints1) {
                                 endX2 = ADoubleSerializerDeserializer.getDouble(bytes1,
-                                        APolygonSerializerDeserializer.getCoordinateOffset(0, Coordinate.X));
+                                        offset1 + APolygonSerializerDeserializer.getCoordinateOffset(0, Coordinate.X));
                                 endY2 = ADoubleSerializerDeserializer.getDouble(bytes1,
-                                        APolygonSerializerDeserializer.getCoordinateOffset(0, Coordinate.Y));
+                                        offset1 + APolygonSerializerDeserializer.getCoordinateOffset(0, Coordinate.Y));
                             } else {
-                                endX2 = ADoubleSerializerDeserializer.getDouble(bytes1,
-                                        APolygonSerializerDeserializer.getCoordinateOffset(i + 1, Coordinate.X));
-                                endY2 = ADoubleSerializerDeserializer.getDouble(bytes1,
-                                        APolygonSerializerDeserializer.getCoordinateOffset(i + 1, Coordinate.Y));
+                                endX2 = ADoubleSerializerDeserializer.getDouble(bytes1, offset1
+                                        + APolygonSerializerDeserializer.getCoordinateOffset(i + 1, Coordinate.X));
+                                endY2 = ADoubleSerializerDeserializer.getDouble(bytes1, offset1
+                                        + APolygonSerializerDeserializer.getCoordinateOffset(i + 1, Coordinate.Y));
                             }
 
                             boolean intersect = lineLineIntersection(startX1, startY1, endX1, endY1, startX2, startY2,
@@ -258,26 +265,26 @@
                         return false;
                     }
 
-                    private boolean lineRectangleIntersection(byte[] bytes0, byte[] bytes1)
+                    private boolean lineRectangleIntersection(byte[] bytes0, int offset0, byte[] bytes1, int offset1)
                             throws HyracksDataException {
                         double startX1 = ADoubleSerializerDeserializer.getDouble(bytes0,
-                                ALineSerializerDeserializer.getStartPointCoordinateOffset(Coordinate.X));
+                                offset0 + ALineSerializerDeserializer.getStartPointCoordinateOffset(Coordinate.X));
                         double startY1 = ADoubleSerializerDeserializer.getDouble(bytes0,
-                                ALineSerializerDeserializer.getStartPointCoordinateOffset(Coordinate.Y));
+                                offset0 + ALineSerializerDeserializer.getStartPointCoordinateOffset(Coordinate.Y));
                         double endX1 = ADoubleSerializerDeserializer.getDouble(bytes0,
-                                ALineSerializerDeserializer.getEndPointCoordinateOffset(Coordinate.X));
+                                offset0 + ALineSerializerDeserializer.getEndPointCoordinateOffset(Coordinate.X));
                         double endY1 = ADoubleSerializerDeserializer.getDouble(bytes0,
-                                ALineSerializerDeserializer.getEndPointCoordinateOffset(Coordinate.Y));
+                                offset0 + ALineSerializerDeserializer.getEndPointCoordinateOffset(Coordinate.Y));
 
                         double x1 = ADoubleSerializerDeserializer.getDouble(bytes1,
-                                ARectangleSerializerDeserializer.getBottomLeftCoordinateOffset(Coordinate.X));
+                                offset1 + ARectangleSerializerDeserializer.getBottomLeftCoordinateOffset(Coordinate.X));
                         double y1 = ADoubleSerializerDeserializer.getDouble(bytes1,
-                                ARectangleSerializerDeserializer.getBottomLeftCoordinateOffset(Coordinate.Y));
+                                offset1 + ARectangleSerializerDeserializer.getBottomLeftCoordinateOffset(Coordinate.Y));
 
                         double x2 = ADoubleSerializerDeserializer.getDouble(bytes1,
-                                ARectangleSerializerDeserializer.getUpperRightCoordinateOffset(Coordinate.X));
+                                offset1 + ARectangleSerializerDeserializer.getUpperRightCoordinateOffset(Coordinate.X));
                         double y2 = ADoubleSerializerDeserializer.getDouble(bytes1,
-                                ARectangleSerializerDeserializer.getUpperRightCoordinateOffset(Coordinate.Y));
+                                offset1 + ARectangleSerializerDeserializer.getUpperRightCoordinateOffset(Coordinate.Y));
 
                         if (lineLineIntersection(startX1, startY1, endX1, endY1, x1, y1, x1, y2)
                                 || lineLineIntersection(startX1, startY1, endX1, endY1, x1, y2, x2, y2)
@@ -289,22 +296,23 @@
 
                     }
 
-                    private boolean lineCircleIntersection(byte[] bytes0, byte[] bytes1) throws HyracksDataException {
+                    private boolean lineCircleIntersection(byte[] bytes0, int offset0, byte[] bytes1, int offset1)
+                            throws HyracksDataException {
                         double startX = ADoubleSerializerDeserializer.getDouble(bytes0,
-                                ALineSerializerDeserializer.getStartPointCoordinateOffset(Coordinate.X));
+                                offset0 + ALineSerializerDeserializer.getStartPointCoordinateOffset(Coordinate.X));
                         double startY = ADoubleSerializerDeserializer.getDouble(bytes0,
-                                ALineSerializerDeserializer.getStartPointCoordinateOffset(Coordinate.Y));
+                                offset0 + ALineSerializerDeserializer.getStartPointCoordinateOffset(Coordinate.Y));
                         double endX = ADoubleSerializerDeserializer.getDouble(bytes0,
-                                ALineSerializerDeserializer.getEndPointCoordinateOffset(Coordinate.X));
+                                offset0 + ALineSerializerDeserializer.getEndPointCoordinateOffset(Coordinate.X));
                         double endY = ADoubleSerializerDeserializer.getDouble(bytes0,
-                                ALineSerializerDeserializer.getEndPointCoordinateOffset(Coordinate.Y));
+                                offset0 + ALineSerializerDeserializer.getEndPointCoordinateOffset(Coordinate.Y));
 
                         double cX = ADoubleSerializerDeserializer.getDouble(bytes1,
-                                ACircleSerializerDeserializer.getCenterPointCoordinateOffset(Coordinate.X));
+                                offset1 + ACircleSerializerDeserializer.getCenterPointCoordinateOffset(Coordinate.X));
                         double cY = ADoubleSerializerDeserializer.getDouble(bytes1,
-                                ACircleSerializerDeserializer.getCenterPointCoordinateOffset(Coordinate.Y));
+                                offset1 + ACircleSerializerDeserializer.getCenterPointCoordinateOffset(Coordinate.Y));
                         double radius = ADoubleSerializerDeserializer.getDouble(bytes1,
-                                ACircleSerializerDeserializer.getRadiusOffset());
+                                offset1 + ACircleSerializerDeserializer.getRadiusOffset());
 
                         double dx = endX - startX;
                         double dy = endY - startY;
@@ -325,25 +333,25 @@
                         return false;
                     }
 
-                    private boolean findEar(byte[] bytes, int u, int v, int w, int n, IntArray pointsOffsets)
-                            throws HyracksDataException {
+                    private boolean findEar(byte[] bytes, int offset, int u, int v, int w, int n,
+                            IntArray pointsOffsets) throws HyracksDataException {
                         int p;
                         double Ax, Ay, Bx, By, Cx, Cy, Px, Py;
 
-                        Ax = ADoubleSerializerDeserializer.getDouble(bytes,
-                                APolygonSerializerDeserializer.getCoordinateOffset(pointsOffsets.get(u), Coordinate.X));
-                        Ay = ADoubleSerializerDeserializer.getDouble(bytes,
-                                APolygonSerializerDeserializer.getCoordinateOffset(pointsOffsets.get(u), Coordinate.Y));
+                        Ax = ADoubleSerializerDeserializer.getDouble(bytes, offset + APolygonSerializerDeserializer
+                                .getCoordinateOffset(pointsOffsets.get(u), Coordinate.X));
+                        Ay = ADoubleSerializerDeserializer.getDouble(bytes, offset + APolygonSerializerDeserializer
+                                .getCoordinateOffset(pointsOffsets.get(u), Coordinate.Y));
 
-                        Bx = ADoubleSerializerDeserializer.getDouble(bytes,
-                                APolygonSerializerDeserializer.getCoordinateOffset(pointsOffsets.get(v), Coordinate.X));
-                        By = ADoubleSerializerDeserializer.getDouble(bytes,
-                                APolygonSerializerDeserializer.getCoordinateOffset(pointsOffsets.get(v), Coordinate.Y));
+                        Bx = ADoubleSerializerDeserializer.getDouble(bytes, offset + APolygonSerializerDeserializer
+                                .getCoordinateOffset(pointsOffsets.get(v), Coordinate.X));
+                        By = ADoubleSerializerDeserializer.getDouble(bytes, offset + APolygonSerializerDeserializer
+                                .getCoordinateOffset(pointsOffsets.get(v), Coordinate.Y));
 
-                        Cx = ADoubleSerializerDeserializer.getDouble(bytes,
-                                APolygonSerializerDeserializer.getCoordinateOffset(pointsOffsets.get(w), Coordinate.X));
-                        Cy = ADoubleSerializerDeserializer.getDouble(bytes,
-                                APolygonSerializerDeserializer.getCoordinateOffset(pointsOffsets.get(w), Coordinate.Y));
+                        Cx = ADoubleSerializerDeserializer.getDouble(bytes, offset + APolygonSerializerDeserializer
+                                .getCoordinateOffset(pointsOffsets.get(w), Coordinate.X));
+                        Cy = ADoubleSerializerDeserializer.getDouble(bytes, offset + APolygonSerializerDeserializer
+                                .getCoordinateOffset(pointsOffsets.get(w), Coordinate.Y));
 
                         if (SpatialUtils.doubleEpsilon() > (((Bx - Ax) * (Cy - Ay)) - ((By - Ay) * (Cx - Ax)))) {
 
@@ -354,9 +362,9 @@
                             if ((p == u) || (p == v) || (p == w)) {
                                 continue;
                             }
-                            Px = ADoubleSerializerDeserializer.getDouble(bytes, APolygonSerializerDeserializer
+                            Px = ADoubleSerializerDeserializer.getDouble(bytes, offset + APolygonSerializerDeserializer
                                     .getCoordinateOffset(pointsOffsets.get(p), Coordinate.X));
-                            Py = ADoubleSerializerDeserializer.getDouble(bytes, APolygonSerializerDeserializer
+                            Py = ADoubleSerializerDeserializer.getDouble(bytes, offset + APolygonSerializerDeserializer
                                     .getCoordinateOffset(pointsOffsets.get(p), Coordinate.Y));
                             if (pointInsideTriangle(Ax, Ay, Bx, By, Cx, Cy, Px, Py)) {
                                 return false;
@@ -366,7 +374,7 @@
                         return true;
                     }
 
-                    private int triangulatePolygon(byte[] bytes, int numOfPoints, IntArray pointsOffsets,
+                    private int triangulatePolygon(byte[] bytes, int offset, int numOfPoints, IntArray pointsOffsets,
                             DoubleArray trianglesX, DoubleArray trianglesY, int triangleId,
                             int nonSimplePolygonDetection, int middleVertex) throws HyracksDataException { // Ear clipping
 
@@ -394,34 +402,40 @@
                                 w = 0;
                             }
 
-                            if (findEar(bytes, u, v, w, numOfPoints, pointsOffsets)) {
+                            if (findEar(bytes, offset, u, v, w, numOfPoints, pointsOffsets)) {
                                 int s, t;
 
                                 addRectangle(trianglesX, trianglesY);
 
                                 SpatialUtils.setTriangleXCoordinate(trianglesX, triangleId, 0,
-                                        ADoubleSerializerDeserializer.getDouble(bytes, APolygonSerializerDeserializer
-                                                .getCoordinateOffset(pointsOffsets.get(u), Coordinate.X)));
+                                        ADoubleSerializerDeserializer.getDouble(bytes,
+                                                offset + APolygonSerializerDeserializer
+                                                        .getCoordinateOffset(pointsOffsets.get(u), Coordinate.X)));
 
                                 SpatialUtils.setTriangleYCoordinate(trianglesY, triangleId, 0,
-                                        ADoubleSerializerDeserializer.getDouble(bytes, APolygonSerializerDeserializer
-                                                .getCoordinateOffset(pointsOffsets.get(u), Coordinate.Y)));
+                                        ADoubleSerializerDeserializer.getDouble(bytes,
+                                                offset + APolygonSerializerDeserializer
+                                                        .getCoordinateOffset(pointsOffsets.get(u), Coordinate.Y)));
 
                                 SpatialUtils.setTriangleXCoordinate(trianglesX, triangleId, 1,
-                                        ADoubleSerializerDeserializer.getDouble(bytes, APolygonSerializerDeserializer
-                                                .getCoordinateOffset(pointsOffsets.get(v), Coordinate.X)));
+                                        ADoubleSerializerDeserializer.getDouble(bytes,
+                                                offset + APolygonSerializerDeserializer
+                                                        .getCoordinateOffset(pointsOffsets.get(v), Coordinate.X)));
 
                                 SpatialUtils.setTriangleYCoordinate(trianglesY, triangleId, 1,
-                                        ADoubleSerializerDeserializer.getDouble(bytes, APolygonSerializerDeserializer
-                                                .getCoordinateOffset(pointsOffsets.get(v), Coordinate.Y)));
+                                        ADoubleSerializerDeserializer.getDouble(bytes,
+                                                offset + APolygonSerializerDeserializer
+                                                        .getCoordinateOffset(pointsOffsets.get(v), Coordinate.Y)));
 
                                 SpatialUtils.setTriangleXCoordinate(trianglesX, triangleId, 2,
-                                        ADoubleSerializerDeserializer.getDouble(bytes, APolygonSerializerDeserializer
-                                                .getCoordinateOffset(pointsOffsets.get(w), Coordinate.X)));
+                                        ADoubleSerializerDeserializer.getDouble(bytes,
+                                                offset + APolygonSerializerDeserializer
+                                                        .getCoordinateOffset(pointsOffsets.get(w), Coordinate.X)));
 
                                 SpatialUtils.setTriangleYCoordinate(trianglesY, triangleId, 2,
-                                        ADoubleSerializerDeserializer.getDouble(bytes, APolygonSerializerDeserializer
-                                                .getCoordinateOffset(pointsOffsets.get(w), Coordinate.Y)));
+                                        ADoubleSerializerDeserializer.getDouble(bytes,
+                                                offset + APolygonSerializerDeserializer
+                                                        .getCoordinateOffset(pointsOffsets.get(w), Coordinate.Y)));
 
                                 // remove v from polygon
                                 for (s = v, t = v + 1; t < numOfPoints; s++, t++) {
@@ -470,15 +484,15 @@
                         return (cp1 * cp2) >= 0.0;
                     }
 
-                    private boolean circleTriangleIntersection(byte[] bytes0, DoubleArray trianglesX,
+                    private boolean circleTriangleIntersection(byte[] bytes0, int offset0, DoubleArray trianglesX,
                             DoubleArray trianglesY, int triangleId) throws HyracksDataException { // separating axis theorem
 
                         double cX = ADoubleSerializerDeserializer.getDouble(bytes0,
-                                ACircleSerializerDeserializer.getCenterPointCoordinateOffset(Coordinate.X));
+                                offset0 + ACircleSerializerDeserializer.getCenterPointCoordinateOffset(Coordinate.X));
                         double cY = ADoubleSerializerDeserializer.getDouble(bytes0,
-                                ACircleSerializerDeserializer.getCenterPointCoordinateOffset(Coordinate.Y));
+                                offset0 + ACircleSerializerDeserializer.getCenterPointCoordinateOffset(Coordinate.Y));
                         double radius = ADoubleSerializerDeserializer.getDouble(bytes0,
-                                ACircleSerializerDeserializer.getRadiusOffset());
+                                offset0 + ACircleSerializerDeserializer.getRadiusOffset());
 
                         double distance = Double.MAX_VALUE;
                         double distanceSquared;
@@ -537,20 +551,21 @@
                         return true;
                     }
 
-                    private boolean circleCircleIntersection(byte[] bytes0, byte[] bytes1) throws HyracksDataException {
+                    private boolean circleCircleIntersection(byte[] bytes0, int offset0, byte[] bytes1, int offset1)
+                            throws HyracksDataException {
                         double cX0 = ADoubleSerializerDeserializer.getDouble(bytes0,
-                                ACircleSerializerDeserializer.getCenterPointCoordinateOffset(Coordinate.X));
+                                offset0 + ACircleSerializerDeserializer.getCenterPointCoordinateOffset(Coordinate.X));
                         double cY0 = ADoubleSerializerDeserializer.getDouble(bytes0,
-                                ACircleSerializerDeserializer.getCenterPointCoordinateOffset(Coordinate.Y));
+                                offset0 + ACircleSerializerDeserializer.getCenterPointCoordinateOffset(Coordinate.Y));
                         double radius0 = ADoubleSerializerDeserializer.getDouble(bytes0,
-                                ACircleSerializerDeserializer.getRadiusOffset());
+                                offset0 + ACircleSerializerDeserializer.getRadiusOffset());
 
                         double cX1 = ADoubleSerializerDeserializer.getDouble(bytes1,
-                                ACircleSerializerDeserializer.getCenterPointCoordinateOffset(Coordinate.X));
+                                offset1 + ACircleSerializerDeserializer.getCenterPointCoordinateOffset(Coordinate.X));
                         double cY1 = ADoubleSerializerDeserializer.getDouble(bytes1,
-                                ACircleSerializerDeserializer.getCenterPointCoordinateOffset(Coordinate.Y));
+                                offset1 + ACircleSerializerDeserializer.getCenterPointCoordinateOffset(Coordinate.Y));
                         double radius1 = ADoubleSerializerDeserializer.getDouble(bytes1,
-                                ACircleSerializerDeserializer.getRadiusOffset());
+                                offset1 + ACircleSerializerDeserializer.getRadiusOffset());
 
                         double distanceSquared = SpatialUtils.dotProduct(cX0 - cX1, cY0 - cY1, cX0 - cX1, cY0 - cY1);
                         double radiusDistanceSquared = (radius0 + radius1) * (radius0 + radius1);
@@ -560,10 +575,10 @@
                         return false;
                     }
 
-                    private void getCounterClockWisePolygon(byte[] bytes, IntArray pointsOffsets, int numOfPoints)
-                            throws HyracksDataException {
+                    private void getCounterClockWisePolygon(byte[] bytes, int offset, IntArray pointsOffsets,
+                            int numOfPoints) throws HyracksDataException {
                         pointsOffsets.reset();
-                        if (SpatialUtils.polygonArea(bytes, numOfPoints) > 0.0) {
+                        if (SpatialUtils.polygonArea(bytes, offset, numOfPoints) > 0.0) {
                             for (int i = 0; i < numOfPoints; i++) {
                                 pointsOffsets.add(i);
                             }
@@ -574,22 +589,23 @@
                         }
                     }
 
-                    private boolean pointInRectangle(byte[] bytes0, byte[] bytes1) throws HyracksDataException {
+                    private boolean pointInRectangle(byte[] bytes0, int offset0, byte[] bytes1, int offset1)
+                            throws HyracksDataException {
 
                         double pX = ADoubleSerializerDeserializer.getDouble(bytes0,
-                                APointSerializerDeserializer.getCoordinateOffset(Coordinate.X));
+                                offset0 + APointSerializerDeserializer.getCoordinateOffset(Coordinate.X));
                         double pY = ADoubleSerializerDeserializer.getDouble(bytes0,
-                                APointSerializerDeserializer.getCoordinateOffset(Coordinate.Y));
+                                offset0 + APointSerializerDeserializer.getCoordinateOffset(Coordinate.Y));
 
                         double x1 = ADoubleSerializerDeserializer.getDouble(bytes1,
-                                ARectangleSerializerDeserializer.getBottomLeftCoordinateOffset(Coordinate.X));
+                                offset1 + ARectangleSerializerDeserializer.getBottomLeftCoordinateOffset(Coordinate.X));
                         double y1 = ADoubleSerializerDeserializer.getDouble(bytes1,
-                                ARectangleSerializerDeserializer.getBottomLeftCoordinateOffset(Coordinate.Y));
+                                offset1 + ARectangleSerializerDeserializer.getBottomLeftCoordinateOffset(Coordinate.Y));
 
                         double x2 = ADoubleSerializerDeserializer.getDouble(bytes1,
-                                ARectangleSerializerDeserializer.getUpperRightCoordinateOffset(Coordinate.X));
+                                offset1 + ARectangleSerializerDeserializer.getUpperRightCoordinateOffset(Coordinate.X));
                         double y2 = ADoubleSerializerDeserializer.getDouble(bytes1,
-                                ARectangleSerializerDeserializer.getUpperRightCoordinateOffset(Coordinate.Y));
+                                offset1 + ARectangleSerializerDeserializer.getUpperRightCoordinateOffset(Coordinate.Y));
 
                         if (pointInsideTriangle(x1, y1, x1, y2, x2, y2, pX, pY)
                                 || pointInsideTriangle(x1, y1, x2, y1, x2, y2, pX, pY)) {
@@ -607,13 +623,13 @@
                         }
                     }
 
-                    private boolean rectangleCircleIntersection(byte[] bytes0, byte[] bytes1)
+                    private boolean rectangleCircleIntersection(byte[] bytes0, int offset0, byte[] bytes1, int offset1)
                             throws HyracksDataException {
-                        triangulateRectangle(bytes0, trianglesX0, trianglesY0);
+                        triangulateRectangle(bytes0, offset0, trianglesX0, trianglesY0);
                         boolean res = false;
                         // 2 triangles in a rectangle
                         for (int i = 0; i < 2; i++) {
-                            res = circleTriangleIntersection(bytes1, trianglesX0, trianglesY0, i);
+                            res = circleTriangleIntersection(bytes1, offset1, trianglesX0, trianglesY0, i);
                             if (res) {
                                 break;
                             }
@@ -621,17 +637,17 @@
                         return res;
                     }
 
-                    private void triangulateRectangle(byte[] bytes, DoubleArray trianglesX, DoubleArray trianglesY)
-                            throws HyracksDataException {
+                    private void triangulateRectangle(byte[] bytes, int offset, DoubleArray trianglesX,
+                            DoubleArray trianglesY) throws HyracksDataException {
                         double x1 = ADoubleSerializerDeserializer.getDouble(bytes,
-                                ARectangleSerializerDeserializer.getBottomLeftCoordinateOffset(Coordinate.X));
+                                offset + ARectangleSerializerDeserializer.getBottomLeftCoordinateOffset(Coordinate.X));
                         double y1 = ADoubleSerializerDeserializer.getDouble(bytes,
-                                ARectangleSerializerDeserializer.getBottomLeftCoordinateOffset(Coordinate.Y));
+                                offset + ARectangleSerializerDeserializer.getBottomLeftCoordinateOffset(Coordinate.Y));
 
                         double x2 = ADoubleSerializerDeserializer.getDouble(bytes,
-                                ARectangleSerializerDeserializer.getUpperRightCoordinateOffset(Coordinate.X));
+                                offset + ARectangleSerializerDeserializer.getUpperRightCoordinateOffset(Coordinate.X));
                         double y2 = ADoubleSerializerDeserializer.getDouble(bytes,
-                                ARectangleSerializerDeserializer.getUpperRightCoordinateOffset(Coordinate.Y));
+                                offset + ARectangleSerializerDeserializer.getUpperRightCoordinateOffset(Coordinate.Y));
                         trianglesX.reset();
                         trianglesY.reset();
 
@@ -657,17 +673,17 @@
                         SpatialUtils.setTriangleYCoordinate(trianglesY, 1, 2, y1);
                     }
 
-                    private boolean rectanglePolygonIntersection(byte[] bytes0, byte[] bytes1)
+                    private boolean rectanglePolygonIntersection(byte[] bytes0, int offset0, byte[] bytes1, int offset1)
                             throws HyracksDataException, AlgebricksException {
                         int numOfPoints1 = AInt16SerializerDeserializer.getShort(bytes1,
-                                APolygonSerializerDeserializer.getNumberOfPointsOffset());
+                                offset1 + APolygonSerializerDeserializer.getNumberOfPointsOffset());
 
                         if (numOfPoints1 < 3) {
                             throw new HyracksDataException(AsterixBuiltinFunctions.SPATIAL_INTERSECT.getName()
                                     + ": polygon must have at least 3 points.");
                         }
 
-                        getCounterClockWisePolygon(bytes1, pointsOffsets1, numOfPoints1);
+                        getCounterClockWisePolygon(bytes1, offset1, pointsOffsets1, numOfPoints1);
                         int nonSimplePolygonDetection1 = 2 * numOfPoints1;
                         int middleVertex1 = numOfPoints1 - 1;
                         int numOfTriangles1 = 0;
@@ -675,8 +691,9 @@
                         trianglesX1.reset();
                         trianglesY1.reset();
                         while (true) {
-                            middleVertex1 = triangulatePolygon(bytes1, numOfPoints1, pointsOffsets1, trianglesX1,
-                                    trianglesY1, numOfTriangles1, nonSimplePolygonDetection1, middleVertex1);
+                            middleVertex1 = triangulatePolygon(bytes1, offset1, numOfPoints1, pointsOffsets1,
+                                    trianglesX1, trianglesY1, numOfTriangles1, nonSimplePolygonDetection1,
+                                    middleVertex1);
 
                             if (middleVertex1 == -1) {
                                 break;
@@ -687,7 +704,7 @@
                             numOfTriangles1++;
                         }
 
-                        triangulateRectangle(bytes0, trianglesX0, trianglesY0);
+                        triangulateRectangle(bytes0, offset0, trianglesX0, trianglesY0);
                         boolean res = false;
                         // 2 triangles in a rectangle
                         for (int j = 0; j < 2; j++) {
@@ -709,17 +726,17 @@
                         return false;
                     }
 
-                    private boolean polygonCircleIntersection(byte[] bytes0, byte[] bytes1)
+                    private boolean polygonCircleIntersection(byte[] bytes0, int offset0, byte[] bytes1, int offset1)
                             throws HyracksDataException, AlgebricksException {
                         int numOfPoints = AInt16SerializerDeserializer.getShort(bytes0,
-                                APolygonSerializerDeserializer.getNumberOfPointsOffset());
+                                offset0 + APolygonSerializerDeserializer.getNumberOfPointsOffset());
 
                         if (numOfPoints < 3) {
                             throw new HyracksDataException(AsterixBuiltinFunctions.SPATIAL_INTERSECT.getName()
                                     + ": polygon must have at least 3 points.");
                         }
 
-                        getCounterClockWisePolygon(bytes0, pointsOffsets0, numOfPoints);
+                        getCounterClockWisePolygon(bytes0, offset0, pointsOffsets0, numOfPoints);
                         int nonSimplePolygonDetection = 2 * numOfPoints;
                         int middleVertex = numOfPoints - 1;
                         int numOfTriangles = 0;
@@ -728,7 +745,7 @@
                         trianglesY0.reset();
                         boolean res = false;
                         while (true) {
-                            middleVertex = triangulatePolygon(bytes0, numOfPoints, pointsOffsets0, trianglesX0,
+                            middleVertex = triangulatePolygon(bytes0, offset0, numOfPoints, pointsOffsets0, trianglesX0,
                                     trianglesY0, numOfTriangles, nonSimplePolygonDetection, middleVertex);
 
                             if (middleVertex == -1) {
@@ -739,7 +756,7 @@
                             numOfTriangles++;
                             int lastTriangle = (trianglesX0.length() / 3) - 1;
 
-                            res = circleTriangleIntersection(bytes1, trianglesX0, trianglesY0, lastTriangle);
+                            res = circleTriangleIntersection(bytes1, offset1, trianglesX0, trianglesY0, lastTriangle);
                             if (res) {
                                 return true;
                             }
@@ -748,73 +765,70 @@
                     }
 
                     @Override
-                    public void evaluate(IFrameTupleReference tuple) throws AlgebricksException {
-                        outInput0.reset();
-                        eval0.evaluate(tuple);
-                        outInput1.reset();
-                        eval1.evaluate(tuple);
+                    public void evaluate(IFrameTupleReference tuple, IPointable result) throws AlgebricksException {
+                        resultStorage.reset();
+                        eval0.evaluate(tuple, inputArg0);
+                        eval1.evaluate(tuple, inputArg1);
+
+                        byte[] bytes0 = inputArg0.getByteArray();
+                        byte[] bytes1 = inputArg1.getByteArray();
+                        int offset0 = inputArg0.getStartOffset();
+                        int offset1 = inputArg1.getStartOffset();
 
                         try {
                             boolean res = false;
-                            ATypeTag tag0 = EnumDeserializer.ATYPETAGDESERIALIZER
-                                    .deserialize(outInput0.getByteArray()[0]);
-                            ATypeTag tag1 = EnumDeserializer.ATYPETAGDESERIALIZER
-                                    .deserialize(outInput1.getByteArray()[0]);
+                            ATypeTag tag0 = EnumDeserializer.ATYPETAGDESERIALIZER.deserialize(bytes0[offset0]);
+                            ATypeTag tag1 = EnumDeserializer.ATYPETAGDESERIALIZER.deserialize(bytes1[offset1]);
 
                             switch (tag0) {
                                 case POINT:
                                     switch (tag1) {
                                         case POINT:
-                                            if (ascDoubleComp
-                                                    .compare(outInput0.getByteArray(),
-                                                            APointSerializerDeserializer.getCoordinateOffset(
-                                                                    Coordinate.X),
-                                                            8, outInput1.getByteArray(), APointSerializerDeserializer
-                                                                    .getCoordinateOffset(Coordinate.X),
-                                                            8) == 0) {
-                                                if (ascDoubleComp
-                                                        .compare(outInput0.getByteArray(),
-                                                                APointSerializerDeserializer.getCoordinateOffset(
-                                                                        Coordinate.Y),
-                                                                8, outInput1.getByteArray(),
-                                                                APointSerializerDeserializer
-                                                                        .getCoordinateOffset(Coordinate.Y),
-                                                                8) == 0) {
+                                            if (ascDoubleComp.compare(bytes0,
+                                                    offset0 + APointSerializerDeserializer
+                                                            .getCoordinateOffset(Coordinate.X),
+                                                    8, bytes1, offset1 + APointSerializerDeserializer
+                                                            .getCoordinateOffset(Coordinate.X),
+                                                    8) == 0) {
+                                                if (ascDoubleComp.compare(bytes0,
+                                                        offset0 + APointSerializerDeserializer
+                                                                .getCoordinateOffset(Coordinate.Y),
+                                                        8, bytes1, offset1 + APointSerializerDeserializer
+                                                                .getCoordinateOffset(Coordinate.Y),
+                                                        8) == 0) {
                                                     res = true;
                                                 }
                                             }
                                             break;
                                         case LINE:
-                                            double pX = ADoubleSerializerDeserializer.getDouble(
-                                                    outInput0.getByteArray(),
-                                                    APointSerializerDeserializer.getCoordinateOffset(Coordinate.X));
-                                            double pY = ADoubleSerializerDeserializer.getDouble(
-                                                    outInput0.getByteArray(),
-                                                    APointSerializerDeserializer.getCoordinateOffset(Coordinate.Y));
+                                            double pX = ADoubleSerializerDeserializer.getDouble(bytes0, offset0
+                                                    + APointSerializerDeserializer.getCoordinateOffset(Coordinate.X));
+                                            double pY = ADoubleSerializerDeserializer.getDouble(bytes0, offset0
+                                                    + APointSerializerDeserializer.getCoordinateOffset(Coordinate.Y));
 
-                                            double startX = ADoubleSerializerDeserializer
-                                                    .getDouble(outInput1.getByteArray(), ALineSerializerDeserializer
+                                            double startX = ADoubleSerializerDeserializer.getDouble(bytes1,
+                                                    offset1 + ALineSerializerDeserializer
                                                             .getStartPointCoordinateOffset(Coordinate.X));
-                                            double startY = ADoubleSerializerDeserializer
-                                                    .getDouble(outInput1.getByteArray(), ALineSerializerDeserializer
+                                            double startY = ADoubleSerializerDeserializer.getDouble(bytes1,
+                                                    offset1 + ALineSerializerDeserializer
                                                             .getStartPointCoordinateOffset(Coordinate.Y));
-                                            double endX = ADoubleSerializerDeserializer
-                                                    .getDouble(outInput1.getByteArray(), ALineSerializerDeserializer
+                                            double endX = ADoubleSerializerDeserializer.getDouble(bytes1,
+                                                    offset1 + ALineSerializerDeserializer
                                                             .getEndPointCoordinateOffset(Coordinate.X));
-                                            double endY = ADoubleSerializerDeserializer
-                                                    .getDouble(outInput1.getByteArray(), ALineSerializerDeserializer
+                                            double endY = ADoubleSerializerDeserializer.getDouble(bytes1,
+                                                    offset1 + ALineSerializerDeserializer
                                                             .getEndPointCoordinateOffset(Coordinate.Y));
 
                                             res = pointOnLine(pX, pY, startX, startY, endX, endY);
                                             break;
                                         case POLYGON:
-                                            res = pointInPolygon(outInput0.getByteArray(), outInput1.getByteArray());
+                                            res = pointInPolygon(bytes0, offset0, bytes1, offset1);
                                             break;
                                         case CIRCLE:
-                                            res = pointInCircle(outInput0.getByteArray(), outInput1.getByteArray());
+                                            res = pointInCircle(bytes0, offset0, bytes1, offset1);
                                             break;
                                         case RECTANGLE:
-                                            res = pointInRectangle(outInput0.getByteArray(), outInput1.getByteArray());
+                                            res = pointInRectangle(bytes0, offset0, bytes1, offset1);
                                             break;
                                         case NULL:
                                             res = false;
@@ -828,68 +842,63 @@
                                 case LINE:
                                     switch (tag1) {
                                         case POINT:
-                                            double pX = ADoubleSerializerDeserializer.getDouble(
-                                                    outInput1.getByteArray(),
-                                                    APointSerializerDeserializer.getCoordinateOffset(Coordinate.X));
-                                            double pY = ADoubleSerializerDeserializer.getDouble(
-                                                    outInput1.getByteArray(),
-                                                    APointSerializerDeserializer.getCoordinateOffset(Coordinate.Y));
+                                            double pX = ADoubleSerializerDeserializer.getDouble(bytes1, offset1
+                                                    + APointSerializerDeserializer.getCoordinateOffset(Coordinate.X));
+                                            double pY = ADoubleSerializerDeserializer.getDouble(bytes1, offset1
+                                                    + APointSerializerDeserializer.getCoordinateOffset(Coordinate.Y));
 
-                                            double startX = ADoubleSerializerDeserializer
-                                                    .getDouble(outInput0.getByteArray(), ALineSerializerDeserializer
+                                            double startX = ADoubleSerializerDeserializer.getDouble(bytes0,
+                                                    offset0 + ALineSerializerDeserializer
                                                             .getStartPointCoordinateOffset(Coordinate.X));
-                                            double startY = ADoubleSerializerDeserializer
-                                                    .getDouble(outInput0.getByteArray(), ALineSerializerDeserializer
+                                            double startY = ADoubleSerializerDeserializer.getDouble(bytes0,
+                                                    offset0 + ALineSerializerDeserializer
                                                             .getStartPointCoordinateOffset(Coordinate.Y));
-                                            double endX = ADoubleSerializerDeserializer
-                                                    .getDouble(outInput0.getByteArray(), ALineSerializerDeserializer
+                                            double endX = ADoubleSerializerDeserializer.getDouble(bytes0,
+                                                    offset0 + ALineSerializerDeserializer
                                                             .getEndPointCoordinateOffset(Coordinate.X));
-                                            double endY = ADoubleSerializerDeserializer
-                                                    .getDouble(outInput0.getByteArray(), ALineSerializerDeserializer
+                                            double endY = ADoubleSerializerDeserializer.getDouble(bytes0,
+                                                    offset0 + ALineSerializerDeserializer
                                                             .getEndPointCoordinateOffset(Coordinate.Y));
 
                                             res = pointOnLine(pX, pY, startX, startY, endX, endY);
                                             break;
                                         case LINE:
-                                            double startX1 = ADoubleSerializerDeserializer
-                                                    .getDouble(outInput0.getByteArray(), ALineSerializerDeserializer
+                                            double startX1 = ADoubleSerializerDeserializer.getDouble(bytes0,
+                                                    offset0 + ALineSerializerDeserializer
                                                             .getStartPointCoordinateOffset(Coordinate.X));
-                                            double startY1 = ADoubleSerializerDeserializer
-                                                    .getDouble(outInput0.getByteArray(), ALineSerializerDeserializer
+                                            double startY1 = ADoubleSerializerDeserializer.getDouble(bytes0,
+                                                    offset0 + ALineSerializerDeserializer
                                                             .getStartPointCoordinateOffset(Coordinate.Y));
-                                            double endX1 = ADoubleSerializerDeserializer
-                                                    .getDouble(outInput0.getByteArray(), ALineSerializerDeserializer
+                                            double endX1 = ADoubleSerializerDeserializer.getDouble(bytes0,
+                                                    offset0 + ALineSerializerDeserializer
                                                             .getEndPointCoordinateOffset(Coordinate.X));
-                                            double endY1 = ADoubleSerializerDeserializer
-                                                    .getDouble(outInput0.getByteArray(), ALineSerializerDeserializer
+                                            double endY1 = ADoubleSerializerDeserializer.getDouble(bytes0,
+                                                    offset0 + ALineSerializerDeserializer
                                                             .getEndPointCoordinateOffset(Coordinate.Y));
 
-                                            double startX2 = ADoubleSerializerDeserializer
-                                                    .getDouble(outInput1.getByteArray(), ALineSerializerDeserializer
+                                            double startX2 = ADoubleSerializerDeserializer.getDouble(bytes1,
+                                                    offset1 + ALineSerializerDeserializer
                                                             .getStartPointCoordinateOffset(Coordinate.X));
-                                            double startY2 = ADoubleSerializerDeserializer
-                                                    .getDouble(outInput1.getByteArray(), ALineSerializerDeserializer
+                                            double startY2 = ADoubleSerializerDeserializer.getDouble(bytes1,
+                                                    offset1 + ALineSerializerDeserializer
                                                             .getStartPointCoordinateOffset(Coordinate.Y));
-                                            double endX2 = ADoubleSerializerDeserializer
-                                                    .getDouble(outInput1.getByteArray(), ALineSerializerDeserializer
+                                            double endX2 = ADoubleSerializerDeserializer.getDouble(bytes1,
+                                                    offset1 + ALineSerializerDeserializer
                                                             .getEndPointCoordinateOffset(Coordinate.X));
-                                            double endY2 = ADoubleSerializerDeserializer
-                                                    .getDouble(outInput1.getByteArray(), ALineSerializerDeserializer
+                                            double endY2 = ADoubleSerializerDeserializer.getDouble(bytes1,
+                                                    offset1 + ALineSerializerDeserializer
                                                             .getEndPointCoordinateOffset(Coordinate.Y));
                                             res = lineLineIntersection(startX1, startY1, endX1, endY1, startX2, startY2,
                                                     endX2, endY2);
                                             break;
                                         case POLYGON:
-                                            res = linePolygonIntersection(outInput0.getByteArray(),
-                                                    outInput1.getByteArray());
+                                            res = linePolygonIntersection(bytes0, offset0, bytes1, offset1);
                                             break;
                                         case CIRCLE:
-                                            res = lineCircleIntersection(outInput0.getByteArray(),
-                                                    outInput1.getByteArray());
+                                            res = lineCircleIntersection(bytes0, offset0, bytes1, offset1);
                                             break;
                                         case RECTANGLE:
-                                            res = lineRectangleIntersection(outInput0.getByteArray(),
-                                                    outInput1.getByteArray());
+                                            res = lineRectangleIntersection(bytes0, offset0, bytes1, offset1);
                                             break;
                                         case NULL:
                                             res = false;
@@ -903,28 +912,23 @@
                                 case POLYGON:
                                     switch (tag1) {
                                         case POINT:
-                                            res = pointInPolygon(outInput1.getByteArray(), outInput0.getByteArray());
+                                            res = pointInPolygon(bytes1, offset1, bytes0, offset0);
                                             break;
                                         case LINE:
-                                            res = linePolygonIntersection(outInput1.getByteArray(),
-                                                    outInput0.getByteArray());
+                                            res = linePolygonIntersection(bytes1, offset1, bytes0, offset0);
                                             break;
                                         case POLYGON:
-                                            int numOfPoints0 = AInt16SerializerDeserializer.getShort(
-                                                    outInput0.getByteArray(),
-                                                    APolygonSerializerDeserializer.getNumberOfPointsOffset());
-                                            int numOfPoints1 = AInt16SerializerDeserializer.getShort(
-                                                    outInput1.getByteArray(),
-                                                    APolygonSerializerDeserializer.getNumberOfPointsOffset());
+                                            int numOfPoints0 = AInt16SerializerDeserializer.getShort(bytes0,
+                                                    offset0 + APolygonSerializerDeserializer.getNumberOfPointsOffset());
+                                            int numOfPoints1 = AInt16SerializerDeserializer.getShort(bytes1,
+                                                    offset1 + APolygonSerializerDeserializer.getNumberOfPointsOffset());
 
                                             if (numOfPoints0 < 3 || numOfPoints1 < 3) {
                                                 throw new AlgebricksException("Polygon must have at least 3 points.");
                                             }
 
-                                            getCounterClockWisePolygon(outInput0.getByteArray(), pointsOffsets0,
-                                                    numOfPoints0);
-                                            getCounterClockWisePolygon(outInput1.getByteArray(), pointsOffsets1,
-                                                    numOfPoints1);
+                                            getCounterClockWisePolygon(bytes0, offset0, pointsOffsets0, numOfPoints0);
+                                            getCounterClockWisePolygon(bytes1, offset1, pointsOffsets1, numOfPoints1);
                                             int nonSimplePolygonDetection0 = 2 * numOfPoints0;
                                             int nonSimplePolygonDetection1 = 2 * numOfPoints1;
                                             boolean intersect = false;
@@ -935,9 +939,9 @@
                                             trianglesX1.reset();
                                             trianglesY1.reset();
                                             while (true) {
-                                                middleVertex1 = triangulatePolygon(outInput1.getByteArray(),
-                                                        numOfPoints1, pointsOffsets1, trianglesX1, trianglesY1,
-                                                        numOfTriangles1, nonSimplePolygonDetection1, middleVertex1);
+                                                middleVertex1 = triangulatePolygon(bytes1, offset1, numOfPoints1,
+                                                        pointsOffsets1, trianglesX1, trianglesY1, numOfTriangles1,
+                                                        nonSimplePolygonDetection1, middleVertex1);
 
                                                 if (middleVertex1 == -1) {
                                                     break;
@@ -951,9 +955,9 @@
                                             trianglesX0.reset();
                                             trianglesY0.reset();
                                             while (true) {
-                                                middleVertex0 = triangulatePolygon(outInput0.getByteArray(),
-                                                        numOfPoints0, pointsOffsets0, trianglesX0, trianglesY0,
-                                                        numOfTriangles0, nonSimplePolygonDetection0, middleVertex0);
+                                                middleVertex0 = triangulatePolygon(bytes0, offset0, numOfPoints0,
+                                                        pointsOffsets0, trianglesX0, trianglesY0, numOfTriangles0,
+                                                        nonSimplePolygonDetection0, middleVertex0);
 
                                                 if (middleVertex0 == -1) {
                                                     break;
@@ -984,12 +988,10 @@
                                             }
                                             break;
                                         case CIRCLE:
-                                            res = polygonCircleIntersection(outInput0.getByteArray(),
-                                                    outInput1.getByteArray());
+                                            res = polygonCircleIntersection(bytes0, offset0, bytes1, offset1);
                                             break;
                                         case RECTANGLE:
-                                            res = rectanglePolygonIntersection(outInput1.getByteArray(),
-                                                    outInput0.getByteArray());
+                                            res = rectanglePolygonIntersection(bytes1, offset1, bytes0, offset0);
                                             break;
                                         case NULL:
                                             res = false;
@@ -1003,23 +1005,19 @@
                                 case CIRCLE:
                                     switch (tag1) {
                                         case POINT:
-                                            res = pointInCircle(outInput1.getByteArray(), outInput0.getByteArray());
+                                            res = pointInCircle(bytes0, offset0, bytes1, offset1);
                                             break;
                                         case LINE:
-                                            res = lineCircleIntersection(outInput1.getByteArray(),
-                                                    outInput0.getByteArray());
+                                            res = lineCircleIntersection(bytes1, offset1, bytes0, offset0);
                                             break;
                                         case POLYGON:
-                                            res = polygonCircleIntersection(outInput1.getByteArray(),
-                                                    outInput0.getByteArray());
+                                            res = polygonCircleIntersection(bytes1, offset1, bytes0, offset0);
                                             break;
                                         case CIRCLE:
-                                            res = circleCircleIntersection(outInput0.getByteArray(),
-                                                    outInput1.getByteArray());
+                                            res = circleCircleIntersection(bytes0, offset0, bytes1, offset1);
                                             break;
                                         case RECTANGLE:
-                                            res = rectangleCircleIntersection(outInput1.getByteArray(),
-                                                    outInput0.getByteArray());
+                                            res = rectangleCircleIntersection(bytes1, offset1, bytes0, offset0);
                                             break;
                                         case NULL:
                                             res = false;
@@ -1033,23 +1031,20 @@
                                 case RECTANGLE:
                                     switch (tag1) {
                                         case POINT:
-                                            res = pointInRectangle(outInput1.getByteArray(), outInput0.getByteArray());
+                                            res = pointInRectangle(bytes1, offset1, bytes0, offset0);
                                             break;
                                         case LINE:
-                                            res = lineRectangleIntersection(outInput1.getByteArray(),
-                                                    outInput0.getByteArray());
+                                            res = lineRectangleIntersection(bytes1, offset1, bytes0, offset0);
                                             break;
                                         case POLYGON:
-                                            res = rectanglePolygonIntersection(outInput0.getByteArray(),
-                                                    outInput1.getByteArray());
+                                            res = rectanglePolygonIntersection(bytes0, offset0, bytes1, offset1);
                                             break;
                                         case CIRCLE:
-                                            res = rectangleCircleIntersection(outInput0.getByteArray(),
-                                                    outInput1.getByteArray());
+                                            res = rectangleCircleIntersection(bytes0, offset0, bytes1, offset1);
                                             break;
                                         case RECTANGLE:
-                                            triangulateRectangle(outInput0.getByteArray(), trianglesX0, trianglesY0);
-                                            triangulateRectangle(outInput1.getByteArray(), trianglesX1, trianglesY1);
+                                            triangulateRectangle(bytes0, offset0, trianglesX0, trianglesY0);
+                                            triangulateRectangle(bytes1, offset1, trianglesX1, trianglesY1);
 
                                             boolean intersect = false;
                                             // 2 triangles in a rectangle
@@ -1097,6 +1092,7 @@
                         } catch (HyracksDataException hde) {
                             throw new AlgebricksException(hde);
                         }
+                        result.set(resultStorage);
                     }
                 };
             }
diff --git a/asterix-runtime/src/main/java/org/apache/asterix/runtime/evaluators/functions/StringConcatDescriptor.java b/asterix-runtime/src/main/java/org/apache/asterix/runtime/evaluators/functions/StringConcatDescriptor.java
index 52734b2..07a79c4 100644
--- a/asterix-runtime/src/main/java/org/apache/asterix/runtime/evaluators/functions/StringConcatDescriptor.java
+++ b/asterix-runtime/src/main/java/org/apache/asterix/runtime/evaluators/functions/StringConcatDescriptor.java
@@ -34,10 +34,12 @@
 import org.apache.asterix.runtime.evaluators.common.AsterixListAccessor;
 import org.apache.hyracks.algebricks.common.exceptions.AlgebricksException;
 import org.apache.hyracks.algebricks.core.algebra.functions.FunctionIdentifier;
-import org.apache.hyracks.algebricks.runtime.base.ICopyEvaluator;
-import org.apache.hyracks.algebricks.runtime.base.ICopyEvaluatorFactory;
+import org.apache.hyracks.algebricks.runtime.base.IScalarEvaluator;
+import org.apache.hyracks.algebricks.runtime.base.IScalarEvaluatorFactory;
+import org.apache.hyracks.api.context.IHyracksTaskContext;
 import org.apache.hyracks.api.dataflow.value.ISerializerDeserializer;
-import org.apache.hyracks.data.std.api.IDataOutputProvider;
+import org.apache.hyracks.data.std.api.IPointable;
+import org.apache.hyracks.data.std.primitive.VoidPointable;
 import org.apache.hyracks.data.std.util.ArrayBackedValueStorage;
 import org.apache.hyracks.dataflow.common.data.accessors.IFrameTupleReference;
 import org.apache.hyracks.util.string.UTF8StringUtil;
@@ -53,39 +55,42 @@
     };
 
     @Override
-    public ICopyEvaluatorFactory createEvaluatorFactory(final ICopyEvaluatorFactory[] args) {
-        return new ICopyEvaluatorFactory() {
+    public IScalarEvaluatorFactory createEvaluatorFactory(final IScalarEvaluatorFactory[] args) {
+        return new IScalarEvaluatorFactory() {
 
             private static final long serialVersionUID = 1L;
 
             @Override
-            public ICopyEvaluator createEvaluator(final IDataOutputProvider output) throws AlgebricksException {
-                return new ICopyEvaluator() {
+            public IScalarEvaluator createScalarEvaluator(final IHyracksTaskContext ctx) throws AlgebricksException {
+                return new IScalarEvaluator() {
 
+                    private final ArrayBackedValueStorage resultStorage = new ArrayBackedValueStorage();
                     private final AsterixListAccessor listAccessor = new AsterixListAccessor();
-                    private final DataOutput out = output.getDataOutput();
-                    private final ICopyEvaluatorFactory listEvalFactory = args[0];
-                    private final ArrayBackedValueStorage outInputList = new ArrayBackedValueStorage();
-                    private final ICopyEvaluator evalList = listEvalFactory.createEvaluator(outInputList);
+                    private final DataOutput out = resultStorage.getDataOutput();
+                    private final IScalarEvaluatorFactory listEvalFactory = args[0];
+                    private final IPointable inputArgList = new VoidPointable();
+                    private final IScalarEvaluator evalList = listEvalFactory.createScalarEvaluator(ctx);
                     @SuppressWarnings("unchecked")
                     private ISerializerDeserializer<ANull> nullSerde = AqlSerializerDeserializerProvider.INSTANCE
                             .getSerializerDeserializer(BuiltinType.ANULL);
                     private final byte[] tempLengthArray = new byte[5];
 
                     @Override
-                    public void evaluate(IFrameTupleReference tuple) throws AlgebricksException {
+                    public void evaluate(IFrameTupleReference tuple, IPointable result) throws AlgebricksException {
+                        resultStorage.reset();
                         try {
-                            outInputList.reset();
-                            evalList.evaluate(tuple);
-                            byte[] listBytes = outInputList.getByteArray();
-                            if (listBytes[0] != ATypeTag.SERIALIZED_ORDEREDLIST_TYPE_TAG
-                                    && listBytes[0] != ATypeTag.SERIALIZED_UNORDEREDLIST_TYPE_TAG) {
+                            evalList.evaluate(tuple, inputArgList);
+                            byte[] listBytes = inputArgList.getByteArray();
+                            int listOffset = inputArgList.getStartOffset();
+
+                            if (listBytes[listOffset] != ATypeTag.SERIALIZED_ORDEREDLIST_TYPE_TAG
+                                    && listBytes[listOffset] != ATypeTag.SERIALIZED_UNORDEREDLIST_TYPE_TAG) {
                                 throw new AlgebricksException(AsterixBuiltinFunctions.STRING_CONCAT.getName()
                                         + ": expects input type ORDEREDLIST/UNORDEREDLIST, but got "
-                                        + EnumDeserializer.ATYPETAGDESERIALIZER.deserialize(listBytes[0]));
+                                        + EnumDeserializer.ATYPETAGDESERIALIZER.deserialize(listBytes[listOffset]));
                             }
                             try {
-                                listAccessor.reset(listBytes, 0);
+                                listAccessor.reset(listBytes, listOffset);
                             } catch (AsterixException e) {
                                 throw new AlgebricksException(e);
                             }
@@ -103,6 +108,7 @@
                                     if (itemType != ATypeTag.STRING) {
                                         if (itemType == ATypeTag.NULL) {
                                             nullSerde.serialize(ANull.NULL, out);
+                                            result.set(resultStorage);
                                             return;
                                         }
                                         throw new AlgebricksException(AsterixBuiltinFunctions.STRING_CONCAT.getName()
@@ -129,6 +135,7 @@
                         } catch (IOException e1) {
                             throw new AlgebricksException(e1.getMessage());
                         }
+                        result.set(resultStorage);
                     }
                 };
             }
diff --git a/asterix-runtime/src/main/java/org/apache/asterix/runtime/evaluators/functions/StringContainsDescriptor.java b/asterix-runtime/src/main/java/org/apache/asterix/runtime/evaluators/functions/StringContainsDescriptor.java
index 2825630..941a84c 100644
--- a/asterix-runtime/src/main/java/org/apache/asterix/runtime/evaluators/functions/StringContainsDescriptor.java
+++ b/asterix-runtime/src/main/java/org/apache/asterix/runtime/evaluators/functions/StringContainsDescriptor.java
@@ -18,40 +18,38 @@
  */
 package org.apache.asterix.runtime.evaluators.functions;
 
-import java.io.DataOutput;
-
 import org.apache.asterix.om.functions.AsterixBuiltinFunctions;
 import org.apache.asterix.om.functions.IFunctionDescriptor;
 import org.apache.asterix.om.functions.IFunctionDescriptorFactory;
 import org.apache.asterix.runtime.evaluators.base.AbstractScalarFunctionDynamicDescriptor;
 import org.apache.hyracks.algebricks.common.exceptions.AlgebricksException;
 import org.apache.hyracks.algebricks.core.algebra.functions.FunctionIdentifier;
-import org.apache.hyracks.algebricks.runtime.base.ICopyEvaluator;
-import org.apache.hyracks.algebricks.runtime.base.ICopyEvaluatorFactory;
-import org.apache.hyracks.data.std.api.IDataOutputProvider;
+import org.apache.hyracks.algebricks.runtime.base.IScalarEvaluator;
+import org.apache.hyracks.algebricks.runtime.base.IScalarEvaluatorFactory;
+import org.apache.hyracks.api.context.IHyracksTaskContext;
 import org.apache.hyracks.data.std.primitive.UTF8StringPointable;
 
 public class StringContainsDescriptor extends AbstractScalarFunctionDynamicDescriptor {
     private static final long serialVersionUID = 1L;
 
     public static final IFunctionDescriptorFactory FACTORY = new IFunctionDescriptorFactory() {
+        @Override
         public IFunctionDescriptor createFunctionDescriptor() {
             return new StringContainsDescriptor();
         }
     };
 
     @Override
-    public ICopyEvaluatorFactory createEvaluatorFactory(final ICopyEvaluatorFactory[] args) throws AlgebricksException {
+    public IScalarEvaluatorFactory createEvaluatorFactory(final IScalarEvaluatorFactory[] args)
+            throws AlgebricksException {
 
-        return new ICopyEvaluatorFactory() {
+        return new IScalarEvaluatorFactory() {
             private static final long serialVersionUID = 1L;
 
             @Override
-            public ICopyEvaluator createEvaluator(IDataOutputProvider output) throws AlgebricksException {
+            public IScalarEvaluator createScalarEvaluator(IHyracksTaskContext ctx) throws AlgebricksException {
 
-                DataOutput dout = output.getDataOutput();
-
-                return new AbstractBinaryStringBoolEval(dout, args[0], args[1],
+                return new AbstractBinaryStringBoolEval(ctx, args[0], args[1],
                         AsterixBuiltinFunctions.STRING_CONTAINS) {
                     @Override
                     protected boolean compute(UTF8StringPointable left, UTF8StringPointable right)
diff --git a/asterix-runtime/src/main/java/org/apache/asterix/runtime/evaluators/functions/StringEndsWithDescriptor.java b/asterix-runtime/src/main/java/org/apache/asterix/runtime/evaluators/functions/StringEndsWithDescriptor.java
index 673ba0f..0c251d4 100644
--- a/asterix-runtime/src/main/java/org/apache/asterix/runtime/evaluators/functions/StringEndsWithDescriptor.java
+++ b/asterix-runtime/src/main/java/org/apache/asterix/runtime/evaluators/functions/StringEndsWithDescriptor.java
@@ -18,40 +18,38 @@
  */
 package org.apache.asterix.runtime.evaluators.functions;
 
-import java.io.DataOutput;
-
 import org.apache.asterix.om.functions.AsterixBuiltinFunctions;
 import org.apache.asterix.om.functions.IFunctionDescriptor;
 import org.apache.asterix.om.functions.IFunctionDescriptorFactory;
 import org.apache.asterix.runtime.evaluators.base.AbstractScalarFunctionDynamicDescriptor;
 import org.apache.hyracks.algebricks.common.exceptions.AlgebricksException;
 import org.apache.hyracks.algebricks.core.algebra.functions.FunctionIdentifier;
-import org.apache.hyracks.algebricks.runtime.base.ICopyEvaluator;
-import org.apache.hyracks.algebricks.runtime.base.ICopyEvaluatorFactory;
-import org.apache.hyracks.data.std.api.IDataOutputProvider;
+import org.apache.hyracks.algebricks.runtime.base.IScalarEvaluator;
+import org.apache.hyracks.algebricks.runtime.base.IScalarEvaluatorFactory;
+import org.apache.hyracks.api.context.IHyracksTaskContext;
 import org.apache.hyracks.data.std.primitive.UTF8StringPointable;
 
 public class StringEndsWithDescriptor extends AbstractScalarFunctionDynamicDescriptor {
     private static final long serialVersionUID = 1L;
 
     public static final IFunctionDescriptorFactory FACTORY = new IFunctionDescriptorFactory() {
+        @Override
         public IFunctionDescriptor createFunctionDescriptor() {
             return new StringEndsWithDescriptor();
         }
     };
 
     @Override
-    public ICopyEvaluatorFactory createEvaluatorFactory(final ICopyEvaluatorFactory[] args) throws AlgebricksException {
+    public IScalarEvaluatorFactory createEvaluatorFactory(final IScalarEvaluatorFactory[] args)
+            throws AlgebricksException {
 
-        return new ICopyEvaluatorFactory() {
+        return new IScalarEvaluatorFactory() {
             private static final long serialVersionUID = 1L;
 
             @Override
-            public ICopyEvaluator createEvaluator(IDataOutputProvider output) throws AlgebricksException {
+            public IScalarEvaluator createScalarEvaluator(IHyracksTaskContext ctx) throws AlgebricksException {
 
-                DataOutput dout = output.getDataOutput();
-
-                return new AbstractBinaryStringBoolEval(dout, args[0], args[1],
+                return new AbstractBinaryStringBoolEval(ctx, args[0], args[1],
                         AsterixBuiltinFunctions.STRING_ENDS_WITH) {
 
                     @Override
diff --git a/asterix-runtime/src/main/java/org/apache/asterix/runtime/evaluators/functions/StringEqualDescriptor.java b/asterix-runtime/src/main/java/org/apache/asterix/runtime/evaluators/functions/StringEqualDescriptor.java
index 8cc3400..441c3e1 100644
--- a/asterix-runtime/src/main/java/org/apache/asterix/runtime/evaluators/functions/StringEqualDescriptor.java
+++ b/asterix-runtime/src/main/java/org/apache/asterix/runtime/evaluators/functions/StringEqualDescriptor.java
@@ -18,17 +18,15 @@
  */
 package org.apache.asterix.runtime.evaluators.functions;
 
-import java.io.DataOutput;
-
 import org.apache.asterix.om.functions.AsterixBuiltinFunctions;
 import org.apache.asterix.om.functions.IFunctionDescriptor;
 import org.apache.asterix.om.functions.IFunctionDescriptorFactory;
 import org.apache.asterix.runtime.evaluators.base.AbstractScalarFunctionDynamicDescriptor;
 import org.apache.hyracks.algebricks.common.exceptions.AlgebricksException;
 import org.apache.hyracks.algebricks.core.algebra.functions.FunctionIdentifier;
-import org.apache.hyracks.algebricks.runtime.base.ICopyEvaluator;
-import org.apache.hyracks.algebricks.runtime.base.ICopyEvaluatorFactory;
-import org.apache.hyracks.data.std.api.IDataOutputProvider;
+import org.apache.hyracks.algebricks.runtime.base.IScalarEvaluator;
+import org.apache.hyracks.algebricks.runtime.base.IScalarEvaluatorFactory;
+import org.apache.hyracks.api.context.IHyracksTaskContext;
 import org.apache.hyracks.data.std.primitive.UTF8StringPointable;
 
 public class StringEqualDescriptor extends AbstractScalarFunctionDynamicDescriptor {
@@ -42,17 +40,17 @@
     };
 
     @Override
-    public ICopyEvaluatorFactory createEvaluatorFactory(final ICopyEvaluatorFactory[] args) throws AlgebricksException {
+    public IScalarEvaluatorFactory createEvaluatorFactory(final IScalarEvaluatorFactory[] args)
+            throws AlgebricksException {
 
-        return new ICopyEvaluatorFactory() {
+        return new IScalarEvaluatorFactory() {
             private static final long serialVersionUID = 1L;
 
             @Override
-            public ICopyEvaluator createEvaluator(IDataOutputProvider output) throws AlgebricksException {
+            public IScalarEvaluator createScalarEvaluator(IHyracksTaskContext ctx) throws AlgebricksException {
 
-                DataOutput dout = output.getDataOutput();
-
-                return new AbstractBinaryStringBoolEval(dout, args[0], args[1], AsterixBuiltinFunctions.STRING_EQUAL) {
+                return new AbstractBinaryStringBoolEval(ctx, args[0], args[1],
+                        AsterixBuiltinFunctions.STRING_EQUAL) {
 
                     @Override
                     protected boolean compute(UTF8StringPointable left, UTF8StringPointable right)
diff --git a/asterix-runtime/src/main/java/org/apache/asterix/runtime/evaluators/functions/StringJoinDescriptor.java b/asterix-runtime/src/main/java/org/apache/asterix/runtime/evaluators/functions/StringJoinDescriptor.java
index 866d6c4..67f3fbd 100644
--- a/asterix-runtime/src/main/java/org/apache/asterix/runtime/evaluators/functions/StringJoinDescriptor.java
+++ b/asterix-runtime/src/main/java/org/apache/asterix/runtime/evaluators/functions/StringJoinDescriptor.java
@@ -31,9 +31,11 @@
 import org.apache.asterix.runtime.evaluators.base.AbstractScalarFunctionDynamicDescriptor;
 import org.apache.hyracks.algebricks.common.exceptions.AlgebricksException;
 import org.apache.hyracks.algebricks.core.algebra.functions.FunctionIdentifier;
-import org.apache.hyracks.algebricks.runtime.base.ICopyEvaluator;
-import org.apache.hyracks.algebricks.runtime.base.ICopyEvaluatorFactory;
-import org.apache.hyracks.data.std.api.IDataOutputProvider;
+import org.apache.hyracks.algebricks.runtime.base.IScalarEvaluator;
+import org.apache.hyracks.algebricks.runtime.base.IScalarEvaluatorFactory;
+import org.apache.hyracks.api.context.IHyracksTaskContext;
+import org.apache.hyracks.data.std.api.IPointable;
+import org.apache.hyracks.data.std.primitive.VoidPointable;
 import org.apache.hyracks.data.std.util.ArrayBackedValueStorage;
 import org.apache.hyracks.dataflow.common.data.accessors.IFrameTupleReference;
 import org.apache.hyracks.util.string.UTF8StringUtil;
@@ -49,57 +51,63 @@
     };
 
     @Override
-    public ICopyEvaluatorFactory createEvaluatorFactory(final ICopyEvaluatorFactory[] args) {
-        return new ICopyEvaluatorFactory() {
+    public IScalarEvaluatorFactory createEvaluatorFactory(final IScalarEvaluatorFactory[] args) {
+        return new IScalarEvaluatorFactory() {
 
             private static final long serialVersionUID = 1L;
 
             @Override
-            public ICopyEvaluator createEvaluator(final IDataOutputProvider output) throws AlgebricksException {
-                return new ICopyEvaluator() {
+            public IScalarEvaluator createScalarEvaluator(final IHyracksTaskContext ctx) throws AlgebricksException {
+                return new IScalarEvaluator() {
 
-                    private DataOutput out = output.getDataOutput();
-                    private ICopyEvaluatorFactory listEvalFactory = args[0];
-                    private ICopyEvaluatorFactory sepEvalFactory = args[1];
-                    private ArrayBackedValueStorage outInputList = new ArrayBackedValueStorage();
-                    private ArrayBackedValueStorage outInputSep = new ArrayBackedValueStorage();
-                    private ICopyEvaluator evalList = listEvalFactory.createEvaluator(outInputList);
-                    private ICopyEvaluator evalSep = sepEvalFactory.createEvaluator(outInputSep);
+                    private ArrayBackedValueStorage resultStorage = new ArrayBackedValueStorage();
+                    private DataOutput out = resultStorage.getDataOutput();
+                    private IScalarEvaluatorFactory listEvalFactory = args[0];
+                    private IScalarEvaluatorFactory sepEvalFactory = args[1];
+                    private IPointable inputArgList = new VoidPointable();
+                    private IPointable inputArgSep = new VoidPointable();
+                    private IScalarEvaluator evalList = listEvalFactory.createScalarEvaluator(ctx);
+                    private IScalarEvaluator evalSep = sepEvalFactory.createScalarEvaluator(ctx);
                     private final byte[] tempLengthArray = new byte[5];
 
                     @Override
-                    public void evaluate(IFrameTupleReference tuple) throws AlgebricksException {
+                    public void evaluate(IFrameTupleReference tuple, IPointable result) throws AlgebricksException {
                         try {
-                            outInputList.reset();
-                            evalList.evaluate(tuple);
-                            byte[] serOrderedList = outInputList.getByteArray();
+                            resultStorage.reset();
+                            evalList.evaluate(tuple, inputArgList);
+                            byte[] serOrderedList = inputArgList.getByteArray();
+                            int serOrderedListOffset = inputArgList.getStartOffset();
 
-                            outInputSep.reset();
-                            evalSep.evaluate(tuple);
-                            byte[] serSep = outInputSep.getByteArray();
-                            if (serOrderedList[0] != ATypeTag.SERIALIZED_ORDEREDLIST_TYPE_TAG
-                                    && serOrderedList[1] != ATypeTag.SERIALIZED_STRING_TYPE_TAG) {
+                            evalSep.evaluate(tuple, inputArgSep);
+                            byte[] serSep = inputArgSep.getByteArray();
+                            int serSepOffset = inputArgSep.getStartOffset();
+
+                            if (serOrderedList[serOrderedListOffset] != ATypeTag.SERIALIZED_ORDEREDLIST_TYPE_TAG
+                                    && serOrderedList[serOrderedListOffset
+                                            + 1] != ATypeTag.SERIALIZED_STRING_TYPE_TAG) {
                                 throw new AlgebricksException(AsterixBuiltinFunctions.STRING_JOIN.getName()
                                         + ": expects input type ORDEREDLIST but got "
-                                        + EnumDeserializer.ATYPETAGDESERIALIZER.deserialize(serOrderedList[0]));
+                                        + EnumDeserializer.ATYPETAGDESERIALIZER
+                                                .deserialize(serOrderedList[serOrderedListOffset]));
                             }
 
-                            if (serSep[0] != ATypeTag.SERIALIZED_STRING_TYPE_TAG) {
+                            if (serSep[serSepOffset] != ATypeTag.SERIALIZED_STRING_TYPE_TAG) {
                                 throw new AlgebricksException(AsterixBuiltinFunctions.STRING_JOIN.getName()
                                         + ": expects STRING type for the seperator but got "
-                                        + EnumDeserializer.ATYPETAGDESERIALIZER.deserialize(serSep[0]));
+                                        + EnumDeserializer.ATYPETAGDESERIALIZER.deserialize(serSep[serSepOffset]));
                             }
 
-                            int size = AOrderedListSerializerDeserializer.getNumberOfItems(serOrderedList);
+                            int size = AOrderedListSerializerDeserializer.getNumberOfItems(serOrderedList,
+                                    serOrderedListOffset);
                             try {
                                 // calculate length first
                                 int utf_8_len = 0;
-                                int sep_len = UTF8StringUtil.getUTFLength(serSep, 1);
+                                int sep_len = UTF8StringUtil.getUTFLength(serSep, serSepOffset + 1);
                                 int sep_meta_len = UTF8StringUtil.getNumBytesToStoreLength(sep_len);
 
                                 for (int i = 0; i < size; i++) {
                                     int itemOffset = AOrderedListSerializerDeserializer.getItemOffset(serOrderedList,
-                                            i);
+                                            serOrderedListOffset, i);
 
                                     int currentSize = UTF8StringUtil.getUTFLength(serOrderedList, itemOffset);
                                     if (i != size - 1 && currentSize != 0) {
@@ -112,19 +120,21 @@
                                 out.write(tempLengthArray, 0, length);
                                 for (int i = 0; i < size; i++) {
                                     int itemOffset = AOrderedListSerializerDeserializer.getItemOffset(serOrderedList,
-                                            i);
+                                            serOrderedListOffset, i);
                                     utf_8_len = UTF8StringUtil.getUTFLength(serOrderedList, itemOffset);
                                     out.write(serOrderedList,
                                             itemOffset + UTF8StringUtil.getNumBytesToStoreLength(utf_8_len), utf_8_len);
-                                    if (i == size - 1 || utf_8_len == 0)
+                                    if (i == size - 1 || utf_8_len == 0) {
                                         continue;
+                                    }
                                     for (int j = 0; j < sep_len; j++) {
-                                        out.writeByte(serSep[1 + sep_meta_len + j]);
+                                        out.writeByte(serSep[serSepOffset + 1 + sep_meta_len + j]);
                                     }
                                 }
                             } catch (AsterixException ex) {
                                 throw new AlgebricksException(ex);
                             }
+                            result.set(resultStorage);
                         } catch (IOException e1) {
                             throw new AlgebricksException(e1.getMessage());
                         }
diff --git a/asterix-runtime/src/main/java/org/apache/asterix/runtime/evaluators/functions/StringLengthDescriptor.java b/asterix-runtime/src/main/java/org/apache/asterix/runtime/evaluators/functions/StringLengthDescriptor.java
index 5a6c1a0..f3d9d0e 100644
--- a/asterix-runtime/src/main/java/org/apache/asterix/runtime/evaluators/functions/StringLengthDescriptor.java
+++ b/asterix-runtime/src/main/java/org/apache/asterix/runtime/evaluators/functions/StringLengthDescriptor.java
@@ -34,10 +34,12 @@
 import org.apache.asterix.runtime.evaluators.base.AbstractScalarFunctionDynamicDescriptor;
 import org.apache.hyracks.algebricks.common.exceptions.AlgebricksException;
 import org.apache.hyracks.algebricks.core.algebra.functions.FunctionIdentifier;
-import org.apache.hyracks.algebricks.runtime.base.ICopyEvaluator;
-import org.apache.hyracks.algebricks.runtime.base.ICopyEvaluatorFactory;
+import org.apache.hyracks.algebricks.runtime.base.IScalarEvaluator;
+import org.apache.hyracks.algebricks.runtime.base.IScalarEvaluatorFactory;
+import org.apache.hyracks.api.context.IHyracksTaskContext;
 import org.apache.hyracks.api.dataflow.value.ISerializerDeserializer;
-import org.apache.hyracks.data.std.api.IDataOutputProvider;
+import org.apache.hyracks.data.std.api.IPointable;
+import org.apache.hyracks.data.std.primitive.VoidPointable;
 import org.apache.hyracks.data.std.util.ArrayBackedValueStorage;
 import org.apache.hyracks.dataflow.common.data.accessors.IFrameTupleReference;
 import org.apache.hyracks.util.string.UTF8StringUtil;
@@ -52,17 +54,18 @@
     };
 
     @Override
-    public ICopyEvaluatorFactory createEvaluatorFactory(final ICopyEvaluatorFactory[] args) {
-        return new ICopyEvaluatorFactory() {
+    public IScalarEvaluatorFactory createEvaluatorFactory(final IScalarEvaluatorFactory[] args) {
+        return new IScalarEvaluatorFactory() {
             private static final long serialVersionUID = 1L;
 
             @Override
-            public ICopyEvaluator createEvaluator(final IDataOutputProvider output) throws AlgebricksException {
-                return new ICopyEvaluator() {
+            public IScalarEvaluator createScalarEvaluator(final IHyracksTaskContext ctx) throws AlgebricksException {
+                return new IScalarEvaluator() {
                     private AMutableInt64 result = new AMutableInt64(0);
-                    private DataOutput out = output.getDataOutput();
-                    private ArrayBackedValueStorage outInput = new ArrayBackedValueStorage();
-                    private ICopyEvaluator eval = args[0].createEvaluator(outInput);
+                    private ArrayBackedValueStorage resultStorage = new ArrayBackedValueStorage();
+                    private DataOutput out = resultStorage.getDataOutput();
+                    private IPointable inputArg = new VoidPointable();
+                    private IScalarEvaluator eval = args[0].createScalarEvaluator(ctx);
                     @SuppressWarnings("unchecked")
                     private ISerializerDeserializer<ANull> nullSerde = AqlSerializerDeserializerProvider.INSTANCE
                             .getSerializerDeserializer(BuiltinType.ANULL);
@@ -71,23 +74,26 @@
                             .getSerializerDeserializer(BuiltinType.AINT64);
 
                     @Override
-                    public void evaluate(IFrameTupleReference tuple) throws AlgebricksException {
-
+                    public void evaluate(IFrameTupleReference tuple, IPointable resultPointable)
+                            throws AlgebricksException {
                         try {
-                            outInput.reset();
-                            eval.evaluate(tuple);
-                            byte[] serString = outInput.getByteArray();
-                            if (serString[0] == ATypeTag.SERIALIZED_STRING_TYPE_TAG) {
-                                int len = UTF8StringUtil.getUTFLength(outInput.getByteArray(), 1);
+                            resultStorage.reset();
+                            eval.evaluate(tuple, inputArg);
+                            byte[] serString = inputArg.getByteArray();
+                            int offset = inputArg.getStartOffset();
+
+                            if (serString[offset] == ATypeTag.SERIALIZED_STRING_TYPE_TAG) {
+                                int len = UTF8StringUtil.getUTFLength(serString, offset + 1);
                                 result.setValue(len);
                                 int64Serde.serialize(result, out);
-                            } else if (serString[0] == ATypeTag.SERIALIZED_NULL_TYPE_TAG)
+                            } else if (serString[offset] == ATypeTag.SERIALIZED_NULL_TYPE_TAG) {
                                 nullSerde.serialize(ANull.NULL, out);
-                            else {
+                            } else {
                                 throw new AlgebricksException(AsterixBuiltinFunctions.STRING_LENGTH.getName()
                                         + ": expects input type STRING/NULL but got "
-                                        + EnumDeserializer.ATYPETAGDESERIALIZER.deserialize(serString[0]));
+                                        + EnumDeserializer.ATYPETAGDESERIALIZER.deserialize(serString[offset]));
                             }
+                            resultPointable.set(resultStorage);
                         } catch (IOException e1) {
                             throw new AlgebricksException(e1);
                         }
diff --git a/asterix-runtime/src/main/java/org/apache/asterix/runtime/evaluators/functions/StringLikeDescriptor.java b/asterix-runtime/src/main/java/org/apache/asterix/runtime/evaluators/functions/StringLikeDescriptor.java
index 3ccba1c..9b2a8b3 100644
--- a/asterix-runtime/src/main/java/org/apache/asterix/runtime/evaluators/functions/StringLikeDescriptor.java
+++ b/asterix-runtime/src/main/java/org/apache/asterix/runtime/evaluators/functions/StringLikeDescriptor.java
@@ -18,7 +18,6 @@
  */
 package org.apache.asterix.runtime.evaluators.functions;
 
-import java.io.DataOutput;
 import java.util.regex.Matcher;
 import java.util.regex.Pattern;
 
@@ -28,9 +27,9 @@
 import org.apache.asterix.runtime.evaluators.base.AbstractScalarFunctionDynamicDescriptor;
 import org.apache.hyracks.algebricks.common.exceptions.AlgebricksException;
 import org.apache.hyracks.algebricks.core.algebra.functions.FunctionIdentifier;
-import org.apache.hyracks.algebricks.runtime.base.ICopyEvaluator;
-import org.apache.hyracks.algebricks.runtime.base.ICopyEvaluatorFactory;
-import org.apache.hyracks.data.std.api.IDataOutputProvider;
+import org.apache.hyracks.algebricks.runtime.base.IScalarEvaluator;
+import org.apache.hyracks.algebricks.runtime.base.IScalarEvaluatorFactory;
+import org.apache.hyracks.api.context.IHyracksTaskContext;
 import org.apache.hyracks.data.std.primitive.UTF8StringPointable;
 import org.apache.hyracks.data.std.util.ByteArrayAccessibleOutputStream;
 import org.apache.hyracks.data.std.util.UTF8CharSequence;
@@ -45,6 +44,7 @@
     private static final long serialVersionUID = 1L;
 
     public static final IFunctionDescriptorFactory FACTORY = new IFunctionDescriptorFactory() {
+        @Override
         public IFunctionDescriptor createFunctionDescriptor() {
             return new StringLikeDescriptor();
         }
@@ -56,17 +56,16 @@
     }
 
     @Override
-    public ICopyEvaluatorFactory createEvaluatorFactory(final ICopyEvaluatorFactory[] args) throws AlgebricksException {
+    public IScalarEvaluatorFactory createEvaluatorFactory(final IScalarEvaluatorFactory[] args)
+            throws AlgebricksException {
 
-        return new ICopyEvaluatorFactory() {
+        return new IScalarEvaluatorFactory() {
             private static final long serialVersionUID = 1L;
 
             @Override
-            public ICopyEvaluator createEvaluator(IDataOutputProvider output) throws AlgebricksException {
+            public IScalarEvaluator createScalarEvaluator(IHyracksTaskContext ctx) throws AlgebricksException {
 
-                final DataOutput dout = output.getDataOutput();
-
-                return new AbstractBinaryStringBoolEval(dout, args[0], args[1],
+                return new AbstractBinaryStringBoolEval(ctx, args[0], args[1],
                         AsterixBuiltinFunctions.STRING_MATCHES) {
 
                     private Pattern pattern = null;
@@ -103,4 +102,3 @@
     }
 
 };
-
diff --git a/asterix-runtime/src/main/java/org/apache/asterix/runtime/evaluators/functions/StringLowerCaseDescriptor.java b/asterix-runtime/src/main/java/org/apache/asterix/runtime/evaluators/functions/StringLowerCaseDescriptor.java
index 7ae1e89..c025947 100644
--- a/asterix-runtime/src/main/java/org/apache/asterix/runtime/evaluators/functions/StringLowerCaseDescriptor.java
+++ b/asterix-runtime/src/main/java/org/apache/asterix/runtime/evaluators/functions/StringLowerCaseDescriptor.java
@@ -32,11 +32,13 @@
 import org.apache.asterix.runtime.evaluators.base.AbstractScalarFunctionDynamicDescriptor;
 import org.apache.hyracks.algebricks.common.exceptions.AlgebricksException;
 import org.apache.hyracks.algebricks.core.algebra.functions.FunctionIdentifier;
-import org.apache.hyracks.algebricks.runtime.base.ICopyEvaluator;
-import org.apache.hyracks.algebricks.runtime.base.ICopyEvaluatorFactory;
+import org.apache.hyracks.algebricks.runtime.base.IScalarEvaluator;
+import org.apache.hyracks.algebricks.runtime.base.IScalarEvaluatorFactory;
+import org.apache.hyracks.api.context.IHyracksTaskContext;
 import org.apache.hyracks.api.dataflow.value.ISerializerDeserializer;
-import org.apache.hyracks.data.std.api.IDataOutputProvider;
+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.data.std.util.ArrayBackedValueStorage;
 import org.apache.hyracks.data.std.util.GrowableArray;
 import org.apache.hyracks.data.std.util.UTF8StringBuilder;
@@ -53,17 +55,18 @@
     };
 
     @Override
-    public ICopyEvaluatorFactory createEvaluatorFactory(final ICopyEvaluatorFactory[] args) {
-        return new ICopyEvaluatorFactory() {
+    public IScalarEvaluatorFactory createEvaluatorFactory(final IScalarEvaluatorFactory[] args) {
+        return new IScalarEvaluatorFactory() {
             private static final long serialVersionUID = 1L;
 
             @Override
-            public ICopyEvaluator createEvaluator(final IDataOutputProvider output) throws AlgebricksException {
-                return new ICopyEvaluator() {
+            public IScalarEvaluator createScalarEvaluator(final IHyracksTaskContext ctx) throws AlgebricksException {
+                return new IScalarEvaluator() {
 
-                    private final DataOutput out = output.getDataOutput();
-                    private final ArrayBackedValueStorage outInput = new ArrayBackedValueStorage();
-                    private final ICopyEvaluator eval = args[0].createEvaluator(outInput);
+                    private final ArrayBackedValueStorage resultStorage = new ArrayBackedValueStorage();
+                    private final DataOutput out = resultStorage.getDataOutput();
+                    private final IPointable inputArg = new VoidPointable();
+                    private final IScalarEvaluator eval = args[0].createScalarEvaluator(ctx);
 
                     private final GrowableArray array = new GrowableArray();
                     private final UTF8StringBuilder builder = new UTF8StringBuilder();
@@ -74,26 +77,30 @@
                             .getSerializerDeserializer(BuiltinType.ANULL);
 
                     @Override
-                    public void evaluate(IFrameTupleReference tuple) throws AlgebricksException {
+                    public void evaluate(IFrameTupleReference tuple, IPointable result) throws AlgebricksException {
 
                         try {
-                            outInput.reset();
-                            eval.evaluate(tuple);
-                            byte[] serString = outInput.getByteArray();
+                            resultStorage.reset();
+                            eval.evaluate(tuple, inputArg);
+                            byte[] serString = inputArg.getByteArray();
+                            int offset = inputArg.getStartOffset();
+                            int len = inputArg.getLength() - 1;
 
-                            if (serString[0] == ATypeTag.SERIALIZED_STRING_TYPE_TAG) {
-                                string.set(serString, 1, serString.length);
+                            if (serString[offset] == ATypeTag.SERIALIZED_STRING_TYPE_TAG) {
+                                string.set(serString, offset + 1, len - 1);
                                 array.reset();
                                 UTF8StringPointable.lowercase(string, builder, array);
 
                                 out.writeByte(ATypeTag.SERIALIZED_STRING_TYPE_TAG);
                                 out.write(array.getByteArray(), 0, array.getLength());
-                            } else if (serString[0] == ATypeTag.SERIALIZED_NULL_TYPE_TAG)
+                            } else if (serString[offset] == ATypeTag.SERIALIZED_NULL_TYPE_TAG) {
                                 nullSerde.serialize(ANull.NULL, out);
-                            else
+                            } else {
                                 throw new AlgebricksException(AsterixBuiltinFunctions.STRING_LOWERCASE.getName()
                                         + ": expects input type STRING/NULL but got "
-                                        + EnumDeserializer.ATYPETAGDESERIALIZER.deserialize(serString[0]));
+                                        + EnumDeserializer.ATYPETAGDESERIALIZER.deserialize(serString[offset]));
+                            }
+                            result.set(resultStorage);
                         } catch (IOException e1) {
                             throw new AlgebricksException(e1);
                         }
diff --git a/asterix-runtime/src/main/java/org/apache/asterix/runtime/evaluators/functions/StringMatchesDescriptor.java b/asterix-runtime/src/main/java/org/apache/asterix/runtime/evaluators/functions/StringMatchesDescriptor.java
index 0b8477c..5551942 100644
--- a/asterix-runtime/src/main/java/org/apache/asterix/runtime/evaluators/functions/StringMatchesDescriptor.java
+++ b/asterix-runtime/src/main/java/org/apache/asterix/runtime/evaluators/functions/StringMatchesDescriptor.java
@@ -18,7 +18,6 @@
  */
 package org.apache.asterix.runtime.evaluators.functions;
 
-import java.io.DataOutput;
 import java.util.regex.Matcher;
 import java.util.regex.Pattern;
 
@@ -28,9 +27,9 @@
 import org.apache.asterix.runtime.evaluators.base.AbstractScalarFunctionDynamicDescriptor;
 import org.apache.hyracks.algebricks.common.exceptions.AlgebricksException;
 import org.apache.hyracks.algebricks.core.algebra.functions.FunctionIdentifier;
-import org.apache.hyracks.algebricks.runtime.base.ICopyEvaluator;
-import org.apache.hyracks.algebricks.runtime.base.ICopyEvaluatorFactory;
-import org.apache.hyracks.data.std.api.IDataOutputProvider;
+import org.apache.hyracks.algebricks.runtime.base.IScalarEvaluator;
+import org.apache.hyracks.algebricks.runtime.base.IScalarEvaluatorFactory;
+import org.apache.hyracks.api.context.IHyracksTaskContext;
 import org.apache.hyracks.data.std.primitive.UTF8StringPointable;
 import org.apache.hyracks.data.std.util.ByteArrayAccessibleOutputStream;
 import org.apache.hyracks.data.std.util.UTF8CharSequence;
@@ -39,23 +38,23 @@
     private static final long serialVersionUID = 1L;
 
     public static final IFunctionDescriptorFactory FACTORY = new IFunctionDescriptorFactory() {
+        @Override
         public IFunctionDescriptor createFunctionDescriptor() {
             return new StringMatchesDescriptor();
         }
     };
 
     @Override
-    public ICopyEvaluatorFactory createEvaluatorFactory(final ICopyEvaluatorFactory[] args) throws AlgebricksException {
+    public IScalarEvaluatorFactory createEvaluatorFactory(final IScalarEvaluatorFactory[] args)
+            throws AlgebricksException {
 
-        return new ICopyEvaluatorFactory() {
+        return new IScalarEvaluatorFactory() {
             private static final long serialVersionUID = 1L;
 
             @Override
-            public ICopyEvaluator createEvaluator(IDataOutputProvider output) throws AlgebricksException {
+            public IScalarEvaluator createScalarEvaluator(IHyracksTaskContext ctx) throws AlgebricksException {
 
-                DataOutput dout = output.getDataOutput();
-
-                return new AbstractBinaryStringBoolEval(dout, args[0], args[1],
+                return new AbstractBinaryStringBoolEval(ctx, args[0], args[1],
                         AsterixBuiltinFunctions.STRING_MATCHES) {
 
                     private Pattern pattern = null;
diff --git a/asterix-runtime/src/main/java/org/apache/asterix/runtime/evaluators/functions/StringMatchesWithFlagDescriptor.java b/asterix-runtime/src/main/java/org/apache/asterix/runtime/evaluators/functions/StringMatchesWithFlagDescriptor.java
index e4129a3..10de2e4 100644
--- a/asterix-runtime/src/main/java/org/apache/asterix/runtime/evaluators/functions/StringMatchesWithFlagDescriptor.java
+++ b/asterix-runtime/src/main/java/org/apache/asterix/runtime/evaluators/functions/StringMatchesWithFlagDescriptor.java
@@ -22,7 +22,6 @@
  */
 package org.apache.asterix.runtime.evaluators.functions;
 
-import java.io.DataOutput;
 import java.util.regex.Matcher;
 import java.util.regex.Pattern;
 
@@ -32,9 +31,9 @@
 import org.apache.asterix.runtime.evaluators.base.AbstractScalarFunctionDynamicDescriptor;
 import org.apache.hyracks.algebricks.common.exceptions.AlgebricksException;
 import org.apache.hyracks.algebricks.core.algebra.functions.FunctionIdentifier;
-import org.apache.hyracks.algebricks.runtime.base.ICopyEvaluator;
-import org.apache.hyracks.algebricks.runtime.base.ICopyEvaluatorFactory;
-import org.apache.hyracks.data.std.api.IDataOutputProvider;
+import org.apache.hyracks.algebricks.runtime.base.IScalarEvaluator;
+import org.apache.hyracks.algebricks.runtime.base.IScalarEvaluatorFactory;
+import org.apache.hyracks.api.context.IHyracksTaskContext;
 import org.apache.hyracks.data.std.primitive.UTF8StringPointable;
 import org.apache.hyracks.data.std.util.ByteArrayAccessibleOutputStream;
 import org.apache.hyracks.data.std.util.UTF8CharSequence;
@@ -43,24 +42,24 @@
 
     private static final long serialVersionUID = 1L;
     public static final IFunctionDescriptorFactory FACTORY = new IFunctionDescriptorFactory() {
+        @Override
         public IFunctionDescriptor createFunctionDescriptor() {
             return new StringMatchesWithFlagDescriptor();
         }
     };
 
     @Override
-    public ICopyEvaluatorFactory createEvaluatorFactory(final ICopyEvaluatorFactory[] args) throws AlgebricksException {
+    public IScalarEvaluatorFactory createEvaluatorFactory(final IScalarEvaluatorFactory[] args)
+            throws AlgebricksException {
 
-        return new ICopyEvaluatorFactory() {
+        return new IScalarEvaluatorFactory() {
 
             private static final long serialVersionUID = 1L;
 
             @Override
-            public ICopyEvaluator createEvaluator(IDataOutputProvider output) throws AlgebricksException {
+            public IScalarEvaluator createScalarEvaluator(IHyracksTaskContext ctx) throws AlgebricksException {
 
-                DataOutput dout = output.getDataOutput();
-
-                return new AbstractTripleStringBoolEval(dout, args[0], args[1], args[2],
+                return new AbstractTripleStringBoolEval(ctx, args[0], args[1], args[2],
                         AsterixBuiltinFunctions.STRING_MATCHES_WITH_FLAG) {
                     private Pattern pattern = null;
                     private Matcher matcher = null;
diff --git a/asterix-runtime/src/main/java/org/apache/asterix/runtime/evaluators/functions/StringReplaceDescriptor.java b/asterix-runtime/src/main/java/org/apache/asterix/runtime/evaluators/functions/StringReplaceDescriptor.java
index a43f1a4..eec9f41 100644
--- a/asterix-runtime/src/main/java/org/apache/asterix/runtime/evaluators/functions/StringReplaceDescriptor.java
+++ b/asterix-runtime/src/main/java/org/apache/asterix/runtime/evaluators/functions/StringReplaceDescriptor.java
@@ -18,7 +18,6 @@
  */
 package org.apache.asterix.runtime.evaluators.functions;
 
-import java.io.DataOutput;
 import java.util.regex.Matcher;
 import java.util.regex.Pattern;
 
@@ -28,9 +27,9 @@
 import org.apache.asterix.runtime.evaluators.base.AbstractScalarFunctionDynamicDescriptor;
 import org.apache.hyracks.algebricks.common.exceptions.AlgebricksException;
 import org.apache.hyracks.algebricks.core.algebra.functions.FunctionIdentifier;
-import org.apache.hyracks.algebricks.runtime.base.ICopyEvaluator;
-import org.apache.hyracks.algebricks.runtime.base.ICopyEvaluatorFactory;
-import org.apache.hyracks.data.std.api.IDataOutputProvider;
+import org.apache.hyracks.algebricks.runtime.base.IScalarEvaluator;
+import org.apache.hyracks.algebricks.runtime.base.IScalarEvaluatorFactory;
+import org.apache.hyracks.api.context.IHyracksTaskContext;
 import org.apache.hyracks.data.std.primitive.UTF8StringPointable;
 import org.apache.hyracks.data.std.util.ByteArrayAccessibleOutputStream;
 import org.apache.hyracks.data.std.util.UTF8CharSequence;
@@ -39,24 +38,24 @@
 
     private static final long serialVersionUID = 1L;
     public static final IFunctionDescriptorFactory FACTORY = new IFunctionDescriptorFactory() {
+        @Override
         public IFunctionDescriptor createFunctionDescriptor() {
             return new StringReplaceDescriptor();
         }
     };
 
     @Override
-    public ICopyEvaluatorFactory createEvaluatorFactory(final ICopyEvaluatorFactory[] args) throws AlgebricksException {
+    public IScalarEvaluatorFactory createEvaluatorFactory(final IScalarEvaluatorFactory[] args)
+            throws AlgebricksException {
 
-        return new ICopyEvaluatorFactory() {
+        return new IScalarEvaluatorFactory() {
 
             private static final long serialVersionUID = 1L;
 
             @Override
-            public ICopyEvaluator createEvaluator(IDataOutputProvider output) throws AlgebricksException {
+            public IScalarEvaluator createScalarEvaluator(IHyracksTaskContext ctx) throws AlgebricksException {
 
-                DataOutput dout = output.getDataOutput();
-
-                return new AbstractTripleStringStringEval(dout, args[0], args[1], args[2],
+                return new AbstractTripleStringStringEval(ctx, args[0], args[1], args[2],
                         AsterixBuiltinFunctions.STRING_REPLACE) {
 
                     private Pattern pattern = null;
diff --git a/asterix-runtime/src/main/java/org/apache/asterix/runtime/evaluators/functions/StringReplaceWithFlagsDescriptor.java b/asterix-runtime/src/main/java/org/apache/asterix/runtime/evaluators/functions/StringReplaceWithFlagsDescriptor.java
index 1511d0d..a65b437 100644
--- a/asterix-runtime/src/main/java/org/apache/asterix/runtime/evaluators/functions/StringReplaceWithFlagsDescriptor.java
+++ b/asterix-runtime/src/main/java/org/apache/asterix/runtime/evaluators/functions/StringReplaceWithFlagsDescriptor.java
@@ -18,7 +18,6 @@
  */
 package org.apache.asterix.runtime.evaluators.functions;
 
-import java.io.DataOutput;
 import java.util.regex.Matcher;
 import java.util.regex.Pattern;
 
@@ -28,9 +27,9 @@
 import org.apache.asterix.runtime.evaluators.base.AbstractScalarFunctionDynamicDescriptor;
 import org.apache.hyracks.algebricks.common.exceptions.AlgebricksException;
 import org.apache.hyracks.algebricks.core.algebra.functions.FunctionIdentifier;
-import org.apache.hyracks.algebricks.runtime.base.ICopyEvaluator;
-import org.apache.hyracks.algebricks.runtime.base.ICopyEvaluatorFactory;
-import org.apache.hyracks.data.std.api.IDataOutputProvider;
+import org.apache.hyracks.algebricks.runtime.base.IScalarEvaluator;
+import org.apache.hyracks.algebricks.runtime.base.IScalarEvaluatorFactory;
+import org.apache.hyracks.api.context.IHyracksTaskContext;
 import org.apache.hyracks.data.std.primitive.UTF8StringPointable;
 import org.apache.hyracks.data.std.util.ByteArrayAccessibleOutputStream;
 import org.apache.hyracks.data.std.util.UTF8CharSequence;
@@ -39,24 +38,24 @@
 
     private static final long serialVersionUID = 1L;
     public static final IFunctionDescriptorFactory FACTORY = new IFunctionDescriptorFactory() {
+        @Override
         public IFunctionDescriptor createFunctionDescriptor() {
             return new StringReplaceWithFlagsDescriptor();
         }
     };
 
     @Override
-    public ICopyEvaluatorFactory createEvaluatorFactory(final ICopyEvaluatorFactory[] args) throws AlgebricksException {
+    public IScalarEvaluatorFactory createEvaluatorFactory(final IScalarEvaluatorFactory[] args)
+            throws AlgebricksException {
 
-        return new ICopyEvaluatorFactory() {
+        return new IScalarEvaluatorFactory() {
 
             private static final long serialVersionUID = 1L;
 
             @Override
-            public ICopyEvaluator createEvaluator(IDataOutputProvider output) throws AlgebricksException {
+            public IScalarEvaluator createScalarEvaluator(IHyracksTaskContext ctx) throws AlgebricksException {
 
-                DataOutput dout = output.getDataOutput();
-
-                return new AbstractQuadStringStringEval(dout, args[0], args[1], args[2], args[3],
+                return new AbstractQuadStringStringEval(ctx, args[0], args[1], args[2], args[3],
                         AsterixBuiltinFunctions.STRING_REPLACE_WITH_FLAG) {
                     private Pattern pattern = null;
                     private Matcher matcher = null;
diff --git a/asterix-runtime/src/main/java/org/apache/asterix/runtime/evaluators/functions/StringStartsWithDescriptor.java b/asterix-runtime/src/main/java/org/apache/asterix/runtime/evaluators/functions/StringStartsWithDescriptor.java
index 8fcca3c..c3d80d4 100644
--- a/asterix-runtime/src/main/java/org/apache/asterix/runtime/evaluators/functions/StringStartsWithDescriptor.java
+++ b/asterix-runtime/src/main/java/org/apache/asterix/runtime/evaluators/functions/StringStartsWithDescriptor.java
@@ -18,40 +18,38 @@
  */
 package org.apache.asterix.runtime.evaluators.functions;
 
-import java.io.DataOutput;
-
 import org.apache.asterix.om.functions.AsterixBuiltinFunctions;
 import org.apache.asterix.om.functions.IFunctionDescriptor;
 import org.apache.asterix.om.functions.IFunctionDescriptorFactory;
 import org.apache.asterix.runtime.evaluators.base.AbstractScalarFunctionDynamicDescriptor;
 import org.apache.hyracks.algebricks.common.exceptions.AlgebricksException;
 import org.apache.hyracks.algebricks.core.algebra.functions.FunctionIdentifier;
-import org.apache.hyracks.algebricks.runtime.base.ICopyEvaluator;
-import org.apache.hyracks.algebricks.runtime.base.ICopyEvaluatorFactory;
-import org.apache.hyracks.data.std.api.IDataOutputProvider;
+import org.apache.hyracks.algebricks.runtime.base.IScalarEvaluator;
+import org.apache.hyracks.algebricks.runtime.base.IScalarEvaluatorFactory;
+import org.apache.hyracks.api.context.IHyracksTaskContext;
 import org.apache.hyracks.data.std.primitive.UTF8StringPointable;
 
 public class StringStartsWithDescriptor extends AbstractScalarFunctionDynamicDescriptor {
     private static final long serialVersionUID = 1L;
 
     public static final IFunctionDescriptorFactory FACTORY = new IFunctionDescriptorFactory() {
+        @Override
         public IFunctionDescriptor createFunctionDescriptor() {
             return new StringStartsWithDescriptor();
         }
     };
 
     @Override
-    public ICopyEvaluatorFactory createEvaluatorFactory(final ICopyEvaluatorFactory[] args) throws AlgebricksException {
+    public IScalarEvaluatorFactory createEvaluatorFactory(final IScalarEvaluatorFactory[] args)
+            throws AlgebricksException {
 
-        return new ICopyEvaluatorFactory() {
+        return new IScalarEvaluatorFactory() {
             private static final long serialVersionUID = 1L;
 
             @Override
-            public ICopyEvaluator createEvaluator(IDataOutputProvider output) throws AlgebricksException {
+            public IScalarEvaluator createScalarEvaluator(IHyracksTaskContext ctx) throws AlgebricksException {
 
-                DataOutput dout = output.getDataOutput();
-
-                return new AbstractBinaryStringBoolEval(dout, args[0], args[1],
+                return new AbstractBinaryStringBoolEval(ctx, args[0], args[1],
                         AsterixBuiltinFunctions.STRING_STARTS_WITH) {
 
                     @Override
diff --git a/asterix-runtime/src/main/java/org/apache/asterix/runtime/evaluators/functions/StringToCodePointDescriptor.java b/asterix-runtime/src/main/java/org/apache/asterix/runtime/evaluators/functions/StringToCodePointDescriptor.java
index f75b8e3..f0c2330 100644
--- a/asterix-runtime/src/main/java/org/apache/asterix/runtime/evaluators/functions/StringToCodePointDescriptor.java
+++ b/asterix-runtime/src/main/java/org/apache/asterix/runtime/evaluators/functions/StringToCodePointDescriptor.java
@@ -35,10 +35,12 @@
 import org.apache.asterix.runtime.evaluators.base.AbstractScalarFunctionDynamicDescriptor;
 import org.apache.hyracks.algebricks.common.exceptions.AlgebricksException;
 import org.apache.hyracks.algebricks.core.algebra.functions.FunctionIdentifier;
-import org.apache.hyracks.algebricks.runtime.base.ICopyEvaluator;
-import org.apache.hyracks.algebricks.runtime.base.ICopyEvaluatorFactory;
+import org.apache.hyracks.algebricks.runtime.base.IScalarEvaluator;
+import org.apache.hyracks.algebricks.runtime.base.IScalarEvaluatorFactory;
+import org.apache.hyracks.api.context.IHyracksTaskContext;
 import org.apache.hyracks.api.dataflow.value.ISerializerDeserializer;
-import org.apache.hyracks.data.std.api.IDataOutputProvider;
+import org.apache.hyracks.data.std.api.IPointable;
+import org.apache.hyracks.data.std.primitive.VoidPointable;
 import org.apache.hyracks.data.std.util.ArrayBackedValueStorage;
 import org.apache.hyracks.dataflow.common.data.accessors.IFrameTupleReference;
 import org.apache.hyracks.util.string.UTF8StringUtil;
@@ -55,16 +57,17 @@
     };
 
     @Override
-    public ICopyEvaluatorFactory createEvaluatorFactory(final ICopyEvaluatorFactory[] args) {
-        return new ICopyEvaluatorFactory() {
+    public IScalarEvaluatorFactory createEvaluatorFactory(final IScalarEvaluatorFactory[] args) {
+        return new IScalarEvaluatorFactory() {
             private static final long serialVersionUID = 1L;
 
             @Override
-            public ICopyEvaluator createEvaluator(final IDataOutputProvider output) throws AlgebricksException {
-                return new ICopyEvaluator() {
-                    protected final DataOutput out = output.getDataOutput();;
-                    protected final ArrayBackedValueStorage argOut = new ArrayBackedValueStorage();
-                    protected final ICopyEvaluator stringEval = args[0].createEvaluator(argOut);
+            public IScalarEvaluator createScalarEvaluator(final IHyracksTaskContext ctx) throws AlgebricksException {
+                return new IScalarEvaluator() {
+                    protected final ArrayBackedValueStorage resultStorage = new ArrayBackedValueStorage();
+                    protected final DataOutput out = resultStorage.getDataOutput();
+                    protected final IPointable argPtr = new VoidPointable();
+                    protected final IScalarEvaluator stringEval = args[0].createScalarEvaluator(ctx);
                     protected final AOrderedListType intListType = new AOrderedListType(BuiltinType.AINT64, null);
 
                     private OrderedListBuilder listBuilder = new OrderedListBuilder();
@@ -76,34 +79,35 @@
                     private final AMutableInt64 aInt64 = new AMutableInt64(0);
 
                     @Override
-                    public void evaluate(IFrameTupleReference tuple) throws AlgebricksException {
+                    public void evaluate(IFrameTupleReference tuple, IPointable result) throws AlgebricksException {
                         try {
-                            argOut.reset();
-                            stringEval.evaluate(tuple);
-                            byte[] serString = argOut.getByteArray();
+                            resultStorage.reset();
+                            stringEval.evaluate(tuple, argPtr);
+                            byte[] serString = argPtr.getByteArray();
+                            int offset = argPtr.getStartOffset();
 
-                            if (serString[0] == ATypeTag.SERIALIZED_STRING_TYPE_TAG) {
-                                byte[] bytes = argOut.getByteArray();
-                                int len = UTF8StringUtil.getUTFLength(bytes, 1);
+                            if (serString[offset] == ATypeTag.SERIALIZED_STRING_TYPE_TAG) {
+                                int len = UTF8StringUtil.getUTFLength(serString, offset + 1);
 
-                                int start = 1 + UTF8StringUtil.getNumBytesToStoreLength(len);
+                                int start = offset + 1 + UTF8StringUtil.getNumBytesToStoreLength(len);
                                 int pos = 0;
                                 listBuilder.reset(intListType);
                                 while (pos < len) {
-                                    int codePoint = UTF8StringUtil.UTF8ToCodePoint(bytes, start + pos);
-                                    pos += UTF8StringUtil.charSize(bytes, start + pos);
+                                    int codePoint = UTF8StringUtil.UTF8ToCodePoint(serString, start + pos);
+                                    pos += UTF8StringUtil.charSize(serString, start + pos);
 
                                     inputVal.reset();
                                     aInt64.setValue(codePoint);
                                     int64Serde.serialize(aInt64, inputVal.getDataOutput());
                                     listBuilder.addItem(inputVal);
-
                                 }
                                 listBuilder.write(out, true);
-                            } else
+                            } else {
                                 throw new AlgebricksException(AsterixBuiltinFunctions.STRING_TO_CODEPOINT.getName()
                                         + ": expects input type STRING but got "
-                                        + EnumDeserializer.ATYPETAGDESERIALIZER.deserialize(serString[0]));
+                                        + EnumDeserializer.ATYPETAGDESERIALIZER.deserialize(serString[offset]));
+                            }
+                            result.set(resultStorage);
                         } catch (IOException e1) {
                             throw new AlgebricksException(e1.getMessage());
                         }
diff --git a/asterix-runtime/src/main/java/org/apache/asterix/runtime/evaluators/functions/StringUpperCaseDescriptor.java b/asterix-runtime/src/main/java/org/apache/asterix/runtime/evaluators/functions/StringUpperCaseDescriptor.java
index 02e495f..473ee94 100644
--- a/asterix-runtime/src/main/java/org/apache/asterix/runtime/evaluators/functions/StringUpperCaseDescriptor.java
+++ b/asterix-runtime/src/main/java/org/apache/asterix/runtime/evaluators/functions/StringUpperCaseDescriptor.java
@@ -32,11 +32,13 @@
 import org.apache.asterix.runtime.evaluators.base.AbstractScalarFunctionDynamicDescriptor;
 import org.apache.hyracks.algebricks.common.exceptions.AlgebricksException;
 import org.apache.hyracks.algebricks.core.algebra.functions.FunctionIdentifier;
-import org.apache.hyracks.algebricks.runtime.base.ICopyEvaluator;
-import org.apache.hyracks.algebricks.runtime.base.ICopyEvaluatorFactory;
+import org.apache.hyracks.algebricks.runtime.base.IScalarEvaluator;
+import org.apache.hyracks.algebricks.runtime.base.IScalarEvaluatorFactory;
+import org.apache.hyracks.api.context.IHyracksTaskContext;
 import org.apache.hyracks.api.dataflow.value.ISerializerDeserializer;
-import org.apache.hyracks.data.std.api.IDataOutputProvider;
+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.data.std.util.ArrayBackedValueStorage;
 import org.apache.hyracks.data.std.util.GrowableArray;
 import org.apache.hyracks.data.std.util.UTF8StringBuilder;
@@ -53,17 +55,18 @@
     };
 
     @Override
-    public ICopyEvaluatorFactory createEvaluatorFactory(final ICopyEvaluatorFactory[] args) {
-        return new ICopyEvaluatorFactory() {
+    public IScalarEvaluatorFactory createEvaluatorFactory(final IScalarEvaluatorFactory[] args) {
+        return new IScalarEvaluatorFactory() {
             private static final long serialVersionUID = 1L;
 
             @Override
-            public ICopyEvaluator createEvaluator(final IDataOutputProvider output) throws AlgebricksException {
-                return new ICopyEvaluator() {
+            public IScalarEvaluator createScalarEvaluator(final IHyracksTaskContext ctx) throws AlgebricksException {
+                return new IScalarEvaluator() {
 
-                    private DataOutput out = output.getDataOutput();
-                    private ArrayBackedValueStorage outInput = new ArrayBackedValueStorage();
-                    private ICopyEvaluator eval = args[0].createEvaluator(outInput);
+                    private ArrayBackedValueStorage resultStorage = new ArrayBackedValueStorage();
+                    private DataOutput out = resultStorage.getDataOutput();
+                    private IPointable inputArg = new VoidPointable();
+                    private IScalarEvaluator eval = args[0].createScalarEvaluator(ctx);
 
                     private final byte stt = ATypeTag.SERIALIZED_STRING_TYPE_TAG;
 
@@ -76,26 +79,28 @@
                             .getSerializerDeserializer(BuiltinType.ANULL);
 
                     @Override
-                    public void evaluate(IFrameTupleReference tuple) throws AlgebricksException {
-
+                    public void evaluate(IFrameTupleReference tuple, IPointable result) throws AlgebricksException {
                         try {
-                            outInput.reset();
-                            eval.evaluate(tuple);
-                            byte[] serString = outInput.getByteArray();
+                            resultStorage.reset();
+                            eval.evaluate(tuple, inputArg);
+                            byte[] serString = inputArg.getByteArray();
+                            int offset = inputArg.getStartOffset();
 
-                            if (serString[0] == ATypeTag.SERIALIZED_STRING_TYPE_TAG) {
-                                string.set(serString, 1, serString.length);
+                            if (serString[offset] == ATypeTag.SERIALIZED_STRING_TYPE_TAG) {
+                                string.set(serString, offset + 1, serString.length);
                                 array.reset();
                                 UTF8StringPointable.uppercase(string, builder, array);
 
                                 out.writeByte(stt);
                                 out.write(array.getByteArray(), 0, array.getLength());
-                            } else if (serString[0] == ATypeTag.SERIALIZED_NULL_TYPE_TAG)
+                            } else if (serString[offset] == ATypeTag.SERIALIZED_NULL_TYPE_TAG) {
                                 nullSerde.serialize(ANull.NULL, out);
-                            else
+                            } else {
                                 throw new AlgebricksException(AsterixBuiltinFunctions.STRING_UPPERCASE.getName()
                                         + ": expects input type STRING/NULL but got "
-                                        + EnumDeserializer.ATYPETAGDESERIALIZER.deserialize(serString[0]));
+                                        + EnumDeserializer.ATYPETAGDESERIALIZER.deserialize(serString[offset]));
+                            }
+                            result.set(resultStorage);
                         } catch (IOException e1) {
                             throw new AlgebricksException(e1);
                         }
diff --git a/asterix-runtime/src/main/java/org/apache/asterix/runtime/evaluators/functions/Substring2Descriptor.java b/asterix-runtime/src/main/java/org/apache/asterix/runtime/evaluators/functions/Substring2Descriptor.java
index a3076ce..8abda5f 100644
--- a/asterix-runtime/src/main/java/org/apache/asterix/runtime/evaluators/functions/Substring2Descriptor.java
+++ b/asterix-runtime/src/main/java/org/apache/asterix/runtime/evaluators/functions/Substring2Descriptor.java
@@ -30,11 +30,13 @@
 import org.apache.asterix.runtime.evaluators.base.AbstractScalarFunctionDynamicDescriptor;
 import org.apache.hyracks.algebricks.common.exceptions.AlgebricksException;
 import org.apache.hyracks.algebricks.core.algebra.functions.FunctionIdentifier;
-import org.apache.hyracks.algebricks.runtime.base.ICopyEvaluator;
-import org.apache.hyracks.algebricks.runtime.base.ICopyEvaluatorFactory;
+import org.apache.hyracks.algebricks.runtime.base.IScalarEvaluator;
+import org.apache.hyracks.algebricks.runtime.base.IScalarEvaluatorFactory;
+import org.apache.hyracks.api.context.IHyracksTaskContext;
 import org.apache.hyracks.api.exceptions.HyracksDataException;
-import org.apache.hyracks.data.std.api.IDataOutputProvider;
+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.data.std.util.ArrayBackedValueStorage;
 import org.apache.hyracks.data.std.util.GrowableArray;
 import org.apache.hyracks.data.std.util.UTF8StringBuilder;
@@ -50,44 +52,49 @@
     };
 
     @Override
-    public ICopyEvaluatorFactory createEvaluatorFactory(final ICopyEvaluatorFactory[] args) throws AlgebricksException {
-        return new ICopyEvaluatorFactory() {
+    public IScalarEvaluatorFactory createEvaluatorFactory(final IScalarEvaluatorFactory[] args)
+            throws AlgebricksException {
+        return new IScalarEvaluatorFactory() {
             private static final long serialVersionUID = 1L;
 
             @Override
-            public ICopyEvaluator createEvaluator(final IDataOutputProvider output) throws AlgebricksException {
-                return new ICopyEvaluator() {
+            public IScalarEvaluator createScalarEvaluator(final IHyracksTaskContext ctx) throws AlgebricksException {
+                return new IScalarEvaluator() {
 
-                    private DataOutput out = output.getDataOutput();
-                    private ArrayBackedValueStorage argOut = new ArrayBackedValueStorage();
-                    private ICopyEvaluator evalString = args[0].createEvaluator(argOut);
-                    private ICopyEvaluator evalStart = args[1].createEvaluator(argOut);
-
+                    private ArrayBackedValueStorage resultStorage = new ArrayBackedValueStorage();
+                    private DataOutput out = resultStorage.getDataOutput();
+                    private IPointable argPtr = new VoidPointable();
+                    private IScalarEvaluator evalString = args[0].createScalarEvaluator(ctx);
+                    private IScalarEvaluator evalStart = args[1].createScalarEvaluator(ctx);
                     private final GrowableArray array = new GrowableArray();
                     private final UTF8StringBuilder builder = new UTF8StringBuilder();
                     private final UTF8StringPointable string = new UTF8StringPointable();
 
                     @Override
-                    public void evaluate(IFrameTupleReference tuple) throws AlgebricksException {
-                        argOut.reset();
-                        evalStart.evaluate(tuple);
+                    public void evaluate(IFrameTupleReference tuple, IPointable result) throws AlgebricksException {
+                        resultStorage.reset();
+                        evalStart.evaluate(tuple, argPtr);
                         int start = 0;
 
+                        byte[] bytes = argPtr.getByteArray();
+                        int offset = argPtr.getStartOffset();
+
                         try {
-                            start = ATypeHierarchy.getIntegerValue(argOut.getByteArray(), 0) - 1;
+                            start = ATypeHierarchy.getIntegerValue(bytes, offset) - 1;
                         } catch (HyracksDataException e1) {
                             throw new AlgebricksException(e1);
                         }
-                        argOut.reset();
-                        evalString.evaluate(tuple);
 
-                        byte[] bytes = argOut.getByteArray();
-                        if (bytes[0] != ATypeTag.SERIALIZED_STRING_TYPE_TAG) {
+                        evalString.evaluate(tuple, argPtr);
+                        bytes = argPtr.getByteArray();
+                        offset = argPtr.getStartOffset();
+                        int len = argPtr.getLength();
+                        if (bytes[offset] != ATypeTag.SERIALIZED_STRING_TYPE_TAG) {
                             throw new AlgebricksException(AsterixBuiltinFunctions.SUBSTRING2.getName()
                                     + ": expects type STRING for the first argument but got "
-                                    + EnumDeserializer.ATYPETAGDESERIALIZER.deserialize(argOut.getByteArray()[0]));
+                                    + EnumDeserializer.ATYPETAGDESERIALIZER.deserialize(bytes[offset]));
                         }
-                        string.set(bytes, 1, bytes.length);
+                        string.set(bytes, offset + 1, len - 1);
                         array.reset();
                         try {
                             UTF8StringPointable.substr(string, start, Integer.MAX_VALUE, builder, array);
@@ -104,6 +111,7 @@
                         } catch (IOException e) {
                             throw new AlgebricksException(e);
                         }
+                        result.set(resultStorage);
                     }
                 };
             }
diff --git a/asterix-runtime/src/main/java/org/apache/asterix/runtime/evaluators/functions/SubstringAfterDescriptor.java b/asterix-runtime/src/main/java/org/apache/asterix/runtime/evaluators/functions/SubstringAfterDescriptor.java
index 78f5a66..32db2c2 100644
--- a/asterix-runtime/src/main/java/org/apache/asterix/runtime/evaluators/functions/SubstringAfterDescriptor.java
+++ b/asterix-runtime/src/main/java/org/apache/asterix/runtime/evaluators/functions/SubstringAfterDescriptor.java
@@ -29,10 +29,12 @@
 import org.apache.asterix.runtime.evaluators.base.AbstractScalarFunctionDynamicDescriptor;
 import org.apache.hyracks.algebricks.common.exceptions.AlgebricksException;
 import org.apache.hyracks.algebricks.core.algebra.functions.FunctionIdentifier;
-import org.apache.hyracks.algebricks.runtime.base.ICopyEvaluator;
-import org.apache.hyracks.algebricks.runtime.base.ICopyEvaluatorFactory;
-import org.apache.hyracks.data.std.api.IDataOutputProvider;
+import org.apache.hyracks.algebricks.runtime.base.IScalarEvaluator;
+import org.apache.hyracks.algebricks.runtime.base.IScalarEvaluatorFactory;
+import org.apache.hyracks.api.context.IHyracksTaskContext;
+import org.apache.hyracks.data.std.api.IPointable;
 import org.apache.hyracks.data.std.primitive.UTF8StringPointable;
+import org.apache.hyracks.data.std.primitive.VoidPointable;
 import org.apache.hyracks.data.std.util.ArrayBackedValueStorage;
 import org.apache.hyracks.data.std.util.GrowableArray;
 import org.apache.hyracks.data.std.util.UTF8StringBuilder;
@@ -48,55 +50,64 @@
     };
 
     @Override
-    public ICopyEvaluatorFactory createEvaluatorFactory(final ICopyEvaluatorFactory[] args) throws AlgebricksException {
-        return new ICopyEvaluatorFactory() {
+    public IScalarEvaluatorFactory createEvaluatorFactory(final IScalarEvaluatorFactory[] args)
+            throws AlgebricksException {
+        return new IScalarEvaluatorFactory() {
             private static final long serialVersionUID = 1L;
 
             @Override
-            public ICopyEvaluator createEvaluator(final IDataOutputProvider output) throws AlgebricksException {
-                return new ICopyEvaluator() {
-
-                    private DataOutput out = output.getDataOutput();
-                    private ArrayBackedValueStorage array0 = new ArrayBackedValueStorage();
-                    private ArrayBackedValueStorage array1 = new ArrayBackedValueStorage();
-                    private ICopyEvaluator evalString = args[0].createEvaluator(array0);
-                    private ICopyEvaluator evalPattern = args[1].createEvaluator(array1);
+            public IScalarEvaluator createScalarEvaluator(final IHyracksTaskContext ctx) throws AlgebricksException {
+                return new IScalarEvaluator() {
+                    private ArrayBackedValueStorage resultStorage = new ArrayBackedValueStorage();
+                    private DataOutput out = resultStorage.getDataOutput();
+                    private IPointable array0 = new VoidPointable();
+                    private IPointable array1 = new VoidPointable();
+                    private IScalarEvaluator evalString = args[0].createScalarEvaluator(ctx);
+                    private IScalarEvaluator evalPattern = args[1].createScalarEvaluator(ctx);
                     private final GrowableArray array = new GrowableArray();
                     private final UTF8StringBuilder builder = new UTF8StringBuilder();
                     private final UTF8StringPointable stringPtr = new UTF8StringPointable();
                     private final UTF8StringPointable patternPtr = new UTF8StringPointable();
 
                     @Override
-                    public void evaluate(IFrameTupleReference tuple) throws AlgebricksException {
-                        array0.reset();
-                        evalString.evaluate(tuple);
+                    public void evaluate(IFrameTupleReference tuple, IPointable result) throws AlgebricksException {
+                        resultStorage.reset();
+                        evalString.evaluate(tuple, array0);
                         byte[] src = array0.getByteArray();
-
-                        array1.reset();
-                        evalPattern.evaluate(tuple);
+                        int srcOffset = array0.getStartOffset();
+                        int srcLen = array0.getLength();
+                        evalPattern.evaluate(tuple, array1);
                         byte[] pattern = array1.getByteArray();
+                        int patternOffset = array1.getStartOffset();
+                        int patternLen = array1.getLength();
 
-                        if ((src[0] != ATypeTag.SERIALIZED_STRING_TYPE_TAG
-                                && src[0] != ATypeTag.SERIALIZED_NULL_TYPE_TAG)
-                                || (pattern[0] != ATypeTag.SERIALIZED_STRING_TYPE_TAG
-                                        && pattern[0] != ATypeTag.SERIALIZED_NULL_TYPE_TAG)) {
+                        if ((src[srcOffset] != ATypeTag.SERIALIZED_STRING_TYPE_TAG
+                                && src[srcOffset] != ATypeTag.SERIALIZED_NULL_TYPE_TAG)
+                                || (pattern[patternOffset] != ATypeTag.SERIALIZED_STRING_TYPE_TAG
+                                        && pattern[patternOffset] != ATypeTag.SERIALIZED_NULL_TYPE_TAG)) {
                             throw new AlgebricksException(AsterixBuiltinFunctions.SUBSTRING_AFTER.getName()
                                     + ": expects input type (STRING/NULL, STRING/NULL) but got ("
-                                    + EnumDeserializer.ATYPETAGDESERIALIZER.deserialize(src[0]) + ", "
-                                    + EnumDeserializer.ATYPETAGDESERIALIZER.deserialize(pattern[0]) + ").");
+                                    + EnumDeserializer.ATYPETAGDESERIALIZER.deserialize(src[srcOffset]) + ", "
+                                    + EnumDeserializer.ATYPETAGDESERIALIZER.deserialize(pattern[patternOffset]) + ").");
                         }
-
-                        stringPtr.set(src, 1, src.length);
-                        patternPtr.set(pattern, 1, pattern.length);
-                        array.reset();
                         try {
+                            if (src[srcOffset] == ATypeTag.SERIALIZED_NULL_TYPE_TAG
+                                    || pattern[patternOffset] == ATypeTag.SERIALIZED_NULL_TYPE_TAG) {
+                                out.writeByte(ATypeTag.SERIALIZED_NULL_TYPE_TAG);
+                                result.set(resultStorage);
+                                return;
+                            }
+                            stringPtr.set(src, srcOffset + 1, srcLen - 1);
+                            patternPtr.set(pattern, patternOffset + 1, patternLen - 1);
+                            array.reset();
+
                             UTF8StringPointable.substrAfter(stringPtr, patternPtr, builder, array);
                             out.writeByte(ATypeTag.SERIALIZED_STRING_TYPE_TAG);
                             out.write(array.getByteArray(), 0, array.getLength());
                         } catch (IOException e) {
                             throw new AlgebricksException(e);
                         }
-
+                        result.set(resultStorage);
                     }
                 }
 
diff --git a/asterix-runtime/src/main/java/org/apache/asterix/runtime/evaluators/functions/SubstringBeforeDescriptor.java b/asterix-runtime/src/main/java/org/apache/asterix/runtime/evaluators/functions/SubstringBeforeDescriptor.java
index dd9a91a..f418213 100644
--- a/asterix-runtime/src/main/java/org/apache/asterix/runtime/evaluators/functions/SubstringBeforeDescriptor.java
+++ b/asterix-runtime/src/main/java/org/apache/asterix/runtime/evaluators/functions/SubstringBeforeDescriptor.java
@@ -29,10 +29,12 @@
 import org.apache.asterix.runtime.evaluators.base.AbstractScalarFunctionDynamicDescriptor;
 import org.apache.hyracks.algebricks.common.exceptions.AlgebricksException;
 import org.apache.hyracks.algebricks.core.algebra.functions.FunctionIdentifier;
-import org.apache.hyracks.algebricks.runtime.base.ICopyEvaluator;
-import org.apache.hyracks.algebricks.runtime.base.ICopyEvaluatorFactory;
-import org.apache.hyracks.data.std.api.IDataOutputProvider;
+import org.apache.hyracks.algebricks.runtime.base.IScalarEvaluator;
+import org.apache.hyracks.algebricks.runtime.base.IScalarEvaluatorFactory;
+import org.apache.hyracks.api.context.IHyracksTaskContext;
+import org.apache.hyracks.data.std.api.IPointable;
 import org.apache.hyracks.data.std.primitive.UTF8StringPointable;
+import org.apache.hyracks.data.std.primitive.VoidPointable;
 import org.apache.hyracks.data.std.util.ArrayBackedValueStorage;
 import org.apache.hyracks.data.std.util.GrowableArray;
 import org.apache.hyracks.data.std.util.UTF8StringBuilder;
@@ -48,54 +50,66 @@
     };
 
     @Override
-    public ICopyEvaluatorFactory createEvaluatorFactory(final ICopyEvaluatorFactory[] args) throws AlgebricksException {
-        return new ICopyEvaluatorFactory() {
+    public IScalarEvaluatorFactory createEvaluatorFactory(final IScalarEvaluatorFactory[] args)
+            throws AlgebricksException {
+        return new IScalarEvaluatorFactory() {
             private static final long serialVersionUID = 1L;
 
             @Override
-            public ICopyEvaluator createEvaluator(final IDataOutputProvider output) throws AlgebricksException {
-                return new ICopyEvaluator() {
-                    private DataOutput out = output.getDataOutput();
-                    private ArrayBackedValueStorage array0 = new ArrayBackedValueStorage();
-                    private ArrayBackedValueStorage array1 = new ArrayBackedValueStorage();
-                    private ICopyEvaluator evalString = args[0].createEvaluator(array0);
-                    private ICopyEvaluator evalPattern = args[1].createEvaluator(array1);
+            public IScalarEvaluator createScalarEvaluator(final IHyracksTaskContext ctx) throws AlgebricksException {
+                return new IScalarEvaluator() {
+
+                    private ArrayBackedValueStorage resultStorage = new ArrayBackedValueStorage();
+                    private DataOutput out = resultStorage.getDataOutput();
+                    private IPointable array0 = new VoidPointable();
+                    private IPointable array1 = new VoidPointable();
+                    private IScalarEvaluator evalString = args[0].createScalarEvaluator(ctx);
+                    private IScalarEvaluator evalPattern = args[1].createScalarEvaluator(ctx);
                     private final GrowableArray array = new GrowableArray();
                     private final UTF8StringBuilder builder = new UTF8StringBuilder();
                     private final UTF8StringPointable stringPtr = new UTF8StringPointable();
                     private final UTF8StringPointable patternPtr = new UTF8StringPointable();
 
                     @Override
-                    public void evaluate(IFrameTupleReference tuple) throws AlgebricksException {
-                        array0.reset();
-                        evalString.evaluate(tuple);
+                    public void evaluate(IFrameTupleReference tuple, IPointable result) throws AlgebricksException {
+                        resultStorage.reset();
+                        evalString.evaluate(tuple, array0);
                         byte[] src = array0.getByteArray();
+                        int srcOffset = array0.getStartOffset();
+                        int srcLen = array0.getLength();
 
-                        array1.reset();
-                        evalPattern.evaluate(tuple);
+                        evalPattern.evaluate(tuple, array1);
                         byte[] pattern = array1.getByteArray();
+                        int patternOffset = array1.getStartOffset();
+                        int patternLen = array1.getLength();
 
-                        if ((src[0] != ATypeTag.SERIALIZED_STRING_TYPE_TAG
-                                && src[0] != ATypeTag.SERIALIZED_NULL_TYPE_TAG)
-                                || (pattern[0] != ATypeTag.SERIALIZED_STRING_TYPE_TAG
-                                        && pattern[0] != ATypeTag.SERIALIZED_NULL_TYPE_TAG)) {
+                        if ((src[srcOffset] != ATypeTag.SERIALIZED_STRING_TYPE_TAG
+                                && src[srcOffset] != ATypeTag.SERIALIZED_NULL_TYPE_TAG)
+                                || (pattern[patternOffset] != ATypeTag.SERIALIZED_STRING_TYPE_TAG
+                                        && pattern[patternOffset] != ATypeTag.SERIALIZED_NULL_TYPE_TAG)) {
                             throw new AlgebricksException(AsterixBuiltinFunctions.SUBSTRING_BEFORE.getName()
                                     + ": expects input type (STRING/NULL, STRING/NULL) but got ("
-                                    + EnumDeserializer.ATYPETAGDESERIALIZER.deserialize(src[0]) + ", "
-                                    + EnumDeserializer.ATYPETAGDESERIALIZER.deserialize(pattern[0]) + ").");
+                                    + EnumDeserializer.ATYPETAGDESERIALIZER.deserialize(src[srcOffset]) + ", "
+                                    + EnumDeserializer.ATYPETAGDESERIALIZER.deserialize(pattern[patternOffset]) + ").");
                         }
 
-                        stringPtr.set(src, 1, src.length);
-                        patternPtr.set(pattern, 1, pattern.length);
-                        array.reset();
                         try {
+                            if (src[srcOffset] == ATypeTag.SERIALIZED_NULL_TYPE_TAG
+                                    || pattern[patternOffset] == ATypeTag.SERIALIZED_NULL_TYPE_TAG) {
+                                out.writeByte(ATypeTag.SERIALIZED_NULL_TYPE_TAG);
+                                result.set(resultStorage);
+                                return;
+                            }
+                            stringPtr.set(src, srcOffset + 1, srcLen - 1);
+                            patternPtr.set(pattern, patternOffset + 1, patternLen - 1);
+                            array.reset();
                             UTF8StringPointable.substrBefore(stringPtr, patternPtr, builder, array);
                             out.writeByte(ATypeTag.SERIALIZED_STRING_TYPE_TAG);
                             out.write(array.getByteArray(), 0, array.getLength());
                         } catch (IOException e) {
                             throw new AlgebricksException(e);
                         }
-
+                        result.set(resultStorage);
                     }
                 };
             }
diff --git a/asterix-runtime/src/main/java/org/apache/asterix/runtime/evaluators/functions/SubstringDescriptor.java b/asterix-runtime/src/main/java/org/apache/asterix/runtime/evaluators/functions/SubstringDescriptor.java
index 07b3b64..660fbb8 100644
--- a/asterix-runtime/src/main/java/org/apache/asterix/runtime/evaluators/functions/SubstringDescriptor.java
+++ b/asterix-runtime/src/main/java/org/apache/asterix/runtime/evaluators/functions/SubstringDescriptor.java
@@ -28,15 +28,17 @@
 import org.apache.asterix.runtime.evaluators.base.AbstractScalarFunctionDynamicDescriptor;
 import org.apache.hyracks.algebricks.common.exceptions.AlgebricksException;
 import org.apache.hyracks.algebricks.core.algebra.functions.FunctionIdentifier;
-import org.apache.hyracks.algebricks.runtime.base.ICopyEvaluator;
-import org.apache.hyracks.algebricks.runtime.base.ICopyEvaluatorFactory;
-import org.apache.hyracks.data.std.api.IDataOutputProvider;
+import org.apache.hyracks.algebricks.runtime.base.IScalarEvaluator;
+import org.apache.hyracks.algebricks.runtime.base.IScalarEvaluatorFactory;
+import org.apache.hyracks.api.context.IHyracksTaskContext;
+import org.apache.hyracks.data.std.api.IPointable;
 import org.apache.hyracks.data.std.primitive.DoublePointable;
 import org.apache.hyracks.data.std.primitive.FloatPointable;
 import org.apache.hyracks.data.std.primitive.IntegerPointable;
 import org.apache.hyracks.data.std.primitive.LongPointable;
 import org.apache.hyracks.data.std.primitive.ShortPointable;
 import org.apache.hyracks.data.std.primitive.UTF8StringPointable;
+import org.apache.hyracks.data.std.primitive.VoidPointable;
 import org.apache.hyracks.data.std.util.ArrayBackedValueStorage;
 import org.apache.hyracks.data.std.util.GrowableArray;
 import org.apache.hyracks.data.std.util.UTF8StringBuilder;
@@ -54,100 +56,105 @@
     };
 
     @Override
-    public ICopyEvaluatorFactory createEvaluatorFactory(final ICopyEvaluatorFactory[] args) throws AlgebricksException {
-        return new ICopyEvaluatorFactory() {
+    public IScalarEvaluatorFactory createEvaluatorFactory(final IScalarEvaluatorFactory[] args)
+            throws AlgebricksException {
+        return new IScalarEvaluatorFactory() {
             private static final long serialVersionUID = 1L;
 
             @Override
-            public ICopyEvaluator createEvaluator(final IDataOutputProvider output) throws AlgebricksException {
-                return new ICopyEvaluator() {
+            public IScalarEvaluator createScalarEvaluator(final IHyracksTaskContext ctx) throws AlgebricksException {
+                return new IScalarEvaluator() {
 
-                    private final DataOutput out = output.getDataOutput();
-                    private final ArrayBackedValueStorage argOut = new ArrayBackedValueStorage();
-                    private final ICopyEvaluator evalString = args[0].createEvaluator(argOut);
-                    private final ICopyEvaluator evalStart = args[1].createEvaluator(argOut);
-                    private final ICopyEvaluator evalLen = args[2].createEvaluator(argOut);
+                    private final ArrayBackedValueStorage resultStorage = new ArrayBackedValueStorage();
+                    private final DataOutput out = resultStorage.getDataOutput();
+                    private final IPointable argPtr = new VoidPointable();
+                    private final IScalarEvaluator evalString = args[0].createScalarEvaluator(ctx);
+                    private final IScalarEvaluator evalStart = args[1].createScalarEvaluator(ctx);
+                    private final IScalarEvaluator evalLen = args[2].createScalarEvaluator(ctx);
 
                     private final GrowableArray array = new GrowableArray();
                     private final UTF8StringBuilder builder = new UTF8StringBuilder();
                     private final UTF8StringPointable string = new UTF8StringPointable();
 
                     @Override
-                    public void evaluate(IFrameTupleReference tuple) throws AlgebricksException {
-                        argOut.reset();
-                        evalStart.evaluate(tuple);
+                    public void evaluate(IFrameTupleReference tuple, IPointable result) throws AlgebricksException {
+                        resultStorage.reset();
+                        evalStart.evaluate(tuple, argPtr);
+                        byte[] bytes = argPtr.getByteArray();
+                        int offset = argPtr.getStartOffset();
                         int start = 0;
 
-                        ATypeTag argOutTypeTag = ATypeTag.VALUE_TYPE_MAPPING[argOut.getByteArray()[0]];
+                        ATypeTag argPtrTypeTag = ATypeTag.VALUE_TYPE_MAPPING[bytes[offset]];
 
-                        switch (argOutTypeTag) {
+                        switch (argPtrTypeTag) {
                             case INT64:
-                                start = (int) LongPointable.getLong(argOut.getByteArray(), 1) - 1;
+                                start = (int) LongPointable.getLong(bytes, offset + 1) - 1;
                                 break;
                             case INT32:
-                                start = IntegerPointable.getInteger(argOut.getByteArray(), 1) - 1;
+                                start = IntegerPointable.getInteger(bytes, offset + 1) - 1;
                                 break;
                             case INT8:
-                                start = argOut.getByteArray()[1] - 1;
+                                start = bytes[offset + 1] - 1;
                                 break;
                             case INT16:
-                                start = ShortPointable.getShort(argOut.getByteArray(), 1) - 1;
+                                start = ShortPointable.getShort(bytes, offset + 1) - 1;
                                 break;
                             case FLOAT:
-                                start = (int) FloatPointable.getFloat(argOut.getByteArray(), 1) - 1;
+                                start = (int) FloatPointable.getFloat(bytes, offset + 1) - 1;
                                 break;
                             case DOUBLE:
-                                start = (int) DoublePointable.getDouble(argOut.getByteArray(), 1) - 1;
+                                start = (int) DoublePointable.getDouble(bytes, offset + 1) - 1;
                                 break;
                             default:
                                 throw new AlgebricksException(AsterixBuiltinFunctions.SUBSTRING.getName()
                                         + ": expects type INT8/16/32/64/FLOAT/DOUBLE for the second argument but got "
-                                        + argOutTypeTag);
+                                        + argPtrTypeTag);
                         }
 
-                        argOut.reset();
-                        evalLen.evaluate(tuple);
+                        evalLen.evaluate(tuple, argPtr);
+                        bytes = argPtr.getByteArray();
+                        offset = argPtr.getStartOffset();
                         int len = 0;
 
-                        argOutTypeTag = ATypeTag.VALUE_TYPE_MAPPING[argOut.getByteArray()[0]];
+                        argPtrTypeTag = ATypeTag.VALUE_TYPE_MAPPING[bytes[offset]];
 
-                        switch (argOutTypeTag) {
+                        switch (argPtrTypeTag) {
                             case INT64:
-                                len = (int) LongPointable.getLong(argOut.getByteArray(), 1);
+                                len = (int) LongPointable.getLong(bytes, offset + 1);
                                 break;
                             case INT32:
-                                len = IntegerPointable.getInteger(argOut.getByteArray(), 1);
+                                len = IntegerPointable.getInteger(bytes, offset + 1);
                                 break;
                             case INT8:
-                                len = argOut.getByteArray()[1];
+                                len = bytes[offset + 1];
                                 break;
                             case INT16:
-                                len = ShortPointable.getShort(argOut.getByteArray(), 1);
+                                len = ShortPointable.getShort(bytes, offset + 1);
                                 break;
                             case FLOAT:
-                                len = (int) FloatPointable.getFloat(argOut.getByteArray(), 1);
+                                len = (int) FloatPointable.getFloat(bytes, offset + 1);
                                 break;
                             case DOUBLE:
-                                len = (int) DoublePointable.getDouble(argOut.getByteArray(), 1);
+                                len = (int) DoublePointable.getDouble(bytes, offset + 1);
                                 break;
                             default:
                                 throw new AlgebricksException(AsterixBuiltinFunctions.SUBSTRING.getName()
                                         + ": expects type INT8/16/32/64/FLOAT/DOUBLE for the third argument but got "
-                                        + argOutTypeTag);
+                                        + argPtrTypeTag);
                         }
 
-                        argOut.reset();
-                        evalString.evaluate(tuple);
+                        evalString.evaluate(tuple, argPtr);
+                        bytes = argPtr.getByteArray();
+                        offset = argPtr.getStartOffset();
+                        int length = argPtr.getLength();
+                        argPtrTypeTag = ATypeTag.VALUE_TYPE_MAPPING[bytes[offset]];
 
-                        byte[] bytes = argOut.getByteArray();
-                        argOutTypeTag = ATypeTag.VALUE_TYPE_MAPPING[bytes[0]];
-
-                        if (argOutTypeTag != ATypeTag.STRING) {
+                        if (argPtrTypeTag != ATypeTag.STRING) {
                             throw new AlgebricksException(AsterixBuiltinFunctions.SUBSTRING.getName()
-                                    + ": expects type STRING for the first argument but got " + argOutTypeTag);
+                                    + ": expects type STRING for the first argument but got " + argPtrTypeTag);
                         }
 
-                        string.set(bytes, 1, bytes.length);
+                        string.set(bytes, offset + 1, length - 1);
                         array.reset();
                         try {
                             UTF8StringPointable.substr(string, start, len, builder, array);
@@ -164,6 +171,7 @@
                         } catch (IOException e) {
                             throw new AlgebricksException(e);
                         }
+                        result.set(resultStorage);
                     }
                 };
             }
diff --git a/asterix-runtime/src/main/java/org/apache/asterix/runtime/evaluators/functions/SwitchCaseDescriptor.java b/asterix-runtime/src/main/java/org/apache/asterix/runtime/evaluators/functions/SwitchCaseDescriptor.java
index 1fb3108..df0b973 100644
--- a/asterix-runtime/src/main/java/org/apache/asterix/runtime/evaluators/functions/SwitchCaseDescriptor.java
+++ b/asterix-runtime/src/main/java/org/apache/asterix/runtime/evaluators/functions/SwitchCaseDescriptor.java
@@ -18,25 +18,24 @@
  */
 package org.apache.asterix.runtime.evaluators.functions;
 
-import java.io.IOException;
-
 import org.apache.asterix.om.functions.AsterixBuiltinFunctions;
 import org.apache.asterix.om.functions.IFunctionDescriptor;
 import org.apache.asterix.om.functions.IFunctionDescriptorFactory;
 import org.apache.asterix.runtime.evaluators.base.AbstractScalarFunctionDynamicDescriptor;
 import org.apache.hyracks.algebricks.common.exceptions.AlgebricksException;
 import org.apache.hyracks.algebricks.core.algebra.functions.FunctionIdentifier;
-import org.apache.hyracks.algebricks.runtime.base.ICopyEvaluator;
-import org.apache.hyracks.algebricks.runtime.base.ICopyEvaluatorFactory;
-import org.apache.hyracks.api.exceptions.HyracksDataException;
-import org.apache.hyracks.data.std.api.IDataOutputProvider;
-import org.apache.hyracks.data.std.util.ArrayBackedValueStorage;
+import org.apache.hyracks.algebricks.runtime.base.IScalarEvaluator;
+import org.apache.hyracks.algebricks.runtime.base.IScalarEvaluatorFactory;
+import org.apache.hyracks.api.context.IHyracksTaskContext;
+import org.apache.hyracks.data.std.api.IPointable;
+import org.apache.hyracks.data.std.primitive.VoidPointable;
 import org.apache.hyracks.dataflow.common.data.accessors.IFrameTupleReference;
 
 public class SwitchCaseDescriptor extends AbstractScalarFunctionDynamicDescriptor {
 
     private static final long serialVersionUID = 1L;
     public static final IFunctionDescriptorFactory FACTORY = new IFunctionDescriptorFactory() {
+        @Override
         public IFunctionDescriptor createFunctionDescriptor() {
             return new SwitchCaseDescriptor();
         }
@@ -48,65 +47,55 @@
     }
 
     @Override
-    public ICopyEvaluatorFactory createEvaluatorFactory(final ICopyEvaluatorFactory[] args) throws AlgebricksException {
+    public IScalarEvaluatorFactory createEvaluatorFactory(final IScalarEvaluatorFactory[] args)
+            throws AlgebricksException {
 
-        return new ICopyEvaluatorFactory() {
+        return new IScalarEvaluatorFactory() {
             private static final long serialVersionUID = 1L;
 
             @Override
-            public ICopyEvaluator createEvaluator(final IDataOutputProvider output) throws AlgebricksException {
-                final ArrayBackedValueStorage condOut = new ArrayBackedValueStorage();
-                final ArrayBackedValueStorage caseOut = new ArrayBackedValueStorage();
-                final ArrayBackedValueStorage argOut = new ArrayBackedValueStorage();
+            public IScalarEvaluator createScalarEvaluator(final IHyracksTaskContext ctx) throws AlgebricksException {
+                final IPointable condPtr = new VoidPointable();
+                final IPointable casePtr = new VoidPointable();
+                final IPointable argPtr = new VoidPointable();
 
-                final ICopyEvaluator[] evals = new ICopyEvaluator[args.length];
+                final IScalarEvaluator[] evals = new IScalarEvaluator[args.length];
                 // condition
-                evals[0] = args[0].createEvaluator(condOut);
+                evals[0] = args[0].createScalarEvaluator(ctx);
                 // case value
                 for (int i = 1; i < evals.length - 1; i += 2) {
-                    evals[i] = args[i].createEvaluator(caseOut);
+                    evals[i] = args[i].createScalarEvaluator(ctx);
                 }
                 // case expression
                 for (int i = 2; i < evals.length - 1; i += 2) {
-                    evals[i] = args[i].createEvaluator(argOut);
+                    evals[i] = args[i].createScalarEvaluator(ctx);
                 }
                 // default expression
-                evals[evals.length - 1] = args[evals.length - 1].createEvaluator(argOut);
+                evals[evals.length - 1] = args[evals.length - 1].createScalarEvaluator(ctx);
 
-                return new ICopyEvaluator() {
+                return new IScalarEvaluator() {
 
                     @Override
-                    public void evaluate(IFrameTupleReference tuple) throws AlgebricksException {
-                        try {
-                            int n = args.length;
-                            condOut.reset();
-                            evals[0].evaluate(tuple);
-                            for (int i = 1; i < n; i += 2) {
-                                caseOut.reset();
-                                evals[i].evaluate(tuple);
-                                if (equals(condOut, caseOut)) {
-                                    argOut.reset();
-                                    evals[i + 1].evaluate(tuple);
-                                    output.getDataOutput().write(argOut.getByteArray(), argOut.getStartOffset(),
-                                            argOut.getLength());
-                                    return;
-                                }
+                    public void evaluate(IFrameTupleReference tuple, IPointable result) throws AlgebricksException {
+                        int n = args.length;
+                        evals[0].evaluate(tuple, condPtr);
+                        for (int i = 1; i < n; i += 2) {
+                            evals[i].evaluate(tuple, casePtr);
+                            if (equals(condPtr, casePtr)) {
+                                evals[i + 1].evaluate(tuple, argPtr);
+                                result.set(argPtr);
+                                return;
                             }
-                            // the default case
-                            argOut.reset();
-                            evals[n - 1].evaluate(tuple);
-                            output.getDataOutput().write(argOut.getByteArray(), argOut.getStartOffset(),
-                                    argOut.getLength());
-                        } catch (HyracksDataException hde) {
-                            throw new AlgebricksException(hde);
-                        } catch (IOException ioe) {
-                            throw new AlgebricksException(ioe);
                         }
+                        // the default case
+                        evals[n - 1].evaluate(tuple, argPtr);
+                        result.set(argPtr);
                     }
 
-                    private boolean equals(ArrayBackedValueStorage out1, ArrayBackedValueStorage out2) {
-                        if (out1.getStartOffset() != out2.getStartOffset() || out1.getLength() != out2.getLength())
+                    private boolean equals(IPointable out1, IPointable out2) {
+                        if (out1.getStartOffset() != out2.getStartOffset() || out1.getLength() != out2.getLength()) {
                             return false;
+                        }
                         byte[] data1 = out1.getByteArray();
                         byte[] data2 = out2.getByteArray();
                         for (int i = out1.getStartOffset(); i < out1.getLength(); i++) {
diff --git a/asterix-runtime/src/main/java/org/apache/asterix/runtime/evaluators/functions/UnorderedListConstructorDescriptor.java b/asterix-runtime/src/main/java/org/apache/asterix/runtime/evaluators/functions/UnorderedListConstructorDescriptor.java
index 14e28e8..ce08ba8 100644
--- a/asterix-runtime/src/main/java/org/apache/asterix/runtime/evaluators/functions/UnorderedListConstructorDescriptor.java
+++ b/asterix-runtime/src/main/java/org/apache/asterix/runtime/evaluators/functions/UnorderedListConstructorDescriptor.java
@@ -30,9 +30,11 @@
 import org.apache.asterix.runtime.evaluators.base.AbstractScalarFunctionDynamicDescriptor;
 import org.apache.hyracks.algebricks.common.exceptions.AlgebricksException;
 import org.apache.hyracks.algebricks.core.algebra.functions.FunctionIdentifier;
-import org.apache.hyracks.algebricks.runtime.base.ICopyEvaluator;
-import org.apache.hyracks.algebricks.runtime.base.ICopyEvaluatorFactory;
-import org.apache.hyracks.data.std.api.IDataOutputProvider;
+import org.apache.hyracks.algebricks.runtime.base.IScalarEvaluator;
+import org.apache.hyracks.algebricks.runtime.base.IScalarEvaluatorFactory;
+import org.apache.hyracks.api.context.IHyracksTaskContext;
+import org.apache.hyracks.data.std.api.IPointable;
+import org.apache.hyracks.data.std.primitive.VoidPointable;
 import org.apache.hyracks.data.std.util.ArrayBackedValueStorage;
 import org.apache.hyracks.dataflow.common.data.accessors.IFrameTupleReference;
 
@@ -40,6 +42,7 @@
 
     private static final long serialVersionUID = 1L;
     public static final IFunctionDescriptorFactory FACTORY = new IFunctionDescriptorFactory() {
+        @Override
         public IFunctionDescriptor createFunctionDescriptor() {
             return new UnorderedListConstructorDescriptor();
         }
@@ -57,43 +60,44 @@
     }
 
     @Override
-    public ICopyEvaluatorFactory createEvaluatorFactory(final ICopyEvaluatorFactory[] args) {
+    public IScalarEvaluatorFactory createEvaluatorFactory(final IScalarEvaluatorFactory[] args) {
         return new UnorderedListConstructorEvaluatorFactory(args, ultype);
     }
 
-    private static class UnorderedListConstructorEvaluatorFactory implements ICopyEvaluatorFactory {
+    private static class UnorderedListConstructorEvaluatorFactory implements IScalarEvaluatorFactory {
 
         private static final long serialVersionUID = 1L;
-        private ICopyEvaluatorFactory[] args;
+        private IScalarEvaluatorFactory[] args;
 
         private boolean selfDescList = false;
         private boolean homoList = false;
         private AUnorderedListType unorderedlistType;
 
-        public UnorderedListConstructorEvaluatorFactory(ICopyEvaluatorFactory[] args, AUnorderedListType type) {
+        public UnorderedListConstructorEvaluatorFactory(IScalarEvaluatorFactory[] args, AUnorderedListType type) {
             this.args = args;
             this.unorderedlistType = type;
-            if (type == null || type.getItemType() == null || type.getItemType().getTypeTag() == ATypeTag.ANY)
+            if (type == null || type.getItemType() == null || type.getItemType().getTypeTag() == ATypeTag.ANY) {
                 this.selfDescList = true;
-            else
+            } else {
                 this.homoList = true;
+            }
         }
 
         @Override
-        public ICopyEvaluator createEvaluator(IDataOutputProvider output) throws AlgebricksException {
-            final DataOutput out = output.getDataOutput();
-            final ArrayBackedValueStorage inputVal = new ArrayBackedValueStorage();
-            final ICopyEvaluator[] argEvals = new ICopyEvaluator[args.length];
+        public IScalarEvaluator createScalarEvaluator(IHyracksTaskContext ctx) throws AlgebricksException {
+            final IPointable inputVal = new VoidPointable();
+            final IScalarEvaluator[] argEvals = new IScalarEvaluator[args.length];
             for (int i = 0; i < args.length; i++) {
-                argEvals[i] = args[i].createEvaluator(inputVal);
+                argEvals[i] = args[i].createScalarEvaluator(ctx);
             }
 
-            return new ICopyEvaluator() {
-
+            return new IScalarEvaluator() {
+                private ArrayBackedValueStorage resultStorage = new ArrayBackedValueStorage();
+                private DataOutput out = resultStorage.getDataOutput();
                 private UnorderedListBuilder builder = new UnorderedListBuilder();
 
                 @Override
-                public void evaluate(IFrameTupleReference tuple) throws AlgebricksException {
+                public void evaluate(IFrameTupleReference tuple, IPointable result) throws AlgebricksException {
                     try {
                         builder.reset(unorderedlistType);
                         if (selfDescList) {
@@ -102,7 +106,9 @@
                         if (homoList) {
                             this.writeTypedItems(tuple);
                         }
+                        resultStorage.reset();
                         builder.write(out, true);
+                        result.set(resultStorage);
                     } catch (IOException ioe) {
                         throw new AlgebricksException(ioe);
                     }
@@ -112,8 +118,7 @@
 
                     try {
                         for (int i = 0; i < argEvals.length; i++) {
-                            inputVal.reset();
-                            argEvals[i].evaluate(tuple);
+                            argEvals[i].evaluate(tuple, inputVal);
                             builder.addItem(inputVal);
                         }
                     } catch (IOException ioe) {
@@ -125,8 +130,7 @@
 
                     try {
                         for (int i = 0; i < argEvals.length; i++) {
-                            inputVal.reset();
-                            argEvals[i].evaluate(tuple);
+                            argEvals[i].evaluate(tuple, inputVal);
                             builder.addItem(inputVal);
                         }
                     } catch (IOException ioe) {
diff --git a/asterix-runtime/src/main/java/org/apache/asterix/runtime/evaluators/functions/WordTokensDescriptor.java b/asterix-runtime/src/main/java/org/apache/asterix/runtime/evaluators/functions/WordTokensDescriptor.java
index baad139..7c1117f 100644
--- a/asterix-runtime/src/main/java/org/apache/asterix/runtime/evaluators/functions/WordTokensDescriptor.java
+++ b/asterix-runtime/src/main/java/org/apache/asterix/runtime/evaluators/functions/WordTokensDescriptor.java
@@ -26,9 +26,9 @@
 import org.apache.asterix.runtime.evaluators.common.WordTokensEvaluator;
 import org.apache.hyracks.algebricks.common.exceptions.AlgebricksException;
 import org.apache.hyracks.algebricks.core.algebra.functions.FunctionIdentifier;
-import org.apache.hyracks.algebricks.runtime.base.ICopyEvaluator;
-import org.apache.hyracks.algebricks.runtime.base.ICopyEvaluatorFactory;
-import org.apache.hyracks.data.std.api.IDataOutputProvider;
+import org.apache.hyracks.algebricks.runtime.base.IScalarEvaluator;
+import org.apache.hyracks.algebricks.runtime.base.IScalarEvaluatorFactory;
+import org.apache.hyracks.api.context.IHyracksTaskContext;
 import org.apache.hyracks.storage.am.lsm.invertedindex.tokenizers.DelimitedUTF8StringBinaryTokenizer;
 import org.apache.hyracks.storage.am.lsm.invertedindex.tokenizers.IBinaryTokenizer;
 import org.apache.hyracks.storage.am.lsm.invertedindex.tokenizers.ITokenFactory;
@@ -38,6 +38,7 @@
 
     private static final long serialVersionUID = 1L;
     public static final IFunctionDescriptorFactory FACTORY = new IFunctionDescriptorFactory() {
+        @Override
         public IFunctionDescriptor createFunctionDescriptor() {
             return new WordTokensDescriptor();
         }
@@ -49,15 +50,16 @@
     }
 
     @Override
-    public ICopyEvaluatorFactory createEvaluatorFactory(final ICopyEvaluatorFactory[] args) throws AlgebricksException {
-        return new ICopyEvaluatorFactory() {
+    public IScalarEvaluatorFactory createEvaluatorFactory(final IScalarEvaluatorFactory[] args)
+            throws AlgebricksException {
+        return new IScalarEvaluatorFactory() {
             private static final long serialVersionUID = 1L;
 
             @Override
-            public ICopyEvaluator createEvaluator(IDataOutputProvider output) throws AlgebricksException {
+            public IScalarEvaluator createScalarEvaluator(IHyracksTaskContext ctx) throws AlgebricksException {
                 ITokenFactory tokenFactory = new UTF8WordTokenFactory();
                 IBinaryTokenizer tokenizer = new DelimitedUTF8StringBinaryTokenizer(true, true, tokenFactory);
-                return new WordTokensEvaluator(args, output, tokenizer, BuiltinType.ASTRING);
+                return new WordTokensEvaluator(args, ctx, tokenizer, BuiltinType.ASTRING);
             }
         };
     }
diff --git a/asterix-runtime/src/main/java/org/apache/asterix/runtime/evaluators/functions/binary/AbstractCopyEvaluator.java b/asterix-runtime/src/main/java/org/apache/asterix/runtime/evaluators/functions/binary/AbstractBinaryScalarEvaluator.java
similarity index 74%
rename from asterix-runtime/src/main/java/org/apache/asterix/runtime/evaluators/functions/binary/AbstractCopyEvaluator.java
rename to asterix-runtime/src/main/java/org/apache/asterix/runtime/evaluators/functions/binary/AbstractBinaryScalarEvaluator.java
index 6de63a2..e87c4eb 100644
--- a/asterix-runtime/src/main/java/org/apache/asterix/runtime/evaluators/functions/binary/AbstractCopyEvaluator.java
+++ b/asterix-runtime/src/main/java/org/apache/asterix/runtime/evaluators/functions/binary/AbstractBinaryScalarEvaluator.java
@@ -19,46 +19,47 @@
 
 package org.apache.asterix.runtime.evaluators.functions.binary;
 
+import java.io.DataOutput;
+
 import org.apache.asterix.formats.nontagged.AqlSerializerDeserializerProvider;
 import org.apache.asterix.om.base.ANull;
 import org.apache.asterix.om.types.ATypeTag;
 import org.apache.asterix.om.types.BuiltinType;
 import org.apache.asterix.om.types.hierachy.ATypeHierarchy;
 import org.apache.hyracks.algebricks.common.exceptions.AlgebricksException;
-import org.apache.hyracks.algebricks.runtime.base.ICopyEvaluator;
-import org.apache.hyracks.algebricks.runtime.base.ICopyEvaluatorFactory;
+import org.apache.hyracks.algebricks.runtime.base.IScalarEvaluator;
+import org.apache.hyracks.algebricks.runtime.base.IScalarEvaluatorFactory;
+import org.apache.hyracks.api.context.IHyracksTaskContext;
 import org.apache.hyracks.api.dataflow.value.ISerializerDeserializer;
 import org.apache.hyracks.api.exceptions.HyracksDataException;
-import org.apache.hyracks.data.std.api.IDataOutputProvider;
+import org.apache.hyracks.data.std.api.IPointable;
+import org.apache.hyracks.data.std.primitive.VoidPointable;
 import org.apache.hyracks.data.std.util.ArrayBackedValueStorage;
 import org.apache.hyracks.dataflow.common.data.accessors.IFrameTupleReference;
 
-import java.io.DataOutput;
-
-public abstract class AbstractCopyEvaluator implements ICopyEvaluator {
+public abstract class AbstractBinaryScalarEvaluator implements IScalarEvaluator {
     @SuppressWarnings("unchecked")
     protected ISerializerDeserializer<ANull> nullSerde = AqlSerializerDeserializerProvider.INSTANCE
             .getSerializerDeserializer(BuiltinType.ANULL);
 
-    protected DataOutput dataOutput;
-    protected ArrayBackedValueStorage[] storages;
-    protected ICopyEvaluator[] evaluators;
+    protected ArrayBackedValueStorage resultStorage = new ArrayBackedValueStorage();
+    protected DataOutput dataOutput = resultStorage.getDataOutput();
+    protected IPointable[] pointables;
+    protected IScalarEvaluator[] evaluators;
 
-    public AbstractCopyEvaluator(final IDataOutputProvider output, final ICopyEvaluatorFactory[] copyEvaluatorFactories)
+    public AbstractBinaryScalarEvaluator(final IHyracksTaskContext context, final IScalarEvaluatorFactory[] evaluatorFactories)
             throws AlgebricksException {
-        dataOutput = output.getDataOutput();
-        storages = new ArrayBackedValueStorage[copyEvaluatorFactories.length];
-        evaluators = new ICopyEvaluator[copyEvaluatorFactories.length];
+        pointables = new IPointable[evaluatorFactories.length];
+        evaluators = new IScalarEvaluator[evaluatorFactories.length];
         for (int i = 0; i < evaluators.length; ++i) {
-            storages[i] = new ArrayBackedValueStorage();
-            evaluators[i] = copyEvaluatorFactories[i].createEvaluator(storages[i]);
+            pointables[i] = new VoidPointable();
+            evaluators[i] = evaluatorFactories[i].createScalarEvaluator(context);
         }
     }
 
     public ATypeTag evaluateTuple(IFrameTupleReference tuple, int id) throws AlgebricksException {
-        storages[id].reset();
-        evaluators[id].evaluate(tuple);
-        return ATypeTag.VALUE_TYPE_MAPPING[storages[id].getByteArray()[0]];
+        evaluators[id].evaluate(tuple, pointables[id]);
+        return ATypeTag.VALUE_TYPE_MAPPING[pointables[id].getByteArray()[pointables[id].getStartOffset()]];
     }
 
     public boolean serializeNullIfAnyNull(ATypeTag... tags) throws HyracksDataException {
diff --git a/asterix-runtime/src/main/java/org/apache/asterix/runtime/evaluators/functions/binary/BinaryConcatDescriptor.java b/asterix-runtime/src/main/java/org/apache/asterix/runtime/evaluators/functions/binary/BinaryConcatDescriptor.java
index 1e676c9..2747260 100644
--- a/asterix-runtime/src/main/java/org/apache/asterix/runtime/evaluators/functions/binary/BinaryConcatDescriptor.java
+++ b/asterix-runtime/src/main/java/org/apache/asterix/runtime/evaluators/functions/binary/BinaryConcatDescriptor.java
@@ -30,10 +30,11 @@
 import org.apache.asterix.runtime.evaluators.common.AsterixListAccessor;
 import org.apache.hyracks.algebricks.common.exceptions.AlgebricksException;
 import org.apache.hyracks.algebricks.core.algebra.functions.FunctionIdentifier;
-import org.apache.hyracks.algebricks.runtime.base.ICopyEvaluator;
-import org.apache.hyracks.algebricks.runtime.base.ICopyEvaluatorFactory;
+import org.apache.hyracks.algebricks.runtime.base.IScalarEvaluator;
+import org.apache.hyracks.algebricks.runtime.base.IScalarEvaluatorFactory;
+import org.apache.hyracks.api.context.IHyracksTaskContext;
 import org.apache.hyracks.api.exceptions.HyracksDataException;
-import org.apache.hyracks.data.std.api.IDataOutputProvider;
+import org.apache.hyracks.data.std.api.IPointable;
 import org.apache.hyracks.data.std.primitive.ByteArrayPointable;
 import org.apache.hyracks.dataflow.common.data.accessors.IFrameTupleReference;
 import org.apache.hyracks.util.encoding.VarLenIntEncoderDecoder;
@@ -54,51 +55,53 @@
     }
 
     @Override
-    public ICopyEvaluatorFactory createEvaluatorFactory(final ICopyEvaluatorFactory[] args) throws AlgebricksException {
-        return new ICopyEvaluatorFactory() {
+    public IScalarEvaluatorFactory createEvaluatorFactory(final IScalarEvaluatorFactory[] args)
+            throws AlgebricksException {
+        return new IScalarEvaluatorFactory() {
             private static final long serialVersionUID = 1L;
 
             @Override
-            public ICopyEvaluator createEvaluator(final IDataOutputProvider output) throws AlgebricksException {
-                return new AbstractCopyEvaluator(output, args) {
+            public IScalarEvaluator createScalarEvaluator(final IHyracksTaskContext ctx) throws AlgebricksException {
+                return new AbstractBinaryScalarEvaluator(ctx, args) {
 
                     private final AsterixListAccessor listAccessor = new AsterixListAccessor();
-                    private final byte SER_BINARY_TYPE = ATypeTag.BINARY.serialize();
                     private final byte[] metaBuffer = new byte[5];
 
                     @Override
-                    public void evaluate(IFrameTupleReference tuple) throws AlgebricksException {
+                    public void evaluate(IFrameTupleReference tuple, IPointable result) throws AlgebricksException {
+                        resultStorage.reset();
                         ATypeTag typeTag = evaluateTuple(tuple, 0);
                         if (typeTag != ATypeTag.UNORDEREDLIST && typeTag != ATypeTag.ORDEREDLIST) {
                             throw new AlgebricksException(getIdentifier().getName()
                                     + ": expects input type ORDEREDLIST/UNORDEREDLIST, but got " + typeTag);
                         }
                         try {
-                            listAccessor.reset(storages[0].getByteArray(), 0);
+                            byte[] data = pointables[0].getByteArray();
+                            int offset = pointables[0].getStartOffset();
 
+                            listAccessor.reset(data, offset);
                             int concatLength = 0;
                             for (int i = 0; i < listAccessor.size(); i++) {
                                 int itemOffset = listAccessor.getItemOffset(i);
                                 ATypeTag itemType = listAccessor.getItemType(itemOffset);
                                 if (itemType != ATypeTag.BINARY) {
                                     if (serializeNullIfAnyNull(itemType)) {
+                                        result.set(resultStorage);
                                         return;
                                     }
                                     throw new AlgebricksException(getIdentifier().getName()
                                             + ": expects type STRING/NULL for the list item but got " + itemType);
                                 }
-                                concatLength += ByteArrayPointable.getContentLength(storages[0].getByteArray(),
-                                        itemOffset);
+                                concatLength += ByteArrayPointable.getContentLength(data, itemOffset);
                             }
-                            dataOutput.writeByte(SER_BINARY_TYPE);
+                            dataOutput.writeByte(ATypeTag.SERIALIZED_BINARY_TYPE_TAG);
                             int metaLen = VarLenIntEncoderDecoder.encode(concatLength, metaBuffer, 0);
                             dataOutput.write(metaBuffer, 0, metaLen);
 
                             for (int i = 0; i < listAccessor.size(); i++) {
                                 int itemOffset = listAccessor.getItemOffset(i);
-                                int length = ByteArrayPointable.getContentLength(storages[0].getByteArray(),
-                                        itemOffset);
-                                dataOutput.write(storages[0].getByteArray(),
+                                int length = ByteArrayPointable.getContentLength(data, itemOffset);
+                                dataOutput.write(data,
                                         itemOffset + ByteArrayPointable.getNumberBytesToStoreMeta(length), length);
                             }
                         } catch (HyracksDataException e) {
@@ -108,7 +111,7 @@
                         } catch (AsterixException e) {
                             throw new AlgebricksException(e);
                         }
-
+                        result.set(resultStorage);
                     }
                 };
 
diff --git a/asterix-runtime/src/main/java/org/apache/asterix/runtime/evaluators/functions/binary/BinaryLengthDescriptor.java b/asterix-runtime/src/main/java/org/apache/asterix/runtime/evaluators/functions/binary/BinaryLengthDescriptor.java
index fc6329d..9e9aab4 100644
--- a/asterix-runtime/src/main/java/org/apache/asterix/runtime/evaluators/functions/binary/BinaryLengthDescriptor.java
+++ b/asterix-runtime/src/main/java/org/apache/asterix/runtime/evaluators/functions/binary/BinaryLengthDescriptor.java
@@ -30,11 +30,12 @@
 import org.apache.asterix.runtime.evaluators.base.AbstractScalarFunctionDynamicDescriptor;
 import org.apache.hyracks.algebricks.common.exceptions.AlgebricksException;
 import org.apache.hyracks.algebricks.core.algebra.functions.FunctionIdentifier;
-import org.apache.hyracks.algebricks.runtime.base.ICopyEvaluator;
-import org.apache.hyracks.algebricks.runtime.base.ICopyEvaluatorFactory;
+import org.apache.hyracks.algebricks.runtime.base.IScalarEvaluator;
+import org.apache.hyracks.algebricks.runtime.base.IScalarEvaluatorFactory;
+import org.apache.hyracks.api.context.IHyracksTaskContext;
 import org.apache.hyracks.api.dataflow.value.ISerializerDeserializer;
 import org.apache.hyracks.api.exceptions.HyracksDataException;
-import org.apache.hyracks.data.std.api.IDataOutputProvider;
+import org.apache.hyracks.data.std.api.IPointable;
 import org.apache.hyracks.data.std.primitive.ByteArrayPointable;
 import org.apache.hyracks.dataflow.common.data.accessors.IFrameTupleReference;
 
@@ -50,13 +51,14 @@
     private static final ATypeTag[] EXPECTED_TAGS = { ATypeTag.BINARY };
 
     @Override
-    public ICopyEvaluatorFactory createEvaluatorFactory(final ICopyEvaluatorFactory[] args) throws AlgebricksException {
-        return new ICopyEvaluatorFactory() {
+    public IScalarEvaluatorFactory createEvaluatorFactory(final IScalarEvaluatorFactory[] args)
+            throws AlgebricksException {
+        return new IScalarEvaluatorFactory() {
             private static final long serialVersionUID = 1L;
 
             @Override
-            public ICopyEvaluator createEvaluator(final IDataOutputProvider output) throws AlgebricksException {
-                return new AbstractCopyEvaluator(output, args) {
+            public IScalarEvaluator createScalarEvaluator(final IHyracksTaskContext ctx) throws AlgebricksException {
+                return new AbstractBinaryScalarEvaluator(ctx, args) {
 
                     private AMutableInt64 result = new AMutableInt64(0);
                     @SuppressWarnings("unchecked")
@@ -64,20 +66,24 @@
                             .getSerializerDeserializer(BuiltinType.AINT64);
 
                     @Override
-                    public void evaluate(IFrameTupleReference tuple) throws AlgebricksException {
+                    public void evaluate(IFrameTupleReference tuple, IPointable resultPointable)
+                            throws AlgebricksException {
+                        resultStorage.reset();
                         ATypeTag tag = evaluateTuple(tuple, 0);
                         try {
                             if (serializeNullIfAnyNull(tag)) {
+                                resultPointable.set(resultStorage);
                                 return;
                             }
                             checkTypeMachingThrowsIfNot(getIdentifier().getName(), EXPECTED_TAGS, tag);
-                            int len = ByteArrayPointable.getContentLength(storages[0].getByteArray(), 1);
+                            int len = ByteArrayPointable.getContentLength(pointables[0].getByteArray(),
+                                    pointables[0].getStartOffset() + 1);
                             result.setValue(len);
                             intSerde.serialize(result, dataOutput);
                         } catch (HyracksDataException e) {
                             throw new AlgebricksException(e);
                         }
-
+                        resultPointable.set(resultStorage);
                     }
                 };
             }
diff --git a/asterix-runtime/src/main/java/org/apache/asterix/runtime/evaluators/functions/binary/FindBinaryDescriptor.java b/asterix-runtime/src/main/java/org/apache/asterix/runtime/evaluators/functions/binary/FindBinaryDescriptor.java
index 4a30847..c7b4843 100644
--- a/asterix-runtime/src/main/java/org/apache/asterix/runtime/evaluators/functions/binary/FindBinaryDescriptor.java
+++ b/asterix-runtime/src/main/java/org/apache/asterix/runtime/evaluators/functions/binary/FindBinaryDescriptor.java
@@ -30,11 +30,12 @@
 import org.apache.asterix.runtime.evaluators.base.AbstractScalarFunctionDynamicDescriptor;
 import org.apache.hyracks.algebricks.common.exceptions.AlgebricksException;
 import org.apache.hyracks.algebricks.core.algebra.functions.FunctionIdentifier;
-import org.apache.hyracks.algebricks.runtime.base.ICopyEvaluator;
-import org.apache.hyracks.algebricks.runtime.base.ICopyEvaluatorFactory;
+import org.apache.hyracks.algebricks.runtime.base.IScalarEvaluator;
+import org.apache.hyracks.algebricks.runtime.base.IScalarEvaluatorFactory;
+import org.apache.hyracks.api.context.IHyracksTaskContext;
 import org.apache.hyracks.api.dataflow.value.ISerializerDeserializer;
 import org.apache.hyracks.api.exceptions.HyracksDataException;
-import org.apache.hyracks.data.std.api.IDataOutputProvider;
+import org.apache.hyracks.data.std.api.IPointable;
 import org.apache.hyracks.data.std.primitive.ByteArrayPointable;
 import org.apache.hyracks.dataflow.common.data.accessors.IFrameTupleReference;
 
@@ -55,13 +56,14 @@
     private static final ATypeTag[] EXPECTED_INPUT_TAG = { ATypeTag.BINARY, ATypeTag.BINARY };
 
     @Override
-    public ICopyEvaluatorFactory createEvaluatorFactory(final ICopyEvaluatorFactory[] args) throws AlgebricksException {
-        return new ICopyEvaluatorFactory() {
+    public IScalarEvaluatorFactory createEvaluatorFactory(final IScalarEvaluatorFactory[] args)
+            throws AlgebricksException {
+        return new IScalarEvaluatorFactory() {
             private static final long serialVersionUID = 1L;
 
             @Override
-            public ICopyEvaluator createEvaluator(final IDataOutputProvider output) throws AlgebricksException {
-                return new AbstractFindBinaryCopyEvaluator(output, args, getIdentifier().getName()) {
+            public IScalarEvaluator createScalarEvaluator(final IHyracksTaskContext ctx) throws AlgebricksException {
+                return new AbstractFindBinaryCopyEvaluator(ctx, args, getIdentifier().getName()) {
                     @Override
                     protected int getFromOffset(IFrameTupleReference tuple) throws AlgebricksException {
                         return 0;
@@ -71,11 +73,11 @@
         };
     }
 
-    static abstract class AbstractFindBinaryCopyEvaluator extends AbstractCopyEvaluator {
+    static abstract class AbstractFindBinaryCopyEvaluator extends AbstractBinaryScalarEvaluator {
 
-        public AbstractFindBinaryCopyEvaluator(IDataOutputProvider output,
-                ICopyEvaluatorFactory[] copyEvaluatorFactories, String functionName) throws AlgebricksException {
-            super(output, copyEvaluatorFactories);
+        public AbstractFindBinaryCopyEvaluator(IHyracksTaskContext context,
+                IScalarEvaluatorFactory[] copyEvaluatorFactories, String functionName) throws AlgebricksException {
+            super(context, copyEvaluatorFactories);
             this.functionName = functionName;
         }
 
@@ -89,19 +91,23 @@
                 .getSerializerDeserializer(BuiltinType.AINT64);
 
         @Override
-        public void evaluate(IFrameTupleReference tuple) throws AlgebricksException {
+        public void evaluate(IFrameTupleReference tuple, IPointable resultPointable) throws AlgebricksException {
+            resultStorage.reset();
             ATypeTag textTag = evaluateTuple(tuple, 0);
             ATypeTag wordTag = evaluateTuple(tuple, 1);
             int fromOffset = getFromOffset(tuple);
 
             try {
                 if (serializeNullIfAnyNull(textTag, wordTag)) {
+                    resultPointable.set(resultStorage);
                     return;
                 }
                 checkTypeMachingThrowsIfNot(functionName, EXPECTED_INPUT_TAG, textTag, wordTag);
 
-                textPtr.set(storages[0].getByteArray(), 1, storages[0].getLength() - 1);
-                wordPtr.set(storages[1].getByteArray(), 1, storages[1].getLength() - 1);
+                textPtr.set(pointables[0].getByteArray(), pointables[0].getStartOffset() + 1,
+                        pointables[0].getLength() - 1);
+                wordPtr.set(pointables[1].getByteArray(), pointables[0].getStartOffset() + 1,
+                        pointables[1].getLength() - 1);
                 result.setValue(1 + indexOf(textPtr.getByteArray(), textPtr.getContentStartOffset(),
                         textPtr.getContentLength(), wordPtr.getByteArray(), wordPtr.getContentStartOffset(),
                         wordPtr.getContentLength(), fromOffset));
@@ -109,6 +115,7 @@
             } catch (HyracksDataException e) {
                 throw new AlgebricksException(e);
             }
+            resultPointable.set(resultStorage);
         }
 
         protected abstract int getFromOffset(IFrameTupleReference tuple) throws AlgebricksException;
@@ -133,14 +140,18 @@
         for (int i = sourceOffset + fromIndex; i <= max; i++) {
             /* Look for first character. */
             if (source[i] != first) {
-                while (++i <= max && source[i] != first);
+                while (++i <= max && source[i] != first) {
+                    ;
+                }
             }
 
             /* Found first character, now look at the rest of v2 */
             if (i <= max) {
                 int j = i + 1;
                 int end = j + targetCount - 1;
-                for (int k = targetOffset + 1; j < end && source[j] == target[k]; j++, k++);
+                for (int k = targetOffset + 1; j < end && source[j] == target[k]; j++, k++) {
+                    ;
+                }
 
                 if (j == end) {
                     /* Found whole string. */
diff --git a/asterix-runtime/src/main/java/org/apache/asterix/runtime/evaluators/functions/binary/FindBinaryFromDescriptor.java b/asterix-runtime/src/main/java/org/apache/asterix/runtime/evaluators/functions/binary/FindBinaryFromDescriptor.java
index 12f4486..6b8ee38 100644
--- a/asterix-runtime/src/main/java/org/apache/asterix/runtime/evaluators/functions/binary/FindBinaryFromDescriptor.java
+++ b/asterix-runtime/src/main/java/org/apache/asterix/runtime/evaluators/functions/binary/FindBinaryFromDescriptor.java
@@ -26,10 +26,10 @@
 import org.apache.asterix.runtime.evaluators.base.AbstractScalarFunctionDynamicDescriptor;
 import org.apache.hyracks.algebricks.common.exceptions.AlgebricksException;
 import org.apache.hyracks.algebricks.core.algebra.functions.FunctionIdentifier;
-import org.apache.hyracks.algebricks.runtime.base.ICopyEvaluator;
-import org.apache.hyracks.algebricks.runtime.base.ICopyEvaluatorFactory;
+import org.apache.hyracks.algebricks.runtime.base.IScalarEvaluator;
+import org.apache.hyracks.algebricks.runtime.base.IScalarEvaluatorFactory;
+import org.apache.hyracks.api.context.IHyracksTaskContext;
 import org.apache.hyracks.api.exceptions.HyracksDataException;
-import org.apache.hyracks.data.std.api.IDataOutputProvider;
 import org.apache.hyracks.dataflow.common.data.accessors.IFrameTupleReference;
 
 public class FindBinaryFromDescriptor extends AbstractScalarFunctionDynamicDescriptor {
@@ -48,24 +48,25 @@
     }
 
     @Override
-    public ICopyEvaluatorFactory createEvaluatorFactory(final ICopyEvaluatorFactory[] args) throws AlgebricksException {
-        return new ICopyEvaluatorFactory() {
+    public IScalarEvaluatorFactory createEvaluatorFactory(final IScalarEvaluatorFactory[] args)
+            throws AlgebricksException {
+        return new IScalarEvaluatorFactory() {
             private static final long serialVersionUID = 1L;
 
             @Override
-            public ICopyEvaluator createEvaluator(final IDataOutputProvider output) throws AlgebricksException {
-                return new FindBinaryDescriptor.AbstractFindBinaryCopyEvaluator(output, args,
+            public IScalarEvaluator createScalarEvaluator(final IHyracksTaskContext ctx) throws AlgebricksException {
+                return new FindBinaryDescriptor.AbstractFindBinaryCopyEvaluator(ctx, args,
                         getIdentifier().getName()) {
                     @Override
                     protected int getFromOffset(IFrameTupleReference tuple) throws AlgebricksException {
                         evaluateTuple(tuple, 2);
                         int getFrom = 0;
                         try {
-                            getFrom = ATypeHierarchy.getIntegerValue(storages[2].getByteArray(), 0);
+                            getFrom = ATypeHierarchy.getIntegerValue(pointables[2].getByteArray(),
+                                    pointables[2].getStartOffset());
                         } catch (HyracksDataException e) {
                             throw new AlgebricksException(e);
                         }
-
                         return getFrom;
                     }
                 };
diff --git a/asterix-runtime/src/main/java/org/apache/asterix/runtime/evaluators/functions/binary/ParseBinaryDescriptor.java b/asterix-runtime/src/main/java/org/apache/asterix/runtime/evaluators/functions/binary/ParseBinaryDescriptor.java
index 8adb21c..a067557 100644
--- a/asterix-runtime/src/main/java/org/apache/asterix/runtime/evaluators/functions/binary/ParseBinaryDescriptor.java
+++ b/asterix-runtime/src/main/java/org/apache/asterix/runtime/evaluators/functions/binary/ParseBinaryDescriptor.java
@@ -30,11 +30,12 @@
 import org.apache.asterix.runtime.evaluators.base.AbstractScalarFunctionDynamicDescriptor;
 import org.apache.hyracks.algebricks.common.exceptions.AlgebricksException;
 import org.apache.hyracks.algebricks.core.algebra.functions.FunctionIdentifier;
-import org.apache.hyracks.algebricks.runtime.base.ICopyEvaluator;
-import org.apache.hyracks.algebricks.runtime.base.ICopyEvaluatorFactory;
+import org.apache.hyracks.algebricks.runtime.base.IScalarEvaluator;
+import org.apache.hyracks.algebricks.runtime.base.IScalarEvaluatorFactory;
+import org.apache.hyracks.api.context.IHyracksTaskContext;
 import org.apache.hyracks.api.dataflow.value.ISerializerDeserializer;
 import org.apache.hyracks.api.exceptions.HyracksDataException;
-import org.apache.hyracks.data.std.api.IDataOutputProvider;
+import org.apache.hyracks.data.std.api.IPointable;
 import org.apache.hyracks.data.std.primitive.UTF8StringPointable;
 import org.apache.hyracks.dataflow.common.data.accessors.IFrameTupleReference;
 import org.apache.hyracks.util.bytes.Base64Parser;
@@ -60,13 +61,14 @@
     }
 
     @Override
-    public ICopyEvaluatorFactory createEvaluatorFactory(final ICopyEvaluatorFactory[] args) throws AlgebricksException {
-        return new ICopyEvaluatorFactory() {
+    public IScalarEvaluatorFactory createEvaluatorFactory(final IScalarEvaluatorFactory[] args)
+            throws AlgebricksException {
+        return new IScalarEvaluatorFactory() {
             private static final long serialVersionUID = 1L;
 
             @Override
-            public ICopyEvaluator createEvaluator(final IDataOutputProvider output) throws AlgebricksException {
-                return new AbstractCopyEvaluator(output, args) {
+            public IScalarEvaluator createScalarEvaluator(final IHyracksTaskContext ctx) throws AlgebricksException {
+                return new AbstractBinaryScalarEvaluator(ctx, args) {
 
                     @SuppressWarnings("unchecked")
                     private ISerializerDeserializer<ABinary> binarySerde = AqlSerializerDeserializerProvider.INSTANCE
@@ -80,18 +82,22 @@
                     private final Base64Parser base64Parser = new Base64Parser();
 
                     @Override
-                    public void evaluate(IFrameTupleReference tuple) throws AlgebricksException {
+                    public void evaluate(IFrameTupleReference tuple, IPointable result) throws AlgebricksException {
+                        resultStorage.reset();
                         ATypeTag binaryTag = evaluateTuple(tuple, 0);
                         ATypeTag formatTag = evaluateTuple(tuple, 1);
 
                         try {
                             if (serializeNullIfAnyNull(binaryTag, formatTag)) {
+                                result.set(resultStorage);
                                 return;
                             }
                             checkTypeMachingThrowsIfNot(getIdentifier().getName(), EXPECTED_INPUT_TAGS, binaryTag,
                                     formatTag);
-                            stringPointable.set(storages[0].getByteArray(), 1, storages[0].getLength());
-                            formatPointable.set(storages[1].getByteArray(), 1, storages[1].getLength());
+                            stringPointable.set(pointables[0].getByteArray(), pointables[0].getStartOffset() + 1,
+                                    pointables[0].getLength());
+                            formatPointable.set(pointables[1].getByteArray(), pointables[1].getStartOffset() + 1,
+                                    pointables[1].getLength());
                             if (HEX_FORMAT.ignoreCaseCompareTo(formatPointable) == 0) {
                                 hexParser.generateByteArrayFromHexString(stringPointable.getByteArray(),
                                         stringPointable.getCharStartOffset(), stringPointable.getUTF8Length());
@@ -110,6 +116,7 @@
                         } catch (HyracksDataException e) {
                             e.printStackTrace();
                         }
+                        result.set(resultStorage);
                     }
                 };
 
diff --git a/asterix-runtime/src/main/java/org/apache/asterix/runtime/evaluators/functions/binary/PrintBinaryDescriptor.java b/asterix-runtime/src/main/java/org/apache/asterix/runtime/evaluators/functions/binary/PrintBinaryDescriptor.java
index 37b414b..92b9ec1 100644
--- a/asterix-runtime/src/main/java/org/apache/asterix/runtime/evaluators/functions/binary/PrintBinaryDescriptor.java
+++ b/asterix-runtime/src/main/java/org/apache/asterix/runtime/evaluators/functions/binary/PrintBinaryDescriptor.java
@@ -31,10 +31,11 @@
 import org.apache.asterix.runtime.evaluators.base.AbstractScalarFunctionDynamicDescriptor;
 import org.apache.hyracks.algebricks.common.exceptions.AlgebricksException;
 import org.apache.hyracks.algebricks.core.algebra.functions.FunctionIdentifier;
-import org.apache.hyracks.algebricks.runtime.base.ICopyEvaluator;
-import org.apache.hyracks.algebricks.runtime.base.ICopyEvaluatorFactory;
+import org.apache.hyracks.algebricks.runtime.base.IScalarEvaluator;
+import org.apache.hyracks.algebricks.runtime.base.IScalarEvaluatorFactory;
+import org.apache.hyracks.api.context.IHyracksTaskContext;
 import org.apache.hyracks.api.exceptions.HyracksDataException;
-import org.apache.hyracks.data.std.api.IDataOutputProvider;
+import org.apache.hyracks.data.std.api.IPointable;
 import org.apache.hyracks.data.std.primitive.ByteArrayPointable;
 import org.apache.hyracks.data.std.primitive.UTF8StringPointable;
 import org.apache.hyracks.dataflow.common.data.accessors.IFrameTupleReference;
@@ -60,13 +61,14 @@
     public final static ATypeTag[] EXPECTED_INPUT_TAGS = { ATypeTag.BINARY, ATypeTag.STRING };
 
     @Override
-    public ICopyEvaluatorFactory createEvaluatorFactory(final ICopyEvaluatorFactory[] args) throws AlgebricksException {
-        return new ICopyEvaluatorFactory() {
+    public IScalarEvaluatorFactory createEvaluatorFactory(final IScalarEvaluatorFactory[] args)
+            throws AlgebricksException {
+        return new IScalarEvaluatorFactory() {
             private static final long serialVersionUID = 1L;
 
             @Override
-            public ICopyEvaluator createEvaluator(final IDataOutputProvider output) throws AlgebricksException {
-                return new AbstractCopyEvaluator(output, args) {
+            public IScalarEvaluator createScalarEvaluator(final IHyracksTaskContext ctx) throws AlgebricksException {
+                return new AbstractBinaryScalarEvaluator(ctx, args) {
 
                     private StringBuilder stringBuilder = new StringBuilder();
                     private final ByteArrayPointable byteArrayPtr = new ByteArrayPointable();
@@ -74,19 +76,23 @@
                     private final UTF8StringWriter writer = new UTF8StringWriter();
 
                     @Override
-                    public void evaluate(IFrameTupleReference tuple) throws AlgebricksException {
+                    public void evaluate(IFrameTupleReference tuple, IPointable result) throws AlgebricksException {
+                        resultStorage.reset();
                         ATypeTag arg0Tag = evaluateTuple(tuple, 0);
                         ATypeTag arg1Tag = evaluateTuple(tuple, 1);
 
                         try {
                             if (serializeNullIfAnyNull(arg0Tag, arg1Tag)) {
+                                result.set(resultStorage);
                                 return;
                             }
                             checkTypeMachingThrowsIfNot(getIdentifier().getName(), EXPECTED_INPUT_TAGS, arg0Tag,
                                     arg1Tag);
 
-                            byteArrayPtr.set(storages[0].getByteArray(), 1, storages[0].getLength());
-                            formatPointable.set(storages[1].getByteArray(), 1, storages[1].getLength());
+                            byteArrayPtr.set(pointables[0].getByteArray(), pointables[0].getStartOffset() + 1,
+                                    pointables[0].getLength());
+                            formatPointable.set(pointables[1].getByteArray(), pointables[1].getStartOffset() + 1,
+                                    pointables[1].getLength());
 
                             int lengthBinary = byteArrayPtr.getContentLength();
                             stringBuilder.setLength(0);
@@ -107,6 +113,7 @@
                         } catch (IOException e) {
                             throw new AlgebricksException(e);
                         }
+                        result.set(resultStorage);
                     }
                 };
             }
diff --git a/asterix-runtime/src/main/java/org/apache/asterix/runtime/evaluators/functions/binary/SubBinaryFromDescriptor.java b/asterix-runtime/src/main/java/org/apache/asterix/runtime/evaluators/functions/binary/SubBinaryFromDescriptor.java
index b99a15b..4d435ab 100644
--- a/asterix-runtime/src/main/java/org/apache/asterix/runtime/evaluators/functions/binary/SubBinaryFromDescriptor.java
+++ b/asterix-runtime/src/main/java/org/apache/asterix/runtime/evaluators/functions/binary/SubBinaryFromDescriptor.java
@@ -25,9 +25,9 @@
 import org.apache.asterix.runtime.evaluators.base.AbstractScalarFunctionDynamicDescriptor;
 import org.apache.hyracks.algebricks.common.exceptions.AlgebricksException;
 import org.apache.hyracks.algebricks.core.algebra.functions.FunctionIdentifier;
-import org.apache.hyracks.algebricks.runtime.base.ICopyEvaluator;
-import org.apache.hyracks.algebricks.runtime.base.ICopyEvaluatorFactory;
-import org.apache.hyracks.data.std.api.IDataOutputProvider;
+import org.apache.hyracks.algebricks.runtime.base.IScalarEvaluator;
+import org.apache.hyracks.algebricks.runtime.base.IScalarEvaluatorFactory;
+import org.apache.hyracks.api.context.IHyracksTaskContext;
 import org.apache.hyracks.dataflow.common.data.accessors.IFrameTupleReference;
 
 public class SubBinaryFromDescriptor extends AbstractScalarFunctionDynamicDescriptor {
@@ -45,13 +45,14 @@
     }
 
     @Override
-    public ICopyEvaluatorFactory createEvaluatorFactory(final ICopyEvaluatorFactory[] args) throws AlgebricksException {
-        return new ICopyEvaluatorFactory() {
+    public IScalarEvaluatorFactory createEvaluatorFactory(final IScalarEvaluatorFactory[] args)
+            throws AlgebricksException {
+        return new IScalarEvaluatorFactory() {
             private static final long serialVersionUID = 1L;
 
             @Override
-            public ICopyEvaluator createEvaluator(final IDataOutputProvider output) throws AlgebricksException {
-                return new SubBinaryFromToDescriptor.AbstractSubBinaryCopyEvaluator(output, args,
+            public IScalarEvaluator createScalarEvaluator(final IHyracksTaskContext ctx) throws AlgebricksException {
+                return new SubBinaryFromToDescriptor.AbstractSubBinaryCopyEvaluator(ctx, args,
                         getIdentifier().getName()) {
                     @Override
                     protected int getSubLength(IFrameTupleReference tuple) throws AlgebricksException {
diff --git a/asterix-runtime/src/main/java/org/apache/asterix/runtime/evaluators/functions/binary/SubBinaryFromToDescriptor.java b/asterix-runtime/src/main/java/org/apache/asterix/runtime/evaluators/functions/binary/SubBinaryFromToDescriptor.java
index 34e527e..20fdeed 100644
--- a/asterix-runtime/src/main/java/org/apache/asterix/runtime/evaluators/functions/binary/SubBinaryFromToDescriptor.java
+++ b/asterix-runtime/src/main/java/org/apache/asterix/runtime/evaluators/functions/binary/SubBinaryFromToDescriptor.java
@@ -29,10 +29,11 @@
 import org.apache.asterix.runtime.evaluators.base.AbstractScalarFunctionDynamicDescriptor;
 import org.apache.hyracks.algebricks.common.exceptions.AlgebricksException;
 import org.apache.hyracks.algebricks.core.algebra.functions.FunctionIdentifier;
-import org.apache.hyracks.algebricks.runtime.base.ICopyEvaluator;
-import org.apache.hyracks.algebricks.runtime.base.ICopyEvaluatorFactory;
+import org.apache.hyracks.algebricks.runtime.base.IScalarEvaluator;
+import org.apache.hyracks.algebricks.runtime.base.IScalarEvaluatorFactory;
+import org.apache.hyracks.api.context.IHyracksTaskContext;
 import org.apache.hyracks.api.exceptions.HyracksDataException;
-import org.apache.hyracks.data.std.api.IDataOutputProvider;
+import org.apache.hyracks.data.std.api.IPointable;
 import org.apache.hyracks.data.std.primitive.ByteArrayPointable;
 import org.apache.hyracks.dataflow.common.data.accessors.IFrameTupleReference;
 import org.apache.hyracks.util.encoding.VarLenIntEncoderDecoder;
@@ -52,19 +53,21 @@
     }
 
     @Override
-    public ICopyEvaluatorFactory createEvaluatorFactory(final ICopyEvaluatorFactory[] args) throws AlgebricksException {
-        return new ICopyEvaluatorFactory() {
+    public IScalarEvaluatorFactory createEvaluatorFactory(final IScalarEvaluatorFactory[] args)
+            throws AlgebricksException {
+        return new IScalarEvaluatorFactory() {
             private static final long serialVersionUID = 1L;
 
             @Override
-            public ICopyEvaluator createEvaluator(final IDataOutputProvider output) throws AlgebricksException {
-                return new AbstractSubBinaryCopyEvaluator(output, args, getIdentifier().getName()) {
+            public IScalarEvaluator createScalarEvaluator(final IHyracksTaskContext ctx) throws AlgebricksException {
+                return new AbstractSubBinaryCopyEvaluator(ctx, args, getIdentifier().getName()) {
                     @Override
                     protected int getSubLength(IFrameTupleReference tuple) throws AlgebricksException {
                         evaluateTuple(tuple, 2);
                         int subLength = 0;
                         try {
-                            subLength = ATypeHierarchy.getIntegerValue(storages[2].getByteArray(), 0);
+                            subLength = ATypeHierarchy.getIntegerValue(pointables[2].getByteArray(),
+                                    pointables[2].getStartOffset());
                         } catch (HyracksDataException e) {
                             throw new AlgebricksException(e);
                         }
@@ -76,10 +79,10 @@
         };
     }
 
-    static abstract class AbstractSubBinaryCopyEvaluator extends AbstractCopyEvaluator {
-        public AbstractSubBinaryCopyEvaluator(IDataOutputProvider output,
-                ICopyEvaluatorFactory[] copyEvaluatorFactories, String functionName) throws AlgebricksException {
-            super(output, copyEvaluatorFactories);
+    static abstract class AbstractSubBinaryCopyEvaluator extends AbstractBinaryScalarEvaluator {
+        public AbstractSubBinaryCopyEvaluator(IHyracksTaskContext context,
+                IScalarEvaluatorFactory[] copyEvaluatorFactories, String functionName) throws AlgebricksException {
+            super(context, copyEvaluatorFactories);
             this.functionName = functionName;
         }
 
@@ -90,24 +93,27 @@
         static final ATypeTag[] EXPECTED_INPUT_TAGS = { ATypeTag.BINARY, ATypeTag.INT32 };
 
         @Override
-        public void evaluate(IFrameTupleReference tuple) throws AlgebricksException {
-
+        public void evaluate(IFrameTupleReference tuple, IPointable result) throws AlgebricksException {
+            resultStorage.reset();
             ATypeTag argTag0 = evaluateTuple(tuple, 0);
             ATypeTag argTag1 = evaluateTuple(tuple, 1);
 
             try {
                 if (serializeNullIfAnyNull(argTag0, argTag1)) {
+                    result.set(resultStorage);
                     return;
                 }
                 checkTypeMachingThrowsIfNot(functionName, EXPECTED_INPUT_TAGS, argTag0, argTag1);
 
-                byteArrayPointable.set(storages[0].getByteArray(), 1, storages[0].getLength() - 1);
-                byte[] startBytes = storages[1].getByteArray();
+                byteArrayPointable.set(pointables[0].getByteArray(), pointables[0].getStartOffset() + 1,
+                        pointables[0].getLength() - 1);
+                byte[] startBytes = pointables[1].getByteArray();
+                int offset = pointables[1].getStartOffset();
 
                 int subStart = 0;
 
                 // strange SQL index convention
-                subStart = ATypeHierarchy.getIntegerValue(startBytes, 0) - 1;
+                subStart = ATypeHierarchy.getIntegerValue(startBytes, offset) - 1;
 
                 int totalLength = byteArrayPointable.getContentLength();
                 int subLength = getSubLength(tuple);
@@ -133,6 +139,7 @@
             } catch (IOException e) {
                 throw new AlgebricksException(e);
             }
+            result.set(resultStorage);
         }
 
         protected abstract int getSubLength(IFrameTupleReference tuple) throws AlgebricksException;
diff --git a/asterix-runtime/src/main/java/org/apache/asterix/runtime/evaluators/functions/records/FieldAccessByIndexDescriptor.java b/asterix-runtime/src/main/java/org/apache/asterix/runtime/evaluators/functions/records/FieldAccessByIndexDescriptor.java
index 03e4490..212d6d3 100644
--- a/asterix-runtime/src/main/java/org/apache/asterix/runtime/evaluators/functions/records/FieldAccessByIndexDescriptor.java
+++ b/asterix-runtime/src/main/java/org/apache/asterix/runtime/evaluators/functions/records/FieldAccessByIndexDescriptor.java
@@ -24,7 +24,7 @@
 import org.apache.asterix.om.types.ARecordType;
 import org.apache.asterix.runtime.evaluators.base.AbstractScalarFunctionDynamicDescriptor;
 import org.apache.hyracks.algebricks.core.algebra.functions.FunctionIdentifier;
-import org.apache.hyracks.algebricks.runtime.base.ICopyEvaluatorFactory;
+import org.apache.hyracks.algebricks.runtime.base.IScalarEvaluatorFactory;
 
 public class FieldAccessByIndexDescriptor extends AbstractScalarFunctionDynamicDescriptor {
 
@@ -47,7 +47,7 @@
     }
 
     @Override
-    public ICopyEvaluatorFactory createEvaluatorFactory(ICopyEvaluatorFactory[] args) {
+    public IScalarEvaluatorFactory createEvaluatorFactory(IScalarEvaluatorFactory[] args) {
         return new FieldAccessByIndexEvalFactory(args[0], args[1], recType);
     }
 
diff --git a/asterix-runtime/src/main/java/org/apache/asterix/runtime/evaluators/functions/records/FieldAccessByIndexEvalFactory.java b/asterix-runtime/src/main/java/org/apache/asterix/runtime/evaluators/functions/records/FieldAccessByIndexEvalFactory.java
index 7bc6aef..dd70d1e 100644
--- a/asterix-runtime/src/main/java/org/apache/asterix/runtime/evaluators/functions/records/FieldAccessByIndexEvalFactory.java
+++ b/asterix-runtime/src/main/java/org/apache/asterix/runtime/evaluators/functions/records/FieldAccessByIndexEvalFactory.java
@@ -34,25 +34,27 @@
 import org.apache.asterix.om.util.NonTaggedFormatUtil;
 import org.apache.hyracks.algebricks.common.exceptions.AlgebricksException;
 import org.apache.hyracks.algebricks.common.exceptions.NotImplementedException;
-import org.apache.hyracks.algebricks.runtime.base.ICopyEvaluator;
-import org.apache.hyracks.algebricks.runtime.base.ICopyEvaluatorFactory;
+import org.apache.hyracks.algebricks.runtime.base.IScalarEvaluator;
+import org.apache.hyracks.algebricks.runtime.base.IScalarEvaluatorFactory;
+import org.apache.hyracks.api.context.IHyracksTaskContext;
 import org.apache.hyracks.api.dataflow.value.ISerializerDeserializer;
-import org.apache.hyracks.data.std.api.IDataOutputProvider;
+import org.apache.hyracks.data.std.api.IPointable;
 import org.apache.hyracks.data.std.primitive.IntegerPointable;
+import org.apache.hyracks.data.std.primitive.VoidPointable;
 import org.apache.hyracks.data.std.util.ArrayBackedValueStorage;
 import org.apache.hyracks.dataflow.common.data.accessors.IFrameTupleReference;
 
-public class FieldAccessByIndexEvalFactory implements ICopyEvaluatorFactory {
+public class FieldAccessByIndexEvalFactory implements IScalarEvaluatorFactory {
 
     private static final long serialVersionUID = 1L;
 
-    private ICopyEvaluatorFactory recordEvalFactory;
-    private ICopyEvaluatorFactory fieldIndexEvalFactory;
+    private IScalarEvaluatorFactory recordEvalFactory;
+    private IScalarEvaluatorFactory fieldIndexEvalFactory;
     private int nullBitmapSize;
     private ARecordType recordType;
 
-    public FieldAccessByIndexEvalFactory(ICopyEvaluatorFactory recordEvalFactory,
-            ICopyEvaluatorFactory fieldIndexEvalFactory, ARecordType recordType) {
+    public FieldAccessByIndexEvalFactory(IScalarEvaluatorFactory recordEvalFactory,
+            IScalarEvaluatorFactory fieldIndexEvalFactory, ARecordType recordType) {
         this.recordEvalFactory = recordEvalFactory;
         this.fieldIndexEvalFactory = fieldIndexEvalFactory;
         this.recordType = recordType;
@@ -60,16 +62,15 @@
     }
 
     @Override
-    public ICopyEvaluator createEvaluator(final IDataOutputProvider output) throws AlgebricksException {
+    public IScalarEvaluator createScalarEvaluator(final IHyracksTaskContext ctx) throws AlgebricksException {
+        return new IScalarEvaluator() {
+            private ArrayBackedValueStorage resultStorage = new ArrayBackedValueStorage();
+            private DataOutput out = resultStorage.getDataOutput();
 
-        return new ICopyEvaluator() {
-
-            private DataOutput out = output.getDataOutput();
-
-            private ArrayBackedValueStorage outInput0 = new ArrayBackedValueStorage();
-            private ArrayBackedValueStorage outInput1 = new ArrayBackedValueStorage();
-            private ICopyEvaluator eval0 = recordEvalFactory.createEvaluator(outInput0);
-            private ICopyEvaluator eval1 = fieldIndexEvalFactory.createEvaluator(outInput1);
+            private IPointable inputArg0 = new VoidPointable();
+            private IPointable inputArg1 = new VoidPointable();
+            private IScalarEvaluator eval0 = recordEvalFactory.createScalarEvaluator(ctx);
+            private IScalarEvaluator eval1 = fieldIndexEvalFactory.createScalarEvaluator(ctx);
             @SuppressWarnings("unchecked")
             private ISerializerDeserializer<ANull> nullSerde = AqlSerializerDeserializerProvider.INSTANCE
                     .getSerializerDeserializer(BuiltinType.ANULL);
@@ -80,37 +81,39 @@
             private ATypeTag fieldValueTypeTag = ATypeTag.NULL;
 
             /*
-             * outInput0: the record
-             * outInput1: the index
+             * inputArg0: the record
+             * inputArg1: the index
              *
-             * This method outputs into IDataOutputProvider output [field type tag (1 byte)][the field data]
+             * This method outputs into IHyracksTaskContext context [field type tag (1 byte)][the field data]
              */
             @Override
-            public void evaluate(IFrameTupleReference tuple) throws AlgebricksException {
+            public void evaluate(IFrameTupleReference tuple, IPointable result) throws AlgebricksException {
                 try {
-                    outInput0.reset();
-                    eval0.evaluate(tuple);
-                    byte[] serRecord = outInput0.getByteArray();
+                    resultStorage.reset();
+                    eval0.evaluate(tuple, inputArg0);
+                    byte[] serRecord = inputArg0.getByteArray();
+                    int offset = inputArg0.getStartOffset();
 
-                    if (serRecord[0] == ATypeTag.SERIALIZED_NULL_TYPE_TAG) {
+                    if (serRecord[offset] == ATypeTag.SERIALIZED_NULL_TYPE_TAG) {
                         nullSerde.serialize(ANull.NULL, out);
+                        result.set(resultStorage);
                         return;
                     }
 
-                    if (serRecord[0] != ATypeTag.SERIALIZED_RECORD_TYPE_TAG) {
+                    if (serRecord[offset] != ATypeTag.SERIALIZED_RECORD_TYPE_TAG) {
                         throw new AlgebricksException("Field accessor is not defined for values of type "
-                                + EnumDeserializer.ATYPETAGDESERIALIZER.deserialize(serRecord[0]));
+                                + EnumDeserializer.ATYPETAGDESERIALIZER.deserialize(serRecord[offset]));
                     }
-                    outInput1.reset();
-                    eval1.evaluate(tuple);
-                    fieldIndex = IntegerPointable.getInteger(outInput1.getByteArray(), 1);
+                    eval1.evaluate(tuple, inputArg1);
+                    fieldIndex = IntegerPointable.getInteger(inputArg1.getByteArray(), inputArg1.getStartOffset() + 1);
                     fieldValueType = recordType.getFieldTypes()[fieldIndex];
-                    fieldValueOffset = ARecordSerializerDeserializer.getFieldOffsetById(serRecord, fieldIndex,
+                    fieldValueOffset = ARecordSerializerDeserializer.getFieldOffsetById(serRecord, offset, fieldIndex,
                             nullBitmapSize, recordType.isOpen());
 
                     if (fieldValueOffset == 0) {
                         // the field is null, we checked the null bit map
                         out.writeByte(ATypeTag.SERIALIZED_NULL_TYPE_TAG);
+                        result.set(resultStorage);
                         return;
                     }
 
@@ -131,7 +134,7 @@
                         out.writeByte(fieldValueTypeTag.serialize());
                     }
                     out.write(serRecord, fieldValueOffset, fieldValueLength);
-
+                    result.set(resultStorage);
                 } catch (IOException e) {
                     throw new AlgebricksException(e);
                 } catch (AsterixException e) {
diff --git a/asterix-runtime/src/main/java/org/apache/asterix/runtime/evaluators/functions/records/FieldAccessByNameDescriptor.java b/asterix-runtime/src/main/java/org/apache/asterix/runtime/evaluators/functions/records/FieldAccessByNameDescriptor.java
index 0951de0..f11941e 100644
--- a/asterix-runtime/src/main/java/org/apache/asterix/runtime/evaluators/functions/records/FieldAccessByNameDescriptor.java
+++ b/asterix-runtime/src/main/java/org/apache/asterix/runtime/evaluators/functions/records/FieldAccessByNameDescriptor.java
@@ -23,7 +23,7 @@
 import org.apache.asterix.om.functions.IFunctionDescriptorFactory;
 import org.apache.asterix.runtime.evaluators.base.AbstractScalarFunctionDynamicDescriptor;
 import org.apache.hyracks.algebricks.core.algebra.functions.FunctionIdentifier;
-import org.apache.hyracks.algebricks.runtime.base.ICopyEvaluatorFactory;
+import org.apache.hyracks.algebricks.runtime.base.IScalarEvaluatorFactory;
 
 public class FieldAccessByNameDescriptor extends AbstractScalarFunctionDynamicDescriptor {
 
@@ -40,7 +40,7 @@
     }
 
     @Override
-    public ICopyEvaluatorFactory createEvaluatorFactory(ICopyEvaluatorFactory[] args) {
+    public IScalarEvaluatorFactory createEvaluatorFactory(IScalarEvaluatorFactory[] args) {
         return new FieldAccessByNameEvalFactory(args[0], args[1]);
     }
 
diff --git a/asterix-runtime/src/main/java/org/apache/asterix/runtime/evaluators/functions/records/FieldAccessByNameEvalFactory.java b/asterix-runtime/src/main/java/org/apache/asterix/runtime/evaluators/functions/records/FieldAccessByNameEvalFactory.java
index 66bedf0..d11c91e 100644
--- a/asterix-runtime/src/main/java/org/apache/asterix/runtime/evaluators/functions/records/FieldAccessByNameEvalFactory.java
+++ b/asterix-runtime/src/main/java/org/apache/asterix/runtime/evaluators/functions/records/FieldAccessByNameEvalFactory.java
@@ -31,36 +31,39 @@
 import org.apache.asterix.om.types.EnumDeserializer;
 import org.apache.asterix.om.util.NonTaggedFormatUtil;
 import org.apache.hyracks.algebricks.common.exceptions.AlgebricksException;
-import org.apache.hyracks.algebricks.runtime.base.ICopyEvaluator;
-import org.apache.hyracks.algebricks.runtime.base.ICopyEvaluatorFactory;
+import org.apache.hyracks.algebricks.runtime.base.IScalarEvaluator;
+import org.apache.hyracks.algebricks.runtime.base.IScalarEvaluatorFactory;
+import org.apache.hyracks.api.context.IHyracksTaskContext;
 import org.apache.hyracks.api.dataflow.value.ISerializerDeserializer;
-import org.apache.hyracks.data.std.api.IDataOutputProvider;
+import org.apache.hyracks.data.std.api.IPointable;
+import org.apache.hyracks.data.std.primitive.VoidPointable;
 import org.apache.hyracks.data.std.util.ArrayBackedValueStorage;
 import org.apache.hyracks.dataflow.common.data.accessors.IFrameTupleReference;
 
-public class FieldAccessByNameEvalFactory implements ICopyEvaluatorFactory {
+public class FieldAccessByNameEvalFactory implements IScalarEvaluatorFactory {
 
     private static final long serialVersionUID = 1L;
 
-    private ICopyEvaluatorFactory recordEvalFactory;
-    private ICopyEvaluatorFactory fldNameEvalFactory;
+    private IScalarEvaluatorFactory recordEvalFactory;
+    private IScalarEvaluatorFactory fldNameEvalFactory;
 
-    public FieldAccessByNameEvalFactory(ICopyEvaluatorFactory recordEvalFactory,
-            ICopyEvaluatorFactory fldNameEvalFactory) {
+    public FieldAccessByNameEvalFactory(IScalarEvaluatorFactory recordEvalFactory,
+            IScalarEvaluatorFactory fldNameEvalFactory) {
         this.recordEvalFactory = recordEvalFactory;
         this.fldNameEvalFactory = fldNameEvalFactory;
     }
 
     @Override
-    public ICopyEvaluator createEvaluator(final IDataOutputProvider output) throws AlgebricksException {
-        return new ICopyEvaluator() {
+    public IScalarEvaluator createScalarEvaluator(final IHyracksTaskContext ctx) throws AlgebricksException {
+        return new IScalarEvaluator() {
 
-            private DataOutput out = output.getDataOutput();
+            private ArrayBackedValueStorage resultStorage = new ArrayBackedValueStorage();
+            private DataOutput out = resultStorage.getDataOutput();
 
-            private ArrayBackedValueStorage outInput0 = new ArrayBackedValueStorage();
-            private ArrayBackedValueStorage outInput1 = new ArrayBackedValueStorage();
-            private ICopyEvaluator eval0 = recordEvalFactory.createEvaluator(outInput0);
-            private ICopyEvaluator eval1 = fldNameEvalFactory.createEvaluator(outInput1);
+            private IPointable inputArg0 = new VoidPointable();
+            private IPointable inputArg1 = new VoidPointable();
+            private IScalarEvaluator eval0 = recordEvalFactory.createScalarEvaluator(ctx);
+            private IScalarEvaluator eval1 = fldNameEvalFactory.createScalarEvaluator(ctx);
             @SuppressWarnings("unchecked")
             private ISerializerDeserializer<ANull> nullSerde = AqlSerializerDeserializerProvider.INSTANCE
                     .getSerializerDeserializer(BuiltinType.ANULL);
@@ -69,38 +72,41 @@
             private ATypeTag fieldValueTypeTag = ATypeTag.NULL;
 
             @Override
-            public void evaluate(IFrameTupleReference tuple) throws AlgebricksException {
-
+            public void evaluate(IFrameTupleReference tuple, IPointable result) throws AlgebricksException {
                 try {
-                    outInput0.reset();
-                    eval0.evaluate(tuple);
-                    outInput1.reset();
-                    eval1.evaluate(tuple);
-                    byte[] serRecord = outInput0.getByteArray();
+                    resultStorage.reset();
+                    eval0.evaluate(tuple, inputArg0);
+                    eval1.evaluate(tuple, inputArg1);
+                    byte[] serRecord = inputArg0.getByteArray();
+                    int serRecordOffset = inputArg0.getStartOffset();
+                    int serRecordLen = inputArg0.getLength();
 
-                    if (serRecord[0] == ATypeTag.SERIALIZED_NULL_TYPE_TAG) {
+                    if (serRecord[serRecordOffset] == ATypeTag.SERIALIZED_NULL_TYPE_TAG) {
                         nullSerde.serialize(ANull.NULL, out);
+                        result.set(resultStorage);
                         return;
                     }
 
-                    if (serRecord[0] != ATypeTag.SERIALIZED_RECORD_TYPE_TAG) {
+                    if (serRecord[serRecordOffset] != ATypeTag.SERIALIZED_RECORD_TYPE_TAG) {
                         throw new AlgebricksException(AsterixBuiltinFunctions.FIELD_ACCESS_BY_NAME.getName()
                                 + ": expects input type NULL or RECORD, but got "
-                                + EnumDeserializer.ATYPETAGDESERIALIZER.deserialize(serRecord[0]));
+                                + EnumDeserializer.ATYPETAGDESERIALIZER.deserialize(serRecord[serRecordOffset]));
                     }
 
-                    byte[] serFldName = outInput1.getByteArray();
-                    fieldValueOffset = ARecordSerializerDeserializer.getFieldOffsetByName(serRecord, serFldName);
+                    byte[] serFldName = inputArg1.getByteArray();
+                    int serFldNameOffset = inputArg1.getStartOffset();
+                    fieldValueOffset = ARecordSerializerDeserializer.getFieldOffsetByName(serRecord, serRecordOffset,
+                            serRecordLen, serFldName, serFldNameOffset);
                     if (fieldValueOffset < 0) {
                         out.writeByte(ATypeTag.SERIALIZED_NULL_TYPE_TAG);
+                        result.set(resultStorage);
                         return;
                     }
 
                     fieldValueTypeTag = EnumDeserializer.ATYPETAGDESERIALIZER.deserialize(serRecord[fieldValueOffset]);
                     fieldValueLength = NonTaggedFormatUtil.getFieldValueLength(serRecord, fieldValueOffset,
                             fieldValueTypeTag, true) + 1;
-                    out.write(serRecord, fieldValueOffset, fieldValueLength);
-
+                    result.set(serRecord, fieldValueOffset, fieldValueLength);
                 } catch (IOException e) {
                     throw new AlgebricksException(e);
                 } catch (AsterixException e) {
diff --git a/asterix-runtime/src/main/java/org/apache/asterix/runtime/evaluators/functions/records/FieldAccessNestedDescriptor.java b/asterix-runtime/src/main/java/org/apache/asterix/runtime/evaluators/functions/records/FieldAccessNestedDescriptor.java
index 726a8b3..67e7027 100644
--- a/asterix-runtime/src/main/java/org/apache/asterix/runtime/evaluators/functions/records/FieldAccessNestedDescriptor.java
+++ b/asterix-runtime/src/main/java/org/apache/asterix/runtime/evaluators/functions/records/FieldAccessNestedDescriptor.java
@@ -26,7 +26,7 @@
 import org.apache.asterix.om.types.ARecordType;
 import org.apache.asterix.runtime.evaluators.base.AbstractScalarFunctionDynamicDescriptor;
 import org.apache.hyracks.algebricks.core.algebra.functions.FunctionIdentifier;
-import org.apache.hyracks.algebricks.runtime.base.ICopyEvaluatorFactory;
+import org.apache.hyracks.algebricks.runtime.base.IScalarEvaluatorFactory;
 
 public class FieldAccessNestedDescriptor extends AbstractScalarFunctionDynamicDescriptor {
 
@@ -51,7 +51,7 @@
     }
 
     @Override
-    public ICopyEvaluatorFactory createEvaluatorFactory(ICopyEvaluatorFactory[] args) {
+    public IScalarEvaluatorFactory createEvaluatorFactory(IScalarEvaluatorFactory[] args) {
         return new FieldAccessNestedEvalFactory(args[0], recType, fldName);
     }
 
diff --git a/asterix-runtime/src/main/java/org/apache/asterix/runtime/evaluators/functions/records/FieldAccessNestedEvalFactory.java b/asterix-runtime/src/main/java/org/apache/asterix/runtime/evaluators/functions/records/FieldAccessNestedEvalFactory.java
index 2f41816..762fdf3 100644
--- a/asterix-runtime/src/main/java/org/apache/asterix/runtime/evaluators/functions/records/FieldAccessNestedEvalFactory.java
+++ b/asterix-runtime/src/main/java/org/apache/asterix/runtime/evaluators/functions/records/FieldAccessNestedEvalFactory.java
@@ -19,27 +19,44 @@
 package org.apache.asterix.runtime.evaluators.functions.records;
 
 import java.io.DataOutput;
+import java.io.IOException;
 import java.util.List;
 
+import org.apache.asterix.common.exceptions.AsterixException;
+import org.apache.asterix.dataflow.data.nontagged.serde.ARecordSerializerDeserializer;
+import org.apache.asterix.formats.nontagged.AqlSerializerDeserializerProvider;
+import org.apache.asterix.om.base.ANull;
+import org.apache.asterix.om.base.AString;
 import org.apache.asterix.om.types.ARecordType;
+import org.apache.asterix.om.types.ATypeTag;
+import org.apache.asterix.om.types.AUnionType;
+import org.apache.asterix.om.types.BuiltinType;
+import org.apache.asterix.om.types.EnumDeserializer;
+import org.apache.asterix.om.types.IAType;
 import org.apache.asterix.om.types.runtime.RuntimeRecordTypeInfo;
+import org.apache.asterix.om.util.NonTaggedFormatUtil;
+import org.apache.commons.lang.NotImplementedException;
 import org.apache.hyracks.algebricks.common.exceptions.AlgebricksException;
-import org.apache.hyracks.algebricks.runtime.base.ICopyEvaluator;
-import org.apache.hyracks.algebricks.runtime.base.ICopyEvaluatorFactory;
-import org.apache.hyracks.data.std.api.IDataOutputProvider;
+import org.apache.hyracks.algebricks.runtime.base.IScalarEvaluator;
+import org.apache.hyracks.algebricks.runtime.base.IScalarEvaluatorFactory;
+import org.apache.hyracks.api.context.IHyracksTaskContext;
+import org.apache.hyracks.api.dataflow.value.ISerializerDeserializer;
+import org.apache.hyracks.api.exceptions.HyracksDataException;
+import org.apache.hyracks.data.std.api.IPointable;
+import org.apache.hyracks.data.std.primitive.VoidPointable;
 import org.apache.hyracks.data.std.util.ArrayBackedValueStorage;
 import org.apache.hyracks.data.std.util.ByteArrayAccessibleOutputStream;
 import org.apache.hyracks.dataflow.common.data.accessors.IFrameTupleReference;
 
-public class FieldAccessNestedEvalFactory implements ICopyEvaluatorFactory {
+public class FieldAccessNestedEvalFactory implements IScalarEvaluatorFactory {
 
     private static final long serialVersionUID = 1L;
 
-    private ICopyEvaluatorFactory recordEvalFactory;
+    private IScalarEvaluatorFactory recordEvalFactory;
     private ARecordType recordType;
     private List<String> fieldPath;
 
-    public FieldAccessNestedEvalFactory(ICopyEvaluatorFactory recordEvalFactory, ARecordType recordType,
+    public FieldAccessNestedEvalFactory(IScalarEvaluatorFactory recordEvalFactory, ARecordType recordType,
             List<String> fldName) {
         this.recordEvalFactory = recordEvalFactory;
         this.recordType = recordType;
@@ -48,30 +65,192 @@
     }
 
     @Override
-    public ICopyEvaluator createEvaluator(final IDataOutputProvider output) throws AlgebricksException {
-        return new ICopyEvaluator() {
+    public IScalarEvaluator createScalarEvaluator(final IHyracksTaskContext ctx) throws AlgebricksException {
+        return new IScalarEvaluator() {
 
-            private final DataOutput out = output.getDataOutput();
+            private ArrayBackedValueStorage resultStorage = new ArrayBackedValueStorage();
+            private final DataOutput out = resultStorage.getDataOutput();
             private final ByteArrayAccessibleOutputStream subRecordTmpStream = new ByteArrayAccessibleOutputStream();
 
-            private final ArrayBackedValueStorage outInput0 = new ArrayBackedValueStorage();
-            private final ICopyEvaluator eval0 = recordEvalFactory.createEvaluator(outInput0);
-            private final ArrayBackedValueStorage[] abvsFields = new ArrayBackedValueStorage[fieldPath.size()];
-            private final DataOutput[] doFields = new DataOutput[fieldPath.size()];
+            private final IPointable inputArg0 = new VoidPointable();
+            private final IScalarEvaluator eval0 = recordEvalFactory.createScalarEvaluator(ctx);
+            private final IPointable[] fieldPointables = new VoidPointable[fieldPath.size()];
             private final RuntimeRecordTypeInfo[] recTypeInfos = new RuntimeRecordTypeInfo[fieldPath.size()];
+            @SuppressWarnings("unchecked")
+            private final ISerializerDeserializer<ANull> nullSerde = AqlSerializerDeserializerProvider.INSTANCE
+                    .getSerializerDeserializer(BuiltinType.ANULL);
 
             {
-                FieldAccessUtil.getFieldsAbvs(abvsFields, doFields, fieldPath);
+                generateFieldsPointables();
                 for (int index = 0; index < fieldPath.size(); ++index) {
                     recTypeInfos[index] = new RuntimeRecordTypeInfo();
                 }
 
             }
 
+            @SuppressWarnings("unchecked")
+            private void generateFieldsPointables() throws AlgebricksException {
+                for (int i = 0; i < fieldPath.size(); i++) {
+                    ArrayBackedValueStorage storage = new ArrayBackedValueStorage();
+                    DataOutput out = storage.getDataOutput();
+                    AString as = new AString(fieldPath.get(i));
+                    try {
+                        AqlSerializerDeserializerProvider.INSTANCE.getSerializerDeserializer(as.getType()).serialize(as,
+                                out);
+                    } catch (HyracksDataException e) {
+                        throw new AlgebricksException(e);
+                    }
+                    fieldPointables[i] = new VoidPointable();
+                    fieldPointables[i].set(storage);
+                }
+            }
+
             @Override
-            public void evaluate(IFrameTupleReference tuple) throws AlgebricksException {
-                FieldAccessUtil.evaluate(tuple, out, eval0, abvsFields, outInput0, subRecordTmpStream, recordType,
-                        recTypeInfos);
+            public void evaluate(IFrameTupleReference tuple, IPointable result) throws AlgebricksException {
+                try {
+                    resultStorage.reset();
+                    eval0.evaluate(tuple, inputArg0);
+                    byte[] serRecord = inputArg0.getByteArray();
+                    int offset = inputArg0.getStartOffset();
+                    int start = offset;
+                    int len = inputArg0.getLength();
+
+                    if (serRecord[start] == ATypeTag.SERIALIZED_NULL_TYPE_TAG) {
+                        nullSerde.serialize(ANull.NULL, out);
+                        result.set(resultStorage);
+                        return;
+                    }
+                    if (serRecord[start] != ATypeTag.SERIALIZED_RECORD_TYPE_TAG) {
+                        throw new AlgebricksException("Field accessor is not defined for values of type "
+                                + EnumDeserializer.ATYPETAGDESERIALIZER.deserialize(serRecord[start]));
+                    }
+
+                    int subFieldIndex = -1;
+                    int subFieldOffset = -1;
+                    int subFieldLength = -1;
+                    int nullBitmapSize = -1;
+
+                    IAType subType = recordType;
+                    recTypeInfos[0].reset(recordType);
+
+                    ATypeTag subTypeTag = ATypeTag.NULL;
+                    boolean openField = false;
+                    int pathIndex = 0;
+
+                    // Moving through closed fields first.
+                    for (; pathIndex < fieldPointables.length; pathIndex++) {
+                        if (subType.getTypeTag().equals(ATypeTag.UNION)) {
+                            //enforced SubType
+                            subType = ((AUnionType) subType).getNullableType();
+                            if (subType.getTypeTag().serialize() != ATypeTag.SERIALIZED_RECORD_TYPE_TAG) {
+                                throw new AlgebricksException(
+                                        "Field accessor is not defined for values of type " + subTypeTag);
+                            }
+                            if (subType.getTypeTag() == ATypeTag.RECORD) {
+                                recTypeInfos[pathIndex].reset((ARecordType) subType);
+                            }
+                        }
+                        subFieldIndex = recTypeInfos[pathIndex].getFieldIndex(fieldPointables[pathIndex].getByteArray(),
+                                fieldPointables[pathIndex].getStartOffset() + 1,
+                                fieldPointables[pathIndex].getLength() - 1);
+                        if (subFieldIndex == -1) {
+                            break;
+                        }
+                        nullBitmapSize = ARecordType.computeNullBitmapSize((ARecordType) subType);
+                        subFieldOffset = ARecordSerializerDeserializer.getFieldOffsetById(serRecord, start,
+                                subFieldIndex, nullBitmapSize, ((ARecordType) subType).isOpen());
+                        if (subFieldOffset == 0) {
+                            // the field is null, we checked the null bit map
+                            out.writeByte(ATypeTag.SERIALIZED_NULL_TYPE_TAG);
+                            result.set(resultStorage);
+                            return;
+                        }
+                        subType = ((ARecordType) subType).getFieldTypes()[subFieldIndex];
+                        if (subType.getTypeTag() == ATypeTag.RECORD && pathIndex + 1 < fieldPointables.length) {
+                            // Move to the next Depth
+                            recTypeInfos[pathIndex + 1].reset((ARecordType) subType);
+                        }
+                        if (subType.getTypeTag().equals(ATypeTag.UNION)) {
+                            if (((AUnionType) subType).isNullableType()) {
+                                subTypeTag = ((AUnionType) subType).getNullableType().getTypeTag();
+                                subFieldLength = NonTaggedFormatUtil.getFieldValueLength(serRecord, subFieldOffset,
+                                        subTypeTag, false);
+                            } else {
+                                // union .. the general case
+                                throw new NotImplementedException();
+                            }
+                        } else {
+                            subTypeTag = subType.getTypeTag();
+                            subFieldLength = NonTaggedFormatUtil.getFieldValueLength(serRecord, subFieldOffset,
+                                    subTypeTag, false);
+                        }
+
+                        if (pathIndex < fieldPointables.length - 1) {
+                            //setup next iteration
+                            subRecordTmpStream.reset();
+                            subRecordTmpStream.write(subTypeTag.serialize());
+                            subRecordTmpStream.write(serRecord, subFieldOffset, subFieldLength);
+                            serRecord = subRecordTmpStream.getByteArray();
+                            start = 0;
+
+                            // type check
+                            if (serRecord[start] == ATypeTag.SERIALIZED_NULL_TYPE_TAG) {
+                                nullSerde.serialize(ANull.NULL, out);
+                                result.set(resultStorage);
+                                return;
+                            }
+                            if (serRecord[start] != ATypeTag.SERIALIZED_RECORD_TYPE_TAG) {
+                                throw new AlgebricksException("Field accessor is not defined for values of type "
+                                        + EnumDeserializer.ATYPETAGDESERIALIZER.deserialize(serRecord[start]));
+                            }
+                        }
+                    }
+
+                    // Moving through open fields after we hit the first open field.
+                    for (; pathIndex < fieldPointables.length; pathIndex++) {
+                        openField = true;
+                        subFieldOffset = ARecordSerializerDeserializer.getFieldOffsetByName(serRecord, start, len,
+                                fieldPointables[pathIndex].getByteArray(), fieldPointables[pathIndex].getStartOffset());
+                        if (subFieldOffset < 0) {
+                            out.writeByte(ATypeTag.SERIALIZED_NULL_TYPE_TAG);
+                            result.set(resultStorage);
+                            return;
+                        }
+
+                        subTypeTag = EnumDeserializer.ATYPETAGDESERIALIZER.deserialize(serRecord[subFieldOffset]);
+                        subFieldLength = NonTaggedFormatUtil.getFieldValueLength(serRecord, subFieldOffset, subTypeTag,
+                                true) + 1;
+
+                        if (pathIndex < fieldPointables.length - 1) {
+                            //setup next iteration
+                            start = subFieldOffset;
+                            len = subFieldLength;
+
+                            // type check
+                            if (serRecord[start] == ATypeTag.SERIALIZED_NULL_TYPE_TAG) {
+                                nullSerde.serialize(ANull.NULL, out);
+                                result.set(resultStorage);
+                                return;
+                            }
+                            if (serRecord[start] != ATypeTag.SERIALIZED_RECORD_TYPE_TAG) {
+                                throw new AlgebricksException("Field accessor is not defined for values of type "
+                                        + EnumDeserializer.ATYPETAGDESERIALIZER.deserialize(serRecord[start]));
+                            }
+                        }
+                    }
+                    // emit the final result.
+                    if (openField) {
+                        result.set(serRecord, subFieldOffset, subFieldLength);
+                    } else {
+                        out.writeByte(subTypeTag.serialize());
+                        out.write(serRecord, subFieldOffset, subFieldLength);
+                        result.set(resultStorage);
+                    }
+                } catch (IOException e) {
+                    throw new AlgebricksException(e);
+                } catch (AsterixException e) {
+                    throw new AlgebricksException(e);
+                }
             }
         };
     }
diff --git a/asterix-runtime/src/main/java/org/apache/asterix/runtime/evaluators/functions/records/FieldAccessUtil.java b/asterix-runtime/src/main/java/org/apache/asterix/runtime/evaluators/functions/records/FieldAccessUtil.java
deleted file mode 100644
index f9bb6fc..0000000
--- a/asterix-runtime/src/main/java/org/apache/asterix/runtime/evaluators/functions/records/FieldAccessUtil.java
+++ /dev/null
@@ -1,203 +0,0 @@
-/*
- * Licensed to the Apache Software Foundation (ASF) under one
- * or more contributor license agreements.  See the NOTICE file
- * distributed with this work for additional information
- * regarding copyright ownership.  The ASF licenses this file
- * to you under the Apache License, Version 2.0 (the
- * "License"); you may not use this file except in compliance
- * with the License.  You may obtain a copy of the License at
- *
- *   http://www.apache.org/licenses/LICENSE-2.0
- *
- * Unless required by applicable law or agreed to in writing,
- * software distributed under the License is distributed on an
- * "AS IS" BASIS, WITHOUT WARRANTIES OR CONDITIONS OF ANY
- * KIND, either express or implied.  See the License for the
- * specific language governing permissions and limitations
- * under the License.
- */
-package org.apache.asterix.runtime.evaluators.functions.records;
-
-import java.io.DataOutput;
-import java.io.IOException;
-import java.util.Arrays;
-import java.util.List;
-
-import org.apache.asterix.common.exceptions.AsterixException;
-import org.apache.asterix.dataflow.data.nontagged.serde.ARecordSerializerDeserializer;
-import org.apache.asterix.formats.nontagged.AqlSerializerDeserializerProvider;
-import org.apache.asterix.om.base.ANull;
-import org.apache.asterix.om.base.AString;
-import org.apache.asterix.om.types.ARecordType;
-import org.apache.asterix.om.types.ATypeTag;
-import org.apache.asterix.om.types.AUnionType;
-import org.apache.asterix.om.types.BuiltinType;
-import org.apache.asterix.om.types.EnumDeserializer;
-import org.apache.asterix.om.types.IAType;
-import org.apache.asterix.om.types.runtime.RuntimeRecordTypeInfo;
-import org.apache.asterix.om.util.NonTaggedFormatUtil;
-import org.apache.commons.lang.NotImplementedException;
-import org.apache.hyracks.algebricks.common.exceptions.AlgebricksException;
-import org.apache.hyracks.algebricks.runtime.base.ICopyEvaluator;
-import org.apache.hyracks.api.dataflow.value.ISerializerDeserializer;
-import org.apache.hyracks.api.exceptions.HyracksDataException;
-import org.apache.hyracks.data.std.util.ArrayBackedValueStorage;
-import org.apache.hyracks.data.std.util.ByteArrayAccessibleOutputStream;
-import org.apache.hyracks.dataflow.common.data.accessors.IFrameTupleReference;
-
-public class FieldAccessUtil {
-    @SuppressWarnings("unchecked")
-    private static ISerializerDeserializer<ANull> nullSerde = AqlSerializerDeserializerProvider.INSTANCE
-            .getSerializerDeserializer(BuiltinType.ANULL);
-
-    @SuppressWarnings("unchecked")
-    public static void getFieldsAbvs(ArrayBackedValueStorage[] abvsFields, DataOutput[] doFields,
-            List<String> fieldPaths) throws AlgebricksException {
-        AString as;
-        for (int i = 0; i < fieldPaths.size(); i++) {
-            abvsFields[i] = new ArrayBackedValueStorage();
-            doFields[i] = abvsFields[i].getDataOutput();
-            as = new AString(fieldPaths.get(i));
-            try {
-                AqlSerializerDeserializerProvider.INSTANCE.getSerializerDeserializer(as.getType()).serialize(as,
-                        doFields[i]);
-            } catch (HyracksDataException e) {
-                throw new AlgebricksException(e);
-            }
-        }
-    }
-
-    public static boolean checkType(byte tagId, DataOutput out) throws AlgebricksException {
-        if (tagId == ATypeTag.SERIALIZED_NULL_TYPE_TAG) {
-            try {
-                nullSerde.serialize(ANull.NULL, out);
-            } catch (HyracksDataException e) {
-                throw new AlgebricksException(e);
-            }
-            return true;
-        }
-
-        if (tagId != ATypeTag.SERIALIZED_RECORD_TYPE_TAG) {
-            throw new AlgebricksException("Field accessor is not defined for values of type "
-                    + EnumDeserializer.ATYPETAGDESERIALIZER.deserialize(tagId));
-        }
-        return false;
-    }
-
-    public static void evaluate(IFrameTupleReference tuple, DataOutput out, ICopyEvaluator eval0,
-            ArrayBackedValueStorage[] abvsFields, ArrayBackedValueStorage abvsRecord,
-            ByteArrayAccessibleOutputStream subRecordTmpStream, ARecordType recordType,
-            RuntimeRecordTypeInfo[] recTypeInfos) throws AlgebricksException {
-        try {
-            abvsRecord.reset();
-            eval0.evaluate(tuple);
-
-            int subFieldIndex = -1;
-            int subFieldOffset = -1;
-            int subFieldLength = -1;
-            int nullBitmapSize = -1;
-
-            IAType subType = recordType;
-            recTypeInfos[0].reset(recordType);
-
-            ATypeTag subTypeTag = ATypeTag.NULL;
-            byte[] subRecord = abvsRecord.getByteArray();
-            boolean openField = false;
-            int i = 0;
-
-            if (checkType(subRecord[0], out)) {
-                return;
-            }
-
-            //Moving through closed fields
-            for (; i < abvsFields.length; i++) {
-                if (subType.getTypeTag().equals(ATypeTag.UNION)) {
-                    //enforced SubType
-                    subType = ((AUnionType) subType).getNullableType();
-                    if (subType.getTypeTag().serialize() != ATypeTag.SERIALIZED_RECORD_TYPE_TAG) {
-                        throw new AlgebricksException("Field accessor is not defined for values of type " + subTypeTag);
-                    }
-                    if (subType.getTypeTag() == ATypeTag.RECORD) {
-                        recTypeInfos[i].reset((ARecordType) subType);
-                    }
-                }
-                subFieldIndex = recTypeInfos[i].getFieldIndex(abvsFields[i].getByteArray(),
-                        abvsFields[i].getStartOffset() + 1, abvsFields[i].getLength());
-                if (subFieldIndex == -1) {
-                    break;
-                }
-                nullBitmapSize = ARecordType.computeNullBitmapSize((ARecordType) subType);
-                subFieldOffset = ARecordSerializerDeserializer.getFieldOffsetById(subRecord, subFieldIndex,
-                        nullBitmapSize, ((ARecordType) subType).isOpen());
-                if (subFieldOffset == 0) {
-                    // the field is null, we checked the null bit map
-                    out.writeByte(ATypeTag.SERIALIZED_NULL_TYPE_TAG);
-                    return;
-                }
-                subType = ((ARecordType) subType).getFieldTypes()[subFieldIndex];
-                if (subType.getTypeTag() == ATypeTag.RECORD && i + 1 < abvsFields.length) {
-                    // Move to the next Depth
-                    recTypeInfos[i + 1].reset((ARecordType) subType);
-                }
-                if (subType.getTypeTag().equals(ATypeTag.UNION)) {
-                    if (((AUnionType) subType).isNullableType()) {
-                        subTypeTag = ((AUnionType) subType).getNullableType().getTypeTag();
-                        subFieldLength = NonTaggedFormatUtil.getFieldValueLength(subRecord, subFieldOffset, subTypeTag,
-                                false);
-                    } else {
-                        // union .. the general case
-                        throw new NotImplementedException();
-                    }
-                } else {
-                    subTypeTag = subType.getTypeTag();
-                    subFieldLength = NonTaggedFormatUtil.getFieldValueLength(subRecord, subFieldOffset, subTypeTag,
-                            false);
-                }
-
-                if (i < abvsFields.length - 1) {
-                    //setup next iteration
-                    subRecordTmpStream.reset();
-                    subRecordTmpStream.write(subTypeTag.serialize());
-                    subRecordTmpStream.write(subRecord, subFieldOffset, subFieldLength);
-                    subRecord = subRecordTmpStream.getByteArray();
-
-                    if (checkType(subRecord[0], out)) {
-                        return;
-                    }
-                }
-            }
-
-            //Moving through open fields
-            for (; i < abvsFields.length; i++) {
-                openField = true;
-                subFieldOffset = ARecordSerializerDeserializer.getFieldOffsetByName(subRecord,
-                        abvsFields[i].getByteArray());
-                if (subFieldOffset < 0) {
-                    out.writeByte(ATypeTag.SERIALIZED_NULL_TYPE_TAG);
-                    return;
-                }
-
-                subTypeTag = EnumDeserializer.ATYPETAGDESERIALIZER.deserialize(subRecord[subFieldOffset]);
-                subFieldLength = NonTaggedFormatUtil.getFieldValueLength(subRecord, subFieldOffset, subTypeTag, true)
-                        + 1;
-
-                if (i < abvsFields.length - 1) {
-                    //setup next iteration
-                    subRecord = Arrays.copyOfRange(subRecord, subFieldOffset, subFieldOffset + subFieldLength);
-
-                    if (checkType(subRecord[0], out)) {
-                        return;
-                    }
-                }
-            }
-            if (!openField) {
-                out.writeByte(subTypeTag.serialize());
-            }
-            out.write(subRecord, subFieldOffset, subFieldLength);
-        } catch (IOException e) {
-            throw new AlgebricksException(e);
-        } catch (AsterixException e) {
-            throw new AlgebricksException(e);
-        }
-    }
-}
diff --git a/asterix-runtime/src/main/java/org/apache/asterix/runtime/evaluators/functions/records/GetRecordFieldValueDescriptor.java b/asterix-runtime/src/main/java/org/apache/asterix/runtime/evaluators/functions/records/GetRecordFieldValueDescriptor.java
index bc1eb4b..c916d62 100644
--- a/asterix-runtime/src/main/java/org/apache/asterix/runtime/evaluators/functions/records/GetRecordFieldValueDescriptor.java
+++ b/asterix-runtime/src/main/java/org/apache/asterix/runtime/evaluators/functions/records/GetRecordFieldValueDescriptor.java
@@ -24,7 +24,7 @@
 import org.apache.asterix.om.types.ARecordType;
 import org.apache.asterix.runtime.evaluators.base.AbstractScalarFunctionDynamicDescriptor;
 import org.apache.hyracks.algebricks.core.algebra.functions.FunctionIdentifier;
-import org.apache.hyracks.algebricks.runtime.base.ICopyEvaluatorFactory;
+import org.apache.hyracks.algebricks.runtime.base.IScalarEvaluatorFactory;
 
 public class GetRecordFieldValueDescriptor extends AbstractScalarFunctionDynamicDescriptor {
 
@@ -47,7 +47,7 @@
     }
 
     @Override
-    public ICopyEvaluatorFactory createEvaluatorFactory(ICopyEvaluatorFactory[] args) {
+    public IScalarEvaluatorFactory createEvaluatorFactory(IScalarEvaluatorFactory[] args) {
         return new GetRecordFieldValueEvalFactory(args[0], args[1], recType);
     }
 
diff --git a/asterix-runtime/src/main/java/org/apache/asterix/runtime/evaluators/functions/records/GetRecordFieldValueEvalFactory.java b/asterix-runtime/src/main/java/org/apache/asterix/runtime/evaluators/functions/records/GetRecordFieldValueEvalFactory.java
index 501c743..71ce3a9 100644
--- a/asterix-runtime/src/main/java/org/apache/asterix/runtime/evaluators/functions/records/GetRecordFieldValueEvalFactory.java
+++ b/asterix-runtime/src/main/java/org/apache/asterix/runtime/evaluators/functions/records/GetRecordFieldValueEvalFactory.java
@@ -21,83 +21,134 @@
 import java.io.DataOutput;
 import java.io.IOException;
 
+import org.apache.asterix.common.exceptions.AsterixException;
+import org.apache.asterix.dataflow.data.nontagged.serde.ARecordSerializerDeserializer;
 import org.apache.asterix.formats.nontagged.AqlSerializerDeserializerProvider;
 import org.apache.asterix.om.base.ANull;
 import org.apache.asterix.om.types.ARecordType;
 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.runtime.RuntimeRecordTypeInfo;
+import org.apache.asterix.om.util.NonTaggedFormatUtil;
 import org.apache.hyracks.algebricks.common.exceptions.AlgebricksException;
-import org.apache.hyracks.algebricks.runtime.base.ICopyEvaluator;
-import org.apache.hyracks.algebricks.runtime.base.ICopyEvaluatorFactory;
+import org.apache.hyracks.algebricks.runtime.base.IScalarEvaluator;
+import org.apache.hyracks.algebricks.runtime.base.IScalarEvaluatorFactory;
+import org.apache.hyracks.api.context.IHyracksTaskContext;
 import org.apache.hyracks.api.dataflow.value.ISerializerDeserializer;
-import org.apache.hyracks.data.std.api.IDataOutputProvider;
+import org.apache.hyracks.data.std.api.IPointable;
+import org.apache.hyracks.data.std.primitive.VoidPointable;
 import org.apache.hyracks.data.std.util.ArrayBackedValueStorage;
-import org.apache.hyracks.data.std.util.ByteArrayAccessibleOutputStream;
 import org.apache.hyracks.dataflow.common.data.accessors.IFrameTupleReference;
 
-public class GetRecordFieldValueEvalFactory implements ICopyEvaluatorFactory {
+public class GetRecordFieldValueEvalFactory implements IScalarEvaluatorFactory {
 
     private static final long serialVersionUID = 1L;
 
-    private ICopyEvaluatorFactory recordEvalFactory;
-    private ICopyEvaluatorFactory fldNameEvalFactory;
+    private IScalarEvaluatorFactory recordEvalFactory;
+    private IScalarEvaluatorFactory fldNameEvalFactory;
     private final ARecordType recordType;
 
-    public GetRecordFieldValueEvalFactory(ICopyEvaluatorFactory recordEvalFactory,
-            ICopyEvaluatorFactory fldNameEvalFactory, ARecordType recordType) {
+    public GetRecordFieldValueEvalFactory(IScalarEvaluatorFactory recordEvalFactory,
+            IScalarEvaluatorFactory fldNameEvalFactory, ARecordType recordType) {
         this.recordEvalFactory = recordEvalFactory;
         this.fldNameEvalFactory = fldNameEvalFactory;
         this.recordType = recordType;
     }
 
     @Override
-    public ICopyEvaluator createEvaluator(final IDataOutputProvider output) throws AlgebricksException {
-        return new ICopyEvaluator() {
+    public IScalarEvaluator createScalarEvaluator(final IHyracksTaskContext ctx) throws AlgebricksException {
+        return new IScalarEvaluator() {
 
-            private final DataOutput out = output.getDataOutput();
-            private final ByteArrayAccessibleOutputStream subRecordTmpStream = new ByteArrayAccessibleOutputStream();
+            private final ArrayBackedValueStorage resultStorage = new ArrayBackedValueStorage();
+            private final DataOutput out = resultStorage.getDataOutput();
 
-            private final ArrayBackedValueStorage outInput0 = new ArrayBackedValueStorage();
-            private final ArrayBackedValueStorage outInput1 = new ArrayBackedValueStorage();
-            private final ICopyEvaluator eval0 = recordEvalFactory.createEvaluator(outInput0);
-            private final ICopyEvaluator eval1 = fldNameEvalFactory.createEvaluator(outInput1);
-
-            private final int size = 1;
-            private final ArrayBackedValueStorage abvsFields[] = new ArrayBackedValueStorage[size];
-            private final DataOutput[] doFields = new DataOutput[size];
+            private final IPointable inputArg0 = new VoidPointable();
+            private final IPointable inputArg1 = new VoidPointable();
+            private final IScalarEvaluator recordEval = recordEvalFactory.createScalarEvaluator(ctx);
+            private final IScalarEvaluator fieldNameEval = fldNameEvalFactory.createScalarEvaluator(ctx);
 
             @SuppressWarnings("unchecked")
             private final ISerializerDeserializer<ANull> nullSerde = AqlSerializerDeserializerProvider.INSTANCE
                     .getSerializerDeserializer(BuiltinType.ANULL);
-            private final RuntimeRecordTypeInfo[] recTypeInfos = new RuntimeRecordTypeInfo[size];
+            private final RuntimeRecordTypeInfo recTypeInfo = new RuntimeRecordTypeInfo();
 
             {
-                abvsFields[0] = new ArrayBackedValueStorage();
-                doFields[0] = abvsFields[0].getDataOutput();
-                for (int index = 0; index < size; ++index) {
-                    recTypeInfos[index] = new RuntimeRecordTypeInfo();
-                }
+                recTypeInfo.reset(recordType);
             }
 
             @Override
-            public void evaluate(IFrameTupleReference tuple) throws AlgebricksException {
+            public void evaluate(IFrameTupleReference tuple, IPointable result) throws AlgebricksException {
                 try {
-                    outInput1.reset();
-                    eval1.evaluate(tuple);
-
-                    byte[] serFldName = outInput1.getByteArray();
-                    if (serFldName[0] != ATypeTag.SERIALIZED_STRING_TYPE_TAG) {
+                    resultStorage.reset();
+                    fieldNameEval.evaluate(tuple, inputArg1);
+                    byte[] serFldName = inputArg1.getByteArray();
+                    int serFldNameOffset = inputArg1.getStartOffset();
+                    int serFldNameLen = inputArg1.getLength();
+                    if (serFldName[serFldNameOffset] != ATypeTag.SERIALIZED_STRING_TYPE_TAG) {
                         nullSerde.serialize(ANull.NULL, out);
+                        result.set(resultStorage);
                         return;
                     }
-                    abvsFields[0].reset();
-                    doFields[0].write(serFldName);
 
-                    FieldAccessUtil.evaluate(tuple, out, eval0, abvsFields, outInput0, subRecordTmpStream, recordType,
-                            recTypeInfos);
+                    recordEval.evaluate(tuple, inputArg0);
+                    byte[] serRecord = inputArg0.getByteArray();
+                    int serRecordOffset = inputArg0.getStartOffset();
+                    int serRecordLen = inputArg0.getLength();
+                    if (serRecord[serRecordOffset] == ATypeTag.SERIALIZED_NULL_TYPE_TAG) {
+                        nullSerde.serialize(ANull.NULL, out);
+                        result.set(resultStorage);
+                        return;
+                    }
+                    if (serRecord[serRecordOffset] != ATypeTag.SERIALIZED_RECORD_TYPE_TAG) {
+                        throw new AlgebricksException("Field accessor is not defined for values of type "
+                                + EnumDeserializer.ATYPETAGDESERIALIZER.deserialize(serRecord[serRecordOffset]));
+                    }
+
+                    int subFieldOffset = -1;
+                    int subFieldLength = -1;
+
+                    // Look at closed fields first.
+                    int subFieldIndex = recTypeInfo.getFieldIndex(serFldName, serFldNameOffset + 1, serFldNameLen - 1);
+                    if (subFieldIndex >= 0) {
+                        int nullBitmapSize = ARecordType.computeNullBitmapSize(recordType);
+                        subFieldOffset = ARecordSerializerDeserializer.getFieldOffsetById(serRecord, serRecordOffset,
+                                subFieldIndex, nullBitmapSize, recordType.isOpen());
+                        if (subFieldOffset == 0) {
+                            // the field is null, we checked the null bit map
+                            out.writeByte(ATypeTag.SERIALIZED_NULL_TYPE_TAG);
+                            result.set(resultStorage);
+                            return;
+                        }
+                        ATypeTag fieldTypeTag = recordType.getFieldTypes()[subFieldIndex].getTypeTag();
+                        subFieldLength = NonTaggedFormatUtil.getFieldValueLength(serRecord, subFieldOffset,
+                                fieldTypeTag, false);
+                        // write result.
+                        out.writeByte(fieldTypeTag.serialize());
+                        out.write(serRecord, subFieldOffset, subFieldLength);
+                        result.set(resultStorage);
+                        return;
+                    }
+
+                    // Look at open fields.
+                    subFieldOffset = ARecordSerializerDeserializer.getFieldOffsetByName(serRecord, serRecordOffset,
+                            serRecordLen, serFldName, serFldNameOffset);
+                    if (subFieldOffset < 0) {
+                        out.writeByte(ATypeTag.SERIALIZED_NULL_TYPE_TAG);
+                        result.set(resultStorage);
+                        return;
+                    }
+                    // Get the field length.
+                    ATypeTag fieldValueTypeTag = EnumDeserializer.ATYPETAGDESERIALIZER
+                            .deserialize(serRecord[subFieldOffset]);
+                    subFieldLength = NonTaggedFormatUtil.getFieldValueLength(serRecord, subFieldOffset,
+                            fieldValueTypeTag, true) + 1;
+                    // write result.
+                    result.set(serRecord, subFieldOffset, subFieldLength);
                 } catch (IOException e) {
                     throw new AlgebricksException(e);
+                } catch (AsterixException e) {
+                    throw new AlgebricksException(e);
                 }
             }
         };
diff --git a/asterix-runtime/src/main/java/org/apache/asterix/runtime/evaluators/functions/records/GetRecordFieldsDescriptor.java b/asterix-runtime/src/main/java/org/apache/asterix/runtime/evaluators/functions/records/GetRecordFieldsDescriptor.java
index 76d19d3..e2b5ec1 100644
--- a/asterix-runtime/src/main/java/org/apache/asterix/runtime/evaluators/functions/records/GetRecordFieldsDescriptor.java
+++ b/asterix-runtime/src/main/java/org/apache/asterix/runtime/evaluators/functions/records/GetRecordFieldsDescriptor.java
@@ -24,7 +24,7 @@
 import org.apache.asterix.om.types.ARecordType;
 import org.apache.asterix.runtime.evaluators.base.AbstractScalarFunctionDynamicDescriptor;
 import org.apache.hyracks.algebricks.core.algebra.functions.FunctionIdentifier;
-import org.apache.hyracks.algebricks.runtime.base.ICopyEvaluatorFactory;
+import org.apache.hyracks.algebricks.runtime.base.IScalarEvaluatorFactory;
 
 public class GetRecordFieldsDescriptor extends AbstractScalarFunctionDynamicDescriptor {
 
@@ -47,7 +47,7 @@
     }
 
     @Override
-    public ICopyEvaluatorFactory createEvaluatorFactory(ICopyEvaluatorFactory[] args) {
+    public IScalarEvaluatorFactory createEvaluatorFactory(IScalarEvaluatorFactory[] args) {
         return new GetRecordFieldsEvalFactory(args[0], recType);
     }
 
diff --git a/asterix-runtime/src/main/java/org/apache/asterix/runtime/evaluators/functions/records/GetRecordFieldsEvalFactory.java b/asterix-runtime/src/main/java/org/apache/asterix/runtime/evaluators/functions/records/GetRecordFieldsEvalFactory.java
index d3f7a79..a24906d 100644
--- a/asterix-runtime/src/main/java/org/apache/asterix/runtime/evaluators/functions/records/GetRecordFieldsEvalFactory.java
+++ b/asterix-runtime/src/main/java/org/apache/asterix/runtime/evaluators/functions/records/GetRecordFieldsEvalFactory.java
@@ -30,27 +30,31 @@
 import org.apache.asterix.om.types.BuiltinType;
 import org.apache.asterix.om.types.EnumDeserializer;
 import org.apache.hyracks.algebricks.common.exceptions.AlgebricksException;
-import org.apache.hyracks.algebricks.runtime.base.ICopyEvaluator;
-import org.apache.hyracks.algebricks.runtime.base.ICopyEvaluatorFactory;
+import org.apache.hyracks.algebricks.runtime.base.IScalarEvaluator;
+import org.apache.hyracks.algebricks.runtime.base.IScalarEvaluatorFactory;
+import org.apache.hyracks.api.context.IHyracksTaskContext;
 import org.apache.hyracks.api.dataflow.value.ISerializerDeserializer;
 import org.apache.hyracks.api.exceptions.HyracksDataException;
-import org.apache.hyracks.data.std.api.IDataOutputProvider;
+import org.apache.hyracks.data.std.api.IPointable;
+import org.apache.hyracks.data.std.primitive.VoidPointable;
 import org.apache.hyracks.data.std.util.ArrayBackedValueStorage;
 import org.apache.hyracks.dataflow.common.data.accessors.IFrameTupleReference;
 
-public class GetRecordFieldsEvalFactory implements ICopyEvaluatorFactory {
+public class GetRecordFieldsEvalFactory implements IScalarEvaluatorFactory {
+
     private static final long serialVersionUID = 1L;
-    private ICopyEvaluatorFactory recordEvalFactory;
+
+    private IScalarEvaluatorFactory recordEvalFactory;
     private final ARecordType recordType;
 
-    public GetRecordFieldsEvalFactory(ICopyEvaluatorFactory recordEvalFactory, ARecordType recordType) {
+    public GetRecordFieldsEvalFactory(IScalarEvaluatorFactory recordEvalFactory, ARecordType recordType) {
         this.recordEvalFactory = recordEvalFactory;
         this.recordType = recordType;
     }
 
     @Override
-    public ICopyEvaluator createEvaluator(final IDataOutputProvider output) throws AlgebricksException {
-        return new ICopyEvaluator() {
+    public IScalarEvaluator createScalarEvaluator(final IHyracksTaskContext ctx) throws AlgebricksException {
+        return new IScalarEvaluator() {
 
             @SuppressWarnings("unchecked")
             private final ISerializerDeserializer<ANull> nullSerde = AqlSerializerDeserializerProvider.INSTANCE
@@ -58,32 +62,36 @@
 
             private final ARecordPointable recordPointable = (ARecordPointable) ARecordPointable.FACTORY
                     .createPointable();
-
-            private ArrayBackedValueStorage outInput0 = new ArrayBackedValueStorage();
-            private ICopyEvaluator eval0 = recordEvalFactory.createEvaluator(outInput0);
-            private DataOutput out = output.getDataOutput();
+            private IPointable inputArg0 = new VoidPointable();
+            private IScalarEvaluator eval0 = recordEvalFactory.createScalarEvaluator(ctx);
+            private ArrayBackedValueStorage resultStorage = new ArrayBackedValueStorage();
+            private DataOutput out = resultStorage.getDataOutput();
             private RecordFieldsUtil rfu = new RecordFieldsUtil();
 
             @Override
-            public void evaluate(IFrameTupleReference tuple) throws AlgebricksException {
-                outInput0.reset();
-                eval0.evaluate(tuple);
+            public void evaluate(IFrameTupleReference tuple, IPointable result) throws AlgebricksException {
+                resultStorage.reset();
+                eval0.evaluate(tuple, inputArg0);
+                byte[] data = inputArg0.getByteArray();
+                int offset = inputArg0.getStartOffset();
+                int len = inputArg0.getLength();
 
-                if (outInput0.getByteArray()[0] == ATypeTag.SERIALIZED_NULL_TYPE_TAG) {
+                if (data[offset] == ATypeTag.SERIALIZED_NULL_TYPE_TAG) {
                     try {
                         nullSerde.serialize(ANull.NULL, out);
+                        result.set(resultStorage);
+                        return;
                     } catch (HyracksDataException e) {
                         throw new AlgebricksException(e);
                     }
                 }
 
-                if (outInput0.getByteArray()[0] != ATypeTag.SERIALIZED_RECORD_TYPE_TAG) {
+                if (data[offset] != ATypeTag.SERIALIZED_RECORD_TYPE_TAG) {
                     throw new AlgebricksException("Field accessor is not defined for values of type "
-                            + EnumDeserializer.ATYPETAGDESERIALIZER.deserialize(outInput0.getByteArray()[0]));
+                            + EnumDeserializer.ATYPETAGDESERIALIZER.deserialize(data[offset]));
                 }
 
-                recordPointable.set(outInput0.getByteArray(), outInput0.getStartOffset(), outInput0.getLength());
-
+                recordPointable.set(data, offset, len);
                 try {
                     rfu.processRecord(recordPointable, recordType, out, 0);
                 } catch (IOException e) {
@@ -91,6 +99,7 @@
                 } catch (AsterixException e) {
                     e.printStackTrace();
                 }
+                result.set(resultStorage);
             }
         };
     }
diff --git a/asterix-runtime/src/main/java/org/apache/asterix/runtime/evaluators/functions/records/RecordAddFieldsDescriptor.java b/asterix-runtime/src/main/java/org/apache/asterix/runtime/evaluators/functions/records/RecordAddFieldsDescriptor.java
index 9e7c4ac..eee240b 100644
--- a/asterix-runtime/src/main/java/org/apache/asterix/runtime/evaluators/functions/records/RecordAddFieldsDescriptor.java
+++ b/asterix-runtime/src/main/java/org/apache/asterix/runtime/evaluators/functions/records/RecordAddFieldsDescriptor.java
@@ -19,7 +19,7 @@
 
 package org.apache.asterix.runtime.evaluators.functions.records;
 
-import java.io.IOException;
+import java.io.DataOutput;
 import java.util.List;
 
 import org.apache.asterix.builders.RecordBuilder;
@@ -49,13 +49,15 @@
 import org.apache.asterix.runtime.evaluators.functions.PointableHelper;
 import org.apache.hyracks.algebricks.common.exceptions.AlgebricksException;
 import org.apache.hyracks.algebricks.core.algebra.functions.FunctionIdentifier;
-import org.apache.hyracks.algebricks.runtime.base.ICopyEvaluator;
-import org.apache.hyracks.algebricks.runtime.base.ICopyEvaluatorFactory;
+import org.apache.hyracks.algebricks.runtime.base.IScalarEvaluator;
+import org.apache.hyracks.algebricks.runtime.base.IScalarEvaluatorFactory;
+import org.apache.hyracks.api.context.IHyracksTaskContext;
 import org.apache.hyracks.api.dataflow.value.IBinaryComparator;
 import org.apache.hyracks.api.dataflow.value.IBinaryHashFunction;
 import org.apache.hyracks.api.dataflow.value.ISerializerDeserializer;
 import org.apache.hyracks.api.exceptions.HyracksDataException;
-import org.apache.hyracks.data.std.api.IDataOutputProvider;
+import org.apache.hyracks.data.std.api.IPointable;
+import org.apache.hyracks.data.std.primitive.VoidPointable;
 import org.apache.hyracks.data.std.util.ArrayBackedValueStorage;
 import org.apache.hyracks.dataflow.common.data.accessors.IFrameTupleReference;
 
@@ -84,8 +86,9 @@
     }
 
     @Override
-    public ICopyEvaluatorFactory createEvaluatorFactory(final ICopyEvaluatorFactory[] args) throws AlgebricksException {
-        return new ICopyEvaluatorFactory() {
+    public IScalarEvaluatorFactory createEvaluatorFactory(final IScalarEvaluatorFactory[] args)
+            throws AlgebricksException {
+        return new IScalarEvaluatorFactory() {
 
             private static final long serialVersionUID = 1L;
             @SuppressWarnings("unchecked")
@@ -93,16 +96,16 @@
                     .getSerializerDeserializer(BuiltinType.ANULL);
 
             @Override
-            public ICopyEvaluator createEvaluator(final IDataOutputProvider output) throws AlgebricksException {
+            public IScalarEvaluator createScalarEvaluator(final IHyracksTaskContext ctx) throws AlgebricksException {
                 final PointableAllocator allocator = new PointableAllocator();
                 final IVisitablePointable vp0 = allocator.allocateRecordValue(inRecType);
                 final IVisitablePointable vp1 = allocator.allocateListValue(inListType);
 
-                final ArrayBackedValueStorage abvs0 = new ArrayBackedValueStorage();
-                final ArrayBackedValueStorage abvs1 = new ArrayBackedValueStorage();
+                final IPointable argPtr0 = new VoidPointable();
+                final IPointable argPtr1 = new VoidPointable();
 
-                final ICopyEvaluator eval0 = args[0].createEvaluator(abvs0);
-                final ICopyEvaluator eval1 = args[1].createEvaluator(abvs1);
+                final IScalarEvaluator eval0 = args[0].createScalarEvaluator(ctx);
+                final IScalarEvaluator eval1 = args[1].createScalarEvaluator(ctx);
 
                 final ArrayBackedValueStorage fieldNamePointable = new ArrayBackedValueStorage();
                 final ArrayBackedValueStorage fieldValuePointer = new ArrayBackedValueStorage();
@@ -114,7 +117,7 @@
                     throw new AlgebricksException(e);
                 }
 
-                return new ICopyEvaluator() {
+                return new IScalarEvaluator() {
                     public static final int TABLE_FRAME_SIZE = 32768; // the default 32k frame size
                     public static final int TABLE_SIZE = 100; // the default 32k frame size
                     private final RecordBuilder recordBuilder = new RecordBuilder();
@@ -132,42 +135,46 @@
                     private BinaryHashMap hashMap = new BinaryHashMap(TABLE_SIZE, TABLE_FRAME_SIZE, putHashFunc,
                             getHashFunc, cmp);
 
+                    private ArrayBackedValueStorage resultStorage = new ArrayBackedValueStorage();
+                    private DataOutput out = resultStorage.getDataOutput();
+
                     @Override
-                    public void evaluate(IFrameTupleReference tuple) throws AlgebricksException {
+                    public void evaluate(IFrameTupleReference tuple, IPointable result) throws AlgebricksException {
+                        resultStorage.reset();
                         recordBuilder.reset(outRecType);
                         requiredRecordTypeInfo.reset(outRecType);
-                        abvs0.reset();
-                        abvs1.reset();
+                        eval0.evaluate(tuple, argPtr0);
+                        eval1.evaluate(tuple, argPtr1);
 
-                        eval0.evaluate(tuple);
-                        eval1.evaluate(tuple);
-
-                        if (abvs0.getByteArray()[0] == ATypeTag.SERIALIZED_NULL_TYPE_TAG
-                                || abvs1.getByteArray()[0] == ATypeTag.SERIALIZED_NULL_TYPE_TAG) {
+                        if (argPtr0.getByteArray()[argPtr0.getStartOffset()] == ATypeTag.SERIALIZED_NULL_TYPE_TAG
+                                || argPtr1.getByteArray()[argPtr1
+                                        .getStartOffset()] == ATypeTag.SERIALIZED_NULL_TYPE_TAG) {
                             try {
-                                nullSerDe.serialize(ANull.NULL, output.getDataOutput());
+                                nullSerDe.serialize(ANull.NULL, out);
                             } catch (HyracksDataException e) {
                                 throw new AlgebricksException(e);
                             }
+                            result.set(resultStorage);
                             return;
                         }
 
                         // Make sure we get a valid record
-                        if (abvs0.getByteArray()[0] != ATypeTag.SERIALIZED_RECORD_TYPE_TAG) {
+                        if (argPtr0.getByteArray()[argPtr0.getStartOffset()] != ATypeTag.SERIALIZED_RECORD_TYPE_TAG) {
                             throw new AlgebricksException("Expected an ordederlist of type " + inRecType + " but "
-                                    + "got "
-                                    + EnumDeserializer.ATYPETAGDESERIALIZER.deserialize(abvs0.getByteArray()[0]));
+                                    + "got " + EnumDeserializer.ATYPETAGDESERIALIZER
+                                            .deserialize(argPtr0.getByteArray()[argPtr0.getStartOffset()]));
                         }
 
                         // Make sure we get a valid list
-                        if (abvs1.getByteArray()[0] != ATypeTag.SERIALIZED_ORDEREDLIST_TYPE_TAG) {
+                        if (argPtr1.getByteArray()[argPtr1
+                                .getStartOffset()] != ATypeTag.SERIALIZED_ORDEREDLIST_TYPE_TAG) {
                             throw new AlgebricksException("Expected an ordederlist of type " + inListType + " but "
-                                    + "got "
-                                    + EnumDeserializer.ATYPETAGDESERIALIZER.deserialize(abvs1.getByteArray()[0]));
+                                    + "got " + EnumDeserializer.ATYPETAGDESERIALIZER
+                                            .deserialize(argPtr1.getByteArray()[argPtr1.getStartOffset()]));
                         }
 
-                        vp0.set(abvs0);
-                        vp1.set(abvs1);
+                        vp0.set(argPtr0);
+                        vp1.set(argPtr1);
 
                         try {
                             ARecordVisitablePointable recordPointable = (ARecordVisitablePointable) vp0;
@@ -183,10 +190,11 @@
                                 hashMap.clear();
                             }
                             addFields(recordPointable, listPointable);
-                            recordBuilder.write(output.getDataOutput(), true);
+                            recordBuilder.write(out, true);
                         } catch (HyracksDataException e) {
                             throw new AlgebricksException(e);
                         }
+                        result.set(resultStorage);
                     }
 
                     private void addFields(ARecordVisitablePointable inputRecordPointer,
diff --git a/asterix-runtime/src/main/java/org/apache/asterix/runtime/evaluators/functions/records/RecordFieldsUtil.java b/asterix-runtime/src/main/java/org/apache/asterix/runtime/evaluators/functions/records/RecordFieldsUtil.java
index bbba625..93c1f1b 100644
--- a/asterix-runtime/src/main/java/org/apache/asterix/runtime/evaluators/functions/records/RecordFieldsUtil.java
+++ b/asterix-runtime/src/main/java/org/apache/asterix/runtime/evaluators/functions/records/RecordFieldsUtil.java
@@ -54,10 +54,6 @@
 
 public class RecordFieldsUtil {
 
-    private final static byte SER_RECORD_TYPE_TAG = ATypeTag.RECORD.serialize();
-    private final static byte SER_ORDERED_LIST_TYPE_TAG = ATypeTag.ORDEREDLIST.serialize();
-    private final static byte SER_UNORDERED_LIST_TYPE_TAG = ATypeTag.UNORDEREDLIST.serialize();
-
     private final static AString fieldName = new AString("field-name");
     private final static AString typeName = new AString("field-type");
     private final static AString isOpenName = new AString("is-open");
@@ -118,15 +114,17 @@
             addIsOpenField(false, fieldRecordBuilder);
 
             // write nested or list types
-            if (tag == SER_RECORD_TYPE_TAG || tag == SER_ORDERED_LIST_TYPE_TAG || tag == SER_UNORDERED_LIST_TYPE_TAG) {
+            if (tag == ATypeTag.SERIALIZED_RECORD_TYPE_TAG || tag == ATypeTag.SERIALIZED_ORDEREDLIST_TYPE_TAG
+                    || tag == ATypeTag.SERIALIZED_UNORDEREDLIST_TYPE_TAG) {
                 if (!recordAccessor.isClosedFieldNull(recType, i)) {
                     IAType fieldType = recordAccessor.getClosedFieldType(recType, i);
                     ArrayBackedValueStorage tmpValue = getTempBuffer();
                     tmpValue.reset();
                     recordAccessor.getClosedFieldValue(recType, i, tmpValue.getDataOutput());
-                    if (tag == SER_RECORD_TYPE_TAG) {
+                    if (tag == ATypeTag.SERIALIZED_RECORD_TYPE_TAG) {
                         addNestedField(tmpValue, fieldType, fieldRecordBuilder, level + 1);
-                    } else if (tag == SER_ORDERED_LIST_TYPE_TAG || tag == SER_UNORDERED_LIST_TYPE_TAG) {
+                    } else if (tag == ATypeTag.SERIALIZED_ORDEREDLIST_TYPE_TAG
+                            || tag == ATypeTag.SERIALIZED_UNORDEREDLIST_TYPE_TAG) {
                         addListField(tmpValue, fieldType, fieldRecordBuilder, level + 1);
                     }
                 }
@@ -155,14 +153,16 @@
             addIsOpenField(true, fieldRecordBuilder);
 
             // write nested or list types
-            if (tag == SER_RECORD_TYPE_TAG || tag == SER_ORDERED_LIST_TYPE_TAG || tag == SER_UNORDERED_LIST_TYPE_TAG) {
+            if (tag == ATypeTag.SERIALIZED_RECORD_TYPE_TAG || tag == ATypeTag.SERIALIZED_ORDEREDLIST_TYPE_TAG
+                    || tag == ATypeTag.SERIALIZED_UNORDEREDLIST_TYPE_TAG) {
                 IAType fieldType = null;
                 ArrayBackedValueStorage tmpValue = getTempBuffer();
                 tmpValue.reset();
                 recordAccessor.getOpenFieldValue(recType, i, tmpValue.getDataOutput());
-                if (tag == SER_RECORD_TYPE_TAG) {
+                if (tag == ATypeTag.SERIALIZED_RECORD_TYPE_TAG) {
                     addNestedField(tmpValue, fieldType, fieldRecordBuilder, level + 1);
-                } else if (tag == SER_ORDERED_LIST_TYPE_TAG || tag == SER_UNORDERED_LIST_TYPE_TAG) {
+                } else if (tag == ATypeTag.SERIALIZED_ORDEREDLIST_TYPE_TAG
+                        || tag == ATypeTag.SERIALIZED_UNORDEREDLIST_TYPE_TAG) {
                     addListField(tmpValue, fieldType, fieldRecordBuilder, level + 1);
                 }
             }
@@ -277,7 +277,7 @@
             byte tagId = list.getItemTag(act, l);
             addFieldType(tagId, listRecordBuilder);
 
-            if (tagId == SER_RECORD_TYPE_TAG) {
+            if (tagId == ATypeTag.SERIALIZED_RECORD_TYPE_TAG) {
                 ArrayBackedValueStorage tmpAbvs = getTempBuffer();
                 list.getItemValue(act, l, tmpAbvs.getDataOutput());
                 addNestedField(tmpAbvs, act.getItemType(), listRecordBuilder, level + 1);
diff --git a/asterix-runtime/src/main/java/org/apache/asterix/runtime/evaluators/functions/records/RecordMergeDescriptor.java b/asterix-runtime/src/main/java/org/apache/asterix/runtime/evaluators/functions/records/RecordMergeDescriptor.java
index afd6fc1..0f11a48 100644
--- a/asterix-runtime/src/main/java/org/apache/asterix/runtime/evaluators/functions/records/RecordMergeDescriptor.java
+++ b/asterix-runtime/src/main/java/org/apache/asterix/runtime/evaluators/functions/records/RecordMergeDescriptor.java
@@ -18,6 +18,7 @@
  */
 package org.apache.asterix.runtime.evaluators.functions.records;
 
+import java.io.DataOutput;
 import java.io.IOException;
 import java.util.ArrayList;
 import java.util.List;
@@ -44,11 +45,13 @@
 import org.apache.asterix.runtime.evaluators.functions.PointableHelper;
 import org.apache.hyracks.algebricks.common.exceptions.AlgebricksException;
 import org.apache.hyracks.algebricks.core.algebra.functions.FunctionIdentifier;
-import org.apache.hyracks.algebricks.runtime.base.ICopyEvaluator;
-import org.apache.hyracks.algebricks.runtime.base.ICopyEvaluatorFactory;
+import org.apache.hyracks.algebricks.runtime.base.IScalarEvaluator;
+import org.apache.hyracks.algebricks.runtime.base.IScalarEvaluatorFactory;
+import org.apache.hyracks.api.context.IHyracksTaskContext;
 import org.apache.hyracks.api.dataflow.value.ISerializerDeserializer;
 import org.apache.hyracks.api.exceptions.HyracksDataException;
-import org.apache.hyracks.data.std.api.IDataOutputProvider;
+import org.apache.hyracks.data.std.api.IPointable;
+import org.apache.hyracks.data.std.primitive.VoidPointable;
 import org.apache.hyracks.data.std.util.ArrayBackedValueStorage;
 import org.apache.hyracks.dataflow.common.data.accessors.IFrameTupleReference;
 
@@ -81,8 +84,9 @@
     }
 
     @Override
-    public ICopyEvaluatorFactory createEvaluatorFactory(final ICopyEvaluatorFactory[] args) throws AlgebricksException {
-        return new ICopyEvaluatorFactory() {
+    public IScalarEvaluatorFactory createEvaluatorFactory(final IScalarEvaluatorFactory[] args)
+            throws AlgebricksException {
+        return new IScalarEvaluatorFactory() {
 
             private static final long serialVersionUID = 1L;
 
@@ -91,57 +95,58 @@
                     .getSerializerDeserializer(BuiltinType.ANULL);
 
             @Override
-            public ICopyEvaluator createEvaluator(final IDataOutputProvider output) throws AlgebricksException {
+            public IScalarEvaluator createScalarEvaluator(final IHyracksTaskContext ctx) throws AlgebricksException {
                 final PointableAllocator pa = new PointableAllocator();
                 final IVisitablePointable vp0 = pa.allocateRecordValue(inRecType0);
                 final IVisitablePointable vp1 = pa.allocateRecordValue(inRecType1);
 
-                final ArrayBackedValueStorage abvs0 = new ArrayBackedValueStorage();
-                final ArrayBackedValueStorage abvs1 = new ArrayBackedValueStorage();
+                final IPointable argPtr0 = new VoidPointable();
+                final IPointable argPtr1 = new VoidPointable();
 
-                final ICopyEvaluator eval0 = args[0].createEvaluator(abvs0);
-                final ICopyEvaluator eval1 = args[1].createEvaluator(abvs1);
+                final IScalarEvaluator eval0 = args[0].createScalarEvaluator(ctx);
+                final IScalarEvaluator eval1 = args[1].createScalarEvaluator(ctx);
 
                 final List<RecordBuilder> rbStack = new ArrayList<>();
 
                 final ArrayBackedValueStorage tabvs = new ArrayBackedValueStorage();
 
-                return new ICopyEvaluator() {
+                return new IScalarEvaluator() {
 
                     private final RuntimeRecordTypeInfo runtimeRecordTypeInfo = new RuntimeRecordTypeInfo();
                     private final DeepEqualAssessor deepEqualAssesor = new DeepEqualAssessor();
+                    private ArrayBackedValueStorage resultStorage = new ArrayBackedValueStorage();
+                    private DataOutput out = resultStorage.getDataOutput();
 
                     @Override
-                    public void evaluate(IFrameTupleReference tuple) throws AlgebricksException {
-                        abvs0.reset();
-                        abvs1.reset();
+                    public void evaluate(IFrameTupleReference tuple, IPointable result) throws AlgebricksException {
+                        resultStorage.reset();
+                        eval0.evaluate(tuple, argPtr0);
+                        eval1.evaluate(tuple, argPtr1);
 
-                        eval0.evaluate(tuple);
-                        eval1.evaluate(tuple);
-
-                        if (abvs0.getByteArray()[0] == ATypeTag.SERIALIZED_NULL_TYPE_TAG
-                                || abvs1.getByteArray()[0] == ATypeTag.SERIALIZED_NULL_TYPE_TAG) {
+                        if (argPtr0.getByteArray()[argPtr0.getStartOffset()] == ATypeTag.SERIALIZED_NULL_TYPE_TAG
+                                || argPtr1.getByteArray()[argPtr1.getStartOffset()] == ATypeTag.SERIALIZED_NULL_TYPE_TAG) {
                             try {
-                                nullSerDe.serialize(ANull.NULL, output.getDataOutput());
+                                nullSerDe.serialize(ANull.NULL, out);
                             } catch (HyracksDataException e) {
                                 throw new AlgebricksException(e);
                             }
+                            result.set(resultStorage);
                             return;
                         }
 
-                        vp0.set(abvs0);
-                        vp1.set(abvs1);
+                        vp0.set(argPtr0);
+                        vp1.set(argPtr1);
 
                         ARecordVisitablePointable rp0 = (ARecordVisitablePointable) vp0;
                         ARecordVisitablePointable rp1 = (ARecordVisitablePointable) vp1;
 
                         try {
                             mergeFields(outRecType, rp0, rp1, true, 0);
-
-                            rbStack.get(0).write(output.getDataOutput(), true);
+                            rbStack.get(0).write(out, true);
                         } catch (IOException | AsterixException e) {
                             throw new AlgebricksException(e);
                         }
+                        result.set(resultStorage);
                     }
 
                     private void mergeFields(ARecordType combinedType, ARecordVisitablePointable leftRecord,
diff --git a/asterix-runtime/src/main/java/org/apache/asterix/runtime/evaluators/functions/records/RecordRemoveFieldsDescriptor.java b/asterix-runtime/src/main/java/org/apache/asterix/runtime/evaluators/functions/records/RecordRemoveFieldsDescriptor.java
index ae752f9..09639d7 100644
--- a/asterix-runtime/src/main/java/org/apache/asterix/runtime/evaluators/functions/records/RecordRemoveFieldsDescriptor.java
+++ b/asterix-runtime/src/main/java/org/apache/asterix/runtime/evaluators/functions/records/RecordRemoveFieldsDescriptor.java
@@ -27,7 +27,7 @@
 import org.apache.asterix.runtime.evaluators.base.AbstractScalarFunctionDynamicDescriptor;
 import org.apache.hyracks.algebricks.common.exceptions.AlgebricksException;
 import org.apache.hyracks.algebricks.core.algebra.functions.FunctionIdentifier;
-import org.apache.hyracks.algebricks.runtime.base.ICopyEvaluatorFactory;
+import org.apache.hyracks.algebricks.runtime.base.IScalarEvaluatorFactory;
 
 public class RecordRemoveFieldsDescriptor extends AbstractScalarFunctionDynamicDescriptor {
     private static final long serialVersionUID = 1L;
@@ -52,7 +52,8 @@
     }
 
     @Override
-    public ICopyEvaluatorFactory createEvaluatorFactory(final ICopyEvaluatorFactory[] args) throws AlgebricksException {
+    public IScalarEvaluatorFactory createEvaluatorFactory(final IScalarEvaluatorFactory[] args)
+            throws AlgebricksException {
         return new RecordRemoveFieldsEvalFactory(args[0], args[1], outputRecordType, inputRecType, inputListType);
     }
 
diff --git a/asterix-runtime/src/main/java/org/apache/asterix/runtime/evaluators/functions/records/RecordRemoveFieldsEvalFactory.java b/asterix-runtime/src/main/java/org/apache/asterix/runtime/evaluators/functions/records/RecordRemoveFieldsEvalFactory.java
index 441f91f..57c6d01 100644
--- a/asterix-runtime/src/main/java/org/apache/asterix/runtime/evaluators/functions/records/RecordRemoveFieldsEvalFactory.java
+++ b/asterix-runtime/src/main/java/org/apache/asterix/runtime/evaluators/functions/records/RecordRemoveFieldsEvalFactory.java
@@ -18,6 +18,7 @@
  */
 package org.apache.asterix.runtime.evaluators.functions.records;
 
+import java.io.DataOutput;
 import java.io.IOException;
 import java.util.ArrayDeque;
 import java.util.ArrayList;
@@ -43,27 +44,29 @@
 import org.apache.asterix.om.types.runtime.RuntimeRecordTypeInfo;
 import org.apache.asterix.runtime.evaluators.functions.PointableHelper;
 import org.apache.hyracks.algebricks.common.exceptions.AlgebricksException;
-import org.apache.hyracks.algebricks.runtime.base.ICopyEvaluator;
-import org.apache.hyracks.algebricks.runtime.base.ICopyEvaluatorFactory;
+import org.apache.hyracks.algebricks.runtime.base.IScalarEvaluator;
+import org.apache.hyracks.algebricks.runtime.base.IScalarEvaluatorFactory;
+import org.apache.hyracks.api.context.IHyracksTaskContext;
 import org.apache.hyracks.api.dataflow.value.ISerializerDeserializer;
 import org.apache.hyracks.api.exceptions.HyracksDataException;
-import org.apache.hyracks.data.std.api.IDataOutputProvider;
+import org.apache.hyracks.data.std.api.IPointable;
+import org.apache.hyracks.data.std.primitive.VoidPointable;
 import org.apache.hyracks.data.std.util.ArrayBackedValueStorage;
 import org.apache.hyracks.dataflow.common.data.accessors.IFrameTupleReference;
 
-class RecordRemoveFieldsEvalFactory implements ICopyEvaluatorFactory {
+class RecordRemoveFieldsEvalFactory implements IScalarEvaluatorFactory {
     private static final long serialVersionUID = 1L;
     @SuppressWarnings("unchecked")
     private final ISerializerDeserializer<ANull> nullSerDe = AqlSerializerDeserializerProvider.INSTANCE
             .getSerializerDeserializer(BuiltinType.ANULL);
-    private ICopyEvaluatorFactory inputRecordEvalFactory;
-    private ICopyEvaluatorFactory removeFieldPathsFactory;
+    private IScalarEvaluatorFactory inputRecordEvalFactory;
+    private IScalarEvaluatorFactory removeFieldPathsFactory;
     private ARecordType requiredRecType;
     private ARecordType inputRecType;
     private AOrderedListType inputListType;
 
-    public RecordRemoveFieldsEvalFactory(ICopyEvaluatorFactory inputRecordEvalFactory,
-            ICopyEvaluatorFactory removeFieldPathsFactory, ARecordType requiredRecType, ARecordType inputRecType,
+    public RecordRemoveFieldsEvalFactory(IScalarEvaluatorFactory inputRecordEvalFactory,
+            IScalarEvaluatorFactory removeFieldPathsFactory, ARecordType requiredRecType, ARecordType inputRecType,
             AOrderedListType inputListType) {
         this.inputRecordEvalFactory = inputRecordEvalFactory;
         this.removeFieldPathsFactory = removeFieldPathsFactory;
@@ -74,54 +77,58 @@
     }
 
     @Override
-    public ICopyEvaluator createEvaluator(final IDataOutputProvider output) throws AlgebricksException {
+    public IScalarEvaluator createScalarEvaluator(final IHyracksTaskContext ctx) throws AlgebricksException {
 
         final PointableAllocator pa = new PointableAllocator();
         final IVisitablePointable vp0 = pa.allocateRecordValue(inputRecType);
         final IVisitablePointable vp1 = pa.allocateListValue(inputListType);
-        final ArrayBackedValueStorage outInput0 = new ArrayBackedValueStorage();
-        final ArrayBackedValueStorage outInput1 = new ArrayBackedValueStorage();
-        final ICopyEvaluator eval0 = inputRecordEvalFactory.createEvaluator(outInput0);
-        final ICopyEvaluator eval1 = removeFieldPathsFactory.createEvaluator(outInput1);
+        final IPointable inputArg0 = new VoidPointable();
+        final IPointable inputArg1 = new VoidPointable();
+        final IScalarEvaluator eval0 = inputRecordEvalFactory.createScalarEvaluator(ctx);
+        final IScalarEvaluator eval1 = removeFieldPathsFactory.createScalarEvaluator(ctx);
 
-        return new ICopyEvaluator() {
+        return new IScalarEvaluator() {
             private final RuntimeRecordTypeInfo runtimeRecordTypeInfo = new RuntimeRecordTypeInfo();
 
             private final List<RecordBuilder> rbStack = new ArrayList<>();
             private final ArrayBackedValueStorage tabvs = new ArrayBackedValueStorage();
             private final Deque<IVisitablePointable> recordPath = new ArrayDeque<>();
 
+            private ArrayBackedValueStorage resultStorage = new ArrayBackedValueStorage();
+            private DataOutput out = resultStorage.getDataOutput();
+
             @Override
-            public void evaluate(IFrameTupleReference tuple) throws AlgebricksException {
-                outInput0.reset();
-                outInput1.reset();
+            public void evaluate(IFrameTupleReference tuple, IPointable result) throws AlgebricksException {
+                resultStorage.reset();
+                eval0.evaluate(tuple, inputArg0);
+                eval1.evaluate(tuple, inputArg1);
 
-                eval0.evaluate(tuple);
-                eval1.evaluate(tuple);
-
-                if (outInput0.getByteArray()[0] == ATypeTag.SERIALIZED_NULL_TYPE_TAG) {
+                if (inputArg0.getByteArray()[inputArg0.getStartOffset()] == ATypeTag.SERIALIZED_NULL_TYPE_TAG) {
                     try {
-                        nullSerDe.serialize(ANull.NULL, output.getDataOutput());
+                        nullSerDe.serialize(ANull.NULL, out);
                     } catch (HyracksDataException e) {
                         throw new AlgebricksException(e);
                     }
+                    result.set(resultStorage);
                     return;
                 }
 
-                if (outInput0.getByteArray()[0] != ATypeTag.SERIALIZED_RECORD_TYPE_TAG) {
-                    throw new AlgebricksException(AsterixBuiltinFunctions.REMOVE_FIELDS.getName()
-                            + ": expects input type " + inputRecType + ", but got "
-                            + EnumDeserializer.ATYPETAGDESERIALIZER.deserialize(outInput0.getByteArray()[0]));
+                if (inputArg0.getByteArray()[inputArg0.getStartOffset()] != ATypeTag.SERIALIZED_RECORD_TYPE_TAG) {
+                    throw new AlgebricksException(
+                            AsterixBuiltinFunctions.REMOVE_FIELDS.getName() + ": expects input type " + inputRecType
+                                    + ", but got " + EnumDeserializer.ATYPETAGDESERIALIZER
+                                            .deserialize(inputArg0.getByteArray()[inputArg0.getStartOffset()]));
                 }
 
-                if (outInput1.getByteArray()[0] != ATypeTag.SERIALIZED_ORDEREDLIST_TYPE_TAG) {
-                    throw new AlgebricksException(AsterixBuiltinFunctions.REMOVE_FIELDS.getName()
-                            + ": expects input type " + inputListType + ", but got "
-                            + EnumDeserializer.ATYPETAGDESERIALIZER.deserialize(outInput1.getByteArray()[0]));
+                if (inputArg1.getByteArray()[inputArg1.getStartOffset()] != ATypeTag.SERIALIZED_ORDEREDLIST_TYPE_TAG) {
+                    throw new AlgebricksException(
+                            AsterixBuiltinFunctions.REMOVE_FIELDS.getName() + ": expects input type " + inputListType
+                                    + ", but got " + EnumDeserializer.ATYPETAGDESERIALIZER
+                                            .deserialize(inputArg1.getByteArray()[inputArg1.getStartOffset()]));
                 }
 
-                vp0.set(outInput0);
-                vp1.set(outInput1);
+                vp0.set(inputArg0);
+                vp1.set(inputArg1);
 
                 ARecordVisitablePointable recordPointable = (ARecordVisitablePointable) vp0;
                 AListVisitablePointable listPointable = (AListVisitablePointable) vp1;
@@ -130,10 +137,11 @@
                     recordPath.clear();
                     rbStack.clear();
                     processRecord(requiredRecType, recordPointable, listPointable, 0);
-                    rbStack.get(0).write(output.getDataOutput(), true);
+                    rbStack.get(0).write(out, true);
                 } catch (IOException | AsterixException e) {
                     throw new AlgebricksException(e);
                 }
+                result.set(resultStorage);
             }
 
             private void processRecord(ARecordType requiredType, ARecordVisitablePointable srp,
@@ -212,11 +220,13 @@
                             Iterator<IVisitablePointable> fpi = recordPath.iterator();
                             for (int j = inputPathItems.size() - 1; j >= 0; j--) {
                                 match &= PointableHelper.isEqual(inputPathItems.get(j), fpi.next());
-                                if (!match)
+                                if (!match) {
                                     break;
+                                }
                             }
-                            if (match)
+                            if (match) {
                                 return false; // Not a valid path for the output record
+                            }
                         }
                     } else {
                         if (PointableHelper.isEqual(recordPath.getFirst(), item)) {
diff --git a/asterix-runtime/src/main/java/org/apache/asterix/runtime/evaluators/functions/temporal/AbstractIntervalLogicFuncDescriptor.java b/asterix-runtime/src/main/java/org/apache/asterix/runtime/evaluators/functions/temporal/AbstractIntervalLogicFuncDescriptor.java
index da00cd2..e48e5b6 100644
--- a/asterix-runtime/src/main/java/org/apache/asterix/runtime/evaluators/functions/temporal/AbstractIntervalLogicFuncDescriptor.java
+++ b/asterix-runtime/src/main/java/org/apache/asterix/runtime/evaluators/functions/temporal/AbstractIntervalLogicFuncDescriptor.java
@@ -29,11 +29,13 @@
 import org.apache.asterix.om.types.EnumDeserializer;
 import org.apache.asterix.runtime.evaluators.base.AbstractScalarFunctionDynamicDescriptor;
 import org.apache.hyracks.algebricks.common.exceptions.AlgebricksException;
-import org.apache.hyracks.algebricks.runtime.base.ICopyEvaluator;
-import org.apache.hyracks.algebricks.runtime.base.ICopyEvaluatorFactory;
+import org.apache.hyracks.algebricks.runtime.base.IScalarEvaluator;
+import org.apache.hyracks.algebricks.runtime.base.IScalarEvaluatorFactory;
+import org.apache.hyracks.api.context.IHyracksTaskContext;
 import org.apache.hyracks.api.dataflow.value.ISerializerDeserializer;
 import org.apache.hyracks.api.exceptions.HyracksDataException;
-import org.apache.hyracks.data.std.api.IDataOutputProvider;
+import org.apache.hyracks.data.std.api.IPointable;
+import org.apache.hyracks.data.std.primitive.VoidPointable;
 import org.apache.hyracks.data.std.util.ArrayBackedValueStorage;
 import org.apache.hyracks.dataflow.common.data.accessors.IFrameTupleReference;
 
@@ -44,21 +46,23 @@
      * @see org.apache.asterix.runtime.base.IScalarFunctionDynamicDescriptor#createEvaluatorFactory(org.apache.hyracks.algebricks.runtime.base.ICopyEvaluatorFactory[])
      */
     @Override
-    public ICopyEvaluatorFactory createEvaluatorFactory(final ICopyEvaluatorFactory[] args) throws AlgebricksException {
-        return new ICopyEvaluatorFactory() {
+    public IScalarEvaluatorFactory createEvaluatorFactory(final IScalarEvaluatorFactory[] args)
+            throws AlgebricksException {
+        return new IScalarEvaluatorFactory() {
 
             private static final long serialVersionUID = 1L;
 
             @Override
-            public ICopyEvaluator createEvaluator(final IDataOutputProvider output) throws AlgebricksException {
+            public IScalarEvaluator createScalarEvaluator(final IHyracksTaskContext ctx) throws AlgebricksException {
 
-                return new ICopyEvaluator() {
+                return new IScalarEvaluator() {
 
-                    private DataOutput out = output.getDataOutput();
-                    private ArrayBackedValueStorage argOut0 = new ArrayBackedValueStorage();
-                    private ArrayBackedValueStorage argOut1 = new ArrayBackedValueStorage();
-                    private ICopyEvaluator eval0 = args[0].createEvaluator(argOut0);
-                    private ICopyEvaluator eval1 = args[1].createEvaluator(argOut1);
+                    private ArrayBackedValueStorage resultStorage = new ArrayBackedValueStorage();
+                    private DataOutput out = resultStorage.getDataOutput();
+                    private IPointable argPtr0 = new VoidPointable();
+                    private IPointable argPtr1 = new VoidPointable();
+                    private IScalarEvaluator eval0 = args[0].createScalarEvaluator(ctx);
+                    private IScalarEvaluator eval1 = args[1].createScalarEvaluator(ctx);
 
                     // possible output types
                     @SuppressWarnings("unchecked")
@@ -69,50 +73,51 @@
                             .getSerializerDeserializer(BuiltinType.ABOOLEAN);
 
                     @Override
-                    public void evaluate(IFrameTupleReference tuple) throws AlgebricksException {
-                        argOut0.reset();
-                        eval0.evaluate(tuple);
-                        argOut1.reset();
-                        eval1.evaluate(tuple);
+                    public void evaluate(IFrameTupleReference tuple, IPointable result) throws AlgebricksException {
+                        resultStorage.reset();
+                        eval0.evaluate(tuple, argPtr0);
+                        eval1.evaluate(tuple, argPtr1);
+
+                        byte[] bytes0 = argPtr0.getByteArray();
+                        int offset0 = argPtr0.getStartOffset();
+                        byte[] bytes1 = argPtr1.getByteArray();
+                        int offset1 = argPtr1.getStartOffset();
 
                         try {
-                            if (argOut0.getByteArray()[0] == ATypeTag.SERIALIZED_NULL_TYPE_TAG
-                                    || argOut1.getByteArray()[0] == ATypeTag.SERIALIZED_NULL_TYPE_TAG) {
+                            if (bytes0[offset0] == ATypeTag.SERIALIZED_NULL_TYPE_TAG
+                                    || bytes1[offset1] == ATypeTag.SERIALIZED_NULL_TYPE_TAG) {
                                 nullSerde.serialize(ANull.NULL, out);
+                                result.set(resultStorage);
                                 return;
                             }
 
-                            if (argOut0.getByteArray()[0] != ATypeTag.SERIALIZED_INTERVAL_TYPE_TAG
-                                    || argOut1.getByteArray()[0] != ATypeTag.SERIALIZED_INTERVAL_TYPE_TAG) {
-                                throw new AlgebricksException(
-                                        getIdentifier().getName()
-                                                + ": expects input type (INTERVAL, INTERVAL) but got ("
-                                                + EnumDeserializer.ATYPETAGDESERIALIZER.deserialize(
-                                                        argOut0.getByteArray()[0])
-                                                + ", " + EnumDeserializer.ATYPETAGDESERIALIZER
-                                                        .deserialize(argOut1.getByteArray()[0])
-                                                + ")");
+                            if (bytes0[offset0] != ATypeTag.SERIALIZED_INTERVAL_TYPE_TAG
+                                    || bytes1[offset1] != ATypeTag.SERIALIZED_INTERVAL_TYPE_TAG) {
+                                throw new AlgebricksException(getIdentifier().getName()
+                                        + ": expects input type (INTERVAL, INTERVAL) but got ("
+                                        + EnumDeserializer.ATYPETAGDESERIALIZER.deserialize(bytes0[offset0]) + ", "
+                                        + EnumDeserializer.ATYPETAGDESERIALIZER.deserialize(bytes1[offset1]) + ")");
                             }
 
-                            if (AIntervalSerializerDeserializer.getIntervalTimeType(argOut0.getByteArray(),
-                                    1) != AIntervalSerializerDeserializer.getIntervalTimeType(argOut1.getByteArray(),
-                                            1)) {
+                            if (AIntervalSerializerDeserializer.getIntervalTimeType(bytes0,
+                                    offset0 + 1) != AIntervalSerializerDeserializer.getIntervalTimeType(bytes1,
+                                            offset1 + 1)) {
                                 throw new AlgebricksException(getIdentifier().getName()
                                         + ": failed to compare intervals with different internal time type.");
                             }
 
                             ABoolean res = (compareIntervals(
-                                    AIntervalSerializerDeserializer.getIntervalStart(argOut0.getByteArray(), 1),
-                                    AIntervalSerializerDeserializer.getIntervalEnd(argOut0.getByteArray(), 1),
-                                    AIntervalSerializerDeserializer.getIntervalStart(argOut1.getByteArray(), 1),
-                                    AIntervalSerializerDeserializer.getIntervalEnd(argOut1.getByteArray(), 1)))
+                                    AIntervalSerializerDeserializer.getIntervalStart(bytes0, offset0 + 1),
+                                    AIntervalSerializerDeserializer.getIntervalEnd(bytes0, offset0 + 1),
+                                    AIntervalSerializerDeserializer.getIntervalStart(bytes1, offset1 + 1),
+                                    AIntervalSerializerDeserializer.getIntervalEnd(bytes1, offset1 + 1)))
                                             ? ABoolean.TRUE : ABoolean.FALSE;
 
                             booleanSerde.serialize(res, out);
-
                         } catch (HyracksDataException hex) {
                             throw new AlgebricksException(hex);
                         }
+                        result.set(resultStorage);
                     }
                 };
             }
diff --git a/asterix-runtime/src/main/java/org/apache/asterix/runtime/evaluators/functions/temporal/AdjustDateTimeForTimeZoneDescriptor.java b/asterix-runtime/src/main/java/org/apache/asterix/runtime/evaluators/functions/temporal/AdjustDateTimeForTimeZoneDescriptor.java
index d8d76b6..6c445e2 100644
--- a/asterix-runtime/src/main/java/org/apache/asterix/runtime/evaluators/functions/temporal/AdjustDateTimeForTimeZoneDescriptor.java
+++ b/asterix-runtime/src/main/java/org/apache/asterix/runtime/evaluators/functions/temporal/AdjustDateTimeForTimeZoneDescriptor.java
@@ -35,11 +35,13 @@
 import org.apache.asterix.runtime.evaluators.base.AbstractScalarFunctionDynamicDescriptor;
 import org.apache.hyracks.algebricks.common.exceptions.AlgebricksException;
 import org.apache.hyracks.algebricks.core.algebra.functions.FunctionIdentifier;
-import org.apache.hyracks.algebricks.runtime.base.ICopyEvaluator;
-import org.apache.hyracks.algebricks.runtime.base.ICopyEvaluatorFactory;
+import org.apache.hyracks.algebricks.runtime.base.IScalarEvaluator;
+import org.apache.hyracks.algebricks.runtime.base.IScalarEvaluatorFactory;
+import org.apache.hyracks.api.context.IHyracksTaskContext;
 import org.apache.hyracks.api.dataflow.value.ISerializerDeserializer;
-import org.apache.hyracks.data.std.api.IDataOutputProvider;
+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.data.std.util.ArrayBackedValueStorage;
 import org.apache.hyracks.dataflow.common.data.accessors.IFrameTupleReference;
 import org.apache.hyracks.util.string.UTF8StringWriter;
@@ -60,20 +62,22 @@
      * @see org.apache.asterix.runtime.base.IScalarFunctionDynamicDescriptor#createEvaluatorFactory(org.apache.hyracks.algebricks.runtime.base.ICopyEvaluatorFactory[])
      */
     @Override
-    public ICopyEvaluatorFactory createEvaluatorFactory(final ICopyEvaluatorFactory[] args) throws AlgebricksException {
-        return new ICopyEvaluatorFactory() {
+    public IScalarEvaluatorFactory createEvaluatorFactory(final IScalarEvaluatorFactory[] args)
+            throws AlgebricksException {
+        return new IScalarEvaluatorFactory() {
 
             private static final long serialVersionUID = 1L;
 
             @Override
-            public ICopyEvaluator createEvaluator(final IDataOutputProvider output) throws AlgebricksException {
-                return new ICopyEvaluator() {
+            public IScalarEvaluator createScalarEvaluator(final IHyracksTaskContext ctx) throws AlgebricksException {
+                return new IScalarEvaluator() {
 
-                    private DataOutput out = output.getDataOutput();
-                    private ArrayBackedValueStorage argOut0 = new ArrayBackedValueStorage();
-                    private ArrayBackedValueStorage argOut1 = new ArrayBackedValueStorage();
-                    private ICopyEvaluator eval0 = args[0].createEvaluator(argOut0);
-                    private ICopyEvaluator eval1 = args[1].createEvaluator(argOut1);
+                    private ArrayBackedValueStorage resultStorage = new ArrayBackedValueStorage();
+                    private DataOutput out = resultStorage.getDataOutput();
+                    private IPointable argPtr0 = new VoidPointable();
+                    private IPointable argPtr1 = new VoidPointable();
+                    private IScalarEvaluator eval0 = args[0].createScalarEvaluator(ctx);
+                    private IScalarEvaluator eval1 = args[1].createScalarEvaluator(ctx);
 
                     // possible output types
                     @SuppressWarnings("unchecked")
@@ -86,32 +90,38 @@
                     private final UTF8StringWriter utf8Writer = new UTF8StringWriter();
 
                     @Override
-                    public void evaluate(IFrameTupleReference tuple) throws AlgebricksException {
-                        argOut0.reset();
-                        eval0.evaluate(tuple);
-                        argOut1.reset();
-                        eval1.evaluate(tuple);
+                    public void evaluate(IFrameTupleReference tuple, IPointable result) throws AlgebricksException {
+                        resultStorage.reset();
+                        eval0.evaluate(tuple, argPtr0);
+                        eval1.evaluate(tuple, argPtr1);
+
+                        byte[] bytes0 = argPtr0.getByteArray();
+                        int offset0 = argPtr0.getStartOffset();
+                        byte[] bytes1 = argPtr1.getByteArray();
+                        int offset1 = argPtr1.getStartOffset();
+                        int len1 = argPtr1.getLength();
 
                         try {
-                            if (argOut0.getByteArray()[0] == ATypeTag.SERIALIZED_NULL_TYPE_TAG
-                                    || argOut1.getByteArray()[0] == ATypeTag.SERIALIZED_NULL_TYPE_TAG) {
+                            if (bytes0[offset0] == ATypeTag.SERIALIZED_NULL_TYPE_TAG
+                                    || bytes1[offset1] == ATypeTag.SERIALIZED_NULL_TYPE_TAG) {
                                 nullSerde.serialize(ANull.NULL, out);
+                                result.set(resultStorage);
                                 return;
                             }
 
-                            if (argOut0.getByteArray()[0] != ATypeTag.SERIALIZED_DATETIME_TYPE_TAG) {
-                                throw new AlgebricksException(FID.getName()
-                                        + ": expects type DATETIME/NULL for parameter 0 but got "
-                                        + EnumDeserializer.ATYPETAGDESERIALIZER.deserialize(argOut0.getByteArray()[0]));
+                            if (bytes0[offset0] != ATypeTag.SERIALIZED_DATETIME_TYPE_TAG) {
+                                throw new AlgebricksException(
+                                        FID.getName() + ": expects type DATETIME/NULL for parameter 0 but got "
+                                                + EnumDeserializer.ATYPETAGDESERIALIZER.deserialize(bytes0[offset0]));
                             }
 
-                            if (argOut1.getByteArray()[0] != ATypeTag.SERIALIZED_STRING_TYPE_TAG) {
-                                throw new AlgebricksException(FID.getName()
-                                        + ": expects type STRING/NULL for parameter 1 but got "
-                                        + EnumDeserializer.ATYPETAGDESERIALIZER.deserialize(argOut1.getByteArray()[0]));
+                            if (bytes1[offset1] != ATypeTag.SERIALIZED_STRING_TYPE_TAG) {
+                                throw new AlgebricksException(
+                                        FID.getName() + ": expects type STRING/NULL for parameter 1 but got "
+                                                + EnumDeserializer.ATYPETAGDESERIALIZER.deserialize(bytes1[offset1]));
                             }
 
-                            utf8Ptr.set(argOut1.getByteArray(), 1, argOut1.getLength() - 1);
+                            utf8Ptr.set(bytes1, offset1 + 1, len1 - 1);
                             int timezone = ATimeParserFactory.parseTimezonePart(utf8Ptr.getByteArray(),
                                     utf8Ptr.getCharStartOffset());
 
@@ -119,12 +129,11 @@
                                 throw new AlgebricksException(FID.getName() + ": wrong format for a time zone string!");
                             }
 
-                            long chronon = ADateTimeSerializerDeserializer.getChronon(argOut0.getByteArray(), 1);
+                            long chronon = ADateTimeSerializerDeserializer.getChronon(bytes0, offset0 + 1);
 
                             chronon = calInstance.adjustChrononByTimezone(chronon, timezone);
 
                             StringBuilder sbder = new StringBuilder();
-
                             calInstance.getExtendStringRepUntilField(chronon, timezone, sbder, Fields.YEAR,
                                     Fields.MILLISECOND, true);
 
@@ -133,6 +142,7 @@
                         } catch (Exception e1) {
                             throw new AlgebricksException(e1);
                         }
+                        result.set(resultStorage);
                     }
                 };
             }
diff --git a/asterix-runtime/src/main/java/org/apache/asterix/runtime/evaluators/functions/temporal/AdjustTimeForTimeZoneDescriptor.java b/asterix-runtime/src/main/java/org/apache/asterix/runtime/evaluators/functions/temporal/AdjustTimeForTimeZoneDescriptor.java
index 527607e..72e4200 100644
--- a/asterix-runtime/src/main/java/org/apache/asterix/runtime/evaluators/functions/temporal/AdjustTimeForTimeZoneDescriptor.java
+++ b/asterix-runtime/src/main/java/org/apache/asterix/runtime/evaluators/functions/temporal/AdjustTimeForTimeZoneDescriptor.java
@@ -35,11 +35,13 @@
 import org.apache.asterix.runtime.evaluators.base.AbstractScalarFunctionDynamicDescriptor;
 import org.apache.hyracks.algebricks.common.exceptions.AlgebricksException;
 import org.apache.hyracks.algebricks.core.algebra.functions.FunctionIdentifier;
-import org.apache.hyracks.algebricks.runtime.base.ICopyEvaluator;
-import org.apache.hyracks.algebricks.runtime.base.ICopyEvaluatorFactory;
+import org.apache.hyracks.algebricks.runtime.base.IScalarEvaluator;
+import org.apache.hyracks.algebricks.runtime.base.IScalarEvaluatorFactory;
+import org.apache.hyracks.api.context.IHyracksTaskContext;
 import org.apache.hyracks.api.dataflow.value.ISerializerDeserializer;
-import org.apache.hyracks.data.std.api.IDataOutputProvider;
+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.data.std.util.ArrayBackedValueStorage;
 import org.apache.hyracks.dataflow.common.data.accessors.IFrameTupleReference;
 import org.apache.hyracks.util.string.UTF8StringWriter;
@@ -59,20 +61,22 @@
      * @see org.apache.asterix.runtime.base.IScalarFunctionDynamicDescriptor#createEvaluatorFactory(org.apache.hyracks.algebricks.runtime.base.ICopyEvaluatorFactory[])
      */
     @Override
-    public ICopyEvaluatorFactory createEvaluatorFactory(final ICopyEvaluatorFactory[] args) throws AlgebricksException {
-        return new ICopyEvaluatorFactory() {
+    public IScalarEvaluatorFactory createEvaluatorFactory(final IScalarEvaluatorFactory[] args)
+            throws AlgebricksException {
+        return new IScalarEvaluatorFactory() {
 
             private static final long serialVersionUID = 1L;
 
             @Override
-            public ICopyEvaluator createEvaluator(final IDataOutputProvider output) throws AlgebricksException {
-                return new ICopyEvaluator() {
+            public IScalarEvaluator createScalarEvaluator(final IHyracksTaskContext ctx) throws AlgebricksException {
+                return new IScalarEvaluator() {
 
-                    private DataOutput out = output.getDataOutput();
-                    private ArrayBackedValueStorage argOut0 = new ArrayBackedValueStorage();
-                    private ArrayBackedValueStorage argOut1 = new ArrayBackedValueStorage();
-                    private ICopyEvaluator eval0 = args[0].createEvaluator(argOut0);
-                    private ICopyEvaluator eval1 = args[1].createEvaluator(argOut1);
+                    private ArrayBackedValueStorage resultStorage = new ArrayBackedValueStorage();
+                    private DataOutput out = resultStorage.getDataOutput();
+                    private IPointable argPtr0 = new VoidPointable();
+                    private IPointable argPtr1 = new VoidPointable();
+                    private IScalarEvaluator eval0 = args[0].createScalarEvaluator(ctx);
+                    private IScalarEvaluator eval1 = args[1].createScalarEvaluator(ctx);
 
                     // possible output types
                     @SuppressWarnings("unchecked")
@@ -84,40 +88,45 @@
                     private final UTF8StringPointable utf8Ptr = new UTF8StringPointable();
 
                     @Override
-                    public void evaluate(IFrameTupleReference tuple) throws AlgebricksException {
-                        argOut0.reset();
-                        eval0.evaluate(tuple);
-                        argOut1.reset();
-                        eval1.evaluate(tuple);
+                    public void evaluate(IFrameTupleReference tuple, IPointable result) throws AlgebricksException {
+                        resultStorage.reset();
+                        eval0.evaluate(tuple, argPtr0);
+                        eval1.evaluate(tuple, argPtr1);
+
+                        byte[] bytes0 = argPtr0.getByteArray();
+                        int offset0 = argPtr0.getStartOffset();
+                        byte[] bytes1 = argPtr1.getByteArray();
+                        int offset1 = argPtr1.getStartOffset();
+                        int len1 = argPtr1.getLength();
 
                         try {
-                            if (argOut0.getByteArray()[0] == ATypeTag.SERIALIZED_NULL_TYPE_TAG
-                                    || argOut1.getByteArray()[0] == ATypeTag.SERIALIZED_NULL_TYPE_TAG) {
+                            if (bytes0[offset0] == ATypeTag.SERIALIZED_NULL_TYPE_TAG
+                                    || bytes1[offset1] == ATypeTag.SERIALIZED_NULL_TYPE_TAG) {
                                 nullSerde.serialize(ANull.NULL, out);
+                                result.set(resultStorage);
                                 return;
                             }
 
-                            if (argOut0.getByteArray()[0] != ATypeTag.SERIALIZED_TIME_TYPE_TAG) {
-                                throw new AlgebricksException(FID.getName()
-                                        + ": expects type TIME/NULL for parameter 0 but got "
-                                        + EnumDeserializer.ATYPETAGDESERIALIZER.deserialize(argOut0.getByteArray()[0]));
+                            if (bytes0[offset0] != ATypeTag.SERIALIZED_TIME_TYPE_TAG) {
+                                throw new AlgebricksException(
+                                        FID.getName() + ": expects type TIME/NULL for parameter 0 but got "
+                                                + EnumDeserializer.ATYPETAGDESERIALIZER.deserialize(bytes0[offset0]));
                             }
 
-                            if (argOut1.getByteArray()[0] != ATypeTag.SERIALIZED_STRING_TYPE_TAG) {
-                                throw new AlgebricksException(FID.getName()
-                                        + ": expects type STRING/NULL for parameter 1 but got "
-                                        + EnumDeserializer.ATYPETAGDESERIALIZER.deserialize(argOut1.getByteArray()[0]));
+                            if (bytes1[offset1] != ATypeTag.SERIALIZED_STRING_TYPE_TAG) {
+                                throw new AlgebricksException(
+                                        FID.getName() + ": expects type STRING/NULL for parameter 1 but got "
+                                                + EnumDeserializer.ATYPETAGDESERIALIZER.deserialize(bytes1[offset1]));
                             }
 
-                            utf8Ptr.set(argOut1.getByteArray(), 1, argOut1.getLength() - 1);
-                            int timezone = ATimeParserFactory.parseTimezonePart(argOut1.getByteArray(),
-                                    utf8Ptr.getCharStartOffset());
+                            utf8Ptr.set(argPtr1.getByteArray(), offset1 + 1, len1 - 1);
+                            int timezone = ATimeParserFactory.parseTimezonePart(bytes1, utf8Ptr.getCharStartOffset());
 
                             if (!calInstance.validateTimeZone(timezone)) {
                                 throw new AlgebricksException(FID.getName() + ": wrong format for a time zone string!");
                             }
 
-                            int chronon = ATimeSerializerDeserializer.getChronon(argOut0.getByteArray(), 1);
+                            int chronon = ATimeSerializerDeserializer.getChronon(bytes0, offset0 + 1);
 
                             chronon = (int) calInstance.adjustChrononByTimezone(chronon, timezone);
 
@@ -132,6 +141,7 @@
                         } catch (Exception e1) {
                             throw new AlgebricksException(e1);
                         }
+                        result.set(resultStorage);
                     }
                 };
             }
diff --git a/asterix-runtime/src/main/java/org/apache/asterix/runtime/evaluators/functions/temporal/CalendarDuartionFromDateDescriptor.java b/asterix-runtime/src/main/java/org/apache/asterix/runtime/evaluators/functions/temporal/CalendarDuartionFromDateDescriptor.java
index 5678827..418ad68 100644
--- a/asterix-runtime/src/main/java/org/apache/asterix/runtime/evaluators/functions/temporal/CalendarDuartionFromDateDescriptor.java
+++ b/asterix-runtime/src/main/java/org/apache/asterix/runtime/evaluators/functions/temporal/CalendarDuartionFromDateDescriptor.java
@@ -37,11 +37,13 @@
 import org.apache.asterix.runtime.evaluators.base.AbstractScalarFunctionDynamicDescriptor;
 import org.apache.hyracks.algebricks.common.exceptions.AlgebricksException;
 import org.apache.hyracks.algebricks.core.algebra.functions.FunctionIdentifier;
-import org.apache.hyracks.algebricks.runtime.base.ICopyEvaluator;
-import org.apache.hyracks.algebricks.runtime.base.ICopyEvaluatorFactory;
+import org.apache.hyracks.algebricks.runtime.base.IScalarEvaluator;
+import org.apache.hyracks.algebricks.runtime.base.IScalarEvaluatorFactory;
+import org.apache.hyracks.api.context.IHyracksTaskContext;
 import org.apache.hyracks.api.dataflow.value.ISerializerDeserializer;
 import org.apache.hyracks.api.exceptions.HyracksDataException;
-import org.apache.hyracks.data.std.api.IDataOutputProvider;
+import org.apache.hyracks.data.std.api.IPointable;
+import org.apache.hyracks.data.std.primitive.VoidPointable;
 import org.apache.hyracks.data.std.util.ArrayBackedValueStorage;
 import org.apache.hyracks.dataflow.common.data.accessors.IFrameTupleReference;
 
@@ -60,21 +62,23 @@
      * @see org.apache.asterix.runtime.base.IScalarFunctionDynamicDescriptor#createEvaluatorFactory(org.apache.hyracks.algebricks.runtime.base.ICopyEvaluatorFactory[])
      */
     @Override
-    public ICopyEvaluatorFactory createEvaluatorFactory(final ICopyEvaluatorFactory[] args) throws AlgebricksException {
-        return new ICopyEvaluatorFactory() {
+    public IScalarEvaluatorFactory createEvaluatorFactory(final IScalarEvaluatorFactory[] args)
+            throws AlgebricksException {
+        return new IScalarEvaluatorFactory() {
 
             private static final long serialVersionUID = 1L;
 
             @Override
-            public ICopyEvaluator createEvaluator(final IDataOutputProvider output) throws AlgebricksException {
+            public IScalarEvaluator createScalarEvaluator(final IHyracksTaskContext ctx) throws AlgebricksException {
 
-                return new ICopyEvaluator() {
+                return new IScalarEvaluator() {
 
-                    private DataOutput out = output.getDataOutput();
-                    private ArrayBackedValueStorage argOut0 = new ArrayBackedValueStorage();
-                    private ArrayBackedValueStorage argOut1 = new ArrayBackedValueStorage();
-                    private ICopyEvaluator eval0 = args[0].createEvaluator(argOut0);
-                    private ICopyEvaluator eval1 = args[1].createEvaluator(argOut1);
+                    private ArrayBackedValueStorage resultStorage = new ArrayBackedValueStorage();
+                    private DataOutput out = resultStorage.getDataOutput();
+                    private IPointable argPtr0 = new VoidPointable();
+                    private IPointable argPtr1 = new VoidPointable();
+                    private IScalarEvaluator eval0 = args[0].createScalarEvaluator(ctx);
+                    private IScalarEvaluator eval1 = args[1].createScalarEvaluator(ctx);
 
                     // possible output types
                     @SuppressWarnings("unchecked")
@@ -89,38 +93,41 @@
                     private GregorianCalendarSystem calInstanct = GregorianCalendarSystem.getInstance();
 
                     @Override
-                    public void evaluate(IFrameTupleReference tuple) throws AlgebricksException {
+                    public void evaluate(IFrameTupleReference tuple, IPointable result) throws AlgebricksException {
+                        resultStorage.reset();
+                        eval0.evaluate(tuple, argPtr0);
+                        eval1.evaluate(tuple, argPtr1);
 
-                        argOut0.reset();
-                        eval0.evaluate(tuple);
-                        argOut1.reset();
-                        eval1.evaluate(tuple);
+                        byte[] bytes0 = argPtr0.getByteArray();
+                        int offset0 = argPtr0.getStartOffset();
+                        byte[] bytes1 = argPtr1.getByteArray();
+                        int offset1 = argPtr1.getStartOffset();
 
                         try {
-                            if (argOut0.getByteArray()[0] == ATypeTag.SERIALIZED_NULL_TYPE_TAG
-                                    || argOut1.getByteArray()[0] == ATypeTag.SERIALIZED_NULL_TYPE_TAG) {
+                            if (bytes0[offset0] == ATypeTag.SERIALIZED_NULL_TYPE_TAG
+                                    || bytes1[offset1] == ATypeTag.SERIALIZED_NULL_TYPE_TAG) {
                                 nullSerde.serialize(ANull.NULL, out);
+                                result.set(resultStorage);
                                 return;
                             }
 
-                            if (argOut0.getByteArray()[0] != ATypeTag.SERIALIZED_DATE_TYPE_TAG) {
-                                throw new AlgebricksException(FID.getName()
-                                        + ": expects type DATE/NULL for parameter 0 but got "
-                                        + EnumDeserializer.ATYPETAGDESERIALIZER.deserialize(argOut0.getByteArray()[0]));
+                            if (bytes0[offset0] != ATypeTag.SERIALIZED_DATE_TYPE_TAG) {
+                                throw new AlgebricksException(
+                                        FID.getName() + ": expects type DATE/NULL for parameter 0 but got "
+                                                + EnumDeserializer.ATYPETAGDESERIALIZER.deserialize(bytes0[offset0]));
                             }
 
-                            if (argOut1.getByteArray()[0] != ATypeTag.SERIALIZED_DURATION_TYPE_TAG) {
-                                throw new AlgebricksException(FID.getName()
-                                        + ": expects type DURATION/NULL for parameter 1 but got "
-                                        + EnumDeserializer.ATYPETAGDESERIALIZER.deserialize(argOut1.getByteArray()[0]));
+                            if (bytes1[offset1] != ATypeTag.SERIALIZED_DURATION_TYPE_TAG) {
+                                throw new AlgebricksException(
+                                        FID.getName() + ": expects type DURATION/NULL for parameter 1 but got "
+                                                + EnumDeserializer.ATYPETAGDESERIALIZER.deserialize(bytes1[offset1]));
                             }
 
-                            int yearMonthDurationInMonths = ADurationSerializerDeserializer
-                                    .getYearMonth(argOut1.getByteArray(), 1);
-                            long dayTimeDurationInMs = ADurationSerializerDeserializer
-                                    .getDayTime(argOut1.getByteArray(), 1);
+                            int yearMonthDurationInMonths = ADurationSerializerDeserializer.getYearMonth(bytes1,
+                                    offset1 + 1);
+                            long dayTimeDurationInMs = ADurationSerializerDeserializer.getDayTime(bytes1, offset1 + 1);
 
-                            long startingTimePoint = ADateSerializerDeserializer.getChronon(argOut0.getByteArray(), 1)
+                            long startingTimePoint = ADateSerializerDeserializer.getChronon(bytes0, offset0 + 1)
                                     * GregorianCalendarSystem.CHRONON_OF_DAY;
 
                             long endingTimePoint = DurationArithmeticOperations.addDuration(startingTimePoint,
@@ -216,6 +223,7 @@
                         } catch (HyracksDataException hex) {
                             throw new AlgebricksException(hex);
                         }
+                        result.set(resultStorage);
                     }
                 };
             }
diff --git a/asterix-runtime/src/main/java/org/apache/asterix/runtime/evaluators/functions/temporal/CalendarDurationFromDateTimeDescriptor.java b/asterix-runtime/src/main/java/org/apache/asterix/runtime/evaluators/functions/temporal/CalendarDurationFromDateTimeDescriptor.java
index 037df2e..dcef6ab 100644
--- a/asterix-runtime/src/main/java/org/apache/asterix/runtime/evaluators/functions/temporal/CalendarDurationFromDateTimeDescriptor.java
+++ b/asterix-runtime/src/main/java/org/apache/asterix/runtime/evaluators/functions/temporal/CalendarDurationFromDateTimeDescriptor.java
@@ -37,11 +37,13 @@
 import org.apache.asterix.runtime.evaluators.base.AbstractScalarFunctionDynamicDescriptor;
 import org.apache.hyracks.algebricks.common.exceptions.AlgebricksException;
 import org.apache.hyracks.algebricks.core.algebra.functions.FunctionIdentifier;
-import org.apache.hyracks.algebricks.runtime.base.ICopyEvaluator;
-import org.apache.hyracks.algebricks.runtime.base.ICopyEvaluatorFactory;
+import org.apache.hyracks.algebricks.runtime.base.IScalarEvaluator;
+import org.apache.hyracks.algebricks.runtime.base.IScalarEvaluatorFactory;
+import org.apache.hyracks.api.context.IHyracksTaskContext;
 import org.apache.hyracks.api.dataflow.value.ISerializerDeserializer;
 import org.apache.hyracks.api.exceptions.HyracksDataException;
-import org.apache.hyracks.data.std.api.IDataOutputProvider;
+import org.apache.hyracks.data.std.api.IPointable;
+import org.apache.hyracks.data.std.primitive.VoidPointable;
 import org.apache.hyracks.data.std.util.ArrayBackedValueStorage;
 import org.apache.hyracks.dataflow.common.data.accessors.IFrameTupleReference;
 
@@ -76,20 +78,22 @@
      * @see org.apache.asterix.runtime.base.IScalarFunctionDynamicDescriptor#createEvaluatorFactory(org.apache.hyracks.algebricks.runtime.base.ICopyEvaluatorFactory[])
      */
     @Override
-    public ICopyEvaluatorFactory createEvaluatorFactory(final ICopyEvaluatorFactory[] args) throws AlgebricksException {
-        return new ICopyEvaluatorFactory() {
+    public IScalarEvaluatorFactory createEvaluatorFactory(final IScalarEvaluatorFactory[] args)
+            throws AlgebricksException {
+        return new IScalarEvaluatorFactory() {
 
             private static final long serialVersionUID = 1L;
 
             @Override
-            public ICopyEvaluator createEvaluator(final IDataOutputProvider output) throws AlgebricksException {
-                return new ICopyEvaluator() {
+            public IScalarEvaluator createScalarEvaluator(final IHyracksTaskContext ctx) throws AlgebricksException {
+                return new IScalarEvaluator() {
 
-                    private DataOutput out = output.getDataOutput();
-                    private ArrayBackedValueStorage argOut0 = new ArrayBackedValueStorage();
-                    private ArrayBackedValueStorage argOut1 = new ArrayBackedValueStorage();
-                    private ICopyEvaluator eval0 = args[0].createEvaluator(argOut0);
-                    private ICopyEvaluator eval1 = args[1].createEvaluator(argOut1);
+                    private ArrayBackedValueStorage resultStorage = new ArrayBackedValueStorage();
+                    private DataOutput out = resultStorage.getDataOutput();
+                    private IPointable argPtr0 = new VoidPointable();
+                    private IPointable argPtr1 = new VoidPointable();
+                    private IScalarEvaluator eval0 = args[0].createScalarEvaluator(ctx);
+                    private IScalarEvaluator eval1 = args[1].createScalarEvaluator(ctx);
 
                     // possible output types
                     @SuppressWarnings("unchecked")
@@ -104,38 +108,41 @@
                     private GregorianCalendarSystem calInstanct = GregorianCalendarSystem.getInstance();
 
                     @Override
-                    public void evaluate(IFrameTupleReference tuple) throws AlgebricksException {
-                        argOut0.reset();
-                        eval0.evaluate(tuple);
-                        argOut1.reset();
-                        eval1.evaluate(tuple);
+                    public void evaluate(IFrameTupleReference tuple, IPointable result) throws AlgebricksException {
+                        resultStorage.reset();
+                        eval0.evaluate(tuple, argPtr0);
+                        eval1.evaluate(tuple, argPtr1);
+
+                        byte[] bytes0 = argPtr0.getByteArray();
+                        int offset0 = argPtr0.getStartOffset();
+                        byte[] bytes1 = argPtr1.getByteArray();
+                        int offset1 = argPtr1.getStartOffset();
 
                         try {
-                            if (argOut0.getByteArray()[0] == ATypeTag.SERIALIZED_NULL_TYPE_TAG
-                                    || argOut1.getByteArray()[0] == ATypeTag.SERIALIZED_NULL_TYPE_TAG) {
+                            if (bytes0[offset0] == ATypeTag.SERIALIZED_NULL_TYPE_TAG
+                                    || bytes1[offset1] == ATypeTag.SERIALIZED_NULL_TYPE_TAG) {
                                 nullSerde.serialize(ANull.NULL, out);
+                                result.set(resultStorage);
                                 return;
                             }
 
-                            if (argOut0.getByteArray()[0] != ATypeTag.SERIALIZED_DATETIME_TYPE_TAG) {
-                                throw new AlgebricksException(FID.getName()
-                                        + ": expects type DATETIME/NULL for parameter 0 but got "
-                                        + EnumDeserializer.ATYPETAGDESERIALIZER.deserialize(argOut0.getByteArray()[0]));
+                            if (bytes0[offset0] != ATypeTag.SERIALIZED_DATETIME_TYPE_TAG) {
+                                throw new AlgebricksException(
+                                        FID.getName() + ": expects type DATETIME/NULL for parameter 0 but got "
+                                                + EnumDeserializer.ATYPETAGDESERIALIZER.deserialize(bytes0[offset0]));
                             }
 
-                            if (argOut1.getByteArray()[0] != ATypeTag.SERIALIZED_DURATION_TYPE_TAG) {
-                                throw new AlgebricksException(FID.getName()
-                                        + ": expects type DURATION/NULL for parameter 1 but got "
-                                        + EnumDeserializer.ATYPETAGDESERIALIZER.deserialize(argOut1.getByteArray()[0]));
+                            if (bytes1[offset1] != ATypeTag.SERIALIZED_DURATION_TYPE_TAG) {
+                                throw new AlgebricksException(
+                                        FID.getName() + ": expects type DURATION/NULL for parameter 1 but got "
+                                                + EnumDeserializer.ATYPETAGDESERIALIZER.deserialize(bytes1[offset1]));
                             }
 
-                            int yearMonthDurationInMonths = ADurationSerializerDeserializer
-                                    .getYearMonth(argOut1.getByteArray(), 1);
-                            long dayTimeDurationInMs = ADurationSerializerDeserializer
-                                    .getDayTime(argOut1.getByteArray(), 1);
+                            int yearMonthDurationInMonths = ADurationSerializerDeserializer.getYearMonth(bytes1,
+                                    offset1 + 1);
+                            long dayTimeDurationInMs = ADurationSerializerDeserializer.getDayTime(bytes1, offset1 + 1);
 
-                            long startingTimePoint = ADateTimeSerializerDeserializer.getChronon(argOut0.getByteArray(),
-                                    1);
+                            long startingTimePoint = ADateTimeSerializerDeserializer.getChronon(bytes0, offset0 + 1);
 
                             long endingTimePoint = DurationArithmeticOperations.addDuration(startingTimePoint,
                                     yearMonthDurationInMonths, dayTimeDurationInMs, false);
@@ -230,6 +237,7 @@
                         } catch (HyracksDataException hex) {
                             throw new AlgebricksException(hex);
                         }
+                        result.set(resultStorage);
                     }
                 };
             }
diff --git a/asterix-runtime/src/main/java/org/apache/asterix/runtime/evaluators/functions/temporal/CurrentDateDescriptor.java b/asterix-runtime/src/main/java/org/apache/asterix/runtime/evaluators/functions/temporal/CurrentDateDescriptor.java
index a90e6c6d..e1f783a 100644
--- a/asterix-runtime/src/main/java/org/apache/asterix/runtime/evaluators/functions/temporal/CurrentDateDescriptor.java
+++ b/asterix-runtime/src/main/java/org/apache/asterix/runtime/evaluators/functions/temporal/CurrentDateDescriptor.java
@@ -31,11 +31,13 @@
 import org.apache.asterix.runtime.evaluators.base.AbstractScalarFunctionDynamicDescriptor;
 import org.apache.hyracks.algebricks.common.exceptions.AlgebricksException;
 import org.apache.hyracks.algebricks.core.algebra.functions.FunctionIdentifier;
-import org.apache.hyracks.algebricks.runtime.base.ICopyEvaluator;
-import org.apache.hyracks.algebricks.runtime.base.ICopyEvaluatorFactory;
+import org.apache.hyracks.algebricks.runtime.base.IScalarEvaluator;
+import org.apache.hyracks.algebricks.runtime.base.IScalarEvaluatorFactory;
+import org.apache.hyracks.api.context.IHyracksTaskContext;
 import org.apache.hyracks.api.dataflow.value.ISerializerDeserializer;
 import org.apache.hyracks.api.exceptions.HyracksDataException;
-import org.apache.hyracks.data.std.api.IDataOutputProvider;
+import org.apache.hyracks.data.std.api.IPointable;
+import org.apache.hyracks.data.std.util.ArrayBackedValueStorage;
 import org.apache.hyracks.dataflow.common.data.accessors.IFrameTupleReference;
 
 public class CurrentDateDescriptor extends AbstractScalarFunctionDynamicDescriptor {
@@ -52,16 +54,17 @@
     };
 
     @Override
-    public ICopyEvaluatorFactory createEvaluatorFactory(ICopyEvaluatorFactory[] args) throws AlgebricksException {
-        return new ICopyEvaluatorFactory() {
+    public IScalarEvaluatorFactory createEvaluatorFactory(IScalarEvaluatorFactory[] args) throws AlgebricksException {
+        return new IScalarEvaluatorFactory() {
 
             private static final long serialVersionUID = 1L;
 
             @Override
-            public ICopyEvaluator createEvaluator(final IDataOutputProvider output) throws AlgebricksException {
-                return new ICopyEvaluator() {
+            public IScalarEvaluator createScalarEvaluator(final IHyracksTaskContext ctx) throws AlgebricksException {
+                return new IScalarEvaluator() {
 
-                    private DataOutput out = output.getDataOutput();
+                    private ArrayBackedValueStorage resultStorage = new ArrayBackedValueStorage();
+                    private DataOutput out = resultStorage.getDataOutput();
 
                     @SuppressWarnings("unchecked")
                     private ISerializerDeserializer<ADate> dateSerde = AqlSerializerDeserializerProvider.INSTANCE
@@ -69,11 +72,14 @@
                     private AMutableDate aDate = new AMutableDate(0);
 
                     @Override
-                    public void evaluate(IFrameTupleReference tuple) throws AlgebricksException {
+                    public void evaluate(IFrameTupleReference tuple, IPointable result) throws AlgebricksException {
                         try {
-                            int dateChronon = (int) (System.currentTimeMillis() / GregorianCalendarSystem.CHRONON_OF_DAY);
+                            resultStorage.reset();
+                            int dateChronon = (int) (System.currentTimeMillis()
+                                    / GregorianCalendarSystem.CHRONON_OF_DAY);
                             aDate.setValue(dateChronon);
                             dateSerde.serialize(aDate, out);
+                            result.set(resultStorage);
                         } catch (HyracksDataException hex) {
                             throw new AlgebricksException(hex);
                         }
diff --git a/asterix-runtime/src/main/java/org/apache/asterix/runtime/evaluators/functions/temporal/CurrentDateTimeDescriptor.java b/asterix-runtime/src/main/java/org/apache/asterix/runtime/evaluators/functions/temporal/CurrentDateTimeDescriptor.java
index fea06ca..c7cc45d 100644
--- a/asterix-runtime/src/main/java/org/apache/asterix/runtime/evaluators/functions/temporal/CurrentDateTimeDescriptor.java
+++ b/asterix-runtime/src/main/java/org/apache/asterix/runtime/evaluators/functions/temporal/CurrentDateTimeDescriptor.java
@@ -30,11 +30,13 @@
 import org.apache.asterix.runtime.evaluators.base.AbstractScalarFunctionDynamicDescriptor;
 import org.apache.hyracks.algebricks.common.exceptions.AlgebricksException;
 import org.apache.hyracks.algebricks.core.algebra.functions.FunctionIdentifier;
-import org.apache.hyracks.algebricks.runtime.base.ICopyEvaluator;
-import org.apache.hyracks.algebricks.runtime.base.ICopyEvaluatorFactory;
+import org.apache.hyracks.algebricks.runtime.base.IScalarEvaluator;
+import org.apache.hyracks.algebricks.runtime.base.IScalarEvaluatorFactory;
+import org.apache.hyracks.api.context.IHyracksTaskContext;
 import org.apache.hyracks.api.dataflow.value.ISerializerDeserializer;
 import org.apache.hyracks.api.exceptions.HyracksDataException;
-import org.apache.hyracks.data.std.api.IDataOutputProvider;
+import org.apache.hyracks.data.std.api.IPointable;
+import org.apache.hyracks.data.std.util.ArrayBackedValueStorage;
 import org.apache.hyracks.dataflow.common.data.accessors.IFrameTupleReference;
 
 public class CurrentDateTimeDescriptor extends AbstractScalarFunctionDynamicDescriptor {
@@ -54,16 +56,17 @@
     }
 
     @Override
-    public ICopyEvaluatorFactory createEvaluatorFactory(ICopyEvaluatorFactory[] args) throws AlgebricksException {
-        return new ICopyEvaluatorFactory() {
+    public IScalarEvaluatorFactory createEvaluatorFactory(IScalarEvaluatorFactory[] args) throws AlgebricksException {
+        return new IScalarEvaluatorFactory() {
 
             private static final long serialVersionUID = 1L;
 
             @Override
-            public ICopyEvaluator createEvaluator(final IDataOutputProvider output) throws AlgebricksException {
-                return new ICopyEvaluator() {
+            public IScalarEvaluator createScalarEvaluator(final IHyracksTaskContext ctx) throws AlgebricksException {
+                return new IScalarEvaluator() {
 
-                    private DataOutput out = output.getDataOutput();
+                    private ArrayBackedValueStorage resultStorage = new ArrayBackedValueStorage();
+                    private DataOutput out = resultStorage.getDataOutput();
 
                     @SuppressWarnings("unchecked")
                     private ISerializerDeserializer<ADateTime> datetimeSerde = AqlSerializerDeserializerProvider.INSTANCE
@@ -71,10 +74,12 @@
                     private AMutableDateTime aDateTime = new AMutableDateTime(0);
 
                     @Override
-                    public void evaluate(IFrameTupleReference tuple) throws AlgebricksException {
+                    public void evaluate(IFrameTupleReference tuple, IPointable result) throws AlgebricksException {
                         try {
+                            resultStorage.reset();
                             aDateTime.setValue(System.currentTimeMillis());
                             datetimeSerde.serialize(aDateTime, out);
+                            result.set(resultStorage);
                         } catch (HyracksDataException hex) {
                             throw new AlgebricksException(hex);
                         }
diff --git a/asterix-runtime/src/main/java/org/apache/asterix/runtime/evaluators/functions/temporal/CurrentTimeDescriptor.java b/asterix-runtime/src/main/java/org/apache/asterix/runtime/evaluators/functions/temporal/CurrentTimeDescriptor.java
index 5c31924..857c25b 100644
--- a/asterix-runtime/src/main/java/org/apache/asterix/runtime/evaluators/functions/temporal/CurrentTimeDescriptor.java
+++ b/asterix-runtime/src/main/java/org/apache/asterix/runtime/evaluators/functions/temporal/CurrentTimeDescriptor.java
@@ -31,11 +31,13 @@
 import org.apache.asterix.runtime.evaluators.base.AbstractScalarFunctionDynamicDescriptor;
 import org.apache.hyracks.algebricks.common.exceptions.AlgebricksException;
 import org.apache.hyracks.algebricks.core.algebra.functions.FunctionIdentifier;
-import org.apache.hyracks.algebricks.runtime.base.ICopyEvaluator;
-import org.apache.hyracks.algebricks.runtime.base.ICopyEvaluatorFactory;
+import org.apache.hyracks.algebricks.runtime.base.IScalarEvaluator;
+import org.apache.hyracks.algebricks.runtime.base.IScalarEvaluatorFactory;
+import org.apache.hyracks.api.context.IHyracksTaskContext;
 import org.apache.hyracks.api.dataflow.value.ISerializerDeserializer;
 import org.apache.hyracks.api.exceptions.HyracksDataException;
-import org.apache.hyracks.data.std.api.IDataOutputProvider;
+import org.apache.hyracks.data.std.api.IPointable;
+import org.apache.hyracks.data.std.util.ArrayBackedValueStorage;
 import org.apache.hyracks.dataflow.common.data.accessors.IFrameTupleReference;
 
 public class CurrentTimeDescriptor extends AbstractScalarFunctionDynamicDescriptor {
@@ -55,16 +57,17 @@
      * @see org.apache.asterix.runtime.base.IScalarFunctionDynamicDescriptor#createEvaluatorFactory(org.apache.hyracks.algebricks.runtime.base.ICopyEvaluatorFactory[])
      */
     @Override
-    public ICopyEvaluatorFactory createEvaluatorFactory(ICopyEvaluatorFactory[] args) throws AlgebricksException {
-        return new ICopyEvaluatorFactory() {
+    public IScalarEvaluatorFactory createEvaluatorFactory(IScalarEvaluatorFactory[] args) throws AlgebricksException {
+        return new IScalarEvaluatorFactory() {
 
             private static final long serialVersionUID = 1L;
 
             @Override
-            public ICopyEvaluator createEvaluator(final IDataOutputProvider output) throws AlgebricksException {
-                return new ICopyEvaluator() {
+            public IScalarEvaluator createScalarEvaluator(final IHyracksTaskContext ctx) throws AlgebricksException {
+                return new IScalarEvaluator() {
 
-                    private DataOutput out = output.getDataOutput();
+                    private ArrayBackedValueStorage resultStorage = new ArrayBackedValueStorage();
+                    private DataOutput out = resultStorage.getDataOutput();
 
                     @SuppressWarnings("unchecked")
                     private ISerializerDeserializer<ATime> timeSerde = AqlSerializerDeserializerProvider.INSTANCE
@@ -72,11 +75,14 @@
                     private AMutableTime aTime = new AMutableTime(0);
 
                     @Override
-                    public void evaluate(IFrameTupleReference tuple) throws AlgebricksException {
+                    public void evaluate(IFrameTupleReference tuple, IPointable result) throws AlgebricksException {
                         try {
-                            int timeChronon = (int) (System.currentTimeMillis() % GregorianCalendarSystem.CHRONON_OF_DAY);
+                            resultStorage.reset();
+                            int timeChronon = (int) (System.currentTimeMillis()
+                                    % GregorianCalendarSystem.CHRONON_OF_DAY);
                             aTime.setValue(timeChronon);
                             timeSerde.serialize(aTime, out);
+                            result.set(resultStorage);
                         } catch (HyracksDataException hex) {
                             throw new AlgebricksException(hex);
                         }
diff --git a/asterix-runtime/src/main/java/org/apache/asterix/runtime/evaluators/functions/temporal/DateFromDatetimeDescriptor.java b/asterix-runtime/src/main/java/org/apache/asterix/runtime/evaluators/functions/temporal/DateFromDatetimeDescriptor.java
index 5927620..bcdb20f 100644
--- a/asterix-runtime/src/main/java/org/apache/asterix/runtime/evaluators/functions/temporal/DateFromDatetimeDescriptor.java
+++ b/asterix-runtime/src/main/java/org/apache/asterix/runtime/evaluators/functions/temporal/DateFromDatetimeDescriptor.java
@@ -35,11 +35,13 @@
 import org.apache.asterix.runtime.evaluators.base.AbstractScalarFunctionDynamicDescriptor;
 import org.apache.hyracks.algebricks.common.exceptions.AlgebricksException;
 import org.apache.hyracks.algebricks.core.algebra.functions.FunctionIdentifier;
-import org.apache.hyracks.algebricks.runtime.base.ICopyEvaluator;
-import org.apache.hyracks.algebricks.runtime.base.ICopyEvaluatorFactory;
+import org.apache.hyracks.algebricks.runtime.base.IScalarEvaluator;
+import org.apache.hyracks.algebricks.runtime.base.IScalarEvaluatorFactory;
+import org.apache.hyracks.api.context.IHyracksTaskContext;
 import org.apache.hyracks.api.dataflow.value.ISerializerDeserializer;
 import org.apache.hyracks.api.exceptions.HyracksDataException;
-import org.apache.hyracks.data.std.api.IDataOutputProvider;
+import org.apache.hyracks.data.std.api.IPointable;
+import org.apache.hyracks.data.std.primitive.VoidPointable;
 import org.apache.hyracks.data.std.util.ArrayBackedValueStorage;
 import org.apache.hyracks.dataflow.common.data.accessors.IFrameTupleReference;
 
@@ -56,18 +58,20 @@
     };
 
     @Override
-    public ICopyEvaluatorFactory createEvaluatorFactory(final ICopyEvaluatorFactory[] args) throws AlgebricksException {
-        return new ICopyEvaluatorFactory() {
+    public IScalarEvaluatorFactory createEvaluatorFactory(final IScalarEvaluatorFactory[] args)
+            throws AlgebricksException {
+        return new IScalarEvaluatorFactory() {
 
             private static final long serialVersionUID = 1L;
 
             @Override
-            public ICopyEvaluator createEvaluator(final IDataOutputProvider output) throws AlgebricksException {
-                return new ICopyEvaluator() {
+            public IScalarEvaluator createScalarEvaluator(final IHyracksTaskContext ctx) throws AlgebricksException {
+                return new IScalarEvaluator() {
 
-                    private DataOutput out = output.getDataOutput();
-                    private ArrayBackedValueStorage argOut = new ArrayBackedValueStorage();
-                    private ICopyEvaluator eval = args[0].createEvaluator(argOut);
+                    private ArrayBackedValueStorage resultStorage = new ArrayBackedValueStorage();
+                    private DataOutput out = resultStorage.getDataOutput();
+                    private IPointable argPtr = new VoidPointable();
+                    private IScalarEvaluator eval = args[0].createScalarEvaluator(ctx);
 
                     // possible returning types
                     @SuppressWarnings("unchecked")
@@ -80,21 +84,22 @@
                             .getSerializerDeserializer(BuiltinType.ANULL);
 
                     @Override
-                    public void evaluate(IFrameTupleReference tuple) throws AlgebricksException {
-                        argOut.reset();
-                        eval.evaluate(tuple);
+                    public void evaluate(IFrameTupleReference tuple, IPointable result) throws AlgebricksException {
+                        resultStorage.reset();
+                        eval.evaluate(tuple, argPtr);
+                        byte[] bytes = argPtr.getByteArray();
+                        int offset = argPtr.getStartOffset();
+
                         try {
-                            if (argOut.getByteArray()[0] == ATypeTag.SERIALIZED_NULL_TYPE_TAG) {
+                            if (bytes[offset] == ATypeTag.SERIALIZED_NULL_TYPE_TAG) {
                                 nullSerde.serialize(ANull.NULL, out);
                             } else {
-                                if (argOut.getByteArray()[0] != ATypeTag.SERIALIZED_DATETIME_TYPE_TAG) {
+                                if (bytes[offset] != ATypeTag.SERIALIZED_DATETIME_TYPE_TAG) {
                                     throw new AlgebricksException(
                                             FID.getName() + ": expects input type DATETIME/NULL but got "
-                                                    + EnumDeserializer.ATYPETAGDESERIALIZER
-                                                            .deserialize(argOut.getByteArray()[0]));
+                                                    + EnumDeserializer.ATYPETAGDESERIALIZER.deserialize(bytes[offset]));
                                 }
-                                long datetimeChronon = ADateTimeSerializerDeserializer.getChronon(argOut.getByteArray(),
-                                        1);
+                                long datetimeChronon = ADateTimeSerializerDeserializer.getChronon(bytes, offset + 1);
                                 int dateChrononInDays = (int) (datetimeChronon
                                         / GregorianCalendarSystem.CHRONON_OF_DAY);
                                 if (dateChrononInDays < 0
@@ -107,6 +112,7 @@
                         } catch (HyracksDataException hex) {
                             throw new AlgebricksException(hex);
                         }
+                        result.set(resultStorage);
                     }
                 };
             }
diff --git a/asterix-runtime/src/main/java/org/apache/asterix/runtime/evaluators/functions/temporal/DateFromUnixTimeInDaysDescriptor.java b/asterix-runtime/src/main/java/org/apache/asterix/runtime/evaluators/functions/temporal/DateFromUnixTimeInDaysDescriptor.java
index d96ffe9..b6f7a2e 100644
--- a/asterix-runtime/src/main/java/org/apache/asterix/runtime/evaluators/functions/temporal/DateFromUnixTimeInDaysDescriptor.java
+++ b/asterix-runtime/src/main/java/org/apache/asterix/runtime/evaluators/functions/temporal/DateFromUnixTimeInDaysDescriptor.java
@@ -33,11 +33,13 @@
 import org.apache.asterix.runtime.evaluators.base.AbstractScalarFunctionDynamicDescriptor;
 import org.apache.hyracks.algebricks.common.exceptions.AlgebricksException;
 import org.apache.hyracks.algebricks.core.algebra.functions.FunctionIdentifier;
-import org.apache.hyracks.algebricks.runtime.base.ICopyEvaluator;
-import org.apache.hyracks.algebricks.runtime.base.ICopyEvaluatorFactory;
+import org.apache.hyracks.algebricks.runtime.base.IScalarEvaluator;
+import org.apache.hyracks.algebricks.runtime.base.IScalarEvaluatorFactory;
+import org.apache.hyracks.api.context.IHyracksTaskContext;
 import org.apache.hyracks.api.dataflow.value.ISerializerDeserializer;
 import org.apache.hyracks.api.exceptions.HyracksDataException;
-import org.apache.hyracks.data.std.api.IDataOutputProvider;
+import org.apache.hyracks.data.std.api.IPointable;
+import org.apache.hyracks.data.std.primitive.VoidPointable;
 import org.apache.hyracks.data.std.util.ArrayBackedValueStorage;
 import org.apache.hyracks.dataflow.common.data.accessors.IFrameTupleReference;
 
@@ -54,18 +56,20 @@
     };
 
     @Override
-    public ICopyEvaluatorFactory createEvaluatorFactory(final ICopyEvaluatorFactory[] args) throws AlgebricksException {
-        return new ICopyEvaluatorFactory() {
+    public IScalarEvaluatorFactory createEvaluatorFactory(final IScalarEvaluatorFactory[] args)
+            throws AlgebricksException {
+        return new IScalarEvaluatorFactory() {
 
             private static final long serialVersionUID = 1L;
 
             @Override
-            public ICopyEvaluator createEvaluator(final IDataOutputProvider output) throws AlgebricksException {
-                return new ICopyEvaluator() {
+            public IScalarEvaluator createScalarEvaluator(final IHyracksTaskContext ctx) throws AlgebricksException {
+                return new IScalarEvaluator() {
 
-                    private DataOutput out = output.getDataOutput();
-                    private ArrayBackedValueStorage argOut = new ArrayBackedValueStorage();
-                    private ICopyEvaluator eval = args[0].createEvaluator(argOut);
+                    private ArrayBackedValueStorage resultStorage = new ArrayBackedValueStorage();
+                    private DataOutput out = resultStorage.getDataOutput();
+                    private IPointable argPtr = new VoidPointable();
+                    private IScalarEvaluator eval = args[0].createScalarEvaluator(ctx);
 
                     private AMutableDate aDate = new AMutableDate(0);
 
@@ -78,19 +82,21 @@
                             .getSerializerDeserializer(BuiltinType.ANULL);
 
                     @Override
-                    public void evaluate(IFrameTupleReference tuple) throws AlgebricksException {
-                        argOut.reset();
-                        eval.evaluate(tuple);
+                    public void evaluate(IFrameTupleReference tuple, IPointable result) throws AlgebricksException {
+                        resultStorage.reset();
+                        eval.evaluate(tuple, argPtr);
                         try {
-                            if (argOut.getByteArray()[0] == ATypeTag.SERIALIZED_NULL_TYPE_TAG) {
+                            if (argPtr.getByteArray()[argPtr.getStartOffset()] == ATypeTag.SERIALIZED_NULL_TYPE_TAG) {
                                 nullSerde.serialize(ANull.NULL, out);
                             } else {
-                                aDate.setValue(ATypeHierarchy.getIntegerValue(argOut.getByteArray(), 0));
+                                aDate.setValue(
+                                        ATypeHierarchy.getIntegerValue(argPtr.getByteArray(), argPtr.getStartOffset()));
                                 dateSerde.serialize(aDate, out);
                             }
                         } catch (HyracksDataException hex) {
                             throw new AlgebricksException(hex);
                         }
+                        result.set(resultStorage);
                     }
                 };
             }
diff --git a/asterix-runtime/src/main/java/org/apache/asterix/runtime/evaluators/functions/temporal/DatetimeFromDateAndTimeDescriptor.java b/asterix-runtime/src/main/java/org/apache/asterix/runtime/evaluators/functions/temporal/DatetimeFromDateAndTimeDescriptor.java
index d5f04ab..ab88265 100644
--- a/asterix-runtime/src/main/java/org/apache/asterix/runtime/evaluators/functions/temporal/DatetimeFromDateAndTimeDescriptor.java
+++ b/asterix-runtime/src/main/java/org/apache/asterix/runtime/evaluators/functions/temporal/DatetimeFromDateAndTimeDescriptor.java
@@ -36,11 +36,13 @@
 import org.apache.asterix.runtime.evaluators.base.AbstractScalarFunctionDynamicDescriptor;
 import org.apache.hyracks.algebricks.common.exceptions.AlgebricksException;
 import org.apache.hyracks.algebricks.core.algebra.functions.FunctionIdentifier;
-import org.apache.hyracks.algebricks.runtime.base.ICopyEvaluator;
-import org.apache.hyracks.algebricks.runtime.base.ICopyEvaluatorFactory;
+import org.apache.hyracks.algebricks.runtime.base.IScalarEvaluator;
+import org.apache.hyracks.algebricks.runtime.base.IScalarEvaluatorFactory;
+import org.apache.hyracks.api.context.IHyracksTaskContext;
 import org.apache.hyracks.api.dataflow.value.ISerializerDeserializer;
 import org.apache.hyracks.api.exceptions.HyracksDataException;
-import org.apache.hyracks.data.std.api.IDataOutputProvider;
+import org.apache.hyracks.data.std.api.IPointable;
+import org.apache.hyracks.data.std.primitive.VoidPointable;
 import org.apache.hyracks.data.std.util.ArrayBackedValueStorage;
 import org.apache.hyracks.dataflow.common.data.accessors.IFrameTupleReference;
 
@@ -60,20 +62,22 @@
      * @see org.apache.asterix.runtime.base.IScalarFunctionDynamicDescriptor#createEvaluatorFactory(org.apache.hyracks.algebricks.runtime.base.ICopyEvaluatorFactory[])
      */
     @Override
-    public ICopyEvaluatorFactory createEvaluatorFactory(final ICopyEvaluatorFactory[] args) throws AlgebricksException {
-        return new ICopyEvaluatorFactory() {
+    public IScalarEvaluatorFactory createEvaluatorFactory(final IScalarEvaluatorFactory[] args)
+            throws AlgebricksException {
+        return new IScalarEvaluatorFactory() {
 
             private static final long serialVersionUID = 1L;
 
             @Override
-            public ICopyEvaluator createEvaluator(final IDataOutputProvider output) throws AlgebricksException {
-                return new ICopyEvaluator() {
+            public IScalarEvaluator createScalarEvaluator(final IHyracksTaskContext ctx) throws AlgebricksException {
+                return new IScalarEvaluator() {
 
-                    private DataOutput out = output.getDataOutput();
-                    private ArrayBackedValueStorage argOut0 = new ArrayBackedValueStorage();
-                    private ArrayBackedValueStorage argOut1 = new ArrayBackedValueStorage();
-                    private ICopyEvaluator eval0 = args[0].createEvaluator(argOut0);
-                    private ICopyEvaluator eval1 = args[1].createEvaluator(argOut1);
+                    private ArrayBackedValueStorage resultStorage = new ArrayBackedValueStorage();
+                    private DataOutput out = resultStorage.getDataOutput();
+                    private IPointable argPtr0 = new VoidPointable();
+                    private IPointable argPtr1 = new VoidPointable();
+                    private IScalarEvaluator eval0 = args[0].createScalarEvaluator(ctx);
+                    private IScalarEvaluator eval1 = args[1].createScalarEvaluator(ctx);
 
                     // possible returning types
                     @SuppressWarnings("unchecked")
@@ -86,32 +90,34 @@
                             .getSerializerDeserializer(BuiltinType.ANULL);
 
                     @Override
-                    public void evaluate(IFrameTupleReference tuple) throws AlgebricksException {
-                        argOut0.reset();
-                        eval0.evaluate(tuple);
-                        argOut1.reset();
-                        eval1.evaluate(tuple);
+                    public void evaluate(IFrameTupleReference tuple, IPointable result) throws AlgebricksException {
+                        resultStorage.reset();
+                        eval0.evaluate(tuple, argPtr0);
+                        eval1.evaluate(tuple, argPtr1);
+
+                        byte[] bytes0 = argPtr0.getByteArray();
+                        int offset0 = argPtr0.getStartOffset();
+                        byte[] bytes1 = argPtr1.getByteArray();
+                        int offset1 = argPtr1.getStartOffset();
 
                         try {
-                            if (argOut0.getByteArray()[0] == ATypeTag.SERIALIZED_NULL_TYPE_TAG
-                                    || argOut1.getByteArray()[0] == ATypeTag.SERIALIZED_NULL_TYPE_TAG) {
+                            if (bytes0[offset0] == ATypeTag.SERIALIZED_NULL_TYPE_TAG
+                                    || bytes1[offset1] == ATypeTag.SERIALIZED_NULL_TYPE_TAG) {
                                 nullSerde.serialize(ANull.NULL, out);
                             } else {
-                                if (argOut0.getByteArray()[0] != ATypeTag.SERIALIZED_DATE_TYPE_TAG
-                                        && argOut1.getByteArray()[0] != ATypeTag.SERIALIZED_TIME_TYPE_TAG) {
-                                    throw new AlgebricksException(
-                                            FID.getName() + ": expects input type (DATE/NULL, TIME/NULL) but got ("
-                                                    + EnumDeserializer.ATYPETAGDESERIALIZER
-                                                            .deserialize(argOut0.getByteArray()[0])
-                                                    + ", " + EnumDeserializer.ATYPETAGDESERIALIZER
-                                                            .deserialize(argOut1.getByteArray()[0])
-                                                    + ").");
+                                if (bytes0[offset0] != ATypeTag.SERIALIZED_DATE_TYPE_TAG
+                                        && bytes1[offset1] != ATypeTag.SERIALIZED_TIME_TYPE_TAG) {
+                                    throw new AlgebricksException(FID.getName()
+                                            + ": expects input type (DATE/NULL, TIME/NULL) but got ("
+                                            + EnumDeserializer.ATYPETAGDESERIALIZER.deserialize(bytes0[offset0]) + ", "
+                                            + EnumDeserializer.ATYPETAGDESERIALIZER.deserialize(bytes1[offset1])
+                                            + ").");
 
                                 }
 
-                                long datetimeChronon = ADateSerializerDeserializer.getChronon(argOut0.getByteArray(), 1)
+                                long datetimeChronon = ADateSerializerDeserializer.getChronon(bytes0, offset0 + 1)
                                         * GregorianCalendarSystem.CHRONON_OF_DAY
-                                        + ATimeSerializerDeserializer.getChronon(argOut1.getByteArray(), 1);
+                                        + ATimeSerializerDeserializer.getChronon(bytes1, offset1 + 1);
 
                                 aDateTime.setValue(datetimeChronon);
                                 datetimeSerde.serialize(aDateTime, out);
@@ -119,6 +125,7 @@
                         } catch (HyracksDataException hex) {
                             throw new AlgebricksException(hex);
                         }
+                        result.set(resultStorage);
                     }
                 };
             }
diff --git a/asterix-runtime/src/main/java/org/apache/asterix/runtime/evaluators/functions/temporal/DatetimeFromUnixTimeInMsDescriptor.java b/asterix-runtime/src/main/java/org/apache/asterix/runtime/evaluators/functions/temporal/DatetimeFromUnixTimeInMsDescriptor.java
index 3d03c51..fae8566 100644
--- a/asterix-runtime/src/main/java/org/apache/asterix/runtime/evaluators/functions/temporal/DatetimeFromUnixTimeInMsDescriptor.java
+++ b/asterix-runtime/src/main/java/org/apache/asterix/runtime/evaluators/functions/temporal/DatetimeFromUnixTimeInMsDescriptor.java
@@ -36,11 +36,13 @@
 import org.apache.asterix.runtime.evaluators.base.AbstractScalarFunctionDynamicDescriptor;
 import org.apache.hyracks.algebricks.common.exceptions.AlgebricksException;
 import org.apache.hyracks.algebricks.core.algebra.functions.FunctionIdentifier;
-import org.apache.hyracks.algebricks.runtime.base.ICopyEvaluator;
-import org.apache.hyracks.algebricks.runtime.base.ICopyEvaluatorFactory;
+import org.apache.hyracks.algebricks.runtime.base.IScalarEvaluator;
+import org.apache.hyracks.algebricks.runtime.base.IScalarEvaluatorFactory;
+import org.apache.hyracks.api.context.IHyracksTaskContext;
 import org.apache.hyracks.api.dataflow.value.ISerializerDeserializer;
 import org.apache.hyracks.api.exceptions.HyracksDataException;
-import org.apache.hyracks.data.std.api.IDataOutputProvider;
+import org.apache.hyracks.data.std.api.IPointable;
+import org.apache.hyracks.data.std.primitive.VoidPointable;
 import org.apache.hyracks.data.std.util.ArrayBackedValueStorage;
 import org.apache.hyracks.dataflow.common.data.accessors.IFrameTupleReference;
 
@@ -61,18 +63,20 @@
      * @see org.apache.asterix.runtime.base.IScalarFunctionDynamicDescriptor#createEvaluatorFactory(org.apache.hyracks.algebricks.runtime.base.ICopyEvaluatorFactory[])
      */
     @Override
-    public ICopyEvaluatorFactory createEvaluatorFactory(final ICopyEvaluatorFactory[] args) throws AlgebricksException {
-        return new ICopyEvaluatorFactory() {
+    public IScalarEvaluatorFactory createEvaluatorFactory(final IScalarEvaluatorFactory[] args)
+            throws AlgebricksException {
+        return new IScalarEvaluatorFactory() {
 
             private static final long serialVersionUID = 1L;
 
             @Override
-            public ICopyEvaluator createEvaluator(final IDataOutputProvider output) throws AlgebricksException {
-                return new ICopyEvaluator() {
+            public IScalarEvaluator createScalarEvaluator(final IHyracksTaskContext ctx) throws AlgebricksException {
+                return new IScalarEvaluator() {
 
-                    private DataOutput out = output.getDataOutput();
-                    private ArrayBackedValueStorage argOut = new ArrayBackedValueStorage();
-                    private ICopyEvaluator eval = args[0].createEvaluator(argOut);
+                    private ArrayBackedValueStorage resultStorage = new ArrayBackedValueStorage();
+                    private DataOutput out = resultStorage.getDataOutput();
+                    private IPointable argPtr = new VoidPointable();
+                    private IScalarEvaluator eval = args[0].createScalarEvaluator(ctx);
 
                     // possible output types
                     @SuppressWarnings("unchecked")
@@ -85,43 +89,40 @@
                     private AMutableDateTime aDatetime = new AMutableDateTime(0);
 
                     @Override
-                    public void evaluate(IFrameTupleReference tuple) throws AlgebricksException {
-                        argOut.reset();
-                        eval.evaluate(tuple);
+                    public void evaluate(IFrameTupleReference tuple, IPointable result) throws AlgebricksException {
+                        resultStorage.reset();
+                        eval.evaluate(tuple, argPtr);
+                        byte[] bytes = argPtr.getByteArray();
+                        int offset = argPtr.getStartOffset();
                         try {
-
-                            ATypeTag argOutTypeTag = ATypeTag.VALUE_TYPE_MAPPING[argOut.getByteArray()[0]];
-
-                            if (argOutTypeTag == ATypeTag.NULL) {
+                            ATypeTag argPtrTypeTag = ATypeTag.VALUE_TYPE_MAPPING[bytes[offset]];
+                            if (argPtrTypeTag == ATypeTag.NULL) {
                                 nullSerde.serialize(ANull.NULL, out);
                             } else {
-                                switch (argOutTypeTag) {
+                                switch (argPtrTypeTag) {
                                     case INT8:
-                                        aDatetime
-                                                .setValue(AInt8SerializerDeserializer.getByte(argOut.getByteArray(), 1));
+                                        aDatetime.setValue(AInt8SerializerDeserializer.getByte(bytes, offset + 1));
                                         break;
                                     case INT16:
-                                        aDatetime.setValue(AInt16SerializerDeserializer.getShort(argOut.getByteArray(),
-                                                1));
+                                        aDatetime.setValue(AInt16SerializerDeserializer.getShort(bytes, offset + 1));
                                         break;
                                     case INT32:
-                                        aDatetime
-                                                .setValue(AInt32SerializerDeserializer.getInt(argOut.getByteArray(), 1));
+                                        aDatetime.setValue(AInt32SerializerDeserializer.getInt(bytes, offset + 1));
                                         break;
                                     case INT64:
-                                        aDatetime.setValue(AInt64SerializerDeserializer.getLong(argOut.getByteArray(),
-                                                1));
+                                        aDatetime.setValue(AInt64SerializerDeserializer.getLong(bytes, offset + 1));
                                         break;
                                     default:
-                                        throw new AlgebricksException(FID.getName()
-                                                + ": expects type INT8/INT16/INT32/INT64/NULL but got " + argOutTypeTag);
+                                        throw new AlgebricksException(
+                                                FID.getName() + ": expects type INT8/INT16/INT32/INT64/NULL but got "
+                                                        + argPtrTypeTag);
                                 }
                                 datetimeSerde.serialize(aDatetime, out);
                             }
-
                         } catch (HyracksDataException hex) {
                             throw new AlgebricksException(hex);
                         }
+                        result.set(resultStorage);
                     }
                 };
             }
diff --git a/asterix-runtime/src/main/java/org/apache/asterix/runtime/evaluators/functions/temporal/DatetimeFromUnixTimeInSecsDescriptor.java b/asterix-runtime/src/main/java/org/apache/asterix/runtime/evaluators/functions/temporal/DatetimeFromUnixTimeInSecsDescriptor.java
index 16e5803..1450ce6 100644
--- a/asterix-runtime/src/main/java/org/apache/asterix/runtime/evaluators/functions/temporal/DatetimeFromUnixTimeInSecsDescriptor.java
+++ b/asterix-runtime/src/main/java/org/apache/asterix/runtime/evaluators/functions/temporal/DatetimeFromUnixTimeInSecsDescriptor.java
@@ -36,11 +36,13 @@
 import org.apache.asterix.runtime.evaluators.base.AbstractScalarFunctionDynamicDescriptor;
 import org.apache.hyracks.algebricks.common.exceptions.AlgebricksException;
 import org.apache.hyracks.algebricks.core.algebra.functions.FunctionIdentifier;
-import org.apache.hyracks.algebricks.runtime.base.ICopyEvaluator;
-import org.apache.hyracks.algebricks.runtime.base.ICopyEvaluatorFactory;
+import org.apache.hyracks.algebricks.runtime.base.IScalarEvaluator;
+import org.apache.hyracks.algebricks.runtime.base.IScalarEvaluatorFactory;
+import org.apache.hyracks.api.context.IHyracksTaskContext;
 import org.apache.hyracks.api.dataflow.value.ISerializerDeserializer;
 import org.apache.hyracks.api.exceptions.HyracksDataException;
-import org.apache.hyracks.data.std.api.IDataOutputProvider;
+import org.apache.hyracks.data.std.api.IPointable;
+import org.apache.hyracks.data.std.primitive.VoidPointable;
 import org.apache.hyracks.data.std.util.ArrayBackedValueStorage;
 import org.apache.hyracks.dataflow.common.data.accessors.IFrameTupleReference;
 
@@ -61,18 +63,20 @@
      * @see org.apache.asterix.runtime.base.IScalarFunctionDynamicDescriptor#createEvaluatorFactory(org.apache.hyracks.algebricks.runtime.base.ICopyEvaluatorFactory[])
      */
     @Override
-    public ICopyEvaluatorFactory createEvaluatorFactory(final ICopyEvaluatorFactory[] args) throws AlgebricksException {
-        return new ICopyEvaluatorFactory() {
+    public IScalarEvaluatorFactory createEvaluatorFactory(final IScalarEvaluatorFactory[] args)
+            throws AlgebricksException {
+        return new IScalarEvaluatorFactory() {
 
             private static final long serialVersionUID = 1L;
 
             @Override
-            public ICopyEvaluator createEvaluator(final IDataOutputProvider output) throws AlgebricksException {
-                return new ICopyEvaluator() {
+            public IScalarEvaluator createScalarEvaluator(final IHyracksTaskContext ctx) throws AlgebricksException {
+                return new IScalarEvaluator() {
 
-                    private DataOutput out = output.getDataOutput();
-                    private ArrayBackedValueStorage argOut = new ArrayBackedValueStorage();
-                    private ICopyEvaluator eval = args[0].createEvaluator(argOut);
+                    private ArrayBackedValueStorage resultStorage = new ArrayBackedValueStorage();
+                    private DataOutput out = resultStorage.getDataOutput();
+                    private IPointable argPtr = new VoidPointable();
+                    private IScalarEvaluator eval = args[0].createScalarEvaluator(ctx);
 
                     // possible output types
                     @SuppressWarnings("unchecked")
@@ -85,44 +89,48 @@
                     private AMutableDateTime aDatetime = new AMutableDateTime(0);
 
                     @Override
-                    public void evaluate(IFrameTupleReference tuple) throws AlgebricksException {
-                        argOut.reset();
-                        eval.evaluate(tuple);
+                    public void evaluate(IFrameTupleReference tuple, IPointable result) throws AlgebricksException {
+                        resultStorage.reset();
+                        eval.evaluate(tuple, argPtr);
+
+                        byte[] bytes = argPtr.getByteArray();
+                        int offset = argPtr.getStartOffset();
+
                         try {
 
-                            ATypeTag argOutTypeTag = ATypeTag.VALUE_TYPE_MAPPING[argOut.getByteArray()[0]];
+                            ATypeTag argPtrTypeTag = ATypeTag.VALUE_TYPE_MAPPING[bytes[offset]];
 
-                            if (argOutTypeTag == ATypeTag.NULL) {
+                            if (argPtrTypeTag == ATypeTag.NULL) {
                                 nullSerde.serialize(ANull.NULL, out);
                             } else {
-                                switch (argOutTypeTag) {
+                                switch (argPtrTypeTag) {
                                     case INT8:
-                                        aDatetime.setValue((AInt8SerializerDeserializer.getByte(argOut.getByteArray(),
-                                                1) * 1000l));
+                                        aDatetime.setValue(
+                                                (AInt8SerializerDeserializer.getByte(bytes, offset + 1) * 1000l));
                                         break;
                                     case INT16:
-                                        aDatetime.setValue((AInt16SerializerDeserializer.getShort(
-                                                argOut.getByteArray(), 1) * 1000l));
+                                        aDatetime.setValue(
+                                                (AInt16SerializerDeserializer.getShort(bytes, offset + 1) * 1000l));
                                         break;
                                     case INT32:
-                                        aDatetime.setValue((AInt32SerializerDeserializer.getInt(argOut.getByteArray(),
-                                                1) * 1000l));
+                                        aDatetime.setValue(
+                                                (AInt32SerializerDeserializer.getInt(bytes, offset + 1) * 1000l));
                                         break;
                                     case INT64:
-                                        aDatetime.setValue((AInt64SerializerDeserializer.getLong(argOut.getByteArray(),
-                                                1) * 1000l));
+                                        aDatetime.setValue(
+                                                (AInt64SerializerDeserializer.getLong(bytes, offset + 1) * 1000l));
                                         break;
                                     default:
-                                        throw new AlgebricksException(FID.getName()
-                                                + ": expects type INT8/INT16/INT32/INT64/NULL but got " + argOutTypeTag);
+                                        throw new AlgebricksException(
+                                                FID.getName() + ": expects type INT8/INT16/INT32/INT64/NULL but got "
+                                                        + argPtrTypeTag);
                                 }
                                 datetimeSerde.serialize(aDatetime, out);
                             }
-
                         } catch (HyracksDataException hex) {
                             throw new AlgebricksException(hex);
                         }
-
+                        result.set(resultStorage);
                     }
                 };
             }
diff --git a/asterix-runtime/src/main/java/org/apache/asterix/runtime/evaluators/functions/temporal/DayOfWeekDescriptor.java b/asterix-runtime/src/main/java/org/apache/asterix/runtime/evaluators/functions/temporal/DayOfWeekDescriptor.java
index 48e4136..d7b5044 100644
--- a/asterix-runtime/src/main/java/org/apache/asterix/runtime/evaluators/functions/temporal/DayOfWeekDescriptor.java
+++ b/asterix-runtime/src/main/java/org/apache/asterix/runtime/evaluators/functions/temporal/DayOfWeekDescriptor.java
@@ -36,11 +36,13 @@
 import org.apache.asterix.runtime.evaluators.base.AbstractScalarFunctionDynamicDescriptor;
 import org.apache.hyracks.algebricks.common.exceptions.AlgebricksException;
 import org.apache.hyracks.algebricks.core.algebra.functions.FunctionIdentifier;
-import org.apache.hyracks.algebricks.runtime.base.ICopyEvaluator;
-import org.apache.hyracks.algebricks.runtime.base.ICopyEvaluatorFactory;
+import org.apache.hyracks.algebricks.runtime.base.IScalarEvaluator;
+import org.apache.hyracks.algebricks.runtime.base.IScalarEvaluatorFactory;
+import org.apache.hyracks.api.context.IHyracksTaskContext;
 import org.apache.hyracks.api.dataflow.value.ISerializerDeserializer;
 import org.apache.hyracks.api.exceptions.HyracksDataException;
-import org.apache.hyracks.data.std.api.IDataOutputProvider;
+import org.apache.hyracks.data.std.api.IPointable;
+import org.apache.hyracks.data.std.primitive.VoidPointable;
 import org.apache.hyracks.data.std.util.ArrayBackedValueStorage;
 import org.apache.hyracks.dataflow.common.data.accessors.IFrameTupleReference;
 
@@ -60,18 +62,20 @@
     };
 
     @Override
-    public ICopyEvaluatorFactory createEvaluatorFactory(final ICopyEvaluatorFactory[] args) throws AlgebricksException {
-        return new ICopyEvaluatorFactory() {
+    public IScalarEvaluatorFactory createEvaluatorFactory(final IScalarEvaluatorFactory[] args)
+            throws AlgebricksException {
+        return new IScalarEvaluatorFactory() {
 
             private static final long serialVersionUID = 1L;
 
             @Override
-            public ICopyEvaluator createEvaluator(final IDataOutputProvider output) throws AlgebricksException {
-                return new ICopyEvaluator() {
+            public IScalarEvaluator createScalarEvaluator(final IHyracksTaskContext ctx) throws AlgebricksException {
+                return new IScalarEvaluator() {
 
-                    private DataOutput out = output.getDataOutput();
-                    private ArrayBackedValueStorage argOut = new ArrayBackedValueStorage();
-                    private ICopyEvaluator eval = args[0].createEvaluator(argOut);
+                    private ArrayBackedValueStorage resultStorage = new ArrayBackedValueStorage();
+                    private DataOutput out = resultStorage.getDataOutput();
+                    private IPointable argPtr = new VoidPointable();
+                    private IScalarEvaluator eval = args[0].createScalarEvaluator(ctx);
 
                     // possible returning types
                     @SuppressWarnings("unchecked")
@@ -84,27 +88,30 @@
                             .getSerializerDeserializer(BuiltinType.ANULL);
 
                     @Override
-                    public void evaluate(IFrameTupleReference tuple) throws AlgebricksException {
-                        argOut.reset();
-                        eval.evaluate(tuple);
+                    public void evaluate(IFrameTupleReference tuple, IPointable result) throws AlgebricksException {
+                        resultStorage.reset();
+                        eval.evaluate(tuple, argPtr);
+
+                        byte[] bytes = argPtr.getByteArray();
+                        int offset = argPtr.getStartOffset();
+
                         try {
-                            if (argOut.getByteArray()[0] == ATypeTag.SERIALIZED_NULL_TYPE_TAG) {
+                            if (bytes[offset] == ATypeTag.SERIALIZED_NULL_TYPE_TAG) {
                                 nullSerde.serialize(ANull.NULL, out);
                             } else {
                                 int daysSinceAnchor;
                                 int reminder = 0;
-                                if (argOut.getByteArray()[0] == ATypeTag.SERIALIZED_DATETIME_TYPE_TAG) {
-                                    daysSinceAnchor = (int) (ADateTimeSerializerDeserializer.getChronon(
-                                            argOut.getByteArray(), 1) / GregorianCalendarSystem.CHRONON_OF_DAY);
-                                    reminder = (int) (ADateTimeSerializerDeserializer.getChronon(argOut.getByteArray(),
-                                            1) % GregorianCalendarSystem.CHRONON_OF_DAY);
-                                } else if (argOut.getByteArray()[0] == ATypeTag.SERIALIZED_DATE_TYPE_TAG) {
-                                    daysSinceAnchor = ADateSerializerDeserializer.getChronon(argOut.getByteArray(), 1);
+                                if (bytes[offset] == ATypeTag.SERIALIZED_DATETIME_TYPE_TAG) {
+                                    daysSinceAnchor = (int) (ADateTimeSerializerDeserializer.getChronon(bytes,
+                                            offset + 1) / GregorianCalendarSystem.CHRONON_OF_DAY);
+                                    reminder = (int) (ADateTimeSerializerDeserializer.getChronon(bytes, offset + 1)
+                                            % GregorianCalendarSystem.CHRONON_OF_DAY);
+                                } else if (bytes[offset] == ATypeTag.SERIALIZED_DATE_TYPE_TAG) {
+                                    daysSinceAnchor = ADateSerializerDeserializer.getChronon(bytes, offset + 1);
                                 } else {
                                     throw new AlgebricksException(
                                             FID.getName() + ": expects input type DATETIME/DATE/NULL but got "
-                                                    + EnumDeserializer.ATYPETAGDESERIALIZER
-                                                            .deserialize(argOut.getByteArray()[0]));
+                                                    + EnumDeserializer.ATYPETAGDESERIALIZER.deserialize(bytes[offset]));
                                 }
 
                                 // adjust the day before 1970-01-01
@@ -132,6 +139,7 @@
                         } catch (HyracksDataException hex) {
                             throw new AlgebricksException(hex);
                         }
+                        result.set(resultStorage);
                     }
                 };
             }
diff --git a/asterix-runtime/src/main/java/org/apache/asterix/runtime/evaluators/functions/temporal/DayTimeDurationComparatorDescriptor.java b/asterix-runtime/src/main/java/org/apache/asterix/runtime/evaluators/functions/temporal/DayTimeDurationComparatorDescriptor.java
index 1a98f3c..b7d170b 100644
--- a/asterix-runtime/src/main/java/org/apache/asterix/runtime/evaluators/functions/temporal/DayTimeDurationComparatorDescriptor.java
+++ b/asterix-runtime/src/main/java/org/apache/asterix/runtime/evaluators/functions/temporal/DayTimeDurationComparatorDescriptor.java
@@ -33,11 +33,13 @@
 import org.apache.asterix.runtime.evaluators.base.AbstractScalarFunctionDynamicDescriptor;
 import org.apache.hyracks.algebricks.common.exceptions.AlgebricksException;
 import org.apache.hyracks.algebricks.core.algebra.functions.FunctionIdentifier;
-import org.apache.hyracks.algebricks.runtime.base.ICopyEvaluator;
-import org.apache.hyracks.algebricks.runtime.base.ICopyEvaluatorFactory;
+import org.apache.hyracks.algebricks.runtime.base.IScalarEvaluator;
+import org.apache.hyracks.algebricks.runtime.base.IScalarEvaluatorFactory;
+import org.apache.hyracks.api.context.IHyracksTaskContext;
 import org.apache.hyracks.api.dataflow.value.ISerializerDeserializer;
 import org.apache.hyracks.api.exceptions.HyracksDataException;
-import org.apache.hyracks.data.std.api.IDataOutputProvider;
+import org.apache.hyracks.data.std.api.IPointable;
+import org.apache.hyracks.data.std.primitive.VoidPointable;
 import org.apache.hyracks.data.std.util.ArrayBackedValueStorage;
 import org.apache.hyracks.dataflow.common.data.accessors.IFrameTupleReference;
 
@@ -69,20 +71,22 @@
     };
 
     @Override
-    public ICopyEvaluatorFactory createEvaluatorFactory(final ICopyEvaluatorFactory[] args) throws AlgebricksException {
-        return new ICopyEvaluatorFactory() {
+    public IScalarEvaluatorFactory createEvaluatorFactory(final IScalarEvaluatorFactory[] args)
+            throws AlgebricksException {
+        return new IScalarEvaluatorFactory() {
 
             private static final long serialVersionUID = 1L;
 
             @Override
-            public ICopyEvaluator createEvaluator(final IDataOutputProvider output) throws AlgebricksException {
-                return new ICopyEvaluator() {
+            public IScalarEvaluator createScalarEvaluator(final IHyracksTaskContext ctx) throws AlgebricksException {
+                return new IScalarEvaluator() {
 
-                    private DataOutput out = output.getDataOutput();
-                    private ArrayBackedValueStorage argOut0 = new ArrayBackedValueStorage();
-                    private ArrayBackedValueStorage argOut1 = new ArrayBackedValueStorage();
-                    private ICopyEvaluator eval0 = args[0].createEvaluator(argOut0);
-                    private ICopyEvaluator eval1 = args[1].createEvaluator(argOut1);
+                    private ArrayBackedValueStorage resultStorage = new ArrayBackedValueStorage();
+                    private DataOutput out = resultStorage.getDataOutput();
+                    private IPointable argPtr0 = new VoidPointable();
+                    private IPointable argPtr1 = new VoidPointable();
+                    private IScalarEvaluator eval0 = args[0].createScalarEvaluator(ctx);
+                    private IScalarEvaluator eval1 = args[1].createScalarEvaluator(ctx);
 
                     // possible output types
                     @SuppressWarnings("unchecked")
@@ -93,46 +97,48 @@
                             .getSerializerDeserializer(BuiltinType.ABOOLEAN);
 
                     @Override
-                    public void evaluate(IFrameTupleReference tuple) throws AlgebricksException {
-                        argOut0.reset();
-                        eval0.evaluate(tuple);
-                        argOut1.reset();
-                        eval1.evaluate(tuple);
+                    public void evaluate(IFrameTupleReference tuple, IPointable result) throws AlgebricksException {
+                        resultStorage.reset();
+                        eval0.evaluate(tuple, argPtr0);
+                        eval1.evaluate(tuple, argPtr1);
+
+                        byte[] bytes0 = argPtr0.getByteArray();
+                        int offset0 = argPtr0.getStartOffset();
+                        byte[] bytes1 = argPtr1.getByteArray();
+                        int offset1 = argPtr1.getStartOffset();
 
                         try {
-                            if (argOut0.getByteArray()[0] == ATypeTag.SERIALIZED_NULL_TYPE_TAG
-                                    || argOut1.getByteArray()[0] == ATypeTag.SERIALIZED_NULL_TYPE_TAG) {
+                            if (bytes0[offset0] == ATypeTag.SERIALIZED_NULL_TYPE_TAG
+                                    || bytes1[offset1] == ATypeTag.SERIALIZED_NULL_TYPE_TAG) {
                                 nullSerde.serialize(ANull.NULL, out);
+                                result.set(resultStorage);
                                 return;
                             }
 
-                            if (argOut0.getByteArray()[0] != ATypeTag.SERIALIZED_DURATION_TYPE_TAG
-                                    || argOut1.getByteArray()[0] != ATypeTag.SERIALIZED_DURATION_TYPE_TAG) {
-                                throw new AlgebricksException(
-                                        getIdentifier().getName()
-                                                + ": expects type NULL/DURATION, NULL/DURATION but got "
-                                                + EnumDeserializer.ATYPETAGDESERIALIZER.deserialize(
-                                                        argOut0.getByteArray()[0])
-                                                + " and " + EnumDeserializer.ATYPETAGDESERIALIZER
-                                                        .deserialize(argOut1.getByteArray()[0]));
+                            if (bytes0[offset0] != ATypeTag.SERIALIZED_DURATION_TYPE_TAG
+                                    || bytes1[offset1] != ATypeTag.SERIALIZED_DURATION_TYPE_TAG) {
+                                throw new AlgebricksException(getIdentifier().getName()
+                                        + ": expects type NULL/DURATION, NULL/DURATION but got "
+                                        + EnumDeserializer.ATYPETAGDESERIALIZER.deserialize(bytes0[offset0]) + " and "
+                                        + EnumDeserializer.ATYPETAGDESERIALIZER.deserialize(bytes1[offset1]));
                             }
 
-                            if ((ADurationSerializerDeserializer.getYearMonth(argOut0.getByteArray(), 1) != 0)
-                                    || (ADurationSerializerDeserializer.getYearMonth(argOut1.getByteArray(), 1) != 0)) {
+                            if ((ADurationSerializerDeserializer.getYearMonth(bytes0, offset0 + 1) != 0)
+                                    || (ADurationSerializerDeserializer.getYearMonth(bytes1, offset1 + 1) != 0)) {
                                 throw new AlgebricksException(
                                         getIdentifier().getName() + ": only year-month durations are allowed.");
                             }
 
-                            if (ADurationSerializerDeserializer.getDayTime(argOut0.getByteArray(),
-                                    1) > ADurationSerializerDeserializer.getDayTime(argOut1.getByteArray(), 1)) {
+                            if (ADurationSerializerDeserializer.getDayTime(bytes0,
+                                    offset0 + 1) > ADurationSerializerDeserializer.getDayTime(bytes1, offset1 + 1)) {
                                 boolSerde.serialize(isGreaterThan ? ABoolean.TRUE : ABoolean.FALSE, out);
                             } else {
                                 boolSerde.serialize(isGreaterThan ? ABoolean.FALSE : ABoolean.TRUE, out);
                             }
-
                         } catch (HyracksDataException hex) {
                             throw new AlgebricksException(hex);
                         }
+                        result.set(resultStorage);
                     }
                 };
             }
diff --git a/asterix-runtime/src/main/java/org/apache/asterix/runtime/evaluators/functions/temporal/DurationEqualDescriptor.java b/asterix-runtime/src/main/java/org/apache/asterix/runtime/evaluators/functions/temporal/DurationEqualDescriptor.java
index c1493bd..bd18f0b 100644
--- a/asterix-runtime/src/main/java/org/apache/asterix/runtime/evaluators/functions/temporal/DurationEqualDescriptor.java
+++ b/asterix-runtime/src/main/java/org/apache/asterix/runtime/evaluators/functions/temporal/DurationEqualDescriptor.java
@@ -33,11 +33,13 @@
 import org.apache.asterix.runtime.evaluators.base.AbstractScalarFunctionDynamicDescriptor;
 import org.apache.hyracks.algebricks.common.exceptions.AlgebricksException;
 import org.apache.hyracks.algebricks.core.algebra.functions.FunctionIdentifier;
-import org.apache.hyracks.algebricks.runtime.base.ICopyEvaluator;
-import org.apache.hyracks.algebricks.runtime.base.ICopyEvaluatorFactory;
+import org.apache.hyracks.algebricks.runtime.base.IScalarEvaluator;
+import org.apache.hyracks.algebricks.runtime.base.IScalarEvaluatorFactory;
+import org.apache.hyracks.api.context.IHyracksTaskContext;
 import org.apache.hyracks.api.dataflow.value.ISerializerDeserializer;
 import org.apache.hyracks.api.exceptions.HyracksDataException;
-import org.apache.hyracks.data.std.api.IDataOutputProvider;
+import org.apache.hyracks.data.std.api.IPointable;
+import org.apache.hyracks.data.std.primitive.VoidPointable;
 import org.apache.hyracks.data.std.util.ArrayBackedValueStorage;
 import org.apache.hyracks.dataflow.common.data.accessors.IFrameTupleReference;
 
@@ -53,20 +55,22 @@
     };
 
     @Override
-    public ICopyEvaluatorFactory createEvaluatorFactory(final ICopyEvaluatorFactory[] args) throws AlgebricksException {
-        return new ICopyEvaluatorFactory() {
+    public IScalarEvaluatorFactory createEvaluatorFactory(final IScalarEvaluatorFactory[] args)
+            throws AlgebricksException {
+        return new IScalarEvaluatorFactory() {
 
             private static final long serialVersionUID = 1L;
 
             @Override
-            public ICopyEvaluator createEvaluator(final IDataOutputProvider output) throws AlgebricksException {
-                return new ICopyEvaluator() {
+            public IScalarEvaluator createScalarEvaluator(final IHyracksTaskContext ctx) throws AlgebricksException {
+                return new IScalarEvaluator() {
 
-                    private DataOutput out = output.getDataOutput();
-                    private ArrayBackedValueStorage argOut0 = new ArrayBackedValueStorage();
-                    private ArrayBackedValueStorage argOut1 = new ArrayBackedValueStorage();
-                    private ICopyEvaluator eval0 = args[0].createEvaluator(argOut0);
-                    private ICopyEvaluator eval1 = args[1].createEvaluator(argOut1);
+                    private ArrayBackedValueStorage resultStorage = new ArrayBackedValueStorage();
+                    private DataOutput out = resultStorage.getDataOutput();
+                    private IPointable argPtr0 = new VoidPointable();
+                    private IPointable argPtr1 = new VoidPointable();
+                    private IScalarEvaluator eval0 = args[0].createScalarEvaluator(ctx);
+                    private IScalarEvaluator eval1 = args[1].createScalarEvaluator(ctx);
 
                     // possible output types
                     @SuppressWarnings("unchecked")
@@ -77,42 +81,45 @@
                             .getSerializerDeserializer(BuiltinType.ABOOLEAN);
 
                     @Override
-                    public void evaluate(IFrameTupleReference tuple) throws AlgebricksException {
-                        argOut0.reset();
-                        eval0.evaluate(tuple);
-                        argOut1.reset();
-                        eval1.evaluate(tuple);
+                    public void evaluate(IFrameTupleReference tuple, IPointable result) throws AlgebricksException {
+                        resultStorage.reset();
+                        eval0.evaluate(tuple, argPtr0);
+                        eval1.evaluate(tuple, argPtr1);
+
+                        byte[] bytes0 = argPtr0.getByteArray();
+                        int offset0 = argPtr0.getStartOffset();
+                        byte[] bytes1 = argPtr1.getByteArray();
+                        int offset1 = argPtr1.getStartOffset();
 
                         try {
-                            if (argOut0.getByteArray()[0] == ATypeTag.SERIALIZED_NULL_TYPE_TAG
-                                    || argOut1.getByteArray()[0] == ATypeTag.SERIALIZED_NULL_TYPE_TAG) {
+                            if (bytes0[offset0] == ATypeTag.SERIALIZED_NULL_TYPE_TAG
+                                    || bytes1[offset1] == ATypeTag.SERIALIZED_NULL_TYPE_TAG) {
                                 nullSerde.serialize(ANull.NULL, out);
+                                result.set(resultStorage);
                                 return;
                             }
 
-                            if (argOut0.getByteArray()[0] != ATypeTag.SERIALIZED_DURATION_TYPE_TAG
-                                    || argOut1.getByteArray()[0] != ATypeTag.SERIALIZED_DURATION_TYPE_TAG) {
-                                throw new AlgebricksException(
-                                        FID.getName() + ": expects type NULL/DURATION, NULL/DURATION but got "
-                                                + EnumDeserializer.ATYPETAGDESERIALIZER.deserialize(
-                                                        argOut0.getByteArray()[0])
-                                                + " and " + EnumDeserializer.ATYPETAGDESERIALIZER
-                                                        .deserialize(argOut1.getByteArray()[0]));
+                            if (bytes0[offset0] != ATypeTag.SERIALIZED_DURATION_TYPE_TAG
+                                    || bytes1[offset1] != ATypeTag.SERIALIZED_DURATION_TYPE_TAG) {
+                                throw new AlgebricksException(FID.getName()
+                                        + ": expects type NULL/DURATION, NULL/DURATION but got "
+                                        + EnumDeserializer.ATYPETAGDESERIALIZER.deserialize(bytes0[offset0]) + " and "
+                                        + EnumDeserializer.ATYPETAGDESERIALIZER.deserialize(bytes1[offset1]));
                             }
 
-                            if ((ADurationSerializerDeserializer.getDayTime(argOut0.getByteArray(),
-                                    1) == ADurationSerializerDeserializer.getDayTime(argOut1.getByteArray(), 1))
-                                    && (ADurationSerializerDeserializer.getYearMonth(argOut0.getByteArray(),
-                                            1) == ADurationSerializerDeserializer.getYearMonth(argOut1.getByteArray(),
-                                                    1))) {
+                            if ((ADurationSerializerDeserializer.getDayTime(bytes0,
+                                    offset0 + 1) == ADurationSerializerDeserializer.getDayTime(bytes1, offset1 + 1))
+                                    && (ADurationSerializerDeserializer.getYearMonth(bytes0,
+                                            offset0 + 1) == ADurationSerializerDeserializer.getYearMonth(bytes1,
+                                                    offset1 + 1))) {
                                 boolSerde.serialize(ABoolean.TRUE, out);
                             } else {
                                 boolSerde.serialize(ABoolean.FALSE, out);
                             }
-
                         } catch (HyracksDataException hex) {
                             throw new AlgebricksException(hex);
                         }
+                        result.set(resultStorage);
                     }
                 };
             }
diff --git a/asterix-runtime/src/main/java/org/apache/asterix/runtime/evaluators/functions/temporal/DurationFromIntervalDescriptor.java b/asterix-runtime/src/main/java/org/apache/asterix/runtime/evaluators/functions/temporal/DurationFromIntervalDescriptor.java
index b69a257..28d2b85 100644
--- a/asterix-runtime/src/main/java/org/apache/asterix/runtime/evaluators/functions/temporal/DurationFromIntervalDescriptor.java
+++ b/asterix-runtime/src/main/java/org/apache/asterix/runtime/evaluators/functions/temporal/DurationFromIntervalDescriptor.java
@@ -35,11 +35,13 @@
 import org.apache.asterix.runtime.evaluators.base.AbstractScalarFunctionDynamicDescriptor;
 import org.apache.hyracks.algebricks.common.exceptions.AlgebricksException;
 import org.apache.hyracks.algebricks.core.algebra.functions.FunctionIdentifier;
-import org.apache.hyracks.algebricks.runtime.base.ICopyEvaluator;
-import org.apache.hyracks.algebricks.runtime.base.ICopyEvaluatorFactory;
+import org.apache.hyracks.algebricks.runtime.base.IScalarEvaluator;
+import org.apache.hyracks.algebricks.runtime.base.IScalarEvaluatorFactory;
+import org.apache.hyracks.api.context.IHyracksTaskContext;
 import org.apache.hyracks.api.dataflow.value.ISerializerDeserializer;
 import org.apache.hyracks.api.exceptions.HyracksDataException;
-import org.apache.hyracks.data.std.api.IDataOutputProvider;
+import org.apache.hyracks.data.std.api.IPointable;
+import org.apache.hyracks.data.std.primitive.VoidPointable;
 import org.apache.hyracks.data.std.util.ArrayBackedValueStorage;
 import org.apache.hyracks.dataflow.common.data.accessors.IFrameTupleReference;
 
@@ -56,18 +58,20 @@
     };
 
     @Override
-    public ICopyEvaluatorFactory createEvaluatorFactory(final ICopyEvaluatorFactory[] args) throws AlgebricksException {
-        return new ICopyEvaluatorFactory() {
+    public IScalarEvaluatorFactory createEvaluatorFactory(final IScalarEvaluatorFactory[] args)
+            throws AlgebricksException {
+        return new IScalarEvaluatorFactory() {
 
             private static final long serialVersionUID = 1L;
 
             @Override
-            public ICopyEvaluator createEvaluator(final IDataOutputProvider output) throws AlgebricksException {
-                return new ICopyEvaluator() {
+            public IScalarEvaluator createScalarEvaluator(final IHyracksTaskContext ctx) throws AlgebricksException {
+                return new IScalarEvaluator() {
 
-                    private DataOutput out = output.getDataOutput();
-                    private ArrayBackedValueStorage argOut = new ArrayBackedValueStorage();
-                    private ICopyEvaluator eval = args[0].createEvaluator(argOut);
+                    private ArrayBackedValueStorage resultStorage = new ArrayBackedValueStorage();
+                    private DataOutput out = resultStorage.getDataOutput();
+                    private IPointable argPtr = new VoidPointable();
+                    private IScalarEvaluator eval = args[0].createScalarEvaluator(ctx);
 
                     @SuppressWarnings("unchecked")
                     private ISerializerDeserializer<ANull> nullSerde = AqlSerializerDeserializerProvider.INSTANCE
@@ -80,24 +84,27 @@
                     private AMutableDayTimeDuration aDayTimeDuration = new AMutableDayTimeDuration(0);
 
                     @Override
-                    public void evaluate(IFrameTupleReference tuple) throws AlgebricksException {
-                        argOut.reset();
-                        eval.evaluate(tuple);
+                    public void evaluate(IFrameTupleReference tuple, IPointable result) throws AlgebricksException {
+                        resultStorage.reset();
+                        eval.evaluate(tuple, argPtr);
+
+                        byte[] bytes = argPtr.getByteArray();
+                        int offset = argPtr.getStartOffset();
 
                         try {
-                            if (argOut.getByteArray()[0] == ATypeTag.SERIALIZED_NULL_TYPE_TAG) {
+                            if (bytes[offset] == ATypeTag.SERIALIZED_NULL_TYPE_TAG) {
                                 nullSerde.serialize(ANull.NULL, out);
+                                result.set(resultStorage);
                                 return;
-                            } else if (argOut.getByteArray()[0] != ATypeTag.SERIALIZED_INTERVAL_TYPE_TAG) {
-                                throw new AlgebricksException(FID.getName()
-                                        + ": expects INTERVAL/NULL as the input but got "
-                                        + EnumDeserializer.ATYPETAGDESERIALIZER.deserialize(argOut.getByteArray()[0]));
+                            } else if (bytes[offset] != ATypeTag.SERIALIZED_INTERVAL_TYPE_TAG) {
+                                throw new AlgebricksException(
+                                        FID.getName() + ": expects INTERVAL/NULL as the input but got "
+                                                + EnumDeserializer.ATYPETAGDESERIALIZER.deserialize(bytes[offset]));
                             }
-                            long chrononStart = AIntervalSerializerDeserializer.getIntervalStart(argOut.getByteArray(),
-                                    1);
-                            long chrononEnd = AIntervalSerializerDeserializer.getIntervalEnd(argOut.getByteArray(), 1);
-                            byte intervalTypeTag = AIntervalSerializerDeserializer
-                                    .getIntervalTimeType(argOut.getByteArray(), 1);
+                            long chrononStart = AIntervalSerializerDeserializer.getIntervalStart(bytes, offset + 1);
+                            long chrononEnd = AIntervalSerializerDeserializer.getIntervalEnd(bytes, offset + 1);
+                            byte intervalTypeTag = AIntervalSerializerDeserializer.getIntervalTimeType(bytes,
+                                    offset + 1);
 
                             if (intervalTypeTag == ATypeTag.SERIALIZED_DATE_TYPE_TAG) {
                                 chrononStart *= GregorianCalendarSystem.CHRONON_OF_DAY;
@@ -110,6 +117,7 @@
                         } catch (HyracksDataException hex) {
                             throw new AlgebricksException(hex);
                         }
+                        result.set(resultStorage);
                     }
                 };
             }
diff --git a/asterix-runtime/src/main/java/org/apache/asterix/runtime/evaluators/functions/temporal/DurationFromMillisecondsDescriptor.java b/asterix-runtime/src/main/java/org/apache/asterix/runtime/evaluators/functions/temporal/DurationFromMillisecondsDescriptor.java
index b9ced3c..b1860bb 100644
--- a/asterix-runtime/src/main/java/org/apache/asterix/runtime/evaluators/functions/temporal/DurationFromMillisecondsDescriptor.java
+++ b/asterix-runtime/src/main/java/org/apache/asterix/runtime/evaluators/functions/temporal/DurationFromMillisecondsDescriptor.java
@@ -36,11 +36,13 @@
 import org.apache.asterix.runtime.evaluators.base.AbstractScalarFunctionDynamicDescriptor;
 import org.apache.hyracks.algebricks.common.exceptions.AlgebricksException;
 import org.apache.hyracks.algebricks.core.algebra.functions.FunctionIdentifier;
-import org.apache.hyracks.algebricks.runtime.base.ICopyEvaluator;
-import org.apache.hyracks.algebricks.runtime.base.ICopyEvaluatorFactory;
+import org.apache.hyracks.algebricks.runtime.base.IScalarEvaluator;
+import org.apache.hyracks.algebricks.runtime.base.IScalarEvaluatorFactory;
+import org.apache.hyracks.api.context.IHyracksTaskContext;
 import org.apache.hyracks.api.dataflow.value.ISerializerDeserializer;
 import org.apache.hyracks.api.exceptions.HyracksDataException;
-import org.apache.hyracks.data.std.api.IDataOutputProvider;
+import org.apache.hyracks.data.std.api.IPointable;
+import org.apache.hyracks.data.std.primitive.VoidPointable;
 import org.apache.hyracks.data.std.util.ArrayBackedValueStorage;
 import org.apache.hyracks.dataflow.common.data.accessors.IFrameTupleReference;
 
@@ -58,18 +60,20 @@
     };
 
     @Override
-    public ICopyEvaluatorFactory createEvaluatorFactory(final ICopyEvaluatorFactory[] args) throws AlgebricksException {
-        return new ICopyEvaluatorFactory() {
+    public IScalarEvaluatorFactory createEvaluatorFactory(final IScalarEvaluatorFactory[] args)
+            throws AlgebricksException {
+        return new IScalarEvaluatorFactory() {
 
             private static final long serialVersionUID = 1L;
 
             @Override
-            public ICopyEvaluator createEvaluator(final IDataOutputProvider output) throws AlgebricksException {
-                return new ICopyEvaluator() {
+            public IScalarEvaluator createScalarEvaluator(final IHyracksTaskContext ctx) throws AlgebricksException {
+                return new IScalarEvaluator() {
 
-                    private DataOutput out = output.getDataOutput();
-                    private ArrayBackedValueStorage argOut0 = new ArrayBackedValueStorage();
-                    private ICopyEvaluator eval0 = args[0].createEvaluator(argOut0);
+                    private ArrayBackedValueStorage resultStorage = new ArrayBackedValueStorage();
+                    private DataOutput out = resultStorage.getDataOutput();
+                    private IPointable argPtr0 = new VoidPointable();
+                    private IScalarEvaluator eval0 = args[0].createScalarEvaluator(ctx);
 
                     // possible output types
                     @SuppressWarnings("unchecked")
@@ -82,45 +86,41 @@
                     AMutableDuration aDuration = new AMutableDuration(0, 0);
 
                     @Override
-                    public void evaluate(IFrameTupleReference tuple) throws AlgebricksException {
-                        argOut0.reset();
-                        eval0.evaluate(tuple);
+                    public void evaluate(IFrameTupleReference tuple, IPointable result) throws AlgebricksException {
+                        resultStorage.reset();
+                        eval0.evaluate(tuple, argPtr0);
+                        byte[] bytes = argPtr0.getByteArray();
+                        int offset = argPtr0.getStartOffset();
 
                         try {
-
-                            ATypeTag argOutTypeTag = ATypeTag.VALUE_TYPE_MAPPING[argOut0.getByteArray()[0]];
-
-                            if (argOutTypeTag == ATypeTag.NULL) {
+                            ATypeTag argPtrTypeTag = ATypeTag.VALUE_TYPE_MAPPING[bytes[offset]];
+                            if (argPtrTypeTag == ATypeTag.NULL) {
                                 nullSerde.serialize(ANull.NULL, out);
                             } else {
-                                switch (argOutTypeTag) {
+                                switch (argPtrTypeTag) {
                                     case INT8:
-                                        aDuration.setValue(0,
-                                                AInt8SerializerDeserializer.getByte(argOut0.getByteArray(), 1));
+                                        aDuration.setValue(0, AInt8SerializerDeserializer.getByte(bytes, offset + 1));
                                         break;
                                     case INT16:
-                                        aDuration.setValue(0,
-                                                AInt16SerializerDeserializer.getShort(argOut0.getByteArray(), 1));
+                                        aDuration.setValue(0, AInt16SerializerDeserializer.getShort(bytes, offset + 1));
                                         break;
                                     case INT32:
-                                        aDuration.setValue(0,
-                                                AInt32SerializerDeserializer.getInt(argOut0.getByteArray(), 1));
+                                        aDuration.setValue(0, AInt32SerializerDeserializer.getInt(bytes, offset + 1));
                                         break;
                                     case INT64:
-                                        aDuration.setValue(0,
-                                                AInt64SerializerDeserializer.getLong(argOut0.getByteArray(), 1));
+                                        aDuration.setValue(0, AInt64SerializerDeserializer.getLong(bytes, offset + 1));
                                         break;
                                     default:
-                                        throw new AlgebricksException(FID.getName()
-                                                + ": expects type INT8/INT16/INT32/INT64/NULL but got " + argOutTypeTag);
+                                        throw new AlgebricksException(
+                                                FID.getName() + ": expects type INT8/INT16/INT32/INT64/NULL but got "
+                                                        + argPtrTypeTag);
                                 }
                                 durationSerde.serialize(aDuration, out);
                             }
-
                         } catch (HyracksDataException hex) {
                             throw new AlgebricksException(hex);
                         }
-
+                        result.set(resultStorage);
                     }
                 };
             }
diff --git a/asterix-runtime/src/main/java/org/apache/asterix/runtime/evaluators/functions/temporal/DurationFromMonthsDescriptor.java b/asterix-runtime/src/main/java/org/apache/asterix/runtime/evaluators/functions/temporal/DurationFromMonthsDescriptor.java
index f66b56b..334607a 100644
--- a/asterix-runtime/src/main/java/org/apache/asterix/runtime/evaluators/functions/temporal/DurationFromMonthsDescriptor.java
+++ b/asterix-runtime/src/main/java/org/apache/asterix/runtime/evaluators/functions/temporal/DurationFromMonthsDescriptor.java
@@ -33,11 +33,13 @@
 import org.apache.asterix.runtime.evaluators.base.AbstractScalarFunctionDynamicDescriptor;
 import org.apache.hyracks.algebricks.common.exceptions.AlgebricksException;
 import org.apache.hyracks.algebricks.core.algebra.functions.FunctionIdentifier;
-import org.apache.hyracks.algebricks.runtime.base.ICopyEvaluator;
-import org.apache.hyracks.algebricks.runtime.base.ICopyEvaluatorFactory;
+import org.apache.hyracks.algebricks.runtime.base.IScalarEvaluator;
+import org.apache.hyracks.algebricks.runtime.base.IScalarEvaluatorFactory;
+import org.apache.hyracks.api.context.IHyracksTaskContext;
 import org.apache.hyracks.api.dataflow.value.ISerializerDeserializer;
 import org.apache.hyracks.api.exceptions.HyracksDataException;
-import org.apache.hyracks.data.std.api.IDataOutputProvider;
+import org.apache.hyracks.data.std.api.IPointable;
+import org.apache.hyracks.data.std.primitive.VoidPointable;
 import org.apache.hyracks.data.std.util.ArrayBackedValueStorage;
 import org.apache.hyracks.dataflow.common.data.accessors.IFrameTupleReference;
 
@@ -54,18 +56,20 @@
     };
 
     @Override
-    public ICopyEvaluatorFactory createEvaluatorFactory(final ICopyEvaluatorFactory[] args) throws AlgebricksException {
-        return new ICopyEvaluatorFactory() {
+    public IScalarEvaluatorFactory createEvaluatorFactory(final IScalarEvaluatorFactory[] args)
+            throws AlgebricksException {
+        return new IScalarEvaluatorFactory() {
 
             private static final long serialVersionUID = 1L;
 
             @Override
-            public ICopyEvaluator createEvaluator(final IDataOutputProvider output) throws AlgebricksException {
-                return new ICopyEvaluator() {
+            public IScalarEvaluator createScalarEvaluator(final IHyracksTaskContext ctx) throws AlgebricksException {
+                return new IScalarEvaluator() {
 
-                    private DataOutput out = output.getDataOutput();
-                    private ArrayBackedValueStorage argOut0 = new ArrayBackedValueStorage();
-                    private ICopyEvaluator eval0 = args[0].createEvaluator(argOut0);
+                    private ArrayBackedValueStorage resultStorage = new ArrayBackedValueStorage();
+                    private DataOutput out = resultStorage.getDataOutput();
+                    private IPointable argPtr0 = new VoidPointable();
+                    private IScalarEvaluator eval0 = args[0].createScalarEvaluator(ctx);
 
                     // possible output types
                     @SuppressWarnings("unchecked")
@@ -78,22 +82,25 @@
                     AMutableDuration aDuration = new AMutableDuration(0, 0);
 
                     @Override
-                    public void evaluate(IFrameTupleReference tuple) throws AlgebricksException {
-                        argOut0.reset();
-                        eval0.evaluate(tuple);
+                    public void evaluate(IFrameTupleReference tuple, IPointable result) throws AlgebricksException {
+                        resultStorage.reset();
+                        eval0.evaluate(tuple, argPtr0);
+
+                        byte[] bytes = argPtr0.getByteArray();
+                        int offset = argPtr0.getStartOffset();
 
                         try {
-                            if (argOut0.getByteArray()[0] == ATypeTag.SERIALIZED_NULL_TYPE_TAG) {
+                            if (bytes[offset] == ATypeTag.SERIALIZED_NULL_TYPE_TAG) {
                                 nullSerde.serialize(ANull.NULL, out);
+                                result.set(resultStorage);
                                 return;
                             }
-
-                            aDuration.setValue(ATypeHierarchy.getIntegerValue(argOut0.getByteArray(), 0), 0);
+                            aDuration.setValue(ATypeHierarchy.getIntegerValue(bytes, offset), 0);
                             durationSerde.serialize(aDuration, out);
-
                         } catch (HyracksDataException hex) {
                             throw new AlgebricksException(hex);
                         }
+                        result.set(resultStorage);
                     }
                 };
             }
diff --git a/asterix-runtime/src/main/java/org/apache/asterix/runtime/evaluators/functions/temporal/GetDayTimeDurationDescriptor.java b/asterix-runtime/src/main/java/org/apache/asterix/runtime/evaluators/functions/temporal/GetDayTimeDurationDescriptor.java
index 2c8ebfd..b75a5b9 100644
--- a/asterix-runtime/src/main/java/org/apache/asterix/runtime/evaluators/functions/temporal/GetDayTimeDurationDescriptor.java
+++ b/asterix-runtime/src/main/java/org/apache/asterix/runtime/evaluators/functions/temporal/GetDayTimeDurationDescriptor.java
@@ -34,11 +34,13 @@
 import org.apache.asterix.runtime.evaluators.base.AbstractScalarFunctionDynamicDescriptor;
 import org.apache.hyracks.algebricks.common.exceptions.AlgebricksException;
 import org.apache.hyracks.algebricks.core.algebra.functions.FunctionIdentifier;
-import org.apache.hyracks.algebricks.runtime.base.ICopyEvaluator;
-import org.apache.hyracks.algebricks.runtime.base.ICopyEvaluatorFactory;
+import org.apache.hyracks.algebricks.runtime.base.IScalarEvaluator;
+import org.apache.hyracks.algebricks.runtime.base.IScalarEvaluatorFactory;
+import org.apache.hyracks.api.context.IHyracksTaskContext;
 import org.apache.hyracks.api.dataflow.value.ISerializerDeserializer;
 import org.apache.hyracks.api.exceptions.HyracksDataException;
-import org.apache.hyracks.data.std.api.IDataOutputProvider;
+import org.apache.hyracks.data.std.api.IPointable;
+import org.apache.hyracks.data.std.primitive.VoidPointable;
 import org.apache.hyracks.data.std.util.ArrayBackedValueStorage;
 import org.apache.hyracks.dataflow.common.data.accessors.IFrameTupleReference;
 
@@ -54,18 +56,20 @@
     };
 
     @Override
-    public ICopyEvaluatorFactory createEvaluatorFactory(final ICopyEvaluatorFactory[] args) throws AlgebricksException {
-        return new ICopyEvaluatorFactory() {
+    public IScalarEvaluatorFactory createEvaluatorFactory(final IScalarEvaluatorFactory[] args)
+            throws AlgebricksException {
+        return new IScalarEvaluatorFactory() {
 
             private static final long serialVersionUID = 1L;
 
             @Override
-            public ICopyEvaluator createEvaluator(final IDataOutputProvider output) throws AlgebricksException {
-                return new ICopyEvaluator() {
+            public IScalarEvaluator createScalarEvaluator(final IHyracksTaskContext ctx) throws AlgebricksException {
+                return new IScalarEvaluator() {
 
-                    private DataOutput out = output.getDataOutput();
-                    private ArrayBackedValueStorage argOut0 = new ArrayBackedValueStorage();
-                    private ICopyEvaluator eval0 = args[0].createEvaluator(argOut0);
+                    private ArrayBackedValueStorage resultStorage = new ArrayBackedValueStorage();
+                    private DataOutput out = resultStorage.getDataOutput();
+                    private IPointable argPtr0 = new VoidPointable();
+                    private IScalarEvaluator eval0 = args[0].createScalarEvaluator(ctx);
 
                     // possible output types
                     @SuppressWarnings("unchecked")
@@ -78,29 +82,32 @@
                     AMutableDayTimeDuration aDayTimeDuration = new AMutableDayTimeDuration(0);
 
                     @Override
-                    public void evaluate(IFrameTupleReference tuple) throws AlgebricksException {
-                        argOut0.reset();
-                        eval0.evaluate(tuple);
+                    public void evaluate(IFrameTupleReference tuple, IPointable result) throws AlgebricksException {
+                        resultStorage.reset();
+                        eval0.evaluate(tuple, argPtr0);
+
+                        byte[] bytes = argPtr0.getByteArray();
+                        int offset = argPtr0.getStartOffset();
 
                         try {
-                            if (argOut0.getByteArray()[0] == ATypeTag.SERIALIZED_NULL_TYPE_TAG) {
+                            if (bytes[offset] == ATypeTag.SERIALIZED_NULL_TYPE_TAG) {
                                 nullSerde.serialize(ANull.NULL, out);
+                                result.set(resultStorage);
                                 return;
                             }
 
-                            if (argOut0.getByteArray()[0] != ATypeTag.SERIALIZED_DURATION_TYPE_TAG) {
+                            if (bytes[offset] != ATypeTag.SERIALIZED_DURATION_TYPE_TAG) {
                                 throw new AlgebricksException(FID.getName() + ": expects NULL/DURATION, but got "
-                                        + EnumDeserializer.ATYPETAGDESERIALIZER.deserialize(argOut0.getByteArray()[0]));
+                                        + EnumDeserializer.ATYPETAGDESERIALIZER.deserialize(bytes[offset]));
                             }
 
-                            aDayTimeDuration.setMilliseconds(
-                                    ADurationSerializerDeserializer.getDayTime(argOut0.getByteArray(), 1));
-
+                            aDayTimeDuration
+                                    .setMilliseconds(ADurationSerializerDeserializer.getDayTime(bytes, offset + 1));
                             dayTimeDurationSerde.serialize(aDayTimeDuration, out);
-
                         } catch (HyracksDataException hex) {
                             throw new AlgebricksException(hex);
                         }
+                        result.set(resultStorage);
                     }
                 };
             }
diff --git a/asterix-runtime/src/main/java/org/apache/asterix/runtime/evaluators/functions/temporal/GetOverlappingIntervalDescriptor.java b/asterix-runtime/src/main/java/org/apache/asterix/runtime/evaluators/functions/temporal/GetOverlappingIntervalDescriptor.java
index 8e7f0c6..94ed860 100644
--- a/asterix-runtime/src/main/java/org/apache/asterix/runtime/evaluators/functions/temporal/GetOverlappingIntervalDescriptor.java
+++ b/asterix-runtime/src/main/java/org/apache/asterix/runtime/evaluators/functions/temporal/GetOverlappingIntervalDescriptor.java
@@ -34,11 +34,13 @@
 import org.apache.asterix.runtime.evaluators.base.AbstractScalarFunctionDynamicDescriptor;
 import org.apache.hyracks.algebricks.common.exceptions.AlgebricksException;
 import org.apache.hyracks.algebricks.core.algebra.functions.FunctionIdentifier;
-import org.apache.hyracks.algebricks.runtime.base.ICopyEvaluator;
-import org.apache.hyracks.algebricks.runtime.base.ICopyEvaluatorFactory;
+import org.apache.hyracks.algebricks.runtime.base.IScalarEvaluator;
+import org.apache.hyracks.algebricks.runtime.base.IScalarEvaluatorFactory;
+import org.apache.hyracks.api.context.IHyracksTaskContext;
 import org.apache.hyracks.api.dataflow.value.ISerializerDeserializer;
 import org.apache.hyracks.api.exceptions.HyracksDataException;
-import org.apache.hyracks.data.std.api.IDataOutputProvider;
+import org.apache.hyracks.data.std.api.IPointable;
+import org.apache.hyracks.data.std.primitive.VoidPointable;
 import org.apache.hyracks.data.std.util.ArrayBackedValueStorage;
 import org.apache.hyracks.dataflow.common.data.accessors.IFrameTupleReference;
 
@@ -52,20 +54,22 @@
     };
 
     @Override
-    public ICopyEvaluatorFactory createEvaluatorFactory(final ICopyEvaluatorFactory[] args) throws AlgebricksException {
-        return new ICopyEvaluatorFactory() {
+    public IScalarEvaluatorFactory createEvaluatorFactory(final IScalarEvaluatorFactory[] args)
+            throws AlgebricksException {
+        return new IScalarEvaluatorFactory() {
 
             private static final long serialVersionUID = 1L;
 
             @Override
-            public ICopyEvaluator createEvaluator(final IDataOutputProvider output) throws AlgebricksException {
-                return new ICopyEvaluator() {
+            public IScalarEvaluator createScalarEvaluator(final IHyracksTaskContext ctx) throws AlgebricksException {
+                return new IScalarEvaluator() {
 
-                    private DataOutput out = output.getDataOutput();
-                    private ArrayBackedValueStorage argOut0 = new ArrayBackedValueStorage();
-                    private ArrayBackedValueStorage argOut1 = new ArrayBackedValueStorage();
-                    private ICopyEvaluator eval0 = args[0].createEvaluator(argOut0);
-                    private ICopyEvaluator eval1 = args[1].createEvaluator(argOut1);
+                    private ArrayBackedValueStorage resultStorage = new ArrayBackedValueStorage();
+                    private DataOutput out = resultStorage.getDataOutput();
+                    private IPointable argPtr0 = new VoidPointable();
+                    private IPointable argPtr1 = new VoidPointable();
+                    private IScalarEvaluator eval0 = args[0].createScalarEvaluator(ctx);
+                    private IScalarEvaluator eval1 = args[1].createScalarEvaluator(ctx);
 
                     private final AMutableInterval aInterval = new AMutableInterval(0, 0, (byte) -1);
 
@@ -77,22 +81,24 @@
                             .getSerializerDeserializer(BuiltinType.AINTERVAL);
 
                     @Override
-                    public void evaluate(IFrameTupleReference tuple) throws AlgebricksException {
-                        argOut0.reset();
-                        eval0.evaluate(tuple);
-                        argOut1.reset();
-                        eval1.evaluate(tuple);
+                    public void evaluate(IFrameTupleReference tuple, IPointable result) throws AlgebricksException {
+                        resultStorage.reset();
+                        eval0.evaluate(tuple, argPtr0);
+                        eval1.evaluate(tuple, argPtr1);
+
+                        byte[] bytes0 = argPtr0.getByteArray();
+                        int offset0 = argPtr0.getStartOffset();
+                        byte[] bytes1 = argPtr1.getByteArray();
+                        int offset1 = argPtr1.getStartOffset();
 
                         try {
-                            if (argOut0.getByteArray()[0] == ATypeTag.SERIALIZED_NULL_TYPE_TAG
-                                    || argOut1.getByteArray()[0] == ATypeTag.SERIALIZED_NULL_TYPE_TAG) {
+                            if (bytes0[offset0] == ATypeTag.SERIALIZED_NULL_TYPE_TAG
+                                    || bytes1[offset1] == ATypeTag.SERIALIZED_NULL_TYPE_TAG) {
                                 nullSerde.serialize(ANull.NULL, out);
-                            } else if (argOut0.getByteArray()[0] == ATypeTag.SERIALIZED_INTERVAL_TYPE_TAG
-                                    && argOut0.getByteArray()[0] == argOut1.getByteArray()[0]) {
-                                byte type0 = AIntervalSerializerDeserializer.getIntervalTimeType(argOut0.getByteArray(),
-                                        1);
-                                byte type1 = AIntervalSerializerDeserializer.getIntervalTimeType(argOut1.getByteArray(),
-                                        1);
+                            } else if (bytes0[offset0] == ATypeTag.SERIALIZED_INTERVAL_TYPE_TAG
+                                    && bytes0[offset0] == bytes1[offset1]) {
+                                byte type0 = AIntervalSerializerDeserializer.getIntervalTimeType(bytes0, offset0 + 1);
+                                byte type1 = AIntervalSerializerDeserializer.getIntervalTimeType(bytes1, offset1 + 1);
                                 if (type0 != type1) {
                                     throw new AlgebricksException(getIdentifier().getName()
                                             + ": expecting two (nullable) interval values with the same internal time type but got interval of "
@@ -101,13 +107,11 @@
                                             + EnumDeserializer.ATYPETAGDESERIALIZER.deserialize(type1));
                                 }
 
-                                long start0 = AIntervalSerializerDeserializer.getIntervalStart(argOut0.getByteArray(),
-                                        1);
-                                long end0 = AIntervalSerializerDeserializer.getIntervalEnd(argOut0.getByteArray(), 1);
+                                long start0 = AIntervalSerializerDeserializer.getIntervalStart(bytes0, offset0 + 1);
+                                long end0 = AIntervalSerializerDeserializer.getIntervalEnd(bytes0, offset0 + 1);
 
-                                long start1 = AIntervalSerializerDeserializer.getIntervalStart(argOut1.getByteArray(),
-                                        1);
-                                long end1 = AIntervalSerializerDeserializer.getIntervalEnd(argOut1.getByteArray(), 1);
+                                long start1 = AIntervalSerializerDeserializer.getIntervalStart(bytes1, offset1 + 1);
+                                long end1 = AIntervalSerializerDeserializer.getIntervalEnd(bytes1, offset1 + 1);
 
                                 if (IntervalLogic.overlap(start0, end0, start1, end1)
                                         || IntervalLogic.overlappedBy(start0, end0, start1, end1)
@@ -119,17 +123,15 @@
                                     nullSerde.serialize(ANull.NULL, out);
                                 }
                             } else {
-                                throw new AlgebricksException(
-                                        getIdentifier().getName()
-                                                + ": expecting two (nullable) interval values but got "
-                                                + EnumDeserializer.ATYPETAGDESERIALIZER.deserialize(
-                                                        argOut0.getByteArray()[0])
-                                                + " and " + EnumDeserializer.ATYPETAGDESERIALIZER
-                                                        .deserialize(argOut0.getByteArray()[1]));
+                                throw new AlgebricksException(getIdentifier().getName()
+                                        + ": expecting two (nullable) interval values but got "
+                                        + EnumDeserializer.ATYPETAGDESERIALIZER.deserialize(bytes0[offset0]) + " and "
+                                        + EnumDeserializer.ATYPETAGDESERIALIZER.deserialize(bytes1[offset1]));
                             }
                         } catch (HyracksDataException hex) {
                             throw new AlgebricksException(hex);
                         }
+                        result.set(resultStorage);
                     }
 
                 };
diff --git a/asterix-runtime/src/main/java/org/apache/asterix/runtime/evaluators/functions/temporal/GetYearMonthDurationDescriptor.java b/asterix-runtime/src/main/java/org/apache/asterix/runtime/evaluators/functions/temporal/GetYearMonthDurationDescriptor.java
index 84fd408..d3397c4 100644
--- a/asterix-runtime/src/main/java/org/apache/asterix/runtime/evaluators/functions/temporal/GetYearMonthDurationDescriptor.java
+++ b/asterix-runtime/src/main/java/org/apache/asterix/runtime/evaluators/functions/temporal/GetYearMonthDurationDescriptor.java
@@ -34,11 +34,13 @@
 import org.apache.asterix.runtime.evaluators.base.AbstractScalarFunctionDynamicDescriptor;
 import org.apache.hyracks.algebricks.common.exceptions.AlgebricksException;
 import org.apache.hyracks.algebricks.core.algebra.functions.FunctionIdentifier;
-import org.apache.hyracks.algebricks.runtime.base.ICopyEvaluator;
-import org.apache.hyracks.algebricks.runtime.base.ICopyEvaluatorFactory;
+import org.apache.hyracks.algebricks.runtime.base.IScalarEvaluator;
+import org.apache.hyracks.algebricks.runtime.base.IScalarEvaluatorFactory;
+import org.apache.hyracks.api.context.IHyracksTaskContext;
 import org.apache.hyracks.api.dataflow.value.ISerializerDeserializer;
 import org.apache.hyracks.api.exceptions.HyracksDataException;
-import org.apache.hyracks.data.std.api.IDataOutputProvider;
+import org.apache.hyracks.data.std.api.IPointable;
+import org.apache.hyracks.data.std.primitive.VoidPointable;
 import org.apache.hyracks.data.std.util.ArrayBackedValueStorage;
 import org.apache.hyracks.dataflow.common.data.accessors.IFrameTupleReference;
 
@@ -54,18 +56,20 @@
     };
 
     @Override
-    public ICopyEvaluatorFactory createEvaluatorFactory(final ICopyEvaluatorFactory[] args) throws AlgebricksException {
-        return new ICopyEvaluatorFactory() {
+    public IScalarEvaluatorFactory createEvaluatorFactory(final IScalarEvaluatorFactory[] args)
+            throws AlgebricksException {
+        return new IScalarEvaluatorFactory() {
 
             private static final long serialVersionUID = 1L;
 
             @Override
-            public ICopyEvaluator createEvaluator(final IDataOutputProvider output) throws AlgebricksException {
-                return new ICopyEvaluator() {
+            public IScalarEvaluator createScalarEvaluator(final IHyracksTaskContext ctx) throws AlgebricksException {
+                return new IScalarEvaluator() {
 
-                    private DataOutput out = output.getDataOutput();
-                    private ArrayBackedValueStorage argOut0 = new ArrayBackedValueStorage();
-                    private ICopyEvaluator eval0 = args[0].createEvaluator(argOut0);
+                    private ArrayBackedValueStorage resultStorage = new ArrayBackedValueStorage();
+                    private DataOutput out = resultStorage.getDataOutput();
+                    private IPointable argPtr0 = new VoidPointable();
+                    private IScalarEvaluator eval0 = args[0].createScalarEvaluator(ctx);
 
                     // possible output types
                     @SuppressWarnings("unchecked")
@@ -78,29 +82,32 @@
                     AMutableYearMonthDuration aYearMonthDuration = new AMutableYearMonthDuration(0);
 
                     @Override
-                    public void evaluate(IFrameTupleReference tuple) throws AlgebricksException {
-                        argOut0.reset();
-                        eval0.evaluate(tuple);
+                    public void evaluate(IFrameTupleReference tuple, IPointable result) throws AlgebricksException {
+                        resultStorage.reset();
+                        eval0.evaluate(tuple, argPtr0);
+
+                        byte[] bytes0 = argPtr0.getByteArray();
+                        int offset0 = argPtr0.getStartOffset();
 
                         try {
-                            if (argOut0.getByteArray()[0] == ATypeTag.SERIALIZED_NULL_TYPE_TAG) {
+                            if (bytes0[offset0] == ATypeTag.SERIALIZED_NULL_TYPE_TAG) {
                                 nullSerde.serialize(ANull.NULL, out);
+                                result.set(resultStorage);
                                 return;
                             }
 
-                            if (argOut0.getByteArray()[0] != ATypeTag.SERIALIZED_DURATION_TYPE_TAG) {
+                            if (bytes0[offset0] != ATypeTag.SERIALIZED_DURATION_TYPE_TAG) {
                                 throw new AlgebricksException(FID.getName() + ": expects NULL/DURATION, but got "
-                                        + EnumDeserializer.ATYPETAGDESERIALIZER.deserialize(argOut0.getByteArray()[0]));
+                                        + EnumDeserializer.ATYPETAGDESERIALIZER.deserialize(bytes0[offset0]));
                             }
 
                             aYearMonthDuration
-                                    .setMonths(ADurationSerializerDeserializer.getYearMonth(argOut0.getByteArray(), 1));
-
+                                    .setMonths(ADurationSerializerDeserializer.getYearMonth(bytes0, offset0 + 1));
                             yearMonthDurationSerde.serialize(aYearMonthDuration, out);
-
                         } catch (HyracksDataException hex) {
                             throw new AlgebricksException(hex);
                         }
+                        result.set(resultStorage);
                     }
                 };
             }
diff --git a/asterix-runtime/src/main/java/org/apache/asterix/runtime/evaluators/functions/temporal/IntervalBinDescriptor.java b/asterix-runtime/src/main/java/org/apache/asterix/runtime/evaluators/functions/temporal/IntervalBinDescriptor.java
index 2e493c5..2160910 100644
--- a/asterix-runtime/src/main/java/org/apache/asterix/runtime/evaluators/functions/temporal/IntervalBinDescriptor.java
+++ b/asterix-runtime/src/main/java/org/apache/asterix/runtime/evaluators/functions/temporal/IntervalBinDescriptor.java
@@ -40,11 +40,13 @@
 import org.apache.asterix.runtime.evaluators.base.AbstractScalarFunctionDynamicDescriptor;
 import org.apache.hyracks.algebricks.common.exceptions.AlgebricksException;
 import org.apache.hyracks.algebricks.core.algebra.functions.FunctionIdentifier;
-import org.apache.hyracks.algebricks.runtime.base.ICopyEvaluator;
-import org.apache.hyracks.algebricks.runtime.base.ICopyEvaluatorFactory;
+import org.apache.hyracks.algebricks.runtime.base.IScalarEvaluator;
+import org.apache.hyracks.algebricks.runtime.base.IScalarEvaluatorFactory;
+import org.apache.hyracks.api.context.IHyracksTaskContext;
 import org.apache.hyracks.api.dataflow.value.ISerializerDeserializer;
 import org.apache.hyracks.api.exceptions.HyracksDataException;
-import org.apache.hyracks.data.std.api.IDataOutputProvider;
+import org.apache.hyracks.data.std.api.IPointable;
+import org.apache.hyracks.data.std.primitive.VoidPointable;
 import org.apache.hyracks.data.std.util.ArrayBackedValueStorage;
 import org.apache.hyracks.dataflow.common.data.accessors.IFrameTupleReference;
 
@@ -60,24 +62,26 @@
     };
 
     @Override
-    public ICopyEvaluatorFactory createEvaluatorFactory(final ICopyEvaluatorFactory[] args) throws AlgebricksException {
-        return new ICopyEvaluatorFactory() {
+    public IScalarEvaluatorFactory createEvaluatorFactory(final IScalarEvaluatorFactory[] args)
+            throws AlgebricksException {
+        return new IScalarEvaluatorFactory() {
 
             private static final long serialVersionUID = 1L;
 
             @Override
-            public ICopyEvaluator createEvaluator(final IDataOutputProvider output) throws AlgebricksException {
-                return new ICopyEvaluator() {
+            public IScalarEvaluator createScalarEvaluator(final IHyracksTaskContext ctx) throws AlgebricksException {
+                return new IScalarEvaluator() {
 
-                    private final DataOutput out = output.getDataOutput();
+                    private final ArrayBackedValueStorage resultStorage = new ArrayBackedValueStorage();
+                    private final DataOutput out = resultStorage.getDataOutput();
 
-                    private final ArrayBackedValueStorage argOut0 = new ArrayBackedValueStorage();
-                    private final ArrayBackedValueStorage argOut1 = new ArrayBackedValueStorage();
-                    private final ArrayBackedValueStorage argOut2 = new ArrayBackedValueStorage();
+                    private final IPointable argPtr0 = new VoidPointable();
+                    private final IPointable argPtr1 = new VoidPointable();
+                    private final IPointable argPtr2 = new VoidPointable();
 
-                    private final ICopyEvaluator eval0 = args[0].createEvaluator(argOut0);
-                    private final ICopyEvaluator eval1 = args[1].createEvaluator(argOut1);
-                    private final ICopyEvaluator eval2 = args[2].createEvaluator(argOut2);
+                    private final IScalarEvaluator eval0 = args[0].createScalarEvaluator(ctx);
+                    private final IScalarEvaluator eval1 = args[1].createScalarEvaluator(ctx);
+                    private final IScalarEvaluator eval2 = args[2].createScalarEvaluator(ctx);
 
                     private final AMutableInterval aInterval = new AMutableInterval(0, 0, (byte) -1);
 
@@ -91,23 +95,25 @@
                     private final GregorianCalendarSystem GREG_CAL = GregorianCalendarSystem.getInstance();
 
                     @Override
-                    public void evaluate(IFrameTupleReference tuple) throws AlgebricksException {
-                        argOut0.reset();
-                        eval0.evaluate(tuple);
+                    public void evaluate(IFrameTupleReference tuple, IPointable result) throws AlgebricksException {
+                        resultStorage.reset();
+                        eval0.evaluate(tuple, argPtr0);
+                        byte[] bytes0 = argPtr0.getByteArray();
+                        int offset0 = argPtr0.getStartOffset();
 
-                        ATypeTag type0 = EnumDeserializer.ATYPETAGDESERIALIZER.deserialize(argOut0.getByteArray()[0]);
+                        ATypeTag type0 = EnumDeserializer.ATYPETAGDESERIALIZER.deserialize(bytes0[offset0]);
 
                         long chrononToBin = 0;
                         switch (type0) {
                             case DATE:
-                                chrononToBin = ADateSerializerDeserializer.getChronon(argOut0.getByteArray(), 1)
+                                chrononToBin = ADateSerializerDeserializer.getChronon(bytes0, offset0 + 1)
                                         * GregorianCalendarSystem.CHRONON_OF_DAY;
                                 break;
                             case TIME:
-                                chrononToBin = ATimeSerializerDeserializer.getChronon(argOut0.getByteArray(), 1);
+                                chrononToBin = ATimeSerializerDeserializer.getChronon(bytes0, offset0 + 1);
                                 break;
                             case DATETIME:
-                                chrononToBin = ADateTimeSerializerDeserializer.getChronon(argOut0.getByteArray(), 1);
+                                chrononToBin = ADateTimeSerializerDeserializer.getChronon(bytes0, offset0 + 1);
                                 break;
                             case NULL:
                                 try {
@@ -115,6 +121,7 @@
                                 } catch (HyracksDataException e) {
                                     throw new AlgebricksException(e);
                                 }
+                                result.set(resultStorage);
                                 return;
                             default:
                                 throw new AlgebricksException(getIdentifier().getName()
@@ -122,28 +129,29 @@
 
                         }
 
-                        argOut1.reset();
-                        eval1.evaluate(tuple);
-
-                        ATypeTag type1 = EnumDeserializer.ATYPETAGDESERIALIZER.deserialize(argOut1.getByteArray()[0]);
+                        eval1.evaluate(tuple, argPtr1);
+                        byte[] bytes1 = argPtr1.getByteArray();
+                        int offset1 = argPtr1.getStartOffset();
+                        ATypeTag type1 = EnumDeserializer.ATYPETAGDESERIALIZER.deserialize(bytes1[offset1]);
 
                         if (type0 != type1) {
-                            if (type0 != ATypeTag.NULL && type1 != ATypeTag.NULL)
+                            if (type0 != ATypeTag.NULL && type1 != ATypeTag.NULL) {
                                 throw new AlgebricksException(getIdentifier().getName() + ": expecting " + type0
                                         + " for the second argument but got " + type1);
+                            }
                         }
 
                         long chrononToStart = 0;
                         switch (type1) {
                             case DATE:
-                                chrononToStart = ADateSerializerDeserializer.getChronon(argOut1.getByteArray(), 1)
+                                chrononToStart = ADateSerializerDeserializer.getChronon(bytes1, offset1 + 1)
                                         * GregorianCalendarSystem.CHRONON_OF_DAY;
                                 break;
                             case TIME:
-                                chrononToStart = ATimeSerializerDeserializer.getChronon(argOut1.getByteArray(), 1);
+                                chrononToStart = ATimeSerializerDeserializer.getChronon(bytes1, offset1 + 1);
                                 break;
                             case DATETIME:
-                                chrononToStart = ADateTimeSerializerDeserializer.getChronon(argOut1.getByteArray(), 1);
+                                chrononToStart = ADateTimeSerializerDeserializer.getChronon(bytes1, offset1 + 1);
                                 break;
                             case NULL:
                                 try {
@@ -151,26 +159,24 @@
                                 } catch (HyracksDataException e) {
                                     throw new AlgebricksException(e);
                                 }
+                                result.set(resultStorage);
                                 return;
                             default:
                                 throw new AlgebricksException(getIdentifier().getName() + ": expecting " + type0
                                         + " for the second argument but got " + type1);
                         }
 
-                        argOut2.reset();
-                        eval2.evaluate(tuple);
-
-                        ATypeTag type2 = EnumDeserializer.ATYPETAGDESERIALIZER.deserialize(argOut2.getByteArray()[0]);
+                        eval2.evaluate(tuple, argPtr2);
+                        byte[] bytes2 = argPtr2.getByteArray();
+                        int offset2 = argPtr2.getStartOffset();
+                        ATypeTag type2 = EnumDeserializer.ATYPETAGDESERIALIZER.deserialize(bytes2[offset2]);
 
                         int yearMonth = 0;
                         long dayTime = 0;
                         long binIndex, binStartChronon, binEndChronon;
                         switch (type2) {
                             case YEARMONTHDURATION:
-
-                                yearMonth = AYearMonthDurationSerializerDeserializer
-                                        .getYearMonth(argOut2.getByteArray(), 1);
-
+                                yearMonth = AYearMonthDurationSerializerDeserializer.getYearMonth(bytes2, offset2 + 1);
                                 int yearStart = GREG_CAL.getYear(chrononToStart);
                                 int monthStart = GREG_CAL.getMonthOfYear(chrononToStart, yearStart);
                                 int yearToBin = GREG_CAL.getYear(chrononToBin);
@@ -194,8 +200,7 @@
                                 break;
 
                             case DAYTIMEDURATION:
-                                dayTime = ADayTimeDurationSerializerDeserializer.getDayTime(argOut2.getByteArray(), 1);
-
+                                dayTime = ADayTimeDurationSerializerDeserializer.getDayTime(bytes2, offset2 + 1);
                                 long totalChronon = chrononToBin - chrononToStart;
 
                                 binIndex = totalChronon / dayTime
@@ -208,6 +213,7 @@
                                 } catch (HyracksDataException e) {
                                     throw new AlgebricksException(e);
                                 }
+                                result.set(resultStorage);
                                 return;
                             default:
                                 throw new AlgebricksException(getIdentifier().getName()
@@ -253,6 +259,7 @@
                                 } catch (HyracksDataException e) {
                                     throw new AlgebricksException(e);
                                 }
+                                result.set(resultStorage);
                                 return;
                             default:
                                 throw new AlgebricksException(getIdentifier().getName()
@@ -262,10 +269,10 @@
                         try {
                             aInterval.setValue(binStartChronon, binEndChronon, type0.serialize());
                             intervalSerde.serialize(aInterval, out);
-                            return;
                         } catch (HyracksDataException ex) {
                             throw new AlgebricksException(ex);
                         }
+                        result.set(resultStorage);
                     }
                 };
             }
diff --git a/asterix-runtime/src/main/java/org/apache/asterix/runtime/evaluators/functions/temporal/MillisecondsFromDayTimeDurationDescriptor.java b/asterix-runtime/src/main/java/org/apache/asterix/runtime/evaluators/functions/temporal/MillisecondsFromDayTimeDurationDescriptor.java
index a16c59a..4b1fedd 100644
--- a/asterix-runtime/src/main/java/org/apache/asterix/runtime/evaluators/functions/temporal/MillisecondsFromDayTimeDurationDescriptor.java
+++ b/asterix-runtime/src/main/java/org/apache/asterix/runtime/evaluators/functions/temporal/MillisecondsFromDayTimeDurationDescriptor.java
@@ -34,11 +34,13 @@
 import org.apache.asterix.runtime.evaluators.base.AbstractScalarFunctionDynamicDescriptor;
 import org.apache.hyracks.algebricks.common.exceptions.AlgebricksException;
 import org.apache.hyracks.algebricks.core.algebra.functions.FunctionIdentifier;
-import org.apache.hyracks.algebricks.runtime.base.ICopyEvaluator;
-import org.apache.hyracks.algebricks.runtime.base.ICopyEvaluatorFactory;
+import org.apache.hyracks.algebricks.runtime.base.IScalarEvaluator;
+import org.apache.hyracks.algebricks.runtime.base.IScalarEvaluatorFactory;
+import org.apache.hyracks.api.context.IHyracksTaskContext;
 import org.apache.hyracks.api.dataflow.value.ISerializerDeserializer;
 import org.apache.hyracks.api.exceptions.HyracksDataException;
-import org.apache.hyracks.data.std.api.IDataOutputProvider;
+import org.apache.hyracks.data.std.api.IPointable;
+import org.apache.hyracks.data.std.primitive.VoidPointable;
 import org.apache.hyracks.data.std.util.ArrayBackedValueStorage;
 import org.apache.hyracks.dataflow.common.data.accessors.IFrameTupleReference;
 
@@ -54,18 +56,20 @@
     };
 
     @Override
-    public ICopyEvaluatorFactory createEvaluatorFactory(final ICopyEvaluatorFactory[] args) throws AlgebricksException {
-        return new ICopyEvaluatorFactory() {
+    public IScalarEvaluatorFactory createEvaluatorFactory(final IScalarEvaluatorFactory[] args)
+            throws AlgebricksException {
+        return new IScalarEvaluatorFactory() {
 
             private static final long serialVersionUID = 1L;
 
             @Override
-            public ICopyEvaluator createEvaluator(final IDataOutputProvider output) throws AlgebricksException {
-                return new ICopyEvaluator() {
+            public IScalarEvaluator createScalarEvaluator(final IHyracksTaskContext ctx) throws AlgebricksException {
+                return new IScalarEvaluator() {
 
-                    private DataOutput out = output.getDataOutput();
-                    private ArrayBackedValueStorage argOut0 = new ArrayBackedValueStorage();
-                    private ICopyEvaluator eval0 = args[0].createEvaluator(argOut0);
+                    private ArrayBackedValueStorage resultStorage = new ArrayBackedValueStorage();
+                    private DataOutput out = resultStorage.getDataOutput();
+                    private IPointable argPtr0 = new VoidPointable();
+                    private IScalarEvaluator eval0 = args[0].createScalarEvaluator(ctx);
 
                     // possible output types
                     @SuppressWarnings("unchecked")
@@ -78,30 +82,32 @@
                     AMutableInt64 aInt64 = new AMutableInt64(0);
 
                     @Override
-                    public void evaluate(IFrameTupleReference tuple) throws AlgebricksException {
-                        argOut0.reset();
-                        eval0.evaluate(tuple);
+                    public void evaluate(IFrameTupleReference tuple, IPointable result) throws AlgebricksException {
+                        resultStorage.reset();
+                        eval0.evaluate(tuple, argPtr0);
+
+                        byte[] bytes = argPtr0.getByteArray();
+                        int offset = argPtr0.getStartOffset();
 
                         try {
-                            if (argOut0.getByteArray()[0] == ATypeTag.SERIALIZED_NULL_TYPE_TAG) {
+                            if (bytes[offset] == ATypeTag.SERIALIZED_NULL_TYPE_TAG) {
                                 nullSerde.serialize(ANull.NULL, out);
+                                result.set(resultStorage);
                                 return;
                             }
 
-                            if (argOut0.getByteArray()[0] != ATypeTag.SERIALIZED_DAY_TIME_DURATION_TYPE_TAG) {
-                                throw new AlgebricksException(FID.getName()
-                                        + ": expects NULL/DAY-TIME-DURATION, but got "
-                                        + EnumDeserializer.ATYPETAGDESERIALIZER.deserialize(argOut0.getByteArray()[0]));
+                            if (bytes[offset] != ATypeTag.SERIALIZED_DAY_TIME_DURATION_TYPE_TAG) {
+                                throw new AlgebricksException(
+                                        FID.getName() + ": expects NULL/DAY-TIME-DURATION, but got "
+                                                + EnumDeserializer.ATYPETAGDESERIALIZER.deserialize(bytes[offset]));
                             }
 
-                            aInt64.setValue(
-                                    ADayTimeDurationSerializerDeserializer.getDayTime(argOut0.getByteArray(), 1));
-
+                            aInt64.setValue(ADayTimeDurationSerializerDeserializer.getDayTime(bytes, offset + 1));
                             int64Serde.serialize(aInt64, out);
-
                         } catch (HyracksDataException hex) {
                             throw new AlgebricksException(hex);
                         }
+                        result.set(resultStorage);
                     }
                 };
             }
diff --git a/asterix-runtime/src/main/java/org/apache/asterix/runtime/evaluators/functions/temporal/MonthsFromYearMonthDurationDescriptor.java b/asterix-runtime/src/main/java/org/apache/asterix/runtime/evaluators/functions/temporal/MonthsFromYearMonthDurationDescriptor.java
index e7c7863..d7198f1 100644
--- a/asterix-runtime/src/main/java/org/apache/asterix/runtime/evaluators/functions/temporal/MonthsFromYearMonthDurationDescriptor.java
+++ b/asterix-runtime/src/main/java/org/apache/asterix/runtime/evaluators/functions/temporal/MonthsFromYearMonthDurationDescriptor.java
@@ -34,11 +34,13 @@
 import org.apache.asterix.runtime.evaluators.base.AbstractScalarFunctionDynamicDescriptor;
 import org.apache.hyracks.algebricks.common.exceptions.AlgebricksException;
 import org.apache.hyracks.algebricks.core.algebra.functions.FunctionIdentifier;
-import org.apache.hyracks.algebricks.runtime.base.ICopyEvaluator;
-import org.apache.hyracks.algebricks.runtime.base.ICopyEvaluatorFactory;
+import org.apache.hyracks.algebricks.runtime.base.IScalarEvaluator;
+import org.apache.hyracks.algebricks.runtime.base.IScalarEvaluatorFactory;
+import org.apache.hyracks.api.context.IHyracksTaskContext;
 import org.apache.hyracks.api.dataflow.value.ISerializerDeserializer;
 import org.apache.hyracks.api.exceptions.HyracksDataException;
-import org.apache.hyracks.data.std.api.IDataOutputProvider;
+import org.apache.hyracks.data.std.api.IPointable;
+import org.apache.hyracks.data.std.primitive.VoidPointable;
 import org.apache.hyracks.data.std.util.ArrayBackedValueStorage;
 import org.apache.hyracks.dataflow.common.data.accessors.IFrameTupleReference;
 
@@ -54,18 +56,20 @@
     };
 
     @Override
-    public ICopyEvaluatorFactory createEvaluatorFactory(final ICopyEvaluatorFactory[] args) throws AlgebricksException {
-        return new ICopyEvaluatorFactory() {
+    public IScalarEvaluatorFactory createEvaluatorFactory(final IScalarEvaluatorFactory[] args)
+            throws AlgebricksException {
+        return new IScalarEvaluatorFactory() {
 
             private static final long serialVersionUID = 1L;
 
             @Override
-            public ICopyEvaluator createEvaluator(final IDataOutputProvider output) throws AlgebricksException {
-                return new ICopyEvaluator() {
+            public IScalarEvaluator createScalarEvaluator(final IHyracksTaskContext ctx) throws AlgebricksException {
+                return new IScalarEvaluator() {
 
-                    private DataOutput out = output.getDataOutput();
-                    private ArrayBackedValueStorage argOut0 = new ArrayBackedValueStorage();
-                    private ICopyEvaluator eval0 = args[0].createEvaluator(argOut0);
+                    private ArrayBackedValueStorage resultStorage = new ArrayBackedValueStorage();
+                    private DataOutput out = resultStorage.getDataOutput();
+                    private IPointable argPtr0 = new VoidPointable();
+                    private IScalarEvaluator eval0 = args[0].createScalarEvaluator(ctx);
 
                     // possible output types
                     @SuppressWarnings("unchecked")
@@ -78,30 +82,32 @@
                     AMutableInt64 aInt64 = new AMutableInt64(0);
 
                     @Override
-                    public void evaluate(IFrameTupleReference tuple) throws AlgebricksException {
-                        argOut0.reset();
-                        eval0.evaluate(tuple);
+                    public void evaluate(IFrameTupleReference tuple, IPointable result) throws AlgebricksException {
+                        resultStorage.reset();;
+                        eval0.evaluate(tuple, argPtr0);
+
+                        byte[] bytes = argPtr0.getByteArray();
+                        int offset = argPtr0.getStartOffset();
 
                         try {
-                            if (argOut0.getByteArray()[0] == ATypeTag.SERIALIZED_NULL_TYPE_TAG) {
+                            if (bytes[offset] == ATypeTag.SERIALIZED_NULL_TYPE_TAG) {
                                 nullSerde.serialize(ANull.NULL, out);
+                                result.set(resultStorage);
                                 return;
                             }
 
-                            if (argOut0.getByteArray()[0] != ATypeTag.SERIALIZED_YEAR_MONTH_DURATION_TYPE_TAG) {
-                                throw new AlgebricksException(FID.getName()
-                                        + ": expects NULL/YEAR-MONTH-DURATION, but got "
-                                        + EnumDeserializer.ATYPETAGDESERIALIZER.deserialize(argOut0.getByteArray()[0]));
+                            if (bytes[offset] != ATypeTag.SERIALIZED_YEAR_MONTH_DURATION_TYPE_TAG) {
+                                throw new AlgebricksException(
+                                        FID.getName() + ": expects NULL/YEAR-MONTH-DURATION, but got "
+                                                + EnumDeserializer.ATYPETAGDESERIALIZER.deserialize(bytes[offset]));
                             }
 
-                            aInt64.setValue(
-                                    AYearMonthDurationSerializerDeserializer.getYearMonth(argOut0.getByteArray(), 1));
-
+                            aInt64.setValue(AYearMonthDurationSerializerDeserializer.getYearMonth(bytes, offset + 1));
                             int64Serde.serialize(aInt64, out);
-
                         } catch (HyracksDataException hex) {
                             throw new AlgebricksException(hex);
                         }
+                        result.set(resultStorage);
                     }
                 };
             }
diff --git a/asterix-runtime/src/main/java/org/apache/asterix/runtime/evaluators/functions/temporal/OverlapBinsDescriptor.java b/asterix-runtime/src/main/java/org/apache/asterix/runtime/evaluators/functions/temporal/OverlapBinsDescriptor.java
index 917f7c3..fcf22e4 100644
--- a/asterix-runtime/src/main/java/org/apache/asterix/runtime/evaluators/functions/temporal/OverlapBinsDescriptor.java
+++ b/asterix-runtime/src/main/java/org/apache/asterix/runtime/evaluators/functions/temporal/OverlapBinsDescriptor.java
@@ -44,11 +44,13 @@
 import org.apache.asterix.runtime.evaluators.base.AbstractScalarFunctionDynamicDescriptor;
 import org.apache.hyracks.algebricks.common.exceptions.AlgebricksException;
 import org.apache.hyracks.algebricks.core.algebra.functions.FunctionIdentifier;
-import org.apache.hyracks.algebricks.runtime.base.ICopyEvaluator;
-import org.apache.hyracks.algebricks.runtime.base.ICopyEvaluatorFactory;
+import org.apache.hyracks.algebricks.runtime.base.IScalarEvaluator;
+import org.apache.hyracks.algebricks.runtime.base.IScalarEvaluatorFactory;
+import org.apache.hyracks.api.context.IHyracksTaskContext;
 import org.apache.hyracks.api.dataflow.value.ISerializerDeserializer;
 import org.apache.hyracks.api.exceptions.HyracksDataException;
-import org.apache.hyracks.data.std.api.IDataOutputProvider;
+import org.apache.hyracks.data.std.api.IPointable;
+import org.apache.hyracks.data.std.primitive.VoidPointable;
 import org.apache.hyracks.data.std.util.ArrayBackedValueStorage;
 import org.apache.hyracks.dataflow.common.data.accessors.IFrameTupleReference;
 
@@ -64,24 +66,26 @@
     };
 
     @Override
-    public ICopyEvaluatorFactory createEvaluatorFactory(final ICopyEvaluatorFactory[] args) throws AlgebricksException {
-        return new ICopyEvaluatorFactory() {
+    public IScalarEvaluatorFactory createEvaluatorFactory(final IScalarEvaluatorFactory[] args)
+            throws AlgebricksException {
+        return new IScalarEvaluatorFactory() {
 
             private static final long serialVersionUID = 1L;
 
             @Override
-            public ICopyEvaluator createEvaluator(final IDataOutputProvider output) throws AlgebricksException {
-                return new ICopyEvaluator() {
+            public IScalarEvaluator createScalarEvaluator(final IHyracksTaskContext ctx) throws AlgebricksException {
+                return new IScalarEvaluator() {
 
-                    private final DataOutput out = output.getDataOutput();
+                    private final ArrayBackedValueStorage resultStorage = new ArrayBackedValueStorage();
+                    private final DataOutput out = resultStorage.getDataOutput();
 
-                    private final ArrayBackedValueStorage argOut0 = new ArrayBackedValueStorage();
-                    private final ArrayBackedValueStorage argOut1 = new ArrayBackedValueStorage();
-                    private final ArrayBackedValueStorage argOut2 = new ArrayBackedValueStorage();
+                    private final IPointable argPtr0 = new VoidPointable();
+                    private final IPointable argPtr1 = new VoidPointable();
+                    private final IPointable argPtr2 = new VoidPointable();
 
-                    private final ICopyEvaluator eval0 = args[0].createEvaluator(argOut0);
-                    private final ICopyEvaluator eval1 = args[1].createEvaluator(argOut1);
-                    private final ICopyEvaluator eval2 = args[2].createEvaluator(argOut2);
+                    private final IScalarEvaluator eval0 = args[0].createScalarEvaluator(ctx);
+                    private final IScalarEvaluator eval1 = args[1].createScalarEvaluator(ctx);
+                    private final IScalarEvaluator eval2 = args[2].createScalarEvaluator(ctx);
 
                     // for output
                     private OrderedListBuilder listBuilder = new OrderedListBuilder();
@@ -100,26 +104,28 @@
                     private final GregorianCalendarSystem GREG_CAL = GregorianCalendarSystem.getInstance();
 
                     @Override
-                    public void evaluate(IFrameTupleReference tuple) throws AlgebricksException {
-                        argOut0.reset();
-                        eval0.evaluate(tuple);
+                    public void evaluate(IFrameTupleReference tuple, IPointable result) throws AlgebricksException {
+                        resultStorage.reset();
+                        eval0.evaluate(tuple, argPtr0);
+                        byte[] bytes0 = argPtr0.getByteArray();
+                        int offset0 = argPtr0.getStartOffset();
 
-                        ATypeTag type0 = EnumDeserializer.ATYPETAGDESERIALIZER.deserialize(argOut0.getByteArray()[0]);
+                        ATypeTag type0 = EnumDeserializer.ATYPETAGDESERIALIZER.deserialize(bytes0[offset0]);
 
                         long intervalStart = 0, intervalEnd = 0;
                         byte intervalTypeTag;
 
                         if (type0 == ATypeTag.INTERVAL) {
-                            intervalStart = AIntervalSerializerDeserializer.getIntervalStart(argOut0.getByteArray(), 1);
-                            intervalEnd = AIntervalSerializerDeserializer.getIntervalEnd(argOut0.getByteArray(), 1);
-                            intervalTypeTag = AIntervalSerializerDeserializer
-                                    .getIntervalTimeType(argOut0.getByteArray(), 1);
+                            intervalStart = AIntervalSerializerDeserializer.getIntervalStart(bytes0, offset0 + 1);
+                            intervalEnd = AIntervalSerializerDeserializer.getIntervalEnd(bytes0, offset0 + 1);
+                            intervalTypeTag = AIntervalSerializerDeserializer.getIntervalTimeType(bytes0, offset0 + 1);
                         } else if (type0 == ATypeTag.NULL) {
                             try {
                                 nullSerde.serialize(ANull.NULL, out);
                             } catch (HyracksDataException e) {
                                 throw new AlgebricksException(e);
                             }
+                            result.set(resultStorage);
                             return;
                         } else {
                             throw new AlgebricksException(getIdentifier().getName()
@@ -127,29 +133,31 @@
                         }
 
                         // get the anchor instance time
-                        argOut1.reset();
-                        eval1.evaluate(tuple);
+                        eval1.evaluate(tuple, argPtr1);
+                        byte[] bytes1 = argPtr1.getByteArray();
+                        int offset1 = argPtr1.getStartOffset();
 
-                        ATypeTag type1 = EnumDeserializer.ATYPETAGDESERIALIZER.deserialize(argOut1.getByteArray()[0]);
+                        ATypeTag type1 = EnumDeserializer.ATYPETAGDESERIALIZER.deserialize(bytes1[offset1]);
 
                         if (intervalTypeTag != type1.serialize()) {
-                            if (intervalTypeTag != ATypeTag.SERIALIZED_NULL_TYPE_TAG && type1 != ATypeTag.NULL)
+                            if (intervalTypeTag != ATypeTag.SERIALIZED_NULL_TYPE_TAG && type1 != ATypeTag.NULL) {
                                 throw new AlgebricksException(
                                         getIdentifier().getName() + ": expecting compatible type to " + type0 + "("
                                                 + intervalTypeTag + ") for the second argument but got " + type1);
+                            }
                         }
 
                         long anchorTime = 0;
                         switch (type1) {
                             case DATE:
-                                anchorTime = ADateSerializerDeserializer.getChronon(argOut1.getByteArray(), 1)
+                                anchorTime = ADateSerializerDeserializer.getChronon(bytes1, offset1 + 1)
                                         * GregorianCalendarSystem.CHRONON_OF_DAY;
                                 break;
                             case TIME:
-                                anchorTime = ATimeSerializerDeserializer.getChronon(argOut1.getByteArray(), 1);
+                                anchorTime = ATimeSerializerDeserializer.getChronon(bytes1, offset1 + 1);
                                 break;
                             case DATETIME:
-                                anchorTime = ADateTimeSerializerDeserializer.getChronon(argOut1.getByteArray(), 1);
+                                anchorTime = ADateTimeSerializerDeserializer.getChronon(bytes1, offset1 + 1);
                                 break;
                             case NULL:
                                 try {
@@ -157,6 +165,7 @@
                                 } catch (HyracksDataException e) {
                                     throw new AlgebricksException(e);
                                 }
+                                result.set(resultStorage);
                                 return;
                             default:
                                 throw new AlgebricksException(
@@ -164,18 +173,18 @@
                                                 + intervalTypeTag + ") for the second argument but got " + type1);
                         }
 
-                        argOut2.reset();
-                        eval2.evaluate(tuple);
+                        eval2.evaluate(tuple, argPtr2);
+                        byte[] bytes2 = argPtr2.getByteArray();
+                        int offset2 = argPtr2.getStartOffset();
 
-                        ATypeTag type2 = EnumDeserializer.ATYPETAGDESERIALIZER.deserialize(argOut2.getByteArray()[0]);
+                        ATypeTag type2 = EnumDeserializer.ATYPETAGDESERIALIZER.deserialize(bytes2[offset2]);
 
                         int yearMonth = 0;
                         long dayTime = 0;
                         long firstBinIndex;
                         switch (type2) {
                             case YEARMONTHDURATION:
-                                yearMonth = AYearMonthDurationSerializerDeserializer
-                                        .getYearMonth(argOut2.getByteArray(), 1);
+                                yearMonth = AYearMonthDurationSerializerDeserializer.getYearMonth(bytes2, offset2 + 1);
 
                                 int yearStart = GREG_CAL.getYear(anchorTime);
                                 int monthStart = GREG_CAL.getMonthOfYear(anchorTime, yearStart);
@@ -199,7 +208,7 @@
                                 break;
 
                             case DAYTIMEDURATION:
-                                dayTime = ADayTimeDurationSerializerDeserializer.getDayTime(argOut2.getByteArray(), 1);
+                                dayTime = ADayTimeDurationSerializerDeserializer.getDayTime(bytes2, offset2 + 1);
 
                                 long totalChronon = intervalStart - anchorTime;
 
@@ -213,6 +222,7 @@
                                 } catch (HyracksDataException e) {
                                     throw new AlgebricksException(e);
                                 }
+                                result.set(resultStorage);
                                 return;
 
                             default:
@@ -317,12 +327,11 @@
                                 throw new AlgebricksException(getIdentifier().getName()
                                         + ": the first argument should be DATE/TIME/DATETIME/NULL but got " + type0);
                             }
-
                             listBuilder.write(out, true);
                         } catch (IOException e1) {
                             throw new AlgebricksException(e1.getMessage());
                         }
-
+                        result.set(resultStorage);
                     }
                 };
             }
diff --git a/asterix-runtime/src/main/java/org/apache/asterix/runtime/evaluators/functions/temporal/ParseDateDescriptor.java b/asterix-runtime/src/main/java/org/apache/asterix/runtime/evaluators/functions/temporal/ParseDateDescriptor.java
index d4c93ff..1243394 100644
--- a/asterix-runtime/src/main/java/org/apache/asterix/runtime/evaluators/functions/temporal/ParseDateDescriptor.java
+++ b/asterix-runtime/src/main/java/org/apache/asterix/runtime/evaluators/functions/temporal/ParseDateDescriptor.java
@@ -37,12 +37,14 @@
 import org.apache.asterix.runtime.evaluators.base.AbstractScalarFunctionDynamicDescriptor;
 import org.apache.hyracks.algebricks.common.exceptions.AlgebricksException;
 import org.apache.hyracks.algebricks.core.algebra.functions.FunctionIdentifier;
-import org.apache.hyracks.algebricks.runtime.base.ICopyEvaluator;
-import org.apache.hyracks.algebricks.runtime.base.ICopyEvaluatorFactory;
+import org.apache.hyracks.algebricks.runtime.base.IScalarEvaluator;
+import org.apache.hyracks.algebricks.runtime.base.IScalarEvaluatorFactory;
+import org.apache.hyracks.api.context.IHyracksTaskContext;
 import org.apache.hyracks.api.dataflow.value.ISerializerDeserializer;
 import org.apache.hyracks.api.exceptions.HyracksDataException;
-import org.apache.hyracks.data.std.api.IDataOutputProvider;
+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.data.std.util.ArrayBackedValueStorage;
 import org.apache.hyracks.dataflow.common.data.accessors.IFrameTupleReference;
 
@@ -63,20 +65,22 @@
     };
 
     @Override
-    public ICopyEvaluatorFactory createEvaluatorFactory(final ICopyEvaluatorFactory[] args) throws AlgebricksException {
-        return new ICopyEvaluatorFactory() {
+    public IScalarEvaluatorFactory createEvaluatorFactory(final IScalarEvaluatorFactory[] args)
+            throws AlgebricksException {
+        return new IScalarEvaluatorFactory() {
 
             private static final long serialVersionUID = 1L;
 
             @Override
-            public ICopyEvaluator createEvaluator(final IDataOutputProvider output) throws AlgebricksException {
-                return new ICopyEvaluator() {
+            public IScalarEvaluator createScalarEvaluator(final IHyracksTaskContext ctx) throws AlgebricksException {
+                return new IScalarEvaluator() {
 
-                    private DataOutput out = output.getDataOutput();
-                    private ArrayBackedValueStorage argOut0 = new ArrayBackedValueStorage();
-                    private ArrayBackedValueStorage argOut1 = new ArrayBackedValueStorage();
-                    private ICopyEvaluator eval0 = args[0].createEvaluator(argOut0);
-                    private ICopyEvaluator eval1 = args[1].createEvaluator(argOut1);
+                    private ArrayBackedValueStorage resultStorage = new ArrayBackedValueStorage();
+                    private DataOutput out = resultStorage.getDataOutput();
+                    private IPointable argPtr0 = new VoidPointable();
+                    private IPointable argPtr1 = new VoidPointable();
+                    private IScalarEvaluator eval0 = args[0].createScalarEvaluator(ctx);
+                    private IScalarEvaluator eval1 = args[1].createScalarEvaluator(ctx);
 
                     @SuppressWarnings("unchecked")
                     private ISerializerDeserializer<ANull> nullSerde = AqlSerializerDeserializerProvider.INSTANCE
@@ -89,34 +93,38 @@
                     private final UTF8StringPointable utf8Ptr = new UTF8StringPointable();
 
                     @Override
-                    public void evaluate(IFrameTupleReference tuple) throws AlgebricksException {
-                        argOut0.reset();
-                        eval0.evaluate(tuple);
-                        argOut1.reset();
-                        eval1.evaluate(tuple);
+                    public void evaluate(IFrameTupleReference tuple, IPointable result) throws AlgebricksException {
+                        resultStorage.reset();
+                        eval0.evaluate(tuple, argPtr0);
+                        eval1.evaluate(tuple, argPtr1);
+
+                        byte[] bytes0 = argPtr0.getByteArray();
+                        int offset0 = argPtr0.getStartOffset();
+                        int len0 = argPtr0.getLength();
+                        byte[] bytes1 = argPtr1.getByteArray();
+                        int offset1 = argPtr1.getStartOffset();
+                        int len1 = argPtr1.getLength();
 
                         try {
-                            if (argOut0.getByteArray()[0] == ATypeTag.SERIALIZED_NULL_TYPE_TAG
-                                    || argOut1.getByteArray()[0] == ATypeTag.SERIALIZED_NULL_TYPE_TAG) {
+                            if (bytes0[offset0] == ATypeTag.SERIALIZED_NULL_TYPE_TAG
+                                    || bytes1[offset1] == ATypeTag.SERIALIZED_NULL_TYPE_TAG) {
                                 nullSerde.serialize(ANull.NULL, out);
+                                result.set(resultStorage);
                                 return;
                             }
 
-                            if (argOut0.getByteArray()[0] != ATypeTag.SERIALIZED_STRING_TYPE_TAG
-                                    || argOut1.getByteArray()[0] != ATypeTag.SERIALIZED_STRING_TYPE_TAG) {
-                                throw new AlgebricksException(
-                                        getIdentifier().getName() + ": expects two strings but got  ("
-                                                + EnumDeserializer.ATYPETAGDESERIALIZER.deserialize(
-                                                        argOut0.getByteArray()[0])
-                                                + ", " + EnumDeserializer.ATYPETAGDESERIALIZER
-                                                        .deserialize(argOut1.getByteArray()[0])
-                                                + ")");
+                            if (bytes0[offset0] != ATypeTag.SERIALIZED_STRING_TYPE_TAG
+                                    || bytes1[offset1] != ATypeTag.SERIALIZED_STRING_TYPE_TAG) {
+                                throw new AlgebricksException(getIdentifier().getName()
+                                        + ": expects two strings but got  ("
+                                        + EnumDeserializer.ATYPETAGDESERIALIZER.deserialize(bytes0[offset0]) + ", "
+                                        + EnumDeserializer.ATYPETAGDESERIALIZER.deserialize(bytes1[offset1]) + ")");
                             }
-                            utf8Ptr.set(argOut0.getByteArray(), 1, argOut0.getLength() - 1);
+                            utf8Ptr.set(bytes0, offset0 + 1, len0 - 1);
                             int start0 = utf8Ptr.getCharStartOffset();
                             int length0 = utf8Ptr.getUTF8Length();
 
-                            utf8Ptr.set(argOut1.getByteArray(), 1, argOut1.getLength() - 1);
+                            utf8Ptr.set(bytes1, offset1 + 1, len1 - 1);
                             int start1 = utf8Ptr.getCharStartOffset();
                             int length1 = utf8Ptr.getUTF8Length();
                             long chronon = 0;
@@ -128,14 +136,13 @@
                                 // search for "|"
                                 formatLength = 0;
                                 for (; formatStart + formatLength < start1 + length1; formatLength++) {
-                                    if (argOut1.getByteArray()[formatStart + formatLength] == '|') {
+                                    if (argPtr1.getByteArray()[formatStart + formatLength] == '|') {
                                         break;
                                     }
                                 }
                                 try {
-                                    chronon = DT_UTILS.parseDateTime(argOut0.getByteArray(), start0, length0,
-                                            argOut1.getByteArray(), formatStart, formatLength,
-                                            DateTimeParseMode.DATE_ONLY);
+                                    chronon = DT_UTILS.parseDateTime(bytes0, start0, length0, bytes1, formatStart,
+                                            formatLength, DateTimeParseMode.DATE_ONLY);
                                 } catch (AsterixTemporalTypeParseException ex) {
                                     formatStart += formatLength + 1;
                                     continue;
@@ -150,10 +157,10 @@
 
                             aDate.setValue((int) (chronon / GregorianCalendarSystem.CHRONON_OF_DAY));
                             dateSerde.serialize(aDate, out);
-
                         } catch (HyracksDataException ex) {
                             throw new AlgebricksException(ex);
                         }
+                        result.set(resultStorage);
                     }
                 };
             }
diff --git a/asterix-runtime/src/main/java/org/apache/asterix/runtime/evaluators/functions/temporal/ParseDateTimeDescriptor.java b/asterix-runtime/src/main/java/org/apache/asterix/runtime/evaluators/functions/temporal/ParseDateTimeDescriptor.java
index bdd0783..7c8847a 100644
--- a/asterix-runtime/src/main/java/org/apache/asterix/runtime/evaluators/functions/temporal/ParseDateTimeDescriptor.java
+++ b/asterix-runtime/src/main/java/org/apache/asterix/runtime/evaluators/functions/temporal/ParseDateTimeDescriptor.java
@@ -36,12 +36,14 @@
 import org.apache.asterix.runtime.evaluators.base.AbstractScalarFunctionDynamicDescriptor;
 import org.apache.hyracks.algebricks.common.exceptions.AlgebricksException;
 import org.apache.hyracks.algebricks.core.algebra.functions.FunctionIdentifier;
-import org.apache.hyracks.algebricks.runtime.base.ICopyEvaluator;
-import org.apache.hyracks.algebricks.runtime.base.ICopyEvaluatorFactory;
+import org.apache.hyracks.algebricks.runtime.base.IScalarEvaluator;
+import org.apache.hyracks.algebricks.runtime.base.IScalarEvaluatorFactory;
+import org.apache.hyracks.api.context.IHyracksTaskContext;
 import org.apache.hyracks.api.dataflow.value.ISerializerDeserializer;
 import org.apache.hyracks.api.exceptions.HyracksDataException;
-import org.apache.hyracks.data.std.api.IDataOutputProvider;
+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.data.std.util.ArrayBackedValueStorage;
 import org.apache.hyracks.dataflow.common.data.accessors.IFrameTupleReference;
 
@@ -58,20 +60,22 @@
     };
 
     @Override
-    public ICopyEvaluatorFactory createEvaluatorFactory(final ICopyEvaluatorFactory[] args) throws AlgebricksException {
-        return new ICopyEvaluatorFactory() {
+    public IScalarEvaluatorFactory createEvaluatorFactory(final IScalarEvaluatorFactory[] args)
+            throws AlgebricksException {
+        return new IScalarEvaluatorFactory() {
 
             private static final long serialVersionUID = 1L;
 
             @Override
-            public ICopyEvaluator createEvaluator(final IDataOutputProvider output) throws AlgebricksException {
-                return new ICopyEvaluator() {
+            public IScalarEvaluator createScalarEvaluator(final IHyracksTaskContext ctx) throws AlgebricksException {
+                return new IScalarEvaluator() {
 
-                    private DataOutput out = output.getDataOutput();
-                    private ArrayBackedValueStorage argOut0 = new ArrayBackedValueStorage();
-                    private ArrayBackedValueStorage argOut1 = new ArrayBackedValueStorage();
-                    private ICopyEvaluator eval0 = args[0].createEvaluator(argOut0);
-                    private ICopyEvaluator eval1 = args[1].createEvaluator(argOut1);
+                    private ArrayBackedValueStorage resultStorage = new ArrayBackedValueStorage();
+                    private DataOutput out = resultStorage.getDataOutput();
+                    private IPointable argPtr0 = new VoidPointable();
+                    private IPointable argPtr1 = new VoidPointable();
+                    private IScalarEvaluator eval0 = args[0].createScalarEvaluator(ctx);
+                    private IScalarEvaluator eval1 = args[1].createScalarEvaluator(ctx);
 
                     @SuppressWarnings("unchecked")
                     private ISerializerDeserializer<ANull> nullSerde = AqlSerializerDeserializerProvider.INSTANCE
@@ -84,34 +88,38 @@
                     private final UTF8StringPointable utf8Ptr = new UTF8StringPointable();
 
                     @Override
-                    public void evaluate(IFrameTupleReference tuple) throws AlgebricksException {
-                        argOut0.reset();
-                        eval0.evaluate(tuple);
-                        argOut1.reset();
-                        eval1.evaluate(tuple);
+                    public void evaluate(IFrameTupleReference tuple, IPointable result) throws AlgebricksException {
+                        resultStorage.reset();
+                        eval0.evaluate(tuple, argPtr0);
+                        eval1.evaluate(tuple, argPtr1);
+
+                        byte[] bytes0 = argPtr0.getByteArray();
+                        int offset0 = argPtr0.getStartOffset();
+                        int len0 = argPtr0.getLength();
+                        byte[] bytes1 = argPtr1.getByteArray();
+                        int offset1 = argPtr1.getStartOffset();
+                        int len1 = argPtr1.getLength();
 
                         try {
-                            if (argOut0.getByteArray()[0] == ATypeTag.SERIALIZED_NULL_TYPE_TAG
-                                    || argOut1.getByteArray()[0] == ATypeTag.SERIALIZED_NULL_TYPE_TAG) {
+                            if (bytes0[offset0] == ATypeTag.SERIALIZED_NULL_TYPE_TAG
+                                    || bytes1[offset1] == ATypeTag.SERIALIZED_NULL_TYPE_TAG) {
                                 nullSerde.serialize(ANull.NULL, out);
+                                result.set(resultStorage);
                                 return;
                             }
 
-                            if (argOut0.getByteArray()[0] != ATypeTag.SERIALIZED_STRING_TYPE_TAG
-                                    || argOut1.getByteArray()[0] != ATypeTag.SERIALIZED_STRING_TYPE_TAG) {
-                                throw new AlgebricksException(
-                                        getIdentifier().getName() + ": expects two strings but got  ("
-                                                + EnumDeserializer.ATYPETAGDESERIALIZER.deserialize(
-                                                        argOut0.getByteArray()[0])
-                                                + ", " + EnumDeserializer.ATYPETAGDESERIALIZER
-                                                        .deserialize(argOut1.getByteArray()[0])
-                                                + ")");
+                            if (bytes0[offset0] != ATypeTag.SERIALIZED_STRING_TYPE_TAG
+                                    || bytes1[offset1] != ATypeTag.SERIALIZED_STRING_TYPE_TAG) {
+                                throw new AlgebricksException(getIdentifier().getName()
+                                        + ": expects two strings but got  ("
+                                        + EnumDeserializer.ATYPETAGDESERIALIZER.deserialize(bytes0[offset0]) + ", "
+                                        + EnumDeserializer.ATYPETAGDESERIALIZER.deserialize(bytes1[offset1]) + ")");
                             }
-                            utf8Ptr.set(argOut0.getByteArray(), 1, argOut0.getLength() - 1);
+                            utf8Ptr.set(bytes0, offset0 + 1, len0 - 1);
                             int start0 = utf8Ptr.getCharStartOffset();
                             int length0 = utf8Ptr.getUTF8Length();
 
-                            utf8Ptr.set(argOut1.getByteArray(), 1, argOut1.getLength() - 1);
+                            utf8Ptr.set(bytes1, offset1 + 1, len1 - 1);
                             int start1 = utf8Ptr.getCharStartOffset();
                             int length1 = utf8Ptr.getUTF8Length();
                             long chronon = 0;
@@ -123,14 +131,13 @@
                                 // search for "|"
                                 formatLength = 0;
                                 for (; formatStart + formatLength < start1 + length1; formatLength++) {
-                                    if (argOut1.getByteArray()[formatStart + formatLength] == '|') {
+                                    if (bytes1[formatStart + formatLength] == '|') {
                                         break;
                                     }
                                 }
                                 try {
-                                    chronon = DT_UTILS.parseDateTime(argOut0.getByteArray(), start0, length0,
-                                            argOut1.getByteArray(), formatStart, formatLength,
-                                            DateTimeParseMode.DATETIME);
+                                    chronon = DT_UTILS.parseDateTime(bytes0, start0, length0, bytes1, formatStart,
+                                            formatLength, DateTimeParseMode.DATETIME);
                                 } catch (AsterixTemporalTypeParseException ex) {
                                     formatStart += formatLength + 1;
                                     continue;
@@ -142,13 +149,12 @@
                                 throw new HyracksDataException(
                                         "parse-datetime: Failed to match with any given format string!");
                             }
-
                             aDateTime.setValue(chronon);
                             datetimeSerde.serialize(aDateTime, out);
-
                         } catch (HyracksDataException ex) {
                             throw new AlgebricksException(ex);
                         }
+                        result.set(resultStorage);
                     }
                 };
             }
diff --git a/asterix-runtime/src/main/java/org/apache/asterix/runtime/evaluators/functions/temporal/ParseTimeDescriptor.java b/asterix-runtime/src/main/java/org/apache/asterix/runtime/evaluators/functions/temporal/ParseTimeDescriptor.java
index db6e8b3..893c357 100644
--- a/asterix-runtime/src/main/java/org/apache/asterix/runtime/evaluators/functions/temporal/ParseTimeDescriptor.java
+++ b/asterix-runtime/src/main/java/org/apache/asterix/runtime/evaluators/functions/temporal/ParseTimeDescriptor.java
@@ -36,12 +36,14 @@
 import org.apache.asterix.runtime.evaluators.base.AbstractScalarFunctionDynamicDescriptor;
 import org.apache.hyracks.algebricks.common.exceptions.AlgebricksException;
 import org.apache.hyracks.algebricks.core.algebra.functions.FunctionIdentifier;
-import org.apache.hyracks.algebricks.runtime.base.ICopyEvaluator;
-import org.apache.hyracks.algebricks.runtime.base.ICopyEvaluatorFactory;
+import org.apache.hyracks.algebricks.runtime.base.IScalarEvaluator;
+import org.apache.hyracks.algebricks.runtime.base.IScalarEvaluatorFactory;
+import org.apache.hyracks.api.context.IHyracksTaskContext;
 import org.apache.hyracks.api.dataflow.value.ISerializerDeserializer;
 import org.apache.hyracks.api.exceptions.HyracksDataException;
-import org.apache.hyracks.data.std.api.IDataOutputProvider;
+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.data.std.util.ArrayBackedValueStorage;
 import org.apache.hyracks.dataflow.common.data.accessors.IFrameTupleReference;
 
@@ -59,20 +61,22 @@
     };
 
     @Override
-    public ICopyEvaluatorFactory createEvaluatorFactory(final ICopyEvaluatorFactory[] args) throws AlgebricksException {
-        return new ICopyEvaluatorFactory() {
+    public IScalarEvaluatorFactory createEvaluatorFactory(final IScalarEvaluatorFactory[] args)
+            throws AlgebricksException {
+        return new IScalarEvaluatorFactory() {
 
             private static final long serialVersionUID = 1L;
 
             @Override
-            public ICopyEvaluator createEvaluator(final IDataOutputProvider output) throws AlgebricksException {
-                return new ICopyEvaluator() {
+            public IScalarEvaluator createScalarEvaluator(final IHyracksTaskContext ctx) throws AlgebricksException {
+                return new IScalarEvaluator() {
 
-                    private DataOutput out = output.getDataOutput();
-                    private ArrayBackedValueStorage argOut0 = new ArrayBackedValueStorage();
-                    private ArrayBackedValueStorage argOut1 = new ArrayBackedValueStorage();
-                    private ICopyEvaluator eval0 = args[0].createEvaluator(argOut0);
-                    private ICopyEvaluator eval1 = args[1].createEvaluator(argOut1);
+                    private ArrayBackedValueStorage resultStorage = new ArrayBackedValueStorage();
+                    private DataOutput out = resultStorage.getDataOutput();
+                    private IPointable argPtr0 = new VoidPointable();
+                    private IPointable argPtr1 = new VoidPointable();
+                    private IScalarEvaluator eval0 = args[0].createScalarEvaluator(ctx);
+                    private IScalarEvaluator eval1 = args[1].createScalarEvaluator(ctx);
 
                     @SuppressWarnings("unchecked")
                     private ISerializerDeserializer<ANull> nullSerde = AqlSerializerDeserializerProvider.INSTANCE
@@ -85,34 +89,38 @@
                     private final UTF8StringPointable utf8Ptr = new UTF8StringPointable();
 
                     @Override
-                    public void evaluate(IFrameTupleReference tuple) throws AlgebricksException {
-                        argOut0.reset();
-                        eval0.evaluate(tuple);
-                        argOut1.reset();
-                        eval1.evaluate(tuple);
+                    public void evaluate(IFrameTupleReference tuple, IPointable result) throws AlgebricksException {
+                        resultStorage.reset();
+                        eval0.evaluate(tuple, argPtr0);
+                        eval1.evaluate(tuple, argPtr1);
+
+                        byte[] bytes0 = argPtr0.getByteArray();
+                        int offset0 = argPtr0.getStartOffset();
+                        int len0 = argPtr0.getLength();
+                        byte[] bytes1 = argPtr1.getByteArray();
+                        int offset1 = argPtr1.getStartOffset();
+                        int len1 = argPtr1.getLength();
 
                         try {
-                            if (argOut0.getByteArray()[0] == ATypeTag.SERIALIZED_NULL_TYPE_TAG
-                                    || argOut1.getByteArray()[0] == ATypeTag.SERIALIZED_NULL_TYPE_TAG) {
+                            if (bytes0[offset0] == ATypeTag.SERIALIZED_NULL_TYPE_TAG
+                                    || bytes1[offset1] == ATypeTag.SERIALIZED_NULL_TYPE_TAG) {
                                 nullSerde.serialize(ANull.NULL, out);
+                                result.set(resultStorage);
                                 return;
                             }
 
-                            if (argOut0.getByteArray()[0] != ATypeTag.SERIALIZED_STRING_TYPE_TAG
-                                    || argOut1.getByteArray()[0] != ATypeTag.SERIALIZED_STRING_TYPE_TAG) {
-                                throw new AlgebricksException(
-                                        getIdentifier().getName() + ": expects two strings but got  ("
-                                                + EnumDeserializer.ATYPETAGDESERIALIZER.deserialize(
-                                                        argOut0.getByteArray()[0])
-                                                + ", " + EnumDeserializer.ATYPETAGDESERIALIZER
-                                                        .deserialize(argOut1.getByteArray()[0])
-                                                + ")");
+                            if (bytes0[offset0] != ATypeTag.SERIALIZED_STRING_TYPE_TAG
+                                    || bytes1[offset1] != ATypeTag.SERIALIZED_STRING_TYPE_TAG) {
+                                throw new AlgebricksException(getIdentifier().getName()
+                                        + ": expects two strings but got  ("
+                                        + EnumDeserializer.ATYPETAGDESERIALIZER.deserialize(bytes0[offset0]) + ", "
+                                        + EnumDeserializer.ATYPETAGDESERIALIZER.deserialize(bytes1[offset1]) + ")");
                             }
-                            utf8Ptr.set(argOut0.getByteArray(), 1, argOut0.getLength() - 1);
+                            utf8Ptr.set(bytes0, offset0 + 1, len0 - 1);
                             int start0 = utf8Ptr.getCharStartOffset();
                             int length0 = utf8Ptr.getUTF8Length();
 
-                            utf8Ptr.set(argOut1.getByteArray(), 1, argOut1.getLength() - 1);
+                            utf8Ptr.set(bytes1, offset1 + 1, len1 - 1);
                             int start1 = utf8Ptr.getCharStartOffset();
                             int length1 = utf8Ptr.getUTF8Length();
                             long chronon = 0;
@@ -124,14 +132,13 @@
                                 // search for "|"
                                 formatLength = 0;
                                 for (; formatStart + formatLength < start1 + length1; formatLength++) {
-                                    if (argOut1.getByteArray()[formatStart + formatLength] == '|') {
+                                    if (bytes1[formatStart + formatLength] == '|') {
                                         break;
                                     }
                                 }
                                 try {
-                                    chronon = DT_UTILS.parseDateTime(argOut0.getByteArray(), start0, length0,
-                                            argOut1.getByteArray(), formatStart, formatLength,
-                                            DateTimeParseMode.TIME_ONLY);
+                                    chronon = DT_UTILS.parseDateTime(bytes0, start0, length0, bytes1, formatStart,
+                                            formatLength, DateTimeParseMode.TIME_ONLY);
                                 } catch (AsterixTemporalTypeParseException ex) {
                                     formatStart += formatLength + 1;
                                     continue;
@@ -146,10 +153,10 @@
 
                             aTime.setValue((int) chronon);
                             timeSerde.serialize(aTime, out);
-
                         } catch (HyracksDataException ex) {
                             throw new AlgebricksException(ex);
                         }
+                        result.set(resultStorage);
                     }
                 };
             }
diff --git a/asterix-runtime/src/main/java/org/apache/asterix/runtime/evaluators/functions/temporal/PrintDateDescriptor.java b/asterix-runtime/src/main/java/org/apache/asterix/runtime/evaluators/functions/temporal/PrintDateDescriptor.java
index d15534d..f48a5c4 100644
--- a/asterix-runtime/src/main/java/org/apache/asterix/runtime/evaluators/functions/temporal/PrintDateDescriptor.java
+++ b/asterix-runtime/src/main/java/org/apache/asterix/runtime/evaluators/functions/temporal/PrintDateDescriptor.java
@@ -36,10 +36,12 @@
 import org.apache.asterix.runtime.evaluators.base.AbstractScalarFunctionDynamicDescriptor;
 import org.apache.hyracks.algebricks.common.exceptions.AlgebricksException;
 import org.apache.hyracks.algebricks.core.algebra.functions.FunctionIdentifier;
-import org.apache.hyracks.algebricks.runtime.base.ICopyEvaluator;
-import org.apache.hyracks.algebricks.runtime.base.ICopyEvaluatorFactory;
+import org.apache.hyracks.algebricks.runtime.base.IScalarEvaluator;
+import org.apache.hyracks.algebricks.runtime.base.IScalarEvaluatorFactory;
+import org.apache.hyracks.api.context.IHyracksTaskContext;
 import org.apache.hyracks.api.dataflow.value.ISerializerDeserializer;
-import org.apache.hyracks.data.std.api.IDataOutputProvider;
+import org.apache.hyracks.data.std.api.IPointable;
+import org.apache.hyracks.data.std.primitive.VoidPointable;
 import org.apache.hyracks.data.std.util.ArrayBackedValueStorage;
 import org.apache.hyracks.dataflow.common.data.accessors.IFrameTupleReference;
 import org.apache.hyracks.util.string.UTF8StringUtil;
@@ -59,20 +61,22 @@
     };
 
     @Override
-    public ICopyEvaluatorFactory createEvaluatorFactory(final ICopyEvaluatorFactory[] args) throws AlgebricksException {
-        return new ICopyEvaluatorFactory() {
+    public IScalarEvaluatorFactory createEvaluatorFactory(final IScalarEvaluatorFactory[] args)
+            throws AlgebricksException {
+        return new IScalarEvaluatorFactory() {
 
             private static final long serialVersionUID = 1L;
 
             @Override
-            public ICopyEvaluator createEvaluator(final IDataOutputProvider output) throws AlgebricksException {
-                return new ICopyEvaluator() {
+            public IScalarEvaluator createScalarEvaluator(final IHyracksTaskContext ctx) throws AlgebricksException {
+                return new IScalarEvaluator() {
 
-                    private DataOutput out = output.getDataOutput();
-                    private ArrayBackedValueStorage argOut0 = new ArrayBackedValueStorage();
-                    private ArrayBackedValueStorage argOut1 = new ArrayBackedValueStorage();
-                    private ICopyEvaluator eval0 = args[0].createEvaluator(argOut0);
-                    private ICopyEvaluator eval1 = args[1].createEvaluator(argOut1);
+                    private ArrayBackedValueStorage resultStorage = new ArrayBackedValueStorage();
+                    private DataOutput out = resultStorage.getDataOutput();
+                    private IPointable argPtr0 = new VoidPointable();
+                    private IPointable argPtr1 = new VoidPointable();
+                    private IScalarEvaluator eval0 = args[0].createScalarEvaluator(ctx);
+                    private IScalarEvaluator eval1 = args[1].createScalarEvaluator(ctx);
 
                     @SuppressWarnings("unchecked")
                     private ISerializerDeserializer<ANull> nullSerde = AqlSerializerDeserializerProvider.INSTANCE
@@ -82,44 +86,46 @@
                     private final UTF8StringWriter utf8Writer = new UTF8StringWriter();
 
                     @Override
-                    public void evaluate(IFrameTupleReference tuple) throws AlgebricksException {
-                        argOut0.reset();
-                        eval0.evaluate(tuple);
-                        argOut1.reset();
-                        eval1.evaluate(tuple);
+                    public void evaluate(IFrameTupleReference tuple, IPointable result) throws AlgebricksException {
+                        resultStorage.reset();
+                        eval0.evaluate(tuple, argPtr0);
+                        eval1.evaluate(tuple, argPtr1);
+
+                        byte[] bytes0 = argPtr0.getByteArray();
+                        int offset0 = argPtr0.getStartOffset();
+                        byte[] bytes1 = argPtr1.getByteArray();
+                        int offset1 = argPtr1.getStartOffset();
 
                         try {
-                            if (argOut0.getByteArray()[0] == ATypeTag.SERIALIZED_NULL_TYPE_TAG
-                                    || argOut1.getByteArray()[0] == ATypeTag.SERIALIZED_NULL_TYPE_TAG) {
+                            if (bytes0[offset0] == ATypeTag.SERIALIZED_NULL_TYPE_TAG
+                                    || bytes1[offset1] == ATypeTag.SERIALIZED_NULL_TYPE_TAG) {
                                 nullSerde.serialize(ANull.NULL, out);
+                                result.set(resultStorage);
                                 return;
                             }
 
-                            if (argOut0.getByteArray()[0] != ATypeTag.SERIALIZED_DATE_TYPE_TAG
-                                    || argOut1.getByteArray()[0] != ATypeTag.SERIALIZED_STRING_TYPE_TAG) {
-                                throw new AlgebricksException(
-                                        getIdentifier().getName() + ": expects (DATE, STRING) but got  ("
-                                                + EnumDeserializer.ATYPETAGDESERIALIZER.deserialize(
-                                                        argOut0.getByteArray()[0])
-                                                + ", " + EnumDeserializer.ATYPETAGDESERIALIZER
-                                                        .deserialize(argOut1.getByteArray()[0])
-                                                + ")");
+                            if (bytes0[offset0] != ATypeTag.SERIALIZED_DATE_TYPE_TAG
+                                    || bytes1[offset1] != ATypeTag.SERIALIZED_STRING_TYPE_TAG) {
+                                throw new AlgebricksException(getIdentifier().getName()
+                                        + ": expects (DATE, STRING) but got  ("
+                                        + EnumDeserializer.ATYPETAGDESERIALIZER.deserialize(bytes0[offset0]) + ", "
+                                        + EnumDeserializer.ATYPETAGDESERIALIZER.deserialize(bytes1[offset1]) + ")");
                             }
 
-                            long chronon = ADateSerializerDeserializer.getChronon(argOut0.getByteArray(), 1)
+                            long chronon = ADateSerializerDeserializer.getChronon(bytes0, offset0 + 1)
                                     * GregorianCalendarSystem.CHRONON_OF_DAY;
-                            int formatLength = UTF8StringUtil.getUTFLength(argOut1.getByteArray(), 1);
+                            int formatLength = UTF8StringUtil.getUTFLength(bytes1, offset1 + 1);
                             int offset = UTF8StringUtil.getNumBytesToStoreLength(formatLength);
                             sbder.delete(0, sbder.length());
-                            DT_UTILS.printDateTime(chronon, 0, argOut1.getByteArray(), 1 + offset, formatLength, sbder,
+                            DT_UTILS.printDateTime(chronon, 0, bytes1, offset1 + 1 + offset, formatLength, sbder,
                                     DateTimeParseMode.DATE_ONLY);
 
                             out.writeByte(ATypeTag.SERIALIZED_STRING_TYPE_TAG);
                             utf8Writer.writeUTF8(sbder.toString(), out);
-
                         } catch (IOException ex) {
                             throw new AlgebricksException(ex);
                         }
+                        result.set(resultStorage);
                     }
                 };
             }
diff --git a/asterix-runtime/src/main/java/org/apache/asterix/runtime/evaluators/functions/temporal/PrintDateTimeDescriptor.java b/asterix-runtime/src/main/java/org/apache/asterix/runtime/evaluators/functions/temporal/PrintDateTimeDescriptor.java
index ba35a42..75fcfe7 100644
--- a/asterix-runtime/src/main/java/org/apache/asterix/runtime/evaluators/functions/temporal/PrintDateTimeDescriptor.java
+++ b/asterix-runtime/src/main/java/org/apache/asterix/runtime/evaluators/functions/temporal/PrintDateTimeDescriptor.java
@@ -35,11 +35,13 @@
 import org.apache.asterix.runtime.evaluators.base.AbstractScalarFunctionDynamicDescriptor;
 import org.apache.hyracks.algebricks.common.exceptions.AlgebricksException;
 import org.apache.hyracks.algebricks.core.algebra.functions.FunctionIdentifier;
-import org.apache.hyracks.algebricks.runtime.base.ICopyEvaluator;
-import org.apache.hyracks.algebricks.runtime.base.ICopyEvaluatorFactory;
+import org.apache.hyracks.algebricks.runtime.base.IScalarEvaluator;
+import org.apache.hyracks.algebricks.runtime.base.IScalarEvaluatorFactory;
+import org.apache.hyracks.api.context.IHyracksTaskContext;
 import org.apache.hyracks.api.dataflow.value.ISerializerDeserializer;
-import org.apache.hyracks.data.std.api.IDataOutputProvider;
+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.data.std.util.ArrayBackedValueStorage;
 import org.apache.hyracks.dataflow.common.data.accessors.IFrameTupleReference;
 import org.apache.hyracks.util.string.UTF8StringWriter;
@@ -58,20 +60,22 @@
     };
 
     @Override
-    public ICopyEvaluatorFactory createEvaluatorFactory(final ICopyEvaluatorFactory[] args) throws AlgebricksException {
-        return new ICopyEvaluatorFactory() {
+    public IScalarEvaluatorFactory createEvaluatorFactory(final IScalarEvaluatorFactory[] args)
+            throws AlgebricksException {
+        return new IScalarEvaluatorFactory() {
 
             private static final long serialVersionUID = 1L;
 
             @Override
-            public ICopyEvaluator createEvaluator(final IDataOutputProvider output) throws AlgebricksException {
-                return new ICopyEvaluator() {
+            public IScalarEvaluator createScalarEvaluator(final IHyracksTaskContext ctx) throws AlgebricksException {
+                return new IScalarEvaluator() {
 
-                    private DataOutput out = output.getDataOutput();
-                    private ArrayBackedValueStorage argOut0 = new ArrayBackedValueStorage();
-                    private ArrayBackedValueStorage argOut1 = new ArrayBackedValueStorage();
-                    private ICopyEvaluator eval0 = args[0].createEvaluator(argOut0);
-                    private ICopyEvaluator eval1 = args[1].createEvaluator(argOut1);
+                    private ArrayBackedValueStorage resultStorage = new ArrayBackedValueStorage();
+                    private DataOutput out = resultStorage.getDataOutput();
+                    private IPointable argPtr0 = new VoidPointable();
+                    private IPointable argPtr1 = new VoidPointable();
+                    private IScalarEvaluator eval0 = args[0].createScalarEvaluator(ctx);
+                    private IScalarEvaluator eval1 = args[1].createScalarEvaluator(ctx);
 
                     @SuppressWarnings("unchecked")
                     private ISerializerDeserializer<ANull> nullSerde = AqlSerializerDeserializerProvider.INSTANCE
@@ -82,31 +86,34 @@
                     private UTF8StringPointable utf8Ptr = new UTF8StringPointable();
 
                     @Override
-                    public void evaluate(IFrameTupleReference tuple) throws AlgebricksException {
-                        argOut0.reset();
-                        eval0.evaluate(tuple);
-                        argOut1.reset();
-                        eval1.evaluate(tuple);
+                    public void evaluate(IFrameTupleReference tuple, IPointable result) throws AlgebricksException {
+                        resultStorage.reset();
+                        eval0.evaluate(tuple, argPtr0);
+                        eval1.evaluate(tuple, argPtr1);
+
+                        byte[] bytes0 = argPtr0.getByteArray();
+                        int offset0 = argPtr0.getStartOffset();
+                        byte[] bytes1 = argPtr1.getByteArray();
+                        int offset1 = argPtr1.getStartOffset();
+                        int len1 = argPtr1.getLength();
 
                         try {
-                            if (argOut0.getByteArray()[0] == ATypeTag.SERIALIZED_NULL_TYPE_TAG
-                                    || argOut1.getByteArray()[0] == ATypeTag.SERIALIZED_NULL_TYPE_TAG) {
+                            if (bytes0[offset0] == ATypeTag.SERIALIZED_NULL_TYPE_TAG
+                                    || bytes1[offset1] == ATypeTag.SERIALIZED_NULL_TYPE_TAG) {
                                 nullSerde.serialize(ANull.NULL, out);
+                                result.set(resultStorage);
                                 return;
                             }
 
-                            if (argOut0.getByteArray()[0] != ATypeTag.SERIALIZED_DATETIME_TYPE_TAG
-                                    || argOut1.getByteArray()[0] != ATypeTag.SERIALIZED_STRING_TYPE_TAG) {
-                                throw new AlgebricksException(
-                                        getIdentifier().getName() + ": expects (DATETIME, STRING) but got  ("
-                                                + EnumDeserializer.ATYPETAGDESERIALIZER.deserialize(
-                                                        argOut0.getByteArray()[0])
-                                                + ", " + EnumDeserializer.ATYPETAGDESERIALIZER
-                                                        .deserialize(argOut1.getByteArray()[0])
-                                                + ")");
+                            if (bytes0[offset0] != ATypeTag.SERIALIZED_DATETIME_TYPE_TAG
+                                    || bytes1[offset1] != ATypeTag.SERIALIZED_STRING_TYPE_TAG) {
+                                throw new AlgebricksException(getIdentifier().getName()
+                                        + ": expects (DATETIME, STRING) but got  ("
+                                        + EnumDeserializer.ATYPETAGDESERIALIZER.deserialize(bytes0[offset0]) + ", "
+                                        + EnumDeserializer.ATYPETAGDESERIALIZER.deserialize(bytes1[offset1]) + ")");
                             }
-                            long chronon = ADateTimeSerializerDeserializer.getChronon(argOut0.getByteArray(), 1);
-                            utf8Ptr.set(argOut1.getByteArray(), 1, argOut1.getLength() - 1);
+                            long chronon = ADateTimeSerializerDeserializer.getChronon(bytes0, offset0 + 1);
+                            utf8Ptr.set(bytes1, offset1 + 1, len1 - 1);
                             int formatLength = utf8Ptr.getUTF8Length();
                             sbder.delete(0, sbder.length());
                             DT_UTILS.printDateTime(chronon, 0, utf8Ptr.getByteArray(), utf8Ptr.getCharStartOffset(),
@@ -114,10 +121,10 @@
 
                             out.writeByte(ATypeTag.SERIALIZED_STRING_TYPE_TAG);
                             utf8Writer.writeUTF8(sbder.toString(), out);
-
                         } catch (IOException ex) {
                             throw new AlgebricksException(ex);
                         }
+                        result.set(resultStorage);
                     }
                 };
             }
diff --git a/asterix-runtime/src/main/java/org/apache/asterix/runtime/evaluators/functions/temporal/PrintTimeDescriptor.java b/asterix-runtime/src/main/java/org/apache/asterix/runtime/evaluators/functions/temporal/PrintTimeDescriptor.java
index f152401..2318412 100644
--- a/asterix-runtime/src/main/java/org/apache/asterix/runtime/evaluators/functions/temporal/PrintTimeDescriptor.java
+++ b/asterix-runtime/src/main/java/org/apache/asterix/runtime/evaluators/functions/temporal/PrintTimeDescriptor.java
@@ -35,11 +35,13 @@
 import org.apache.asterix.runtime.evaluators.base.AbstractScalarFunctionDynamicDescriptor;
 import org.apache.hyracks.algebricks.common.exceptions.AlgebricksException;
 import org.apache.hyracks.algebricks.core.algebra.functions.FunctionIdentifier;
-import org.apache.hyracks.algebricks.runtime.base.ICopyEvaluator;
-import org.apache.hyracks.algebricks.runtime.base.ICopyEvaluatorFactory;
+import org.apache.hyracks.algebricks.runtime.base.IScalarEvaluator;
+import org.apache.hyracks.algebricks.runtime.base.IScalarEvaluatorFactory;
+import org.apache.hyracks.api.context.IHyracksTaskContext;
 import org.apache.hyracks.api.dataflow.value.ISerializerDeserializer;
-import org.apache.hyracks.data.std.api.IDataOutputProvider;
+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.data.std.util.ArrayBackedValueStorage;
 import org.apache.hyracks.dataflow.common.data.accessors.IFrameTupleReference;
 import org.apache.hyracks.util.string.UTF8StringWriter;
@@ -58,20 +60,22 @@
     };
 
     @Override
-    public ICopyEvaluatorFactory createEvaluatorFactory(final ICopyEvaluatorFactory[] args) throws AlgebricksException {
-        return new ICopyEvaluatorFactory() {
+    public IScalarEvaluatorFactory createEvaluatorFactory(final IScalarEvaluatorFactory[] args)
+            throws AlgebricksException {
+        return new IScalarEvaluatorFactory() {
 
             private static final long serialVersionUID = 1L;
 
             @Override
-            public ICopyEvaluator createEvaluator(final IDataOutputProvider output) throws AlgebricksException {
-                return new ICopyEvaluator() {
+            public IScalarEvaluator createScalarEvaluator(final IHyracksTaskContext ctx) throws AlgebricksException {
+                return new IScalarEvaluator() {
 
-                    private DataOutput out = output.getDataOutput();
-                    private ArrayBackedValueStorage argOut0 = new ArrayBackedValueStorage();
-                    private ArrayBackedValueStorage argOut1 = new ArrayBackedValueStorage();
-                    private ICopyEvaluator eval0 = args[0].createEvaluator(argOut0);
-                    private ICopyEvaluator eval1 = args[1].createEvaluator(argOut1);
+                    private ArrayBackedValueStorage resultStorage = new ArrayBackedValueStorage();
+                    private DataOutput out = resultStorage.getDataOutput();
+                    private IPointable argPtr0 = new VoidPointable();
+                    private IPointable argPtr1 = new VoidPointable();
+                    private IScalarEvaluator eval0 = args[0].createScalarEvaluator(ctx);
+                    private IScalarEvaluator eval1 = args[1].createScalarEvaluator(ctx);
 
                     @SuppressWarnings("unchecked")
                     private ISerializerDeserializer<ANull> nullSerde = AqlSerializerDeserializerProvider.INSTANCE
@@ -82,32 +86,35 @@
                     private final UTF8StringPointable utf8Ptr = new UTF8StringPointable();
 
                     @Override
-                    public void evaluate(IFrameTupleReference tuple) throws AlgebricksException {
-                        argOut0.reset();
-                        eval0.evaluate(tuple);
-                        argOut1.reset();
-                        eval1.evaluate(tuple);
+                    public void evaluate(IFrameTupleReference tuple, IPointable result) throws AlgebricksException {
+                        resultStorage.reset();
+                        eval0.evaluate(tuple, argPtr0);
+                        eval1.evaluate(tuple, argPtr1);
+
+                        byte[] bytes0 = argPtr0.getByteArray();
+                        int offset0 = argPtr0.getStartOffset();
+                        byte[] bytes1 = argPtr1.getByteArray();
+                        int offset1 = argPtr1.getStartOffset();
+                        int len1 = argPtr1.getLength();
 
                         try {
-                            if (argOut0.getByteArray()[0] == ATypeTag.SERIALIZED_NULL_TYPE_TAG
-                                    || argOut1.getByteArray()[0] == ATypeTag.SERIALIZED_NULL_TYPE_TAG) {
+                            if (bytes0[offset0] == ATypeTag.SERIALIZED_NULL_TYPE_TAG
+                                    || bytes1[offset1] == ATypeTag.SERIALIZED_NULL_TYPE_TAG) {
                                 nullSerde.serialize(ANull.NULL, out);
+                                result.set(resultStorage);
                                 return;
                             }
 
-                            if (argOut0.getByteArray()[0] != ATypeTag.SERIALIZED_TIME_TYPE_TAG
-                                    || argOut1.getByteArray()[0] != ATypeTag.SERIALIZED_STRING_TYPE_TAG) {
-                                throw new AlgebricksException(
-                                        getIdentifier().getName() + ": expects (TIME, STRING) but got  ("
-                                                + EnumDeserializer.ATYPETAGDESERIALIZER.deserialize(
-                                                        argOut0.getByteArray()[0])
-                                                + ", " + EnumDeserializer.ATYPETAGDESERIALIZER
-                                                        .deserialize(argOut1.getByteArray()[0])
-                                                + ")");
+                            if (bytes0[offset0] != ATypeTag.SERIALIZED_TIME_TYPE_TAG
+                                    || bytes1[offset1] != ATypeTag.SERIALIZED_STRING_TYPE_TAG) {
+                                throw new AlgebricksException(getIdentifier().getName()
+                                        + ": expects (TIME, STRING) but got  ("
+                                        + EnumDeserializer.ATYPETAGDESERIALIZER.deserialize(bytes0[offset0]) + ", "
+                                        + EnumDeserializer.ATYPETAGDESERIALIZER.deserialize(bytes1[offset1]) + ")");
                             }
 
-                            long chronon = ATimeSerializerDeserializer.getChronon(argOut0.getByteArray(), 1);
-                            utf8Ptr.set(argOut1.getByteArray(), 1, argOut1.getLength() - 1);
+                            long chronon = ATimeSerializerDeserializer.getChronon(bytes0, offset0 + 1);
+                            utf8Ptr.set(bytes1, offset1 + 1, len1 - 1);
                             int formatLength = utf8Ptr.getUTF8Length();
                             sbder.delete(0, sbder.length());
                             DT_UTILS.printDateTime(chronon, 0, utf8Ptr.getByteArray(), utf8Ptr.getCharStartOffset(),
@@ -115,10 +122,10 @@
 
                             out.writeByte(ATypeTag.SERIALIZED_STRING_TYPE_TAG);
                             writer.writeUTF8(sbder.toString(), out);
-
                         } catch (IOException ex) {
                             throw new AlgebricksException(ex);
                         }
+                        result.set(resultStorage);
                     }
                 };
             }
diff --git a/asterix-runtime/src/main/java/org/apache/asterix/runtime/evaluators/functions/temporal/TimeFromDatetimeDescriptor.java b/asterix-runtime/src/main/java/org/apache/asterix/runtime/evaluators/functions/temporal/TimeFromDatetimeDescriptor.java
index 384cfd7..a8c3fe6 100644
--- a/asterix-runtime/src/main/java/org/apache/asterix/runtime/evaluators/functions/temporal/TimeFromDatetimeDescriptor.java
+++ b/asterix-runtime/src/main/java/org/apache/asterix/runtime/evaluators/functions/temporal/TimeFromDatetimeDescriptor.java
@@ -35,11 +35,13 @@
 import org.apache.asterix.runtime.evaluators.base.AbstractScalarFunctionDynamicDescriptor;
 import org.apache.hyracks.algebricks.common.exceptions.AlgebricksException;
 import org.apache.hyracks.algebricks.core.algebra.functions.FunctionIdentifier;
-import org.apache.hyracks.algebricks.runtime.base.ICopyEvaluator;
-import org.apache.hyracks.algebricks.runtime.base.ICopyEvaluatorFactory;
+import org.apache.hyracks.algebricks.runtime.base.IScalarEvaluator;
+import org.apache.hyracks.algebricks.runtime.base.IScalarEvaluatorFactory;
+import org.apache.hyracks.api.context.IHyracksTaskContext;
 import org.apache.hyracks.api.dataflow.value.ISerializerDeserializer;
 import org.apache.hyracks.api.exceptions.HyracksDataException;
-import org.apache.hyracks.data.std.api.IDataOutputProvider;
+import org.apache.hyracks.data.std.api.IPointable;
+import org.apache.hyracks.data.std.primitive.VoidPointable;
 import org.apache.hyracks.data.std.util.ArrayBackedValueStorage;
 import org.apache.hyracks.dataflow.common.data.accessors.IFrameTupleReference;
 
@@ -60,18 +62,20 @@
      * @see org.apache.asterix.runtime.base.IScalarFunctionDynamicDescriptor#createEvaluatorFactory(org.apache.hyracks.algebricks.runtime.base.ICopyEvaluatorFactory[])
      */
     @Override
-    public ICopyEvaluatorFactory createEvaluatorFactory(final ICopyEvaluatorFactory[] args) throws AlgebricksException {
-        return new ICopyEvaluatorFactory() {
+    public IScalarEvaluatorFactory createEvaluatorFactory(final IScalarEvaluatorFactory[] args)
+            throws AlgebricksException {
+        return new IScalarEvaluatorFactory() {
 
             private static final long serialVersionUID = 1L;
 
             @Override
-            public ICopyEvaluator createEvaluator(final IDataOutputProvider output) throws AlgebricksException {
-                return new ICopyEvaluator() {
+            public IScalarEvaluator createScalarEvaluator(final IHyracksTaskContext ctx) throws AlgebricksException {
+                return new IScalarEvaluator() {
 
-                    private DataOutput out = output.getDataOutput();
-                    private ArrayBackedValueStorage argOut = new ArrayBackedValueStorage();
-                    private ICopyEvaluator eval = args[0].createEvaluator(argOut);
+                    private ArrayBackedValueStorage resultStorage = new ArrayBackedValueStorage();
+                    private DataOutput out = resultStorage.getDataOutput();
+                    private IPointable argPtr = new VoidPointable();
+                    private IScalarEvaluator eval = args[0].createScalarEvaluator(ctx);
 
                     // possible returning types
                     @SuppressWarnings("unchecked")
@@ -84,21 +88,23 @@
                             .getSerializerDeserializer(BuiltinType.ANULL);
 
                     @Override
-                    public void evaluate(IFrameTupleReference tuple) throws AlgebricksException {
-                        argOut.reset();
-                        eval.evaluate(tuple);
+                    public void evaluate(IFrameTupleReference tuple, IPointable result) throws AlgebricksException {
+                        resultStorage.reset();
+                        eval.evaluate(tuple, argPtr);
+
+                        byte[] bytes = argPtr.getByteArray();
+                        int offset = argPtr.getStartOffset();
+
                         try {
-                            if (argOut.getByteArray()[0] == ATypeTag.SERIALIZED_NULL_TYPE_TAG) {
+                            if (bytes[offset] == ATypeTag.SERIALIZED_NULL_TYPE_TAG) {
                                 nullSerde.serialize(ANull.NULL, out);
                             } else {
-                                if (argOut.getByteArray()[0] != ATypeTag.SERIALIZED_DATETIME_TYPE_TAG) {
+                                if (bytes[offset] != ATypeTag.SERIALIZED_DATETIME_TYPE_TAG) {
                                     throw new AlgebricksException(
                                             FID.getName() + ": expects input type DATETIME/NULL but got "
-                                                    + EnumDeserializer.ATYPETAGDESERIALIZER
-                                                            .deserialize(argOut.getByteArray()[0]));
+                                                    + EnumDeserializer.ATYPETAGDESERIALIZER.deserialize(bytes[offset]));
                                 }
-                                long datetimeChronon = ADateTimeSerializerDeserializer.getChronon(argOut.getByteArray(),
-                                        1);
+                                long datetimeChronon = ADateTimeSerializerDeserializer.getChronon(bytes, offset + 1);
                                 int timeChronon = (int) (datetimeChronon % GregorianCalendarSystem.CHRONON_OF_DAY);
                                 if (timeChronon < 0) {
                                     timeChronon += GregorianCalendarSystem.CHRONON_OF_DAY;
@@ -109,6 +115,7 @@
                         } catch (HyracksDataException hex) {
                             throw new AlgebricksException(hex);
                         }
+                        result.set(resultStorage);
                     }
                 };
             }
diff --git a/asterix-runtime/src/main/java/org/apache/asterix/runtime/evaluators/functions/temporal/TimeFromUnixTimeInMsDescriptor.java b/asterix-runtime/src/main/java/org/apache/asterix/runtime/evaluators/functions/temporal/TimeFromUnixTimeInMsDescriptor.java
index 3744873..48be51d 100644
--- a/asterix-runtime/src/main/java/org/apache/asterix/runtime/evaluators/functions/temporal/TimeFromUnixTimeInMsDescriptor.java
+++ b/asterix-runtime/src/main/java/org/apache/asterix/runtime/evaluators/functions/temporal/TimeFromUnixTimeInMsDescriptor.java
@@ -33,11 +33,13 @@
 import org.apache.asterix.runtime.evaluators.base.AbstractScalarFunctionDynamicDescriptor;
 import org.apache.hyracks.algebricks.common.exceptions.AlgebricksException;
 import org.apache.hyracks.algebricks.core.algebra.functions.FunctionIdentifier;
-import org.apache.hyracks.algebricks.runtime.base.ICopyEvaluator;
-import org.apache.hyracks.algebricks.runtime.base.ICopyEvaluatorFactory;
+import org.apache.hyracks.algebricks.runtime.base.IScalarEvaluator;
+import org.apache.hyracks.algebricks.runtime.base.IScalarEvaluatorFactory;
+import org.apache.hyracks.api.context.IHyracksTaskContext;
 import org.apache.hyracks.api.dataflow.value.ISerializerDeserializer;
 import org.apache.hyracks.api.exceptions.HyracksDataException;
-import org.apache.hyracks.data.std.api.IDataOutputProvider;
+import org.apache.hyracks.data.std.api.IPointable;
+import org.apache.hyracks.data.std.primitive.VoidPointable;
 import org.apache.hyracks.data.std.util.ArrayBackedValueStorage;
 import org.apache.hyracks.dataflow.common.data.accessors.IFrameTupleReference;
 
@@ -56,18 +58,20 @@
      * @see org.apache.asterix.runtime.base.IScalarFunctionDynamicDescriptor#createEvaluatorFactory(org.apache.hyracks.algebricks.runtime.base.ICopyEvaluatorFactory[])
      */
     @Override
-    public ICopyEvaluatorFactory createEvaluatorFactory(final ICopyEvaluatorFactory[] args) throws AlgebricksException {
-        return new ICopyEvaluatorFactory() {
+    public IScalarEvaluatorFactory createEvaluatorFactory(final IScalarEvaluatorFactory[] args)
+            throws AlgebricksException {
+        return new IScalarEvaluatorFactory() {
 
             private static final long serialVersionUID = 1L;
 
             @Override
-            public ICopyEvaluator createEvaluator(final IDataOutputProvider output) throws AlgebricksException {
-                return new ICopyEvaluator() {
+            public IScalarEvaluator createScalarEvaluator(final IHyracksTaskContext ctx) throws AlgebricksException {
+                return new IScalarEvaluator() {
 
-                    private DataOutput out = output.getDataOutput();
-                    private ArrayBackedValueStorage argOut = new ArrayBackedValueStorage();
-                    private ICopyEvaluator eval = args[0].createEvaluator(argOut);
+                    private ArrayBackedValueStorage resultStorage = new ArrayBackedValueStorage();
+                    private DataOutput out = resultStorage.getDataOutput();
+                    private IPointable argPtr = new VoidPointable();
+                    private IScalarEvaluator eval = args[0].createScalarEvaluator(ctx);
 
                     // possible output types
                     @SuppressWarnings("unchecked")
@@ -80,19 +84,21 @@
                     private AMutableTime aTime = new AMutableTime(0);
 
                     @Override
-                    public void evaluate(IFrameTupleReference tuple) throws AlgebricksException {
-                        argOut.reset();
-                        eval.evaluate(tuple);
+                    public void evaluate(IFrameTupleReference tuple, IPointable result) throws AlgebricksException {
+                        resultStorage.reset();
+                        eval.evaluate(tuple, argPtr);
                         try {
-                            if (argOut.getByteArray()[0] == ATypeTag.SERIALIZED_NULL_TYPE_TAG) {
+                            if (argPtr.getByteArray()[argPtr.getStartOffset()] == ATypeTag.SERIALIZED_NULL_TYPE_TAG) {
                                 nullSerde.serialize(ANull.NULL, out);
                             } else {
-                                aTime.setValue(ATypeHierarchy.getIntegerValue(argOut.getByteArray(), 0));
+                                aTime.setValue(
+                                        ATypeHierarchy.getIntegerValue(argPtr.getByteArray(), argPtr.getStartOffset()));
                                 timeSerde.serialize(aTime, out);
                             }
                         } catch (HyracksDataException hex) {
                             throw new AlgebricksException(hex);
                         }
+                        result.set(resultStorage);
                     }
                 };
             }
diff --git a/asterix-runtime/src/main/java/org/apache/asterix/runtime/evaluators/functions/temporal/YearMonthDurationComparatorDecriptor.java b/asterix-runtime/src/main/java/org/apache/asterix/runtime/evaluators/functions/temporal/YearMonthDurationComparatorDecriptor.java
index f75665d..52cbaf5 100644
--- a/asterix-runtime/src/main/java/org/apache/asterix/runtime/evaluators/functions/temporal/YearMonthDurationComparatorDecriptor.java
+++ b/asterix-runtime/src/main/java/org/apache/asterix/runtime/evaluators/functions/temporal/YearMonthDurationComparatorDecriptor.java
@@ -33,11 +33,13 @@
 import org.apache.asterix.runtime.evaluators.base.AbstractScalarFunctionDynamicDescriptor;
 import org.apache.hyracks.algebricks.common.exceptions.AlgebricksException;
 import org.apache.hyracks.algebricks.core.algebra.functions.FunctionIdentifier;
-import org.apache.hyracks.algebricks.runtime.base.ICopyEvaluator;
-import org.apache.hyracks.algebricks.runtime.base.ICopyEvaluatorFactory;
+import org.apache.hyracks.algebricks.runtime.base.IScalarEvaluator;
+import org.apache.hyracks.algebricks.runtime.base.IScalarEvaluatorFactory;
+import org.apache.hyracks.api.context.IHyracksTaskContext;
 import org.apache.hyracks.api.dataflow.value.ISerializerDeserializer;
 import org.apache.hyracks.api.exceptions.HyracksDataException;
-import org.apache.hyracks.data.std.api.IDataOutputProvider;
+import org.apache.hyracks.data.std.api.IPointable;
+import org.apache.hyracks.data.std.primitive.VoidPointable;
 import org.apache.hyracks.data.std.util.ArrayBackedValueStorage;
 import org.apache.hyracks.dataflow.common.data.accessors.IFrameTupleReference;
 
@@ -68,20 +70,22 @@
     };
 
     @Override
-    public ICopyEvaluatorFactory createEvaluatorFactory(final ICopyEvaluatorFactory[] args) throws AlgebricksException {
-        return new ICopyEvaluatorFactory() {
+    public IScalarEvaluatorFactory createEvaluatorFactory(final IScalarEvaluatorFactory[] args)
+            throws AlgebricksException {
+        return new IScalarEvaluatorFactory() {
 
             private static final long serialVersionUID = 1L;
 
             @Override
-            public ICopyEvaluator createEvaluator(final IDataOutputProvider output) throws AlgebricksException {
-                return new ICopyEvaluator() {
+            public IScalarEvaluator createScalarEvaluator(final IHyracksTaskContext ctx) throws AlgebricksException {
+                return new IScalarEvaluator() {
 
-                    private DataOutput out = output.getDataOutput();
-                    private ArrayBackedValueStorage argOut0 = new ArrayBackedValueStorage();
-                    private ArrayBackedValueStorage argOut1 = new ArrayBackedValueStorage();
-                    private ICopyEvaluator eval0 = args[0].createEvaluator(argOut0);
-                    private ICopyEvaluator eval1 = args[1].createEvaluator(argOut1);
+                    private ArrayBackedValueStorage resultStorage = new ArrayBackedValueStorage();
+                    private DataOutput out = resultStorage.getDataOutput();
+                    private IPointable argPtr0 = new VoidPointable();
+                    private IPointable argPtr1 = new VoidPointable();
+                    private IScalarEvaluator eval0 = args[0].createScalarEvaluator(ctx);
+                    private IScalarEvaluator eval1 = args[1].createScalarEvaluator(ctx);
 
                     // possible output types
                     @SuppressWarnings("unchecked")
@@ -92,46 +96,48 @@
                             .getSerializerDeserializer(BuiltinType.ABOOLEAN);
 
                     @Override
-                    public void evaluate(IFrameTupleReference tuple) throws AlgebricksException {
-                        argOut0.reset();
-                        eval0.evaluate(tuple);
-                        argOut1.reset();
-                        eval1.evaluate(tuple);
+                    public void evaluate(IFrameTupleReference tuple, IPointable result) throws AlgebricksException {
+                        resultStorage.reset();
+                        eval0.evaluate(tuple, argPtr0);
+                        eval1.evaluate(tuple, argPtr1);
+
+                        byte[] bytes0 = argPtr0.getByteArray();
+                        int offset0 = argPtr0.getStartOffset();
+                        byte[] bytes1 = argPtr1.getByteArray();
+                        int offset1 = argPtr1.getStartOffset();
 
                         try {
-                            if (argOut0.getByteArray()[0] == ATypeTag.SERIALIZED_NULL_TYPE_TAG
-                                    || argOut1.getByteArray()[0] == ATypeTag.SERIALIZED_NULL_TYPE_TAG) {
+                            if (bytes0[offset0] == ATypeTag.SERIALIZED_NULL_TYPE_TAG
+                                    || bytes1[offset1] == ATypeTag.SERIALIZED_NULL_TYPE_TAG) {
                                 nullSerde.serialize(ANull.NULL, out);
+                                result.set(resultStorage);
                                 return;
                             }
 
-                            if (argOut0.getByteArray()[0] != ATypeTag.SERIALIZED_DURATION_TYPE_TAG
-                                    || argOut1.getByteArray()[0] != ATypeTag.SERIALIZED_DURATION_TYPE_TAG) {
-                                throw new AlgebricksException(
-                                        getIdentifier().getName()
-                                                + ": expects type NULL/DURATION, NULL/DURATION but got "
-                                                + EnumDeserializer.ATYPETAGDESERIALIZER.deserialize(
-                                                        argOut0.getByteArray()[0])
-                                                + " and " + EnumDeserializer.ATYPETAGDESERIALIZER
-                                                        .deserialize(argOut1.getByteArray()[0]));
+                            if (bytes0[offset0] != ATypeTag.SERIALIZED_DURATION_TYPE_TAG
+                                    || bytes1[offset1] != ATypeTag.SERIALIZED_DURATION_TYPE_TAG) {
+                                throw new AlgebricksException(getIdentifier().getName()
+                                        + ": expects type NULL/DURATION, NULL/DURATION but got "
+                                        + EnumDeserializer.ATYPETAGDESERIALIZER.deserialize(bytes0[offset0]) + " and "
+                                        + EnumDeserializer.ATYPETAGDESERIALIZER.deserialize(bytes1[offset1]));
                             }
 
-                            if ((ADurationSerializerDeserializer.getDayTime(argOut0.getByteArray(), 1) != 0)
-                                    || (ADurationSerializerDeserializer.getDayTime(argOut1.getByteArray(), 1) != 0)) {
+                            if ((ADurationSerializerDeserializer.getDayTime(bytes0, offset0 + 1) != 0)
+                                    || (ADurationSerializerDeserializer.getDayTime(bytes1, offset1 + 1) != 0)) {
                                 throw new AlgebricksException(
                                         getIdentifier().getName() + ": only year-month durations are allowed.");
                             }
 
-                            if (ADurationSerializerDeserializer.getYearMonth(argOut0.getByteArray(),
-                                    1) > ADurationSerializerDeserializer.getYearMonth(argOut1.getByteArray(), 1)) {
+                            if (ADurationSerializerDeserializer.getYearMonth(bytes0,
+                                    offset0 + 1) > ADurationSerializerDeserializer.getYearMonth(bytes1, offset1 + 1)) {
                                 boolSerde.serialize(isGreaterThan ? ABoolean.TRUE : ABoolean.FALSE, out);
                             } else {
                                 boolSerde.serialize(isGreaterThan ? ABoolean.FALSE : ABoolean.TRUE, out);
                             }
-
                         } catch (HyracksDataException hex) {
                             throw new AlgebricksException(hex);
                         }
+                        result.set(resultStorage);
                     }
                 };
             }
diff --git a/asterix-runtime/src/main/java/org/apache/asterix/runtime/formats/NonTaggedDataFormat.java b/asterix-runtime/src/main/java/org/apache/asterix/runtime/formats/NonTaggedDataFormat.java
index 27dadfc..4b1e255 100644
--- a/asterix-runtime/src/main/java/org/apache/asterix/runtime/formats/NonTaggedDataFormat.java
+++ b/asterix-runtime/src/main/java/org/apache/asterix/runtime/formats/NonTaggedDataFormat.java
@@ -166,7 +166,88 @@
 import org.apache.asterix.runtime.evaluators.constructors.AYearMonthDurationConstructorDescriptor;
 import org.apache.asterix.runtime.evaluators.constructors.ClosedRecordConstructorDescriptor;
 import org.apache.asterix.runtime.evaluators.constructors.OpenRecordConstructorDescriptor;
-import org.apache.asterix.runtime.evaluators.functions.*;
+import org.apache.asterix.runtime.evaluators.functions.AndDescriptor;
+import org.apache.asterix.runtime.evaluators.functions.AnyCollectionMemberDescriptor;
+import org.apache.asterix.runtime.evaluators.functions.CastListDescriptor;
+import org.apache.asterix.runtime.evaluators.functions.CastRecordDescriptor;
+import org.apache.asterix.runtime.evaluators.functions.CodePointToStringDescriptor;
+import org.apache.asterix.runtime.evaluators.functions.CountHashedGramTokensDescriptor;
+import org.apache.asterix.runtime.evaluators.functions.CountHashedWordTokensDescriptor;
+import org.apache.asterix.runtime.evaluators.functions.CreateCircleDescriptor;
+import org.apache.asterix.runtime.evaluators.functions.CreateLineDescriptor;
+import org.apache.asterix.runtime.evaluators.functions.CreateMBRDescriptor;
+import org.apache.asterix.runtime.evaluators.functions.CreatePointDescriptor;
+import org.apache.asterix.runtime.evaluators.functions.CreatePolygonDescriptor;
+import org.apache.asterix.runtime.evaluators.functions.CreateRectangleDescriptor;
+import org.apache.asterix.runtime.evaluators.functions.CreateUUIDDescriptor;
+import org.apache.asterix.runtime.evaluators.functions.DeepEqualityDescriptor;
+import org.apache.asterix.runtime.evaluators.functions.EditDistanceCheckDescriptor;
+import org.apache.asterix.runtime.evaluators.functions.EditDistanceContainsDescriptor;
+import org.apache.asterix.runtime.evaluators.functions.EditDistanceDescriptor;
+import org.apache.asterix.runtime.evaluators.functions.EditDistanceListIsFilterable;
+import org.apache.asterix.runtime.evaluators.functions.EditDistanceStringIsFilterable;
+import org.apache.asterix.runtime.evaluators.functions.EmbedTypeDescriptor;
+import org.apache.asterix.runtime.evaluators.functions.FlowRecordDescriptor;
+import org.apache.asterix.runtime.evaluators.functions.FuzzyEqDescriptor;
+import org.apache.asterix.runtime.evaluators.functions.GetItemDescriptor;
+import org.apache.asterix.runtime.evaluators.functions.GramTokensDescriptor;
+import org.apache.asterix.runtime.evaluators.functions.HashedGramTokensDescriptor;
+import org.apache.asterix.runtime.evaluators.functions.HashedWordTokensDescriptor;
+import org.apache.asterix.runtime.evaluators.functions.InjectFailureDescriptor;
+import org.apache.asterix.runtime.evaluators.functions.IsNullDescriptor;
+import org.apache.asterix.runtime.evaluators.functions.IsSystemNullDescriptor;
+import org.apache.asterix.runtime.evaluators.functions.LenDescriptor;
+import org.apache.asterix.runtime.evaluators.functions.NotDescriptor;
+import org.apache.asterix.runtime.evaluators.functions.NotNullDescriptor;
+import org.apache.asterix.runtime.evaluators.functions.NumericAbsDescriptor;
+import org.apache.asterix.runtime.evaluators.functions.NumericAddDescriptor;
+import org.apache.asterix.runtime.evaluators.functions.NumericCaretDescriptor;
+import org.apache.asterix.runtime.evaluators.functions.NumericCeilingDescriptor;
+import org.apache.asterix.runtime.evaluators.functions.NumericDivideDescriptor;
+import org.apache.asterix.runtime.evaluators.functions.NumericFloorDescriptor;
+import org.apache.asterix.runtime.evaluators.functions.NumericModuloDescriptor;
+import org.apache.asterix.runtime.evaluators.functions.NumericMultiplyDescriptor;
+import org.apache.asterix.runtime.evaluators.functions.NumericRoundDescriptor;
+import org.apache.asterix.runtime.evaluators.functions.NumericRoundHalfToEven2Descriptor;
+import org.apache.asterix.runtime.evaluators.functions.NumericRoundHalfToEvenDescriptor;
+import org.apache.asterix.runtime.evaluators.functions.NumericSubDescriptor;
+import org.apache.asterix.runtime.evaluators.functions.NumericUnaryMinusDescriptor;
+import org.apache.asterix.runtime.evaluators.functions.OrDescriptor;
+import org.apache.asterix.runtime.evaluators.functions.OrderedListConstructorDescriptor;
+import org.apache.asterix.runtime.evaluators.functions.PrefixLenJaccardDescriptor;
+import org.apache.asterix.runtime.evaluators.functions.RegExpDescriptor;
+import org.apache.asterix.runtime.evaluators.functions.SimilarityJaccardCheckDescriptor;
+import org.apache.asterix.runtime.evaluators.functions.SimilarityJaccardDescriptor;
+import org.apache.asterix.runtime.evaluators.functions.SimilarityJaccardPrefixCheckDescriptor;
+import org.apache.asterix.runtime.evaluators.functions.SimilarityJaccardPrefixDescriptor;
+import org.apache.asterix.runtime.evaluators.functions.SimilarityJaccardSortedCheckDescriptor;
+import org.apache.asterix.runtime.evaluators.functions.SimilarityJaccardSortedDescriptor;
+import org.apache.asterix.runtime.evaluators.functions.SpatialAreaDescriptor;
+import org.apache.asterix.runtime.evaluators.functions.SpatialCellDescriptor;
+import org.apache.asterix.runtime.evaluators.functions.SpatialDistanceDescriptor;
+import org.apache.asterix.runtime.evaluators.functions.SpatialIntersectDescriptor;
+import org.apache.asterix.runtime.evaluators.functions.StringConcatDescriptor;
+import org.apache.asterix.runtime.evaluators.functions.StringContainsDescriptor;
+import org.apache.asterix.runtime.evaluators.functions.StringEndsWithDescriptor;
+import org.apache.asterix.runtime.evaluators.functions.StringEqualDescriptor;
+import org.apache.asterix.runtime.evaluators.functions.StringJoinDescriptor;
+import org.apache.asterix.runtime.evaluators.functions.StringLengthDescriptor;
+import org.apache.asterix.runtime.evaluators.functions.StringLikeDescriptor;
+import org.apache.asterix.runtime.evaluators.functions.StringLowerCaseDescriptor;
+import org.apache.asterix.runtime.evaluators.functions.StringMatchesDescriptor;
+import org.apache.asterix.runtime.evaluators.functions.StringMatchesWithFlagDescriptor;
+import org.apache.asterix.runtime.evaluators.functions.StringReplaceDescriptor;
+import org.apache.asterix.runtime.evaluators.functions.StringReplaceWithFlagsDescriptor;
+import org.apache.asterix.runtime.evaluators.functions.StringStartsWithDescriptor;
+import org.apache.asterix.runtime.evaluators.functions.StringToCodePointDescriptor;
+import org.apache.asterix.runtime.evaluators.functions.StringUpperCaseDescriptor;
+import org.apache.asterix.runtime.evaluators.functions.Substring2Descriptor;
+import org.apache.asterix.runtime.evaluators.functions.SubstringAfterDescriptor;
+import org.apache.asterix.runtime.evaluators.functions.SubstringBeforeDescriptor;
+import org.apache.asterix.runtime.evaluators.functions.SubstringDescriptor;
+import org.apache.asterix.runtime.evaluators.functions.SwitchCaseDescriptor;
+import org.apache.asterix.runtime.evaluators.functions.UnorderedListConstructorDescriptor;
+import org.apache.asterix.runtime.evaluators.functions.WordTokensDescriptor;
 import org.apache.asterix.runtime.evaluators.functions.binary.BinaryConcatDescriptor;
 import org.apache.asterix.runtime.evaluators.functions.binary.BinaryLengthDescriptor;
 import org.apache.asterix.runtime.evaluators.functions.binary.FindBinaryDescriptor;
@@ -263,7 +344,7 @@
 import org.apache.hyracks.algebricks.data.IPrinterFactoryProvider;
 import org.apache.hyracks.algebricks.data.ISerializerDeserializerProvider;
 import org.apache.hyracks.algebricks.data.ITypeTraitProvider;
-import org.apache.hyracks.algebricks.runtime.base.ICopyEvaluatorFactory;
+import org.apache.hyracks.algebricks.runtime.base.IScalarEvaluatorFactory;
 import org.apache.hyracks.algebricks.runtime.evaluators.ColumnAccessEvalFactory;
 import org.apache.hyracks.algebricks.runtime.evaluators.ConstantEvalFactory;
 import org.apache.hyracks.api.dataflow.value.INullWriterFactory;
@@ -644,15 +725,15 @@
 
     @SuppressWarnings("unchecked")
     @Override
-    public ICopyEvaluatorFactory getFieldAccessEvaluatorFactory(ARecordType recType, List<String> fldName,
+    public IScalarEvaluatorFactory getFieldAccessEvaluatorFactory(ARecordType recType, List<String> fldName,
             int recordColumn) throws AlgebricksException {
         String[] names = recType.getFieldNames();
         int n = names.length;
         boolean fieldFound = false;
-        ICopyEvaluatorFactory recordEvalFactory = new ColumnAccessEvalFactory(recordColumn);
+        IScalarEvaluatorFactory recordEvalFactory = new ColumnAccessEvalFactory(recordColumn);
         ArrayBackedValueStorage abvs = new ArrayBackedValueStorage();
         DataOutput dos = abvs.getDataOutput();
-        ICopyEvaluatorFactory evalFactory = null;
+        IScalarEvaluatorFactory evalFactory = null;
         if (fldName.size() == 1) {
             for (int i = 0; i < n; i++) {
                 if (names[i].equals(fldName.get(0))) {
@@ -664,7 +745,7 @@
                     } catch (HyracksDataException e) {
                         throw new AlgebricksException(e);
                     }
-                    ICopyEvaluatorFactory fldIndexEvalFactory = new ConstantEvalFactory(
+                    IScalarEvaluatorFactory fldIndexEvalFactory = new ConstantEvalFactory(
                             Arrays.copyOf(abvs.getByteArray(), abvs.getLength()));
 
                     evalFactory = new FieldAccessByIndexEvalFactory(recordEvalFactory, fldIndexEvalFactory, recType);
@@ -690,7 +771,7 @@
                     throw new AlgebricksException(e);
                 }
             }
-            ICopyEvaluatorFactory[] factories = new ICopyEvaluatorFactory[2];
+            IScalarEvaluatorFactory[] factories = new IScalarEvaluatorFactory[2];
             factories[0] = recordEvalFactory;
             if (fldName.size() > 1) {
                 evalFactory = new FieldAccessNestedEvalFactory(recordEvalFactory, recType, fldName);
@@ -699,17 +780,18 @@
                         .createEvaluatorFactory(factories);
             }
             return evalFactory;
-        } else
+        } else {
             throw new AlgebricksException("Could not find field " + fldName + " in the schema.");
+        }
     }
 
     @SuppressWarnings("unchecked")
     @Override
-    public ICopyEvaluatorFactory[] createMBRFactory(ARecordType recType, List<String> fldName, int recordColumn,
+    public IScalarEvaluatorFactory[] createMBRFactory(ARecordType recType, List<String> fldName, int recordColumn,
             int dimension, List<String> filterFieldName) throws AlgebricksException {
-        ICopyEvaluatorFactory evalFactory = getFieldAccessEvaluatorFactory(recType, fldName, recordColumn);
+        IScalarEvaluatorFactory evalFactory = getFieldAccessEvaluatorFactory(recType, fldName, recordColumn);
         int numOfFields = dimension * 2;
-        ICopyEvaluatorFactory[] evalFactories = new ICopyEvaluatorFactory[numOfFields
+        IScalarEvaluatorFactory[] evalFactories = new IScalarEvaluatorFactory[numOfFields
                 + (filterFieldName == null ? 0 : 1)];
 
         ArrayBackedValueStorage abvs1 = new ArrayBackedValueStorage();
@@ -720,7 +802,7 @@
         } catch (HyracksDataException e) {
             throw new AlgebricksException(e);
         }
-        ICopyEvaluatorFactory dimensionEvalFactory = new ConstantEvalFactory(
+        IScalarEvaluatorFactory dimensionEvalFactory = new ConstantEvalFactory(
                 Arrays.copyOf(abvs1.getByteArray(), abvs1.getLength()));
 
         for (int i = 0; i < numOfFields; i++) {
@@ -732,7 +814,7 @@
             } catch (HyracksDataException e) {
                 throw new AlgebricksException(e);
             }
-            ICopyEvaluatorFactory coordinateEvalFactory = new ConstantEvalFactory(
+            IScalarEvaluatorFactory coordinateEvalFactory = new ConstantEvalFactory(
                     Arrays.copyOf(abvs2.getByteArray(), abvs2.getLength()));
 
             evalFactories[i] = new CreateMBREvalFactory(evalFactory, dimensionEvalFactory, coordinateEvalFactory);
@@ -745,14 +827,14 @@
 
     @SuppressWarnings("unchecked")
     @Override
-    public Triple<ICopyEvaluatorFactory, ScalarFunctionCallExpression, IAType> partitioningEvaluatorFactory(
+    public Triple<IScalarEvaluatorFactory, ScalarFunctionCallExpression, IAType> partitioningEvaluatorFactory(
             ARecordType recType, List<String> fldName) throws AlgebricksException {
         String[] names = recType.getFieldNames();
         int n = names.length;
         if (fldName.size() > 1) {
             for (int i = 0; i < n; i++) {
                 if (names[i].equals(fldName.get(0))) {
-                    ICopyEvaluatorFactory recordEvalFactory = new ColumnAccessEvalFactory(
+                    IScalarEvaluatorFactory recordEvalFactory = new ColumnAccessEvalFactory(
                             GlobalConfig.DEFAULT_INPUT_DATA_COLUMN);
                     ArrayBackedValueStorage abvs = new ArrayBackedValueStorage();
                     DataOutput dos = abvs.getDataOutput();
@@ -763,9 +845,9 @@
                     } catch (HyracksDataException e) {
                         throw new AlgebricksException(e);
                     }
-                    ICopyEvaluatorFactory fldIndexEvalFactory = new ConstantEvalFactory(
+                    IScalarEvaluatorFactory fldIndexEvalFactory = new ConstantEvalFactory(
                             Arrays.copyOf(abvs.getByteArray(), abvs.getLength()));
-                    ICopyEvaluatorFactory evalFactory = new FieldAccessByIndexEvalFactory(recordEvalFactory,
+                    IScalarEvaluatorFactory evalFactory = new FieldAccessByIndexEvalFactory(recordEvalFactory,
                             fldIndexEvalFactory, recType);
                     IFunctionInfo finfoAccess = AsterixBuiltinFunctions
                             .getAsterixFunctionInfo(AsterixBuiltinFunctions.FIELD_ACCESS_BY_INDEX);
@@ -774,12 +856,12 @@
                             new MutableObject<ILogicalExpression>(new VariableReferenceExpression(METADATA_DUMMY_VAR)),
                             new MutableObject<ILogicalExpression>(
                                     new ConstantExpression(new AsterixConstantValue(new AInt32(i)))));
-                    return new Triple<ICopyEvaluatorFactory, ScalarFunctionCallExpression, IAType>(evalFactory,
+                    return new Triple<IScalarEvaluatorFactory, ScalarFunctionCallExpression, IAType>(evalFactory,
                             partitionFun, recType.getFieldTypes()[i]);
                 }
             }
         } else {
-            ICopyEvaluatorFactory recordEvalFactory = new ColumnAccessEvalFactory(
+            IScalarEvaluatorFactory recordEvalFactory = new ColumnAccessEvalFactory(
                     GlobalConfig.DEFAULT_INPUT_DATA_COLUMN);
             ArrayBackedValueStorage abvs = new ArrayBackedValueStorage();
             DataOutput dos = abvs.getDataOutput();
@@ -789,7 +871,7 @@
             } catch (HyracksDataException e) {
                 throw new AlgebricksException(e);
             }
-            ICopyEvaluatorFactory evalFactory = new FieldAccessNestedEvalFactory(recordEvalFactory, recType, fldName);
+            IScalarEvaluatorFactory evalFactory = new FieldAccessNestedEvalFactory(recordEvalFactory, recType, fldName);
             IFunctionInfo finfoAccess = AsterixBuiltinFunctions
                     .getAsterixFunctionInfo(AsterixBuiltinFunctions.FIELD_ACCESS_NESTED);
 
@@ -797,7 +879,7 @@
                     new MutableObject<ILogicalExpression>(new VariableReferenceExpression(METADATA_DUMMY_VAR)),
                     new MutableObject<ILogicalExpression>(new ConstantExpression(new AsterixConstantValue(as))));
             try {
-                return new Triple<ICopyEvaluatorFactory, ScalarFunctionCallExpression, IAType>(evalFactory,
+                return new Triple<IScalarEvaluatorFactory, ScalarFunctionCallExpression, IAType>(evalFactory,
                         partitionFun, recType.getSubFieldType(fldName));
             } catch (IOException e) {
                 throw new AlgebricksException(e);
@@ -838,11 +920,12 @@
                 } else {
                     IAType itemType = (IAType) context.getType(f.getArguments().get(0).getValue());
                     if (itemType instanceof AUnionType) {
-                        if (((AUnionType) itemType).isNullableType())
+                        if (((AUnionType) itemType).isNullableType()) {
                             itemType = ((AUnionType) itemType).getNullableType();
-                        else
+                        } else {
                             // Convert UNION types into ANY.
                             itemType = BuiltinType.ANY;
+                        }
                     }
                     ((ListifyAggregateDescriptor) fd).reset(new AOrderedListType(itemType, null));
                 }
@@ -1108,7 +1191,7 @@
 
     @SuppressWarnings("unchecked")
     @Override
-    public ICopyEvaluatorFactory getConstantEvalFactory(IAlgebricksConstantValue value) throws AlgebricksException {
+    public IScalarEvaluatorFactory getConstantEvalFactory(IAlgebricksConstantValue value) throws AlgebricksException {
         IAObject obj = null;
         if (value.isNull()) {
             obj = ANull.NULL;
diff --git a/asterix-runtime/src/main/java/org/apache/asterix/runtime/runningaggregates/std/TidRunningAggregateDescriptor.java b/asterix-runtime/src/main/java/org/apache/asterix/runtime/runningaggregates/std/TidRunningAggregateDescriptor.java
index f8e7fc2..9cdfa56 100644
--- a/asterix-runtime/src/main/java/org/apache/asterix/runtime/runningaggregates/std/TidRunningAggregateDescriptor.java
+++ b/asterix-runtime/src/main/java/org/apache/asterix/runtime/runningaggregates/std/TidRunningAggregateDescriptor.java
@@ -18,8 +18,6 @@
  */
 package org.apache.asterix.runtime.runningaggregates.std;
 
-import java.io.DataOutput;
-
 import org.apache.asterix.formats.nontagged.AqlSerializerDeserializerProvider;
 import org.apache.asterix.om.base.AInt64;
 import org.apache.asterix.om.base.AMutableInt64;
@@ -30,12 +28,14 @@
 import org.apache.asterix.runtime.runningaggregates.base.AbstractRunningAggregateFunctionDynamicDescriptor;
 import org.apache.hyracks.algebricks.common.exceptions.AlgebricksException;
 import org.apache.hyracks.algebricks.core.algebra.functions.FunctionIdentifier;
-import org.apache.hyracks.algebricks.runtime.base.ICopyEvaluatorFactory;
-import org.apache.hyracks.algebricks.runtime.base.ICopyRunningAggregateFunction;
-import org.apache.hyracks.algebricks.runtime.base.ICopyRunningAggregateFunctionFactory;
+import org.apache.hyracks.algebricks.runtime.base.IRunningAggregateEvaluator;
+import org.apache.hyracks.algebricks.runtime.base.IRunningAggregateEvaluatorFactory;
+import org.apache.hyracks.algebricks.runtime.base.IScalarEvaluatorFactory;
+import org.apache.hyracks.api.context.IHyracksTaskContext;
 import org.apache.hyracks.api.dataflow.value.ISerializerDeserializer;
 import org.apache.hyracks.api.exceptions.HyracksDataException;
-import org.apache.hyracks.data.std.api.IDataOutputProvider;
+import org.apache.hyracks.data.std.api.IPointable;
+import org.apache.hyracks.data.std.util.ArrayBackedValueStorage;
 import org.apache.hyracks.dataflow.common.data.accessors.IFrameTupleReference;
 
 public class TidRunningAggregateDescriptor extends AbstractRunningAggregateFunctionDynamicDescriptor {
@@ -49,36 +49,36 @@
     };
 
     @Override
-    public ICopyRunningAggregateFunctionFactory createRunningAggregateFunctionFactory(ICopyEvaluatorFactory[] args)
+    public IRunningAggregateEvaluatorFactory createRunningAggregateEvaluatorFactory(IScalarEvaluatorFactory[] args)
             throws AlgebricksException {
 
-        return new ICopyRunningAggregateFunctionFactory() {
+        return new IRunningAggregateEvaluatorFactory() {
 
             private static final long serialVersionUID = 1L;
 
             @SuppressWarnings("unchecked")
             @Override
-            public ICopyRunningAggregateFunction createRunningAggregateFunction(IDataOutputProvider provider)
+            public IRunningAggregateEvaluator createRunningAggregateEvaluator(IHyracksTaskContext ctx)
                     throws AlgebricksException {
 
-                final DataOutput out = provider.getDataOutput();
+                return new IRunningAggregateEvaluator() {
 
-                return new ICopyRunningAggregateFunction() {
-
-                    int cnt;
-                    ISerializerDeserializer<AInt64> serde = AqlSerializerDeserializerProvider.INSTANCE
+                    private final ArrayBackedValueStorage resultStorage = new ArrayBackedValueStorage();
+                    private final ISerializerDeserializer<AInt64> serde = AqlSerializerDeserializerProvider.INSTANCE
                             .getSerializerDeserializer(BuiltinType.AINT64);
-                    AMutableInt64 m = new AMutableInt64(0);
+                    private final AMutableInt64 m = new AMutableInt64(0);
+                    private int cnt;
 
                     @Override
-                    public void step(IFrameTupleReference tuple) throws AlgebricksException {
+                    public void step(IFrameTupleReference tuple, IPointable result) throws AlgebricksException {
+                        resultStorage.reset();
                         try {
                             m.setValue(cnt);
-                            serde.serialize(m, out);
+                            serde.serialize(m, resultStorage.getDataOutput());
                         } catch (HyracksDataException e) {
                             throw new AlgebricksException(e);
                         }
-
+                        result.set(resultStorage);
                         ++cnt;
                     }
 
diff --git a/asterix-runtime/src/main/java/org/apache/asterix/runtime/unnestingfunctions/std/RangeDescriptor.java b/asterix-runtime/src/main/java/org/apache/asterix/runtime/unnestingfunctions/std/RangeDescriptor.java
index e2a38aa..2f3cd7e 100644
--- a/asterix-runtime/src/main/java/org/apache/asterix/runtime/unnestingfunctions/std/RangeDescriptor.java
+++ b/asterix-runtime/src/main/java/org/apache/asterix/runtime/unnestingfunctions/std/RangeDescriptor.java
@@ -18,8 +18,6 @@
  */
 package org.apache.asterix.runtime.unnestingfunctions.std;
 
-import java.io.DataOutput;
-
 import org.apache.asterix.formats.nontagged.AqlSerializerDeserializerProvider;
 import org.apache.asterix.om.base.AMutableInt64;
 import org.apache.asterix.om.functions.AsterixBuiltinFunctions;
@@ -30,13 +28,15 @@
 import org.apache.asterix.runtime.unnestingfunctions.base.AbstractUnnestingFunctionDynamicDescriptor;
 import org.apache.hyracks.algebricks.common.exceptions.AlgebricksException;
 import org.apache.hyracks.algebricks.core.algebra.functions.FunctionIdentifier;
-import org.apache.hyracks.algebricks.runtime.base.ICopyEvaluator;
-import org.apache.hyracks.algebricks.runtime.base.ICopyEvaluatorFactory;
-import org.apache.hyracks.algebricks.runtime.base.ICopyUnnestingFunction;
-import org.apache.hyracks.algebricks.runtime.base.ICopyUnnestingFunctionFactory;
+import org.apache.hyracks.algebricks.runtime.base.IScalarEvaluator;
+import org.apache.hyracks.algebricks.runtime.base.IScalarEvaluatorFactory;
+import org.apache.hyracks.algebricks.runtime.base.IUnnestingEvaluator;
+import org.apache.hyracks.algebricks.runtime.base.IUnnestingEvaluatorFactory;
+import org.apache.hyracks.api.context.IHyracksTaskContext;
 import org.apache.hyracks.api.dataflow.value.ISerializerDeserializer;
 import org.apache.hyracks.api.exceptions.HyracksDataException;
-import org.apache.hyracks.data.std.api.IDataOutputProvider;
+import org.apache.hyracks.data.std.api.IPointable;
+import org.apache.hyracks.data.std.primitive.VoidPointable;
 import org.apache.hyracks.data.std.util.ArrayBackedValueStorage;
 import org.apache.hyracks.dataflow.common.data.accessors.IFrameTupleReference;
 
@@ -45,6 +45,7 @@
     private static final long serialVersionUID = 1L;
 
     public static final IFunctionDescriptorFactory FACTORY = new IFunctionDescriptorFactory() {
+        @Override
         public IFunctionDescriptor createFunctionDescriptor() {
             return new RangeDescriptor();
         }
@@ -56,41 +57,39 @@
     }
 
     @Override
-    public ICopyUnnestingFunctionFactory createUnnestingFunctionFactory(final ICopyEvaluatorFactory[] args)
+    public IUnnestingEvaluatorFactory createUnnestingEvaluatorFactory(final IScalarEvaluatorFactory[] args)
             throws AlgebricksException {
-        return new ICopyUnnestingFunctionFactory() {
+        return new IUnnestingEvaluatorFactory() {
 
             private static final long serialVersionUID = 1L;
 
             @Override
-            public ICopyUnnestingFunction createUnnestingFunction(final IDataOutputProvider provider)
+            public IUnnestingEvaluator createUnnestingEvaluator(final IHyracksTaskContext ctx)
                     throws AlgebricksException {
-                return new ICopyUnnestingFunction() {
+                return new IUnnestingEvaluator() {
 
-                    private DataOutput out = provider.getDataOutput();
+                    private ArrayBackedValueStorage resultStorage = new ArrayBackedValueStorage();
                     @SuppressWarnings("rawtypes")
                     private ISerializerDeserializer serde = AqlSerializerDeserializerProvider.INSTANCE
                             .getSerializerDeserializer(BuiltinType.AINT64);
-                    private ArrayBackedValueStorage inputVal = new ArrayBackedValueStorage();
-                    private ICopyEvaluator eval0 = args[0].createEvaluator(inputVal);
-                    private ICopyEvaluator eval1 = args[1].createEvaluator(inputVal);
+                    private IPointable inputVal = new VoidPointable();
+                    private IScalarEvaluator eval0 = args[0].createScalarEvaluator(ctx);
+                    private IScalarEvaluator eval1 = args[1].createScalarEvaluator(ctx);
                     private AMutableInt64 aInt64 = new AMutableInt64(0);
                     private long current;
                     private long max;
 
                     @Override
                     public void init(IFrameTupleReference tuple) throws AlgebricksException {
-                        inputVal.reset();
-                        eval0.evaluate(tuple);
+                        eval0.evaluate(tuple, inputVal);
                         try {
-                            current = ATypeHierarchy.getLongValue(inputVal.getByteArray(), 0);
+                            current = ATypeHierarchy.getLongValue(inputVal.getByteArray(), inputVal.getStartOffset());
                         } catch (HyracksDataException e) {
                             throw new AlgebricksException(e);
                         }
-                        inputVal.reset();
-                        eval1.evaluate(tuple);
+                        eval1.evaluate(tuple, inputVal);
                         try {
-                            max = ATypeHierarchy.getLongValue(inputVal.getByteArray(), 0);
+                            max = ATypeHierarchy.getLongValue(inputVal.getByteArray(), inputVal.getStartOffset());
                         } catch (HyracksDataException e) {
                             throw new AlgebricksException(e);
                         }
@@ -98,13 +97,15 @@
 
                     @SuppressWarnings("unchecked")
                     @Override
-                    public boolean step() throws AlgebricksException {
+                    public boolean step(IPointable result) throws AlgebricksException {
                         if (current > max) {
                             return false;
                         }
                         aInt64.setValue(current);
                         try {
-                            serde.serialize(aInt64, out);
+                            resultStorage.reset();
+                            serde.serialize(aInt64, resultStorage.getDataOutput());
+                            result.set(resultStorage);
                         } catch (HyracksDataException e) {
                             throw new AlgebricksException(e);
                         }
diff --git a/asterix-runtime/src/main/java/org/apache/asterix/runtime/unnestingfunctions/std/ScanCollectionDescriptor.java b/asterix-runtime/src/main/java/org/apache/asterix/runtime/unnestingfunctions/std/ScanCollectionDescriptor.java
index 88b3da4..495e7b6 100644
--- a/asterix-runtime/src/main/java/org/apache/asterix/runtime/unnestingfunctions/std/ScanCollectionDescriptor.java
+++ b/asterix-runtime/src/main/java/org/apache/asterix/runtime/unnestingfunctions/std/ScanCollectionDescriptor.java
@@ -19,7 +19,6 @@
 
 package org.apache.asterix.runtime.unnestingfunctions.std;
 
-import java.io.DataOutput;
 import java.io.IOException;
 
 import org.apache.asterix.common.exceptions.AsterixException;
@@ -32,11 +31,13 @@
 import org.apache.asterix.runtime.unnestingfunctions.base.AbstractUnnestingFunctionDynamicDescriptor;
 import org.apache.hyracks.algebricks.common.exceptions.AlgebricksException;
 import org.apache.hyracks.algebricks.core.algebra.functions.FunctionIdentifier;
-import org.apache.hyracks.algebricks.runtime.base.ICopyEvaluator;
-import org.apache.hyracks.algebricks.runtime.base.ICopyEvaluatorFactory;
-import org.apache.hyracks.algebricks.runtime.base.ICopyUnnestingFunction;
-import org.apache.hyracks.algebricks.runtime.base.ICopyUnnestingFunctionFactory;
-import org.apache.hyracks.data.std.api.IDataOutputProvider;
+import org.apache.hyracks.algebricks.runtime.base.IScalarEvaluator;
+import org.apache.hyracks.algebricks.runtime.base.IScalarEvaluatorFactory;
+import org.apache.hyracks.algebricks.runtime.base.IUnnestingEvaluator;
+import org.apache.hyracks.algebricks.runtime.base.IUnnestingEvaluatorFactory;
+import org.apache.hyracks.api.context.IHyracksTaskContext;
+import org.apache.hyracks.data.std.api.IPointable;
+import org.apache.hyracks.data.std.primitive.VoidPointable;
 import org.apache.hyracks.data.std.util.ArrayBackedValueStorage;
 import org.apache.hyracks.dataflow.common.data.accessors.IFrameTupleReference;
 
@@ -44,6 +45,7 @@
 
     private static final long serialVersionUID = 1L;
     public static final IFunctionDescriptorFactory FACTORY = new IFunctionDescriptorFactory() {
+        @Override
         public IFunctionDescriptor createFunctionDescriptor() {
             return new ScanCollectionDescriptor();
         }
@@ -55,44 +57,42 @@
     }
 
     @Override
-    public ICopyUnnestingFunctionFactory createUnnestingFunctionFactory(final ICopyEvaluatorFactory[] args) {
+    public IUnnestingEvaluatorFactory createUnnestingEvaluatorFactory(final IScalarEvaluatorFactory[] args) {
         return new ScanCollectionUnnestingFunctionFactory(args[0]);
     }
 
-    public static class ScanCollectionUnnestingFunctionFactory implements ICopyUnnestingFunctionFactory {
+    public static class ScanCollectionUnnestingFunctionFactory implements IUnnestingEvaluatorFactory {
 
         private static final long serialVersionUID = 1L;
-        private ICopyEvaluatorFactory listEvalFactory;
+        private IScalarEvaluatorFactory listEvalFactory;
 
-        public ScanCollectionUnnestingFunctionFactory(ICopyEvaluatorFactory arg) {
+        public ScanCollectionUnnestingFunctionFactory(IScalarEvaluatorFactory arg) {
             this.listEvalFactory = arg;
         }
 
         @Override
-        public ICopyUnnestingFunction createUnnestingFunction(IDataOutputProvider provider) throws AlgebricksException {
+        public IUnnestingEvaluator createUnnestingEvaluator(IHyracksTaskContext ctx) throws AlgebricksException {
 
-            final DataOutput out = provider.getDataOutput();
+            return new IUnnestingEvaluator() {
 
-            return new ICopyUnnestingFunction() {
-
+                private final ArrayBackedValueStorage resultStorage = new ArrayBackedValueStorage();
                 private final AsterixListAccessor listAccessor = new AsterixListAccessor();
-                private ArrayBackedValueStorage inputVal = new ArrayBackedValueStorage();
-                private ICopyEvaluator argEval = listEvalFactory.createEvaluator(inputVal);
+                private final IPointable inputVal = new VoidPointable();
+                private final IScalarEvaluator argEval = listEvalFactory.createScalarEvaluator(ctx);
                 private int itemIndex;
                 private boolean metNull = false;
 
                 @Override
                 public void init(IFrameTupleReference tuple) throws AlgebricksException {
                     try {
-                        inputVal.reset();
-                        argEval.evaluate(tuple);
+                        argEval.evaluate(tuple, inputVal);
                         ATypeTag typeTag = EnumDeserializer.ATYPETAGDESERIALIZER
-                                .deserialize(inputVal.getByteArray()[0]);
+                                .deserialize(inputVal.getByteArray()[inputVal.getStartOffset()]);
                         if (typeTag == ATypeTag.NULL) {
                             metNull = true;
                             return;
                         }
-                        listAccessor.reset(inputVal.getByteArray(), 0);
+                        listAccessor.reset(inputVal.getByteArray(), inputVal.getStartOffset());
                         itemIndex = 0;
                     } catch (AsterixException e) {
                         throw new AlgebricksException(e);
@@ -100,11 +100,13 @@
                 }
 
                 @Override
-                public boolean step() throws AlgebricksException {
+                public boolean step(IPointable result) throws AlgebricksException {
                     try {
                         if (!metNull) {
                             if (itemIndex < listAccessor.size()) {
-                                listAccessor.writeItem(itemIndex, out);
+                                resultStorage.reset();
+                                listAccessor.writeItem(itemIndex, resultStorage.getDataOutput());
+                                result.set(resultStorage);
                                 ++itemIndex;
                                 return true;
                             }
diff --git a/asterix-runtime/src/main/java/org/apache/asterix/runtime/unnestingfunctions/std/SubsetCollectionDescriptor.java b/asterix-runtime/src/main/java/org/apache/asterix/runtime/unnestingfunctions/std/SubsetCollectionDescriptor.java
index 88d9a4e..4ad01d8 100644
--- a/asterix-runtime/src/main/java/org/apache/asterix/runtime/unnestingfunctions/std/SubsetCollectionDescriptor.java
+++ b/asterix-runtime/src/main/java/org/apache/asterix/runtime/unnestingfunctions/std/SubsetCollectionDescriptor.java
@@ -18,31 +18,28 @@
  */
 package org.apache.asterix.runtime.unnestingfunctions.std;
 
-import java.io.DataOutput;
 import java.io.IOException;
 
 import org.apache.asterix.common.exceptions.AsterixException;
 import org.apache.asterix.dataflow.data.nontagged.serde.AOrderedListSerializerDeserializer;
 import org.apache.asterix.dataflow.data.nontagged.serde.AUnorderedListSerializerDeserializer;
-import org.apache.asterix.formats.nontagged.AqlSerializerDeserializerProvider;
-import org.apache.asterix.om.base.ANull;
 import org.apache.asterix.om.functions.AsterixBuiltinFunctions;
 import org.apache.asterix.om.functions.IFunctionDescriptor;
 import org.apache.asterix.om.functions.IFunctionDescriptorFactory;
 import org.apache.asterix.om.types.ATypeTag;
-import org.apache.asterix.om.types.BuiltinType;
 import org.apache.asterix.om.types.EnumDeserializer;
 import org.apache.asterix.om.types.hierachy.ATypeHierarchy;
 import org.apache.asterix.om.util.NonTaggedFormatUtil;
 import org.apache.asterix.runtime.unnestingfunctions.base.AbstractUnnestingFunctionDynamicDescriptor;
 import org.apache.hyracks.algebricks.common.exceptions.AlgebricksException;
 import org.apache.hyracks.algebricks.core.algebra.functions.FunctionIdentifier;
-import org.apache.hyracks.algebricks.runtime.base.ICopyEvaluator;
-import org.apache.hyracks.algebricks.runtime.base.ICopyEvaluatorFactory;
-import org.apache.hyracks.algebricks.runtime.base.ICopyUnnestingFunction;
-import org.apache.hyracks.algebricks.runtime.base.ICopyUnnestingFunctionFactory;
-import org.apache.hyracks.api.dataflow.value.ISerializerDeserializer;
-import org.apache.hyracks.data.std.api.IDataOutputProvider;
+import org.apache.hyracks.algebricks.runtime.base.IScalarEvaluator;
+import org.apache.hyracks.algebricks.runtime.base.IScalarEvaluatorFactory;
+import org.apache.hyracks.algebricks.runtime.base.IUnnestingEvaluator;
+import org.apache.hyracks.algebricks.runtime.base.IUnnestingEvaluatorFactory;
+import org.apache.hyracks.api.context.IHyracksTaskContext;
+import org.apache.hyracks.data.std.api.IPointable;
+import org.apache.hyracks.data.std.primitive.VoidPointable;
 import org.apache.hyracks.data.std.util.ArrayBackedValueStorage;
 import org.apache.hyracks.dataflow.common.data.accessors.IFrameTupleReference;
 
@@ -56,68 +53,65 @@
     };
 
     @Override
-    public ICopyUnnestingFunctionFactory createUnnestingFunctionFactory(final ICopyEvaluatorFactory[] args)
+    public IUnnestingEvaluatorFactory createUnnestingEvaluatorFactory(final IScalarEvaluatorFactory[] args)
             throws AlgebricksException {
-        return new ICopyUnnestingFunctionFactory() {
+        return new IUnnestingEvaluatorFactory() {
             private static final long serialVersionUID = 1L;
 
             @Override
-            public ICopyUnnestingFunction createUnnestingFunction(IDataOutputProvider provider)
-                    throws AlgebricksException {
+            public IUnnestingEvaluator createUnnestingEvaluator(IHyracksTaskContext ctx) throws AlgebricksException {
 
-                final DataOutput out = provider.getDataOutput();
-
-                return new ICopyUnnestingFunction() {
-                    @SuppressWarnings("unchecked")
-                    private ISerializerDeserializer<ANull> nullSerde = AqlSerializerDeserializerProvider.INSTANCE
-                            .getSerializerDeserializer(BuiltinType.ANULL);
-                    private ArrayBackedValueStorage inputVal = new ArrayBackedValueStorage();
-                    private ICopyEvaluator evalList = args[0].createEvaluator(inputVal);
-                    private ICopyEvaluator evalStart = args[1].createEvaluator(inputVal);
-                    private ICopyEvaluator evalLen = args[2].createEvaluator(inputVal);
+                return new IUnnestingEvaluator() {
+                    private IPointable inputVal = new VoidPointable();
+                    private IScalarEvaluator evalList = args[0].createScalarEvaluator(ctx);
+                    private IScalarEvaluator evalStart = args[1].createScalarEvaluator(ctx);
+                    private IScalarEvaluator evalLen = args[2].createScalarEvaluator(ctx);
+                    private ArrayBackedValueStorage resultStorage = new ArrayBackedValueStorage();
                     private int numItems;
                     private int numItemsMax;
                     private int posStart;
                     private int posCrt;
                     private ATypeTag itemTag;
                     private boolean selfDescList = false;
+                    private boolean metNull = false;
 
                     @Override
                     public void init(IFrameTupleReference tuple) throws AlgebricksException {
                         try {
-                            inputVal.reset();
-                            evalStart.evaluate(tuple);
+                            evalStart.evaluate(tuple, inputVal);
+                            posStart = ATypeHierarchy.getIntegerValue(inputVal.getByteArray(),
+                                    inputVal.getStartOffset());
 
-                            posStart = ATypeHierarchy.getIntegerValue(inputVal.getByteArray(), 0);
+                            evalLen.evaluate(tuple, inputVal);
+                            numItems = ATypeHierarchy.getIntegerValue(inputVal.getByteArray(),
+                                    inputVal.getStartOffset());
 
-                            inputVal.reset();
-                            evalLen.evaluate(tuple);
-
-                            numItems = ATypeHierarchy.getIntegerValue(inputVal.getByteArray(), 0);
-
-                            inputVal.reset();
-                            evalList.evaluate(tuple);
-
+                            evalList.evaluate(tuple, inputVal);
                             byte[] serList = inputVal.getByteArray();
+                            int offset = inputVal.getStartOffset();
+                            metNull = false;
 
-                            if (serList[0] == ATypeTag.SERIALIZED_NULL_TYPE_TAG) {
-                                nullSerde.serialize(ANull.NULL, out);
+                            byte typeTag = serList[offset];
+                            if (typeTag == ATypeTag.SERIALIZED_NULL_TYPE_TAG) {
+                                metNull = true;
                                 return;
                             }
 
-                            if (serList[0] != ATypeTag.SERIALIZED_ORDEREDLIST_TYPE_TAG
-                                    && serList[0] != ATypeTag.SERIALIZED_UNORDEREDLIST_TYPE_TAG) {
+                            if (typeTag != ATypeTag.SERIALIZED_ORDEREDLIST_TYPE_TAG
+                                    && typeTag != ATypeTag.SERIALIZED_UNORDEREDLIST_TYPE_TAG) {
                                 throw new AlgebricksException("Subset-collection is not defined for values of type"
-                                        + EnumDeserializer.ATYPETAGDESERIALIZER.deserialize(serList[0]));
+                                        + EnumDeserializer.ATYPETAGDESERIALIZER.deserialize(typeTag));
                             }
-                            if (serList[0] == ATypeTag.SERIALIZED_ORDEREDLIST_TYPE_TAG)
-                                numItemsMax = AOrderedListSerializerDeserializer.getNumberOfItems(serList);
-                            else
-                                numItemsMax = AUnorderedListSerializerDeserializer.getNumberOfItems(serList);
+                            if (typeTag == ATypeTag.SERIALIZED_ORDEREDLIST_TYPE_TAG) {
+                                numItemsMax = AOrderedListSerializerDeserializer.getNumberOfItems(serList, offset);
+                            } else {
+                                numItemsMax = AUnorderedListSerializerDeserializer.getNumberOfItems(serList, offset);
+                            }
 
-                            itemTag = EnumDeserializer.ATYPETAGDESERIALIZER.deserialize(serList[1]);
-                            if (itemTag == ATypeTag.ANY)
+                            itemTag = EnumDeserializer.ATYPETAGDESERIALIZER.deserialize(serList[offset + 1]);
+                            if (itemTag == ATypeTag.ANY) {
                                 selfDescList = true;
+                            }
 
                             posCrt = posStart;
                         } catch (IOException e) {
@@ -126,24 +120,31 @@
                     }
 
                     @Override
-                    public boolean step() throws AlgebricksException {
-                        if (posCrt < posStart + numItems && posCrt < numItemsMax) {
+                    public boolean step(IPointable result) throws AlgebricksException {
+                        if (!metNull && posCrt < posStart + numItems && posCrt < numItemsMax) {
+                            resultStorage.reset();
                             byte[] serList = inputVal.getByteArray();
+                            int offset = inputVal.getStartOffset();
                             int itemLength = 0;
                             try {
-                                int itemOffset = AOrderedListSerializerDeserializer.getItemOffset(serList, posCrt);
-                                if (selfDescList)
+                                int itemOffset = AOrderedListSerializerDeserializer.getItemOffset(serList, offset,
+                                        posCrt);
+                                if (selfDescList) {
                                     itemTag = EnumDeserializer.ATYPETAGDESERIALIZER.deserialize(serList[itemOffset]);
+                                }
                                 itemLength = NonTaggedFormatUtil.getFieldValueLength(serList, itemOffset, itemTag,
                                         selfDescList);
-                                if (!selfDescList)
-                                    out.writeByte(itemTag.serialize());
-                                out.write(serList, itemOffset, itemLength + (!selfDescList ? 0 : 1));
+                                if (!selfDescList) {
+                                    resultStorage.getDataOutput().writeByte(itemTag.serialize());
+                                }
+                                resultStorage.getDataOutput().write(serList, itemOffset,
+                                        itemLength + (!selfDescList ? 0 : 1));
                             } catch (IOException e) {
                                 throw new AlgebricksException(e);
                             } catch (AsterixException e) {
                                 throw new AlgebricksException(e);
                             }
+                            result.set(resultStorage);
                             ++posCrt;
                             return true;
                         }