Changeset: 39de0ff25c14 for MonetDB URL: https://dev.monetdb.org/hg/MonetDB/rev/39de0ff25c14 Branch: strimps_v3 Log Message:
Merge with default branch diffs (truncated from 6500 to 300 lines): diff --git a/ChangeLog b/ChangeLog --- a/ChangeLog +++ b/ChangeLog @@ -1,3 +1,9 @@ # ChangeLog file for devel # This file is updated with Maddlog +* Mon Apr 28 2025 Niels Nes <[email protected]> +- Changed the way complex AND and OR expressions are handled. The new + expression tree uses 2 new cmp flag (cmp_con/cmp_dis), both expressions + hold lists of expressions. This structure reduces the need for stack + space, allowing way larger expressions trees to be handled. + diff --git a/clients/mapiclient/mclient.c b/clients/mapiclient/mclient.c --- a/clients/mapiclient/mclient.c +++ b/clients/mapiclient/mclient.c @@ -3770,12 +3770,13 @@ main(int argc, char **argv) mapi_setfilecallback2(mid, getfile, putfile, &priv); mapi_trace(mid, trace); + if (!has_fileargs && command == NULL && isatty(fileno(stdin))) + catch_interrupts(mid); + /* give the user a welcome message with some general info */ if (!quiet && !has_fileargs && command == NULL && isatty(fileno(stdin))) { char *lang; - catch_interrupts(mid); - if (mode == SQL) { lang = "/SQL"; } else { diff --git a/gdk/gdk_bat.c b/gdk/gdk_bat.c --- a/gdk/gdk_bat.c +++ b/gdk/gdk_bat.c @@ -834,7 +834,8 @@ COLcopy(BAT *b, int tt, bool writable, r bn->tnil = bi.nil; bn->tminpos = bi.minpos; bn->tmaxpos = bi.maxpos; - bn->tunique_est = bi.unique_est; + if (!bi.key) + bn->tunique_est = bi.unique_est; } else if (ATOMstorage(tt) == ATOMstorage(b->ttype) && ATOMcompare(tt) == ATOMcompare(b->ttype)) { BUN h = bi.count; @@ -861,7 +862,8 @@ COLcopy(BAT *b, int tt, bool writable, r } bn->tminpos = bi.minpos; bn->tmaxpos = bi.maxpos; - bn->tunique_est = bi.unique_est; + if (!bi.key) + bn->tunique_est = bi.unique_est; } else { bn->tsorted = bn->trevsorted = false; /* set based on count later */ bn->tnonil = bn->tnil = false; @@ -873,6 +875,7 @@ COLcopy(BAT *b, int tt, bool writable, r bn->tsorted = ATOMlinear(b->ttype); bn->trevsorted = ATOMlinear(b->ttype); bn->tkey = true; + bn->tunique_est = (double) bn->batCount; } bat_iterator_end(&bi); if (!writable) @@ -1665,8 +1668,12 @@ BUNinplacemulti(BAT *b, const oid *posit BUN nunique = b->thash ? b->thash->nunique : 0; MT_rwlock_wrunlock(&b->thashlock); MT_lock_set(&b->theaplock); - if (nunique != 0) + if (nunique != 0) { b->tunique_est = (double) nunique; + if (nunique == b->batCount && !b->tkey) + BATkey(b, true); + } else if (b->tkey) + b->tunique_est = (double) b->batCount; b->tminpos = bi.minpos; b->tmaxpos = bi.maxpos; b->theap->dirty = true; @@ -1954,8 +1961,10 @@ BATkey(BAT *b, bool flag) b->tkey = flag; if (!flag) { b->tseqbase = oid_nil; - } else + } else { b->tnokey[0] = b->tnokey[1] = 0; + b->tunique_est = (double) b->batCount; + } gdk_return rc = GDK_SUCCEED; if (flag && VIEWtparent(b)) { /* if a view is key, then so is the parent if the two @@ -2021,6 +2030,7 @@ BATtseqbase(BAT *b, oid o) b->trevsorted = b->batCount <= 1; if (!b->trevsorted) b->tnorevsorted = 1; + b->tunique_est = (double) b->batCount; } } } else { diff --git a/gdk/gdk_cand.c b/gdk/gdk_cand.c --- a/gdk/gdk_cand.c +++ b/gdk/gdk_cand.c @@ -1469,6 +1469,7 @@ BATmaskedcands(oid hseq, BUN nr, BAT *ma GDKfree(msks); } BATsetcount(bn, cnt); + bn->tunique_est = (double) cnt; TRC_DEBUG(ALGO, "hseq=" OIDFMT ", masked=" ALGOBATFMT ", selected=%s" " -> " ALGOBATFMT "\n", hseq, ALGOBATPAR(masked), diff --git a/gdk/gdk_join.c b/gdk/gdk_join.c --- a/gdk/gdk_join.c +++ b/gdk/gdk_join.c @@ -3259,8 +3259,6 @@ hashjoin(BAT **r1p, BAT **r2p, BAT **r3p locked = false; MT_rwlock_rdunlock(&r->thashlock); } - bat_iterator_end(&li); - bat_iterator_end(&ri); if (hash_cand) { HEAPfree(&hsh->heaplink, true); @@ -3269,7 +3267,7 @@ hashjoin(BAT **r1p, BAT **r2p, BAT **r3p } /* also set other bits of heap to correct value to indicate size */ BATsetcount(r1, BATcount(r1)); - r1->tunique_est = MIN(l->tunique_est, r->tunique_est); + r1->tunique_est = MIN(li.unique_est, ri.unique_est); if (BATcount(r1) <= 1) { r1->tsorted = true; r1->trevsorted = true; @@ -3285,14 +3283,16 @@ hashjoin(BAT **r1p, BAT **r2p, BAT **r3p r2->tkey = true; r2->tseqbase = 0; } - r2->tunique_est = MIN(l->tunique_est, r->tunique_est); + r2->tunique_est = MIN(li.unique_est, ri.unique_est); } if (r3) { r3->tnonil = !r3->tnil; BATsetcount(r3, BATcount(r3)); assert(BATcount(r1) == BATcount(r3)); - r3->tunique_est = MIN(l->tunique_est, r->tunique_est); + r3->tunique_est = MIN(li.unique_est, ri.unique_est); } + bat_iterator_end(&li); + bat_iterator_end(&ri); if (BATcount(r1) > 0) { if (BATtdense(r1)) r1->tseqbase = ((oid *) r1->theap->base)[0]; diff --git a/gdk/gdk_project.c b/gdk/gdk_project.c --- a/gdk/gdk_project.c +++ b/gdk/gdk_project.c @@ -572,8 +572,8 @@ project_str(BATiter *restrict li, struct bn->tnonil = r1i->nonil & r2i->nonil; bn->tkey = false; bn->tunique_est = - MIN(li->b->tunique_est?li->b->tunique_est:BATcount(li->b), - r1i->b->tunique_est?r1i->b->tunique_est:BATcount(r1i->b)); + MIN(li->unique_est ? li->unique_est : BATcount(li->b), + r1i->unique_est ? r1i->unique_est : BATcount(r1i->b)); TRC_DEBUG(ALGO, "l=" ALGOBATFMT " r1=" ALGOBATFMT " r2=" ALGOBATFMT " -> " ALGOBATFMT "%s " LLFMT "us\n", ALGOBATPAR(li->b), ALGOBATPAR(r1i->b), ALGOBATPAR(r2i->b), @@ -824,8 +824,8 @@ BATproject2(BAT *restrict l, BAT *restri } bn->tunique_est = - MIN(li.b->tunique_est?li.b->tunique_est:BATcount(li.b), - r1i.b->tunique_est?r1i.b->tunique_est:BATcount(r1i.b)); + MIN(li.unique_est ? li.unique_est : BATcount(li.b), + r1i.unique_est ? r1i.unique_est : BATcount(r1i.b)); if (!BATtdensebi(&r1i) || (r2 && !BATtdensebi(&r2i))) BATtseqbase(bn, oid_nil); diff --git a/misc/selinux/monetdb.te b/misc/selinux/monetdb.te --- a/misc/selinux/monetdb.te +++ b/misc/selinux/monetdb.te @@ -8,7 +8,7 @@ # Copyright August 2008 - 2023 MonetDB B.V.; # Copyright 1997 - July 2008 CWI. -policy_module(monetdb, 1.4) +policy_module(monetdb, 1.5) # The above line declares that this file is a SELinux policy file. Its # name is monetdb, so the file should be saved as monetdb.te @@ -28,7 +28,7 @@ require { class fifo_file { getattr read write }; class file { entrypoint execute getattr manage_file_perms map open read }; class netlink_selinux_socket create_socket_perms; - class process { rlimitinh siginh signal sigchld sigkill transition }; + class process { rlimitinh siginh signal sigchld sigkill signull transition }; class tcp_socket create_stream_socket_perms; class udp_socket create_stream_socket_perms; class unix_dgram_socket create_socket_perms; @@ -58,7 +58,7 @@ type_transition monetdbd_t mserver5_exec allow monetdbd_t mserver5_t:process sigkill; # on EPEL 7 we need these as well allow mserver5_t monetdbd_t:process sigchld; -allow monetdbd_t unconfined_service_t:process signal; +allow monetdbd_t unconfined_service_t:process { signal signull }; allow mserver5_t proc_t:file { open read getattr }; # read /proc/meminfo # declare a type for the systemd unit file (monetdbd.service) diff --git a/sql/backends/monet5/UDF/udf/udf.c b/sql/backends/monet5/UDF/udf/udf.c --- a/sql/backends/monet5/UDF/udf/udf.c +++ b/sql/backends/monet5/UDF/udf/udf.c @@ -366,7 +366,7 @@ UDFBATfuse_(BAT **ret, BAT *bone, BAT *b bres->trevsorted = true; else bres->trevsorted = (BATcount(bres) <= 1); - /* result tail is key (unique), iff both input tails are */ + /* result tail is key (unique), if both input tails are */ BATkey(bres, BATtkey(bone) || BATtkey(btwo)); *ret = bres; 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 @@ -692,16 +692,15 @@ exp_count_no_nil_arg(sql_exp *e, stmt *e } static stmt * -exp_bin_or(backend *be, sql_exp *e, stmt *left, stmt *right, stmt *grp, stmt *ext, stmt *cnt, stmt *sel, int depth, bool reduce, int push) +exp_bin_conjunctive(backend *be, sql_exp *e, stmt *left, stmt *right, stmt *grp, stmt *ext, stmt *cnt, stmt *sel, int depth, bool reduce, int push) { sql_subtype *bt = sql_bind_localtype("bit"); list *l = e->l; node *n; - stmt *sel1 = NULL, *sel2 = NULL, *s = NULL; + stmt *sel1 = NULL, *s = NULL; int anti = is_anti(e); sel1 = sel; - sel2 = sel; for (n = l->h; n; n = n->next) { sql_exp *c = n->data; stmt *sin = (sel1 && sel1->nrcols)?sel1:NULL; @@ -713,62 +712,33 @@ exp_bin_or(backend *be, sql_exp *e, stmt if (!s) return s; - if (!reduce && sin) { + if (!reduce && sin && sin != sel) { sql_subfunc *f = sql_bind_func(be->mvc, "sys", anti?"or":"and", bt, bt, F_FUNC, true, true); assert(f); s = stmt_binop(be, sin, s, NULL, f); - } else if (!sin && sel1 && sel1->nrcols == 0 && s->nrcols == 0) { + } else if (!reduce && !sin && sel1 && sel1->nrcols == 0 && s->nrcols == 0) { sql_subfunc *f = sql_bind_func(be->mvc, "sys", anti?"or":"and", bt, bt, F_FUNC, true, true); assert(f); s = stmt_binop(be, sel1, s, sin, f); - } else if (sel1 && (sel1->nrcols == 0 || s->nrcols == 0)) { - stmt *predicate = bin_find_smallest_column(be, left); - - predicate = stmt_const(be, predicate, stmt_bool(be, 1)); - if (s->nrcols == 0) + } else if (reduce && ((sel1 && (sel1->nrcols == 0 || s->nrcols == 0)) || c->type != e_cmp)) { + if (s->nrcols) { + if (sel1 && (sel1->nrcols == 0 || s->nrcols == 0)) { + stmt *predicate = bin_find_smallest_column(be, left); + + predicate = stmt_const(be, predicate, stmt_bool(be, 1)); + s = stmt_uselect(be, predicate, sel1, cmp_equal, s, anti, is_semantics(c)); + } else + s = stmt_uselect(be, s, stmt_bool(be, 1), cmp_equal, sel1, anti, is_semantics(c)); + } else { + stmt *predicate = bin_find_smallest_column(be, left); + + predicate = stmt_const(be, predicate, stmt_bool(be, 1)); s = stmt_uselect(be, predicate, s, cmp_equal, sel1, anti, is_semantics(c)); - else - s = stmt_uselect(be, predicate, sel1, cmp_equal, s, anti, is_semantics(c)); + } } sel1 = s; } - l = e->r; - for (n = l->h; n; n = n->next) { - sql_exp *c = n->data; - stmt *sin = (sel2 && sel2->nrcols)?sel2:NULL; - - /* propagate the anti flag */ - if (anti) - set_anti(c); - s = exp_bin(be, c, left, right, grp, ext, cnt, reduce?sin:NULL, depth, reduce, push); - if (!s) - return s; - - if (!reduce && sin) { - sql_subfunc *f = sql_bind_func(be->mvc, "sys", anti?"or":"and", bt, bt, F_FUNC, true, true); - assert(f); - s = stmt_binop(be, sin, s, NULL, f); - } else if (!sin && sel2 && sel2->nrcols == 0 && s->nrcols == 0) { - sql_subfunc *f = sql_bind_func(be->mvc, "sys", anti?"or":"and", bt, bt, F_FUNC, true, true); - assert(f); - s = stmt_binop(be, sel2, s, sin, f); - } else if (sel2 && (sel2->nrcols == 0 || s->nrcols == 0)) { - stmt *predicate = bin_find_smallest_column(be, left); - - predicate = stmt_const(be, predicate, stmt_bool(be, 1)); _______________________________________________ checkin-list mailing list -- [email protected] To unsubscribe send an email to [email protected]
