Changeset: 54c45b0895fc for MonetDB URL: http://dev.monetdb.org/hg/MonetDB?cmd=changeset;node=54c45b0895fc Modified Files: clients/mapiclient/dump.c common/utils/msabaoth.c gdk/gdk_firstn.c gdk/gdk_imprints.h geom/monetdb5/geom.c monetdb5/modules/kernel/algebra.c monetdb5/modules/kernel/bat5.c monetdb5/modules/mal/clients.c monetdb5/optimizer/opt_mergetable.c monetdb5/tests/gdkTests/Tests/firstn.stable.out sql/backends/monet5/datacell/basket.c sql/backends/monet5/datacell/emitter.c sql/backends/monet5/datacell/sensor.c sql/backends/monet5/rel_bin.c sql/backends/monet5/sql_gencode.c sql/backends/monet5/sql_scenario.c sql/backends/monet5/sql_statement.h sql/benchmarks/tpch/Tests/02-explain.stable.out sql/benchmarks/tpch/Tests/03-explain.stable.out sql/benchmarks/tpch/Tests/10-explain.stable.out sql/benchmarks/tpch/Tests/18-explain.stable.out sql/benchmarks/tpch/Tests/21-explain.stable.out sql/server/rel_planner.c sql/server/rel_schema.c sql/server/rel_updates.c sql/server/sql_decimal.c sql/server/sql_env.c sql/storage/store.c sql/test/BugTracker-2010/Tests/LIMIT_OFFSET_big-endian.Bug-2622.stable.out sql/test/pg_regress/Tests/All testing/difflib.c Branch: mosaic Log Message:
Merge with default branch. diffs (truncated from 1219 to 300 lines): diff --git a/clients/mapiclient/dump.c b/clients/mapiclient/dump.c --- a/clients/mapiclient/dump.c +++ b/clients/mapiclient/dump.c @@ -1286,7 +1286,7 @@ dump_functions(Mapi mid, stream *toConso if (schema) free(schema); mapi_close_handle(hdl); - return mnstr_errnr(toConsole) ? 1 : 0; + return mnstr_errnr(toConsole) != 0; bailout: if (schema) diff --git a/common/utils/msabaoth.c b/common/utils/msabaoth.c --- a/common/utils/msabaoth.c +++ b/common/utils/msabaoth.c @@ -804,7 +804,7 @@ msab_getUplogInfo(sabuplog *ret, const s memmove(&avg10[0], &avg10[1], sizeof(int) * 9); memmove(&avg30[0], &avg30[1], sizeof(int) * 29); avg10[9] = avg30[29] = ret->crashavg1 = - (start != 0 ? 1 : 0); + (start != 0); *p = '\0'; ret->laststart = start = (time_t)atol(data); p = data; @@ -834,9 +834,9 @@ msab_getUplogInfo(sabuplog *ret, const s memmove(&avg10[0], &avg10[1], sizeof(int) * 9); memmove(&avg30[0], &avg30[1], sizeof(int) * 29); avg10[9] = avg30[29] = ret->crashavg1 = - (start != 0 ? (db->state != SABdbRunning ? 1 : 0) : 0); + (start != 0 ? (db->state != SABdbRunning) : 0); ret->crashcntr = - ret->startcntr - (db->state == SABdbRunning ? 1 : 0) - + ret->startcntr - (db->state == SABdbRunning) - ret->stopcntr; for (i = 0; i < 10; i++) ret->crashavg10 += avg10[i]; diff --git a/gdk/gdk_firstn.c b/gdk/gdk_firstn.c --- a/gdk/gdk_firstn.c +++ b/gdk/gdk_firstn.c @@ -472,7 +472,6 @@ BATfirstn_grouped(BAT **topn, BAT **gids } *groups; assert(topn); - assert(gids); CANDINIT(b, s, start, end, cnt, cand, candend); @@ -651,15 +650,18 @@ BATfirstn_grouped(BAT **topn, BAT **gids bn->T->nil = 0; bn->T->nonil = 1; } - BATsetcount(gn, ncnt); - BATseqbase(gn, 0); - gn->tkey = ncnt == top; - gn->tsorted = ncnt <= 1; - gn->trevsorted = ncnt <= 1; - gn->T->nil = 0; - gn->T->nonil = 1; + if (gids) { + BATsetcount(gn, ncnt); + BATseqbase(gn, 0); + gn->tkey = ncnt == top; + gn->tsorted = ncnt <= 1; + gn->trevsorted = ncnt <= 1; + gn->T->nil = 0; + gn->T->nonil = 1; + *gids = gn; + } else + BBPreclaim(gn); *topn = bn; - *gids = gn; return GDK_SUCCEED; } @@ -747,20 +749,20 @@ BATfirstn_grouped_with_groups(BAT **topn } *groups; assert(topn); - assert(gids); if (BATtdense(g)) { /* trivial: g determines ordering, return initial * slice of s */ bn = BATslice(s, 0, n); - gn = BATslice(g, 0, n); - if (bn == NULL || gn == NULL) { + gn = gids ? BATslice(g, 0, n) : NULL; + if (bn == NULL || (gids != NULL && gn == NULL)) { BBPreclaim(bn); BBPreclaim(gn); return GDK_FAIL; } *topn = bn; - *gids = gn; + if (gids) + *gids = gn; return GDK_SUCCEED; } @@ -944,15 +946,18 @@ BATfirstn_grouped_with_groups(BAT **topn bn->T->nil = 0; bn->T->nonil = 1; } - BATsetcount(gn, ncnt); - BATseqbase(gn, 0); - gn->tkey = ncnt == top; - gn->tsorted = ncnt <= 1; - gn->trevsorted = ncnt <= 1; - gn->T->nil = 0; - gn->T->nonil = 1; + if (gids) { + BATsetcount(gn, ncnt); + BATseqbase(gn, 0); + gn->tkey = ncnt == top; + gn->tsorted = ncnt <= 1; + gn->trevsorted = ncnt <= 1; + gn->T->nil = 0; + gn->T->nonil = 1; + *gids = gn; + } else + BBPreclaim(gn); *topn = bn; - *gids = gn; return GDK_SUCCEED; } @@ -995,13 +1000,13 @@ BATfirstn(BAT **topn, BAT **gids, BAT *b } if (g == NULL) { - if (gids == NULL) { + if (gids == NULL && !distinct) { *topn = BATfirstn_unique(b, s, n, asc); return *topn ? GDK_SUCCEED : GDK_FAIL; } return BATfirstn_grouped(topn, gids, b, s, n, asc, distinct); } - if (gids == NULL) { + if (gids == NULL && !distinct) { *topn = BATfirstn_unique_with_groups(b, s, g, n, asc); return *topn ? GDK_SUCCEED : GDK_FAIL; } diff --git a/gdk/gdk_imprints.h b/gdk/gdk_imprints.h --- a/gdk/gdk_imprints.h +++ b/gdk/gdk_imprints.h @@ -37,12 +37,12 @@ typedef struct { #define IMPScnt(X) ((X) & 16777215) /* 24 bits for cnt */ #define IMPSsetcnt(X,Y) ((X) = (Y)) /* no overflow check */ #define IMPScnt_inc(X) ((X)++) /* no overflow check */ -#define IMPSrepeat(X) (((X) & 16777216)?1:0) +#define IMPSrepeat(X) (((X) & 16777216) != 0) #define IMPSsetrepeat(X) ((X) |= 16777216) #define IMPSunsetrepeat(X) ((X) &= (~16777216)) #define IMPSsetBit(B,X,Y) ((((uint##B##_t)1)<<(Y))|(X)) #define IMPSunsetBit(B,X,Y) ((~(((uint##B##_t)1)<<(Y)))&(X)) -#define IMPSisSet(B,X,Y) (((((uint##B##_t)1)<<Y)&X)?1:0) +#define IMPSisSet(B,X,Y) (((((uint##B##_t)1)<<Y)&X) != 0) #define IMPSmod2(X,Y) ((X)&((Y)-1)) #endif /* GDK_IMPS_H */ diff --git a/geom/monetdb5/geom.c b/geom/monetdb5/geom.c --- a/geom/monetdb5/geom.c +++ b/geom/monetdb5/geom.c @@ -257,12 +257,12 @@ mbrCOMP(mbr *l, mbr *r) /* simple lexicographical ordering on (x,y) */ int res; if (l->xmin == r->xmin) - res = (l->ymin < r->ymin) ? -1 : (l->ymin == r->ymin) ? 0 : 1; + res = (l->ymin < r->ymin) ? -1 : (l->ymin != r->ymin); else res = (l->xmin < r->xmin) ? -1 : 1; if (res == 0) { if (l->xmax == r->xmax) - res = (l->ymax < r->ymax) ? -1 : (l->ymax == r->ymax) ? 0 : 1; + res = (l->ymax < r->ymax) ? -1 : (l->ymax != r->ymax); else res = (l->xmax < r->xmax) ? -1 : 1; } diff --git a/monetdb5/modules/kernel/algebra.c b/monetdb5/modules/kernel/algebra.c --- a/monetdb5/modules/kernel/algebra.c +++ b/monetdb5/modules/kernel/algebra.c @@ -2206,7 +2206,7 @@ ALGexist(bit *ret, int *bid, ptr val) } derefStr(b, h, val); q = BUNfnd(BATmirror(b), val); - *ret = (q != BUN_NONE) ? 1 : 0; + *ret = (q != BUN_NONE); BBPreleaseref(b->batCacheid); return MAL_SUCCEED; } diff --git a/monetdb5/modules/kernel/bat5.c b/monetdb5/modules/kernel/bat5.c --- a/monetdb5/modules/kernel/bat5.c +++ b/monetdb5/modules/kernel/bat5.c @@ -1694,7 +1694,7 @@ BKCisSynced(bit *ret, int *bid1, int *bi BBPreleaseref(b1->batCacheid); throw(MAL, "bat.isSynced", RUNTIME_OBJECT_MISSING); } - *ret = ALIGNsynced(b1, b2) ? 1 : 0; + *ret = ALIGNsynced(b1, b2) != 0; BBPreleaseref(b1->batCacheid); BBPreleaseref(b2->batCacheid); return MAL_SUCCEED; diff --git a/monetdb5/modules/mal/clients.c b/monetdb5/modules/mal/clients.c --- a/monetdb5/modules/mal/clients.c +++ b/monetdb5/modules/mal/clients.c @@ -625,7 +625,7 @@ CLTsessions(Client cntxt, MalBlkPtr mb, MT_lock_set(&mal_contextLock, "clients.sessions"); - for (c = mal_clients + (GDKgetenv_isyes("monet_daemon")?1:0); c < mal_clients + MAL_MAXCLIENTS; c++) + for (c = mal_clients + (GDKgetenv_isyes("monet_daemon") != 0); c < mal_clients + MAL_MAXCLIENTS; c++) if (c->mode == RUNCLIENT) { BUNappend(user, &usrname, FALSE); msg = MTIMEunix_epoch(&ts); diff --git a/monetdb5/optimizer/opt_mergetable.c b/monetdb5/optimizer/opt_mergetable.c --- a/monetdb5/optimizer/opt_mergetable.c +++ b/monetdb5/optimizer/opt_mergetable.c @@ -556,8 +556,8 @@ mat_join2(MalBlkPtr mb, InstrPtr p, mat_ } } else { int mv = (m>=0)?m:n; - int av = (m>=0)?0:1; - int bv = (m>=0)?1:0; + int av = (m<0); + int bv = (m>=0); for(k=1; k<mat[mv].mi->argc; k++) { InstrPtr q = copyInstruction(p); @@ -622,8 +622,8 @@ mat_join3(MalBlkPtr mb, InstrPtr p, mat_ } } else { int mv = (m>=0)?m:n; - int av = (m>=0)?0:1; - int bv = (m>=0)?1:0; + int av = (m<0); + int bv = (m>=0); for(k=1; k<mat[mv].mi->argc; k++) { InstrPtr q = copyInstruction(p); diff --git a/monetdb5/tests/gdkTests/Tests/firstn.stable.out b/monetdb5/tests/gdkTests/Tests/firstn.stable.out --- a/monetdb5/tests/gdkTests/Tests/firstn.stable.out +++ b/monetdb5/tests/gdkTests/Tests/firstn.stable.out @@ -54,334 +54,334 @@ function user.main():void; bat.append(c,6@0); bat.append(c,7@0); bat.append(c,8@0); - x1 := algebra.firstn(a,0:wrd,true); + x1 := algebra.firstn(a,0:wrd,true,false); io.print(x1); a1 := algebra.leftfetchjoin(x1,a); io.print(a1); - x1 := algebra.firstn(a,1:wrd,true); + x1 := algebra.firstn(a,1:wrd,true,false); io.print(x1); a1 := algebra.leftfetchjoin(x1,a); io.print(a1); - x1 := algebra.firstn(a,2:wrd,true); + x1 := algebra.firstn(a,2:wrd,true,false); io.print(x1); a1 := algebra.leftfetchjoin(x1,a); io.print(a1); - x1 := algebra.firstn(a,3:wrd,true); + x1 := algebra.firstn(a,3:wrd,true,false); io.print(x1); a1 := algebra.leftfetchjoin(x1,a); io.print(a1); - x1 := algebra.firstn(a,4:wrd,true); + x1 := algebra.firstn(a,4:wrd,true,false); io.print(x1); a1 := algebra.leftfetchjoin(x1,a); io.print(a1); - x1 := algebra.firstn(a,5:wrd,true); + x1 := algebra.firstn(a,5:wrd,true,false); io.print(x1); a1 := algebra.leftfetchjoin(x1,a); io.print(a1); - x1 := algebra.firstn(a,6:wrd,true); + x1 := algebra.firstn(a,6:wrd,true,false); io.print(x1); a1 := algebra.leftfetchjoin(x1,a); io.print(a1); - x1 := algebra.firstn(a,7:wrd,true); + x1 := algebra.firstn(a,7:wrd,true,false); io.print(x1); a1 := algebra.leftfetchjoin(x1,a); io.print(a1); - x1 := algebra.firstn(a,8:wrd,true); + x1 := algebra.firstn(a,8:wrd,true,false); io.print(x1); a1 := algebra.leftfetchjoin(x1,a); io.print(a1); - x1 := algebra.firstn(a,9:wrd,true); + x1 := algebra.firstn(a,9:wrd,true,false); io.print(x1); a1 := algebra.leftfetchjoin(x1,a); io.print(a1); - x1 := algebra.firstn(a,10:wrd,true); + x1 := algebra.firstn(a,10:wrd,true,false); io.print(x1); a1 := algebra.leftfetchjoin(x1,a); _______________________________________________ checkin-list mailing list checkin-list@monetdb.org https://www.monetdb.org/mailman/listinfo/checkin-list