Changeset: 4082a1b3fe14 for MonetDB
URL: https://dev.monetdb.org/hg/MonetDB/rev/4082a1b3fe14
Added Files:
        sql/test/BugTracker-2026/Tests/8113-dict-compress.test
Modified Files:
        sql/backends/monet5/dict.c
        sql/test/BugTracker-2026/Tests/All
Branch: Dec2025
Log Message:

Fix handling of dict-compressed columns.
Fixes #8113.


diffs (68 lines):

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
@@ -1057,7 +1057,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++) {
@@ -1074,6 +1074,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/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/All 
b/sql/test/BugTracker-2026/Tests/All
--- a/sql/test/BugTracker-2026/Tests/All
+++ b/sql/test/BugTracker-2026/Tests/All
@@ -212,3 +212,4 @@ KNOWNFAIL?8030-inner-join-group-by-bug
 8031-simplify-count-too-simple
 8100-error-overflow
 8107-select-generate-date
+8113-dict-compress
_______________________________________________
checkin-list mailing list -- [email protected]
To unsubscribe send an email to [email protected]

Reply via email to