ASTERIXDB-673: add a regression test.

Change-Id: Iee137d4a6d0e0cf9f4a28aa7f2158713dab085a8
Reviewed-on: https://asterix-gerrit.ics.uci.edu/631
Tested-by: Jenkins <jenkins@fulliautomatix.ics.uci.edu>
Reviewed-by: Till Westmann <tillw@apache.org>
diff --git a/asterix-app/src/test/resources/runtimets/queries/list/query-ASTERIXDB-673/query-ASTERIXDB-673.1.ddl.aql b/asterix-app/src/test/resources/runtimets/queries/list/query-ASTERIXDB-673/query-ASTERIXDB-673.1.ddl.aql
new file mode 100644
index 0000000..3b1f31a
--- /dev/null
+++ b/asterix-app/src/test/resources/runtimets/queries/list/query-ASTERIXDB-673/query-ASTERIXDB-673.1.ddl.aql
@@ -0,0 +1,36 @@
+/*
+ * 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 FacebookMessageType as closed {
+        message-id: int64,
+        author-id: int64,
+        in-response-to: int64?,
+        sender-location: point?,
+        message: string,
+        send-time: datetime
+}
+
+create dataset FacebookMessages(FacebookMessageType)
+primary key message-id;
+
diff --git a/asterix-app/src/test/resources/runtimets/queries/list/query-ASTERIXDB-673/query-ASTERIXDB-673.2.update.aql b/asterix-app/src/test/resources/runtimets/queries/list/query-ASTERIXDB-673/query-ASTERIXDB-673.2.update.aql
new file mode 100644
index 0000000..3b07795
--- /dev/null
+++ b/asterix-app/src/test/resources/runtimets/queries/list/query-ASTERIXDB-673/query-ASTERIXDB-673.2.update.aql
@@ -0,0 +1,25 @@
+/*
+ * 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 FacebookMessages using localfs
+(("path"="asterix_nc1://data/fbm-with-send-time.adm"),("format"="adm"));
+
+
diff --git a/asterix-app/src/test/resources/runtimets/queries/list/query-ASTERIXDB-673/query-ASTERIXDB-673.3.query.aql b/asterix-app/src/test/resources/runtimets/queries/list/query-ASTERIXDB-673/query-ASTERIXDB-673.3.query.aql
new file mode 100644
index 0000000..a22ed4f
--- /dev/null
+++ b/asterix-app/src/test/resources/runtimets/queries/list/query-ASTERIXDB-673/query-ASTERIXDB-673.3.query.aql
@@ -0,0 +1,33 @@
+/*
+ * 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 case is to verify the fix for ASTERIXDB-673.
+ */
+
+use dataverse test;
+
+for $m in dataset FacebookMessages
+let $msgid := $m.message-id
+group by $author := $m.author-id with $msgid
+where $msgid > 0 and $msgid < 10
+return {
+   "author": $author,
+   "msgids": $msgid
+ };
+
diff --git a/asterix-app/src/test/resources/runtimets/results/list/query-ASTERIXDB-673/query-ASTERIXDB-673.1.adm b/asterix-app/src/test/resources/runtimets/results/list/query-ASTERIXDB-673/query-ASTERIXDB-673.1.adm
new file mode 100644
index 0000000..e69de29
--- /dev/null
+++ b/asterix-app/src/test/resources/runtimets/results/list/query-ASTERIXDB-673/query-ASTERIXDB-673.1.adm
diff --git a/asterix-app/src/test/resources/runtimets/testsuite.xml b/asterix-app/src/test/resources/runtimets/testsuite.xml
index 35ecb1e..f148a77 100644
--- a/asterix-app/src/test/resources/runtimets/testsuite.xml
+++ b/asterix-app/src/test/resources/runtimets/testsuite.xml
@@ -2829,6 +2829,11 @@
                 <output-dir compare="Text">query-issue428</output-dir>
             </compilation-unit>
         </test-case>
+        <test-case FilePath="list">
+            <compilation-unit name="query-ASTERIXDB-673">
+                <output-dir compare="Text">query-ASTERIXDB-673</output-dir>
+            </compilation-unit>
+        </test-case>
     </test-group>
     <test-group name="misc">
         <test-case FilePath="misc">