Changeset: 07f31aff32cd for MonetDB
URL: https://dev.monetdb.org/hg/MonetDB/rev/07f31aff32cd
Modified Files:
sql/backends/monet5/rel_bin.c
sql/backends/monet5/sql_statement.c
sql/backends/monet5/sql_statement.h
Branch: default
Log Message:
make sure we call normal aggregations (counts) when result is only needed
within a pipeline loop
diffs (79 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
@@ -5550,11 +5550,11 @@ insert_check_ukey(backend *be, list *ins
s = stmt_join(be, s, h, 0, cmp_equal, 0, k->type ==
unndkey? 1: 0, false);
/* s should be empty */
s = stmt_result(be, s, 0);
- s = stmt_aggr(be, s, NULL, NULL, cnt, 1, 0, 1);
+ s = stmt_aggr_nopp(be, s, NULL, NULL, cnt, 1, 0, 1);
} else {
s = stmt_uselect(be, s, h, cmp_equal, NULL, 0, k->type
== unndkey? 1: 0);
/* s should be empty */
- s = stmt_aggr(be, s, NULL, NULL, cnt, 1, 0, 1);
+ s = stmt_aggr_nopp(be, s, NULL, NULL, cnt, 1, 0, 1);
}
/* s should be empty */
s = stmt_binop(be, s, stmt_atom_lng(be, 0), NULL, ne);
@@ -5790,7 +5790,7 @@ sql_insert_check_null(backend *be, sql_t
s = stmt_selectnil(be, column(be, i), NULL);
if (!cnt)
cnt = sql_bind_func(sql, "sys",
"count", sql_fetch_localtype(TYPE_void), NULL, F_AGGR, true, true);
- s = stmt_aggr(be, s, NULL, NULL, cnt, 1, 0, 1);
+ s = stmt_aggr_nopp(be, s, NULL, NULL, cnt, 1,
0, 1);
} else {
sql_subfunc *isnil = sql_bind_func(sql, "sys",
"isnull", &c->type, NULL, F_FUNC, true, true);
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
@@ -21,8 +21,6 @@
#include "mal_namespace.h"
#include "mal_builder.h"
-static stmt * stmt_aggr_(backend *be, stmt *op1, stmt *grp, stmt *ext,
sql_subfunc *op, int reduce, int no_nil, int nil_if_empty);
-
/*
* Some utility routines to generate code
* The equality operator in MAL is '==' instead of '='.
@@ -4387,7 +4385,7 @@ stmt_Nop(backend *be, stmt *ops, stmt *s
push_cands = f->func->type == F_FUNC && can_push_cands(sel,
mod, fimp);
default_nargs = (f->res && list_length(f->res) ?
list_length(f->res) : 1) + list_length(ops->op4.lval) + (o && o->nrcols > 0 ? 6
: 4);
if (rows) {
- card = stmt_aggr_(be, rows, NULL, NULL,
sql_bind_func(be->mvc, "sys", "count", sql_fetch_localtype(TYPE_void), NULL,
F_AGGR, true, true), 1, 0, 1);
+ card = stmt_aggr_nopp(be, rows, NULL, NULL,
sql_bind_func(be->mvc, "sys", "count", sql_fetch_localtype(TYPE_void), NULL,
F_AGGR, true, true), 1, 0, 1);
default_nargs++;
}
@@ -4604,8 +4602,8 @@ stmt_func(backend *be, stmt *ops, const
return NULL;
}
-static stmt *
-stmt_aggr_(backend *be, stmt *op1, stmt *grp, stmt *ext, sql_subfunc *op, int
reduce, int no_nil, int nil_if_empty)
+stmt *
+stmt_aggr_nopp(backend *be, stmt *op1, stmt *grp, stmt *ext, sql_subfunc *op,
int reduce, int no_nil, int nil_if_empty)
{
MalBlkPtr mb = be->mb;
InstrPtr q = NULL;
@@ -4748,7 +4746,7 @@ stmt_aggr(backend *be, stmt *op1, stmt *
if (be->pipeline)
return stmt_pp_aggr(be, op1, grp, ext, op, reduce, no_nil,
nil_if_empty);
else
- return stmt_aggr_(be, op1, grp, ext, op, reduce, no_nil,
nil_if_empty);
+ return stmt_aggr_nopp(be, op1, grp, ext, op, reduce, no_nil,
nil_if_empty);
}
static stmt *
diff --git a/sql/backends/monet5/sql_statement.h
b/sql/backends/monet5/sql_statement.h
--- a/sql/backends/monet5/sql_statement.h
+++ b/sql/backends/monet5/sql_statement.h
@@ -260,6 +260,8 @@ extern stmt *stmt_Nop(backend *be, stmt
sql_export stmt *stmt_func(backend *be, stmt *ops, const char *name, sql_rel
*imp, int f_union);
extern stmt *stmt_direct_func(backend *be, InstrPtr q);
extern stmt *stmt_aggr(backend *be, stmt *op1, stmt *grp, stmt *ext,
sql_subfunc *op, int reduce, int no_nil, int nil_if_empty);
+extern stmt * stmt_aggr_nopp(backend *be, stmt *op1, stmt *grp, stmt *ext,
sql_subfunc *op, int reduce, int no_nil, int nil_if_empty);
+
sql_export stmt *stmt_blackbox_result(backend *be, InstrPtr q, int retnr,
sql_subtype *t);
_______________________________________________
checkin-list mailing list -- [email protected]
To unsubscribe send an email to [email protected]