Modified stabilization branch to work with hyracks_asterix_stabilization

git-svn-id: https://asterixdb.googlecode.com/svn/branches/asterix_stabilization@61 eaa15691-b419-025a-1212-ee371bd00084
diff --git a/asterix-algebra/pom.xml b/asterix-algebra/pom.xml
index b60dc3b..ac2207c 100644
--- a/asterix-algebra/pom.xml
+++ b/asterix-algebra/pom.xml
@@ -61,8 +61,7 @@
 		<dependency>
 			<groupId>edu.uci.ics.hyracks</groupId>
 			<artifactId>hyracks-algebricks-compiler</artifactId>
-			<version>0.2.0</version>
-			<scope>compile</scope>
+			<version>0.2.1-SNAPSHOT</version>
 		</dependency>
 		<dependency>
 			<groupId>org.json</groupId>
diff --git a/asterix-algebra/src/main/java/edu/uci/ics/asterix/optimizer/rules/IntroduceBTreeIndexSearchRule.java b/asterix-algebra/src/main/java/edu/uci/ics/asterix/optimizer/rules/IntroduceBTreeIndexSearchRule.java
index 48abbec..fc61154 100644
--- a/asterix-algebra/src/main/java/edu/uci/ics/asterix/optimizer/rules/IntroduceBTreeIndexSearchRule.java
+++ b/asterix-algebra/src/main/java/edu/uci/ics/asterix/optimizer/rules/IntroduceBTreeIndexSearchRule.java
@@ -578,7 +578,7 @@
 
         validateRemainingPreds(outRest);
         if (!outRest.isEmpty()) {
-            ILogicalExpression pulledCond = makeCondition(outRest);
+            ILogicalExpression pulledCond = makeCondition(outRest, context);
             SelectOperator selectRest = new SelectOperator(new MutableObject<ILogicalExpression>(pulledCond));
             if (assignFieldAccess != null) {
                 opRef3.setValue(primIdxUnnestMap);
@@ -611,9 +611,9 @@
         }
     }
 
-    private ILogicalExpression makeCondition(List<Mutable<ILogicalExpression>> predList) {
+    private ILogicalExpression makeCondition(List<Mutable<ILogicalExpression>> predList, IOptimizationContext context) {
         if (predList.size() > 1) {
-            IFunctionInfo finfo = AlgebricksBuiltinFunctions.getBuiltinFunctionInfo(AlgebricksBuiltinFunctions.AND);
+            IFunctionInfo finfo = context.getMetadataProvider().lookupFunction(AlgebricksBuiltinFunctions.AND);
             return new ScalarFunctionCallExpression(finfo, predList);
         } else {
             return predList.get(0).getValue();
diff --git a/asterix-algebra/src/main/java/edu/uci/ics/asterix/translator/AqlExpressionToPlanTranslator.java b/asterix-algebra/src/main/java/edu/uci/ics/asterix/translator/AqlExpressionToPlanTranslator.java
index d601fc4..2d5e376 100644
--- a/asterix-algebra/src/main/java/edu/uci/ics/asterix/translator/AqlExpressionToPlanTranslator.java
+++ b/asterix-algebra/src/main/java/edu/uci/ics/asterix/translator/AqlExpressionToPlanTranslator.java
@@ -94,6 +94,7 @@
 import edu.uci.ics.asterix.om.constants.AsterixConstantValue;
 import edu.uci.ics.asterix.om.functions.AsterixBuiltinFunctions;
 import edu.uci.ics.asterix.om.functions.AsterixFunction;
+import edu.uci.ics.asterix.om.functions.AsterixFunctionInfo;
 import edu.uci.ics.asterix.om.types.BuiltinType;
 import edu.uci.ics.asterix.om.types.IAType;
 import edu.uci.ics.hyracks.algebricks.core.algebra.base.Counter;
@@ -469,7 +470,8 @@
         }
 
         FunctionIdentifier fi = new FunctionIdentifier(AlgebricksBuiltinFunctions.ALGEBRICKS_NS, fid.getFunctionName(), false);
-        FunctionIdentifier builtinAquafi = AlgebricksBuiltinFunctions.getBuiltinFunctionIdentifier(fi);
+        AsterixFunctionInfo afi = AsterixBuiltinFunctions.lookupFunction(fi);
+        FunctionIdentifier builtinAquafi = afi == null ? null : afi.getFunctionIdentifier();
 
         if (builtinAquafi != null) {
             fi = builtinAquafi;
diff --git a/asterix-algebra/src/main/java/edu/uci/ics/asterix/translator/AqlPlusExpressionToPlanTranslator.java b/asterix-algebra/src/main/java/edu/uci/ics/asterix/translator/AqlPlusExpressionToPlanTranslator.java
index b1b8cb2..c105713 100644
--- a/asterix-algebra/src/main/java/edu/uci/ics/asterix/translator/AqlPlusExpressionToPlanTranslator.java
+++ b/asterix-algebra/src/main/java/edu/uci/ics/asterix/translator/AqlPlusExpressionToPlanTranslator.java
@@ -93,6 +93,7 @@
 import edu.uci.ics.asterix.om.constants.AsterixConstantValue;
 import edu.uci.ics.asterix.om.functions.AsterixBuiltinFunctions;
 import edu.uci.ics.asterix.om.functions.AsterixFunction;
+import edu.uci.ics.asterix.om.functions.AsterixFunctionInfo;
 import edu.uci.ics.asterix.om.types.BuiltinType;
 import edu.uci.ics.asterix.om.types.IAType;
 import edu.uci.ics.hyracks.algebricks.core.algebra.base.Counter;
@@ -469,7 +470,9 @@
         }
 
         FunctionIdentifier fi = new FunctionIdentifier(AlgebricksBuiltinFunctions.ALGEBRICKS_NS, fid.getFunctionName(), false);
-        FunctionIdentifier builtinAquafi = AlgebricksBuiltinFunctions.getBuiltinFunctionIdentifier(fi);
+        AsterixFunctionInfo afi = AsterixBuiltinFunctions.lookupFunction(fi);
+        FunctionIdentifier builtinAquafi = afi == null ? null : afi.getFunctionIdentifier();
+
 
         if (builtinAquafi != null) {
             fi = builtinAquafi;
diff --git a/asterix-app/pom.xml b/asterix-app/pom.xml
index 03ee55b..19806a1 100644
--- a/asterix-app/pom.xml
+++ b/asterix-app/pom.xml
@@ -128,20 +128,17 @@
 		<dependency>
 			<groupId>edu.uci.ics.hyracks</groupId>
 			<artifactId>hyracks-control-cc</artifactId>
-			<version>0.2.0</version>
-			<scope>compile</scope>
+			<version>0.2.1-SNAPSHOT</version>
 		</dependency>
 		<dependency>
 			<groupId>edu.uci.ics.hyracks</groupId>
 			<artifactId>hyracks-control-nc</artifactId>
-			<version>0.2.0</version>
-			<scope>compile</scope>
+			<version>0.2.1-SNAPSHOT</version>
 		</dependency>
 		<dependency>
 			<groupId>edu.uci.ics.hyracks</groupId>
 			<artifactId>hyracks-algebricks-compiler</artifactId>
-			<version>0.2.0</version>
-			<scope>compile</scope>
+			<version>0.2.1-SNAPSHOT</version>
 		</dependency>
 		<dependency>
 			<groupId>edu.uci.ics.asterix</groupId>
diff --git a/asterix-common/pom.xml b/asterix-common/pom.xml
index a34460c..34a73c9 100644
--- a/asterix-common/pom.xml
+++ b/asterix-common/pom.xml
@@ -26,20 +26,12 @@
 		<dependency>
 			<groupId>edu.uci.ics.hyracks</groupId>
 			<artifactId>hyracks-algebricks-compiler</artifactId>
-			<version>0.2.0</version>
-			<scope>compile</scope>
-		</dependency>
-		<dependency>
-			<groupId>edu.uci.ics.hyracks</groupId>
-			<artifactId>hyracks-dataflow-common</artifactId>
-			<version>0.2.0</version>
-			<scope>compile</scope>
+			<version>0.2.1-SNAPSHOT</version>
 		</dependency>
 		<dependency>
 			<groupId>edu.uci.ics.hyracks</groupId>
 			<artifactId>hyracks-dataflow-std</artifactId>
-			<version>0.2.0</version>
-			<scope>compile</scope>
+			<version>0.2.1-SNAPSHOT</version>
 		</dependency>
 	</dependencies>
 
diff --git a/asterix-dist/pom.xml b/asterix-dist/pom.xml
index df445e0..ec27b64 100644
--- a/asterix-dist/pom.xml
+++ b/asterix-dist/pom.xml
@@ -32,14 +32,14 @@
     <dependency>
 	  <groupId>edu.uci.ics.hyracks</groupId>
   	  <artifactId>hyracks-server</artifactId>
-  	  <version>0.2.0</version>
+  	  <version>0.2.1-SNAPSHOT</version>
   	  <type>zip</type>
       <classifier>binary-assembly</classifier>
     </dependency>
     <dependency>
 	  <groupId>edu.uci.ics.hyracks</groupId>
   	  <artifactId>hyracks-cli</artifactId>
-  	  <version>0.2.0</version>
+  	  <version>0.2.1-SNAPSHOT</version>
   	  <type>zip</type>
       <classifier>binary-assembly</classifier>
     </dependency>
diff --git a/asterix-external-data/pom.xml b/asterix-external-data/pom.xml
index 9473ce9..7e3e65d 100644
--- a/asterix-external-data/pom.xml
+++ b/asterix-external-data/pom.xml
@@ -85,18 +85,6 @@
 			<scope>test</scope>
 		</dependency>
 		<dependency>
-			<groupId>edu.uci.ics.hyracks</groupId>
-			<artifactId>hyracks-control-cc</artifactId>
-			<version>0.2.0</version>
-			<scope>compile</scope>
-		</dependency>
-		<dependency>
-			<groupId>edu.uci.ics.hyracks</groupId>
-			<artifactId>hyracks-control-nc</artifactId>
-			<version>0.2.0</version>
-			<scope>compile</scope>
-		</dependency>
-		<dependency>
 			<groupId>edu.uci.ics.asterix</groupId>
 			<artifactId>asterix-om</artifactId>
 			<version>0.0.4-SNAPSHOT</version>
diff --git a/asterix-hyracks-glue/pom.xml b/asterix-hyracks-glue/pom.xml
index eb5cb62..012d8f6 100644
--- a/asterix-hyracks-glue/pom.xml
+++ b/asterix-hyracks-glue/pom.xml
@@ -32,30 +32,6 @@
       <scope>test</scope>
     </dependency>
     <dependency>
-       <groupId>edu.uci.ics.hyracks</groupId>
-       <artifactId>hyracks-storage-am-common</artifactId>
-       <version>0.2.0</version>
-       <scope>compile</scope>
-    </dependency>
-    <dependency>
-      <groupId>edu.uci.ics.hyracks</groupId>
-      <artifactId>hyracks-storage-common</artifactId>
-      <version>0.2.0</version>
-      <scope>compile</scope>
-    </dependency>
-    <dependency>
-       <groupId>edu.uci.ics.hyracks</groupId>
-       <artifactId>hyracks-api</artifactId>
-       <version>0.2.0</version>
-       <scope>compile</scope>
-    </dependency>
-       <dependency>
-       <groupId>edu.uci.ics.hyracks</groupId>
-       <artifactId>hyracks-dataflow-common</artifactId>
-       <version>0.2.0</version>
-       <scope>compile</scope>
-    </dependency>
-    <dependency>
        <groupId>edu.uci.ics.asterix</groupId>
        <artifactId>asterix-transactions</artifactId>
        <version>0.0.4-SNAPSHOT</version>
@@ -64,8 +40,7 @@
     <dependency>
        <groupId>edu.uci.ics.hyracks</groupId>
        <artifactId>hyracks-storage-am-btree</artifactId>
-       <version>0.2.0</version>
-       <scope>compile</scope>
+       <version>0.2.1-SNAPSHOT</version>
     </dependency>
   </dependencies>
   <properties>
diff --git a/asterix-metadata/pom.xml b/asterix-metadata/pom.xml
index a93fe2e..043bc13 100644
--- a/asterix-metadata/pom.xml
+++ b/asterix-metadata/pom.xml
@@ -45,26 +45,12 @@
 		<dependency>
 			<groupId>edu.uci.ics.hyracks</groupId>
 			<artifactId>hyracks-storage-am-invertedindex</artifactId>
-			<version>0.2.0</version>
-			<scope>compile</scope>
-		</dependency>
-		<dependency>
-			<groupId>edu.uci.ics.hyracks</groupId>
-			<artifactId>hyracks-storage-am-common</artifactId>
-			<version>0.2.0</version>
-			<scope>compile</scope>
+			<version>0.2.1-SNAPSHOT</version>
 		</dependency>
 		<dependency>
 			<groupId>edu.uci.ics.hyracks</groupId>
 			<artifactId>hyracks-storage-am-rtree</artifactId>
-			<version>0.2.0</version>
-			<scope>compile</scope>
-		</dependency>
-		<dependency>
-			<groupId>edu.uci.ics.hyracks</groupId>
-			<artifactId>hyracks-dataflow-common</artifactId>
-			<version>0.2.0</version>
-			<scope>compile</scope>
+			<version>0.2.1-SNAPSHOT</version>
 		</dependency>
 		<dependency>
 			<groupId>edu.uci.ics.asterix</groupId>
diff --git a/asterix-metadata/src/main/java/edu/uci/ics/asterix/metadata/declared/AqlMetadataProvider.java b/asterix-metadata/src/main/java/edu/uci/ics/asterix/metadata/declared/AqlMetadataProvider.java
index f768e0e..2d85fe3 100644
--- a/asterix-metadata/src/main/java/edu/uci/ics/asterix/metadata/declared/AqlMetadataProvider.java
+++ b/asterix-metadata/src/main/java/edu/uci/ics/asterix/metadata/declared/AqlMetadataProvider.java
@@ -35,6 +35,7 @@
 import edu.uci.ics.asterix.formats.nontagged.AqlTypeTraitProvider;
 import edu.uci.ics.asterix.metadata.declared.AqlCompiledIndexDecl.IndexKind;
 import edu.uci.ics.asterix.metadata.utils.DatasetUtils;
+import edu.uci.ics.asterix.om.functions.AsterixBuiltinFunctions;
 import edu.uci.ics.asterix.om.types.ARecordType;
 import edu.uci.ics.asterix.om.types.ATypeTag;
 import edu.uci.ics.asterix.om.types.IAType;
@@ -43,6 +44,8 @@
 import edu.uci.ics.hyracks.algebricks.core.algebra.base.LogicalVariable;
 import edu.uci.ics.hyracks.algebricks.core.algebra.data.IPrinterFactory;
 import edu.uci.ics.hyracks.algebricks.core.algebra.expressions.ScalarFunctionCallExpression;
+import edu.uci.ics.hyracks.algebricks.core.algebra.functions.FunctionIdentifier;
+import edu.uci.ics.hyracks.algebricks.core.algebra.functions.IFunctionInfo;
 import edu.uci.ics.hyracks.algebricks.core.algebra.metadata.IDataSink;
 import edu.uci.ics.hyracks.algebricks.core.algebra.metadata.IDataSource;
 import edu.uci.ics.hyracks.algebricks.core.algebra.metadata.IDataSourceIndex;
@@ -921,4 +924,9 @@
         return new BTreeNSMLeafFrameFactory(new TypeAwareTupleWriterFactory(typeTraits));
     }
 
+    @Override
+    public IFunctionInfo lookupFunction(FunctionIdentifier fid) {
+        return AsterixBuiltinFunctions.lookupFunction(fid);
+    }
+
 }
diff --git a/asterix-om/pom.xml b/asterix-om/pom.xml
index a3626b7..fc9acd8 100644
--- a/asterix-om/pom.xml
+++ b/asterix-om/pom.xml
@@ -33,8 +33,7 @@
 		<dependency>
 			<groupId>edu.uci.ics.hyracks</groupId>
 			<artifactId>hyracks-storage-am-invertedindex</artifactId>
-			<version>0.2.0</version>
-			<scope>compile</scope>
+			<version>0.2.1-SNAPSHOT</version>
 		</dependency>
 		<dependency>
 			<groupId>edu.uci.ics.asterix</groupId>
@@ -45,26 +44,12 @@
 		<dependency>
 			<groupId>edu.uci.ics.hyracks</groupId>
 			<artifactId>hyracks-algebricks-compiler</artifactId>
-			<version>0.2.0</version>
-			<scope>compile</scope>
-		</dependency>
-		<dependency>
-			<groupId>edu.uci.ics.hyracks</groupId>
-			<artifactId>hyracks-dataflow-common</artifactId>
-			<version>0.2.0</version>
-			<scope>compile</scope>
+			<version>0.2.1-SNAPSHOT</version>
 		</dependency>
 		<dependency>
 			<groupId>edu.uci.ics.hyracks</groupId>
 			<artifactId>hyracks-storage-am-rtree</artifactId>
-			<version>0.2.0</version>
-			<scope>compile</scope>
-		</dependency>
-		<dependency>
-			<groupId>edu.uci.ics.hyracks</groupId>
-			<artifactId>hyracks-storage-am-common</artifactId>
-			<version>0.2.0</version>
-			<scope>compile</scope>
+			<version>0.2.1-SNAPSHOT</version>
 		</dependency>
 	</dependencies>
 </project>
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 c898f86..9e46f1d 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
@@ -357,6 +357,10 @@
         }
         return finfo;
     }
+    
+    public static AsterixFunctionInfo lookupFunction(FunctionIdentifier fid) {
+        return (AsterixFunctionInfo) asterixFunctionIdToInfo.get(fid);
+    }
 
     static {
 
diff --git a/asterix-om/src/main/java/edu/uci/ics/asterix/om/functions/AsterixFunctionInfo.java b/asterix-om/src/main/java/edu/uci/ics/asterix/om/functions/AsterixFunctionInfo.java
index c5e4b99..8580d33 100644
--- a/asterix-om/src/main/java/edu/uci/ics/asterix/om/functions/AsterixFunctionInfo.java
+++ b/asterix-om/src/main/java/edu/uci/ics/asterix/om/functions/AsterixFunctionInfo.java
@@ -37,12 +37,6 @@
         return functionIdentifier;
     }
 
-    
-    @Override
-    public Object getInfo() {
-        throw new IllegalStateException();
-    }
-
     @Override
     public int hashCode() {
         return toString().hashCode();
diff --git a/asterix-runtime/pom.xml b/asterix-runtime/pom.xml
index e3b246a..3b5b392 100644
--- a/asterix-runtime/pom.xml
+++ b/asterix-runtime/pom.xml
@@ -56,38 +56,7 @@
 		<dependency>
 			<groupId>edu.uci.ics.hyracks</groupId>
 		        <artifactId>hyracks-storage-am-btree</artifactId>
-			<version>0.2.0</version>
-			<scope>compile</scope>
-		</dependency>
-		<dependency>
-			<groupId>edu.uci.ics.hyracks</groupId>
-		        <artifactId>hyracks-storage-am-common</artifactId>
-			<version>0.2.0</version>
-			<scope>compile</scope>
-		</dependency>
-		<dependency>
-		        <groupId>edu.uci.ics.hyracks</groupId>
-		        <artifactId>hyracks-storage-common</artifactId>
-			<version>0.2.0</version>
-			<scope>compile</scope>
-		</dependency>
-		<dependency>
-		        <groupId>edu.uci.ics.hyracks</groupId>
-		        <artifactId>hyracks-api</artifactId>
-			<version>0.2.0</version>
-			<scope>compile</scope>
-		</dependency>
-		<dependency>
-		        <groupId>edu.uci.ics.hyracks</groupId>
-		        <artifactId>hyracks-dataflow-common</artifactId>
-			<version>0.2.0</version>
-			<scope>compile</scope>
-		</dependency>
-		<dependency>
-		        <groupId>edu.uci.ics.hyracks</groupId>
-		        <artifactId>hyracks-dataflow-std</artifactId>
-			<version>0.2.0</version>
-			<scope>compile</scope>
+			<version>0.2.1-SNAPSHOT</version>
 		</dependency>
 		<dependency>
 		        <groupId>edu.uci.ics.asterix</groupId>