Changeset: c5115e90d569 for MonetDB
URL: https://dev.monetdb.org/hg/MonetDB?cmd=changeset;node=c5115e90d569
Modified Files:
gdk/gdk_group.c
gdk/gdk_join.c
Branch: default
Log Message:
Merge with Oct2020 branch.
diffs (284 lines):
diff --git a/gdk/gdk_aggr.c b/gdk/gdk_aggr.c
--- a/gdk/gdk_aggr.c
+++ b/gdk/gdk_aggr.c
@@ -3487,6 +3487,7 @@ BATmin_skipnil(BAT *b, void *aggr, bit s
const oid *ords = (const oid *) (pb ?
pb->torderidx->base : b->torderidx->base) + ORDERIDXOFF;
BUN r;
if (!b->tnonil) {
+ MT_thread_setalgorithm(pb ? "binsearch on
parent oidx" : "binsearch on oids");
r = binsearch(ords, 0, b->ttype, Tloc(b, 0),
b->tvheap ? b->tvheap->base :
NULL,
b->twidth, 0, BATcount(b),
@@ -3502,6 +3503,7 @@ BATmin_skipnil(BAT *b, void *aggr, bit s
/* no non-nil values */
pos = oid_nil;
} else {
+ MT_thread_setalgorithm(pb ? "using parent oidx"
: "using oids");
pos = ords[r];
}
} else if ((VIEWtparent(b) == 0 ||
@@ -3510,6 +3512,8 @@ BATmin_skipnil(BAT *b, void *aggr, bit s
Imprints *imprints = VIEWtparent(b) ?
BBPdescriptor(VIEWtparent(b))->timprints : b->timprints;
int i;
+
+ MT_thread_setalgorithm(VIEWtparent(b) ? "using parent
imprints" : "using imprints");
pos = oid_nil;
/* find first non-empty bin */
for (i = 0; i < imprints->bits; i++) {
@@ -3591,6 +3595,7 @@ BATmax_skipnil(BAT *b, void *aggr, bit s
BATcheckorderidx(pb))) {
const oid *ords = (const oid *) (pb ?
pb->torderidx->base : b->torderidx->base) + ORDERIDXOFF;
+ MT_thread_setalgorithm(pb ? "using parent oidx" :
"using oids");
pos = ords[BATcount(b) - 1];
/* nils are first, ie !skipnil, check for nils */
if (!skipnil) {
@@ -3608,6 +3613,7 @@ BATmax_skipnil(BAT *b, void *aggr, bit s
Imprints *imprints = VIEWtparent(b) ?
BBPdescriptor(VIEWtparent(b))->timprints : b->timprints;
int i;
+ MT_thread_setalgorithm(VIEWtparent(b) ? "using parent
imprints" : "using imprints");
pos = oid_nil;
/* find last non-empty bin */
for (i = imprints->bits - 1; i >= 0; i--) {
@@ -3889,6 +3895,7 @@ doBATgroupquantile(BAT *b, BAT *g, BAT *
BATcount(pb) == BATcount(b) &&
pb->hseqbase == b->hseqbase &&
BATcheckorderidx(pb))) {
+ MT_thread_setalgorithm(pb ? "using parent oidx" :
"using oids");
ords = (const oid *) (pb ? pb->torderidx->base :
b->torderidx->base) + ORDERIDXOFF;
} else {
if (BATsort(NULL, &t1, NULL, b, NULL, g, false, false,
false) != GDK_SUCCEED)
diff --git a/gdk/gdk_group.c b/gdk/gdk_group.c
--- a/gdk/gdk_group.c
+++ b/gdk/gdk_group.c
@@ -322,7 +322,7 @@
INIT_0; \
assert(grps == NULL); \
if (ci.tpe == cand_dense) { \
- MT_thread_setalgorithm("GRP_use_existing_hash_table,
dense"); \
+ MT_thread_setalgorithm(phash ?
"GRP_use_existing_hash_table, dense, parent hash" :
"GRP_use_existing_hash_table, dense"); \
for (r = 0; r < cnt; r++) { \
oid o = canditer_next_dense(&ci); \
p = o - hseqb + lo; \
@@ -356,7 +356,7 @@
} \
} \
} else { \
- MT_thread_setalgorithm("GRP_use_existing_hash_table,
!dense"); \
+ MT_thread_setalgorithm(phash ?
"GRP_use_existing_hash_table, !dense, parent hash" :
"GRP_use_existing_hash_table, !dense"); \
for (r = 0; r < cnt; r++) { \
oid o = canditer_next(&ci); \
p = o - hseqb + lo; \
@@ -992,6 +992,7 @@ BATgroup_internal(BAT **groups, BAT **ex
* since we may have to go through long lists of
* duplicates in the hash table to find an old
* group */
+ bool phash = false;
algomsg = "existing hash -- ";
if (b->thash == NULL && (parent = VIEWtparent(b)) != 0) {
/* b is a view on another bat (b2 for now).
@@ -1001,6 +1002,8 @@ BATgroup_internal(BAT **groups, BAT **ex
lo = (BUN) ((b->theap.base - b2->theap.base) >>
b->tshift);
b = b2;
bi = bat_iterator(b);
+ algomsg = "existing parent hash -- ";
+ phash = true;
}
hs = b->thash;
gn->tsorted = true; /* be optimistic */
diff --git a/gdk/gdk_join.c b/gdk/gdk_join.c
--- a/gdk/gdk_join.c
+++ b/gdk/gdk_join.c
@@ -2524,7 +2524,6 @@ hashjoin(BAT **r1p, BAT **r2p, BAT *l, B
assert(!BATtvoid(r));
assert(ATOMtype(l->ttype) == ATOMtype(r->ttype));
- MT_thread_setalgorithm(__func__);
int t = ATOMbasetype(r->ttype);
if (r->ttype == TYPE_void || l->ttype == TYPE_void)
t = TYPE_void;
@@ -2558,6 +2557,7 @@ hashjoin(BAT **r1p, BAT **r2p, BAT *l, B
rh = canditer_last(rci) + 1 - r->hseqbase;
if (phash) {
/* there is a hash on the parent which we should use */
+ MT_thread_setalgorithm(swapped ? "hashjoin using parent hash
(swapped)" : "hashjoin using parent hash");
BAT *b = BBPdescriptor(VIEWtparent(r));
TRC_DEBUG(ALGO, "%s(%s): using "
"parent(" ALGOBATFMT ") for hash%s\n",
@@ -2571,6 +2571,7 @@ hashjoin(BAT **r1p, BAT **r2p, BAT *l, B
r = b;
} else if (hash) {
/* there is a hash on r which we should use */
+ MT_thread_setalgorithm(swapped ? "hashjoin using existing hash
(swapped)" : "hashjoin using existing hash");
hsh = r->thash;
TRC_DEBUG(ALGO, ALGOBATFMT ": using "
"existing hash%s\n",
@@ -2581,6 +2582,7 @@ hashjoin(BAT **r1p, BAT **r2p, BAT *l, B
* candidate list */
char ext[32];
assert(rci->s);
+ MT_thread_setalgorithm(swapped ? "hashjoin using candidate hash
(swapped)" : "hashjoin using candidate hash");
TRC_DEBUG(ALGO, ALGOBATFMT ": creating "
"hash for candidate list " ALGOBATFMT "%s%s\n",
ALGOBATPAR(r), ALGOBATPAR(rci->s),
@@ -2595,6 +2597,7 @@ hashjoin(BAT **r1p, BAT **r2p, BAT *l, B
hash_cand = true;
} else {
/* we need to create a hash on r */
+ MT_thread_setalgorithm(swapped ? "hashjoin using new hash
(swapped)" : "hashjoin using new hash");
TRC_DEBUG(ALGO, ALGOBATFMT ": creating hash%s\n",
ALGOBATPAR(r),
swapped ? " (swapped)" : "");
diff --git a/gdk/gdk_select.c b/gdk/gdk_select.c
--- a/gdk/gdk_select.c
+++ b/gdk/gdk_select.c
@@ -337,7 +337,7 @@ hashselect(BAT *b, struct canditer *rest
#define bitswitch(ISDENSE, TEST, TYPE) \
do { \
assert(imprints); \
- *algo = "imprints select " #TEST " (canditer_next" #ISDENSE
")"; \
+ *algo = parent ? "parent imprints select " #TEST "
(canditer_next" #ISDENSE ")" : "imprints select " #TEST " (canditer_next"
#ISDENSE ")"; \
switch (imprints->bits) { \
case 8: checkMINMAX(8, TYPE); impsmask(ISDENSE,TEST,8); break;
\
case 16: checkMINMAX(16, TYPE); impsmask(ISDENSE,TEST,16);
break; \
@@ -457,6 +457,7 @@ NAME##_##TYPE(BAT *b, struct canditer *r
BUN p; \
BUN pr_off = 0; \
Imprints *imprints; \
+ bat parent = 0; \
(void) li; \
(void) hi; \
(void) lval; \
@@ -465,11 +466,11 @@ NAME##_##TYPE(BAT *b, struct canditer *r
assert(hi == !anti); \
assert(lval); \
assert(hval); \
- if (use_imprints && VIEWtparent(b)) { \
- BAT *parent = BBPdescriptor(VIEWtparent(b)); \
- assert(parent); \
- basesrc = (const TYPE *) Tloc(parent, 0); \
- imprints = parent->timprints; \
+ if (use_imprints && (parent = VIEWtparent(b))) { \
+ BAT *pbat = BBPdescriptor(parent); \
+ assert(pbat); \
+ basesrc = (const TYPE *) Tloc(pbat, 0); \
+ imprints = pbat->timprints; \
pr_off = (BUN) (src - basesrc); \
} else { \
imprints = b->timprints; \
@@ -1347,6 +1348,7 @@ BATselect(BAT *b, BAT *s, const void *tl
* trevstorted then use the order index. And there is no cand
* list or if there is one, it is dense.
* TODO: we do not support anti-select with order index */
+ bool poidx = false;
if (!anti &&
!(hash && (phash || b->thash)) &&
!(b->tsorted || b->trevsorted) &&
@@ -1365,6 +1367,7 @@ BATselect(BAT *b, BAT *s, const void *tl
if ((ORDERfnd(b, th) - ORDERfnd(b, tl)) < b->batCount/3) {
use_orderidx = true;
if (view) {
+ poidx = true; /* using parent oidx */
vwo = (lng) ((view->theap.base - b->theap.base)
>> b->tshift);
vwl = b->hseqbase + (oid) vwo + ci.seq -
view->hseqbase;
vwh = vwl + canditer_last(&ci) - ci.seq;
@@ -1448,7 +1451,7 @@ BATselect(BAT *b, BAT *s, const void *tl
}
} else {
assert(use_orderidx);
- algo = "select: orderidx";
+ algo = poidx ? "select: parent orderidx" : "select:
orderidx";
if (lval) {
if (li)
low = ORDERfndfirst(b, tl);
diff --git a/gdk/gdk_unique.c b/gdk/gdk_unique.c
--- a/gdk/gdk_unique.c
+++ b/gdk/gdk_unique.c
@@ -38,7 +38,7 @@ BATunique(BAT *b, BAT *s)
BUN hb;
BATiter bi;
int (*cmp)(const void *, const void *);
- bat parent;
+ bat parent = 0;
struct canditer ci;
PROPrec *prop;
const char *algomsg = "";
@@ -170,6 +170,7 @@ BATunique(BAT *b, BAT *s)
lo = (BUN) ((b->theap.base - b2->theap.base) >>
b->tshift);
b = b2;
bi = bat_iterator(b);
+ algomsg = "unique: existing parent hash";
} else {
lo = 0;
}
diff --git a/sql/test/BugTracker-2020/Tests/All
b/sql/test/BugTracker-2020/Tests/All
--- a/sql/test/BugTracker-2020/Tests/All
+++ b/sql/test/BugTracker-2020/Tests/All
@@ -26,5 +26,6 @@ table-udf-column-descriptor.Bug-6964
table-udf-distinct.Bug-6965
HAVE_PYMONETDB?table-udf-on-remote.Bug-6971
integers-intervals.Bug-6979
+KNOWNFAIL?wrong-key-error.Bug-6983
semijoin.Bug-7001
drop-stream-table.Bug-7005
diff --git a/sql/test/BugTracker-2020/Tests/wrong-key-error.Bug-6983.sql
b/sql/test/BugTracker-2020/Tests/wrong-key-error.Bug-6983.sql
new file mode 100644
--- /dev/null
+++ b/sql/test/BugTracker-2020/Tests/wrong-key-error.Bug-6983.sql
@@ -0,0 +1,9 @@
+start transaction;
+create table a (id int primary key);
+insert into a values (1);
+
+create table b (id int primary key);
+
+create table c (a int references a(id), b int references b(id));
+insert into c (a, b) values (1, 2); -- 40002!INSERT INTO: FOREIGN KEY
constraint 'c.c_b_fkey' violated
+rollback;
diff --git a/sql/test/BugTracker-2020/Tests/wrong-key-error.Bug-6983.stable.err
b/sql/test/BugTracker-2020/Tests/wrong-key-error.Bug-6983.stable.err
new file mode 100644
--- /dev/null
+++ b/sql/test/BugTracker-2020/Tests/wrong-key-error.Bug-6983.stable.err
@@ -0,0 +1,16 @@
+stderr of test 'wrong-key-error.Bug-6983` in directory
'sql/test/BugTracker-2020` itself:
+
+
+# 15:23:21 >
+# 15:23:21 > "mclient" "-lsql" "-ftest" "-tnone" "-Eutf-8" "-i" "-e"
"--host=/var/tmp/mtest-3778" "--port=36467"
+# 15:23:21 >
+
+MAPI = (monetdb) /var/tmp/mtest-3778/.s.monetdb.36467
+QUERY = insert into c (a, b) values (1, 2); -- 40002!INSERT INTO: FOREIGN KEY
constraint 'c.c_b_fkey' violated
+ERROR = !INSERT INTO: FOREIGN KEY constraint 'c.c_b_fkey' violated
+CODE = 40002
+
+# 15:23:21 >
+# 15:23:21 > "Done."
+# 15:23:21 >
+
diff --git a/sql/test/BugTracker-2020/Tests/wrong-key-error.Bug-6983.stable.out
b/sql/test/BugTracker-2020/Tests/wrong-key-error.Bug-6983.stable.out
new file mode 100644
--- /dev/null
+++ b/sql/test/BugTracker-2020/Tests/wrong-key-error.Bug-6983.stable.out
@@ -0,0 +1,19 @@
+stdout of test 'wrong-key-error.Bug-6983` in directory
'sql/test/BugTracker-2020` itself:
+
+
+# 15:23:21 >
+# 15:23:21 > "mclient" "-lsql" "-ftest" "-tnone" "-Eutf-8" "-i" "-e"
"--host=/var/tmp/mtest-3778" "--port=36467"
+# 15:23:21 >
+
+#start transaction;
+#create table a (id int primary key);
+#insert into a values (1);
+[ 1 ]
+#create table b (id int primary key);
+#create table c (a int references a(id), b int references b(id));
+#rollback;
+
+# 15:23:21 >
+# 15:23:21 > "Done."
+# 15:23:21 >
+
_______________________________________________
checkin-list mailing list
[email protected]
https://www.monetdb.org/mailman/listinfo/checkin-list