Changeset: 4daf28035bef for MonetDB URL: https://dev.monetdb.org/hg/MonetDB?cmd=changeset;node=4daf28035bef Added Files: sql/test/BugTracker-2017/Tests/case.Bug-6386.sql sql/test/BugTracker-2017/Tests/case.Bug-6386.stable.err sql/test/BugTracker-2017/Tests/case.Bug-6386.stable.out sql/test/BugTracker-2017/Tests/exists.Bug-6392.sql sql/test/BugTracker-2017/Tests/exists.Bug-6392.stable.err sql/test/BugTracker-2017/Tests/exists.Bug-6392.stable.out sql/test/BugTracker-2017/Tests/sqllitelogistest_case.Bug-6335.sql Modified Files: clients/Tests/MAL-signatures.stable.out clients/Tests/MAL-signatures.stable.out.int128 gdk/gdk_bat.c gdk/gdk_batop.c gdk/gdk_group.c gdk/gdk_hash.h sql/backends/monet5/prog.c sql/backends/monet5/rel_bin.c sql/backends/monet5/sql.c sql/backends/monet5/sql.h sql/backends/monet5/sql_cat.c sql/backends/monet5/sql_execute.c sql/backends/monet5/sql_rank.mal sql/backends/monet5/sql_scenario.c sql/backends/monet5/sql_statement.c sql/backends/monet5/sql_upgrades.c sql/common/sql_list.c sql/common/sql_string.c sql/jdbc/tests/Tests/Bug_Connect_as_voc_getMetaData_Failure_Bug_6388.stable.err sql/jdbc/tests/Tests/Bug_Connect_as_voc_getMetaData_Failure_Bug_6388.stable.out sql/scripts/25_debug.sql sql/scripts/51_sys_schema_extension.sql sql/server/rel_optimizer.c sql/server/rel_psm.c sql/server/rel_rel.c sql/server/rel_schema.c sql/server/rel_select.c sql/server/rel_sequence.c sql/server/rel_trans.c sql/server/rel_updates.c sql/server/sql_atom.c sql/server/sql_mvc.c sql/server/sql_parser.y sql/server/sql_qc.c sql/server/sql_scan.c sql/server/sql_semantic.c sql/storage/bat/res_table.c sql/test/BugTracker-2015/Tests/large_join.Bug-3809.sql sql/test/BugTracker-2017/Tests/All sql/test/Tests/coalesce.stable.out sql/test/Tests/systemfunctions.stable.out sql/test/Tests/systemfunctions.stable.out.int128 sql/test/emptydb-upgrade-chain-hge/Tests/upgrade.stable.out.int128 sql/test/emptydb-upgrade-chain/Tests/upgrade.stable.out sql/test/emptydb-upgrade-chain/Tests/upgrade.stable.out.int128 sql/test/emptydb-upgrade-hge/Tests/upgrade.stable.out.int128 sql/test/emptydb-upgrade/Tests/upgrade.stable.out sql/test/emptydb-upgrade/Tests/upgrade.stable.out.int128 sql/test/emptydb/Tests/check.stable.out sql/test/emptydb/Tests/check.stable.out.32bit sql/test/emptydb/Tests/check.stable.out.int128 sql/test/leaks/Tests/check1.stable.out.int128 sql/test/leaks/Tests/check2.stable.out.int128 sql/test/leaks/Tests/check3.stable.out.int128 sql/test/leaks/Tests/check4.stable.out.int128 sql/test/leaks/Tests/check5.stable.out.int128 sql/test/leaks/Tests/select1.stable.out.int128 sql/test/leaks/Tests/select2.stable.out.int128 sql/test/leaks/Tests/temp1.stable.out.int128 sql/test/testdb-upgrade-chain-hge/Tests/upgrade.stable.out.int128 sql/test/testdb-upgrade-chain/Tests/upgrade.stable.out sql/test/testdb-upgrade-chain/Tests/upgrade.stable.out.int128 sql/test/testdb-upgrade-hge/Tests/upgrade.stable.out.int128 sql/test/testdb-upgrade/Tests/upgrade.stable.out sql/test/testdb-upgrade/Tests/upgrade.stable.out.int128 Branch: default Log Message:
Merge with Jul2017 branch. diffs (truncated from 3658 to 300 lines): diff --git a/clients/Tests/MAL-signatures.stable.out b/clients/Tests/MAL-signatures.stable.out --- a/clients/Tests/MAL-signatures.stable.out +++ b/clients/Tests/MAL-signatures.stable.out @@ -95,7 +95,7 @@ Ready. [ "aggr", "covar", "function aggr.covar(e1:bat[:sht], e2:bat[:sht]):sht;", "", "" ] [ "aggr", "exist", "command aggr.exist(b:bat[:any_2], h:any_1):bit ", "ALGexist;", "" ] [ "aggr", "exist", "command aggr.exist(b:bat[:any_2]):bit ", "SQLexist;", "" ] -[ "aggr", "exist", "command aggr.exist(v:any_2):bit ", "SQLexist_val;", "" ] +[ "aggr", "exist", "pattern aggr.exist(v:any_2):bit ", "SQLexist_val;", "" ] [ "aggr", "jsonaggr", "command aggr.jsonaggr(val:bat[:dbl]):str ", "JSONgroupStr;", "Aggregate the double values to array." ] [ "aggr", "jsonaggr", "command aggr.jsonaggr(val:bat[:str]):str ", "JSONgroupStr;", "Aggregate the string values to array." ] [ "aggr", "max", "command aggr.max(b:bat[:any_1], g:bat[:oid], e:bat[:any_2]):bat[:any_1] ", "AGGRmax3;", "" ] diff --git a/clients/Tests/MAL-signatures.stable.out.int128 b/clients/Tests/MAL-signatures.stable.out.int128 --- a/clients/Tests/MAL-signatures.stable.out.int128 +++ b/clients/Tests/MAL-signatures.stable.out.int128 @@ -103,7 +103,7 @@ Ready. [ "aggr", "covar", "function aggr.covar(e1:bat[:sht], e2:bat[:sht]):sht;", "", "" ] [ "aggr", "exist", "command aggr.exist(b:bat[:any_2], h:any_1):bit ", "ALGexist;", "" ] [ "aggr", "exist", "command aggr.exist(b:bat[:any_2]):bit ", "SQLexist;", "" ] -[ "aggr", "exist", "command aggr.exist(v:any_2):bit ", "SQLexist_val;", "" ] +[ "aggr", "exist", "pattern aggr.exist(v:any_2):bit ", "SQLexist_val;", "" ] [ "aggr", "jsonaggr", "command aggr.jsonaggr(val:bat[:dbl]):str ", "JSONgroupStr;", "Aggregate the double values to array." ] [ "aggr", "jsonaggr", "command aggr.jsonaggr(val:bat[:str]):str ", "JSONgroupStr;", "Aggregate the string values to array." ] [ "aggr", "max", "command aggr.max(b:bat[:any_1], g:bat[:oid], e:bat[:any_2]):bat[:any_1] ", "AGGRmax3;", "" ] diff --git a/gdk/gdk_bat.c b/gdk/gdk_bat.c --- a/gdk/gdk_bat.c +++ b/gdk/gdk_bat.c @@ -505,6 +505,8 @@ BATclear(BAT *b, int force) HASHdestroy(b); IMPSdestroy(b); OIDXdestroy(b); + PROPdestroy(b->tprops); + b->tprops = NULL; /* we must dispose of all inserted atoms */ if (force && BATatoms[b->ttype].atomDel == NULL) { @@ -1055,6 +1057,8 @@ BUNappend(BAT *b, const void *t, bit for IMPSdestroy(b); /* no support for inserts in imprints yet */ OIDXdestroy(b); + PROPdestroy(b->tprops); + b->tprops = NULL; if (b->thash == (Hash *) 1) { /* don't bother first loading the hash to then change it */ HASHdestroy(b); @@ -1118,6 +1122,8 @@ BUNdelete(BAT *b, oid o) IMPSdestroy(b); OIDXdestroy(b); HASHdestroy(b); + PROPdestroy(b->tprops); + b->tprops = NULL; return GDK_SUCCEED; } @@ -1155,6 +1161,8 @@ BUNinplace(BAT *b, BUN p, const void *t, b->tnil = 0; } HASHdestroy(b); + PROPdestroy(b->tprops); + b->tprops = NULL; Treplacevalue(b, BUNtloc(bi, p), t); tt = b->ttype; diff --git a/gdk/gdk_batop.c b/gdk/gdk_batop.c --- a/gdk/gdk_batop.c +++ b/gdk/gdk_batop.c @@ -490,6 +490,8 @@ BATappend(BAT *b, BAT *n, BAT *s, bit fo IMPSdestroy(b); /* imprints do not support updates yet */ OIDXdestroy(b); + PROPdestroy(b->tprops); + b->tprops = NULL; if (b->thash == (Hash *) 1 || BATcount(b) == 0) { /* don't bother first loading the hash to then change * it, or updating the hash if we replace the heap */ @@ -749,6 +751,8 @@ BATdel(BAT *b, BAT *d) /* not sure about these anymore */ b->tnosorted = b->tnorevsorted = 0; b->tnokey[0] = b->tnokey[1] = 0; + PROPdestroy(b->tprops); + b->tprops = NULL; return GDK_SUCCEED; } diff --git a/gdk/gdk_group.c b/gdk/gdk_group.c --- a/gdk/gdk_group.c +++ b/gdk/gdk_group.c @@ -98,24 +98,64 @@ #define GRP_compare_consecutive_values(INIT_0,INIT_1,COMP,KEEP) \ do { \ INIT_0; \ - for (r = 0; r < cnt; r++) { \ - if (cand) { \ + if (cand && grps) { \ + for (r = 0; r < cnt; r++) { \ p = *cand++ - b->hseqbase; \ - } else { \ - p = start++; \ + assert(p < end); \ + INIT_1; \ + if (ngrp == 0 || grps[r] != prev || COMP) { \ + GRPnotfound(); \ + } else { \ + ngrps[r] = ngrp - 1; \ + if (histo) \ + cnts[ngrp - 1]++; \ + } \ + KEEP; \ + prev = grps[r]; \ } \ - assert(p < end); \ - INIT_1; \ - if (ngrp == 0 || (grps && grps[r] != prev) || COMP) { \ - GRPnotfound(); \ - } else { \ - ngrps[r] = ngrp - 1; \ - if (histo) \ - cnts[ngrp - 1]++; \ + } else if (cand) { \ + for (r = 0; r < cnt; r++) { \ + p = *cand++ - b->hseqbase; \ + assert(p < end); \ + INIT_1; \ + if (ngrp == 0 || COMP) { \ + GRPnotfound(); \ + } else { \ + ngrps[r] = ngrp - 1; \ + if (histo) \ + cnts[ngrp - 1]++; \ + } \ + KEEP; \ } \ - KEEP; \ - if (grps) \ + } else if (grps) { \ + for (r = 0; r < cnt; r++) { \ + p = start++; \ + assert(p < end); \ + INIT_1; \ + if (ngrp == 0 || grps[r] != prev || COMP) { \ + GRPnotfound(); \ + } else { \ + ngrps[r] = ngrp - 1; \ + if (histo) \ + cnts[ngrp - 1]++; \ + } \ + KEEP; \ prev = grps[r]; \ + } \ + } else { \ + for (r = 0; r < cnt; r++) { \ + p = start++; \ + assert(p < end); \ + INIT_1; \ + if (ngrp == 0 || COMP) { \ + GRPnotfound(); \ + } else { \ + ngrps[r] = ngrp - 1; \ + if (histo) \ + cnts[ngrp - 1]++; \ + } \ + KEEP; \ + } \ } \ } while(0) @@ -353,6 +393,13 @@ rev(oid x) } /* population count: count number of 1 bits in a value */ +#ifdef __GNUC__ +#if SIZEOF_OID == SIZEOF_INT +#define pop(x) __builtin_popcount(x) +#else +#define pop(x) __builtin_popcountl(x) +#endif +#else static inline int pop(oid x) { @@ -373,93 +420,27 @@ pop(oid x) #endif return (int) x; } +#endif -#define GRP_create_partial_hash_table(INIT_0,INIT_1,HASH,COMP) \ +#define GRP_create_partial_hash_table_core(INIT_1,HASH,COMP,ASSERT,GRPTST) \ do { \ - oid grp; \ - INIT_0; \ - if (gc) { \ + if (cand) { \ for (r = 0; r < cnt; r++) { \ - if (cand) { \ - p = cand[r] - b->hseqbase; \ - } else { \ - p = start + r; \ - } \ + p = cand[r] - b->hseqbase; \ assert(p < end); \ INIT_1; \ prb = HASH; \ for (hb = HASHget(hs, prb); \ hb != HASHnil(hs) && hb >= start; \ hb = HASHgetlink(hs, hb)) { \ - assert(HASHgetlink(hs, hb) == HASHnil(hs) \ - || HASHgetlink(hs, hb) < hb); \ - if (cand) { \ - q = r; \ - while (q != 0 && cand[--q] - b->hseqbase > hb) \ - ; \ - if (cand[q] - b->hseqbase != hb) \ - continue; \ - if (grps[q] != grps[r]) { \ - hb = HASHnil(hs); \ - break; \ - } \ - grp = ngrps[q]; \ - } else { \ - if (grps[hb] != grps[r]) { \ - hb = HASHnil(hs); \ - break; \ - } \ - grp = ngrps[hb]; \ - } \ - if (COMP) { \ - ngrps[r] = grp; \ - if (histo) \ - cnts[grp]++; \ - if (gn->tsorted && \ - grp != ngrp - 1) \ - gn->tsorted = 0; \ - break; \ - } \ - } \ - if (hb == HASHnil(hs) || hb < start) { \ - GRPnotfound(); \ - /* enter new group into hash table */ \ - HASHputlink(hs, p, HASHget(hs, prb)); \ - HASHput(hs, prb, p); \ - } \ - } \ - } else if (grps) { \ - for (r = 0; r < cnt; r++) { \ - if (cand) { \ - p = cand[r] - b->hseqbase; \ - } else { \ - p = start + r; \ - } \ - assert(p < end); \ - INIT_1; \ - prb = HASH; \ - /* cleverly combine group ID with */ \ - /* hash value: group ID in top-most */ \ - /* bits of hash by reversing the */ \ - /* bits and shifting them in place */ \ - prb = (prb ^ rev(grps[r]) >> bits) & hs->mask; \ - for (hb = HASHget(hs, prb); \ - hb != HASHnil(hs) && hb >= start; \ - hb = HASHgetlink(hs, hb)) { \ - if (cand) { \ - q = r; \ - while (q != 0 && cand[--q] - b->hseqbase > hb) \ - ; \ - if (cand[q] - b->hseqbase != hb) \ - continue; \ - if (grps[q] != grps[r]) \ - continue; \ - grp = ngrps[q]; \ - } else { \ - if (grps[hb] != grps[r]) \ - continue; \ - grp = ngrps[hb]; \ - } \ + ASSERT; \ + q = r; \ + while (q != 0 && cand[--q] - b->hseqbase > hb) \ + ; \ + if (cand[q] - b->hseqbase != hb) \ + continue; \ + GRPTST(q, r); \ + grp = ngrps[q]; \ if (COMP) { \ ngrps[r] = grp; \ if (histo) \ @@ -479,27 +460,16 @@ pop(oid x) } \ } else { \ for (r = 0; r < cnt; r++) { \ - if (cand) { \ - p = cand[r] - b->hseqbase; \ - } else { \ - p = start + r; \ - } \ + p = start + r; \ assert(p < end); \ INIT_1; \ prb = HASH; \ for (hb = HASHget(hs, prb); \ _______________________________________________ checkin-list mailing list checkin-list@monetdb.org https://www.monetdb.org/mailman/listinfo/checkin-list