asterixdb-commits mailing list archives

Site index · List index
Message view « Date » · « Thread »
Top « Date » · « Thread »
From buyin...@apache.org
Subject [10/24] incubator-asterixdb git commit: Move to non-copy-based evaluator interfaces for all function implementations, including: - scalar functions, - aggregate functions, - running aggregate functions, - unnesting functions
Date Sat, 13 Feb 2016 02:15:39 GMT
http://git-wip-us.apache.org/repos/asf/incubator-asterixdb/blob/0ae30836/asterix-runtime/src/main/java/org/apache/asterix/runtime/evaluators/functions/NumericUnaryMinusDescriptor.java
----------------------------------------------------------------------
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.asterix.runtime.evaluators.base.AbstractScalarFunctionDynamicD
 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 @@ public class NumericUnaryMinusDescriptor extends AbstractScalarFunctionDynamicDe
     };
 
     @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 @@ public class NumericUnaryMinusDescriptor extends AbstractScalarFunctionDynamicDe
 
                     @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);
                     }
                 };
             }

http://git-wip-us.apache.org/repos/asf/incubator-asterixdb/blob/0ae30836/asterix-runtime/src/main/java/org/apache/asterix/runtime/evaluators/functions/OrDescriptor.java
----------------------------------------------------------------------
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.om.types.BuiltinType;
 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 @@ public class OrDescriptor extends AbstractScalarFunctionDynamicDescriptor {
     }
 
     @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 @@ public class OrDescriptor extends AbstractScalarFunctionDynamicDescriptor {
                             .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 @@ public class OrDescriptor extends AbstractScalarFunctionDynamicDescriptor {
                             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);
                         }

http://git-wip-us.apache.org/repos/asf/incubator-asterixdb/blob/0ae30836/asterix-runtime/src/main/java/org/apache/asterix/runtime/evaluators/functions/OrderedListConstructorDescriptor.java
----------------------------------------------------------------------
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.om.types.ATypeTag;
 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 @@ public class OrderedListConstructorDescriptor extends AbstractScalarFunctionDyna
 
     private static final long serialVersionUID = 1L;
     public static final IFunctionDescriptorFactory FACTORY = new IFunctionDescriptorFactory() {
+        @Override
         public IFunctionDescriptor createFunctionDescriptor() {
             return new OrderedListConstructorDescriptor();
         }
@@ -57,20 +60,20 @@ public class OrderedListConstructorDescriptor extends AbstractScalarFunctionDyna
     }
 
     @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 @@ public class OrderedListConstructorDescriptor extends AbstractScalarFunctionDyna
         }
 
         @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 @@ public class OrderedListConstructorDescriptor extends AbstractScalarFunctionDyna
                             this.writeTypedItems(tuple);
                         }
                         builder.write(out, true);
+                        result.set(resultStorage);
                     } catch (IOException ioe) {
                         throw new AlgebricksException(ioe);
                     }
@@ -111,8 +116,7 @@ public class OrderedListConstructorDescriptor extends AbstractScalarFunctionDyna
 
                     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 @@ public class OrderedListConstructorDescriptor extends AbstractScalarFunctionDyna
 
                     try {
                         for (int i = 0; i < argEvals.length; i++) {
-                            inputVal.reset();
-                            argEvals[i].evaluate(tuple);
+                            argEvals[i].evaluate(tuple, inputVal);
                             builder.addItem(inputVal);
                         }
 

http://git-wip-us.apache.org/repos/asf/incubator-asterixdb/blob/0ae30836/asterix-runtime/src/main/java/org/apache/asterix/runtime/evaluators/functions/PrefixLenDescriptor.java
----------------------------------------------------------------------
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.base.AbstractScalarFunctionDynamicD
 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 @@ public class PrefixLenDescriptor extends AbstractScalarFunctionDynamicDescriptor
     };
 
     @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 @@ public class PrefixLenDescriptor extends AbstractScalarFunctionDynamicDescriptor
                             .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 @@ public class PrefixLenDescriptor extends AbstractScalarFunctionDynamicDescriptor
                         } catch (IOException e) {
                             throw new AlgebricksException(e);
                         }
+                        result.set(resultStorage);
                     }
                 };
             }

http://git-wip-us.apache.org/repos/asf/incubator-asterixdb/blob/0ae30836/asterix-runtime/src/main/java/org/apache/asterix/runtime/evaluators/functions/PrefixLenJaccardDescriptor.java
----------------------------------------------------------------------
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.om.types.hierachy.ATypeHierarchy;
 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 @@ public class PrefixLenJaccardDescriptor extends AbstractScalarFunctionDynamicDes
     };
 
     @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 @@ public class PrefixLenJaccardDescriptor extends AbstractScalarFunctionDynamicDes
                             .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 @@ public class PrefixLenJaccardDescriptor extends AbstractScalarFunctionDynamicDes
                         } catch (IOException e) {
                             throw new AlgebricksException(e);
                         }
+                        result.set(resultStorage);
                     }
                 };
             }

http://git-wip-us.apache.org/repos/asf/incubator-asterixdb/blob/0ae30836/asterix-runtime/src/main/java/org/apache/asterix/runtime/evaluators/functions/RegExpDescriptor.java
----------------------------------------------------------------------
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.om.types.EnumDeserializer;
 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 @@ public class RegExpDescriptor extends AbstractScalarFunctionDynamicDescriptor {
     }
 
     @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 ICopyEvaluator() {
+                return new IScalarEvaluator() {
 
+                    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 @@ public class RegExpDescriptor extends AbstractScalarFunctionDynamicDescriptor {
                     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 @@ public class RegExpDescriptor extends AbstractScalarFunctionDynamicDescriptor {
                                 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 @@ public class RegExpDescriptor extends AbstractScalarFunctionDynamicDescriptor {
                             }
                             ABoolean res = (matcher.find(0)) ? ABoolean.TRUE : ABoolean.FALSE;
                             booleanSerde.serialize(res, dout);
+                            result.set(resultStorage);
                         } catch (HyracksDataException e) {
                             throw new AlgebricksException(e);
                         }

http://git-wip-us.apache.org/repos/asf/incubator-asterixdb/blob/0ae30836/asterix-runtime/src/main/java/org/apache/asterix/runtime/evaluators/functions/SimilarityDescriptor.java
----------------------------------------------------------------------
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.base.AbstractScalarFunctionDynamicD
 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 @@ public class SimilarityDescriptor extends AbstractScalarFunctionDynamicDescripto
     };
 
     @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 @@ public class SimilarityDescriptor extends AbstractScalarFunctionDynamicDescripto
                             .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());
-
-                        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]));
+                        SimilarityFilters similarityFilters = similarityFiltersCache.get(similarityThreshold, data,
+                                offset, len);
+
+                        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);
-
-                        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]));
+                        int length1 = IntegerPointable.getInteger(data, offset + 1);
+
+                        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 @@ public class SimilarityDescriptor extends AbstractScalarFunctionDynamicDescripto
                             // -- - 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 @@ public class SimilarityDescriptor extends AbstractScalarFunctionDynamicDescripto
 
                             // -- - 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 @@ public class SimilarityDescriptor extends AbstractScalarFunctionDynamicDescripto
                             }
 
                             // -- - 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 @@ public class SimilarityDescriptor extends AbstractScalarFunctionDynamicDescripto
                         } catch (IOException e) {
                             throw new AlgebricksException(e);
                         }
+                        result.set(resultStorage);
                     }
                 };
             }

http://git-wip-us.apache.org/repos/asf/incubator-asterixdb/blob/0ae30836/asterix-runtime/src/main/java/org/apache/asterix/runtime/evaluators/functions/SimilarityJaccardCheckDescriptor.java
----------------------------------------------------------------------
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.base.AbstractScalarFunctionDynamicD
 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);
             }
         };
     }

http://git-wip-us.apache.org/repos/asf/incubator-asterixdb/blob/0ae30836/asterix-runtime/src/main/java/org/apache/asterix/runtime/evaluators/functions/SimilarityJaccardDescriptor.java
----------------------------------------------------------------------
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.base.AbstractScalarFunctionDynamicD
 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);
             }
         };
     }

http://git-wip-us.apache.org/repos/asf/incubator-asterixdb/blob/0ae30836/asterix-runtime/src/main/java/org/apache/asterix/runtime/evaluators/functions/SimilarityJaccardPrefixCheckDescriptor.java
----------------------------------------------------------------------
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.base.AbstractScalarFunctionDynamicD
 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 @@ public class SimilarityJaccardPrefixCheckDescriptor extends AbstractScalarFuncti
     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 @@ public class SimilarityJaccardPrefixCheckDescriptor extends AbstractScalarFuncti
 
         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 @@ public class SimilarityJaccardPrefixCheckDescriptor extends AbstractScalarFuncti
             listBuilder.addItem(inputVal);
 
             listBuilder.write(out, true);
-
         }
     }
 

http://git-wip-us.apache.org/repos/asf/incubator-asterixdb/blob/0ae30836/asterix-runtime/src/main/java/org/apache/asterix/runtime/evaluators/functions/SimilarityJaccardPrefixDescriptor.java
----------------------------------------------------------------------
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.base.AbstractScalarFunctionDynamicD
 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);
             }
         };
     }

http://git-wip-us.apache.org/repos/asf/incubator-asterixdb/blob/0ae30836/asterix-runtime/src/main/java/org/apache/asterix/runtime/evaluators/functions/SimilarityJaccardSortedCheckDescriptor.java
----------------------------------------------------------------------
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.base.AbstractScalarFunctionDynamicD
 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);
             }
         };
     }

http://git-wip-us.apache.org/repos/asf/incubator-asterixdb/blob/0ae30836/asterix-runtime/src/main/java/org/apache/asterix/runtime/evaluators/functions/SimilarityJaccardSortedDescriptor.java
----------------------------------------------------------------------
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.base.AbstractScalarFunctionDynamicD
 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);
             }
         };
     }


Mime
View raw message