Changeset: a54782c4434f for MonetDB URL: http://dev.monetdb.org/hg/MonetDB?cmd=changeset;node=a54782c4434f Added Files: clients/R/Makefile.ag clients/R/MonetDB.R/Makefile.ag clients/R/MonetDB.R/src/Makefile.ag clients/mapiclient/mapisplit-dummy.c clients/mapiclient/profiler-dummy.c Modified Files: clients/Makefile.ag 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/R/Tests/dbi.R clients/R/Tests/dplyr.R clients/R/Tests/dplyr.stable.out clients/R/Tests/survey.R clients/mapiclient/Makefile.ag clients/mapiclient/mclient.1 clients/mapiclient/mclient.c clients/nodejs/Tests/nodetest.js clients/nodejs/monetdb/mapiclient.js clients/nodejs/monetdb/package.json sql/backends/monet5/gsl/Makefile.ag sql/test/BugTracker-2012/Tests/with_and_exists.Bug-3099.sql sql/test/BugTracker-2012/Tests/with_and_exists.Bug-3099.stable.out sql/test/BugTracker/Tests/jdbc_no_debug.SF-1739356.stable.out.32bit Branch: default Log Message:
Merger diffs (truncated from 890 to 300 lines): diff --git a/clients/Makefile.ag b/clients/Makefile.ag --- a/clients/Makefile.ag +++ b/clients/Makefile.ag @@ -15,6 +15,6 @@ # Copyright August 2008-2015 MonetDB B.V. # All Rights Reserved. -SUBDIRS = mapilib mapiclient HAVE_ODBC?odbc HAVE_PERL?perl php HAVE_RUBYGEM?ruby examples HAVE_PYTHON2?python2 HAVE_PYTHON3?python3 NATIVE_WIN32?NT +SUBDIRS = mapilib mapiclient HAVE_ODBC?odbc HAVE_PERL?perl php HAVE_RUBYGEM?ruby examples HAVE_PYTHON2?python2 HAVE_PYTHON3?python3 NATIVE_WIN32?NT R EXTRA_DIST_DIR = Tests diff --git a/clients/R/Makefile.ag b/clients/R/Makefile.ag new file mode 100644 --- /dev/null +++ b/clients/R/Makefile.ag @@ -0,0 +1,20 @@ +# The contents of this file are subject to the MonetDB Public License +# Version 1.1 (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.monetdb.org/Legal/MonetDBLicense +# +# Software distributed under the License is distributed on an "AS IS" +# basis, WITHOUT WARRANTY OF ANY KIND, either express or implied. See the +# License for the specific language governing rights and limitations +# under the License. +# +# The Original Code is the MonetDB Database System. +# +# The Initial Developer of the Original Code is CWI. +# Portions created by CWI are Copyright (C) 1997-July 2008 CWI. +# Copyright August 2008-2015 MonetDB B.V. +# All Rights Reserved. + +SUBDIRS = MonetDB.R + +EXTRA_DIST_DIR = Tests diff --git a/clients/R/MonetDB.R/Makefile.ag b/clients/R/MonetDB.R/Makefile.ag new file mode 100644 --- /dev/null +++ b/clients/R/MonetDB.R/Makefile.ag @@ -0,0 +1,20 @@ +# The contents of this file are subject to the MonetDB Public License +# Version 1.1 (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.monetdb.org/Legal/MonetDBLicense +# +# Software distributed under the License is distributed on an "AS IS" +# basis, WITHOUT WARRANTY OF ANY KIND, either express or implied. See the +# License for the specific language governing rights and limitations +# under the License. +# +# The Original Code is the MonetDB Database System. +# +# The Initial Developer of the Original Code is CWI. +# Portions created by CWI are Copyright (C) 1997-July 2008 CWI. +# Copyright August 2008-2015 MonetDB B.V. +# All Rights Reserved. + +SUBDIRS = src +EXTRA_DIST = DESCRIPTION NAMESPACE NEWS +EXTRA_DIST_DIR = R man 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/Makefile.ag b/clients/R/MonetDB.R/src/Makefile.ag new file mode 100644 --- /dev/null +++ b/clients/R/MonetDB.R/src/Makefile.ag @@ -0,0 +1,18 @@ +# The contents of this file are subject to the MonetDB Public License +# Version 1.1 (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.monetdb.org/Legal/MonetDBLicense +# +# Software distributed under the License is distributed on an "AS IS" +# basis, WITHOUT WARRANTY OF ANY KIND, either express or implied. See the +# License for the specific language governing rights and limitations +# under the License. +# +# The Original Code is the MonetDB Database System. +# +# The Initial Developer of the Original Code is CWI. +# Portions created by CWI are Copyright (C) 1997-July 2008 CWI. +# Copyright August 2008-2015 MonetDB B.V. +# All Rights Reserved. + +EXTRA_DIST = Makevars.win mapisplit.c mapisplit.h mapisplit-r.c profiler.c profiler.h profiler-r.c 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,6 +20,11 @@ #else #include <sys/socket.h> #include <netinet/in.h> +#define HAVE_NL_LANGINFO /* not on Windows, probably everywhere else */ +#endif + +#ifdef HAVE_NL_LANGINFO +#include <langinfo.h> #endif #include "mapisplit.h" @@ -45,13 +50,6 @@ static char* profiler_symb_trans = "V"; static char* profiler_symb_bfree = "_"; static char* profiler_symb_bfull = "#"; -static int profiler_strupp(char *s) { - size_t i; - for (i = 0; i < strlen(s); i++) - s[i] = toupper(s[i]); - return i; -} - /* standalone MAL function call parser */ void mal_statement_split(char* stmt, mal_statement *out, size_t maxparams) { #define TRIM(str) \ @@ -121,7 +119,7 @@ void mal_statement_split(char* stmt, mal } } -static unsigned long profiler_tsms() { +static unsigned long profiler_tsms(void) { unsigned long ret = 0; struct timeval tv; gettimeofday(&tv, NULL); @@ -131,9 +129,10 @@ static unsigned long profiler_tsms() { } // clear line and overwrite with spaces -void profiler_clearbar() { +void profiler_clearbar(void) { + int bs; if (!profiler_needcleanup) return; - for (int bs=0; bs < PROFILER_BARSYMB + 3 + 6; bs++) printf("\b \b"); + for (bs=0; bs < PROFILER_BARSYMB + 3 + 6; bs++) printf("\b \b"); profiler_needcleanup = 0; } @@ -152,11 +151,10 @@ 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) { - params = (void*) params; char buf[BUFSIZ]; char* elems[TRACE_NCOLS]; // query ids are unlikely to be longer than BUFSIZ @@ -167,15 +165,20 @@ static void* profiler_thread(void* param size_t profiler_msgs_expect = 0; size_t profiler_msgs_done = 0; - unsigned long profiler_querystart; + unsigned long profiler_querystart = 0; char* stmtbuf = malloc(65507); // maximum size of an IPv4 UDP packet mal_statement *stmt = malloc(sizeof(mal_statement)); stmt->params = malloc(TRACE_MAL_MAXPARAMS * sizeof(char*)); + (void) params; for(;;) { recvd = read(profiler_socket, buf, sizeof(buf)); + if (recvd < 0) + return NULL; if (recvd > 0) { + size_t i = 0, j = 0; + char ib = 0; buf[recvd] = 0; if (buf[0]== '#') { continue; @@ -185,8 +188,6 @@ static void* profiler_thread(void* param continue; } // cleanup overloaded query identifier - size_t i = 0, j = 0; - char ib = 0; for (i = 0; i < strlen(elems[TRACE_COL_QUERYID]); i++) { if (elems[TRACE_COL_QUERYID][i] == '[') {ib = 1; thisqueryid[j++] = '*'; } if (elems[TRACE_COL_QUERYID][i] == ']') {ib = 0; continue;} @@ -229,20 +230,19 @@ void profiler_renderbar_dl(int* state, i profiler_renderbar(*state, *total, profiler_symb_trans); } -void profiler_arm() { +void profiler_arm(void) { profiler_armed = 1; } -int profiler_start() { +int profiler_start(void) { + struct sockaddr_in serv_addr; + socklen_t len = sizeof(serv_addr); + profiler_socket = socket(AF_INET, SOCK_DGRAM, IPPROTO_UDP); if(profiler_socket < 0) { - fprintf(stderr, "socket error\n"); return -1; } - struct sockaddr_in serv_addr; - socklen_t len = sizeof(serv_addr); - memset((char *) &serv_addr, 0, sizeof(serv_addr)); _______________________________________________ checkin-list mailing list checkin-list@monetdb.org https://www.monetdb.org/mailman/listinfo/checkin-list