Test changes to integrate with REST API test framework
git-svn-id: https://asterixdb.googlecode.com/svn/branches/asterix_stabilization_result_distribution@1330 eaa15691-b419-025a-1212-ee371bd00084
diff --git a/asterix-app/src/test/resources/runtimets/queries/aggregate/avg_double_null/avg_double_null.1.ddl.aql b/asterix-app/src/test/resources/runtimets/queries/aggregate/avg_double_null/avg_double_null.1.ddl.aql
new file mode 100644
index 0000000..7aae44e
--- /dev/null
+++ b/asterix-app/src/test/resources/runtimets/queries/aggregate/avg_double_null/avg_double_null.1.ddl.aql
@@ -0,0 +1,18 @@
+drop dataverse test if exists;
+
+create dataverse test;
+
+create type NumericType as open {
+ id: int32,
+ int8Field: int8?,
+ int16Field: int16?,
+ int32Field: int32?,
+ int64Field: int64?,
+ floatField: float?,
+ doubleField: double?
+}
+
+create external dataset Numeric(NumericType)
+using "edu.uci.ics.asterix.external.dataset.adapter.NCFileSystemAdapter"
+(("path"="nc1://data/nontagged/numericData.json"),("format"="adm"));
+
diff --git a/asterix-app/src/test/resources/runtimets/queries/aggregate/avg_double_null/avg_double_null.2.update.aql b/asterix-app/src/test/resources/runtimets/queries/aggregate/avg_double_null/avg_double_null.2.update.aql
new file mode 100644
index 0000000..1ecf3aa
--- /dev/null
+++ b/asterix-app/src/test/resources/runtimets/queries/aggregate/avg_double_null/avg_double_null.2.update.aql
@@ -0,0 +1 @@
+// no inserts, deletes
diff --git a/asterix-app/src/test/resources/runtimets/queries/aggregate/avg_double_null/avg_double_null.3.query.aql b/asterix-app/src/test/resources/runtimets/queries/aggregate/avg_double_null/avg_double_null.3.query.aql
new file mode 100644
index 0000000..9eb80c4
--- /dev/null
+++ b/asterix-app/src/test/resources/runtimets/queries/aggregate/avg_double_null/avg_double_null.3.query.aql
@@ -0,0 +1,7 @@
+use dataverse test;
+
+let $a := avg(
+ for $x in dataset('Numeric')
+ return $x.doubleField
+)
+return {"average": $a}
diff --git a/asterix-app/src/test/resources/runtimets/queries/aggregate/avg_empty_01/avg_empty_01.1.ddl.aql b/asterix-app/src/test/resources/runtimets/queries/aggregate/avg_empty_01/avg_empty_01.1.ddl.aql
new file mode 100644
index 0000000..0ed1519
--- /dev/null
+++ b/asterix-app/src/test/resources/runtimets/queries/aggregate/avg_empty_01/avg_empty_01.1.ddl.aql
@@ -0,0 +1,9 @@
+/*
+ * Description : Tests that avg aggregation correctly returns null for an empty stream,
+ * without an aggregate combiner.
+ * Success : Yes
+ */
+
+drop dataverse test if exists;
+create dataverse test;
+
diff --git a/asterix-app/src/test/resources/runtimets/queries/aggregate/avg_empty_01/avg_empty_01.2.update.aql b/asterix-app/src/test/resources/runtimets/queries/aggregate/avg_empty_01/avg_empty_01.2.update.aql
new file mode 100644
index 0000000..d1537b0
--- /dev/null
+++ b/asterix-app/src/test/resources/runtimets/queries/aggregate/avg_empty_01/avg_empty_01.2.update.aql
@@ -0,0 +1,7 @@
+/*
+ * Description : Tests that avg aggregation correctly returns null for an empty stream,
+ * without an aggregate combiner.
+ * Success : Yes
+ */
+
+// no inserts, deletes
diff --git a/asterix-app/src/test/resources/runtimets/queries/aggregate/avg_empty_01/avg_empty_01.3.query.aql b/asterix-app/src/test/resources/runtimets/queries/aggregate/avg_empty_01/avg_empty_01.3.query.aql
new file mode 100644
index 0000000..ddeb318
--- /dev/null
+++ b/asterix-app/src/test/resources/runtimets/queries/aggregate/avg_empty_01/avg_empty_01.3.query.aql
@@ -0,0 +1,13 @@
+/*
+ * Description : Tests that avg aggregation correctly returns null for an empty stream,
+ * without an aggregate combiner.
+ * Success : Yes
+ */
+
+use dataverse test;
+
+avg(
+ for $x in [1, 2, 3]
+ where $x > 10
+ return $x
+)
diff --git a/asterix-app/src/test/resources/runtimets/queries/aggregate/avg_empty_02/avg_empty_02.1.ddl.aql b/asterix-app/src/test/resources/runtimets/queries/aggregate/avg_empty_02/avg_empty_02.1.ddl.aql
new file mode 100644
index 0000000..7ace66f
--- /dev/null
+++ b/asterix-app/src/test/resources/runtimets/queries/aggregate/avg_empty_02/avg_empty_02.1.ddl.aql
@@ -0,0 +1,16 @@
+/*
+ * Description : Tests that avg aggregation correctly returns null for an empty stream,
+ * with an aggregate combiner.
+ * Success : Yes
+ */
+
+drop dataverse test if exists;
+create dataverse test;
+
+create type TestType as closed {
+ id: int32,
+ val: double
+}
+
+create dataset Test(TestType) primary key id;
+
diff --git a/asterix-app/src/test/resources/runtimets/queries/aggregate/avg_empty_02/avg_empty_02.2.update.aql b/asterix-app/src/test/resources/runtimets/queries/aggregate/avg_empty_02/avg_empty_02.2.update.aql
new file mode 100644
index 0000000..5a8604b
--- /dev/null
+++ b/asterix-app/src/test/resources/runtimets/queries/aggregate/avg_empty_02/avg_empty_02.2.update.aql
@@ -0,0 +1,7 @@
+/*
+ * Description : Tests that avg aggregation correctly returns null for an empty stream,
+ * with an aggregate combiner.
+ * Success : Yes
+ */
+
+// no inserts, deletes
diff --git a/asterix-app/src/test/resources/runtimets/queries/aggregate/avg_empty_02/avg_empty_02.3.query.aql b/asterix-app/src/test/resources/runtimets/queries/aggregate/avg_empty_02/avg_empty_02.3.query.aql
new file mode 100644
index 0000000..d73d568
--- /dev/null
+++ b/asterix-app/src/test/resources/runtimets/queries/aggregate/avg_empty_02/avg_empty_02.3.query.aql
@@ -0,0 +1,12 @@
+/*
+ * Description : Tests that avg aggregation correctly returns null for an empty stream,
+ * with an aggregate combiner.
+ * Success : Yes
+ */
+
+use dataverse test;
+
+avg(
+ for $x in dataset('Test')
+ return $x.val
+)
diff --git a/asterix-app/src/test/resources/runtimets/queries/aggregate/avg_float/avg_float.1.ddl.aql b/asterix-app/src/test/resources/runtimets/queries/aggregate/avg_float/avg_float.1.ddl.aql
new file mode 100644
index 0000000..97b4670
--- /dev/null
+++ b/asterix-app/src/test/resources/runtimets/queries/aggregate/avg_float/avg_float.1.ddl.aql
@@ -0,0 +1,4 @@
+drop dataverse test if exists;
+
+create dataverse test;
+
diff --git a/asterix-app/src/test/resources/runtimets/queries/aggregate/avg_float/avg_float.2.update.aql b/asterix-app/src/test/resources/runtimets/queries/aggregate/avg_float/avg_float.2.update.aql
new file mode 100644
index 0000000..e69de29
--- /dev/null
+++ b/asterix-app/src/test/resources/runtimets/queries/aggregate/avg_float/avg_float.2.update.aql
diff --git a/asterix-app/src/test/resources/runtimets/queries/aggregate/avg_float/avg_float.3.query.aql b/asterix-app/src/test/resources/runtimets/queries/aggregate/avg_float/avg_float.3.query.aql
new file mode 100644
index 0000000..c7ec789
--- /dev/null
+++ b/asterix-app/src/test/resources/runtimets/queries/aggregate/avg_float/avg_float.3.query.aql
@@ -0,0 +1,6 @@
+use dataverse test;
+
+avg(
+ for $x in [float("1"), float("2"), float("3")]
+ return $x
+)
diff --git a/asterix-app/src/test/resources/runtimets/queries/aggregate/avg_float_null/avg_float_nu.1.ddl.aql b/asterix-app/src/test/resources/runtimets/queries/aggregate/avg_float_null/avg_float_nu.1.ddl.aql
new file mode 100644
index 0000000..7aae44e
--- /dev/null
+++ b/asterix-app/src/test/resources/runtimets/queries/aggregate/avg_float_null/avg_float_nu.1.ddl.aql
@@ -0,0 +1,18 @@
+drop dataverse test if exists;
+
+create dataverse test;
+
+create type NumericType as open {
+ id: int32,
+ int8Field: int8?,
+ int16Field: int16?,
+ int32Field: int32?,
+ int64Field: int64?,
+ floatField: float?,
+ doubleField: double?
+}
+
+create external dataset Numeric(NumericType)
+using "edu.uci.ics.asterix.external.dataset.adapter.NCFileSystemAdapter"
+(("path"="nc1://data/nontagged/numericData.json"),("format"="adm"));
+
diff --git a/asterix-app/src/test/resources/runtimets/queries/aggregate/avg_float_null/avg_float_nu.2.update.aql b/asterix-app/src/test/resources/runtimets/queries/aggregate/avg_float_null/avg_float_nu.2.update.aql
new file mode 100644
index 0000000..e69de29
--- /dev/null
+++ b/asterix-app/src/test/resources/runtimets/queries/aggregate/avg_float_null/avg_float_nu.2.update.aql
diff --git a/asterix-app/src/test/resources/runtimets/queries/aggregate/avg_float_null/avg_float_nu.3.query.aql b/asterix-app/src/test/resources/runtimets/queries/aggregate/avg_float_null/avg_float_nu.3.query.aql
new file mode 100644
index 0000000..536c339
--- /dev/null
+++ b/asterix-app/src/test/resources/runtimets/queries/aggregate/avg_float_null/avg_float_nu.3.query.aql
@@ -0,0 +1,7 @@
+use dataverse test;
+
+let $a := avg(
+ for $x in dataset('Numeric')
+ return $x.floatField
+)
+return {"average": $a}
diff --git a/asterix-app/src/test/resources/runtimets/queries/aggregate/avg_int16/avg_int16.1.ddl.aql b/asterix-app/src/test/resources/runtimets/queries/aggregate/avg_int16/avg_int16.1.ddl.aql
new file mode 100644
index 0000000..97b4670
--- /dev/null
+++ b/asterix-app/src/test/resources/runtimets/queries/aggregate/avg_int16/avg_int16.1.ddl.aql
@@ -0,0 +1,4 @@
+drop dataverse test if exists;
+
+create dataverse test;
+
diff --git a/asterix-app/src/test/resources/runtimets/queries/aggregate/avg_int16/avg_int16.2.update.aql b/asterix-app/src/test/resources/runtimets/queries/aggregate/avg_int16/avg_int16.2.update.aql
new file mode 100644
index 0000000..8b13789
--- /dev/null
+++ b/asterix-app/src/test/resources/runtimets/queries/aggregate/avg_int16/avg_int16.2.update.aql
@@ -0,0 +1 @@
+
diff --git a/asterix-app/src/test/resources/runtimets/queries/aggregate/avg_int16/avg_int16.3.query.aql b/asterix-app/src/test/resources/runtimets/queries/aggregate/avg_int16/avg_int16.3.query.aql
new file mode 100644
index 0000000..cc7edcd
--- /dev/null
+++ b/asterix-app/src/test/resources/runtimets/queries/aggregate/avg_int16/avg_int16.3.query.aql
@@ -0,0 +1,6 @@
+use dataverse test;
+
+avg(
+ for $x in [int16("1"), int16("2"), int16("3")]
+ return $x
+)
diff --git a/asterix-app/src/test/resources/runtimets/queries/aggregate/avg_int16_null/avg_int16_null.1.ddl.aql b/asterix-app/src/test/resources/runtimets/queries/aggregate/avg_int16_null/avg_int16_null.1.ddl.aql
new file mode 100644
index 0000000..7aae44e
--- /dev/null
+++ b/asterix-app/src/test/resources/runtimets/queries/aggregate/avg_int16_null/avg_int16_null.1.ddl.aql
@@ -0,0 +1,18 @@
+drop dataverse test if exists;
+
+create dataverse test;
+
+create type NumericType as open {
+ id: int32,
+ int8Field: int8?,
+ int16Field: int16?,
+ int32Field: int32?,
+ int64Field: int64?,
+ floatField: float?,
+ doubleField: double?
+}
+
+create external dataset Numeric(NumericType)
+using "edu.uci.ics.asterix.external.dataset.adapter.NCFileSystemAdapter"
+(("path"="nc1://data/nontagged/numericData.json"),("format"="adm"));
+
diff --git a/asterix-app/src/test/resources/runtimets/queries/aggregate/avg_int16_null/avg_int16_null.2.update.aql b/asterix-app/src/test/resources/runtimets/queries/aggregate/avg_int16_null/avg_int16_null.2.update.aql
new file mode 100644
index 0000000..e69de29
--- /dev/null
+++ b/asterix-app/src/test/resources/runtimets/queries/aggregate/avg_int16_null/avg_int16_null.2.update.aql
diff --git a/asterix-app/src/test/resources/runtimets/queries/aggregate/avg_int16_null/avg_int16_null.3.query.aql b/asterix-app/src/test/resources/runtimets/queries/aggregate/avg_int16_null/avg_int16_null.3.query.aql
new file mode 100644
index 0000000..9b73751
--- /dev/null
+++ b/asterix-app/src/test/resources/runtimets/queries/aggregate/avg_int16_null/avg_int16_null.3.query.aql
@@ -0,0 +1,7 @@
+use dataverse test;
+
+let $a := avg(
+ for $x in dataset('Numeric')
+ return $x.int16Field
+)
+return {"average": $a}
diff --git a/asterix-app/src/test/resources/runtimets/queries/aggregate/avg_int32/avg_int32.1.ddl.aql b/asterix-app/src/test/resources/runtimets/queries/aggregate/avg_int32/avg_int32.1.ddl.aql
new file mode 100644
index 0000000..97b4670
--- /dev/null
+++ b/asterix-app/src/test/resources/runtimets/queries/aggregate/avg_int32/avg_int32.1.ddl.aql
@@ -0,0 +1,4 @@
+drop dataverse test if exists;
+
+create dataverse test;
+
diff --git a/asterix-app/src/test/resources/runtimets/queries/aggregate/avg_int32/avg_int32.2.update.aql b/asterix-app/src/test/resources/runtimets/queries/aggregate/avg_int32/avg_int32.2.update.aql
new file mode 100644
index 0000000..8b13789
--- /dev/null
+++ b/asterix-app/src/test/resources/runtimets/queries/aggregate/avg_int32/avg_int32.2.update.aql
@@ -0,0 +1 @@
+
diff --git a/asterix-app/src/test/resources/runtimets/queries/aggregate/avg_int32/avg_int32.3.query.aql b/asterix-app/src/test/resources/runtimets/queries/aggregate/avg_int32/avg_int32.3.query.aql
new file mode 100644
index 0000000..49a3cc2
--- /dev/null
+++ b/asterix-app/src/test/resources/runtimets/queries/aggregate/avg_int32/avg_int32.3.query.aql
@@ -0,0 +1,7 @@
+use dataverse test;
+
+avg(
+ for $x in [1, 2, 3]
+ return $x
+)
+
diff --git a/asterix-app/src/test/resources/runtimets/queries/aggregate/avg_int32_null/avg_int32_null.1.ddl.aql b/asterix-app/src/test/resources/runtimets/queries/aggregate/avg_int32_null/avg_int32_null.1.ddl.aql
new file mode 100644
index 0000000..7aae44e
--- /dev/null
+++ b/asterix-app/src/test/resources/runtimets/queries/aggregate/avg_int32_null/avg_int32_null.1.ddl.aql
@@ -0,0 +1,18 @@
+drop dataverse test if exists;
+
+create dataverse test;
+
+create type NumericType as open {
+ id: int32,
+ int8Field: int8?,
+ int16Field: int16?,
+ int32Field: int32?,
+ int64Field: int64?,
+ floatField: float?,
+ doubleField: double?
+}
+
+create external dataset Numeric(NumericType)
+using "edu.uci.ics.asterix.external.dataset.adapter.NCFileSystemAdapter"
+(("path"="nc1://data/nontagged/numericData.json"),("format"="adm"));
+
diff --git a/asterix-app/src/test/resources/runtimets/queries/aggregate/avg_int32_null/avg_int32_null.2.update.aql b/asterix-app/src/test/resources/runtimets/queries/aggregate/avg_int32_null/avg_int32_null.2.update.aql
new file mode 100644
index 0000000..e69de29
--- /dev/null
+++ b/asterix-app/src/test/resources/runtimets/queries/aggregate/avg_int32_null/avg_int32_null.2.update.aql
diff --git a/asterix-app/src/test/resources/runtimets/queries/aggregate/avg_int32_null/avg_int32_null.3.query.aql b/asterix-app/src/test/resources/runtimets/queries/aggregate/avg_int32_null/avg_int32_null.3.query.aql
new file mode 100644
index 0000000..31fcb7a
--- /dev/null
+++ b/asterix-app/src/test/resources/runtimets/queries/aggregate/avg_int32_null/avg_int32_null.3.query.aql
@@ -0,0 +1,7 @@
+use dataverse test;
+
+let $a := avg(
+ for $x in dataset('Numeric')
+ return $x.int32Field
+)
+return {"average": $a}
diff --git a/asterix-app/src/test/resources/runtimets/queries/aggregate/avg_int64/avg_int64.1.ddl.aql b/asterix-app/src/test/resources/runtimets/queries/aggregate/avg_int64/avg_int64.1.ddl.aql
new file mode 100644
index 0000000..d330bc0
--- /dev/null
+++ b/asterix-app/src/test/resources/runtimets/queries/aggregate/avg_int64/avg_int64.1.ddl.aql
@@ -0,0 +1,3 @@
+drop dataverse test if exists;
+
+create dataverse test;
diff --git a/asterix-app/src/test/resources/runtimets/queries/aggregate/avg_int64/avg_int64.2.update.aql b/asterix-app/src/test/resources/runtimets/queries/aggregate/avg_int64/avg_int64.2.update.aql
new file mode 100644
index 0000000..e69de29
--- /dev/null
+++ b/asterix-app/src/test/resources/runtimets/queries/aggregate/avg_int64/avg_int64.2.update.aql
diff --git a/asterix-app/src/test/resources/runtimets/queries/aggregate/avg_int64/avg_int64.3.query.aql b/asterix-app/src/test/resources/runtimets/queries/aggregate/avg_int64/avg_int64.3.query.aql
new file mode 100644
index 0000000..8d2860a
--- /dev/null
+++ b/asterix-app/src/test/resources/runtimets/queries/aggregate/avg_int64/avg_int64.3.query.aql
@@ -0,0 +1,6 @@
+use dataverse test;
+
+avg(
+ for $x in [int64("1"), int64("2"), int64("3")]
+ return $x
+)
diff --git a/asterix-app/src/test/resources/runtimets/queries/aggregate/avg_int64_null/avg_int64_null.1.ddl.aql b/asterix-app/src/test/resources/runtimets/queries/aggregate/avg_int64_null/avg_int64_null.1.ddl.aql
new file mode 100644
index 0000000..7aae44e
--- /dev/null
+++ b/asterix-app/src/test/resources/runtimets/queries/aggregate/avg_int64_null/avg_int64_null.1.ddl.aql
@@ -0,0 +1,18 @@
+drop dataverse test if exists;
+
+create dataverse test;
+
+create type NumericType as open {
+ id: int32,
+ int8Field: int8?,
+ int16Field: int16?,
+ int32Field: int32?,
+ int64Field: int64?,
+ floatField: float?,
+ doubleField: double?
+}
+
+create external dataset Numeric(NumericType)
+using "edu.uci.ics.asterix.external.dataset.adapter.NCFileSystemAdapter"
+(("path"="nc1://data/nontagged/numericData.json"),("format"="adm"));
+
diff --git a/asterix-app/src/test/resources/runtimets/queries/aggregate/avg_int64_null/avg_int64_null.2.update.aql b/asterix-app/src/test/resources/runtimets/queries/aggregate/avg_int64_null/avg_int64_null.2.update.aql
new file mode 100644
index 0000000..e69de29
--- /dev/null
+++ b/asterix-app/src/test/resources/runtimets/queries/aggregate/avg_int64_null/avg_int64_null.2.update.aql
diff --git a/asterix-app/src/test/resources/runtimets/queries/aggregate/avg_int64_null/avg_int64_null.3.query.aql b/asterix-app/src/test/resources/runtimets/queries/aggregate/avg_int64_null/avg_int64_null.3.query.aql
new file mode 100644
index 0000000..6b18e0f
--- /dev/null
+++ b/asterix-app/src/test/resources/runtimets/queries/aggregate/avg_int64_null/avg_int64_null.3.query.aql
@@ -0,0 +1,7 @@
+use dataverse test;
+
+let $a := avg(
+ for $x in dataset('Numeric')
+ return $x.int64Field
+)
+return {"average": $a}
diff --git a/asterix-app/src/test/resources/runtimets/queries/aggregate/avg_int8/avg_int8.1.ddl.aql b/asterix-app/src/test/resources/runtimets/queries/aggregate/avg_int8/avg_int8.1.ddl.aql
new file mode 100644
index 0000000..d330bc0
--- /dev/null
+++ b/asterix-app/src/test/resources/runtimets/queries/aggregate/avg_int8/avg_int8.1.ddl.aql
@@ -0,0 +1,3 @@
+drop dataverse test if exists;
+
+create dataverse test;
diff --git a/asterix-app/src/test/resources/runtimets/queries/aggregate/avg_int8/avg_int8.2.update.aql b/asterix-app/src/test/resources/runtimets/queries/aggregate/avg_int8/avg_int8.2.update.aql
new file mode 100644
index 0000000..e69de29
--- /dev/null
+++ b/asterix-app/src/test/resources/runtimets/queries/aggregate/avg_int8/avg_int8.2.update.aql
diff --git a/asterix-app/src/test/resources/runtimets/queries/aggregate/avg_int8/avg_int8.3.query.aql b/asterix-app/src/test/resources/runtimets/queries/aggregate/avg_int8/avg_int8.3.query.aql
new file mode 100644
index 0000000..ac648af
--- /dev/null
+++ b/asterix-app/src/test/resources/runtimets/queries/aggregate/avg_int8/avg_int8.3.query.aql
@@ -0,0 +1,6 @@
+use dataverse test;
+
+avg(
+ for $x in [int8("1"),int8("2"), int8("3")]
+ return $x
+)
diff --git a/asterix-app/src/test/resources/runtimets/queries/aggregate/avg_int8_null/avg_int8_null.1.ddl.aql b/asterix-app/src/test/resources/runtimets/queries/aggregate/avg_int8_null/avg_int8_null.1.ddl.aql
new file mode 100644
index 0000000..ba1bb8f
--- /dev/null
+++ b/asterix-app/src/test/resources/runtimets/queries/aggregate/avg_int8_null/avg_int8_null.1.ddl.aql
@@ -0,0 +1,17 @@
+drop dataverse test if exists;
+
+create dataverse test;
+
+create type NumericType as open {
+ id: int32,
+ int8Field: int8?,
+ int16Field: int16?,
+ int32Field: int32?,
+ int64Field: int64?,
+ floatField: float?,
+ doubleField: double?
+}
+
+create external dataset Numeric(NumericType)
+using "edu.uci.ics.asterix.external.dataset.adapter.NCFileSystemAdapter"
+(("path"="nc1://data/nontagged/numericData.json"),("format"="adm"));
diff --git a/asterix-app/src/test/resources/runtimets/queries/aggregate/avg_int8_null/avg_int8_null.2.update.aql b/asterix-app/src/test/resources/runtimets/queries/aggregate/avg_int8_null/avg_int8_null.2.update.aql
new file mode 100644
index 0000000..e69de29
--- /dev/null
+++ b/asterix-app/src/test/resources/runtimets/queries/aggregate/avg_int8_null/avg_int8_null.2.update.aql
diff --git a/asterix-app/src/test/resources/runtimets/queries/aggregate/avg_int8_null/avg_int8_null.3.query.aql b/asterix-app/src/test/resources/runtimets/queries/aggregate/avg_int8_null/avg_int8_null.3.query.aql
new file mode 100644
index 0000000..2917fec
--- /dev/null
+++ b/asterix-app/src/test/resources/runtimets/queries/aggregate/avg_int8_null/avg_int8_null.3.query.aql
@@ -0,0 +1,7 @@
+use dataverse test;
+
+let $a := avg(
+ for $x in dataset('Numeric')
+ return $x.int8Field
+)
+return {"average": $a}
diff --git a/asterix-app/src/test/resources/runtimets/queries/aggregate/count_null/count_null.1.ddl.aql b/asterix-app/src/test/resources/runtimets/queries/aggregate/count_null/count_null.1.ddl.aql
new file mode 100644
index 0000000..7cdcbea
--- /dev/null
+++ b/asterix-app/src/test/resources/runtimets/queries/aggregate/count_null/count_null.1.ddl.aql
@@ -0,0 +1,20 @@
+drop dataverse test if exists;
+
+create dataverse test;
+
+use dataverse test;
+
+create type NumericType as open {
+ id: int32,
+ int8Field: int8?,
+ int16Field: int16?,
+ int32Field: int32?,
+ int64Field: int64?,
+ floatField: float?,
+ doubleField: double?
+}
+
+create external dataset Numeric(NumericType)
+using "edu.uci.ics.asterix.external.dataset.adapter.NCFileSystemAdapter"
+(("path"="nc1://data/nontagged/numericData.json"),("format"="adm"));
+
diff --git a/asterix-app/src/test/resources/runtimets/queries/aggregate/count_null/count_null.2.update.aql b/asterix-app/src/test/resources/runtimets/queries/aggregate/count_null/count_null.2.update.aql
new file mode 100644
index 0000000..e69de29
--- /dev/null
+++ b/asterix-app/src/test/resources/runtimets/queries/aggregate/count_null/count_null.2.update.aql
diff --git a/asterix-app/src/test/resources/runtimets/queries/aggregate/count_null/count_null.3.query.aql b/asterix-app/src/test/resources/runtimets/queries/aggregate/count_null/count_null.3.query.aql
new file mode 100644
index 0000000..9cbfe6c
--- /dev/null
+++ b/asterix-app/src/test/resources/runtimets/queries/aggregate/count_null/count_null.3.query.aql
@@ -0,0 +1,7 @@
+use dataverse test;
+
+let $c := count(
+ for $x in dataset('Numeric')
+ return $x.doubleField
+)
+return {"count": $c}
diff --git a/asterix-app/src/test/resources/runtimets/queries/aggregate/global-avg_null/global-avg_null.1.ddl.aql b/asterix-app/src/test/resources/runtimets/queries/aggregate/global-avg_null/global-avg_null.1.ddl.aql
new file mode 100644
index 0000000..cdf28e4
--- /dev/null
+++ b/asterix-app/src/test/resources/runtimets/queries/aggregate/global-avg_null/global-avg_null.1.ddl.aql
@@ -0,0 +1,22 @@
+drop dataverse test if exists;
+
+create dataverse test;
+
+use dataverse test;
+
+create type NumericType as open {
+ id: int32,
+ int8Field: int8?,
+ int16Field: int16?,
+ int32Field: int32?,
+ int64Field: int64?,
+ floatField: float?,
+ doubleField: double?
+}
+
+write output to nc1:"rttest/aggregate_global-avg_null.adm";
+
+create external dataset Numeric(NumericType)
+using "edu.uci.ics.asterix.external.dataset.adapter.NCFileSystemAdapter"
+(("path"="nc1://data/nontagged/numericData.json"),("format"="adm"));
+
diff --git a/asterix-app/src/test/resources/runtimets/queries/aggregate/global-avg_null/global-avg_null.2.update.aql b/asterix-app/src/test/resources/runtimets/queries/aggregate/global-avg_null/global-avg_null.2.update.aql
new file mode 100644
index 0000000..8b13789
--- /dev/null
+++ b/asterix-app/src/test/resources/runtimets/queries/aggregate/global-avg_null/global-avg_null.2.update.aql
@@ -0,0 +1 @@
+
diff --git a/asterix-app/src/test/resources/runtimets/queries/aggregate/global-avg_null/global-avg_null.3.query.aql b/asterix-app/src/test/resources/runtimets/queries/aggregate/global-avg_null/global-avg_null.3.query.aql
new file mode 100644
index 0000000..15493b9
--- /dev/null
+++ b/asterix-app/src/test/resources/runtimets/queries/aggregate/global-avg_null/global-avg_null.3.query.aql
@@ -0,0 +1,8 @@
+use dataverse test;
+
+let $c := global-avg(
+ for $x in dataset('Numeric')
+ return { "sum": $x.doubleField, "count": $x.int32Field }
+)
+return {"global-average": $c}
+
diff --git a/asterix-app/src/test/resources/runtimets/queries/aggregate/local-avg_double/local-avg_double.1.ddl.aql b/asterix-app/src/test/resources/runtimets/queries/aggregate/local-avg_double/local-avg_double.1.ddl.aql
new file mode 100644
index 0000000..97b4670
--- /dev/null
+++ b/asterix-app/src/test/resources/runtimets/queries/aggregate/local-avg_double/local-avg_double.1.ddl.aql
@@ -0,0 +1,4 @@
+drop dataverse test if exists;
+
+create dataverse test;
+
diff --git a/asterix-app/src/test/resources/runtimets/queries/aggregate/local-avg_double/local-avg_double.2.update.aql b/asterix-app/src/test/resources/runtimets/queries/aggregate/local-avg_double/local-avg_double.2.update.aql
new file mode 100644
index 0000000..8b13789
--- /dev/null
+++ b/asterix-app/src/test/resources/runtimets/queries/aggregate/local-avg_double/local-avg_double.2.update.aql
@@ -0,0 +1 @@
+
diff --git a/asterix-app/src/test/resources/runtimets/queries/aggregate/local-avg_double/local-avg_double.3.query.aql b/asterix-app/src/test/resources/runtimets/queries/aggregate/local-avg_double/local-avg_double.3.query.aql
new file mode 100644
index 0000000..81ebdc5
--- /dev/null
+++ b/asterix-app/src/test/resources/runtimets/queries/aggregate/local-avg_double/local-avg_double.3.query.aql
@@ -0,0 +1,7 @@
+use dataverse test;
+
+local-avg(
+ for $x in [1.0, 2.0, double("3.0")]
+ return $x
+)
+
diff --git a/asterix-app/src/test/resources/runtimets/queries/aggregate/local-avg_double_null/local-avg_double_null.1.ddl.aql b/asterix-app/src/test/resources/runtimets/queries/aggregate/local-avg_double_null/local-avg_double_null.1.ddl.aql
new file mode 100644
index 0000000..1590bae
--- /dev/null
+++ b/asterix-app/src/test/resources/runtimets/queries/aggregate/local-avg_double_null/local-avg_double_null.1.ddl.aql
@@ -0,0 +1,20 @@
+drop dataverse test if exists;
+
+create dataverse test;
+
+create type NumericType as open {
+ id: int32,
+ int8Field: int8?,
+ int16Field: int16?,
+ int32Field: int32?,
+ int64Field: int64?,
+ floatField: float?,
+ doubleField: double?
+}
+
+write output to nc1:"rttest/aggregate_local-avg_double_null.adm";
+
+create external dataset Numeric(NumericType)
+using "edu.uci.ics.asterix.external.dataset.adapter.NCFileSystemAdapter"
+(("path"="nc1://data/nontagged/numericData.json"),("format"="adm"));
+
diff --git a/asterix-app/src/test/resources/runtimets/queries/aggregate/local-avg_double_null/local-avg_double_null.2.update.aql b/asterix-app/src/test/resources/runtimets/queries/aggregate/local-avg_double_null/local-avg_double_null.2.update.aql
new file mode 100644
index 0000000..155c264
--- /dev/null
+++ b/asterix-app/src/test/resources/runtimets/queries/aggregate/local-avg_double_null/local-avg_double_null.2.update.aql
@@ -0,0 +1 @@
+// No inserts/deletes here
diff --git a/asterix-app/src/test/resources/runtimets/queries/aggregate/local-avg_double_null/local-avg_double_null.3.query.aql b/asterix-app/src/test/resources/runtimets/queries/aggregate/local-avg_double_null/local-avg_double_null.3.query.aql
new file mode 100644
index 0000000..28721d1
--- /dev/null
+++ b/asterix-app/src/test/resources/runtimets/queries/aggregate/local-avg_double_null/local-avg_double_null.3.query.aql
@@ -0,0 +1,6 @@
+use dataverse test;
+
+local-avg(
+ for $x in dataset('Numeric')
+ return $x.doubleField
+)
diff --git a/asterix-app/src/test/resources/runtimets/queries/aggregate/local-avg_float/local-avg_float.1.ddl.aql b/asterix-app/src/test/resources/runtimets/queries/aggregate/local-avg_float/local-avg_float.1.ddl.aql
new file mode 100644
index 0000000..97b4670
--- /dev/null
+++ b/asterix-app/src/test/resources/runtimets/queries/aggregate/local-avg_float/local-avg_float.1.ddl.aql
@@ -0,0 +1,4 @@
+drop dataverse test if exists;
+
+create dataverse test;
+
diff --git a/asterix-app/src/test/resources/runtimets/queries/aggregate/local-avg_float/local-avg_float.2.update.aql b/asterix-app/src/test/resources/runtimets/queries/aggregate/local-avg_float/local-avg_float.2.update.aql
new file mode 100644
index 0000000..c52462e
--- /dev/null
+++ b/asterix-app/src/test/resources/runtimets/queries/aggregate/local-avg_float/local-avg_float.2.update.aql
@@ -0,0 +1 @@
+// no inserts/deletes here
diff --git a/asterix-app/src/test/resources/runtimets/queries/aggregate/local-avg_float/local-avg_float.3.query.aql b/asterix-app/src/test/resources/runtimets/queries/aggregate/local-avg_float/local-avg_float.3.query.aql
new file mode 100644
index 0000000..ae73bf4
--- /dev/null
+++ b/asterix-app/src/test/resources/runtimets/queries/aggregate/local-avg_float/local-avg_float.3.query.aql
@@ -0,0 +1,7 @@
+use dataverse test;
+
+local-avg(
+ for $x in [float("1"), float("2"), float("3")]
+ return $x
+)
+
diff --git a/asterix-app/src/test/resources/runtimets/queries/aggregate/local-avg_float_null/local-avg_float_null.1.ddl.aql b/asterix-app/src/test/resources/runtimets/queries/aggregate/local-avg_float_null/local-avg_float_null.1.ddl.aql
new file mode 100644
index 0000000..fcf1327
--- /dev/null
+++ b/asterix-app/src/test/resources/runtimets/queries/aggregate/local-avg_float_null/local-avg_float_null.1.ddl.aql
@@ -0,0 +1,20 @@
+drop dataverse test if exists;
+
+create dataverse test;
+
+create type NumericType as open {
+ id: int32,
+ int8Field: int8?,
+ int16Field: int16?,
+ int32Field: int32?,
+ int64Field: int64?,
+ floatField: float?,
+ doubleField: double?
+}
+
+write output to nc1:"rttest/aggregate_local-avg_float_null.adm";
+
+create external dataset Numeric(NumericType)
+using "edu.uci.ics.asterix.external.dataset.adapter.NCFileSystemAdapter"
+(("path"="nc1://data/nontagged/numericData.json"),("format"="adm"));
+
diff --git a/asterix-app/src/test/resources/runtimets/queries/aggregate/local-avg_float_null/local-avg_float_null.2.update.aql b/asterix-app/src/test/resources/runtimets/queries/aggregate/local-avg_float_null/local-avg_float_null.2.update.aql
new file mode 100644
index 0000000..b77b33e
--- /dev/null
+++ b/asterix-app/src/test/resources/runtimets/queries/aggregate/local-avg_float_null/local-avg_float_null.2.update.aql
@@ -0,0 +1 @@
+// no insert delete here
diff --git a/asterix-app/src/test/resources/runtimets/queries/aggregate/local-avg_float_null/local-avg_float_null.3.query.aql b/asterix-app/src/test/resources/runtimets/queries/aggregate/local-avg_float_null/local-avg_float_null.3.query.aql
new file mode 100644
index 0000000..8fe8c64
--- /dev/null
+++ b/asterix-app/src/test/resources/runtimets/queries/aggregate/local-avg_float_null/local-avg_float_null.3.query.aql
@@ -0,0 +1,6 @@
+use dataverse test;
+
+local-avg(
+ for $x in dataset('Numeric')
+ return $x.floatField
+)
diff --git a/asterix-app/src/test/resources/runtimets/queries/aggregate/local-avg_int16/local-avg_int16.1.ddl.aql b/asterix-app/src/test/resources/runtimets/queries/aggregate/local-avg_int16/local-avg_int16.1.ddl.aql
new file mode 100644
index 0000000..c01b9e9
--- /dev/null
+++ b/asterix-app/src/test/resources/runtimets/queries/aggregate/local-avg_int16/local-avg_int16.1.ddl.aql
@@ -0,0 +1,9 @@
+drop dataverse test if exists;
+
+create dataverse test;
+
+local-avg(
+ for $x in [int16("1"), int16("2"), int16("3")]
+ return $x
+)
+
diff --git a/asterix-app/src/test/resources/runtimets/queries/aggregate/local-avg_int16/local-avg_int16.2.update.aql b/asterix-app/src/test/resources/runtimets/queries/aggregate/local-avg_int16/local-avg_int16.2.update.aql
new file mode 100644
index 0000000..8b13789
--- /dev/null
+++ b/asterix-app/src/test/resources/runtimets/queries/aggregate/local-avg_int16/local-avg_int16.2.update.aql
@@ -0,0 +1 @@
+
diff --git a/asterix-app/src/test/resources/runtimets/queries/aggregate/local-avg_int16/local-avg_int16.3.query.aql b/asterix-app/src/test/resources/runtimets/queries/aggregate/local-avg_int16/local-avg_int16.3.query.aql
new file mode 100644
index 0000000..2d776a9
--- /dev/null
+++ b/asterix-app/src/test/resources/runtimets/queries/aggregate/local-avg_int16/local-avg_int16.3.query.aql
@@ -0,0 +1,7 @@
+use dataverse test;
+
+local-avg(
+ for $x in [int16("1"), int16("2"), int16("3")]
+ return $x
+)
+
diff --git a/asterix-app/src/test/resources/runtimets/queries/aggregate/local-avg_int16_null/local-avg_int16_null.1.ddl.aql b/asterix-app/src/test/resources/runtimets/queries/aggregate/local-avg_int16_null/local-avg_int16_null.1.ddl.aql
new file mode 100644
index 0000000..6bf1a63
--- /dev/null
+++ b/asterix-app/src/test/resources/runtimets/queries/aggregate/local-avg_int16_null/local-avg_int16_null.1.ddl.aql
@@ -0,0 +1,20 @@
+drop dataverse test if exists;
+
+create dataverse test;
+
+create type NumericType as open {
+ id: int32,
+ int8Field: int8?,
+ int16Field: int16?,
+ int32Field: int32?,
+ int64Field: int64?,
+ floatField: float?,
+ doubleField: double?
+}
+
+write output to nc1:"rttest/aggregate_local-avg_int16_null.adm";
+
+create external dataset Numeric(NumericType)
+using "edu.uci.ics.asterix.external.dataset.adapter.NCFileSystemAdapter"
+(("path"="nc1://data/nontagged/numericData.json"),("format"="adm"));
+
diff --git a/asterix-app/src/test/resources/runtimets/queries/aggregate/local-avg_int16_null/local-avg_int16_null.2.update.aql b/asterix-app/src/test/resources/runtimets/queries/aggregate/local-avg_int16_null/local-avg_int16_null.2.update.aql
new file mode 100644
index 0000000..9d2ef1c
--- /dev/null
+++ b/asterix-app/src/test/resources/runtimets/queries/aggregate/local-avg_int16_null/local-avg_int16_null.2.update.aql
@@ -0,0 +1 @@
+// no insert deletes here
diff --git a/asterix-app/src/test/resources/runtimets/queries/aggregate/local-avg_int16_null/local-avg_int16_null.3.query.aql b/asterix-app/src/test/resources/runtimets/queries/aggregate/local-avg_int16_null/local-avg_int16_null.3.query.aql
new file mode 100644
index 0000000..9e923df
--- /dev/null
+++ b/asterix-app/src/test/resources/runtimets/queries/aggregate/local-avg_int16_null/local-avg_int16_null.3.query.aql
@@ -0,0 +1,6 @@
+use dataverse test;
+
+local-avg(
+ for $x in dataset('Numeric')
+ return $x.int16Field
+)
diff --git a/asterix-app/src/test/resources/runtimets/queries/aggregate/local-avg_int32/local-avg_int32.1.ddl.aql b/asterix-app/src/test/resources/runtimets/queries/aggregate/local-avg_int32/local-avg_int32.1.ddl.aql
new file mode 100644
index 0000000..97b4670
--- /dev/null
+++ b/asterix-app/src/test/resources/runtimets/queries/aggregate/local-avg_int32/local-avg_int32.1.ddl.aql
@@ -0,0 +1,4 @@
+drop dataverse test if exists;
+
+create dataverse test;
+
diff --git a/asterix-app/src/test/resources/runtimets/queries/aggregate/local-avg_int32/local-avg_int32.2.update.aql b/asterix-app/src/test/resources/runtimets/queries/aggregate/local-avg_int32/local-avg_int32.2.update.aql
new file mode 100644
index 0000000..f0c597a
--- /dev/null
+++ b/asterix-app/src/test/resources/runtimets/queries/aggregate/local-avg_int32/local-avg_int32.2.update.aql
@@ -0,0 +1 @@
+// no inserts deletes here
diff --git a/asterix-app/src/test/resources/runtimets/queries/aggregate/local-avg_int32/local-avg_int32.3.query.aql b/asterix-app/src/test/resources/runtimets/queries/aggregate/local-avg_int32/local-avg_int32.3.query.aql
new file mode 100644
index 0000000..56ec2c4
--- /dev/null
+++ b/asterix-app/src/test/resources/runtimets/queries/aggregate/local-avg_int32/local-avg_int32.3.query.aql
@@ -0,0 +1,7 @@
+use dataverse test;
+
+local-avg(
+ for $x in [1, 2, 3]
+ return $x
+)
+
diff --git a/asterix-app/src/test/resources/runtimets/queries/aggregate/local-avg_int32_null/local-avg_int32_null.1.ddl.aql b/asterix-app/src/test/resources/runtimets/queries/aggregate/local-avg_int32_null/local-avg_int32_null.1.ddl.aql
new file mode 100644
index 0000000..7aae44e
--- /dev/null
+++ b/asterix-app/src/test/resources/runtimets/queries/aggregate/local-avg_int32_null/local-avg_int32_null.1.ddl.aql
@@ -0,0 +1,18 @@
+drop dataverse test if exists;
+
+create dataverse test;
+
+create type NumericType as open {
+ id: int32,
+ int8Field: int8?,
+ int16Field: int16?,
+ int32Field: int32?,
+ int64Field: int64?,
+ floatField: float?,
+ doubleField: double?
+}
+
+create external dataset Numeric(NumericType)
+using "edu.uci.ics.asterix.external.dataset.adapter.NCFileSystemAdapter"
+(("path"="nc1://data/nontagged/numericData.json"),("format"="adm"));
+
diff --git a/asterix-app/src/test/resources/runtimets/queries/aggregate/local-avg_int32_null/local-avg_int32_null.2.update.aql b/asterix-app/src/test/resources/runtimets/queries/aggregate/local-avg_int32_null/local-avg_int32_null.2.update.aql
new file mode 100644
index 0000000..f0c597a
--- /dev/null
+++ b/asterix-app/src/test/resources/runtimets/queries/aggregate/local-avg_int32_null/local-avg_int32_null.2.update.aql
@@ -0,0 +1 @@
+// no inserts deletes here
diff --git a/asterix-app/src/test/resources/runtimets/queries/aggregate/local-avg_int32_null/local-avg_int32_null.3.query.aql b/asterix-app/src/test/resources/runtimets/queries/aggregate/local-avg_int32_null/local-avg_int32_null.3.query.aql
new file mode 100644
index 0000000..f6a89c6
--- /dev/null
+++ b/asterix-app/src/test/resources/runtimets/queries/aggregate/local-avg_int32_null/local-avg_int32_null.3.query.aql
@@ -0,0 +1,6 @@
+use dataverse test;
+
+local-avg(
+ for $x in dataset('Numeric')
+ return $x.int32Field
+)
diff --git a/asterix-app/src/test/resources/runtimets/queries/aggregate/local-avg_int64/local-avg_int64.1.ddl.aql b/asterix-app/src/test/resources/runtimets/queries/aggregate/local-avg_int64/local-avg_int64.1.ddl.aql
new file mode 100644
index 0000000..97b4670
--- /dev/null
+++ b/asterix-app/src/test/resources/runtimets/queries/aggregate/local-avg_int64/local-avg_int64.1.ddl.aql
@@ -0,0 +1,4 @@
+drop dataverse test if exists;
+
+create dataverse test;
+
diff --git a/asterix-app/src/test/resources/runtimets/queries/aggregate/local-avg_int64/local-avg_int64.2.update.aql b/asterix-app/src/test/resources/runtimets/queries/aggregate/local-avg_int64/local-avg_int64.2.update.aql
new file mode 100644
index 0000000..2be8eb8
--- /dev/null
+++ b/asterix-app/src/test/resources/runtimets/queries/aggregate/local-avg_int64/local-avg_int64.2.update.aql
@@ -0,0 +1 @@
+// no inserts delete here
diff --git a/asterix-app/src/test/resources/runtimets/queries/aggregate/local-avg_int64/local-avg_int64.3.query.aql b/asterix-app/src/test/resources/runtimets/queries/aggregate/local-avg_int64/local-avg_int64.3.query.aql
new file mode 100644
index 0000000..6501365a
--- /dev/null
+++ b/asterix-app/src/test/resources/runtimets/queries/aggregate/local-avg_int64/local-avg_int64.3.query.aql
@@ -0,0 +1,7 @@
+use dataverse test;
+
+local-avg(
+ for $x in [int64("1"), int64("2"), int64("3")]
+ return $x
+)
+
diff --git a/asterix-app/src/test/resources/runtimets/queries/aggregate/local-avg_int64_null/local-avg_int64_null.1.ddl.aql b/asterix-app/src/test/resources/runtimets/queries/aggregate/local-avg_int64_null/local-avg_int64_null.1.ddl.aql
new file mode 100644
index 0000000..7aae44e
--- /dev/null
+++ b/asterix-app/src/test/resources/runtimets/queries/aggregate/local-avg_int64_null/local-avg_int64_null.1.ddl.aql
@@ -0,0 +1,18 @@
+drop dataverse test if exists;
+
+create dataverse test;
+
+create type NumericType as open {
+ id: int32,
+ int8Field: int8?,
+ int16Field: int16?,
+ int32Field: int32?,
+ int64Field: int64?,
+ floatField: float?,
+ doubleField: double?
+}
+
+create external dataset Numeric(NumericType)
+using "edu.uci.ics.asterix.external.dataset.adapter.NCFileSystemAdapter"
+(("path"="nc1://data/nontagged/numericData.json"),("format"="adm"));
+
diff --git a/asterix-app/src/test/resources/runtimets/queries/aggregate/local-avg_int64_null/local-avg_int64_null.2.update.aql b/asterix-app/src/test/resources/runtimets/queries/aggregate/local-avg_int64_null/local-avg_int64_null.2.update.aql
new file mode 100644
index 0000000..b77b33e
--- /dev/null
+++ b/asterix-app/src/test/resources/runtimets/queries/aggregate/local-avg_int64_null/local-avg_int64_null.2.update.aql
@@ -0,0 +1 @@
+// no insert delete here
diff --git a/asterix-app/src/test/resources/runtimets/queries/aggregate/local-avg_int64_null/local-avg_int64_null.3.query.aql b/asterix-app/src/test/resources/runtimets/queries/aggregate/local-avg_int64_null/local-avg_int64_null.3.query.aql
new file mode 100644
index 0000000..d0248c3
--- /dev/null
+++ b/asterix-app/src/test/resources/runtimets/queries/aggregate/local-avg_int64_null/local-avg_int64_null.3.query.aql
@@ -0,0 +1,6 @@
+use dataverse test;
+
+local-avg(
+ for $x in dataset('Numeric')
+ return $x.int64Field
+)
diff --git a/asterix-app/src/test/resources/runtimets/queries/aggregate/local-avg_int8/local-avg_int8.1.ddl.aql b/asterix-app/src/test/resources/runtimets/queries/aggregate/local-avg_int8/local-avg_int8.1.ddl.aql
new file mode 100644
index 0000000..97b4670
--- /dev/null
+++ b/asterix-app/src/test/resources/runtimets/queries/aggregate/local-avg_int8/local-avg_int8.1.ddl.aql
@@ -0,0 +1,4 @@
+drop dataverse test if exists;
+
+create dataverse test;
+
diff --git a/asterix-app/src/test/resources/runtimets/queries/aggregate/local-avg_int8/local-avg_int8.2.update.aql b/asterix-app/src/test/resources/runtimets/queries/aggregate/local-avg_int8/local-avg_int8.2.update.aql
new file mode 100644
index 0000000..b77b33e
--- /dev/null
+++ b/asterix-app/src/test/resources/runtimets/queries/aggregate/local-avg_int8/local-avg_int8.2.update.aql
@@ -0,0 +1 @@
+// no insert delete here
diff --git a/asterix-app/src/test/resources/runtimets/queries/aggregate/local-avg_int8/local-avg_int8.3.query.aql b/asterix-app/src/test/resources/runtimets/queries/aggregate/local-avg_int8/local-avg_int8.3.query.aql
new file mode 100644
index 0000000..884c61b
--- /dev/null
+++ b/asterix-app/src/test/resources/runtimets/queries/aggregate/local-avg_int8/local-avg_int8.3.query.aql
@@ -0,0 +1,7 @@
+use dataverse test;
+
+local-avg(
+ for $x in [int8("1"),int8("2"), int8("3")]
+ return $x
+)
+
diff --git a/asterix-app/src/test/resources/runtimets/queries/aggregate/local-avg_int8_null/local-avg_int8_null.1.ddl.aql b/asterix-app/src/test/resources/runtimets/queries/aggregate/local-avg_int8_null/local-avg_int8_null.1.ddl.aql
new file mode 100644
index 0000000..7aae44e
--- /dev/null
+++ b/asterix-app/src/test/resources/runtimets/queries/aggregate/local-avg_int8_null/local-avg_int8_null.1.ddl.aql
@@ -0,0 +1,18 @@
+drop dataverse test if exists;
+
+create dataverse test;
+
+create type NumericType as open {
+ id: int32,
+ int8Field: int8?,
+ int16Field: int16?,
+ int32Field: int32?,
+ int64Field: int64?,
+ floatField: float?,
+ doubleField: double?
+}
+
+create external dataset Numeric(NumericType)
+using "edu.uci.ics.asterix.external.dataset.adapter.NCFileSystemAdapter"
+(("path"="nc1://data/nontagged/numericData.json"),("format"="adm"));
+
diff --git a/asterix-app/src/test/resources/runtimets/queries/aggregate/local-avg_int8_null/local-avg_int8_null.2.update.aql b/asterix-app/src/test/resources/runtimets/queries/aggregate/local-avg_int8_null/local-avg_int8_null.2.update.aql
new file mode 100644
index 0000000..b77b33e
--- /dev/null
+++ b/asterix-app/src/test/resources/runtimets/queries/aggregate/local-avg_int8_null/local-avg_int8_null.2.update.aql
@@ -0,0 +1 @@
+// no insert delete here
diff --git a/asterix-app/src/test/resources/runtimets/queries/aggregate/local-avg_int8_null/local-avg_int8_null.3.query.aql b/asterix-app/src/test/resources/runtimets/queries/aggregate/local-avg_int8_null/local-avg_int8_null.3.query.aql
new file mode 100644
index 0000000..82d7ab3
--- /dev/null
+++ b/asterix-app/src/test/resources/runtimets/queries/aggregate/local-avg_int8_null/local-avg_int8_null.3.query.aql
@@ -0,0 +1,6 @@
+use dataverse test;
+
+local-avg(
+ for $x in dataset('Numeric')
+ return $x.int8Field
+)
diff --git a/asterix-app/src/test/resources/runtimets/queries/aggregate/scalar_avg_null/scalar_avg_null.1.ddl.aql b/asterix-app/src/test/resources/runtimets/queries/aggregate/scalar_avg_null/scalar_avg_null.1.ddl.aql
new file mode 100644
index 0000000..5e74858
--- /dev/null
+++ b/asterix-app/src/test/resources/runtimets/queries/aggregate/scalar_avg_null/scalar_avg_null.1.ddl.aql
@@ -0,0 +1,8 @@
+/*
+ * Description : Tests the scalar version of avg with nulls.
+ * Success : Yes
+ */
+
+drop dataverse test if exists;
+create dataverse test;
+
diff --git a/asterix-app/src/test/resources/runtimets/queries/aggregate/scalar_avg_null/scalar_avg_null.2.update.aql b/asterix-app/src/test/resources/runtimets/queries/aggregate/scalar_avg_null/scalar_avg_null.2.update.aql
new file mode 100644
index 0000000..0a4161c
--- /dev/null
+++ b/asterix-app/src/test/resources/runtimets/queries/aggregate/scalar_avg_null/scalar_avg_null.2.update.aql
@@ -0,0 +1,6 @@
+/*
+ * Description : Tests the scalar version of avg with nulls.
+ * Success : Yes
+ */
+
+// no inserts deletes here
diff --git a/asterix-app/src/test/resources/runtimets/queries/aggregate/scalar_avg_null/scalar_avg_null.3.query.aql b/asterix-app/src/test/resources/runtimets/queries/aggregate/scalar_avg_null/scalar_avg_null.3.query.aql
new file mode 100644
index 0000000..2b8b993
--- /dev/null
+++ b/asterix-app/src/test/resources/runtimets/queries/aggregate/scalar_avg_null/scalar_avg_null.3.query.aql
@@ -0,0 +1,15 @@
+/*
+ * Description : Tests the scalar version of avg with nulls.
+ * Success : Yes
+ */
+
+use dataverse test;
+
+let $i8 := avg([int8("1"), int8("2"), int8("3"), null])
+let $i16 := avg([int16("1"), int16("2"), int16("3"), null])
+let $i32 := avg([int32("1"), int32("2"), int32("3"), null])
+let $i64 := avg([int64("1"), int64("2"), int64("3"), null])
+let $f := avg([float("1"), float("2"), float("3"), null])
+let $d := avg([double("1"), double("2"), double("3"), null])
+for $i in [$i8, $i16, $i32, $i64, $f, $d]
+return $i
diff --git a/asterix-app/src/test/resources/runtimets/queries/aggregate/scalar_count_null/scalar_count_null.1.ddl.aql b/asterix-app/src/test/resources/runtimets/queries/aggregate/scalar_count_null/scalar_count_null.1.ddl.aql
new file mode 100644
index 0000000..8341d8f
--- /dev/null
+++ b/asterix-app/src/test/resources/runtimets/queries/aggregate/scalar_count_null/scalar_count_null.1.ddl.aql
@@ -0,0 +1,8 @@
+/*
+ * Description : Tests the scalar version of count with nulls.
+ * Success : Yes
+ */
+
+drop dataverse test if exists;
+create dataverse test;
+
diff --git a/asterix-app/src/test/resources/runtimets/queries/aggregate/scalar_count_null/scalar_count_null.2.update.aql b/asterix-app/src/test/resources/runtimets/queries/aggregate/scalar_count_null/scalar_count_null.2.update.aql
new file mode 100644
index 0000000..221f98a
--- /dev/null
+++ b/asterix-app/src/test/resources/runtimets/queries/aggregate/scalar_count_null/scalar_count_null.2.update.aql
@@ -0,0 +1,6 @@
+/*
+ * Description : Tests the scalar version of count with nulls.
+ * Success : Yes
+ */
+
+// no inserts, deletes here
diff --git a/asterix-app/src/test/resources/runtimets/queries/aggregate/scalar_count_null/scalar_count_null.3.query.aql b/asterix-app/src/test/resources/runtimets/queries/aggregate/scalar_count_null/scalar_count_null.3.query.aql
new file mode 100644
index 0000000..d432cdf
--- /dev/null
+++ b/asterix-app/src/test/resources/runtimets/queries/aggregate/scalar_count_null/scalar_count_null.3.query.aql
@@ -0,0 +1,16 @@
+/*
+ * Description : Tests the scalar version of count with nulls.
+ * Success : Yes
+ */
+
+use dataverse test;
+
+let $i8 := count([int8("1"), int8("2"), int8("3"), null])
+let $i16 := count([int16("1"), int16("2"), int16("3"), null])
+let $i32 := count([int32("1"), int32("2"), int32("3"), null])
+let $i64 := count([int64("1"), int64("2"), int64("3"), null])
+let $f := count([float("1"), float("2"), float("3"), null])
+let $d := count([double("1"), double("2"), double("3"), null])
+let $s := count(["a", "b", "c", null])
+for $i in [$i8, $i16, $i32, $i64, $f, $d, $s]
+return $i
diff --git a/asterix-app/src/test/resources/runtimets/queries/aggregate/scalar_max_null/scalar_max_null.1.ddl.aql b/asterix-app/src/test/resources/runtimets/queries/aggregate/scalar_max_null/scalar_max_null.1.ddl.aql
new file mode 100644
index 0000000..4713540
--- /dev/null
+++ b/asterix-app/src/test/resources/runtimets/queries/aggregate/scalar_max_null/scalar_max_null.1.ddl.aql
@@ -0,0 +1,8 @@
+/*
+ * Description : Tests the scalar version of max with nulls.
+ * Success : Yes
+ */
+
+drop dataverse test if exists;
+create dataverse test;
+
diff --git a/asterix-app/src/test/resources/runtimets/queries/aggregate/scalar_max_null/scalar_max_null.2.update.aql b/asterix-app/src/test/resources/runtimets/queries/aggregate/scalar_max_null/scalar_max_null.2.update.aql
new file mode 100644
index 0000000..ade6f7b
--- /dev/null
+++ b/asterix-app/src/test/resources/runtimets/queries/aggregate/scalar_max_null/scalar_max_null.2.update.aql
@@ -0,0 +1,6 @@
+/*
+ * Description : Tests the scalar version of max with nulls.
+ * Success : Yes
+ */
+
+// no inserts, deletes here
diff --git a/asterix-app/src/test/resources/runtimets/queries/aggregate/scalar_max_null/scalar_max_null.3.query.aql b/asterix-app/src/test/resources/runtimets/queries/aggregate/scalar_max_null/scalar_max_null.3.query.aql
new file mode 100644
index 0000000..b5708c9
--- /dev/null
+++ b/asterix-app/src/test/resources/runtimets/queries/aggregate/scalar_max_null/scalar_max_null.3.query.aql
@@ -0,0 +1,17 @@
+/*
+ * Description : Tests the scalar version of max with nulls.
+ * Success : Yes
+ */
+
+use dataverse test;
+
+let $i8 := max([int8("1"), int8("2"), int8("3"), null])
+let $i16 := max([int16("1"), int16("2"), int16("3"), null])
+let $i32 := max([int32("1"), int32("2"), int32("3"), null])
+let $i64 := max([int64("1"), int64("2"), int64("3"), null])
+let $f := max([float("1"), float("2"), float("3"), null])
+let $d := max([double("1"), double("2"), double("3"), null])
+let $s := max(["foo", "bar", "world", null])
+let $dt := min([datetime("2012-03-01T00:00:00Z"), datetime("2012-01-01T00:00:00Z"), datetime("2012-02-01T00:00:00Z"), null])
+for $i in [$i8, $i16, $i32, $i64, $f, $d, $s, $dt]
+return $i
diff --git a/asterix-app/src/test/resources/runtimets/queries/aggregate/scalar_min_null/scalar_min_null.1.ddl.aql b/asterix-app/src/test/resources/runtimets/queries/aggregate/scalar_min_null/scalar_min_null.1.ddl.aql
new file mode 100644
index 0000000..807484d
--- /dev/null
+++ b/asterix-app/src/test/resources/runtimets/queries/aggregate/scalar_min_null/scalar_min_null.1.ddl.aql
@@ -0,0 +1,8 @@
+/*
+ * Description : Tests the scalar version of min with nulls.
+ * Success : Yes
+ */
+
+drop dataverse test if exists;
+create dataverse test;
+
diff --git a/asterix-app/src/test/resources/runtimets/queries/aggregate/scalar_min_null/scalar_min_null.2.update.aql b/asterix-app/src/test/resources/runtimets/queries/aggregate/scalar_min_null/scalar_min_null.2.update.aql
new file mode 100644
index 0000000..db34098
--- /dev/null
+++ b/asterix-app/src/test/resources/runtimets/queries/aggregate/scalar_min_null/scalar_min_null.2.update.aql
@@ -0,0 +1,6 @@
+/*
+ * Description : Tests the scalar version of min with nulls.
+ * Success : Yes
+ */
+
+// no inserts, deletes here
diff --git a/asterix-app/src/test/resources/runtimets/queries/aggregate/scalar_min_null/scalar_min_null.3.query.aql b/asterix-app/src/test/resources/runtimets/queries/aggregate/scalar_min_null/scalar_min_null.3.query.aql
new file mode 100644
index 0000000..426f2ee
--- /dev/null
+++ b/asterix-app/src/test/resources/runtimets/queries/aggregate/scalar_min_null/scalar_min_null.3.query.aql
@@ -0,0 +1,17 @@
+/*
+ * Description : Tests the scalar version of min with nulls.
+ * Success : Yes
+ */
+
+use dataverse test;
+
+let $i8 := min([int8("1"), int8("2"), int8("3"), null])
+let $i16 := min([int16("1"), int16("2"), int16("3"), null])
+let $i32 := min([int32("1"), int32("2"), int32("3"), null])
+let $i64 := min([int64("1"), int64("2"), int64("3"), null])
+let $f := min([float("1"), float("2"), float("3"), null])
+let $d := min([double("1"), double("2"), double("3"), null])
+let $s := min(["foo", "bar", "world", null])
+let $dt := min([datetime("2012-03-01T00:00:00Z"), datetime("2012-01-01T00:00:00Z"), datetime("2012-02-01T00:00:00Z"), null])
+for $i in [$i8, $i16, $i32, $i64, $f, $d, $s, $dt]
+return $i
diff --git a/asterix-app/src/test/resources/runtimets/queries/aggregate/scalar_sum_null/scalar_sum_null.1.ddl.aql b/asterix-app/src/test/resources/runtimets/queries/aggregate/scalar_sum_null/scalar_sum_null.1.ddl.aql
new file mode 100644
index 0000000..8aad56b
--- /dev/null
+++ b/asterix-app/src/test/resources/runtimets/queries/aggregate/scalar_sum_null/scalar_sum_null.1.ddl.aql
@@ -0,0 +1,7 @@
+/*
+ * Description : Tests the scalar version of sum with nulls.
+ * Success : Yes
+ */
+
+drop dataverse test if exists;
+create dataverse test;
diff --git a/asterix-app/src/test/resources/runtimets/queries/aggregate/scalar_sum_null/scalar_sum_null.2.update.aql b/asterix-app/src/test/resources/runtimets/queries/aggregate/scalar_sum_null/scalar_sum_null.2.update.aql
new file mode 100644
index 0000000..3032051
--- /dev/null
+++ b/asterix-app/src/test/resources/runtimets/queries/aggregate/scalar_sum_null/scalar_sum_null.2.update.aql
@@ -0,0 +1,6 @@
+/*
+ * Description : Tests the scalar version of sum with nulls.
+ * Success : Yes
+ */
+
+// no inserts, deletes here
diff --git a/asterix-app/src/test/resources/runtimets/queries/aggregate/scalar_sum_null/scalar_sum_null.3.query.aql b/asterix-app/src/test/resources/runtimets/queries/aggregate/scalar_sum_null/scalar_sum_null.3.query.aql
new file mode 100644
index 0000000..3cd2c19
--- /dev/null
+++ b/asterix-app/src/test/resources/runtimets/queries/aggregate/scalar_sum_null/scalar_sum_null.3.query.aql
@@ -0,0 +1,15 @@
+/*
+ * Description : Tests the scalar version of sum with nulls.
+ * Success : Yes
+ */
+
+use dataverse test;
+
+let $i8 := sum([int8("1"), int8("2"), int8("3"), null])
+let $i16 := sum([int16("1"), int16("2"), int16("3"), null])
+let $i32 := sum([int32("1"), int32("2"), int32("3"), null])
+let $i64 := sum([int64("1"), int64("2"), int64("3"), null])
+let $f := sum([float("1"), float("2"), float("3"), null])
+let $d := sum([double("1"), double("2"), double("3"), null])
+for $i in [$i8, $i16, $i32, $i64, $f, $d]
+return $i
diff --git a/asterix-app/src/test/resources/runtimets/queries/aggregate/sum_double_null/sum_double_null.1.ddl.aql b/asterix-app/src/test/resources/runtimets/queries/aggregate/sum_double_null/sum_double_null.1.ddl.aql
new file mode 100644
index 0000000..7aae44e
--- /dev/null
+++ b/asterix-app/src/test/resources/runtimets/queries/aggregate/sum_double_null/sum_double_null.1.ddl.aql
@@ -0,0 +1,18 @@
+drop dataverse test if exists;
+
+create dataverse test;
+
+create type NumericType as open {
+ id: int32,
+ int8Field: int8?,
+ int16Field: int16?,
+ int32Field: int32?,
+ int64Field: int64?,
+ floatField: float?,
+ doubleField: double?
+}
+
+create external dataset Numeric(NumericType)
+using "edu.uci.ics.asterix.external.dataset.adapter.NCFileSystemAdapter"
+(("path"="nc1://data/nontagged/numericData.json"),("format"="adm"));
+
diff --git a/asterix-app/src/test/resources/runtimets/queries/aggregate/sum_double_null/sum_double_null.2.update.aql b/asterix-app/src/test/resources/runtimets/queries/aggregate/sum_double_null/sum_double_null.2.update.aql
new file mode 100644
index 0000000..d93253f
--- /dev/null
+++ b/asterix-app/src/test/resources/runtimets/queries/aggregate/sum_double_null/sum_double_null.2.update.aql
@@ -0,0 +1 @@
+// no inserts, deletes here
diff --git a/asterix-app/src/test/resources/runtimets/queries/aggregate/sum_double_null/sum_double_null.3.query.aql b/asterix-app/src/test/resources/runtimets/queries/aggregate/sum_double_null/sum_double_null.3.query.aql
new file mode 100644
index 0000000..843ae1b
--- /dev/null
+++ b/asterix-app/src/test/resources/runtimets/queries/aggregate/sum_double_null/sum_double_null.3.query.aql
@@ -0,0 +1,6 @@
+use dataverse test;
+
+sum(
+ for $x in dataset('Numeric')
+ return $x.doubleField
+)
diff --git a/asterix-app/src/test/resources/runtimets/queries/aggregate/sum_float_null/sum_float_null.1.ddl.aql b/asterix-app/src/test/resources/runtimets/queries/aggregate/sum_float_null/sum_float_null.1.ddl.aql
new file mode 100644
index 0000000..7aae44e
--- /dev/null
+++ b/asterix-app/src/test/resources/runtimets/queries/aggregate/sum_float_null/sum_float_null.1.ddl.aql
@@ -0,0 +1,18 @@
+drop dataverse test if exists;
+
+create dataverse test;
+
+create type NumericType as open {
+ id: int32,
+ int8Field: int8?,
+ int16Field: int16?,
+ int32Field: int32?,
+ int64Field: int64?,
+ floatField: float?,
+ doubleField: double?
+}
+
+create external dataset Numeric(NumericType)
+using "edu.uci.ics.asterix.external.dataset.adapter.NCFileSystemAdapter"
+(("path"="nc1://data/nontagged/numericData.json"),("format"="adm"));
+
diff --git a/asterix-app/src/test/resources/runtimets/queries/aggregate/sum_float_null/sum_float_null.2.update.aql b/asterix-app/src/test/resources/runtimets/queries/aggregate/sum_float_null/sum_float_null.2.update.aql
new file mode 100644
index 0000000..d93253f
--- /dev/null
+++ b/asterix-app/src/test/resources/runtimets/queries/aggregate/sum_float_null/sum_float_null.2.update.aql
@@ -0,0 +1 @@
+// no inserts, deletes here
diff --git a/asterix-app/src/test/resources/runtimets/queries/aggregate/sum_float_null/sum_float_null.3.query.aql b/asterix-app/src/test/resources/runtimets/queries/aggregate/sum_float_null/sum_float_null.3.query.aql
new file mode 100644
index 0000000..4015f0b
--- /dev/null
+++ b/asterix-app/src/test/resources/runtimets/queries/aggregate/sum_float_null/sum_float_null.3.query.aql
@@ -0,0 +1,6 @@
+use dataverse test;
+
+sum(
+ for $x in dataset('Numeric')
+ return $x.floatField
+)
diff --git a/asterix-app/src/test/resources/runtimets/queries/aggregate/sum_int16_null/sum_int16_null.1.ddl.aql b/asterix-app/src/test/resources/runtimets/queries/aggregate/sum_int16_null/sum_int16_null.1.ddl.aql
new file mode 100644
index 0000000..7aae44e
--- /dev/null
+++ b/asterix-app/src/test/resources/runtimets/queries/aggregate/sum_int16_null/sum_int16_null.1.ddl.aql
@@ -0,0 +1,18 @@
+drop dataverse test if exists;
+
+create dataverse test;
+
+create type NumericType as open {
+ id: int32,
+ int8Field: int8?,
+ int16Field: int16?,
+ int32Field: int32?,
+ int64Field: int64?,
+ floatField: float?,
+ doubleField: double?
+}
+
+create external dataset Numeric(NumericType)
+using "edu.uci.ics.asterix.external.dataset.adapter.NCFileSystemAdapter"
+(("path"="nc1://data/nontagged/numericData.json"),("format"="adm"));
+
diff --git a/asterix-app/src/test/resources/runtimets/queries/aggregate/sum_int16_null/sum_int16_null.2.update.aql b/asterix-app/src/test/resources/runtimets/queries/aggregate/sum_int16_null/sum_int16_null.2.update.aql
new file mode 100644
index 0000000..d93253f
--- /dev/null
+++ b/asterix-app/src/test/resources/runtimets/queries/aggregate/sum_int16_null/sum_int16_null.2.update.aql
@@ -0,0 +1 @@
+// no inserts, deletes here
diff --git a/asterix-app/src/test/resources/runtimets/queries/aggregate/sum_int16_null/sum_int16_null.3.query.aql b/asterix-app/src/test/resources/runtimets/queries/aggregate/sum_int16_null/sum_int16_null.3.query.aql
new file mode 100644
index 0000000..7aa5a34
--- /dev/null
+++ b/asterix-app/src/test/resources/runtimets/queries/aggregate/sum_int16_null/sum_int16_null.3.query.aql
@@ -0,0 +1,6 @@
+use dataverse test;
+
+sum(
+ for $x in dataset('Numeric')
+ return $x.int16Field
+)
diff --git a/asterix-app/src/test/resources/runtimets/queries/aggregate/sum_int32_null/sum_int32_null.1.ddl.aql b/asterix-app/src/test/resources/runtimets/queries/aggregate/sum_int32_null/sum_int32_null.1.ddl.aql
new file mode 100644
index 0000000..7aae44e
--- /dev/null
+++ b/asterix-app/src/test/resources/runtimets/queries/aggregate/sum_int32_null/sum_int32_null.1.ddl.aql
@@ -0,0 +1,18 @@
+drop dataverse test if exists;
+
+create dataverse test;
+
+create type NumericType as open {
+ id: int32,
+ int8Field: int8?,
+ int16Field: int16?,
+ int32Field: int32?,
+ int64Field: int64?,
+ floatField: float?,
+ doubleField: double?
+}
+
+create external dataset Numeric(NumericType)
+using "edu.uci.ics.asterix.external.dataset.adapter.NCFileSystemAdapter"
+(("path"="nc1://data/nontagged/numericData.json"),("format"="adm"));
+
diff --git a/asterix-app/src/test/resources/runtimets/queries/aggregate/sum_int32_null/sum_int32_null.2.update.aql b/asterix-app/src/test/resources/runtimets/queries/aggregate/sum_int32_null/sum_int32_null.2.update.aql
new file mode 100644
index 0000000..d93253f
--- /dev/null
+++ b/asterix-app/src/test/resources/runtimets/queries/aggregate/sum_int32_null/sum_int32_null.2.update.aql
@@ -0,0 +1 @@
+// no inserts, deletes here
diff --git a/asterix-app/src/test/resources/runtimets/queries/aggregate/sum_int32_null/sum_int32_null.3.query.aql b/asterix-app/src/test/resources/runtimets/queries/aggregate/sum_int32_null/sum_int32_null.3.query.aql
new file mode 100644
index 0000000..26c390a
--- /dev/null
+++ b/asterix-app/src/test/resources/runtimets/queries/aggregate/sum_int32_null/sum_int32_null.3.query.aql
@@ -0,0 +1,6 @@
+use dataverse test;
+
+sum(
+ for $x in dataset('Numeric')
+ return $x.int32Field
+)
diff --git a/asterix-app/src/test/resources/runtimets/queries/aggregate/sum_int64_null/sum_int64_null.1.ddl.aql b/asterix-app/src/test/resources/runtimets/queries/aggregate/sum_int64_null/sum_int64_null.1.ddl.aql
new file mode 100644
index 0000000..7aae44e
--- /dev/null
+++ b/asterix-app/src/test/resources/runtimets/queries/aggregate/sum_int64_null/sum_int64_null.1.ddl.aql
@@ -0,0 +1,18 @@
+drop dataverse test if exists;
+
+create dataverse test;
+
+create type NumericType as open {
+ id: int32,
+ int8Field: int8?,
+ int16Field: int16?,
+ int32Field: int32?,
+ int64Field: int64?,
+ floatField: float?,
+ doubleField: double?
+}
+
+create external dataset Numeric(NumericType)
+using "edu.uci.ics.asterix.external.dataset.adapter.NCFileSystemAdapter"
+(("path"="nc1://data/nontagged/numericData.json"),("format"="adm"));
+
diff --git a/asterix-app/src/test/resources/runtimets/queries/aggregate/sum_int64_null/sum_int64_null.2.update.aql b/asterix-app/src/test/resources/runtimets/queries/aggregate/sum_int64_null/sum_int64_null.2.update.aql
new file mode 100644
index 0000000..d93253f
--- /dev/null
+++ b/asterix-app/src/test/resources/runtimets/queries/aggregate/sum_int64_null/sum_int64_null.2.update.aql
@@ -0,0 +1 @@
+// no inserts, deletes here
diff --git a/asterix-app/src/test/resources/runtimets/queries/aggregate/sum_int64_null/sum_int64_null.3.query.aql b/asterix-app/src/test/resources/runtimets/queries/aggregate/sum_int64_null/sum_int64_null.3.query.aql
new file mode 100644
index 0000000..8751d93
--- /dev/null
+++ b/asterix-app/src/test/resources/runtimets/queries/aggregate/sum_int64_null/sum_int64_null.3.query.aql
@@ -0,0 +1,6 @@
+use dataverse test;
+
+sum(
+ for $x in dataset('Numeric')
+ return $x.int64Field
+)
diff --git a/asterix-app/src/test/resources/runtimets/queries/aggregate/sum_int8_null/sum_int8_null.1.ddl.aql b/asterix-app/src/test/resources/runtimets/queries/aggregate/sum_int8_null/sum_int8_null.1.ddl.aql
new file mode 100644
index 0000000..7aae44e
--- /dev/null
+++ b/asterix-app/src/test/resources/runtimets/queries/aggregate/sum_int8_null/sum_int8_null.1.ddl.aql
@@ -0,0 +1,18 @@
+drop dataverse test if exists;
+
+create dataverse test;
+
+create type NumericType as open {
+ id: int32,
+ int8Field: int8?,
+ int16Field: int16?,
+ int32Field: int32?,
+ int64Field: int64?,
+ floatField: float?,
+ doubleField: double?
+}
+
+create external dataset Numeric(NumericType)
+using "edu.uci.ics.asterix.external.dataset.adapter.NCFileSystemAdapter"
+(("path"="nc1://data/nontagged/numericData.json"),("format"="adm"));
+
diff --git a/asterix-app/src/test/resources/runtimets/queries/aggregate/sum_int8_null/sum_int8_null.2.update.aql b/asterix-app/src/test/resources/runtimets/queries/aggregate/sum_int8_null/sum_int8_null.2.update.aql
new file mode 100644
index 0000000..1ecf3aa
--- /dev/null
+++ b/asterix-app/src/test/resources/runtimets/queries/aggregate/sum_int8_null/sum_int8_null.2.update.aql
@@ -0,0 +1 @@
+// no inserts, deletes
diff --git a/asterix-app/src/test/resources/runtimets/queries/aggregate/sum_int8_null/sum_int8_null.3.query.aql b/asterix-app/src/test/resources/runtimets/queries/aggregate/sum_int8_null/sum_int8_null.3.query.aql
new file mode 100644
index 0000000..fe8dc24
--- /dev/null
+++ b/asterix-app/src/test/resources/runtimets/queries/aggregate/sum_int8_null/sum_int8_null.3.query.aql
@@ -0,0 +1,6 @@
+use dataverse test;
+
+sum(
+ for $x in dataset('Numeric')
+ return $x.int8Field
+)
diff --git a/asterix-app/src/test/resources/runtimets/queries/aggregate/sum_numeric_null/sum_numeric_null.1.ddl.aql b/asterix-app/src/test/resources/runtimets/queries/aggregate/sum_numeric_null/sum_numeric_null.1.ddl.aql
new file mode 100644
index 0000000..6be5fe1
--- /dev/null
+++ b/asterix-app/src/test/resources/runtimets/queries/aggregate/sum_numeric_null/sum_numeric_null.1.ddl.aql
@@ -0,0 +1,16 @@
+/*
+ * Description : Add numeric values with a null value, sum() aggregate function must return null.
+ * Expected result : Success
+ * Date : July 20th 2012
+ */
+
+drop dataverse test if exists;
+create dataverse test;
+
+create type TestType as open {
+id:int32,
+sal:int32?
+}
+
+create dataset tdst(TestType) primary key id;
+
diff --git a/asterix-app/src/test/resources/runtimets/queries/aggregate/sum_numeric_null/sum_numeric_null.2.update.aql b/asterix-app/src/test/resources/runtimets/queries/aggregate/sum_numeric_null/sum_numeric_null.2.update.aql
new file mode 100644
index 0000000..bc2adb1
--- /dev/null
+++ b/asterix-app/src/test/resources/runtimets/queries/aggregate/sum_numeric_null/sum_numeric_null.2.update.aql
@@ -0,0 +1,15 @@
+/*
+ * Description : Add numeric values with a null value, sum() aggregate function must return null.
+ * Expected result : Success
+ * Date : July 20th 2012
+ */
+
+use dataverse test;
+
+insert into dataset tdst({"id":123,"sal":345});
+insert into dataset tdst({"id":113,"sal":335});
+insert into dataset tdst({"id":163,"sal":315});
+insert into dataset tdst({"id":161,"sal":365});
+insert into dataset tdst({"id":173,"sal":385});
+insert into dataset tdst({"id":183,"sal":null});
+
diff --git a/asterix-app/src/test/resources/runtimets/queries/aggregate/sum_numeric_null/sum_numeric_null.3.query.aql b/asterix-app/src/test/resources/runtimets/queries/aggregate/sum_numeric_null/sum_numeric_null.3.query.aql
new file mode 100644
index 0000000..4b11a2a
--- /dev/null
+++ b/asterix-app/src/test/resources/runtimets/queries/aggregate/sum_numeric_null/sum_numeric_null.3.query.aql
@@ -0,0 +1,13 @@
+/*
+ * Description : Add numeric values with a null value, sum() aggregate function must return null.
+ * Expected result : Success
+ * Date : July 20th 2012
+ */
+
+use dataverse test;
+
+// In AQL
+// sum(numeric + null) => null
+
+sum(for $l in dataset('tdst')
+return $l.sal)
diff --git a/asterix-app/src/test/resources/runtimets/queries/comparison/datetime_tzeq/datetime_tzeq.1.ddl.aql b/asterix-app/src/test/resources/runtimets/queries/comparison/datetime_tzeq/datetime_tzeq.1.ddl.aql
new file mode 100644
index 0000000..97b4670
--- /dev/null
+++ b/asterix-app/src/test/resources/runtimets/queries/comparison/datetime_tzeq/datetime_tzeq.1.ddl.aql
@@ -0,0 +1,4 @@
+drop dataverse test if exists;
+
+create dataverse test;
+
diff --git a/asterix-app/src/test/resources/runtimets/queries/comparison/datetime_tzeq/datetime_tzeq.2.update.aql b/asterix-app/src/test/resources/runtimets/queries/comparison/datetime_tzeq/datetime_tzeq.2.update.aql
new file mode 100644
index 0000000..e69de29
--- /dev/null
+++ b/asterix-app/src/test/resources/runtimets/queries/comparison/datetime_tzeq/datetime_tzeq.2.update.aql
diff --git a/asterix-app/src/test/resources/runtimets/queries/comparison/datetime_tzeq/datetime_tzeq.3.query.aql b/asterix-app/src/test/resources/runtimets/queries/comparison/datetime_tzeq/datetime_tzeq.3.query.aql
new file mode 100644
index 0000000..ff8fec8
--- /dev/null
+++ b/asterix-app/src/test/resources/runtimets/queries/comparison/datetime_tzeq/datetime_tzeq.3.query.aql
@@ -0,0 +1,10 @@
+use dataverse test;
+
+let $dt1 := datetime("2011-12-31T14:00:00-10:00")
+let $dt2 := datetime("2012-01-01T00:00:00Z")
+let $dt3 := datetime("2000-03-01T02:00:00+04:00")
+let $dt4 := datetime("2000-02-29T22:00:00Z")
+let $r1 := $dt1 = $dt2
+let $r2 := $dt3 = $dt4
+
+return { "result1": $r1,"result2": $r2 }
diff --git a/asterix-app/src/test/resources/runtimets/queries/comparison/double_null/double_null.1.ddl.aql b/asterix-app/src/test/resources/runtimets/queries/comparison/double_null/double_null.1.ddl.aql
new file mode 100644
index 0000000..d330bc0
--- /dev/null
+++ b/asterix-app/src/test/resources/runtimets/queries/comparison/double_null/double_null.1.ddl.aql
@@ -0,0 +1,3 @@
+drop dataverse test if exists;
+
+create dataverse test;
diff --git a/asterix-app/src/test/resources/runtimets/queries/comparison/double_null/double_null.2.update.aql b/asterix-app/src/test/resources/runtimets/queries/comparison/double_null/double_null.2.update.aql
new file mode 100644
index 0000000..e69de29
--- /dev/null
+++ b/asterix-app/src/test/resources/runtimets/queries/comparison/double_null/double_null.2.update.aql
diff --git a/asterix-app/src/test/resources/runtimets/queries/comparison/double_null/double_null.3.query.aql b/asterix-app/src/test/resources/runtimets/queries/comparison/double_null/double_null.3.query.aql
new file mode 100644
index 0000000..326adda
--- /dev/null
+++ b/asterix-app/src/test/resources/runtimets/queries/comparison/double_null/double_null.3.query.aql
@@ -0,0 +1,12 @@
+use dataverse test;
+
+let $c1 := double("-6.5d")
+let $c2 := [1]
+let $c3 := $c2[1]
+let $r1 := $c1 > $c3
+let $r2 := $c3 >= $c1
+let $r3 := $c1 < $c3
+let $r4 := $c3 <= $c1
+let $r5 := $c1 = $c3
+let $r6 := $c3 != $c1
+return {"result1": $r1,"result2": $r2,"result3": $r3,"result4": $r4,"result5": $r5, "result6": $r6}
diff --git a/asterix-app/src/test/resources/runtimets/queries/comparison/float_null/float_null.1.ddl.aql b/asterix-app/src/test/resources/runtimets/queries/comparison/float_null/float_null.1.ddl.aql
new file mode 100644
index 0000000..d330bc0
--- /dev/null
+++ b/asterix-app/src/test/resources/runtimets/queries/comparison/float_null/float_null.1.ddl.aql
@@ -0,0 +1,3 @@
+drop dataverse test if exists;
+
+create dataverse test;
diff --git a/asterix-app/src/test/resources/runtimets/queries/comparison/float_null/float_null.2.update.aql b/asterix-app/src/test/resources/runtimets/queries/comparison/float_null/float_null.2.update.aql
new file mode 100644
index 0000000..e69de29
--- /dev/null
+++ b/asterix-app/src/test/resources/runtimets/queries/comparison/float_null/float_null.2.update.aql
diff --git a/asterix-app/src/test/resources/runtimets/queries/comparison/float_null/float_null.3.query.aql b/asterix-app/src/test/resources/runtimets/queries/comparison/float_null/float_null.3.query.aql
new file mode 100644
index 0000000..b9af2e9
--- /dev/null
+++ b/asterix-app/src/test/resources/runtimets/queries/comparison/float_null/float_null.3.query.aql
@@ -0,0 +1,12 @@
+use dataverse test;
+
+let $c1 := float("-6.5d")
+let $c2 := [1]
+let $c3 := $c2[1]
+let $r1 := $c1 > $c3
+let $r2 := $c3 >= $c1
+let $r3 := $c1 < $c3
+let $r4 := $c3 <= $c1
+let $r5 := $c1 = $c3
+let $r6 := $c3 != $c1
+return {"result1": $r1,"result2": $r2,"result3": $r3,"result4": $r4,"result5": $r5, "result6": $r6}
diff --git a/asterix-app/src/test/resources/runtimets/queries/comparison/int16_null/int16_null.1.ddl.aql b/asterix-app/src/test/resources/runtimets/queries/comparison/int16_null/int16_null.1.ddl.aql
new file mode 100644
index 0000000..97b4670
--- /dev/null
+++ b/asterix-app/src/test/resources/runtimets/queries/comparison/int16_null/int16_null.1.ddl.aql
@@ -0,0 +1,4 @@
+drop dataverse test if exists;
+
+create dataverse test;
+
diff --git a/asterix-app/src/test/resources/runtimets/queries/comparison/int16_null/int16_null.2.update.aql b/asterix-app/src/test/resources/runtimets/queries/comparison/int16_null/int16_null.2.update.aql
new file mode 100644
index 0000000..e69de29
--- /dev/null
+++ b/asterix-app/src/test/resources/runtimets/queries/comparison/int16_null/int16_null.2.update.aql
diff --git a/asterix-app/src/test/resources/runtimets/queries/comparison/int16_null/int16_null.3.query.aql b/asterix-app/src/test/resources/runtimets/queries/comparison/int16_null/int16_null.3.query.aql
new file mode 100644
index 0000000..8aca9cd
--- /dev/null
+++ b/asterix-app/src/test/resources/runtimets/queries/comparison/int16_null/int16_null.3.query.aql
@@ -0,0 +1,12 @@
+use dataverse test;
+
+let $c1 := int16("3")
+let $c2 := [1]
+let $c3 := $c2[1]
+let $r1 := $c1 > $c3
+let $r2 := $c3 >= $c1
+let $r3 := $c1 < $c3
+let $r4 := $c3 <= $c1
+let $r5 := $c1 = $c3
+let $r6 := $c3 != $c1
+return {"result1": $r1,"result2": $r2,"result3": $r3,"result4": $r4,"result5": $r5, "result6": $r6}
diff --git a/asterix-app/src/test/resources/runtimets/queries/comparison/int32_null/int32_null.1.ddl..aql b/asterix-app/src/test/resources/runtimets/queries/comparison/int32_null/int32_null.1.ddl..aql
new file mode 100644
index 0000000..d1972e8
--- /dev/null
+++ b/asterix-app/src/test/resources/runtimets/queries/comparison/int32_null/int32_null.1.ddl..aql
@@ -0,0 +1,16 @@
+drop dataverse test if exists;
+create dataverse test;
+use dataverse test;
+
+write output to nc1:"rttest/comparison_int32_null.adm";
+
+let $c1 := int32("3")
+let $c2 := [1]
+let $c3 := $c2[1]
+let $r1 := $c1 > $c3
+let $r2 := $c3 >= $c1
+let $r3 := $c1 < $c3
+let $r4 := $c3 <= $c1
+let $r5 := $c1 = $c3
+let $r6 := $c3 != $c1
+return {"result1": $r1,"result2": $r2,"result3": $r3,"result4": $r4,"result5": $r5, "result6": $r6}
diff --git a/asterix-app/src/test/resources/runtimets/queries/comparison/int32_null/int32_null.2.update.aql b/asterix-app/src/test/resources/runtimets/queries/comparison/int32_null/int32_null.2.update.aql
new file mode 100644
index 0000000..d1972e8
--- /dev/null
+++ b/asterix-app/src/test/resources/runtimets/queries/comparison/int32_null/int32_null.2.update.aql
@@ -0,0 +1,16 @@
+drop dataverse test if exists;
+create dataverse test;
+use dataverse test;
+
+write output to nc1:"rttest/comparison_int32_null.adm";
+
+let $c1 := int32("3")
+let $c2 := [1]
+let $c3 := $c2[1]
+let $r1 := $c1 > $c3
+let $r2 := $c3 >= $c1
+let $r3 := $c1 < $c3
+let $r4 := $c3 <= $c1
+let $r5 := $c1 = $c3
+let $r6 := $c3 != $c1
+return {"result1": $r1,"result2": $r2,"result3": $r3,"result4": $r4,"result5": $r5, "result6": $r6}
diff --git a/asterix-app/src/test/resources/runtimets/queries/comparison/int32_null/int32_null.3.query.aql b/asterix-app/src/test/resources/runtimets/queries/comparison/int32_null/int32_null.3.query.aql
new file mode 100644
index 0000000..d1972e8
--- /dev/null
+++ b/asterix-app/src/test/resources/runtimets/queries/comparison/int32_null/int32_null.3.query.aql
@@ -0,0 +1,16 @@
+drop dataverse test if exists;
+create dataverse test;
+use dataverse test;
+
+write output to nc1:"rttest/comparison_int32_null.adm";
+
+let $c1 := int32("3")
+let $c2 := [1]
+let $c3 := $c2[1]
+let $r1 := $c1 > $c3
+let $r2 := $c3 >= $c1
+let $r3 := $c1 < $c3
+let $r4 := $c3 <= $c1
+let $r5 := $c1 = $c3
+let $r6 := $c3 != $c1
+return {"result1": $r1,"result2": $r2,"result3": $r3,"result4": $r4,"result5": $r5, "result6": $r6}
diff --git a/asterix-app/src/test/resources/runtimets/queries/comparison/int64_null/int64_null.1.ddl.aql b/asterix-app/src/test/resources/runtimets/queries/comparison/int64_null/int64_null.1.ddl.aql
new file mode 100644
index 0000000..16769de
--- /dev/null
+++ b/asterix-app/src/test/resources/runtimets/queries/comparison/int64_null/int64_null.1.ddl.aql
@@ -0,0 +1,2 @@
+drop dataverse test if exists;
+create dataverse test;
diff --git a/asterix-app/src/test/resources/runtimets/queries/comparison/int64_null/int64_null.2.update.aql b/asterix-app/src/test/resources/runtimets/queries/comparison/int64_null/int64_null.2.update.aql
new file mode 100644
index 0000000..e69de29
--- /dev/null
+++ b/asterix-app/src/test/resources/runtimets/queries/comparison/int64_null/int64_null.2.update.aql
diff --git a/asterix-app/src/test/resources/runtimets/queries/comparison/int64_null/int64_null.3.query.aql b/asterix-app/src/test/resources/runtimets/queries/comparison/int64_null/int64_null.3.query.aql
new file mode 100644
index 0000000..7fc4730
--- /dev/null
+++ b/asterix-app/src/test/resources/runtimets/queries/comparison/int64_null/int64_null.3.query.aql
@@ -0,0 +1,12 @@
+use dataverse test;
+
+let $c1 := int64("3")
+let $c2 := [1]
+let $c3 := $c2[1]
+let $r1 := $c1 > $c3
+let $r2 := $c3 >= $c1
+let $r3 := $c1 < $c3
+let $r4 := $c3 <= $c1
+let $r5 := $c1 = $c3
+let $r6 := $c3 != $c1
+return {"result1": $r1,"result2": $r2,"result3": $r3,"result4": $r4,"result5": $r5, "result6": $r6}
diff --git a/asterix-app/src/test/resources/runtimets/queries/comparison/int8_null/int8_null.1.ddl.aql b/asterix-app/src/test/resources/runtimets/queries/comparison/int8_null/int8_null.1.ddl.aql
new file mode 100644
index 0000000..16769de
--- /dev/null
+++ b/asterix-app/src/test/resources/runtimets/queries/comparison/int8_null/int8_null.1.ddl.aql
@@ -0,0 +1,2 @@
+drop dataverse test if exists;
+create dataverse test;
diff --git a/asterix-app/src/test/resources/runtimets/queries/comparison/int8_null/int8_null.2.update.aql b/asterix-app/src/test/resources/runtimets/queries/comparison/int8_null/int8_null.2.update.aql
new file mode 100644
index 0000000..e69de29
--- /dev/null
+++ b/asterix-app/src/test/resources/runtimets/queries/comparison/int8_null/int8_null.2.update.aql
diff --git a/asterix-app/src/test/resources/runtimets/queries/comparison/int8_null/int8_null.3.query.aql b/asterix-app/src/test/resources/runtimets/queries/comparison/int8_null/int8_null.3.query.aql
new file mode 100644
index 0000000..5f96dd8
--- /dev/null
+++ b/asterix-app/src/test/resources/runtimets/queries/comparison/int8_null/int8_null.3.query.aql
@@ -0,0 +1,12 @@
+use dataverse test;
+
+let $c1 := int8("3")
+let $c2 := [1]
+let $c3 := $c2[1]
+let $r1 := $c1 > $c3
+let $r2 := $c3 >= $c1
+let $r3 := $c1 < $c3
+let $r4 := $c3 <= $c1
+let $r5 := $c1 = $c3
+let $r6 := $c3 != $c1
+return {"result1": $r1,"result2": $r2,"result3": $r3,"result4": $r4,"result5": $r5, "result6": $r6}
diff --git a/asterix-app/src/test/resources/runtimets/queries/comparison/lt_01/lt_01.1.ddl.aql b/asterix-app/src/test/resources/runtimets/queries/comparison/lt_01/lt_01.1.ddl.aql
new file mode 100644
index 0000000..16769de
--- /dev/null
+++ b/asterix-app/src/test/resources/runtimets/queries/comparison/lt_01/lt_01.1.ddl.aql
@@ -0,0 +1,2 @@
+drop dataverse test if exists;
+create dataverse test;
diff --git a/asterix-app/src/test/resources/runtimets/queries/comparison/lt_01/lt_01.2.update.aql b/asterix-app/src/test/resources/runtimets/queries/comparison/lt_01/lt_01.2.update.aql
new file mode 100644
index 0000000..e69de29
--- /dev/null
+++ b/asterix-app/src/test/resources/runtimets/queries/comparison/lt_01/lt_01.2.update.aql
diff --git a/asterix-app/src/test/resources/runtimets/queries/comparison/lt_01/lt_01.3.query.aql b/asterix-app/src/test/resources/runtimets/queries/comparison/lt_01/lt_01.3.query.aql
new file mode 100644
index 0000000..cf5c158
--- /dev/null
+++ b/asterix-app/src/test/resources/runtimets/queries/comparison/lt_01/lt_01.3.query.aql
@@ -0,0 +1,5 @@
+use dataverse test;
+
+for $x in [1, 3, 2]
+where $x < 3
+return $x
diff --git a/asterix-app/src/test/resources/runtimets/queries/comparison/lte_01/lte_01.1.ddl.aql b/asterix-app/src/test/resources/runtimets/queries/comparison/lte_01/lte_01.1.ddl.aql
new file mode 100644
index 0000000..16769de
--- /dev/null
+++ b/asterix-app/src/test/resources/runtimets/queries/comparison/lte_01/lte_01.1.ddl.aql
@@ -0,0 +1,2 @@
+drop dataverse test if exists;
+create dataverse test;
diff --git a/asterix-app/src/test/resources/runtimets/queries/comparison/lte_01/lte_01.2.update.aql b/asterix-app/src/test/resources/runtimets/queries/comparison/lte_01/lte_01.2.update.aql
new file mode 100644
index 0000000..e69de29
--- /dev/null
+++ b/asterix-app/src/test/resources/runtimets/queries/comparison/lte_01/lte_01.2.update.aql
diff --git a/asterix-app/src/test/resources/runtimets/queries/comparison/lte_01/lte_01.3.query.aql b/asterix-app/src/test/resources/runtimets/queries/comparison/lte_01/lte_01.3.query.aql
new file mode 100644
index 0000000..45f83c4
--- /dev/null
+++ b/asterix-app/src/test/resources/runtimets/queries/comparison/lte_01/lte_01.3.query.aql
@@ -0,0 +1,5 @@
+use dataverse test;
+
+for $x in [1, 3, 2]
+where $x <= 2
+return $x
diff --git a/asterix-app/src/test/resources/runtimets/queries/comparison/string_null/string_null.1.ddl.aql b/asterix-app/src/test/resources/runtimets/queries/comparison/string_null/string_null.1.ddl.aql
new file mode 100644
index 0000000..16769de
--- /dev/null
+++ b/asterix-app/src/test/resources/runtimets/queries/comparison/string_null/string_null.1.ddl.aql
@@ -0,0 +1,2 @@
+drop dataverse test if exists;
+create dataverse test;
diff --git a/asterix-app/src/test/resources/runtimets/queries/comparison/string_null/string_null.2.update.aql b/asterix-app/src/test/resources/runtimets/queries/comparison/string_null/string_null.2.update.aql
new file mode 100644
index 0000000..e69de29
--- /dev/null
+++ b/asterix-app/src/test/resources/runtimets/queries/comparison/string_null/string_null.2.update.aql
diff --git a/asterix-app/src/test/resources/runtimets/queries/comparison/string_null/string_null.3.query.aql b/asterix-app/src/test/resources/runtimets/queries/comparison/string_null/string_null.3.query.aql
new file mode 100644
index 0000000..f391766
--- /dev/null
+++ b/asterix-app/src/test/resources/runtimets/queries/comparison/string_null/string_null.3.query.aql
@@ -0,0 +1,12 @@
+use dataverse test;
+
+let $c1 := "AA"
+let $c2 := [1]
+let $c3 := $c2[1]
+let $r1 := $c1 > $c3
+let $r2 := $c3 >= $c1
+let $r3 := $c1 < $c3
+let $r4 := $c3 <= $c1
+let $r5 := $c1 = $c3
+let $r6 := $c3 != $c1
+return {"result1": $r1,"result2": $r2,"result3": $r3,"result4": $r4,"result5": $r5, "result6": $r6}
diff --git a/asterix-app/src/test/resources/runtimets/queries/dapd/q1/q1.1.ddl.aql b/asterix-app/src/test/resources/runtimets/queries/dapd/q1/q1.1.ddl.aql
new file mode 100644
index 0000000..574c795
--- /dev/null
+++ b/asterix-app/src/test/resources/runtimets/queries/dapd/q1/q1.1.ddl.aql
@@ -0,0 +1,30 @@
+drop dataverse test if exists;
+
+create dataverse test;
+use dataverse test;
+
+create type AddressType as closed {
+ street: string,
+ city: string,
+ zip: string,
+ latlong: point
+}
+
+create type UserType as open {
+ name: string,
+ email: string,
+ interests: {{string}},
+ address: AddressType,
+ member_of: {{
+ {
+ sig_id: int32,
+ chapter_name: string,
+ member_since: date
+ }
+ }}
+}
+
+create external dataset User(UserType)
+using "edu.uci.ics.asterix.external.dataset.adapter.NCFileSystemAdapter"
+(("path"="nc1://data/events/tiny/user.adm"),("format"="adm"));
+
diff --git a/asterix-app/src/test/resources/runtimets/queries/dapd/q1/q1.2.update.aql b/asterix-app/src/test/resources/runtimets/queries/dapd/q1/q1.2.update.aql
new file mode 100644
index 0000000..1ecf3aa
--- /dev/null
+++ b/asterix-app/src/test/resources/runtimets/queries/dapd/q1/q1.2.update.aql
@@ -0,0 +1 @@
+// no inserts, deletes
diff --git a/asterix-app/src/test/resources/runtimets/queries/dapd/q1/q1.3.query.aql b/asterix-app/src/test/resources/runtimets/queries/dapd/q1/q1.3.query.aql
new file mode 100644
index 0000000..4d5c9c8
--- /dev/null
+++ b/asterix-app/src/test/resources/runtimets/queries/dapd/q1/q1.3.query.aql
@@ -0,0 +1,6 @@
+use dataverse test;
+
+for $user in dataset('User')
+where some $i in $user.interests
+ satisfies $i = "movies"
+return {"name": $user.name}
diff --git a/asterix-app/src/test/resources/runtimets/queries/dapd/q2/q2.1.ddl.aql b/asterix-app/src/test/resources/runtimets/queries/dapd/q2/q2.1.ddl.aql
new file mode 100644
index 0000000..719161c
--- /dev/null
+++ b/asterix-app/src/test/resources/runtimets/queries/dapd/q2/q2.1.ddl.aql
@@ -0,0 +1,37 @@
+drop dataverse test if exists;
+
+create dataverse test;
+use dataverse test;
+
+create type AddressType as closed {
+ street: string,
+ city: string,
+ zip: string,
+ latlong: point
+}
+
+create type EventType as closed {
+ event_id: int32,
+ name: string,
+ location: AddressType ?,
+ organizers: {{
+ {
+ name: string
+ }
+ }},
+ sponsoring_sigs: [
+ {
+ sig_id: int32,
+ chapter_name: string
+ }
+ ],
+ interest_keywords: {{string}},
+ price: double?,
+ start_time: datetime,
+ end_time: datetime
+}
+
+create external dataset Event(EventType)
+using "edu.uci.ics.asterix.external.dataset.adapter.NCFileSystemAdapter"
+(("path"="nc1://data/events/tiny/event.adm"),("format"="adm"));
+
diff --git a/asterix-app/src/test/resources/runtimets/queries/dapd/q2/q2.2.update.aql b/asterix-app/src/test/resources/runtimets/queries/dapd/q2/q2.2.update.aql
new file mode 100644
index 0000000..1ecf3aa
--- /dev/null
+++ b/asterix-app/src/test/resources/runtimets/queries/dapd/q2/q2.2.update.aql
@@ -0,0 +1 @@
+// no inserts, deletes
diff --git a/asterix-app/src/test/resources/runtimets/queries/dapd/q2/q2.3.query.aql b/asterix-app/src/test/resources/runtimets/queries/dapd/q2/q2.3.query.aql
new file mode 100644
index 0000000..c6117dd
--- /dev/null
+++ b/asterix-app/src/test/resources/runtimets/queries/dapd/q2/q2.3.query.aql
@@ -0,0 +1,15 @@
+use dataverse test;
+
+for $event in dataset('Event')
+for $sponsor in $event.sponsoring_sigs
+let $es := { "event": $event, "sponsor": $sponsor }
+group by $sig_id := $sponsor.sig_id with $es
+let $sig_sponsorship_count := count($es)
+let $by_chapter :=
+ for $e in $es
+ group by $chapter_name := $e.sponsor.chapter_name with $e
+ return { "chapter_name": $chapter_name, "escount" : count($e) }
+order by $sig_sponsorship_count desc
+limit 5
+return { "sig_id": $sig_id, "total_count": $sig_sponsorship_count, "chapter_breakdown": $by_chapter }
+
diff --git a/asterix-app/src/test/resources/runtimets/queries/dapd/q3/q3.1.ddl.aql b/asterix-app/src/test/resources/runtimets/queries/dapd/q3/q3.1.ddl.aql
new file mode 100644
index 0000000..9af9a0d
--- /dev/null
+++ b/asterix-app/src/test/resources/runtimets/queries/dapd/q3/q3.1.ddl.aql
@@ -0,0 +1,26 @@
+drop dataverse test if exists;
+create dataverse test;
+use dataverse test;
+
+create type AddressType as closed {
+ street: string,
+ city: string,
+ zip: string,
+ latlong: point2d
+}
+
+create type UserType as open{
+ name: string,
+ interests: {{string}},
+ address: AddressType,
+ member_of: {{
+ {
+ sig_id: int32,
+ chapter_name: string,
+ member_since: date
+ }
+}}
+}
+
+create dataset User(UserType) primary key name;
+
diff --git a/asterix-app/src/test/resources/runtimets/queries/dapd/q3/q3.2.update.aql b/asterix-app/src/test/resources/runtimets/queries/dapd/q3/q3.2.update.aql
new file mode 100644
index 0000000..7bad91f
--- /dev/null
+++ b/asterix-app/src/test/resources/runtimets/queries/dapd/q3/q3.2.update.aql
@@ -0,0 +1,6 @@
+use dataverse test;
+
+load dataset User
+using "edu.uci.ics.asterix.external.dataset.adapter.NCFileSystemAdapter"
+(("path"="nc1://data/events/tiny/user.adm"),("format"="json")) pre-sorted;
+
diff --git a/asterix-app/src/test/resources/runtimets/queries/dapd/q3/q3.3.query.aql b/asterix-app/src/test/resources/runtimets/queries/dapd/q3/q3.3.query.aql
new file mode 100644
index 0000000..d2a7776
--- /dev/null
+++ b/asterix-app/src/test/resources/runtimets/queries/dapd/q3/q3.3.query.aql
@@ -0,0 +1,15 @@
+use dataverse test;
+
+set simthreshold '.5f';
+
+for $user in dataset('User')
+let $similar_users :=
+ for $similar_user in dataset('User')
+ where $user.name != $similar_user.name
+ and $user.interests ~= $similar_user.interests
+ let $sim := similarity-jaccard($user.interests, $similar_user.interests)
+ order by $sim desc
+ limit 10
+ return { "user_name": $similar_user.name }
+order by $user.name
+return { "user_name" : $user.name, "similar_users" : $similar_users }
diff --git a/asterix-app/src/test/resources/runtimets/queries/employee/q_01/q_01.1.ddl.aql b/asterix-app/src/test/resources/runtimets/queries/employee/q_01/q_01.1.ddl.aql
new file mode 100644
index 0000000..c7c784f
--- /dev/null
+++ b/asterix-app/src/test/resources/runtimets/queries/employee/q_01/q_01.1.ddl.aql
@@ -0,0 +1,23 @@
+drop dataverse test if exists;
+
+create dataverse test;
+
+use dataverse test;
+
+create type EmpType as open {
+ id: int32,
+ name: string,
+ address: {
+ number: int32,
+ street: string,
+ city: string
+ },
+ age: int32?,
+ interests: {{string}}?,
+ children: [string]?
+}
+
+create external dataset Emp(EmpType)
+using "edu.uci.ics.asterix.external.dataset.adapter.NCFileSystemAdapter"
+(("path"="nc1://data/nontagged/employee.json"),("format"="adm"));
+
diff --git a/asterix-app/src/test/resources/runtimets/queries/employee/q_01/q_01.2.update.aql b/asterix-app/src/test/resources/runtimets/queries/employee/q_01/q_01.2.update.aql
new file mode 100644
index 0000000..1ecf3aa
--- /dev/null
+++ b/asterix-app/src/test/resources/runtimets/queries/employee/q_01/q_01.2.update.aql
@@ -0,0 +1 @@
+// no inserts, deletes
diff --git a/asterix-app/src/test/resources/runtimets/queries/employee/q_01/q_01.3.query.aql b/asterix-app/src/test/resources/runtimets/queries/employee/q_01/q_01.3.query.aql
new file mode 100644
index 0000000..c640a96
--- /dev/null
+++ b/asterix-app/src/test/resources/runtimets/queries/employee/q_01/q_01.3.query.aql
@@ -0,0 +1,4 @@
+use dataverse test;
+
+for $e in dataset('Emp')
+return $e
diff --git a/asterix-app/src/test/resources/runtimets/queries/employee/q_02/q_02.1.ddl.aql b/asterix-app/src/test/resources/runtimets/queries/employee/q_02/q_02.1.ddl.aql
new file mode 100644
index 0000000..5066a4f
--- /dev/null
+++ b/asterix-app/src/test/resources/runtimets/queries/employee/q_02/q_02.1.ddl.aql
@@ -0,0 +1,22 @@
+drop dataverse test if exists;
+
+create dataverse test;
+
+use dataverse test;
+
+create type EmpType as open {
+ id: int32,
+ name: string,
+ address: {
+ number: int32,
+ street: string,
+ city: string
+ },
+ age: int32?,
+ interests: {{string}}?,
+ children: [string]?
+}
+
+create external dataset Emp(EmpType)
+using "edu.uci.ics.asterix.external.dataset.adapter.NCFileSystemAdapter"
+(("path"="nc1://data/nontagged/employee.json"),("format"="adm"));
diff --git a/asterix-app/src/test/resources/runtimets/queries/employee/q_02/q_02.2.update.aql b/asterix-app/src/test/resources/runtimets/queries/employee/q_02/q_02.2.update.aql
new file mode 100644
index 0000000..1ecf3aa
--- /dev/null
+++ b/asterix-app/src/test/resources/runtimets/queries/employee/q_02/q_02.2.update.aql
@@ -0,0 +1 @@
+// no inserts, deletes
diff --git a/asterix-app/src/test/resources/runtimets/queries/employee/q_02/q_02.3.query.aql b/asterix-app/src/test/resources/runtimets/queries/employee/q_02/q_02.3.query.aql
new file mode 100644
index 0000000..454e236
--- /dev/null
+++ b/asterix-app/src/test/resources/runtimets/queries/employee/q_02/q_02.3.query.aql
@@ -0,0 +1,5 @@
+use dataverse test;
+
+for $e in dataset('Emp')
+let $m := [{"EmpName": $e.name, "parent_interest_1": $e.interests[?], "child1Name": $e.children[?], "child2Name": $e.children[1]}]
+return $m
diff --git a/asterix-app/src/test/resources/runtimets/queries/open-closed/c2c-w-optional/c2c-w-option.1.ddl.aql b/asterix-app/src/test/resources/runtimets/queries/open-closed/c2c-w-optional/c2c-w-option.1.ddl.aql
new file mode 100644
index 0000000..fcc576b
--- /dev/null
+++ b/asterix-app/src/test/resources/runtimets/queries/open-closed/c2c-w-optional/c2c-w-option.1.ddl.aql
@@ -0,0 +1,24 @@
+/*
+ * Testcase Name : c2c-w-optional.aql
+ * Description : Insert data into target datase by doing a select on source dataset.
+ * : Here both source and target datasets are internal datasets
+ * : The schema includes one optional field named optnl_fld.
+ * Success : Yes
+ * Date : 23rd May 2012
+ */
+
+drop dataverse test if exists;
+create dataverse test;
+use dataverse test;
+
+create type TestType as closed {
+id:int32,
+description:string,
+name:string,
+optnl_fld:string?
+}
+
+create dataset T1(TestType) primary key id;
+
+create dataset T2(TestType) primary key id;
+
diff --git a/asterix-app/src/test/resources/runtimets/queries/open-closed/c2c-w-optional/c2c-w-option.2.update.aql b/asterix-app/src/test/resources/runtimets/queries/open-closed/c2c-w-optional/c2c-w-option.2.update.aql
new file mode 100644
index 0000000..89c4d1b
--- /dev/null
+++ b/asterix-app/src/test/resources/runtimets/queries/open-closed/c2c-w-optional/c2c-w-option.2.update.aql
@@ -0,0 +1,21 @@
+/*
+ * Testcase Name : c2c-w-optional.aql
+ * Description : Insert data into target datase by doing a select on source dataset.
+ * : Here both source and target datasets are internal datasets
+ * : The schema includes one optional field named optnl_fld.
+ * Success : Yes
+ * Date : 23rd May 2012
+ */
+
+use dataverse test;
+
+insert into dataset T1({
+"id":1234,
+"description":"donut",
+"name":"Cake",
+"optnl_fld":"optional data goes here"
+}
+);
+
+insert into dataset T2(for $l in dataset("T1") return $l );
+
diff --git a/asterix-app/src/test/resources/runtimets/queries/open-closed/c2c-w-optional/c2c-w-option.3.query.aql b/asterix-app/src/test/resources/runtimets/queries/open-closed/c2c-w-optional/c2c-w-option.3.query.aql
new file mode 100644
index 0000000..8afe5b1
--- /dev/null
+++ b/asterix-app/src/test/resources/runtimets/queries/open-closed/c2c-w-optional/c2c-w-option.3.query.aql
@@ -0,0 +1,14 @@
+/*
+ * Testcase Name : c2c-w-optional.aql
+ * Description : Insert data into target datase by doing a select on source dataset.
+ * : Here both source and target datasets are internal datasets
+ * : The schema includes one optional field named optnl_fld.
+ * Success : Yes
+ * Date : 23rd May 2012
+ */
+
+use dataverse test;
+
+for $d in dataset("T2")
+order by $d.id
+return $d
diff --git a/asterix-app/src/test/resources/runtimets/queries/open-closed/c2c-wo-optional/c2c-wo-optional.1.ddl.aql b/asterix-app/src/test/resources/runtimets/queries/open-closed/c2c-wo-optional/c2c-wo-optional.1.ddl.aql
new file mode 100644
index 0000000..4e4cc66
--- /dev/null
+++ b/asterix-app/src/test/resources/runtimets/queries/open-closed/c2c-wo-optional/c2c-wo-optional.1.ddl.aql
@@ -0,0 +1,24 @@
+/*
+ * Testcase Name : c2c-wo-optional.aql
+ * Description : Insert data into target datase by doing a select on source dataset.
+ * : Here both source and target datasets are internal datasets
+ * : The schema includes one optional field named optnl_fld.
+ * : Note that the optional field in source dataset does not hold any data.
+ * Success : Yes
+ * Date : 23rd May 2012
+ */
+
+drop dataverse test if exists;
+create dataverse test;
+use dataverse test;
+
+create type TestType as closed {
+id:int32,
+description:string,
+name:string,
+optnl_fld:string?
+}
+
+create dataset T1(TestType) primary key id;
+
+create dataset T2(TestType) primary key id;
diff --git a/asterix-app/src/test/resources/runtimets/queries/open-closed/c2c-wo-optional/c2c-wo-optional.2.update.aql b/asterix-app/src/test/resources/runtimets/queries/open-closed/c2c-wo-optional/c2c-wo-optional.2.update.aql
new file mode 100644
index 0000000..b4da91b
--- /dev/null
+++ b/asterix-app/src/test/resources/runtimets/queries/open-closed/c2c-wo-optional/c2c-wo-optional.2.update.aql
@@ -0,0 +1,20 @@
+/*
+ * Testcase Name : c2c-wo-optional.aql
+ * Description : Insert data into target datase by doing a select on source dataset.
+ * : Here both source and target datasets are internal datasets
+ * : The schema includes one optional field named optnl_fld.
+ * : Note that the optional field in source dataset does not hold any data.
+ * Success : Yes
+ * Date : 23rd May 2012
+ */
+
+use dataverse test;
+
+insert into dataset T1({
+"id":1234,
+"description":"donut",
+"name":"Cake"
+}
+);
+
+insert into dataset T2(for $l in dataset("T1") return $l );
diff --git a/asterix-app/src/test/resources/runtimets/queries/open-closed/c2c-wo-optional/c2c-wo-optional.3.query.aql b/asterix-app/src/test/resources/runtimets/queries/open-closed/c2c-wo-optional/c2c-wo-optional.3.query.aql
new file mode 100644
index 0000000..4b5434c
--- /dev/null
+++ b/asterix-app/src/test/resources/runtimets/queries/open-closed/c2c-wo-optional/c2c-wo-optional.3.query.aql
@@ -0,0 +1,15 @@
+/*
+ * Testcase Name : c2c-wo-optional.aql
+ * Description : Insert data into target datase by doing a select on source dataset.
+ * : Here both source and target datasets are internal datasets
+ * : The schema includes one optional field named optnl_fld.
+ * : Note that the optional field in source dataset does not hold any data.
+ * Success : Yes
+ * Date : 23rd May 2012
+ */
+
+use dataverse test;
+
+for $d in dataset("T2")
+order by $d.id
+return $d
diff --git a/asterix-app/src/test/resources/runtimets/queries/open-closed/query-issue134/query-issue134.1.ddl.aql b/asterix-app/src/test/resources/runtimets/queries/open-closed/query-issue134/query-issue134.1.ddl.aql
new file mode 100644
index 0000000..53dc601
--- /dev/null
+++ b/asterix-app/src/test/resources/runtimets/queries/open-closed/query-issue134/query-issue134.1.ddl.aql
@@ -0,0 +1,8 @@
+/*
+ * Description : This test case is to verify the fix for issue134
+ : https://code.google.com/p/asterixdb/issues/detail?id=134
+ * Expected Res : Success
+ * Date : 26th November 2012
+ */
+
+
diff --git a/asterix-app/src/test/resources/runtimets/queries/open-closed/query-issue134/query-issue134.2.update.aql b/asterix-app/src/test/resources/runtimets/queries/open-closed/query-issue134/query-issue134.2.update.aql
new file mode 100644
index 0000000..53dc601
--- /dev/null
+++ b/asterix-app/src/test/resources/runtimets/queries/open-closed/query-issue134/query-issue134.2.update.aql
@@ -0,0 +1,8 @@
+/*
+ * Description : This test case is to verify the fix for issue134
+ : https://code.google.com/p/asterixdb/issues/detail?id=134
+ * Expected Res : Success
+ * Date : 26th November 2012
+ */
+
+
diff --git a/asterix-app/src/test/resources/runtimets/queries/open-closed/query-issue134/query-issue134.3.query.aql b/asterix-app/src/test/resources/runtimets/queries/open-closed/query-issue134/query-issue134.3.query.aql
new file mode 100644
index 0000000..59c94b6
--- /dev/null
+++ b/asterix-app/src/test/resources/runtimets/queries/open-closed/query-issue134/query-issue134.3.query.aql
@@ -0,0 +1,9 @@
+/*
+ * Description : This test case is to verify the fix for issue134
+ : https://code.google.com/p/asterixdb/issues/detail?id=134
+ * Expected Res : Success
+ * Date : 26th November 2012
+ */
+
+let $a:=true
+return {{[1,2,3,4,5],[6,5,3,8,9],[44,22,66,-1,0,99.9]}}
diff --git a/asterix-app/src/test/resources/runtimets/queries/open-closed/query-issue166/query-issue166.1.ddl.aql b/asterix-app/src/test/resources/runtimets/queries/open-closed/query-issue166/query-issue166.1.ddl.aql
new file mode 100644
index 0000000..a17a20d
--- /dev/null
+++ b/asterix-app/src/test/resources/runtimets/queries/open-closed/query-issue166/query-issue166.1.ddl.aql
@@ -0,0 +1,7 @@
+/*
+ * Description : This test case is to verify the fix for issue166
+ : https://code.google.com/p/asterixdb/issues/detail?id=166
+ * Expected Res : Success
+ * Date : 26th November 2012
+ */
+
diff --git a/asterix-app/src/test/resources/runtimets/queries/open-closed/query-issue166/query-issue166.2.update.aql b/asterix-app/src/test/resources/runtimets/queries/open-closed/query-issue166/query-issue166.2.update.aql
new file mode 100644
index 0000000..a17a20d
--- /dev/null
+++ b/asterix-app/src/test/resources/runtimets/queries/open-closed/query-issue166/query-issue166.2.update.aql
@@ -0,0 +1,7 @@
+/*
+ * Description : This test case is to verify the fix for issue166
+ : https://code.google.com/p/asterixdb/issues/detail?id=166
+ * Expected Res : Success
+ * Date : 26th November 2012
+ */
+
diff --git a/asterix-app/src/test/resources/runtimets/queries/open-closed/query-issue166/query-issue166.3.query.aql b/asterix-app/src/test/resources/runtimets/queries/open-closed/query-issue166/query-issue166.3.query.aql
new file mode 100644
index 0000000..b907bb2
--- /dev/null
+++ b/asterix-app/src/test/resources/runtimets/queries/open-closed/query-issue166/query-issue166.3.query.aql
@@ -0,0 +1,9 @@
+/*
+ * Description : This test case is to verify the fix for issue166
+ : https://code.google.com/p/asterixdb/issues/detail?id=166
+ * Expected Res : Success
+ * Date : 26th November 2012
+ */
+
+let $a := [[1,2,3],[4,5,6,7]]
+return $a[1]
diff --git a/asterix-app/src/test/resources/runtimets/queries/open-closed/query-issue208/query-issue208.1.ddl.aql b/asterix-app/src/test/resources/runtimets/queries/open-closed/query-issue208/query-issue208.1.ddl.aql
new file mode 100644
index 0000000..8e33f17
--- /dev/null
+++ b/asterix-app/src/test/resources/runtimets/queries/open-closed/query-issue208/query-issue208.1.ddl.aql
@@ -0,0 +1,30 @@
+/*
+ * Description : This test case is to verify the fix for issue208
+ : https://code.google.com/p/asterixdb/issues/detail?id=208
+ * Expected Res : Success
+ * Date : 26th November 2012
+ */
+
+drop dataverse OpenSocialNetworkData if exists;
+create dataverse OpenSocialNetworkData;
+
+use dataverse OpenSocialNetworkData;
+
+create type TwitterUserType as open {
+screen-name: string,
+lang: string,
+friends_count: int32,
+statuses_count: int32,
+name: string,
+followers_count: int32
+}
+
+create type TweetMessageType as open {
+tweetid: string,
+tweetid-copy: string,
+send-time-copy: datetime
+}
+
+create dataset TweetMessages(TweetMessageType)
+primary key tweetid;
+
diff --git a/asterix-app/src/test/resources/runtimets/queries/open-closed/query-issue208/query-issue208.2.update.aql b/asterix-app/src/test/resources/runtimets/queries/open-closed/query-issue208/query-issue208.2.update.aql
new file mode 100644
index 0000000..404fb35
--- /dev/null
+++ b/asterix-app/src/test/resources/runtimets/queries/open-closed/query-issue208/query-issue208.2.update.aql
@@ -0,0 +1,13 @@
+/*
+ * Description : This test case is to verify the fix for issue208
+ : https://code.google.com/p/asterixdb/issues/detail?id=208
+ * Expected Res : Success
+ * Date : 26th November 2012
+ */
+
+use dataverse OpenSocialNetworkData;
+
+load dataset TweetMessages
+using "edu.uci.ics.asterix.external.dataset.adapter.NCFileSystemAdapter"
+(("path"="nc1://data/twitter/tw_messages.adm"),("format"="adm"));
+
diff --git a/asterix-app/src/test/resources/runtimets/queries/open-closed/query-issue208/query-issue208.3.query.aql b/asterix-app/src/test/resources/runtimets/queries/open-closed/query-issue208/query-issue208.3.query.aql
new file mode 100644
index 0000000..e0a0d2b
--- /dev/null
+++ b/asterix-app/src/test/resources/runtimets/queries/open-closed/query-issue208/query-issue208.3.query.aql
@@ -0,0 +1,19 @@
+/*
+ * Description : This test case is to verify the fix for issue208
+ : https://code.google.com/p/asterixdb/issues/detail?id=208
+ * Expected Res : Success
+ * Date : 26th November 2012
+ */
+
+use dataverse OpenSocialNetworkData;
+
+for $t in dataset('TweetMessages')
+where $t.send-time >= datetime('2005-04-13T17:17:22') and
+$t.send-time <= datetime('2011-04-13T17:18:22')
+group by $uid := $t.user.screen-name with $t
+order by $uid
+return {
+ "user": $uid,
+ "count": count($t)
+}
+
diff --git a/asterix-app/src/test/resources/runtimets/queries/open-closed/query-issue236/query-issue236.1.ddl.aql b/asterix-app/src/test/resources/runtimets/queries/open-closed/query-issue236/query-issue236.1.ddl.aql
new file mode 100644
index 0000000..39a1510
--- /dev/null
+++ b/asterix-app/src/test/resources/runtimets/queries/open-closed/query-issue236/query-issue236.1.ddl.aql
@@ -0,0 +1,35 @@
+/*
+ * Description : This test case is to verify the fix for issue236
+ : https://code.google.com/p/asterixdb/issues/detail?id=236
+ * Expected Res : Success
+ * Date : 20 Dec. 2012
+ */
+
+drop dataverse SocialNetworkData if exists;
+
+create dataverse SocialNetworkData;
+use dataverse SocialNetworkData;
+
+create type TwitterUserType as open {
+screen-name: string,
+lang: string,
+friends_count: int32,
+statuses_count: int32,
+name: string,
+followers_count: int32
+}
+
+create type TweetMessageType as closed {
+tweetid: string,
+tweetid-copy: string,
+user: TwitterUserType,
+sender-location: point?,
+send-time: datetime,
+send-time-copy: datetime,
+referred-topics: {{ string }},
+message-text: string
+}
+
+create dataset TweetMessages(TweetMessageType)
+primary key tweetid;
+
diff --git a/asterix-app/src/test/resources/runtimets/queries/open-closed/query-issue236/query-issue236.2.update.aql b/asterix-app/src/test/resources/runtimets/queries/open-closed/query-issue236/query-issue236.2.update.aql
new file mode 100644
index 0000000..fcb04b4
--- /dev/null
+++ b/asterix-app/src/test/resources/runtimets/queries/open-closed/query-issue236/query-issue236.2.update.aql
@@ -0,0 +1,23 @@
+/*
+ * Description : This test case is to verify the fix for issue236
+ : https://code.google.com/p/asterixdb/issues/detail?id=236
+ * Expected Res : Success
+ * Date : 20 Dec. 2012
+ */
+
+
+use dataverse SocialNetworkData;
+
+insert into dataset TweetMessages(
+{
+"tweetid": "1111387810",
+"tweetid-copy": "1111387810",
+"user": { "screen-name": "TonyNapier#786", "lang": "en", "friends_count": 4241366,
+"statuses_count": 97, "name": "Tony Napier", "followers_count": 5984113 },
+"sender-location": point("29.24,78.35"),
+"send-time": datetime("2011-11-24T14:24:51.000Z"),
+"send-time-copy": datetime("2011-11-24T14:24:51.000Z"),
+"referred-topics": {{ "sprint", "wireless" }},
+"message-text": " love sprint its wireless is mind-blowing:)"
+});
+
diff --git a/asterix-app/src/test/resources/runtimets/queries/open-closed/query-issue236/query-issue236.3.query.aql b/asterix-app/src/test/resources/runtimets/queries/open-closed/query-issue236/query-issue236.3.query.aql
new file mode 100644
index 0000000..ffa269b
--- /dev/null
+++ b/asterix-app/src/test/resources/runtimets/queries/open-closed/query-issue236/query-issue236.3.query.aql
@@ -0,0 +1,11 @@
+/*
+ * Description : This test case is to verify the fix for issue236
+ : https://code.google.com/p/asterixdb/issues/detail?id=236
+ * Expected Res : Success
+ * Date : 20 Dec. 2012
+ */
+
+use dataverse SocialNetworkData;
+
+for $r in dataset('TweetMessages')
+return $r
diff --git a/asterix-app/src/test/resources/runtimets/queries/open-closed/query-issue29/query-issue29.1.ddl.aql b/asterix-app/src/test/resources/runtimets/queries/open-closed/query-issue29/query-issue29.1.ddl.aql
new file mode 100644
index 0000000..4f27231
--- /dev/null
+++ b/asterix-app/src/test/resources/runtimets/queries/open-closed/query-issue29/query-issue29.1.ddl.aql
@@ -0,0 +1,7 @@
+/*
+ * Description : This test case is to verify the fix for issue29
+ : https://code.google.com/p/asterixdb/issues/detail?id=29
+ * Expected Res : Success
+ * Date : 26th November 2012
+ */
+
diff --git a/asterix-app/src/test/resources/runtimets/queries/open-closed/query-issue29/query-issue29.2.update.aql b/asterix-app/src/test/resources/runtimets/queries/open-closed/query-issue29/query-issue29.2.update.aql
new file mode 100644
index 0000000..4f27231
--- /dev/null
+++ b/asterix-app/src/test/resources/runtimets/queries/open-closed/query-issue29/query-issue29.2.update.aql
@@ -0,0 +1,7 @@
+/*
+ * Description : This test case is to verify the fix for issue29
+ : https://code.google.com/p/asterixdb/issues/detail?id=29
+ * Expected Res : Success
+ * Date : 26th November 2012
+ */
+
diff --git a/asterix-app/src/test/resources/runtimets/queries/open-closed/query-issue29/query-issue29.3.query.aql b/asterix-app/src/test/resources/runtimets/queries/open-closed/query-issue29/query-issue29.3.query.aql
new file mode 100644
index 0000000..5951a74
--- /dev/null
+++ b/asterix-app/src/test/resources/runtimets/queries/open-closed/query-issue29/query-issue29.3.query.aql
@@ -0,0 +1,68 @@
+/*
+ * Description : This test case is to verify the fix for issue29
+ : https://code.google.com/p/asterixdb/issues/detail?id=29
+ * Expected Res : Success
+ * Date : 26th November 2012
+ */
+
+let $tweets :=
+{{
+ {
+ "tweetid": "1023",
+ "user": {
+ "screen-name": "dflynn24",
+ "lang": "en",
+ "friends_count": 46,
+ "statuses_count": 987,
+ "name": "danielle flynn",
+ "followers_count": 47
+ },
+ "sender-location": "40.904177,-72.958996",
+ "send-time": "2010-02-21T11:56:02-05:00",
+ "referred-topics": {{ "verizon" }},
+ "message-text": "i need a #verizon phone like nowwwww! :("
+ },
+ {
+ "tweetid": "1024",
+ "user": {
+ "screen-name": "miriamorous",
+ "lang": "en",
+ "friends_count": 69,
+ "statuses_count": 1068,
+ "name": "Miriam Songco",
+ "followers_count": 78
+ },
+ "send-time": "2010-02-21T11:11:43-08:00",
+ "referred-topics": {{ "commercials", "verizon", "att" }},
+ "message-text": "#verizon & #att #commercials, so competitive"
+ },
+ {
+ "tweetid": "1025",
+ "user": {
+ "screen-name": "dj33",
+ "lang": "en",
+ "friends_count": 96,
+ "statuses_count": 1696,
+ "name": "Don Jango",
+ "followers_count": 22
+ },
+ "send-time": "2010-02-21T12:38:44-05:00",
+ "referred-topics": {{ "charlotte" }},
+ "message-text": "Chillin at dca waiting for 900am flight to #charlotte and from there to providenciales"
+ },
+ {
+ "tweetid": "1026",
+ "user": {
+ "screen-name": "reallyleila",
+ "lang": "en",
+ "friends_count": 106,
+ "statuses_count": 107,
+ "name": "Leila Samii",
+ "followers_count": 52
+ },
+ "send-time": "2010-02-21T21:31:57-06:00",
+ "referred-topics": {{ "verizon", "at&t", "iphone" }},
+ "message-text": "I think a switch from #verizon to #at&t may be in my near future... my smartphone is like a land line compared to the #iphone!"
+ }
+}}
+return $tweets
diff --git a/asterix-app/src/test/resources/runtimets/queries/open-closed/query-issue55-1/query-issue55-1.1.ddl.aql b/asterix-app/src/test/resources/runtimets/queries/open-closed/query-issue55-1/query-issue55-1.1.ddl.aql
new file mode 100644
index 0000000..22f04ff
--- /dev/null
+++ b/asterix-app/src/test/resources/runtimets/queries/open-closed/query-issue55-1/query-issue55-1.1.ddl.aql
@@ -0,0 +1,7 @@
+/*
+ * Description : This test case is to verify the fix for issue55 query 1
+ : https://code.google.com/p/asterixdb/issues/detail?id=55
+ * Expected Res : Success
+ * Date : 26th November 2012
+ */
+
diff --git a/asterix-app/src/test/resources/runtimets/queries/open-closed/query-issue55-1/query-issue55-1.2.update.aql b/asterix-app/src/test/resources/runtimets/queries/open-closed/query-issue55-1/query-issue55-1.2.update.aql
new file mode 100644
index 0000000..22f04ff
--- /dev/null
+++ b/asterix-app/src/test/resources/runtimets/queries/open-closed/query-issue55-1/query-issue55-1.2.update.aql
@@ -0,0 +1,7 @@
+/*
+ * Description : This test case is to verify the fix for issue55 query 1
+ : https://code.google.com/p/asterixdb/issues/detail?id=55
+ * Expected Res : Success
+ * Date : 26th November 2012
+ */
+
diff --git a/asterix-app/src/test/resources/runtimets/queries/open-closed/query-issue55-1/query-issue55-1.3.query.aql b/asterix-app/src/test/resources/runtimets/queries/open-closed/query-issue55-1/query-issue55-1.3.query.aql
new file mode 100644
index 0000000..6053fff
--- /dev/null
+++ b/asterix-app/src/test/resources/runtimets/queries/open-closed/query-issue55-1/query-issue55-1.3.query.aql
@@ -0,0 +1,11 @@
+/*
+ * Description : This test case is to verify the fix for issue55 query 1
+ : https://code.google.com/p/asterixdb/issues/detail?id=55
+ * Expected Res : Success
+ * Date : 26th November 2012
+ */
+
+let $l := [1.1f, 1.0f, 1.2f, 0.9, 1.3, 1, 2]
+for $i in $l
+for $j in $l
+return [$i, $j, "=", $i = $j, "<", $i < $j, "<=", $i <= $j, ">", $i > $j, ">=", $i >= $j]
diff --git a/asterix-app/src/test/resources/runtimets/queries/open-closed/query-issue55/query-issue55.1.ddl.aql b/asterix-app/src/test/resources/runtimets/queries/open-closed/query-issue55/query-issue55.1.ddl.aql
new file mode 100644
index 0000000..489f515
--- /dev/null
+++ b/asterix-app/src/test/resources/runtimets/queries/open-closed/query-issue55/query-issue55.1.ddl.aql
@@ -0,0 +1,8 @@
+/*
+ * Description : This test case is to verify the fix for issue55 query 2
+ : https://code.google.com/p/asterixdb/issues/detail?id=55
+ * Expected Res : Success
+ * Date : 26th November 2012
+ */
+
+
diff --git a/asterix-app/src/test/resources/runtimets/queries/open-closed/query-issue55/query-issue55.2.update.aql b/asterix-app/src/test/resources/runtimets/queries/open-closed/query-issue55/query-issue55.2.update.aql
new file mode 100644
index 0000000..489f515
--- /dev/null
+++ b/asterix-app/src/test/resources/runtimets/queries/open-closed/query-issue55/query-issue55.2.update.aql
@@ -0,0 +1,8 @@
+/*
+ * Description : This test case is to verify the fix for issue55 query 2
+ : https://code.google.com/p/asterixdb/issues/detail?id=55
+ * Expected Res : Success
+ * Date : 26th November 2012
+ */
+
+
diff --git a/asterix-app/src/test/resources/runtimets/queries/open-closed/query-issue55/query-issue55.3.query.aql b/asterix-app/src/test/resources/runtimets/queries/open-closed/query-issue55/query-issue55.3.query.aql
new file mode 100644
index 0000000..174d71c
--- /dev/null
+++ b/asterix-app/src/test/resources/runtimets/queries/open-closed/query-issue55/query-issue55.3.query.aql
@@ -0,0 +1,9 @@
+/*
+ * Description : This test case is to verify the fix for issue55 query 2
+ : https://code.google.com/p/asterixdb/issues/detail?id=55
+ * Expected Res : Success
+ * Date : 26th November 2012
+ */
+
+for $x in [[1,3],[4,5,2],[-1,-3,0],["a"]]
+return $x
diff --git a/asterix-app/src/test/resources/runtimets/queries/open-closed/query-proposal/query-proposal.1.ddl.aql b/asterix-app/src/test/resources/runtimets/queries/open-closed/query-proposal/query-proposal.1.ddl.aql
new file mode 100644
index 0000000..81160d1
--- /dev/null
+++ b/asterix-app/src/test/resources/runtimets/queries/open-closed/query-proposal/query-proposal.1.ddl.aql
@@ -0,0 +1,30 @@
+/*
+ * Description : Insert open data into internal dataset and query the open data
+ * Expected Result : Success
+ * Date : 23rd October 2012
+ * Notes : This test was written to cover the scenario which is used in the proposal.
+ */
+
+drop dataverse test if exists;
+create dataverse test;
+
+use dataverse test;
+
+create type TweetMessageType as open {
+tweetid : string,
+user : {
+ screen-name: string,
+ lang: string,
+ friends_count: int32,
+ statuses_count: int32,
+ name: string,
+ followers_count: int32
+}, sender-location: point?,
+ send-time: datetime,
+ referred-topics: {{ string }},
+ message-text: string
+};
+
+create dataset TweetMessages(TweetMessageType)
+primary key tweetid;
+
diff --git a/asterix-app/src/test/resources/runtimets/queries/open-closed/query-proposal/query-proposal.2.update.aql b/asterix-app/src/test/resources/runtimets/queries/open-closed/query-proposal/query-proposal.2.update.aql
new file mode 100644
index 0000000..fc08626
--- /dev/null
+++ b/asterix-app/src/test/resources/runtimets/queries/open-closed/query-proposal/query-proposal.2.update.aql
@@ -0,0 +1,75 @@
+/*
+ * Description : Insert open data into internal dataset and query the open data
+ * Expected Result : Success
+ * Date : 23rd October 2012
+ * Notes : This test was written to cover the scenario which is used in the proposal.
+ */
+
+
+use dataverse test;
+
+insert into dataset TweetMessages(
+ {
+ "tweetid": "1023",
+ "user": {
+ "screen-name": "dflynn24",
+ "lang": "en",
+ "friends_count": 46,
+ "statuses_count": 987,
+ "name": "danielle flynn",
+ "followers_count": 47
+ },
+ "sender-location": create-point(40.904177,-72.958996),
+ "send-time": datetime("2010-02-21T11:56:02-05:00"),
+ "referred-topics": {{ "verizon" }},
+ "message-text": "i need a #verizon phone like nowwwww! : ("
+ });
+
+insert into dataset TweetMessages(
+ {
+ "tweetid": "1024",
+ "user": {
+ "screen-name": "miriamorous",
+ "lang": "en",
+ "friends_count": 69,
+ "statuses_count": 1068,
+ "name": "Miriam Songco",
+ "followers_count": 78
+ },
+ "send-time": datetime("2010-02-21T11:11:43-08:00"),
+ "referred-topics": {{ "commercials", "verizon", "att" }},
+ "message-text": "#verizon & #att #commercials, so competitive"
+ });
+
+insert into dataset TweetMessages(
+ {
+ "tweetid": "1025",
+ "user": {
+ "screen-name": "dj33",
+ "lang": "en",
+ "friends_count": 96,
+ "send-time": "2010-02-21T11:56:02-05:00",
+ "statuses_count": 1696,
+ "name": "Don Jango",
+ "followers_count": 22
+ },
+ "send-time": datetime("2010-02-21T12:38:44-05:00"),
+ "referred-topics": {{ "charlotte" }},
+ "message-text": "Chillin at dca waiting for 900am flight to #charlotte and from there to providenciales"
+ });
+
+insert into dataset TweetMessages(
+ { "tweetid": "1026",
+ "user": {
+ "screen-name": "reallyleila",
+ "lang": "en",
+ "friends_count": 106,
+ "statuses_count": 107,
+ "name": "Leila Samii",
+ "followers_count": 52
+ },
+ "send-time": datetime("2010-02-21T21:31:57-06:00"),
+ "referred-topics": {{ "verizon", "at&t", "iphone" }},
+ "message-text": "I think a switch from #verizon to #at&t may be in my near future... my smartphone is like a land line compared to the #iphone!"
+});
+
diff --git a/asterix-app/src/test/resources/runtimets/queries/open-closed/query-proposal/query-proposal.3.query.aql b/asterix-app/src/test/resources/runtimets/queries/open-closed/query-proposal/query-proposal.3.query.aql
new file mode 100644
index 0000000..f91bb83
--- /dev/null
+++ b/asterix-app/src/test/resources/runtimets/queries/open-closed/query-proposal/query-proposal.3.query.aql
@@ -0,0 +1,19 @@
+/*
+ * Description : Insert open data into internal dataset and query the open data
+ * Expected Result : Success
+ * Date : 23rd October 2012
+ * Notes : This test was written to cover the scenario which is used in the proposal.
+ */
+
+use dataverse test;
+
+for $tp1 in (
+ for $tweet in dataset('TweetMessages')
+ where some $topic in $tweet.referred-topics satisfies contains($topic, 'verizon')
+ for $tp in $tweet.referred-topics
+ return
+ { "topic": $tp }
+)
+group by $tp2 := $tp1.topic with $tp1
+order by $tp2
+return { "topic": $tp2, "count": count($tp1) }
diff --git a/asterix-app/src/test/resources/runtimets/queries/open-closed/query-proposal02/query-proposal02.1.ddl.aql b/asterix-app/src/test/resources/runtimets/queries/open-closed/query-proposal02/query-proposal02.1.ddl.aql
new file mode 100644
index 0000000..1dcceb8
--- /dev/null
+++ b/asterix-app/src/test/resources/runtimets/queries/open-closed/query-proposal02/query-proposal02.1.ddl.aql
@@ -0,0 +1,30 @@
+/*
+ * Description : Insert open data into internal dataset and query the open data
+ * Expected Result : Success
+ * Date : 23rd October 2012
+ * Notes : This test was written to cover the scenario which is used in the proposal.
+ * : this is another variant of the test in query-proposal.aql
+ */
+
+drop dataverse test if exists;
+create dataverse test;
+
+use dataverse test;
+
+create type TweetMessageType as open {
+tweetid : string,
+user : {
+ screen-name: string,
+ lang: string,
+ friends_count: int32,
+ statuses_count: int32,
+ name: string,
+ followers_count: int32
+}, sender-location: point?,
+ send-time: datetime,
+ referred-topics: {{ string }},
+ message-text: string
+};
+
+create dataset TweetMessages(TweetMessageType)
+primary key tweetid;
diff --git a/asterix-app/src/test/resources/runtimets/queries/open-closed/query-proposal02/query-proposal02.2.update.aql b/asterix-app/src/test/resources/runtimets/queries/open-closed/query-proposal02/query-proposal02.2.update.aql
new file mode 100644
index 0000000..47c40d2
--- /dev/null
+++ b/asterix-app/src/test/resources/runtimets/queries/open-closed/query-proposal02/query-proposal02.2.update.aql
@@ -0,0 +1,75 @@
+/*
+ * Description : Insert open data into internal dataset and query the open data
+ * Expected Result : Success
+ * Date : 23rd October 2012
+ * Notes : This test was written to cover the scenario which is used in the proposal.
+ * : this is another variant of the test in query-proposal.aql
+ */
+
+use dataverse test;
+
+insert into dataset TweetMessages(
+ {
+ "tweetid": "1023",
+ "user": {
+ "screen-name": "dflynn24",
+ "lang": "en",
+ "friends_count": 46,
+ "statuses_count": 987,
+ "name": "danielle flynn",
+ "followers_count": 47
+ },
+ "sender-location": create-point(40.904177,-72.958996),
+ "send-time": datetime("2010-02-21T11:56:02-05:00"),
+ "referred-topics": {{ "verizon" }},
+ "message-text": "i need a #verizon phone like nowwwww! : ("
+ });
+
+insert into dataset TweetMessages(
+ {
+ "tweetid": "1024",
+ "user": {
+ "screen-name": "miriamorous",
+ "lang": "en",
+ "friends_count": 69,
+ "statuses_count": 1068,
+ "name": "Miriam Songco",
+ "followers_count": 78
+ },
+ "send-time": datetime("2010-02-21T11:11:43-08:00"),
+ "referred-topics": {{ "commercials", "verizon", "att" }},
+ "message-text": "#verizon & #att #commercials, so competitive"
+ });
+
+insert into dataset TweetMessages(
+ {
+ "tweetid": "1025",
+ "user": {
+ "screen-name": "dj33",
+ "lang": "en",
+ "friends_count": 96,
+ "send-time": "2010-02-21T11:56:02-05:00",
+ "statuses_count": 1696,
+ "name": "Don Jango",
+ "followers_count": 22
+ },
+ "send-time": datetime("2010-02-21T12:38:44-05:00"),
+ "referred-topics": {{ "charlotte" }},
+ "message-text": "Chillin at dca waiting for 900am flight to #charlotte and from there to providenciales"
+ });
+
+insert into dataset TweetMessages(
+ { "tweetid": "1026",
+ "user": {
+ "screen-name": "reallyleila",
+ "lang": "en",
+ "friends_count": 106,
+ "statuses_count": 107,
+ "name": "Leila Samii",
+ "followers_count": 52
+ },
+ "send-time": datetime("2010-02-21T21:31:57-06:00"),
+ "referred-topics": {{ "verizon", "at&t", "iphone" }},
+ "message-text": "I think a switch from #verizon to #at&t may be in my near future... my smartphone is like a land line compared to the #iphone!"
+});
+
diff --git a/asterix-app/src/test/resources/runtimets/queries/open-closed/query-proposal02/query-proposal02.3.query.aql b/asterix-app/src/test/resources/runtimets/queries/open-closed/query-proposal02/query-proposal02.3.query.aql
new file mode 100644
index 0000000..bb32102
--- /dev/null
+++ b/asterix-app/src/test/resources/runtimets/queries/open-closed/query-proposal02/query-proposal02.3.query.aql
@@ -0,0 +1,22 @@
+/*
+ * Description : Insert open data into internal dataset and query the open data
+ * Expected Result : Success
+ * Date : 23rd October 2012
+ * Notes : This test was written to cover the scenario which is used in the proposal.
+ * : this is another variant of the test in query-proposal.aql
+ */
+
+use dataverse test;
+
+for $tweet in dataset('TweetMessages')
+ where some $reftopic in $tweet.referred-topics
+ satisfies contains($reftopic, 'verizon')
+ for $reftopic in $tweet.referred-topics
+ group by $topic := $reftopic with $tweet
+ order by $topic
+ return
+ {
+ "topic": $topic,
+ "count": count($tweet)
+ }
+
diff --git a/asterix-app/src/test/resources/runtimets/queries/spatial/line-intersect-circle/line-intersect-circle.1.ddl.aql b/asterix-app/src/test/resources/runtimets/queries/spatial/line-intersect-circle/line-intersect-circle.1.ddl.aql
new file mode 100644
index 0000000..e123144
--- /dev/null
+++ b/asterix-app/src/test/resources/runtimets/queries/spatial/line-intersect-circle/line-intersect-circle.1.ddl.aql
@@ -0,0 +1,13 @@
+drop dataverse test if exists;
+create dataverse test;
+use dataverse test;
+
+create type MyRecord as open {
+ id: int32,
+ point: point,
+ kwds: string
+}
+
+create external dataset MyData(MyRecord)
+using "edu.uci.ics.asterix.external.dataset.adapter.NCFileSystemAdapter"
+(("path"="nc1://data/spatial/spatialData.json"),("format"="adm"));
diff --git a/asterix-app/src/test/resources/runtimets/queries/spatial/line-intersect-circle/line-intersect-circle.2.update.aql b/asterix-app/src/test/resources/runtimets/queries/spatial/line-intersect-circle/line-intersect-circle.2.update.aql
new file mode 100644
index 0000000..1ecf3aa
--- /dev/null
+++ b/asterix-app/src/test/resources/runtimets/queries/spatial/line-intersect-circle/line-intersect-circle.2.update.aql
@@ -0,0 +1 @@
+// no inserts, deletes
diff --git a/asterix-app/src/test/resources/runtimets/queries/spatial/line-intersect-circle/line-intersect-circle.3.query.aql b/asterix-app/src/test/resources/runtimets/queries/spatial/line-intersect-circle/line-intersect-circle.3.query.aql
new file mode 100644
index 0000000..fda31b4
--- /dev/null
+++ b/asterix-app/src/test/resources/runtimets/queries/spatial/line-intersect-circle/line-intersect-circle.3.query.aql
@@ -0,0 +1,6 @@
+use dataverse test;
+
+for $o in dataset('MyData')
+where spatial-intersect($o.line1, create-circle(create-point(0.0,0.0), 5.0))
+order by $o.id
+return {"id":$o.id}
diff --git a/asterix-app/src/test/resources/runtimets/queries/spatial/line-intersect-line/line-intersect-line.1.ddl.aql b/asterix-app/src/test/resources/runtimets/queries/spatial/line-intersect-line/line-intersect-line.1.ddl.aql
new file mode 100644
index 0000000..e123144
--- /dev/null
+++ b/asterix-app/src/test/resources/runtimets/queries/spatial/line-intersect-line/line-intersect-line.1.ddl.aql
@@ -0,0 +1,13 @@
+drop dataverse test if exists;
+create dataverse test;
+use dataverse test;
+
+create type MyRecord as open {
+ id: int32,
+ point: point,
+ kwds: string
+}
+
+create external dataset MyData(MyRecord)
+using "edu.uci.ics.asterix.external.dataset.adapter.NCFileSystemAdapter"
+(("path"="nc1://data/spatial/spatialData.json"),("format"="adm"));
diff --git a/asterix-app/src/test/resources/runtimets/queries/spatial/line-intersect-line/line-intersect-line.2.update.aql b/asterix-app/src/test/resources/runtimets/queries/spatial/line-intersect-line/line-intersect-line.2.update.aql
new file mode 100644
index 0000000..bb883a0
--- /dev/null
+++ b/asterix-app/src/test/resources/runtimets/queries/spatial/line-intersect-line/line-intersect-line.2.update.aql
@@ -0,0 +1 @@
+// no inserts, deletes
diff --git a/asterix-app/src/test/resources/runtimets/queries/spatial/line-intersect-line/line-intersect-line.3.query.aql b/asterix-app/src/test/resources/runtimets/queries/spatial/line-intersect-line/line-intersect-line.3.query.aql
new file mode 100644
index 0000000..e1768ab
--- /dev/null
+++ b/asterix-app/src/test/resources/runtimets/queries/spatial/line-intersect-line/line-intersect-line.3.query.aql
@@ -0,0 +1,6 @@
+use dataverse test;
+
+for $o in dataset('MyData')
+where spatial-intersect($o.line1, $o.line2)
+order by $o.id
+return {"id":$o.id}
diff --git a/asterix-app/src/test/resources/runtimets/queries/spatial/line-intersect-polygon/line-intersect-polygon.1.ddl.aql b/asterix-app/src/test/resources/runtimets/queries/spatial/line-intersect-polygon/line-intersect-polygon.1.ddl.aql
new file mode 100644
index 0000000..1914a96
--- /dev/null
+++ b/asterix-app/src/test/resources/runtimets/queries/spatial/line-intersect-polygon/line-intersect-polygon.1.ddl.aql
@@ -0,0 +1,14 @@
+drop dataverse test if exists;
+create dataverse test;
+use dataverse test;
+
+create type MyRecord as open {
+ id: int32,
+ point: point,
+ kwds: string
+}
+
+create external dataset MyData(MyRecord)
+using "edu.uci.ics.asterix.external.dataset.adapter.NCFileSystemAdapter"
+(("path"="nc1://data/spatial/spatialData.json"),("format"="adm"));
+
diff --git a/asterix-app/src/test/resources/runtimets/queries/spatial/line-intersect-polygon/line-intersect-polygon.2.update.aql b/asterix-app/src/test/resources/runtimets/queries/spatial/line-intersect-polygon/line-intersect-polygon.2.update.aql
new file mode 100644
index 0000000..1ecf3aa
--- /dev/null
+++ b/asterix-app/src/test/resources/runtimets/queries/spatial/line-intersect-polygon/line-intersect-polygon.2.update.aql
@@ -0,0 +1 @@
+// no inserts, deletes
diff --git a/asterix-app/src/test/resources/runtimets/queries/spatial/line-intersect-polygon/line-intersect-polygon.3.query.aql b/asterix-app/src/test/resources/runtimets/queries/spatial/line-intersect-polygon/line-intersect-polygon.3.query.aql
new file mode 100644
index 0000000..ee45ed0
--- /dev/null
+++ b/asterix-app/src/test/resources/runtimets/queries/spatial/line-intersect-polygon/line-intersect-polygon.3.query.aql
@@ -0,0 +1,7 @@
+use dataverse test;
+
+for $o in dataset('MyData')
+where spatial-intersect($o.line1, $o.poly1)
+order by $o.id
+return {"id":$o.id}
+
diff --git a/asterix-app/src/test/resources/runtimets/queries/spatial/line-intersect-rectangle/line-intersect-rectangle.1.ddl.aql b/asterix-app/src/test/resources/runtimets/queries/spatial/line-intersect-rectangle/line-intersect-rectangle.1.ddl.aql
new file mode 100644
index 0000000..a920acd
--- /dev/null
+++ b/asterix-app/src/test/resources/runtimets/queries/spatial/line-intersect-rectangle/line-intersect-rectangle.1.ddl.aql
@@ -0,0 +1,14 @@
+drop dataverse test if exists;
+create dataverse test;
+use dataverse test;
+
+create type MyRecord as open {
+ id: int32,
+ point: point,
+ kwds: string
+}
+
+create external dataset MyData(MyRecord)
+ using "edu.uci.ics.asterix.external.dataset.adapter.NCFileSystemAdapter"
+ (("path"="nc1://data/spatial/spatialData.json"),("format"="adm"));
+
diff --git a/asterix-app/src/test/resources/runtimets/queries/spatial/line-intersect-rectangle/line-intersect-rectangle.2.update.aql b/asterix-app/src/test/resources/runtimets/queries/spatial/line-intersect-rectangle/line-intersect-rectangle.2.update.aql
new file mode 100644
index 0000000..1ecf3aa
--- /dev/null
+++ b/asterix-app/src/test/resources/runtimets/queries/spatial/line-intersect-rectangle/line-intersect-rectangle.2.update.aql
@@ -0,0 +1 @@
+// no inserts, deletes
diff --git a/asterix-app/src/test/resources/runtimets/queries/spatial/line-intersect-rectangle/line-intersect-rectangle.3.query.aql b/asterix-app/src/test/resources/runtimets/queries/spatial/line-intersect-rectangle/line-intersect-rectangle.3.query.aql
new file mode 100644
index 0000000..ef3b9b1
--- /dev/null
+++ b/asterix-app/src/test/resources/runtimets/queries/spatial/line-intersect-rectangle/line-intersect-rectangle.3.query.aql
@@ -0,0 +1,7 @@
+use dataverse test;
+
+for $o in dataset('MyData')
+where spatial-intersect($o.line1, $o.rec)
+order by $o.id
+return {"id":$o.id}
+
diff --git a/asterix-app/src/test/resources/runtimets/queries/spatial/line_accessor/line_accessor.1.ddl.aql b/asterix-app/src/test/resources/runtimets/queries/spatial/line_accessor/line_accessor.1.ddl.aql
new file mode 100644
index 0000000..febae58
--- /dev/null
+++ b/asterix-app/src/test/resources/runtimets/queries/spatial/line_accessor/line_accessor.1.ddl.aql
@@ -0,0 +1,8 @@
+/*
+ * Description : Test spatial accessors
+ * Expected Result : Success
+ * Date : Oct 17, 2012
+ */
+
+drop dataverse test if exists;
+create dataverse test;
diff --git a/asterix-app/src/test/resources/runtimets/queries/spatial/line_accessor/line_accessor.2.update.aql b/asterix-app/src/test/resources/runtimets/queries/spatial/line_accessor/line_accessor.2.update.aql
new file mode 100644
index 0000000..e4f7747
--- /dev/null
+++ b/asterix-app/src/test/resources/runtimets/queries/spatial/line_accessor/line_accessor.2.update.aql
@@ -0,0 +1,7 @@
+/*
+ * Description : Test spatial accessors
+ * Expected Result : Success
+ * Date : Oct 17, 2012
+ */
+
+// no inserts, deletes
diff --git a/asterix-app/src/test/resources/runtimets/queries/spatial/line_accessor/line_accessor.3.query.aql b/asterix-app/src/test/resources/runtimets/queries/spatial/line_accessor/line_accessor.3.query.aql
new file mode 100644
index 0000000..4c4992e
--- /dev/null
+++ b/asterix-app/src/test/resources/runtimets/queries/spatial/line_accessor/line_accessor.3.query.aql
@@ -0,0 +1,12 @@
+/*
+ * Description : Test spatial accessors
+ * Expected Result : Success
+ * Date : Oct 17, 2012
+ */
+
+use dataverse test;
+
+let $line := create-line(create-point(100.6,999.4), create-point(-872.0,-876.9))
+let $line_list := get-points($line)
+for $p in $line_list
+return $p
diff --git a/asterix-app/src/test/resources/runtimets/queries/spatial/spatial-area/spatial-area.1.ddl.aql b/asterix-app/src/test/resources/runtimets/queries/spatial/spatial-area/spatial-area.1.ddl.aql
new file mode 100644
index 0000000..1914a96
--- /dev/null
+++ b/asterix-app/src/test/resources/runtimets/queries/spatial/spatial-area/spatial-area.1.ddl.aql
@@ -0,0 +1,14 @@
+drop dataverse test if exists;
+create dataverse test;
+use dataverse test;
+
+create type MyRecord as open {
+ id: int32,
+ point: point,
+ kwds: string
+}
+
+create external dataset MyData(MyRecord)
+using "edu.uci.ics.asterix.external.dataset.adapter.NCFileSystemAdapter"
+(("path"="nc1://data/spatial/spatialData.json"),("format"="adm"));
+
diff --git a/asterix-app/src/test/resources/runtimets/queries/spatial/spatial-area/spatial-area.2.update.aql b/asterix-app/src/test/resources/runtimets/queries/spatial/spatial-area/spatial-area.2.update.aql
new file mode 100644
index 0000000..bb883a0
--- /dev/null
+++ b/asterix-app/src/test/resources/runtimets/queries/spatial/spatial-area/spatial-area.2.update.aql
@@ -0,0 +1 @@
+// no inserts, deletes
diff --git a/asterix-app/src/test/resources/runtimets/queries/spatial/spatial-area/spatial-area.3.query.aql b/asterix-app/src/test/resources/runtimets/queries/spatial/spatial-area/spatial-area.3.query.aql
new file mode 100644
index 0000000..940dfe8
--- /dev/null
+++ b/asterix-app/src/test/resources/runtimets/queries/spatial/spatial-area/spatial-area.3.query.aql
@@ -0,0 +1,7 @@
+use dataverse test;
+
+let $polygonArea := spatial-area(create-polygon(create-point(1.0,1.0),create-point(1.0,4.0),create-point(3.0,4.0),create-point(3.0,1.0)))
+let $circleArea := spatial-area(create-circle(create-point(0.0,0.0), 1.0))
+let $rectangleArea := spatial-area(create-rectangle(create-point(0.0,5.0), create-point(8.0,8.0)))
+return {"polygonArea":$polygonArea, "circleArea":$circleArea, "rectangleArea":$rectangleArea}
+