1) Fixes Issue 24:Need grammar consistency w.r.t. semicolons
   ';' is the terminator symbol for all AQL statements/queries. As per the last discussion, we decided to keep the terminator symbol optional for create type 
   statement and aql queries. If we choose to make it mandatory for them, I would go ahead an modify all test cases. 
2) Fixed a bug in create dataset syntax that deems the datatype compoenent of a dataset definition as being optionalr, resulting in NPE.
3) Code refactoring centering use of FunctionDescriptors. Code reduction and simplication with interfaces replaced by abstract classes that have default implementation. 


git-svn-id: https://asterixdb.googlecode.com/svn/branches/asterix_stabilization@576 eaa15691-b419-025a-1212-ee371bd00084
diff --git a/asterix-algebra/src/main/java/edu/uci/ics/asterix/jobgen/AqlLogicalExpressionJobGen.java b/asterix-algebra/src/main/java/edu/uci/ics/asterix/jobgen/AqlLogicalExpressionJobGen.java
index 9717d6a..f515516 100644
--- a/asterix-algebra/src/main/java/edu/uci/ics/asterix/jobgen/AqlLogicalExpressionJobGen.java
+++ b/asterix-algebra/src/main/java/edu/uci/ics/asterix/jobgen/AqlLogicalExpressionJobGen.java
@@ -4,28 +4,22 @@
 
 import org.apache.commons.lang3.mutable.Mutable;
 
+import edu.uci.ics.asterix.common.functions.FunctionDescriptorTag;
 import edu.uci.ics.asterix.formats.base.IDataFormat;
 import edu.uci.ics.asterix.metadata.declared.AqlCompiledMetadataDeclarations;
 import edu.uci.ics.asterix.metadata.declared.AqlMetadataProvider;
 import edu.uci.ics.asterix.om.functions.AsterixBuiltinFunctions;
 import edu.uci.ics.asterix.om.functions.IFunctionDescriptor;
-import edu.uci.ics.asterix.runtime.base.IAggregateFunctionDynamicDescriptor;
-import edu.uci.ics.asterix.runtime.base.IRunningAggregateFunctionDynamicDescriptor;
-import edu.uci.ics.asterix.runtime.base.IScalarFunctionDynamicDescriptor;
-import edu.uci.ics.asterix.runtime.base.ISerializableAggregateFunctionDynamicDescriptor;
-import edu.uci.ics.asterix.runtime.base.IUnnestingFunctionDynamicDescriptor;
 import edu.uci.ics.asterix.runtime.evaluators.comparisons.ComparisonEvalFactory;
 import edu.uci.ics.asterix.runtime.formats.FormatUtils;
 import edu.uci.ics.hyracks.algebricks.common.exceptions.AlgebricksException;
 import edu.uci.ics.hyracks.algebricks.core.algebra.base.ILogicalExpression;
 import edu.uci.ics.hyracks.algebricks.core.algebra.base.LogicalVariable;
 import edu.uci.ics.hyracks.algebricks.core.algebra.expressions.AbstractFunctionCallExpression;
-import edu.uci.ics.hyracks.algebricks.core.algebra.expressions.AbstractFunctionCallExpression.FunctionKind;
 import edu.uci.ics.hyracks.algebricks.core.algebra.expressions.AggregateFunctionCallExpression;
 import edu.uci.ics.hyracks.algebricks.core.algebra.expressions.ConstantExpression;
 import edu.uci.ics.hyracks.algebricks.core.algebra.expressions.ILogicalExpressionJobGen;
 import edu.uci.ics.hyracks.algebricks.core.algebra.expressions.IVariableTypeEnvironment;
-import edu.uci.ics.hyracks.algebricks.core.algebra.expressions.ScalarFunctionCallExpression;
 import edu.uci.ics.hyracks.algebricks.core.algebra.expressions.StatefulFunctionCallExpression;
 import edu.uci.ics.hyracks.algebricks.core.algebra.expressions.UnnestingFunctionCallExpression;
 import edu.uci.ics.hyracks.algebricks.core.algebra.expressions.VariableReferenceExpression;
@@ -53,79 +47,25 @@
             IVariableTypeEnvironment env, IOperatorSchema[] inputSchemas, JobGenContext context)
             throws AlgebricksException {
         ICopyEvaluatorFactory[] args = codegenArguments(expr, env, inputSchemas, context);
-        IFunctionDescriptor fd;
-        AqlMetadataProvider mp = (AqlMetadataProvider) context.getMetadataProvider();
-        AqlCompiledMetadataDeclarations compiledDecls = mp.getMetadataDeclarations();
-        try {
-            fd = compiledDecls.getFormat().resolveFunction(expr, env);
-        } catch (AlgebricksException e) {
-            throw new AlgebricksException(e);
-        }
+        IFunctionDescriptor fd = getFunctionDescriptor(expr, env, context);
         switch (fd.getFunctionDescriptorTag()) {
-            case SCALAR: {
-                throw new AlgebricksException(
-                        "Trying to create an aggregate from a scalar evaluator function descriptor. (fi="
-                                + expr.getFunctionIdentifier() + ")");
-            }
-            case AGGREGATE: {
-                IAggregateFunctionDynamicDescriptor afdd = (IAggregateFunctionDynamicDescriptor) fd;
-                return afdd.createAggregateFunctionFactory(args);
-            }
-            case SERIALAGGREGATE: {
-                // temporal hack
+            case SERIALAGGREGATE:
                 return null;
-            }
-            case RUNNINGAGGREGATE: {
-                throw new AlgebricksException(
-                        "Trying to create an aggregate from a running aggregate function descriptor.");
-            }
-            case UNNEST: {
-                throw new AlgebricksException(
-                        "Trying to create an aggregate from an unnesting aggregate function descriptor.");
-            }
-
-            default: {
-                throw new IllegalStateException(fd.getFunctionDescriptorTag().toString());
-            }
+            case AGGREGATE:
+                return fd.createAggregateFunctionFactory(args);
+            default:
+                throw new IllegalStateException("Invalid function descriptor " + fd.getFunctionDescriptorTag()
+                        + " expected " + FunctionDescriptorTag.SERIALAGGREGATE + " or "
+                        + FunctionDescriptorTag.AGGREGATE);
         }
-
     }
 
     @Override
-    public ICopyRunningAggregateFunctionFactory createRunningAggregateFunctionFactory(StatefulFunctionCallExpression expr,
-            IVariableTypeEnvironment env, IOperatorSchema[] inputSchemas, JobGenContext context)
-            throws AlgebricksException {
+    public ICopyRunningAggregateFunctionFactory createRunningAggregateFunctionFactory(
+            StatefulFunctionCallExpression expr, IVariableTypeEnvironment env, IOperatorSchema[] inputSchemas,
+            JobGenContext context) throws AlgebricksException {
         ICopyEvaluatorFactory[] args = codegenArguments(expr, env, inputSchemas, context);
-        IFunctionDescriptor fd;
-        AqlMetadataProvider mp = (AqlMetadataProvider) context.getMetadataProvider();
-        AqlCompiledMetadataDeclarations compiledDecls = mp.getMetadataDeclarations();
-        try {
-            fd = compiledDecls.getFormat().resolveFunction(expr, env);
-        } catch (AlgebricksException e) {
-            throw new AlgebricksException(e);
-        }
-        switch (fd.getFunctionDescriptorTag()) {
-            case SCALAR: {
-                throw new AlgebricksException(
-                        "Trying to create a running aggregate from a scalar evaluator function descriptor. (fi="
-                                + expr.getFunctionIdentifier() + ")");
-            }
-            case AGGREGATE: {
-                throw new AlgebricksException(
-                        "Trying to create a running aggregate from an aggregate function descriptor.");
-            }
-            case UNNEST: {
-                throw new AlgebricksException(
-                        "Trying to create a running aggregate from an unnesting function descriptor.");
-            }
-            case RUNNINGAGGREGATE: {
-                IRunningAggregateFunctionDynamicDescriptor rafdd = (IRunningAggregateFunctionDynamicDescriptor) fd;
-                return rafdd.createRunningAggregateFunctionFactory(args);
-            }
-            default: {
-                throw new IllegalStateException();
-            }
-        }
+        return getFunctionDescriptor(expr, env, context).createRunningAggregateFunctionFactory(args);
     }
 
     @Override
@@ -133,52 +73,33 @@
             IVariableTypeEnvironment env, IOperatorSchema[] inputSchemas, JobGenContext context)
             throws AlgebricksException {
         ICopyEvaluatorFactory[] args = codegenArguments(expr, env, inputSchemas, context);
-        IFunctionDescriptor fd;
-        AqlMetadataProvider mp = (AqlMetadataProvider) context.getMetadataProvider();
-        AqlCompiledMetadataDeclarations compiledDecls = mp.getMetadataDeclarations();
-        try {
-            fd = compiledDecls.getFormat().resolveFunction(expr, env);
-        } catch (AlgebricksException e) {
-            throw new AlgebricksException(e);
-        }
-        switch (fd.getFunctionDescriptorTag()) {
-            case UNNEST: {
-                IUnnestingFunctionDynamicDescriptor ufdd = (IUnnestingFunctionDynamicDescriptor) fd;
-                return ufdd.createUnnestingFunctionFactory(args);
-            }
-            default: {
-                throw new AlgebricksException("Trying to create an unnesting function descriptor from a "
-                        + fd.getFunctionDescriptorTag() + ". (fid=" + expr.getFunctionIdentifier() + ")");
-            }
-        }
+        return getFunctionDescriptor(expr, env, context).createUnnestingFunctionFactory(args);
     }
 
     @Override
     public ICopyEvaluatorFactory createEvaluatorFactory(ILogicalExpression expr, IVariableTypeEnvironment env,
             IOperatorSchema[] inputSchemas, JobGenContext context) throws AlgebricksException {
+        ICopyEvaluatorFactory copyEvaluatorFactory = null;
         switch (expr.getExpressionTag()) {
             case VARIABLE: {
                 VariableReferenceExpression v = (VariableReferenceExpression) expr;
-                return createVariableEvaluatorFactory(v, inputSchemas, context);
+                copyEvaluatorFactory = createVariableEvaluatorFactory(v, inputSchemas, context);
+                return copyEvaluatorFactory;
             }
             case CONSTANT: {
                 ConstantExpression c = (ConstantExpression) expr;
-                return createConstantEvaluatorFactory(c, inputSchemas, context);
+                copyEvaluatorFactory = createConstantEvaluatorFactory(c, inputSchemas, context);
+                return copyEvaluatorFactory;
             }
             case FUNCTION_CALL: {
-                AbstractFunctionCallExpression fun = (AbstractFunctionCallExpression) expr;
-                if (fun.getKind() == FunctionKind.SCALAR) {
-                    ScalarFunctionCallExpression scalar = (ScalarFunctionCallExpression) fun;
-                    return createScalarFunctionEvaluatorFactory(scalar, env, inputSchemas, context);
-                } else {
-                    throw new AlgebricksException("Cannot create evaluator for function " + fun + " of kind "
-                            + fun.getKind());
-                }
+                copyEvaluatorFactory = createScalarFunctionEvaluatorFactory((AbstractFunctionCallExpression) expr, env,
+                        inputSchemas, context);
+                return copyEvaluatorFactory;
             }
-            default: {
+            default:
                 throw new IllegalStateException();
-            }
         }
+
     }
 
     private ICopyEvaluatorFactory createVariableEvaluatorFactory(VariableReferenceExpression expr,
@@ -203,31 +124,15 @@
             return new ComparisonEvalFactory(args[0], args[1], ck);
         }
 
-        IFunctionDescriptor fd;
-
+        IFunctionDescriptor fd = null;
         AqlMetadataProvider mp = (AqlMetadataProvider) context.getMetadataProvider();
         IDataFormat format = mp == null ? FormatUtils.getDefaultFormat() : mp.getMetadataDeclarations().getFormat();
-        try {
-            fd = format.resolveFunction(expr, env);
-        } catch (AlgebricksException e) {
-            throw new AlgebricksException(e);
-        }
-
-        switch (fd.getFunctionDescriptorTag()) {
-            case SCALAR: {
-                IScalarFunctionDynamicDescriptor sfdd = (IScalarFunctionDynamicDescriptor) fd;
-                return sfdd.createEvaluatorFactory(args);
-            }
-            default: {
-                throw new AlgebricksException("Trying to create a scalar function descriptor from a "
-                        + fd.getFunctionDescriptorTag() + ". (fid=" + fi + ")");
-            }
-        }
-
+        fd = format.resolveFunction(expr, env);
+        return fd.createEvaluatorFactory(args);
     }
 
-    private ICopyEvaluatorFactory createConstantEvaluatorFactory(ConstantExpression expr, IOperatorSchema[] inputSchemas,
-            JobGenContext context) throws AlgebricksException {
+    private ICopyEvaluatorFactory createConstantEvaluatorFactory(ConstantExpression expr,
+            IOperatorSchema[] inputSchemas, JobGenContext context) throws AlgebricksException {
         AqlMetadataProvider mp = (AqlMetadataProvider) context.getMetadataProvider();
         IDataFormat format = mp == null ? FormatUtils.getDefaultFormat() : mp.getMetadataDeclarations().getFormat();
         return format.getConstantEvalFactory(expr.getValue());
@@ -250,27 +155,15 @@
             AggregateFunctionCallExpression expr, IVariableTypeEnvironment env, IOperatorSchema[] inputSchemas,
             JobGenContext context) throws AlgebricksException {
         ICopyEvaluatorFactory[] args = codegenArguments(expr, env, inputSchemas, context);
-        IFunctionDescriptor fd;
-        AqlMetadataProvider mp = (AqlMetadataProvider) context.getMetadataProvider();
-        AqlCompiledMetadataDeclarations compiledDecls = mp.getMetadataDeclarations();
-        try {
-            fd = compiledDecls.getFormat().resolveFunction(expr, env);
-        } catch (AlgebricksException e) {
-            throw new AlgebricksException(e);
-        }
+        IFunctionDescriptor fd = getFunctionDescriptor(expr, env, context);
+
         switch (fd.getFunctionDescriptorTag()) {
-            case SCALAR: {
-                throw new AlgebricksException(
-                        "Trying to create an aggregate from a scalar evaluator function descriptor. (fi="
-                                + expr.getFunctionIdentifier() + ")");
-            }
             case AGGREGATE: {
                 if (AsterixBuiltinFunctions.isAggregateFunctionSerializable(fd.getIdentifier())) {
                     AggregateFunctionCallExpression serialAggExpr = AsterixBuiltinFunctions
                             .makeSerializableAggregateFunctionExpression(fd.getIdentifier(), expr.getArguments());
-                    ISerializableAggregateFunctionDynamicDescriptor afdd = (ISerializableAggregateFunctionDynamicDescriptor) compiledDecls
-                            .getFormat().resolveFunction(serialAggExpr, env);
-                    return afdd.createAggregateFunctionFactory(args);
+                    IFunctionDescriptor afdd = getFunctionDescriptor(serialAggExpr, env, context);
+                    return afdd.createSerializableAggregateFunctionFactory(args);
                 } else {
                     throw new AlgebricksException(
                             "Trying to create a serializable aggregate from a non-serializable aggregate function descriptor. (fi="
@@ -278,22 +171,23 @@
                 }
             }
             case SERIALAGGREGATE: {
-                ISerializableAggregateFunctionDynamicDescriptor afdd = (ISerializableAggregateFunctionDynamicDescriptor) fd;
-                return afdd.createAggregateFunctionFactory(args);
-            }
-            case RUNNINGAGGREGATE: {
-                throw new AlgebricksException(
-                        "Trying to create an aggregate from a running aggregate function descriptor.");
-            }
-            case UNNEST: {
-                throw new AlgebricksException(
-                        "Trying to create an aggregate from an unnesting aggregate function descriptor.");
+                return fd.createSerializableAggregateFunctionFactory(args);
             }
 
-            default: {
-                throw new IllegalStateException();
-            }
+            default:
+                throw new IllegalStateException("Invalid function descriptor " + fd.getFunctionDescriptorTag()
+                        + " expected " + FunctionDescriptorTag.SERIALAGGREGATE + " or "
+                        + FunctionDescriptorTag.AGGREGATE);
         }
     }
 
+    private IFunctionDescriptor getFunctionDescriptor(AbstractFunctionCallExpression expr,
+            IVariableTypeEnvironment env, JobGenContext context) throws AlgebricksException {
+        IFunctionDescriptor fd;
+        AqlMetadataProvider mp = (AqlMetadataProvider) context.getMetadataProvider();
+        AqlCompiledMetadataDeclarations compiledDecls = mp.getMetadataDeclarations();
+        fd = compiledDecls.getFormat().resolveFunction(expr, env);
+        return fd;
+    }
+
 }
diff --git a/asterix-aql/src/main/javacc/AQL.jj b/asterix-aql/src/main/javacc/AQL.jj
index 0767c4e..3e63b35 100644
--- a/asterix-aql/src/main/javacc/AQL.jj
+++ b/asterix-aql/src/main/javacc/AQL.jj
@@ -598,7 +598,7 @@
     	itemTypeName = new Identifier(token.image);
   	}
   	< RIGHTPAREN >
-  )?
+  )
   {
   	  if(datasetType == DatasetType.INTERNAL) {
       	idd = InternalDatasetDeclaration();
@@ -860,6 +860,7 @@
   )?
   "as"
   ( typeExpr = TypeExpr() )
+  (";")?
   {
     long numValues = -1;
     String filename = null;
@@ -1143,11 +1144,12 @@
 }
 {
     expr = Expression()
-
+    (";")?
     {
       query.setBody(expr);
       return query;
     }
+     
 }
 
 
diff --git a/asterix-om/src/main/java/edu/uci/ics/asterix/om/functions/AbstractFunctionDescriptor.java b/asterix-om/src/main/java/edu/uci/ics/asterix/om/functions/AbstractFunctionDescriptor.java
new file mode 100644
index 0000000..caf3b91
--- /dev/null
+++ b/asterix-om/src/main/java/edu/uci/ics/asterix/om/functions/AbstractFunctionDescriptor.java
@@ -0,0 +1,65 @@
+/*
+ * Copyright 2009-2012 by The Regents of the University of California
+ * Licensed 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 from
+ * 
+ *     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 edu.uci.ics.asterix.om.functions;
+
+import edu.uci.ics.asterix.common.functions.FunctionDescriptorTag;
+import edu.uci.ics.hyracks.algebricks.common.exceptions.AlgebricksException;
+import edu.uci.ics.hyracks.algebricks.common.exceptions.NotImplementedException;
+import edu.uci.ics.hyracks.algebricks.core.algebra.functions.FunctionIdentifier;
+import edu.uci.ics.hyracks.algebricks.runtime.base.ICopyAggregateFunctionFactory;
+import edu.uci.ics.hyracks.algebricks.runtime.base.ICopyEvaluatorFactory;
+import edu.uci.ics.hyracks.algebricks.runtime.base.ICopyRunningAggregateFunctionFactory;
+import edu.uci.ics.hyracks.algebricks.runtime.base.ICopySerializableAggregateFunctionFactory;
+import edu.uci.ics.hyracks.algebricks.runtime.base.ICopyUnnestingFunctionFactory;
+
+public abstract class AbstractFunctionDescriptor implements IFunctionDescriptor {
+
+    @Override
+    public abstract FunctionIdentifier getIdentifier();
+
+    @Override
+    public abstract FunctionDescriptorTag getFunctionDescriptorTag();
+
+    @Override
+    public ICopyEvaluatorFactory createEvaluatorFactory(ICopyEvaluatorFactory[] args) throws AlgebricksException {
+        throw new NotImplementedException("Not Implemented");
+    }
+
+    @Override
+    public ICopyRunningAggregateFunctionFactory createRunningAggregateFunctionFactory(ICopyEvaluatorFactory[] args)
+            throws AlgebricksException {
+        throw new NotImplementedException("Not Implemented");
+    }
+
+    @Override
+    public ICopySerializableAggregateFunctionFactory createSerializableAggregateFunctionFactory(
+            ICopyEvaluatorFactory[] args) throws AlgebricksException {
+        throw new NotImplementedException("Not Implemented");
+    }
+
+    @Override
+    public ICopyUnnestingFunctionFactory createUnnestingFunctionFactory(ICopyEvaluatorFactory[] args)
+            throws AlgebricksException {
+        throw new NotImplementedException("Not Implemented");
+    }
+
+    @Override
+    public ICopyAggregateFunctionFactory createAggregateFunctionFactory(ICopyEvaluatorFactory[] args)
+            throws AlgebricksException {
+        throw new NotImplementedException("Not Implemented");
+
+    }
+
+}
diff --git a/asterix-om/src/main/java/edu/uci/ics/asterix/om/functions/AsterixBuiltinFunctions.java b/asterix-om/src/main/java/edu/uci/ics/asterix/om/functions/AsterixBuiltinFunctions.java
index 417948f..6f5a95f 100644
--- a/asterix-om/src/main/java/edu/uci/ics/asterix/om/functions/AsterixBuiltinFunctions.java
+++ b/asterix-om/src/main/java/edu/uci/ics/asterix/om/functions/AsterixBuiltinFunctions.java
@@ -163,51 +163,51 @@
             "numeric-idiv", 2);
     public final static FunctionIdentifier CARET = new FunctionIdentifier(FunctionConstants.ASTERIX_NS, "caret", 2);
 
-	public final static FunctionIdentifier NUMERIC_ABS = new FunctionIdentifier(
-			FunctionConstants.ASTERIX_NS, "numeric-abs", 1);
-	public final static FunctionIdentifier NUMERIC_CEILING = new FunctionIdentifier(
-			FunctionConstants.ASTERIX_NS, "numeric-ceiling", 1);
-	public final static FunctionIdentifier NUMERIC_FLOOR = new FunctionIdentifier(
-			FunctionConstants.ASTERIX_NS, "numeric-floor", 1);
-	public final static FunctionIdentifier NUMERIC_ROUND = new FunctionIdentifier(
-			FunctionConstants.ASTERIX_NS, "numeric-round", 1);
-	public final static FunctionIdentifier NUMERIC_ROUND_HALF_TO_EVEN = new FunctionIdentifier(
-			FunctionConstants.ASTERIX_NS, "numeric-round-half-to-even", 1);
-	public final static FunctionIdentifier NUMERIC_ROUND_HALF_TO_EVEN2 = new FunctionIdentifier(
-			FunctionConstants.ASTERIX_NS, "numeric-round-half-to-even2", 2);
-	// String funcitons
-	public final static FunctionIdentifier STRING_EQUAL = new FunctionIdentifier(
-			FunctionConstants.ASTERIX_NS, "string-equal", 2);
-	public final static FunctionIdentifier STRING_START_WITH = new FunctionIdentifier(
-			FunctionConstants.ASTERIX_NS, "start-with", 2);
-	public final static FunctionIdentifier STRING_END_WITH = new FunctionIdentifier(
-			FunctionConstants.ASTERIX_NS, "end-with", 2);
-	public final static FunctionIdentifier STRING_MATCHES = new FunctionIdentifier(
-			FunctionConstants.ASTERIX_NS, "matches", 2);
-	public final static FunctionIdentifier STRING_MATCHES_WITH_FLAG = new FunctionIdentifier(
-			FunctionConstants.ASTERIX_NS, "matches2", 3);
-	public final static FunctionIdentifier STRING_LOWERCASE = new FunctionIdentifier(
-			FunctionConstants.ASTERIX_NS, "lowercase", 1);
-	public final static FunctionIdentifier STRING_REPLACE = new FunctionIdentifier(
-			FunctionConstants.ASTERIX_NS, "replace", 3);
-	public final static FunctionIdentifier STRING_REPLACE_WITH_FLAG = new FunctionIdentifier(
-			FunctionConstants.ASTERIX_NS, "replace2", 4);
-	public final static FunctionIdentifier STRING_LENGTH = new FunctionIdentifier(
-			FunctionConstants.ASTERIX_NS, "string-length", 1);
-	public final static FunctionIdentifier SUBSTRING2 = new FunctionIdentifier(
-			FunctionConstants.ASTERIX_NS, "substring2", 2);
-	public final static FunctionIdentifier SUBSTRING_BEFORE = new FunctionIdentifier(
-			FunctionConstants.ASTERIX_NS, "substring-before", 2);
-	public final static FunctionIdentifier SUBSTRING_AFTER = new FunctionIdentifier(
-			FunctionConstants.ASTERIX_NS, "substring-after", 2);
-	public final static FunctionIdentifier STRING_TO_CODEPOINT = new FunctionIdentifier(
-			FunctionConstants.ASTERIX_NS, "string-to-codepoint", 1);
-	public final static FunctionIdentifier CODEPOINT_TO_STRING = new FunctionIdentifier(
-			FunctionConstants.ASTERIX_NS, "codepoint-to-string", 1);
-	public final static FunctionIdentifier STRING_CONCAT = new FunctionIdentifier(
-			FunctionConstants.ASTERIX_NS, "string-concat", 1);
-	public final static FunctionIdentifier STRING_JOIN = new FunctionIdentifier(
-			FunctionConstants.ASTERIX_NS, "string-join", 2);
+    public final static FunctionIdentifier NUMERIC_ABS = new FunctionIdentifier(FunctionConstants.ASTERIX_NS,
+            "numeric-abs", 1);
+    public final static FunctionIdentifier NUMERIC_CEILING = new FunctionIdentifier(FunctionConstants.ASTERIX_NS,
+            "numeric-ceiling", 1);
+    public final static FunctionIdentifier NUMERIC_FLOOR = new FunctionIdentifier(FunctionConstants.ASTERIX_NS,
+            "numeric-floor", 1);
+    public final static FunctionIdentifier NUMERIC_ROUND = new FunctionIdentifier(FunctionConstants.ASTERIX_NS,
+            "numeric-round", 1);
+    public final static FunctionIdentifier NUMERIC_ROUND_HALF_TO_EVEN = new FunctionIdentifier(
+            FunctionConstants.ASTERIX_NS, "numeric-round-half-to-even", 1);
+    public final static FunctionIdentifier NUMERIC_ROUND_HALF_TO_EVEN2 = new FunctionIdentifier(
+            FunctionConstants.ASTERIX_NS, "numeric-round-half-to-even2", 2);
+    // String funcitons
+    public final static FunctionIdentifier STRING_EQUAL = new FunctionIdentifier(FunctionConstants.ASTERIX_NS,
+            "string-equal", 2);
+    public final static FunctionIdentifier STRING_START_WITH = new FunctionIdentifier(FunctionConstants.ASTERIX_NS,
+            "start-with", 2);
+    public final static FunctionIdentifier STRING_END_WITH = new FunctionIdentifier(FunctionConstants.ASTERIX_NS,
+            "end-with", 2);
+    public final static FunctionIdentifier STRING_MATCHES = new FunctionIdentifier(FunctionConstants.ASTERIX_NS,
+            "matches", 2);
+    public final static FunctionIdentifier STRING_MATCHES_WITH_FLAG = new FunctionIdentifier(
+            FunctionConstants.ASTERIX_NS, "matches2", 3);
+    public final static FunctionIdentifier STRING_LOWERCASE = new FunctionIdentifier(FunctionConstants.ASTERIX_NS,
+            "lowercase", 1);
+    public final static FunctionIdentifier STRING_REPLACE = new FunctionIdentifier(FunctionConstants.ASTERIX_NS,
+            "replace", 3);
+    public final static FunctionIdentifier STRING_REPLACE_WITH_FLAG = new FunctionIdentifier(
+            FunctionConstants.ASTERIX_NS, "replace2", 4);
+    public final static FunctionIdentifier STRING_LENGTH = new FunctionIdentifier(FunctionConstants.ASTERIX_NS,
+            "string-length", 1);
+    public final static FunctionIdentifier SUBSTRING2 = new FunctionIdentifier(FunctionConstants.ASTERIX_NS,
+            "substring2", 2);
+    public final static FunctionIdentifier SUBSTRING_BEFORE = new FunctionIdentifier(FunctionConstants.ASTERIX_NS,
+            "substring-before", 2);
+    public final static FunctionIdentifier SUBSTRING_AFTER = new FunctionIdentifier(FunctionConstants.ASTERIX_NS,
+            "substring-after", 2);
+    public final static FunctionIdentifier STRING_TO_CODEPOINT = new FunctionIdentifier(FunctionConstants.ASTERIX_NS,
+            "string-to-codepoint", 1);
+    public final static FunctionIdentifier CODEPOINT_TO_STRING = new FunctionIdentifier(FunctionConstants.ASTERIX_NS,
+            "codepoint-to-string", 1);
+    public final static FunctionIdentifier STRING_CONCAT = new FunctionIdentifier(FunctionConstants.ASTERIX_NS,
+            "string-concat", 1);
+    public final static FunctionIdentifier STRING_JOIN = new FunctionIdentifier(FunctionConstants.ASTERIX_NS,
+            "string-join", 2);
 
     public final static FunctionIdentifier DATASET = new FunctionIdentifier(FunctionConstants.ASTERIX_NS, "dataset", 1);
     public final static FunctionIdentifier FEED_INGEST = new FunctionIdentifier(FunctionConstants.ASTERIX_NS,
@@ -404,9 +404,6 @@
         IFunctionInfo finfo = asterixFunctionIdToInfo.get(fid);
         if (finfo == null) {
             finfo = new AsterixFunctionInfo(fid);
-            //   if (fid.isBuiltin()) {
-            asterixFunctionIdToInfo.put(fid, finfo);
-            //  }
         }
         return finfo;
     }
@@ -523,15 +520,14 @@
         add(NUMERIC_DIVIDE, NonTaggedNumericAddSubMulDivTypeComputer.INSTANCE);
         add(NUMERIC_MOD, NonTaggedNumericAddSubMulDivTypeComputer.INSTANCE);
         add(NUMERIC_IDIV, AInt32TypeComputer.INSTANCE);
-        
-        // Xiaoyu Ma Add for new functions
+
         add(NUMERIC_ABS, NonTaggedNumericUnaryFunctionTypeComputer.INSTANCE);
         add(NUMERIC_CEILING, NonTaggedNumericUnaryFunctionTypeComputer.INSTANCE);
         add(NUMERIC_FLOOR, NonTaggedNumericUnaryFunctionTypeComputer.INSTANCE);
         add(NUMERIC_ROUND, NonTaggedNumericUnaryFunctionTypeComputer.INSTANCE);
         add(NUMERIC_ROUND_HALF_TO_EVEN, NonTaggedNumericUnaryFunctionTypeComputer.INSTANCE);
         add(NUMERIC_ROUND_HALF_TO_EVEN2, NonTaggedNumericRoundHalfToEven2TypeComputer.INSTANCE);
-        
+
         add(STRING_TO_CODEPOINT, OrderedListOfAInt32TypeComputer.INSTANCE);
         add(CODEPOINT_TO_STRING, AStringTypeComputer.INSTANCE);
         add(STRING_CONCAT, AStringTypeComputer.INSTANCE);
@@ -548,7 +544,7 @@
         add(SUBSTRING_AFTER, BinaryStringStringOrNullTypeComputer.INSTANCE);
         add(STRING_EQUAL, BinaryStringBoolOrNullTypeComputer.INSTANCE);
         add(STRING_JOIN, AStringTypeComputer.INSTANCE);
-        
+
         add(OPEN_RECORD_CONSTRUCTOR, OpenRecordConstructorResultType.INSTANCE);
         add(ORDERED_LIST_CONSTRUCTOR, OrderedListConstructorResultType.INSTANCE);
         add(POINT_CONSTRUCTOR, OptionalAPointTypeComputer.INSTANCE);
diff --git a/asterix-om/src/main/java/edu/uci/ics/asterix/om/functions/IFunctionDescriptor.java b/asterix-om/src/main/java/edu/uci/ics/asterix/om/functions/IFunctionDescriptor.java
index 2fb5447..c372dec 100644
--- a/asterix-om/src/main/java/edu/uci/ics/asterix/om/functions/IFunctionDescriptor.java
+++ b/asterix-om/src/main/java/edu/uci/ics/asterix/om/functions/IFunctionDescriptor.java
@@ -1,12 +1,47 @@
+/*
+ * Copyright 2009-2012 by The Regents of the University of California
+ * Licensed 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 from
+ * 
+ *     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 edu.uci.ics.asterix.om.functions;
 
 import java.io.Serializable;
 
 import edu.uci.ics.asterix.common.functions.FunctionDescriptorTag;
+import edu.uci.ics.hyracks.algebricks.common.exceptions.AlgebricksException;
 import edu.uci.ics.hyracks.algebricks.core.algebra.functions.FunctionIdentifier;
+import edu.uci.ics.hyracks.algebricks.runtime.base.ICopyAggregateFunctionFactory;
+import edu.uci.ics.hyracks.algebricks.runtime.base.ICopyEvaluatorFactory;
+import edu.uci.ics.hyracks.algebricks.runtime.base.ICopyRunningAggregateFunctionFactory;
+import edu.uci.ics.hyracks.algebricks.runtime.base.ICopySerializableAggregateFunctionFactory;
+import edu.uci.ics.hyracks.algebricks.runtime.base.ICopyUnnestingFunctionFactory;
 
 public interface IFunctionDescriptor extends Serializable {
     public FunctionIdentifier getIdentifier();
 
     public FunctionDescriptorTag getFunctionDescriptorTag();
+
+    public ICopyEvaluatorFactory createEvaluatorFactory(ICopyEvaluatorFactory[] args) throws AlgebricksException;
+
+    public ICopyRunningAggregateFunctionFactory createRunningAggregateFunctionFactory(final ICopyEvaluatorFactory[] args)
+            throws AlgebricksException;
+
+    public ICopySerializableAggregateFunctionFactory createSerializableAggregateFunctionFactory(
+            final ICopyEvaluatorFactory[] args) throws AlgebricksException;
+
+    public ICopyUnnestingFunctionFactory createUnnestingFunctionFactory(final ICopyEvaluatorFactory[] args)
+            throws AlgebricksException;
+
+    public ICopyAggregateFunctionFactory createAggregateFunctionFactory(final ICopyEvaluatorFactory[] args)
+            throws AlgebricksException;
+
 }
\ No newline at end of file
diff --git a/asterix-runtime/src/main/java/edu/uci/ics/asterix/runtime/aggregates/base/AbstractAggregateFunctionDynamicDescriptor.java b/asterix-runtime/src/main/java/edu/uci/ics/asterix/runtime/aggregates/base/AbstractAggregateFunctionDynamicDescriptor.java
index 07d8141..09325e4 100644
--- a/asterix-runtime/src/main/java/edu/uci/ics/asterix/runtime/aggregates/base/AbstractAggregateFunctionDynamicDescriptor.java
+++ b/asterix-runtime/src/main/java/edu/uci/ics/asterix/runtime/aggregates/base/AbstractAggregateFunctionDynamicDescriptor.java
@@ -1,12 +1,14 @@
 package edu.uci.ics.asterix.runtime.aggregates.base;
 
 import edu.uci.ics.asterix.common.functions.FunctionDescriptorTag;
-import edu.uci.ics.asterix.runtime.base.IAggregateFunctionDynamicDescriptor;
+import edu.uci.ics.asterix.om.functions.AbstractFunctionDescriptor;
 
-public abstract class AbstractAggregateFunctionDynamicDescriptor implements IAggregateFunctionDynamicDescriptor {
+public abstract class AbstractAggregateFunctionDynamicDescriptor extends AbstractFunctionDescriptor  {
     private static final long serialVersionUID = 1L;
 
     public FunctionDescriptorTag getFunctionDescriptorTag() {
         return FunctionDescriptorTag.AGGREGATE;
     }
+
+   
 }
diff --git a/asterix-runtime/src/main/java/edu/uci/ics/asterix/runtime/aggregates/base/AbstractSerializableAggregateFunctionDynamicDescriptor.java b/asterix-runtime/src/main/java/edu/uci/ics/asterix/runtime/aggregates/base/AbstractSerializableAggregateFunctionDynamicDescriptor.java
index 0634868..abde117 100644
--- a/asterix-runtime/src/main/java/edu/uci/ics/asterix/runtime/aggregates/base/AbstractSerializableAggregateFunctionDynamicDescriptor.java
+++ b/asterix-runtime/src/main/java/edu/uci/ics/asterix/runtime/aggregates/base/AbstractSerializableAggregateFunctionDynamicDescriptor.java
@@ -1,10 +1,9 @@
 package edu.uci.ics.asterix.runtime.aggregates.base;
 
 import edu.uci.ics.asterix.common.functions.FunctionDescriptorTag;
-import edu.uci.ics.asterix.runtime.base.ISerializableAggregateFunctionDynamicDescriptor;
+import edu.uci.ics.asterix.om.functions.AbstractFunctionDescriptor;
 
-public abstract class AbstractSerializableAggregateFunctionDynamicDescriptor implements
-        ISerializableAggregateFunctionDynamicDescriptor {
+public abstract class AbstractSerializableAggregateFunctionDynamicDescriptor extends AbstractFunctionDescriptor {
     private static final long serialVersionUID = 1L;
 
     @Override
diff --git a/asterix-runtime/src/main/java/edu/uci/ics/asterix/runtime/aggregates/serializable/std/SerializableAvgAggregateDescriptor.java b/asterix-runtime/src/main/java/edu/uci/ics/asterix/runtime/aggregates/serializable/std/SerializableAvgAggregateDescriptor.java
index 057c274..6c9989d 100644
--- a/asterix-runtime/src/main/java/edu/uci/ics/asterix/runtime/aggregates/serializable/std/SerializableAvgAggregateDescriptor.java
+++ b/asterix-runtime/src/main/java/edu/uci/ics/asterix/runtime/aggregates/serializable/std/SerializableAvgAggregateDescriptor.java
@@ -48,8 +48,8 @@
     }
 
     @Override
-    public ICopySerializableAggregateFunctionFactory createAggregateFunctionFactory(ICopyEvaluatorFactory[] args)
-            throws AlgebricksException {
+    public ICopySerializableAggregateFunctionFactory createSerializableAggregateFunctionFactory(
+            ICopyEvaluatorFactory[] args) throws AlgebricksException {
         final ICopyEvaluatorFactory[] evals = args;
 
         return new ICopySerializableAggregateFunctionFactory() {
@@ -89,8 +89,8 @@
                         boolean metNull = BufferSerDeUtil.getBoolean(state, start + 16);
                         if (inputVal.getLength() > 0) {
                             ++count;
-                            ATypeTag typeTag = EnumDeserializer.ATYPETAGDESERIALIZER
-                                    .deserialize(inputVal.getByteArray()[0]);
+                            ATypeTag typeTag = EnumDeserializer.ATYPETAGDESERIALIZER.deserialize(inputVal
+                                    .getByteArray()[0]);
                             switch (typeTag) {
                                 case INT8: {
                                     byte val = AInt8SerializerDeserializer.getByte(inputVal.getByteArray(), 1);
diff --git a/asterix-runtime/src/main/java/edu/uci/ics/asterix/runtime/aggregates/serializable/std/SerializableCountAggregateDescriptor.java b/asterix-runtime/src/main/java/edu/uci/ics/asterix/runtime/aggregates/serializable/std/SerializableCountAggregateDescriptor.java
index 98e86d2..d8f2553 100644
--- a/asterix-runtime/src/main/java/edu/uci/ics/asterix/runtime/aggregates/serializable/std/SerializableCountAggregateDescriptor.java
+++ b/asterix-runtime/src/main/java/edu/uci/ics/asterix/runtime/aggregates/serializable/std/SerializableCountAggregateDescriptor.java
@@ -39,7 +39,7 @@
     }
 
     @Override
-    public ICopySerializableAggregateFunctionFactory createAggregateFunctionFactory(final ICopyEvaluatorFactory[] args)
+    public ICopySerializableAggregateFunctionFactory createSerializableAggregateFunctionFactory(final ICopyEvaluatorFactory[] args)
             throws AlgebricksException {
         return new ICopySerializableAggregateFunctionFactory() {
             private static final long serialVersionUID = 1L;
diff --git a/asterix-runtime/src/main/java/edu/uci/ics/asterix/runtime/aggregates/serializable/std/SerializableGlobalAvgAggregateDescriptor.java b/asterix-runtime/src/main/java/edu/uci/ics/asterix/runtime/aggregates/serializable/std/SerializableGlobalAvgAggregateDescriptor.java
index 31d9345..02d24a0 100644
--- a/asterix-runtime/src/main/java/edu/uci/ics/asterix/runtime/aggregates/serializable/std/SerializableGlobalAvgAggregateDescriptor.java
+++ b/asterix-runtime/src/main/java/edu/uci/ics/asterix/runtime/aggregates/serializable/std/SerializableGlobalAvgAggregateDescriptor.java
@@ -58,7 +58,7 @@
     }
 
     @Override
-    public ICopySerializableAggregateFunctionFactory createAggregateFunctionFactory(ICopyEvaluatorFactory[] args)
+    public ICopySerializableAggregateFunctionFactory createSerializableAggregateFunctionFactory(ICopyEvaluatorFactory[] args)
             throws AlgebricksException {
         final ICopyEvaluatorFactory[] evals = args;
         List<IAType> unionList = new ArrayList<IAType>();
diff --git a/asterix-runtime/src/main/java/edu/uci/ics/asterix/runtime/aggregates/serializable/std/SerializableLocalAvgAggregateDescriptor.java b/asterix-runtime/src/main/java/edu/uci/ics/asterix/runtime/aggregates/serializable/std/SerializableLocalAvgAggregateDescriptor.java
index c12a9a6..d96e488 100644
--- a/asterix-runtime/src/main/java/edu/uci/ics/asterix/runtime/aggregates/serializable/std/SerializableLocalAvgAggregateDescriptor.java
+++ b/asterix-runtime/src/main/java/edu/uci/ics/asterix/runtime/aggregates/serializable/std/SerializableLocalAvgAggregateDescriptor.java
@@ -60,7 +60,7 @@
     }
 
     @Override
-    public ICopySerializableAggregateFunctionFactory createAggregateFunctionFactory(ICopyEvaluatorFactory[] args)
+    public ICopySerializableAggregateFunctionFactory createSerializableAggregateFunctionFactory(ICopyEvaluatorFactory[] args)
             throws AlgebricksException {
         final ICopyEvaluatorFactory[] evals = args;
         List<IAType> unionList = new ArrayList<IAType>();
diff --git a/asterix-runtime/src/main/java/edu/uci/ics/asterix/runtime/aggregates/serializable/std/SerializableSumAggregateDescriptor.java b/asterix-runtime/src/main/java/edu/uci/ics/asterix/runtime/aggregates/serializable/std/SerializableSumAggregateDescriptor.java
index 2b53d89..510921a 100644
--- a/asterix-runtime/src/main/java/edu/uci/ics/asterix/runtime/aggregates/serializable/std/SerializableSumAggregateDescriptor.java
+++ b/asterix-runtime/src/main/java/edu/uci/ics/asterix/runtime/aggregates/serializable/std/SerializableSumAggregateDescriptor.java
@@ -52,7 +52,7 @@
     }
 
     @Override
-    public ICopySerializableAggregateFunctionFactory createAggregateFunctionFactory(final ICopyEvaluatorFactory[] args)
+    public ICopySerializableAggregateFunctionFactory createSerializableAggregateFunctionFactory(final ICopyEvaluatorFactory[] args)
             throws AlgebricksException {
         return new ICopySerializableAggregateFunctionFactory() {
             private static final long serialVersionUID = 1L;
diff --git a/asterix-runtime/src/main/java/edu/uci/ics/asterix/runtime/base/IAggregateFunctionDynamicDescriptor.java b/asterix-runtime/src/main/java/edu/uci/ics/asterix/runtime/base/IAggregateFunctionDynamicDescriptor.java
deleted file mode 100644
index 95c604a..0000000
--- a/asterix-runtime/src/main/java/edu/uci/ics/asterix/runtime/base/IAggregateFunctionDynamicDescriptor.java
+++ /dev/null
@@ -1,11 +0,0 @@
-package edu.uci.ics.asterix.runtime.base;
-
-import edu.uci.ics.asterix.om.functions.IFunctionDescriptor;
-import edu.uci.ics.hyracks.algebricks.common.exceptions.AlgebricksException;
-import edu.uci.ics.hyracks.algebricks.runtime.base.ICopyAggregateFunctionFactory;
-import edu.uci.ics.hyracks.algebricks.runtime.base.ICopyEvaluatorFactory;
-
-public interface IAggregateFunctionDynamicDescriptor extends IFunctionDescriptor {
-    public ICopyAggregateFunctionFactory createAggregateFunctionFactory(final ICopyEvaluatorFactory[] args)
-            throws AlgebricksException;
-}
diff --git a/asterix-runtime/src/main/java/edu/uci/ics/asterix/runtime/base/IRunningAggregateFunctionDynamicDescriptor.java b/asterix-runtime/src/main/java/edu/uci/ics/asterix/runtime/base/IRunningAggregateFunctionDynamicDescriptor.java
deleted file mode 100644
index 7ab7261..0000000
--- a/asterix-runtime/src/main/java/edu/uci/ics/asterix/runtime/base/IRunningAggregateFunctionDynamicDescriptor.java
+++ /dev/null
@@ -1,12 +0,0 @@
-package edu.uci.ics.asterix.runtime.base;
-
-
-import edu.uci.ics.asterix.om.functions.IFunctionDescriptor;
-import edu.uci.ics.hyracks.algebricks.common.exceptions.AlgebricksException;
-import edu.uci.ics.hyracks.algebricks.runtime.base.ICopyEvaluatorFactory;
-import edu.uci.ics.hyracks.algebricks.runtime.base.ICopyRunningAggregateFunctionFactory;
-
-public interface IRunningAggregateFunctionDynamicDescriptor extends IFunctionDescriptor {
-    public ICopyRunningAggregateFunctionFactory createRunningAggregateFunctionFactory(final ICopyEvaluatorFactory[] args)
-            throws AlgebricksException;
-}
diff --git a/asterix-runtime/src/main/java/edu/uci/ics/asterix/runtime/base/IScalarFunctionDynamicDescriptor.java b/asterix-runtime/src/main/java/edu/uci/ics/asterix/runtime/base/IScalarFunctionDynamicDescriptor.java
deleted file mode 100644
index 8e4353e..0000000
--- a/asterix-runtime/src/main/java/edu/uci/ics/asterix/runtime/base/IScalarFunctionDynamicDescriptor.java
+++ /dev/null
@@ -1,10 +0,0 @@
-package edu.uci.ics.asterix.runtime.base;
-
-
-import edu.uci.ics.asterix.om.functions.IFunctionDescriptor;
-import edu.uci.ics.hyracks.algebricks.common.exceptions.AlgebricksException;
-import edu.uci.ics.hyracks.algebricks.runtime.base.ICopyEvaluatorFactory;
-
-public interface IScalarFunctionDynamicDescriptor extends IFunctionDescriptor {
-    public ICopyEvaluatorFactory createEvaluatorFactory(ICopyEvaluatorFactory[] args) throws AlgebricksException;
-}
diff --git a/asterix-runtime/src/main/java/edu/uci/ics/asterix/runtime/base/ISerializableAggregateFunctionDynamicDescriptor.java b/asterix-runtime/src/main/java/edu/uci/ics/asterix/runtime/base/ISerializableAggregateFunctionDynamicDescriptor.java
deleted file mode 100644
index 810af16..0000000
--- a/asterix-runtime/src/main/java/edu/uci/ics/asterix/runtime/base/ISerializableAggregateFunctionDynamicDescriptor.java
+++ /dev/null
@@ -1,11 +0,0 @@
-package edu.uci.ics.asterix.runtime.base;
-
-import edu.uci.ics.asterix.om.functions.IFunctionDescriptor;
-import edu.uci.ics.hyracks.algebricks.common.exceptions.AlgebricksException;
-import edu.uci.ics.hyracks.algebricks.runtime.base.ICopyEvaluatorFactory;
-import edu.uci.ics.hyracks.algebricks.runtime.base.ICopySerializableAggregateFunctionFactory;
-
-public interface ISerializableAggregateFunctionDynamicDescriptor extends IFunctionDescriptor {
-    public ICopySerializableAggregateFunctionFactory createAggregateFunctionFactory(final ICopyEvaluatorFactory[] args)
-            throws AlgebricksException;
-}
diff --git a/asterix-runtime/src/main/java/edu/uci/ics/asterix/runtime/base/IUnnestingFunctionDynamicDescriptor.java b/asterix-runtime/src/main/java/edu/uci/ics/asterix/runtime/base/IUnnestingFunctionDynamicDescriptor.java
deleted file mode 100644
index 3f55539..0000000
--- a/asterix-runtime/src/main/java/edu/uci/ics/asterix/runtime/base/IUnnestingFunctionDynamicDescriptor.java
+++ /dev/null
@@ -1,11 +0,0 @@
-package edu.uci.ics.asterix.runtime.base;
-
-import edu.uci.ics.asterix.om.functions.IFunctionDescriptor;
-import edu.uci.ics.hyracks.algebricks.common.exceptions.AlgebricksException;
-import edu.uci.ics.hyracks.algebricks.runtime.base.ICopyEvaluatorFactory;
-import edu.uci.ics.hyracks.algebricks.runtime.base.ICopyUnnestingFunctionFactory;
-
-public interface IUnnestingFunctionDynamicDescriptor extends IFunctionDescriptor {
-    public ICopyUnnestingFunctionFactory createUnnestingFunctionFactory(final ICopyEvaluatorFactory[] args)
-            throws AlgebricksException;
-}
diff --git a/asterix-runtime/src/main/java/edu/uci/ics/asterix/runtime/evaluators/base/AbstractScalarFunctionDynamicDescriptor.java b/asterix-runtime/src/main/java/edu/uci/ics/asterix/runtime/evaluators/base/AbstractScalarFunctionDynamicDescriptor.java
index 06aa928..a2f00ff 100644
--- a/asterix-runtime/src/main/java/edu/uci/ics/asterix/runtime/evaluators/base/AbstractScalarFunctionDynamicDescriptor.java
+++ b/asterix-runtime/src/main/java/edu/uci/ics/asterix/runtime/evaluators/base/AbstractScalarFunctionDynamicDescriptor.java
@@ -1,9 +1,9 @@
 package edu.uci.ics.asterix.runtime.evaluators.base;
 
 import edu.uci.ics.asterix.common.functions.FunctionDescriptorTag;
-import edu.uci.ics.asterix.runtime.base.IScalarFunctionDynamicDescriptor;
+import edu.uci.ics.asterix.om.functions.AbstractFunctionDescriptor;
 
-public abstract class AbstractScalarFunctionDynamicDescriptor implements IScalarFunctionDynamicDescriptor {
+public abstract class AbstractScalarFunctionDynamicDescriptor extends AbstractFunctionDescriptor {
 
     private static final long serialVersionUID = 1L;
 
diff --git a/asterix-runtime/src/main/java/edu/uci/ics/asterix/runtime/runningaggregates/base/AbstractRunningAggregateFunctionDynamicDescriptor.java b/asterix-runtime/src/main/java/edu/uci/ics/asterix/runtime/runningaggregates/base/AbstractRunningAggregateFunctionDynamicDescriptor.java
index c8f12f0..9be4046 100644
--- a/asterix-runtime/src/main/java/edu/uci/ics/asterix/runtime/runningaggregates/base/AbstractRunningAggregateFunctionDynamicDescriptor.java
+++ b/asterix-runtime/src/main/java/edu/uci/ics/asterix/runtime/runningaggregates/base/AbstractRunningAggregateFunctionDynamicDescriptor.java
@@ -1,10 +1,9 @@
 package edu.uci.ics.asterix.runtime.runningaggregates.base;
 
 import edu.uci.ics.asterix.common.functions.FunctionDescriptorTag;
-import edu.uci.ics.asterix.runtime.base.IRunningAggregateFunctionDynamicDescriptor;
+import edu.uci.ics.asterix.om.functions.AbstractFunctionDescriptor;
 
-public abstract class AbstractRunningAggregateFunctionDynamicDescriptor implements
-        IRunningAggregateFunctionDynamicDescriptor {
+public abstract class AbstractRunningAggregateFunctionDynamicDescriptor extends AbstractFunctionDescriptor {
     private static final long serialVersionUID = 1L;
 
     public FunctionDescriptorTag getFunctionDescriptorTag() {
diff --git a/asterix-runtime/src/main/java/edu/uci/ics/asterix/runtime/unnestingfunctions/base/AbstractUnnestingFunctionDynamicDescriptor.java b/asterix-runtime/src/main/java/edu/uci/ics/asterix/runtime/unnestingfunctions/base/AbstractUnnestingFunctionDynamicDescriptor.java
index 52a44ae..bcab30f 100644
--- a/asterix-runtime/src/main/java/edu/uci/ics/asterix/runtime/unnestingfunctions/base/AbstractUnnestingFunctionDynamicDescriptor.java
+++ b/asterix-runtime/src/main/java/edu/uci/ics/asterix/runtime/unnestingfunctions/base/AbstractUnnestingFunctionDynamicDescriptor.java
@@ -1,9 +1,9 @@
 package edu.uci.ics.asterix.runtime.unnestingfunctions.base;
 
 import edu.uci.ics.asterix.common.functions.FunctionDescriptorTag;
-import edu.uci.ics.asterix.runtime.base.IUnnestingFunctionDynamicDescriptor;
+import edu.uci.ics.asterix.om.functions.AbstractFunctionDescriptor;
 
-public abstract class AbstractUnnestingFunctionDynamicDescriptor implements IUnnestingFunctionDynamicDescriptor {
+public abstract class AbstractUnnestingFunctionDynamicDescriptor extends AbstractFunctionDescriptor {
     private static final long serialVersionUID = 1L;
 
     public FunctionDescriptorTag getFunctionDescriptorTag() {