Changeset: 6ed58f6acd9e for MonetDB
URL: http://dev.monetdb.org/hg/MonetDB?cmd=changeset;node=6ed58f6acd9e
Modified Files:
        sql/backends/monet5/rel_bin.c
        sql/backends/monet5/sciql.c
        sql/backends/monet5/sql.c
        sql/backends/monet5/sql_execute.c
        sql/backends/monet5/sql_gencode.c
        sql/backends/monet5/sql_statement.c
Branch: SciQL-2
Log Message:

more compilation errors fixed/hid


diffs (225 lines):

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
@@ -680,24 +680,52 @@ exp_bin(mvc *sql, sql_exp *e, stmt *left
                        return NULL;
                }
 
-                       if (list_length(e->r) > 2) {
-                               /* NB: this is a HACK to make the array_slice 
filter work.
-                                * Unlike the normal filters, the array_slice 
doesn't have
-                                *  right-side comparison value.
-                                * Instead, it has a list of dimension and 
slicing ranges,
-                                *  contained in e->r, that need to be passed 
to the filter
-                                *  function.
-                                * Here we create a stmt for each of them and 
add it to the ops
-                                *  list.
-                                */
-                               node *n;
-                               for (n = ((list*)e->r)->h; n; n = n->next) {
-                                       append(ops, exp_bin(sql, n->data, NULL, 
NULL, NULL, NULL, NULL, NULL));
+//FOT: The original filter case does not exist anymore so I removed also the
+//adaptation for the arrays. I need to see how (if needed) to put it in the 
changed code
+#if 0
+               /* general predicate, select and join */
+               if (get_cmp(e) == cmp_filter) {
+                       list *ops;
+
+                       if (l->nrcols == 0)
+                               l = stmt_const(sql->sa, 
bin_first_column(sql->sa, swapped?right:left), l);
+
+                               if (left && right && re->card > CARD_ATOM && 
!is_select) {
+                       /* find predicate function */
+                                       sql_subfunc *f = e->f;
+                                       stmt *j = stmt_joinN(sql->sa, l, r, r2, 
f, swapped);
+
+                                       if (j && is_anti(e))
+                                               j->flag |= ANTI;
+                    return j;
+                }
+            
+                               ops = sa_list(sql->sa);
+               
+                               if (list_length(e->r) > 2) {
+                                       /* NB: this is a HACK to make the 
array_slice filter work.
+                                       * Unlike the normal filters, the 
array_slice doesn't have
+                                       * right-side comparison value.
+                                       * Instead, it has a list of dimension 
and slicing ranges,
+                                       * contained in e->r, that need to be 
passed to the filter function.
+                                       * Here we create a stmt for each of 
them and add it to the ops list.*/
+                       node *n;
+                       for (n = ((list*)e->r)->h; n; n = n->next) {
+                       append(ops, exp_bin(sql, n->data, NULL, NULL, NULL, 
NULL, NULL, NULL));
+                       }
+               } else { /* the normal/original filter case */
+                                       append(ops, r);
+                                       append(ops, r2);
                                }
-                       } else { /* the normal/original filter case */
-                               append(ops, r);
-                               append(ops, r2);
-                       }
+                               r = stmt_list(sql->sa, ops);
+                               s = stmt_genselect(sql->sa, l, r, e->f, sel);
+
+                               if (s && is_anti(e))
+                                       s->flag |= ANTI;
+                               return s;
+               }
+#endif
+
                if (left && right && !is_select &&
                   ((l->nrcols && (r->nrcols || (r2 && r2->nrcols))) || 
                     re->card > CARD_ATOM || 
@@ -765,7 +793,7 @@ stmt_col( mvc *sql, sql_column *c, stmt 
 { 
        stmt *sc = stmt_bat(sql->sa, c, RDONLY);
 
-       if (isTableOrArray(c->t) && !c->t->readonly && !readonly &&
+       if ((isTable(c->t) || isArray(c->t)) && c->t->access != TABLE_READONLY 
&&
           (c->base.flag != TR_NEW || c->t->base.flag != TR_NEW /* alter */) &&
           (c->t->persistence == SQL_PERSIST || c->t->persistence == 
SQL_DECLARED_TABLE) && !c->t->commit_action) {
                stmt *i = stmt_bat(sql->sa, c, RD_INS);
@@ -783,7 +811,7 @@ stmt_idx( mvc *sql, sql_idx *i, stmt *de
 { 
        stmt *sc = stmt_idxbat(sql->sa, i, RDONLY);
 
-       if (isTableOrArray(i->t) && !i->t->readonly && !readonly &&
+       if ((isTable(i->t) || isArray(i->t)) && i->t->access != TABLE_READONLY 
&&
           (i->base.flag != TR_NEW || i->t->base.flag != TR_NEW /* alter */) &&
           (i->t->persistence == SQL_PERSIST || i->t->persistence == 
SQL_DECLARED_TABLE) && !i->t->commit_action) {
                stmt *ic = stmt_idxbat(sql->sa, i, RD_INS);
diff --git a/sql/backends/monet5/sciql.c b/sql/backends/monet5/sciql.c
--- a/sql/backends/monet5/sciql.c
+++ b/sql/backends/monet5/sciql.c
@@ -204,25 +204,25 @@ str SCIQLmaterialise(Client cntxt, MalBl
                        /* Fill the BAT with the constant value */
                        switch(tpe) { /* TODO: check for overflow */
                        case TYPE_bte:
-                               bn = BATconstant(tpe, &dst.val.btval, cntall);
+                               bn = BATconstant(tpe, &dst.val.btval, cntall, 
TRANSIENT);
                                break;
                        case TYPE_sht:
-                               bn = BATconstant(tpe, &dst.val.shval, cntall);
+                               bn = BATconstant(tpe, &dst.val.shval, cntall, 
TRANSIENT);
                                break;
                        case TYPE_int:
-                               bn = BATconstant(tpe, &dst.val.ival, cntall);
+                               bn = BATconstant(tpe, &dst.val.ival, cntall, 
TRANSIENT);
                                break;
                        case TYPE_lng:
-                               bn = BATconstant(tpe, &dst.val.lval, cntall);
+                               bn = BATconstant(tpe, &dst.val.lval, cntall, 
TRANSIENT);
                                break;
                        case TYPE_flt:
-                               bn = BATconstant(tpe, &dst.val.fval, cntall);
+                               bn = BATconstant(tpe, &dst.val.fval, cntall, 
TRANSIENT);
                                break;
                        case TYPE_dbl:
-                               bn = BATconstant(tpe, &dst.val.dval, cntall);
+                               bn = BATconstant(tpe, &dst.val.dval, cntall, 
TRANSIENT);
                                break;
                        case TYPE_str:
-                               bn = BATconstant(tpe, dst.val.sval, cntall);
+                               bn = BATconstant(tpe, dst.val.sval, cntall, 
TRANSIENT);
                                break;
                        default:
                                throw(MAL, "sciql.materialise", "Unsupported 
data type %s", ATOMname(tpe));
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
@@ -424,7 +424,7 @@ create_table_or_view(mvc *sql, char *sna
                }
        }
 
-       nt = sql_trans_create_table(sql->session->tr, s, t->base.name, 
t->query, t->type, t->system, temp, t->commit_action, t->sz);
+       nt = sql_trans_create_table(sql->session->tr, s, t->base.name, 
t->query, t->type, t->system, temp, t->commit_action, t->sz, 0, 1, 0);
 
        for (n = t->columns.set->h; n; n = n->next) {
                sql_column *c = n->data;
@@ -4552,7 +4552,7 @@ RAstatement(Client cntxt, MalBlkPtr mb, 
                MSinitClientPrg(cntxt, "user", "test");
 
                /* generate MAL code */
-               backend_callinline(b, cntxt, s);
+               backend_callinline(b, cntxt, s, rel);
                addQueryToCache(cntxt);
 
                msg = (str) runMAL(cntxt, cntxt->curprg->def, 0, 0);
diff --git a/sql/backends/monet5/sql_execute.c 
b/sql/backends/monet5/sql_execute.c
--- a/sql/backends/monet5/sql_execute.c
+++ b/sql/backends/monet5/sql_execute.c
@@ -179,7 +179,7 @@ SQLstatementIntern(Client c, str *expr, 
                        goto endofcompile;
                }
                /* generate MAL code */
-               if (backend_callinline(sql, c, s) == 0)
+               if (backend_callinline(sql, c, s, r) == 0)
                        addQueryToCache(c);
                else
                        err = 1;
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
@@ -1256,11 +1256,12 @@ static int
 
                                        if (backend_create_subfunc(sql, 
s->op4.funcval, NULL) < 0)
                                                return -1;
-                                       isArraySlice = (strcmp(mod, "array") == 
0 && strcmp(fimp, "slice") == 0);
-
+                                       
                                        mod = sql_func_mod(f);
                                        fimp = sql_func_imp(f);
                                        fimp = strconcat(fimp, "subselect");
+                                       isArraySlice = (strcmp(mod, "array") == 
0 && strcmp(fimp, "slice") == 0);
+                                       
                                        q = newStmt(mb, mod, 
convertOperator(fimp));
                                        /* NB: this is a HACK to make the 
array_slice filter work.
                                         * The array_slice function computes 
the selected OIDs only
@@ -1280,14 +1281,15 @@ static int
                                        // f->query contains the R code to be 
run
                                        if (f->lang == FUNC_LANG_R)
                                                q = pushStr(mb, q, f->query);
+
                                        for (n = s->op1->op4.lval->h; n; n = 
n->next) {
                                                stmt *op = n->data;
 
                                                q = pushArgument(mb, q, op->nr);
                                        }
                                        /* candidate lists */
-                                               if (sub > 0)
-                                                       q = pushArgument(mb, q, 
sub);
+                                       if (sub > 0)
+                                               q = pushArgument(mb, q, sub);
                                        else
                                                q = pushNil(mb, q, TYPE_bat); 
 
@@ -2584,13 +2586,15 @@ add_materialise_stmt(MalBlkPtr mb, sql_r
                }
                break;
        case op_table:
+//FOT: sql_subtype does not store a pointer to the sql_table so I had to 
comment it until I find the solution
+#if 0
                if (rel->flag == 0 && rel->r != NULL) { /* a table returning 
UDF */
                        sql_table *t = 
((sql_subfunc*)((sql_exp*)rel->r)->f)->res.comp_type;
                        if (t->valence > 0) { /* an array returning UDF */
                                /* TODO: materialise the arrays 
defined/returned by the function */
                        }
                }
-
+#endif
                if (rel->l)
                        add_materialise_stmt(mb, rel->l, processed);    
                break;
diff --git a/sql/backends/monet5/sql_statement.c 
b/sql/backends/monet5/sql_statement.c
--- a/sql/backends/monet5/sql_statement.c
+++ b/sql/backends/monet5/sql_statement.c
@@ -361,7 +361,7 @@ stmt_deps(list *dep_list, stmt *s, int d
                        case st_append_col:
                        case st_update_col:
                                if (depend_type == COLUMN_DEPENDENCY) {
-                               if (isTableOrArray(s->op4.cval->t)) 
+                               if (isTable(s->op4.cval->t) || 
isArray(s->op4.cval->t)) 
                                                dep_list = 
cond_append(dep_list, &s->op4.cval->base.id);
                                        dep_list = cond_append(dep_list, 
&s->op4.cval->t->base.id);
                                }
_______________________________________________
checkin-list mailing list
checkin-list@monetdb.org
https://www.monetdb.org/mailman/listinfo/checkin-list

Reply via email to