Changeset: bb177ef43091 for MonetDB URL: https://dev.monetdb.org/hg/MonetDB/rev/bb177ef43091 Branch: default Log Message:
Merged with Jan2022 diffs (truncated from 1313 to 300 lines): diff --git a/clients/mapiclient/dump.c b/clients/mapiclient/dump.c --- a/clients/mapiclient/dump.c +++ b/clients/mapiclient/dump.c @@ -1506,15 +1506,15 @@ describe_sequence(Mapi mid, const char * goto bailout; snprintf(query, maxquerylen, - "SELECT s.name, " /* 0 */ - "seq.name, " /* 1 */ - "get_value_for(s.name, seq.name), " /* 2 */ - "seq.\"minvalue\", " /* 3 */ - "seq.\"maxvalue\", " /* 4 */ - "seq.\"increment\", " /* 5 */ - "seq.\"cycle\", " /* 6 */ - "seq.\"cacheinc\", " /* 7 */ - "rem.\"remark\" " /* 8 */ + "SELECT s.name, " /* 0 */ + "seq.name, " /* 1 */ + "peak_next_value_for(s.name, seq.name), " /* 2 */ + "seq.\"minvalue\", " /* 3 */ + "seq.\"maxvalue\", " /* 4 */ + "seq.\"increment\", " /* 5 */ + "seq.\"cycle\", " /* 6 */ + "seq.\"cacheinc\", " /* 7 */ + "rem.\"remark\" " /* 8 */ "FROM sys.sequences seq LEFT OUTER JOIN sys.comments rem ON seq.id = rem.id, " "sys.schemas s " "WHERE s.id = seq.schema_id " diff --git a/gdk/gdk_strimps.c b/gdk/gdk_strimps.c --- a/gdk/gdk_strimps.c +++ b/gdk/gdk_strimps.c @@ -298,15 +298,15 @@ STRMPbuildHeader(BAT *b, BAT *s, CharPai struct canditer ci; size_t values = 0; + TRC_DEBUG_IF(ACCELERATOR) t0 = GDKusec(); - TRC_DEBUG_IF(ACCELERATOR) t0 = GDKusec(); - hlen = STRIMP_HISTSIZE; - if ((hist = (PairHistogramElem *)GDKmalloc(hlen*sizeof(PairHistogramElem))) == NULL) { + ncand = canditer_init(&ci, b, s); + if (ncand == 0) { return false; } - ncand = canditer_init(&ci, b, s); - if (ncand == 0) { + hlen = STRIMP_HISTSIZE; + if ((hist = (PairHistogramElem *)GDKmalloc(hlen*sizeof(PairHistogramElem))) == NULL) { return false; } @@ -357,6 +357,13 @@ STRMPbuildHeader(BAT *b, BAT *s, CharPai if (hist[hidx].p == NULL) { values++; hist[hidx].p = (CharPair *)GDKmalloc(sizeof(CharPair)); + if (!hist[hidx].p) { + bat_iterator_end(&bi); + for (hidx = 0; hidx < hlen; hidx++) + GDKfree(hist[hidx].p); + GDKfree(hist); + return false; + } hist[hidx].p->psize = cpp->psize; hist[hidx].p->pbytes = cpp->pbytes; } @@ -480,6 +487,16 @@ BATcheckstrimps(BAT *b) return ret; } +#define STRMPfilterloop(next) \ + do { \ + for (i = 0; i < ncand; i++) { \ + x = next(&ci); \ + if ((bitstring_array[x] & qbmask) == qbmask) { \ + rvals[j++] = x; \ + } \ + } \ + } while (0) + /* Filter a BAT b using a string q. Return the result as a candidate * list. */ @@ -487,11 +504,11 @@ BAT * STRMPfilter(BAT *b, BAT *s, const str q) { BAT *r = NULL; - BUN i, ncand; + BUN i, ncand, j = 0; uint64_t qbmask; uint64_t *bitstring_array; Strimps *strmps; - oid x; + oid x, *restrict rvals; struct canditer ci; lng t0 = 0; BAT *pb; @@ -512,7 +529,7 @@ STRMPfilter(BAT *b, BAT *s, const str q) STRMPincref(strmps); MT_lock_unset(&pb->batIdxLock); - ncand = canditer_init(&ci, b, s); + ncand = canditer_init(&ci, b, s); if (ncand == 0) { STRMPdecref(strmps, false); return BATdense(b->hseqbase, 0, 0); @@ -525,18 +542,15 @@ STRMPfilter(BAT *b, BAT *s, const str q) qbmask = STRMPmakebitstring(q, strmps); bitstring_array = (uint64_t *)strmps->bitstrings_base; + rvals = Tloc(r, 0); - for (i = 0; i < ncand; i++) { - x = canditer_next(&ci); - if ((bitstring_array[x] & qbmask) == qbmask) { - if (BUNappend(r, &x, false) != GDK_SUCCEED) { - BBPunfix(r->batCacheid); - STRMPdecref(strmps, false); - goto sfilter_fail; - } - } + if (ci.tpe == cand_dense) { + STRMPfilterloop(canditer_next_dense); + } else { + STRMPfilterloop(canditer_next); } + BATsetcount(r, j); r->tkey = true; r->tsorted = true; r->trevsorted = BATcount(r) <= 1; @@ -636,8 +650,8 @@ STRMPcreateStrimpHeap(BAT *b, BAT *s) CharPair hpairs[STRIMP_HEADER_SIZE]; const char *nme; - if ((r = b->tstrimps) == NULL && - STRMPbuildHeader(b, s, hpairs)) { /* Find the header pairs, put + if ((r = b->tstrimps) == NULL && + STRMPbuildHeader(b, s, hpairs)) { /* Find the header pairs, put the result in hpairs */ sz = 8 + STRIMP_HEADER_SIZE; /* add 8-bytes for the descriptor and the pair sizes */ @@ -707,7 +721,7 @@ STRMPcreate(BAT *b, BAT *s) if (pb->tstrimps == NULL) { MT_lock_set(&pb->batIdxLock); - if (pb->tstrimps == NULL) { + if (pb->tstrimps == NULL) { Strimps *r; BATiter bi; BUN i, ncand; @@ -716,10 +730,10 @@ STRMPcreate(BAT *b, BAT *s) str cs; uint64_t *dh; - if ((r = STRMPcreateStrimpHeap(pb, s)) == NULL) { - MT_lock_unset(&b->batIdxLock); + if ((r = STRMPcreateStrimpHeap(pb, s)) == NULL) { + MT_lock_unset(&b->batIdxLock); return GDK_FAIL; - } + } dh = (uint64_t *)r->bitstrings_base; /* Compute bitstrings */ @@ -739,10 +753,10 @@ STRMPcreate(BAT *b, BAT *s) pb->tstrimps = r; pb->batDirtydesc = true; persistStrimp(pb); - } - MT_lock_unset(&pb->batIdxLock); - } - TRC_DEBUG(ACCELERATOR, "strimp creation took " LLFMT " usec\n", GDKusec()-t0); + } + MT_lock_unset(&pb->batIdxLock); + } + TRC_DEBUG(ACCELERATOR, "strimp creation took " LLFMT " usec\n", GDKusec()-t0); return GDK_SUCCEED; } @@ -780,6 +794,7 @@ STRMPappendBitstring(BAT *b, const str s size_t pairs_offset = (char *)strmp->pairs_base - strmp->strimps.base; size_t bitstrings_offset = (char *)strmp->bitstrings_base - strmp->strimps.base; if (HEAPextend(&(strmp->strimps), (size_t)(extend_factor*BATcount(pb)*sizeof(uint64_t)), false) == GDK_FAIL) { + MT_lock_unset(&pb->batIdxLock); GDKerror("Cannot extend heap\n"); return GDK_FAIL; } diff --git a/geom/monetdb5/geom.c b/geom/monetdb5/geom.c --- a/geom/monetdb5/geom.c +++ b/geom/monetdb5/geom.c @@ -5799,10 +5799,9 @@ pnpoly(int *out, int nvert, dbl *vx, dbl } bat_iterator_end(&bpxi); bat_iterator_end(&bpyi); - + BATsetcount(bo, cnt); bo->tsorted = bo->trevsorted = false; bo->tkey = false; - BATsetcount(bo, cnt); BBPunfix(bpx->batCacheid); BBPunfix(bpy->batCacheid); BBPkeepref(*out = bo->batCacheid); @@ -5892,9 +5891,9 @@ pnpolyWithHoles(bat *out, int nvert, dbl } bat_iterator_end(&bpxi); bat_iterator_end(&bpyi); + BATsetcount(bo, cnt); bo->tsorted = bo->trevsorted = false; bo->tkey = false; - BATsetcount(bo, cnt); BBPunfix(bpx->batCacheid); BBPunfix(bpy->batCacheid); BBPkeepref(*out = bo->batCacheid); diff --git a/monetdb5/modules/atoms/mtime.c b/monetdb5/modules/atoms/mtime.c --- a/monetdb5/modules/atoms/mtime.c +++ b/monetdb5/modules/atoms/mtime.c @@ -181,9 +181,9 @@ NAME##_bulk(Client cntxt, MalBlkPtr mb, nils |= is_##OUTTYPE##_nil(ptrn[i]); \ } \ } \ + BATsetcount(bn, n); \ bn->tnonil = !nils; \ bn->tnil = nils; \ - BATsetcount(bn, n); \ SETFLAGS; \ bn->tkey = false; \ bailout: \ @@ -297,9 +297,9 @@ NAME##_bulk(Client cntxt, MalBlkPtr mb, nils |= is_##OUTTYPE##_nil(res); \ } \ } \ + BATsetcount(bn, n); \ bn->tnonil = !nils; \ bn->tnil = nils; \ - BATsetcount(bn, n); \ bn->tsorted = n < 2; \ bn->trevsorted = n < 2; \ bn->tkey = false; \ @@ -378,9 +378,9 @@ NAME##_bulk_p1(Client cntxt, MalBlkPtr m nils |= is_##OUTTYPE##_nil(res); \ } \ } \ + BATsetcount(bn, n); \ bn->tnonil = !nils; \ bn->tnil = nils; \ - BATsetcount(bn, n); \ bn->tsorted = n < 2; \ bn->trevsorted = n < 2; \ bn->tkey = false; \ @@ -455,9 +455,9 @@ NAME##_bulk_p2(Client cntxt, MalBlkPtr m nils |= is_##OUTTYPE##_nil(res); \ } \ } \ + BATsetcount(bn, n); \ bn->tnonil = !nils; \ bn->tnil = nils; \ - BATsetcount(bn, n); \ bn->tsorted = n < 2; \ bn->trevsorted = n < 2; \ bn->tkey = false; \ 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 @@ -2931,18 +2931,18 @@ STRprelude(void *ret) fp[i] = UTF8_toUpper[i].from; tp[i] = UTF8_toUpper[i].to; } + BATsetcount(UTF8_toUpperFrom, i); UTF8_toUpperFrom->tkey = true; UTF8_toUpperFrom->tsorted = true; UTF8_toUpperFrom->trevsorted = false; UTF8_toUpperFrom->tnil = false; UTF8_toUpperFrom->tnonil = true; - BATsetcount(UTF8_toUpperFrom, i); + BATsetcount(UTF8_toUpperTo, i); UTF8_toUpperTo->tkey = false; UTF8_toUpperTo->tsorted = false; UTF8_toUpperTo->trevsorted = false; UTF8_toUpperTo->tnil = false; UTF8_toUpperTo->tnonil = true; - BATsetcount(UTF8_toUpperTo, i); fp = (int *) Tloc(UTF8_toLowerFrom, 0); tp = (int *) Tloc(UTF8_toLowerTo, 0); @@ -2950,18 +2950,18 @@ STRprelude(void *ret) fp[i] = UTF8_toLower[i].from; tp[i] = UTF8_toLower[i].to; } + BATsetcount(UTF8_toLowerFrom, i); UTF8_toLowerFrom->tkey = true; UTF8_toLowerFrom->tsorted = true; UTF8_toLowerFrom->trevsorted = false; UTF8_toLowerFrom->tnil = false; UTF8_toLowerFrom->tnonil = true; - BATsetcount(UTF8_toLowerFrom, i); + BATsetcount(UTF8_toLowerTo, i); UTF8_toLowerTo->tkey = false; UTF8_toLowerTo->tsorted = false; UTF8_toLowerTo->trevsorted = false; _______________________________________________ checkin-list mailing list checkin-list@monetdb.org https://www.monetdb.org/mailman/listinfo/checkin-list