Changeset: b8c7c1d4883d for MonetDB
URL: https://dev.monetdb.org/hg/MonetDB/rev/b8c7c1d4883d
Modified Files:
gdk/gdk_batop.c
gdk/gdk_hash.c
sql/server/rel_exp.c
sql/test/BugTracker-2026/Tests/All
Branch: pp_hashjoin
Log Message:
Merge with default branch.
diffs (214 lines):
diff --git a/gdk/gdk_batop.c b/gdk/gdk_batop.c
--- a/gdk/gdk_batop.c
+++ b/gdk/gdk_batop.c
@@ -1353,11 +1353,13 @@ BATdel(BAT *b, BAT *d)
*/
static gdk_return
BATappend_or_update(BAT *b, BAT *p, const oid *positions, BAT *n,
- bool mayappend, bool autoincr, bool force)
+ bool mayappend, bool autoincr, bool force,
+ const char *func)
{
lng t0 = GDKusec();
oid pos = oid_nil;
BUN nunique = 0;
+ gdk_return rc = GDK_SUCCEED;
if (b == NULL || b->ttype == TYPE_void || n == NULL) {
return GDK_SUCCEED;
@@ -1474,6 +1476,34 @@ BATappend_or_update(BAT *b, BAT *p, cons
bat_iterator_end(&ni);
return GDK_FAIL;
}
+ if (i < ni.count - 1) {
+ BUN j = 1;
+ if (positions) {
+ if (autoincr) {
+ j = ni.count - i;
+ } else {
+ for (j = 1; j <
ni.count - i; j++)
+ if
(positions[j] != updid + j)
+ break;
+ }
+ } else {
+ for (j = 1; j < ni.count - i;
j++)
+ if (BUNtoid(p, i + j)
!= updid + j)
+ break;
+ }
+ if (j > 1) {
+ BAT *s = BATdense(0, i +
n->hseqbase, j);
+ rc = BATappend2(b, n, s, force,
true);
+ BBPreclaim(s);
+ if (rc != GDK_SUCCEED) {
+ bat_iterator_end(&ni);
+ return rc;
+ }
+ i += j - 1;
+ continue;
+ }
+ }
+
if (BUNappend(b, new, force) != GDK_SUCCEED) {
bat_iterator_end(&ni);
return GDK_FAIL;
@@ -1592,7 +1622,6 @@ BATappend_or_update(BAT *b, BAT *p, cons
MT_UNREACHABLE();
}
MT_lock_set(&b->theaplock);
- gdk_return rc = GDK_SUCCEED;
bool skip = false;
if (new == prevnew && !hasdel) {
d = prevoff;
@@ -1973,8 +2002,8 @@ BATappend_or_update(BAT *b, BAT *p, cons
b->theap->dirty = true;
MT_lock_unset(&b->theaplock);
TRC_DEBUG(ALGO,
- "BATreplace(" ALGOBATFMT "," ALGOOPTBATFMT "," ALGOBATFMT ")
" LLFMT " usec\n",
- ALGOBATPAR(b), ALGOOPTBATPAR(p), ALGOBATPAR(n),
+ "%s(" ALGOBATFMT "," ALGOOPTBATFMT "," ALGOBATFMT ") " LLFMT
" usec\n",
+ func, ALGOBATPAR(b), ALGOOPTBATPAR(p), ALGOBATPAR(n),
GDKusec() - t0);
return GDK_SUCCEED;
@@ -1993,14 +2022,16 @@ BATappend_or_update(BAT *b, BAT *p, cons
gdk_return
BATreplace(BAT *b, BAT *p, BAT *n, bool force)
{
- return BATappend_or_update(b, p, NULL, n, false, false, force);
+ return BATappend_or_update(b, p, NULL, n, false, false,
+ force, __func__);
}
/* like BATreplace, but p may specify locations beyond the end of b */
gdk_return
BATupdate(BAT *b, BAT *p, BAT *n, bool force)
{
- return BATappend_or_update(b, p, NULL, n, true, false, force);
+ return BATappend_or_update(b, p, NULL, n, true, false,
+ force, __func__);
}
#if 0 /* not used */
@@ -2008,7 +2039,8 @@ BATupdate(BAT *b, BAT *p, BAT *n, bool f
gdk_return
BATreplacepos(BAT *b, const oid *positions, BAT *n, bool autoincr, bool force)
{
- return BATappend_or_update(b, NULL, positions, n, false, autoincr,
force);
+ return BATappend_or_update(b, NULL, positions, n, false, autoincr,
+ force, __func__);
}
#endif
@@ -2017,7 +2049,8 @@ BATreplacepos(BAT *b, const oid *positio
gdk_return
BATupdatepos(BAT *b, const oid *positions, BAT *n, bool autoincr, bool force)
{
- return BATappend_or_update(b, NULL, positions, n, true, autoincr,
force);
+ return BATappend_or_update(b, NULL, positions, n, true, autoincr,
+ force, __func__);
}
/*
diff --git a/gdk/gdk_hash.c b/gdk/gdk_hash.c
--- a/gdk/gdk_hash.c
+++ b/gdk/gdk_hash.c
@@ -511,8 +511,7 @@ BATcheckhash_locked(BAT *b)
h->nunique = hdata[5];
h->nheads = hdata[6];
h->type = b->ustr ?
TYPE_oid : ATOMbasetype(b->ttype);
- if (h->width <
SIZEOF_BUN &&
- ((BUN) 1 << (8 *
h->width)) - 1 > h->nbucket) {
+ if ((~(BUN) 0 >>
((SIZEOF_BUN - h->width) * 8)) > h->nbucket) {
close(fd);
h->Link =
h->heaplink.base;
h->Bckt =
h->heapbckt.base + HASH_HEADER_SIZE * SIZEOF_SIZE_T;
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
@@ -3287,13 +3287,13 @@ compare_func( comp_type t, int anti )
case cmp_equal:
return anti?"<>":"=";
case cmp_lt:
- return anti?">":"<";
+ return anti?">=":"<";
case cmp_lte:
- return anti?">=":"<=";
+ return anti?">":"<=";
case cmp_gte:
- return anti?"<=":">=";
+ return anti?"<":">=";
case cmp_gt:
- return anti?"<":">";
+ return anti?"<=":">";
case cmp_notequal:
return anti?"=":"<>";
default:
diff --git a/sql/test/BugTracker-2026/Tests/7980-lag-offset-ignored-bug.test
b/sql/test/BugTracker-2026/Tests/7980-lag-offset-ignored-bug.test
new file mode 100644
--- /dev/null
+++ b/sql/test/BugTracker-2026/Tests/7980-lag-offset-ignored-bug.test
@@ -0,0 +1,16 @@
+query I rowsort
+SELECT LAG(v, off) OVER (ORDER BY v) AS actual
+FROM (VALUES (0, 10), (1, 20)) AS t(off, v)
+----
+10
+10
+
+query I rowsort
+SELECT LAG(v, off) OVER (ORDER BY v) AS actual
+FROM (VALUES (0, 10), (1, 20), (2, 30), (1, 40)) AS t(off, v)
+----
+10
+10
+10
+30
+
diff --git a/sql/test/BugTracker-2026/Tests/7981-not-x-lt-x-bug.test
b/sql/test/BugTracker-2026/Tests/7981-not-x-lt-x-bug.test
new file mode 100644
--- /dev/null
+++ b/sql/test/BugTracker-2026/Tests/7981-not-x-lt-x-bug.test
@@ -0,0 +1,34 @@
+query T rowsort
+SELECT NOT (2 < 2)
+----
+True
+
+statement ok
+CREATE TABLE t7981(x INT)
+
+statement ok
+INSERT INTO t7981 VALUES (2)
+
+query ITT rowsort
+SELECT x,
+ NOT (x < x) AS actual_not_x_lt_x,
+ TRUE AS expected
+FROM t7981
+----
+2
+True
+True
+
+query ITT rowsort
+SELECT x,
+ NOT (x < x) AS actual_not_x_lt_x,
+ (x < x) AS actual_x_lt_x
+FROM t7981
+----
+2
+True
+False
+
+statement ok
+DROP TABLE IF EXISTS t7981
+
diff --git a/sql/test/BugTracker-2026/Tests/All
b/sql/test/BugTracker-2026/Tests/All
--- a/sql/test/BugTracker-2026/Tests/All
+++ b/sql/test/BugTracker-2026/Tests/All
@@ -163,3 +163,5 @@ KNOWNFAIL?7974-muli-column-not-in-subque
7977-prepare-optimize
7978-name-leak-prepare-error-recompile
7979-prepare-error-exec-113
+KNOWNFAIL?7980-lag-offset-ignored-bug
+7981-not-x-lt-x-bug
_______________________________________________
checkin-list mailing list -- [email protected]
To unsubscribe send an email to [email protected]