added fix for not pushing multiple aggregate functions in PushAggFuncIntoStandaloneAggregateRule
diff --git a/asterix-algebra/src/main/java/edu/uci/ics/asterix/optimizer/rules/PushAggFuncIntoStandaloneAggregateRule.java b/asterix-algebra/src/main/java/edu/uci/ics/asterix/optimizer/rules/PushAggFuncIntoStandaloneAggregateRule.java
index 9af6c48..3c9f1cc 100644
--- a/asterix-algebra/src/main/java/edu/uci/ics/asterix/optimizer/rules/PushAggFuncIntoStandaloneAggregateRule.java
+++ b/asterix-algebra/src/main/java/edu/uci/ics/asterix/optimizer/rules/PushAggFuncIntoStandaloneAggregateRule.java
@@ -122,7 +122,14 @@
 
     private Mutable<ILogicalExpression> fingAggFuncExprRef(List<Mutable<ILogicalExpression>> exprRefs,
             LogicalVariable aggVar) {
+
+        // only works for single aggregate function
+        if (exprRefs.size() > 1) {
+            return null;
+        }
+
         for (Mutable<ILogicalExpression> exprRef : exprRefs) {
+
             ILogicalExpression expr = exprRef.getValue();
             if (expr.getExpressionTag() != LogicalExpressionTag.FUNCTION_CALL) {
                 continue;
diff --git a/asterix-app/src/test/resources/runtimets/results/aggregate/agg_null_rec/agg_null_rec.1.adm b/asterix-app/src/test/resources/runtimets/results/aggregate/agg_null_rec/agg_null_rec.1.adm
index 77d99fc..7c1107a 100644
--- a/asterix-app/src/test/resources/runtimets/results/aggregate/agg_null_rec/agg_null_rec.1.adm
+++ b/asterix-app/src/test/resources/runtimets/results/aggregate/agg_null_rec/agg_null_rec.1.adm
@@ -1 +1 @@
-{ "count": 1, "average": null, "sum": null, "min": null, "max": null }
\ No newline at end of file
+{ "count": 3, "average": null, "sum": null, "min": null, "max": null }
\ No newline at end of file
diff --git a/asterix-app/src/test/resources/runtimets/results/aggregate/agg_number_rec/agg_number_rec.1.adm b/asterix-app/src/test/resources/runtimets/results/aggregate/agg_number_rec/agg_number_rec.1.adm
index 77d99fc..a3c13a2 100644
--- a/asterix-app/src/test/resources/runtimets/results/aggregate/agg_number_rec/agg_number_rec.1.adm
+++ b/asterix-app/src/test/resources/runtimets/results/aggregate/agg_number_rec/agg_number_rec.1.adm
@@ -1 +1 @@
-{ "count": 1, "average": null, "sum": null, "min": null, "max": null }
\ No newline at end of file
+{ "count": 3, "average": 1.2824609161579424E16d, "sum": 3.8473827484738272E16d, "min": 2.0d, "max": 3.847382748473824E16d }
\ No newline at end of file
diff --git a/asterix-app/src/test/resources/runtimets/testsuite.xml b/asterix-app/src/test/resources/runtimets/testsuite.xml
index ff3f8ea..d011f2c 100644
--- a/asterix-app/src/test/resources/runtimets/testsuite.xml
+++ b/asterix-app/src/test/resources/runtimets/testsuite.xml
@@ -11,6 +11,11 @@
       </compilation-unit>
     </test-case>
     <test-case FilePath="aggregate">
+      <compilation-unit name="agg_number_rec">
+        <output-dir compare="Text">agg_number_rec</output-dir>
+      </compilation-unit>
+    </test-case>
+    <test-case FilePath="aggregate">
       <compilation-unit name="avg_mixed">
         <output-dir compare="Text">avg_mixed</output-dir>
         <expected-error>edu.uci.ics.asterix.common.exceptions.AsterixException</expected-error>