Changeset: e9cc2bf9b3bf for MonetDB URL: https://dev.monetdb.org/hg/MonetDB/rev/e9cc2bf9b3bf Modified Files: sql/backends/monet5/rel_bin.c sql/server/rel_exp.c sql/server/rel_optimize_others.c sql/server/rel_partition.c sql/server/rel_select.c Branch: balanced_union Log Message:
Merge with default diffs (truncated from 1365 to 300 lines): diff --git a/ChangeLog b/ChangeLog --- a/ChangeLog +++ b/ChangeLog @@ -7,3 +7,9 @@ During the upgrade function definitions will fallback to the normal PYTHON language option. +* Mon Jul 17 2023 Panagiotis Koutsourakis <kutsu...@monetdbsolutions.com> +- Implemented direct masking for strimp construction. The strimps + datastructure now keeps an array of 65K 64-bit integers that is zero + everywhere except at the indexes that correspond to header pairs. The + entry for the nth pair in order has the nth bit of the bitstring + on. These can be used to quickly construct bitstrings. diff --git a/ChangeLog.strimps-updates b/ChangeLog.strimps-updates deleted file mode 100644 --- a/ChangeLog.strimps-updates +++ /dev/null @@ -1,10 +0,0 @@ -# ChangeLog file for strimpsv2 -# This file is updated with Maddlog - -* Mon Jul 17 2023 Panagiotis Koutsourakis <kutsu...@monetdbsolutions.com> -- Implemented direct masking for strimp construction. The strimps - datastructure now keeps an array of 65K 64-bit integers that is zero - everywhere except at the indexes that correspond to header pairs. The - entry for the nth pair in order has the nth bit of the bitstring - on. These can be used to quickly construct bitstrings. - diff --git a/clients/mapiclient/mhelp.c b/clients/mapiclient/mhelp.c --- a/clients/mapiclient/mhelp.c +++ b/clients/mapiclient/mhelp.c @@ -673,9 +673,9 @@ SQLhelp sqlhelp2[] = { NULL}, {"generated_column", NULL, - "AUTO_INCREMENT | GENERATED ALWAYS AS IDENTITY [ '(' [ AS data_type] [ START [WITH start]] [INCREMENT BY increment]\n" - "[MINVALUE minvalue | NO MINVALUE] [MAXVALUE maxvalue | NO MAXVALUE] [CACHE cachevalue] [[NO] CYCLE] ')' ] ", - "data_type", + "AUTO_INCREMENT | GENERATED { ALWAYS | BY DEFAULT } AS IDENTITY [ '(' [ AS seq_int_datatype] [ START [WITH start]]\n" + " [INCREMENT BY increment] [MINVALUE minvalue | NO MINVALUE] [MAXVALUE maxvalue | NO MAXVALUE] [CACHE cachevalue] [[NO] CYCLE] ')' ]", + "seq_int_datatype", "See also https://www.monetdb.org/documentation/user-guide/sql-manual/data-types/serial-types/"}, {"global_privileges", NULL, diff --git a/monetdb5/mal/mal_dataflow.c b/monetdb5/mal/mal_dataflow.c --- a/monetdb5/mal/mal_dataflow.c +++ b/monetdb5/mal/mal_dataflow.c @@ -82,7 +82,7 @@ typedef struct DATAFLOW { struct worker { MT_Id id; - enum { WAITING, RUNNING, FREE, EXITED } flag; + enum { WAITING, RUNNING, FREE, EXITED, FINISHING } flag; ATOMIC_PTR_TYPE cntxt; /* client we do work for (NULL -> any) */ MT_Sema s; struct worker *next; @@ -245,6 +245,7 @@ static void DFLOWworker(void *T) { struct worker *t = (struct worker *) T; + bool locked = false; #ifdef _MSC_VER srand((unsigned int) GDKusec()); #endif @@ -411,20 +412,8 @@ DFLOWworker(void *T) } } MT_lock_set(&dataflowLock); - if (GDKexiting() || ATOMIC_GET(&exiting)) { - MT_lock_unset(&dataflowLock); - break; - } - if (free_count >= free_max) { - struct worker **tp = &workers; - while (*tp && *tp != t) - tp = &(*tp)->next; - assert(*tp && *tp == t); - *tp = t->next; - t->flag = EXITED; - t->next = exited_workers; - exited_workers = t; - MT_lock_unset(&dataflowLock); + if (GDKexiting() || ATOMIC_GET(&exiting) || free_count >= free_max) { + locked = true; break; } free_count++; @@ -442,6 +431,19 @@ DFLOWworker(void *T) break; assert(t->flag == WAITING); } + if (!locked) + MT_lock_set(&dataflowLock); + if (t->flag != FINISHING) { + struct worker **tp = t->flag == FREE ? &free_workers : &workers; + while (*tp && *tp != t) + tp = &(*tp)->next; + assert(*tp && *tp == t); + *tp = t->next; + t->flag = EXITED; + t->next = exited_workers; + exited_workers = t; + } + MT_lock_unset(&dataflowLock); GDKsetbuf(NULL); } @@ -747,6 +749,7 @@ DFLOWscheduler(DataFlow flow, struct wor static inline void finish_worker(struct worker *t) { + t->flag = FINISHING; MT_lock_unset(&dataflowLock); MT_join_thread(t->id); MT_sema_destroy(&t->s); @@ -944,6 +947,8 @@ stopMALdataflow(void) } while (free_workers) { struct worker *t = free_workers; + assert(free_count > 0); + free_count--; free_workers = free_workers->next; MT_sema_up(&t->s); finish_worker(t); @@ -953,6 +958,11 @@ stopMALdataflow(void) workers = workers->next; finish_worker(t); } + while (exited_workers) { + struct worker *t = exited_workers; + exited_workers = exited_workers->next; + finish_worker(t); + } MT_lock_unset(&dataflowLock); } } diff --git a/sql/ChangeLog b/sql/ChangeLog --- a/sql/ChangeLog +++ b/sql/ChangeLog @@ -16,6 +16,12 @@ Note: MonetDB does NOT support catalog qualifiers in object names, so all the _CATALOG columns in these information_schema views will allways contain NULL. +* Mon Aug 21 2023 Niels Nes <niels....@monetdbsolutions.com> +- Added support for generated column syntax: + GENERATED BY DEFAULT AS IDENTITY ... + This allows the user to override the default generated sequence value + during inserts. + * Fri Jul 7 2023 Niels Nes <niels....@monetdbsolutions.com> - Added SQL support for: <result offset clause> and <fetch first clause> in <query expression> ::= 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 @@ -190,7 +190,7 @@ list_find_column(backend *be, list *l, c const char *nme = column_name(be->mvc->sa, s); if (rnme && strcmp(rnme, rname) == 0 && - strcmp(nme, name) == 0) { + strcmp(nme, name) == 0) { res = s; break; } @@ -601,7 +601,7 @@ exp_count_no_nil_arg(sql_exp *e, stmt *e while (as->type == st_alias) as = as->op1; /* use candidate */ - if (as && as->type == st_join && as->flag == cmp_project) { + if (as && as->type == st_join && as->flag == cmp_project) { if (as->op1 && (as->op1->type != st_result || as->op1->op1->type != st_group)) /* exclude a subquery with select distinct under the count */ as = as->op1; } @@ -890,7 +890,7 @@ exp2bin_casewhen(backend *be, sql_exp *f stmt *case_when = exp_bin(be, e, left, right, NULL, NULL, NULL, nsel, depth+1, 0, 1); if (!case_when) return NULL; - cmp = sql_bind_func(be->mvc, "sys", "=", exp_subtype(e), exp_subtype(e), F_FUNC, true); + cmp = sql_bind_func(be->mvc, "sys", "=", exp_subtype(e), exp_subtype(e), F_FUNC, true); if (!cmp) return NULL; if (!single_value && !case_when->nrcols) { @@ -1357,7 +1357,7 @@ exp_bin(backend *be, sql_exp *e, stmt *l mvc *sql = be->mvc; stmt *s = NULL; - if (mvc_highwater(sql)) + if (mvc_highwater(sql)) return sql_error(be->mvc, 10, SQLSTATE(42000) "Query too complex: running out of stack space"); if (!e) { @@ -1408,7 +1408,7 @@ exp_bin(backend *be, sql_exp *e, stmt *l return stmt_return(be, r, GET_PSM_LEVEL(e->flag)); } else if (e->flag & PSM_WHILE) { /* while is a if - block true with leave statement - * needed because the condition needs to be inside this outer block */ + * needed because the condition needs to be inside this outer block */ stmt *ifstmt = stmt_cond(be, stmt_bool(be, 1), NULL, 0, 0); stmt *cond = exp_bin(be, e->l, left, right, grp, ext, cnt, sel, 0, 0, push); stmt *wstmt; @@ -1458,15 +1458,15 @@ exp_bin(backend *be, sql_exp *e, stmt *l } break; case e_atom: { - if (e->l) { /* literals */ + if (e->l) { /* literals */ s = stmt_atom(be, e->l); - } else if (e->r) { /* parameters and declared variables */ + } else if (e->r) { /* parameters and declared variables */ sql_var_name *vname = (sql_var_name*) e->r; assert(vname->name); s = stmt_var(be, vname->sname ? sa_strdup(sql->sa, vname->sname) : NULL, sa_strdup(sql->sa, vname->name), e->tpe.type?&e->tpe:NULL, 0, e->flag); - } else if (e->f) { /* values */ + } else if (e->f) { /* values */ s = value_list(be, e->f, left, sel); - } else { /* arguments */ + } else { /* arguments */ sql_subtype *t = e->tpe.type?&e->tpe:NULL; if (!t && 0) { sql_arg *a = sql_bind_paramnr(be->mvc, e->flag); @@ -1492,7 +1492,7 @@ exp_bin(backend *be, sql_exp *e, stmt *l if (!l) return NULL; s = stmt_convert(be, l, (!push&&l->nrcols==0)?NULL:sel, from, to); - } break; + } break; case e_func: { node *en; list *l = sa_list(sql->sa), *exps = e->l; @@ -1560,7 +1560,7 @@ exp_bin(backend *be, sql_exp *e, stmt *l } if (!(s = stmt_Nop(be, stmt_list(be, l), sel, f, rows))) return NULL; - } break; + } break; case e_aggr: { list *attr = e->l; stmt *as = NULL; @@ -1637,7 +1637,7 @@ exp_bin(backend *be, sql_exp *e, stmt *l s = stmt_aggr(be, as, grp, ext, a, 1, need_no_nil(e) /* ignore nil*/, !zero_if_empty(e)); if (find_prop(e->p, PROP_COUNT)) /* propagate count == 0 ipv NULL in outer joins */ s->flag |= OUTER_ZERO; - } break; + } break; case e_column: { if (right) /* check relation names */ s = bin_find_column(be, right, e->l, e->r); @@ -1737,7 +1737,7 @@ exp_bin(backend *be, sql_exp *e, stmt *l } if (!l && right) { clean_mal_statements(be, oldstop, oldvtop, oldvid); - l = exp_bin(be, e->l, right, NULL, grp, ext, cnt, sel, depth+1, 0, push); + l = exp_bin(be, e->l, right, NULL, grp, ext, cnt, sel, depth+1, 0, push); swapped = 1; } @@ -1745,23 +1745,23 @@ exp_bin(backend *be, sql_exp *e, stmt *l oldstop = be->mb->stop; oldvid = be->mb->vid; if (swapped || !right || !reduce) - r = exp_bin(be, re, left, (!reduce)?right:NULL, grp, ext, cnt, sel, depth+1, 0, push); + r = exp_bin(be, re, left, (!reduce)?right:NULL, grp, ext, cnt, sel, depth+1, 0, push); else - r = exp_bin(be, re, right, NULL, grp, ext, cnt, sel, depth+1, 0, push); + r = exp_bin(be, re, right, NULL, grp, ext, cnt, sel, depth+1, 0, push); if (!r && !swapped) { clean_mal_statements(be, oldstop, oldvtop, oldvid); - r = exp_bin(be, re, left, NULL, grp, ext, cnt, sel, depth+1, 0, push); + r = exp_bin(be, re, left, NULL, grp, ext, cnt, sel, depth+1, 0, push); is_select = 1; } if (!r && swapped) { clean_mal_statements(be, oldstop, oldvtop, oldvid); - r = exp_bin(be, re, right, NULL, grp, ext, cnt, sel, depth+1, 0, push); + r = exp_bin(be, re, right, NULL, grp, ext, cnt, sel, depth+1, 0, push); is_select = 1; } if (re2 && (swapped || !right || !reduce)) - r2 = exp_bin(be, re2, left, (!reduce)?right:NULL, grp, ext, cnt, sel, depth+1, 0, push); + r2 = exp_bin(be, re2, left, (!reduce)?right:NULL, grp, ext, cnt, sel, depth+1, 0, push); else if (re2) - r2 = exp_bin(be, re2, right, NULL, grp, ext, cnt, sel, depth+1, 0, push); + r2 = exp_bin(be, re2, right, NULL, grp, ext, cnt, sel, depth+1, 0, push); if (!l || !r || (re2 && !r2)) return NULL; @@ -2414,7 +2414,7 @@ rel2bin_table(backend *be, sql_rel *rel, } if (backend_create_subfunc(be, f, ops) < 0) { freeInstruction(q); - return NULL; + return NULL; } str mod = sql_func_mod(f->func); str fcn = backend_function_imp(be, f->func); @@ -2792,9 +2792,9 @@ rel2bin_join(backend *be, sql_rel *rel, left = row2cols(be, left); right = row2cols(be, right); /* - * split in 2 steps, _______________________________________________ checkin-list mailing list -- checkin-list@monetdb.org To unsubscribe send an email to checkin-list-le...@monetdb.org