MonetDB: Jul2021 - Merged with Oct2020
Changeset: 386371c4359f for MonetDB URL: https://dev.monetdb.org/hg/MonetDB/rev/386371c4359f Modified Files: monetdb5/mal/mal_interpreter.c monetdb5/mal/mal_runtime.c sql/server/rel_exp.c sql/server/rel_optimizer.c sql/server/rel_propagate.c Branch: Jul2021 Log Message: Merged with Oct2020 diffs (61 lines): diff --git a/monetdb5/mal/mal_interpreter.c b/monetdb5/mal/mal_interpreter.c --- a/monetdb5/mal/mal_interpreter.c +++ b/monetdb5/mal/mal_interpreter.c @@ -504,6 +504,7 @@ str runMALsequence(Client cntxt, MalBlkP runtimeProfileBegin(cntxt, mb, stk, getInstrPtr(mb,0), &runtimeProfileFunction); mb->starttime = GDKusec(); if (cntxt->sessiontimeout && mb->starttime - cntxt->session > cntxt->sessiontimeout) { + runtimeProfileFinish(cntxt, mb, stk); if ( backup != backups) GDKfree(backup); if ( garbage != garbages) GDKfree(garbage); throw(MAL, "mal.interpreter", SQLSTATE(HYT00) RUNTIME_SESSION_TIMEOUT); diff --git a/monetdb5/mal/mal_runtime.c b/monetdb5/mal/mal_runtime.c --- a/monetdb5/mal/mal_runtime.c +++ b/monetdb5/mal/mal_runtime.c @@ -161,25 +161,28 @@ clearQRYqueue(size_t idx) static void advanceQRYqueue(void) { - qhead++; - if( qhead == qsize) - qhead = 0; - if( qtail == qhead) - qtail++; - if( qtail == qsize) - qtail = 0; - /* clean out the element */ - str s = QRYqueue[qhead].query; - if( s){ - /* don;t wipe them when they are still running, prepared, or paused */ - /* The upper layer has assured there is at least one slot available */ - if(QRYqueue[qhead].status != 0 && (QRYqueue[qhead].status[0] == 'r' || QRYqueue[qhead].status[0] == 'p')){ - advanceQRYqueue(); - return; + bool found_empty_slot = false; + + while (!found_empty_slot) { + qhead++; + if( qhead == qsize) + qhead = 0; + if( qtail == qhead) + qtail++; + if( qtail == qsize) + qtail = 0; + /* clean out the element */ + str s = QRYqueue[qhead].query; + if (!s || QRYqueue[qhead].status == 0 || (QRYqueue[qhead].status[0] != 'r' && QRYqueue[qhead].status[0] != 'p')) { + /* don't wipe them when they are still running, prepared, or paused */ + /* The upper layer has assured there is at least one slot available */ + if (s) { + GDKfree(s); + GDKfree(QRYqueue[qhead].username); + clearQRYqueue(qhead); + } + found_empty_slot = true; } - GDKfree(s); - GDKfree(QRYqueue[qhead].username); - clearQRYqueue(qhead); } } ___ checkin-list mailing list checkin-list@monetdb.org https://www.monetdb.org/mailman/listinfo/checkin-list
MonetDB: Oct2020 - Backporting recent fixes from Jul2021 branch ...
Changeset: 90ec7ad61401 for MonetDB URL: https://dev.monetdb.org/hg/MonetDB/rev/90ec7ad61401 Modified Files: sql/server/rel_exp.c sql/server/rel_optimizer.c sql/server/rel_propagate.c sql/test/merge-partitions/Tests/mergepart31.stable.out Branch: Oct2020 Log Message: Backporting recent fixes from Jul2021 branch into Oct2020 diffs (80 lines): 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 @@ -1738,7 +1738,7 @@ exp_two_sided_bound_cmp_exp_is_false(sql sql_exp* h = e->f; assert (v && l && h); -return exp_is_null(l) || exp_is_null(v) || exp_is_null(h); +return is_anti(e) ? exp_is_null(v) || (exp_is_null(l) && exp_is_null(h)) : exp_is_null(l) || exp_is_null(v) || exp_is_null(h); } static inline bool diff --git a/sql/server/rel_optimizer.c b/sql/server/rel_optimizer.c --- a/sql/server/rel_optimizer.c +++ b/sql/server/rel_optimizer.c @@ -7884,7 +7884,7 @@ rel_simplify_predicates(visitor *v, sql_ } } } - } else if (is_atom(l->type) && is_atom(r->type) && !is_semantics(e)) { + } else if (is_atom(l->type) && is_atom(r->type) && !is_semantics(e) && !e->f) { /* compute comparisons on atoms */ if (exp_is_null(l) || exp_is_null(r)) { e = exp_null(v->sql->sa, sql_bind_localtype("bit")); diff --git a/sql/server/rel_propagate.c b/sql/server/rel_propagate.c --- a/sql/server/rel_propagate.c +++ b/sql/server/rel_propagate.c @@ -718,20 +718,9 @@ rel_generate_subinserts(sql_query *query int tpe = pt->tpe.type->localtype; int (*atomcmp)(const void *, const void *) = ATOMcompare(tpe); const void *nil = ATOMnilptr(tpe); - - if (atomcmp(pt->part.range.minvalue, nil) != 0 || atomcmp(pt->part.range.maxvalue, nil) != 0) { - sql_exp *e1, *e2; - bool max_equal_min = ATOMcmp(pt->tpe.type->localtype, pt->part.range.maxvalue, pt->part.range.minvalue) == 0; + bool is_min_nil = atomcmp(pt->part.range.minvalue, nil) == 0, is_max_nil = atomcmp(pt->part.range.maxvalue, nil) == 0; - e1 = exp_atom(sql->sa, atom_general_ptr(sql->sa, &pt->tpe, pt->part.range.minvalue)); - if (!max_equal_min) { - e2 = exp_atom(sql->sa, atom_general_ptr(sql->sa, &pt->tpe, pt->part.range.maxvalue)); - range = exp_compare2(sql->sa, le, e1, e2, cmp_gte|CMP_BETWEEN); - } else { - range = exp_compare(sql->sa, le, e1, cmp_equal); - } - full_range = range; - } else { + if (is_min_nil && is_max_nil) { found_all_range_values |= (pt->with_nills != 1); found_nils |= is_bit_nil(pt->with_nills); if (pt->with_nills == false) { /* full range without nils */ @@ -741,6 +730,17 @@ rel_generate_subinserts(sql_query *query nils = exp_compare(sql->sa, nils, exp_atom_bool(sql->sa, 0), cmp_equal); full_range = range = nils; /* ugh */ } + } else if (is_min_nil) { + full_range = range = exp_compare(sql->sa, le, exp_atom(sql->sa, atom_general_ptr(sql->sa, &pt->tpe, pt->part.range.maxvalue)), cmp_lt); + } else if (is_max_nil) { + full_range = range = exp_compare(sql->sa, le, exp_atom(sql->sa, atom_general_ptr(sql->sa, &pt->tpe, pt->part.range.minvalue)), cmp_gte); + } else { + bool max_equal_min = ATOMcmp(pt->tpe.type->localtype, pt->part.range.maxvalue, pt->part.range.minvalue) == 0; + + full_range = range = max_equal_min ? + exp_compare(sql->sa, le, exp_atom(sql->sa, atom_general_ptr(sql->sa, &pt->tpe, pt->part.range.minvalue)), cmp_equal) : + exp_compare2(sql->sa, le, exp_atom(sql->sa, atom_general_ptr(sql->sa, &pt->tpe, pt->part.range.minvalue)), + exp_atom(sql->sa, atom_general_ptr(sql->sa, &pt->tpe, pt->part.range.maxvalue)), cmp_gte|CMP_BETWEEN); } if (pt->with_nills == true) { /* handle the nulls case *
MonetDB: Jul2021 - Here 1 row is expected
Changeset: e63dca1f71d3 for MonetDB URL: https://dev.monetdb.org/hg/MonetDB/rev/e63dca1f71d3 Modified Files: sql/test/merge-partitions/Tests/mergepart31.test Branch: Jul2021 Log Message: Here 1 row is expected diffs (12 lines): diff --git a/sql/test/merge-partitions/Tests/mergepart31.test b/sql/test/merge-partitions/Tests/mergepart31.test --- a/sql/test/merge-partitions/Tests/mergepart31.test +++ b/sql/test/merge-partitions/Tests/mergepart31.test @@ -368,7 +368,7 @@ CREATE TABLE fourth_decade (stamp TIMEST statement ok ALTER TABLE splitted ADD TABLE fourth_decade AS PARTITION FROM RANGE MINVALUE TO TIMESTAMP '2000-01-01 00:00:00' -statement ok rowcount 0 +statement ok rowcount 1 INSERT INTO splitted VALUES (TIMESTAMP '1999-01-01 00:00:00', 7) query T nosort ___ checkin-list mailing list checkin-list@monetdb.org https://www.monetdb.org/mailman/listinfo/checkin-list
MonetDB: Jul2021 - Plugging my own hole, sorry
Changeset: 767ba76c765a for MonetDB URL: https://dev.monetdb.org/hg/MonetDB/rev/767ba76c765a Modified Files: monetdb5/modules/kernel/batstr.c sql/test/SQLancer/Tests/sqlancer15.test Branch: Jul2021 Log Message: Plugging my own hole, sorry diffs (90 lines): diff --git a/monetdb5/modules/kernel/batstr.c b/monetdb5/modules/kernel/batstr.c --- a/monetdb5/modules/kernel/batstr.c +++ b/monetdb5/modules/kernel/batstr.c @@ -191,7 +191,7 @@ STRbatAscii(Client cntxt, MalBlkPtr mb, if ((msg = str_wchr_at(&next, x, 0)) != MAL_SUCCEED) goto bailout; - vals[p1] = next; + vals[i] = next; nils |= is_int_nil(next); } } else { @@ -201,7 +201,7 @@ STRbatAscii(Client cntxt, MalBlkPtr mb, if ((msg = str_wchr_at(&next, x, 0)) != MAL_SUCCEED) goto bailout; - vals[p1] = next; + vals[i] = next; nils |= is_int_nil(next); } } diff --git a/sql/test/SQLancer/Tests/sqlancer15.test b/sql/test/SQLancer/Tests/sqlancer15.test --- a/sql/test/SQLancer/Tests/sqlancer15.test +++ b/sql/test/SQLancer/Tests/sqlancer15.test @@ -708,6 +708,65 @@ statement ok START TRANSACTION statement ok +CREATE TABLE "t0" ("c0" CHARACTER LARGE OBJECT,"c2" DOUBLE) + +statement ok rowcount 20 +COPY 20 RECORDS INTO "t0" FROM stdin USING DELIMITERS E'\t',E'\n','"' + +"1970" NULL +"3"NULL +NULL NULL +"3"NULL +"W"NULL +"-"NULL +"t " NULL +"0.1454211084558179" NULL +"2"NULL +"" 0.18341645025687223 +NULL 0.5805338105211456 +NULL 1810425471 +NULL NULL +NULL 0.8204238200689035 +"Lxy}" NULL +"-887573436" NULL +NULL 0.6211363 +NULL 0.6211363 +"0.21185164" NULL +"0.36241230481890585" NULL + +query I rowsort +SELECT CASE WHEN t0.c2 = t0.c2 THEN 1 ELSE ascii(t0.c0) END FROM t0 LEFT OUTER JOIN (VALUES (1), (1), (- 81524669)) AS sub0 ON 1 <= t0.c2 + +1 +1 +1 +1 +1 +1 +1 +1 +116 +45 +45 +48 +48 +48 +49 +50 +51 +51 +76 +87 +NULL +NULL + +statement ok +ROLLBACK + +statement ok +START TRANSACTION + +statement ok CREATE TABLE t0(c0 DOUBLE UNIQUE, c1 CHAR(224), c4 boolean) statement ok ___ checkin-list mailing list checkin-list@monetdb.org https://www.monetdb.org/mailman/listinfo/checkin-list
MonetDB: string_imprints - Fix a number of bugs
Changeset: 1fea2b59a1ff for MonetDB URL: https://dev.monetdb.org/hg/MonetDB/rev/1fea2b59a1ff Modified Files: gdk/gdk_strimps.c Branch: string_imprints Log Message: Fix a number of bugs Also dump the strimp to disk for debuging. (Persistence has not been working with my tests). diffs (87 lines): diff --git a/gdk/gdk_strimps.c b/gdk/gdk_strimps.c --- a/gdk/gdk_strimps.c +++ b/gdk/gdk_strimps.c @@ -96,7 +96,7 @@ pair_equal(CharPair *p1, CharPair *p2) { #else /* BytePairs implementation */ #define isIgnored(x) (isspace((x)) || isdigit((x)) || ispunct((x))) -#define pairToIndex(b1, b2) (uint16_t)(((uint8_t)b2)<<8 | ((uint8_t)b1)) +#define pairToIndex(b1, b2) (uint16_t)(((uint16_t)b2)<<8 | ((uint16_t)b1)) static bool pair_equal(CharPair *p1, CharPair *p2) { @@ -301,8 +301,7 @@ STRMPbuildHeader(BAT *b, CharPair *hpair if (hist[hidx].p == NULL) { hist[hidx].p = (CharPair *)GDKmalloc(sizeof(CharPair)); hist[hidx].p->psize = cpp->psize; - hist[hidx].p->pbytes = (uint8_t *)GDKmalloc(cpp->psize*sizeof(uint8_t)); - memcpy(hist[hidx].p->pbytes, cpp->pbytes, cpp->psize); + hist[hidx].p->pbytes = cpp->pbytes; } } next_pair(pip); @@ -314,7 +313,6 @@ STRMPbuildHeader(BAT *b, CharPair *hpair STRMPchoosePairs(hist, hlen, hpairs); for(hidx = 0; hidx < hlen; hidx++) { if(hist[hidx].p) { - GDKfree(hist[hidx].p->pbytes); GDKfree(hist[hidx].p); hist[hidx].p = NULL; } @@ -327,7 +325,7 @@ STRMPbuildHeader(BAT *b, CharPair *hpair /* Create the heap for a string imprint. Returns NULL on failure. */ static Strimps * -STRMPcreateStrimp(BAT *b) +STRMPcreateStrimpHeap(BAT *b) { uint8_t *h1, *h2; Strimps *r = NULL; @@ -338,8 +336,8 @@ STRMPcreateStrimp(BAT *b) const char *nme; - STRMPbuildHeader(b, hpairs); /* Find the header pairs */ - sz = 8; /* add 8-bytes for the descriptor */ + STRMPbuildHeader(b, hpairs); /* Find the header pairs */ + sz = 8 + STRIMP_HEADER_SIZE; /* add 8-bytes for the descriptor */ for(i = 0; i < STRIMP_HEADER_SIZE; i++) { sz += hpairs[i].psize; } @@ -548,6 +546,7 @@ BATstrimpsync(void *arg) static void persistStrimp(BAT *b) { + TRC_DEBUG(ALGO, "zoo: %d\n", (BBP_status(b->batCacheid) & BBPEXISTING)); if((BBP_status(b->batCacheid) & BBPEXISTING) && b->batInserted == b->batCount && !b->theap->dirty @@ -580,10 +579,10 @@ STRMPcreate(BAT *b) if (BATcheckstrimps(b)) return GDK_SUCCEED; - if ((h = STRMPcreateStrimp(b)) == NULL) { + if ((h = STRMPcreateStrimpHeap(b)) == NULL) { return GDK_FAIL; } - dh = (uint64_t *)h->strimps.base + h->strimps.free; + dh = (uint64_t *)((uint8_t*)h->strimps.base + h->strimps.free); bi = bat_iterator(b); for (i = 0; i < b->batCount; i++) { @@ -595,6 +594,15 @@ STRMPcreate(BAT *b) } h->strimps.free += b->batCount*sizeof(uint64_t); + /* Debug */ + { + FILE *f = fopen("/tmp/strmp", "wb"); + if (f) { + fwrite(h->strimps.base, 1, h->strimps.free, f); + fclose(f); + } + } + /* After we have computed the strimp, attempt to write it back * to the BAT. */ ___ checkin-list mailing list checkin-list@monetdb.org https://www.monetdb.org/mailman/listinfo/checkin-list
MonetDB: string_imprints - Persist strimps on disk
Changeset: 4f6a1af1748a for MonetDB URL: https://dev.monetdb.org/hg/MonetDB/rev/4f6a1af1748a Modified Files: gdk/gdk_strimps.c Branch: string_imprints Log Message: Persist strimps on disk diffs (112 lines): diff --git a/gdk/gdk_strimps.c b/gdk/gdk_strimps.c --- a/gdk/gdk_strimps.c +++ b/gdk/gdk_strimps.c @@ -96,10 +96,7 @@ pair_equal(CharPair *p1, CharPair *p2) { #else /* BytePairs implementation */ #define isIgnored(x) (isspace((x)) || isdigit((x)) || ispunct((x))) -#define isNotIgnored(x) (!isIgnored(x)) #define pairToIndex(b1, b2) (uint16_t)(((uint8_t)b2)<<8 | ((uint8_t)b1)) -#define indexToPair2(idx) (idx & 0xff00) >> 8 -#define indexToPair1(idx) (idx & 0xff) static bool pair_equal(CharPair *p1, CharPair *p2) { @@ -135,7 +132,7 @@ next_pair(PairIterator *pi) { #endif // UTF8STRINGS static int8_t -strimp_lookup(Strimps *s, CharPair *p) { +STRMPpairLookup(Strimps *s, CharPair *p) { int8_t ret = -1; size_t idx = 0; size_t npairs = NPAIRS(((uint64_t *)s->strimps.base)[0]); @@ -449,7 +446,7 @@ BATcheckstrimps(BAT *b) if (ret) TRC_DEBUG(ALGO, "BATcheckstrimps(" ALGOBATFMT "): already has strimps, waited " LLFMT " usec\n", ALGOBATPAR(b), GDKusec() - t); - return false; + return ret; } /* Filter a BAT b using a string q. Return the result as a candidate @@ -495,12 +492,75 @@ STRMPfilter(BAT *b, char *q) return NULL; } -#if 0 -void +static void +BATstrimpsync(void *arg) +{ + BAT *b = arg; + lng t0 = 0; + Heap *hp; + int fd; + const char *failed = " failed"; + + TRC_DEBUG_IF(ALGO) t0 = GDKusec(); + + MT_lock_set(&b->batIdxLock); + if ((hp = &b->tstrimps->strimps)) { + if (HEAPsave(hp, hp->filename, NULL, true) == GDK_SUCCEED) { + if (hp->storage == STORE_MEM) { + if ((fd = GDKfdlocate(hp->farmid, hp->filename, "rb+", NULL)) >= 0) { + ((uint64_t *)hp->base)[0] |= (uint64_t) 1 << 32; + if (write(fd, hp->base, sizeof(uint64_t)) >= 0) { + failed = ""; + if (!(GDKdebug & NOSYNCMASK)) { +#if defined(NATIVE_WIN32) + _commit(fd); +#elif defined(HAVE_FDATASYNC) + fdatasync(fd); +#elif defined(HAVE_FSYNC) + fsync(fd); +#endif + } + hp->dirty = false; + } else { + perror("write strimps"); + } + close(fd); + } + } else { + ((uint64_t *)hp->base)[0] |= (uint64_t) 1 << 32; + if (!(GDKdebug & NOSYNCMASK) && + MT_msync(hp->base, sizeof(uint64_t)) < 0) { + ((uint64_t *)hp->base)[0] &= ~((uint64_t) 1 << 32); + } else { + hp->dirty = false; + failed = ""; + } + } + TRC_DEBUG(ALGO, "BATstrimpsync(%s): strimps persisted" + " (" LLFMT " usec)%s\n", + BATgetId(b), GDKusec() - t0, failed); + } + } + MT_lock_unset(&b->batIdxLock); + BBPunfix(b->batCacheid); +} + +static void persistStrimp(BAT *b) { - if((BBP_status(b->batCacheid) & BBPEXISTING) && - b->batInserted == b->batCount) + if((BBP_status(b->batCacheid) & BBPEXISTING) + && b->batInserted == b->batCount + && !b->theap->dirty + && !GDKinmemory(b->theap->farmid)) { + MT_Id tid; + BBPfix(b->batCacheid); + char name[MT_NAME_LEN]; + snprintf(name, sizeof(name), "strimpsync%d", b->batCacheid); + if (MT_create_thread(&tid, BATstrimpsync, b, +MT_THR_DETACHED, name) < 0) + BBPunfix(b->batCacheid); + } else + TRC_DEBUG(ALGO, "persistStrimp(" ALGOBATFMT "): NOT persisting strimp\n", ALGOBATPAR(b)); } /* Create */ ___ checkin-list mailing list checkin-list@monetdb.org https://www.monetdb.org/mailman/listinfo/checkin-list
MonetDB: string_imprints - Read and write the descriptor correctly
Changeset: a2c6fcd81f79 for MonetDB URL: https://dev.monetdb.org/hg/MonetDB/rev/a2c6fcd81f79 Modified Files: gdk/gdk_strimps.c Branch: string_imprints Log Message: Read and write the descriptor correctly diffs (130 lines): diff --git a/gdk/gdk_strimps.c b/gdk/gdk_strimps.c --- a/gdk/gdk_strimps.c +++ b/gdk/gdk_strimps.c @@ -138,7 +138,7 @@ static int8_t strimp_lookup(Strimps *s, CharPair *p) { int8_t ret = -1; size_t idx = 0; - size_t npairs = NPAIRS((uint64_t)s->strimps.base[0]); + size_t npairs = NPAIRS(((uint64_t *)s->strimps.base)[0]); size_t offset = 0; CharPair sp; (void)p; @@ -181,7 +181,7 @@ STRMPmakebitstring(const str s, Strimps pi.lim = strlen(s); while(pair_at(&pi, &cp)) { - pair_idx = strimp_lookup(r, &cp); + pair_idx = STRMPpairLookup(r, &cp); if (pair_idx > 0) ret |= 0x1 << pair_idx; next_pair(&pi); @@ -190,8 +190,6 @@ STRMPmakebitstring(const str s, Strimps return ret; } - - /* Given a histogram find the indices of the STRIMP_HEADER_SIZE largest * counts. * @@ -321,6 +319,7 @@ STRMPbuildHeader(BAT *b, CharPair *hpair if(hist[hidx].p) { GDKfree(hist[hidx].p->pbytes); GDKfree(hist[hidx].p); + hist[hidx].p = NULL; } } GDKfree(hist); @@ -333,7 +332,6 @@ STRMPbuildHeader(BAT *b, CharPair *hpair static Strimps * STRMPcreateStrimp(BAT *b) { - uint64_t *d; uint8_t *h1, *h2; Strimps *r = NULL; uint64_t descriptor; @@ -354,16 +352,15 @@ STRMPcreateStrimp(BAT *b) if ((r = GDKzalloc(sizeof(Strimps))) == NULL || (r->strimps.farmid = BBPselectfarm(b->batRole, b->ttype, strimpheap)) < 0 || strconcat_len(r->strimps.filename, sizeof(r->strimps.filename), - nme, ".strimp", NULL) >= sizeof(r->strimps.filename) || + nme, ".tstrimps", NULL) >= sizeof(r->strimps.filename) || HEAPalloc(&r->strimps, BATcount(b)*sizeof(uint64_t) + sz, sizeof(uint8_t), 0) != GDK_SUCCEED) { GDKfree(r); return NULL; } - descriptor = STRIMP_VERSION | STRIMP_HEADER_SIZE << 8 | ((uint64_t)sz) << 16; + descriptor = STRIMP_VERSION | ((uint64_t)STRIMP_HEADER_SIZE) << 8 | ((uint64_t)sz) << 16; - d = (uint64_t *)r->strimps.base; - *d = descriptor; + ((uint64_t *)r->strimps.base)[0] = descriptor; r->sizes_base = h1 = (uint8_t *)r->strimps.base + 8; r->pairs_base = h2 = (uint8_t *)h1 + STRIMP_HEADER_SIZE; @@ -505,7 +502,6 @@ persistStrimp(BAT *b) if((BBP_status(b->batCacheid) & BBPEXISTING) && b->batInserted == b->batCount) } -#endif /* Create */ gdk_return @@ -521,31 +517,32 @@ STRMPcreate(BAT *b) assert(b->ttype == TYPE_str); TRC_DEBUG_IF(ALGO) t0 = GDKusec(); - if (b->tstrimps == NULL) { - if ((h = STRMPcreateStrimp(b)) == NULL) { - return GDK_FAIL; - } - dh = (uint64_t *)h->strimps.base + h->strimps.free; + if (BATcheckstrimps(b)) + return GDK_SUCCEED; + + if ((h = STRMPcreateStrimp(b)) == NULL) { + return GDK_FAIL; + } + dh = (uint64_t *)h->strimps.base + h->strimps.free; - bi = bat_iterator(b); - for (i = 0; i < b->batCount; i++) { - s = (str)BUNtvar(bi, i); - if (!strNil(s)) - *dh++ = STRMPmakebitstring(s, h); - else - *dh++ = 0; /* no pairs in nil values */ - } - h->strimps.free += b->batCount*sizeof(uint64_t); + bi = bat_iterator(b); + for (i = 0; i < b->batCount; i++) { + s = (str)BUNtvar(bi, i); + if (!strNil(s)) + *dh++ = STRMPmakebitstring(s, h); + else + *dh++ = 0; /* no pairs in nil values */ + } + h->strimps.free += b->batCount*sizeof(uint64_t); - /* After we have computed the strimp, attempt to write it back -* to the BAT. -*/ - MT_lock_set(&b->batIdxLock); - b->tstrimps = h; - b->batDirtydesc = true; - /* persistStrimp(b) */ - MT_lock_unset(&b->batIdxLock); - } + /* After we have computed the strimp, attempt to write it back +* to the BAT. +*/ + MT_lock_set(&b->batIdxLock); + b->tstrimps = h; + b->batDirtydesc = true; + persistStrimp(b); + MT_lock_unset(&b->batIdxLock); TRC_DEBUG(ALGO, "strimp creation took " LLFMT " usec\n", GDKusec()-t0); return GDK_SUCCEED; _
MonetDB: scatter - merged
Changeset: 41db648fa734 for MonetDB URL: https://dev.monetdb.org/hg/MonetDB/rev/41db648fa734 Branch: scatter Log Message: merged diffs (truncated from 999 to 300 lines): diff --git a/sql/backends/monet5/rel_bin.c b/sql/backends/monet5/rel_bin.c --- a/sql/backends/monet5/rel_bin.c +++ b/sql/backends/monet5/rel_bin.c @@ -56,9 +56,7 @@ static stmt * stmt_selectnil( backend *be, stmt *col) { sql_subtype *t = tail_type(col); - stmt *n = stmt_atom(be, atom_general(be->mvc->sa, t, NULL)); - stmt *nn = stmt_uselect2(be, col, n, n, 3, NULL, 0, 1); - return nn; + return stmt_uselect(be, col, stmt_atom(be, atom_general(be->mvc->sa, t, NULL)), cmp_equal, NULL, 0, 1); } static stmt * @@ -378,9 +376,7 @@ static stmt * stmt_selectnonil( backend *be, stmt *col, stmt *s ) { sql_subtype *t = tail_type(col); - stmt *n = stmt_atom(be, atom_general(be->mvc->sa, t, NULL)); - stmt *nn = stmt_uselect2(be, col, n, n, 3, s, 1, 1); - return nn; + return stmt_uselect(be, col, stmt_atom(be, atom_general(be->mvc->sa, t, NULL)), cmp_equal, s, 1, 1); } static int @@ -1510,7 +1506,7 @@ exp_bin(backend *be, sql_exp *e, stmt *l if (r2 && r2->nrcols == 0) r2 = stmt_const(be, bin_find_smallest_column(be, swapped?left:right), r2); if (r2) { - s = stmt_join2(be, l, r, r2, (comp_type)e->flag, is_anti(e), swapped); + s = stmt_join2(be, l, r, r2, (comp_type)e->flag, is_anti(e), is_symmetric(e), swapped); } else if (swapped) { s = stmt_join(be, r, l, is_anti(e), swap_compare((comp_type)e->flag), 0, is_semantics(e), false); } else { @@ -1520,7 +1516,7 @@ exp_bin(backend *be, sql_exp *e, stmt *l if (r2) { /* handle all cases in stmt_uselect, reducing, non reducing, scalar etc */ if (l->nrcols == 0 && ((sel && sel->nrcols > 0) || r->nrcols > 0 || r2->nrcols > 0 || reduce)) l = left ? stmt_const(be, bin_find_smallest_column(be, left), l) : column(be, l); - s = stmt_uselect2(be, l, r, r2, (comp_type)e->flag, sel, is_anti(e), reduce); + s = stmt_uselect2(be, l, r, r2, (comp_type)e->flag, sel, is_anti(e), is_symmetric(e), reduce); } else { /* value compare or select */ if ((!reduce || (l->nrcols == 0 && r->nrcols == 0)) && (e->flag == mark_in || e->flag == mark_notin)) { @@ -2414,7 +2410,7 @@ split_join_exps(sql_rel *rel, list *join /* we can handle thetajoins, rangejoins and filter joins (like) */ /* ToDo how about atom expressions? */ if (e->type == e_cmp) { - int flag = e->flag & ~CMP_BETWEEN; + int flag = e->flag; /* check if its a select or join expression, ie use only expressions of one relation left and of the other right (than join) */ if (flag < cmp_filter || flag == mark_in || flag == mark_notin) { /* theta and range joins */ /* join or select ? */ @@ -5614,10 +5610,8 @@ check_for_foreign_key_references(mvc *sq if (k->t != t && !cascade) { node *n = ol_first_node(t->columns); sql_column *c = n->data; - size_t n_rows = store->storage_api.count_col(sql->session->tr, c, 0); - size_t n_deletes = store->storage_api.count_del(sql->session->tr, c->t, 0); - assert (n_rows >= n_deletes); - if (n_rows - n_deletes > 0) { + size_t n_rows = store->storage_api.count_col(sql->session->tr, c, 10); + if (n_rows > 0) { list_destroy(keys); sql_error(sql, 02, SQLSTATE(23000) "TRUNCATE: FOREIGN KEY %s.%s depends on %s", k->t->base.name, k->base.name, t->base.name); *error = 1; diff --git a/sql/backends/monet5/sql_scenario.c b/sql/backends/monet5/sql_scenario.c --- a/sql/backends/monet5/sql_scenario.c +++ b/sql/backends/monet5/sql_scenario.c @@ -300,7 +300,12 @@ SQLprepareClient(Client c, int login)
MonetDB: scatter - correctly free all blobs again
Changeset: deb371d82bb8 for MonetDB URL: https://dev.monetdb.org/hg/MonetDB/rev/deb371d82bb8 Modified Files: tools/monetdbe/monetdbe.c Branch: scatter Log Message: correctly free all blobs again diffs (50 lines): diff --git a/tools/monetdbe/monetdbe.c b/tools/monetdbe/monetdbe.c --- a/tools/monetdbe/monetdbe.c +++ b/tools/monetdbe/monetdbe.c @@ -2218,6 +2218,7 @@ remote_cleanup: GDKfree(d); } else if (mtype == TYPE_blob) { int err = 0; + size_t j = 0; blob **d = GDKmalloc(sizeof(blob*)*cnt); if (!d) { mdbe->msg = createException(SQL, "monetdbe.monetdbe_append", "Cannot append values"); @@ -2225,7 +2226,7 @@ remote_cleanup: } monetdbe_data_blob* be = (monetdbe_data_blob*)v; - for (size_t j=0; jmsg = createException(MAL, "monetdbe.monetdbe_append", MAL_MALLOC_FAIL); - err = j-1; + err = 1; break; } b->nitems = len; @@ -2243,15 +2244,13 @@ remote_cleanup: d[j] = b; } } - if (store->storage_api.append_col(m->session->tr, c, pos, d, mtype) != 0) { + if (!err && store->storage_api.append_col(m->session->tr, c, pos, d, mtype) != 0) { mdbe->msg = createException(SQL, "monetdbe.monetdbe_append", "Cannot append values"); - err = cnt; + err = 1; } - if (err) - cnt = err; - for (size_t j=0; jhttps://www.monetdb.org/mailman/listinfo/checkin-list
MonetDB: scatter - Fix for sqlancer crash
Changeset: c71c667a9e78 for MonetDB URL: https://dev.monetdb.org/hg/MonetDB/rev/c71c667a9e78 Modified Files: sql/backends/monet5/rel_bin.c Branch: scatter Log Message: Fix for sqlancer crash diffs (16 lines): diff --git a/sql/backends/monet5/rel_bin.c b/sql/backends/monet5/rel_bin.c --- a/sql/backends/monet5/rel_bin.c +++ b/sql/backends/monet5/rel_bin.c @@ -5610,10 +5610,8 @@ check_for_foreign_key_references(mvc *sq if (k->t != t && !cascade) { node *n = ol_first_node(t->columns); sql_column *c = n->data; - size_t n_rows = store->storage_api.count_col(sql->session->tr, c, 0); - size_t n_deletes = store->storage_api.count_del(sql->session->tr, c->t, 0); - assert (n_rows >= n_deletes); - if (n_rows - n_deletes > 0) { + size_t n_rows = store->storage_api.count_col(sql->session->tr, c, 10); + if (n_rows > 0) { list_destroy(keys); sql_error(sql, 02, SQLSTATE(23000) "TRUNCATE: FOREIGN KEY %s.%s depends on %s", k->t->base.name, k->base.name, t->base.name); *error = 1; ___ checkin-list mailing list checkin-list@monetdb.org https://www.monetdb.org/mailman/listinfo/checkin-list
MonetDB: scatter - Merged with Jul2021
Changeset: 6ffbcc06b72c for MonetDB URL: https://dev.monetdb.org/hg/MonetDB/rev/6ffbcc06b72c Modified Files: sql/include/sql_catalog.h sql/server/rel_optimizer.c Branch: scatter Log Message: Merged with Jul2021 diffs (truncated from 986 to 300 lines): diff --git a/sql/backends/monet5/rel_bin.c b/sql/backends/monet5/rel_bin.c --- a/sql/backends/monet5/rel_bin.c +++ b/sql/backends/monet5/rel_bin.c @@ -56,9 +56,7 @@ static stmt * stmt_selectnil( backend *be, stmt *col) { sql_subtype *t = tail_type(col); - stmt *n = stmt_atom(be, atom_general(be->mvc->sa, t, NULL)); - stmt *nn = stmt_uselect2(be, col, n, n, 3, NULL, 0, 1); - return nn; + return stmt_uselect(be, col, stmt_atom(be, atom_general(be->mvc->sa, t, NULL)), cmp_equal, NULL, 0, 1); } static stmt * @@ -378,9 +376,7 @@ static stmt * stmt_selectnonil( backend *be, stmt *col, stmt *s ) { sql_subtype *t = tail_type(col); - stmt *n = stmt_atom(be, atom_general(be->mvc->sa, t, NULL)); - stmt *nn = stmt_uselect2(be, col, n, n, 3, s, 1, 1); - return nn; + return stmt_uselect(be, col, stmt_atom(be, atom_general(be->mvc->sa, t, NULL)), cmp_equal, s, 1, 1); } static int @@ -1510,7 +1506,7 @@ exp_bin(backend *be, sql_exp *e, stmt *l if (r2 && r2->nrcols == 0) r2 = stmt_const(be, bin_find_smallest_column(be, swapped?left:right), r2); if (r2) { - s = stmt_join2(be, l, r, r2, (comp_type)e->flag, is_anti(e), swapped); + s = stmt_join2(be, l, r, r2, (comp_type)e->flag, is_anti(e), is_symmetric(e), swapped); } else if (swapped) { s = stmt_join(be, r, l, is_anti(e), swap_compare((comp_type)e->flag), 0, is_semantics(e), false); } else { @@ -1520,7 +1516,7 @@ exp_bin(backend *be, sql_exp *e, stmt *l if (r2) { /* handle all cases in stmt_uselect, reducing, non reducing, scalar etc */ if (l->nrcols == 0 && ((sel && sel->nrcols > 0) || r->nrcols > 0 || r2->nrcols > 0 || reduce)) l = left ? stmt_const(be, bin_find_smallest_column(be, left), l) : column(be, l); - s = stmt_uselect2(be, l, r, r2, (comp_type)e->flag, sel, is_anti(e), reduce); + s = stmt_uselect2(be, l, r, r2, (comp_type)e->flag, sel, is_anti(e), is_symmetric(e), reduce); } else { /* value compare or select */ if ((!reduce || (l->nrcols == 0 && r->nrcols == 0)) && (e->flag == mark_in || e->flag == mark_notin)) { @@ -2414,7 +2410,7 @@ split_join_exps(sql_rel *rel, list *join /* we can handle thetajoins, rangejoins and filter joins (like) */ /* ToDo how about atom expressions? */ if (e->type == e_cmp) { - int flag = e->flag & ~CMP_BETWEEN; + int flag = e->flag; /* check if its a select or join expression, ie use only expressions of one relation left and of the other right (than join) */ if (flag < cmp_filter || flag == mark_in || flag == mark_notin) { /* theta and range joins */ /* join or select ? */ diff --git a/sql/backends/monet5/sql_scenario.c b/sql/backends/monet5/sql_scenario.c --- a/sql/backends/monet5/sql_scenario.c +++ b/sql/backends/monet5/sql_scenario.c @@ -300,7 +300,12 @@ SQLprepareClient(Client c, int login) } else if (sscanf(tok, "columnar_protocol=%d", &value) == 1) { c->protocol = (value != 0) ? PROTOCOL_COLUMNAR : PROTOCOL_9; } else if (sscanf(tok, "time_zone=%d", &value) == 1) { - m->timezone = 1000 * value; + sql_schema *s = mvc_bind_schema(m, "sys"); + sql_var *var = find_global_var(m, s, "current_timezone"); + ValRecord val; + VALinit(&val, TYPE_lng, &(lng){1000 * value}); + sql_update_var(m, s, "current_timezone", &val); + sqlvar_set(var, &val); } else { msg = createException(SQL, "SQLprepareClient", SQLSTATE(42000) "unexpected handshake option: %s", tok); goto bailout; diff --git a/sql/backends/monet5/sql_statement.c b/sql/backends/monet5/sql_statement.c --- a/sql/backends/monet5/sql_statement.c +++ b/sql/backends/monet5/sql_statement.c @@ -1618,8 +1618,7 @@ argumentZero(MalBlkPtr mb, int tpe) */ static InstrPtr -sele
MonetDB: Jul2021 - sqlancer assertion error (It will be fixed on...
Changeset: 84c6a1d8f76c for MonetDB URL: https://dev.monetdb.org/hg/MonetDB/rev/84c6a1d8f76c Modified Files: sql/test/SQLancer/Tests/sqlancer15.test Branch: Jul2021 Log Message: sqlancer assertion error (It will be fixed on the scatter branch) diffs (46 lines): diff --git a/sql/test/SQLancer/Tests/sqlancer15.test b/sql/test/SQLancer/Tests/sqlancer15.test --- a/sql/test/SQLancer/Tests/sqlancer15.test +++ b/sql/test/SQLancer/Tests/sqlancer15.test @@ -162,7 +162,7 @@ INSERT INTO "t2" VALUES (false, DATE '19 (true, DATE '1970-01-01', NULL),(false, DATE '1970-01-01', 0.2627602),(true, DATE '1970-01-01', NULL),(true, DATE '1970-01-01', NULL),(true, DATE '1969-12-13', NULL) query I rowsort -SELECT 1 FROM t2 WHERE (TIME '01:00:00') NOT IN (TIME '01:00:00', TIME '01:00:00') NOT IN ((VALUES (TRUE))); +SELECT 1 FROM t2 WHERE (TIME '01:00:00') NOT IN (TIME '01:00:00', TIME '01:00:00') NOT IN ((VALUES (TRUE))) 1 1 @@ -266,7 +266,7 @@ statement ok rowcount 2 INSERT INTO "t0" VALUES (3), (2) query II rowsort -select * from t0 join (values (1, 2, 3, 4, 5)) as sub0(a,b,c,d,e) on t0.c0 = 3; +select * from t0 join (values (1, 2, 3, 4, 5)) as sub0(a,b,c,d,e) on t0.c0 = 3 3 1 @@ -704,3 +704,24 @@ 0 statement ok ROLLBACK +statement ok +START TRANSACTION + +statement ok +CREATE TABLE t0(c0 DOUBLE UNIQUE, c1 CHAR(224), c4 boolean) + +statement ok +CREATE TABLE t1(c0 DOUBLE PRECISION UNIQUE, c1 DOUBLE PRECISION, FOREIGN KEY (c0) REFERENCES t0(c0)) + +statement ok +INSERT INTO t0(c1) VALUES('-521239643'), ('-1125457389'), ('0.18375426768390923') + +statement ok +DELETE FROM t0 + +statement ok +TRUNCATE t0 + +statement ok +ROLLBACK + ___ checkin-list mailing list checkin-list@monetdb.org https://www.monetdb.org/mailman/listinfo/checkin-list
MonetDB: Jul2021 - First bug found, this optimization cannot be ...
Changeset: a16c2cdd4640 for MonetDB URL: https://dev.monetdb.org/hg/MonetDB/rev/a16c2cdd4640 Added Files: sql/test/SQLancer/Tests/sqlancer16.test Modified Files: sql/server/rel_optimizer.c sql/test/SQLancer/Tests/All sql/test/SQLancer/Tests/sqlancer15.test Branch: Jul2021 Log Message: First bug found, this optimization cannot be applied in a range diffs (294 lines): diff --git a/sql/server/rel_optimizer.c b/sql/server/rel_optimizer.c --- a/sql/server/rel_optimizer.c +++ b/sql/server/rel_optimizer.c @@ -7786,7 +7786,7 @@ rel_simplify_predicates(visitor *v, sql_ } } } - } else if (is_atom(l->type) && is_atom(r->type) && !is_semantics(e)) { + } else if (is_atom(l->type) && is_atom(r->type) && !is_semantics(e) && !e->f) { /* compute comparisons on atoms */ if (exp_is_null(l) || exp_is_null(r)) { e = exp_null(v->sql->sa, sql_bind_localtype("bit")); diff --git a/sql/test/SQLancer/Tests/All b/sql/test/SQLancer/Tests/All --- a/sql/test/SQLancer/Tests/All +++ b/sql/test/SQLancer/Tests/All @@ -13,3 +13,4 @@ sqlancer12 sqlancer13 sqlancer14 sqlancer15 +sqlancer16 diff --git a/sql/test/SQLancer/Tests/sqlancer15.test b/sql/test/SQLancer/Tests/sqlancer15.test --- a/sql/test/SQLancer/Tests/sqlancer15.test +++ b/sql/test/SQLancer/Tests/sqlancer15.test @@ -658,35 +658,6 @@ statement ok START TRANSACTION statement ok -CREATE TABLE t0(c0 INTERVAL DAY PRIMARY KEY, c1 BIGINT) - -statement ok -CREATE TABLE t1(c0 INTERVAL DAY, c1 BIGINT) - -statement ok rowcount 2 -INSERT INTO t1(c1) VALUES(3), (5) - -statement ok rowcount 3 -INSERT INTO t0(c0) VALUES(INTERVAL '9' DAY), (INTERVAL '7' DAY), (INTERVAL '8' DAY) - -statement ok rowcount 3 -TRUNCATE t0 - -statement ok rowcount 1 -INSERT INTO t0(c0) VALUES(INTERVAL '8' DAY) - -query T rowsort -SELECT t0.c0 FROM t0 WHERE (SELECT INTERVAL '2' DAY FROM t1 GROUP BY t1.c0) NOT IN (t0.c0) - -8 - -statement ok -ROLLBACK - -statement ok -START TRANSACTION - -statement ok CREATE TABLE "t0" ("c3" TIMESTAMP) statement ok rowcount 10 @@ -714,96 +685,22 @@ statement ok START TRANSACTION statement ok -CREATE TABLE "t0" ("c2" DATE, CONSTRAINT "t0_c2_pkey" PRIMARY KEY ("c2")) - -statement ok rowcount 2 -INSERT INTO "t0" VALUES (DATE '1970-01-04'), (DATE '1970-01-01') - -query T rowsort -SELECT t0.c2 FROM t0 WHERE (t0.c2) IN (t0.c2, (VALUES (DATE '1969-12-10'), (DATE '1970-01-01'))) - -1970-01-01 -1970-01-04 +CREATE TABLE "t0" ("c0" VARCHAR(32),"c1" REAL NOT NULL) -query I rowsort -SELECT CAST(SUM(count) AS BIGINT) FROM (SELECT CAST((t0.c2) IN (t0.c2, (VALUES (DATE '1969-12-10'), (DATE '1970-01-01'))) AS INT) as count FROM t0) as res - -2 - -statement ok -CREATE TABLE "t1" ("c2" BIGINT NOT NULL, CONSTRAINT "t1_c2_pkey" PRIMARY KEY ("c2")) - -statement ok rowcount 4 -INSERT INTO "t1" VALUES (69), (-12), (9), (0) +statement ok rowcount 20 +INSERT INTO "t0" VALUES ('|', 0.040731274),('儁\001萂y', 0.006212054),('N㸊', 3),(NULL, 0.35244483),(NULL, 1.2527365e+09),('g\t!cWW', 1.0299588e+09), +('1350272002', 0.718041),('V', 0.409386),('88', 1.2198221e+09),('*', 0.743),('0.5962615646747591', 0.06295456),('dJ>w++', 0),(NULL, 0.111538105), +(NULL, 4),('0.00', 8),(NULL, 0.2905001),(NULL, 40),(NULL, 5),(NULL, 0.14210498),('', 0.8845672) query T rowsort -SELECT -3 < least((SELECT 1 WHERE FALSE), (SELECT DISTINCT 2 FROM t1)) FROM t1 +SELECT t0.c0 FROM t0 WHERE ('*') BETWEEN ASYMMETRIC ('j^O') AND ('') -True -True -True -True query I rowsort -SELECT t1.c2 FROM t1 WHERE -3 < least((SELECT 1 WHERE FALSE), (SELECT 2 FROM t1 GROUP BY DATE '1970-01-11')) - --12 -0 -69 -9 - -query T rowsort -SELECT least((SELECT 1 WHERE FALSE), (SELECT DISTINCT 2 FROM t1)) > -3 FROM t1 +SELECT CAST(SUM(count) AS BIGINT) FROM (SELECT ALL CAST(('*') BETWEEN ASYMMETRIC ('j^O') AND ('') AS INT) as count FROM t0) as res -True -True -True -True - -query I rowsort -SELECT t1.c2 FROM t1 WHERE least((SELECT 1 WHERE FALSE), (SELECT 2 FROM t1 GROUP BY DATE '1970-01-11')) > -3 - --12 0 -69 -9 statement ok ROLLBACK -statement ok -START TRANSACTION - -statement ok -CREATE TABLE "t0" ("c3" INTERVAL SECOND) - -statement ok rowcount 9 -INSERT INTO "t0" VALUES (INTERVAL '6' SECOND),(INTERVAL '9' SECOND),(INTERVAL '1' SECOND), -(INTERVAL '0' SECOND),(INTERVAL '9' SECOND),(INTERVAL '4' SECOND),(INTERVAL '6' SECOND),(INTERVAL '1' SECOND),(NULL) - -query T rowsort -SELECT (SELECT 2 WHERE FALSE) = ANY(SELECT 3 WHERE FALSE) - -False - -query T rowsort -SELECT t0.c3 FROM t0 WHERE ifthenelse((SELECT 2 WHERE FALSE) = ANY(SELECT 3 WHERE FALSE), 2, 1) - -0:00:00 -0:00:01 -0:00:01 -0:00:04 -0:00:06 -0:00:06 -0:00:09 -0:00:09 -NULL - -query I rowsort -SELECT CAST(SUM(count) AS BI
MonetDB: Jul2021 - Removed CMP_SYMMETRIC and CMP_BETWEEN flags. ...
Changeset: e1eb09dab2ee for MonetDB URL: https://dev.monetdb.org/hg/MonetDB/rev/e1eb09dab2ee Modified Files: sql/backends/monet5/rel_bin.c sql/backends/monet5/sql_statement.c sql/backends/monet5/sql_statement.h sql/include/sql_catalog.h sql/include/sql_relation.h sql/server/rel_dump.c sql/server/rel_exp.c sql/server/rel_exp.h sql/server/rel_optimizer.c sql/server/rel_propagate.c sql/server/rel_select.c sql/test/miscellaneous/Tests/simple_plans.test Branch: Jul2021 Log Message: Removed CMP_SYMMETRIC and CMP_BETWEEN flags. They would sometimes give false positives when testing for comparison flags which wasn't desirable. CMP_BETWEEN is now absolete and use 'symmetric' property in the atom for the other. diffs (truncated from 605 to 300 lines): diff --git a/sql/backends/monet5/rel_bin.c b/sql/backends/monet5/rel_bin.c --- a/sql/backends/monet5/rel_bin.c +++ b/sql/backends/monet5/rel_bin.c @@ -56,9 +56,7 @@ static stmt * stmt_selectnil( backend *be, stmt *col) { sql_subtype *t = tail_type(col); - stmt *n = stmt_atom(be, atom_general(be->mvc->sa, t, NULL)); - stmt *nn = stmt_uselect2(be, col, n, n, 3, NULL, 0, 1); - return nn; + return stmt_uselect(be, col, stmt_atom(be, atom_general(be->mvc->sa, t, NULL)), cmp_equal, NULL, 0, 1); } static stmt * @@ -378,9 +376,7 @@ static stmt * stmt_selectnonil( backend *be, stmt *col, stmt *s ) { sql_subtype *t = tail_type(col); - stmt *n = stmt_atom(be, atom_general(be->mvc->sa, t, NULL)); - stmt *nn = stmt_uselect2(be, col, n, n, 3, s, 1, 1); - return nn; + return stmt_uselect(be, col, stmt_atom(be, atom_general(be->mvc->sa, t, NULL)), cmp_equal, s, 1, 1); } static int @@ -1510,7 +1506,7 @@ exp_bin(backend *be, sql_exp *e, stmt *l if (r2 && r2->nrcols == 0) r2 = stmt_const(be, bin_find_smallest_column(be, swapped?left:right), r2); if (r2) { - s = stmt_join2(be, l, r, r2, (comp_type)e->flag, is_anti(e), swapped); + s = stmt_join2(be, l, r, r2, (comp_type)e->flag, is_anti(e), is_symmetric(e), swapped); } else if (swapped) { s = stmt_join(be, r, l, is_anti(e), swap_compare((comp_type)e->flag), 0, is_semantics(e), false); } else { @@ -1520,7 +1516,7 @@ exp_bin(backend *be, sql_exp *e, stmt *l if (r2) { /* handle all cases in stmt_uselect, reducing, non reducing, scalar etc */ if (l->nrcols == 0 && ((sel && sel->nrcols > 0) || r->nrcols > 0 || r2->nrcols > 0 || reduce)) l = left ? stmt_const(be, bin_find_smallest_column(be, left), l) : column(be, l); - s = stmt_uselect2(be, l, r, r2, (comp_type)e->flag, sel, is_anti(e), reduce); + s = stmt_uselect2(be, l, r, r2, (comp_type)e->flag, sel, is_anti(e), is_symmetric(e), reduce); } else { /* value compare or select */ if ((!reduce || (l->nrcols == 0 && r->nrcols == 0)) && (e->flag == mark_in || e->flag == mark_notin)) { @@ -2414,7 +2410,7 @@ split_join_exps(sql_rel *rel, list *join /* we can handle thetajoins, rangejoins and filter joins (like) */ /* ToDo how about atom expressions? */ if (e->type == e_cmp) { - int flag = e->flag & ~CMP_BETWEEN; + int flag = e->flag; /* check if its a select or join expression, ie use only expressions of one relation left and of the other right (than join) */ if (flag < cmp_filter || flag == mark_in || flag == mark_notin) { /* theta and range joins */ /* join or select ? */ diff --git a/sql/backends/monet5/sql_statement.c b/sql/backends/monet5/sql_statement.c --- a/sql/backends/monet5/sql_statement.c +++ b/sql/backends/monet5/sql_statement.c @@ -1618,8 +1618,7 @@ argumentZero(MalBlkPtr mb, int tpe) */ static InstrPtr -select2_join2(backend *be, stmt *op1, stmt *op2, stmt *op3, int cmp, stmt **Sub, int anti, int swapped, int type, int - reduce) +select2_join2(backend *be, stmt *op1, stmt *op2, stmt *op3, int cmp, stmt **Sub, int anti, int symmetric, int swapped, int type, int reduce) { MalBlkPtr mb = be->mb; InstrPtr p, q; @@ -1630,7 +1629,7 @@ select2_join2(backend *be, stmt *op1, st if (op1->nr < 0 || (sub && sub->nr < 0)) return NULL; l = op1->nr; - if (((cmp & CMP_BETWEEN && cmp & CMP_SYMMETRIC) || op2->nrcols > 0 || op3->nrcols > 0 || !reduce) &
MonetDB: default - Changed sys.epoch(BIGINT) to sys.epoch(DECIMA...
Changeset: 75857450dec8 for MonetDB URL: https://dev.monetdb.org/hg/MonetDB/rev/75857450dec8 Modified Files: clients/Tests/exports.stable.out sql/ChangeLog sql/backends/monet5/sql_upgrades.c sql/common/sql_types.c sql/scripts/17_temporal.sql sql/test/BugTracker-2016/Tests/epoch.Bug-3979.test sql/test/BugTracker-2020/Tests/integers-intervals.Bug-6979.test sql/test/emptydb-upgrade-chain-hge/Tests/upgrade.stable.out.int128 sql/test/emptydb-upgrade-chain-hge/Tests/upgrade.stable.out.ppc64.int128 sql/test/emptydb-upgrade-chain/Tests/upgrade.stable.out sql/test/emptydb-upgrade-chain/Tests/upgrade.stable.out.32bit sql/test/emptydb-upgrade-chain/Tests/upgrade.stable.out.int128 sql/test/emptydb-upgrade-chain/Tests/upgrade.stable.out.ppc64 sql/test/emptydb-upgrade-chain/Tests/upgrade.stable.out.ppc64.int128 sql/test/emptydb-upgrade-hge/Tests/upgrade.stable.out.int128 sql/test/emptydb-upgrade/Tests/upgrade.stable.out sql/test/emptydb-upgrade/Tests/upgrade.stable.out.32bit sql/test/emptydb-upgrade/Tests/upgrade.stable.out.int128 sql/test/emptydb/Tests/check.stable.out sql/test/emptydb/Tests/check.stable.out.int128 sql/test/mergetables/Tests/forex.test sql/test/pg_regress/Tests/date.test sql/test/pg_regress/Tests/time.test sql/test/pg_regress/Tests/timestamp.test sql/test/pg_regress/Tests/timestamptz.test sql/test/testdb-upgrade-chain-hge/Tests/upgrade.stable.out.int128 sql/test/testdb-upgrade-chain/Tests/upgrade.stable.out sql/test/testdb-upgrade-chain/Tests/upgrade.stable.out.32bit sql/test/testdb-upgrade-chain/Tests/upgrade.stable.out.int128 sql/test/testdb-upgrade-hge/Tests/upgrade.stable.out.int128 sql/test/testdb-upgrade/Tests/upgrade.stable.out sql/test/testdb-upgrade/Tests/upgrade.stable.out.32bit sql/test/testdb-upgrade/Tests/upgrade.stable.out.int128 Branch: default Log Message: Changed sys.epoch(BIGINT) to sys.epoch(DECIMAL(18,3)), i.e. a different way to specify milliseconds. diffs (truncated from 2436 to 300 lines): diff --git a/clients/Tests/exports.stable.out b/clients/Tests/exports.stable.out --- a/clients/Tests/exports.stable.out +++ b/clients/Tests/exports.stable.out @@ -761,6 +761,7 @@ void MCcloseClient(Client c); Client MCforkClient(Client father); Client MCgetClient(int id); Client MCinitClient(oid user, bstream *fin, stream *fout); +size_t MCmemoryClaim(void); int MCpushClientInput(Client c, bstream *new_input, int listing, char *prompt); void MCstopClients(Client c); str MCsuspendClient(int id); diff --git a/sql/ChangeLog b/sql/ChangeLog --- a/sql/ChangeLog +++ b/sql/ChangeLog @@ -1,3 +1,18 @@ # ChangeLog file for sql # This file is updated with Maddlog +* Thu Jun 3 2021 Sjoerd Mullender +- The sys.epoch function has always been confusing. There are two + versions, one with an INTEGER argument, and one with a BIGINT + argument. The former accepted values as seconds, whereas the + latter epected milliseconds. Also, the construct EXTRACT(EPOCH + FROM value) returns a BIGINT with millisecond precision. This has + now been overhauled. There is no longer a function sys.epoch with + BIGINT argument, but instead there is a new function sys.epoch with + DECIMAL(18,3) argument. The argument is seconds, but with 3 decimals, + it provides millisecond accuracy. Also the EXTRACT(EPOCH FROM value) + now returns a DECIMAL(18,3), again seconds with 3 decimals giving + millisecond accuracy. Note that the internal, binary representation + of DECIMAL(18,3) interpreted as seconds with 3 decimals and BIGINT + with millisecond precision is exactly the same. + diff --git a/sql/backends/monet5/sql_upgrades.c b/sql/backends/monet5/sql_upgrades.c --- a/sql/backends/monet5/sql_upgrades.c +++ b/sql/backends/monet5/sql_upgrades.c @@ -1311,8 +1311,7 @@ sql_update_jun2020(Client c, mvc *sql, c "create function sys.tracelog()\n" " returns table (\n" " ticks bigint, -- time in microseconds\n" - " stmt string, -- actual statement executed\n" - " event string -- profiler event executed\n" + " stmt string -- actual statement executed\n" " )\n" " external name sql.dump_trace;\n" "create view sys.tracelog as select * from sys.tracelog();\n" @@ -3361,6 +3360,68 @@ bailout: return err; /* usually MAL_SUCCEED */ } +static str +sql_update_default(Client c, mvc *sql, const char *prev_schema, bool *systabfixed) +{ + sql_subtype tp; + size_t bufsize = 65536, pos = 0; + char *buf = NULL, *err = NULL; + sql_schema *s = mvc_bind_schema(sql, "sys"); + sql_table *t; + + (void)
MonetDB: userprofile - comment
Changeset: 08e57797d399 for MonetDB URL: https://dev.monetdb.org/hg/MonetDB/rev/08e57797d399 Modified Files: sql/storage/bat/bat_table.c Branch: userprofile Log Message: comment diffs (11 lines): diff --git a/sql/storage/bat/bat_table.c b/sql/storage/bat/bat_table.c --- a/sql/storage/bat/bat_table.c +++ b/sql/storage/bat/bat_table.c @@ -224,6 +224,7 @@ table_insert(sql_trans *tr, sql_table *t for (; n; n = n->next) { sql_column *c = n->data; val = va_arg(va, void *); + // this breaks if next arg is 0 //if (!val) // break; ok = store->storage_api.append_col(tr, c, offset, val, c->type.type->localtype, 1); ___ checkin-list mailing list checkin-list@monetdb.org https://www.monetdb.org/mailman/listinfo/checkin-list