Changeset: 527bc2e61ea0 for MonetDB
URL: https://dev.monetdb.org/hg/MonetDB/rev/527bc2e61ea0
Modified Files:
sql/backends/monet5/dict.c
sql/test/dict/Tests/dict01.test
Branch: Jan2022
Log Message:
Look for void bats, please someone review this. Also use right macro for
external types
diffs (122 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
@@ -499,7 +499,7 @@ DICTrenumber_intern( BAT *o, BAT *lc, BA
}
/* dense or cheap dense check */
if (!BATtdense(lc) && !(lc->tsorted && lc->tkey && BATcount(lc) ==
offcnt && *(oid*)Tloc(lc, offcnt-1) == offcnt-1)) {
- BAT *nrc = COLnew(0, rc->ttype, offcnt, TRANSIENT);
+ BAT *nrc = COLnew(0, ATOMtype(rc->ttype), offcnt, TRANSIENT);
if (!nrc) {
if (lc != olc)
bat_destroy(lc);
@@ -509,14 +509,26 @@ DICTrenumber_intern( BAT *o, BAT *lc, BA
}
/* create map with holes filled in */
- oid *op = Tloc(nrc, 0);
- oid *ip = Tloc(rc, 0);
+ oid *restrict op = Tloc(nrc, 0);
unsigned char *lp = Tloc(lc, 0);
- for(BUN i = 0, j = 0; i<offcnt; i++) {
- if (lp[j] > i) {
- op[i] = offcnt;
- } else {
- op[i] = ip[j++];
+ if (BATtvoid(rc)) {
+ oid seq = rc->tseqbase + rc->hseqbase, j = 0;
+ for(BUN i = 0; i<offcnt; i++) {
+ if (lp[j] > i) {
+ op[i] = offcnt;
+ } else {
+ op[i] = seq + j;
+ j++;
+ }
+ }
+ } else {
+ oid *ip = Tloc(rc, 0);
+ for(BUN i = 0, j = 0; i<offcnt; i++) {
+ if (lp[j] > i) {
+ op[i] = offcnt;
+ } else {
+ op[i] = ip[j++];
+ }
}
}
BATsetcount(nrc, offcnt);
@@ -687,7 +699,7 @@ DICTthetaselect(Client cntxt, MalBlkPtr
BUN max_cnt = lv->ttype == TYPE_bte?256:(64*1024);
if ((lv->tkey && (op[0] == '=' || op[0] == '!')) || ((op[0] == '<' ||
op[0] == '>') && lv->tsorted && BATcount(lv) < (max_cnt/2))) {
BUN p = BUN_NONE;
- if (ATOMvarsized(lv->ttype))
+ if (ATOMextern(lv->ttype))
v = *(ptr*)v;
if (op[0] == '=' || op[0] == '!') {
p = BUNfnd(lv, v);
@@ -709,7 +721,7 @@ DICTthetaselect(Client cntxt, MalBlkPtr
bn = BATdense(0, 0, 0);
}
} else { /* select + intersect */
- if (ATOMvarsized(lv->ttype))
+ if (ATOMextern(lv->ttype))
v = *(ptr*)v;
bn = BATthetaselect(lv, NULL, v, op);
/* call dict convert */
@@ -769,7 +781,7 @@ DICTselect(Client cntxt, MalBlkPtr mb, M
throw(SQL, "dict.select", SQLSTATE(HY013) MAL_MALLOC_FAIL);
}
- if (ATOMvarsized(lv->ttype)) {
+ if (ATOMextern(lv->ttype)) {
l = *(ptr*)l;
h = *(ptr*)h;
}
diff --git a/sql/test/dict/Tests/dict01.test b/sql/test/dict/Tests/dict01.test
--- a/sql/test/dict/Tests/dict01.test
+++ b/sql/test/dict/Tests/dict01.test
@@ -658,6 +658,45 @@ statement ok
START TRANSACTION
statement ok
+CREATE TABLE "t0" ("c0" INET,CONSTRAINT "t0_c0_pkey" PRIMARY KEY ("c0"))
+
+statement ok
+CREATE TABLE "t1" ("c0" INET,CONSTRAINT "con2" UNIQUE ("c0"))
+
+statement ok rowcount 4
+INSERT INTO "t1" VALUES
('25.170.105.65/11'),('50.132.219.7/25'),('83.196.168.47'),('201.118.197.112/24')
+
+statement ok
+create view v1(vc0) as (select blob 'b0' from t1, t0)
+
+statement ok
+COMMIT
+
+statement ok
+CALL "sys"."dict_compress"('sys','t1','c0')
+
+statement ok rowcount 0
+UPDATE t1 SET c0 = least(INET '110.84.240.170', t1.c0) FROM v1 WHERE (0.4) IN
(2, 0.8)
+
+statement ok
+START TRANSACTION
+
+statement ok
+DROP VIEW v1
+
+statement ok
+DROP TABLE t0
+
+statement ok
+DROP TABLE t1
+
+statement ok
+COMMIT
+
+statement ok
+START TRANSACTION
+
+statement ok
DROP ALL PROCEDURE "sys"."dict_compress"
statement ok
_______________________________________________
checkin-list mailing list
[email protected]
https://www.monetdb.org/mailman/listinfo/checkin-list