Changeset: 1ce3b4b9a81a for MonetDB
URL: https://dev.monetdb.org/hg/MonetDB/rev/1ce3b4b9a81a
Modified Files:
clients/Tests/exports.stable.out
Branch: dict
Log Message:
merged with default
diffs (truncated from 2175 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
@@ -233,6 +233,7 @@ gdk_return BUNreplacemulti(BAT *b, const
gdk_return BUNreplacemultiincr(BAT *b, oid position, const void *values, BUN
count, bool force) __attribute__((__warn_unused_result__));
BAT *COLcopy(BAT *b, int tt, bool writable, role_t role);
BAT *COLnew(oid hseq, int tltype, BUN capacity, role_t role)
__attribute__((__warn_unused_result__));
+BAT *COLnew2(oid hseq, int tt, BUN cap, role_t role, uint16_t width)
__attribute__((__warn_unused_result__));
size_t GDK_mem_maxsize;
size_t GDK_vm_maxsize;
gdk_return GDKanalytical_correlation(BAT *r, BAT *p, BAT *o, BAT *b1, BAT *b2,
BAT *s, BAT *e, int tpe, int frame_type);
diff --git a/gdk/gdk.h b/gdk/gdk.h
--- a/gdk/gdk.h
+++ b/gdk/gdk.h
@@ -1060,6 +1060,8 @@ gdk_export void HEAP_free(Heap *heap, va
*/
gdk_export BAT *COLnew(oid hseq, int tltype, BUN capacity, role_t role)
__attribute__((__warn_unused_result__));
+gdk_export BAT *COLnew2(oid hseq, int tt, BUN cap, role_t role, uint16_t width)
+ __attribute__((__warn_unused_result__));
gdk_export BAT *BATdense(oid hseq, oid tseq, BUN cnt)
__attribute__((__warn_unused_result__));
gdk_export gdk_return BATextend(BAT *b, BUN newcap)
@@ -2350,19 +2352,19 @@ gdk_export BAT *BATsample_with_seed(BAT
* on each iteration */
#define TIMEOUT_LOOP_IDX(IDX, REPEATS, TIMEOFFSET) \
for (BUN REPS = (IDX = 0, (REPEATS)); REPS > 0; REPS = 0) /* "loops" at
most once */ \
- for (BUN CTR1 = 0, END1 = (REPS + 1 + CHECK_QRY_TIMEOUT_MASK)
>> CHECK_QRY_TIMEOUT_SHIFT; CTR1 < END1 && TIMEOFFSET >= 0; CTR1++, TIMEOFFSET
= TIMEOFFSET > 0 && GDKusec() > TIMEOFFSET ? -1 : TIMEOFFSET) \
+ for (BUN CTR1 = 0, END1 = (REPS + CHECK_QRY_TIMEOUT_STEP) >>
CHECK_QRY_TIMEOUT_SHIFT; CTR1 < END1 && TIMEOFFSET >= 0; CTR1++, TIMEOFFSET =
TIMEOFFSET > 0 && GDKusec() > TIMEOFFSET ? -1 : TIMEOFFSET) \
for (BUN CTR2 = 0, END2 = CTR1 == END1 - 1 ? REPS &
CHECK_QRY_TIMEOUT_MASK : CHECK_QRY_TIMEOUT_STEP; CTR2 < END2; CTR2++, IDX++)
/* declare and use IDX as a loop variable, initializing it to 0 and
* incrementing it on each iteration */
#define TIMEOUT_LOOP_IDX_DECL(IDX, REPEATS, TIMEOFFSET)
\
for (BUN IDX = 0, REPS = (REPEATS); REPS > 0; REPS = 0) /* "loops" at
most once */ \
- for (BUN CTR1 = 0, END1 = (REPS + CHECK_QRY_TIMEOUT_MASK) >>
CHECK_QRY_TIMEOUT_SHIFT; CTR1 < END1 && TIMEOFFSET >= 0; CTR1++, TIMEOFFSET =
TIMEOFFSET > 0 && GDKusec() > TIMEOFFSET ? -1 : TIMEOFFSET) \
+ for (BUN CTR1 = 0, END1 = (REPS + CHECK_QRY_TIMEOUT_STEP) >>
CHECK_QRY_TIMEOUT_SHIFT; CTR1 < END1 && TIMEOFFSET >= 0; CTR1++, TIMEOFFSET =
TIMEOFFSET > 0 && GDKusec() > TIMEOFFSET ? -1 : TIMEOFFSET) \
for (BUN CTR2 = 0, END2 = CTR1 == END1 - 1 ? REPS &
CHECK_QRY_TIMEOUT_MASK : CHECK_QRY_TIMEOUT_STEP; CTR2 < END2; CTR2++, IDX++)
/* there is no user-visible loop variable */
#define TIMEOUT_LOOP(REPEATS, TIMEOFFSET) \
- for (BUN CTR1 = 0, REPS = (REPEATS), END1 = (REPS +
CHECK_QRY_TIMEOUT_MASK) >> CHECK_QRY_TIMEOUT_SHIFT; CTR1 < END1 && TIMEOFFSET
>= 0; CTR1++, TIMEOFFSET = TIMEOFFSET > 0 && GDKusec() > TIMEOFFSET ? -1 :
TIMEOFFSET) \
+ for (BUN CTR1 = 0, REPS = (REPEATS), END1 = (REPS +
CHECK_QRY_TIMEOUT_STEP) >> CHECK_QRY_TIMEOUT_SHIFT; CTR1 < END1 && TIMEOFFSET
>= 0; CTR1++, TIMEOFFSET = TIMEOFFSET > 0 && GDKusec() > TIMEOFFSET ? -1 :
TIMEOFFSET) \
for (BUN CTR2 = 0, END2 = CTR1 == END1 - 1 ? REPS &
CHECK_QRY_TIMEOUT_MASK : CHECK_QRY_TIMEOUT_STEP; CTR2 < END2; CTR2++)
/* break out of the loop (cannot use do/while trick here) */
diff --git a/gdk/gdk_align.c b/gdk/gdk_align.c
--- a/gdk/gdk_align.c
+++ b/gdk/gdk_align.c
@@ -255,7 +255,7 @@ BATmaterialize(BAT *b)
b->tunique_est = is_oid_nil(t) ? 1.0 : (double) b->batCount;
MT_lock_unset(&b->theaplock);
b->ttype = TYPE_oid;
- BATsetdims(b);
+ BATsetdims(b, 0);
b->batDirtydesc = true;
BATsetcount(b, b->batCount);
diff --git a/gdk/gdk_bat.c b/gdk/gdk_bat.c
--- a/gdk/gdk_bat.c
+++ b/gdk/gdk_bat.c
@@ -171,9 +171,9 @@ ATOMelmshift(int sz)
void
-BATsetdims(BAT *b)
+BATsetdims(BAT *b, uint16_t width)
{
- b->twidth = b->ttype == TYPE_str ? 1 : ATOMsize(b->ttype);
+ b->twidth = b->ttype == TYPE_str ? width > 0 ? width : 1 :
ATOMsize(b->ttype);
b->tshift = ATOMelmshift(b->twidth);
assert_shift_width(b->tshift, b->twidth);
b->tvarsized = b->ttype == TYPE_void || BATatoms[b->ttype].atomPut !=
NULL;
@@ -204,6 +204,7 @@ settailname(Heap *restrict tail, const c
{
if (tt == TYPE_str) {
switch (width) {
+ case 0:
case 1:
strconcat_len(tail->filename,
sizeof(tail->filename), physnme,
@@ -241,7 +242,7 @@ settailname(Heap *restrict tail, const c
* filenames.
*/
BAT *
-COLnew_intern(oid hseq, int tt, BUN cap, role_t role, uint16_t width)
+COLnew2(oid hseq, int tt, BUN cap, role_t role, uint16_t width)
{
BAT *bn;
@@ -268,20 +269,11 @@ COLnew_intern(oid hseq, int tt, BUN cap,
if (bn == NULL)
return NULL;
- BATsetdims(bn);
+ BATsetdims(bn, width);
bn->batCapacity = cap;
if (ATOMstorage(tt) == TYPE_msk)
cap /= 8; /* 8 values per byte */
- else if (tt == TYPE_str) {
- if (width != 0) {
- /* power of two and not too large */
- assert((width & (width - 1)) == 0);
- assert(width <= sizeof(var_t));
- bn->twidth = width;
- }
- settailname(bn->theap, BBP_physical(bn->batCacheid), tt,
bn->twidth);
- }
/* alloc the main heaps */
if (tt && HEAPalloc(bn->theap, cap, bn->twidth, ATOMsize(bn->ttype)) !=
GDK_SUCCEED) {
@@ -313,7 +305,7 @@ COLnew_intern(oid hseq, int tt, BUN cap,
BAT *
COLnew(oid hseq, int tt, BUN cap, role_t role)
{
- return COLnew_intern(hseq, tt, cap, role, 0);
+ return COLnew2(hseq, tt, cap, role, 0);
}
BAT *
@@ -835,16 +827,15 @@ COLcopy(BAT *b, int tt, bool writable, r
slowcopy = true;
}
- bn = COLnew_intern(b->hseqbase, tt, bi.count, role, bi.width);
+ bn = COLnew2(b->hseqbase, tt, bi.count, role, bi.width);
if (bn == NULL) {
bat_iterator_end(&bi);
return NULL;
}
if (bn->tvheap != NULL && bn->tvheap->base == NULL) {
/* this combination can happen since the last
- * argument of COLnew_intern not being zero
- * triggers a skip in the allocation of the
- * tvheap */
+ * argument of COLnew2 not being zero triggers a
+ * skip in the allocation of the tvheap */
if (ATOMheap(bn->ttype, bn->tvheap, bn->batCapacity) !=
GDK_SUCCEED) {
bat_iterator_end(&bi);
BBPreclaim(bn);
@@ -2787,4 +2778,3 @@ BATassertProps(BAT *b)
}
MT_lock_unset(&b->theaplock);
}
-
diff --git a/gdk/gdk_private.h b/gdk/gdk_private.h
--- a/gdk/gdk_private.h
+++ b/gdk/gdk_private.h
@@ -83,7 +83,7 @@ void BATrmprop_nolock(BAT *b, enum prop_
__attribute__((__visibility__("hidden")));
gdk_return BATsave_locked(BAT *bd, BATiter *bi, BUN size)
__attribute__((__visibility__("hidden")));
-void BATsetdims(BAT *b)
+void BATsetdims(BAT *b, uint16_t width)
__attribute__((__visibility__("hidden")));
ValPtr BATsetprop(BAT *b, enum prop_t idx, int type, const void *v)
__attribute__((__visibility__("hidden")));
@@ -125,9 +125,6 @@ BUN binsearch_flt(const oid *restrict in
__attribute__((__visibility__("hidden")));
BUN binsearch_dbl(const oid *restrict indir, oid offset, const dbl *restrict
vals, BUN lo, BUN hi, dbl v, int ordering, int last)
__attribute__((__visibility__("hidden")));
-BAT *COLnew_intern(oid hseq, int tt, BUN cap, role_t role, uint16_t width)
- __attribute__((__warn_unused_result__))
- __attribute__((__visibility__("hidden")));
Heap *createOIDXheap(BAT *b, bool stable)
__attribute__((__visibility__("hidden")));
void doHASHdestroy(BAT *b, Hash *hs)
diff --git a/gdk/gdk_project.c b/gdk/gdk_project.c
--- a/gdk/gdk_project.c
+++ b/gdk/gdk_project.c
@@ -710,7 +710,7 @@ BATproject2(BAT *restrict l, BAT *restri
r1i = bat_iterator(r1);
r2i = bat_iterator(r2);
}
- bn = COLnew_intern(l->hseqbase, ATOMtype(r1->ttype), lcount, TRANSIENT,
stringtrick ? r1i.width : 0);
+ bn = COLnew2(l->hseqbase, ATOMtype(r1->ttype), lcount, TRANSIENT,
stringtrick ? r1i.width : 0);
if (bn == NULL) {
goto doreturn;
}
@@ -965,7 +965,7 @@ BATprojectchain(BAT **bats)
bi = bat_iterator(b);
if (nonil && ATOMstorage(tpe) == TYPE_str && b->batRestricted ==
BAT_READ) {
stringtrick = true;
- bn = COLnew_intern(ba[0].hlo, tpe, ba[0].cnt, TRANSIENT,
bi.width);
+ bn = COLnew2(ba[0].hlo, tpe, ba[0].cnt, TRANSIENT, bi.width);
if (bn && bn->tvheap) {
/* no need to remove any files since they were
* never created for this bat */
diff --git a/monetdb5/mal/mal_profiler.c b/monetdb5/mal/mal_profiler.c
--- a/monetdb5/mal/mal_profiler.c
+++ b/monetdb5/mal/mal_profiler.c
@@ -68,8 +68,9 @@ static void logjsonInternal(char *logbuf
MT_lock_set(&mal_profileLock);
if (maleventstream) {
// upon request the log record is sent over the profile stream
- (void) mnstr_write(maleventstream, logbuffer, 1, len);
- (void) mnstr_flush(maleventstream, MNSTR_FLUSH_DATA);
+ if (mnstr_write(maleventstream, logbuffer, 1, len) != BLOCK) /*
if we wrote exactly the BLOCK size, it was
+
flushed allready */
+ (void) mnstr_flush(maleventstream, MNSTR_FLUSH_DATA);
}
MT_lock_unset(&mal_profileLock);
}
diff --git a/monetdb5/modules/mal/remote.c b/monetdb5/modules/mal/remote.c
--- a/monetdb5/modules/mal/remote.c
+++ b/monetdb5/modules/mal/remote.c
@@ -726,17 +726,10 @@ RMTinternalcopyfrom(BAT **ret, char *hdr
hdr++;
}
- b = COLnew(0, bb.Ttype, bb.size, TRANSIENT);
+ b = COLnew2(bb.Hseqbase, bb.Ttype, bb.size, TRANSIENT, bb.size > 0 ?
(uint16_t) (bb.tailsize / bb.size) : 0);
if (b == NULL)
throw(MAL, "remote.get", SQLSTATE(HY013) MAL_MALLOC_FAIL);
- /* for strings, the width may not match, fix it to match what we
- * retrieved */
- if (bb.Ttype == TYPE_str && bb.size) {
- b->twidth = (unsigned short) (bb.tailsize / bb.size);
- b->tshift = ATOMelmshift(Tsize(b));
- }
-
if (bb.tailsize > 0) {
if (HEAPextend(b->theap, bb.tailsize, true) != GDK_SUCCEED ||
mnstr_read(in, b->theap->base, bb.tailsize, 1) < 0)
@@ -744,7 +737,9 @@ RMTinternalcopyfrom(BAT **ret, char *hdr
b->theap->dirty = true;
}
if (bb.theapsize > 0) {
- if (HEAPextend(b->tvheap, bb.theapsize, true) != GDK_SUCCEED ||
+ if ((b->tvheap->base == NULL &&
+ (*BATatoms[b->ttype].atomHeap)(b->tvheap,
b->batCapacity) != GDK_SUCCEED) ||
+ HEAPextend(b->tvheap, bb.theapsize, true) !=
GDK_SUCCEED ||
mnstr_read(in, b->tvheap->base, bb.theapsize, 1) < 0)
goto bailout;
b->tvheap->free = bb.theapsize;
diff --git a/sql/server/rel_dump.c b/sql/server/rel_dump.c
--- a/sql/server/rel_dump.c
+++ b/sql/server/rel_dump.c
@@ -1883,6 +1883,7 @@ rel_read(mvc *sql, char *r, int *pos, li
outputs = new_exp_list(sql->sa);
while (r[*pos] && r[*pos] != ']' && m) {
sql_arg *a = m->data;
+ unsigned int rlabel, nlabel;
char *nrname, *ncname;
if (r[*pos] != '"')
@@ -1908,6 +1909,10 @@ rel_read(mvc *sql, char *r, int *pos, li
(*pos)++;
next = exp_column(sql->sa, nrname,
ncname, &a->type, CARD_MULTI, 1, 0, 0);
+ rlabel = try_update_label_count(sql,
nrname);
+ nlabel = try_update_label_count(sql,
ncname);
+ if (rlabel && rlabel == nlabel)
+ next->alias.label = rlabel;
set_basecol(next);
append(outputs, next);
m = m->next;
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
@@ -1776,8 +1776,8 @@ exp_is_cmp_exp_is_false(sql_exp* e)
return false;
if (e->flag == cmp_equal && !is_anti(e))
return ((exp_is_null(l) && exp_is_not_null(r)) ||
(exp_is_not_null(l) && exp_is_null(r)));
- if (((e->flag == cmp_notequal) && !is_anti(e)) || ((e->flag ==
cmp_equal) && is_anti(e)) )
- return ((exp_is_null(l) && exp_is_null(r)) ||
(exp_is_not_null(l) && exp_is_not_null(r)));
+ if ((e->flag == cmp_notequal && !is_anti(e)) || (e->flag == cmp_equal
&& is_anti(e)))
+ return exp_is_null(l) && exp_is_null(r);
return false;
}
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
@@ -4689,7 +4689,7 @@ rel_push_select_down(visitor *v, sql_rel
if (is_select(rel->op) && r && r->op == op_project && !rel_is_ref(r) &&
!is_single(r)){
sql_rel *pl = r->l;
/* we cannot push through window functions (for safety I
disabled projects over DDL too) */
- if (pl && pl->op != op_ddl && !exps_have_unsafe(r->exps, 1)) {
+ if (pl && pl->op != op_ddl && !exps_have_unsafe(r->exps, 0)) {
/* introduce selects under the project (if needed) */
set_processed(pl);
for (n = exps->h; n;) {
diff --git a/sql/server/rel_rel.c b/sql/server/rel_rel.c
--- a/sql/server/rel_rel.c
+++ b/sql/server/rel_rel.c
@@ -1057,44 +1057,36 @@ rel_bind_path_(mvc *sql, sql_rel *rel, s
break;
case op_semi:
case op_anti:
-
case op_select:
case op_topn:
case op_sample:
found = rel_bind_path_(sql, rel->l, e, path);
break;
-
case op_basetable:
_______________________________________________
checkin-list mailing list
[email protected]
https://www.monetdb.org/mailman/listinfo/checkin-list