ASTERIXDB-923: add a regression test.
Change-Id: I5cf9da76e078abba452652cbad204fa53c8bb678
Reviewed-on: https://asterix-gerrit.ics.uci.edu/700
Tested-by: Jenkins <jenkins@fulliautomatix.ics.uci.edu>
Reviewed-by: Michael Blow <michael.blow@couchbase.com>
Reviewed-by: Till Westmann <tillw@apache.org>
diff --git a/asterix-app/src/test/resources/runtimets/queries/aggregate/query-ASTERIXDB-923/query-ASTERIXDB-923.1.ddl.aql b/asterix-app/src/test/resources/runtimets/queries/aggregate/query-ASTERIXDB-923/query-ASTERIXDB-923.1.ddl.aql
new file mode 100644
index 0000000..6b59fb3
--- /dev/null
+++ b/asterix-app/src/test/resources/runtimets/queries/aggregate/query-ASTERIXDB-923/query-ASTERIXDB-923.1.ddl.aql
@@ -0,0 +1,42 @@
+/*
+ * Licensed to the Apache Software Foundation (ASF) under one
+ * or more contributor license agreements. See the NOTICE file
+ * distributed with this work for additional information
+ * regarding copyright ownership. The ASF licenses this file
+ * to you under the Apache License, Version 2.0 (the
+ * "License"); you may not use this file except in compliance
+ * with the License. You may obtain a copy of the License at
+ *
+ * http://www.apache.org/licenses/LICENSE-2.0
+ *
+ * Unless required by applicable law or agreed to in writing,
+ * software distributed under the License is distributed on an
+ * "AS IS" BASIS, WITHOUT WARRANTIES OR CONDITIONS OF ANY
+ * KIND, either express or implied. See the License for the
+ * specific language governing permissions and limitations
+ * under the License.
+ */
+
+drop dataverse test if exists;
+create dataverse test;
+use dataverse test;
+
+create type EmploymentType as
+{
+ "organization-name" : string,
+ "start-date" : date,
+ "end-date" : date?
+}
+
+create type FacebookUserType as
+ closed {
+ id : int64,
+ alias : string,
+ name : string,
+ "user-since" : datetime,
+ "friend-ids" : {{int64}},
+ employment : [EmploymentType]
+}
+
+create dataset FacebookUsers (FacebookUserType) primary key id;
+
diff --git a/asterix-app/src/test/resources/runtimets/queries/aggregate/query-ASTERIXDB-923/query-ASTERIXDB-923.2.update.aql b/asterix-app/src/test/resources/runtimets/queries/aggregate/query-ASTERIXDB-923/query-ASTERIXDB-923.2.update.aql
new file mode 100644
index 0000000..ba7edb2
--- /dev/null
+++ b/asterix-app/src/test/resources/runtimets/queries/aggregate/query-ASTERIXDB-923/query-ASTERIXDB-923.2.update.aql
@@ -0,0 +1,24 @@
+/*
+ * Licensed to the Apache Software Foundation (ASF) under one
+ * or more contributor license agreements. See the NOTICE file
+ * distributed with this work for additional information
+ * regarding copyright ownership. The ASF licenses this file
+ * to you under the Apache License, Version 2.0 (the
+ * "License"); you may not use this file except in compliance
+ * with the License. You may obtain a copy of the License at
+ *
+ * http://www.apache.org/licenses/LICENSE-2.0
+ *
+ * Unless required by applicable law or agreed to in writing,
+ * software distributed under the License is distributed on an
+ * "AS IS" BASIS, WITHOUT WARRANTIES OR CONDITIONS OF ANY
+ * KIND, either express or implied. See the License for the
+ * specific language governing permissions and limitations
+ * under the License.
+ */
+
+use dataverse test;
+
+load dataset FacebookUsers using localfs
+(("path"="asterix_nc1://data/tinysocial/fbu.adm"),("format"="adm"));
+
diff --git a/asterix-app/src/test/resources/runtimets/queries/aggregate/query-ASTERIXDB-923/query-ASTERIXDB-923.3.query.aql b/asterix-app/src/test/resources/runtimets/queries/aggregate/query-ASTERIXDB-923/query-ASTERIXDB-923.3.query.aql
new file mode 100644
index 0000000..3faa9b6
--- /dev/null
+++ b/asterix-app/src/test/resources/runtimets/queries/aggregate/query-ASTERIXDB-923/query-ASTERIXDB-923.3.query.aql
@@ -0,0 +1,26 @@
+/*
+ * Licensed to the Apache Software Foundation (ASF) under one
+ * or more contributor license agreements. See the NOTICE file
+ * distributed with this work for additional information
+ * regarding copyright ownership. The ASF licenses this file
+ * to you under the Apache License, Version 2.0 (the
+ * "License"); you may not use this file except in compliance
+ * with the License. You may obtain a copy of the License at
+ *
+ * http://www.apache.org/licenses/LICENSE-2.0
+ *
+ * Unless required by applicable law or agreed to in writing,
+ * software distributed under the License is distributed on an
+ * "AS IS" BASIS, WITHOUT WARRANTIES OR CONDITIONS OF ANY
+ * KIND, either express or implied. See the License for the
+ * specific language governing permissions and limitations
+ * under the License.
+ */
+
+/* This test verifies the fix for ASTERIXDB-923. */
+
+use dataverse test;
+
+for $g in
+(for $u in dataset FacebookUsers group by $u.id with $u return $u)
+return count(for $x in $g return $x)
diff --git a/asterix-app/src/test/resources/runtimets/queries/aggregate/query-ASTERIXDB-923/query-ASTERIXDB-923.4.query.aql b/asterix-app/src/test/resources/runtimets/queries/aggregate/query-ASTERIXDB-923/query-ASTERIXDB-923.4.query.aql
new file mode 100644
index 0000000..689472f
--- /dev/null
+++ b/asterix-app/src/test/resources/runtimets/queries/aggregate/query-ASTERIXDB-923/query-ASTERIXDB-923.4.query.aql
@@ -0,0 +1,24 @@
+/*
+ * Licensed to the Apache Software Foundation (ASF) under one
+ * or more contributor license agreements. See the NOTICE file
+ * distributed with this work for additional information
+ * regarding copyright ownership. The ASF licenses this file
+ * to you under the Apache License, Version 2.0 (the
+ * "License"); you may not use this file except in compliance
+ * with the License. You may obtain a copy of the License at
+ *
+ * http://www.apache.org/licenses/LICENSE-2.0
+ *
+ * Unless required by applicable law or agreed to in writing,
+ * software distributed under the License is distributed on an
+ * "AS IS" BASIS, WITHOUT WARRANTIES OR CONDITIONS OF ANY
+ * KIND, either express or implied. See the License for the
+ * specific language governing permissions and limitations
+ * under the License.
+ */
+
+use dataverse test;
+
+for $g in
+(for $u in dataset FacebookUsers group by $u.id with $u return $u)
+return count($g)
\ No newline at end of file
diff --git a/asterix-app/src/test/resources/runtimets/queries/aggregate/query-ASTERIXDB-923/query-ASTERIXDB-923.5.query.aql b/asterix-app/src/test/resources/runtimets/queries/aggregate/query-ASTERIXDB-923/query-ASTERIXDB-923.5.query.aql
new file mode 100644
index 0000000..e1165b4
--- /dev/null
+++ b/asterix-app/src/test/resources/runtimets/queries/aggregate/query-ASTERIXDB-923/query-ASTERIXDB-923.5.query.aql
@@ -0,0 +1,24 @@
+/*
+ * Licensed to the Apache Software Foundation (ASF) under one
+ * or more contributor license agreements. See the NOTICE file
+ * distributed with this work for additional information
+ * regarding copyright ownership. The ASF licenses this file
+ * to you under the Apache License, Version 2.0 (the
+ * "License"); you may not use this file except in compliance
+ * with the License. You may obtain a copy of the License at
+ *
+ * http://www.apache.org/licenses/LICENSE-2.0
+ *
+ * Unless required by applicable law or agreed to in writing,
+ * software distributed under the License is distributed on an
+ * "AS IS" BASIS, WITHOUT WARRANTIES OR CONDITIONS OF ANY
+ * KIND, either express or implied. See the License for the
+ * specific language governing permissions and limitations
+ * under the License.
+ */
+
+use dataverse test;
+
+for $g in
+(for $u in dataset FacebookUsers group by $u.id with $u return $u)
+return count(for $x in (for $y in $g return $y) return $x)
\ No newline at end of file
diff --git a/asterix-app/src/test/resources/runtimets/results/aggregate/query-ASTERIXDB-923/query-ASTERIXDB-923.1.adm b/asterix-app/src/test/resources/runtimets/results/aggregate/query-ASTERIXDB-923/query-ASTERIXDB-923.1.adm
new file mode 100644
index 0000000..d3d1712
--- /dev/null
+++ b/asterix-app/src/test/resources/runtimets/results/aggregate/query-ASTERIXDB-923/query-ASTERIXDB-923.1.adm
@@ -0,0 +1,10 @@
+1
+1
+1
+1
+1
+1
+1
+1
+1
+1
diff --git a/asterix-app/src/test/resources/runtimets/results/aggregate/query-ASTERIXDB-923/query-ASTERIXDB-923.2.adm b/asterix-app/src/test/resources/runtimets/results/aggregate/query-ASTERIXDB-923/query-ASTERIXDB-923.2.adm
new file mode 100644
index 0000000..d3d1712
--- /dev/null
+++ b/asterix-app/src/test/resources/runtimets/results/aggregate/query-ASTERIXDB-923/query-ASTERIXDB-923.2.adm
@@ -0,0 +1,10 @@
+1
+1
+1
+1
+1
+1
+1
+1
+1
+1
diff --git a/asterix-app/src/test/resources/runtimets/results/aggregate/query-ASTERIXDB-923/query-ASTERIXDB-923.3.adm b/asterix-app/src/test/resources/runtimets/results/aggregate/query-ASTERIXDB-923/query-ASTERIXDB-923.3.adm
new file mode 100644
index 0000000..d3d1712
--- /dev/null
+++ b/asterix-app/src/test/resources/runtimets/results/aggregate/query-ASTERIXDB-923/query-ASTERIXDB-923.3.adm
@@ -0,0 +1,10 @@
+1
+1
+1
+1
+1
+1
+1
+1
+1
+1
diff --git a/asterix-app/src/test/resources/runtimets/testsuite.xml b/asterix-app/src/test/resources/runtimets/testsuite.xml
index 67db6af..8411c5a 100644
--- a/asterix-app/src/test/resources/runtimets/testsuite.xml
+++ b/asterix-app/src/test/resources/runtimets/testsuite.xml
@@ -402,6 +402,11 @@
<output-dir compare="Text">count_null</output-dir>
</compilation-unit>
</test-case>
+ <test-case FilePath="aggregate">
+ <compilation-unit name="query-ASTERIXDB-923">
+ <output-dir compare="Text">query-ASTERIXDB-923</output-dir>
+ </compilation-unit>
+ </test-case>
<!--
<test-case FilePath="aggregate">
<compilation-unit name="droptype">