You are viewing a plain text version of this content. The canonical link for it is here.
Posted to commits@asterixdb.apache.org by bu...@apache.org on 2015/10/31 00:16:11 UTC

[03/51] [partial] incubator-asterixdb git commit: SQL++ parser: 1. refactored asterix-aql to become asterix-lang-common and asterix-lang-aql, where the former is the common part for different languages; 2. added asterix-lang-sqlpp on top of asterix-lang-

http://git-wip-us.apache.org/repos/asf/incubator-asterixdb/blob/391f09e5/asterix-app/src/test/resources/parserts/queries-sql-like/nestedFor.aql
----------------------------------------------------------------------
diff --git a/asterix-app/src/test/resources/parserts/queries-sql-like/nestedFor.aql b/asterix-app/src/test/resources/parserts/queries-sql-like/nestedFor.aql
new file mode 100644
index 0000000..88d0bcc
--- /dev/null
+++ b/asterix-app/src/test/resources/parserts/queries-sql-like/nestedFor.aql
@@ -0,0 +1,22 @@
+/*
+ * 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.
+ */
+from $user in dataset('User')
+from $mv in dataset('Movie')
+where some $i in $user.interests satisfies $i.movie = $mv.movie
+select { "name": $user.name, "movie": $mv.movie }

http://git-wip-us.apache.org/repos/asf/incubator-asterixdb/blob/391f09e5/asterix-app/src/test/resources/parserts/queries-sql-like/numberInFieldAccessor.aql
----------------------------------------------------------------------
diff --git a/asterix-app/src/test/resources/parserts/queries-sql-like/numberInFieldAccessor.aql b/asterix-app/src/test/resources/parserts/queries-sql-like/numberInFieldAccessor.aql
new file mode 100644
index 0000000..8d58272
--- /dev/null
+++ b/asterix-app/src/test/resources/parserts/queries-sql-like/numberInFieldAccessor.aql
@@ -0,0 +1,22 @@
+/*
+ * 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.
+ */
+from $user in dataset('User')
+from $mv in dataset('Movie')
+where some $i in $user.interests satisfies $i.movie = $mv.movie[2]
+select { "name": $user.name, "movie": $mv.movie }

http://git-wip-us.apache.org/repos/asf/incubator-asterixdb/blob/391f09e5/asterix-app/src/test/resources/parserts/queries-sql-like/union.aql
----------------------------------------------------------------------
diff --git a/asterix-app/src/test/resources/parserts/queries-sql-like/union.aql b/asterix-app/src/test/resources/parserts/queries-sql-like/union.aql
new file mode 100644
index 0000000..a850807
--- /dev/null
+++ b/asterix-app/src/test/resources/parserts/queries-sql-like/union.aql
@@ -0,0 +1,26 @@
+/*
+ * Licensed to the Apache Software Foundation (ASF) under one
+ * or more contributor license agreements.  See the NOTICE file
+ * distributed with this work for additional information
+ * regarding copyright ownership.  The ASF licenses this file
+ * to you under the Apache License, Version 2.0 (the
+ * "License"); you may not use this file except in compliance
+ * with the License.  You may obtain a copy of the License at
+ *
+ *   http://www.apache.org/licenses/LICENSE-2.0
+ *
+ * Unless required by applicable law or agreed to in writing,
+ * software distributed under the License is distributed on an
+ * "AS IS" BASIS, WITHOUT WARRANTIES OR CONDITIONS OF ANY
+ * KIND, either express or implied.  See the License for the
+ * specific language governing permissions and limitations
+ * under the License.
+ */
+(from $l in foo1()
+select $l)
+union
+(from $l in foo2()
+select $l)
+union
+(from $l in foo3()
+select $l)

http://git-wip-us.apache.org/repos/asf/incubator-asterixdb/blob/391f09e5/asterix-app/src/test/resources/parserts/queries-sql-like/variables.aql
----------------------------------------------------------------------
diff --git a/asterix-app/src/test/resources/parserts/queries-sql-like/variables.aql b/asterix-app/src/test/resources/parserts/queries-sql-like/variables.aql
new file mode 100644
index 0000000..9efb2c0
--- /dev/null
+++ b/asterix-app/src/test/resources/parserts/queries-sql-like/variables.aql
@@ -0,0 +1,22 @@
+/*
+ * 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.
+ */
+with $a:=1
+with $b:=1
+return
+  $b-$a

http://git-wip-us.apache.org/repos/asf/incubator-asterixdb/blob/391f09e5/asterix-app/src/test/resources/parserts/queries/1.aql
----------------------------------------------------------------------
diff --git a/asterix-app/src/test/resources/parserts/queries/1.aql b/asterix-app/src/test/resources/parserts/queries/1.aql
new file mode 100644
index 0000000..fcf1126
--- /dev/null
+++ b/asterix-app/src/test/resources/parserts/queries/1.aql
@@ -0,0 +1,21 @@
+/*
+ * 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.
+ */
+for $user in dataset('User')
+where some $i in $user.interests satisfies $i = "movies"
+return { "name": $user.name }

http://git-wip-us.apache.org/repos/asf/incubator-asterixdb/blob/391f09e5/asterix-app/src/test/resources/parserts/queries/2.aql
----------------------------------------------------------------------
diff --git a/asterix-app/src/test/resources/parserts/queries/2.aql b/asterix-app/src/test/resources/parserts/queries/2.aql
new file mode 100644
index 0000000..9a343f6
--- /dev/null
+++ b/asterix-app/src/test/resources/parserts/queries/2.aql
@@ -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.
+ */
+for $event in dataset('Event')
+for $sponsor in $event.sponsoring_sigs
+let $es := { "event": $event, "sponsor": $sponsor }
+group by $sig_name := $sponsor.sig_name with $es
+let $sig_sponsorship_count := count($es)
+let $by_chapter :=
+   for $e in $es
+   group by $chapter_name := $e.sponsor.chapter_name with $es
+   return { "chapter_name": $chapter_name, "escount" : count($es) }
+order by $sig_sponsorship_count desc
+limit 5
+return { "sig_name": $sig_name, "total_count": $sig_sponsorship_count, "chapter_breakdown": $by_chapter }

http://git-wip-us.apache.org/repos/asf/incubator-asterixdb/blob/391f09e5/asterix-app/src/test/resources/parserts/queries/4.aql
----------------------------------------------------------------------
diff --git a/asterix-app/src/test/resources/parserts/queries/4.aql b/asterix-app/src/test/resources/parserts/queries/4.aql
new file mode 100644
index 0000000..8817098
--- /dev/null
+++ b/asterix-app/src/test/resources/parserts/queries/4.aql
@@ -0,0 +1,26 @@
+/*
+ * Licensed to the Apache Software Foundation (ASF) under one
+ * or more contributor license agreements.  See the NOTICE file
+ * distributed with this work for additional information
+ * regarding copyright ownership.  The ASF licenses this file
+ * to you under the Apache License, Version 2.0 (the
+ * "License"); you may not use this file except in compliance
+ * with the License.  You may obtain a copy of the License at
+ *
+ *   http://www.apache.org/licenses/LICENSE-2.0
+ *
+ * Unless required by applicable law or agreed to in writing,
+ * software distributed under the License is distributed on an
+ * "AS IS" BASIS, WITHOUT WARRANTIES OR CONDITIONS OF ANY
+ * KIND, either express or implied.  See the License for the
+ * specific language governing permissions and limitations
+ * under the License.
+ */
+for $sig in dataset('SIGroup')
+where $sig.name = "Movie-Watchers"
+let $similar_sigs :=
+   for $similar_sig in dataset('SIGroup')
+   where $similar_sig != $sig
+   and $similar_sig.interests ~= $sig.interests
+   return { "sig_name" : $similar_sig.name }
+return { "similar_sigs" : $similar_sigs }

http://git-wip-us.apache.org/repos/asf/incubator-asterixdb/blob/391f09e5/asterix-app/src/test/resources/parserts/queries/5.aql
----------------------------------------------------------------------
diff --git a/asterix-app/src/test/resources/parserts/queries/5.aql b/asterix-app/src/test/resources/parserts/queries/5.aql
new file mode 100644
index 0000000..6653644
--- /dev/null
+++ b/asterix-app/src/test/resources/parserts/queries/5.aql
@@ -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.
+ */
+for $event in dataset('Event')
+where $event.name = "The Night of the Ad Eaters, 29th edition"
+let $collocated_events :=
+   for $collocated_event in dataset('Events')
+   where $collocated_event.location.street ~= $event.location.street
+   and $collocated_event.location.city = $event.location.city
+   and $collocated_event.location.state = $event.location.state
+   and $collocated_event.location.zip = $event.location.zip
+   return { "event_name" : $collocated_event.name }
+return { "collocated_evnets" : $collocated_events }

http://git-wip-us.apache.org/repos/asf/incubator-asterixdb/blob/391f09e5/asterix-app/src/test/resources/parserts/queries/6.aql
----------------------------------------------------------------------
diff --git a/asterix-app/src/test/resources/parserts/queries/6.aql b/asterix-app/src/test/resources/parserts/queries/6.aql
new file mode 100644
index 0000000..f8b06df
--- /dev/null
+++ b/asterix-app/src/test/resources/parserts/queries/6.aql
@@ -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.
+ */
+for $user in dataset('Users')
+let $similar_users :=
+   for $similar_user in dataset('Users')
+   let $similarity := jaccard_similarity($user.interests, $similar_user.interests)
+   where $user != $similar_user
+   and $similarity >= .75
+   order by $similarity desc
+   limit 10
+   return { "user_name" : $similar_user.name, "similarity" : $similarity }
+return { "user_name" : $user.name, "similar_users" : $similar_users }

http://git-wip-us.apache.org/repos/asf/incubator-asterixdb/blob/391f09e5/asterix-app/src/test/resources/parserts/queries/ANYInFieldAccessor.aql
----------------------------------------------------------------------
diff --git a/asterix-app/src/test/resources/parserts/queries/ANYInFieldAccessor.aql b/asterix-app/src/test/resources/parserts/queries/ANYInFieldAccessor.aql
new file mode 100644
index 0000000..d2800c1
--- /dev/null
+++ b/asterix-app/src/test/resources/parserts/queries/ANYInFieldAccessor.aql
@@ -0,0 +1,22 @@
+/*
+ * 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.
+ */
+for $user in dataset('User')
+for $mv in dataset('Movie')
+where some $i in $user.interests satisfies $i.movie = $mv.movie[?]
+return { "name": $user.name, "movie": $mv.movie }

http://git-wip-us.apache.org/repos/asf/incubator-asterixdb/blob/391f09e5/asterix-app/src/test/resources/parserts/queries/IfInFLOWGR.aql
----------------------------------------------------------------------
diff --git a/asterix-app/src/test/resources/parserts/queries/IfInFLOWGR.aql b/asterix-app/src/test/resources/parserts/queries/IfInFLOWGR.aql
new file mode 100644
index 0000000..1ec2e65
--- /dev/null
+++ b/asterix-app/src/test/resources/parserts/queries/IfInFLOWGR.aql
@@ -0,0 +1,21 @@
+/*
+ * 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.
+ */
+for $i in [1,2,30,40]
+for $j in {{4,5,6}}
+return if ($i>$j) then $i else $j

http://git-wip-us.apache.org/repos/asf/incubator-asterixdb/blob/391f09e5/asterix-app/src/test/resources/parserts/queries/IfThenElse.aql
----------------------------------------------------------------------
diff --git a/asterix-app/src/test/resources/parserts/queries/IfThenElse.aql b/asterix-app/src/test/resources/parserts/queries/IfThenElse.aql
new file mode 100644
index 0000000..0c3fbac
--- /dev/null
+++ b/asterix-app/src/test/resources/parserts/queries/IfThenElse.aql
@@ -0,0 +1,22 @@
+/*
+ * 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.
+ */
+if (2>1) then
+    20
+else
+    10

http://git-wip-us.apache.org/repos/asf/incubator-asterixdb/blob/391f09e5/asterix-app/src/test/resources/parserts/queries/LetFor.aql
----------------------------------------------------------------------
diff --git a/asterix-app/src/test/resources/parserts/queries/LetFor.aql b/asterix-app/src/test/resources/parserts/queries/LetFor.aql
new file mode 100644
index 0000000..0f7009c
--- /dev/null
+++ b/asterix-app/src/test/resources/parserts/queries/LetFor.aql
@@ -0,0 +1,22 @@
+/*
+ * 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.
+ */
+let $users := dataset('User')
+for $user in $users
+where some $i in $user.interests satisfies $i = "movies"
+return { "name": $user.name }

http://git-wip-us.apache.org/repos/asf/incubator-asterixdb/blob/391f09e5/asterix-app/src/test/resources/parserts/queries/ListConstructor.aql
----------------------------------------------------------------------
diff --git a/asterix-app/src/test/resources/parserts/queries/ListConstructor.aql b/asterix-app/src/test/resources/parserts/queries/ListConstructor.aql
new file mode 100644
index 0000000..5e84384
--- /dev/null
+++ b/asterix-app/src/test/resources/parserts/queries/ListConstructor.aql
@@ -0,0 +1,21 @@
+/*
+ * 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.
+ */
+for $i in [1,2,3]
+for $j in {{4,5,6}}
+return $i+$j

http://git-wip-us.apache.org/repos/asf/incubator-asterixdb/blob/391f09e5/asterix-app/src/test/resources/parserts/queries/addOperator.aql
----------------------------------------------------------------------
diff --git a/asterix-app/src/test/resources/parserts/queries/addOperator.aql b/asterix-app/src/test/resources/parserts/queries/addOperator.aql
new file mode 100644
index 0000000..fe5ab3c
--- /dev/null
+++ b/asterix-app/src/test/resources/parserts/queries/addOperator.aql
@@ -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.
+ */
+1+1-2

http://git-wip-us.apache.org/repos/asf/incubator-asterixdb/blob/391f09e5/asterix-app/src/test/resources/parserts/queries/constant.aql
----------------------------------------------------------------------
diff --git a/asterix-app/src/test/resources/parserts/queries/constant.aql b/asterix-app/src/test/resources/parserts/queries/constant.aql
new file mode 100644
index 0000000..4fa77c9
--- /dev/null
+++ b/asterix-app/src/test/resources/parserts/queries/constant.aql
@@ -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.
+ */
+-1 +1

http://git-wip-us.apache.org/repos/asf/incubator-asterixdb/blob/391f09e5/asterix-app/src/test/resources/parserts/queries/createInternalDataSet.aql
----------------------------------------------------------------------
diff --git a/asterix-app/src/test/resources/parserts/queries/createInternalDataSet.aql b/asterix-app/src/test/resources/parserts/queries/createInternalDataSet.aql
new file mode 100644
index 0000000..899c755
--- /dev/null
+++ b/asterix-app/src/test/resources/parserts/queries/createInternalDataSet.aql
@@ -0,0 +1,21 @@
+/*
+ * 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.
+ */
+create dataset ds1(someType) primary key id;
+create internal dataset ds2(someType) primary key id;
+

http://git-wip-us.apache.org/repos/asf/incubator-asterixdb/blob/391f09e5/asterix-app/src/test/resources/parserts/queries/del-dataset.aql
----------------------------------------------------------------------
diff --git a/asterix-app/src/test/resources/parserts/queries/del-dataset.aql b/asterix-app/src/test/resources/parserts/queries/del-dataset.aql
new file mode 100644
index 0000000..cf624a5
--- /dev/null
+++ b/asterix-app/src/test/resources/parserts/queries/del-dataset.aql
@@ -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 dataverse demo0927 if exists;
+
+create dataverse demo0927;
+
+use dataverse demo0927;
+
+create type CustomerType as closed {
+  cid: int32, 
+  name: string,
+  age: int32?,
+  address: AddressType?,
+  lastorder: {
+    oid: int32,
+    total: float
+  }
+}
+
+create type AddressType as closed {
+  number: int32, 
+  street: string,
+  city: string
+}
+
+create nodegroup group1  if not exists on nc1, nc2;
+
+create dataset Customers(CustomerType) 
+  primary key cid on group1;
+
+drop dataset Customers;

http://git-wip-us.apache.org/repos/asf/incubator-asterixdb/blob/391f09e5/asterix-app/src/test/resources/parserts/queries/fieldAccessor.aql
----------------------------------------------------------------------
diff --git a/asterix-app/src/test/resources/parserts/queries/fieldAccessor.aql b/asterix-app/src/test/resources/parserts/queries/fieldAccessor.aql
new file mode 100644
index 0000000..b324ee1
--- /dev/null
+++ b/asterix-app/src/test/resources/parserts/queries/fieldAccessor.aql
@@ -0,0 +1,21 @@
+/*
+ * 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.
+ */
+let $bla := { "name" : "value" }
+return
+  $bla."name" = $bla.name

http://git-wip-us.apache.org/repos/asf/incubator-asterixdb/blob/391f09e5/asterix-app/src/test/resources/parserts/queries/functionDecl.aql
----------------------------------------------------------------------
diff --git a/asterix-app/src/test/resources/parserts/queries/functionDecl.aql b/asterix-app/src/test/resources/parserts/queries/functionDecl.aql
new file mode 100644
index 0000000..dd483e7
--- /dev/null
+++ b/asterix-app/src/test/resources/parserts/queries/functionDecl.aql
@@ -0,0 +1,25 @@
+/*
+ * Licensed to the Apache Software Foundation (ASF) under one
+ * or more contributor license agreements.  See the NOTICE file
+ * distributed with this work for additional information
+ * regarding copyright ownership.  The ASF licenses this file
+ * to you under the Apache License, Version 2.0 (the
+ * "License"); you may not use this file except in compliance
+ * with the License.  You may obtain a copy of the License at
+ *
+ *   http://www.apache.org/licenses/LICENSE-2.0
+ *
+ * Unless required by applicable law or agreed to in writing,
+ * software distributed under the License is distributed on an
+ * "AS IS" BASIS, WITHOUT WARRANTIES OR CONDITIONS OF ANY
+ * KIND, either express or implied.  See the License for the
+ * specific language governing permissions and limitations
+ * under the License.
+ */
+declare function add($a, $b){
+	$a + $b
+}
+
+declare function minus($a, $b){
+	$a - $b
+}

http://git-wip-us.apache.org/repos/asf/incubator-asterixdb/blob/391f09e5/asterix-app/src/test/resources/parserts/queries/functionDecl1.aql
----------------------------------------------------------------------
diff --git a/asterix-app/src/test/resources/parserts/queries/functionDecl1.aql b/asterix-app/src/test/resources/parserts/queries/functionDecl1.aql
new file mode 100644
index 0000000..1c65cdf
--- /dev/null
+++ b/asterix-app/src/test/resources/parserts/queries/functionDecl1.aql
@@ -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.
+ */
+declare function calculate($events){
+for $event in $events
+for $sponsor in $event.sponsoring_sigs
+let $es := { "event": $event, "sponsor": $sponsor }
+group by $sig_name := $sponsor.sig_name with $es
+let $sig_sponsorship_count := count($es)
+let $by_chapter :=
+   for $e in $es
+   group by $chapter_name := $e.sponsor.chapter_name with $es
+   return { "chapter_name": $chapter_name, "escount" : count($es) }
+order by $sig_sponsorship_count desc
+limit 5
+return { "sig_name": $sig_name, "total_count": $sig_sponsorship_count, "chapter_breakdown": $by_chapter }
+}
+
+let $result := calculate(dataset('Events'))
+return $result

http://git-wip-us.apache.org/repos/asf/incubator-asterixdb/blob/391f09e5/asterix-app/src/test/resources/parserts/queries/functionDecl2.aql
----------------------------------------------------------------------
diff --git a/asterix-app/src/test/resources/parserts/queries/functionDecl2.aql b/asterix-app/src/test/resources/parserts/queries/functionDecl2.aql
new file mode 100644
index 0000000..c44d703
--- /dev/null
+++ b/asterix-app/src/test/resources/parserts/queries/functionDecl2.aql
@@ -0,0 +1,24 @@
+/*
+ * Licensed to the Apache Software Foundation (ASF) under one
+ * or more contributor license agreements.  See the NOTICE file
+ * distributed with this work for additional information
+ * regarding copyright ownership.  The ASF licenses this file
+ * to you under the Apache License, Version 2.0 (the
+ * "License"); you may not use this file except in compliance
+ * with the License.  You may obtain a copy of the License at
+ *
+ *   http://www.apache.org/licenses/LICENSE-2.0
+ *
+ * Unless required by applicable law or agreed to in writing,
+ * software distributed under the License is distributed on an
+ * "AS IS" BASIS, WITHOUT WARRANTIES OR CONDITIONS OF ANY
+ * KIND, either express or implied.  See the License for the
+ * specific language governing permissions and limitations
+ * under the License.
+ */
+declare function GT($a, $b){
+if ($a > $b) then
+    true
+else
+    false
+}

http://git-wip-us.apache.org/repos/asf/incubator-asterixdb/blob/391f09e5/asterix-app/src/test/resources/parserts/queries/functionDecl3.aql
----------------------------------------------------------------------
diff --git a/asterix-app/src/test/resources/parserts/queries/functionDecl3.aql b/asterix-app/src/test/resources/parserts/queries/functionDecl3.aql
new file mode 100644
index 0000000..854d6f0
--- /dev/null
+++ b/asterix-app/src/test/resources/parserts/queries/functionDecl3.aql
@@ -0,0 +1,23 @@
+/*
+ * 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.
+ */
+declare function "function with spaces"($a, $b) {
+  "string with spaces"
+};
+
+"function with spaces" (1, 2)

http://git-wip-us.apache.org/repos/asf/incubator-asterixdb/blob/391f09e5/asterix-app/src/test/resources/parserts/queries/load-del-dataset.aql
----------------------------------------------------------------------
diff --git a/asterix-app/src/test/resources/parserts/queries/load-del-dataset.aql b/asterix-app/src/test/resources/parserts/queries/load-del-dataset.aql
new file mode 100644
index 0000000..8f113e0
--- /dev/null
+++ b/asterix-app/src/test/resources/parserts/queries/load-del-dataset.aql
@@ -0,0 +1,50 @@
+/*
+ * 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 demo0927 if exists;
+
+create dataverse demo0927;
+
+use dataverse demo0927;
+
+create type CustomerType as closed {
+  cid: int32, 
+  name: string,
+  age: int32?,
+  address: AddressType?,
+  lastorder: {
+    oid: int32,
+    total: float
+  }
+}
+
+create type AddressType as closed {
+  number: int32, 
+  street: string,
+  city: string
+}
+
+create nodegroup group1  if not exists on nc1, nc2;
+
+create dataset Customers(CustomerType) 
+  primary key cid on group1;
+
+load dataset Customers 
+using "org.apache.asterix.external.dataset.adapter.NCFileSystemAdapter"
+(("path"="nc1:///tmp/customerData.json"),("format"="adm")) pre-sorted;
+

http://git-wip-us.apache.org/repos/asf/incubator-asterixdb/blob/391f09e5/asterix-app/src/test/resources/parserts/queries/mulOperator.aql
----------------------------------------------------------------------
diff --git a/asterix-app/src/test/resources/parserts/queries/mulOperator.aql b/asterix-app/src/test/resources/parserts/queries/mulOperator.aql
new file mode 100644
index 0000000..848fe63
--- /dev/null
+++ b/asterix-app/src/test/resources/parserts/queries/mulOperator.aql
@@ -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.
+ */
+1+2*3-4

http://git-wip-us.apache.org/repos/asf/incubator-asterixdb/blob/391f09e5/asterix-app/src/test/resources/parserts/queries/nestedFLWOGR.aql
----------------------------------------------------------------------
diff --git a/asterix-app/src/test/resources/parserts/queries/nestedFLWOGR.aql b/asterix-app/src/test/resources/parserts/queries/nestedFLWOGR.aql
new file mode 100644
index 0000000..ad28aee
--- /dev/null
+++ b/asterix-app/src/test/resources/parserts/queries/nestedFLWOGR.aql
@@ -0,0 +1,23 @@
+/*
+ * 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.
+ */
+for $user in 
+	let $data := dataset('User')
+	return $data
+where some $i in $user.interests satisfies $i = "movies"
+return { "name": $user.name }

http://git-wip-us.apache.org/repos/asf/incubator-asterixdb/blob/391f09e5/asterix-app/src/test/resources/parserts/queries/nestedFLWOGR1.aql
----------------------------------------------------------------------
diff --git a/asterix-app/src/test/resources/parserts/queries/nestedFLWOGR1.aql b/asterix-app/src/test/resources/parserts/queries/nestedFLWOGR1.aql
new file mode 100644
index 0000000..a790c96
--- /dev/null
+++ b/asterix-app/src/test/resources/parserts/queries/nestedFLWOGR1.aql
@@ -0,0 +1,24 @@
+/*
+ * Licensed to the Apache Software Foundation (ASF) under one
+ * or more contributor license agreements.  See the NOTICE file
+ * distributed with this work for additional information
+ * regarding copyright ownership.  The ASF licenses this file
+ * to you under the Apache License, Version 2.0 (the
+ * "License"); you may not use this file except in compliance
+ * with the License.  You may obtain a copy of the License at
+ *
+ *   http://www.apache.org/licenses/LICENSE-2.0
+ *
+ * Unless required by applicable law or agreed to in writing,
+ * software distributed under the License is distributed on an
+ * "AS IS" BASIS, WITHOUT WARRANTIES OR CONDITIONS OF ANY
+ * KIND, either express or implied.  See the License for the
+ * specific language governing permissions and limitations
+ * under the License.
+ */
+for $i in [1,2,30,40]
+for $j in {{4,5,6}}
+return 
+	for $k in if ($i>$j) then $i else $j
+	where $k <10
+	return $k

http://git-wip-us.apache.org/repos/asf/incubator-asterixdb/blob/391f09e5/asterix-app/src/test/resources/parserts/queries/nestedFLWOGR2.aql
----------------------------------------------------------------------
diff --git a/asterix-app/src/test/resources/parserts/queries/nestedFLWOGR2.aql b/asterix-app/src/test/resources/parserts/queries/nestedFLWOGR2.aql
new file mode 100644
index 0000000..e28c6a4
--- /dev/null
+++ b/asterix-app/src/test/resources/parserts/queries/nestedFLWOGR2.aql
@@ -0,0 +1,24 @@
+/*
+ * Licensed to the Apache Software Foundation (ASF) under one
+ * or more contributor license agreements.  See the NOTICE file
+ * distributed with this work for additional information
+ * regarding copyright ownership.  The ASF licenses this file
+ * to you under the Apache License, Version 2.0 (the
+ * "License"); you may not use this file except in compliance
+ * with the License.  You may obtain a copy of the License at
+ *
+ *   http://www.apache.org/licenses/LICENSE-2.0
+ *
+ * Unless required by applicable law or agreed to in writing,
+ * software distributed under the License is distributed on an
+ * "AS IS" BASIS, WITHOUT WARRANTIES OR CONDITIONS OF ANY
+ * KIND, either express or implied.  See the License for the
+ * specific language governing permissions and limitations
+ * under the License.
+ */
+for $i in [1,2,30,for $tmp in dataset('number') return $tmp]
+for $j in {{4,5,6}}
+return 
+	for $k in if ($i>$j) then $i else $j
+	where $k <10
+	return $k

http://git-wip-us.apache.org/repos/asf/incubator-asterixdb/blob/391f09e5/asterix-app/src/test/resources/parserts/queries/nestedFLWOGR3.aql
----------------------------------------------------------------------
diff --git a/asterix-app/src/test/resources/parserts/queries/nestedFLWOGR3.aql b/asterix-app/src/test/resources/parserts/queries/nestedFLWOGR3.aql
new file mode 100644
index 0000000..c1a9ec9
--- /dev/null
+++ b/asterix-app/src/test/resources/parserts/queries/nestedFLWOGR3.aql
@@ -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.
+ */
+for $event in dataset('Event')
+for $sponsor in $event.sponsoring_sigs
+let $es := { "event": $event, "sponsor": $sponsor }
+group by $sig_name := $sponsor.sig_name with $es
+let $sig_sponsorship_count := count($es)
+let $by_chapter :=
+   for $e in $es
+   group by $chapter_name := $e.sponsor.chapter_name with $es
+   return { "chapter_name": $chapter_name, "escount" : count($es) }
+order by $sig_sponsorship_count desc
+limit 5 offset 2
+return { "sig_name": $sig_name, "total_count": $sig_sponsorship_count, "chapter_breakdown": $by_chapter }

http://git-wip-us.apache.org/repos/asf/incubator-asterixdb/blob/391f09e5/asterix-app/src/test/resources/parserts/queries/nestedFor.aql
----------------------------------------------------------------------
diff --git a/asterix-app/src/test/resources/parserts/queries/nestedFor.aql b/asterix-app/src/test/resources/parserts/queries/nestedFor.aql
new file mode 100644
index 0000000..03172b7
--- /dev/null
+++ b/asterix-app/src/test/resources/parserts/queries/nestedFor.aql
@@ -0,0 +1,22 @@
+/*
+ * 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.
+ */
+for $user in dataset('User')
+for $mv in dataset('Movie')
+where some $i in $user.interests satisfies $i.movie = $mv.movie
+return { "name": $user.name, "movie": $mv.movie }

http://git-wip-us.apache.org/repos/asf/incubator-asterixdb/blob/391f09e5/asterix-app/src/test/resources/parserts/queries/numberInFieldAccessor.aql
----------------------------------------------------------------------
diff --git a/asterix-app/src/test/resources/parserts/queries/numberInFieldAccessor.aql b/asterix-app/src/test/resources/parserts/queries/numberInFieldAccessor.aql
new file mode 100644
index 0000000..7dfcb93
--- /dev/null
+++ b/asterix-app/src/test/resources/parserts/queries/numberInFieldAccessor.aql
@@ -0,0 +1,22 @@
+/*
+ * 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.
+ */
+for $user in dataset('User')
+for $mv in dataset('Movie')
+where some $i in $user.interests satisfies $i.movie = $mv.movie[2]
+return { "name": $user.name, "movie": $mv.movie }

http://git-wip-us.apache.org/repos/asf/incubator-asterixdb/blob/391f09e5/asterix-app/src/test/resources/parserts/queries/union.aql
----------------------------------------------------------------------
diff --git a/asterix-app/src/test/resources/parserts/queries/union.aql b/asterix-app/src/test/resources/parserts/queries/union.aql
new file mode 100644
index 0000000..eb98c60
--- /dev/null
+++ b/asterix-app/src/test/resources/parserts/queries/union.aql
@@ -0,0 +1,26 @@
+/*
+ * Licensed to the Apache Software Foundation (ASF) under one
+ * or more contributor license agreements.  See the NOTICE file
+ * distributed with this work for additional information
+ * regarding copyright ownership.  The ASF licenses this file
+ * to you under the Apache License, Version 2.0 (the
+ * "License"); you may not use this file except in compliance
+ * with the License.  You may obtain a copy of the License at
+ *
+ *   http://www.apache.org/licenses/LICENSE-2.0
+ *
+ * Unless required by applicable law or agreed to in writing,
+ * software distributed under the License is distributed on an
+ * "AS IS" BASIS, WITHOUT WARRANTIES OR CONDITIONS OF ANY
+ * KIND, either express or implied.  See the License for the
+ * specific language governing permissions and limitations
+ * under the License.
+ */
+(for $l in foo1()
+return $l)
+union
+(for $l in foo2()
+return $l)
+union
+(for $l in foo3()
+return $l)

http://git-wip-us.apache.org/repos/asf/incubator-asterixdb/blob/391f09e5/asterix-app/src/test/resources/parserts/queries/utf-8.aql
----------------------------------------------------------------------
diff --git a/asterix-app/src/test/resources/parserts/queries/utf-8.aql b/asterix-app/src/test/resources/parserts/queries/utf-8.aql
new file mode 100644
index 0000000..645c6ee
--- /dev/null
+++ b/asterix-app/src/test/resources/parserts/queries/utf-8.aql
@@ -0,0 +1,21 @@
+/*
+ * 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.
+ */
+string-to-codepoint("äöß");
+string-to-codepoint("迎");
+/* currently fails (issue 277) string-to-codepoint("欢")  */

http://git-wip-us.apache.org/repos/asf/incubator-asterixdb/blob/391f09e5/asterix-app/src/test/resources/parserts/queries/variables.aql
----------------------------------------------------------------------
diff --git a/asterix-app/src/test/resources/parserts/queries/variables.aql b/asterix-app/src/test/resources/parserts/queries/variables.aql
new file mode 100644
index 0000000..d8dc03f
--- /dev/null
+++ b/asterix-app/src/test/resources/parserts/queries/variables.aql
@@ -0,0 +1,22 @@
+/*
+ * 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.
+ */
+let $a:=1
+let $b:=1
+return
+  $b-$a

http://git-wip-us.apache.org/repos/asf/incubator-asterixdb/blob/391f09e5/asterix-app/src/test/resources/parserts/queries_sqlpp/1.sqlpp
----------------------------------------------------------------------
diff --git a/asterix-app/src/test/resources/parserts/queries_sqlpp/1.sqlpp b/asterix-app/src/test/resources/parserts/queries_sqlpp/1.sqlpp
new file mode 100644
index 0000000..4933e4c
--- /dev/null
+++ b/asterix-app/src/test/resources/parserts/queries_sqlpp/1.sqlpp
@@ -0,0 +1,23 @@
+/*
+ * 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.
+ */
+
+select element {'name':user.name}
+from  User as user
+where some i in user.interests satisfies (i = 'movies')
+;

http://git-wip-us.apache.org/repos/asf/incubator-asterixdb/blob/391f09e5/asterix-app/src/test/resources/parserts/queries_sqlpp/2.sqlpp
----------------------------------------------------------------------
diff --git a/asterix-app/src/test/resources/parserts/queries_sqlpp/2.sqlpp b/asterix-app/src/test/resources/parserts/queries_sqlpp/2.sqlpp
new file mode 100644
index 0000000..4921b58
--- /dev/null
+++ b/asterix-app/src/test/resources/parserts/queries_sqlpp/2.sqlpp
@@ -0,0 +1,33 @@
+/*
+ * Licensed to the Apache Software Foundation (ASF) under one
+ * or more contributor license agreements.  See the NOTICE file
+ * distributed with this work for additional information
+ * regarding copyright ownership.  The ASF licenses this file
+ * to you under the Apache License, Version 2.0 (the
+ * "License"); you may not use this file except in compliance
+ * with the License.  You may obtain a copy of the License at
+ *
+ *   http://www.apache.org/licenses/LICENSE-2.0
+ *
+ * Unless required by applicable law or agreed to in writing,
+ * software distributed under the License is distributed on an
+ * "AS IS" BASIS, WITHOUT WARRANTIES OR CONDITIONS OF ANY
+ * KIND, either express or implied.  See the License for the
+ * specific language governing permissions and limitations
+ * under the License.
+ */
+
+select element {'sig_name':sig_name,'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_name as sig_name
+with  sig_sponsorship_count as count(es),
+      by_chapter as (
+      select element {'chapter_name':chapter_name,'escount':count(es)}
+      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/incubator-asterixdb/blob/391f09e5/asterix-app/src/test/resources/parserts/queries_sqlpp/4.sqlpp
----------------------------------------------------------------------
diff --git a/asterix-app/src/test/resources/parserts/queries_sqlpp/4.sqlpp b/asterix-app/src/test/resources/parserts/queries_sqlpp/4.sqlpp
new file mode 100644
index 0000000..90993e8
--- /dev/null
+++ b/asterix-app/src/test/resources/parserts/queries_sqlpp/4.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.
+ */
+
+select element {'similar_sigs':similar_sigs}
+from  SIGroup as sig
+with  similar_sigs as (
+      select element {'sig_name':similar_sig.name}
+      from  SIGroup as similar_sig
+      where ((similar_sig != sig) and (similar_sig.interests ~= sig.interests))
+  )
+where (sig.name = 'Movie-Watchers')
+;

http://git-wip-us.apache.org/repos/asf/incubator-asterixdb/blob/391f09e5/asterix-app/src/test/resources/parserts/queries_sqlpp/5.sqlpp
----------------------------------------------------------------------
diff --git a/asterix-app/src/test/resources/parserts/queries_sqlpp/5.sqlpp b/asterix-app/src/test/resources/parserts/queries_sqlpp/5.sqlpp
new file mode 100644
index 0000000..d8cb6ae
--- /dev/null
+++ b/asterix-app/src/test/resources/parserts/queries_sqlpp/5.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.
+ */
+
+select element {'collocated_evnets':collocated_events}
+from  Event as event
+with  collocated_events as (
+      select element {'event_name':collocated_event.name}
+      from  Events as collocated_event
+      where ((collocated_event.location.street ~= event.location.street) and (collocated_event.location.city = event.location.city) and (collocated_event.location.state = event.location.state) and (collocated_event.location.zip = event.location.zip))
+  )
+where (event.name = 'The Night of the Ad Eaters, 29th edition')
+;

http://git-wip-us.apache.org/repos/asf/incubator-asterixdb/blob/391f09e5/asterix-app/src/test/resources/parserts/queries_sqlpp/6.sqlpp
----------------------------------------------------------------------
diff --git a/asterix-app/src/test/resources/parserts/queries_sqlpp/6.sqlpp b/asterix-app/src/test/resources/parserts/queries_sqlpp/6.sqlpp
new file mode 100644
index 0000000..5eae7fd
--- /dev/null
+++ b/asterix-app/src/test/resources/parserts/queries_sqlpp/6.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.
+ */
+
+select element {'user_name':user.name,'similar_users':similar_users}
+from  Users as user
+with  similar_users as (
+      select element {'user_name':similar_user.name,'similarity':similarity}
+      from  Users as similar_user
+      with  similarity as jaccard_similarity(user.interests,similar_user.interests)
+      where ((user != similar_user) and (similarity >= 0.75))
+      order by similarity desc
+      limit 10
+  )
+;

http://git-wip-us.apache.org/repos/asf/incubator-asterixdb/blob/391f09e5/asterix-app/src/test/resources/parserts/queries_sqlpp/ANYInFieldAccessor.sqlpp
----------------------------------------------------------------------
diff --git a/asterix-app/src/test/resources/parserts/queries_sqlpp/ANYInFieldAccessor.sqlpp b/asterix-app/src/test/resources/parserts/queries_sqlpp/ANYInFieldAccessor.sqlpp
new file mode 100644
index 0000000..bca9e57
--- /dev/null
+++ b/asterix-app/src/test/resources/parserts/queries_sqlpp/ANYInFieldAccessor.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.
+ */
+
+select element {'name':user.name,'movie':mv.movie}
+from  User as user,
+      Movie as mv
+where some i in user.interests satisfies (i.movie = mv.movie[?])
+;

http://git-wip-us.apache.org/repos/asf/incubator-asterixdb/blob/391f09e5/asterix-app/src/test/resources/parserts/queries_sqlpp/IfInFLOWGR.sqlpp
----------------------------------------------------------------------
diff --git a/asterix-app/src/test/resources/parserts/queries_sqlpp/IfInFLOWGR.sqlpp b/asterix-app/src/test/resources/parserts/queries_sqlpp/IfInFLOWGR.sqlpp
new file mode 100644
index 0000000..294730f
--- /dev/null
+++ b/asterix-app/src/test/resources/parserts/queries_sqlpp/IfInFLOWGR.sqlpp
@@ -0,0 +1,25 @@
+/*
+ * Licensed to the Apache Software Foundation (ASF) under one
+ * or more contributor license agreements.  See the NOTICE file
+ * distributed with this work for additional information
+ * regarding copyright ownership.  The ASF licenses this file
+ * to you under the Apache License, Version 2.0 (the
+ * "License"); you may not use this file except in compliance
+ * with the License.  You may obtain a copy of the License at
+ *
+ *   http://www.apache.org/licenses/LICENSE-2.0
+ *
+ * Unless required by applicable law or agreed to in writing,
+ * software distributed under the License is distributed on an
+ * "AS IS" BASIS, WITHOUT WARRANTIES OR CONDITIONS OF ANY
+ * KIND, either express or implied.  See the License for the
+ * specific language governing permissions and limitations
+ * under the License.
+ */
+
+select element if ((i > j))
+    then i
+    else j
+from  [1,2,30,40] as i,
+      {{4,5,6}} as j
+;

http://git-wip-us.apache.org/repos/asf/incubator-asterixdb/blob/391f09e5/asterix-app/src/test/resources/parserts/queries_sqlpp/IfThenElse.sqlpp
----------------------------------------------------------------------
diff --git a/asterix-app/src/test/resources/parserts/queries_sqlpp/IfThenElse.sqlpp b/asterix-app/src/test/resources/parserts/queries_sqlpp/IfThenElse.sqlpp
new file mode 100644
index 0000000..f346d1a
--- /dev/null
+++ b/asterix-app/src/test/resources/parserts/queries_sqlpp/IfThenElse.sqlpp
@@ -0,0 +1,22 @@
+/*
+ * 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.
+ */
+
+select element if ((2 > 1))
+    then 20
+    else 10;

http://git-wip-us.apache.org/repos/asf/incubator-asterixdb/blob/391f09e5/asterix-app/src/test/resources/parserts/queries_sqlpp/LetFor.sqlpp
----------------------------------------------------------------------
diff --git a/asterix-app/src/test/resources/parserts/queries_sqlpp/LetFor.sqlpp b/asterix-app/src/test/resources/parserts/queries_sqlpp/LetFor.sqlpp
new file mode 100644
index 0000000..5c118fa
--- /dev/null
+++ b/asterix-app/src/test/resources/parserts/queries_sqlpp/LetFor.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.
+ */
+
+with  users as User
+select element {'name':user.name}
+from  users as user
+where some i in user.interests satisfies (i = 'movies')
+;

http://git-wip-us.apache.org/repos/asf/incubator-asterixdb/blob/391f09e5/asterix-app/src/test/resources/parserts/queries_sqlpp/ListConstructor.sqlpp
----------------------------------------------------------------------
diff --git a/asterix-app/src/test/resources/parserts/queries_sqlpp/ListConstructor.sqlpp b/asterix-app/src/test/resources/parserts/queries_sqlpp/ListConstructor.sqlpp
new file mode 100644
index 0000000..a9d7a1e
--- /dev/null
+++ b/asterix-app/src/test/resources/parserts/queries_sqlpp/ListConstructor.sqlpp
@@ -0,0 +1,23 @@
+/*
+ * 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.
+ */
+
+select element (i + j)
+from  [1,2,3] as i,
+      {{4,5,6}} as j
+;

http://git-wip-us.apache.org/repos/asf/incubator-asterixdb/blob/391f09e5/asterix-app/src/test/resources/parserts/queries_sqlpp/addOperator.sqlpp
----------------------------------------------------------------------
diff --git a/asterix-app/src/test/resources/parserts/queries_sqlpp/addOperator.sqlpp b/asterix-app/src/test/resources/parserts/queries_sqlpp/addOperator.sqlpp
new file mode 100644
index 0000000..23cc57d
--- /dev/null
+++ b/asterix-app/src/test/resources/parserts/queries_sqlpp/addOperator.sqlpp
@@ -0,0 +1,20 @@
+/*
+ * 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.
+ */
+
+1 + 1 - 2;

http://git-wip-us.apache.org/repos/asf/incubator-asterixdb/blob/391f09e5/asterix-app/src/test/resources/parserts/queries_sqlpp/columnalias.sqlpp
----------------------------------------------------------------------
diff --git a/asterix-app/src/test/resources/parserts/queries_sqlpp/columnalias.sqlpp b/asterix-app/src/test/resources/parserts/queries_sqlpp/columnalias.sqlpp
new file mode 100644
index 0000000..746660c
--- /dev/null
+++ b/asterix-app/src/test/resources/parserts/queries_sqlpp/columnalias.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.
+ */
+
+SELECT SQRT(t.a*t.b) AS root FROM tbl_name t
+GROUP BY root
+WITH u AS root
+HAVING root > 0
+ORDER BY u; 
\ No newline at end of file

http://git-wip-us.apache.org/repos/asf/incubator-asterixdb/blob/391f09e5/asterix-app/src/test/resources/parserts/queries_sqlpp/columnalias2.sqlpp
----------------------------------------------------------------------
diff --git a/asterix-app/src/test/resources/parserts/queries_sqlpp/columnalias2.sqlpp b/asterix-app/src/test/resources/parserts/queries_sqlpp/columnalias2.sqlpp
new file mode 100644
index 0000000..8eeea85
--- /dev/null
+++ b/asterix-app/src/test/resources/parserts/queries_sqlpp/columnalias2.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.
+ */
+
+SELECT SQRT(t.a*t.b) AS root FROM tbl_name root
+GROUP BY root.id
+WITH u AS root.time
+HAVING root.orders > 0
+ORDER BY u; 
\ No newline at end of file

http://git-wip-us.apache.org/repos/asf/incubator-asterixdb/blob/391f09e5/asterix-app/src/test/resources/parserts/queries_sqlpp/columnalias3.sqlpp
----------------------------------------------------------------------
diff --git a/asterix-app/src/test/resources/parserts/queries_sqlpp/columnalias3.sqlpp b/asterix-app/src/test/resources/parserts/queries_sqlpp/columnalias3.sqlpp
new file mode 100644
index 0000000..8226362
--- /dev/null
+++ b/asterix-app/src/test/resources/parserts/queries_sqlpp/columnalias3.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.
+ */
+
+SELECT ELEMENT {'root': SQRT(t.a*t.b)} FROM tbl_name t
+GROUP BY root
+WITH u AS root
+HAVING root > 0
+ORDER BY u; 
\ No newline at end of file

http://git-wip-us.apache.org/repos/asf/incubator-asterixdb/blob/391f09e5/asterix-app/src/test/resources/parserts/queries_sqlpp/constant.sqlpp
----------------------------------------------------------------------
diff --git a/asterix-app/src/test/resources/parserts/queries_sqlpp/constant.sqlpp b/asterix-app/src/test/resources/parserts/queries_sqlpp/constant.sqlpp
new file mode 100644
index 0000000..9d2e0ed
--- /dev/null
+++ b/asterix-app/src/test/resources/parserts/queries_sqlpp/constant.sqlpp
@@ -0,0 +1,20 @@
+/*
+ * 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.
+ */
+
+-1 + 1;

http://git-wip-us.apache.org/repos/asf/incubator-asterixdb/blob/391f09e5/asterix-app/src/test/resources/parserts/queries_sqlpp/createInternalDataSet.sqlpp
----------------------------------------------------------------------
diff --git a/asterix-app/src/test/resources/parserts/queries_sqlpp/createInternalDataSet.sqlpp b/asterix-app/src/test/resources/parserts/queries_sqlpp/createInternalDataSet.sqlpp
new file mode 100644
index 0000000..43b7626
--- /dev/null
+++ b/asterix-app/src/test/resources/parserts/queries_sqlpp/createInternalDataSet.sqlpp
@@ -0,0 +1,23 @@
+/*
+ * 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.
+ */
+
+create  table ds1(someType) primary key id;
+
+create  table ds2(someType) primary key id;
+

http://git-wip-us.apache.org/repos/asf/incubator-asterixdb/blob/391f09e5/asterix-app/src/test/resources/parserts/queries_sqlpp/del-dataset.sqlpp
----------------------------------------------------------------------
diff --git a/asterix-app/src/test/resources/parserts/queries_sqlpp/del-dataset.sqlpp b/asterix-app/src/test/resources/parserts/queries_sqlpp/del-dataset.sqlpp
new file mode 100644
index 0000000..e9600e4
--- /dev/null
+++ b/asterix-app/src/test/resources/parserts/queries_sqlpp/del-dataset.sqlpp
@@ -0,0 +1,52 @@
+/*
+ * 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 demo0927 if exists;
+create  database demo0927;
+
+use demo0927;
+
+
+create type demo0927.CustomerType as
+ closed {
+  cid : int32,
+  name : string,
+  age : int32?,
+  address : AddressType?,
+  lastorder : {
+      oid : int32,
+      total : float
+  }
+
+}
+
+create type demo0927.AddressType as
+ closed {
+  number : int32,
+  street : string,
+  city : string
+}
+
+create  nodegroup group1 if not exists  on 
+    nc1,
+    nc2
+;
+create  table Customers(CustomerType) primary key cid on group1;
+
+drop  table Customers;

http://git-wip-us.apache.org/repos/asf/incubator-asterixdb/blob/391f09e5/asterix-app/src/test/resources/parserts/queries_sqlpp/fieldAccessor.sqlpp
----------------------------------------------------------------------
diff --git a/asterix-app/src/test/resources/parserts/queries_sqlpp/fieldAccessor.sqlpp b/asterix-app/src/test/resources/parserts/queries_sqlpp/fieldAccessor.sqlpp
new file mode 100644
index 0000000..4ad60bc
--- /dev/null
+++ b/asterix-app/src/test/resources/parserts/queries_sqlpp/fieldAccessor.sqlpp
@@ -0,0 +1,22 @@
+/*
+ * 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.
+ */
+
+with  bla as {'name':'value'}
+select element (bla."name" = bla.name)
+;

http://git-wip-us.apache.org/repos/asf/incubator-asterixdb/blob/391f09e5/asterix-app/src/test/resources/parserts/queries_sqlpp/from_collection_array.sqlpp
----------------------------------------------------------------------
diff --git a/asterix-app/src/test/resources/parserts/queries_sqlpp/from_collection_array.sqlpp b/asterix-app/src/test/resources/parserts/queries_sqlpp/from_collection_array.sqlpp
new file mode 100644
index 0000000..1235b6c
--- /dev/null
+++ b/asterix-app/src/test/resources/parserts/queries_sqlpp/from_collection_array.sqlpp
@@ -0,0 +1,21 @@
+/*
+ * 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.
+ */
+
+from [ 10, 20, 30 ] as x
+select element x;

http://git-wip-us.apache.org/repos/asf/incubator-asterixdb/blob/391f09e5/asterix-app/src/test/resources/parserts/queries_sqlpp/from_collection_bag.sqlpp
----------------------------------------------------------------------
diff --git a/asterix-app/src/test/resources/parserts/queries_sqlpp/from_collection_bag.sqlpp b/asterix-app/src/test/resources/parserts/queries_sqlpp/from_collection_bag.sqlpp
new file mode 100644
index 0000000..c5219ff
--- /dev/null
+++ b/asterix-app/src/test/resources/parserts/queries_sqlpp/from_collection_bag.sqlpp
@@ -0,0 +1,21 @@
+/*
+ * 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.
+ */
+
+from {{ 10, 20, 30 }} as x
+select element x;

http://git-wip-us.apache.org/repos/asf/incubator-asterixdb/blob/391f09e5/asterix-app/src/test/resources/parserts/queries_sqlpp/from_inner_correlate.sqlpp
----------------------------------------------------------------------
diff --git a/asterix-app/src/test/resources/parserts/queries_sqlpp/from_inner_correlate.sqlpp b/asterix-app/src/test/resources/parserts/queries_sqlpp/from_inner_correlate.sqlpp
new file mode 100644
index 0000000..30d0ecf
--- /dev/null
+++ b/asterix-app/src/test/resources/parserts/queries_sqlpp/from_inner_correlate.sqlpp
@@ -0,0 +1,23 @@
+/*
+ * 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 sensors AS s inner correlate s.readings AS r
+select element r;

http://git-wip-us.apache.org/repos/asf/incubator-asterixdb/blob/391f09e5/asterix-app/src/test/resources/parserts/queries_sqlpp/from_inner_flatten.sqlpp
----------------------------------------------------------------------
diff --git a/asterix-app/src/test/resources/parserts/queries_sqlpp/from_inner_flatten.sqlpp b/asterix-app/src/test/resources/parserts/queries_sqlpp/from_inner_flatten.sqlpp
new file mode 100644
index 0000000..ffd21bb
--- /dev/null
+++ b/asterix-app/src/test/resources/parserts/queries_sqlpp/from_inner_flatten.sqlpp
@@ -0,0 +1,23 @@
+/*
+ * 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;
+
+select s.sensor as sensor, r as reading
+from sensors as s, s.readings as r;

http://git-wip-us.apache.org/repos/asf/incubator-asterixdb/blob/391f09e5/asterix-app/src/test/resources/parserts/queries_sqlpp/from_inner_join.sqlpp
----------------------------------------------------------------------
diff --git a/asterix-app/src/test/resources/parserts/queries_sqlpp/from_inner_join.sqlpp b/asterix-app/src/test/resources/parserts/queries_sqlpp/from_inner_join.sqlpp
new file mode 100644
index 0000000..f2ca69c
--- /dev/null
+++ b/asterix-app/src/test/resources/parserts/queries_sqlpp/from_inner_join.sqlpp
@@ -0,0 +1,25 @@
+/*
+ * Licensed to the Apache Software Foundation (ASF) under one
+ * or more contributor license agreements.  See the NOTICE file
+ * distributed with this work for additional information
+ * regarding copyright ownership.  The ASF licenses this file
+ * to you under the Apache License, Version 2.0 (the
+ * "License"); you may not use this file except in compliance
+ * with the License.  You may obtain a copy of the License at
+ *
+ *   http://www.apache.org/licenses/LICENSE-2.0
+ *
+ * Unless required by applicable law or agreed to in writing,
+ * software distributed under the License is distributed on an
+ * "AS IS" BASIS, WITHOUT WARRANTIES OR CONDITIONS OF ANY
+ * KIND, either express or implied.  See the License for the
+ * specific language governing permissions and limitations
+ * under the License.
+ */
+
+use test;
+
+select m.sensor as sensor, s.readings as readings, m.location as location
+from sensors as s
+join sensorMeta as m
+on s.sensor = m.sensor;

http://git-wip-us.apache.org/repos/asf/incubator-asterixdb/blob/391f09e5/asterix-app/src/test/resources/parserts/queries_sqlpp/from_left_correlate.sqlpp
----------------------------------------------------------------------
diff --git a/asterix-app/src/test/resources/parserts/queries_sqlpp/from_left_correlate.sqlpp b/asterix-app/src/test/resources/parserts/queries_sqlpp/from_left_correlate.sqlpp
new file mode 100644
index 0000000..47385a7
--- /dev/null
+++ b/asterix-app/src/test/resources/parserts/queries_sqlpp/from_left_correlate.sqlpp
@@ -0,0 +1,57 @@
+/*
+ * 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_022;
+
+select sl.location as location, sr.gas as gas, sr.readings as readings
+from {{
+     {
+        'sensor' : 1,
+        'location': point('0.0,0.0')
+    },
+    {
+        'sensor' : 2,
+        'location': point('0.0,1.0')
+    },
+    {
+        'sensor' : 3,
+        'location': point('0.0,1.0')
+    }
+}} as sl
+left correlate {{
+     {
+        'id' : 1,
+        'sensor' : 1,
+        'gas' : 'co2',
+        'readings': {{ 0.2, 0.3 }}
+    },
+    {
+        'id' : 2,
+        'sensor' : 2,
+        'gas' : 'co2',
+        'readings': {{ 0.4, 0.2 }}
+    },
+    {
+        'id' : 3,
+        'sensor' : 2,
+        'gas' : 'no2',
+         'readings': {{ 0.1 }}
+    }
+}} as sr
+where sl.sensor = sr.sensor;