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-common;
3. ported parser tests, optimizer tests and runtime tests in asterix-app to their sql++ version, and added parser tests for all the queries.
Change-Id: Ie5af4e3b692ca017ec047a1ba3b404a51beb3a2e
Reviewed-on: https://asterix-gerrit.ics.uci.edu/466
Tested-by: Jenkins <jenkins@fulliautomatix.ics.uci.edu>
Reviewed-by: Till Westmann <tillw@apache.org>
diff --git a/asterix-app/src/test/resources/parserts/ignore.txt b/asterix-app/src/test/resources/parserts/ignore.txt
new file mode 100644
index 0000000..8b13789
--- /dev/null
+++ b/asterix-app/src/test/resources/parserts/ignore.txt
@@ -0,0 +1 @@
+
diff --git a/asterix-app/src/test/resources/parserts/only.txt b/asterix-app/src/test/resources/parserts/only.txt
new file mode 100644
index 0000000..e69de29
--- /dev/null
+++ b/asterix-app/src/test/resources/parserts/only.txt
diff --git a/asterix-app/src/test/resources/parserts/queries-sql-like/1.aql b/asterix-app/src/test/resources/parserts/queries-sql-like/1.aql
new file mode 100644
index 0000000..e13643a
--- /dev/null
+++ b/asterix-app/src/test/resources/parserts/queries-sql-like/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.
+ */
+from $user in dataset('User')
+where some $i in $user.interests satisfies $i = "movies"
+select { "name": $user.name }
diff --git a/asterix-app/src/test/resources/parserts/queries-sql-like/2.aql b/asterix-app/src/test/resources/parserts/queries-sql-like/2.aql
new file mode 100644
index 0000000..4571288
--- /dev/null
+++ b/asterix-app/src/test/resources/parserts/queries-sql-like/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.
+ */
+from $event in dataset('Event')
+from $sponsor in $event.sponsoring_sigs
+with $es := { "event": $event, "sponsor": $sponsor }
+group by $sig_name := $sponsor.sig_name keeping $es
+with $sig_sponsorship_count := count($es)
+with $by_chapter :=
+ from $e in $es
+ group by $chapter_name := $e.sponsor.chapter_name keeping $es
+ select { "chapter_name": $chapter_name, "escount" : count($es) }
+order by $sig_sponsorship_count desc
+limit 5
+select { "sig_name": $sig_name, "total_count": $sig_sponsorship_count, "chapter_breakdown": $by_chapter }
diff --git a/asterix-app/src/test/resources/parserts/queries-sql-like/4.aql b/asterix-app/src/test/resources/parserts/queries-sql-like/4.aql
new file mode 100644
index 0000000..f60795b
--- /dev/null
+++ b/asterix-app/src/test/resources/parserts/queries-sql-like/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.
+ */
+from $sig in dataset('SIGroup')
+where $sig.name = "Movie-Watchers"
+with $similar_sigs :=
+ from $similar_sig in dataset('SIGroup')
+ where $similar_sig != $sig
+ and $similar_sig.interests ~= $sig.interests
+ select { "sig_name" : $similar_sig.name }
+select { "similar_sigs" : $similar_sigs }
diff --git a/asterix-app/src/test/resources/parserts/queries-sql-like/5.aql b/asterix-app/src/test/resources/parserts/queries-sql-like/5.aql
new file mode 100644
index 0000000..2687bf1
--- /dev/null
+++ b/asterix-app/src/test/resources/parserts/queries-sql-like/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.
+ */
+from $event in dataset('Event')
+where $event.name = "The Night of the Ad Eaters, 29th edition"
+with $collocated_events :=
+ from $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
+ select { "event_name" : $collocated_event.name }
+select { "collocated_evnets" : $collocated_events }
diff --git a/asterix-app/src/test/resources/parserts/queries-sql-like/6.aql b/asterix-app/src/test/resources/parserts/queries-sql-like/6.aql
new file mode 100644
index 0000000..1dd358f
--- /dev/null
+++ b/asterix-app/src/test/resources/parserts/queries-sql-like/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.
+ */
+from $user in dataset('Users')
+with $similar_users :=
+ from $similar_user in dataset('Users')
+ with $similarity := jaccard_similarity($user.interests, $similar_user.interests)
+ where $user != $similar_user
+ and $similarity >= .75
+ order by $similarity desc
+ limit 10
+ select { "user_name" : $similar_user.name, "similarity" : $similarity }
+select { "user_name" : $user.name, "similar_users" : $similar_users }
diff --git a/asterix-app/src/test/resources/parserts/queries-sql-like/ANYInFieldAccessor.aql b/asterix-app/src/test/resources/parserts/queries-sql-like/ANYInFieldAccessor.aql
new file mode 100644
index 0000000..12e3f96
--- /dev/null
+++ b/asterix-app/src/test/resources/parserts/queries-sql-like/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.
+ */
+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 }
diff --git a/asterix-app/src/test/resources/parserts/queries-sql-like/IfInFLOWGR.aql b/asterix-app/src/test/resources/parserts/queries-sql-like/IfInFLOWGR.aql
new file mode 100644
index 0000000..cf65175
--- /dev/null
+++ b/asterix-app/src/test/resources/parserts/queries-sql-like/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.
+ */
+from $i in [1,2,30,40]
+from $j in {{4,5,6}}
+select if ($i>$j) then $i else $j
diff --git a/asterix-app/src/test/resources/parserts/queries-sql-like/ListConstructor.aql b/asterix-app/src/test/resources/parserts/queries-sql-like/ListConstructor.aql
new file mode 100644
index 0000000..b4ced83
--- /dev/null
+++ b/asterix-app/src/test/resources/parserts/queries-sql-like/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.
+ */
+from $i in [1,2,3]
+from $j in {{4,5,6}}
+select $i+$j
diff --git a/asterix-app/src/test/resources/parserts/queries-sql-like/WithFrom.aql b/asterix-app/src/test/resources/parserts/queries-sql-like/WithFrom.aql
new file mode 100644
index 0000000..a384e16
--- /dev/null
+++ b/asterix-app/src/test/resources/parserts/queries-sql-like/WithFrom.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 $users := dataset('User')
+from $user in $users
+where some $i in $user.interests satisfies $i = "movies"
+select { "name": $user.name }
diff --git a/asterix-app/src/test/resources/parserts/queries-sql-like/fieldAccessor.aql b/asterix-app/src/test/resources/parserts/queries-sql-like/fieldAccessor.aql
new file mode 100644
index 0000000..667821d
--- /dev/null
+++ b/asterix-app/src/test/resources/parserts/queries-sql-like/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.
+ */
+with $bla := { "name" : "value" }
+return
+ $bla."name" = $bla.name
diff --git a/asterix-app/src/test/resources/parserts/queries-sql-like/functionDecl1.aql b/asterix-app/src/test/resources/parserts/queries-sql-like/functionDecl1.aql
new file mode 100644
index 0000000..6b0364c
--- /dev/null
+++ b/asterix-app/src/test/resources/parserts/queries-sql-like/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){
+from $event in $events
+from $sponsor in $event.sponsoring_sigs
+with $es := { "event": $event, "sponsor": $sponsor }
+group by $sig_name := $sponsor.sig_name keeping $es
+with $sig_sponsorship_count := count($es)
+with $by_chapter :=
+ from $e in $es
+ group by $chapter_name := $e.sponsor.chapter_name keeping $es
+ select { "chapter_name": $chapter_name, "escount" : count($es) }
+order by $sig_sponsorship_count desc
+limit 5
+select { "sig_name": $sig_name, "total_count": $sig_sponsorship_count, "chapter_breakdown": $by_chapter }
+}
+
+with $result := calculate(dataset('Events'))
+select $result
diff --git a/asterix-app/src/test/resources/parserts/queries-sql-like/nestedFLWOGR.aql b/asterix-app/src/test/resources/parserts/queries-sql-like/nestedFLWOGR.aql
new file mode 100644
index 0000000..95a0e22
--- /dev/null
+++ b/asterix-app/src/test/resources/parserts/queries-sql-like/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.
+ */
+from $user in
+ with $data := dataset('User')
+ select $data
+where some $i in $user.interests satisfies $i = "movies"
+select { "name": $user.name }
diff --git a/asterix-app/src/test/resources/parserts/queries-sql-like/nestedFLWOGR1.aql b/asterix-app/src/test/resources/parserts/queries-sql-like/nestedFLWOGR1.aql
new file mode 100644
index 0000000..db114e4
--- /dev/null
+++ b/asterix-app/src/test/resources/parserts/queries-sql-like/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.
+ */
+from $i in [1,2,30,40]
+from $j in {{4,5,6}}
+select
+ from $k in if ($i>$j) then $i else $j
+ where $k <10
+ select $k
diff --git a/asterix-app/src/test/resources/parserts/queries-sql-like/nestedFLWOGR2.aql b/asterix-app/src/test/resources/parserts/queries-sql-like/nestedFLWOGR2.aql
new file mode 100644
index 0000000..c9d772e
--- /dev/null
+++ b/asterix-app/src/test/resources/parserts/queries-sql-like/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.
+ */
+from $i in [1,2,30,from $tmp in dataset('number') select $tmp]
+from $j in {{4,5,6}}
+select
+ from $k in if ($i>$j) then $i else $j
+ where $k <10
+ select $k
diff --git a/asterix-app/src/test/resources/parserts/queries-sql-like/nestedFLWOGR3.aql b/asterix-app/src/test/resources/parserts/queries-sql-like/nestedFLWOGR3.aql
new file mode 100644
index 0000000..657eacc
--- /dev/null
+++ b/asterix-app/src/test/resources/parserts/queries-sql-like/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.
+ */
+from $event in dataset('Event')
+from $sponsor in $event.sponsoring_sigs
+with $es := { "event": $event, "sponsor": $sponsor }
+group by $sig_name := $sponsor.sig_name keeping $es
+with $sig_sponsorship_count := count($es)
+with $by_chapter :=
+ from $e in $es
+ group by $chapter_name := $e.sponsor.chapter_name keeping $es
+ select { "chapter_name": $chapter_name, "escount" : count($es) }
+order by $sig_sponsorship_count desc
+limit 5 offset 2
+select { "sig_name": $sig_name, "total_count": $sig_sponsorship_count, "chapter_breakdown": $by_chapter }
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 }
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 }
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)
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
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 }
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 }
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 }
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 }
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 }
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 }
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
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
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 }
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
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
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
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;
+
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;
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
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
+}
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
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
+}
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)
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;
+
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
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 }
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
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
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 }
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 }
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 }
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)
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("欢") */
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
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')
+;
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
+;
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..90993e89
--- /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')
+;
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')
+;
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
+ )
+;
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[?])
+;
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
+;
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;
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')
+;
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
+;
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;
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
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
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
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;
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;
+
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;
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)
+;
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;
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;
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;
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;
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;
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;
diff --git a/asterix-app/src/test/resources/parserts/queries_sqlpp/from_left_correlate2.sqlpp b/asterix-app/src/test/resources/parserts/queries_sqlpp/from_left_correlate2.sqlpp
new file mode 100644
index 0000000..eeb02cd
--- /dev/null
+++ b/asterix-app/src/test/resources/parserts/queries_sqlpp/from_left_correlate2.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.
+ */
+
+from {{
+ {
+ 'sensor' : 1,
+ 'readings': {{ 0.2, 0.3 }}
+ },
+ {
+ 'sensor': 2,
+ 'readings': {{ 0.4, 0.2 }}
+ },
+ {
+ 'sensor': 3,
+ 'readings': {{}}
+ }
+}} as s left outer correlate s.readings as r
+select element r;
diff --git a/asterix-app/src/test/resources/parserts/queries_sqlpp/from_left_outer_join.sqlpp b/asterix-app/src/test/resources/parserts/queries_sqlpp/from_left_outer_join.sqlpp
new file mode 100644
index 0000000..2169a3e
--- /dev/null
+++ b/asterix-app/src/test/resources/parserts/queries_sqlpp/from_left_outer_join.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_021;
+
+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 outer join {{
+ {
+ '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
+on sl.sensor = sr.sensor;
diff --git a/asterix-app/src/test/resources/parserts/queries_sqlpp/from_where_select_clause.sqlpp b/asterix-app/src/test/resources/parserts/queries_sqlpp/from_where_select_clause.sqlpp
new file mode 100644
index 0000000..b162713
--- /dev/null
+++ b/asterix-app/src/test/resources/parserts/queries_sqlpp/from_where_select_clause.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.
+ */
+
+from [ 10, 20, 30, 10, 10 ] as x
+where x = 10
+select element x;
diff --git a/asterix-app/src/test/resources/parserts/queries_sqlpp/functionDecl.sqlpp b/asterix-app/src/test/resources/parserts/queries_sqlpp/functionDecl.sqlpp
new file mode 100644
index 0000000..e0d13a4
--- /dev/null
+++ b/asterix-app/src/test/resources/parserts/queries_sqlpp/functionDecl.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.
+ */
+
+declare function add(a,b) {
+(a + b)
+};
+declare function minus(a,b) {
+(a - b)
+};
diff --git a/asterix-app/src/test/resources/parserts/queries_sqlpp/functionDecl1.sqlpp b/asterix-app/src/test/resources/parserts/queries_sqlpp/functionDecl1.sqlpp
new file mode 100644
index 0000000..2d1d8af
--- /dev/null
+++ b/asterix-app/src/test/resources/parserts/queries_sqlpp/functionDecl1.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.
+ */
+
+declare function calculate(events) {
+(
+ select element {'sig_name':sig_name,'total_count':sig_sponsorship_count,'chapter_breakdown':by_chapter}
+ from events 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
+)
+};
+with result as calculate(Events)
+select element result
+;
diff --git a/asterix-app/src/test/resources/parserts/queries_sqlpp/functionDecl2.sqlpp b/asterix-app/src/test/resources/parserts/queries_sqlpp/functionDecl2.sqlpp
new file mode 100644
index 0000000..ddda48e
--- /dev/null
+++ b/asterix-app/src/test/resources/parserts/queries_sqlpp/functionDecl2.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.
+ */
+
+declare function GT(a,b) {
+if ((a > b))
+ then true
+ else false
+};
diff --git a/asterix-app/src/test/resources/parserts/queries_sqlpp/functionDecl3.sqlpp b/asterix-app/src/test/resources/parserts/queries_sqlpp/functionDecl3.sqlpp
new file mode 100644
index 0000000..da8ab9a
--- /dev/null
+++ b/asterix-app/src/test/resources/parserts/queries_sqlpp/functionDecl3.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.
+ */
+
+declare function "function with spaces"(a,b) {
+'string with spaces'
+};
+"function with spaces"(1,2);
diff --git a/asterix-app/src/test/resources/parserts/queries_sqlpp/groupby_clause_count.sqlpp b/asterix-app/src/test/resources/parserts/queries_sqlpp/groupby_clause_count.sqlpp
new file mode 100644
index 0000000..caa1a1e
--- /dev/null
+++ b/asterix-app/src/test/resources/parserts/queries_sqlpp/groupby_clause_count.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.
+ */
+
+from {{
+ {
+ 'gas' : 'co',
+ 'num' : 0.1
+ },
+ {
+ 'gas' : 'co',
+ 'num' : 0.2
+ },
+ {
+ 'gas' : 'co',
+ 'num' : 0.3
+ },
+ {
+ 'gas' : 'co2',
+ 'num' : 0.4
+ },
+ {
+ 'gas' : 'no2',
+ 'num' : 0.5
+ },
+ {
+ 'gas' : 'no2',
+ 'num' : 0.6
+ }
+}} AS r
+group by r.gas as g
+select element count(r);
diff --git a/asterix-app/src/test/resources/parserts/queries_sqlpp/load-del-dataset.sqlpp b/asterix-app/src/test/resources/parserts/queries_sqlpp/load-del-dataset.sqlpp
new file mode 100644
index 0000000..d08a13b
--- /dev/null
+++ b/asterix-app/src/test/resources/parserts/queries_sqlpp/load-del-dataset.sqlpp
@@ -0,0 +1,53 @@
+/*
+ * 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;
+
+load table Customers using "org.apache.asterix.external.dataset.adapter.NCFileSystemAdapter" (("path"="nc1:///tmp/customerData.json"),("format"="adm")) pre-sorted;
+
diff --git a/asterix-app/src/test/resources/parserts/queries_sqlpp/mulOperator.sqlpp b/asterix-app/src/test/resources/parserts/queries_sqlpp/mulOperator.sqlpp
new file mode 100644
index 0000000..c2e6b6f
--- /dev/null
+++ b/asterix-app/src/test/resources/parserts/queries_sqlpp/mulOperator.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 + 2 * 3 - 4;
diff --git a/asterix-app/src/test/resources/parserts/queries_sqlpp/nestedFLWOGR.sqlpp b/asterix-app/src/test/resources/parserts/queries_sqlpp/nestedFLWOGR.sqlpp
new file mode 100644
index 0000000..c5719ec
--- /dev/null
+++ b/asterix-app/src/test/resources/parserts/queries_sqlpp/nestedFLWOGR.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.
+ */
+
+select element {'name':user.name}
+from (
+ with data as User
+ select element data
+) as user
+where some i in user.interests satisfies (i = 'movies')
+;
diff --git a/asterix-app/src/test/resources/parserts/queries_sqlpp/nestedFLWOGR1.sqlpp b/asterix-app/src/test/resources/parserts/queries_sqlpp/nestedFLWOGR1.sqlpp
new file mode 100644
index 0000000..704f348
--- /dev/null
+++ b/asterix-app/src/test/resources/parserts/queries_sqlpp/nestedFLWOGR1.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.
+ */
+
+select element (
+ select element k
+ from if ((i > j))
+ then i
+ else j as k
+ where (k < 10)
+)
+from [1,2,30,40] as i,
+ {{4,5,6}} as j
+;
diff --git a/asterix-app/src/test/resources/parserts/queries_sqlpp/nestedFLWOGR2.sqlpp b/asterix-app/src/test/resources/parserts/queries_sqlpp/nestedFLWOGR2.sqlpp
new file mode 100644
index 0000000..0abbf80
--- /dev/null
+++ b/asterix-app/src/test/resources/parserts/queries_sqlpp/nestedFLWOGR2.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.
+ */
+
+select element (
+ select element k
+ from if ((i > j))
+ then i
+ else j as k
+ where (k < 10)
+)
+from [1,2,30,(
+ select element tmp
+ from number as tmp
+ )] as i,
+ {{4,5,6}} as j
+;
diff --git a/asterix-app/src/test/resources/parserts/queries_sqlpp/nestedFLWOGR3.sqlpp b/asterix-app/src/test/resources/parserts/queries_sqlpp/nestedFLWOGR3.sqlpp
new file mode 100644
index 0000000..f82a3b6
--- /dev/null
+++ b/asterix-app/src/test/resources/parserts/queries_sqlpp/nestedFLWOGR3.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 offset 2
+;
diff --git a/asterix-app/src/test/resources/parserts/queries_sqlpp/nestedFor.sqlpp b/asterix-app/src/test/resources/parserts/queries_sqlpp/nestedFor.sqlpp
new file mode 100644
index 0000000..bee2f90
--- /dev/null
+++ b/asterix-app/src/test/resources/parserts/queries_sqlpp/nestedFor.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)
+;
diff --git a/asterix-app/src/test/resources/parserts/queries_sqlpp/numberInFieldAccessor.sqlpp b/asterix-app/src/test/resources/parserts/queries_sqlpp/numberInFieldAccessor.sqlpp
new file mode 100644
index 0000000..d65197a
--- /dev/null
+++ b/asterix-app/src/test/resources/parserts/queries_sqlpp/numberInFieldAccessor.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[2])
+;
diff --git a/asterix-app/src/test/resources/parserts/queries_sqlpp/select_clause_sugar.sqlpp b/asterix-app/src/test/resources/parserts/queries_sqlpp/select_clause_sugar.sqlpp
new file mode 100644
index 0000000..bddd911
--- /dev/null
+++ b/asterix-app/src/test/resources/parserts/queries_sqlpp/select_clause_sugar.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 x as "value"
+from [ 10, 20, 30, 10, 10 ] as x
+where x = 10;
diff --git a/asterix-app/src/test/resources/parserts/queries_sqlpp/select_from_where_sugar.sqlpp b/asterix-app/src/test/resources/parserts/queries_sqlpp/select_from_where_sugar.sqlpp
new file mode 100644
index 0000000..e64afd2
--- /dev/null
+++ b/asterix-app/src/test/resources/parserts/queries_sqlpp/select_from_where_sugar.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 x
+from [ 10, 20, 30, 10, 10 ] as x
+where x = 10;
diff --git a/asterix-app/src/test/resources/parserts/queries_sqlpp/tuple_nav.sqlpp b/asterix-app/src/test/resources/parserts/queries_sqlpp/tuple_nav.sqlpp
new file mode 100644
index 0000000..6ebd598
--- /dev/null
+++ b/asterix-app/src/test/resources/parserts/queries_sqlpp/tuple_nav.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.
+ */
+
+{ 'id' : 1 }.name;
diff --git a/asterix-app/src/test/resources/parserts/queries_sqlpp/tuple_nav_delimited_identifier.sqlpp b/asterix-app/src/test/resources/parserts/queries_sqlpp/tuple_nav_delimited_identifier.sqlpp
new file mode 100644
index 0000000..df06b40
--- /dev/null
+++ b/asterix-app/src/test/resources/parserts/queries_sqlpp/tuple_nav_delimited_identifier.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.
+ */
+
+{'e' : 1 }."e";
diff --git a/asterix-app/src/test/resources/parserts/queries_sqlpp/tuple_nav_mutiple_steps.sqlpp b/asterix-app/src/test/resources/parserts/queries_sqlpp/tuple_nav_mutiple_steps.sqlpp
new file mode 100644
index 0000000..486a976
--- /dev/null
+++ b/asterix-app/src/test/resources/parserts/queries_sqlpp/tuple_nav_mutiple_steps.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.
+ */
+
+{'n' : 1, 'a1 a2' : { 'n' : 2, 'b1 b2' : {'n' : 3}}}."a1 a2"."b1 b2".n;
diff --git a/asterix-app/src/test/resources/parserts/queries_sqlpp/tuple_nav_quotes.sqlpp b/asterix-app/src/test/resources/parserts/queries_sqlpp/tuple_nav_quotes.sqlpp
new file mode 100644
index 0000000..10f97ab
--- /dev/null
+++ b/asterix-app/src/test/resources/parserts/queries_sqlpp/tuple_nav_quotes.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.
+ */
+
+{ 'author-id' : 2 }."author-id";
diff --git a/asterix-app/src/test/resources/parserts/queries_sqlpp/union.sqlpp b/asterix-app/src/test/resources/parserts/queries_sqlpp/union.sqlpp
new file mode 100644
index 0000000..56464ba
--- /dev/null
+++ b/asterix-app/src/test/resources/parserts/queries_sqlpp/union.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 l
+from foo1() as l
+union
+select element l
+from foo2() as l
+union
+select element l
+from foo3() as l;
diff --git a/asterix-app/src/test/resources/parserts/queries_sqlpp/utf-8.sqlpp b/asterix-app/src/test/resources/parserts/queries_sqlpp/utf-8.sqlpp
new file mode 100644
index 0000000..ca2640f
--- /dev/null
+++ b/asterix-app/src/test/resources/parserts/queries_sqlpp/utf-8.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.
+ */
+
+string_to_codepoint('äöß');
+string_to_codepoint('迎');
+/* currently fails (issue 277) string-to-codepoint("欢") */
diff --git a/asterix-app/src/test/resources/parserts/queries_sqlpp/variables.sqlpp b/asterix-app/src/test/resources/parserts/queries_sqlpp/variables.sqlpp
new file mode 100644
index 0000000..7611e3e
--- /dev/null
+++ b/asterix-app/src/test/resources/parserts/queries_sqlpp/variables.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.
+ */
+
+with a as 1,
+ b as 1
+select element (b - a)
+;
diff --git a/asterix-app/src/test/resources/parserts/queries_sqlpp/where_clause.sqlpp b/asterix-app/src/test/resources/parserts/queries_sqlpp/where_clause.sqlpp
new file mode 100644
index 0000000..6a5e766
--- /dev/null
+++ b/asterix-app/src/test/resources/parserts/queries_sqlpp/where_clause.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 test;
+
+from sensors AS r
+where r.reading = 0.2
+select element r.reading;
\ No newline at end of file
diff --git a/asterix-app/src/test/resources/parserts/results_parser_sqlpp/1.ast b/asterix-app/src/test/resources/parserts/results_parser_sqlpp/1.ast
new file mode 100644
index 0000000..5615495
--- /dev/null
+++ b/asterix-app/src/test/resources/parserts/results_parser_sqlpp/1.ast
@@ -0,0 +1,36 @@
+Query:
+SELECT ELEMENT [
+RecordConstructor [
+ (
+ LiteralExpr [STRING] [name]
+ :
+ FieldAccessor [
+ Variable [ Name=user ]
+ Field=name
+ ]
+ )
+]
+]
+FROM [ FunctionCall Metadata.dataset@1[
+ LiteralExpr [STRING] [User]
+ ]
+ AS
+ Variable [ Name=user ]
+]
+Where
+ QuantifiedExpression SOME [
+ [Variable [ Name=i ]
+ In
+ FieldAccessor [
+ Variable [ Name=user ]
+ Field=interests
+ ]
+ ]
+ Satifies [
+ OperatorExpr [
+ Variable [ Name=i ]
+ =
+ LiteralExpr [STRING] [movies]
+ ]
+ ]
+ ]
diff --git a/asterix-app/src/test/resources/parserts/results_parser_sqlpp/2.ast b/asterix-app/src/test/resources/parserts/results_parser_sqlpp/2.ast
new file mode 100644
index 0000000..f861640
--- /dev/null
+++ b/asterix-app/src/test/resources/parserts/results_parser_sqlpp/2.ast
@@ -0,0 +1,112 @@
+Query:
+SELECT ELEMENT [
+RecordConstructor [
+ (
+ LiteralExpr [STRING] [sig_name]
+ :
+ Variable [ Name=sig_name ]
+ )
+ (
+ LiteralExpr [STRING] [total_count]
+ :
+ Variable [ Name=sig_sponsorship_count ]
+ )
+ (
+ LiteralExpr [STRING] [chapter_breakdown]
+ :
+ Variable [ Name=by_chapter ]
+ )
+]
+]
+FROM [ FunctionCall Metadata.dataset@1[
+ LiteralExpr [STRING] [Event]
+ ]
+ AS
+ Variable [ Name=event ]
+,
+ FieldAccessor [
+ Variable [ Name=event ]
+ Field=sponsoring_sigs
+ ]
+ AS
+ Variable [ Name=sponsor ]
+]
+LetVariable [ Name=es ]
+ :=
+ RecordConstructor [
+ (
+ LiteralExpr [STRING] [event]
+ :
+ Variable [ Name=event ]
+ )
+ (
+ LiteralExpr [STRING] [sponsor]
+ :
+ Variable [ Name=sponsor ]
+ )
+ ]
+Groupby
+ Variable [ Name=sig_name ]
+ :=
+ FieldAccessor [
+ Variable [ Name=sponsor ]
+ Field=sig_name
+ ]
+ With
+ Variable [ Name=es ]
+ Variable [ Name=sponsor ]
+ Variable [ Name=event ]
+
+LetVariable [ Name=sig_sponsorship_count ]
+ :=
+ FunctionCall null.count@1[
+ Variable [ Name=es ]
+ ]
+LetVariable [ Name=by_chapter ]
+ :=
+ (
+ SELECT ELEMENT [
+ RecordConstructor [
+ (
+ LiteralExpr [STRING] [chapter_name]
+ :
+ Variable [ Name=chapter_name ]
+ )
+ (
+ LiteralExpr [STRING] [escount]
+ :
+ FunctionCall null.count@1[
+ Variable [ Name=es ]
+ ]
+ )
+ ]
+ ]
+ FROM [ Variable [ Name=es ]
+ AS
+ Variable [ Name=e ]
+ ]
+ Groupby
+ Variable [ Name=chapter_name ]
+ :=
+ FieldAccessor [
+ FieldAccessor [
+ Variable [ Name=e ]
+ Field=sponsor
+ ]
+ Field=chapter_name
+ ]
+ With
+ Variable [ Name=e ]
+ Variable [ Name=by_chapter ]
+ Variable [ Name=sig_sponsorship_count ]
+ Variable [ Name=es ]
+ Variable [ Name=sponsor ]
+ Variable [ Name=event ]
+
+ )
+Orderby
+ Variable [ Name=sig_sponsorship_count ]
+ DESC
+
+Limit
+ LiteralExpr [LONG] [5]
diff --git a/asterix-app/src/test/resources/parserts/results_parser_sqlpp/4.ast b/asterix-app/src/test/resources/parserts/results_parser_sqlpp/4.ast
new file mode 100644
index 0000000..e739c37
--- /dev/null
+++ b/asterix-app/src/test/resources/parserts/results_parser_sqlpp/4.ast
@@ -0,0 +1,67 @@
+Query:
+SELECT ELEMENT [
+RecordConstructor [
+ (
+ LiteralExpr [STRING] [similar_sigs]
+ :
+ Variable [ Name=similar_sigs ]
+ )
+]
+]
+FROM [ FunctionCall Metadata.dataset@1[
+ LiteralExpr [STRING] [SIGroup]
+ ]
+ AS
+ Variable [ Name=sig ]
+]
+LetVariable [ Name=similar_sigs ]
+ :=
+ (
+ SELECT ELEMENT [
+ RecordConstructor [
+ (
+ LiteralExpr [STRING] [sig_name]
+ :
+ FieldAccessor [
+ Variable [ Name=similar_sig ]
+ Field=name
+ ]
+ )
+ ]
+ ]
+ FROM [ FunctionCall Metadata.dataset@1[
+ LiteralExpr [STRING] [SIGroup]
+ ]
+ AS
+ Variable [ Name=similar_sig ]
+ ]
+ Where
+ OperatorExpr [
+ OperatorExpr [
+ Variable [ Name=similar_sig ]
+ !=
+ Variable [ Name=sig ]
+ ]
+ and
+ OperatorExpr [
+ FieldAccessor [
+ Variable [ Name=similar_sig ]
+ Field=interests
+ ]
+ ~=
+ FieldAccessor [
+ Variable [ Name=sig ]
+ Field=interests
+ ]
+ ]
+ ]
+ )
+Where
+ OperatorExpr [
+ FieldAccessor [
+ Variable [ Name=sig ]
+ Field=name
+ ]
+ =
+ LiteralExpr [STRING] [Movie-Watchers]
+ ]
diff --git a/asterix-app/src/test/resources/parserts/results_parser_sqlpp/5.ast b/asterix-app/src/test/resources/parserts/results_parser_sqlpp/5.ast
new file mode 100644
index 0000000..73f0cd6
--- /dev/null
+++ b/asterix-app/src/test/resources/parserts/results_parser_sqlpp/5.ast
@@ -0,0 +1,121 @@
+Query:
+SELECT ELEMENT [
+RecordConstructor [
+ (
+ LiteralExpr [STRING] [collocated_evnets]
+ :
+ Variable [ Name=collocated_events ]
+ )
+]
+]
+FROM [ FunctionCall Metadata.dataset@1[
+ LiteralExpr [STRING] [Event]
+ ]
+ AS
+ Variable [ Name=event ]
+]
+LetVariable [ Name=collocated_events ]
+ :=
+ (
+ SELECT ELEMENT [
+ RecordConstructor [
+ (
+ LiteralExpr [STRING] [event_name]
+ :
+ FieldAccessor [
+ Variable [ Name=collocated_event ]
+ Field=name
+ ]
+ )
+ ]
+ ]
+ FROM [ FunctionCall Metadata.dataset@1[
+ LiteralExpr [STRING] [Events]
+ ]
+ AS
+ Variable [ Name=collocated_event ]
+ ]
+ Where
+ OperatorExpr [
+ OperatorExpr [
+ FieldAccessor [
+ FieldAccessor [
+ Variable [ Name=collocated_event ]
+ Field=location
+ ]
+ Field=street
+ ]
+ ~=
+ FieldAccessor [
+ FieldAccessor [
+ Variable [ Name=event ]
+ Field=location
+ ]
+ Field=street
+ ]
+ ]
+ and
+ OperatorExpr [
+ FieldAccessor [
+ FieldAccessor [
+ Variable [ Name=collocated_event ]
+ Field=location
+ ]
+ Field=city
+ ]
+ =
+ FieldAccessor [
+ FieldAccessor [
+ Variable [ Name=event ]
+ Field=location
+ ]
+ Field=city
+ ]
+ ]
+ and
+ OperatorExpr [
+ FieldAccessor [
+ FieldAccessor [
+ Variable [ Name=collocated_event ]
+ Field=location
+ ]
+ Field=state
+ ]
+ =
+ FieldAccessor [
+ FieldAccessor [
+ Variable [ Name=event ]
+ Field=location
+ ]
+ Field=state
+ ]
+ ]
+ and
+ OperatorExpr [
+ FieldAccessor [
+ FieldAccessor [
+ Variable [ Name=collocated_event ]
+ Field=location
+ ]
+ Field=zip
+ ]
+ =
+ FieldAccessor [
+ FieldAccessor [
+ Variable [ Name=event ]
+ Field=location
+ ]
+ Field=zip
+ ]
+ ]
+ ]
+ )
+Where
+ OperatorExpr [
+ FieldAccessor [
+ Variable [ Name=event ]
+ Field=name
+ ]
+ =
+ LiteralExpr [STRING] [The Night of the Ad Eaters, 29th edition]
+ ]
diff --git a/asterix-app/src/test/resources/parserts/results_parser_sqlpp/6.ast b/asterix-app/src/test/resources/parserts/results_parser_sqlpp/6.ast
new file mode 100644
index 0000000..dcbd485
--- /dev/null
+++ b/asterix-app/src/test/resources/parserts/results_parser_sqlpp/6.ast
@@ -0,0 +1,83 @@
+Query:
+SELECT ELEMENT [
+RecordConstructor [
+ (
+ LiteralExpr [STRING] [user_name]
+ :
+ FieldAccessor [
+ Variable [ Name=user ]
+ Field=name
+ ]
+ )
+ (
+ LiteralExpr [STRING] [similar_users]
+ :
+ Variable [ Name=similar_users ]
+ )
+]
+]
+FROM [ FunctionCall Metadata.dataset@1[
+ LiteralExpr [STRING] [Users]
+ ]
+ AS
+ Variable [ Name=user ]
+]
+LetVariable [ Name=similar_users ]
+ :=
+ (
+ SELECT ELEMENT [
+ RecordConstructor [
+ (
+ LiteralExpr [STRING] [user_name]
+ :
+ FieldAccessor [
+ Variable [ Name=similar_user ]
+ Field=name
+ ]
+ )
+ (
+ LiteralExpr [STRING] [similarity]
+ :
+ Variable [ Name=similarity ]
+ )
+ ]
+ ]
+ FROM [ FunctionCall Metadata.dataset@1[
+ LiteralExpr [STRING] [Users]
+ ]
+ AS
+ Variable [ Name=similar_user ]
+ ]
+ LetVariable [ Name=similarity ]
+ :=
+ FunctionCall null.jaccard_similarity@2[
+ FieldAccessor [
+ Variable [ Name=user ]
+ Field=interests
+ ]
+ FieldAccessor [
+ Variable [ Name=similar_user ]
+ Field=interests
+ ]
+ ]
+ Where
+ OperatorExpr [
+ OperatorExpr [
+ Variable [ Name=user ]
+ !=
+ Variable [ Name=similar_user ]
+ ]
+ and
+ OperatorExpr [
+ Variable [ Name=similarity ]
+ >=
+ LiteralExpr [DOUBLE] [0.75]
+ ]
+ ]
+ Orderby
+ Variable [ Name=similarity ]
+ DESC
+
+ Limit
+ LiteralExpr [LONG] [10]
+ )
diff --git a/asterix-app/src/test/resources/parserts/results_parser_sqlpp/ANYInFieldAccessor.ast b/asterix-app/src/test/resources/parserts/results_parser_sqlpp/ANYInFieldAccessor.ast
new file mode 100644
index 0000000..2f60cbc
--- /dev/null
+++ b/asterix-app/src/test/resources/parserts/results_parser_sqlpp/ANYInFieldAccessor.ast
@@ -0,0 +1,59 @@
+Query:
+SELECT ELEMENT [
+RecordConstructor [
+ (
+ LiteralExpr [STRING] [name]
+ :
+ FieldAccessor [
+ Variable [ Name=user ]
+ Field=name
+ ]
+ )
+ (
+ LiteralExpr [STRING] [movie]
+ :
+ FieldAccessor [
+ Variable [ Name=mv ]
+ Field=movie
+ ]
+ )
+]
+]
+FROM [ FunctionCall Metadata.dataset@1[
+ LiteralExpr [STRING] [User]
+ ]
+ AS
+ Variable [ Name=user ]
+,
+ FunctionCall Metadata.dataset@1[
+ LiteralExpr [STRING] [Movie]
+ ]
+ AS
+ Variable [ Name=mv ]
+]
+Where
+ QuantifiedExpression SOME [
+ [Variable [ Name=i ]
+ In
+ FieldAccessor [
+ Variable [ Name=user ]
+ Field=interests
+ ]
+ ]
+ Satifies [
+ OperatorExpr [
+ FieldAccessor [
+ Variable [ Name=i ]
+ Field=movie
+ ]
+ =
+ IndexAccessor [
+ FieldAccessor [
+ Variable [ Name=mv ]
+ Field=movie
+ ]
+ Index: ANY
+ ]
+ ]
+ ]
+ ]
diff --git a/asterix-app/src/test/resources/parserts/results_parser_sqlpp/IfInFLOWGR.ast b/asterix-app/src/test/resources/parserts/results_parser_sqlpp/IfInFLOWGR.ast
new file mode 100644
index 0000000..4b9e932
--- /dev/null
+++ b/asterix-app/src/test/resources/parserts/results_parser_sqlpp/IfInFLOWGR.ast
@@ -0,0 +1,32 @@
+Query:
+SELECT ELEMENT [
+IfExpr [
+ Condition:
+ OperatorExpr [
+ Variable [ Name=i ]
+ >
+ Variable [ Name=j ]
+ ]
+ Then:
+ Variable [ Name=i ]
+ Else:
+ Variable [ Name=j ]
+]
+]
+FROM [ OrderedListConstructor [
+ LiteralExpr [LONG] [1]
+ LiteralExpr [LONG] [2]
+ LiteralExpr [LONG] [30]
+ LiteralExpr [LONG] [40]
+ ]
+ AS
+ Variable [ Name=i ]
+,
+ UnorderedListConstructor [
+ LiteralExpr [LONG] [4]
+ LiteralExpr [LONG] [5]
+ LiteralExpr [LONG] [6]
+ ]
+ AS
+ Variable [ Name=j ]
+]
diff --git a/asterix-app/src/test/resources/parserts/results_parser_sqlpp/IfThenElse.ast b/asterix-app/src/test/resources/parserts/results_parser_sqlpp/IfThenElse.ast
new file mode 100644
index 0000000..8c3462e
--- /dev/null
+++ b/asterix-app/src/test/resources/parserts/results_parser_sqlpp/IfThenElse.ast
@@ -0,0 +1,15 @@
+Query:
+SELECT ELEMENT [
+IfExpr [
+ Condition:
+ OperatorExpr [
+ LiteralExpr [LONG] [2]
+ >
+ LiteralExpr [LONG] [1]
+ ]
+ Then:
+ LiteralExpr [LONG] [20]
+ Else:
+ LiteralExpr [LONG] [10]
+]
+]
diff --git a/asterix-app/src/test/resources/parserts/results_parser_sqlpp/LetFor.ast b/asterix-app/src/test/resources/parserts/results_parser_sqlpp/LetFor.ast
new file mode 100644
index 0000000..b9bf49a
--- /dev/null
+++ b/asterix-app/src/test/resources/parserts/results_parser_sqlpp/LetFor.ast
@@ -0,0 +1,39 @@
+Query:
+LetVariable [ Name=users ]
+ :=
+ FunctionCall Metadata.dataset@1[
+ LiteralExpr [STRING] [User]
+ ]
+SELECT ELEMENT [
+RecordConstructor [
+ (
+ LiteralExpr [STRING] [name]
+ :
+ FieldAccessor [
+ Variable [ Name=user ]
+ Field=name
+ ]
+ )
+]
+]
+FROM [ Variable [ Name=users ]
+ AS
+ Variable [ Name=user ]
+]
+Where
+ QuantifiedExpression SOME [
+ [Variable [ Name=i ]
+ In
+ FieldAccessor [
+ Variable [ Name=user ]
+ Field=interests
+ ]
+ ]
+ Satifies [
+ OperatorExpr [
+ Variable [ Name=i ]
+ =
+ LiteralExpr [STRING] [movies]
+ ]
+ ]
+ ]
diff --git a/asterix-app/src/test/resources/parserts/results_parser_sqlpp/ListConstructor.ast b/asterix-app/src/test/resources/parserts/results_parser_sqlpp/ListConstructor.ast
new file mode 100644
index 0000000..3d3a387
--- /dev/null
+++ b/asterix-app/src/test/resources/parserts/results_parser_sqlpp/ListConstructor.ast
@@ -0,0 +1,24 @@
+Query:
+SELECT ELEMENT [
+OperatorExpr [
+ Variable [ Name=i ]
+ +
+ Variable [ Name=j ]
+]
+]
+FROM [ OrderedListConstructor [
+ LiteralExpr [LONG] [1]
+ LiteralExpr [LONG] [2]
+ LiteralExpr [LONG] [3]
+ ]
+ AS
+ Variable [ Name=i ]
+,
+ UnorderedListConstructor [
+ LiteralExpr [LONG] [4]
+ LiteralExpr [LONG] [5]
+ LiteralExpr [LONG] [6]
+ ]
+ AS
+ Variable [ Name=j ]
+]
diff --git a/asterix-app/src/test/resources/parserts/results_parser_sqlpp/addOperator.ast b/asterix-app/src/test/resources/parserts/results_parser_sqlpp/addOperator.ast
new file mode 100644
index 0000000..106d1f1
--- /dev/null
+++ b/asterix-app/src/test/resources/parserts/results_parser_sqlpp/addOperator.ast
@@ -0,0 +1,8 @@
+Query:
+OperatorExpr [
+ LiteralExpr [LONG] [1]
+ +
+ LiteralExpr [LONG] [1]
+ -
+ LiteralExpr [LONG] [2]
+]
diff --git a/asterix-app/src/test/resources/parserts/results_parser_sqlpp/columnalias.ast b/asterix-app/src/test/resources/parserts/results_parser_sqlpp/columnalias.ast
new file mode 100644
index 0000000..26addaa
--- /dev/null
+++ b/asterix-app/src/test/resources/parserts/results_parser_sqlpp/columnalias.ast
@@ -0,0 +1,77 @@
+Query:
+SELECT [
+FunctionCall null.SQRT@1[
+ OperatorExpr [
+ FieldAccessor [
+ Variable [ Name=t ]
+ Field=a
+ ]
+ *
+ FieldAccessor [
+ Variable [ Name=t ]
+ Field=b
+ ]
+ ]
+]
+root
+]
+FROM [ FunctionCall Metadata.dataset@1[
+ LiteralExpr [STRING] [tbl_name]
+ ]
+ AS
+ Variable [ Name=t ]
+]
+Groupby
+ FunctionCall null.SQRT@1[
+ OperatorExpr [
+ FieldAccessor [
+ Variable [ Name=t ]
+ Field=a
+ ]
+ *
+ FieldAccessor [
+ Variable [ Name=t ]
+ Field=b
+ ]
+ ]
+ ]
+ With
+ Variable [ Name=t ]
+
+LetVariable [ Name=u ]
+ :=
+ FunctionCall null.SQRT@1[
+ OperatorExpr [
+ FieldAccessor [
+ Variable [ Name=t ]
+ Field=a
+ ]
+ *
+ FieldAccessor [
+ Variable [ Name=t ]
+ Field=b
+ ]
+ ]
+ ]
+ HAVING
+ OperatorExpr [
+ FunctionCall null.SQRT@1[
+ OperatorExpr [
+ FieldAccessor [
+ Variable [ Name=t ]
+ Field=a
+ ]
+ *
+ FieldAccessor [
+ Variable [ Name=t ]
+ Field=b
+ ]
+ ]
+ ]
+ >
+ LiteralExpr [LONG] [0]
+ ]
+Orderby
+ Variable [ Name=u ]
+ ASC
+
diff --git a/asterix-app/src/test/resources/parserts/results_parser_sqlpp/columnalias2.ast b/asterix-app/src/test/resources/parserts/results_parser_sqlpp/columnalias2.ast
new file mode 100644
index 0000000..90d32cc
--- /dev/null
+++ b/asterix-app/src/test/resources/parserts/results_parser_sqlpp/columnalias2.ast
@@ -0,0 +1,54 @@
+Query:
+SELECT [
+FunctionCall null.SQRT@1[
+ OperatorExpr [
+ FieldAccessor [
+ FunctionCall Metadata.dataset@1[
+ LiteralExpr [STRING] [t]
+ ]
+ Field=a
+ ]
+ *
+ FieldAccessor [
+ FunctionCall Metadata.dataset@1[
+ LiteralExpr [STRING] [t]
+ ]
+ Field=b
+ ]
+ ]
+]
+root
+]
+FROM [ FunctionCall Metadata.dataset@1[
+ LiteralExpr [STRING] [tbl_name]
+ ]
+ AS
+ Variable [ Name=root ]
+]
+Groupby
+ FieldAccessor [
+ Variable [ Name=root ]
+ Field=id
+ ]
+ With
+ Variable [ Name=root ]
+
+LetVariable [ Name=u ]
+ :=
+ FieldAccessor [
+ Variable [ Name=root ]
+ Field=time
+ ]
+ HAVING
+ OperatorExpr [
+ FieldAccessor [
+ Variable [ Name=root ]
+ Field=orders
+ ]
+ >
+ LiteralExpr [LONG] [0]
+ ]
+Orderby
+ Variable [ Name=u ]
+ ASC
+
diff --git a/asterix-app/src/test/resources/parserts/results_parser_sqlpp/columnalias3.ast b/asterix-app/src/test/resources/parserts/results_parser_sqlpp/columnalias3.ast
new file mode 100644
index 0000000..6b5693b
--- /dev/null
+++ b/asterix-app/src/test/resources/parserts/results_parser_sqlpp/columnalias3.ast
@@ -0,0 +1,82 @@
+Query:
+SELECT ELEMENT [
+RecordConstructor [
+ (
+ LiteralExpr [STRING] [root]
+ :
+ FunctionCall null.SQRT@1[
+ OperatorExpr [
+ FieldAccessor [
+ Variable [ Name=t ]
+ Field=a
+ ]
+ *
+ FieldAccessor [
+ Variable [ Name=t ]
+ Field=b
+ ]
+ ]
+ ]
+ )
+]
+]
+FROM [ FunctionCall Metadata.dataset@1[
+ LiteralExpr [STRING] [tbl_name]
+ ]
+ AS
+ Variable [ Name=t ]
+]
+Groupby
+ FunctionCall null.SQRT@1[
+ OperatorExpr [
+ FieldAccessor [
+ Variable [ Name=t ]
+ Field=a
+ ]
+ *
+ FieldAccessor [
+ Variable [ Name=t ]
+ Field=b
+ ]
+ ]
+ ]
+ With
+ Variable [ Name=t ]
+
+LetVariable [ Name=u ]
+ :=
+ FunctionCall null.SQRT@1[
+ OperatorExpr [
+ FieldAccessor [
+ Variable [ Name=t ]
+ Field=a
+ ]
+ *
+ FieldAccessor [
+ Variable [ Name=t ]
+ Field=b
+ ]
+ ]
+ ]
+ HAVING
+ OperatorExpr [
+ FunctionCall null.SQRT@1[
+ OperatorExpr [
+ FieldAccessor [
+ Variable [ Name=t ]
+ Field=a
+ ]
+ *
+ FieldAccessor [
+ Variable [ Name=t ]
+ Field=b
+ ]
+ ]
+ ]
+ >
+ LiteralExpr [LONG] [0]
+ ]
+Orderby
+ Variable [ Name=u ]
+ ASC
+
diff --git a/asterix-app/src/test/resources/parserts/results_parser_sqlpp/constant.ast b/asterix-app/src/test/resources/parserts/results_parser_sqlpp/constant.ast
new file mode 100644
index 0000000..78a13aa
--- /dev/null
+++ b/asterix-app/src/test/resources/parserts/results_parser_sqlpp/constant.ast
@@ -0,0 +1,6 @@
+Query:
+OperatorExpr [
+ NEGATIVE LiteralExpr [LONG] [1]
+ +
+ LiteralExpr [LONG] [1]
+]
diff --git a/asterix-app/src/test/resources/parserts/results_parser_sqlpp/createInternalDataSet.ast b/asterix-app/src/test/resources/parserts/results_parser_sqlpp/createInternalDataSet.ast
new file mode 100644
index 0000000..cd320ddf
--- /dev/null
+++ b/asterix-app/src/test/resources/parserts/results_parser_sqlpp/createInternalDataSet.ast
@@ -0,0 +1,2 @@
+DatasetDecl ds1(someType) partitioned by [[id]]
+DatasetDecl ds2(someType) partitioned by [[id]]
diff --git a/asterix-app/src/test/resources/parserts/results_parser_sqlpp/del-dataset.ast b/asterix-app/src/test/resources/parserts/results_parser_sqlpp/del-dataset.ast
new file mode 100644
index 0000000..849a30c
--- /dev/null
+++ b/asterix-app/src/test/resources/parserts/results_parser_sqlpp/del-dataset.ast
@@ -0,0 +1,22 @@
+DataverseUse demo0927
+TypeDecl CustomerType [
+ closed RecordType {
+ cid : int32,
+ name : string,
+ age : int32?,
+ address : AddressType?,
+ lastorder : open RecordType {
+ oid : int32,
+ total : float
+ }
+
+ }
+]
+TypeDecl AddressType [
+ closed RecordType {
+ number : int32,
+ street : string,
+ city : string
+ }
+]
+DatasetDecl Customers(CustomerType) partitioned by [[cid]]
diff --git a/asterix-app/src/test/resources/parserts/results_parser_sqlpp/fieldAccessor.ast b/asterix-app/src/test/resources/parserts/results_parser_sqlpp/fieldAccessor.ast
new file mode 100644
index 0000000..40bc769
--- /dev/null
+++ b/asterix-app/src/test/resources/parserts/results_parser_sqlpp/fieldAccessor.ast
@@ -0,0 +1,23 @@
+Query:
+LetVariable [ Name=bla ]
+ :=
+ RecordConstructor [
+ (
+ LiteralExpr [STRING] [name]
+ :
+ LiteralExpr [STRING] [value]
+ )
+ ]
+SELECT ELEMENT [
+OperatorExpr [
+ FieldAccessor [
+ Variable [ Name=bla ]
+ Field=name
+ ]
+ =
+ FieldAccessor [
+ Variable [ Name=bla ]
+ Field=name
+ ]
+]
+]
diff --git a/asterix-app/src/test/resources/parserts/results_parser_sqlpp/from_collection_array.ast b/asterix-app/src/test/resources/parserts/results_parser_sqlpp/from_collection_array.ast
new file mode 100644
index 0000000..192bf6e
--- /dev/null
+++ b/asterix-app/src/test/resources/parserts/results_parser_sqlpp/from_collection_array.ast
@@ -0,0 +1,12 @@
+Query:
+SELECT ELEMENT [
+Variable [ Name=x ]
+]
+FROM [ OrderedListConstructor [
+ LiteralExpr [LONG] [10]
+ LiteralExpr [LONG] [20]
+ LiteralExpr [LONG] [30]
+ ]
+ AS
+ Variable [ Name=x ]
+]
diff --git a/asterix-app/src/test/resources/parserts/results_parser_sqlpp/from_collection_bag.ast b/asterix-app/src/test/resources/parserts/results_parser_sqlpp/from_collection_bag.ast
new file mode 100644
index 0000000..e768f7e
--- /dev/null
+++ b/asterix-app/src/test/resources/parserts/results_parser_sqlpp/from_collection_bag.ast
@@ -0,0 +1,12 @@
+Query:
+SELECT ELEMENT [
+Variable [ Name=x ]
+]
+FROM [ UnorderedListConstructor [
+ LiteralExpr [LONG] [10]
+ LiteralExpr [LONG] [20]
+ LiteralExpr [LONG] [30]
+ ]
+ AS
+ Variable [ Name=x ]
+]
diff --git a/asterix-app/src/test/resources/parserts/results_parser_sqlpp/from_inner_correlate.ast b/asterix-app/src/test/resources/parserts/results_parser_sqlpp/from_inner_correlate.ast
new file mode 100644
index 0000000..b354122
--- /dev/null
+++ b/asterix-app/src/test/resources/parserts/results_parser_sqlpp/from_inner_correlate.ast
@@ -0,0 +1,18 @@
+DataverseUse test
+Query:
+SELECT ELEMENT [
+Variable [ Name=r ]
+]
+FROM [ FunctionCall Metadata.dataset@1[
+ LiteralExpr [STRING] [sensors]
+ ]
+ AS
+ Variable [ Name=s ]
+ INNER UNNEST
+ FieldAccessor [
+ Variable [ Name=s ]
+ Field=readings
+ ]
+ AS
+ Variable [ Name=r ]
+]
diff --git a/asterix-app/src/test/resources/parserts/results_parser_sqlpp/from_inner_flatten.ast b/asterix-app/src/test/resources/parserts/results_parser_sqlpp/from_inner_flatten.ast
new file mode 100644
index 0000000..7668550
--- /dev/null
+++ b/asterix-app/src/test/resources/parserts/results_parser_sqlpp/from_inner_flatten.ast
@@ -0,0 +1,24 @@
+DataverseUse test
+Query:
+SELECT [
+FieldAccessor [
+ Variable [ Name=s ]
+ Field=sensor
+]
+sensor
+Variable [ Name=r ]
+reading
+]
+FROM [ FunctionCall Metadata.dataset@1[
+ LiteralExpr [STRING] [sensors]
+ ]
+ AS
+ Variable [ Name=s ]
+,
+ FieldAccessor [
+ Variable [ Name=s ]
+ Field=readings
+ ]
+ AS
+ Variable [ Name=r ]
+]
diff --git a/asterix-app/src/test/resources/parserts/results_parser_sqlpp/from_inner_join.ast b/asterix-app/src/test/resources/parserts/results_parser_sqlpp/from_inner_join.ast
new file mode 100644
index 0000000..2a3a239
--- /dev/null
+++ b/asterix-app/src/test/resources/parserts/results_parser_sqlpp/from_inner_join.ast
@@ -0,0 +1,42 @@
+DataverseUse test
+Query:
+SELECT [
+FieldAccessor [
+ Variable [ Name=m ]
+ Field=sensor
+]
+sensor
+FieldAccessor [
+ Variable [ Name=s ]
+ Field=readings
+]
+readings
+FieldAccessor [
+ Variable [ Name=m ]
+ Field=location
+]
+location
+]
+FROM [ FunctionCall Metadata.dataset@1[
+ LiteralExpr [STRING] [sensors]
+ ]
+ AS
+ Variable [ Name=s ]
+ INNER JOIN
+ FunctionCall Metadata.dataset@1[
+ LiteralExpr [STRING] [sensorMeta]
+ ]
+ AS
+ Variable [ Name=m ]
+ OperatorExpr [
+ FieldAccessor [
+ Variable [ Name=s ]
+ Field=sensor
+ ]
+ =
+ FieldAccessor [
+ Variable [ Name=m ]
+ Field=sensor
+ ]
+ ]
+]
diff --git a/asterix-app/src/test/resources/parserts/results_parser_sqlpp/from_left_correlate.ast b/asterix-app/src/test/resources/parserts/results_parser_sqlpp/from_left_correlate.ast
new file mode 100644
index 0000000..9fd948a
--- /dev/null
+++ b/asterix-app/src/test/resources/parserts/results_parser_sqlpp/from_left_correlate.ast
@@ -0,0 +1,157 @@
+DataverseUse test_022
+Query:
+SELECT [
+FieldAccessor [
+ Variable [ Name=sl ]
+ Field=location
+]
+location
+FieldAccessor [
+ Variable [ Name=sr ]
+ Field=gas
+]
+gas
+FieldAccessor [
+ Variable [ Name=sr ]
+ Field=readings
+]
+readings
+]
+FROM [ UnorderedListConstructor [
+ RecordConstructor [
+ (
+ LiteralExpr [STRING] [sensor]
+ :
+ LiteralExpr [LONG] [1]
+ )
+ (
+ LiteralExpr [STRING] [location]
+ :
+ FunctionCall test_022.point@1[
+ LiteralExpr [STRING] [0.0,0.0]
+ ]
+ )
+ ]
+ RecordConstructor [
+ (
+ LiteralExpr [STRING] [sensor]
+ :
+ LiteralExpr [LONG] [2]
+ )
+ (
+ LiteralExpr [STRING] [location]
+ :
+ FunctionCall test_022.point@1[
+ LiteralExpr [STRING] [0.0,1.0]
+ ]
+ )
+ ]
+ RecordConstructor [
+ (
+ LiteralExpr [STRING] [sensor]
+ :
+ LiteralExpr [LONG] [3]
+ )
+ (
+ LiteralExpr [STRING] [location]
+ :
+ FunctionCall test_022.point@1[
+ LiteralExpr [STRING] [0.0,1.0]
+ ]
+ )
+ ]
+ ]
+ AS
+ Variable [ Name=sl ]
+ LEFTOUTER UNNEST
+ UnorderedListConstructor [
+ RecordConstructor [
+ (
+ LiteralExpr [STRING] [id]
+ :
+ LiteralExpr [LONG] [1]
+ )
+ (
+ LiteralExpr [STRING] [sensor]
+ :
+ LiteralExpr [LONG] [1]
+ )
+ (
+ LiteralExpr [STRING] [gas]
+ :
+ LiteralExpr [STRING] [co2]
+ )
+ (
+ LiteralExpr [STRING] [readings]
+ :
+ UnorderedListConstructor [
+ LiteralExpr [DOUBLE] [0.2]
+ LiteralExpr [DOUBLE] [0.3]
+ ]
+ )
+ ]
+ RecordConstructor [
+ (
+ LiteralExpr [STRING] [id]
+ :
+ LiteralExpr [LONG] [2]
+ )
+ (
+ LiteralExpr [STRING] [sensor]
+ :
+ LiteralExpr [LONG] [2]
+ )
+ (
+ LiteralExpr [STRING] [gas]
+ :
+ LiteralExpr [STRING] [co2]
+ )
+ (
+ LiteralExpr [STRING] [readings]
+ :
+ UnorderedListConstructor [
+ LiteralExpr [DOUBLE] [0.4]
+ LiteralExpr [DOUBLE] [0.2]
+ ]
+ )
+ ]
+ RecordConstructor [
+ (
+ LiteralExpr [STRING] [id]
+ :
+ LiteralExpr [LONG] [3]
+ )
+ (
+ LiteralExpr [STRING] [sensor]
+ :
+ LiteralExpr [LONG] [2]
+ )
+ (
+ LiteralExpr [STRING] [gas]
+ :
+ LiteralExpr [STRING] [no2]
+ )
+ (
+ LiteralExpr [STRING] [readings]
+ :
+ UnorderedListConstructor [
+ LiteralExpr [DOUBLE] [0.1]
+ ]
+ )
+ ]
+ ]
+ AS
+ Variable [ Name=sr ]
+]
+Where
+ OperatorExpr [
+ FieldAccessor [
+ Variable [ Name=sl ]
+ Field=sensor
+ ]
+ =
+ FieldAccessor [
+ Variable [ Name=sr ]
+ Field=sensor
+ ]
+ ]
diff --git a/asterix-app/src/test/resources/parserts/results_parser_sqlpp/from_left_correlate2.ast b/asterix-app/src/test/resources/parserts/results_parser_sqlpp/from_left_correlate2.ast
new file mode 100644
index 0000000..9ace3b5
--- /dev/null
+++ b/asterix-app/src/test/resources/parserts/results_parser_sqlpp/from_left_correlate2.ast
@@ -0,0 +1,59 @@
+Query:
+SELECT ELEMENT [
+Variable [ Name=r ]
+]
+FROM [ UnorderedListConstructor [
+ RecordConstructor [
+ (
+ LiteralExpr [STRING] [sensor]
+ :
+ LiteralExpr [LONG] [1]
+ )
+ (
+ LiteralExpr [STRING] [readings]
+ :
+ UnorderedListConstructor [
+ LiteralExpr [DOUBLE] [0.2]
+ LiteralExpr [DOUBLE] [0.3]
+ ]
+ )
+ ]
+ RecordConstructor [
+ (
+ LiteralExpr [STRING] [sensor]
+ :
+ LiteralExpr [LONG] [2]
+ )
+ (
+ LiteralExpr [STRING] [readings]
+ :
+ UnorderedListConstructor [
+ LiteralExpr [DOUBLE] [0.4]
+ LiteralExpr [DOUBLE] [0.2]
+ ]
+ )
+ ]
+ RecordConstructor [
+ (
+ LiteralExpr [STRING] [sensor]
+ :
+ LiteralExpr [LONG] [3]
+ )
+ (
+ LiteralExpr [STRING] [readings]
+ :
+ UnorderedListConstructor [
+ ]
+ )
+ ]
+ ]
+ AS
+ Variable [ Name=s ]
+ LEFTOUTER UNNEST
+ FieldAccessor [
+ Variable [ Name=s ]
+ Field=readings
+ ]
+ AS
+ Variable [ Name=r ]
+]
diff --git a/asterix-app/src/test/resources/parserts/results_parser_sqlpp/from_left_outer_join.ast b/asterix-app/src/test/resources/parserts/results_parser_sqlpp/from_left_outer_join.ast
new file mode 100644
index 0000000..69745a5
--- /dev/null
+++ b/asterix-app/src/test/resources/parserts/results_parser_sqlpp/from_left_outer_join.ast
@@ -0,0 +1,156 @@
+DataverseUse test_021
+Query:
+SELECT [
+FieldAccessor [
+ Variable [ Name=sl ]
+ Field=location
+]
+location
+FieldAccessor [
+ Variable [ Name=sr ]
+ Field=gas
+]
+gas
+FieldAccessor [
+ Variable [ Name=sr ]
+ Field=readings
+]
+readings
+]
+FROM [ UnorderedListConstructor [
+ RecordConstructor [
+ (
+ LiteralExpr [STRING] [sensor]
+ :
+ LiteralExpr [LONG] [1]
+ )
+ (
+ LiteralExpr [STRING] [location]
+ :
+ FunctionCall test_021.point@1[
+ LiteralExpr [STRING] [0.0,0.0]
+ ]
+ )
+ ]
+ RecordConstructor [
+ (
+ LiteralExpr [STRING] [sensor]
+ :
+ LiteralExpr [LONG] [2]
+ )
+ (
+ LiteralExpr [STRING] [location]
+ :
+ FunctionCall test_021.point@1[
+ LiteralExpr [STRING] [0.0,1.0]
+ ]
+ )
+ ]
+ RecordConstructor [
+ (
+ LiteralExpr [STRING] [sensor]
+ :
+ LiteralExpr [LONG] [3]
+ )
+ (
+ LiteralExpr [STRING] [location]
+ :
+ FunctionCall test_021.point@1[
+ LiteralExpr [STRING] [0.0,1.0]
+ ]
+ )
+ ]
+ ]
+ AS
+ Variable [ Name=sl ]
+ LEFTOUTER JOIN
+ UnorderedListConstructor [
+ RecordConstructor [
+ (
+ LiteralExpr [STRING] [id]
+ :
+ LiteralExpr [LONG] [1]
+ )
+ (
+ LiteralExpr [STRING] [sensor]
+ :
+ LiteralExpr [LONG] [1]
+ )
+ (
+ LiteralExpr [STRING] [gas]
+ :
+ LiteralExpr [STRING] [co2]
+ )
+ (
+ LiteralExpr [STRING] [readings]
+ :
+ UnorderedListConstructor [
+ LiteralExpr [DOUBLE] [0.2]
+ LiteralExpr [DOUBLE] [0.3]
+ ]
+ )
+ ]
+ RecordConstructor [
+ (
+ LiteralExpr [STRING] [id]
+ :
+ LiteralExpr [LONG] [2]
+ )
+ (
+ LiteralExpr [STRING] [sensor]
+ :
+ LiteralExpr [LONG] [2]
+ )
+ (
+ LiteralExpr [STRING] [gas]
+ :
+ LiteralExpr [STRING] [co2]
+ )
+ (
+ LiteralExpr [STRING] [readings]
+ :
+ UnorderedListConstructor [
+ LiteralExpr [DOUBLE] [0.4]
+ LiteralExpr [DOUBLE] [0.2]
+ ]
+ )
+ ]
+ RecordConstructor [
+ (
+ LiteralExpr [STRING] [id]
+ :
+ LiteralExpr [LONG] [3]
+ )
+ (
+ LiteralExpr [STRING] [sensor]
+ :
+ LiteralExpr [LONG] [2]
+ )
+ (
+ LiteralExpr [STRING] [gas]
+ :
+ LiteralExpr [STRING] [no2]
+ )
+ (
+ LiteralExpr [STRING] [readings]
+ :
+ UnorderedListConstructor [
+ LiteralExpr [DOUBLE] [0.1]
+ ]
+ )
+ ]
+ ]
+ AS
+ Variable [ Name=sr ]
+ OperatorExpr [
+ FieldAccessor [
+ Variable [ Name=sl ]
+ Field=sensor
+ ]
+ =
+ FieldAccessor [
+ Variable [ Name=sr ]
+ Field=sensor
+ ]
+ ]
+]
diff --git a/asterix-app/src/test/resources/parserts/results_parser_sqlpp/from_where_select_clause.ast b/asterix-app/src/test/resources/parserts/results_parser_sqlpp/from_where_select_clause.ast
new file mode 100644
index 0000000..bb0c8b5
--- /dev/null
+++ b/asterix-app/src/test/resources/parserts/results_parser_sqlpp/from_where_select_clause.ast
@@ -0,0 +1,20 @@
+Query:
+SELECT ELEMENT [
+Variable [ Name=x ]
+]
+FROM [ OrderedListConstructor [
+ LiteralExpr [LONG] [10]
+ LiteralExpr [LONG] [20]
+ LiteralExpr [LONG] [30]
+ LiteralExpr [LONG] [10]
+ LiteralExpr [LONG] [10]
+ ]
+ AS
+ Variable [ Name=x ]
+]
+Where
+ OperatorExpr [
+ Variable [ Name=x ]
+ =
+ LiteralExpr [LONG] [10]
+ ]
diff --git a/asterix-app/src/test/resources/parserts/results_parser_sqlpp/functionDecl.ast b/asterix-app/src/test/resources/parserts/results_parser_sqlpp/functionDecl.ast
new file mode 100644
index 0000000..e025413
--- /dev/null
+++ b/asterix-app/src/test/resources/parserts/results_parser_sqlpp/functionDecl.ast
@@ -0,0 +1,16 @@
+FunctionDecl add([a, b]) {
+ OperatorExpr [
+ Variable [ Name=a ]
+ +
+ Variable [ Name=b ]
+ ]
+}
+
+FunctionDecl minus([a, b]) {
+ OperatorExpr [
+ Variable [ Name=a ]
+ -
+ Variable [ Name=b ]
+ ]
+}
+
diff --git a/asterix-app/src/test/resources/parserts/results_parser_sqlpp/functionDecl1.ast b/asterix-app/src/test/resources/parserts/results_parser_sqlpp/functionDecl1.ast
new file mode 100644
index 0000000..36f35dd
--- /dev/null
+++ b/asterix-app/src/test/resources/parserts/results_parser_sqlpp/functionDecl1.ast
@@ -0,0 +1,114 @@
+FunctionDecl calculate([events]) {
+ (
+ SELECT ELEMENT [
+ RecordConstructor [
+ (
+ LiteralExpr [STRING] [sig_name]
+ :
+ Variable [ Name=sig_name ]
+ )
+ (
+ LiteralExpr [STRING] [total_count]
+ :
+ Variable [ Name=sig_sponsorship_count ]
+ )
+ (
+ LiteralExpr [STRING] [chapter_breakdown]
+ :
+ Variable [ Name=by_chapter ]
+ )
+ ]
+ ]
+ FROM [ Variable [ Name=events ]
+ AS
+ Variable [ Name=event ]
+,
+ FieldAccessor [
+ Variable [ Name=event ]
+ Field=sponsoring_sigs
+ ]
+ AS
+ Variable [ Name=sponsor ]
+ ]
+ LetVariable [ Name=es ]
+ :=
+ RecordConstructor [
+ (
+ LiteralExpr [STRING] [event]
+ :
+ Variable [ Name=event ]
+ )
+ (
+ LiteralExpr [STRING] [sponsor]
+ :
+ Variable [ Name=sponsor ]
+ )
+ ]
+ Groupby
+ Variable [ Name=sig_name ]
+ :=
+ FieldAccessor [
+ Variable [ Name=sponsor ]
+ Field=sig_name
+ ]
+
+ LetVariable [ Name=sig_sponsorship_count ]
+ :=
+ FunctionCall null.count@1[
+ Variable [ Name=es ]
+ ]
+ LetVariable [ Name=by_chapter ]
+ :=
+ (
+ SELECT ELEMENT [
+ RecordConstructor [
+ (
+ LiteralExpr [STRING] [chapter_name]
+ :
+ Variable [ Name=chapter_name ]
+ )
+ (
+ LiteralExpr [STRING] [escount]
+ :
+ FunctionCall null.count@1[
+ Variable [ Name=es ]
+ ]
+ )
+ ]
+ ]
+ FROM [ Variable [ Name=es ]
+ AS
+ Variable [ Name=e ]
+ ]
+ Groupby
+ Variable [ Name=chapter_name ]
+ :=
+ FieldAccessor [
+ FieldAccessor [
+ Variable [ Name=e ]
+ Field=sponsor
+ ]
+ Field=chapter_name
+ ]
+
+ )
+ Orderby
+ Variable [ Name=sig_sponsorship_count ]
+ DESC
+
+ Limit
+ LiteralExpr [LONG] [5]
+ )
+}
+
+Query:
+LetVariable [ Name=result ]
+ :=
+ FunctionCall null.calculate@1[
+ FunctionCall Metadata.dataset@1[
+ LiteralExpr [STRING] [Events]
+ ]
+ ]
+SELECT ELEMENT [
+Variable [ Name=result ]
+]
diff --git a/asterix-app/src/test/resources/parserts/results_parser_sqlpp/functionDecl2.ast b/asterix-app/src/test/resources/parserts/results_parser_sqlpp/functionDecl2.ast
new file mode 100644
index 0000000..407d545
--- /dev/null
+++ b/asterix-app/src/test/resources/parserts/results_parser_sqlpp/functionDecl2.ast
@@ -0,0 +1,15 @@
+FunctionDecl GT([a, b]) {
+ IfExpr [
+ Condition:
+ OperatorExpr [
+ Variable [ Name=a ]
+ >
+ Variable [ Name=b ]
+ ]
+ Then:
+ LiteralExpr [TRUE]
+ Else:
+ LiteralExpr [FALSE]
+ ]
+}
+
diff --git a/asterix-app/src/test/resources/parserts/results_parser_sqlpp/functionDecl3.ast b/asterix-app/src/test/resources/parserts/results_parser_sqlpp/functionDecl3.ast
new file mode 100644
index 0000000..487c466
--- /dev/null
+++ b/asterix-app/src/test/resources/parserts/results_parser_sqlpp/functionDecl3.ast
@@ -0,0 +1,9 @@
+FunctionDecl function with spaces([a, b]) {
+ LiteralExpr [STRING] [string with spaces]
+}
+
+Query:
+FunctionCall null.function with spaces@2[
+ LiteralExpr [LONG] [1]
+ LiteralExpr [LONG] [2]
+]
diff --git a/asterix-app/src/test/resources/parserts/results_parser_sqlpp/groupby_clause_count.ast b/asterix-app/src/test/resources/parserts/results_parser_sqlpp/groupby_clause_count.ast
new file mode 100644
index 0000000..b413291
--- /dev/null
+++ b/asterix-app/src/test/resources/parserts/results_parser_sqlpp/groupby_clause_count.ast
@@ -0,0 +1,93 @@
+Query:
+SELECT ELEMENT [
+FunctionCall null.count@1[
+ Variable [ Name=r ]
+]
+]
+FROM [ UnorderedListConstructor [
+ RecordConstructor [
+ (
+ LiteralExpr [STRING] [gas]
+ :
+ LiteralExpr [STRING] [co]
+ )
+ (
+ LiteralExpr [STRING] [num]
+ :
+ LiteralExpr [DOUBLE] [0.1]
+ )
+ ]
+ RecordConstructor [
+ (
+ LiteralExpr [STRING] [gas]
+ :
+ LiteralExpr [STRING] [co]
+ )
+ (
+ LiteralExpr [STRING] [num]
+ :
+ LiteralExpr [DOUBLE] [0.2]
+ )
+ ]
+ RecordConstructor [
+ (
+ LiteralExpr [STRING] [gas]
+ :
+ LiteralExpr [STRING] [co]
+ )
+ (
+ LiteralExpr [STRING] [num]
+ :
+ LiteralExpr [DOUBLE] [0.3]
+ )
+ ]
+ RecordConstructor [
+ (
+ LiteralExpr [STRING] [gas]
+ :
+ LiteralExpr [STRING] [co2]
+ )
+ (
+ LiteralExpr [STRING] [num]
+ :
+ LiteralExpr [DOUBLE] [0.4]
+ )
+ ]
+ RecordConstructor [
+ (
+ LiteralExpr [STRING] [gas]
+ :
+ LiteralExpr [STRING] [no2]
+ )
+ (
+ LiteralExpr [STRING] [num]
+ :
+ LiteralExpr [DOUBLE] [0.5]
+ )
+ ]
+ RecordConstructor [
+ (
+ LiteralExpr [STRING] [gas]
+ :
+ LiteralExpr [STRING] [no2]
+ )
+ (
+ LiteralExpr [STRING] [num]
+ :
+ LiteralExpr [DOUBLE] [0.6]
+ )
+ ]
+ ]
+ AS
+ Variable [ Name=r ]
+]
+Groupby
+ Variable [ Name=g ]
+ :=
+ FieldAccessor [
+ Variable [ Name=r ]
+ Field=gas
+ ]
+ With
+ Variable [ Name=r ]
+
diff --git a/asterix-app/src/test/resources/parserts/results_parser_sqlpp/load-del-dataset.ast b/asterix-app/src/test/resources/parserts/results_parser_sqlpp/load-del-dataset.ast
new file mode 100644
index 0000000..849a30c
--- /dev/null
+++ b/asterix-app/src/test/resources/parserts/results_parser_sqlpp/load-del-dataset.ast
@@ -0,0 +1,22 @@
+DataverseUse demo0927
+TypeDecl CustomerType [
+ closed RecordType {
+ cid : int32,
+ name : string,
+ age : int32?,
+ address : AddressType?,
+ lastorder : open RecordType {
+ oid : int32,
+ total : float
+ }
+
+ }
+]
+TypeDecl AddressType [
+ closed RecordType {
+ number : int32,
+ street : string,
+ city : string
+ }
+]
+DatasetDecl Customers(CustomerType) partitioned by [[cid]]
diff --git a/asterix-app/src/test/resources/parserts/results_parser_sqlpp/mulOperator.ast b/asterix-app/src/test/resources/parserts/results_parser_sqlpp/mulOperator.ast
new file mode 100644
index 0000000..42be275
--- /dev/null
+++ b/asterix-app/src/test/resources/parserts/results_parser_sqlpp/mulOperator.ast
@@ -0,0 +1,12 @@
+Query:
+OperatorExpr [
+ LiteralExpr [LONG] [1]
+ +
+ OperatorExpr [
+ LiteralExpr [LONG] [2]
+ *
+ LiteralExpr [LONG] [3]
+ ]
+ -
+ LiteralExpr [LONG] [4]
+]
diff --git a/asterix-app/src/test/resources/parserts/results_parser_sqlpp/nestedFLWOGR.ast b/asterix-app/src/test/resources/parserts/results_parser_sqlpp/nestedFLWOGR.ast
new file mode 100644
index 0000000..6e7af3a
--- /dev/null
+++ b/asterix-app/src/test/resources/parserts/results_parser_sqlpp/nestedFLWOGR.ast
@@ -0,0 +1,43 @@
+Query:
+SELECT ELEMENT [
+RecordConstructor [
+ (
+ LiteralExpr [STRING] [name]
+ :
+ FieldAccessor [
+ Variable [ Name=user ]
+ Field=name
+ ]
+ )
+]
+]
+FROM [ (
+ LetVariable [ Name=data ]
+ :=
+ FunctionCall Metadata.dataset@1[
+ LiteralExpr [STRING] [User]
+ ]
+ SELECT ELEMENT [
+ Variable [ Name=data ]
+ ]
+ )
+ AS
+ Variable [ Name=user ]
+]
+Where
+ QuantifiedExpression SOME [
+ [Variable [ Name=i ]
+ In
+ FieldAccessor [
+ Variable [ Name=user ]
+ Field=interests
+ ]
+ ]
+ Satifies [
+ OperatorExpr [
+ Variable [ Name=i ]
+ =
+ LiteralExpr [STRING] [movies]
+ ]
+ ]
+ ]
diff --git a/asterix-app/src/test/resources/parserts/results_parser_sqlpp/nestedFLWOGR1.ast b/asterix-app/src/test/resources/parserts/results_parser_sqlpp/nestedFLWOGR1.ast
new file mode 100644
index 0000000..46d3fb8
--- /dev/null
+++ b/asterix-app/src/test/resources/parserts/results_parser_sqlpp/nestedFLWOGR1.ast
@@ -0,0 +1,46 @@
+Query:
+SELECT ELEMENT [
+(
+ SELECT ELEMENT [
+ Variable [ Name=k ]
+ ]
+ FROM [ IfExpr [
+ Condition:
+ OperatorExpr [
+ Variable [ Name=i ]
+ >
+ Variable [ Name=j ]
+ ]
+ Then:
+ Variable [ Name=i ]
+ Else:
+ Variable [ Name=j ]
+ ]
+ AS
+ Variable [ Name=k ]
+ ]
+ Where
+ OperatorExpr [
+ Variable [ Name=k ]
+ <
+ LiteralExpr [LONG] [10]
+ ]
+)
+]
+FROM [ OrderedListConstructor [
+ LiteralExpr [LONG] [1]
+ LiteralExpr [LONG] [2]
+ LiteralExpr [LONG] [30]
+ LiteralExpr [LONG] [40]
+ ]
+ AS
+ Variable [ Name=i ]
+,
+ UnorderedListConstructor [
+ LiteralExpr [LONG] [4]
+ LiteralExpr [LONG] [5]
+ LiteralExpr [LONG] [6]
+ ]
+ AS
+ Variable [ Name=j ]
+]
diff --git a/asterix-app/src/test/resources/parserts/results_parser_sqlpp/nestedFLWOGR2.ast b/asterix-app/src/test/resources/parserts/results_parser_sqlpp/nestedFLWOGR2.ast
new file mode 100644
index 0000000..9673c91
--- /dev/null
+++ b/asterix-app/src/test/resources/parserts/results_parser_sqlpp/nestedFLWOGR2.ast
@@ -0,0 +1,56 @@
+Query:
+SELECT ELEMENT [
+(
+ SELECT ELEMENT [
+ Variable [ Name=k ]
+ ]
+ FROM [ IfExpr [
+ Condition:
+ OperatorExpr [
+ Variable [ Name=i ]
+ >
+ Variable [ Name=j ]
+ ]
+ Then:
+ Variable [ Name=i ]
+ Else:
+ Variable [ Name=j ]
+ ]
+ AS
+ Variable [ Name=k ]
+ ]
+ Where
+ OperatorExpr [
+ Variable [ Name=k ]
+ <
+ LiteralExpr [LONG] [10]
+ ]
+)
+]
+FROM [ OrderedListConstructor [
+ LiteralExpr [LONG] [1]
+ LiteralExpr [LONG] [2]
+ LiteralExpr [LONG] [30]
+ (
+ SELECT ELEMENT [
+ Variable [ Name=tmp ]
+ ]
+ FROM [ FunctionCall Metadata.dataset@1[
+ LiteralExpr [STRING] [number]
+ ]
+ AS
+ Variable [ Name=tmp ]
+ ]
+ )
+ ]
+ AS
+ Variable [ Name=i ]
+,
+ UnorderedListConstructor [
+ LiteralExpr [LONG] [4]
+ LiteralExpr [LONG] [5]
+ LiteralExpr [LONG] [6]
+ ]
+ AS
+ Variable [ Name=j ]
+]
diff --git a/asterix-app/src/test/resources/parserts/results_parser_sqlpp/nestedFLWOGR3.ast b/asterix-app/src/test/resources/parserts/results_parser_sqlpp/nestedFLWOGR3.ast
new file mode 100644
index 0000000..b798bc6
--- /dev/null
+++ b/asterix-app/src/test/resources/parserts/results_parser_sqlpp/nestedFLWOGR3.ast
@@ -0,0 +1,114 @@
+Query:
+SELECT ELEMENT [
+RecordConstructor [
+ (
+ LiteralExpr [STRING] [sig_name]
+ :
+ Variable [ Name=sig_name ]
+ )
+ (
+ LiteralExpr [STRING] [total_count]
+ :
+ Variable [ Name=sig_sponsorship_count ]
+ )
+ (
+ LiteralExpr [STRING] [chapter_breakdown]
+ :
+ Variable [ Name=by_chapter ]
+ )
+]
+]
+FROM [ FunctionCall Metadata.dataset@1[
+ LiteralExpr [STRING] [Event]
+ ]
+ AS
+ Variable [ Name=event ]
+,
+ FieldAccessor [
+ Variable [ Name=event ]
+ Field=sponsoring_sigs
+ ]
+ AS
+ Variable [ Name=sponsor ]
+]
+LetVariable [ Name=es ]
+ :=
+ RecordConstructor [
+ (
+ LiteralExpr [STRING] [event]
+ :
+ Variable [ Name=event ]
+ )
+ (
+ LiteralExpr [STRING] [sponsor]
+ :
+ Variable [ Name=sponsor ]
+ )
+ ]
+Groupby
+ Variable [ Name=sig_name ]
+ :=
+ FieldAccessor [
+ Variable [ Name=sponsor ]
+ Field=sig_name
+ ]
+ With
+ Variable [ Name=es ]
+ Variable [ Name=sponsor ]
+ Variable [ Name=event ]
+
+LetVariable [ Name=sig_sponsorship_count ]
+ :=
+ FunctionCall null.count@1[
+ Variable [ Name=es ]
+ ]
+LetVariable [ Name=by_chapter ]
+ :=
+ (
+ SELECT ELEMENT [
+ RecordConstructor [
+ (
+ LiteralExpr [STRING] [chapter_name]
+ :
+ Variable [ Name=chapter_name ]
+ )
+ (
+ LiteralExpr [STRING] [escount]
+ :
+ FunctionCall null.count@1[
+ Variable [ Name=es ]
+ ]
+ )
+ ]
+ ]
+ FROM [ Variable [ Name=es ]
+ AS
+ Variable [ Name=e ]
+ ]
+ Groupby
+ Variable [ Name=chapter_name ]
+ :=
+ FieldAccessor [
+ FieldAccessor [
+ Variable [ Name=e ]
+ Field=sponsor
+ ]
+ Field=chapter_name
+ ]
+ With
+ Variable [ Name=e ]
+ Variable [ Name=by_chapter ]
+ Variable [ Name=sig_sponsorship_count ]
+ Variable [ Name=es ]
+ Variable [ Name=sponsor ]
+ Variable [ Name=event ]
+
+ )
+Orderby
+ Variable [ Name=sig_sponsorship_count ]
+ DESC
+
+Limit
+ LiteralExpr [LONG] [5]
+ Offset
+ LiteralExpr [LONG] [2]
diff --git a/asterix-app/src/test/resources/parserts/results_parser_sqlpp/nestedFor.ast b/asterix-app/src/test/resources/parserts/results_parser_sqlpp/nestedFor.ast
new file mode 100644
index 0000000..518d51b
--- /dev/null
+++ b/asterix-app/src/test/resources/parserts/results_parser_sqlpp/nestedFor.ast
@@ -0,0 +1,56 @@
+Query:
+SELECT ELEMENT [
+RecordConstructor [
+ (
+ LiteralExpr [STRING] [name]
+ :
+ FieldAccessor [
+ Variable [ Name=user ]
+ Field=name
+ ]
+ )
+ (
+ LiteralExpr [STRING] [movie]
+ :
+ FieldAccessor [
+ Variable [ Name=mv ]
+ Field=movie
+ ]
+ )
+]
+]
+FROM [ FunctionCall Metadata.dataset@1[
+ LiteralExpr [STRING] [User]
+ ]
+ AS
+ Variable [ Name=user ]
+,
+ FunctionCall Metadata.dataset@1[
+ LiteralExpr [STRING] [Movie]
+ ]
+ AS
+ Variable [ Name=mv ]
+]
+Where
+ QuantifiedExpression SOME [
+ [Variable [ Name=i ]
+ In
+ FieldAccessor [
+ Variable [ Name=user ]
+ Field=interests
+ ]
+ ]
+ Satifies [
+ OperatorExpr [
+ FieldAccessor [
+ Variable [ Name=i ]
+ Field=movie
+ ]
+ =
+ FieldAccessor [
+ Variable [ Name=mv ]
+ Field=movie
+ ]
+ ]
+ ]
+ ]
diff --git a/asterix-app/src/test/resources/parserts/results_parser_sqlpp/numberInFieldAccessor.ast b/asterix-app/src/test/resources/parserts/results_parser_sqlpp/numberInFieldAccessor.ast
new file mode 100644
index 0000000..38846d5
--- /dev/null
+++ b/asterix-app/src/test/resources/parserts/results_parser_sqlpp/numberInFieldAccessor.ast
@@ -0,0 +1,62 @@
+Query:
+SELECT ELEMENT [
+RecordConstructor [
+ (
+ LiteralExpr [STRING] [name]
+ :
+ FieldAccessor [
+ Variable [ Name=user ]
+ Field=name
+ ]
+ )
+ (
+ LiteralExpr [STRING] [movie]
+ :
+ FieldAccessor [
+ Variable [ Name=mv ]
+ Field=movie
+ ]
+ )
+]
+]
+FROM [ FunctionCall Metadata.dataset@1[
+ LiteralExpr [STRING] [User]
+ ]
+ AS
+ Variable [ Name=user ]
+,
+ FunctionCall Metadata.dataset@1[
+ LiteralExpr [STRING] [Movie]
+ ]
+ AS
+ Variable [ Name=mv ]
+]
+Where
+ QuantifiedExpression SOME [
+ [Variable [ Name=i ]
+ In
+ FieldAccessor [
+ Variable [ Name=user ]
+ Field=interests
+ ]
+ ]
+ Satifies [
+ OperatorExpr [
+ FieldAccessor [
+ Variable [ Name=i ]
+ Field=movie
+ ]
+ =
+ IndexAccessor [
+ FieldAccessor [
+ Variable [ Name=mv ]
+ Field=movie
+ ]
+ Index: FieldAccessor [
+ Variable [ Name=mv ]
+ Field=movie
+ ]
+ ]
+ ]
+ ]
+ ]
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
new file mode 100644
index 0000000..6622fe1
--- /dev/null
+++ b/asterix-app/src/test/resources/parserts/results_parser_sqlpp/select_clause_sugar.ast
@@ -0,0 +1,21 @@
+Query:
+SELECT [
+Variable [ Name=x ]
+value
+]
+FROM [ OrderedListConstructor [
+ LiteralExpr [LONG] [10]
+ LiteralExpr [LONG] [20]
+ LiteralExpr [LONG] [30]
+ LiteralExpr [LONG] [10]
+ LiteralExpr [LONG] [10]
+ ]
+ AS
+ Variable [ Name=x ]
+]
+Where
+ OperatorExpr [
+ Variable [ Name=x ]
+ =
+ LiteralExpr [LONG] [10]
+ ]
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
new file mode 100644
index 0000000..bb0c8b5
--- /dev/null
+++ b/asterix-app/src/test/resources/parserts/results_parser_sqlpp/select_from_where_sugar.ast
@@ -0,0 +1,20 @@
+Query:
+SELECT ELEMENT [
+Variable [ Name=x ]
+]
+FROM [ OrderedListConstructor [
+ LiteralExpr [LONG] [10]
+ LiteralExpr [LONG] [20]
+ LiteralExpr [LONG] [30]
+ LiteralExpr [LONG] [10]
+ LiteralExpr [LONG] [10]
+ ]
+ AS
+ Variable [ Name=x ]
+]
+Where
+ OperatorExpr [
+ Variable [ Name=x ]
+ =
+ LiteralExpr [LONG] [10]
+ ]
diff --git a/asterix-app/src/test/resources/parserts/results_parser_sqlpp/tuple_nav.ast b/asterix-app/src/test/resources/parserts/results_parser_sqlpp/tuple_nav.ast
new file mode 100644
index 0000000..303a19d
--- /dev/null
+++ b/asterix-app/src/test/resources/parserts/results_parser_sqlpp/tuple_nav.ast
@@ -0,0 +1,11 @@
+Query:
+FieldAccessor [
+ RecordConstructor [
+ (
+ LiteralExpr [STRING] [id]
+ :
+ LiteralExpr [LONG] [1]
+ )
+ ]
+ Field=name
+]
diff --git a/asterix-app/src/test/resources/parserts/results_parser_sqlpp/tuple_nav_delimited_identifier.ast b/asterix-app/src/test/resources/parserts/results_parser_sqlpp/tuple_nav_delimited_identifier.ast
new file mode 100644
index 0000000..d2d46e9
--- /dev/null
+++ b/asterix-app/src/test/resources/parserts/results_parser_sqlpp/tuple_nav_delimited_identifier.ast
@@ -0,0 +1,11 @@
+Query:
+FieldAccessor [
+ RecordConstructor [
+ (
+ LiteralExpr [STRING] [e]
+ :
+ LiteralExpr [LONG] [1]
+ )
+ ]
+ Field=e
+]
diff --git a/asterix-app/src/test/resources/parserts/results_parser_sqlpp/tuple_nav_mutiple_steps.ast b/asterix-app/src/test/resources/parserts/results_parser_sqlpp/tuple_nav_mutiple_steps.ast
new file mode 100644
index 0000000..8e60aa9
--- /dev/null
+++ b/asterix-app/src/test/resources/parserts/results_parser_sqlpp/tuple_nav_mutiple_steps.ast
@@ -0,0 +1,39 @@
+Query:
+FieldAccessor [
+ FieldAccessor [
+ FieldAccessor [
+ RecordConstructor [
+ (
+ LiteralExpr [STRING] [n]
+ :
+ LiteralExpr [LONG] [1]
+ )
+ (
+ LiteralExpr [STRING] [a1 a2]
+ :
+ RecordConstructor [
+ (
+ LiteralExpr [STRING] [n]
+ :
+ LiteralExpr [LONG] [2]
+ )
+ (
+ LiteralExpr [STRING] [b1 b2]
+ :
+ RecordConstructor [
+ (
+ LiteralExpr [STRING] [n]
+ :
+ LiteralExpr [LONG] [3]
+ )
+ ]
+ )
+ ]
+ )
+ ]
+ Field=a1 a2
+ ]
+ Field=b1 b2
+ ]
+ Field=n
+]
diff --git a/asterix-app/src/test/resources/parserts/results_parser_sqlpp/tuple_nav_quotes.ast b/asterix-app/src/test/resources/parserts/results_parser_sqlpp/tuple_nav_quotes.ast
new file mode 100644
index 0000000..930ebf5
--- /dev/null
+++ b/asterix-app/src/test/resources/parserts/results_parser_sqlpp/tuple_nav_quotes.ast
@@ -0,0 +1,11 @@
+Query:
+FieldAccessor [
+ RecordConstructor [
+ (
+ LiteralExpr [STRING] [author-id]
+ :
+ LiteralExpr [LONG] [2]
+ )
+ ]
+ Field=author-id
+]
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
new file mode 100644
index 0000000..ef69119
--- /dev/null
+++ b/asterix-app/src/test/resources/parserts/results_parser_sqlpp/union.ast
@@ -0,0 +1,27 @@
+Query:
+SELECT ELEMENT [
+Variable [ Name=l ]
+]
+FROM [ FunctionCall null.foo1@0[
+ ]
+ AS
+ Variable [ Name=l ]
+]
+UNION ALL
+ SELECT ELEMENT [
+ Variable [ Name=l ]
+ ]
+ FROM [ FunctionCall null.foo2@0[
+ ]
+ AS
+ Variable [ Name=l ]
+ ]
+UNION ALL
+ SELECT ELEMENT [
+ Variable [ Name=l ]
+ ]
+ FROM [ FunctionCall null.foo3@0[
+ ]
+ AS
+ Variable [ Name=l ]
+ ]
diff --git a/asterix-app/src/test/resources/parserts/results_parser_sqlpp/utf-8.ast b/asterix-app/src/test/resources/parserts/results_parser_sqlpp/utf-8.ast
new file mode 100644
index 0000000..50d1e0b
--- /dev/null
+++ b/asterix-app/src/test/resources/parserts/results_parser_sqlpp/utf-8.ast
@@ -0,0 +1,8 @@
+Query:
+FunctionCall null.string_to_codepoint@1[
+ LiteralExpr [STRING] [äöß]
+]
+Query:
+FunctionCall null.string_to_codepoint@1[
+ LiteralExpr [STRING] [迎]
+]
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
new file mode 100644
index 0000000..330ebef
--- /dev/null
+++ b/asterix-app/src/test/resources/parserts/results_parser_sqlpp/variables.ast
@@ -0,0 +1,14 @@
+Query:
+LetVariable [ Name=a ]
+ :=
+ LiteralExpr [LONG] [1]
+LetVariable [ Name=b ]
+ :=
+ LiteralExpr [LONG] [1]
+SELECT ELEMENT [
+OperatorExpr [
+ Variable [ Name=b ]
+ -
+ Variable [ Name=a ]
+]
+]
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
new file mode 100644
index 0000000..57c1c2c
--- /dev/null
+++ b/asterix-app/src/test/resources/parserts/results_parser_sqlpp/where_clause.ast
@@ -0,0 +1,23 @@
+DataverseUse test
+Query:
+SELECT ELEMENT [
+FieldAccessor [
+ Variable [ Name=r ]
+ Field=reading
+]
+]
+FROM [ FunctionCall Metadata.dataset@1[
+ LiteralExpr [STRING] [sensors]
+ ]
+ AS
+ Variable [ Name=r ]
+]
+Where
+ OperatorExpr [
+ FieldAccessor [
+ Variable [ Name=r ]
+ Field=reading
+ ]
+ =
+ LiteralExpr [DOUBLE] [0.2]
+ ]