MonetDB: default - Merge with Dec2023 branch.
Changeset: 69cf9a438678 for MonetDB URL: https://dev.monetdb.org/hg/MonetDB/rev/69cf9a438678 Modified Files: gdk/gdk_system.h sql/storage/store.c sql/test/BugTracker-2024/Tests/All Branch: default Log Message: Merge with Dec2023 branch. diffs (truncated from 580 to 300 lines): diff --git a/gdk/gdk_system.c b/gdk/gdk_system.c --- a/gdk/gdk_system.c +++ b/gdk/gdk_system.c @@ -280,15 +280,16 @@ dump_threads(void) char buf[1024]; thread_lock(); for (struct mtthread *t = mtthreads; t; t = t->next) { + MT_Lock *lk = t->lockwait; + MT_Sema *sm = t->semawait; + MT_Cond *cn = t->condwait; + struct mtthread *jn = t->joinwait; int pos = snprintf(buf, sizeof(buf), - "%s, tid %zu, waiting for %s, working on %.200s", + "%s, tid %zu, waiting for %s%s, working on %.200s", t->threadname, t->tid, - t->lockwait ? t->lockwait->name : - t->semawait ? t->semawait->name : - t->condwait ? t->condwait->name : - t->joinwait ? t->joinwait->threadname : - "nothing", + lk ? "lock " : sm ? "semaphore " : cn ? "condvar " : jn ? "thread " : "", + lk ? lk->name : sm ? sm->name : cn ? cn->name : jn ? jn->threadname : "nothing", ATOMIC_GET(&t->exited) ? "exiting" : t->working ? t->working : "nothing"); #ifdef LOCK_OWNER diff --git a/gdk/gdk_system.h b/gdk/gdk_system.h --- a/gdk/gdk_system.h +++ b/gdk/gdk_system.h @@ -498,7 +498,6 @@ typedef struct MT_Lock { #define MT_lock_try(l) (pthread_mutex_trylock(&(l)->lock) == 0 && (_DBG_LOCK_LOCKER(l), true)) -#ifdef LOCK_STATS #define MT_lock_set(l) \ do {\ _DBG_LOCK_COUNT_0(l); \ @@ -511,14 +510,6 @@ typedef struct MT_Lock { _DBG_LOCK_LOCKER(l);\ _DBG_LOCK_COUNT_2(l); \ } while (0) -#else -#define MT_lock_set(l) \ - do {\ - pthread_mutex_lock(&(l)->lock); \ - _DBG_LOCK_LOCKER(l);\ - } while (0) -#endif - #define MT_lock_unset(l) \ do {\ _DBG_LOCK_UNLOCKER(l); \ diff --git a/sql/storage/store.c b/sql/storage/store.c --- a/sql/storage/store.c +++ b/sql/storage/store.c @@ -57,10 +57,10 @@ ulng store_oldest(sqlstore *store, sql_trans *tr) { if (tr && tr->ts == (ulng) ATOMIC_GET(&store->oldest)) { - sql_session *s = store->active->h->data; - if (s->tr == tr && store->active->h->next) { - s = store->active->h->next->data; - return s->tr->ts; + sql_trans *otr = store->active->h->data; + if (otr == tr && store->active->h->next) { + otr = store->active->h->next->data; + return otr->ts; } } return (ulng) ATOMIC_GET(&store->oldest); diff --git a/sql/test/BugTracker-2024/Tests/All b/sql/test/BugTracker-2024/Tests/All --- a/sql/test/BugTracker-2024/Tests/All +++ b/sql/test/BugTracker-2024/Tests/All @@ -34,3 +34,20 @@ between-true-and-null-Bug-7465 inner-join-contains-7466 contains-or-7469 conversion-string-to-bte-failed-7470 +groupby-select1-Bug-7472 +SQLunionfunc-Bug-7473 +VLTgenerator_table-Bug-7474 +exp_equal-Bug-7475 +rel2bin_join-Bug-7476 +atom_cmp-Bug-7477 +exp_equal-Bug-7478 +exp_ref-Bug-7479 +get_rel_count-Bug-7480 +mvc_row_result_wrap-Bug-7481 +bin_find_smallest_column-Bug-7482 +rel_setop_get_statistics-Bug-7483 +rel_groupby_cse-Bug-7484 +rel_groupby_cse-Bug-7485 +CMDgen_group-Bug-7486 +sql_init_subtype-Bug-7487 +orderby-max-over-rows-Bug-7488 diff --git a/sql/test/BugTracker-2024/Tests/CMDgen_group-Bug-7486.test b/sql/test/BugTracker-2024/Tests/CMDgen_group-Bug-7486.test new file mode 100644 --- /dev/null +++ b/sql/test/BugTracker-2024/Tests/CMDgen_group-Bug-7486.test @@ -0,0 +1,20 @@ +query I nosort +WITH x AS ( SELECT * FROM generate_series ( 32989 , 8100 ) EXCEPT SELECT * FROM generate_series ( 44 , 3 ) ) SELECT CASE WHEN NULL IN ( 69 ) THEN 41 END FROM x LIMIT 3 + +NULL +NULL +NULL + +skipif knownfail +query I nosort +WITH x AS ( SELECT * FROM generate_series ( 32989 , 8100 ) EXCEPT SELECT * FROM generate_series ( 44 , 3 ) ) SELECT CASE WHEN NULL IN ( 69 , MAX ( CASE WHEN 97 T
MonetDB: Dec2023 - the active list has sql_trans objects not sql...
Changeset: 8cb6d210be30 for MonetDB URL: https://dev.monetdb.org/hg/MonetDB/rev/8cb6d210be30 Modified Files: sql/storage/store.c Branch: Dec2023 Log Message: the active list has sql_trans objects not sql_sessions. diffs (18 lines): diff --git a/sql/storage/store.c b/sql/storage/store.c --- a/sql/storage/store.c +++ b/sql/storage/store.c @@ -57,10 +57,10 @@ ulng store_oldest(sqlstore *store, sql_trans *tr) { if (tr && tr->ts == (ulng) ATOMIC_GET(&store->oldest)) { - sql_session *s = store->active->h->data; - if (s->tr == tr && store->active->h->next) { - s = store->active->h->next->data; - return s->tr->ts; + sql_trans *otr = store->active->h->data; + if (otr == tr && store->active->h->next) { + otr = store->active->h->next->data; + return otr->ts; } } return (ulng) ATOMIC_GET(&store->oldest); ___ checkin-list mailing list -- checkin-list@monetdb.org To unsubscribe send an email to checkin-list-le...@monetdb.org
MonetDB: default - merge with distinct_from
Changeset: ffd1b69a0993 for MonetDB URL: https://dev.monetdb.org/hg/MonetDB/rev/ffd1b69a0993 Branch: default Log Message: merge with distinct_from diffs (266 lines): diff --git a/sql/ChangeLog b/sql/ChangeLog --- a/sql/ChangeLog +++ b/sql/ChangeLog @@ -1,6 +1,11 @@ # ChangeLog file for sql # This file is updated with Maddlog +* Thu Mar 21 2024 Yunus Koning +- Introduce IS [NOT] DISTINCT FROM syntax. The syntax allows two values + to be compared. The comparison always returns boolean FALSE or TRUE + never NULL. + * Wed Mar 6 2024 Yunus Koning - SQL2023 feature: Introduce UNIQUE NULLS [NOT] DISTINCT syntax which allows for NULLS to be treated as unique, i.e. a column with this 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 @@ -1831,8 +1831,8 @@ exp_bin(backend *be, sql_exp *e, stmt *l tail_type(l), tail_type(l), F_FUNC, true, true); assert(f); if (is_semantics(e)) { - if (exp_is_null(e->l) && exp_is_null(e->r)) { - s = stmt_bool(be, !is_anti(e)); + if (exp_is_null(e->l) && exp_is_null(e->r) && (e->flag == cmp_equal || e->flag == cmp_notequal)) { + s = stmt_bool(be, e->flag == cmp_equal ? !is_anti(e): is_anti(e)); } else { list *args = sa_list(sql->sa); if (args == NULL) diff --git a/sql/server/rel_select.c b/sql/server/rel_select.c --- a/sql/server/rel_select.c +++ b/sql/server/rel_select.c @@ -2367,6 +2367,8 @@ rel_logical_value_exp(sql_query *query, int quantifier = 0, need_not = 0; sql_exp *rs = NULL, *ls; comp_type cmp_type = compare_str2type(compare_op); + bool is_not_distinct_from = false; + bool is_distinct_from = false; /* * = ANY -> IN, <> ALL -> NOT( = ANY) -> NOT IN @@ -2374,7 +2376,17 @@ rel_logical_value_exp(sql_query *query, */ if (n->next->next->next) quantifier = n->next->next->next->data.i_val + 1; - assert(quantifier == 0 || quantifier == 1 || quantifier == 2); + assert(quantifier == 0 || quantifier == 1 || quantifier == 2 || quantifier == 3 || quantifier == 4); + + /* [NOT] DISTINCT FROM */ + if (quantifier == 3) { + is_not_distinct_from = true; + quantifier = 0; + } + else if (quantifier == 4) { + is_distinct_from = true; + quantifier = 0; + } if ((quantifier == 1 && cmp_type == cmp_equal) || (quantifier == 2 && cmp_type == cmp_notequal)) { @@ -2405,6 +2417,15 @@ rel_logical_value_exp(sql_query *query, rs = rel_value_exp(query, rel, ro, f|sql_farg, ek); if (!rs) return NULL; + + if (is_distinct_from || is_not_distinct_from) { + if (rel_convert_types(sql, rel ? *rel : NULL, rel ? *rel : NULL, &ls, &rs, 1, type_equal_no_any) < 0) + return NULL; + sql_exp* e = exp_compare(sql->sa, ls, rs, is_not_distinct_from?cmp_equal:cmp_notequal); + set_semantics(e); + return e; + } + if (rs->type == e_atom) quantifier = 0; diff --git a/sql/server/sql_parser.y b/sql/server/sql_parser.y --- a/sql/server/sql_parser.y +++ b/sql/server/sql_parser.y @@ -3909,6 +3909,20 @@ comparison_predicate: append_symbol(l, $5); append_int(l, $3); $$ = _symbol_create_list(SQL_COMPARE, l ); } + | pred_exp IS NOT DISTINCT FROM pred_exp + { dlist *l = L(); + append_symbol(l, $1); + append_string(l, sa_strdup(SA, "=")); + append_symbol(l, $6); + append_int(l, 2); + $$ = _symbol_create_list(SQL_COMPARE, l ); } + | pred_exp IS DISTINCT FROM pred_exp + { dlist *l = L(); + append_symbol(l, $1); + append_string(l, sa_strdup(SA, "=")); + append_symbol(l, $5); + append_int(l, 3); + $$ = _symbol_create_list(SQL_COMPARE, l ); } ; between_predicate: diff --git a/sql/test/2024/
MonetDB: distinct_from - merge with default
Changeset: 8e8ccee7e3be for MonetDB URL: https://dev.monetdb.org/hg/MonetDB/rev/8e8ccee7e3be Branch: distinct_from Log Message: merge with default diffs (126 lines): diff --git a/gdk/gdk_select.c b/gdk/gdk_select.c --- a/gdk/gdk_select.c +++ b/gdk/gdk_select.c @@ -1206,6 +1206,9 @@ BATrange(BATiter *bi, const void *tl, co if (tl == NULL && th == NULL) return range_contains; /* looking for everything */ + if (VIEWtparent(bi->b)) + pb = BATdescriptor(VIEWtparent(bi->b)); + /* keep locked while we look at the property values */ MT_lock_set(&bi->b->theaplock); if (bi->minpos != BUN_NONE) @@ -1221,8 +1224,7 @@ BATrange(BATiter *bi, const void *tl, co } bool keep = false; /* keep lock on parent bat? */ if (minprop == NULL || maxprop == NULL) { - if (VIEWtparent(bi->b) && - (pb = BATdescriptor(VIEWtparent(bi->b))) != NULL) { + if (pb != NULL) { MT_lock_set(&pb->theaplock); if (minprop == NULL && (minprop = BATgetprop_nolock(pb, GDK_MIN_BOUND)) != NULL) { keep = true; diff --git a/monetdb5/modules/atoms/Tests/All b/monetdb5/modules/atoms/Tests/All --- a/monetdb5/modules/atoms/Tests/All +++ b/monetdb5/modules/atoms/Tests/All @@ -33,13 +33,3 @@ jsonrender uuid00 strappend - -startswith -endswith -contains -HAVE_ICONV?asciify -startswith_join -endswith_join -contains_join - -ts_and_tstz_to_str_bug diff --git a/monetdb5/modules/kernel/Tests/All b/monetdb5/modules/kernel/Tests/All --- a/monetdb5/modules/kernel/Tests/All +++ b/monetdb5/modules/kernel/Tests/All @@ -3,8 +3,3 @@ TriBool batstr math select - -HAVE_ICONV?batstr_asciify -batstr_startswith -batstr_endswith -batstr_contains diff --git a/monetdb5/modules/mal/Tests/All b/monetdb5/modules/mal/Tests/All --- a/monetdb5/modules/mal/Tests/All +++ b/monetdb5/modules/mal/Tests/All @@ -52,6 +52,3 @@ orderidx00 orderidx01 orderidx02 orderidx04 - -txtsim_levenshtein -txtsim_jarowinkler diff --git a/sql/test/strings/Tests/All b/sql/test/strings/Tests/All new file mode 100644 --- /dev/null +++ b/sql/test/strings/Tests/All @@ -0,0 +1,17 @@ +startswith +endswith +contains +HAVE_ICONV?asciify +startswith_join +endswith_join +contains_join + +ts_and_tstz_to_str_bug + +HAVE_ICONV?batstr_asciify +batstr_startswith +batstr_endswith +batstr_contains + +txtsim_levenshtein +txtsim_jarowinkler diff --git a/monetdb5/modules/atoms/Tests/asciify.test b/sql/test/strings/Tests/asciify.test rename from monetdb5/modules/atoms/Tests/asciify.test rename to sql/test/strings/Tests/asciify.test diff --git a/monetdb5/modules/kernel/Tests/batstr_asciify.test b/sql/test/strings/Tests/batstr_asciify.test rename from monetdb5/modules/kernel/Tests/batstr_asciify.test rename to sql/test/strings/Tests/batstr_asciify.test diff --git a/monetdb5/modules/kernel/Tests/batstr_contains.test b/sql/test/strings/Tests/batstr_contains.test rename from monetdb5/modules/kernel/Tests/batstr_contains.test rename to sql/test/strings/Tests/batstr_contains.test diff --git a/monetdb5/modules/kernel/Tests/batstr_endswith.test b/sql/test/strings/Tests/batstr_endswith.test rename from monetdb5/modules/kernel/Tests/batstr_endswith.test rename to sql/test/strings/Tests/batstr_endswith.test diff --git a/monetdb5/modules/kernel/Tests/batstr_startswith.test b/sql/test/strings/Tests/batstr_startswith.test rename from monetdb5/modules/kernel/Tests/batstr_startswith.test rename to sql/test/strings/Tests/batstr_startswith.test diff --git a/monetdb5/modules/atoms/Tests/contains.test b/sql/test/strings/Tests/contains.test rename from monetdb5/modules/atoms/Tests/contains.test rename to sql/test/strings/Tests/contains.test diff --git a/monetdb5/modules/atoms/Tests/contains_join.test b/sql/test/strings/Tests/contains_join.test rename from monetdb5/modules/atoms/Tests/contains_join.test rename to sql/test/strings/Tests/contains_join.test diff --git a/monetdb5/modules/atoms/Tests/endswith.test b/sql/test/strings/Tests/endswith.test rename from monetdb5/modules/atoms/Tests/endswith.test rename to sql/test/strings/Tests/endswith.test diff --git a/monetdb5/modules/atoms/Tests/endswith_join.test b/sql/test/strings/Tests/endswith_join.test rename from monetdb5/modules/atoms/Tests/endswith_join.test rename to sql/test/strings/Tests/endswith_join.test diff --git a/monetdb5/modules/atoms/Tests/startswith.test b/sql/test/strings/Tests/startswith.test rename from monetdb5/modules/atoms/Tests/startswith.test rename to sql/test/strings/Tests/startswith.test diff --git a/monetdb5/modules/atoms/Tests/startswith_join.test b/sql/test/strings/Tests/startswith_join.test rename from monetdb5/modules/atoms/Tests/startswith_join.test rename to sql/test/strings/Tests/startswith_join.test diff --git a/monetdb5/modules/atoms/Tests/ts_and_tstz_to_str_bug.test b/sql/test/strings/Tests/ts_and_tstz_to_str_bug.test rename
MonetDB: distinct_from - add test for two columns
Changeset: c15f96310f33 for MonetDB URL: https://dev.monetdb.org/hg/MonetDB/rev/c15f96310f33 Modified Files: sql/test/2024/Tests/distinct_from.test Branch: distinct_from Log Message: add test for two columns diffs (75 lines): diff --git a/sql/test/2024/Tests/distinct_from.test b/sql/test/2024/Tests/distinct_from.test --- a/sql/test/2024/Tests/distinct_from.test +++ b/sql/test/2024/Tests/distinct_from.test @@ -1,6 +1,3 @@ -statement ok -create table foo(s) as values (10), (20), (NULL) - query I nosort SELECT 10 IS NOT DISTINCT FROM 20 @@ -43,6 +40,9 @@ SELECT NULL IS NOT DISTINCT FROM NULL 1 +statement ok +create table foo(s) as values (10), (20), (NULL) + query I nosort select s IS NOT DISTINCT FROM 20 FROM foo; @@ -71,7 +71,6 @@ 1 1 0 - query I nosort select 20 IS NOT DISTINCT FROM s FROM foo; @@ -99,3 +98,46 @@ select NULL IS DISTINCT FROM s FROM foo; 1 1 0 + +statement ok +create table bar(s) as values (20), (30), (NULL) + +query rowsort +select foo.s, bar.s, foo.s IS DISTINCT FROM bar.s, foo.s IS NOT DISTINCT FROM bar.s FROM foo, bar + +10 +20 +1 +0 +10 +30 +1 +0 +10 +NULL +1 +0 +20 +20 +0 +1 +20 +30 +1 +0 +20 +NULL +1 +0 +NULL +20 +1 +0 +NULL +30 +1 +0 +NULL +NULL +0 +1 ___ checkin-list mailing list -- checkin-list@monetdb.org To unsubscribe send an email to checkin-list-le...@monetdb.org
MonetDB: distinct_from - update changelog
Changeset: 75405850de3b for MonetDB URL: https://dev.monetdb.org/hg/MonetDB/rev/75405850de3b Modified Files: sql/ChangeLog Branch: distinct_from Log Message: update changelog diffs (15 lines): diff --git a/sql/ChangeLog b/sql/ChangeLog --- a/sql/ChangeLog +++ b/sql/ChangeLog @@ -1,6 +1,11 @@ # ChangeLog file for sql # This file is updated with Maddlog +* Thu Mar 21 2024 Yunus Koning +- Introduce IS [NOT] DISTINCT FROM syntax. The syntax allows two values + to be compared. The comparison always returns boolean FALSE or TRUE + never NULL. + * Wed Mar 6 2024 Yunus Koning - SQL2023 feature: Introduce UNIQUE NULLS [NOT] DISTINCT syntax which allows for NULLS to be treated as unique, i.e. a column with this ___ checkin-list mailing list -- checkin-list@monetdb.org To unsubscribe send an email to checkin-list-le...@monetdb.org
MonetDB: Dec2023 - Use f strings, and use " so that ' does not h...
Changeset: 023893da55b0 for MonetDB URL: https://dev.monetdb.org/hg/MonetDB/rev/023893da55b0 Modified Files: sql/test/sysmon/Tests/sys_queue_expand.SQL.py Branch: Dec2023 Log Message: Use f strings, and use " so that ' does not have to be quoted. diffs (81 lines): diff --git a/sql/test/sysmon/Tests/sys_queue_expand.SQL.py b/sql/test/sysmon/Tests/sys_queue_expand.SQL.py --- a/sql/test/sysmon/Tests/sys_queue_expand.SQL.py +++ b/sql/test/sysmon/Tests/sys_queue_expand.SQL.py @@ -9,16 +9,16 @@ import pymonetdb import os import multiprocessing as mp -db = os.environ['TSTDB'] -pt = int(os.environ['MAPIPORT']) -SLEEP_TIME='5000' +db = os.environ["TSTDB"] +pt = int(os.environ["MAPIPORT"]) +SLEEP_TIME = 5000 # milliseconds def worker_task(): dbh = None try: dbh = pymonetdb.connect(database=db, port=pt, autocommit=True) cur = dbh.cursor() -cur.execute('call sys.sleep('+SLEEP_TIME+')') +cur.execute(f"call sys.sleep({SLEEP_TIME})") except pymonetdb.exceptions.Error as e: print(e) finally: @@ -37,11 +37,11 @@ def main(): mstdbh = pymonetdb.connect(database=db, port=pt, autocommit=True) mstcur = mstdbh.cursor() -query = 'create procedure sleep(i int) external name alarm.sleep;' +query = "create procedure sleep(i int) external name alarm.sleep;" mstcur.execute(query) -query = 'select username, status, query from sys.queue() where status = \'running\' order by query' -expected_res = [('monetdb', 'running', 'select username, status, query from sys.queue() where status = \'running\' order by query\n;')] +query = "select username, status, query from sys.queue() where status = 'running' order by query" +expected_res = [("monetdb", "running", "select username, status, query from sys.queue() where status = 'running' order by query\n;")] rowcnt = mstcur.execute(query) res = mstcur.fetchall() if rowcnt != len(expected_res) or res != expected_res: @@ -54,12 +54,12 @@ def main(): # Check the long running query, but lets first wait for a moment for the # workers to start with their queries -mstcur.execute('call sys.sleep(1000)') -query = 'select username, status, query from sys.queue() where query like \'call sys.sleep('+SLEEP_TIME+')%\' order by query' +mstcur.execute("call sys.sleep(1000)") +query = f"select username, status, query from sys.queue() where query like 'call sys.sleep({SLEEP_TIME})%' order by query" expected_res = [ -('monetdb', 'running', 'call sys.sleep('+SLEEP_TIME+')\n;'), -('monetdb', 'running', 'call sys.sleep('+SLEEP_TIME+')\n;'), -('monetdb', 'running', 'call sys.sleep('+SLEEP_TIME+')\n;')] +("monetdb", "running", f"call sys.sleep({SLEEP_TIME})\n;"), +("monetdb", "running", f"call sys.sleep({SLEEP_TIME})\n;"), +("monetdb", "running", f"call sys.sleep({SLEEP_TIME})\n;")] rowcnt = mstcur.execute(query) res = mstcur.fetchall() if rowcnt != len(expected_res) or res != expected_res: @@ -70,10 +70,10 @@ def main(): # sys.queue() should have been expanded from 4 to 8, so we # should be able to have 8 queries in the queue -mstcur.execute('select 6') -mstcur.execute('select 7') -mstcur.execute('select 8') -query = 'select count(*) from sys.queue()' +mstcur.execute("select 6") +mstcur.execute("select 7") +mstcur.execute("select 8") +query = "select count(*) from sys.queue()" expected_res = 8 rowcnt = mstcur.execute(query) res = mstcur.fetchall() @@ -84,7 +84,7 @@ def main(): finally: if mstdbh is not None: if mstcur is not None: -mstcur.execute('drop procedure sleep;') +mstcur.execute("drop procedure sleep") mstdbh.close() if __name__ == "__main__": ___ checkin-list mailing list -- checkin-list@monetdb.org To unsubscribe send an email to checkin-list-le...@monetdb.org