Changeset: 3cb1fffbf420 for MonetDB URL: https://dev.monetdb.org/hg/MonetDB/rev/3cb1fffbf420 Modified Files: sql/backends/monet5/sql.c Branch: sqloptimizer Log Message:
Merged with default diffs (truncated from 11904 to 300 lines): diff --git a/NT/mksqlwxs.py b/NT/mksqlwxs.py --- a/NT/mksqlwxs.py +++ b/NT/mksqlwxs.py @@ -158,7 +158,7 @@ def main(): vcpkg.format(r'bin\getopt.dll'), vcpkg.format(r'bin\libxml2.dll'), vcpkg.format(r'bin\lz4.dll'), - vcpkg.format(r'bin\lzma.dll'), + vcpkg.format(r'bin\liblzma.dll'), vcpkg.format(r'bin\pcre.dll'), vcpkg.format(r'bin\zlib1.dll')]) id = comp(debug, id, 14, diff --git a/clients/Tests/exports.stable.out b/clients/Tests/exports.stable.out --- a/clients/Tests/exports.stable.out +++ b/clients/Tests/exports.stable.out @@ -124,7 +124,7 @@ gdk_return BATfirstn(BAT **topn, BAT **g restrict_t BATgetaccess(BAT *b); ValPtr BATgetprop(BAT *b, enum prop_t idx); gdk_return BATgroup(BAT **groups, BAT **extents, BAT **histo, BAT *b, BAT *s, BAT *g, BAT *e, BAT *h) __attribute__((__warn_unused_result__)); -const char *BATgroupaggrinit(BAT *b, BAT *g, BAT *e, BAT *s, oid *minp, oid *maxp, BUN *ngrpp, struct canditer *ci, BUN *ncand); +const char *BATgroupaggrinit(BAT *b, BAT *g, BAT *e, BAT *s, oid *minp, oid *maxp, BUN *ngrpp, struct canditer *ci); gdk_return BATgroupavg(BAT **bnp, BAT **cntsp, BAT *b, BAT *g, BAT *e, BAT *s, int tp, bool skip_nils, bool abort_on_error, int scale); gdk_return BATgroupavg3(BAT **avgp, BAT **remp, BAT **cntp, BAT *b, BAT *g, BAT *e, BAT *s, bool skip_nils); BAT *BATgroupavg3combine(BAT *avg, BAT *rem, BAT *cnt, BAT *g, BAT *e, bool skip_nils); @@ -462,7 +462,7 @@ ssize_t bteFromStr(const char *src, size ssize_t bteToStr(str *dst, size_t *len, const bte *src, bool external); const bte bte_nil; oid canditer_idx(const struct canditer *ci, BUN p); -BUN canditer_init(struct canditer *ci, BAT *b, BAT *s); +void canditer_init(struct canditer *ci, BAT *b, BAT *s); oid canditer_last(const struct canditer *ci); oid canditer_mask_next(const struct canditer *ci, oid o, bool next); oid canditer_peek(struct canditer *ci); diff --git a/gdk/gdk.h b/gdk/gdk.h --- a/gdk/gdk.h +++ b/gdk/gdk.h @@ -925,10 +925,10 @@ gdk_export void HEAPincref(Heap *h); * The BAT iterator provides a number of fields that can (and often * should) be used to access information about the BAT. For string * BATs, if a parallel threads adds values, the offset heap (theap) may - * get replaced by a one that is wider. This involves changing the - * twidth and tshift values in the BAT structure. These changed values - * should not be used to access the data in the iterator. Instead, use - * the width and shift values in the iterator itself. + * get replaced by one that is wider. This involves changing the twidth + * and tshift values in the BAT structure. These changed values should + * not be used to access the data in the iterator. Instead, use the + * width and shift values in the iterator itself. */ typedef struct BATiter { BAT *b; diff --git a/gdk/gdk_aggr.c b/gdk/gdk_aggr.c --- a/gdk/gdk_aggr.c +++ b/gdk/gdk_aggr.c @@ -61,7 +61,7 @@ const char * BATgroupaggrinit(BAT *b, BAT *g, BAT *e, BAT *s, /* outputs: */ oid *minp, oid *maxp, BUN *ngrpp, - struct canditer *ci, BUN *ncand) + struct canditer *ci) { oid min, max; BUN i, ngrp; @@ -69,7 +69,7 @@ BATgroupaggrinit(BAT *b, BAT *g, BAT *e, if (b == NULL) return "b must exist"; - *ncand = canditer_init(ci, b, s); + canditer_init(ci, b, s); if (g) { if (ci->ncand != BATcount(g) || (ci->ncand != 0 && ci->seq != g->hseqbase)) @@ -168,7 +168,7 @@ exchange(double *x, double *y) /* this function was adapted from https://bugs.python.org/file10357/msum4.py */ BUN dofsum(const void *restrict values, oid seqb, - struct canditer *restrict ci, BUN ncand, + struct canditer *restrict ci, void *restrict results, BUN ngrp, int tp1, int tp2, const oid *restrict gids, oid min, oid max, bool skip_nils, bool abort_on_error, @@ -229,7 +229,7 @@ dofsum(const void *restrict values, oid return BUN_NONE; } } - TIMEOUT_LOOP(ncand, timeoffset) { + TIMEOUT_LOOP(ci->ncand, timeoffset) { listi = canditer_next(ci) - seqb; grp = gids ? gids[listi] : 0; if (grp < min || grp > max) @@ -448,8 +448,8 @@ dofsum(const void *restrict values, oid *algo = "sum: no candidates, no groups"; \ sum = 0; \ if (nonil) { \ - *seen = ncand > 0; \ - TIMEOUT_LOOP_IDX(i, ncand, timeoffset) { \ + *seen = ci->ncand > 0; \ + TIMEOUT_LOOP_IDX(i, ci->ncand, timeoffset) { \ x = vals[ci->seq + i - seqb]; \ ADD_WITH_CHECK(x, sum, \ TYPE2, sum, \ @@ -460,7 +460,7 @@ dofsum(const void *restrict values, oid GOTO_LABEL_TIMEOUT_HANDLER(bailout)); \ } else { \ bool seenval = false; \ - TIMEOUT_LOOP_IDX(i, ncand, timeoffset) { \ + TIMEOUT_LOOP_IDX(i, ci->ncand, timeoffset) { \ x = vals[ci->seq + i - seqb]; \ if (is_##TYPE1##_nil(x)) { \ if (!skip_nils) { \ @@ -488,7 +488,7 @@ dofsum(const void *restrict values, oid bool seenval = false; \ *algo = "sum: with candidates, no groups"; \ sum = 0; \ - TIMEOUT_LOOP_IDX(i, ncand, timeoffset) { \ + TIMEOUT_LOOP_IDX(i, ci->ncand, timeoffset) { \ x = vals[canditer_next(ci) - seqb]; \ if (is_##TYPE1##_nil(x)) { \ if (!skip_nils) { \ @@ -511,7 +511,7 @@ dofsum(const void *restrict values, oid } else if (ci->tpe == cand_dense) { \ /* multiple groups, no candidate list */ \ *algo = "sum: no candidates, with groups"; \ - TIMEOUT_LOOP_IDX(i, ncand, timeoffset) { \ + TIMEOUT_LOOP_IDX(i, ci->ncand, timeoffset) { \ if (gids == NULL || \ (gids[i] >= min && gids[i] <= max)) { \ gid = gids ? gids[i] - min : (oid) i; \ @@ -544,7 +544,7 @@ dofsum(const void *restrict values, oid } else { \ /* multiple groups, with candidate list */ \ *algo = "sum: with candidates, with groups"; \ - TIMEOUT_LOOP(ncand, timeoffset) { \ + TIMEOUT_LOOP(ci->ncand, timeoffset) { \ i = canditer_next(ci) - seqb; \ if (gids == NULL || \ (gids[i] >= min && gids[i] <= max)) { \ @@ -588,8 +588,8 @@ dofsum(const void *restrict values, oid sum = 0; \ if (nonil) { \ *algo = "sum: no candidates, no groups, no nils, no overflow"; \ - *seen = ncand > 0; \ - TIMEOUT_LOOP_IDX(i, ncand, timeoffset) { \ + *seen = ci->ncand > 0; \ + TIMEOUT_LOOP_IDX(i, ci->ncand, timeoffset) { \ sum += vals[ci->seq + i - seqb]; \ } \ TIMEOUT_CHECK(timeoffset, \ @@ -597,7 +597,7 @@ dofsum(const void *restrict values, oid } else { \ bool seenval = false; \ *algo = "sum: no candidates, no groups, no overflow"; \ - TIMEOUT_LOOP_IDX(i, ncand, timeoffset) { \ + TIMEOUT_LOOP_IDX(i, ci->ncand, timeoffset) { \ x = vals[ci->seq + i - seqb]; \ if (is_##TYPE1##_nil(x)) { \ if (!skip_nils) { \ @@ -622,7 +622,7 @@ dofsum(const void *restrict values, oid bool seenval = false; \ *algo = "sum: with candidates, no groups, no overflow"; \ sum = 0; \ - TIMEOUT_LOOP_IDX(i, ncand, timeoffset) { \ + TIMEOUT_LOOP_IDX(i, ci->ncand, timeoffset) { \ x = vals[canditer_next(ci) - seqb]; \ if (is_##TYPE1##_nil(x)) { \ if (!skip_nils) { \ @@ -643,7 +643,7 @@ dofsum(const void *restrict values, oid /* multiple groups, no candidate list */ \ if (nonil) { \ *algo = "sum: no candidates, with groups, no nils, no overflow"; \ - TIMEOUT_LOOP_IDX(i, ncand, timeoffset) { \ + TIMEOUT_LOOP_IDX(i, ci->ncand, timeoffset) { \ if (gids == NULL || \ (gids[i] >= min && gids[i] <= max)) { \ gid = gids ? gids[i] - min : (oid) i; \ @@ -660,7 +660,7 @@ dofsum(const void *restrict values, oid GOTO_LABEL_TIMEOUT_HANDLER(bailout)); \ } else { \ *algo = "sum: no candidates, with groups, no overflow"; \ - TIMEOUT_LOOP_IDX(i, ncand, timeoffset) { \ + TIMEOUT_LOOP_IDX(i, ci->ncand, timeoffset) { \ if (gids == NULL || \ (gids[i] >= min && gids[i] <= max)) { \ gid = gids ? gids[i] - min : (oid) i; \ @@ -688,7 +688,7 @@ dofsum(const void *restrict values, oid } else { \ /* multiple groups, with candidate list */ \ *algo = "sum: with candidates, with groups, no overflow"; \ - TIMEOUT_LOOP(ncand, timeoffset) { \ + TIMEOUT_LOOP(ci->ncand, timeoffset) { \ i = canditer_next(ci) - seqb; \ if (gids == NULL || \ (gids[i] >= min && gids[i] <= max)) { \ @@ -718,7 +718,7 @@ dofsum(const void *restrict values, oid static BUN dosum(const void *restrict values, bool nonil, oid seqb, - struct canditer *restrict ci, BUN ncand, + struct canditer *restrict ci, void *restrict results, BUN ngrp, int tp1, int tp2, const oid *restrict gids, oid min, oid max, bool skip_nils, bool abort_on_error, @@ -744,7 +744,7 @@ dosum(const void *restrict values, bool if (tp1 != TYPE_flt && tp1 != TYPE_dbl) goto unsupported; *algo = "sum: floating point"; - return dofsum(values, seqb, ci, ncand, results, ngrp, tp1, tp2, + return dofsum(values, seqb, ci, results, ngrp, tp1, tp2, gids, min, max, skip_nils, abort_on_error, nil_if_empty); } @@ -771,7 +771,7 @@ dosum(const void *restrict values, bool sht *restrict sums = (sht *) results; switch (tp1) { case TYPE_bte: - if (ncand < ((BUN) 1 << ((sizeof(sht) - sizeof(bte)) << 3))) + if (ci->ncand < ((BUN) 1 << ((sizeof(sht) - sizeof(bte)) << 3))) AGGR_SUM_NOOVL(bte, sht); else AGGR_SUM(bte, sht); @@ -788,13 +788,13 @@ dosum(const void *restrict values, bool int *restrict sums = (int *) results; switch (tp1) { case TYPE_bte: - if (ncand < ((BUN) 1 << ((sizeof(int) - sizeof(bte)) << 3))) + if (ci->ncand < ((BUN) 1 << ((sizeof(int) - sizeof(bte)) << 3))) AGGR_SUM_NOOVL(bte, int); else AGGR_SUM(bte, int); break; case TYPE_sht: - if (ncand < ((BUN) 1 << ((sizeof(int) - sizeof(sht)) << 3))) + if (ci->ncand < ((BUN) 1 << ((sizeof(int) - sizeof(sht)) << 3))) AGGR_SUM_NOOVL(sht, int); else AGGR_SUM(sht, int); @@ -822,19 +822,19 @@ dosum(const void *restrict values, bool break; #else case TYPE_bte: - if (ncand < ((BUN) 1 << ((sizeof(lng) - sizeof(bte)) << 3))) + if (ci->ncand < ((BUN) 1 << ((sizeof(lng) - sizeof(bte)) << 3))) AGGR_SUM_NOOVL(bte, lng); else AGGR_SUM(bte, lng); break; case TYPE_sht: - if (ncand < ((BUN) 1 << ((sizeof(lng) - sizeof(sht)) << 3))) + if (ci->ncand < ((BUN) 1 << ((sizeof(lng) - sizeof(sht)) << 3))) AGGR_SUM_NOOVL(sht, lng); else AGGR_SUM(sht, lng); break; case TYPE_int: - if (ncand < ((BUN) 1 << ((sizeof(lng) - sizeof(int)) << 3))) + if (ci->ncand < ((BUN) 1 << ((sizeof(lng) - sizeof(int)) << 3))) AGGR_SUM_NOOVL(int, lng); else AGGR_SUM(int, lng); @@ -921,14 +921,13 @@ BATgroupsum(BAT *b, BAT *g, BAT *e, BAT BUN nils; BAT *bn; struct canditer ci; - BUN ncand; const char *err; const char *algo = NULL; lng t0 = 0; TRC_DEBUG_IF(ALGO) t0 = GDKusec(); - if ((err = BATgroupaggrinit(b, g, e, s, &min, &max, &ngrp, &ci, &ncand)) != NULL) { + if ((err = BATgroupaggrinit(b, g, e, s, &min, &max, &ngrp, &ci)) != NULL) { GDKerror("%s\n", err); return NULL; } @@ -937,14 +936,14 @@ BATgroupsum(BAT *b, BAT *g, BAT *e, BAT return NULL; } - if (ncand == 0 || ngrp == 0) { + if (ci.ncand == 0 || ngrp == 0) { /* trivial: no sums, so return bat aligned with g with * nil in the tail */ return BATconstant(ngrp == 0 ? 0 : min, tp, ATOMnilptr(tp), ngrp, TRANSIENT); } if ((e == NULL || - (BATcount(e) == ncand && e->hseqbase == ci.hseq)) && + (BATcount(e) == ci.ncand && e->hseqbase == ci.hseq)) && (BATtdense(g) || (g->tkey && g->tnonil))) { /* trivial: singleton groups, so all results are equal * to the inputs (but possibly a different type) */ @@ -962,7 +961,7 @@ BATgroupsum(BAT *b, BAT *g, BAT *e, BAT gids = (const oid *) Tloc(g, 0); BATiter bi = bat_iterator(b); - nils = dosum(bi.base, b->tnonil, b->hseqbase, &ci, ncand, + nils = dosum(bi.base, b->tnonil, b->hseqbase, &ci, Tloc(bn, 0), ngrp, b->ttype, tp, gids, min, max, skip_nils, abort_on_error, true, __func__, &algo); _______________________________________________ checkin-list mailing list -- checkin-list@monetdb.org To unsubscribe send an email to checkin-list-le...@monetdb.org