Changeset: f9d632b3b121 for MonetDB
URL: http://dev.monetdb.org/hg/MonetDB?cmd=changeset;node=f9d632b3b121
Modified Files:
clients/R/MonetDB.R/NAMESPACE
clients/R/MonetDB.R/R/control.R
clients/R/MonetDB.R/R/dplyr.R
clients/R/MonetDB.R/man/control.Rd
clients/R/MonetDB.R/man/src_monetdb.Rd
clients/R/MonetDB.R/src/profiler-r.c
clients/R/MonetDB.R/src/profiler.c
clients/R/MonetDB.R/src/profiler.h
clients/mapiclient/mclient.c
Branch: default
Log Message:
R Connector: CRAN compatibility
diffs (158 lines):
diff --git a/clients/R/MonetDB.R/NAMESPACE b/clients/R/MonetDB.R/NAMESPACE
--- a/clients/R/MonetDB.R/NAMESPACE
+++ b/clients/R/MonetDB.R/NAMESPACE
@@ -7,6 +7,7 @@ export(monet.read.csv,monetdb.read.csv)
exportMethods(dbSendUpdate,dbSendUpdateAsync,dbTransaction)
# shorthands
export(mc,mq)
+useDynLib(MonetDB.R)
# control.R
export(monetdb.server.setup)
@@ -14,7 +15,6 @@ export(monetdb.server.start)
export(monetdb.server.stop)
export(monetdbd.liststatus)
export(monetdb.liststatus)
-useDynLib(MonetDB.R)
# dplyr.R
export(src_monetdb)
diff --git a/clients/R/MonetDB.R/R/control.R b/clients/R/MonetDB.R/R/control.R
--- a/clients/R/MonetDB.R/R/control.R
+++ b/clients/R/MonetDB.R/R/control.R
@@ -69,7 +69,7 @@ monetdb.server.start <-
monetdb.server.stop <-
- function( correct.pid, wait=T ){
+ function( correct.pid, wait=TRUE ){
if ( .Platform$OS.type == "unix" ) {
system(paste0("kill ",correct.pid))
diff --git a/clients/R/MonetDB.R/R/dplyr.R b/clients/R/MonetDB.R/R/dplyr.R
--- a/clients/R/MonetDB.R/R/dplyr.R
+++ b/clients/R/MonetDB.R/R/dplyr.R
@@ -43,7 +43,7 @@ sample_frac.tbl_monetdb <- function(tbl,
if (n < 1) {
stop("not sampling 0 rows...")
}
- sample_n(tbl, n, replace, weight)
+ dplyr::sample_n(tbl, n, replace, weight)
}
db_query_fields.MonetDBConnection <- function(con, sql, ...) {
diff --git a/clients/R/MonetDB.R/man/control.Rd
b/clients/R/MonetDB.R/man/control.Rd
--- a/clients/R/MonetDB.R/man/control.Rd
+++ b/clients/R/MonetDB.R/man/control.Rd
@@ -18,7 +18,7 @@ This function will return the process id
monetdb.server.setup(database.directory,monetdb.program.path,
dbname = "demo", dbport = 50000)
monetdb.server.start(bat.file)
-monetdb.server.stop(correct.pid)
+monetdb.server.stop(correct.pid, wait = TRUE)
}
\arguments{
\item{database.directory}{Path to the directory where the initialization
script and all data will be stored. Must be empty or non-existant.}
@@ -27,6 +27,7 @@ monetdb.server.stop(correct.pid)
\item{dbport}{TCP port for MonetDB to listen for connections. This port
should not conflict with other running programs on your local computer. Two
databases with the same port number cannot be accessed at the same time}
\item{bat.file}{Path to the MonetDB startup script. This path is returned
by \code{monetdb.server.setup}}
\item{correct.pid}{Process ID of the running MonetDB server. This number is
returned by \code{monetdb.server.start}}
+ \item{wait}{Wait for the server to shut down or return immediately}
}
\value{
\code{monetdb.server.setup} returns the path to a MonetDB startup script,
which can used many times
diff --git a/clients/R/MonetDB.R/man/src_monetdb.Rd
b/clients/R/MonetDB.R/man/src_monetdb.Rd
--- a/clients/R/MonetDB.R/man/src_monetdb.Rd
+++ b/clients/R/MonetDB.R/man/src_monetdb.Rd
@@ -3,6 +3,8 @@
\alias{tbl.src_monetdb}
\alias{src_desc.src_monetdb}
\alias{src_translate_env.src_monetdb}
+\alias{sample_frac.tbl_monetdb}
+\alias{sample_n.tbl_monetdb}
\alias{db_analyze.MonetDBConnection}
\alias{db_create_index.MonetDBConnection}
\alias{db_insert_into.MonetDBConnection}
diff --git a/clients/R/MonetDB.R/src/profiler-r.c
b/clients/R/MonetDB.R/src/profiler-r.c
--- a/clients/R/MonetDB.R/src/profiler-r.c
+++ b/clients/R/MonetDB.R/src/profiler-r.c
@@ -1,11 +1,16 @@
#include <R.h>
#include <Rdefines.h>
-int profiler_start();
+#include "profiler.h"
SEXP profiler_start_listen() {
SEXP port;
+ int pret;
port = NEW_INTEGER(1);
- INTEGER_POINTER(port)[0] = profiler_start();
+ pret = profiler_start();
+ if (pret < 0) {
+ error("Failed to listen for UDP messages");
+ }
+ INTEGER_POINTER(port)[0] = pret;
return port;
}
diff --git a/clients/R/MonetDB.R/src/profiler.c
b/clients/R/MonetDB.R/src/profiler.c
--- a/clients/R/MonetDB.R/src/profiler.c
+++ b/clients/R/MonetDB.R/src/profiler.c
@@ -20,7 +20,6 @@
#else
#include <sys/socket.h>
#include <netinet/in.h>
-
#define HAVE_NL_LANGINFO /* not on Windows, probably everywhere else */
#endif
@@ -152,7 +151,7 @@ void profiler_renderbar(size_t state, si
for (bs=0; bs < symbols; bs++) printf("%s", profiler_symb_bfull);
for (bs=0; bs < PROFILER_BARSYMB-symbols; bs++) printf("%s",
profiler_symb_bfree);
printf(" %3u%% ", percentage);
- fflush(stdout);
+ fflush(NULL);
}
static void* profiler_thread(void* params) {
@@ -241,7 +240,6 @@ int profiler_start(void) {
profiler_socket = socket(AF_INET, SOCK_DGRAM, IPPROTO_UDP);
if(profiler_socket < 0) {
- fprintf(stderr, "socket error\n");
return -1;
}
@@ -252,7 +250,6 @@ int profiler_start(void) {
if (bind(profiler_socket, (struct sockaddr *) &serv_addr,
sizeof(serv_addr)) < 0 ||
getsockname(profiler_socket, (struct sockaddr *)&serv_addr,
&len) < 0) {
- fprintf(stderr, "could not bind to process (%d) %s\n", errno,
strerror(errno));
return -1;
}
diff --git a/clients/R/MonetDB.R/src/profiler.h
b/clients/R/MonetDB.R/src/profiler.h
--- a/clients/R/MonetDB.R/src/profiler.h
+++ b/clients/R/MonetDB.R/src/profiler.h
@@ -13,5 +13,5 @@ void mal_statement_split(char* stmt, mal
void profiler_clearbar(void);
void profiler_renderbar_dl(int* state, int* total);
void profiler_arm(void);
-int profiler_start(void);
-void profiler_renderbar(size_t state, size_t total, char *symbol);
+int profiler_start(void);
+void profiler_renderbar(size_t state, size_t total, char *symbol);
\ No newline at end of file
diff --git a/clients/mapiclient/mclient.c b/clients/mapiclient/mclient.c
--- a/clients/mapiclient/mclient.c
+++ b/clients/mapiclient/mclient.c
@@ -3239,6 +3239,9 @@ main(int argc, char **argv)
if (mode == SQL && progress) {
char* buf = malloc(100);
int port = profiler_start();
+ if (port < 0) {
+ fprintf(stderr, "Unable to listen for UDP profiling
messages\n");
+ }
sprintf(buf, "CALL profiler_openstream('127.0.0.1', %d)", port);
mapi_query(mid, buf);
sprintf(buf, "CALL profiler_stethoscope(0)");
_______________________________________________
checkin-list mailing list
[email protected]
https://www.monetdb.org/mailman/listinfo/checkin-list