Add NoSQL grammar:
Please make FROM a synonym for FOR, SELECT a synonym for RETURN, and WITH a synonym for LET. No semantic changes here - just some keyword synonyms.
Change-Id: Iffba1c25c611fc420b6e223bcdde75a9244035e4
Reviewed-on: http://fulliautomatix.ics.uci.edu:8443/181
Tested-by: Jenkins <jenkins@fulliautomatix.ics.uci.edu>
Reviewed-by: Till Westmann <westmann@gmail.com>
diff --git a/asterix-app/src/test/resources/AQLTS/queries-sql-like/functionDecl1.aql b/asterix-app/src/test/resources/AQLTS/queries-sql-like/functionDecl1.aql
new file mode 100644
index 0000000..9a77c84
--- /dev/null
+++ b/asterix-app/src/test/resources/AQLTS/queries-sql-like/functionDecl1.aql
@@ -0,0 +1,17 @@
+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 with $es
+with $sig_sponsorship_count := count($es)
+with $by_chapter :=
+ from $e in $es
+ group by $chapter_name := $e.sponsor.chapter_name with $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
\ No newline at end of file