Changeset: 158e0108771c for MonetDB
URL: https://dev.monetdb.org/hg/MonetDB/rev/158e0108771c
Modified Files:
monetdb5/modules/mal/iterator.c
monetdb5/modules/mal/manifold.c
sql/backends/monet5/rel_bin.c
sql/backends/monet5/sql_statement.c
sql/server/rel_optimizer.c
Branch: sequences_7184
Log Message:
And more progress...
diffs (106 lines):
diff --git a/monetdb5/modules/mal/iterator.c b/monetdb5/modules/mal/iterator.c
--- a/monetdb5/modules/mal/iterator.c
+++ b/monetdb5/modules/mal/iterator.c
@@ -145,7 +145,7 @@ ITRbunIterator(Client cntxt, MalBlkPtr m
*head = 0;
bi = bat_iterator(b);
- if (VALinit(tail, b->ttype, BUNtail(bi, *head)) == NULL) {
+ if (VALinit(tail, ATOMtype(b->ttype), BUNtail(bi, *head)) == NULL) {
bat_iterator_end(&bi);
BBPunfix(b->batCacheid);
throw(MAL, "iterator.nextChunk", SQLSTATE(HY013)
MAL_MALLOC_FAIL);
@@ -181,7 +181,7 @@ ITRbunNext(Client cntxt, MalBlkPtr mb, M
return MAL_SUCCEED;
}
bi = bat_iterator(b);
- if (VALinit(tail, b->ttype, BUNtail(bi, *head)) == NULL) {
+ if (VALinit(tail, ATOMtype(b->ttype), BUNtail(bi, *head)) == NULL) {
bat_iterator_end(&bi);
BBPunfix(b->batCacheid);
throw(MAL, "iterator.nextChunk", SQLSTATE(HY013)
MAL_MALLOC_FAIL);
diff --git a/monetdb5/modules/mal/manifold.c b/monetdb5/modules/mal/manifold.c
--- a/monetdb5/modules/mal/manifold.c
+++ b/monetdb5/modules/mal/manifold.c
@@ -384,6 +384,7 @@ MANIFOLDremapMultiplex(Client cntxt, Mal
#include "mel.h"
mel_func manifold_init_funcs[] = {
pattern("mal", "multiplex", MANIFOLDremapMultiplex, false, "", args(1,4,
varargany("",0),arg("mod",str),arg("fcn",str),varargany("a",0))),
+ pattern("mal", "multiplex", MANIFOLDremapMultiplex, false, "", args(1,4,
varargany("",0),arg("card", lng), arg("mod",str),arg("fcn",str))),
pattern("mal", "multiplex", MANIFOLDremapMultiplex, false, "", args(1,5,
varargany("",0),arg("card", lng),
arg("mod",str),arg("fcn",str),varargany("a",0))),
pattern("batmal", "multiplex", MANIFOLDremapMultiplex, false, "", args(1,4,
varargany("",0),arg("mod",str),arg("fcn",str),varargany("a",0))),
pattern("mal", "manifold", MANIFOLDevaluate, false, "", args(1,4,
batargany("",0),arg("mod",str),arg("fcn",str),varargany("a",0))),
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
@@ -1243,19 +1243,8 @@ exp_bin(backend *be, sql_exp *e, stmt *l
stmt *rows = NULL;
int push_cands = can_push_cands(sel, f);
- if (f->func->side_effect && left && left->nrcols > 0 &&
f->func->type != F_LOADER) {
- sql_subfunc *f1 = NULL;
- /* we cannot assume all SQL functions with no arguments
have a correspondent with one argument, so attempt to find it. 'rand' function
is the exception */
- if (list_empty(exps) && (strcmp(f->func->base.name,
"rand") == 0 || (f1 = sql_find_func(sql, f->func->s ? f->func->s->base.name :
NULL, f->func->base.name, 1, f->func->type, NULL)))) {
- if (f1)
- f = f1;
- list_append(l, stmt_const(be,
bin_find_smallest_column(be, left),
-
stmt_atom(be, atom_general(sql->sa, f1 ?
&(((sql_arg*)f1->func->ops->h->data)->type) : sql_bind_localtype("int"),
NULL))));
- } else if (exps_card(exps) < CARD_MULTI) {
- rows = bin_find_smallest_column(be, left);
- }
- sql->session->status = 0; /* if the function was not
found clean the error */
- sql->errstr[0] = '\0';
+ if (f->func->side_effect && left && left->nrcols > 0 &&
f->func->type != F_LOADER && exps_card(exps) < CARD_MULTI) {
+ rows = bin_find_smallest_column(be, left);
}
assert(!e->r);
if (strcmp(sql_func_mod(f->func), "") == 0 &&
strcmp(sql_func_imp(f->func), "") == 0 && strcmp(f->func->base.name, "star") ==
0)
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
@@ -3365,9 +3365,11 @@ stmt_Nop(backend *be, stmt *ops, stmt *s
}
s->op1 = ops;
if (o) {
- s->nrcols = rows? rows->nrcols:o->nrcols;
+ s->nrcols = o->nrcols;
s->key = o->key;
s->aggr = o->aggr;
+ } else if (rows) {
+ s->nrcols = rows->nrcols;
} else {
s->nrcols = 0;
s->key = 1;
diff --git a/sql/server/rel_optimizer.c b/sql/server/rel_optimizer.c
--- a/sql/server/rel_optimizer.c
+++ b/sql/server/rel_optimizer.c
@@ -9073,8 +9073,18 @@ static bool
switch(e->type) {
case e_func: // I.e. f() or f(arg) or f(arg1, ..., argn)
{
+ is_independent = true;
+
+ sql_subfunc *f = e->f;
+ if (strcmp(sql_func_mod(f->func), "") == 0 &&
strcmp(sql_func_imp(f->func), "") == 0 && strcmp(f->func->base.name, "star") ==
0) {
+ /* the star() function call signals that the parent
expression is a function call
+ * to some window function without column expressions.
+ * We do not optimize such window functions here.*/
+ is_independent = false;
+ break;
+ }
+
list* args = e->l;// The list of actual arguments which can be
empty
- is_independent = true;
if (args)
for (node *en = args->h; en; en = en->next) {
sql_exp* arg = en->data;
@@ -9091,6 +9101,9 @@ static bool
if (is_independent)
e->argument_independence = 1;
break;
+ case e_cmp:
+ is_independent = _rel_flag_independent_projections(sql, e->l,
projected_from) && _rel_flag_independent_projections(sql, e->r, projected_from);
+ break;
case e_atom: // Any atom potentially aliased, e.g. 2 as i
is_independent = true;
break;
_______________________________________________
checkin-list mailing list
[email protected]
https://www.monetdb.org/mailman/listinfo/checkin-list