MonetDB: Jul2021 - Merged with Oct2020
Changeset: 672dd9175ddb for MonetDB URL: https://dev.monetdb.org/hg/MonetDB/rev/672dd9175ddb Removed Files: sql/test/BugTracker-2021/Tests/remote-join-idxs.Bug-7165.stable.err sql/test/BugTracker-2021/Tests/remote-join-idxs.Bug-7165.stable.out Modified Files: sql/server/rel_dump.c sql/test/BugTracker-2021/Tests/All Branch: Jul2021 Log Message: Merged with Oct2020 diffs (153 lines): diff --git a/sql/server/rel_dump.c b/sql/server/rel_dump.c --- a/sql/server/rel_dump.c +++ b/sql/server/rel_dump.c @@ -814,12 +814,14 @@ read_prop(mvc *sql, sql_exp *exp, char * (*pos)++; if (r[*pos] != '.') return sql_error(sql, -1, SQLSTATE(42000) "JOINIDX: missing '.'\n"); + (*pos)++; tname = r+*pos + 1; skipIdent(r,pos); convertIdent(tname); (*pos)++; if (r[*pos] != '.') return sql_error(sql, -1, SQLSTATE(42000) "JOINIDX: missing '.'\n"); + (*pos)++; iname = r+*pos + 1; skipIdent(r,pos); convertIdent(iname); diff --git a/sql/test/BugTracker-2021/Tests/All b/sql/test/BugTracker-2021/Tests/All --- a/sql/test/BugTracker-2021/Tests/All +++ b/sql/test/BugTracker-2021/Tests/All @@ -22,3 +22,4 @@ rollup-distinct-count.Bug-7146 sum-union.Bug-7147 distinct-union.Bug-7148 HAVE_LIBPY3?python-aggregates-empty.Bug-7158 +remote-join-idxs.Bug-7165 diff --git a/sql/test/BugTracker-2021/Tests/remote-join-idxs.Bug-7165.py b/sql/test/BugTracker-2021/Tests/remote-join-idxs.Bug-7165.py new file mode 100644 --- /dev/null +++ b/sql/test/BugTracker-2021/Tests/remote-join-idxs.Bug-7165.py @@ -0,0 +1,122 @@ +import sys, os, socket, tempfile, pymonetdb + +try: +from MonetDBtesting import process +except ImportError: +import process + + +# Find a free network port +def freeport(): +sock = socket.socket(socket.AF_INET, socket.SOCK_STREAM) +sock.bind(('', 0)) +port = sock.getsockname()[1] +sock.close() +return port + + +with tempfile.TemporaryDirectory() as farm_dir: +os.mkdir(os.path.join(farm_dir, 'node1')) +os.mkdir(os.path.join(farm_dir, 'node2')) +os.mkdir(os.path.join(farm_dir, 'node3')) + +node1_port = freeport() +with process.server(mapiport=node1_port, dbname='node1', +dbfarm=os.path.join(farm_dir, 'node1'), +stdin=process.PIPE, stdout=process.PIPE, +stderr=process.PIPE) as node1_proc: + +node2_port = freeport() +with process.server(mapiport=node2_port, dbname='node2', +dbfarm=os.path.join(farm_dir, 'node2'), +stdin=process.PIPE, stdout=process.PIPE, +stderr=process.PIPE) as node2_proc: + +node3_port = freeport() +with process.server(mapiport=node3_port, dbname='node3', +dbfarm=os.path.join(farm_dir, 'node3'), +stdin=process.PIPE, stdout=process.PIPE, +stderr=process.PIPE) as node3_proc: + +node1_conn = pymonetdb.connect(database='node1', port=node1_port, autocommit=True) +node1_cur = node1_conn.cursor() +node2_conn = pymonetdb.connect(database='node2', port=node2_port, autocommit=True) +node2_cur = node2_conn.cursor() +node3_conn = pymonetdb.connect(database='node3', port=node3_port, autocommit=True) +node3_cur = node3_conn.cursor() + +# Setup local s1 table +node1_cur.execute("CREATE TABLE s1 (s_pk INT, i INT)") +node1_cur.execute("ALTER TABLE s1 ADD CONSTRAINT s1_pk PRIMARY KEY (s_pk)") +node1_cur.execute("INSERT INTO s1 VALUES (0, 23), (1, 42)") +# Setup local t1 table +node1_cur.execute("CREATE TABLE t1 (t_pk INT, t_fk INT, s VARCHAR(10))") +node1_cur.execute("ALTER TABLE t1 ADD CONSTRAINT t1_pk PRIMARY KEY (t_pk)") +node1_cur.execute("INSERT INTO t1 VALUES (0, 0, 'abc'), (1, 2, 'efg')") + +# Setup local s2 table +node2_cur.execute("CREATE TABLE s2 (s_pk INT, i INT)") +node2_cur.execute("ALTER TABLE s2 ADD CONSTRAINT s2_pk PRIMARY KEY (s_pk)") +node2_cur.execute("INSERT INTO s2 VALUES (2, 100), (3, 77)") +# Setup local t2 table +node2_cur.execute("CREATE TABLE t2 (t_pk INT, t_fk INT, s VARCHAR(10))") +node2_cur.execute("ALTER TABLE t2 ADD CONSTRAINT t2_pk PRIMARY KEY (t_pk)") +node2_cur.execute("INSERT INTO t2 VALUES (2, 3, 'hij'), (3, 1, 'klm')") + +# Setup remote s2 table +node1_cur.execute("CREATE REMOTE TABLE s2 (s_pk INT, i INT) on 'mapi:mo
MonetDB: Jul2021 - Merged with Oct2020
Changeset: d990d63fdffa for MonetDB URL: https://dev.monetdb.org/hg/MonetDB/rev/d990d63fdffa Modified Files: monetdb5/modules/mal/mal_io.c monetdb5/modules/mal/txtsim.c Branch: Jul2021 Log Message: Merged with Oct2020 diffs (12 lines): diff --git a/monetdb5/modules/mal/txtsim.c b/monetdb5/modules/mal/txtsim.c --- a/monetdb5/modules/mal/txtsim.c +++ b/monetdb5/modules/mal/txtsim.c @@ -722,7 +722,7 @@ fstrcmp_impl_internal(dbl *ret, int **fd allocations performed. Thus, we use a static buffer for the diagonal vectors, and never free them. */ fdiag_len = string[0].data_length + string[1].data_length + 3; - CHECK_INT_BUFFER_LENGTH(fdiag_buf, fdiag_buflen, fdiag_len, "txtsim.similarity"); + CHECK_INT_BUFFER_LENGTH(fdiag_buf, fdiag_buflen, fdiag_len * 2 * sizeof(int), "txtsim.similarity"); fdiag = *fdiag_buf + string[1].data_length + 1; bdiag = fdiag + fdiag_len; ___ checkin-list mailing list checkin-list@monetdb.org https://www.monetdb.org/mailman/listinfo/checkin-list
MonetDB: Jul2021 - Merged with Oct2020
Changeset: eb5bbca369b9 for MonetDB URL: https://dev.monetdb.org/hg/MonetDB/rev/eb5bbca369b9 Modified Files: sql/test/Tests/All testing/Mtest.py.in Branch: Jul2021 Log Message: Merged with Oct2020 diffs (21 lines): diff --git a/testing/Mtest.py.in b/testing/Mtest.py.in --- a/testing/Mtest.py.in +++ b/testing/Mtest.py.in @@ -2362,7 +2362,7 @@ def CheckPort(port) : except socket.error as err: Serrno = err.errno Serrstr = err.strerror -S1.close(); +S1.close() host = 'localhost' try: S0.bind((host,port)) @@ -3886,7 +3886,7 @@ def main(argv) : # /var/tmp/mtest and try not to forget to clean that up sockdir = "/var/tmp/mtest-%d" % os.getpid() try: -os.mkdir(sockdir); +os.mkdir(sockdir) SOCK = "--set mapi_usock=%s/.s.monetdb.%s" % \ (sockdir, env['MAPIPORT']) HOST = sockdir ___ checkin-list mailing list checkin-list@monetdb.org https://www.monetdb.org/mailman/listinfo/checkin-list
MonetDB: Jul2021 - Merged with Oct2020 and converted
Changeset: d0f1bd7f686d for MonetDB URL: https://dev.monetdb.org/hg/MonetDB/rev/d0f1bd7f686d Added Files: sql/test/BugTracker-2021/Tests/python-aggregates-empty.Bug-7158.test Removed Files: sql/backends/monet5/Tests/rapi18.sql sql/backends/monet5/UDF/capi/Tests/capi07.sql sql/test/BugTracker-2021/Tests/python-aggregates-empty.Bug-7158.sql sql/test/BugTracker-2021/Tests/python-aggregates-empty.Bug-7158.stable.err sql/test/BugTracker-2021/Tests/python-aggregates-empty.Bug-7158.stable.out Modified Files: monetdb5/extras/rapi/rapi.c sql/backends/monet5/Tests/rapi18.test sql/backends/monet5/UDF/capi/Tests/capi07.test sql/backends/monet5/UDF/capi/capi.c sql/backends/monet5/UDF/pyapi3/pyapi3.c sql/test/BugTracker-2021/Tests/All Branch: Jul2021 Log Message: Merged with Oct2020 and converted diffs (truncated from 312 to 300 lines): diff --git a/monetdb5/extras/rapi/rapi.c b/monetdb5/extras/rapi/rapi.c --- a/monetdb5/extras/rapi/rapi.c +++ b/monetdb5/extras/rapi/rapi.c @@ -543,6 +543,40 @@ static char *RAPIinstalladdons(void) { return NULL; } +static str +empty_return(MalBlkPtr mb, MalStkPtr stk, InstrPtr pci, size_t retcols, oid seqbase) +{ + for (size_t i = 0; i < retcols; i++) { + if (isaBatType(getArgType(mb, pci, i))) { + BAT *b = COLnew(seqbase, getBatType(getArgType(mb, pci, i)), 0, TRANSIENT); + if (!b) { + for (size_t j = 0; j < i; j++) { + if (isaBatType(getArgType(mb, pci, j))) + BBPunfix(*getArgReference_bat(stk, pci, j)); + else + VALclear(&stk->stk[pci->argv[j]]); + } + return createException(MAL, "rapi.eval", SQLSTATE(HY013) MAL_MALLOC_FAIL); + } + *getArgReference_bat(stk, pci, i) = b->batCacheid; + BBPkeepref(b->batCacheid); + } else { // single value return, only for non-grouped aggregations + // return NULL to conform to SQL aggregates + int tpe = getArgType(mb, pci, i); + if (!VALinit(&stk->stk[pci->argv[i]], tpe, ATOMnilptr(tpe))) { + for (size_t j = 0; j < i; j++) { + if (isaBatType(getArgType(mb, pci, j))) + BBPunfix(*getArgReference_bat(stk, pci, j)); + else + VALclear(&stk->stk[pci->argv[j]]); + } + return createException(MAL, "rapi.eval", SQLSTATE(HY013) MAL_MALLOC_FAIL); + } + } + } + return MAL_SUCCEED; +} + static str RAPIeval(Client cntxt, MalBlkPtr mb, MalStkPtr stk, InstrPtr pci, bit grouped) { sql_func * sqlfun = NULL; str exprStr = *getArgReference_str(stk, pci, pci->retc + 1); @@ -656,6 +690,12 @@ static str RAPIeval(Client cntxt, MalBlk msg = createException(MAL, "rapi.eval", SQLSTATE(HY013) MAL_MALLOC_FAIL); goto wrapup; } + if (BATcount(b) == 0) { /* empty input, generate trivial return */ + /* I expect all inputs to have the same size, so this should be safe */ + msg = empty_return(mb, stk, pci, pci->retc, b->hseqbase); + BBPunfix(b->batCacheid); + goto wrapup; + } } // check the BAT count, if it is bigger than RAPI_MAX_TUPLES, fail @@ -780,9 +820,9 @@ static str RAPIeval(Client cntxt, MalBlk } msg = MAL_SUCCEED; } + wrapup: /* unprotect environment, so it will be eaten by the GC. */ UNPROTECT(1); - wrapup: MT_lock_unset(&rapiLock); if (argnames) free(argnames); diff --git a/sql/backends/monet5/Tests/rapi18.test b/sql/backends/monet5/Tests/rapi18.test --- a/sql/backends/monet5/Tests/rapi18.test +++ b/sql/backends/monet5/Tests/rapi18.test @@ -26,5 +26,17 @@ select g, rapi18(n) from rapi18bad group 1000 values hashing to 11dbd9e3e1c8fd598a3eaf93a417a852 statement ok +create table empty_table(col1 int) + +query R rowsort +select rapi18(col1) from empty_table + +NULL + +query R rowsort +select rapi18(col1) from empty_table group by col1 + + +statement ok ROLLBACK diff --git a/sql/backends/monet5/UDF/capi/Tests/capi07.test b/sql/backends/monet5/UDF/capi/Tests/capi07.test --- a/sql/backends/monet
MonetDB: Jul2021 - Merged with Oct2020
Changeset: 38e442e8192c for MonetDB URL: https://dev.monetdb.org/hg/MonetDB/rev/38e442e8192c Branch: Jul2021 Log Message: Merged with Oct2020 diffs (124 lines): diff --git a/misc/python/create_include_object.py.in b/misc/python/create_include_object.py.in --- a/misc/python/create_include_object.py.in +++ b/misc/python/create_include_object.py.in @@ -81,15 +81,13 @@ def mal2c(content): def sql2c(content): comment_or_empty = re.compile('^[ \t]*(--|#|$)') comment = re.compile(r'/\*.*?\*/|--.*') -space = re.compile('[ \t]+') c_array = [] length = 0 for line in content.split('\n'): if comment_or_empty.match(line): continue line = comment.sub('', line) -line = space.sub(' ', line) -line = line.strip() +line = line.rstrip() if line.startswith('include '): continue if not line: @@ -112,7 +110,6 @@ def create_c_sourcefile(srcfile, lang, m def copy2c(content): return ",".join(str(ord(c)) for c in content) + "," - def txt2c(content, sql): buffer = bytearray() @@ -183,7 +180,6 @@ def txt2c(content, sql): #return buffer return buffer_as_string - def main(): parser = argparse.ArgumentParser() parser.add_argument("name", help="The name of the module to convert") diff --git a/sql/scripts/23_skyserver.sql b/sql/scripts/23_skyserver.sql --- a/sql/scripts/23_skyserver.sql +++ b/sql/scripts/23_skyserver.sql @@ -10,15 +10,15 @@ BEGIN DECLARE res varchar(32), aux varchar(32); DECLARE ofset int; -IF ( st < 0 or st > LENGTH(s1)) -THEN RETURN ''; -END IF; + IF ( st < 0 or st > LENGTH(s1)) + THEN RETURN ''; + END IF; -SET ofset = 1; -SET res = SUBSTRING(s1,ofset,st-1); -SET res = res || s3; -SET ofset = st + len; -SET aux = SUBSTRING(s1,ofset,LENGTH(s1)-ofset+1); + SET ofset = 1; + SET res = SUBSTRING(s1,ofset,st-1); + SET res = res || s3; + SET ofset = st + len; + SET aux = SUBSTRING(s1,ofset,LENGTH(s1)-ofset+1); SET res = res || aux; RETURN res; END; @@ -45,7 +45,7 @@ grant execute on function MS_ROUND to pu CREATE FUNCTION MS_STR(num float, prc int, truncat int) RETURNS string BEGIN -RETURN CAST(num as string); + RETURN CAST(num as string); END; grant execute on function MS_STR to public; diff --git a/sql/scripts/81_tracer.sql b/sql/scripts/81_tracer.sql --- a/sql/scripts/81_tracer.sql +++ b/sql/scripts/81_tracer.sql @@ -8,39 +8,39 @@ CREATE SCHEMA logging; -- Flush the buffer CREATE PROCEDURE logging.flush() -EXTERNAL NAME logging.flush; + EXTERNAL NAME logging.flush; -- Sets the log level for a specific component CREATE PROCEDURE logging.setcomplevel(comp_id STRING, lvl_id STRING) -EXTERNAL NAME logging.setcomplevel; + EXTERNAL NAME logging.setcomplevel; -- Resets the log level for a specific component back to the default CREATE PROCEDURE logging.resetcomplevel(comp_id STRING) -EXTERNAL NAME logging.resetcomplevel; + EXTERNAL NAME logging.resetcomplevel; -- Sets the log level for a specific layer CREATE PROCEDURE logging.setlayerlevel(layer_id STRING, lvl_id STRING) -EXTERNAL NAME logging.setlayerlevel; + EXTERNAL NAME logging.setlayerlevel; -- Resets the log level for a specific layer back to the default CREATE PROCEDURE logging.resetlayerlevel(layer_id STRING) -EXTERNAL NAME logging.resetlayerlevel; + EXTERNAL NAME logging.resetlayerlevel; -- Sets the flush level CREATE PROCEDURE logging.setflushlevel(lvl_id STRING) - EXTERNAL NAME logging.setflushlevel; + EXTERNAL NAME logging.setflushlevel; -- Resets the flush level back to the default CREATE PROCEDURE logging.resetflushlevel() - EXTERNAL NAME logging.resetflushlevel; + EXTERNAL NAME logging.resetflushlevel; -- Sets the adapter CREATE PROCEDURE logging.setadapter(adapter_id STRING) - EXTERNAL NAME logging.setadapter; + EXTERNAL NAME logging.setadapter; -- Resets the adapter back to the default CREATE PROCEDURE logging.resetadapter() - EXTERNAL NAME logging.resetadapter; + EXTERNAL NAME logging.resetadapter; -- Returns in the form of a SQL result-set all the -- components along with their ID and their current ___ checkin-list mailing list checkin-list@monetdb.org https://www.monetdb.org/mailman/listinfo/checkin-list
MonetDB: Jul2021 - Merged with Oct2020 and converted tests
Changeset: f7bea632f54b for MonetDB URL: https://dev.monetdb.org/hg/MonetDB/rev/f7bea632f54b Added Files: sql/test/BugTracker-2021/Tests/distinct-union.Bug-7148.test sql/test/BugTracker-2021/Tests/sum-union.Bug-7147.test Removed Files: sql/test/BugTracker-2021/Tests/distinct-union.Bug-7148.sql sql/test/BugTracker-2021/Tests/distinct-union.Bug-7148.stable.err sql/test/BugTracker-2021/Tests/distinct-union.Bug-7148.stable.out sql/test/BugTracker-2021/Tests/sum-union.Bug-7147.sql sql/test/BugTracker-2021/Tests/sum-union.Bug-7147.stable.err sql/test/BugTracker-2021/Tests/sum-union.Bug-7147.stable.out Modified Files: sql/server/rel_rel.c sql/server/rel_unnest.c sql/test/BugTracker-2021/Tests/All Branch: Jul2021 Log Message: Merged with Oct2020 and converted tests diffs (truncated from 482 to 300 lines): diff --git a/sql/server/rel_rel.c b/sql/server/rel_rel.c --- a/sql/server/rel_rel.c +++ b/sql/server/rel_rel.c @@ -467,7 +467,7 @@ rel_setop(sql_allocator *sa, sql_rel *l, rel->r = r; rel->op = setop; rel->exps = NULL; - rel->card = is_union(setop) ? CARD_MULTI : l->card; + rel->card = CARD_MULTI; assert(l->nrcols == r->nrcols); rel->nrcols = l->nrcols; return rel; @@ -521,9 +521,8 @@ rel_setop_set_exps(mvc *sql, sql_rel *re else set_has_no_nil(e); e->p = NULL; /* remove all the properties on unions */ - e->card = MAX(f->card, g->card); - } else - e->card = f->card; + } + e->card = CARD_MULTI; /* multi cardinality */ } rel->nrcols = l->nrcols; rel->exps = exps; diff --git a/sql/server/rel_unnest.c b/sql/server/rel_unnest.c --- a/sql/server/rel_unnest.c +++ b/sql/server/rel_unnest.c @@ -1913,10 +1913,7 @@ exp_reset_card_and_freevar_set_physical_ case op_full: case op_semi: case op_anti: - case op_project: - case op_union: - case op_inter: - case op_except: { + case op_project: { switch(e->type) { case e_aggr: case e_func: { @@ -1956,6 +1953,11 @@ exp_reset_card_and_freevar_set_physical_ break; } } break; + case op_inter: + case op_except: + case op_union: { + e->card = CARD_MULTI; + } break; case op_groupby: { switch(e->type) { case e_aggr: @@ -1979,7 +1981,7 @@ exp_reset_card_and_freevar_set_physical_ } if (is_simple_project(rel->op) && need_distinct(rel)) /* Need distinct, all expressions should have CARD_AGGR at max */ e->card = MIN(e->card, CARD_AGGR); - if (!is_groupby(rel->op) || !list_empty(rel->r)) /* global groupings have atomic cardinality */ + if (!is_set(rel->op) && (!is_groupby(rel->op) || !list_empty(rel->r))) /* global groupings have atomic cardinality */ rel->card = MAX(e->card, rel->card); /* the relation cardinality may get updated too */ return e; } diff --git a/sql/test/BugTracker-2021/Tests/All b/sql/test/BugTracker-2021/Tests/All --- a/sql/test/BugTracker-2021/Tests/All +++ b/sql/test/BugTracker-2021/Tests/All @@ -19,3 +19,5 @@ count-distinct.Bug-7141 HAVE_LIBPY3?aggregates-tables.Bug-7142 type-upcasting-INT2BIGINT.Bug-7144 rollup-distinct-count.Bug-7146 +sum-union.Bug-7147 +distinct-union.Bug-7148 diff --git a/sql/test/BugTracker-2021/Tests/distinct-union.Bug-7148.test b/sql/test/BugTracker-2021/Tests/distinct-union.Bug-7148.test new file mode 100644 --- /dev/null +++ b/sql/test/BugTracker-2021/Tests/distinct-union.Bug-7148.test @@ -0,0 +1,298 @@ +query TI rowsort +select +distinct c1, c2 +from ( +select 'A' c0, 'a' c1, 1 c2 +union all select 'A', 'a', 2 +union all select 'A', 'b', 3 +union all select 'B', 'a', 4 +union all select 'B', 'b', 5 +union all select 'C', 'c', 6 +union all select 'C', 'a', 7 +union all select 'C', 'b', 8 +union all select 'C', 'c', 9 +union all select 'D', 'd', 0 +union all select 'F', 'a', 1 +union all select 'F', 'b', 2 +union all select 'E', 'c', 3 +union all select 'G', 'd', 4 +union all select 'G', 'e', 5 +union all select 'G', 'a', 6 +union all select 'G', 'b', 7 +union all select 'H', 'c', 8 +union all select 'A', 'd', 9 +union all select 'B', 'e', 0 +) T + +a +1 +a +2 +a +4 +a +6 +a +7 +b +2 +b +3 +b +5 +b +7 +b +8 +c +3 +c +6 +c +8 +c +9 +d +0 +d +4 +d +9 +e +0 +e +5 + +query TI rowsort +select +c1, c2 +from ( +select 'A' c0, 'a' c1, 1 c2 +union all select 'A', 'a', 2 +union all select 'A', 'b', 3 +union all select 'B', 'a', 4 +union all select 'B', 'b', 5 +union all select 'C', 'c', 6 +union all select 'C', 'a', 7 +union all select 'C', 'b', 8 +union all select 'C', 'c', 9 +union all select 'D', 'd', 0 +union all se
MonetDB: Jul2021 - Merged with Oct2020 and converted
Changeset: 5a7b7826c91e for MonetDB URL: https://dev.monetdb.org/hg/MonetDB/rev/5a7b7826c91e Added Files: sql/test/BugTracker-2021/Tests/rollup-distinct-count.Bug-7146.test Removed Files: sql/test/BugTracker-2021/Tests/rollup-distinct-count.Bug-7146.sql sql/test/BugTracker-2021/Tests/rollup-distinct-count.Bug-7146.stable.err sql/test/BugTracker-2021/Tests/rollup-distinct-count.Bug-7146.stable.out Modified Files: sql/server/rel_unnest.c sql/test/BugTracker-2021/Tests/All Branch: Jul2021 Log Message: Merged with Oct2020 and converted diffs (149 lines): diff --git a/sql/server/rel_unnest.c b/sql/server/rel_unnest.c --- a/sql/server/rel_unnest.c +++ b/sql/server/rel_unnest.c @@ -3451,8 +3451,9 @@ rewrite_groupings(visitor *v, sql_rel *r if (exp_name(e)) exp_prop_alias(v->sql->sa, ne, e); } else { - ne = exp_ref(v->sql, e); - append(exps, e); + sql_exp *ec = exp_copy(v->sql, e); + ne = exp_ref(v->sql, ec); + append(exps, ec); } append(pexps, ne); } diff --git a/sql/test/BugTracker-2021/Tests/All b/sql/test/BugTracker-2021/Tests/All --- a/sql/test/BugTracker-2021/Tests/All +++ b/sql/test/BugTracker-2021/Tests/All @@ -18,3 +18,4 @@ HAVE_LIBPY3?python-aggregates-void-bat.B count-distinct.Bug-7141 HAVE_LIBPY3?aggregates-tables.Bug-7142 type-upcasting-INT2BIGINT.Bug-7144 +rollup-distinct-count.Bug-7146 diff --git a/sql/test/BugTracker-2021/Tests/rollup-distinct-count.Bug-7146.test b/sql/test/BugTracker-2021/Tests/rollup-distinct-count.Bug-7146.test new file mode 100644 --- /dev/null +++ b/sql/test/BugTracker-2021/Tests/rollup-distinct-count.Bug-7146.test @@ -0,0 +1,121 @@ +query I rowsort +select count(distinct b) from ( +select 'a' b, 'A' c +union all select 'b', 'C' +) T group by rollup(c) + +1 +1 +2 + +query TI rowsort +select c, count(distinct b) from ( +select 1 a, 'a' b, 'A' c +union all select 2, 'b', 'C' +union all select 3, 'c', 'C' +union all select 4, 'a', 'A' +union all select 5, 'c', 'B' +union all select 6, 'd', 'A' +union all select 7, 'a', 'B' +union all select 8, 'b', 'D' +union all select 9, null, 'D' +) T +group by rollup(c) + +A +2 +B +2 +C +2 +D +1 +NULL +4 + +query TI rowsort +select c, count(b) from ( +select 1 a, 'a' b, 'A' c +union all select 2, 'b', 'C' +union all select 3, 'c', 'C' +union all select 4, 'a', 'A' +union all select 5, 'c', 'B' +union all select 6, 'd', 'A' +union all select 7, 'a', 'B' +union all select 8, 'b', 'D' +union all select 9, null, 'D' +) T +group by rollup(c) + +A +3 +B +2 +C +2 +D +1 +NULL +8 + +query I rowsort +select count(distinct b) from ( +select 'a' b, 'A' c +union all select 'b', 'C' +) T group by cube(c) + +1 +1 +2 + +query TI rowsort +select c, count(distinct b) from ( +select 1 a, 'a' b, 'A' c +union all select 2, 'b', 'C' +union all select 3, 'c', 'C' +union all select 4, 'a', 'A' +union all select 5, 'c', 'B' +union all select 6, 'd', 'A' +union all select 7, 'a', 'B' +union all select 8, 'b', 'D' +union all select 9, null, 'D' +) T +group by cube(c) + +A +2 +B +2 +C +2 +D +1 +NULL +4 + +query TI rowsort +select c, count(b) from ( +select 1 a, 'a' b, 'A' c +union all select 2, 'b', 'C' +union all select 3, 'c', 'C' +union all select 4, 'a', 'A' +union all select 5, 'c', 'B' +union all select 6, 'd', 'A' +union all select 7, 'a', 'B' +union all select 8, 'b', 'D' +union all select 9, null, 'D' +) T +group by cube(c) + +A +3 +B +2 +C +2 +D +1 +NULL +8 + + ___ checkin-list mailing list checkin-list@monetdb.org https://www.monetdb.org/mailman/listinfo/checkin-list
MonetDB: Jul2021 - Merged with Oct2020
Changeset: 30aef2cf7fed for MonetDB URL: https://dev.monetdb.org/hg/MonetDB/rev/30aef2cf7fed Removed Files: sql/test/BugTracker-2021/Tests/type-upcasting-INT2BIGINT.Bug-7144.sql sql/test/BugTracker-2021/Tests/type-upcasting-INT2BIGINT.Bug-7144.stable.err sql/test/BugTracker-2021/Tests/type-upcasting-INT2BIGINT.Bug-7144.stable.out Modified Files: monetdb5/optimizer/opt_mergetable.c sql/server/rel_exp.c sql/server/rel_exp.h sql/server/rel_select.c sql/server/rel_updates.c sql/server/sql_parser.y sql/test/BugTracker-2021/Tests/All sql/test/BugTracker-2021/Tests/type-upcasting-INT2BIGINT.Bug-7144.test Branch: Jul2021 Log Message: Merged with Oct2020 diffs (166 lines): diff --git a/monetdb5/optimizer/opt_mergetable.c b/monetdb5/optimizer/opt_mergetable.c --- a/monetdb5/optimizer/opt_mergetable.c +++ b/monetdb5/optimizer/opt_mergetable.c @@ -177,9 +177,9 @@ static int checksize(matlist_t *ml, int v) { if (v >= ml->vsize) { - int sz = ml->vsize, i, nvsize, *nhorigin, *ntorigin, *nvars; + int sz = ml->vsize, i, *nhorigin, *ntorigin, *nvars; - nvsize = ml->vsize * 2; + unsigned int nvsize = ml->vsize * 2; nhorigin = (int*) GDKrealloc(ml->horigin, sizeof(int)* nvsize); ntorigin = (int*) GDKrealloc(ml->torigin, sizeof(int)* nvsize); nvars = (int*) GDKrealloc(ml->vars, sizeof(int)* nvsize); 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 @@ -2894,6 +2894,38 @@ exp_aggr_is_count(sql_exp *e) return 0; } +list * +check_distinct_exp_names(mvc *sql, list *exps) +{ + list *distinct_exps = NULL; + bool duplicates = false; + + if (list_length(exps) < 2) { + return exps; /* always true */ + } else if (list_length(exps) < 5) { + distinct_exps = list_distinct(exps, (fcmp) exp_equal, (fdup) NULL); + } else { /* for longer lists, use hashing */ + sql_hash *ht = hash_new(sql->ta, list_length(exps), (fkeyvalue)&exp_key); + + for (node *n = exps->h; n && !duplicates; n = n->next) { + sql_exp *e = n->data; + int key = ht->key(e); + sql_hash_e *he = ht->buckets[key&(ht->size-1)]; + + for (; he && !duplicates; he = he->chain) { + sql_exp *f = he->value; + + if (!exp_equal(e, f)) + duplicates = true; + } + hash_add(ht, key, e); + } + } + if ((distinct_exps && list_length(distinct_exps) != list_length(exps)) || duplicates) + return NULL; + return exps; +} + void exps_reset_freevar(list *exps) { diff --git a/sql/server/rel_exp.h b/sql/server/rel_exp.h --- a/sql/server/rel_exp.h +++ b/sql/server/rel_exp.h @@ -196,7 +196,7 @@ extern atom *exp_flatten(mvc *sql, sql_e extern void exp_sum_scales(sql_subfunc *f, sql_exp *l, sql_exp *r); extern int exp_aggr_is_count(sql_exp *e); - +extern list *check_distinct_exp_names(mvc *sql, list *exps); extern void exps_reset_freevar(list *exps); extern sql_exp *exp_check_type(mvc *sql, sql_subtype *t, sql_rel *rel, sql_exp *exp, check_type tpe); 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 @@ -5321,36 +5321,6 @@ exp_key(sql_exp *e) } static list * -check_distinct_exp_names(mvc *sql, list *exps) -{ - list *distinct_exps = NULL; - bool duplicates = false; - - if (list_length(exps) < 5) { - distinct_exps = list_distinct(exps, (fcmp) exp_equal, (fdup) NULL); - } else { /* for longer lists, use hashing */ - sql_hash *ht = hash_new(sql->ta, list_length(exps), (fkeyvalue)&exp_key); - - for (node *n = exps->h; n && !duplicates; n = n->next) { - sql_exp *e = n->data; - int key = ht->key(e); - sql_hash_e *he = ht->buckets[key&(ht->size-1)]; - - for (; he && !duplicates; he = he->chain) { - sql_exp *f = he->value; - - if (!exp_equal(e, f)) - duplicates = true; - } - hash_add(ht, key, e); - } - } - if ((distinct_exps && list_length(distinct_exps) != list_length(exps)) || duplicates) - return NULL; - return exps; -} - -static list * group_merge_exps(mvc *sql, list *gexps, list *exps) { int nexps = list_length(gexps) + list_length(exps); diff --git a/sql/server/rel_updates.c b/sql/server/rel_updates.c --- a/sql/server/rel_updates.c +++ b/sql/s
MonetDB: Jul2021 - Merged with Oct2020 and converted tests
Changeset: d80ba61b8b4e for MonetDB URL: https://dev.monetdb.org/hg/MonetDB/rev/d80ba61b8b4e Added Files: sql/test/BugTracker-2021/Tests/aggregates-tables.Bug-7142.test sql/test/BugTracker-2021/Tests/count-distinct.Bug-7141.test Removed Files: sql/test/BugTracker-2021/Tests/aggregates-tables.Bug-7142.sql sql/test/BugTracker-2021/Tests/aggregates-tables.Bug-7142.stable.err sql/test/BugTracker-2021/Tests/aggregates-tables.Bug-7142.stable.out sql/test/BugTracker-2021/Tests/count-distinct.Bug-7141.sql sql/test/BugTracker-2021/Tests/count-distinct.Bug-7141.stable.err sql/test/BugTracker-2021/Tests/count-distinct.Bug-7141.stable.out Modified Files: sql/server/rel_optimizer.c sql/server/rel_psm.c sql/test/BugTracker-2021/Tests/All Branch: Jul2021 Log Message: Merged with Oct2020 and converted tests diffs (131 lines): diff --git a/sql/server/rel_psm.c b/sql/server/rel_psm.c --- a/sql/server/rel_psm.c +++ b/sql/server/rel_psm.c @@ -818,11 +818,15 @@ rel_create_func(sql_query *query, dlist int instantiate = (sql->emode == m_instantiate); int deps = (sql->emode == m_deps); int create = (!instantiate && !deps); - bit vararg = FALSE; + bit vararg = FALSE, union_err = 0; char *F = NULL, *fn = NULL, is_func; - if (res && res->token == SQL_TABLE) - type = F_UNION; + if (res && res->token == SQL_TABLE) { + if (type == F_FUNC) + type = F_UNION; + else + union_err = 1; + } FUNC_TYPE_STR(type, F, fn) @@ -832,7 +836,9 @@ rel_create_func(sql_query *query, dlist if (create && store_readonly(sql->session->tr->store)) return sql_error(sql, 06, SQLSTATE(42000) "Schema statements cannot be executed on a readonly database."); - if (res && type == F_PROC) + if (union_err) + return sql_error(sql, 02, SQLSTATE(42000) "CREATE %s: %ss cannot return tables", F, fn); + else if (res && type == F_PROC) return sql_error(sql, 02, SQLSTATE(42000) "CREATE %s: procedures cannot have return parameters", F); else if (res && (type == F_FILT || type == F_LOADER)) return sql_error(sql, 02, SQLSTATE(42000) "CREATE %s: %s functions don't have to specify a return type", F, fn); diff --git a/sql/test/BugTracker-2021/Tests/All b/sql/test/BugTracker-2021/Tests/All --- a/sql/test/BugTracker-2021/Tests/All +++ b/sql/test/BugTracker-2021/Tests/All @@ -15,3 +15,5 @@ WITH-alias-DELETE-1.deletes-wrong-tuples WITH-alias-DELETE-2.deletes-too-many-tuples.Bug-7133 merge-delete.Bug-7136 HAVE_LIBPY3?python-aggregates-void-bat.Bug-7138 +count-distinct.Bug-7141 +HAVE_LIBPY3?aggregates-tables.Bug-7142 diff --git a/sql/test/BugTracker-2021/Tests/aggregates-tables.Bug-7142.test b/sql/test/BugTracker-2021/Tests/aggregates-tables.Bug-7142.test new file mode 100644 --- /dev/null +++ b/sql/test/BugTracker-2021/Tests/aggregates-tables.Bug-7142.test @@ -0,0 +1,34 @@ +statement ok +START TRANSACTION + +statement error 42000!CREATE AGGREGATE: aggregates cannot return tables +CREATE AGGREGATE linear_least_squares(xg DOUBLE, yg DOUBLE) +RETURNS TABLE (a DOUBLE, b DOUBLE) +LANGUAGE PYTHON { +import numpy as np +# Define an inner function to do the work +def perform_least_squares(x, y): +mx = np.average(x) +my = np.average(y) +N = len(x) +a = (np.dot(x,y) - mx*my)/(np.dot(x,x) - N*mx*mx) +b = (my*np.dot(x,x) - mx*(np.dot(x,y)))/(np.dot(x,x) - N*mx*mx) +return [a, b] +ab = {"a": list(), "b": list()} +try: +groups = np.unique(aggr_group) +for i in range(groups): +a,b = perform_least_squares(xg[aggr_group==groups[i]], yg[aggr_group==groups[i]]) +ab["a"].append(a) +ab["b"].append(b) +except NameError: +a,b = perform_least_squares(xg, yg) +ab["a"].append(a) +ab["b"].append(b) +return ab +} + +statement ok +ROLLBACK + + diff --git a/sql/test/BugTracker-2021/Tests/count-distinct.Bug-7141.test b/sql/test/BugTracker-2021/Tests/count-distinct.Bug-7141.test new file mode 100644 --- /dev/null +++ b/sql/test/BugTracker-2021/Tests/count-distinct.Bug-7141.test @@ -0,0 +1,45 @@ +statement ok +START TRANSACTION + +statement ok +create table test ("id" int, "version" int) + +statement ok rowcount 9 +insert into test values(1,1),(1,1),(1,2),(1,2),(2,1),(2,2),(2,2),(3,4),(3,4) + +query I rowsort +SELECT COUNT(distinct "version") FROM test GROUP BY "id", "version" + +1 +1 +1 +1 +1 + +query III rowsort +SELECT "id", "version", COUNT(distinct "version") FROM test GROUP BY "id", "version" + +1 +1 +1 +1 +2 +1 +2 +1 +1 +2 +2 +1 +3 +4 +1 + +query III rowsort +SELECT "id", "version", COUNT(distinct "version") FROM test GROUP BY "id", "version" HAVING COUNT(distinct "version") > 1 + + +statemen
MonetDB: Jul2021 - Merged with Oct2020
Changeset: 5beaf2d4d3cb for MonetDB URL: https://dev.monetdb.org/hg/MonetDB/rev/5beaf2d4d3cb Modified Files: gdk/gdk_logger.c Branch: Jul2021 Log Message: Merged with Oct2020 diffs (125 lines): diff --git a/clients/mapilib/monetdb-mapi.pc.in b/clients/mapilib/monetdb-mapi.pc.in --- a/clients/mapilib/monetdb-mapi.pc.in +++ b/clients/mapilib/monetdb-mapi.pc.in @@ -4,11 +4,15 @@ # # Copyright 1997 - July 2008 CWI, August 2008 - 2021 MonetDB B.V. +prefix=@CMAKE_INSTALL_PREFIX@ +libdir=@CMAKE_INSTALL_FULL_LIBDIR@ +includedir=@CMAKE_INSTALL_FULL_INCLUDEDIR@ + Name: monetdb-mapi Description: MonetDB MAPI C-client libary URL: https://www.monetdb.org/ Version: @MONETDB_VERSION@ Requires.private: monetdb-stream = @MONETDB_VERSION@ openssl -Libs: -L@CMAKE_INSTALL_FULL_LIBDIR@ -lmapi -Cflags: -I@CMAKE_INSTALL_FULL_INCLUDEDIR@/monetdb +Libs: -L${libdir} -lmapi +Cflags: -I${includedir}/monetdb diff --git a/common/stream/monetdb-stream.pc.in b/common/stream/monetdb-stream.pc.in --- a/common/stream/monetdb-stream.pc.in +++ b/common/stream/monetdb-stream.pc.in @@ -4,12 +4,16 @@ # # Copyright 1997 - July 2008 CWI, August 2008 - 2021 MonetDB B.V. +prefix=@CMAKE_INSTALL_PREFIX@ +libdir=@CMAKE_INSTALL_FULL_LIBDIR@ +includedir=@CMAKE_INSTALL_FULL_INCLUDEDIR@ + Name: monetdb-stream Description: MonetDB streams libary URL: https://www.monetdb.org/ Version: @MONETDB_VERSION@ Requires.private: @PKG_ZLIB@ @PKG_BZIP2@ @PKG_CURL@ @PKG_LZMA@ @PKG_SNAPPY@ -Libs: -L@CMAKE_INSTALL_FULL_LIBDIR@ -lstream +Libs: -L${libdir} -lstream Libs.private: @SOCKET_LIBS@ @PKG_LIBICONV@ -Cflags: -I@CMAKE_INSTALL_FULL_INCLUDEDIR@/monetdb +Cflags: -I${includedir}/monetdb diff --git a/gdk/monetdb-gdk.pc.in b/gdk/monetdb-gdk.pc.in --- a/gdk/monetdb-gdk.pc.in +++ b/gdk/monetdb-gdk.pc.in @@ -4,12 +4,16 @@ # # Copyright 1997 - July 2008 CWI, August 2008 - 2021 MonetDB B.V. +prefix=@CMAKE_INSTALL_PREFIX@ +libdir=@CMAKE_INSTALL_FULL_LIBDIR@ +includedir=@CMAKE_INSTALL_FULL_INCLUDEDIR@ + Name: monetdb-gdk Description: MonetDB GDK libary URL: https://www.monetdb.org/ Version: @MONETDB_VERSION@ Requires.private: monetdb-stream = @MONETDB_VERSION@ -Libs: -L@CMAKE_INSTALL_FULL_LIBDIR@ -lbat +Libs: -L${libdir} -lbat Libs.private: -lm @CMAKE_THREAD_LIBS_INIT@ -l@CMAKE_DL_LIBS@ -Cflags: -I@CMAKE_INSTALL_FULL_INCLUDEDIR@/monetdb +Cflags: -I${includedir}/monetdb diff --git a/monetdb5/mal/CMakeLists.txt b/monetdb5/mal/CMakeLists.txt --- a/monetdb5/mal/CMakeLists.txt +++ b/monetdb5/mal/CMakeLists.txt @@ -12,10 +12,14 @@ set(mal_public_headers ${CMAKE_CURRENT_SOURCE_DIR}/mal_client.h ${CMAKE_CURRENT_SOURCE_DIR}/mal_errors.h ${CMAKE_CURRENT_SOURCE_DIR}/mal_exception.h + ${CMAKE_CURRENT_SOURCE_DIR}/mal_function.h ${CMAKE_CURRENT_SOURCE_DIR}/mal_import.h ${CMAKE_CURRENT_SOURCE_DIR}/mal_instruction.h ${CMAKE_CURRENT_SOURCE_DIR}/mal_linker.h + ${CMAKE_CURRENT_SOURCE_DIR}/mal_listing.h + ${CMAKE_CURRENT_SOURCE_DIR}/mal_module.h ${CMAKE_CURRENT_SOURCE_DIR}/mal_namespace.h + ${CMAKE_CURRENT_SOURCE_DIR}/mal_resolve.h ${CMAKE_CURRENT_SOURCE_DIR}/mal_stack.h ${CMAKE_CURRENT_SOURCE_DIR}/mal_type.h ${CMAKE_CURRENT_SOURCE_DIR}/mal_prelude.h diff --git a/monetdb5/tools/monetdb5.pc.in b/monetdb5/tools/monetdb5.pc.in --- a/monetdb5/tools/monetdb5.pc.in +++ b/monetdb5/tools/monetdb5.pc.in @@ -4,11 +4,15 @@ # # Copyright 1997 - July 2008 CWI, August 2008 - 2021 MonetDB B.V. +prefix=@CMAKE_INSTALL_PREFIX@ +libdir=@CMAKE_INSTALL_FULL_LIBDIR@ +includedir=@CMAKE_INSTALL_FULL_INCLUDEDIR@ + Name: monetdb5 Description: MonetDB5 URL: https://www.monetdb.org/ Version: @MONETDB_VERSION@ Requires.private: monetdb-gdk = @MONETDB_VERSION@ monetdb-stream = @MONETDB_VERSION@ @PKG_LIBXML2@ @PKG_CRYPTO@ @PKG_PCRE@ -Libs: -L@CMAKE_INSTALL_FULL_LIBDIR@ -lmonetdb5 -Cflags: -I@CMAKE_INSTALL_FULL_INCLUDEDIR@/monetdb +Libs: -L${libdir} -lmonetdb5 +Cflags: -I${includedir}/monetdb diff --git a/tools/monetdbe/monetdbe.pc.in b/tools/monetdbe/monetdbe.pc.in --- a/tools/monetdbe/monetdbe.pc.in +++ b/tools/monetdbe/monetdbe.pc.in @@ -4,11 +4,15 @@ # # Copyright 1997 - July 2008 CWI, August 2008 - 2021 MonetDB B.V. +prefix=@CMAKE_INSTALL_PREFIX@ +libdir=@CMAKE_INSTALL_FULL_LIBDIR@ +includedir=@CMAKE_INSTALL_FULL_INCLUDEDIR@ + Name: monetdbe Description: MonetDB as embedded library URL: https://www.monetdb.org/ Version: @MONETDB_VERSION@ Requires.private: monetdb-gdk = @MONETDB_VERSION@ -Libs: -L@CMAKE_INSTALL_FULL_LIBDIR@ -lmonetdbe -Cflags: -I@CMAKE_INSTALL_FULL_INCLUDEDIR@/monetdb +Libs: -L${libdir} -lmonetdbe +Cflags: -I${includedir}/monetdb ___ checkin-list mailing list checkin-list@monetdb.org https://www.monetdb.org/mailman/listinfo/checkin-list
MonetDB: Jul2021 - Merged with Oct2020
Changeset: 16a3c6f572fa for MonetDB URL: https://dev.monetdb.org/hg/MonetDB/rev/16a3c6f572fa Removed Files: sql/test/mergetables/Tests/mergetable_rel_push_aggr_down.sql Modified Files: sql/server/rel_optimizer.c sql/test/mergetables/Tests/mergetable_rel_push_aggr_down.test Branch: Jul2021 Log Message: Merged with Oct2020 diffs (38 lines): diff --git a/sql/test/mergetables/Tests/mergetable_rel_push_aggr_down.test b/sql/test/mergetables/Tests/mergetable_rel_push_aggr_down.test --- a/sql/test/mergetables/Tests/mergetable_rel_push_aggr_down.test +++ b/sql/test/mergetables/Tests/mergetable_rel_push_aggr_down.test @@ -69,5 +69,34 @@ select count(*) FROM ( 0 statement ok +create merge table merge_table (mcol1 int, mcol2 int, mcol3 int) + +statement ok +create table child1 (mcol1 int, mcol2 int, mcol3 int) + +statement ok rowcount 1 +insert into child1 values (1,1,1) + +statement ok +create table child2 (mcol1 int, mcol2 int, mcol3 int) + +statement ok rowcount 1 +insert into child2 values (2,2,2) + +statement ok +alter table merge_table add table child1 + +statement ok +alter table merge_table add table child2 + +query II nosort +select cast(sum(mcol1) as bigint), cast(sum(mcol2) as bigint) from merge_table group by mcol1, mcol2, mcol3 order by mcol1 limit 2 + +1 +1 +2 +2 + +statement ok rollback ___ checkin-list mailing list checkin-list@monetdb.org https://www.monetdb.org/mailman/listinfo/checkin-list
MonetDB: Jul2021 - Merged with Oct2020 and converted
Changeset: 309c27f88d09 for MonetDB URL: https://dev.monetdb.org/hg/MonetDB/rev/309c27f88d09 Added Files: sql/test/BugTracker-2021/Tests/python-aggregates-void-bat.Bug-7138.test Removed Files: sql/test/BugTracker-2021/Tests/python-aggregates-void-bat.Bug-7138.sql sql/test/BugTracker-2021/Tests/python-aggregates-void-bat.Bug-7138.stable.err sql/test/BugTracker-2021/Tests/python-aggregates-void-bat.Bug-7138.stable.out Modified Files: sql/backends/monet5/UDF/pyapi3/pyapi3.c sql/test/BugTracker-2021/Tests/All Branch: Jul2021 Log Message: Merged with Oct2020 and converted diffs (157 lines): diff --git a/sql/backends/monet5/UDF/pyapi3/pyapi3.c b/sql/backends/monet5/UDF/pyapi3/pyapi3.c --- a/sql/backends/monet5/UDF/pyapi3/pyapi3.c +++ b/sql/backends/monet5/UDF/pyapi3/pyapi3.c @@ -122,11 +122,19 @@ PYAPI3PyAPIevalAggrMap(Client cntxt, Mal } \ /*iterate over the elements of the current BAT*/ \ temp_indices = GDKzalloc(sizeof(lng) * group_count); \ - for (element_it = 0; element_it < elements; element_it++) { \ - /*group of current element*/ \ - oid group = aggr_group_arr[element_it]; \ - /*append current element to proper group*/ \ - ptr[group][i][temp_indices[group]++] = batcontent[element_it]; \ + if (BATtvoid(aggr_group)) { \ + for (element_it = 0; element_it < elements; element_it++) {\ + /*append current element to proper group*/ \ + ptr[element_it][i][temp_indices[element_it]++] = \ + batcontent[element_it]; \ + } \ + } else { \ + for (element_it = 0; element_it < elements; element_it++) {\ + /*group of current element*/ \ + oid group = aggr_group_arr[element_it]; \ + /*append current element to proper group*/ \ + ptr[group][i][temp_indices[group]++] = batcontent[element_it]; \ + } \ } \ GDKfree(temp_indices); \ } @@ -736,9 +744,15 @@ static str PyAPIeval(Client cntxt, MalBl goto aggrwrapup; } - aggr_group_arr = (oid *)aggr_group->theap->base + aggr_group->tbaseoff; - for (element_it = 0; element_it < elements; element_it++) { - group_counts[aggr_group_arr[element_it]]++; + if (BATtvoid(aggr_group)) { + for (element_it = 0; element_it < elements; element_it++) { + group_counts[element_it]++; + } + } else { + aggr_group_arr = (oid *)aggr_group->theap->base + aggr_group->tbaseoff; + for (element_it = 0; element_it < elements; element_it++) { + group_counts[aggr_group_arr[element_it]]++; + } } // now perform the actual splitting of the data, first construct @@ -807,13 +821,22 @@ static str PyAPIeval(Client cntxt, MalBl // iterate over the elements of the current BAT temp_indices = GDKzalloc(sizeof(PyObject *) * group_count); - for (element_it = 0; element_it < elements; -element_it++) { - // group of current element - oid group = aggr_group_arr[element_it]; - // append current eleme
MonetDB: Jul2021 - Merged with Oct2020
Changeset: 386371c4359f for MonetDB URL: https://dev.monetdb.org/hg/MonetDB/rev/386371c4359f Modified Files: monetdb5/mal/mal_interpreter.c monetdb5/mal/mal_runtime.c sql/server/rel_exp.c sql/server/rel_optimizer.c sql/server/rel_propagate.c Branch: Jul2021 Log Message: Merged with Oct2020 diffs (61 lines): diff --git a/monetdb5/mal/mal_interpreter.c b/monetdb5/mal/mal_interpreter.c --- a/monetdb5/mal/mal_interpreter.c +++ b/monetdb5/mal/mal_interpreter.c @@ -504,6 +504,7 @@ str runMALsequence(Client cntxt, MalBlkP runtimeProfileBegin(cntxt, mb, stk, getInstrPtr(mb,0), &runtimeProfileFunction); mb->starttime = GDKusec(); if (cntxt->sessiontimeout && mb->starttime - cntxt->session > cntxt->sessiontimeout) { + runtimeProfileFinish(cntxt, mb, stk); if ( backup != backups) GDKfree(backup); if ( garbage != garbages) GDKfree(garbage); throw(MAL, "mal.interpreter", SQLSTATE(HYT00) RUNTIME_SESSION_TIMEOUT); diff --git a/monetdb5/mal/mal_runtime.c b/monetdb5/mal/mal_runtime.c --- a/monetdb5/mal/mal_runtime.c +++ b/monetdb5/mal/mal_runtime.c @@ -161,25 +161,28 @@ clearQRYqueue(size_t idx) static void advanceQRYqueue(void) { - qhead++; - if( qhead == qsize) - qhead = 0; - if( qtail == qhead) - qtail++; - if( qtail == qsize) - qtail = 0; - /* clean out the element */ - str s = QRYqueue[qhead].query; - if( s){ - /* don;t wipe them when they are still running, prepared, or paused */ - /* The upper layer has assured there is at least one slot available */ - if(QRYqueue[qhead].status != 0 && (QRYqueue[qhead].status[0] == 'r' || QRYqueue[qhead].status[0] == 'p')){ - advanceQRYqueue(); - return; + bool found_empty_slot = false; + + while (!found_empty_slot) { + qhead++; + if( qhead == qsize) + qhead = 0; + if( qtail == qhead) + qtail++; + if( qtail == qsize) + qtail = 0; + /* clean out the element */ + str s = QRYqueue[qhead].query; + if (!s || QRYqueue[qhead].status == 0 || (QRYqueue[qhead].status[0] != 'r' && QRYqueue[qhead].status[0] != 'p')) { + /* don't wipe them when they are still running, prepared, or paused */ + /* The upper layer has assured there is at least one slot available */ + if (s) { + GDKfree(s); + GDKfree(QRYqueue[qhead].username); + clearQRYqueue(qhead); + } + found_empty_slot = true; } - GDKfree(s); - GDKfree(QRYqueue[qhead].username); - clearQRYqueue(qhead); } } ___ checkin-list mailing list checkin-list@monetdb.org https://www.monetdb.org/mailman/listinfo/checkin-list
MonetDB: Jul2021 - Merged with Oct2020
Changeset: 5b9b1f9e2a5a for MonetDB URL: https://dev.monetdb.org/hg/MonetDB/rev/5b9b1f9e2a5a Added Files: sql/test/BugTracker-2021/Tests/batappend-undefined.Bug-7130.test Removed Files: sql/test/BugTracker-2021/Tests/batappend-undefined.Bug-7130.sql sql/test/BugTracker-2021/Tests/batappend-undefined.Bug-7130.stable.err sql/test/BugTracker-2021/Tests/batappend-undefined.Bug-7130.stable.out Modified Files: sql/server/rel_select.c sql/test/BugTracker-2021/Tests/All tools/monetdbe/monetdbe.c Branch: Jul2021 Log Message: Merged with Oct2020 diffs (91 lines): diff --git a/sql/test/BugTracker-2021/Tests/All b/sql/test/BugTracker-2021/Tests/All --- a/sql/test/BugTracker-2021/Tests/All +++ b/sql/test/BugTracker-2021/Tests/All @@ -10,3 +10,4 @@ lowercase-cryllic.Bug-7126 unnest-union.Bug-7127 subquery-missing.Bug-7128 batcalc-between-undefined.Bug-7129 +batappend-undefined.Bug-7130 diff --git a/sql/test/BugTracker-2021/Tests/batappend-undefined.Bug-7130.test b/sql/test/BugTracker-2021/Tests/batappend-undefined.Bug-7130.test new file mode 100644 --- /dev/null +++ b/sql/test/BugTracker-2021/Tests/batappend-undefined.Bug-7130.test @@ -0,0 +1,60 @@ +statement ok +start transaction + +statement ok +create table t_qh ( c_f INTEGER , c_y2 INTEGER , c_i768 INTEGER , c_tqx TEXT , c_mknkhml TEXT, primary key(c_f, c_y2), unique(c_y2) ) + +statement ok rowcount 3 +insert into t_qh values (1,1,1,'a','a'),(2,2,2,'b','b'),(3,3,3,'c','c') + +statement ok +create table t_ckfystsc ( c_kvhq5p INTEGER , c_aifpl INTEGER , c_jf6 TEXT , c_f31ix TEXT NOT NULL, c_lo0zqfe TEXT , c_zv INTEGER , c_l153 INTEGER , primary key(c_zv), unique(c_zv) ) + +statement ok rowcount 3 +insert into t_ckfystsc values (1,1,'a','a','a',1,1),(2,2,'b','b','b',2,2),(3,3,'c','c','c',3,3) + +statement ok +create view t_vehkuero as select distinct abs( cast(subq_0.c1 as INTEGER)) as c0 from (select ref_0.c_f as c0, ref_0.c_f as c1, ref_0.c_i768 as c2, ref_0.c_y2 as c3 from t_qh as ref_0) +as subq_0 where cast(nullif('zdo', 'apqonv1a') as CHAR) like 'aou%2' AND length( cast(case when subq_0.c1 = ( select subq_0.c3 as c0 from t_qh as ref_6 +where (subq_0.c0 <> ( select subq_0.c0 as c0 from t_qh as ref_7)) ) then 'xk' else 'xk' end as CHAR)) <> subq_0.c0 + +query T rowsort +select 1000 in (select 2 from t_vehkuero) from (select 1 as c0 from t_ckfystsc) as subq_0 + +False +False +False + +query T rowsort +select case when subq_0.c0 in ( select ref_5.c_tqx as c0 from t_qh as ref_5 where ref_5.c_y2 in ( select ref_6.c_y2 as c0 from t_qh as ref_6 union select 2 as c0 from t_vehkuero as ref_7)) +then cast(nullif(subq_0.c0, subq_0.c0) as CHAR) else cast(nullif(subq_0.c0, subq_0.c0) as CHAR) end as c0 from (select ref_0.c_lo0zqfe as c0, ref_0.c_aifpl as c1 from t_ckfystsc as ref_0) as subq_0 + +NULL +NULL +NULL + +statement ok +rollback + +statement ok +create table t_qh ( c_f INTEGER , c_y2 INTEGER , c_i768 INTEGER , c_tqx INTEGER , primary key(c_i768), unique(c_y2) ) + +statement ok rowcount 3 +insert into t_qh values (1,1,1,1),(2,2,2,2),(3,3,3,3) + +statement ok +create view t_amy as select ref_1.c_f as c0 from t_qh as ref_0 cross join t_qh as ref_1 left outer join (select ref_2.c_i768 as c0, cast(sum( cast(ref_3.c_f as INTEGER)) as bigint) as c1, count(*) as c2 from t_qh as ref_2 +left outer join t_qh as ref_3 on (ref_2.c_f < ref_2.c_f) where ref_2.c_i768 > ref_3.c_y2 group by ref_2.c_i768) as subq_0 on (ref_0.c_y2 < ref_1.c_f) where ref_0.c_f <> ( select ref_4.c_i768 as c0 from t_qh +as ref_4 cross join t_qh as ref_5 where EXISTS ( select ref_6.c_i768 as c0, ref_1.c_i768 as c1, ref_6.c_y2 as c2 from t_qh as ref_6 where subq_0.c0 < ( select subq_0.c1 as c0 from t_qh as ref_7 +where (ref_5.c_f <> ref_6.c_f) or (subq_0.c1 is NULL + +statement error GDK reported error: hashjoin: more than one match +select (subq_0.c0 = case when EXISTS ( select ref_15.c0 as c6 from t_amy as ref_15) then subq_0.c1 else subq_0.c1 end) as c4 from (select ref_12.c_f as c0, 30 as c1 from t_qh as ref_12) as subq_0 + +statement error GDK reported error: BATsubcross: more than one match +select (select (select 1 where subq_0.c0 = (select subq_0.c1 from t_qh)) from (select 320, 1) subq_0(c0,c1)) from (select 2) subq_0(c3) + +statement ok +drop table t_qh cascade + + diff --git a/tools/monetdbe/monetdbe.c b/tools/monetdbe/monetdbe.c --- a/tools/monetdbe/monetdbe.c +++ b/tools/monetdbe/monetdbe.c @@ -2093,6 +2093,14 @@ remote_cleanup: //set default flags BATsettrivprop(bn); + if (cnt > 1) { + bn->tsorted = bn->trevsorted = false; + bn->tnosorted = bn->tnorevsorted = 0; + bn->tkey = false; + bn->tnonil = false; + bn->tnil = false; + } + if (s
MonetDB: Jul2021 - Merged with Oct2020
Changeset: 603d7da5e42d for MonetDB URL: https://dev.monetdb.org/hg/MonetDB/rev/603d7da5e42d Modified Files: gdk/gdk_join.c sql/backends/monet5/rel_bin.c Branch: Jul2021 Log Message: Merged with Oct2020 diffs (32 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 @@ -4259,7 +4259,7 @@ rel2bin_insert(backend *be, sql_rel *rel if (idx_ins) pin = refs_find_rel(refs, prel); - if (constraint && !be->rowcount) + if (constraint) sql_insert_check_null(be, t, inserts->op4.lval); l = sa_list(sql->sa); @@ -5173,8 +5173,7 @@ sql_update(backend *be, sql_table *t, st list *l = sa_list(sql->sa); node *n; - if (!be->rowcount) - sql_update_check_null(be, t, updates); + sql_update_check_null(be, t, updates); /* check keys + get idx */ idx_updates = update_idxs_and_check_keys(be, t, rows, updates, l, NULL); @@ -5258,8 +5257,7 @@ rel2bin_update(backend *be, sql_rel *rel if (c) updates[c->colnr] = bin_find_column(be, update, ce->l, ce->r); } - if (!be->rowcount) - sql_update_check_null(be, t, updates); + sql_update_check_null(be, t, updates); /* check keys + get idx */ updcol = first_updated_col(updates, ol_length(t->columns)); ___ checkin-list mailing list checkin-list@monetdb.org https://www.monetdb.org/mailman/listinfo/checkin-list
MonetDB: Jul2021 - Merged with Oct2020
Changeset: ae13bb01007a for MonetDB URL: https://dev.monetdb.org/hg/MonetDB/rev/ae13bb01007a Modified Files: gdk/gdk_select.c Branch: Jul2021 Log Message: Merged with Oct2020 diffs (11 lines): diff --git a/gdk/gdk_select.c b/gdk/gdk_select.c --- a/gdk/gdk_select.c +++ b/gdk/gdk_select.c @@ -839,7 +839,6 @@ scanselect(BAT *b, struct canditer *rest assert(!hval || th != NULL); assert(!equi || (li && hi && !anti)); assert(!anti || lval || hval); - assert( anti || lval || hval || !b->tnonil); assert(b->ttype != TYPE_void || equi || b->tnonil); #ifndef NDEBUG ___ checkin-list mailing list checkin-list@monetdb.org https://www.monetdb.org/mailman/listinfo/checkin-list
MonetDB: Jul2021 - Merged with Oct2020
Changeset: dc85bc93b5b2 for MonetDB URL: https://dev.monetdb.org/hg/MonetDB/rev/dc85bc93b5b2 Added Files: sql/test/BugTracker-2021/Tests/unnest-union.Bug-7127.test Removed Files: sql/test/BugTracker-2021/Tests/batcalc-between-undefined.Bug-7129.sql sql/test/BugTracker-2021/Tests/subquery-missing.Bug-7128.sql sql/test/BugTracker-2021/Tests/unnest-union.Bug-7127.sql sql/test/BugTracker-2021/Tests/unnest-union.Bug-7127.stable.err sql/test/BugTracker-2021/Tests/unnest-union.Bug-7127.stable.out Modified Files: sql/server/rel_unnest.c sql/test/BugTracker-2021/Tests/All sql/test/BugTracker-2021/Tests/batcalc-between-undefined.Bug-7129.test sql/test/BugTracker-2021/Tests/subquery-missing.Bug-7128.test Branch: Jul2021 Log Message: Merged with Oct2020 diffs (132 lines): diff --git a/sql/server/rel_unnest.c b/sql/server/rel_unnest.c --- a/sql/server/rel_unnest.c +++ b/sql/server/rel_unnest.c @@ -1346,7 +1346,6 @@ push_up_set(mvc *sql, sql_rel *rel, list /* left of rel should be a set */ if (d && is_distinct_set(sql, d, ad) && s && is_set(s->op)) { - list *sexps; sql_rel *sl = s->l, *sr = s->r, *n; sl = rel_project(sql->sa, sl, rel_projections(sql, sl, NULL, 1, 1)); @@ -1363,12 +1362,11 @@ push_up_set(mvc *sql, sql_rel *rel, list s->l = rel; s->r = n; if (is_join(rel->op)) { - sexps = sa_list(sql->sa); - for (node *m = d->exps->h; m; m = m->next) { - sql_exp *e = m->data, *pe; - - pe = exp_ref(sql, e); - append(sexps, pe); + list *sexps = sa_list(sql->sa), *dexps = rel_projections(sql, d, NULL, 1, 1); + for (node *m = dexps->h; m; m = m->next) { + sql_exp *e = m->data; + + list_append(sexps, exp_ref(sql, e)); } s->exps = list_merge(sexps, s->exps, (fdup)NULL); } diff --git a/sql/test/BugTracker-2021/Tests/All b/sql/test/BugTracker-2021/Tests/All --- a/sql/test/BugTracker-2021/Tests/All +++ b/sql/test/BugTracker-2021/Tests/All @@ -7,5 +7,6 @@ merge-stmt.wrong-error.Bug-7109 remote-table-groupby.Bug-7110 conditional-execution-round.Bug-7125 lowercase-cryllic.Bug-7126 +unnest-union.Bug-7127 subquery-missing.Bug-7128 batcalc-between-undefined.Bug-7129 diff --git a/sql/test/BugTracker-2021/Tests/batcalc-between-undefined.Bug-7129.test b/sql/test/BugTracker-2021/Tests/batcalc-between-undefined.Bug-7129.test --- a/sql/test/BugTracker-2021/Tests/batcalc-between-undefined.Bug-7129.test +++ b/sql/test/BugTracker-2021/Tests/batcalc-between-undefined.Bug-7129.test @@ -4,12 +4,26 @@ start transaction statement ok create table t_qh ( c_f INTEGER , c_y2 INTEGER , primary key(c_f), unique(c_f) ) +statement ok rowcount 3 +insert into t_qh values (1,1), (2,2), (3,3) + query II rowsort WITH cte_1 AS (select count( cast(87.53 as INTEGER)) as c0, avg( cast(abs( cast(50.40 as INTEGER)) as INTEGER)) as c1, subq_0.c0 as c2 from (select distinct ref_5.c_f as c0, 75 as c1, ref_5.c_f as c2 from t_qh as ref_5 where ref_5.c_f is not NULL) as subq_0 group by subq_0.c0) select distinct cast(sum( cast((case when (ref_23.c0 > ref_23.c0) and (ref_23.c0 < ref_23.c1) then ref_23.c1 else ref_23.c1 end & ref_23.c1) as INTEGER)) as bigint) as c3, ref_23.c0 as c4 from cte_1 as ref_23 group by ref_23.c0 +150 +1 + +query II rowsort +WITH cte_1 AS (select count( cast(87.53 as INTEGER)) as c0, avg( cast(abs( cast(50.40 as INTEGER)) as INTEGER)) as c1, subq_0.c0 as c2 from +(select distinct ref_5.c_f as c0, 75 as c1, ref_5.c_f as c2 from t_qh as ref_5 where ref_5.c_f is not NULL) as subq_0 group by subq_0.c0) +select distinct cast(sum( cast((case when (ref_23.c0 > ref_23.c0) and (ref_23.c0 < ref_23.c1) then ref_23.c1 else ref_23.c1 end) as INTEGER)) as bigint) +as c3, ref_23.c0 as c4 from cte_1 as ref_23 group by ref_23.c0 + +150 +1 statement ok rollback diff --git a/sql/test/BugTracker-2021/Tests/subquery-missing.Bug-7128.test b/sql/test/BugTracker-2021/Tests/subquery-missing.Bug-7128.test --- a/sql/test/BugTracker-2021/Tests/subquery-missing.Bug-7128.test +++ b/sql/test/BugTracker-2021/Tests/subquery-missing.Bug-7128.test @@ -4,6 +4,9 @@ start transaction statement ok create table t_qh ( c_f INTEGER , c_y2 INTEGER , c_i768 INTEGER , c_tqx TEXT , primary key(c_f, c_y2), unique(c_y2) ) +statement ok rowcount 3 +insert into t_qh values (1,1,1,'a'), (2,2,2,'b'), (3,3,3,'c') + query I rowsort select ref_1.c_i768 as c0 from t_qh as ref_1 cross join (select ref_2.c_i768
MonetDB: Jul2021 - Merged with Oct2020
Changeset: d50f8818401a for MonetDB URL: https://dev.monetdb.org/hg/MonetDB/rev/d50f8818401a Modified Files: sql/backends/monet5/sql.c sql/server/rel_optimizer.c Branch: Jul2021 Log Message: Merged with Oct2020 diffs (22 lines): diff --git a/sql/server/rel_optimizer.c b/sql/server/rel_optimizer.c --- a/sql/server/rel_optimizer.c +++ b/sql/server/rel_optimizer.c @@ -3944,10 +3944,14 @@ rel_merge_project_rse(visitor *v, sql_re sql_subtype *t1 = exp_subtype(e1), *t3 = exp_subtype(e3), super; supertype(&super, t1, t3); /* e1 and e2 must have the same type */ - if ((e1 = exp_check_type(v->sql, &super, rel, e1, type_equal)) && - (e2 = exp_check_type(v->sql, &super, rel, e2, type_equal)) && - (e3 = exp_check_type(v->sql, &super, rel, e3, type_equal)) && - (ne = exp_compare2(v->sql->sa, e1, e2, e3, compare_funcs2range(lf->func->base.name, rf->func->base.name { + if (!(e1 = exp_check_type(v->sql, &super, rel, e1, type_equal)) || + !(e2 = exp_check_type(v->sql, &super, rel, e2, type_equal)) || + !(e3 = exp_check_type(v->sql, &super, rel, e3, type_equal))) { + v->sql->session->status = 0; + v->sql->errstr[0] = 0; + return e; + } + if ((ne = exp_compare2(v->sql->sa, e1, e2, e3, compare_funcs2range(lf->func->base.name, rf->func->base.name { if (exp_name(e)) exp_prop_alias(v->sql->sa, ne, e); e = ne; ___ checkin-list mailing list checkin-list@monetdb.org https://www.monetdb.org/mailman/listinfo/checkin-list
MonetDB: Jul2021 - Merged with Oct2020
Changeset: 2aa7c509948d for MonetDB URL: https://dev.monetdb.org/hg/MonetDB/rev/2aa7c509948d Added Files: sql/test/BugTracker-2021/Tests/subquery-missing.Bug-7128.test Removed Files: sql/test/BugTracker-2021/Tests/subquery-missing.Bug-7128.sql sql/test/BugTracker-2021/Tests/subquery-missing.Bug-7128.stable.err sql/test/BugTracker-2021/Tests/subquery-missing.Bug-7128.stable.out Modified Files: sql/server/rel_select.c sql/test/BugTracker-2021/Tests/All Branch: Jul2021 Log Message: Merged with Oct2020 diffs (42 lines): 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 @@ -1604,7 +1604,7 @@ rel_select_push_exp_down(mvc *sql, sql_r if ((rs->card <= CARD_ATOM || (rs2 && ls->card <= CARD_ATOM)) && (exp_is_atom(rs) || (rs2 && exp_is_atom(ls)) || exp_has_freevar(sql, rs) || exp_has_freevar(sql, ls)) && (!rs2 || (rs2->card <= CARD_ATOM && (exp_is_atom(rs2) || exp_has_freevar(sql, rs2) { - if ((ls->card == rs->card && (!rs2 || ls->card == rs2->card || rs->card == rs2->card)) || rel->processed) /* bin compare op */ + if (ls->card == rs->card || (rs2 && (ls->card == rs2->card || rs->card == rs2->card)) || rel->processed) /* bin compare op */ return rel_select(sql->sa, rel, e); return push_select_exp(sql, rel, e, ls, L, f); diff --git a/sql/test/BugTracker-2021/Tests/All b/sql/test/BugTracker-2021/Tests/All --- a/sql/test/BugTracker-2021/Tests/All +++ b/sql/test/BugTracker-2021/Tests/All @@ -7,4 +7,5 @@ merge-stmt.wrong-error.Bug-7109 remote-table-groupby.Bug-7110 conditional-execution-round.Bug-7125 lowercase-cryllic.Bug-7126 +subquery-missing.Bug-7128 batcalc-between-undefined.Bug-7129 diff --git a/sql/test/BugTracker-2021/Tests/subquery-missing.Bug-7128.test b/sql/test/BugTracker-2021/Tests/subquery-missing.Bug-7128.test new file mode 100644 --- /dev/null +++ b/sql/test/BugTracker-2021/Tests/subquery-missing.Bug-7128.test @@ -0,0 +1,16 @@ +statement ok +start transaction + +statement ok +create table t_qh ( c_f INTEGER , c_y2 INTEGER , c_i768 INTEGER , c_tqx TEXT , primary key(c_f, c_y2), unique(c_y2) ) + +query I rowsort +select ref_1.c_i768 as c0 from t_qh as ref_1 cross join (select ref_2.c_i768 as c0 from t_qh as ref_2 inner join t_qh as +ref_3 on (1=1) where ref_3.c_f <> ref_3.c_y2) as subq_0 where ref_1.c_y2 < ( select ref_1.c_f as c0 from t_qh as ref_4 +where (EXISTS ( select distinct ref_5.c_i768 as c0 from t_qh as ref_5)) and (ref_1.c_i768 between ref_4.c_y2 and ref_1.c_y2)) + + +statement ok +rollback + + ___ checkin-list mailing list checkin-list@monetdb.org https://www.monetdb.org/mailman/listinfo/checkin-list
MonetDB: Jul2021 - Merged with Oct2020
Changeset: f30278ca3c19 for MonetDB URL: https://dev.monetdb.org/hg/MonetDB/rev/f30278ca3c19 Added Files: sql/test/BugTracker-2021/Tests/batcalc-between-undefined.Bug-7129.test sql/test/BugTracker-2021/Tests/lowercase-cryllic.Bug-7126.test Removed Files: sql/test/BugTracker-2021/Tests/batcalc-between-undefined.Bug-7129.sql sql/test/BugTracker-2021/Tests/batcalc-between-undefined.Bug-7129.stable.err sql/test/BugTracker-2021/Tests/batcalc-between-undefined.Bug-7129.stable.out sql/test/BugTracker-2021/Tests/lowercase-crylic.Bug-7126.test sql/test/BugTracker-2021/Tests/lowercase-cryllic.Bug-7126.sql sql/test/BugTracker-2021/Tests/lowercase-cryllic.Bug-7126.stable.err sql/test/BugTracker-2021/Tests/lowercase-cryllic.Bug-7126.stable.out Modified Files: sql/server/rel_optimizer.c sql/test/BugTracker-2021/Tests/All Branch: Jul2021 Log Message: Merged with Oct2020 diffs (65 lines): diff --git a/sql/server/rel_optimizer.c b/sql/server/rel_optimizer.c --- a/sql/server/rel_optimizer.c +++ b/sql/server/rel_optimizer.c @@ -3939,17 +3939,19 @@ rel_merge_project_rse(visitor *v, sql_re if (((strcmp(lf->func->base.name, ">=") == 0 || strcmp(lf->func->base.name, ">") == 0) && list_length(lfexps) == 2) && ((strcmp(rf->func->base.name, "<=") == 0 || strcmp(rf->func->base.name, "<") == 0) && list_length(rfexps) == 2) && exp_equal(list_fetch(lfexps,0), list_fetch(rfexps,0)) == 0) { - sql_exp *ne = exp_compare2(v->sql->sa, - list_fetch(lfexps, 0), - list_fetch(lfexps, 1), - list_fetch(rfexps, 1), - compare_funcs2range(lf->func->base.name, rf->func->base.name)); - if (ne) { + sql_exp *e1 = list_fetch(lfexps, 0), *e2 = list_fetch(lfexps, 1), *e3 = list_fetch(rfexps, 1), *ne = NULL; + sql_subtype *t1 = exp_subtype(e1), *t3 = exp_subtype(e3), super; + + supertype(&super, t1, t3); /* e1 and e2 must have the same type */ + if ((e1 = exp_check_type(v->sql, &super, rel, e1, type_equal)) && + (e2 = exp_check_type(v->sql, &super, rel, e2, type_equal)) && + (e3 = exp_check_type(v->sql, &super, rel, e3, type_equal)) && + (ne = exp_compare2(v->sql->sa, e1, e2, e3, compare_funcs2range(lf->func->base.name, rf->func->base.name { if (exp_name(e)) exp_prop_alias(v->sql->sa, ne, e); e = ne; + v->changes++; } - v->changes++; } } } diff --git a/sql/test/BugTracker-2021/Tests/All b/sql/test/BugTracker-2021/Tests/All --- a/sql/test/BugTracker-2021/Tests/All +++ b/sql/test/BugTracker-2021/Tests/All @@ -6,4 +6,5 @@ union-groupby.Bug-7108 merge-stmt.wrong-error.Bug-7109 remote-table-groupby.Bug-7110 conditional-execution-round.Bug-7125 -lowercase-crylic.Bug-7126 +lowercase-cryllic.Bug-7126 +batcalc-between-undefined.Bug-7129 diff --git a/sql/test/BugTracker-2021/Tests/batcalc-between-undefined.Bug-7129.test b/sql/test/BugTracker-2021/Tests/batcalc-between-undefined.Bug-7129.test new file mode 100644 --- /dev/null +++ b/sql/test/BugTracker-2021/Tests/batcalc-between-undefined.Bug-7129.test @@ -0,0 +1,17 @@ +statement ok +start transaction + +statement ok +create table t_qh ( c_f INTEGER , c_y2 INTEGER , primary key(c_f), unique(c_f) ) + +query II rowsort +WITH cte_1 AS (select count( cast(87.53 as INTEGER)) as c0, avg( cast(abs( cast(50.40 as INTEGER)) as INTEGER)) as c1, subq_0.c0 as c2 from +(select distinct ref_5.c_f as c0, 75 as c1, ref_5.c_f as c2 from t_qh as ref_5 where ref_5.c_f is not NULL) as subq_0 group by subq_0.c0) +select distinct cast(sum( cast((case when (ref_23.c0 > ref_23.c0) and (ref_23.c0 < ref_23.c1) then ref_23.c1 else ref_23.c1 end & ref_23.c1) as INTEGER)) as bigint) +as c3, ref_23.c0 as c4 from cte_1 as ref_23 group by ref_23.c0 + + +statement ok +rollback + + diff --git a/sql/test/BugTracker-2021/Tests/lowercase-crylic.Bug-7126.test b/sql/test/BugTracker-2021/Tests/lowercase-cryllic.Bug-7126.test rename from sql/test/BugTracker-2021/Tests/lowercase-crylic.Bug-7126.test rename to sql/test/BugT
MonetDB: Jul2021 - Merged with Oct2020
Changeset: d31b8397b7d6 for MonetDB URL: https://dev.monetdb.org/hg/MonetDB/rev/d31b8397b7d6 Added Files: sql/test/BugTracker-2021/Tests/lowercase-crylic.Bug-7126.test Removed Files: sql/test/BugTracker-2021/Tests/lowercase-crylic.Bug-7126.sql sql/test/BugTracker-2021/Tests/lowercase-crylic.Bug-7126.stable.err sql/test/BugTracker-2021/Tests/lowercase-crylic.Bug-7126.stable.out Modified Files: monetdb5/modules/atoms/str.c sql/test/BugTracker-2021/Tests/All Branch: Jul2021 Log Message: Merged with Oct2020 diffs (34 lines): diff --git a/monetdb5/modules/atoms/str.c b/monetdb5/modules/atoms/str.c --- a/monetdb5/modules/atoms/str.c +++ b/monetdb5/modules/atoms/str.c @@ -3183,7 +3183,7 @@ convertCase(BAT *from, BAT *to, str *buf int c; UTF8_GETCHAR(c, src); - if ((c & 0x80) == 0) { + if (c < 192) { /* the first 191 characters in unicode are trivial to convert */ /* for ASCII characters we don't need to do a hash lookup */ if (lower_to_upper) { if ('a' <= c && c <= 'z') diff --git a/sql/test/BugTracker-2021/Tests/All b/sql/test/BugTracker-2021/Tests/All --- a/sql/test/BugTracker-2021/Tests/All +++ b/sql/test/BugTracker-2021/Tests/All @@ -6,3 +6,4 @@ union-groupby.Bug-7108 merge-stmt.wrong-error.Bug-7109 remote-table-groupby.Bug-7110 conditional-execution-round.Bug-7125 +lowercase-crylic.Bug-7126 diff --git a/sql/test/BugTracker-2021/Tests/lowercase-crylic.Bug-7126.test b/sql/test/BugTracker-2021/Tests/lowercase-crylic.Bug-7126.test new file mode 100644 --- /dev/null +++ b/sql/test/BugTracker-2021/Tests/lowercase-crylic.Bug-7126.test @@ -0,0 +1,9 @@ +query rowsort +select lower('ASDFasdfФЫВАфыва'), upper('ASDFasdfФЫВАфыва'), lower('ÀA¿'), upper('àa¿') + +asdfasdf +ASDFASDF +@a@ +@A@ + + ___ checkin-list mailing list checkin-list@monetdb.org https://www.monetdb.org/mailman/listinfo/checkin-list
MonetDB: Jul2021 - Merged with Oct2020
Changeset: 5c344f0668e5 for MonetDB URL: https://dev.monetdb.org/hg/MonetDB/rev/5c344f0668e5 Branch: Jul2021 Log Message: Merged with Oct2020 diffs (12 lines): diff --git a/clients/odbc/driver/SQLSpecialColumns.c b/clients/odbc/driver/SQLSpecialColumns.c --- a/clients/odbc/driver/SQLSpecialColumns.c +++ b/clients/odbc/driver/SQLSpecialColumns.c @@ -221,7 +221,7 @@ MNDBSpecialColumns(ODBCStmt *stmt, "sys.tables t, " "sys.columns c, " "sys.keys k, " - "sys.objects kc" + "sys.objects kc " "where s.id = t.schema_id and " "t.id = c.table_id and " "t.id = k.table_id and " ___ checkin-list mailing list checkin-list@monetdb.org https://www.monetdb.org/mailman/listinfo/checkin-list
MonetDB: Jul2021 - merged with Oct2020
Changeset: 3ae3b1a917e2 for MonetDB URL: https://dev.monetdb.org/hg/MonetDB/rev/3ae3b1a917e2 Modified Files: geom/sql/conformance/Tests/All Branch: Jul2021 Log Message: merged with Oct2020 diffs (12 lines): diff --git a/geom/sql/conformance/Tests/All b/geom/sql/conformance/Tests/All --- a/geom/sql/conformance/Tests/All +++ b/geom/sql/conformance/Tests/All @@ -47,7 +47,7 @@ HAVE_GEOM?T45 HAVE_GEOM?T46 HAVE_GEOM?T47 HAVE_GEOM?T48 -HAVE_GEOM?T49 +#HAVE_GEOM?T49 # disabled because depends on geos library version HAVE_GEOM?T50 HAVE_GEOM?T51 HAVE_GEOM?T52 ___ checkin-list mailing list checkin-list@monetdb.org https://www.monetdb.org/mailman/listinfo/checkin-list