Changeset: 2db7c16377ca for MonetDB
URL: http://dev.monetdb.org/hg/MonetDB?cmd=changeset;node=2db7c16377ca
Added Files:
        monetdb5/extras/rapi/Makefile.ag
Modified Files:
        NT/monetdb_config.h.in
        configure.ag
        sql/backends/monet5/Makefile.ag
        sql/backends/monet5/Tests/All
        sql/backends/monet5/mal_backend.c
        sql/backends/monet5/rel_bin.c
        sql/backends/monet5/sql.c
        sql/backends/monet5/sql_gencode.c
        sql/backends/monet5/sql_scenario.c
        sql/common/sql_keyword.c
        sql/common/sql_list.c
        sql/common/sql_mem.c
        sql/include/sql_mem.h
        sql/server/Makefile.ag
        sql/server/rel_psm.c
        sql/server/sql_parser.y
        sql/server/sql_qc.c
        sql/server/sql_scan.c
        sql/storage/restrict/restrict_table.c
        sql/storage/store_dependency.c
        sql/storage/store_sequence.c
        testing/Mtest.py.in
Branch: RIntegration-default
Log Message:

Makefile.ag got lost


diffs (truncated from 682 to 300 lines):

diff --git a/NT/monetdb_config.h.in b/NT/monetdb_config.h.in
--- a/NT/monetdb_config.h.in
+++ b/NT/monetdb_config.h.in
@@ -299,6 +299,9 @@
 /* Define if you have the pthread library */
 /* #undef HAVE_LIBPTHREAD */
 
+/* Define if you have libR installed */
+/* #undef HAVE_LIBR */
+
 /* Define if you have the readline library */
 /* #undef HAVE_LIBREADLINE */
 
diff --git a/configure.ag b/configure.ag
--- a/configure.ag
+++ b/configure.ag
@@ -3377,20 +3377,20 @@ done
 echo
 echo "* Enabled/disabled components:"
 for comp in \
-       'gdk      ' \
-       'monetdb5 ' \
-       'sql      ' \
-       'jsonstore' \
-       'geom     ' \
-       'gsl      ' \
-       'fits     ' \
-       'rdf      ' \
+       'gdk         ' \
+       'monetdb5    ' \
+       'sql         ' \
+       'jaql        ' \
+       'geom        ' \
+       'gsl         ' \
+       'fits        ' \
+       'rdf         ' \
        'rintegration' \
-       'datacell ' \
-       'odbc     ' \
-       'jdbc     ' \
-       'control  ' \
-       'testing  ' \
+       'datacell    ' \
+       'odbc        ' \
+       'jdbc        ' \
+       'control     ' \
+       'testing     ' \
 ; do
        eval "dft=\$dft_$comp"
        eval "enable=\$enable_$comp"
diff --git a/monetdb5/extras/rapi/Makefile.ag b/monetdb5/extras/rapi/Makefile.ag
new file mode 100644
--- /dev/null
+++ b/monetdb5/extras/rapi/Makefile.ag
@@ -0,0 +1,59 @@
+# 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-2014 MonetDB B.V.
+# All Rights Reserved.
+
+INCLUDES = \
+       ../../../common/options \
+       ../../../common/stream \
+       ../../../gdk \
+       ../../mal \
+       $(libr_CFLAGS)
+
+MTSAFE
+
+lib__rapi = {
+       MODULE
+       DIR = libdir/monetdb5
+       SOURCES = rapi.c
+       LIBS = $(libr_LIBS)
+}
+
+headers_h = {
+       DIR = includedir/monetdb
+       HEADERS = h
+       SOURCES = rapi.h 
+}
+
+headers_rapi_mal = {
+       HEADERS = mal
+       DIR = libdir/monetdb5
+       SOURCES = rapi.mal
+}
+
+headers_rapi_R = {
+       HEADERS = R
+       DIR = libdir/monetdb5
+       SOURCES = rapi.R
+}
+
+headers_autoload = {
+       HEADERS = mal
+       DIR = libdir/monetdb5/autoload
+       SOURCES = 50_rapi.mal
+}
+
+EXTRA_DIST_DIR = Tests
+EXTRA_DIST = 50_rapi.mal rapi.mal rapi.R
diff --git a/sql/backends/monet5/Makefile.ag b/sql/backends/monet5/Makefile.ag
--- a/sql/backends/monet5/Makefile.ag
+++ b/sql/backends/monet5/Makefile.ag
@@ -24,6 +24,7 @@ INCLUDES = ../../include ../../common ..
                   ../../../monetdb5/modules/mal \
                   ../../../monetdb5/optimizer \
                   ../../../monetdb5/scheduler \
+                  ../../../monetdb5/extras/rapi \
                   ../../../clients/mapilib \
                   ../../../common/options \
                   ../../../common/stream \
diff --git a/sql/backends/monet5/Tests/All b/sql/backends/monet5/Tests/All
--- a/sql/backends/monet5/Tests/All
+++ b/sql/backends/monet5/Tests/All
@@ -1,2 +1,20 @@
 optimizers
-#Mbeddedsql5--help   disabled for now
+
+HAVE_LIBR?rapi00
+HAVE_LIBR?rapi01
+HAVE_LIBR?rapi02
+HAVE_LIBR?rapi03
+HAVE_LIBR?rapi04
+HAVE_LIBR?rapi05
+HAVE_LIBR?rapi06
+HAVE_LIBR?rapi07
+# this one will require significant work in the SQL layer, so disabled for now
+# HAVE_LIBR?rapi08
+ HAVE_LIBR?rapi09
+  HAVE_LIBR?rapi10
+
+# should this work?
+#inlineUDF
+
+# disabled for now
+#Mbeddedsql5--help   
diff --git a/sql/backends/monet5/mal_backend.c 
b/sql/backends/monet5/mal_backend.c
--- a/sql/backends/monet5/mal_backend.c
+++ b/sql/backends/monet5/mal_backend.c
@@ -37,7 +37,7 @@ backend_reset(backend *b)
 backend *
 backend_create(mvc *m, Client c)
 {
-       backend *b = NEW(backend);
+       backend *b = MNEW(backend);
 
        b->console = isAdministrator(c);
        b->mvc = m;
diff --git a/sql/backends/monet5/rel_bin.c b/sql/backends/monet5/rel_bin.c
--- a/sql/backends/monet5/rel_bin.c
+++ b/sql/backends/monet5/rel_bin.c
@@ -2648,7 +2648,7 @@ sql_parse(mvc *m, sql_allocator *sa, cha
        if (THRhighwater())
                return sql_error(m, 10, "SELECT: too many nested operators");
 
-       o = NEW(mvc);
+       o = MNEW(mvc);
        if (!o)
                return NULL;
        *o = *m;
diff --git a/sql/backends/monet5/sql.c b/sql/backends/monet5/sql.c
--- a/sql/backends/monet5/sql.c
+++ b/sql/backends/monet5/sql.c
@@ -892,7 +892,7 @@ create_func(mvc *sql, char *sname, sql_f
                }
                sa_destroy(sql->sa);
                sql->sa = sa;
-       } else {
+       } else if (nf->lang == FUNC_LANG_MAL) {
                if (!backend_resolve_function(sql, nf))
                        return sql_message("3F000!CREATE %s%s: external name 
%s.%s not bound", KF, F, nf->mod, nf->base.name);
        }
diff --git a/sql/backends/monet5/sql_gencode.c 
b/sql/backends/monet5/sql_gencode.c
--- a/sql/backends/monet5/sql_gencode.c
+++ b/sql/backends/monet5/sql_gencode.c
@@ -90,6 +90,21 @@ constantAtom(backend *sql, MalBlkPtr mb,
        return idx;
 }
 
+static InstrPtr
+pushPtr(MalBlkPtr mb, InstrPtr q, ptr val)
+{
+       int _t;
+       ValRecord cst;
+
+       if (q == NULL)
+               return NULL;
+       cst.vtype= TYPE_ptr;
+       cst.val.pval = val;
+       cst.len = 0;
+       _t = defConstant(mb, TYPE_ptr, &cst);
+       return pushArgument(mb, q, _t);
+}
+
 static int
 argumentZero(MalBlkPtr mb, int tpe)
 {
@@ -694,6 +709,10 @@ dump_joinN(backend *sql, MalBlkPtr mb, s
        /* filter qualifying tuples, return oids of h and tail */
        q = newStmt(mb, mod, fimp);
        q = pushReturn(mb, q, newTmpVariable(mb, TYPE_any));
+       if (LANG_EXT(f->lang)) 
+               q = pushPtr(mb, q, f);
+       if (f->lang == FUNC_LANG_R)
+               q = pushStr(mb, q, f->query);
        q = pushArgument(mb, q, op1);
        q = pushArgument(mb, q, op2);
        if (s->op3)
@@ -1824,6 +1843,7 @@ static int
                        sql_subtype *tpe = NULL;
                        int special = 0;
                        sql_subfunc *f = s->op4.funcval;
+                       int rtype = (f->res.type)?f->res.type->localtype:0;
                        node *n;
                        /* dump operands */
                        if (_dumpstmt(sql, mb, s->op1) < 0)
@@ -1865,6 +1885,10 @@ static int
                        if (strcmp(fimp, "round") == 0 && tpe && 
tpe->type->eclass == EC_DEC)
                                special = 1;
 
+                       if (LANG_EXT(f->func->lang)) 
+                               q = pushPtr(mb, q, f->func);
+                       if (f->func->lang == FUNC_LANG_R)
+                               q = pushStr(mb, q, f->func->query);
                        for (n = s->op1->op4.lval->h; n; n = n->next) {
                                stmt *op = n->data;
 
@@ -1972,6 +1996,15 @@ static int
                                        setVarUDFtype(mb, getArg(q, 0));
                                }
                        }
+                       if (LANG_EXT(a->aggr->lang)) 
+                               q = pushPtr(mb, q, a->aggr);
+                       if (a->aggr->lang == FUNC_LANG_R){
+                               if (!g) {
+                                       setVarType(mb, getArg(q, 0), restype);
+                                       setVarUDFtype(mb, getArg(q, 0));
+                               }
+                               q = pushStr(mb, q, a->aggr->query);
+                       }
                        if (s->op1->type != st_list) {
                                q = pushArgument(mb, q, l);
                        } else {
@@ -2913,3 +2946,21 @@ backend_create_subaggr(backend *be, sql_
 {
        return backend_create_func(be, f->aggr, f->res, NULL);
 }
+
+/* TODO handle aggr */
+int
+backend_create_func(backend *be, sql_func *f)
+{
+       switch(f->lang) {
+       case FUNC_LANG_INT:
+       case FUNC_LANG_MAL:
+       case FUNC_LANG_SQL:
+               return backend_create_sql_func(be, f);
+       case FUNC_LANG_R:
+               return backend_create_r_func(be, f);
+       case FUNC_LANG_C:
+       case FUNC_LANG_J:
+       default:
+               return -1;      
+       }
+}
diff --git a/sql/backends/monet5/sql_scenario.c 
b/sql/backends/monet5/sql_scenario.c
--- a/sql/backends/monet5/sql_scenario.c
+++ b/sql/backends/monet5/sql_scenario.c
@@ -1214,7 +1214,7 @@ SQLstatementIntern(Client c, str *expr, 
        initSQLreferences();
        m = sql->mvc;
        ac = m->session->auto_commit;
-       o = NEW(mvc);
+       o = MNEW(mvc);
        if (!o)
                throw(SQL, "SQLstatement", "Out of memory");
        *o = *m;
diff --git a/sql/common/sql_keyword.c b/sql/common/sql_keyword.c
--- a/sql/common/sql_keyword.c
+++ b/sql/common/sql_keyword.c
@@ -48,7 +48,7 @@ keyword_key(char *k, int *l)
 void
 keywords_insert(char *k, int token)
 {
-       keyword *kw = NEW(keyword);
+       keyword *kw = MNEW(keyword);
_______________________________________________
checkin-list mailing list
checkin-list@monetdb.org
https://www.monetdb.org/mailman/listinfo/checkin-list

Reply via email to