asterixdb-commits mailing list archives

Site index · List index
Message view « Date » · « Thread »
Top « Date » · « Thread »
From buyin...@apache.org
Subject [6/8] asterixdb git commit: Clean up GROUP BY and WITH clause.
Date Mon, 15 Aug 2016 15:45:37 GMT
http://git-wip-us.apache.org/repos/asf/asterixdb/blob/8671ddf8/asterixdb/asterix-app/src/test/resources/runtimets/queries_sqlpp/dapd/q2-2-negative/q2-2-negative.2.update.sqlpp
----------------------------------------------------------------------
diff --git a/asterixdb/asterix-app/src/test/resources/runtimets/queries_sqlpp/dapd/q2-2-negative/q2-2-negative.2.update.sqlpp b/asterixdb/asterix-app/src/test/resources/runtimets/queries_sqlpp/dapd/q2-2-negative/q2-2-negative.2.update.sqlpp
new file mode 100644
index 0000000..bd244d0
--- /dev/null
+++ b/asterixdb/asterix-app/src/test/resources/runtimets/queries_sqlpp/dapd/q2-2-negative/q2-2-negative.2.update.sqlpp
@@ -0,0 +1,19 @@
+/*
+ * 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.
+ */
+

http://git-wip-us.apache.org/repos/asf/asterixdb/blob/8671ddf8/asterixdb/asterix-app/src/test/resources/runtimets/queries_sqlpp/dapd/q2-2-negative/q2-2-negative.3.query.sqlpp
----------------------------------------------------------------------
diff --git a/asterixdb/asterix-app/src/test/resources/runtimets/queries_sqlpp/dapd/q2-2-negative/q2-2-negative.3.query.sqlpp b/asterixdb/asterix-app/src/test/resources/runtimets/queries_sqlpp/dapd/q2-2-negative/q2-2-negative.3.query.sqlpp
new file mode 100644
index 0000000..8a5d32d
--- /dev/null
+++ b/asterixdb/asterix-app/src/test/resources/runtimets/queries_sqlpp/dapd/q2-2-negative/q2-2-negative.3.query.sqlpp
@@ -0,0 +1,40 @@
+/*
+ * 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 query is a negative test for default group variable's fields.
+ */
+
+use test;
+
+
+select element {'sig_id':sig_id,'total_count':sig_sponsorship_count,'chapter_breakdown':by_chapter}
+from  Event as event,
+      event.sponsoring_sigs as sponsor
+let  e = {'event':event,'sponsor':sponsor}
+group by sponsor.sig_id as sig_id
+let  sig_sponsorship_count = count(1),
+      by_chapter = (
+      select element {'chapter_name':chapter_name,'escount':count(e)}
+      from  e as e
+      group by e.sponsor.chapter_name as chapter_name
+  )
+order by sig_sponsorship_count desc
+limit 5
+;

http://git-wip-us.apache.org/repos/asf/asterixdb/blob/8671ddf8/asterixdb/asterix-app/src/test/resources/runtimets/queries_sqlpp/dapd/q2-2/q2-2.3.query.sqlpp
----------------------------------------------------------------------
diff --git a/asterixdb/asterix-app/src/test/resources/runtimets/queries_sqlpp/dapd/q2-2/q2-2.3.query.sqlpp b/asterixdb/asterix-app/src/test/resources/runtimets/queries_sqlpp/dapd/q2-2/q2-2.3.query.sqlpp
index 307ad80..bf968cc 100644
--- a/asterixdb/asterix-app/src/test/resources/runtimets/queries_sqlpp/dapd/q2-2/q2-2.3.query.sqlpp
+++ b/asterixdb/asterix-app/src/test/resources/runtimets/queries_sqlpp/dapd/q2-2/q2-2.3.query.sqlpp
@@ -27,10 +27,9 @@ use test;
 select element {'sig_id':sig_id,'total_count':sig_sponsorship_count,'chapter_breakdown':by_chapter}
 from  Event as event,
       event.sponsoring_sigs as sponsor
-with  e as {'event':event,'sponsor':sponsor}
-group by sponsor.sig_id as sig_id
-with  sig_sponsorship_count as count(e),
-      by_chapter as (
+group by sponsor.sig_id as sig_id group as e
+let  sig_sponsorship_count = count(1),
+      by_chapter = (
       select element {'chapter_name':chapter_name,'escount':count(e)}
       from  e as e
       group by e.sponsor.chapter_name as chapter_name

http://git-wip-us.apache.org/repos/asf/asterixdb/blob/8671ddf8/asterixdb/asterix-app/src/test/resources/runtimets/queries_sqlpp/dapd/q2-7/q2-7.1.ddl.sqlpp
----------------------------------------------------------------------
diff --git a/asterixdb/asterix-app/src/test/resources/runtimets/queries_sqlpp/dapd/q2-7/q2-7.1.ddl.sqlpp b/asterixdb/asterix-app/src/test/resources/runtimets/queries_sqlpp/dapd/q2-7/q2-7.1.ddl.sqlpp
new file mode 100644
index 0000000..99eae31
--- /dev/null
+++ b/asterixdb/asterix-app/src/test/resources/runtimets/queries_sqlpp/dapd/q2-7/q2-7.1.ddl.sqlpp
@@ -0,0 +1,55 @@
+/*
+ * 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 test;
+
+
+create type test.AddressType as
+ closed {
+  street : string,
+  city : string,
+  zip : string,
+  latlong : point
+}
+
+create type test.EventType as
+ closed {
+  event_id : int64,
+  name : string,
+  location : AddressType?,
+  organizers : {{{
+          name : string
+      }
+}},
+  sponsoring_sigs : [{
+          sig_id : int64,
+          chapter_name : string
+      }
+],
+  interest_keywords : {{string}},
+  price : double?,
+  start_time : datetime,
+  end_time : datetime
+}
+
+create external  dataset Event(EventType) using localfs((`path`=`asterix_nc1://data/events/tiny/event.adm`),(`format`=`adm`));
+

http://git-wip-us.apache.org/repos/asf/asterixdb/blob/8671ddf8/asterixdb/asterix-app/src/test/resources/runtimets/queries_sqlpp/dapd/q2-7/q2-7.2.update.sqlpp
----------------------------------------------------------------------
diff --git a/asterixdb/asterix-app/src/test/resources/runtimets/queries_sqlpp/dapd/q2-7/q2-7.2.update.sqlpp b/asterixdb/asterix-app/src/test/resources/runtimets/queries_sqlpp/dapd/q2-7/q2-7.2.update.sqlpp
new file mode 100644
index 0000000..bd244d0
--- /dev/null
+++ b/asterixdb/asterix-app/src/test/resources/runtimets/queries_sqlpp/dapd/q2-7/q2-7.2.update.sqlpp
@@ -0,0 +1,19 @@
+/*
+ * 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.
+ */
+

http://git-wip-us.apache.org/repos/asf/asterixdb/blob/8671ddf8/asterixdb/asterix-app/src/test/resources/runtimets/queries_sqlpp/dapd/q2-7/q2-7.3.query.sqlpp
----------------------------------------------------------------------
diff --git a/asterixdb/asterix-app/src/test/resources/runtimets/queries_sqlpp/dapd/q2-7/q2-7.3.query.sqlpp b/asterixdb/asterix-app/src/test/resources/runtimets/queries_sqlpp/dapd/q2-7/q2-7.3.query.sqlpp
new file mode 100644
index 0000000..92039e0
--- /dev/null
+++ b/asterixdb/asterix-app/src/test/resources/runtimets/queries_sqlpp/dapd/q2-7/q2-7.3.query.sqlpp
@@ -0,0 +1,35 @@
+/*
+ * 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 test;
+
+// Tests nested SELECT * for nested GROUP BY.
+SELECT sponsor.sig_id, COUNT(1) total_count,
+       (
+         SELECT *
+         FROM es AS e
+         GROUP BY e.sponsor.chapter_name
+       ) chapter_breakdown
+FROM  Event,
+      Event.sponsoring_sigs AS sponsor
+GROUP BY sponsor.sig_id GROUP AS es
+ORDER BY total_count DESC
+LIMIT 5
+;

http://git-wip-us.apache.org/repos/asf/asterixdb/blob/8671ddf8/asterixdb/asterix-app/src/test/resources/runtimets/queries_sqlpp/dapd/q2-8/q2-8.1.ddl.sqlpp
----------------------------------------------------------------------
diff --git a/asterixdb/asterix-app/src/test/resources/runtimets/queries_sqlpp/dapd/q2-8/q2-8.1.ddl.sqlpp b/asterixdb/asterix-app/src/test/resources/runtimets/queries_sqlpp/dapd/q2-8/q2-8.1.ddl.sqlpp
new file mode 100644
index 0000000..99eae31
--- /dev/null
+++ b/asterixdb/asterix-app/src/test/resources/runtimets/queries_sqlpp/dapd/q2-8/q2-8.1.ddl.sqlpp
@@ -0,0 +1,55 @@
+/*
+ * 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 test;
+
+
+create type test.AddressType as
+ closed {
+  street : string,
+  city : string,
+  zip : string,
+  latlong : point
+}
+
+create type test.EventType as
+ closed {
+  event_id : int64,
+  name : string,
+  location : AddressType?,
+  organizers : {{{
+          name : string
+      }
+}},
+  sponsoring_sigs : [{
+          sig_id : int64,
+          chapter_name : string
+      }
+],
+  interest_keywords : {{string}},
+  price : double?,
+  start_time : datetime,
+  end_time : datetime
+}
+
+create external  dataset Event(EventType) using localfs((`path`=`asterix_nc1://data/events/tiny/event.adm`),(`format`=`adm`));
+

http://git-wip-us.apache.org/repos/asf/asterixdb/blob/8671ddf8/asterixdb/asterix-app/src/test/resources/runtimets/queries_sqlpp/dapd/q2-8/q2-8.2.update.sqlpp
----------------------------------------------------------------------
diff --git a/asterixdb/asterix-app/src/test/resources/runtimets/queries_sqlpp/dapd/q2-8/q2-8.2.update.sqlpp b/asterixdb/asterix-app/src/test/resources/runtimets/queries_sqlpp/dapd/q2-8/q2-8.2.update.sqlpp
new file mode 100644
index 0000000..bd244d0
--- /dev/null
+++ b/asterixdb/asterix-app/src/test/resources/runtimets/queries_sqlpp/dapd/q2-8/q2-8.2.update.sqlpp
@@ -0,0 +1,19 @@
+/*
+ * 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.
+ */
+

http://git-wip-us.apache.org/repos/asf/asterixdb/blob/8671ddf8/asterixdb/asterix-app/src/test/resources/runtimets/queries_sqlpp/dapd/q2-8/q2-8.3.query.sqlpp
----------------------------------------------------------------------
diff --git a/asterixdb/asterix-app/src/test/resources/runtimets/queries_sqlpp/dapd/q2-8/q2-8.3.query.sqlpp b/asterixdb/asterix-app/src/test/resources/runtimets/queries_sqlpp/dapd/q2-8/q2-8.3.query.sqlpp
new file mode 100644
index 0000000..28a3317
--- /dev/null
+++ b/asterixdb/asterix-app/src/test/resources/runtimets/queries_sqlpp/dapd/q2-8/q2-8.3.query.sqlpp
@@ -0,0 +1,35 @@
+/*
+ * 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 test;
+
+// Tests the case that a GROUP BY key expression appears in an aggregation function.
+SELECT sponsor.sig_id, COUNT(sponsor.sig_id) total_count,
+       (
+         SELECT e.sponsor.chapter_name, COUNT(e.sponsor.chapter_name) AS escount
+         FROM es AS e
+         GROUP BY e.sponsor.chapter_name
+       ) chapter_breakdown
+FROM  Event,
+      Event.sponsoring_sigs AS sponsor
+GROUP BY sponsor.sig_id GROUP AS es
+ORDER BY total_count DESC
+LIMIT 5
+;

http://git-wip-us.apache.org/repos/asf/asterixdb/blob/8671ddf8/asterixdb/asterix-app/src/test/resources/runtimets/queries_sqlpp/dapd/q2-9/q2-9.1.ddl.sqlpp
----------------------------------------------------------------------
diff --git a/asterixdb/asterix-app/src/test/resources/runtimets/queries_sqlpp/dapd/q2-9/q2-9.1.ddl.sqlpp b/asterixdb/asterix-app/src/test/resources/runtimets/queries_sqlpp/dapd/q2-9/q2-9.1.ddl.sqlpp
new file mode 100644
index 0000000..99eae31
--- /dev/null
+++ b/asterixdb/asterix-app/src/test/resources/runtimets/queries_sqlpp/dapd/q2-9/q2-9.1.ddl.sqlpp
@@ -0,0 +1,55 @@
+/*
+ * 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 test;
+
+
+create type test.AddressType as
+ closed {
+  street : string,
+  city : string,
+  zip : string,
+  latlong : point
+}
+
+create type test.EventType as
+ closed {
+  event_id : int64,
+  name : string,
+  location : AddressType?,
+  organizers : {{{
+          name : string
+      }
+}},
+  sponsoring_sigs : [{
+          sig_id : int64,
+          chapter_name : string
+      }
+],
+  interest_keywords : {{string}},
+  price : double?,
+  start_time : datetime,
+  end_time : datetime
+}
+
+create external  dataset Event(EventType) using localfs((`path`=`asterix_nc1://data/events/tiny/event.adm`),(`format`=`adm`));
+

http://git-wip-us.apache.org/repos/asf/asterixdb/blob/8671ddf8/asterixdb/asterix-app/src/test/resources/runtimets/queries_sqlpp/dapd/q2-9/q2-9.2.update.sqlpp
----------------------------------------------------------------------
diff --git a/asterixdb/asterix-app/src/test/resources/runtimets/queries_sqlpp/dapd/q2-9/q2-9.2.update.sqlpp b/asterixdb/asterix-app/src/test/resources/runtimets/queries_sqlpp/dapd/q2-9/q2-9.2.update.sqlpp
new file mode 100644
index 0000000..bd244d0
--- /dev/null
+++ b/asterixdb/asterix-app/src/test/resources/runtimets/queries_sqlpp/dapd/q2-9/q2-9.2.update.sqlpp
@@ -0,0 +1,19 @@
+/*
+ * 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.
+ */
+

http://git-wip-us.apache.org/repos/asf/asterixdb/blob/8671ddf8/asterixdb/asterix-app/src/test/resources/runtimets/queries_sqlpp/dapd/q2-9/q2-9.3.query.sqlpp
----------------------------------------------------------------------
diff --git a/asterixdb/asterix-app/src/test/resources/runtimets/queries_sqlpp/dapd/q2-9/q2-9.3.query.sqlpp b/asterixdb/asterix-app/src/test/resources/runtimets/queries_sqlpp/dapd/q2-9/q2-9.3.query.sqlpp
new file mode 100644
index 0000000..7044711
--- /dev/null
+++ b/asterixdb/asterix-app/src/test/resources/runtimets/queries_sqlpp/dapd/q2-9/q2-9.3.query.sqlpp
@@ -0,0 +1,35 @@
+/*
+ * 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 test;
+
+// Tests outer scope variable references in nested GROUP BY.
+SELECT sponsor.sig_id, COUNT(1) total_count,
+       (
+         SELECT sponsor.sig_id, e.sponsor.chapter_name, COUNT(e.sponsor.chapter_name) AS escount
+         FROM es AS e
+         GROUP BY e.sponsor.chapter_name
+       ) chapter_breakdown
+FROM  Event,
+      Event.sponsoring_sigs AS sponsor
+GROUP BY sponsor.sig_id GROUP AS es
+ORDER BY total_count DESC
+LIMIT 5
+;

http://git-wip-us.apache.org/repos/asf/asterixdb/blob/8671ddf8/asterixdb/asterix-app/src/test/resources/runtimets/queries_sqlpp/dapd/q2/q2.3.query.sqlpp
----------------------------------------------------------------------
diff --git a/asterixdb/asterix-app/src/test/resources/runtimets/queries_sqlpp/dapd/q2/q2.3.query.sqlpp b/asterixdb/asterix-app/src/test/resources/runtimets/queries_sqlpp/dapd/q2/q2.3.query.sqlpp
index f88e846..eb29743 100644
--- a/asterixdb/asterix-app/src/test/resources/runtimets/queries_sqlpp/dapd/q2/q2.3.query.sqlpp
+++ b/asterixdb/asterix-app/src/test/resources/runtimets/queries_sqlpp/dapd/q2/q2.3.query.sqlpp
@@ -23,14 +23,13 @@ use test;
 select element {'sig_id':sig_id,'total_count':sig_sponsorship_count,'chapter_breakdown':by_chapter}
 from  Event as event,
       event.sponsoring_sigs as sponsor
-with  es as {'event':event,'sponsor':sponsor}
-group by sponsor.sig_id as sig_id
-with  sig_sponsorship_count as count(es),
-      by_chapter as (
+group by sponsor.sig_id as sig_id group as es
+let sig_sponsorship_count = count(1),
+    by_chapter = (
       select element {'chapter_name':chapter_name,'escount':count(e)}
-      from  es as e
+      from es as e
       group by e.sponsor.chapter_name as chapter_name
-  )
+    )
 order by sig_sponsorship_count desc
 limit 5
 ;

http://git-wip-us.apache.org/repos/asf/asterixdb/blob/8671ddf8/asterixdb/asterix-app/src/test/resources/runtimets/queries_sqlpp/global-aggregate/q09/q09.1.ddl.sqlpp
----------------------------------------------------------------------
diff --git a/asterixdb/asterix-app/src/test/resources/runtimets/queries_sqlpp/global-aggregate/q09/q09.1.ddl.sqlpp b/asterixdb/asterix-app/src/test/resources/runtimets/queries_sqlpp/global-aggregate/q09/q09.1.ddl.sqlpp
new file mode 100644
index 0000000..f78afef
--- /dev/null
+++ b/asterixdb/asterix-app/src/test/resources/runtimets/queries_sqlpp/global-aggregate/q09/q09.1.ddl.sqlpp
@@ -0,0 +1,51 @@
+/*
+ * 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 TinySocial if exists;
+create  dataverse TinySocial;
+
+use TinySocial;
+
+
+create type TinySocial.TwitterUserType as
+{
+  `screen-name` : string
+}
+
+create type TinySocial.TweetMessageType as {
+  tweetid : string
+}
+
+create type TinySocial.FacebookUserType as
+ open {
+  id : int64
+}
+
+create type TinySocial.FacebookMessageType as
+ open {
+  `message-id` : int64
+}
+
+create  dataset FacebookUsers(FacebookUserType) primary key id;
+create  dataset FacebookMessages(FacebookMessageType) primary key `message-id`;
+create  dataset TwitterUsers(TwitterUserType) primary key `screen-name`;
+create  dataset TweetMessages(TweetMessageType) primary key tweetid hints (`CARDINALITY`=`100`);
+create  index fbUserSinceIdx  on FacebookUsers (`user-since`:datetime) type btree enforced;
+create  index fbAuthorIdx  on FacebookMessages (`author-id`:int64) type btree enforced;
+

http://git-wip-us.apache.org/repos/asf/asterixdb/blob/8671ddf8/asterixdb/asterix-app/src/test/resources/runtimets/queries_sqlpp/global-aggregate/q09/q09.2.update.sqlpp
----------------------------------------------------------------------
diff --git a/asterixdb/asterix-app/src/test/resources/runtimets/queries_sqlpp/global-aggregate/q09/q09.2.update.sqlpp b/asterixdb/asterix-app/src/test/resources/runtimets/queries_sqlpp/global-aggregate/q09/q09.2.update.sqlpp
new file mode 100644
index 0000000..5211fb6
--- /dev/null
+++ b/asterixdb/asterix-app/src/test/resources/runtimets/queries_sqlpp/global-aggregate/q09/q09.2.update.sqlpp
@@ -0,0 +1,30 @@
+/*
+ * 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 TinySocial;
+
+
+load  dataset FacebookUsers using localfs ((`path`=`asterix_nc1://data/tinysocial/fbu.adm`),(`format`=`adm`));
+
+load  dataset FacebookMessages using localfs ((`path`=`asterix_nc1://data/tinysocial/fbm.adm`),(`format`=`adm`));
+
+load  dataset TwitterUsers using localfs ((`path`=`asterix_nc1://data/tinysocial/twu.adm`),(`format`=`adm`));
+
+load  dataset TweetMessages using localfs ((`path`=`asterix_nc1://data/tinysocial/twm.adm`),(`format`=`adm`));
+

http://git-wip-us.apache.org/repos/asf/asterixdb/blob/8671ddf8/asterixdb/asterix-app/src/test/resources/runtimets/queries_sqlpp/global-aggregate/q09/q09.3.query.sqlpp
----------------------------------------------------------------------
diff --git a/asterixdb/asterix-app/src/test/resources/runtimets/queries_sqlpp/global-aggregate/q09/q09.3.query.sqlpp b/asterixdb/asterix-app/src/test/resources/runtimets/queries_sqlpp/global-aggregate/q09/q09.3.query.sqlpp
new file mode 100644
index 0000000..a3b0ce6
--- /dev/null
+++ b/asterixdb/asterix-app/src/test/resources/runtimets/queries_sqlpp/global-aggregate/q09/q09.3.query.sqlpp
@@ -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.
+ */
+
+USE TinySocial;
+
+// Tests the propagation for WITH binding variables in global aggregates.
+WITH t AS 1
+
+SELECT COUNT(1) count, t
+FROM FacebookUsers u;

http://git-wip-us.apache.org/repos/asf/asterixdb/blob/8671ddf8/asterixdb/asterix-app/src/test/resources/runtimets/queries_sqlpp/global-aggregate/q10/q10.1.ddl.sqlpp
----------------------------------------------------------------------
diff --git a/asterixdb/asterix-app/src/test/resources/runtimets/queries_sqlpp/global-aggregate/q10/q10.1.ddl.sqlpp b/asterixdb/asterix-app/src/test/resources/runtimets/queries_sqlpp/global-aggregate/q10/q10.1.ddl.sqlpp
new file mode 100644
index 0000000..f78afef
--- /dev/null
+++ b/asterixdb/asterix-app/src/test/resources/runtimets/queries_sqlpp/global-aggregate/q10/q10.1.ddl.sqlpp
@@ -0,0 +1,51 @@
+/*
+ * 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 TinySocial if exists;
+create  dataverse TinySocial;
+
+use TinySocial;
+
+
+create type TinySocial.TwitterUserType as
+{
+  `screen-name` : string
+}
+
+create type TinySocial.TweetMessageType as {
+  tweetid : string
+}
+
+create type TinySocial.FacebookUserType as
+ open {
+  id : int64
+}
+
+create type TinySocial.FacebookMessageType as
+ open {
+  `message-id` : int64
+}
+
+create  dataset FacebookUsers(FacebookUserType) primary key id;
+create  dataset FacebookMessages(FacebookMessageType) primary key `message-id`;
+create  dataset TwitterUsers(TwitterUserType) primary key `screen-name`;
+create  dataset TweetMessages(TweetMessageType) primary key tweetid hints (`CARDINALITY`=`100`);
+create  index fbUserSinceIdx  on FacebookUsers (`user-since`:datetime) type btree enforced;
+create  index fbAuthorIdx  on FacebookMessages (`author-id`:int64) type btree enforced;
+

http://git-wip-us.apache.org/repos/asf/asterixdb/blob/8671ddf8/asterixdb/asterix-app/src/test/resources/runtimets/queries_sqlpp/global-aggregate/q10/q10.2.update.sqlpp
----------------------------------------------------------------------
diff --git a/asterixdb/asterix-app/src/test/resources/runtimets/queries_sqlpp/global-aggregate/q10/q10.2.update.sqlpp b/asterixdb/asterix-app/src/test/resources/runtimets/queries_sqlpp/global-aggregate/q10/q10.2.update.sqlpp
new file mode 100644
index 0000000..5211fb6
--- /dev/null
+++ b/asterixdb/asterix-app/src/test/resources/runtimets/queries_sqlpp/global-aggregate/q10/q10.2.update.sqlpp
@@ -0,0 +1,30 @@
+/*
+ * 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 TinySocial;
+
+
+load  dataset FacebookUsers using localfs ((`path`=`asterix_nc1://data/tinysocial/fbu.adm`),(`format`=`adm`));
+
+load  dataset FacebookMessages using localfs ((`path`=`asterix_nc1://data/tinysocial/fbm.adm`),(`format`=`adm`));
+
+load  dataset TwitterUsers using localfs ((`path`=`asterix_nc1://data/tinysocial/twu.adm`),(`format`=`adm`));
+
+load  dataset TweetMessages using localfs ((`path`=`asterix_nc1://data/tinysocial/twm.adm`),(`format`=`adm`));
+

http://git-wip-us.apache.org/repos/asf/asterixdb/blob/8671ddf8/asterixdb/asterix-app/src/test/resources/runtimets/queries_sqlpp/global-aggregate/q10/q10.3.query.sqlpp
----------------------------------------------------------------------
diff --git a/asterixdb/asterix-app/src/test/resources/runtimets/queries_sqlpp/global-aggregate/q10/q10.3.query.sqlpp b/asterixdb/asterix-app/src/test/resources/runtimets/queries_sqlpp/global-aggregate/q10/q10.3.query.sqlpp
new file mode 100644
index 0000000..a5fa88c
--- /dev/null
+++ b/asterixdb/asterix-app/src/test/resources/runtimets/queries_sqlpp/global-aggregate/q10/q10.3.query.sqlpp
@@ -0,0 +1,29 @@
+/*
+ * 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 TinySocial;
+
+// Tests the propagation for WITH binding variables for subqueries in global aggregates.
+WITH t AS (
+   SELECT VALUE MIN(v)
+   FROM [1, 2, 3] v
+)[0]
+
+SELECT COUNT(1) count, t
+FROM FacebookUsers u;

http://git-wip-us.apache.org/repos/asf/asterixdb/blob/8671ddf8/asterixdb/asterix-app/src/test/resources/runtimets/queries_sqlpp/group-by/sugar-01-negative/sugar-01-negative.1.ddl.sqlpp
----------------------------------------------------------------------
diff --git a/asterixdb/asterix-app/src/test/resources/runtimets/queries_sqlpp/group-by/sugar-01-negative/sugar-01-negative.1.ddl.sqlpp b/asterixdb/asterix-app/src/test/resources/runtimets/queries_sqlpp/group-by/sugar-01-negative/sugar-01-negative.1.ddl.sqlpp
new file mode 100644
index 0000000..7cb4811
--- /dev/null
+++ b/asterixdb/asterix-app/src/test/resources/runtimets/queries_sqlpp/group-by/sugar-01-negative/sugar-01-negative.1.ddl.sqlpp
@@ -0,0 +1,29 @@
+/*
+ * 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 gby IF EXISTS;
+CREATE DATAVERSE gby;
+
+USE gby;
+
+CREATE TYPE EmpType AS {
+  name : string
+}
+
+CREATE DATASET Employee(EmpType) PRIMARY KEY name;

http://git-wip-us.apache.org/repos/asf/asterixdb/blob/8671ddf8/asterixdb/asterix-app/src/test/resources/runtimets/queries_sqlpp/group-by/sugar-01-negative/sugar-01-negative.2.update.sqlpp
----------------------------------------------------------------------
diff --git a/asterixdb/asterix-app/src/test/resources/runtimets/queries_sqlpp/group-by/sugar-01-negative/sugar-01-negative.2.update.sqlpp b/asterixdb/asterix-app/src/test/resources/runtimets/queries_sqlpp/group-by/sugar-01-negative/sugar-01-negative.2.update.sqlpp
new file mode 100644
index 0000000..99116f6
--- /dev/null
+++ b/asterixdb/asterix-app/src/test/resources/runtimets/queries_sqlpp/group-by/sugar-01-negative/sugar-01-negative.2.update.sqlpp
@@ -0,0 +1,32 @@
+/*
+ * 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 gby;
+
+INSERT INTO Employee (
+  [
+   { 'name': 'Bill',
+     'deptno': 'K55',
+     'salary': 2000 },
+
+   { 'name': 'Fred',
+     'deptno': 'K55',
+     'salary': 3000 }
+  ]
+);
\ No newline at end of file

http://git-wip-us.apache.org/repos/asf/asterixdb/blob/8671ddf8/asterixdb/asterix-app/src/test/resources/runtimets/queries_sqlpp/group-by/sugar-01-negative/sugar-01-negative.3.query.sqlpp
----------------------------------------------------------------------
diff --git a/asterixdb/asterix-app/src/test/resources/runtimets/queries_sqlpp/group-by/sugar-01-negative/sugar-01-negative.3.query.sqlpp b/asterixdb/asterix-app/src/test/resources/runtimets/queries_sqlpp/group-by/sugar-01-negative/sugar-01-negative.3.query.sqlpp
new file mode 100644
index 0000000..e278914
--- /dev/null
+++ b/asterixdb/asterix-app/src/test/resources/runtimets/queries_sqlpp/group-by/sugar-01-negative/sugar-01-negative.3.query.sqlpp
@@ -0,0 +1,27 @@
+/*
+ * 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 gby;
+
+// Tests that a SQL++ core aggregate function, e.g., COLL_AVG,
+// cannot be used like a SQL-92 sugar, e.g., AVG. Its input must be a collection.
+FROM Employee e
+GROUP BY e.deptno AS deptno GROUP AS g
+SELECT deptno AS deptno, COLL_AVG(e.salary) AS avgpay,
+       (SELECT i.e.name AS name, i.e.salary AS salary FROM g AS i) AS workers;

http://git-wip-us.apache.org/repos/asf/asterixdb/blob/8671ddf8/asterixdb/asterix-app/src/test/resources/runtimets/queries_sqlpp/group-by/sugar-01/sugar-01.3.query.sqlpp
----------------------------------------------------------------------
diff --git a/asterixdb/asterix-app/src/test/resources/runtimets/queries_sqlpp/group-by/sugar-01/sugar-01.3.query.sqlpp b/asterixdb/asterix-app/src/test/resources/runtimets/queries_sqlpp/group-by/sugar-01/sugar-01.3.query.sqlpp
index c695e87..9ac8546 100644
--- a/asterixdb/asterix-app/src/test/resources/runtimets/queries_sqlpp/group-by/sugar-01/sugar-01.3.query.sqlpp
+++ b/asterixdb/asterix-app/src/test/resources/runtimets/queries_sqlpp/group-by/sugar-01/sugar-01.3.query.sqlpp
@@ -22,5 +22,5 @@ USE gby;
 
 FROM Employee e
 GROUP BY e.deptno AS deptno GROUP AS g
-SELECT deptno AS deptno, coll_avg(e.salary) AS avgpay,
+SELECT deptno AS deptno, AVG(e.salary) AS avgpay,
        (SELECT i.e.name AS name, i.e.salary AS salary FROM g AS i) AS workers;

http://git-wip-us.apache.org/repos/asf/asterixdb/blob/8671ddf8/asterixdb/asterix-app/src/test/resources/runtimets/queries_sqlpp/group-by/sugar-02/sugar-02.4.query.sqlpp
----------------------------------------------------------------------
diff --git a/asterixdb/asterix-app/src/test/resources/runtimets/queries_sqlpp/group-by/sugar-02/sugar-02.4.query.sqlpp b/asterixdb/asterix-app/src/test/resources/runtimets/queries_sqlpp/group-by/sugar-02/sugar-02.4.query.sqlpp
index c86cd18..e526091 100644
--- a/asterixdb/asterix-app/src/test/resources/runtimets/queries_sqlpp/group-by/sugar-02/sugar-02.4.query.sqlpp
+++ b/asterixdb/asterix-app/src/test/resources/runtimets/queries_sqlpp/group-by/sugar-02/sugar-02.4.query.sqlpp
@@ -26,6 +26,6 @@ FROM Employee e
     JOIN SuperStars s ON e.id = s.id
 GROUP BY deptId
 HAVING deptId = 'K55'
-SELECT e.department_id AS deptId, coll_sum(e.salary + i.bonus) AS star_cost
+SELECT e.department_id AS deptId, SUM(e.salary + i.bonus) AS star_cost
 ORDER BY deptId;
 

http://git-wip-us.apache.org/repos/asf/asterixdb/blob/8671ddf8/asterixdb/asterix-app/src/test/resources/runtimets/queries_sqlpp/group-by/sugar-03/sugar-03.3.query.sqlpp
----------------------------------------------------------------------
diff --git a/asterixdb/asterix-app/src/test/resources/runtimets/queries_sqlpp/group-by/sugar-03/sugar-03.3.query.sqlpp b/asterixdb/asterix-app/src/test/resources/runtimets/queries_sqlpp/group-by/sugar-03/sugar-03.3.query.sqlpp
index c747382..4832b22 100644
--- a/asterixdb/asterix-app/src/test/resources/runtimets/queries_sqlpp/group-by/sugar-03/sugar-03.3.query.sqlpp
+++ b/asterixdb/asterix-app/src/test/resources/runtimets/queries_sqlpp/group-by/sugar-03/sugar-03.3.query.sqlpp
@@ -24,7 +24,7 @@ FROM Employee e
     JOIN SuperStars s ON e.id = s.id
 GROUP BY e.department_id AS deptId GROUP AS eis
 SELECT deptId as deptId,
-    coll_avg(e.salary + i.bonus) AS avgpay,
+    AVG(e.salary + i.bonus) AS avgpay,
     (FROM eis AS v
          SELECT v.e.id AS id, v.e.salary AS salary, v.i.bonus AS bonus
          ORDER BY v.i.bonus DESC LIMIT 3

http://git-wip-us.apache.org/repos/asf/asterixdb/blob/8671ddf8/asterixdb/asterix-app/src/test/resources/runtimets/queries_sqlpp/group-by/sugar-05/sugar-05.3.query.sqlpp
----------------------------------------------------------------------
diff --git a/asterixdb/asterix-app/src/test/resources/runtimets/queries_sqlpp/group-by/sugar-05/sugar-05.3.query.sqlpp b/asterixdb/asterix-app/src/test/resources/runtimets/queries_sqlpp/group-by/sugar-05/sugar-05.3.query.sqlpp
index 45c3528..37cf60c 100644
--- a/asterixdb/asterix-app/src/test/resources/runtimets/queries_sqlpp/group-by/sugar-05/sugar-05.3.query.sqlpp
+++ b/asterixdb/asterix-app/src/test/resources/runtimets/queries_sqlpp/group-by/sugar-05/sugar-05.3.query.sqlpp
@@ -25,7 +25,7 @@ SELECT ELEMENT {
             FROM Car c JOIN Tire t ON c.tire_size = t.size
             GROUP BY c.tire_size AS tire_size GROUP AS g
             SELECT tire_size AS tire_size,
-                   coll_avg(c.price + 4 * t.price) AS avg_total_price,
+                   AVG(c.price + 4 * t.price) AS avg_total_price,
                    ( FROM g AS g
                      SELECT g.c.make AS make,
                             g.c.model AS model,

http://git-wip-us.apache.org/repos/asf/asterixdb/blob/8671ddf8/asterixdb/asterix-app/src/test/resources/runtimets/queries_sqlpp/misc/query-ASTERIXDB-971/query-ASTERIXDB-971.1.ddl.sqlpp
----------------------------------------------------------------------
diff --git a/asterixdb/asterix-app/src/test/resources/runtimets/queries_sqlpp/misc/query-ASTERIXDB-971/query-ASTERIXDB-971.1.ddl.sqlpp b/asterixdb/asterix-app/src/test/resources/runtimets/queries_sqlpp/misc/query-ASTERIXDB-971/query-ASTERIXDB-971.1.ddl.sqlpp
new file mode 100644
index 0000000..82f182e
--- /dev/null
+++ b/asterixdb/asterix-app/src/test/resources/runtimets/queries_sqlpp/misc/query-ASTERIXDB-971/query-ASTERIXDB-971.1.ddl.sqlpp
@@ -0,0 +1,28 @@
+/*
+ * 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 test;
+
+create type account as open
+{ id: int32, sum:int32 }
+
+create dataset Accounts(account) primary key id;
+

http://git-wip-us.apache.org/repos/asf/asterixdb/blob/8671ddf8/asterixdb/asterix-app/src/test/resources/runtimets/queries_sqlpp/misc/query-ASTERIXDB-971/query-ASTERIXDB-971.2.update.sqlpp
----------------------------------------------------------------------
diff --git a/asterixdb/asterix-app/src/test/resources/runtimets/queries_sqlpp/misc/query-ASTERIXDB-971/query-ASTERIXDB-971.2.update.sqlpp b/asterixdb/asterix-app/src/test/resources/runtimets/queries_sqlpp/misc/query-ASTERIXDB-971/query-ASTERIXDB-971.2.update.sqlpp
new file mode 100644
index 0000000..3af2128
--- /dev/null
+++ b/asterixdb/asterix-app/src/test/resources/runtimets/queries_sqlpp/misc/query-ASTERIXDB-971/query-ASTERIXDB-971.2.update.sqlpp
@@ -0,0 +1,27 @@
+/*
+ * 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 test;
+
+insert into Accounts(
+{"id": 1, "sum":100}
+)
+insert into Accounts(
+{"id": 2, "sum":150}
+)

http://git-wip-us.apache.org/repos/asf/asterixdb/blob/8671ddf8/asterixdb/asterix-app/src/test/resources/runtimets/queries_sqlpp/misc/query-ASTERIXDB-971/query-ASTERIXDB-971.3.query.sqlpp
----------------------------------------------------------------------
diff --git a/asterixdb/asterix-app/src/test/resources/runtimets/queries_sqlpp/misc/query-ASTERIXDB-971/query-ASTERIXDB-971.3.query.sqlpp b/asterixdb/asterix-app/src/test/resources/runtimets/queries_sqlpp/misc/query-ASTERIXDB-971/query-ASTERIXDB-971.3.query.sqlpp
new file mode 100644
index 0000000..6856726
--- /dev/null
+++ b/asterixdb/asterix-app/src/test/resources/runtimets/queries_sqlpp/misc/query-ASTERIXDB-971/query-ASTERIXDB-971.3.query.sqlpp
@@ -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.
+ */
+
+USE test;
+
+FROM range(1,2) AS x
+SELECT ELEMENT (
+    WITH z AS (FROM Accounts AS y WHERE y.id=x SELECT VALUE y)
+    SELECT x, z
+);

http://git-wip-us.apache.org/repos/asf/asterixdb/blob/8671ddf8/asterixdb/asterix-app/src/test/resources/runtimets/queries_sqlpp/subquery/exists/exists.3.query.sqlpp
----------------------------------------------------------------------
diff --git a/asterixdb/asterix-app/src/test/resources/runtimets/queries_sqlpp/subquery/exists/exists.3.query.sqlpp b/asterixdb/asterix-app/src/test/resources/runtimets/queries_sqlpp/subquery/exists/exists.3.query.sqlpp
index 8f89da4..e7328f3 100644
--- a/asterixdb/asterix-app/src/test/resources/runtimets/queries_sqlpp/subquery/exists/exists.3.query.sqlpp
+++ b/asterixdb/asterix-app/src/test/resources/runtimets/queries_sqlpp/subquery/exists/exists.3.query.sqlpp
@@ -23,14 +23,13 @@ WITH q22_customer_tmp AS
 (
     SELECT c_acctbal, c_custkey, substring(c_phone,1,2) AS cntrycode
     FROM  Customer
-)
-,
+),
 avg AS (
         SELECT ELEMENT AVG(c_acctbal)
         FROM  Customer
         WHERE c_acctbal > 0.0
 )[0]
-SELECT  cntrycode, count(ct) AS numcust, SUM(c_acctbal) AS totacctbal
+SELECT cntrycode, count(ct) AS numcust, SUM(c_acctbal) AS totacctbal
 FROM  q22_customer_tmp AS ct
 WHERE c_acctbal > avg
       AND EXISTS (SELECT * FROM Orders o WHERE o.o_custkey = ct.c_custkey)

http://git-wip-us.apache.org/repos/asf/asterixdb/blob/8671ddf8/asterixdb/asterix-app/src/test/resources/runtimets/queries_sqlpp/tpch-sql-like/q14_promotion_effect/q14_promotion_effect.3.query.sqlpp
----------------------------------------------------------------------
diff --git a/asterixdb/asterix-app/src/test/resources/runtimets/queries_sqlpp/tpch-sql-like/q14_promotion_effect/q14_promotion_effect.3.query.sqlpp b/asterixdb/asterix-app/src/test/resources/runtimets/queries_sqlpp/tpch-sql-like/q14_promotion_effect/q14_promotion_effect.3.query.sqlpp
index 7a14b25..445da07 100644
--- a/asterixdb/asterix-app/src/test/resources/runtimets/queries_sqlpp/tpch-sql-like/q14_promotion_effect/q14_promotion_effect.3.query.sqlpp
+++ b/asterixdb/asterix-app/src/test/resources/runtimets/queries_sqlpp/tpch-sql-like/q14_promotion_effect/q14_promotion_effect.3.query.sqlpp
@@ -34,5 +34,5 @@ from  LineItem as l,
       Part as p
 let lp = {'p_type': p.p_type, 'l_extendedprice': l.l_extendedprice, 'l_discount': l.l_discount}
 where ((l.l_partkey = p.p_partkey) and (l.l_shipdate >= '1995-09-01') and (l.l_shipdate < '1995-10-01'))
-group by 1 as t
+group by 1 as t group as g(lp as lp)
 ;

http://git-wip-us.apache.org/repos/asf/asterixdb/blob/8671ddf8/asterixdb/asterix-app/src/test/resources/runtimets/queries_sqlpp/tpch-with-index/q14_promotion_effect/q14_promotion_effect.3.query.sqlpp
----------------------------------------------------------------------
diff --git a/asterixdb/asterix-app/src/test/resources/runtimets/queries_sqlpp/tpch-with-index/q14_promotion_effect/q14_promotion_effect.3.query.sqlpp b/asterixdb/asterix-app/src/test/resources/runtimets/queries_sqlpp/tpch-with-index/q14_promotion_effect/q14_promotion_effect.3.query.sqlpp
index 5de0352..c20b6ae 100644
--- a/asterixdb/asterix-app/src/test/resources/runtimets/queries_sqlpp/tpch-with-index/q14_promotion_effect/q14_promotion_effect.3.query.sqlpp
+++ b/asterixdb/asterix-app/src/test/resources/runtimets/queries_sqlpp/tpch-with-index/q14_promotion_effect/q14_promotion_effect.3.query.sqlpp
@@ -34,5 +34,5 @@ from  LineItem as l,
       Part as p
 let lp = {'p_type': p.p_type, 'l_extendedprice': l.l_extendedprice, 'l_discount': l.l_discount}
 where ((l.l_partkey = p.p_partkey) and (l.l_shipdate >= '1995-09-01') and (l.l_shipdate < '1995-10-01'))
-group by 1 as t
+group by 1 as t group as g(lp as lp)
 ;

http://git-wip-us.apache.org/repos/asf/asterixdb/blob/8671ddf8/asterixdb/asterix-app/src/test/resources/runtimets/queries_sqlpp/tpch/q14_promotion_effect/q14_promotion_effect.3.query.sqlpp
----------------------------------------------------------------------
diff --git a/asterixdb/asterix-app/src/test/resources/runtimets/queries_sqlpp/tpch/q14_promotion_effect/q14_promotion_effect.3.query.sqlpp b/asterixdb/asterix-app/src/test/resources/runtimets/queries_sqlpp/tpch/q14_promotion_effect/q14_promotion_effect.3.query.sqlpp
index 32ab76a..89ade9d 100644
--- a/asterixdb/asterix-app/src/test/resources/runtimets/queries_sqlpp/tpch/q14_promotion_effect/q14_promotion_effect.3.query.sqlpp
+++ b/asterixdb/asterix-app/src/test/resources/runtimets/queries_sqlpp/tpch/q14_promotion_effect/q14_promotion_effect.3.query.sqlpp
@@ -32,4 +32,4 @@ from  LineItem as l,
 let lp = {'p_type': p.p_type, 'l_extendedprice': l.l_extendedprice, 'l_discount': l.l_discount}
 where ((l.l_partkey = p.p_partkey) and (l.l_shipdate >= '1995-09-01') and (l.l_shipdate < '1995-10-01'))
 group by 1 as t
-;
+group as g(lp as lp);

http://git-wip-us.apache.org/repos/asf/asterixdb/blob/8671ddf8/asterixdb/asterix-app/src/test/resources/runtimets/results/dapd/q2-12/q2-12.1.adm
----------------------------------------------------------------------
diff --git a/asterixdb/asterix-app/src/test/resources/runtimets/results/dapd/q2-12/q2-12.1.adm b/asterixdb/asterix-app/src/test/resources/runtimets/results/dapd/q2-12/q2-12.1.adm
new file mode 100644
index 0000000..f845003
--- /dev/null
+++ b/asterixdb/asterix-app/src/test/resources/runtimets/results/dapd/q2-12/q2-12.1.adm
@@ -0,0 +1,2 @@
+{ "sig_id": 14, "total_count": 3, "chapter_breakdown": [ { "sig_id": 14, "$1": 3 } ] }
+{ "sig_id": 31, "total_count": 1, "chapter_breakdown": [ { "sig_id": 31, "$1": 1 } ] }

http://git-wip-us.apache.org/repos/asf/asterixdb/blob/8671ddf8/asterixdb/asterix-app/src/test/resources/runtimets/results/dapd/q2-7/q2-7.1.adm
----------------------------------------------------------------------
diff --git a/asterixdb/asterix-app/src/test/resources/runtimets/results/dapd/q2-7/q2-7.1.adm b/asterixdb/asterix-app/src/test/resources/runtimets/results/dapd/q2-7/q2-7.1.adm
new file mode 100644
index 0000000..5839a99
--- /dev/null
+++ b/asterixdb/asterix-app/src/test/resources/runtimets/results/dapd/q2-7/q2-7.1.adm
@@ -0,0 +1,2 @@
+{ "sig_id": 14, "total_count": 3, "chapter_breakdown": [ { "chapter_name": "Laguna Beach", "$2": [ { "e": { "Event": { "event_id": 1023, "name": "Art Opening: Southern Orange County Beaches", "organizers": {{ { "name": "Jane Smith" } }}, "sponsoring_sigs": [ { "sig_id": 14, "chapter_name": "San Clemente" }, { "sig_id": 14, "chapter_name": "Laguna Beach" } ], "interest_keywords": {{ "art", "landscape", "nature", "vernissage" }}, "start_time": datetime("2011-02-24T02:00:00.000Z"), "end_time": datetime("2011-02-24T05:00:00.000Z") }, "sponsor": { "sig_id": 14, "chapter_name": "Laguna Beach" } } }, { "e": { "Event": { "event_id": 1042, "name": "Orange County Landmarks", "organizers": {{ { "name": "John Smith" } }}, "sponsoring_sigs": [ { "sig_id": 14, "chapter_name": "Laguna Beach" } ], "interest_keywords": {{ "architecture", "photography" }}, "price": 10.0, "start_time": datetime("2011-02-24T01:00:00.000Z"), "end_time": datetime("2011-02-24T03:00:00.000Z") }, "sponsor": { "sig_id": 14, 
 "chapter_name": "Laguna Beach" } } } ] }, { "chapter_name": "San Clemente", "$2": [ { "e": { "Event": { "event_id": 1023, "name": "Art Opening: Southern Orange County Beaches", "organizers": {{ { "name": "Jane Smith" } }}, "sponsoring_sigs": [ { "sig_id": 14, "chapter_name": "San Clemente" }, { "sig_id": 14, "chapter_name": "Laguna Beach" } ], "interest_keywords": {{ "art", "landscape", "nature", "vernissage" }}, "start_time": datetime("2011-02-24T02:00:00.000Z"), "end_time": datetime("2011-02-24T05:00:00.000Z") }, "sponsor": { "sig_id": 14, "chapter_name": "San Clemente" } } } ] } ] }
+{ "sig_id": 31, "total_count": 1, "chapter_breakdown": [ { "chapter_name": "Huntington Beach", "$2": [ { "e": { "Event": { "event_id": 941, "name": "Intro to Scuba Diving", "organizers": {{ { "name": "Joseph Surfer", "affiliation": "Huntington Beach Scuba Assoc." } }}, "sponsoring_sigs": [ { "sig_id": 31, "chapter_name": "Huntington Beach" } ], "interest_keywords": {{ "scuba", "diving", "aquatics" }}, "price": 40.0, "start_time": datetime("2010-10-16T17:00:00.000Z"), "end_time": datetime("2010-10-16T20:00:00.000Z") }, "sponsor": { "sig_id": 31, "chapter_name": "Huntington Beach" } } } ] } ] }

http://git-wip-us.apache.org/repos/asf/asterixdb/blob/8671ddf8/asterixdb/asterix-app/src/test/resources/runtimets/results/dapd/q2-9/q2-9.1.adm
----------------------------------------------------------------------
diff --git a/asterixdb/asterix-app/src/test/resources/runtimets/results/dapd/q2-9/q2-9.1.adm b/asterixdb/asterix-app/src/test/resources/runtimets/results/dapd/q2-9/q2-9.1.adm
new file mode 100644
index 0000000..9f5968c
--- /dev/null
+++ b/asterixdb/asterix-app/src/test/resources/runtimets/results/dapd/q2-9/q2-9.1.adm
@@ -0,0 +1,2 @@
+{ "sig_id": 14, "total_count": 3, "chapter_breakdown": [ { "sig_id": 14, "chapter_name": "Laguna Beach", "escount": 2 }, { "sig_id": 14, "chapter_name": "San Clemente", "escount": 1 } ] }
+{ "sig_id": 31, "total_count": 1, "chapter_breakdown": [ { "sig_id": 31, "chapter_name": "Huntington Beach", "escount": 1 } ] }

http://git-wip-us.apache.org/repos/asf/asterixdb/blob/8671ddf8/asterixdb/asterix-app/src/test/resources/runtimets/results/global-aggregate/q09/q09.1.adm
----------------------------------------------------------------------
diff --git a/asterixdb/asterix-app/src/test/resources/runtimets/results/global-aggregate/q09/q09.1.adm b/asterixdb/asterix-app/src/test/resources/runtimets/results/global-aggregate/q09/q09.1.adm
new file mode 100644
index 0000000..17e22f6
--- /dev/null
+++ b/asterixdb/asterix-app/src/test/resources/runtimets/results/global-aggregate/q09/q09.1.adm
@@ -0,0 +1 @@
+{ "count": 10, "t": 1 }

http://git-wip-us.apache.org/repos/asf/asterixdb/blob/8671ddf8/asterixdb/asterix-app/src/test/resources/runtimets/results/misc/query-ASTERIXDB-971-aql/query-ASTERIXDB-971-aql.1.adm
----------------------------------------------------------------------
diff --git a/asterixdb/asterix-app/src/test/resources/runtimets/results/misc/query-ASTERIXDB-971-aql/query-ASTERIXDB-971-aql.1.adm b/asterixdb/asterix-app/src/test/resources/runtimets/results/misc/query-ASTERIXDB-971-aql/query-ASTERIXDB-971-aql.1.adm
new file mode 100644
index 0000000..c828226
--- /dev/null
+++ b/asterixdb/asterix-app/src/test/resources/runtimets/results/misc/query-ASTERIXDB-971-aql/query-ASTERIXDB-971-aql.1.adm
@@ -0,0 +1,2 @@
+{ "x": 1, "z": [ { "id": 1, "sum": 100 } ] }
+{ "x": 2, "z": [ { "id": 2, "sum": 150 } ] }

http://git-wip-us.apache.org/repos/asf/asterixdb/blob/8671ddf8/asterixdb/asterix-app/src/test/resources/runtimets/results/misc/query-ASTERIXDB-971-sqlpp/query-ASTERIXDB-971-sqlpp.1.adm
----------------------------------------------------------------------
diff --git a/asterixdb/asterix-app/src/test/resources/runtimets/results/misc/query-ASTERIXDB-971-sqlpp/query-ASTERIXDB-971-sqlpp.1.adm b/asterixdb/asterix-app/src/test/resources/runtimets/results/misc/query-ASTERIXDB-971-sqlpp/query-ASTERIXDB-971-sqlpp.1.adm
new file mode 100644
index 0000000..6ec06aa
--- /dev/null
+++ b/asterixdb/asterix-app/src/test/resources/runtimets/results/misc/query-ASTERIXDB-971-sqlpp/query-ASTERIXDB-971-sqlpp.1.adm
@@ -0,0 +1,2 @@
+[ { "x": 1, "z": [ { "id": 1, "sum": 100 } ] } ]
+[ { "x": 2, "z": [ { "id": 2, "sum": 150 } ] } ]

http://git-wip-us.apache.org/repos/asf/asterixdb/blob/8671ddf8/asterixdb/asterix-app/src/test/resources/runtimets/results_parser_sqlpp/dapd/q2/q2.3.ast
----------------------------------------------------------------------
diff --git a/asterixdb/asterix-app/src/test/resources/runtimets/results_parser_sqlpp/dapd/q2/q2.3.ast b/asterixdb/asterix-app/src/test/resources/runtimets/results_parser_sqlpp/dapd/q2/q2.3.ast
index f8a709b..06b8dff 100644
--- a/asterixdb/asterix-app/src/test/resources/runtimets/results_parser_sqlpp/dapd/q2/q2.3.ast
+++ b/asterixdb/asterix-app/src/test/resources/runtimets/results_parser_sqlpp/dapd/q2/q2.3.ast
@@ -30,20 +30,6 @@ FROM [  FunctionCall Metadata.dataset@1[
   ]
   AS Variable [ Name=$sponsor ]
 ]
-Let Variable [ Name=$es ]
-  :=
-  RecordConstructor [
-    (
-      LiteralExpr [STRING] [event]
-      :
-      Variable [ Name=$event ]
-    )
-    (
-      LiteralExpr [STRING] [sponsor]
-      :
-      Variable [ Name=$sponsor ]
-    )
-  ]
 Groupby
   Variable [ Name=$sig_id ]
   :=
@@ -51,11 +37,10 @@ Groupby
     Variable [ Name=$sponsor ]
     Field=sig_id
   ]
-  GROUP AS Variable [ Name=#1 ]
+  GROUP AS Variable [ Name=$es ]
   (
-    es:=Variable [ Name=$es ]
-    sponsor:=Variable [ Name=$sponsor ]
     event:=Variable [ Name=$event ]
+    sponsor:=Variable [ Name=$sponsor ]
   )
 
 Let Variable [ Name=$sig_sponsorship_count ]
@@ -63,13 +48,10 @@ Let Variable [ Name=$sig_sponsorship_count ]
   FunctionCall test.sql-count@1[
     (
       SELECT ELEMENT [
-      FieldAccessor [
-        Variable [ Name=#2 ]
-        Field=es
-      ]
+      LiteralExpr [LONG] [1]
       ]
-      FROM [        Variable [ Name=#1 ]
-        AS Variable [ Name=#2 ]
+      FROM [        Variable [ Name=$es ]
+        AS Variable [ Name=#1 ]
       ]
     )
   ]
@@ -90,12 +72,12 @@ Let Variable [ Name=$by_chapter ]
           (
             SELECT ELEMENT [
             FieldAccessor [
-              Variable [ Name=#4 ]
+              Variable [ Name=#3 ]
               Field=e
             ]
             ]
-            FROM [              Variable [ Name=#3 ]
-              AS Variable [ Name=#4 ]
+            FROM [              Variable [ Name=#2 ]
+              AS Variable [ Name=#3 ]
             ]
           )
         ]
@@ -115,15 +97,9 @@ Let Variable [ Name=$by_chapter ]
         ]
         Field=chapter_name
       ]
-      GROUP AS Variable [ Name=#3 ]
+      GROUP AS Variable [ Name=#2 ]
       (
         e:=Variable [ Name=$e ]
-        sig_sponsorship_count:=Variable [ Name=$sig_sponsorship_count ]
-        es:=Variable [ Name=$es ]
-        event:=Variable [ Name=$event ]
-        sponsor:=Variable [ Name=$sponsor ]
-        sig_id:=Variable [ Name=$sig_id ]
-        #1:=Variable [ Name=#1 ]
       )
 
   )

http://git-wip-us.apache.org/repos/asf/asterixdb/blob/8671ddf8/asterixdb/asterix-app/src/test/resources/runtimets/results_parser_sqlpp/flwor/at02/at02.3.ast
----------------------------------------------------------------------
diff --git a/asterixdb/asterix-app/src/test/resources/runtimets/results_parser_sqlpp/flwor/at02/at02.3.ast b/asterixdb/asterix-app/src/test/resources/runtimets/results_parser_sqlpp/flwor/at02/at02.3.ast
index afd1f81..755ff18 100644
--- a/asterixdb/asterix-app/src/test/resources/runtimets/results_parser_sqlpp/flwor/at02/at02.3.ast
+++ b/asterixdb/asterix-app/src/test/resources/runtimets/results_parser_sqlpp/flwor/at02/at02.3.ast
@@ -82,8 +82,8 @@ Groupby
   ]
   GROUP AS Variable [ Name=#1 ]
   (
-    m:=Variable [ Name=$m ]
     u:=Variable [ Name=$u ]
+    m:=Variable [ Name=$m ]
   )
 
 Orderby

http://git-wip-us.apache.org/repos/asf/asterixdb/blob/8671ddf8/asterixdb/asterix-app/src/test/resources/runtimets/results_parser_sqlpp/flwor/query-issue550/query-issue550.3.ast
----------------------------------------------------------------------
diff --git a/asterixdb/asterix-app/src/test/resources/runtimets/results_parser_sqlpp/flwor/query-issue550/query-issue550.3.ast b/asterixdb/asterix-app/src/test/resources/runtimets/results_parser_sqlpp/flwor/query-issue550/query-issue550.3.ast
index f8988ad..e5a516d 100644
--- a/asterixdb/asterix-app/src/test/resources/runtimets/results_parser_sqlpp/flwor/query-issue550/query-issue550.3.ast
+++ b/asterixdb/asterix-app/src/test/resources/runtimets/results_parser_sqlpp/flwor/query-issue550/query-issue550.3.ast
@@ -181,6 +181,5 @@ Groupby
   GROUP AS Variable [ Name=#1 ]
   (
     s:=Variable [ Name=$s ]
-    sample:=Variable [ Name=$sample ]
   )
 

http://git-wip-us.apache.org/repos/asf/asterixdb/blob/8671ddf8/asterixdb/asterix-app/src/test/resources/runtimets/results_parser_sqlpp/fuzzyjoin/dblp-1_1/dblp-1_1.3.ast
----------------------------------------------------------------------
diff --git a/asterixdb/asterix-app/src/test/resources/runtimets/results_parser_sqlpp/fuzzyjoin/dblp-1_1/dblp-1_1.3.ast b/asterixdb/asterix-app/src/test/resources/runtimets/results_parser_sqlpp/fuzzyjoin/dblp-1_1/dblp-1_1.3.ast
index 884a1aa..165a711 100644
--- a/asterixdb/asterix-app/src/test/resources/runtimets/results_parser_sqlpp/fuzzyjoin/dblp-1_1/dblp-1_1.3.ast
+++ b/asterixdb/asterix-app/src/test/resources/runtimets/results_parser_sqlpp/fuzzyjoin/dblp-1_1/dblp-1_1.3.ast
@@ -23,8 +23,8 @@ Groupby
   Variable [ Name=$token ]
   GROUP AS Variable [ Name=#1 ]
   (
-    token:=Variable [ Name=$token ]
     paper:=Variable [ Name=$paper ]
+    token:=Variable [ Name=$token ]
   )
 
 Orderby

http://git-wip-us.apache.org/repos/asf/asterixdb/blob/8671ddf8/asterixdb/asterix-app/src/test/resources/runtimets/results_parser_sqlpp/fuzzyjoin/dblp-1_2.1.1/dblp-1_2.3.ast
----------------------------------------------------------------------
diff --git a/asterixdb/asterix-app/src/test/resources/runtimets/results_parser_sqlpp/fuzzyjoin/dblp-1_2.1.1/dblp-1_2.3.ast b/asterixdb/asterix-app/src/test/resources/runtimets/results_parser_sqlpp/fuzzyjoin/dblp-1_2.1.1/dblp-1_2.3.ast
index 0279463..1d14a93 100644
--- a/asterixdb/asterix-app/src/test/resources/runtimets/results_parser_sqlpp/fuzzyjoin/dblp-1_2.1.1/dblp-1_2.3.ast
+++ b/asterixdb/asterix-app/src/test/resources/runtimets/results_parser_sqlpp/fuzzyjoin/dblp-1_2.1.1/dblp-1_2.3.ast
@@ -29,18 +29,16 @@ Groupby
   Variable [ Name=$token ]
   GROUP AS Variable [ Name=#1 ]
   (
-    id:=Variable [ Name=$id ]
-    token:=Variable [ Name=$token ]
     paper:=Variable [ Name=$paper ]
+    token:=Variable [ Name=$token ]
   )
 
 Orderby
   FunctionCall fuzzyjoin.sql-count@1[
     (
       SELECT ELEMENT [
-      FieldAccessor [
-        Variable [ Name=#2 ]
-        Field=id
+      FunctionCall Metadata.dataset@1[
+        LiteralExpr [STRING] [id]
       ]
       ]
       FROM [        Variable [ Name=#1 ]

http://git-wip-us.apache.org/repos/asf/asterixdb/blob/8671ddf8/asterixdb/asterix-app/src/test/resources/runtimets/results_parser_sqlpp/fuzzyjoin/dblp-1_2.1/dblp-1_2.3.ast
----------------------------------------------------------------------
diff --git a/asterixdb/asterix-app/src/test/resources/runtimets/results_parser_sqlpp/fuzzyjoin/dblp-1_2.1/dblp-1_2.3.ast b/asterixdb/asterix-app/src/test/resources/runtimets/results_parser_sqlpp/fuzzyjoin/dblp-1_2.1/dblp-1_2.3.ast
index 0279463..1d14a93 100644
--- a/asterixdb/asterix-app/src/test/resources/runtimets/results_parser_sqlpp/fuzzyjoin/dblp-1_2.1/dblp-1_2.3.ast
+++ b/asterixdb/asterix-app/src/test/resources/runtimets/results_parser_sqlpp/fuzzyjoin/dblp-1_2.1/dblp-1_2.3.ast
@@ -29,18 +29,16 @@ Groupby
   Variable [ Name=$token ]
   GROUP AS Variable [ Name=#1 ]
   (
-    id:=Variable [ Name=$id ]
-    token:=Variable [ Name=$token ]
     paper:=Variable [ Name=$paper ]
+    token:=Variable [ Name=$token ]
   )
 
 Orderby
   FunctionCall fuzzyjoin.sql-count@1[
     (
       SELECT ELEMENT [
-      FieldAccessor [
-        Variable [ Name=#2 ]
-        Field=id
+      FunctionCall Metadata.dataset@1[
+        LiteralExpr [STRING] [id]
       ]
       ]
       FROM [        Variable [ Name=#1 ]

http://git-wip-us.apache.org/repos/asf/asterixdb/blob/8671ddf8/asterixdb/asterix-app/src/test/resources/runtimets/results_parser_sqlpp/fuzzyjoin/dblp-1_2/dblp-1_2.3.ast
----------------------------------------------------------------------
diff --git a/asterixdb/asterix-app/src/test/resources/runtimets/results_parser_sqlpp/fuzzyjoin/dblp-1_2/dblp-1_2.3.ast b/asterixdb/asterix-app/src/test/resources/runtimets/results_parser_sqlpp/fuzzyjoin/dblp-1_2/dblp-1_2.3.ast
index 37f1f7c..7306e80 100644
--- a/asterixdb/asterix-app/src/test/resources/runtimets/results_parser_sqlpp/fuzzyjoin/dblp-1_2/dblp-1_2.3.ast
+++ b/asterixdb/asterix-app/src/test/resources/runtimets/results_parser_sqlpp/fuzzyjoin/dblp-1_2/dblp-1_2.3.ast
@@ -29,18 +29,16 @@ Groupby
   Variable [ Name=$token ]
   GROUP AS Variable [ Name=#1 ]
   (
-    paperid:=Variable [ Name=$paperid ]
-    token:=Variable [ Name=$token ]
     paper:=Variable [ Name=$paper ]
+    token:=Variable [ Name=$token ]
   )
 
 Orderby
   FunctionCall fuzzyjoin.sql-count@1[
     (
       SELECT ELEMENT [
-      FieldAccessor [
-        Variable [ Name=#2 ]
-        Field=paperid
+      FunctionCall Metadata.dataset@1[
+        LiteralExpr [STRING] [paperid]
       ]
       ]
       FROM [        Variable [ Name=#1 ]

http://git-wip-us.apache.org/repos/asf/asterixdb/blob/8671ddf8/asterixdb/asterix-app/src/test/resources/runtimets/results_parser_sqlpp/fuzzyjoin/dblp-2.1_5.3.1/dblp-2.3.ast
----------------------------------------------------------------------
diff --git a/asterixdb/asterix-app/src/test/resources/runtimets/results_parser_sqlpp/fuzzyjoin/dblp-2.1_5.3.1/dblp-2.3.ast b/asterixdb/asterix-app/src/test/resources/runtimets/results_parser_sqlpp/fuzzyjoin/dblp-2.1_5.3.1/dblp-2.3.ast
index 378d301..fb7aaec 100644
--- a/asterixdb/asterix-app/src/test/resources/runtimets/results_parser_sqlpp/fuzzyjoin/dblp-2.1_5.3.1/dblp-2.3.ast
+++ b/asterixdb/asterix-app/src/test/resources/runtimets/results_parser_sqlpp/fuzzyjoin/dblp-2.1_5.3.1/dblp-2.3.ast
@@ -96,24 +96,16 @@ Let Variable [ Name=$tokensDBLP ]
           Variable [ Name=$token ]
           GROUP AS Variable [ Name=#1 ]
           (
-            id:=Variable [ Name=$id ]
-            token:=Variable [ Name=$token ]
             paper:=Variable [ Name=$paper ]
-            tokenUnranked:=Variable [ Name=$tokenUnranked ]
-            lenDBLP:=Variable [ Name=$lenDBLP ]
-            tokensUnrankedDBLP:=Variable [ Name=$tokensUnrankedDBLP ]
-            idDBLP:=Variable [ Name=$idDBLP ]
-            prefixTokenDBLP:=Variable [ Name=$prefixTokenDBLP ]
-            paperDBLP:=Variable [ Name=$paperDBLP ]
+            token:=Variable [ Name=$token ]
           )
 
         Orderby
           FunctionCall fuzzyjoin.sql-count@1[
             (
               SELECT ELEMENT [
-              FieldAccessor [
-                Variable [ Name=#2 ]
-                Field=id
+              FunctionCall Metadata.dataset@1[
+                LiteralExpr [STRING] [id]
               ]
               ]
               FROM [                Variable [ Name=#1 ]

http://git-wip-us.apache.org/repos/asf/asterixdb/blob/8671ddf8/asterixdb/asterix-app/src/test/resources/runtimets/results_parser_sqlpp/fuzzyjoin/dblp-2_1/dblp-2_1.3.ast
----------------------------------------------------------------------
diff --git a/asterixdb/asterix-app/src/test/resources/runtimets/results_parser_sqlpp/fuzzyjoin/dblp-2_1/dblp-2_1.3.ast b/asterixdb/asterix-app/src/test/resources/runtimets/results_parser_sqlpp/fuzzyjoin/dblp-2_1/dblp-2_1.3.ast
index d77ee91..172b607 100644
--- a/asterixdb/asterix-app/src/test/resources/runtimets/results_parser_sqlpp/fuzzyjoin/dblp-2_1/dblp-2_1.3.ast
+++ b/asterixdb/asterix-app/src/test/resources/runtimets/results_parser_sqlpp/fuzzyjoin/dblp-2_1/dblp-2_1.3.ast
@@ -60,10 +60,8 @@ Let Variable [ Name=$tokensDBLP ]
           Variable [ Name=$token ]
           GROUP AS Variable [ Name=#1 ]
           (
-            token:=Variable [ Name=$token ]
             paper:=Variable [ Name=$paper ]
-            tokenUnranked:=Variable [ Name=$tokenUnranked ]
-            paperDBLP:=Variable [ Name=$paperDBLP ]
+            token:=Variable [ Name=$token ]
           )
 
         Orderby

http://git-wip-us.apache.org/repos/asf/asterixdb/blob/8671ddf8/asterixdb/asterix-app/src/test/resources/runtimets/results_parser_sqlpp/fuzzyjoin/dblp-2_2/dblp-2_2.3.ast
----------------------------------------------------------------------
diff --git a/asterixdb/asterix-app/src/test/resources/runtimets/results_parser_sqlpp/fuzzyjoin/dblp-2_2/dblp-2_2.3.ast b/asterixdb/asterix-app/src/test/resources/runtimets/results_parser_sqlpp/fuzzyjoin/dblp-2_2/dblp-2_2.3.ast
index de0c379..4d4ecc8 100644
--- a/asterixdb/asterix-app/src/test/resources/runtimets/results_parser_sqlpp/fuzzyjoin/dblp-2_2/dblp-2_2.3.ast
+++ b/asterixdb/asterix-app/src/test/resources/runtimets/results_parser_sqlpp/fuzzyjoin/dblp-2_2/dblp-2_2.3.ast
@@ -66,20 +66,16 @@ Let Variable [ Name=$tokensDBLP ]
           Variable [ Name=$token ]
           GROUP AS Variable [ Name=#1 ]
           (
-            id:=Variable [ Name=$id ]
-            token:=Variable [ Name=$token ]
             paper:=Variable [ Name=$paper ]
-            tokenUnranked:=Variable [ Name=$tokenUnranked ]
-            paperDBLP:=Variable [ Name=$paperDBLP ]
+            token:=Variable [ Name=$token ]
           )
 
         Orderby
           FunctionCall fuzzyjoin.sql-count@1[
             (
               SELECT ELEMENT [
-              FieldAccessor [
-                Variable [ Name=#2 ]
-                Field=id
+              FunctionCall Metadata.dataset@1[
+                LiteralExpr [STRING] [id]
               ]
               ]
               FROM [                Variable [ Name=#1 ]

http://git-wip-us.apache.org/repos/asf/asterixdb/blob/8671ddf8/asterixdb/asterix-app/src/test/resources/runtimets/results_parser_sqlpp/fuzzyjoin/dblp-2_3/dblp-2_3.3.ast
----------------------------------------------------------------------
diff --git a/asterixdb/asterix-app/src/test/resources/runtimets/results_parser_sqlpp/fuzzyjoin/dblp-2_3/dblp-2_3.3.ast b/asterixdb/asterix-app/src/test/resources/runtimets/results_parser_sqlpp/fuzzyjoin/dblp-2_3/dblp-2_3.3.ast
index 0359a32..0e7d067 100644
--- a/asterixdb/asterix-app/src/test/resources/runtimets/results_parser_sqlpp/fuzzyjoin/dblp-2_3/dblp-2_3.3.ast
+++ b/asterixdb/asterix-app/src/test/resources/runtimets/results_parser_sqlpp/fuzzyjoin/dblp-2_3/dblp-2_3.3.ast
@@ -69,21 +69,16 @@ Let Variable [ Name=$tokensDBLP ]
           Variable [ Name=$token ]
           GROUP AS Variable [ Name=#1 ]
           (
-            id:=Variable [ Name=$id ]
-            token:=Variable [ Name=$token ]
             paper:=Variable [ Name=$paper ]
-            tokenUnranked:=Variable [ Name=$tokenUnranked ]
-            idDBLP:=Variable [ Name=$idDBLP ]
-            paperDBLP:=Variable [ Name=$paperDBLP ]
+            token:=Variable [ Name=$token ]
           )
 
         Orderby
           FunctionCall fuzzyjoin.sql-count@1[
             (
               SELECT ELEMENT [
-              FieldAccessor [
-                Variable [ Name=#2 ]
-                Field=id
+              FunctionCall Metadata.dataset@1[
+                LiteralExpr [STRING] [id]
               ]
               ]
               FROM [                Variable [ Name=#1 ]

http://git-wip-us.apache.org/repos/asf/asterixdb/blob/8671ddf8/asterixdb/asterix-app/src/test/resources/runtimets/results_parser_sqlpp/fuzzyjoin/dblp-2_4/dblp-2_4.3.ast
----------------------------------------------------------------------
diff --git a/asterixdb/asterix-app/src/test/resources/runtimets/results_parser_sqlpp/fuzzyjoin/dblp-2_4/dblp-2_4.3.ast b/asterixdb/asterix-app/src/test/resources/runtimets/results_parser_sqlpp/fuzzyjoin/dblp-2_4/dblp-2_4.3.ast
index b43a06c..b290858 100644
--- a/asterixdb/asterix-app/src/test/resources/runtimets/results_parser_sqlpp/fuzzyjoin/dblp-2_4/dblp-2_4.3.ast
+++ b/asterixdb/asterix-app/src/test/resources/runtimets/results_parser_sqlpp/fuzzyjoin/dblp-2_4/dblp-2_4.3.ast
@@ -72,22 +72,16 @@ Let Variable [ Name=$tokensDBLP ]
           Variable [ Name=$token ]
           GROUP AS Variable [ Name=#1 ]
           (
-            id:=Variable [ Name=$id ]
-            token:=Variable [ Name=$token ]
             paper:=Variable [ Name=$paper ]
-            tokenUnranked:=Variable [ Name=$tokenUnranked ]
-            tokensUnrankedDBLP:=Variable [ Name=$tokensUnrankedDBLP ]
-            idDBLP:=Variable [ Name=$idDBLP ]
-            paperDBLP:=Variable [ Name=$paperDBLP ]
+            token:=Variable [ Name=$token ]
           )
 
         Orderby
           FunctionCall fuzzyjoin.sql-count@1[
             (
               SELECT ELEMENT [
-              FieldAccessor [
-                Variable [ Name=#2 ]
-                Field=id
+              FunctionCall Metadata.dataset@1[
+                LiteralExpr [STRING] [id]
               ]
               ]
               FROM [                Variable [ Name=#1 ]

http://git-wip-us.apache.org/repos/asf/asterixdb/blob/8671ddf8/asterixdb/asterix-app/src/test/resources/runtimets/results_parser_sqlpp/fuzzyjoin/dblp-2_5.1/dblp-2_5.3.ast
----------------------------------------------------------------------
diff --git a/asterixdb/asterix-app/src/test/resources/runtimets/results_parser_sqlpp/fuzzyjoin/dblp-2_5.1/dblp-2_5.3.ast b/asterixdb/asterix-app/src/test/resources/runtimets/results_parser_sqlpp/fuzzyjoin/dblp-2_5.1/dblp-2_5.3.ast
index c8a4003..244cb0b 100644
--- a/asterixdb/asterix-app/src/test/resources/runtimets/results_parser_sqlpp/fuzzyjoin/dblp-2_5.1/dblp-2_5.3.ast
+++ b/asterixdb/asterix-app/src/test/resources/runtimets/results_parser_sqlpp/fuzzyjoin/dblp-2_5.1/dblp-2_5.3.ast
@@ -82,23 +82,16 @@ Let Variable [ Name=$tokensDBLP ]
           Variable [ Name=$token ]
           GROUP AS Variable [ Name=#1 ]
           (
-            id:=Variable [ Name=$id ]
-            token:=Variable [ Name=$token ]
             paper:=Variable [ Name=$paper ]
-            tokenUnranked:=Variable [ Name=$tokenUnranked ]
-            lenDBLP:=Variable [ Name=$lenDBLP ]
-            tokensUnrankedDBLP:=Variable [ Name=$tokensUnrankedDBLP ]
-            idDBLP:=Variable [ Name=$idDBLP ]
-            paperDBLP:=Variable [ Name=$paperDBLP ]
+            token:=Variable [ Name=$token ]
           )
 
         Orderby
           FunctionCall fuzzyjoin.sql-count@1[
             (
               SELECT ELEMENT [
-              FieldAccessor [
-                Variable [ Name=#2 ]
-                Field=id
+              FunctionCall Metadata.dataset@1[
+                LiteralExpr [STRING] [id]
               ]
               ]
               FROM [                Variable [ Name=#1 ]

http://git-wip-us.apache.org/repos/asf/asterixdb/blob/8671ddf8/asterixdb/asterix-app/src/test/resources/runtimets/results_parser_sqlpp/fuzzyjoin/dblp-2_5.2/dblp-2_5.3.ast
----------------------------------------------------------------------
diff --git a/asterixdb/asterix-app/src/test/resources/runtimets/results_parser_sqlpp/fuzzyjoin/dblp-2_5.2/dblp-2_5.3.ast b/asterixdb/asterix-app/src/test/resources/runtimets/results_parser_sqlpp/fuzzyjoin/dblp-2_5.2/dblp-2_5.3.ast
index c8a4003..244cb0b 100644
--- a/asterixdb/asterix-app/src/test/resources/runtimets/results_parser_sqlpp/fuzzyjoin/dblp-2_5.2/dblp-2_5.3.ast
+++ b/asterixdb/asterix-app/src/test/resources/runtimets/results_parser_sqlpp/fuzzyjoin/dblp-2_5.2/dblp-2_5.3.ast
@@ -82,23 +82,16 @@ Let Variable [ Name=$tokensDBLP ]
           Variable [ Name=$token ]
           GROUP AS Variable [ Name=#1 ]
           (
-            id:=Variable [ Name=$id ]
-            token:=Variable [ Name=$token ]
             paper:=Variable [ Name=$paper ]
-            tokenUnranked:=Variable [ Name=$tokenUnranked ]
-            lenDBLP:=Variable [ Name=$lenDBLP ]
-            tokensUnrankedDBLP:=Variable [ Name=$tokensUnrankedDBLP ]
-            idDBLP:=Variable [ Name=$idDBLP ]
-            paperDBLP:=Variable [ Name=$paperDBLP ]
+            token:=Variable [ Name=$token ]
           )
 
         Orderby
           FunctionCall fuzzyjoin.sql-count@1[
             (
               SELECT ELEMENT [
-              FieldAccessor [
-                Variable [ Name=#2 ]
-                Field=id
+              FunctionCall Metadata.dataset@1[
+                LiteralExpr [STRING] [id]
               ]
               ]
               FROM [                Variable [ Name=#1 ]

http://git-wip-us.apache.org/repos/asf/asterixdb/blob/8671ddf8/asterixdb/asterix-app/src/test/resources/runtimets/results_parser_sqlpp/fuzzyjoin/dblp-2_5.3.1/dblp-2_5.3.ast
----------------------------------------------------------------------
diff --git a/asterixdb/asterix-app/src/test/resources/runtimets/results_parser_sqlpp/fuzzyjoin/dblp-2_5.3.1/dblp-2_5.3.ast b/asterixdb/asterix-app/src/test/resources/runtimets/results_parser_sqlpp/fuzzyjoin/dblp-2_5.3.1/dblp-2_5.3.ast
index c8a4003..244cb0b 100644
--- a/asterixdb/asterix-app/src/test/resources/runtimets/results_parser_sqlpp/fuzzyjoin/dblp-2_5.3.1/dblp-2_5.3.ast
+++ b/asterixdb/asterix-app/src/test/resources/runtimets/results_parser_sqlpp/fuzzyjoin/dblp-2_5.3.1/dblp-2_5.3.ast
@@ -82,23 +82,16 @@ Let Variable [ Name=$tokensDBLP ]
           Variable [ Name=$token ]
           GROUP AS Variable [ Name=#1 ]
           (
-            id:=Variable [ Name=$id ]
-            token:=Variable [ Name=$token ]
             paper:=Variable [ Name=$paper ]
-            tokenUnranked:=Variable [ Name=$tokenUnranked ]
-            lenDBLP:=Variable [ Name=$lenDBLP ]
-            tokensUnrankedDBLP:=Variable [ Name=$tokensUnrankedDBLP ]
-            idDBLP:=Variable [ Name=$idDBLP ]
-            paperDBLP:=Variable [ Name=$paperDBLP ]
+            token:=Variable [ Name=$token ]
           )
 
         Orderby
           FunctionCall fuzzyjoin.sql-count@1[
             (
               SELECT ELEMENT [
-              FieldAccessor [
-                Variable [ Name=#2 ]
-                Field=id
+              FunctionCall Metadata.dataset@1[
+                LiteralExpr [STRING] [id]
               ]
               ]
               FROM [                Variable [ Name=#1 ]

http://git-wip-us.apache.org/repos/asf/asterixdb/blob/8671ddf8/asterixdb/asterix-app/src/test/resources/runtimets/results_parser_sqlpp/fuzzyjoin/dblp-2_5.3/dblp-2_5.3.ast
----------------------------------------------------------------------
diff --git a/asterixdb/asterix-app/src/test/resources/runtimets/results_parser_sqlpp/fuzzyjoin/dblp-2_5.3/dblp-2_5.3.ast b/asterixdb/asterix-app/src/test/resources/runtimets/results_parser_sqlpp/fuzzyjoin/dblp-2_5.3/dblp-2_5.3.ast
index c8a4003..244cb0b 100644
--- a/asterixdb/asterix-app/src/test/resources/runtimets/results_parser_sqlpp/fuzzyjoin/dblp-2_5.3/dblp-2_5.3.ast
+++ b/asterixdb/asterix-app/src/test/resources/runtimets/results_parser_sqlpp/fuzzyjoin/dblp-2_5.3/dblp-2_5.3.ast
@@ -82,23 +82,16 @@ Let Variable [ Name=$tokensDBLP ]
           Variable [ Name=$token ]
           GROUP AS Variable [ Name=#1 ]
           (
-            id:=Variable [ Name=$id ]
-            token:=Variable [ Name=$token ]
             paper:=Variable [ Name=$paper ]
-            tokenUnranked:=Variable [ Name=$tokenUnranked ]
-            lenDBLP:=Variable [ Name=$lenDBLP ]
-            tokensUnrankedDBLP:=Variable [ Name=$tokensUnrankedDBLP ]
-            idDBLP:=Variable [ Name=$idDBLP ]
-            paperDBLP:=Variable [ Name=$paperDBLP ]
+            token:=Variable [ Name=$token ]
           )
 
         Orderby
           FunctionCall fuzzyjoin.sql-count@1[
             (
               SELECT ELEMENT [
-              FieldAccessor [
-                Variable [ Name=#2 ]
-                Field=id
+              FunctionCall Metadata.dataset@1[
+                LiteralExpr [STRING] [id]
               ]
               ]
               FROM [                Variable [ Name=#1 ]

http://git-wip-us.apache.org/repos/asf/asterixdb/blob/8671ddf8/asterixdb/asterix-app/src/test/resources/runtimets/results_parser_sqlpp/fuzzyjoin/dblp-2_5/dblp-2_5.3.ast
----------------------------------------------------------------------
diff --git a/asterixdb/asterix-app/src/test/resources/runtimets/results_parser_sqlpp/fuzzyjoin/dblp-2_5/dblp-2_5.3.ast b/asterixdb/asterix-app/src/test/resources/runtimets/results_parser_sqlpp/fuzzyjoin/dblp-2_5/dblp-2_5.3.ast
index 3ae14cf..60e0b24 100644
--- a/asterixdb/asterix-app/src/test/resources/runtimets/results_parser_sqlpp/fuzzyjoin/dblp-2_5/dblp-2_5.3.ast
+++ b/asterixdb/asterix-app/src/test/resources/runtimets/results_parser_sqlpp/fuzzyjoin/dblp-2_5/dblp-2_5.3.ast
@@ -82,23 +82,16 @@ Let Variable [ Name=$tokensDBLP ]
           Variable [ Name=$token ]
           GROUP AS Variable [ Name=#1 ]
           (
-            id:=Variable [ Name=$id ]
-            token:=Variable [ Name=$token ]
             paper:=Variable [ Name=$paper ]
-            tokenUnranked:=Variable [ Name=$tokenUnranked ]
-            lenDBLP:=Variable [ Name=$lenDBLP ]
-            tokensUnrankedDBLP:=Variable [ Name=$tokensUnrankedDBLP ]
-            idDBLP:=Variable [ Name=$idDBLP ]
-            paperDBLP:=Variable [ Name=$paperDBLP ]
+            token:=Variable [ Name=$token ]
           )
 
         Orderby
           FunctionCall fuzzyjoin.sql-count@1[
             (
               SELECT ELEMENT [
-              FieldAccessor [
-                Variable [ Name=#2 ]
-                Field=id
+              FunctionCall Metadata.dataset@1[
+                LiteralExpr [STRING] [id]
               ]
               ]
               FROM [                Variable [ Name=#1 ]

http://git-wip-us.apache.org/repos/asf/asterixdb/blob/8671ddf8/asterixdb/asterix-app/src/test/resources/runtimets/results_parser_sqlpp/fuzzyjoin/dblp-3_1.1/dblp-3_1.3.ast
----------------------------------------------------------------------
diff --git a/asterixdb/asterix-app/src/test/resources/runtimets/results_parser_sqlpp/fuzzyjoin/dblp-3_1.1/dblp-3_1.3.ast b/asterixdb/asterix-app/src/test/resources/runtimets/results_parser_sqlpp/fuzzyjoin/dblp-3_1.1/dblp-3_1.3.ast
index 350a380..fd16f56 100644
--- a/asterixdb/asterix-app/src/test/resources/runtimets/results_parser_sqlpp/fuzzyjoin/dblp-3_1.1/dblp-3_1.3.ast
+++ b/asterixdb/asterix-app/src/test/resources/runtimets/results_parser_sqlpp/fuzzyjoin/dblp-3_1.1/dblp-3_1.3.ast
@@ -40,7 +40,9 @@ FROM [  (
         LiteralExpr [STRING] [sim]
         :
         IndexAccessor [
-          Variable [ Name=$sim ]
+          FunctionCall Metadata.dataset@1[
+            LiteralExpr [STRING] [sim]
+          ]
           Index:           LiteralExpr [LONG] [0]
         ]
       )
@@ -131,14 +133,8 @@ FROM [  (
               Variable [ Name=$token ]
               GROUP AS Variable [ Name=#1 ]
               (
-                token:=Variable [ Name=$token ]
                 paper:=Variable [ Name=$paper ]
-                tokenUnranked:=Variable [ Name=$tokenUnranked ]
-                lenLeft:=Variable [ Name=$lenLeft ]
-                prefixTokenRight:=Variable [ Name=$prefixTokenRight ]
-                paperRight:=Variable [ Name=$paperRight ]
-                prefixTokenLeft:=Variable [ Name=$prefixTokenLeft ]
-                paperLeft:=Variable [ Name=$paperLeft ]
+                token:=Variable [ Name=$token ]
               )
 
             Orderby
@@ -222,16 +218,8 @@ Variable [ Name=$i ]
               Variable [ Name=$token ]
               GROUP AS Variable [ Name=#3 ]
               (
-                token:=Variable [ Name=$token ]
                 paper:=Variable [ Name=$paper ]
-                tokenUnranked:=Variable [ Name=$tokenUnranked ]
-                lenRight:=Variable [ Name=$lenRight ]
-                tokensLeft:=Variable [ Name=$tokensLeft ]
-                lenLeft:=Variable [ Name=$lenLeft ]
-                prefixTokenRight:=Variable [ Name=$prefixTokenRight ]
-                paperRight:=Variable [ Name=$paperRight ]
-                prefixTokenLeft:=Variable [ Name=$prefixTokenLeft ]
-                paperLeft:=Variable [ Name=$paperLeft ]
+                token:=Variable [ Name=$token ]
               )
 
             Orderby
@@ -321,15 +309,10 @@ Variable [ Name=$i ]
       ]
       GROUP AS Variable [ Name=#5 ]
       (
-        sim:=Variable [ Name=$sim ]
-        tokensRight:=Variable [ Name=$tokensRight ]
-        lenRight:=Variable [ Name=$lenRight ]
-        tokensLeft:=Variable [ Name=$tokensLeft ]
-        lenLeft:=Variable [ Name=$lenLeft ]
-        prefixTokenRight:=Variable [ Name=$prefixTokenRight ]
-        paperRight:=Variable [ Name=$paperRight ]
-        prefixTokenLeft:=Variable [ Name=$prefixTokenLeft ]
         paperLeft:=Variable [ Name=$paperLeft ]
+        prefixTokenLeft:=Variable [ Name=$prefixTokenLeft ]
+        paperRight:=Variable [ Name=$paperRight ]
+        prefixTokenRight:=Variable [ Name=$prefixTokenRight ]
       )
 
   )


Mime
View raw message