MonetDB: default - Merge with Aug2024 branch.
Changeset: f57570cce99a for MonetDB URL: https://dev.monetdb.org/hg/MonetDB/rev/f57570cce99a Modified Files: testing/CMakeLists.txt Branch: default Log Message: Merge with Aug2024 branch. diffs (truncated from 852 to 300 lines): diff --git a/ctest/tools/monetdbe/Tests/example_proxy.SQL.py b/ctest/tools/monetdbe/Tests/example_proxy.SQL.py --- a/ctest/tools/monetdbe/Tests/example_proxy.SQL.py +++ b/ctest/tools/monetdbe/Tests/example_proxy.SQL.py @@ -1,4 +1,5 @@ -import os, pymonetdb +from MonetDBtesting import tpymonetdb as pymonetdb +import os import subprocess db = os.getenv("TSTDB") diff --git a/sql/test/BugTracker-2009/Tests/bit_and.SF-2850341.py b/sql/test/BugTracker-2009/Tests/bit_and.SF-2850341.py --- a/sql/test/BugTracker-2009/Tests/bit_and.SF-2850341.py +++ b/sql/test/BugTracker-2009/Tests/bit_and.SF-2850341.py @@ -1,4 +1,5 @@ -import sys, os, pymonetdb +from MonetDBtesting import tpymonetdb as pymonetdb +import sys, os db = os.getenv("TSTDB") port = int(os.getenv("MAPIPORT")) diff --git a/sql/test/BugTracker-2011/Tests/interrupted-initialization.Bug-2875.SQL.py b/sql/test/BugTracker-2011/Tests/interrupted-initialization.Bug-2875.SQL.py --- a/sql/test/BugTracker-2011/Tests/interrupted-initialization.Bug-2875.SQL.py +++ b/sql/test/BugTracker-2011/Tests/interrupted-initialization.Bug-2875.SQL.py @@ -1,4 +1,5 @@ -import os, sys, tempfile, pymonetdb +from MonetDBtesting import tpymonetdb as pymonetdb +import os, sys, tempfile try: from MonetDBtesting import process except ImportError: diff --git a/sql/test/BugTracker-2011/Tests/many-connects-cache.Bug-2904.SQL.py b/sql/test/BugTracker-2011/Tests/many-connects-cache.Bug-2904.SQL.py --- a/sql/test/BugTracker-2011/Tests/many-connects-cache.Bug-2904.SQL.py +++ b/sql/test/BugTracker-2011/Tests/many-connects-cache.Bug-2904.SQL.py @@ -1,4 +1,5 @@ -import sys, os, pymonetdb, threading +from MonetDBtesting import tpymonetdb as pymonetdb +import sys, os, threading db = os.getenv("TSTDB") port = int(os.getenv("MAPIPORT")) diff --git a/sql/test/BugTracker-2011/Tests/python-connections-Bug.2901.SQL.py b/sql/test/BugTracker-2011/Tests/python-connections-Bug.2901.SQL.py --- a/sql/test/BugTracker-2011/Tests/python-connections-Bug.2901.SQL.py +++ b/sql/test/BugTracker-2011/Tests/python-connections-Bug.2901.SQL.py @@ -1,4 +1,4 @@ -import pymonetdb +from MonetDBtesting import tpymonetdb as pymonetdb import os c = pymonetdb.connect(port=int(os.getenv('MAPIPORT')), diff --git a/sql/test/BugTracker-2011/Tests/user_create_temp_table.Bug-2916.SQL.py b/sql/test/BugTracker-2011/Tests/user_create_temp_table.Bug-2916.SQL.py --- a/sql/test/BugTracker-2011/Tests/user_create_temp_table.Bug-2916.SQL.py +++ b/sql/test/BugTracker-2011/Tests/user_create_temp_table.Bug-2916.SQL.py @@ -1,4 +1,5 @@ -import sys, os, pymonetdb +from MonetDBtesting import tpymonetdb as pymonetdb +import sys, os db = os.getenv("TSTDB") port = int(os.getenv("MAPIPORT")) diff --git a/sql/test/BugTracker-2012/Tests/day-of-month-localization.Bug-2962.SQL.py b/sql/test/BugTracker-2012/Tests/day-of-month-localization.Bug-2962.SQL.py --- a/sql/test/BugTracker-2012/Tests/day-of-month-localization.Bug-2962.SQL.py +++ b/sql/test/BugTracker-2012/Tests/day-of-month-localization.Bug-2962.SQL.py @@ -1,4 +1,5 @@ -import time, sys, os, pymonetdb +from MonetDBtesting import tpymonetdb as pymonetdb +import time, sys, os client1 = pymonetdb.connect(database=os.getenv("TSTDB"), port=int(os.getenv("MAPIPORT"))) cur1 = client1.cursor() diff --git a/sql/test/BugTracker-2012/Tests/large-number-operation-strange-results.Bug-2929.py b/sql/test/BugTracker-2012/Tests/large-number-operation-strange-results.Bug-2929.py --- a/sql/test/BugTracker-2012/Tests/large-number-operation-strange-results.Bug-2929.py +++ b/sql/test/BugTracker-2012/Tests/large-number-operation-strange-results.Bug-2929.py @@ -1,4 +1,5 @@ -import sys, os, pymonetdb +from MonetDBtesting import tpymonetdb as pymonetdb +import sys, os from decimal import * db = os.getenv("TSTDB") diff --git a/sql/test/BugTracker-2012/Tests/table_functions_fail_after_restart.Bug-3063.py b/sql/test/BugTracker-2012/Tests/table_functions_fail_after_restart.Bug-3063.py --- a/sql/test/BugTracker-2012/Tests/table_functions_fail_after_restart.Bug-3063.py +++ b/sql/test/BugTracker-2012/Tests/table_functions_fail_after_restart.Bug-3063.py @@ -1,4 +1,5 @@ -import os, sys, tempfile, pymonetdb +from MonetDBtesting import tpymonetdb as pymonetdb +import os, sys, tempfile try: from MonetDBtesting import process diff --git a/sql/test/BugTracker-2013/Tests/binary_copy_into.Bug-3345.SQL.py b/sql/test/BugTracker-2013/Tests/binary_copy_into.Bug-3345.SQL.py --- a/sql/test/BugTracker-2013/Tests/binary_copy_into.Bug-3345.SQL.py +++ b/sql/test/BugTracker-2013/Tests/binary_copy_into.Bug-3345.SQL.py @@ -1,4 +1,5 @@ -import os, sys, shutil, pymonetdb +from MonetDBtesting import tpymonetdb as pymonetdb +import os, sys, shutil src = os.enviro
MonetDB: nested - improved handling of mixure of composites and ...
Changeset: e05926cd3c81 for MonetDB URL: https://dev.monetdb.org/hg/MonetDB/rev/e05926cd3c81 Modified Files: sql/backends/monet5/rel_bin.c sql/server/rel_exp.c sql/server/rel_multiset.c sql/test/nested/Tests/webclicks.test Branch: nested Log Message: improved handling of mixure of composites and multisets diffs (truncated from 322 to 300 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 @@ -645,7 +645,11 @@ composite_value_list(backend *be, sql_ex i = exp_bin(be, e, left, NULL, NULL, NULL, NULL, sel, 0, 0, 0); if (!i) return NULL; - list_append(f, i); + if (i->type == st_list) { + for( node *n = i->op4.lval->h; n; n = n->next) + list_append(f, n->data); + } else + list_append(f, i); } return stmt_list(be, f); } @@ -764,21 +768,25 @@ append_tuple(backend *be, sql_exp *tuple } m = m->next; } - if (type->type->composite) { - for(n = attr->h, o = type->type->d.fields->h; n && o; n = n->next, o = o->next) { + sql_subtype *ntype = type; + if (is_row(tuple) && list_length(type->type->d.fields) == 1) { + sql_arg *f = type->type->d.fields->h->data; + ntype = &f->type; + } + if (ntype->type->composite) { + for(n = attr->h, o = ntype->type->d.fields->h; n && o; n = n->next, o = o->next) { + sql_arg *f = o->data; sql_exp *e = n->data; list *vals = m->data; - sql_subtype *type = exp_subtype(e); - assert(type->type == ((sql_arg*)o->data)->type.type); - if (type->type->composite) { - node *nm = append_tuple(be, e, type, left, sel, m, rowcnt, lcnt, type->multiset); + if (f->type.type->composite) { + node *nm = append_tuple(be, e, &f->type, left, sel, m, rowcnt, lcnt, ntype->multiset); if (nm == m) return m; m = nm; } else { stmt *i = exp_bin(be, e, left, NULL, NULL, NULL, NULL, sel, 0, 0, 0); + append(vals, i); m = m->next; - append(vals, i); } } } else { @@ -5816,27 +5824,27 @@ table_update_stmts(mvc *sql, sql_table * } static node * -insert_composite(stmt **updates, sql_column *c, node *n, stmt *input_tuple) -{ - node *m, *f; +insert_composite(stmt **updates, sql_column *c, node *n, node **M) +{ + node *m = *M, *f; + /* while(input_tuple->type == st_alias) input_tuple = input_tuple->op1; if (input_tuple->type != st_list) return NULL; - /* TODO we need to insert the id into the composite column itself if this is a multiset */ - if (c->type.multiset) { - printf("todo insert next id?\n"); - } - for(m = input_tuple->op4.lval->h, n = n->next, f = c->type.type->d.fields->h; n && m && f; m = m->next, f = f->next) { + */ + for(n = n->next, f = c->type.type->d.fields->h; n && m && f; f = f->next) { sql_column *c = n->data; - if (c->type.type->composite) { - n = insert_composite(updates, c, n, m->data); + if (c->type.type->composite && !c->type.multiset) { + n = insert_composite(updates, c, n, &m); } else { updates[c->colnr] = m->data; n = n->next; - } - } + m = m->next; + } + } + /* if (c->type.multiset) { sql_column *c = n->data; @@ -5851,8 +5859,10 @@ insert_composite(stmt **updates, sql_col n = n->next; m = m->next; } - if (f || m) /* did we find all fields and use all values */ - return NULL; + */ + //if (f || m) /* did we find all fields and use all values */ + //return NULL; + *M = m; return n; } @@ -5904,14 +5914,15 @@ rel2bin_insert(backend *be, sql_rel *rel return NULL; updates = table_update_stmts(sql, t, &len); - for (n = ol_first_node(t->columns), m = inserts->op4.lval->h; n && m; m = m->next) { + for (n = ol_first_node(t->columns), m = inserts->op4.lval->h; n && m; ) { sql_column *c = n->data; if (c->t
MonetDB: nested - check for from string/json earlier
Changeset: d6520c6fa39c for MonetDB URL: https://dev.monetdb.org/hg/MonetDB/rev/d6520c6fa39c Modified Files: sql/server/rel_exp.c Branch: nested Log Message: check for from string/json earlier diffs (15 lines): diff --git a/sql/server/rel_exp.c b/sql/server/rel_exp.c --- a/sql/server/rel_exp.c +++ b/sql/server/rel_exp.c @@ -3783,6 +3783,11 @@ exp_check_type(mvc *sql, sql_subtype *t, return exp_check_multiset_type(sql, t, rel, exp, tpe); if (t->type->composite && (is_row(exp) || is_values(exp))) return exp_check_composite_type(sql, t, rel, exp, tpe); + sql_subtype *et = exp_subtype(exp); + if (strcmp(et->type->base.name, "json") == 0) + return exp_convert(sql, exp, et, t); + if (EC_VARCHAR(et->type->eclass)) + return exp_convert(sql, exp, et, t); if (is_values(exp)) return NULL; } ___ checkin-list mailing list -- checkin-list@monetdb.org To unsubscribe send an email to checkin-list-le...@monetdb.org
MonetDB: Aug2024 - Be explicit about our own time zone.
Changeset: c69c198743d2 for MonetDB URL: https://dev.monetdb.org/hg/MonetDB/rev/c69c198743d2 Modified Files: sql/test/datetime/Tests/str_to_time.test Branch: Aug2024 Log Message: Be explicit about our own time zone. diffs (10 lines): diff --git a/sql/test/datetime/Tests/str_to_time.test b/sql/test/datetime/Tests/str_to_time.test --- a/sql/test/datetime/Tests/str_to_time.test +++ b/sql/test/datetime/Tests/str_to_time.test @@ -1,3 +1,6 @@ +statement ok +set time zone interval '+01:00' hour to minute + statement ok create table itt (n int, t varchar(10), p varchar(10)) ___ checkin-list mailing list -- checkin-list@monetdb.org To unsubscribe send an email to checkin-list-le...@monetdb.org
MonetDB: nested - reenable inserts into multisetid/nr in json code
Changeset: 86280b095c4b for MonetDB URL: https://dev.monetdb.org/hg/MonetDB/rev/86280b095c4b Modified Files: sql/backends/monet5/sql.c Branch: nested Log Message: reenable inserts into multisetid/nr in json code diffs (18 lines): diff --git a/sql/backends/monet5/sql.c b/sql/backends/monet5/sql.c --- a/sql/backends/monet5/sql.c +++ b/sql/backends/monet5/sql.c @@ -5766,10 +5766,10 @@ insert_json_object(char **msg, JSON *js, } } - //if (elm > 0 && BUNappend(bats[w], &id, false) != GDK_SUCCEED) - // elm = -3; - //if (t->multiset == MS_ARRAY && elm > 0 && BUNappend(bats[w+1], &anr, false) != GDK_SUCCEED) - // elm = -3; + if (elm > 0 && BUNappend(bats[w], &id, false) != GDK_SUCCEED) + elm = -3; + if (t->multiset == MS_ARRAY && elm > 0 && BUNappend(bats[w+1], &anr, false) != GDK_SUCCEED) + elm = -3; return elm; } ___ checkin-list mailing list -- checkin-list@monetdb.org To unsubscribe send an email to checkin-list-le...@monetdb.org
MonetDB: odbc_loader - merge with default
Changeset: ab82fe1e7222 for MonetDB URL: https://dev.monetdb.org/hg/MonetDB/rev/ab82fe1e7222 Branch: odbc_loader Log Message: merge with default diffs (truncated from 1296 to 300 lines): diff --git a/ctest/tools/monetdbe/Tests/example_proxy.SQL.py b/ctest/tools/monetdbe/Tests/example_proxy.SQL.py --- a/ctest/tools/monetdbe/Tests/example_proxy.SQL.py +++ b/ctest/tools/monetdbe/Tests/example_proxy.SQL.py @@ -1,4 +1,5 @@ -import os, pymonetdb +from MonetDBtesting import tpymonetdb as pymonetdb +import os import subprocess db = os.getenv("TSTDB") diff --git a/sql/server/rel_optimize_proj.c b/sql/server/rel_optimize_proj.c --- a/sql/server/rel_optimize_proj.c +++ b/sql/server/rel_optimize_proj.c @@ -2504,9 +2504,91 @@ rel_distinct_aggregate_on_unique_values( static inline sql_rel * rel_remove_const_aggr(visitor *v, sql_rel *rel) { - if (!rel) + if(!rel) { + return rel; + } + + list *exps = rel->exps; + + if(rel->op != op_groupby || list_empty(exps)) { return rel; - if (rel && is_groupby(rel->op) && list_length(rel->exps) >= 1 && !rel_is_ref(rel)) { + } + + if(!list_empty(rel->r)) { + /* in the general case in an expression of an aggregate over +* a constant can be rewritten as just the const e.g. +* aggr(const) -> const +*/ + + for(node *n = exps->h; n; n = n->next) { + sql_exp *e = n->data; + + if(e->type != e_aggr) { + continue; + } + + sql_func *j = ((sql_subfunc *)e->f)->func; + + /* some aggregates with const values can only be eliminated +* under certain circumstances e.g. +* sum(NULL) -> NULL, sum(0) -> 0 +* prod(NULL) -> NULL, prod(1) -> 1 +* count(NULL) -> 0 +*/ + int sum = strcmp(j->base.name, "sum") == 0, + prd = strcmp(j->base.name, "prod") == 0, + cnt = strcmp(j->base.name, "count") == 0; + + if(!j->s && j->system == 1) { + list *se = e->l; + + if(se == NULL) { + continue; + } + + for(node *m = se->h; m; m = m->next) { + sql_exp *w = m->data; + + if(w->type == e_atom && w->card == CARD_ATOM) { + atom *wa = w->l; + + if(sum && !(wa->isnull || atom_is_zero(wa))) { + continue; + } + + if(prd && !(wa->isnull || atom_is_one(wa))) { + continue; + } + + if(cnt) { + if(wa->isnull) { + list_remove_node(se, NULL, m); + + w=exp_atom_lng(v->sql->sa, 0); + list_append(se, w); + } + else { + continue; + } + } + + exp_setalias(w,e->alias.label,e->alias.rname,e->alias.name); + + n->data = w; + v->changes++; + } + } + } + } + } + + /* +* Below code replaces GROUP BY with PROJECT in some cases; +* Triggers on... +* select 1 having true; select 42 from foo group by x; select n from foo group by rollup(n); + */ + + if (!rel_is_ref(rel)) { int needed = 0; for (node *n = rel->exps->h; n; n = n->next) { sql_exp *exp = (sql_exp*) n->data; @@ -2524,6 +2606,7 @@ rel_remove_const_aggr(visitor *v, sql_re if (exp_is_atom(exp)) atoms++; } + /* possible edge case, never triggers in coverage tes
MonetDB: nested - approved output
Changeset: d729fac5d0b2 for MonetDB URL: https://dev.monetdb.org/hg/MonetDB/rev/d729fac5d0b2 Modified Files: clients/Tests/MAL-signatures-hge.test clients/Tests/MAL-signatures.test Branch: nested Log Message: approved output diffs (48 lines): diff --git a/clients/Tests/MAL-signatures-hge.test b/clients/Tests/MAL-signatures-hge.test --- a/clients/Tests/MAL-signatures-hge.test +++ b/clients/Tests/MAL-signatures-hge.test @@ -3729,6 +3729,11 @@ pattern bat.appendBulk(X_0:bat[:any_1], CMDBATappend_bulk append the arguments ins to i bat +appendBulk +pattern bat.appendBulk(X_0:bat[:any_1], X_1:bit, X_2:bit, X_3:bat[:any_1]...):bat[:any_1] +CMDBATappend_bulk +append the arguments ins to i +bat delete command bat.delete(X_0:bat[:any_1], X_1:oid):bat[:any_1] BKCdelete @@ -49165,7 +49170,7 @@ SQLfrom_json Reads json string into table of nested/multiset structures sql from_varchar -pattern sql.from_varchar(X_0:str, X_1:ptr):bat[:any]... +pattern sql.from_varchar(X_0:bat?[:str], X_1:ptr):bat[:any]... SQLfrom_varchar Reads string into table of nested/multiset structures sql diff --git a/clients/Tests/MAL-signatures.test b/clients/Tests/MAL-signatures.test --- a/clients/Tests/MAL-signatures.test +++ b/clients/Tests/MAL-signatures.test @@ -3164,6 +3164,11 @@ pattern bat.appendBulk(X_0:bat[:any_1], CMDBATappend_bulk append the arguments ins to i bat +appendBulk +pattern bat.appendBulk(X_0:bat[:any_1], X_1:bit, X_2:bit, X_3:bat[:any_1]...):bat[:any_1] +CMDBATappend_bulk +append the arguments ins to i +bat delete command bat.delete(X_0:bat[:any_1], X_1:oid):bat[:any_1] BKCdelete @@ -37605,7 +37610,7 @@ SQLfrom_json Reads json string into table of nested/multiset structures sql from_varchar -pattern sql.from_varchar(X_0:str, X_1:ptr):bat[:any]... +pattern sql.from_varchar(X_0:bat?[:str], X_1:ptr):bat[:any]... SQLfrom_varchar Reads string into table of nested/multiset structures sql ___ checkin-list mailing list -- checkin-list@monetdb.org To unsubscribe send an email to checkin-list-le...@monetdb.org
MonetDB: Aug2024 - Fix a few more timeout issues.
Changeset: 95e8ee42ef91 for MonetDB URL: https://dev.monetdb.org/hg/MonetDB/rev/95e8ee42ef91 Modified Files: testing/Mtest.py.in Branch: Aug2024 Log Message: Fix a few more timeout issues. diffs (67 lines): diff --git a/testing/Mtest.py.in b/testing/Mtest.py.in --- a/testing/Mtest.py.in +++ b/testing/Mtest.py.in @@ -1544,7 +1544,10 @@ def coredumpctl(pid): stdout=process.PIPE, stderr=process.PIPE, text=True) as p: -out, err = p.communicate() +try: +out, err = p.communicate(timeout=60) +except process.TimeoutExpired: +p.kill() os.unlink(name) s = [] for l in out.split('\n'): @@ -1694,7 +1697,7 @@ def GetBitsAndModsAndThreads(env) : qErr = proc.stderr.read(timeout=5) try: proc.wait(timeout=5) -except TimeoutExpired: +except process.TimeoutExpired: proc.kill() proc.wait() finally: @@ -2478,13 +2481,19 @@ def stacktrace(proc, outfile): with process.Popen([cdb, '-pv', '-p', str(proc.pid), '-y', f'{sym}cache*;srv*http://msdl.microsoft.com/download/symbols', '-lines', '-c', '~*kP;!locks;q'], stdout=process.PIPE, text=True) as p: -out, err = p.communicate() +try: +out, err = p.communicate(timeout=60) +except process.TimeoutExpired: +p.kill() else: out = '' elif platform.system() == 'Darwin': try: with process.Popen(['lldb', '--attach-pid', str(proc.pid), '--batch', '--one-line', 'bt all'], stdout=process.PIPE, text=True) as p: -out, err = p.communicate() +try: +out, err = p.communicate(timeout=60) +except process.TimeoutExpired: +p.kill() except KeyboardInterrupt: raise except: @@ -2495,7 +2504,7 @@ def stacktrace(proc, outfile): text=True) as p: try: out, err = p.communicate(timeout=60) -except TimeoutExpired: +except process.TimeoutExpired: # gdb sometimes hangs when trying to get the stack # trace: kill it mercilessly if it does p.kill() @@ -2574,9 +2583,9 @@ class ServerClass: self.proc.terminate() try: self.proc.wait(timeout=30) -except TimeoutExpired: +except process.TimeoutExpired: self.proc.kill() -self.wait() +self.proc.wait() self.code = returnCode(self.proc, self.errfile) if self.pollfile is None: self.outfile.write(self.proc.stdout.read()) ___ checkin-list mailing list -- checkin-list@monetdb.org To unsubscribe send an email to checkin-list-le...@monetdb.org
MonetDB: nested - Adds tests for composite type support
Changeset: 6a50044015e5 for MonetDB URL: https://dev.monetdb.org/hg/MonetDB/rev/6a50044015e5 Added Files: sql/test/nested/Tests/composite.test Branch: nested Log Message: Adds tests for composite type support diffs (67 lines): diff --git a/sql/test/nested/Tests/composite.test b/sql/test/nested/Tests/composite.test new file mode 100644 --- /dev/null +++ b/sql/test/nested/Tests/composite.test @@ -0,0 +1,62 @@ +statement ok +create type myt as (n int, m text[]) + +statement ok +create table foo (c myt) + +## array syntax + +statement ok +insert into foo values ((10, 'test')) + +statement ok +insert into foo values ((20, 'alice')), ((30, 'bob')) + +query I nosort +select count(*) from foo + +3 + +query IT nosort +select c.n, c.m from foo + +10 +test +20 +alice +30 +bob + +## literal syntax + +statement ok +insert into foo values ('{(0, "head")}') + +statement ok +insert into foo values ('{(1, "hello")}'), ('{(2, "world")}') + +query IT nosort +select c.n, c.m from foo + +10 +test +20 +alice +30 +bob +0 +head +1 +hello +2 +world + +## modify table + +statement ok +truncate foo + +query I nosort +select count(*) from foo + +0 ___ checkin-list mailing list -- checkin-list@monetdb.org To unsubscribe send an email to checkin-list-le...@monetdb.org
MonetDB: nested - pass info over multiset id columns
Changeset: c2f4e0bda9a3 for MonetDB URL: https://dev.monetdb.org/hg/MonetDB/rev/c2f4e0bda9a3 Modified Files: monetdb5/modules/mal/batExtensions.c sql/backends/monet5/sql_statement.c sql/backends/monet5/sql_statement.h sql/test/nested/Tests/All Branch: nested Log Message: pass info over multiset id columns diffs (230 lines): diff --git a/monetdb5/modules/mal/batExtensions.c b/monetdb5/modules/mal/batExtensions.c --- a/monetdb5/modules/mal/batExtensions.c +++ b/monetdb5/modules/mal/batExtensions.c @@ -200,8 +200,14 @@ CMDBATappend_bulk(Client cntxt, MalBlkPt bat *r = getArgReference_bat(stk, pci, 0), *bid = getArgReference_bat(stk, pci, 1); bit force = *getArgReference_bit(stk, pci, 2); + bit ms = false; + int argc = 3; + if (getArgType(mb, pci, argc) == TYPE_bit && getArgType(mb, pci, argc + 1) != TYPE_bit) { + ms = *getArgReference_bit(stk, pci, argc); + argc++; + } BAT *b; - BUN inputs = (BUN) (pci->argc - 3), number_existing = 0, total = 0; + BUN inputs = (BUN) (pci->argc - argc), number_existing = 0, total = 0; (void) cntxt; if ((b = BATdescriptor(*bid)) == NULL) @@ -210,9 +216,32 @@ CMDBATappend_bulk(Client cntxt, MalBlkPt if (inputs > 0) { number_existing = BATcount(b); - if (isaBatType(getArgType(mb, pci, 3))) { /* use BATappend for the bulk case */ + if (isaBatType(getArgType(mb, pci, argc))) {/* use BATappend for the bulk case */ gdk_return rt; - for (int i = 3, args = pci->argc; i < args; i++) { + if (ms) { + int nr = -1; + for (int i = argc, args = pci->argc; i < args; i++) { + BAT *d = BATdescriptor(*getArgReference_bat(stk, pci, i)); + if (!d) { + BBPunfix(b->batCacheid); + throw(MAL, "bat.append_bulk", + SQLSTATE(HY002) RUNTIME_OBJECT_MISSING); + } + if (i > argc) { + int *t = Tloc(d, 0); + for(BUN n = 0; n < BATcount(d); n++) + t[n] += nr; + } + rt = BATappend(b, d, NULL, force); + nr = *(int*)Tloc(b, BATcount(b)-1); + BBPunfix(d->batCacheid); + if (rt != GDK_SUCCEED) { + BBPunfix(b->batCacheid); + throw(MAL, "bat.append_bulk", GDK_EXCEPTION); + } + } + } else + for (int i = argc, args = pci->argc; i < args; i++) { BAT *d = BATdescriptor(*getArgReference_bat(stk, pci, i)); if (!d) { BBPunfix(b->batCacheid); @@ -242,7 +271,7 @@ CMDBATappend_bulk(Client cntxt, MalBlkPt BBPunfix(b->batCacheid); throw(MAL, "bat.append_bulk", GDK_EXCEPTION); } - for (int i = 3, args = pci->argc; i < args; i++) { + for (int i = argc, args = pci->argc; i < args; i++) { ptr u = getArgReference(stk, pci, i); if (external) u = (ptr) *(ptr *) u; @@ -291,6 +320,7 @@ mel_func batExtensions_init_funcs[] = { pattern("bat", "partition", CMDBATpartition2, false, "Create the n-th slice over the BAT broken into several pieces.", args(1,4, batargany("",1),batargany("b",1),arg("pieces",int),arg("n",int))), pattern("bat", "appendBulk", CMDBATappend_bulk, false, "append the arguments ins to i", args(1,4, batargany("",1), batargany("i",1),arg("force",bit),varargany("ins",1))), pattern("bat", "appendBulk", CMDBATappend_bulk, false, "append the arguments ins to i", args(1,4, batargany("",1), batargany("i",1),arg("force",bit),batvarargany("ins",1))), + pattern("bat", "appendBulk", CMDBATappend_bulk, false, "append the arguments ins to i", args(1,5, batargany("",1), batargany("i",1),arg("force",bit),arg("inc",bit), batvarargany("ins",1))), command("bat", "vacuum", CMDBATvacuum, false, "", args(1,2, batarg("",str),batarg("b",str))), { .imp=NULL } }; diff --git a/sql/backends/monet5/sql_statement.c b/s
MonetDB: nested - merged
Changeset: a2f96419f173 for MonetDB URL: https://dev.monetdb.org/hg/MonetDB/rev/a2f96419f173 Branch: nested Log Message: merged diffs (67 lines): diff --git a/sql/test/nested/Tests/composite.test b/sql/test/nested/Tests/composite.test new file mode 100644 --- /dev/null +++ b/sql/test/nested/Tests/composite.test @@ -0,0 +1,62 @@ +statement ok +create type myt as (n int, m text[]) + +statement ok +create table foo (c myt) + +## array syntax + +statement ok +insert into foo values ((10, 'test')) + +statement ok +insert into foo values ((20, 'alice')), ((30, 'bob')) + +query I nosort +select count(*) from foo + +3 + +query IT nosort +select c.n, c.m from foo + +10 +test +20 +alice +30 +bob + +## literal syntax + +statement ok +insert into foo values ('{(0, "head")}') + +statement ok +insert into foo values ('{(1, "hello")}'), ('{(2, "world")}') + +query IT nosort +select c.n, c.m from foo + +10 +test +20 +alice +30 +bob +0 +head +1 +hello +2 +world + +## modify table + +statement ok +truncate foo + +query I nosort +select count(*) from foo + +0 ___ checkin-list mailing list -- checkin-list@monetdb.org To unsubscribe send an email to checkin-list-le...@monetdb.org
MonetDB: odbc_loader - Add retrieval of ODBC Driver (Manager) er...
Changeset: 5f594f42e0cc for MonetDB URL: https://dev.monetdb.org/hg/MonetDB/rev/5f594f42e0cc Modified Files: sql/backends/monet5/vaults/odbc/odbc_loader.c Branch: odbc_loader Log Message: Add retrieval of ODBC Driver (Manager) error message via SQLGetDiagRec(). Also added support to connect using FILEDSN= diffs (72 lines): diff --git a/sql/backends/monet5/vaults/odbc/odbc_loader.c b/sql/backends/monet5/vaults/odbc/odbc_loader.c --- a/sql/backends/monet5/vaults/odbc/odbc_loader.c +++ b/sql/backends/monet5/vaults/odbc/odbc_loader.c @@ -114,6 +114,7 @@ map_rescol_type(SQLSMALLINT dataType, SQ /* decimalDigits contains the precision of fractions of a second */ typenm = "time"; break; + case SQL_DATETIME: case SQL_TYPE_TIMESTAMP: /* decimalDigits contains the precision of fractions of a second */ typenm = "timestamp"; @@ -201,9 +202,13 @@ odbc_relation(mvc *sql, sql_subfunc *f, // skip 'odbc:' prefix from url so we get a connection string including the query char * con_str = &url[5]; - // the connection string must start with 'DSN=' or 'DRIVER=' else the ODBC driver manager can't load the ODBC driver - if (con_str && (strncasecmp("DSN=", con_str, 4) != 0) && (strncasecmp("DRIVER=", con_str, 7) != 0)) - return "Invalid ODBC connection string. Should start with 'DSN=' or 'DRIVER='."; + /* the connection string must start with 'DSN=' or 'DRIVER=' or 'FILEDSN=' + else the ODBC driver manager can't load the ODBC driver */ + if (con_str + && (strncmp("DSN=", con_str, 4) != 0) + && (strncmp("DRIVER=", con_str, 7) != 0) + && (strncmp("FILEDSN=", con_str, 8) != 0)) + return "Invalid ODBC connection string. Should start with 'DSN=' or 'DRIVER=' or 'FILEDSN='."; // locate the 'QUERY=' part to extract the SQL query string to execute char * qry_str = strstr(con_str, "QUERY="); @@ -312,9 +317,41 @@ odbc_relation(mvc *sql, sql_subfunc *f, GDKfree(query); if (odbc_con_str) GDKfree(odbc_con_str); - // TODO get DiagRecMsg to get driver err message and sqlstate + + if (ret != SQL_SUCCESS && ret != SQL_SUCCESS_WITH_INFO) { + SQLSMALLINT handleType; + SQLHANDLE handle; + SQLCHAR state[6]; + SQLINTEGER errnr; + SQLCHAR msg[2048]; + SQLSMALLINT msglen; + + /* get err message(s) from the right handle */ + if (stmt != SQL_NULL_HSTMT) { + handleType = SQL_HANDLE_STMT; + handle = stmt; + } else + if (dbc != SQL_NULL_HDBC) { + handleType = SQL_HANDLE_DBC; + handle = dbc; + } else { + handleType = SQL_HANDLE_ENV; + handle = env; + } + ret = SQLGetDiagRec(handleType, handle, 1, state, &errnr, msg, sizeof(msg), &msglen); + if (ret == SQL_SUCCESS || ret == SQL_SUCCESS_WITH_INFO) { + str retmsg; + if (errmsg != NULL) { + retmsg = sa_message(sql->sa, "odbc_loader" " %s SQLstate %s, Errnr %d, Message %s", errmsg, (char*)state, (int)errnr, (char*)msg); + } else { + retmsg = sa_message(sql->sa, "odbc_loader" " SQLstate %s, Errnr %d, Message %s", (char*)state, (int)errnr, (char*)msg); + } + odbc_cleanup(env, dbc, stmt); + return retmsg; + } + } odbc_cleanup(env, dbc, stmt); - return errmsg; + return (str)errmsg; } static void * ___ checkin-list mailing list -- checkin-list@monetdb.org To unsubscribe send an email to checkin-list-le...@monetdb.org
MonetDB: const_aggr_elim - Merges default
Changeset: f28fc2ea8799 for MonetDB URL: https://dev.monetdb.org/hg/MonetDB/rev/f28fc2ea8799 Branch: const_aggr_elim Log Message: Merges default diffs (truncated from 919 to 300 lines): diff --git a/ctest/tools/monetdbe/Tests/example_proxy.SQL.py b/ctest/tools/monetdbe/Tests/example_proxy.SQL.py --- a/ctest/tools/monetdbe/Tests/example_proxy.SQL.py +++ b/ctest/tools/monetdbe/Tests/example_proxy.SQL.py @@ -1,4 +1,5 @@ -import os, pymonetdb +from MonetDBtesting import tpymonetdb as pymonetdb +import os import subprocess db = os.getenv("TSTDB") diff --git a/sql/test/BugTracker-2009/Tests/bit_and.SF-2850341.py b/sql/test/BugTracker-2009/Tests/bit_and.SF-2850341.py --- a/sql/test/BugTracker-2009/Tests/bit_and.SF-2850341.py +++ b/sql/test/BugTracker-2009/Tests/bit_and.SF-2850341.py @@ -1,4 +1,5 @@ -import sys, os, pymonetdb +from MonetDBtesting import tpymonetdb as pymonetdb +import sys, os db = os.getenv("TSTDB") port = int(os.getenv("MAPIPORT")) diff --git a/sql/test/BugTracker-2011/Tests/interrupted-initialization.Bug-2875.SQL.py b/sql/test/BugTracker-2011/Tests/interrupted-initialization.Bug-2875.SQL.py --- a/sql/test/BugTracker-2011/Tests/interrupted-initialization.Bug-2875.SQL.py +++ b/sql/test/BugTracker-2011/Tests/interrupted-initialization.Bug-2875.SQL.py @@ -1,4 +1,5 @@ -import os, sys, tempfile, pymonetdb +from MonetDBtesting import tpymonetdb as pymonetdb +import os, sys, tempfile try: from MonetDBtesting import process except ImportError: diff --git a/sql/test/BugTracker-2011/Tests/many-connects-cache.Bug-2904.SQL.py b/sql/test/BugTracker-2011/Tests/many-connects-cache.Bug-2904.SQL.py --- a/sql/test/BugTracker-2011/Tests/many-connects-cache.Bug-2904.SQL.py +++ b/sql/test/BugTracker-2011/Tests/many-connects-cache.Bug-2904.SQL.py @@ -1,4 +1,5 @@ -import sys, os, pymonetdb, threading +from MonetDBtesting import tpymonetdb as pymonetdb +import sys, os, threading db = os.getenv("TSTDB") port = int(os.getenv("MAPIPORT")) diff --git a/sql/test/BugTracker-2011/Tests/python-connections-Bug.2901.SQL.py b/sql/test/BugTracker-2011/Tests/python-connections-Bug.2901.SQL.py --- a/sql/test/BugTracker-2011/Tests/python-connections-Bug.2901.SQL.py +++ b/sql/test/BugTracker-2011/Tests/python-connections-Bug.2901.SQL.py @@ -1,4 +1,4 @@ -import pymonetdb +from MonetDBtesting import tpymonetdb as pymonetdb import os c = pymonetdb.connect(port=int(os.getenv('MAPIPORT')), diff --git a/sql/test/BugTracker-2011/Tests/user_create_temp_table.Bug-2916.SQL.py b/sql/test/BugTracker-2011/Tests/user_create_temp_table.Bug-2916.SQL.py --- a/sql/test/BugTracker-2011/Tests/user_create_temp_table.Bug-2916.SQL.py +++ b/sql/test/BugTracker-2011/Tests/user_create_temp_table.Bug-2916.SQL.py @@ -1,4 +1,5 @@ -import sys, os, pymonetdb +from MonetDBtesting import tpymonetdb as pymonetdb +import sys, os db = os.getenv("TSTDB") port = int(os.getenv("MAPIPORT")) diff --git a/sql/test/BugTracker-2012/Tests/day-of-month-localization.Bug-2962.SQL.py b/sql/test/BugTracker-2012/Tests/day-of-month-localization.Bug-2962.SQL.py --- a/sql/test/BugTracker-2012/Tests/day-of-month-localization.Bug-2962.SQL.py +++ b/sql/test/BugTracker-2012/Tests/day-of-month-localization.Bug-2962.SQL.py @@ -1,4 +1,5 @@ -import time, sys, os, pymonetdb +from MonetDBtesting import tpymonetdb as pymonetdb +import time, sys, os client1 = pymonetdb.connect(database=os.getenv("TSTDB"), port=int(os.getenv("MAPIPORT"))) cur1 = client1.cursor() diff --git a/sql/test/BugTracker-2012/Tests/large-number-operation-strange-results.Bug-2929.py b/sql/test/BugTracker-2012/Tests/large-number-operation-strange-results.Bug-2929.py --- a/sql/test/BugTracker-2012/Tests/large-number-operation-strange-results.Bug-2929.py +++ b/sql/test/BugTracker-2012/Tests/large-number-operation-strange-results.Bug-2929.py @@ -1,4 +1,5 @@ -import sys, os, pymonetdb +from MonetDBtesting import tpymonetdb as pymonetdb +import sys, os from decimal import * db = os.getenv("TSTDB") diff --git a/sql/test/BugTracker-2012/Tests/table_functions_fail_after_restart.Bug-3063.py b/sql/test/BugTracker-2012/Tests/table_functions_fail_after_restart.Bug-3063.py --- a/sql/test/BugTracker-2012/Tests/table_functions_fail_after_restart.Bug-3063.py +++ b/sql/test/BugTracker-2012/Tests/table_functions_fail_after_restart.Bug-3063.py @@ -1,4 +1,5 @@ -import os, sys, tempfile, pymonetdb +from MonetDBtesting import tpymonetdb as pymonetdb +import os, sys, tempfile try: from MonetDBtesting import process diff --git a/sql/test/BugTracker-2013/Tests/binary_copy_into.Bug-3345.SQL.py b/sql/test/BugTracker-2013/Tests/binary_copy_into.Bug-3345.SQL.py --- a/sql/test/BugTracker-2013/Tests/binary_copy_into.Bug-3345.SQL.py +++ b/sql/test/BugTracker-2013/Tests/binary_copy_into.Bug-3345.SQL.py @@ -1,4 +1,5 @@ -import os, sys, shutil, pymonetdb +from MonetDBtesting import tpymonetdb as pymonetdb +import os, sys, shutil src = os.environ['RELSRCDIR'] dst = os.environ['TSTTRGDIR'] diff
MonetDB: default - Merges branch const_aggr_elim
Changeset: 76649af0f3e0 for MonetDB URL: https://dev.monetdb.org/hg/MonetDB/rev/76649af0f3e0 Branch: default Log Message: Merges branch const_aggr_elim diffs (truncated from 377 to 300 lines): diff --git a/sql/server/rel_optimize_proj.c b/sql/server/rel_optimize_proj.c --- a/sql/server/rel_optimize_proj.c +++ b/sql/server/rel_optimize_proj.c @@ -2504,9 +2504,91 @@ rel_distinct_aggregate_on_unique_values( static inline sql_rel * rel_remove_const_aggr(visitor *v, sql_rel *rel) { - if (!rel) + if(!rel) { + return rel; + } + + list *exps = rel->exps; + + if(rel->op != op_groupby || list_empty(exps)) { return rel; - if (rel && is_groupby(rel->op) && list_length(rel->exps) >= 1 && !rel_is_ref(rel)) { + } + + if(!list_empty(rel->r)) { + /* in the general case in an expression of an aggregate over +* a constant can be rewritten as just the const e.g. +* aggr(const) -> const +*/ + + for(node *n = exps->h; n; n = n->next) { + sql_exp *e = n->data; + + if(e->type != e_aggr) { + continue; + } + + sql_func *j = ((sql_subfunc *)e->f)->func; + + /* some aggregates with const values can only be eliminated +* under certain circumstances e.g. +* sum(NULL) -> NULL, sum(0) -> 0 +* prod(NULL) -> NULL, prod(1) -> 1 +* count(NULL) -> 0 +*/ + int sum = strcmp(j->base.name, "sum") == 0, + prd = strcmp(j->base.name, "prod") == 0, + cnt = strcmp(j->base.name, "count") == 0; + + if(!j->s && j->system == 1) { + list *se = e->l; + + if(se == NULL) { + continue; + } + + for(node *m = se->h; m; m = m->next) { + sql_exp *w = m->data; + + if(w->type == e_atom && w->card == CARD_ATOM) { + atom *wa = w->l; + + if(sum && !(wa->isnull || atom_is_zero(wa))) { + continue; + } + + if(prd && !(wa->isnull || atom_is_one(wa))) { + continue; + } + + if(cnt) { + if(wa->isnull) { + list_remove_node(se, NULL, m); + + w=exp_atom_lng(v->sql->sa, 0); + list_append(se, w); + } + else { + continue; + } + } + + exp_setalias(w,e->alias.label,e->alias.rname,e->alias.name); + + n->data = w; + v->changes++; + } + } + } + } + } + + /* +* Below code replaces GROUP BY with PROJECT in some cases; +* Triggers on... +* select 1 having true; select 42 from foo group by x; select n from foo group by rollup(n); + */ + + if (!rel_is_ref(rel)) { int needed = 0; for (node *n = rel->exps->h; n; n = n->next) { sql_exp *exp = (sql_exp*) n->data; @@ -2524,6 +2606,7 @@ rel_remove_const_aggr(visitor *v, sql_re if (exp_is_atom(exp)) atoms++; } + /* possible edge case, never triggers in coverage tests */ if (atoms == list_length(rel->r)) { list *nexps = sa_list(v->sql->sa); for (node *n = rel->exps->h; n; ) { @@ -2588,6 +2671,7 @@ rel_remove_const_aggr(visitor *v, sql_re return nrel; } } +
MonetDB: nested - check for complex_conversions
Changeset: 33a9046f8e24 for MonetDB URL: https://dev.monetdb.org/hg/MonetDB/rev/33a9046f8e24 Modified Files: sql/server/rel_multiset.c Branch: nested Log Message: check for complex_conversions diffs (33 lines): diff --git a/sql/server/rel_multiset.c b/sql/server/rel_multiset.c --- a/sql/server/rel_multiset.c +++ b/sql/server/rel_multiset.c @@ -389,12 +389,28 @@ fm_project_ms_bt(visitor *v, sql_exp *e, } } +static bool +exps_are_complex_convert(list *exps) +{ + if (list_empty(exps)) + return false; + for(node *n = exps->h; n; n = n->next) { + sql_exp *e = n->data; + if (e->type == e_convert) { + sql_subtype *t = exp_subtype(e); + if (t->multiset || t->type->composite) + return true; + } + } + return false; +} + static sql_rel * fm_project(visitor *v, sql_rel *rel) { sql_rel *l = rel->l; - if ((!l || (l && rel->card == CARD_ATOM && is_project(l->op))) && rel->exps) { /* check for type multiset */ + if ((!l || (l && (rel->card == CARD_ATOM || exps_are_complex_convert(rel->exps)) && is_project(l->op))) && rel->exps) { /* check for type multiset */ bool needed = false; for(node *n = rel->exps->h; n; n = n->next) { sql_exp *e = n->data; ___ checkin-list mailing list -- checkin-list@monetdb.org To unsubscribe send an email to checkin-list-le...@monetdb.org
MonetDB: nested - Adds test for array support of basic types
Changeset: fc4f28d0f2af for MonetDB URL: https://dev.monetdb.org/hg/MonetDB/rev/fc4f28d0f2af Added Files: sql/test/nested/Tests/array.test Branch: nested Log Message: Adds test for array support of basic types diffs (77 lines): diff --git a/sql/test/nested/Tests/array.test b/sql/test/nested/Tests/array.test new file mode 100644 --- /dev/null +++ b/sql/test/nested/Tests/array.test @@ -0,0 +1,72 @@ +statement ok +create table foo (n int[]) + +query I nosort +select * from foo + + +statement ok +insert into foo values ('{1, 2}') + +query T nosort +select * from foo + +{1,2} + +statement ok +insert into foo values ('{1, 2}') + +query T nosort +select * from foo + +{1,2} +{1,2} + +statement ok +insert into foo values ('{3, 4}'), ('{5}'), ('{6, 7, 8}') + +query T nosort +select * from foo + +{1,2} +{1,2} +{3,4} +{5} +{6,7,8} + +statement ok +create table bar (n text[]) + +query I nosort +select * from bar + + +statement ok +insert into bar values ('{"left", "right"}') + +query T nosort +select * from bar + +{"left","right"} + +statement ok +insert into bar values ('{"l2", "r2"}') + +query T nosort +select * from bar + +{"left","right"} +{"l1","r2"} + +statement ok +insert into bar values ('{"single"}'), ('{"a", "b", "c"}'), ('{"one", "two"}'); + +query T nosort +select * from bar + +{"left","right"} +{"l1","r2"} +{"single"} +{"a","b","c"} +{"one","two"} + ___ checkin-list mailing list -- checkin-list@monetdb.org To unsubscribe send an email to checkin-list-le...@monetdb.org
MonetDB: const_aggr_elim - Closes branch
Changeset: c8ddb657725f for MonetDB URL: https://dev.monetdb.org/hg/MonetDB/rev/c8ddb657725f Branch: const_aggr_elim Log Message: Closes branch ___ checkin-list mailing list -- checkin-list@monetdb.org To unsubscribe send an email to checkin-list-le...@monetdb.org
MonetDB: nested - probaly fixes handling non-composite type mult...
Changeset: ab24a528dae9 for MonetDB URL: https://dev.monetdb.org/hg/MonetDB/rev/ab24a528dae9 Modified Files: sql/server/rel_exp.c Branch: nested Log Message: probaly fixes handling non-composite type multiset (array) handling diffs (15 lines): diff --git a/sql/server/rel_exp.c b/sql/server/rel_exp.c --- a/sql/server/rel_exp.c +++ b/sql/server/rel_exp.c @@ -3758,7 +3758,10 @@ exp_check_multiset_type(mvc *sql, sql_su sql_exp *r = v->data; if (!is_row(r)) - r = exp_check_multiset_type(sql, &ct, rel, r, tpe); + if (t->type->composite) + r = exp_check_multiset_type(sql, &ct, rel, r, tpe); + else + r = exp_check_type(sql, &ct, rel, r, tpe); else r = exp_check_composite_type(sql, &ct, rel, r, tpe); if (!r) ___ checkin-list mailing list -- checkin-list@monetdb.org To unsubscribe send an email to checkin-list-le...@monetdb.org
MonetDB: nested - Merge with default branch.
Changeset: 6ae7a6227a28 for MonetDB URL: https://dev.monetdb.org/hg/MonetDB/rev/6ae7a6227a28 Branch: nested Log Message: Merge with default branch. diffs (truncated from 1353 to 300 lines): diff --git a/ctest/tools/monetdbe/Tests/example_proxy.SQL.py b/ctest/tools/monetdbe/Tests/example_proxy.SQL.py --- a/ctest/tools/monetdbe/Tests/example_proxy.SQL.py +++ b/ctest/tools/monetdbe/Tests/example_proxy.SQL.py @@ -1,4 +1,5 @@ -import os, pymonetdb +from MonetDBtesting import tpymonetdb as pymonetdb +import os import subprocess db = os.getenv("TSTDB") diff --git a/sql/test/BugTracker-2009/Tests/bit_and.SF-2850341.py b/sql/test/BugTracker-2009/Tests/bit_and.SF-2850341.py --- a/sql/test/BugTracker-2009/Tests/bit_and.SF-2850341.py +++ b/sql/test/BugTracker-2009/Tests/bit_and.SF-2850341.py @@ -1,4 +1,5 @@ -import sys, os, pymonetdb +from MonetDBtesting import tpymonetdb as pymonetdb +import sys, os db = os.getenv("TSTDB") port = int(os.getenv("MAPIPORT")) diff --git a/sql/test/BugTracker-2011/Tests/interrupted-initialization.Bug-2875.SQL.py b/sql/test/BugTracker-2011/Tests/interrupted-initialization.Bug-2875.SQL.py --- a/sql/test/BugTracker-2011/Tests/interrupted-initialization.Bug-2875.SQL.py +++ b/sql/test/BugTracker-2011/Tests/interrupted-initialization.Bug-2875.SQL.py @@ -1,4 +1,5 @@ -import os, sys, tempfile, pymonetdb +from MonetDBtesting import tpymonetdb as pymonetdb +import os, sys, tempfile try: from MonetDBtesting import process except ImportError: diff --git a/sql/test/BugTracker-2011/Tests/many-connects-cache.Bug-2904.SQL.py b/sql/test/BugTracker-2011/Tests/many-connects-cache.Bug-2904.SQL.py --- a/sql/test/BugTracker-2011/Tests/many-connects-cache.Bug-2904.SQL.py +++ b/sql/test/BugTracker-2011/Tests/many-connects-cache.Bug-2904.SQL.py @@ -1,4 +1,5 @@ -import sys, os, pymonetdb, threading +from MonetDBtesting import tpymonetdb as pymonetdb +import sys, os, threading db = os.getenv("TSTDB") port = int(os.getenv("MAPIPORT")) diff --git a/sql/test/BugTracker-2011/Tests/python-connections-Bug.2901.SQL.py b/sql/test/BugTracker-2011/Tests/python-connections-Bug.2901.SQL.py --- a/sql/test/BugTracker-2011/Tests/python-connections-Bug.2901.SQL.py +++ b/sql/test/BugTracker-2011/Tests/python-connections-Bug.2901.SQL.py @@ -1,4 +1,4 @@ -import pymonetdb +from MonetDBtesting import tpymonetdb as pymonetdb import os c = pymonetdb.connect(port=int(os.getenv('MAPIPORT')), diff --git a/sql/test/BugTracker-2011/Tests/user_create_temp_table.Bug-2916.SQL.py b/sql/test/BugTracker-2011/Tests/user_create_temp_table.Bug-2916.SQL.py --- a/sql/test/BugTracker-2011/Tests/user_create_temp_table.Bug-2916.SQL.py +++ b/sql/test/BugTracker-2011/Tests/user_create_temp_table.Bug-2916.SQL.py @@ -1,4 +1,5 @@ -import sys, os, pymonetdb +from MonetDBtesting import tpymonetdb as pymonetdb +import sys, os db = os.getenv("TSTDB") port = int(os.getenv("MAPIPORT")) diff --git a/sql/test/BugTracker-2012/Tests/day-of-month-localization.Bug-2962.SQL.py b/sql/test/BugTracker-2012/Tests/day-of-month-localization.Bug-2962.SQL.py --- a/sql/test/BugTracker-2012/Tests/day-of-month-localization.Bug-2962.SQL.py +++ b/sql/test/BugTracker-2012/Tests/day-of-month-localization.Bug-2962.SQL.py @@ -1,4 +1,5 @@ -import time, sys, os, pymonetdb +from MonetDBtesting import tpymonetdb as pymonetdb +import time, sys, os client1 = pymonetdb.connect(database=os.getenv("TSTDB"), port=int(os.getenv("MAPIPORT"))) cur1 = client1.cursor() diff --git a/sql/test/BugTracker-2012/Tests/large-number-operation-strange-results.Bug-2929.py b/sql/test/BugTracker-2012/Tests/large-number-operation-strange-results.Bug-2929.py --- a/sql/test/BugTracker-2012/Tests/large-number-operation-strange-results.Bug-2929.py +++ b/sql/test/BugTracker-2012/Tests/large-number-operation-strange-results.Bug-2929.py @@ -1,4 +1,5 @@ -import sys, os, pymonetdb +from MonetDBtesting import tpymonetdb as pymonetdb +import sys, os from decimal import * db = os.getenv("TSTDB") diff --git a/sql/test/BugTracker-2012/Tests/table_functions_fail_after_restart.Bug-3063.py b/sql/test/BugTracker-2012/Tests/table_functions_fail_after_restart.Bug-3063.py --- a/sql/test/BugTracker-2012/Tests/table_functions_fail_after_restart.Bug-3063.py +++ b/sql/test/BugTracker-2012/Tests/table_functions_fail_after_restart.Bug-3063.py @@ -1,4 +1,5 @@ -import os, sys, tempfile, pymonetdb +from MonetDBtesting import tpymonetdb as pymonetdb +import os, sys, tempfile try: from MonetDBtesting import process diff --git a/sql/test/BugTracker-2013/Tests/binary_copy_into.Bug-3345.SQL.py b/sql/test/BugTracker-2013/Tests/binary_copy_into.Bug-3345.SQL.py --- a/sql/test/BugTracker-2013/Tests/binary_copy_into.Bug-3345.SQL.py +++ b/sql/test/BugTracker-2013/Tests/binary_copy_into.Bug-3345.SQL.py @@ -1,4 +1,5 @@ -import os, sys, shutil, pymonetdb +from MonetDBtesting import tpymonetdb as pymonetdb +import os, sys, shutil src = os.environ['RELSRCDIR'] dst = os.environ['TSTTRGDIR'] d
MonetDB: default - Merge with Aug2024 branch.
Changeset: b8d8f0756a30 for MonetDB URL: https://dev.monetdb.org/hg/MonetDB/rev/b8d8f0756a30 Modified Files: testing/Mtest.py.in Branch: default Log Message: Merge with Aug2024 branch. diffs (67 lines): diff --git a/testing/Mtest.py.in b/testing/Mtest.py.in --- a/testing/Mtest.py.in +++ b/testing/Mtest.py.in @@ -1552,7 +1552,10 @@ def coredumpctl(pid): stdout=process.PIPE, stderr=process.PIPE, text=True) as p: -out, err = p.communicate() +try: +out, err = p.communicate(timeout=60) +except process.TimeoutExpired: +p.kill() os.unlink(name) s = [] for l in out.split('\n'): @@ -1702,7 +1705,7 @@ def GetBitsAndModsAndThreads(env) : qErr = proc.stderr.read(timeout=5) try: proc.wait(timeout=5) -except TimeoutExpired: +except process.TimeoutExpired: proc.kill() proc.wait() finally: @@ -2544,13 +2547,19 @@ def stacktrace(proc, outfile): with process.Popen([cdb, '-pv', '-p', str(proc.pid), '-y', f'{sym}cache*;srv*http://msdl.microsoft.com/download/symbols', '-lines', '-c', '~*kP;!locks;q'], stdout=process.PIPE, text=True) as p: -out, err = p.communicate() +try: +out, err = p.communicate(timeout=60) +except process.TimeoutExpired: +p.kill() else: out = '' elif platform.system() == 'Darwin': try: with process.Popen(['lldb', '--attach-pid', str(proc.pid), '--batch', '--one-line', 'bt all'], stdout=process.PIPE, text=True) as p: -out, err = p.communicate() +try: +out, err = p.communicate(timeout=60) +except process.TimeoutExpired: +p.kill() except KeyboardInterrupt: raise except: @@ -2561,7 +2570,7 @@ def stacktrace(proc, outfile): text=True) as p: try: out, err = p.communicate(timeout=60) -except TimeoutExpired: +except process.TimeoutExpired: # gdb sometimes hangs when trying to get the stack # trace: kill it mercilessly if it does p.kill() @@ -2640,9 +2649,9 @@ class ServerClass: self.proc.terminate() try: self.proc.wait(timeout=30) -except TimeoutExpired: +except process.TimeoutExpired: self.proc.kill() -self.wait() +self.proc.wait() self.code = returnCode(self.proc, self.errfile) if self.pollfile is None: self.outfile.write(self.proc.stdout.read()) ___ checkin-list mailing list -- checkin-list@monetdb.org To unsubscribe send an email to checkin-list-le...@monetdb.org
MonetDB: odbc_loader - Correct mapping of ODBC sql types to name...
Changeset: 0865c61f5409 for MonetDB URL: https://dev.monetdb.org/hg/MonetDB/rev/0865c61f5409 Modified Files: sql/backends/monet5/vaults/odbc/odbc_loader.c Branch: odbc_loader Log Message: Correct mapping of ODBC sql types to names expected by sql_bind_subtype(). diffs (164 lines): diff --git a/sql/backends/monet5/vaults/odbc/odbc_loader.c b/sql/backends/monet5/vaults/odbc/odbc_loader.c --- a/sql/backends/monet5/vaults/odbc/odbc_loader.c +++ b/sql/backends/monet5/vaults/odbc/odbc_loader.c @@ -51,11 +51,11 @@ odbc_cleanup(SQLHANDLE env, SQLHANDLE db } } - static sql_subtype * map_rescol_type(SQLSMALLINT dataType, SQLULEN columnSize, SQLSMALLINT decimalDigits, mvc * sql) { char * typenm; + int interval_type = 0; switch (dataType) { case SQL_CHAR: @@ -64,18 +64,25 @@ map_rescol_type(SQLSMALLINT dataType, SQ case SQL_WCHAR: case SQL_WVARCHAR: case SQL_WLONGVARCHAR: - default: + default:/* all other ODBC types are also mapped to varchar for now */ + /* all ODBC char datatypes are mapped to varchar. char and clob are internally not used anymore */ return sql_bind_subtype(sql->sa, "varchar", (int) columnSize, 0); - case SQL_DECIMAL: - case SQL_NUMERIC: - return sql_bind_subtype(sql->sa, "decimal", (int) decimalDigits, 6); - case SQL_BINARY: case SQL_VARBINARY: case SQL_LONGVARBINARY: return sql_bind_subtype(sql->sa, "blob", (int) columnSize, 0); + case SQL_DECIMAL: + case SQL_NUMERIC: + /* columnSize contains the defined number of digits, so precision. */ + /* decimalDigits contains the scale (which can be negative). */ + return sql_bind_subtype(sql->sa, "decimal", (int) columnSize, (int) decimalDigits); + + case SQL_BIT: + typenm = "boolean"; + break; + case SQL_TINYINT: typenm = "tinyint"; break; @@ -83,11 +90,12 @@ map_rescol_type(SQLSMALLINT dataType, SQ typenm = "smallint"; break; case SQL_INTEGER: - typenm = "integer"; + typenm = "int"; break; case SQL_BIGINT: typenm = "bigint"; break; + case SQL_REAL: typenm = "real"; break; @@ -95,65 +103,81 @@ map_rescol_type(SQLSMALLINT dataType, SQ typenm = "double"; break; case SQL_FLOAT: - typenm = "float"; + /* the precision of SQL_FLOAT can be either 24 or 53: if it is 24, the SQL_FLOAT data type is the same as SQL_REAL; if it is 53, the SQL_FLOAT data type is the same as SQL_DOUBLE. */ + typenm = (columnSize == 7) ? "real" : "double"; break; + case SQL_TYPE_DATE: typenm = "date"; break; case SQL_TYPE_TIME: + /* decimalDigits contains the precision of fractions of a second */ typenm = "time"; break; case SQL_TYPE_TIMESTAMP: - typenm = "timeestamp"; + /* decimalDigits contains the precision of fractions of a second */ + typenm = "timestamp"; break; - case SQL_BIT: - typenm = "boolean"; - break; + case SQL_INTERVAL_MONTH: - typenm = "INTERVAL MONTH"; + typenm = "month_interval"; + interval_type = 3; break; case SQL_INTERVAL_YEAR: - typenm = "INTERVAL YEAR"; + typenm = "month_interval"; + interval_type = 1; break; case SQL_INTERVAL_YEAR_TO_MONTH: - typenm = "INTERVAL YEAR TO MONTH"; + typenm = "month_interval"; + interval_type = 2; break; case SQL_INTERVAL_DAY: - typenm = "INTERVAL DAY"; + typenm = "day_interval"; + interval_type = 4; break; case SQL_INTERVAL_HOUR: - typenm = "INTERVAL HOUR"; + typenm = "sec_interval"; + interval_type = 8; break; case SQL_INTERVAL_MINUTE: - typenm = "INTERVAL MINUTE"; + typenm = "sec_interval"; + interval_type = 11; break; case SQL_INTERVAL_SECOND: - typenm = "INTERVAL SECOND"; + typenm = "sec_interval"; + interval_type = 13; break; case SQL_INTERVAL_DAY_TO_HOUR: - typenm = "INTERVAL DAY TO HOUR"; + typenm = "sec_interval"; + interval_type = 5; break; case SQL_INTERVAL_DAY_TO_MINUTE: - typenm = "INTERVAL DAY TO MI
MonetDB: nested - pass input relation
Changeset: 266dd0fc13fc for MonetDB URL: https://dev.monetdb.org/hg/MonetDB/rev/266dd0fc13fc Modified Files: sql/server/rel_multiset.c Branch: nested Log Message: pass input relation diffs (12 lines): diff --git a/sql/server/rel_multiset.c b/sql/server/rel_multiset.c --- a/sql/server/rel_multiset.c +++ b/sql/server/rel_multiset.c @@ -426,7 +426,7 @@ fm_project(visitor *v, sql_rel *rel) } append(fexps, exp_ref(v->sql, e)); } - sql_rel *nrel = rel_project(v->sql->sa, NULL, rel->exps); + sql_rel *nrel = rel_project(v->sql->sa, l, rel->exps); list *tl = append(sa_list(v->sql->sa), exp_subtype(fexps->h->data));//exp_types(v->sql->sa, fexps); list *rl = exp_types(v->sql->sa, nexps); sql_subfunc *msf = sql_bind_func_(v->sql, NULL, "multiset", tl, F_UNION, true, true, false); ___ checkin-list mailing list -- checkin-list@monetdb.org To unsubscribe send an email to checkin-list-le...@monetdb.org
MonetDB: nested - needed to skip the first statement
Changeset: bcd06e710f94 for MonetDB URL: https://dev.monetdb.org/hg/MonetDB/rev/bcd06e710f94 Modified Files: sql/backends/monet5/rel_bin.c sql/backends/monet5/sql.c Branch: nested Log Message: needed to skip the first statement diffs (24 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 @@ -690,7 +690,7 @@ set_value_list(backend *be, sql_exp *val stmt *input = list_fetch(s->op4.lval, i); sql_subtype *type = tail_type(input); list *nl = list_append(sa_list(be->mvc->sa), input); - for (; n; n = n->next) { + for (n = n->next; n; n = n->next) { stmt *s = n->data; stmt *input = list_fetch(s->op4.lval, i); nl = list_append(nl, input); diff --git a/sql/backends/monet5/sql.c b/sql/backends/monet5/sql.c --- a/sql/backends/monet5/sql.c +++ b/sql/backends/monet5/sql.c @@ -6876,7 +6876,7 @@ static mel_func sql_init_funcs[] = { pattern("sql", "check", SQLcheck, false, "Return sql string of check constraint.", args(1,3, arg("sql",str), arg("sname", str), arg("name", str))), pattern("sql", "read_dump_rel", SQLread_dump_rel, false, "Reads sql_rel string into sql_rel object and then writes it to the return value", args(1,2, arg("sql",str), arg("sql_rel", str))), pattern("sql", "from_json", SQLfrom_json, false, "Reads json string into table of nested/multiset structures", args(1,3, batvarargany("t",0), optbatarg("input", json), arg("type", ptr))), - pattern("sql", "from_varchar", SQLfrom_varchar, false, "Reads string into table of nested/multiset structures", args(1,3, batvarargany("t",0), arg("input", str), arg("type", ptr))), + pattern("sql", "from_varchar", SQLfrom_varchar, false, "Reads string into table of nested/multiset structures", args(1,3, batvarargany("t",0), optbatarg("input", str), arg("type", ptr))), { .imp=NULL } }; #include "mal_import.h" ___ checkin-list mailing list -- checkin-list@monetdb.org To unsubscribe send an email to checkin-list-le...@monetdb.org
MonetDB: odbc_loader - Added filling the res_exps.
Changeset: 552c5b45f49c for MonetDB URL: https://dev.monetdb.org/hg/MonetDB/rev/552c5b45f49c Modified Files: sql/backends/monet5/vaults/odbc/odbc_loader.c Branch: odbc_loader Log Message: Added filling the res_exps. For both odbc_relation() and odbc_load() we now call new odbc_query(), which does all the work. diffs (truncated from 316 to 300 lines): diff --git a/sql/backends/monet5/vaults/odbc/odbc_loader.c b/sql/backends/monet5/vaults/odbc/odbc_loader.c --- a/sql/backends/monet5/vaults/odbc/odbc_loader.c +++ b/sql/backends/monet5/vaults/odbc/odbc_loader.c @@ -181,6 +181,53 @@ map_rescol_type(SQLSMALLINT dataType, SQ return sql_bind_subtype(sql->sa, typenm, interval_type, 0); } +static char * +nameofSQLtype(SQLSMALLINT dataType) +{ + /* https://docs.microsoft.com/en-us/sql/odbc/reference/appendixes/sql-data-types */ + switch (dataType) { + case SQL_CHAR: return "CHAR"; + case SQL_VARCHAR: return "VARCHAR"; + case SQL_LONGVARCHAR: return "LONG VARCHAR"; + case SQL_WCHAR: return "WCHAR"; + case SQL_WVARCHAR: return "WVARCHAR"; + case SQL_WLONGVARCHAR: return "WLONGVARCHAR"; + case SQL_DECIMAL: return "DECIMAL"; + case SQL_NUMERIC: return "NUMERIC"; + case SQL_SMALLINT: return "SMALLINT"; + case SQL_INTEGER: return "INTEGER"; + case SQL_REAL: return "REAL"; + case SQL_FLOAT: return "FLOAT"; + case SQL_DOUBLE:return "DOUBLE"; + case SQL_BIT: return "BIT"; + case SQL_TINYINT: return "TINYINT"; + case SQL_BIGINT:return "BIGINT"; + case SQL_BINARY:return "BINARY"; + case SQL_VARBINARY: return "VARBINARY"; + case SQL_LONGVARBINARY: return "LONG VARBINARY"; + case SQL_DATETIME: return "DATETIME"; + case SQL_TYPE_DATE: return "DATE"; + case SQL_TYPE_TIME: return "TIME"; + case SQL_TYPE_TIMESTAMP:return "TIMESTAMP"; + case SQL_INTERVAL_MONTH:return "INTERVAL MONTH"; + case SQL_INTERVAL_YEAR: return "INTERVAL YEAR"; + case SQL_INTERVAL_YEAR_TO_MONTH: return "INTERVAL YEAR TO MONTH"; + case SQL_INTERVAL_DAY: return "INTERVAL DAY"; + case SQL_INTERVAL_HOUR: return "INTERVAL HOUR"; + case SQL_INTERVAL_MINUTE: return "INTERVAL MINUTE"; + case SQL_INTERVAL_SECOND: return "INTERVAL SECOND"; + case SQL_INTERVAL_DAY_TO_HOUR: return "INTERVAL DAY TO HOUR"; + case SQL_INTERVAL_DAY_TO_MINUTE:return "INTERVAL DAY TO MINUTE"; + case SQL_INTERVAL_DAY_TO_SECOND:return "INTERVAL DAY TO SECOND"; + case SQL_INTERVAL_HOUR_TO_MINUTE: return "INTERVAL HOUR TO MINUTE"; + case SQL_INTERVAL_HOUR_TO_SECOND: return "INTERVAL HOUR TO SECOND"; + case SQL_INTERVAL_MINUTE_TO_SECOND: return "INTERVAL MINUTE TO SECOND"; + case SQL_GUID: return "GUID"; +/* case SQL_HUGEINT: return "HUGEINT"; 0x4000 (defined in ODBCGlobal.h) */ + default:return "Driver specific type"; + } +} + /* * returns an error string (static or via tmp sa_allocator allocated), NULL on success * @@ -191,12 +238,12 @@ map_rescol_type(SQLSMALLINT dataType, SQ * Fill the list res_exps, with one result expressions per resulting column. */ static str -odbc_relation(mvc *sql, sql_subfunc *f, char *url, list *res_exps, char *aname) +odbc_query(mvc *sql, sql_subfunc *f, char *url, list *res_exps, sql_exp *topn, int caller) { - (void) res_exps; - (void) aname; - bool trace_enabled = true; + (void) topn; + bool trace_enabled = true; /* used for development only */ + /* check received url and extract the ODBC connection string and yhe SQL query */ if (!url || (url && strncasecmp("odbc:", url, 5) != 0)) return "Invalid URI. Must start with 'odbc:'."; @@ -223,6 +270,8 @@ odbc_relation(mvc *sql, sql_subfunc *f, if (trace_enabled) printf("\nExtracted ODBC connection string: %s\nand SQL query: %s\n", odbc_con_str, query); + + /* now we can try to connect to the ODBC driver and execute the SQL query */ SQLRETURN ret = SQL_INVALID_HANDLE; SQLHANDLE env = SQL_NULL_HENV; SQLHANDLE dbc = SQL_NULL_HDBC; @@ -232,17 +281,17 @@ odbc_relation(mvc *sql, sql_subfunc *f, ret = SQLAllocHandle(SQL_HANDLE_ENV, SQL_NULL_HANDLE, &env); if (ret != SQL_SUCCESS && ret != SQL_SUCCESS_WITH_INFO) { errmsg = "Allocate ODBC ENV handle failed."; - goto failure; + goto finish; } ret = SQLSetEnvAttr(env, SQL_ATTR_ODBC_VERSION, (SQLPOINTER) (uintptr_t) SQL_OV_ODBC3, 0); if (ret != SQL_SUCCESS && ret != SQL_SUCCESS_WITH_INFO) { errmsg = "SQLSetEnvAttr (SQL_ATTR_ODBC