Changeset: 2ee1d8519a68 for MonetDB
URL: https://dev.monetdb.org/hg/MonetDB/rev/2ee1d8519a68
Branch: default
Log Message:
Merge with Dec2023 branch.
diffs (truncated from 329 to 300 lines):
diff --git a/debian/control b/debian/control
--- a/debian/control
+++ b/debian/control
@@ -11,7 +11,7 @@ Build-Depends: debhelper (>= 12), cmake
libxml2-dev, pkg-config,
python3, python3-dev, python3-numpy,
unixodbc-dev, zlib1g-dev, r-base-dev,
- libcfitsio-dev, openssl-dev (>= 1.1.1)
+ libcfitsio-dev, libssl-dev (>= 1.1.1)
Standards-Version: 3.8.0
X-Python-Version: >= 2.6
diff --git a/gdk/gdk_bat.c b/gdk/gdk_bat.c
--- a/gdk/gdk_bat.c
+++ b/gdk/gdk_bat.c
@@ -1292,12 +1292,12 @@ BUNappendmulti(BAT *b, const void *value
(count > 1 ||
b->tseqbase + b->batCount != ((oid *)
values)[0]))
b->tseqbase = oid_nil;
- if (b->tsorted && ((oid *)
b->theap->base)[b->batCount - 1] > ((oid *) values)[0]) {
+ if (b->tsorted && !is_oid_nil(((oid *)
b->theap->base)[b->batCount - 1]) && ((oid *) b->theap->base)[b->batCount - 1]
> ((oid *) values)[0]) {
b->tsorted = false;
if (b->tnosorted == 0)
b->tnosorted = b->batCount;
}
- if (b->trevsorted && ((oid *)
b->theap->base)[b->batCount - 1] < ((oid *) values)[0]) {
+ if (b->trevsorted && !is_oid_nil(((oid *)
values)[0]) && ((oid *) b->theap->base)[b->batCount - 1] < ((oid *) values)[0])
{
b->trevsorted = false;
if (b->tnorevsorted == 0)
b->tnorevsorted = b->batCount;
diff --git a/gdk/gdk_calc.c b/gdk/gdk_calc.c
--- a/gdk/gdk_calc.c
+++ b/gdk/gdk_calc.c
@@ -4028,6 +4028,13 @@ bailout:
return NULL;
}
+#define HANDLE_TIMEOUT \
+ do { \
+ GDKerror("%s\n", GDKexiting() ? EXITING_MSG : TIMEOUT_MSG); \
+ BBPreclaim(bn); \
+ bn = NULL; \
+ } while (0)
+
BAT *
BATcalcbetween(BAT *b, BAT *lo, BAT *hi, BAT *s, BAT *slo, BAT *shi,
bool symmetric, bool linc, bool hinc, bool nils_false, bool anti)
@@ -4064,20 +4071,50 @@ BATcalcbetween(BAT *b, BAT *lo, BAT *hi,
BATiter bi = bat_iterator(b);
BATiter loi = bat_iterator(lo);
BATiter hii = bat_iterator(hi);
- bn = BATcalcbetween_intern(bi.base, 1,
- bi.vh ? bi.vh->base : NULL,
- bi.width,
- loi.base, 1,
- loi.vh ? loi.vh->base : NULL,
- loi.width,
- hii.base, 1,
- hii.vh ? hii.vh->base : NULL,
- hii.width,
- bi.type,
- &ci, &cilo, &cihi,
- b->hseqbase, lo->hseqbase, hi->hseqbase,
- symmetric, anti, linc, hinc,
- nils_false, __func__);
+ if (b->ttype == TYPE_void || lo->ttype == TYPE_void || hi->ttype ==
TYPE_void) {
+ lng timeoffset = 0;
+ QryCtx *qry_ctx = MT_thread_get_qry_ctx();
+ if (qry_ctx != NULL) {
+ timeoffset = (qry_ctx->starttime &&
qry_ctx->querytimeout) ? (qry_ctx->starttime + qry_ctx->querytimeout) : 0;
+ }
+ bn = COLnew(ci.seq, TYPE_bit, ci.ncand, TRANSIENT);
+ if (bn) {
+ bit *restrict dst = (bit *) Tloc(bn, 0);
+ BUN i, j, k, l;
+ BUN nils = 0;
+ TIMEOUT_LOOP_IDX(l, ci.ncand, timeoffset) {
+ i = canditer_next(&ci) - b->hseqbase;
+ j = canditer_next(&cilo) - lo->hseqbase;
+ k = canditer_next(&cihi) - hi->hseqbase;
+ dst[l] = BETWEEN(BUNtoid(b, i),
+ BUNtoid(lo, j),
+ BUNtoid(hi, k), oid);
+ nils += is_bit_nil(dst[l]);
+ }
+ BATsetcount(bn, ci.ncand);
+ bn->tsorted = ci.ncand <= 1 || nils == ci.ncand;
+ bn->trevsorted = ci.ncand <= 1 || nils == ci.ncand;
+ bn->tkey = ci.ncand <= 1;
+ bn->tnil = nils != 0;
+ bn->tnonil = nils == 0;
+ TIMEOUT_CHECK(timeoffset, HANDLE_TIMEOUT);
+ }
+ } else {
+ bn = BATcalcbetween_intern(bi.base, 1,
+ bi.vh ? bi.vh->base : NULL,
+ bi.width,
+ loi.base, 1,
+ loi.vh ? loi.vh->base : NULL,
+ loi.width,
+ hii.base, 1,
+ hii.vh ? hii.vh->base : NULL,
+ hii.width,
+ bi.type,
+ &ci, &cilo, &cihi,
+ b->hseqbase, lo->hseqbase,
hi->hseqbase,
+ symmetric, anti, linc, hinc,
+ nils_false, __func__);
+ }
bat_iterator_end(&bi);
bat_iterator_end(&loi);
bat_iterator_end(&hii);
@@ -4115,18 +4152,45 @@ BATcalcbetweencstcst(BAT *b, const ValRe
canditer_init(&ci, b, s);
BATiter bi = bat_iterator(b);
- bn = BATcalcbetween_intern(bi.base, 1,
- bi.vh ? bi.vh->base : NULL,
- bi.width,
- VALptr(lo), 0, NULL, 0,
- VALptr(hi), 0, NULL, 0,
- bi.type,
- &ci,
- &(struct canditer){.tpe=cand_dense,
.ncand=ci.ncand},
- &(struct canditer){.tpe=cand_dense,
.ncand=ci.ncand},
- b->hseqbase, 0, 0, symmetric, anti,
- linc, hinc, nils_false,
- __func__);
+ if (b->ttype == TYPE_void) {
+ lng timeoffset = 0;
+ QryCtx *qry_ctx = MT_thread_get_qry_ctx();
+ if (qry_ctx != NULL) {
+ timeoffset = (qry_ctx->starttime &&
qry_ctx->querytimeout) ? (qry_ctx->starttime + qry_ctx->querytimeout) : 0;
+ }
+ bn = COLnew(ci.seq, TYPE_bit, ci.ncand, TRANSIENT);
+ if (bn) {
+ bit *restrict dst = (bit *) Tloc(bn, 0);
+ BUN i, l;
+ BUN nils = 0;
+ TIMEOUT_LOOP_IDX(l, ci.ncand, timeoffset) {
+ i = canditer_next(&ci) - b->hseqbase;
+ dst[l] = BETWEEN(BUNtoid(b, i), lo->val.oval,
+ hi->val.oval, oid);
+ nils += is_bit_nil(dst[l]);
+ }
+ BATsetcount(bn, ci.ncand);
+ bn->tsorted = ci.ncand <= 1 || nils == ci.ncand;
+ bn->trevsorted = ci.ncand <= 1 || nils == ci.ncand;
+ bn->tkey = ci.ncand <= 1;
+ bn->tnil = nils != 0;
+ bn->tnonil = nils == 0;
+ TIMEOUT_CHECK(timeoffset, HANDLE_TIMEOUT);
+ }
+ } else {
+ bn = BATcalcbetween_intern(bi.base, 1,
+ bi.vh ? bi.vh->base : NULL,
+ bi.width,
+ VALptr(lo), 0, NULL, 0,
+ VALptr(hi), 0, NULL, 0,
+ bi.type,
+ &ci,
+ &(struct canditer){.tpe=cand_dense,
.ncand=ci.ncand},
+ &(struct canditer){.tpe=cand_dense,
.ncand=ci.ncand},
+ b->hseqbase, 0, 0, symmetric, anti,
+ linc, hinc, nils_false,
+ __func__);
+ }
bat_iterator_end(&bi);
TRC_DEBUG(ALGO, "b=" ALGOBATFMT ",s=" ALGOOPTBATFMT
@@ -4165,21 +4229,49 @@ BATcalcbetweenbatcst(BAT *b, BAT *lo, co
BATiter bi = bat_iterator(b);
BATiter loi = bat_iterator(lo);
- bn = BATcalcbetween_intern(bi.base, 1,
- bi.vh ? bi.vh->base : NULL,
- bi.width,
- loi.base, 1,
- loi.vh ? loi.vh->base : NULL,
- loi.width,
- VALptr(hi), 0, NULL, 0,
- bi.type,
- &ci,
- &cilo,
- &(struct canditer){.tpe=cand_dense,
.ncand=ci.ncand},
- b->hseqbase, lo->hseqbase, 0,
- symmetric, anti,
- linc, hinc, nils_false,
- __func__);
+ if (b->ttype == TYPE_void || lo->ttype == TYPE_void) {
+ lng timeoffset = 0;
+ QryCtx *qry_ctx = MT_thread_get_qry_ctx();
+ if (qry_ctx != NULL) {
+ timeoffset = (qry_ctx->starttime &&
qry_ctx->querytimeout) ? (qry_ctx->starttime + qry_ctx->querytimeout) : 0;
+ }
+ bn = COLnew(ci.seq, TYPE_bit, ci.ncand, TRANSIENT);
+ if (bn) {
+ bit *restrict dst = (bit *) Tloc(bn, 0);
+ BUN i, j, l;
+ BUN nils = 0;
+ TIMEOUT_LOOP_IDX(l, ci.ncand, timeoffset) {
+ i = canditer_next(&ci) - b->hseqbase;
+ j = canditer_next(&cilo) - lo->hseqbase;
+ dst[l] = BETWEEN(BUNtoid(b, i), BUNtoid(lo, j),
+ hi->val.oval, oid);
+ nils += is_bit_nil(dst[l]);
+ }
+ BATsetcount(bn, ci.ncand);
+ bn->tsorted = ci.ncand <= 1 || nils == ci.ncand;
+ bn->trevsorted = ci.ncand <= 1 || nils == ci.ncand;
+ bn->tkey = ci.ncand <= 1;
+ bn->tnil = nils != 0;
+ bn->tnonil = nils == 0;
+ TIMEOUT_CHECK(timeoffset, HANDLE_TIMEOUT);
+ }
+ } else {
+ bn = BATcalcbetween_intern(bi.base, 1,
+ bi.vh ? bi.vh->base : NULL,
+ bi.width,
+ loi.base, 1,
+ loi.vh ? loi.vh->base : NULL,
+ loi.width,
+ VALptr(hi), 0, NULL, 0,
+ bi.type,
+ &ci,
+ &cilo,
+ &(struct canditer){.tpe=cand_dense,
.ncand=ci.ncand},
+ b->hseqbase, lo->hseqbase, 0,
+ symmetric, anti,
+ linc, hinc, nils_false,
+ __func__);
+ }
bat_iterator_end(&bi);
bat_iterator_end(&loi);
@@ -4221,21 +4313,49 @@ BATcalcbetweencstbat(BAT *b, const ValRe
BATiter bi = bat_iterator(b);
BATiter hii = bat_iterator(hi);
- bn = BATcalcbetween_intern(bi.base, 1,
- bi.vh ? bi.vh->base : NULL,
- bi.width,
- VALptr(lo), 0, NULL, 0,
- hii.base, 1,
- hii.vh ? hii.vh->base : NULL,
- hii.width,
- bi.type,
- &ci,
- &(struct canditer){.tpe=cand_dense,
.ncand=ci.ncand},
- &cihi,
- b->hseqbase, 0, hi->hseqbase,
- symmetric, anti,
- linc, hinc, nils_false,
- __func__);
+ if (b->ttype == TYPE_void || hi->ttype == TYPE_void) {
+ lng timeoffset = 0;
+ QryCtx *qry_ctx = MT_thread_get_qry_ctx();
+ if (qry_ctx != NULL) {
+ timeoffset = (qry_ctx->starttime &&
qry_ctx->querytimeout) ? (qry_ctx->starttime + qry_ctx->querytimeout) : 0;
+ }
+ bn = COLnew(ci.seq, TYPE_bit, ci.ncand, TRANSIENT);
+ if (bn) {
+ bit *restrict dst = (bit *) Tloc(bn, 0);
+ BUN i, k, l;
+ BUN nils = 0;
+ TIMEOUT_LOOP_IDX(l, ci.ncand, timeoffset) {
+ i = canditer_next(&ci) - b->hseqbase;
+ k = canditer_next(&cihi) - hi->hseqbase;
+ dst[l] = BETWEEN(BUNtoid(b, i), lo->val.oval,
+ BUNtoid(hi, k), oid);
+ nils += is_bit_nil(dst[l]);
+ }
+ BATsetcount(bn, ci.ncand);
+ bn->tsorted = ci.ncand <= 1 || nils == ci.ncand;
+ bn->trevsorted = ci.ncand <= 1 || nils == ci.ncand;
+ bn->tkey = ci.ncand <= 1;
+ bn->tnil = nils != 0;
+ bn->tnonil = nils == 0;
+ TIMEOUT_CHECK(timeoffset, HANDLE_TIMEOUT);
+ }
+ } else {
+ bn = BATcalcbetween_intern(bi.base, 1,
+ bi.vh ? bi.vh->base : NULL,
+ bi.width,
+ VALptr(lo), 0, NULL, 0,
+ hii.base, 1,
+ hii.vh ? hii.vh->base : NULL,
+ hii.width,
+ bi.type,
+ &ci,
+ &(struct canditer){.tpe=cand_dense,
.ncand=ci.ncand},
+ &cihi,
+ b->hseqbase, 0, hi->hseqbase,
+ symmetric, anti,
+ linc, hinc, nils_false,
+ __func__);
+ }
bat_iterator_end(&bi);
bat_iterator_end(&hii);
_______________________________________________
checkin-list mailing list -- [email protected]
To unsubscribe send an email to [email protected]