1. Fix for issue 810.
2. Add regression tests for issue 567 and 697.
Change-Id: I1eb4d7ca5d757f317efbe373ba502c6db61d93f4
Reviewed-on: http://fulliautomatix.ics.uci.edu:8443/179
Reviewed-by: Preston Carman <ecarm002@ucr.edu>
Tested-by: Jenkins <jenkins@fulliautomatix.ics.uci.edu>
diff --git a/asterix-app/src/test/resources/optimizerts/queries/query-issue697.aql b/asterix-app/src/test/resources/optimizerts/queries/query-issue697.aql
new file mode 100644
index 0000000..1442482
--- /dev/null
+++ b/asterix-app/src/test/resources/optimizerts/queries/query-issue697.aql
@@ -0,0 +1,27 @@
+/*
+ * Description : This test case is to verify the fix for issue697
+ * https://code.google.com/p/asterixdb/issues/detail?id=697
+ * Expected Result : Success
+ * Date : 16th Nov. 2014
+ */
+
+drop dataverse test if exists;
+create dataverse test;
+
+use dataverse test;
+
+create type TestType as closed {
+ key1: int32,
+ value: int32
+}
+
+create dataset test(TestType)
+ primary key key1;
+
+
+for $i in dataset("test")
+group by $aid := $i.key1 with $i
+return {
+ "gid": $aid,
+ "avg": avg(for $j in $i where not(is-null($j.value)) return $j.value)
+}