Changeset: 92a8c49c5899 for MonetDB
URL: http://dev.monetdb.org/hg/MonetDB?cmd=changeset;node=92a8c49c5899
Added Files:
sql/backends/monet5/Tests/rapi06.sql
Modified Files:
monetdb5/extras/rapi/rapi.mal
Branch: RIntegration
Log Message:
R API: Added test case for aggregate functions
diffs (41 lines):
diff --git a/monetdb5/extras/rapi/rapi.mal b/monetdb5/extras/rapi/rapi.mal
--- a/monetdb5/extras/rapi/rapi.mal
+++ b/monetdb5/extras/rapi/rapi.mal
@@ -17,7 +17,6 @@
module rapi;
-
command parser(expr:str):bit
address RAPIparser;
@@ -30,6 +29,7 @@ pattern eval(expr:str,arg:any...):any...
address RAPIeval
comment "Execute a simple R script value";
+# sql compiler needs this function for bat-wise operations
module batrapi;
pattern eval(expr:str,arg:any...):any...
address RAPIeval
diff --git a/sql/backends/monet5/Tests/rapi06.sql
b/sql/backends/monet5/Tests/rapi06.sql
new file mode 100644
--- /dev/null
+++ b/sql/backends/monet5/Tests/rapi06.sql
@@ -0,0 +1,16 @@
+START TRANSACTION;
+
+CREATE TABLE rval(groupcol integer,datacol integer);
+INSERT INTO rval VALUES (1,42), (1,84), (2,42), (2,21);
+
+CREATE AGGREGATE aggrmedian(arg0 integer) RETURNS double LANGUAGE R {
+ return(aggregate(arg0, by=list(groups), FUN=median))
+};
+
+SELECT groupcol,aggrmedian(datacol) FROM rval GROUP BY groupcol;
+SELECT aggrmedian(datacol) FROM rval;
+
+DROP AGGREGATE aggrmedian;
+DROP TABLE rval;
+
+ROLLBACK;
\ No newline at end of file
_______________________________________________
checkin-list mailing list
[email protected]
https://www.monetdb.org/mailman/listinfo/checkin-list