Changeset: 038758c791b3 for MonetDB
URL: https://dev.monetdb.org/hg/MonetDB/rev/038758c791b3
Modified Files:
gdk/gdk_calc.c
gdk/gdk_heap.c
sql/backends/monet5/dict.c
sql/backends/monet5/generator/generator.c
sql/test/BugTracker-2026/Tests/All
Branch: default
Log Message:
Merge with Dec2025 branch.
diffs (truncated from 352 to 300 lines):
diff --git a/gdk/gdk_calc.c b/gdk/gdk_calc.c
--- a/gdk/gdk_calc.c
+++ b/gdk/gdk_calc.c
@@ -4241,8 +4241,8 @@ BATcalcbetweencstcst(BAT *b, const ValRe
BATcheck(b, NULL);
- if (ATOMbasetype(b->ttype) != ATOMbasetype(lo->vtype) ||
- ATOMbasetype(b->ttype) != ATOMbasetype(hi->vtype)) {
+ if (ATOMbasetype(ATOMtype(b->ttype)) !=
ATOMbasetype(ATOMtype(lo->vtype)) ||
+ ATOMbasetype(ATOMtype(b->ttype)) !=
ATOMbasetype(ATOMtype(hi->vtype))) {
GDKerror("incompatible input types.\n");
return NULL;
}
diff --git a/gdk/gdk_heap.c b/gdk/gdk_heap.c
--- a/gdk/gdk_heap.c
+++ b/gdk/gdk_heap.c
@@ -880,7 +880,7 @@ HEAPsave(Heap *h, const char *nme, const
size_t
HEAPvmsize(const Heap *h)
{
- if (h && h->base && h->free)
+ if (h && h != (Heap *) 1 && h->base && h->free)
return h->size;
return 0;
}
@@ -890,7 +890,7 @@ HEAPvmsize(const Heap *h)
size_t
HEAPmemsize(const Heap *h)
{
- if (h && h->base && h->free && h->storage != STORE_MMAP)
+ if (h && h != (Heap *) 1 && h->base && h->free && h->storage !=
STORE_MMAP)
return h->size;
return 0;
}
diff --git a/sql/backends/monet5/dict.c b/sql/backends/monet5/dict.c
--- a/sql/backends/monet5/dict.c
+++ b/sql/backends/monet5/dict.c
@@ -1060,7 +1060,7 @@ DICTenlarge(BAT *offsets, BUN cnt, BUN s
n = COLnew(offsets->hseqbase, TYPE_int, sz, role);
if (!n)
return NULL;
- if (offsets->ttype == TYPE_sht) {
+ if (offsets->ttype == TYPE_bte) {
unsigned char *o = Tloc(offsets, 0);
unsigned int *no = Tloc(n, 0);
for(BUN i = 0; i<cnt; i++) {
@@ -1077,6 +1077,7 @@ DICTenlarge(BAT *offsets, BUN cnt, BUN s
} else {
return NULL;
}
+ BATsetcount(n, cnt);
BATnegateprops(n);
n->tnil = offsets->tnil;
n->tnonil = offsets->tnonil;
diff --git a/sql/backends/monet5/generator/generator.c
b/sql/backends/monet5/generator/generator.c
--- a/sql/backends/monet5/generator/generator.c
+++ b/sql/backends/monet5/generator/generator.c
@@ -243,32 +243,24 @@ VLTgenerator_table_(BAT **result, Client
is_date_nil(f) || is_date_nil(l))
throw(MAL, "generator.table",
SQLSTATE(42000) "Illegal generator
range");
- n = (BUN) (date_diff(l, f) / (s *28)); /* n maybe too
large now */
+ if (s > GDK_int_max / 28)
+ n = 0;
+ else
+ n = (BUN) (date_diff(l, f) / (s * 28)); /* n
maybe too large now */
bn = COLnew(0, TYPE_date, n + 1, TRANSIENT);
if (bn == NULL)
throw(MAL, "generator.table", SQLSTATE(HY013)
MAL_MALLOC_FAIL);
v = (date *) Tloc(bn, 0);
- BUN c;
if (s < 0) {
- for (c = 0; f > l; c++) {
+ for (; !is_date_nil(f) && f > l; f =
date_add_month(f, s)) {
*v++ = f;
- f = date_add_month(f, s);
- if (is_date_nil(f)) {
- BBPreclaim(bn);
- throw(MAL, "generator.table",
SQLSTATE(22003) "overflow in calculation");
- }
}
} else {
- for (c = 0; f < l; c++) {
+ for (; !is_date_nil(f) && f < l; f =
date_add_month(f, s)) {
*v++ = f;
- f = date_add_month(f, s);
- if (is_date_nil(f)) {
- BBPreclaim(bn);
- throw(MAL, "generator.table",
SQLSTATE(22003) "overflow in calculation");
- }
}
}
- n = c;
+ n = v - (date *) Tloc(bn, 0);
bn->tsorted = s > 0 || n <= 1;
bn->trevsorted = s < 0 || n <= 1;
} else if (tpe == TYPE_date) { /* days */
@@ -295,27 +287,16 @@ VLTgenerator_table_(BAT **result, Client
if (bn == NULL)
throw(MAL, "generator.table", SQLSTATE(HY013)
MAL_MALLOC_FAIL);
v = (date *) Tloc(bn, 0);
- BUN c;
if (s < 0) {
- for (c = 0; c < n && f > l; c++) {
+ for (; !is_date_nil(f) && f > l; f =
date_add_day(f, s)) {
*v++ = f;
- f = date_add_day(f, (int) s);
- if (is_date_nil(f)) {
- BBPreclaim(bn);
- throw(MAL, "generator.table",
SQLSTATE(22003) "overflow in calculation");
- }
}
} else {
- for (c = 0; c < n && f < l; c++) {
+ for (; !is_date_nil(f) && f < l; f =
date_add_day(f, s)) {
*v++ = f;
- f = date_add_day(f, (int) s);
- if (is_date_nil(f)) {
- BBPreclaim(bn);
- throw(MAL, "generator.table",
SQLSTATE(22003) "overflow in calculation");
- }
}
}
- n = c;
+ n = v - (date *) Tloc(bn, 0);
bn->tsorted = s > 0 || n <= 1;
bn->trevsorted = s < 0 || n <= 1;
} else if (tpe == TYPE_timestamp) {
@@ -346,18 +327,16 @@ VLTgenerator_table_(BAT **result, Client
if (bn == NULL)
throw(MAL, "generator.table", SQLSTATE(HY013)
MAL_MALLOC_FAIL);
v = (timestamp *) Tloc(bn, 0);
- for (BUN c = 0; c < n; c++) {
- *v++ = f;
- f = timestamp_add_usec(f, s);
- if (is_timestamp_nil(f)) {
- BBPreclaim(bn);
- throw(MAL, "generator.table",
SQLSTATE(22003) "overflow in calculation");
+ if (s < 0) {
+ for (; !is_timestamp_nil(f) && f > l; f =
timestamp_add_usec(f, s)) {
+ *v++ = f;
+ }
+ } else {
+ for (; !is_timestamp_nil(f) && f < l; f =
timestamp_add_usec(f, s)) {
+ *v++ = f;
}
}
- if (f != l) {
- *v++ = f;
- n++;
- }
+ n = v - (timestamp *) Tloc(bn, 0);
bn->tsorted = s > 0 || n <= 1;
bn->trevsorted = s < 0 || n <= 1;
} else {
@@ -1066,7 +1045,7 @@ VLTgenerator_thetasubselect(Client cntxt
} else
if ( strcmp(oper,">") == 0){
low= *getArgReference_TYPE(stk,pci,3, date);
- low = date_add_month(low, 1);
+ low = date_add_day(low, 1);
if (is_date_nil(low)) {
BBPreclaim(cand);
throw(MAL, "generator.select",
SQLSTATE(22003) "overflow in calculation");
diff --git a/sql/test/BugTracker-2026/Tests/8107-select-generate-date.test
b/sql/test/BugTracker-2026/Tests/8107-select-generate-date.test
new file mode 100644
--- /dev/null
+++ b/sql/test/BugTracker-2026/Tests/8107-select-generate-date.test
@@ -0,0 +1,13 @@
+query ITT nosort
+SELECT COUNT(*) AS actual_count,
+ MIN(value) AS actual_min,
+ MAX(value) AS actual_max
+FROM generate_series(
+ DATE '2026-01-01',
+ DATE '2026-01-10',
+ INTERVAL '1' DAY
+ ) AS date_series
+WHERE value > DATE '2026-01-03'
+----
+6 2026-01-04 2026-01-09
+
diff --git a/sql/test/BugTracker-2026/Tests/8113-dict-compress.test
b/sql/test/BugTracker-2026/Tests/8113-dict-compress.test
new file mode 100644
--- /dev/null
+++ b/sql/test/BugTracker-2026/Tests/8113-dict-compress.test
@@ -0,0 +1,35 @@
+statement ok
+CREATE PROCEDURE dict_compress(
+ sname STRING, tname STRING, cname STRING, ordered_values BOOLEAN
+) EXTERNAL NAME dict.compress
+
+statement ok
+CREATE TABLE t (
+ id INTEGER PRIMARY KEY,
+ v VARCHAR(20) NOT NULL
+)
+
+statement ok
+INSERT INTO t VALUES (-1, '-1')
+
+statement ok
+CALL dict_compress('sys', 't', 'v', false)
+
+statement ok
+INSERT INTO t
+SELECT i, CAST(i AS VARCHAR(20))
+FROM generate_series(0, 70001) AS g(i)
+
+query IIII nosort
+SELECT COUNT(*) AS row_count,
+ COUNT(DISTINCT v) AS distinct_count,
+ SUM(CASE WHEN v <> CAST(id AS VARCHAR(20)) THEN 1 ELSE 0 END)
+ AS mismatch_count,
+ COUNT(*) - COUNT(DISTINCT v) AS duplicate_count
+FROM t
+----
+70002 70002 0 0
+
+statement ok
+drop procedure dict_compress
+
diff --git a/sql/test/BugTracker-2026/Tests/8118-between-dense.test
b/sql/test/BugTracker-2026/Tests/8118-between-dense.test
new file mode 100644
--- /dev/null
+++ b/sql/test/BugTracker-2026/Tests/8118-between-dense.test
@@ -0,0 +1,30 @@
+statement ok
+CREATE FUNCTION densebat(n BIGINT)
+RETURNS TABLE(x oid)
+EXTERNAL NAME bat.densebat
+
+statement ok
+CREATE TABLE oid_values(x oid)
+
+statement ok
+INSERT INTO oid_values
+SELECT * FROM densebat(3)
+
+query I
+SELECT x BETWEEN CAST(0 AS oid) AND CAST(2 AS oid) AS materialized_control
+FROM oid_values
+ORDER BY x
+----
+1
+1
+1
+
+query I
+SELECT x BETWEEN CAST(0 AS oid) AND CAST(2 AS oid) AS dense_test
+FROM densebat(3)
+----
+1
+1
+1
+
+
diff --git a/sql/test/BugTracker-2026/Tests/8127-date-overflow.test
b/sql/test/BugTracker-2026/Tests/8127-date-overflow.test
new file mode 100644
--- /dev/null
+++ b/sql/test/BugTracker-2026/Tests/8127-date-overflow.test
@@ -0,0 +1,10 @@
+query ITT nosort
+SELECT count(*), min(value), max(value)
+FROM generate_series(
+ DATE '2000-01-01',
+ DATE '2000-01-02',
+ INTERVAL '1073741824' MONTH
+)
+----
+1 2000-01-01 2000-01-01
+
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
@@ -248,4 +248,8 @@ KNOWNFAIL?8010-first_value-last_value-pa
8100-error-overflow
8105-semijoin-compare-exp-optimization
8106-SQLSpecialColumns-overflow-bug
+8107-select-generate-date
8108-rownumber-topn-equality
+8113-dict-compress
+8118-between-dense
+8127-date-overflow
diff --git a/sql/test/bugs/Tests/All b/sql/test/bugs/Tests/All
--- a/sql/test/bugs/Tests/All
+++ b/sql/test/bugs/Tests/All
@@ -117,3 +117,4 @@ procedure-recompile
rse_bug
delete-or-not-in-bug
default-error
+escaped-unicode
diff --git a/sql/test/bugs/Tests/escaped-unicode.test
b/sql/test/bugs/Tests/escaped-unicode.test
new file mode 100644
--- /dev/null
+++ b/sql/test/bugs/Tests/escaped-unicode.test
@@ -0,0 +1,54 @@
+statement ok
+DROP TABLE IF EXISTS escapetest
_______________________________________________
checkin-list mailing list -- [email protected]
To unsubscribe send an email to [email protected]