asterixdb-commits mailing list archives

Site index · List index
Message view « Date » · « Thread »
Top « Date » · « Thread »
From buyin...@apache.org
Subject [32/51] [partial] incubator-asterixdb git commit: ASTERIXDB-1226: implement SQL++ core group-by semantics and syntatic sugars.
Date Mon, 28 Mar 2016 20:18:59 GMT
http://git-wip-us.apache.org/repos/asf/incubator-asterixdb/blob/acc12a9b/asterix-app/src/test/resources/parserts/results_parser_sqlpp/select_clause_sugar.ast
----------------------------------------------------------------------
diff --git a/asterix-app/src/test/resources/parserts/results_parser_sqlpp/select_clause_sugar.ast b/asterix-app/src/test/resources/parserts/results_parser_sqlpp/select_clause_sugar.ast
index 6622fe1..3049374 100644
--- a/asterix-app/src/test/resources/parserts/results_parser_sqlpp/select_clause_sugar.ast
+++ b/asterix-app/src/test/resources/parserts/results_parser_sqlpp/select_clause_sugar.ast
@@ -1,6 +1,6 @@
 Query:
 SELECT [
-Variable [ Name=x ]
+Variable [ Name=$x ]
 value
 ]
 FROM [  OrderedListConstructor [
@@ -11,11 +11,11 @@ FROM [  OrderedListConstructor [
     LiteralExpr [LONG] [10]
   ]
   AS
-  Variable [ Name=x ]
+  Variable [ Name=$x ]
 ]
 Where
   OperatorExpr [
-    Variable [ Name=x ]
+    Variable [ Name=$x ]
     =
     LiteralExpr [LONG] [10]
   ]

http://git-wip-us.apache.org/repos/asf/incubator-asterixdb/blob/acc12a9b/asterix-app/src/test/resources/parserts/results_parser_sqlpp/select_from_where_sugar.ast
----------------------------------------------------------------------
diff --git a/asterix-app/src/test/resources/parserts/results_parser_sqlpp/select_from_where_sugar.ast b/asterix-app/src/test/resources/parserts/results_parser_sqlpp/select_from_where_sugar.ast
index bb0c8b5..b978b56 100644
--- a/asterix-app/src/test/resources/parserts/results_parser_sqlpp/select_from_where_sugar.ast
+++ b/asterix-app/src/test/resources/parserts/results_parser_sqlpp/select_from_where_sugar.ast
@@ -1,6 +1,6 @@
 Query:
 SELECT ELEMENT [
-Variable [ Name=x ]
+Variable [ Name=$x ]
 ]
 FROM [  OrderedListConstructor [
     LiteralExpr [LONG] [10]
@@ -10,11 +10,11 @@ FROM [  OrderedListConstructor [
     LiteralExpr [LONG] [10]
   ]
   AS
-  Variable [ Name=x ]
+  Variable [ Name=$x ]
 ]
 Where
   OperatorExpr [
-    Variable [ Name=x ]
+    Variable [ Name=$x ]
     =
     LiteralExpr [LONG] [10]
   ]

http://git-wip-us.apache.org/repos/asf/incubator-asterixdb/blob/acc12a9b/asterix-app/src/test/resources/parserts/results_parser_sqlpp/union.ast
----------------------------------------------------------------------
diff --git a/asterix-app/src/test/resources/parserts/results_parser_sqlpp/union.ast b/asterix-app/src/test/resources/parserts/results_parser_sqlpp/union.ast
index ef69119..fdc8591 100644
--- a/asterix-app/src/test/resources/parserts/results_parser_sqlpp/union.ast
+++ b/asterix-app/src/test/resources/parserts/results_parser_sqlpp/union.ast
@@ -1,27 +1,27 @@
 Query:
 SELECT ELEMENT [
-Variable [ Name=l ]
+Variable [ Name=$l ]
 ]
 FROM [  FunctionCall null.foo1@0[
   ]
   AS
-  Variable [ Name=l ]
+  Variable [ Name=$l ]
 ]
 UNION ALL 
   SELECT ELEMENT [
-  Variable [ Name=l ]
+  Variable [ Name=$l ]
   ]
   FROM [    FunctionCall null.foo2@0[
     ]
     AS
-    Variable [ Name=l ]
+    Variable [ Name=$l ]
   ]
 UNION ALL 
   SELECT ELEMENT [
-  Variable [ Name=l ]
+  Variable [ Name=$l ]
   ]
   FROM [    FunctionCall null.foo3@0[
     ]
     AS
-    Variable [ Name=l ]
+    Variable [ Name=$l ]
   ]

http://git-wip-us.apache.org/repos/asf/incubator-asterixdb/blob/acc12a9b/asterix-app/src/test/resources/parserts/results_parser_sqlpp/variables.ast
----------------------------------------------------------------------
diff --git a/asterix-app/src/test/resources/parserts/results_parser_sqlpp/variables.ast b/asterix-app/src/test/resources/parserts/results_parser_sqlpp/variables.ast
index 330ebef..698f469 100644
--- a/asterix-app/src/test/resources/parserts/results_parser_sqlpp/variables.ast
+++ b/asterix-app/src/test/resources/parserts/results_parser_sqlpp/variables.ast
@@ -1,14 +1,14 @@
 Query:
-LetVariable [ Name=a ]
+Let Variable [ Name=$a ]
   :=
   LiteralExpr [LONG] [1]
-LetVariable [ Name=b ]
+Let Variable [ Name=$b ]
   :=
   LiteralExpr [LONG] [1]
 SELECT ELEMENT [
 OperatorExpr [
-  Variable [ Name=b ]
+  Variable [ Name=$b ]
   -
-  Variable [ Name=a ]
+  Variable [ Name=$a ]
 ]
 ]

http://git-wip-us.apache.org/repos/asf/incubator-asterixdb/blob/acc12a9b/asterix-app/src/test/resources/parserts/results_parser_sqlpp/where_clause.ast
----------------------------------------------------------------------
diff --git a/asterix-app/src/test/resources/parserts/results_parser_sqlpp/where_clause.ast b/asterix-app/src/test/resources/parserts/results_parser_sqlpp/where_clause.ast
index 57c1c2c..7a32a1f 100644
--- a/asterix-app/src/test/resources/parserts/results_parser_sqlpp/where_clause.ast
+++ b/asterix-app/src/test/resources/parserts/results_parser_sqlpp/where_clause.ast
@@ -2,7 +2,7 @@ DataverseUse test
 Query:
 SELECT ELEMENT [
 FieldAccessor [
-  Variable [ Name=r ]
+  Variable [ Name=$r ]
   Field=reading
 ]
 ]
@@ -10,12 +10,12 @@ FROM [  FunctionCall Metadata.dataset@1[
     LiteralExpr [STRING] [sensors]
   ]
   AS
-  Variable [ Name=r ]
+  Variable [ Name=$r ]
 ]
 Where
   OperatorExpr [
     FieldAccessor [
-      Variable [ Name=r ]
+      Variable [ Name=$r ]
       Field=reading
     ]
     =

http://git-wip-us.apache.org/repos/asf/incubator-asterixdb/blob/acc12a9b/asterix-app/src/test/resources/runtimets/queries/tpch-sql-like/q14_promotion_effect/q14_promotion_effect.3.query.aql
----------------------------------------------------------------------
diff --git a/asterix-app/src/test/resources/runtimets/queries/tpch-sql-like/q14_promotion_effect/q14_promotion_effect.3.query.aql b/asterix-app/src/test/resources/runtimets/queries/tpch-sql-like/q14_promotion_effect/q14_promotion_effect.3.query.aql
index 4ebf65d..cc15b41 100644
--- a/asterix-app/src/test/resources/runtimets/queries/tpch-sql-like/q14_promotion_effect/q14_promotion_effect.3.query.aql
+++ b/asterix-app/src/test/resources/runtimets/queries/tpch-sql-like/q14_promotion_effect/q14_promotion_effect.3.query.aql
@@ -23,11 +23,12 @@ from $p in dataset('Part')
 where $l.l_partkey = $p.p_partkey
   and $l.l_shipdate >= '1995-09-01'
   and $l.l_shipdate < '1995-10-01'
-group by $t:=1 keeping $l, $p
+let $lp := {'p_type': $p.p_type, 'l_extendedprice': $l.l_extendedprice, 'l_discount': $l.l_discount}
+group by $t:=1 keeping $lp
 select 100.00 * sum(
-  from $i in $l
+  from $i in $lp
   select switch-case(like($i.p_type, 'PROMO%'),
                      true, $i.l_extendedprice*(1-$i.l_discount),
                      false, 0.0)
-  ) / sum(from $i in $l select $i.l_extendedprice * (1 - $i.l_discount)
+  ) / sum(from $i in $lp select $i.l_extendedprice * (1 - $i.l_discount)
 )

http://git-wip-us.apache.org/repos/asf/incubator-asterixdb/blob/acc12a9b/asterix-app/src/test/resources/runtimets/queries/tpch/q14_promotion_effect/q14_promotion_effect.3.query.aql
----------------------------------------------------------------------
diff --git a/asterix-app/src/test/resources/runtimets/queries/tpch/q14_promotion_effect/q14_promotion_effect.3.query.aql b/asterix-app/src/test/resources/runtimets/queries/tpch/q14_promotion_effect/q14_promotion_effect.3.query.aql
index e421d4a..c7fb01c 100644
--- a/asterix-app/src/test/resources/runtimets/queries/tpch/q14_promotion_effect/q14_promotion_effect.3.query.aql
+++ b/asterix-app/src/test/resources/runtimets/queries/tpch/q14_promotion_effect/q14_promotion_effect.3.query.aql
@@ -23,11 +23,12 @@ for $p in dataset('Part')
 where $l.l_partkey = $p.p_partkey
   and $l.l_shipdate >= '1995-09-01'
   and $l.l_shipdate < '1995-10-01'
-group by $t:=1 with $l, $p
+let $lp := {'p_type': $p.p_type, 'l_extendedprice': $l.l_extendedprice, 'l_discount': $l.l_discount}
+group by $t:=1 with $lp
 return 100.00 * sum(
-  for $i in $l
+  for $i in $lp
   return switch-case(like($i.p_type, 'PROMO%'),
                      true, $i.l_extendedprice*(1-$i.l_discount),
                      false, 0.0)
-  ) / sum(for $i in $l return $i.l_extendedprice * (1 - $i.l_discount)
+  ) / sum(for $i in $lp return $i.l_extendedprice * (1 - $i.l_discount)
 )

http://git-wip-us.apache.org/repos/asf/incubator-asterixdb/blob/acc12a9b/asterix-app/src/test/resources/runtimets/queries_sqlpp/group-by/core-01/core-01.1.ddl.sqlpp
----------------------------------------------------------------------
diff --git a/asterix-app/src/test/resources/runtimets/queries_sqlpp/group-by/core-01/core-01.1.ddl.sqlpp b/asterix-app/src/test/resources/runtimets/queries_sqlpp/group-by/core-01/core-01.1.ddl.sqlpp
new file mode 100644
index 0000000..bbccf8c
--- /dev/null
+++ b/asterix-app/src/test/resources/runtimets/queries_sqlpp/group-by/core-01/core-01.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 DATABASE gby IF EXISTS;
+CREATE DATABASE gby;
+
+USE gby;
+
+CREATE TYPE EmpType AS {
+  name : string
+}
+
+CREATE TABLE Employee(EmpType) PRIMARY KEY name;

http://git-wip-us.apache.org/repos/asf/incubator-asterixdb/blob/acc12a9b/asterix-app/src/test/resources/runtimets/queries_sqlpp/group-by/core-01/core-01.2.update.sqlpp
----------------------------------------------------------------------
diff --git a/asterix-app/src/test/resources/runtimets/queries_sqlpp/group-by/core-01/core-01.2.update.sqlpp b/asterix-app/src/test/resources/runtimets/queries_sqlpp/group-by/core-01/core-01.2.update.sqlpp
new file mode 100644
index 0000000..99116f6
--- /dev/null
+++ b/asterix-app/src/test/resources/runtimets/queries_sqlpp/group-by/core-01/core-01.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/incubator-asterixdb/blob/acc12a9b/asterix-app/src/test/resources/runtimets/queries_sqlpp/group-by/core-01/core-01.3.query.sqlpp
----------------------------------------------------------------------
diff --git a/asterix-app/src/test/resources/runtimets/queries_sqlpp/group-by/core-01/core-01.3.query.sqlpp b/asterix-app/src/test/resources/runtimets/queries_sqlpp/group-by/core-01/core-01.3.query.sqlpp
new file mode 100644
index 0000000..3e16b8c
--- /dev/null
+++ b/asterix-app/src/test/resources/runtimets/queries_sqlpp/group-by/core-01/core-01.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 gby;
+
+
+FROM Employee e
+GROUP BY e.deptno AS deptno GROUP AS g(e AS e)
+SELECT ELEMENT {
+  'deptno': deptno,
+  'avgpay': avg( (FROM g AS i SELECT ELEMENT i.e.salary) ),
+  'workers': (FROM g AS i SELECT ELEMENT  {'name': i.e.name, 'salary': i.e.salary})
+};

http://git-wip-us.apache.org/repos/asf/incubator-asterixdb/blob/acc12a9b/asterix-app/src/test/resources/runtimets/queries_sqlpp/group-by/core-02/core-02.1.ddl.sqlpp
----------------------------------------------------------------------
diff --git a/asterix-app/src/test/resources/runtimets/queries_sqlpp/group-by/core-02/core-02.1.ddl.sqlpp b/asterix-app/src/test/resources/runtimets/queries_sqlpp/group-by/core-02/core-02.1.ddl.sqlpp
new file mode 100644
index 0000000..7a281d2
--- /dev/null
+++ b/asterix-app/src/test/resources/runtimets/queries_sqlpp/group-by/core-02/core-02.1.ddl.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.
+ */
+
+DROP DATABASE gby IF EXISTS;
+CREATE DATABASE gby;
+
+USE gby;
+
+CREATE TYPE EmployeeType AS {
+  id : string
+}
+
+CREATE TYPE IncentiveType AS {
+  job_category: string
+}
+
+CREATE TYPE SuperStarType AS {
+  id : string
+}
+
+CREATE TABLE Employee(EmployeeType) PRIMARY KEY id;
+CREATE TABLE Incentive(IncentiveType) PRIMARY KEY job_category;
+CREATE TABLE SuperStars(SuperStarType) PRIMARY KEY id;
+

http://git-wip-us.apache.org/repos/asf/incubator-asterixdb/blob/acc12a9b/asterix-app/src/test/resources/runtimets/queries_sqlpp/group-by/core-02/core-02.2.update.sqlpp
----------------------------------------------------------------------
diff --git a/asterix-app/src/test/resources/runtimets/queries_sqlpp/group-by/core-02/core-02.2.update.sqlpp b/asterix-app/src/test/resources/runtimets/queries_sqlpp/group-by/core-02/core-02.2.update.sqlpp
new file mode 100644
index 0000000..19f0c1f
--- /dev/null
+++ b/asterix-app/src/test/resources/runtimets/queries_sqlpp/group-by/core-02/core-02.2.update.sqlpp
@@ -0,0 +1,42 @@
+/*
+ * Licensed to the Apache Software Foundation (ASF) under one
+ * or more contributor license agreements.  See the NOTICE file
+ * distributed with this work for additional information
+ * regarding copyright ownership.  The ASF licenses this file
+ * to you under the Apache License, Version 2.0 (the
+ * "License"); you may not use this file except in compliance
+ * with the License.  You may obtain a copy of the License at
+ *
+ *   http://www.apache.org/licenses/LICENSE-2.0
+ *
+ * Unless required by applicable law or agreed to in writing,
+ * software distributed under the License is distributed on an
+ * "AS IS" BASIS, WITHOUT WARRANTIES OR CONDITIONS OF ANY
+ * KIND, either express or implied.  See the License for the
+ * specific language governing permissions and limitations
+ * under the License.
+ */
+
+USE gby;
+
+INSERT INTO Employee (
+   {
+    'id': '123',
+    'job_category': 'Cook',
+    'salary': 2000,
+    'department_id': 'K55'
+   }
+);
+
+INSERT INTO Incentive (
+  { 'job_category': 'Cook',
+    'bonus': 1000
+  }
+)
+
+INSERT INTO SuperStars (
+  {
+    'id': '123'
+  }
+)
+

http://git-wip-us.apache.org/repos/asf/incubator-asterixdb/blob/acc12a9b/asterix-app/src/test/resources/runtimets/queries_sqlpp/group-by/core-02/core-02.3.query.sqlpp
----------------------------------------------------------------------
diff --git a/asterix-app/src/test/resources/runtimets/queries_sqlpp/group-by/core-02/core-02.3.query.sqlpp b/asterix-app/src/test/resources/runtimets/queries_sqlpp/group-by/core-02/core-02.3.query.sqlpp
new file mode 100644
index 0000000..f2ce8b7
--- /dev/null
+++ b/asterix-app/src/test/resources/runtimets/queries_sqlpp/group-by/core-02/core-02.3.query.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 gby;
+
+FROM Employee e
+    JOIN Incentive i ON e.job_category = i.job_category
+    JOIN SuperStars s ON e.id = s.id
+GROUP BY e.department_id AS deptId
+GROUP AS eis(e AS e, i AS i, s AS s)
+SELECT ELEMENT {
+      'deptId': deptId,
+      'star_cost': sum( (FROM eis AS p SELECT ELEMENT p.e.salary + p.i.bonus) )
+};

http://git-wip-us.apache.org/repos/asf/incubator-asterixdb/blob/acc12a9b/asterix-app/src/test/resources/runtimets/queries_sqlpp/group-by/core-03/core-02.1.ddl.sqlpp
----------------------------------------------------------------------
diff --git a/asterix-app/src/test/resources/runtimets/queries_sqlpp/group-by/core-03/core-02.1.ddl.sqlpp b/asterix-app/src/test/resources/runtimets/queries_sqlpp/group-by/core-03/core-02.1.ddl.sqlpp
new file mode 100644
index 0000000..7a281d2
--- /dev/null
+++ b/asterix-app/src/test/resources/runtimets/queries_sqlpp/group-by/core-03/core-02.1.ddl.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.
+ */
+
+DROP DATABASE gby IF EXISTS;
+CREATE DATABASE gby;
+
+USE gby;
+
+CREATE TYPE EmployeeType AS {
+  id : string
+}
+
+CREATE TYPE IncentiveType AS {
+  job_category: string
+}
+
+CREATE TYPE SuperStarType AS {
+  id : string
+}
+
+CREATE TABLE Employee(EmployeeType) PRIMARY KEY id;
+CREATE TABLE Incentive(IncentiveType) PRIMARY KEY job_category;
+CREATE TABLE SuperStars(SuperStarType) PRIMARY KEY id;
+

http://git-wip-us.apache.org/repos/asf/incubator-asterixdb/blob/acc12a9b/asterix-app/src/test/resources/runtimets/queries_sqlpp/group-by/core-03/core-02.2.update.sqlpp
----------------------------------------------------------------------
diff --git a/asterix-app/src/test/resources/runtimets/queries_sqlpp/group-by/core-03/core-02.2.update.sqlpp b/asterix-app/src/test/resources/runtimets/queries_sqlpp/group-by/core-03/core-02.2.update.sqlpp
new file mode 100644
index 0000000..19f0c1f
--- /dev/null
+++ b/asterix-app/src/test/resources/runtimets/queries_sqlpp/group-by/core-03/core-02.2.update.sqlpp
@@ -0,0 +1,42 @@
+/*
+ * Licensed to the Apache Software Foundation (ASF) under one
+ * or more contributor license agreements.  See the NOTICE file
+ * distributed with this work for additional information
+ * regarding copyright ownership.  The ASF licenses this file
+ * to you under the Apache License, Version 2.0 (the
+ * "License"); you may not use this file except in compliance
+ * with the License.  You may obtain a copy of the License at
+ *
+ *   http://www.apache.org/licenses/LICENSE-2.0
+ *
+ * Unless required by applicable law or agreed to in writing,
+ * software distributed under the License is distributed on an
+ * "AS IS" BASIS, WITHOUT WARRANTIES OR CONDITIONS OF ANY
+ * KIND, either express or implied.  See the License for the
+ * specific language governing permissions and limitations
+ * under the License.
+ */
+
+USE gby;
+
+INSERT INTO Employee (
+   {
+    'id': '123',
+    'job_category': 'Cook',
+    'salary': 2000,
+    'department_id': 'K55'
+   }
+);
+
+INSERT INTO Incentive (
+  { 'job_category': 'Cook',
+    'bonus': 1000
+  }
+)
+
+INSERT INTO SuperStars (
+  {
+    'id': '123'
+  }
+)
+

http://git-wip-us.apache.org/repos/asf/incubator-asterixdb/blob/acc12a9b/asterix-app/src/test/resources/runtimets/queries_sqlpp/group-by/core-03/core-02.3.query.sqlpp
----------------------------------------------------------------------
diff --git a/asterix-app/src/test/resources/runtimets/queries_sqlpp/group-by/core-03/core-02.3.query.sqlpp b/asterix-app/src/test/resources/runtimets/queries_sqlpp/group-by/core-03/core-02.3.query.sqlpp
new file mode 100644
index 0000000..d0ac45b
--- /dev/null
+++ b/asterix-app/src/test/resources/runtimets/queries_sqlpp/group-by/core-03/core-02.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.
+ */
+
+USE gby;
+
+FROM Employee e
+    JOIN Incentive i ON e.job_category = i.job_category
+    JOIN SuperStars s ON e.id = s.id
+GROUP BY e.department_id AS deptId
+GROUP AS eis(e AS e, i AS i, s AS s)
+SELECT ELEMENT {
+      'deptId': deptId,
+      'avgpay': avg( (FROM eis AS g SELECT ELEMENT g.e.salary + g.i.bonus) ),
+      'topstar_details':
+           (
+                FROM eis AS g
+                SELECT ELEMENT {
+                    'id': g.e.id,
+                    'salary': g.e.salary,
+                    'bonus': g.i.bonus
+                }
+                ORDER BY g.i.bonus DESC LIMIT 3
+           )
+};

http://git-wip-us.apache.org/repos/asf/incubator-asterixdb/blob/acc12a9b/asterix-app/src/test/resources/runtimets/queries_sqlpp/group-by/core-04/core-04.1.ddl.sqlpp
----------------------------------------------------------------------
diff --git a/asterix-app/src/test/resources/runtimets/queries_sqlpp/group-by/core-04/core-04.1.ddl.sqlpp b/asterix-app/src/test/resources/runtimets/queries_sqlpp/group-by/core-04/core-04.1.ddl.sqlpp
new file mode 100644
index 0000000..7a281d2
--- /dev/null
+++ b/asterix-app/src/test/resources/runtimets/queries_sqlpp/group-by/core-04/core-04.1.ddl.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.
+ */
+
+DROP DATABASE gby IF EXISTS;
+CREATE DATABASE gby;
+
+USE gby;
+
+CREATE TYPE EmployeeType AS {
+  id : string
+}
+
+CREATE TYPE IncentiveType AS {
+  job_category: string
+}
+
+CREATE TYPE SuperStarType AS {
+  id : string
+}
+
+CREATE TABLE Employee(EmployeeType) PRIMARY KEY id;
+CREATE TABLE Incentive(IncentiveType) PRIMARY KEY job_category;
+CREATE TABLE SuperStars(SuperStarType) PRIMARY KEY id;
+

http://git-wip-us.apache.org/repos/asf/incubator-asterixdb/blob/acc12a9b/asterix-app/src/test/resources/runtimets/queries_sqlpp/group-by/core-04/core-04.2.update.sqlpp
----------------------------------------------------------------------
diff --git a/asterix-app/src/test/resources/runtimets/queries_sqlpp/group-by/core-04/core-04.2.update.sqlpp b/asterix-app/src/test/resources/runtimets/queries_sqlpp/group-by/core-04/core-04.2.update.sqlpp
new file mode 100644
index 0000000..52443b5
--- /dev/null
+++ b/asterix-app/src/test/resources/runtimets/queries_sqlpp/group-by/core-04/core-04.2.update.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.
+ */
+
+USE gby;
+
+INSERT INTO Employee (
+  [
+   {
+    'id': '123',
+    'job_category': 'Cook',
+    'salary': 2000,
+    'department_id': 'K55'
+   },
+   {
+    'id': '234',
+    'job_category': 'Teach',
+    'salary': 2500,
+    'department_id': 'K54'
+   }
+  ]
+);
+
+INSERT INTO Incentive (
+ [
+  { 'job_category': 'Cook',
+    'bonus': 1000
+  },
+  { 'job_category': 'Teach',
+    'bonus': 2000
+  }
+ ]
+)
+
+INSERT INTO SuperStars (
+  {
+    'id': '123'
+  }
+)
+

http://git-wip-us.apache.org/repos/asf/incubator-asterixdb/blob/acc12a9b/asterix-app/src/test/resources/runtimets/queries_sqlpp/group-by/core-04/core-04.3.query.sqlpp
----------------------------------------------------------------------
diff --git a/asterix-app/src/test/resources/runtimets/queries_sqlpp/group-by/core-04/core-04.3.query.sqlpp b/asterix-app/src/test/resources/runtimets/queries_sqlpp/group-by/core-04/core-04.3.query.sqlpp
new file mode 100644
index 0000000..46c8644
--- /dev/null
+++ b/asterix-app/src/test/resources/runtimets/queries_sqlpp/group-by/core-04/core-04.3.query.sqlpp
@@ -0,0 +1,38 @@
+/*
+ * 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;
+
+FROM  Employee e, Incentive i
+WHERE e.job_category = i.job_category
+GROUP BY e.department_id AS deptId
+GROUP AS ei(e AS e2, i AS i2)
+SELECT ELEMENT {
+    'deptId': deptId,
+    'job_category_details':
+         (  FROM ei AS g
+            SELECT ELEMENT {
+                'category': g.i2.job_category,
+                'bonus': g.i2.bonus
+            }
+            ORDER BY g.i2.bonus DESC LIMIT 3
+          )
+      }
+ORDER BY deptId DESC;
+

http://git-wip-us.apache.org/repos/asf/incubator-asterixdb/blob/acc12a9b/asterix-app/src/test/resources/runtimets/queries_sqlpp/group-by/core-05/core-05.1.ddl.sqlpp
----------------------------------------------------------------------
diff --git a/asterix-app/src/test/resources/runtimets/queries_sqlpp/group-by/core-05/core-05.1.ddl.sqlpp b/asterix-app/src/test/resources/runtimets/queries_sqlpp/group-by/core-05/core-05.1.ddl.sqlpp
new file mode 100644
index 0000000..2030780
--- /dev/null
+++ b/asterix-app/src/test/resources/runtimets/queries_sqlpp/group-by/core-05/core-05.1.ddl.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.
+ */
+
+DROP DATABASE gby IF EXISTS;
+CREATE DATABASE gby;
+
+USE gby;
+
+CREATE TYPE CarType AS {
+  cid : string
+}
+
+CREATE TYPE TireType AS {
+  tid: string
+}
+
+CREATE TABLE Car(CarType) PRIMARY KEY cid;
+CREATE TABLE Tire(TireType) PRIMARY KEY tid;
+

http://git-wip-us.apache.org/repos/asf/incubator-asterixdb/blob/acc12a9b/asterix-app/src/test/resources/runtimets/queries_sqlpp/group-by/core-05/core-05.2.update.sqlpp
----------------------------------------------------------------------
diff --git a/asterix-app/src/test/resources/runtimets/queries_sqlpp/group-by/core-05/core-05.2.update.sqlpp b/asterix-app/src/test/resources/runtimets/queries_sqlpp/group-by/core-05/core-05.2.update.sqlpp
new file mode 100644
index 0000000..275e4fc
--- /dev/null
+++ b/asterix-app/src/test/resources/runtimets/queries_sqlpp/group-by/core-05/core-05.2.update.sqlpp
@@ -0,0 +1,59 @@
+/*
+ * 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 Car (
+  [
+   {
+    'cid': '1',
+    'make': 'Honda',
+    'model': 'Civic',
+    'price': 28000,
+    'tire_size': 'P205/55R16'
+   },
+   {
+    'cid': '2',
+    'make': 'Toyota',
+    'model': 'Corolla',
+    'price': 27000,
+    'tire_size': 'P205/55R16'
+   }
+  ]
+);
+
+INSERT INTO Tire (
+ [
+   {
+        'tid': '1',
+        'mfr': 'Bridgestone',
+        'brand': 'Turanza',
+        'size': 'P205/55R16',
+        'price': 150
+    },
+    {
+        'tid': '2',
+        'mfr': 'Goodyear',
+        'brand': 'Eagle',
+        'size': 'P205/55R16',
+        'price': 100
+    }
+ ]
+)
+

http://git-wip-us.apache.org/repos/asf/incubator-asterixdb/blob/acc12a9b/asterix-app/src/test/resources/runtimets/queries_sqlpp/group-by/core-05/core-05.3.query.sqlpp
----------------------------------------------------------------------
diff --git a/asterix-app/src/test/resources/runtimets/queries_sqlpp/group-by/core-05/core-05.3.query.sqlpp b/asterix-app/src/test/resources/runtimets/queries_sqlpp/group-by/core-05/core-05.3.query.sqlpp
new file mode 100644
index 0000000..11c6c6f
--- /dev/null
+++ b/asterix-app/src/test/resources/runtimets/queries_sqlpp/group-by/core-05/core-05.3.query.sqlpp
@@ -0,0 +1,47 @@
+/*
+ * 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;
+
+SELECT ELEMENT {
+        'Vehicle prices including 4 tires':
+        (   FROM Car c JOIN Tire t ON c.tire_size = t.size
+            GROUP BY c.tire_size AS tire_size GROUP AS g(c AS c, t AS t)
+            SELECT ELEMENT {
+                'tire_size': tire_size,
+                'avg_total_price': avg(
+                                         (  FROM g AS g
+                                            SELECT ELEMENT g.c.price + 4 * g.t.price
+                                          )
+                                       ),
+                'combinations':
+                            ( FROM g AS g
+                              SELECT ELEMENT {
+                                    'make': g.c.make,
+                                    'model': g.c.model,
+                                    'mfr': g.t.mfr,
+                                    'brand': g.t.brand,
+                                    'price': g.c.price + 4 * g.t.price
+                               }
+                               ORDER BY g.c.make, g.c.model, g.t.mfr, g.t.brand
+                            )
+              }
+        )
+    };
+

http://git-wip-us.apache.org/repos/asf/incubator-asterixdb/blob/acc12a9b/asterix-app/src/test/resources/runtimets/queries_sqlpp/group-by/sugar-01/sugar-01.1.ddl.sqlpp
----------------------------------------------------------------------
diff --git a/asterix-app/src/test/resources/runtimets/queries_sqlpp/group-by/sugar-01/sugar-01.1.ddl.sqlpp b/asterix-app/src/test/resources/runtimets/queries_sqlpp/group-by/sugar-01/sugar-01.1.ddl.sqlpp
new file mode 100644
index 0000000..bbccf8c
--- /dev/null
+++ b/asterix-app/src/test/resources/runtimets/queries_sqlpp/group-by/sugar-01/sugar-01.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 DATABASE gby IF EXISTS;
+CREATE DATABASE gby;
+
+USE gby;
+
+CREATE TYPE EmpType AS {
+  name : string
+}
+
+CREATE TABLE Employee(EmpType) PRIMARY KEY name;

http://git-wip-us.apache.org/repos/asf/incubator-asterixdb/blob/acc12a9b/asterix-app/src/test/resources/runtimets/queries_sqlpp/group-by/sugar-01/sugar-01.2.update.sqlpp
----------------------------------------------------------------------
diff --git a/asterix-app/src/test/resources/runtimets/queries_sqlpp/group-by/sugar-01/sugar-01.2.update.sqlpp b/asterix-app/src/test/resources/runtimets/queries_sqlpp/group-by/sugar-01/sugar-01.2.update.sqlpp
new file mode 100644
index 0000000..99116f6
--- /dev/null
+++ b/asterix-app/src/test/resources/runtimets/queries_sqlpp/group-by/sugar-01/sugar-01.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/incubator-asterixdb/blob/acc12a9b/asterix-app/src/test/resources/runtimets/queries_sqlpp/group-by/sugar-01/sugar-01.3.query.sqlpp
----------------------------------------------------------------------
diff --git a/asterix-app/src/test/resources/runtimets/queries_sqlpp/group-by/sugar-01/sugar-01.3.query.sqlpp b/asterix-app/src/test/resources/runtimets/queries_sqlpp/group-by/sugar-01/sugar-01.3.query.sqlpp
new file mode 100644
index 0000000..79758e3
--- /dev/null
+++ b/asterix-app/src/test/resources/runtimets/queries_sqlpp/group-by/sugar-01/sugar-01.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 gby;
+
+
+FROM Employee e
+GROUP BY e.deptno AS deptno GROUP AS g
+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/incubator-asterixdb/blob/acc12a9b/asterix-app/src/test/resources/runtimets/queries_sqlpp/group-by/sugar-02/sugar-02.1.ddl.sqlpp
----------------------------------------------------------------------
diff --git a/asterix-app/src/test/resources/runtimets/queries_sqlpp/group-by/sugar-02/sugar-02.1.ddl.sqlpp b/asterix-app/src/test/resources/runtimets/queries_sqlpp/group-by/sugar-02/sugar-02.1.ddl.sqlpp
new file mode 100644
index 0000000..b4ebc49
--- /dev/null
+++ b/asterix-app/src/test/resources/runtimets/queries_sqlpp/group-by/sugar-02/sugar-02.1.ddl.sqlpp
@@ -0,0 +1,39 @@
+/*
+ * 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 DATABASE gby IF EXISTS;
+CREATE DATABASE gby;
+
+USE gby;
+
+CREATE TYPE EmployeeType AS {
+  id : string
+}
+
+CREATE TYPE IncentiveType AS {
+  job_category: string
+}
+
+CREATE TYPE SuperStarType AS {
+  id : string
+}
+
+CREATE TABLE Employee(EmployeeType) PRIMARY KEY id;
+CREATE TABLE Incentive(IncentiveType) PRIMARY KEY job_category;
+CREATE TABLE SuperStars(SuperStarType) PRIMARY KEY id;

http://git-wip-us.apache.org/repos/asf/incubator-asterixdb/blob/acc12a9b/asterix-app/src/test/resources/runtimets/queries_sqlpp/group-by/sugar-02/sugar-02.2.update.sqlpp
----------------------------------------------------------------------
diff --git a/asterix-app/src/test/resources/runtimets/queries_sqlpp/group-by/sugar-02/sugar-02.2.update.sqlpp b/asterix-app/src/test/resources/runtimets/queries_sqlpp/group-by/sugar-02/sugar-02.2.update.sqlpp
new file mode 100644
index 0000000..e6545e0
--- /dev/null
+++ b/asterix-app/src/test/resources/runtimets/queries_sqlpp/group-by/sugar-02/sugar-02.2.update.sqlpp
@@ -0,0 +1,43 @@
+/*
+ * 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 (
+   {
+    'id': '123',
+    'job_category': 'Cook',
+    'salary': 2000,
+    'department_id': 'K55'
+   }
+);
+
+INSERT INTO Incentive (
+  { 'job_category': 'Cook',
+    'bonus': 1000
+  }
+)
+
+INSERT INTO SuperStars (
+  {
+    'id': '123'
+  }
+)
+

http://git-wip-us.apache.org/repos/asf/incubator-asterixdb/blob/acc12a9b/asterix-app/src/test/resources/runtimets/queries_sqlpp/group-by/sugar-02/sugar-02.3.query.sqlpp
----------------------------------------------------------------------
diff --git a/asterix-app/src/test/resources/runtimets/queries_sqlpp/group-by/sugar-02/sugar-02.3.query.sqlpp b/asterix-app/src/test/resources/runtimets/queries_sqlpp/group-by/sugar-02/sugar-02.3.query.sqlpp
new file mode 100644
index 0000000..b488a32
--- /dev/null
+++ b/asterix-app/src/test/resources/runtimets/queries_sqlpp/group-by/sugar-02/sugar-02.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;
+
+FROM Employee e
+    JOIN Incentive i ON e.job_category = i.job_category
+    JOIN SuperStars s ON e.id = s.id
+GROUP BY e.department_id AS deptId
+SELECT deptId as deptId, sum(e.salary + i.bonus) AS star_cost;
+

http://git-wip-us.apache.org/repos/asf/incubator-asterixdb/blob/acc12a9b/asterix-app/src/test/resources/runtimets/queries_sqlpp/group-by/sugar-03/sugar-03.1.ddl.sqlpp
----------------------------------------------------------------------
diff --git a/asterix-app/src/test/resources/runtimets/queries_sqlpp/group-by/sugar-03/sugar-03.1.ddl.sqlpp b/asterix-app/src/test/resources/runtimets/queries_sqlpp/group-by/sugar-03/sugar-03.1.ddl.sqlpp
new file mode 100644
index 0000000..7a281d2
--- /dev/null
+++ b/asterix-app/src/test/resources/runtimets/queries_sqlpp/group-by/sugar-03/sugar-03.1.ddl.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.
+ */
+
+DROP DATABASE gby IF EXISTS;
+CREATE DATABASE gby;
+
+USE gby;
+
+CREATE TYPE EmployeeType AS {
+  id : string
+}
+
+CREATE TYPE IncentiveType AS {
+  job_category: string
+}
+
+CREATE TYPE SuperStarType AS {
+  id : string
+}
+
+CREATE TABLE Employee(EmployeeType) PRIMARY KEY id;
+CREATE TABLE Incentive(IncentiveType) PRIMARY KEY job_category;
+CREATE TABLE SuperStars(SuperStarType) PRIMARY KEY id;
+

http://git-wip-us.apache.org/repos/asf/incubator-asterixdb/blob/acc12a9b/asterix-app/src/test/resources/runtimets/queries_sqlpp/group-by/sugar-03/sugar-03.2.update.sqlpp
----------------------------------------------------------------------
diff --git a/asterix-app/src/test/resources/runtimets/queries_sqlpp/group-by/sugar-03/sugar-03.2.update.sqlpp b/asterix-app/src/test/resources/runtimets/queries_sqlpp/group-by/sugar-03/sugar-03.2.update.sqlpp
new file mode 100644
index 0000000..19f0c1f
--- /dev/null
+++ b/asterix-app/src/test/resources/runtimets/queries_sqlpp/group-by/sugar-03/sugar-03.2.update.sqlpp
@@ -0,0 +1,42 @@
+/*
+ * Licensed to the Apache Software Foundation (ASF) under one
+ * or more contributor license agreements.  See the NOTICE file
+ * distributed with this work for additional information
+ * regarding copyright ownership.  The ASF licenses this file
+ * to you under the Apache License, Version 2.0 (the
+ * "License"); you may not use this file except in compliance
+ * with the License.  You may obtain a copy of the License at
+ *
+ *   http://www.apache.org/licenses/LICENSE-2.0
+ *
+ * Unless required by applicable law or agreed to in writing,
+ * software distributed under the License is distributed on an
+ * "AS IS" BASIS, WITHOUT WARRANTIES OR CONDITIONS OF ANY
+ * KIND, either express or implied.  See the License for the
+ * specific language governing permissions and limitations
+ * under the License.
+ */
+
+USE gby;
+
+INSERT INTO Employee (
+   {
+    'id': '123',
+    'job_category': 'Cook',
+    'salary': 2000,
+    'department_id': 'K55'
+   }
+);
+
+INSERT INTO Incentive (
+  { 'job_category': 'Cook',
+    'bonus': 1000
+  }
+)
+
+INSERT INTO SuperStars (
+  {
+    'id': '123'
+  }
+)
+

http://git-wip-us.apache.org/repos/asf/incubator-asterixdb/blob/acc12a9b/asterix-app/src/test/resources/runtimets/queries_sqlpp/group-by/sugar-03/sugar-03.3.query.sqlpp
----------------------------------------------------------------------
diff --git a/asterix-app/src/test/resources/runtimets/queries_sqlpp/group-by/sugar-03/sugar-03.3.query.sqlpp b/asterix-app/src/test/resources/runtimets/queries_sqlpp/group-by/sugar-03/sugar-03.3.query.sqlpp
new file mode 100644
index 0000000..49dd2c0
--- /dev/null
+++ b/asterix-app/src/test/resources/runtimets/queries_sqlpp/group-by/sugar-03/sugar-03.3.query.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;
+
+FROM Employee e
+    JOIN Incentive i ON e.job_category = i.job_category
+    JOIN SuperStars s ON e.id = s.id
+GROUP BY e.department_id AS deptId GROUP AS eis
+SELECT deptId as deptId,
+    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
+    ) AS topstar_details
+    ;

http://git-wip-us.apache.org/repos/asf/incubator-asterixdb/blob/acc12a9b/asterix-app/src/test/resources/runtimets/queries_sqlpp/group-by/sugar-04/sugar-04.1.ddl.sqlpp
----------------------------------------------------------------------
diff --git a/asterix-app/src/test/resources/runtimets/queries_sqlpp/group-by/sugar-04/sugar-04.1.ddl.sqlpp b/asterix-app/src/test/resources/runtimets/queries_sqlpp/group-by/sugar-04/sugar-04.1.ddl.sqlpp
new file mode 100644
index 0000000..7a281d2
--- /dev/null
+++ b/asterix-app/src/test/resources/runtimets/queries_sqlpp/group-by/sugar-04/sugar-04.1.ddl.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.
+ */
+
+DROP DATABASE gby IF EXISTS;
+CREATE DATABASE gby;
+
+USE gby;
+
+CREATE TYPE EmployeeType AS {
+  id : string
+}
+
+CREATE TYPE IncentiveType AS {
+  job_category: string
+}
+
+CREATE TYPE SuperStarType AS {
+  id : string
+}
+
+CREATE TABLE Employee(EmployeeType) PRIMARY KEY id;
+CREATE TABLE Incentive(IncentiveType) PRIMARY KEY job_category;
+CREATE TABLE SuperStars(SuperStarType) PRIMARY KEY id;
+

http://git-wip-us.apache.org/repos/asf/incubator-asterixdb/blob/acc12a9b/asterix-app/src/test/resources/runtimets/queries_sqlpp/group-by/sugar-04/sugar-04.2.update.sqlpp
----------------------------------------------------------------------
diff --git a/asterix-app/src/test/resources/runtimets/queries_sqlpp/group-by/sugar-04/sugar-04.2.update.sqlpp b/asterix-app/src/test/resources/runtimets/queries_sqlpp/group-by/sugar-04/sugar-04.2.update.sqlpp
new file mode 100644
index 0000000..52443b5
--- /dev/null
+++ b/asterix-app/src/test/resources/runtimets/queries_sqlpp/group-by/sugar-04/sugar-04.2.update.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.
+ */
+
+USE gby;
+
+INSERT INTO Employee (
+  [
+   {
+    'id': '123',
+    'job_category': 'Cook',
+    'salary': 2000,
+    'department_id': 'K55'
+   },
+   {
+    'id': '234',
+    'job_category': 'Teach',
+    'salary': 2500,
+    'department_id': 'K54'
+   }
+  ]
+);
+
+INSERT INTO Incentive (
+ [
+  { 'job_category': 'Cook',
+    'bonus': 1000
+  },
+  { 'job_category': 'Teach',
+    'bonus': 2000
+  }
+ ]
+)
+
+INSERT INTO SuperStars (
+  {
+    'id': '123'
+  }
+)
+

http://git-wip-us.apache.org/repos/asf/incubator-asterixdb/blob/acc12a9b/asterix-app/src/test/resources/runtimets/queries_sqlpp/group-by/sugar-04/sugar-04.3.query.sqlpp
----------------------------------------------------------------------
diff --git a/asterix-app/src/test/resources/runtimets/queries_sqlpp/group-by/sugar-04/sugar-04.3.query.sqlpp b/asterix-app/src/test/resources/runtimets/queries_sqlpp/group-by/sugar-04/sugar-04.3.query.sqlpp
new file mode 100644
index 0000000..d8fb8c9
--- /dev/null
+++ b/asterix-app/src/test/resources/runtimets/queries_sqlpp/group-by/sugar-04/sugar-04.3.query.sqlpp
@@ -0,0 +1,31 @@
+/*
+ * 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;
+
+FROM  Employee e, Incentive i
+WHERE e.job_category = i.job_category
+GROUP BY e.department_id AS deptId
+SELECT deptId AS deptId,
+     (  FROM i AS i
+        SELECT i.job_category AS category, i.bonus AS bonus
+        ORDER BY i.bonus DESC LIMIT 3
+      ) AS job_category_details
+ORDER BY deptId DESC;
+

http://git-wip-us.apache.org/repos/asf/incubator-asterixdb/blob/acc12a9b/asterix-app/src/test/resources/runtimets/queries_sqlpp/group-by/sugar-05/sugar-05.1.ddl.sqlpp
----------------------------------------------------------------------
diff --git a/asterix-app/src/test/resources/runtimets/queries_sqlpp/group-by/sugar-05/sugar-05.1.ddl.sqlpp b/asterix-app/src/test/resources/runtimets/queries_sqlpp/group-by/sugar-05/sugar-05.1.ddl.sqlpp
new file mode 100644
index 0000000..2030780
--- /dev/null
+++ b/asterix-app/src/test/resources/runtimets/queries_sqlpp/group-by/sugar-05/sugar-05.1.ddl.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.
+ */
+
+DROP DATABASE gby IF EXISTS;
+CREATE DATABASE gby;
+
+USE gby;
+
+CREATE TYPE CarType AS {
+  cid : string
+}
+
+CREATE TYPE TireType AS {
+  tid: string
+}
+
+CREATE TABLE Car(CarType) PRIMARY KEY cid;
+CREATE TABLE Tire(TireType) PRIMARY KEY tid;
+

http://git-wip-us.apache.org/repos/asf/incubator-asterixdb/blob/acc12a9b/asterix-app/src/test/resources/runtimets/queries_sqlpp/group-by/sugar-05/sugar-05.2.update.sqlpp
----------------------------------------------------------------------
diff --git a/asterix-app/src/test/resources/runtimets/queries_sqlpp/group-by/sugar-05/sugar-05.2.update.sqlpp b/asterix-app/src/test/resources/runtimets/queries_sqlpp/group-by/sugar-05/sugar-05.2.update.sqlpp
new file mode 100644
index 0000000..275e4fc
--- /dev/null
+++ b/asterix-app/src/test/resources/runtimets/queries_sqlpp/group-by/sugar-05/sugar-05.2.update.sqlpp
@@ -0,0 +1,59 @@
+/*
+ * 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 Car (
+  [
+   {
+    'cid': '1',
+    'make': 'Honda',
+    'model': 'Civic',
+    'price': 28000,
+    'tire_size': 'P205/55R16'
+   },
+   {
+    'cid': '2',
+    'make': 'Toyota',
+    'model': 'Corolla',
+    'price': 27000,
+    'tire_size': 'P205/55R16'
+   }
+  ]
+);
+
+INSERT INTO Tire (
+ [
+   {
+        'tid': '1',
+        'mfr': 'Bridgestone',
+        'brand': 'Turanza',
+        'size': 'P205/55R16',
+        'price': 150
+    },
+    {
+        'tid': '2',
+        'mfr': 'Goodyear',
+        'brand': 'Eagle',
+        'size': 'P205/55R16',
+        'price': 100
+    }
+ ]
+)
+

http://git-wip-us.apache.org/repos/asf/incubator-asterixdb/blob/acc12a9b/asterix-app/src/test/resources/runtimets/queries_sqlpp/group-by/sugar-05/sugar-05.3.query.sqlpp
----------------------------------------------------------------------
diff --git a/asterix-app/src/test/resources/runtimets/queries_sqlpp/group-by/sugar-05/sugar-05.3.query.sqlpp b/asterix-app/src/test/resources/runtimets/queries_sqlpp/group-by/sugar-05/sugar-05.3.query.sqlpp
new file mode 100644
index 0000000..1a7a2bf
--- /dev/null
+++ b/asterix-app/src/test/resources/runtimets/queries_sqlpp/group-by/sugar-05/sugar-05.3.query.sqlpp
@@ -0,0 +1,38 @@
+/*
+ * 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;
+
+SELECT ELEMENT {
+        'Vehicle prices including 4 tires':
+        (
+            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,
+                   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,
+                            g.t.mfr AS mfr,
+                            g.t.brand AS brand,
+                            g.c.price + 4 * g.t.price AS price
+                     ORDER BY g.c.make, g.c.model, g.t.mfr, g.t.brand
+                   ) AS combinations
+        )
+    };

http://git-wip-us.apache.org/repos/asf/incubator-asterixdb/blob/acc12a9b/asterix-app/src/test/resources/runtimets/queries_sqlpp/tpch-sql-like/q14_promotion_effect/q14_promotion_effect.3.query.sqlpp
----------------------------------------------------------------------
diff --git a/asterix-app/src/test/resources/runtimets/queries_sqlpp/tpch-sql-like/q14_promotion_effect/q14_promotion_effect.3.query.sqlpp b/asterix-app/src/test/resources/runtimets/queries_sqlpp/tpch-sql-like/q14_promotion_effect/q14_promotion_effect.3.query.sqlpp
index 559dfc8..a8f29d3 100644
--- a/asterix-app/src/test/resources/runtimets/queries_sqlpp/tpch-sql-like/q14_promotion_effect/q14_promotion_effect.3.query.sqlpp
+++ b/asterix-app/src/test/resources/runtimets/queries_sqlpp/tpch-sql-like/q14_promotion_effect/q14_promotion_effect.3.query.sqlpp
@@ -22,13 +22,14 @@ use tpch;
 
 select element (100.0 * tpch.sum((
       select element tpch."switch-case"(tpch.like(i.p_type,'PROMO%'),true,(i.l_extendedprice * (1 - i.l_discount)),false,0.0)
-      from  l as i
+      from  lp as i
   )) / tpch.sum((
       select element (i.l_extendedprice * (1 - i.l_discount))
-      from  l as i
+      from  lp as i
   )))
 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
 ;

http://git-wip-us.apache.org/repos/asf/incubator-asterixdb/blob/acc12a9b/asterix-app/src/test/resources/runtimets/queries_sqlpp/tpch-sql/distinct_by/distinct_by.1.ddl.sqlpp
----------------------------------------------------------------------
diff --git a/asterix-app/src/test/resources/runtimets/queries_sqlpp/tpch-sql/distinct_by/distinct_by.1.ddl.sqlpp b/asterix-app/src/test/resources/runtimets/queries_sqlpp/tpch-sql/distinct_by/distinct_by.1.ddl.sqlpp
new file mode 100644
index 0000000..c5fcd3f
--- /dev/null
+++ b/asterix-app/src/test/resources/runtimets/queries_sqlpp/tpch-sql/distinct_by/distinct_by.1.ddl.sqlpp
@@ -0,0 +1,47 @@
+/*
+ * 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  database tpch if exists;
+create  database tpch;
+
+use tpch;
+
+
+create type tpch.LineItemType as
+ closed {
+  l_orderkey : int32,
+  l_partkey : int32,
+  l_suppkey : int32,
+  l_linenumber : int32,
+  l_quantity : double,
+  l_extendedprice : double,
+  l_discount : double,
+  l_tax : double,
+  l_returnflag : string,
+  l_linestatus : string,
+  l_shipdate : string,
+  l_commitdate : string,
+  l_receiptdate : string,
+  l_shipinstruct : string,
+  l_shipmode : string,
+  l_comment : string
+}
+
+create  table LineItem(LineItemType) primary key l_orderkey,l_linenumber;
+

http://git-wip-us.apache.org/repos/asf/incubator-asterixdb/blob/acc12a9b/asterix-app/src/test/resources/runtimets/queries_sqlpp/tpch-sql/distinct_by/distinct_by.2.update.sqlpp
----------------------------------------------------------------------
diff --git a/asterix-app/src/test/resources/runtimets/queries_sqlpp/tpch-sql/distinct_by/distinct_by.2.update.sqlpp b/asterix-app/src/test/resources/runtimets/queries_sqlpp/tpch-sql/distinct_by/distinct_by.2.update.sqlpp
new file mode 100644
index 0000000..ffd9143
--- /dev/null
+++ b/asterix-app/src/test/resources/runtimets/queries_sqlpp/tpch-sql/distinct_by/distinct_by.2.update.sqlpp
@@ -0,0 +1,24 @@
+/*
+ * Licensed to the Apache Software Foundation (ASF) under one
+ * or more contributor license agreements.  See the NOTICE file
+ * distributed with this work for additional information
+ * regarding copyright ownership.  The ASF licenses this file
+ * to you under the Apache License, Version 2.0 (the
+ * "License"); you may not use this file except in compliance
+ * with the License.  You may obtain a copy of the License at
+ *
+ *   http://www.apache.org/licenses/LICENSE-2.0
+ *
+ * Unless required by applicable law or agreed to in writing,
+ * software distributed under the License is distributed on an
+ * "AS IS" BASIS, WITHOUT WARRANTIES OR CONDITIONS OF ANY
+ * KIND, either express or implied.  See the License for the
+ * specific language governing permissions and limitations
+ * under the License.
+ */
+
+use tpch;
+
+
+load  table LineItem using localfs (("path"="asterix_nc1://data/tpch0.001/lineitem.tbl"),("format"="delimited-text"),("delimiter"="|")) pre-sorted;
+

http://git-wip-us.apache.org/repos/asf/incubator-asterixdb/blob/acc12a9b/asterix-app/src/test/resources/runtimets/queries_sqlpp/tpch-sql/distinct_by/distinct_by.3.query.sqlpp
----------------------------------------------------------------------
diff --git a/asterix-app/src/test/resources/runtimets/queries_sqlpp/tpch-sql/distinct_by/distinct_by.3.query.sqlpp b/asterix-app/src/test/resources/runtimets/queries_sqlpp/tpch-sql/distinct_by/distinct_by.3.query.sqlpp
new file mode 100644
index 0000000..843afa0
--- /dev/null
+++ b/asterix-app/src/test/resources/runtimets/queries_sqlpp/tpch-sql/distinct_by/distinct_by.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 tpch;
+
+
+SELECT DISTINCT
+       l.l_returnflag AS l_returnflag,
+       l.l_linestatus AS l_linestatus,
+       l.l_shipmode AS l_shipmode
+FROM  LineItem AS l
+ORDER BY l.l_returnflag,l.l_linestatus,l.l_shipmode
+;

http://git-wip-us.apache.org/repos/asf/incubator-asterixdb/blob/acc12a9b/asterix-app/src/test/resources/runtimets/queries_sqlpp/tpch-sql/group_no_agg/group_no_agg.1.ddl.sqlpp
----------------------------------------------------------------------
diff --git a/asterix-app/src/test/resources/runtimets/queries_sqlpp/tpch-sql/group_no_agg/group_no_agg.1.ddl.sqlpp b/asterix-app/src/test/resources/runtimets/queries_sqlpp/tpch-sql/group_no_agg/group_no_agg.1.ddl.sqlpp
new file mode 100644
index 0000000..581b684
--- /dev/null
+++ b/asterix-app/src/test/resources/runtimets/queries_sqlpp/tpch-sql/group_no_agg/group_no_agg.1.ddl.sqlpp
@@ -0,0 +1,34 @@
+/*
+ * 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  database tpch if exists;
+create  database tpch;
+
+use tpch;
+
+
+create type tpch.RegionType as
+ closed {
+  r_regionkey : int32,
+  r_name : string,
+  r_comment : string
+}
+
+create  table Regions_group_no_agg(RegionType) primary key r_regionkey;
+

http://git-wip-us.apache.org/repos/asf/incubator-asterixdb/blob/acc12a9b/asterix-app/src/test/resources/runtimets/queries_sqlpp/tpch-sql/group_no_agg/group_no_agg.2.update.sqlpp
----------------------------------------------------------------------
diff --git a/asterix-app/src/test/resources/runtimets/queries_sqlpp/tpch-sql/group_no_agg/group_no_agg.2.update.sqlpp b/asterix-app/src/test/resources/runtimets/queries_sqlpp/tpch-sql/group_no_agg/group_no_agg.2.update.sqlpp
new file mode 100644
index 0000000..a012a5b
--- /dev/null
+++ b/asterix-app/src/test/resources/runtimets/queries_sqlpp/tpch-sql/group_no_agg/group_no_agg.2.update.sqlpp
@@ -0,0 +1,24 @@
+/*
+ * Licensed to the Apache Software Foundation (ASF) under one
+ * or more contributor license agreements.  See the NOTICE file
+ * distributed with this work for additional information
+ * regarding copyright ownership.  The ASF licenses this file
+ * to you under the Apache License, Version 2.0 (the
+ * "License"); you may not use this file except in compliance
+ * with the License.  You may obtain a copy of the License at
+ *
+ *   http://www.apache.org/licenses/LICENSE-2.0
+ *
+ * Unless required by applicable law or agreed to in writing,
+ * software distributed under the License is distributed on an
+ * "AS IS" BASIS, WITHOUT WARRANTIES OR CONDITIONS OF ANY
+ * KIND, either express or implied.  See the License for the
+ * specific language governing permissions and limitations
+ * under the License.
+ */
+
+use tpch;
+
+
+load  table Regions_group_no_agg using localfs (("path"="asterix_nc1://data/tpch0.001/region.tbl"),("format"="delimited-text"),("delimiter"="|")) pre-sorted;
+

http://git-wip-us.apache.org/repos/asf/incubator-asterixdb/blob/acc12a9b/asterix-app/src/test/resources/runtimets/queries_sqlpp/tpch-sql/group_no_agg/group_no_agg.3.query.sqlpp
----------------------------------------------------------------------
diff --git a/asterix-app/src/test/resources/runtimets/queries_sqlpp/tpch-sql/group_no_agg/group_no_agg.3.query.sqlpp b/asterix-app/src/test/resources/runtimets/queries_sqlpp/tpch-sql/group_no_agg/group_no_agg.3.query.sqlpp
new file mode 100644
index 0000000..b1e5a5b
--- /dev/null
+++ b/asterix-app/src/test/resources/runtimets/queries_sqlpp/tpch-sql/group_no_agg/group_no_agg.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 tpch;
+
+
+SELECT VALUE name
+FROM  Regions_group_no_agg AS r
+GROUP BY r.r_name AS name
+ORDER BY name
+;

http://git-wip-us.apache.org/repos/asf/incubator-asterixdb/blob/acc12a9b/asterix-app/src/test/resources/runtimets/queries_sqlpp/tpch-sql/nest_aggregate/nest_aggregate.1.ddl.sqlpp
----------------------------------------------------------------------
diff --git a/asterix-app/src/test/resources/runtimets/queries_sqlpp/tpch-sql/nest_aggregate/nest_aggregate.1.ddl.sqlpp b/asterix-app/src/test/resources/runtimets/queries_sqlpp/tpch-sql/nest_aggregate/nest_aggregate.1.ddl.sqlpp
new file mode 100644
index 0000000..3b070de
--- /dev/null
+++ b/asterix-app/src/test/resources/runtimets/queries_sqlpp/tpch-sql/nest_aggregate/nest_aggregate.1.ddl.sqlpp
@@ -0,0 +1,94 @@
+/*
+ * 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.
+ */
+/*
+ * Description  : This test case is to verify the fix for issue782
+ * https://code.google.com/p/asterixdb/issues/detail?id=782
+ * Expected Res : SUCCESS
+ * Date         : 2nd Jun 2014
+ */
+
+drop  database tpch if exists;
+create  database tpch;
+
+use tpch;
+
+
+create type tpch.OrderType as
+ closed {
+  o_orderkey : int64,
+  o_custkey : int64,
+  o_orderstatus : string,
+  o_totalprice : double,
+  o_orderdate : string,
+  o_orderpriority : string,
+  o_clerk : string,
+  o_shippriority : int64,
+  o_comment : string
+}
+
+create type tpch.CustomerType as
+ closed {
+  c_custkey : int64,
+  c_name : string,
+  c_address : string,
+  c_nationkey : int64,
+  c_phone : string,
+  c_acctbal : double,
+  c_mktsegment : string,
+  c_comment : string
+}
+
+create type tpch.SupplierType as
+ closed {
+  s_suppkey : int64,
+  s_name : string,
+  s_address : string,
+  s_nationkey : int64,
+  s_phone : string,
+  s_acctbal : double,
+  s_comment : string
+}
+
+create type tpch.NationType as
+ closed {
+  n_nationkey : int64,
+  n_name : string,
+  n_regionkey : int64,
+  n_comment : string
+}
+
+create type tpch.RegionType as
+ closed {
+  r_regionkey : int64,
+  r_name : string,
+  r_comment : string
+}
+
+create  table Orders(OrderType) primary key o_orderkey;
+
+create  table Supplier(SupplierType) primary key s_suppkey;
+
+create  table Region(RegionType) primary key r_regionkey;
+
+create  table Nation(NationType) primary key n_nationkey;
+
+create  table Customer(CustomerType) primary key c_custkey;
+
+create  table SelectedNation(NationType) primary key n_nationkey;
+

http://git-wip-us.apache.org/repos/asf/incubator-asterixdb/blob/acc12a9b/asterix-app/src/test/resources/runtimets/queries_sqlpp/tpch-sql/nest_aggregate/nest_aggregate.2.update.sqlpp
----------------------------------------------------------------------
diff --git a/asterix-app/src/test/resources/runtimets/queries_sqlpp/tpch-sql/nest_aggregate/nest_aggregate.2.update.sqlpp b/asterix-app/src/test/resources/runtimets/queries_sqlpp/tpch-sql/nest_aggregate/nest_aggregate.2.update.sqlpp
new file mode 100644
index 0000000..8e61b76
--- /dev/null
+++ b/asterix-app/src/test/resources/runtimets/queries_sqlpp/tpch-sql/nest_aggregate/nest_aggregate.2.update.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.
+ */
+/*
+ * Description  : This test case is to verify the fix for issue782
+ * https://code.google.com/p/asterixdb/issues/detail?id=782
+ * Expected Res : SUCCESS
+ * Date         : 2nd Jun 2014
+ */
+
+use tpch;
+
+
+load  table Orders using localfs (("path"="asterix_nc1://data/tpch0.001/orders.tbl"),("format"="delimited-text"),("delimiter"="|"));
+
+load  table Supplier using localfs (("path"="asterix_nc1://data/tpch0.001/supplier.tbl"),("format"="delimited-text"),("delimiter"="|"));
+
+load  table Region using localfs (("path"="asterix_nc1://data/tpch0.001/region.tbl"),("format"="delimited-text"),("delimiter"="|"));
+
+load  table Nation using localfs (("path"="asterix_nc1://data/tpch0.001/nation.tbl"),("format"="delimited-text"),("delimiter"="|"));
+
+load  table Customer using localfs (("path"="asterix_nc1://data/tpch0.001/customer.tbl"),("format"="delimited-text"),("delimiter"="|"));
+
+load  table SelectedNation using localfs (("path"="asterix_nc1://data/tpch0.001/selectednation.tbl"),("format"="delimited-text"),("delimiter"="|"));
+

http://git-wip-us.apache.org/repos/asf/incubator-asterixdb/blob/acc12a9b/asterix-app/src/test/resources/runtimets/queries_sqlpp/tpch-sql/nest_aggregate/nest_aggregate.3.query.sqlpp
----------------------------------------------------------------------
diff --git a/asterix-app/src/test/resources/runtimets/queries_sqlpp/tpch-sql/nest_aggregate/nest_aggregate.3.query.sqlpp b/asterix-app/src/test/resources/runtimets/queries_sqlpp/tpch-sql/nest_aggregate/nest_aggregate.3.query.sqlpp
new file mode 100644
index 0000000..a4396d7
--- /dev/null
+++ b/asterix-app/src/test/resources/runtimets/queries_sqlpp/tpch-sql/nest_aggregate/nest_aggregate.3.query.sqlpp
@@ -0,0 +1,44 @@
+/*
+ * 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.
+ */
+/*
+ * Description  : This test case is to verify the fix for issue782
+ * https://code.google.com/p/asterixdb/issues/detail?id=782
+ * Expected Res : SUCCESS
+ * Date         : 2nd Jun 2014
+ */
+
+USE tpch;
+
+
+SELECT  nation.n_nationkey AS nation_key,
+        nation.n_name AS name,
+        (
+            SELECT orderdate AS order_date, sum(orders.o_totalprice) AS sum_price
+            FROM  Orders AS orders,
+                  Customer AS customer
+            WHERE orders.o_custkey = customer.c_custkey AND customer.c_nationkey = nation.n_nationkey
+            GROUP BY orders.o_orderdate AS orderdate
+            ORDER BY sum_price
+            LIMIT 3
+        ) AS aggregates
+FROM  Nation AS nation,
+      SelectedNation AS sn
+WHERE nation.n_nationkey /*+ indexnl */ = sn.n_nationkey
+ORDER BY nation.n_nationkey
+;

http://git-wip-us.apache.org/repos/asf/incubator-asterixdb/blob/acc12a9b/asterix-app/src/test/resources/runtimets/queries_sqlpp/tpch-sql/nest_aggregate2/nest_aggregate2.1.ddl.sqlpp
----------------------------------------------------------------------
diff --git a/asterix-app/src/test/resources/runtimets/queries_sqlpp/tpch-sql/nest_aggregate2/nest_aggregate2.1.ddl.sqlpp b/asterix-app/src/test/resources/runtimets/queries_sqlpp/tpch-sql/nest_aggregate2/nest_aggregate2.1.ddl.sqlpp
new file mode 100644
index 0000000..3b070de
--- /dev/null
+++ b/asterix-app/src/test/resources/runtimets/queries_sqlpp/tpch-sql/nest_aggregate2/nest_aggregate2.1.ddl.sqlpp
@@ -0,0 +1,94 @@
+/*
+ * 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.
+ */
+/*
+ * Description  : This test case is to verify the fix for issue782
+ * https://code.google.com/p/asterixdb/issues/detail?id=782
+ * Expected Res : SUCCESS
+ * Date         : 2nd Jun 2014
+ */
+
+drop  database tpch if exists;
+create  database tpch;
+
+use tpch;
+
+
+create type tpch.OrderType as
+ closed {
+  o_orderkey : int64,
+  o_custkey : int64,
+  o_orderstatus : string,
+  o_totalprice : double,
+  o_orderdate : string,
+  o_orderpriority : string,
+  o_clerk : string,
+  o_shippriority : int64,
+  o_comment : string
+}
+
+create type tpch.CustomerType as
+ closed {
+  c_custkey : int64,
+  c_name : string,
+  c_address : string,
+  c_nationkey : int64,
+  c_phone : string,
+  c_acctbal : double,
+  c_mktsegment : string,
+  c_comment : string
+}
+
+create type tpch.SupplierType as
+ closed {
+  s_suppkey : int64,
+  s_name : string,
+  s_address : string,
+  s_nationkey : int64,
+  s_phone : string,
+  s_acctbal : double,
+  s_comment : string
+}
+
+create type tpch.NationType as
+ closed {
+  n_nationkey : int64,
+  n_name : string,
+  n_regionkey : int64,
+  n_comment : string
+}
+
+create type tpch.RegionType as
+ closed {
+  r_regionkey : int64,
+  r_name : string,
+  r_comment : string
+}
+
+create  table Orders(OrderType) primary key o_orderkey;
+
+create  table Supplier(SupplierType) primary key s_suppkey;
+
+create  table Region(RegionType) primary key r_regionkey;
+
+create  table Nation(NationType) primary key n_nationkey;
+
+create  table Customer(CustomerType) primary key c_custkey;
+
+create  table SelectedNation(NationType) primary key n_nationkey;
+

http://git-wip-us.apache.org/repos/asf/incubator-asterixdb/blob/acc12a9b/asterix-app/src/test/resources/runtimets/queries_sqlpp/tpch-sql/nest_aggregate2/nest_aggregate2.2.update.sqlpp
----------------------------------------------------------------------
diff --git a/asterix-app/src/test/resources/runtimets/queries_sqlpp/tpch-sql/nest_aggregate2/nest_aggregate2.2.update.sqlpp b/asterix-app/src/test/resources/runtimets/queries_sqlpp/tpch-sql/nest_aggregate2/nest_aggregate2.2.update.sqlpp
new file mode 100644
index 0000000..8e61b76
--- /dev/null
+++ b/asterix-app/src/test/resources/runtimets/queries_sqlpp/tpch-sql/nest_aggregate2/nest_aggregate2.2.update.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.
+ */
+/*
+ * Description  : This test case is to verify the fix for issue782
+ * https://code.google.com/p/asterixdb/issues/detail?id=782
+ * Expected Res : SUCCESS
+ * Date         : 2nd Jun 2014
+ */
+
+use tpch;
+
+
+load  table Orders using localfs (("path"="asterix_nc1://data/tpch0.001/orders.tbl"),("format"="delimited-text"),("delimiter"="|"));
+
+load  table Supplier using localfs (("path"="asterix_nc1://data/tpch0.001/supplier.tbl"),("format"="delimited-text"),("delimiter"="|"));
+
+load  table Region using localfs (("path"="asterix_nc1://data/tpch0.001/region.tbl"),("format"="delimited-text"),("delimiter"="|"));
+
+load  table Nation using localfs (("path"="asterix_nc1://data/tpch0.001/nation.tbl"),("format"="delimited-text"),("delimiter"="|"));
+
+load  table Customer using localfs (("path"="asterix_nc1://data/tpch0.001/customer.tbl"),("format"="delimited-text"),("delimiter"="|"));
+
+load  table SelectedNation using localfs (("path"="asterix_nc1://data/tpch0.001/selectednation.tbl"),("format"="delimited-text"),("delimiter"="|"));
+



Mime
View raw message