MonetDB: cleanup_types - make sure to do mark (aggregating) join...
Changeset: a48982bfe212 for MonetDB URL: https://dev.monetdb.org/hg/MonetDB/rev/a48982bfe212 Modified Files: sql/backends/monet5/rel_bin.c Branch: cleanup_types Log Message: make sure to do mark (aggregating) joins/selects after group-join diffs (21 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 @@ -2790,7 +2790,7 @@ get_simple_equi_joins_first(mvc *sql, sq for (node *n = exps->h; n; n = n->next) { sql_exp *e = n->data; - if (can_join_exp(rel, e, false) && is_equi_exp_(e)) + if (can_join_exp(rel, e, false) && is_equi_exp_(e) && !is_any(e)) list_append(new_exps, e); else *equality_only = false; @@ -2798,7 +2798,7 @@ get_simple_equi_joins_first(mvc *sql, sq for (node *n = exps->h; n; n = n->next) { sql_exp *e = n->data; - if (!is_equi_exp_(e) || !can_join_exp(rel, e, false)) + if (!is_equi_exp_(e) || !can_join_exp(rel, e, false) || is_any(e)) list_append(new_exps, e); } return new_exps; ___ checkin-list mailing list -- checkin-list@monetdb.org To unsubscribe send an email to checkin-list-le...@monetdb.org
MonetDB: cleanup_types - cleanup create_analytics interface (no ...
Changeset: b268191c00f7 for MonetDB URL: https://dev.monetdb.org/hg/MonetDB/rev/b268191c00f7 Modified Files: sql/common/sql_types.c Branch: cleanup_types Log Message: cleanup create_analytics interface (no need to pass scale_fix-ing) diffs (241 lines): diff --git a/sql/common/sql_types.c b/sql/common/sql_types.c --- a/sql/common/sql_types.c +++ b/sql/common/sql_types.c @@ -901,13 +901,13 @@ sql_create_union(sql_allocator *sa, cons } static sql_func * -sql_create_analytic(sql_allocator *sa, const char *name, const char *mod, const char *imp, bit private, int fix_scale, sql_type *fres, int nargs, ...) +sql_create_analytic(sql_allocator *sa, const char *name, const char *mod, const char *imp, bit private, sql_type *fres, int nargs, ...) { sql_func *res; va_list valist; va_start(valist, nargs); - res = sql_create_func_(sa, name, mod, imp, F_ANALYTIC, TRUE, private, fix_scale, 0, fres, nargs, valist); + res = sql_create_func_(sa, name, mod, imp, F_ANALYTIC, TRUE, private, SCALE_NONE, 0, fres, nargs, valist); va_end(valist); return res; } @@ -1199,141 +1199,141 @@ sqltypeinit( sql_allocator *sa) sql_create_aggr(sa, "listagg", "aggr", "str_group_concat", TRUE, FALSE, STR, 2, STR, STR); /* order based operators */ - sql_create_analytic(sa, "diff", "sql", "diff", TRUE, SCALE_NONE, BIT, 1, ANY); - sql_create_analytic(sa, "diff", "sql", "diff", TRUE, SCALE_NONE, BIT, 2, BIT, ANY); + sql_create_analytic(sa, "diff", "sql", "diff", TRUE, BIT, 1, ANY); + sql_create_analytic(sa, "diff", "sql", "diff", TRUE, BIT, 2, BIT, ANY); for (t = numerical; *t != TME; t++) { if (*t == OID) continue; - sql_create_analytic(sa, "window_bound", "sql", "window_bound", TRUE, SCALE_NONE, OID, 5, ANY, INT, INT, INT, *t); - sql_create_analytic(sa, "window_bound", "sql", "window_bound", TRUE, SCALE_NONE, OID, 6, BIT, ANY, INT, INT, INT, *t); + sql_create_analytic(sa, "window_bound", "sql", "window_bound", TRUE, OID, 5, ANY, INT, INT, INT, *t); + sql_create_analytic(sa, "window_bound", "sql", "window_bound", TRUE, OID, 6, BIT, ANY, INT, INT, INT, *t); } - sql_create_analytic(sa, "rank", "sql", "rank", FALSE, SCALE_NONE, INT, 1, ANY); - sql_create_analytic(sa, "dense_rank", "sql", "dense_rank", FALSE, SCALE_NONE, INT, 1, ANY); - sql_create_analytic(sa, "row_number", "sql", "row_number", FALSE, SCALE_NONE, INT, 1, ANY); - sql_create_analytic(sa, "percent_rank", "sql", "percent_rank", FALSE, SCALE_NONE, DBL, 1, ANY); - sql_create_analytic(sa, "cume_dist", "sql", "cume_dist", FALSE, SCALE_NONE, DBL, 1, ANY); + sql_create_analytic(sa, "rank", "sql", "rank", FALSE, INT, 1, ANY); + sql_create_analytic(sa, "dense_rank", "sql", "dense_rank", FALSE, INT, 1, ANY); + sql_create_analytic(sa, "row_number", "sql", "row_number", FALSE, INT, 1, ANY); + sql_create_analytic(sa, "percent_rank", "sql", "percent_rank", FALSE, DBL, 1, ANY); + sql_create_analytic(sa, "cume_dist", "sql", "cume_dist", FALSE, DBL, 1, ANY); - sql_create_analytic(sa, "ntile", "sql", "ntile", FALSE, SCALE_NONE, BTE, 2, ANY, BTE); - sql_create_analytic(sa, "ntile", "sql", "ntile", FALSE, SCALE_NONE, SHT, 2, ANY, SHT); - sql_create_analytic(sa, "ntile", "sql", "ntile", FALSE, SCALE_NONE, INT, 2, ANY, INT); - sql_create_analytic(sa, "ntile", "sql", "ntile", FALSE, SCALE_NONE, LNG, 2, ANY, LNG); + sql_create_analytic(sa, "ntile", "sql", "ntile", FALSE, BTE, 2, ANY, BTE); + sql_create_analytic(sa, "ntile", "sql", "ntile", FALSE, SHT, 2, ANY, SHT); + sql_create_analytic(sa, "ntile", "sql", "ntile", FALSE, INT, 2, ANY, INT); + sql_create_analytic(sa, "ntile", "sql", "ntile", FALSE, LNG, 2, ANY, LNG); #ifdef HAVE_HGE - sql_create_analytic(sa, "ntile", "sql", "ntile", FALSE, SCALE_NONE, HGE, 2, ANY, HGE); + sql_create_analytic(sa, "ntile", "sql", "ntile", FALSE, HGE, 2, ANY, HGE); #endif - sql_create_analytic(sa, "lag", "sql", "lag", FALSE, SCALE_NONE, ANY, 1, ANY); - sql_create_analytic(sa, "lag", "sql", "lag", FALSE, SCALE_NONE, ANY, 2, ANY, BTE); - sql_create_analytic(sa, "lag", "sql", "lag", FALSE, SCALE_NONE, ANY, 2, ANY, SHT); - sql_create_analytic(sa, "lag", "sql", "lag", FALSE, SCALE_NONE, ANY, 2, ANY, INT); - sql_create_analytic(sa, "lag", "sql", "lag", FALSE, SCALE_NONE, ANY, 2, ANY, LNG); + sql_create_analytic(sa, "lag", "sql", "lag", FALSE, ANY, 1, ANY); + sql_create_analytic(sa, "lag", "sql", "lag", FALSE, ANY, 2, ANY, BTE); + sql_create_analytic(sa, "lag", "sql", "lag", FALSE, ANY, 2, ANY, SHT); + sql_create_analytic(sa, "lag", "sql", "lag", FALSE, ANY, 2, ANY, INT); + sql_create_analytic(sa, "lag", "sql", "lag", FALSE, ANY, 2, ANY, LNG); #ifde
MonetDB: geos-reentrant - New function MT_thread_init_add_callba...
Changeset: 5dd2fb712612 for MonetDB URL: https://dev.monetdb.org/hg/MonetDB/rev/5dd2fb712612 Modified Files: clients/Tests/exports.stable.out gdk/gdk_system.c gdk/gdk_system.h Branch: geos-reentrant Log Message: New function MT_thread_init_add_callback to register callbacks. The callbacks are called at thread creation and destruction by the thread itself. diffs (148 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 @@ -385,6 +385,7 @@ const char *MT_thread_getalgorithm(void) void *MT_thread_getdata(void); const char *MT_thread_getname(void); bool MT_thread_init(void); +gdk_return MT_thread_init_add_callback(void (*init)(void *), void (*destroy)(void *), void *data); bool MT_thread_register(void); void MT_thread_set_qry_ctx(QryCtx *ctx); void MT_thread_setalgorithm(const char *algo); diff --git a/gdk/gdk_system.c b/gdk/gdk_system.c --- a/gdk/gdk_system.c +++ b/gdk/gdk_system.c @@ -184,10 +184,18 @@ GDKlockstatistics(int what) #endif /* LOCK_STATS */ +struct thread_funcs { + void (*init)(void *); + void (*destroy)(void *); + void *data; +}; + static struct mtthread { struct mtthread *next; void (*func) (void *); /* function to be called */ void *data; /* and its data */ + struct thread_funcs *thread_funcs; /* callback funcs */ + int nthread_funcs; MT_Lock *lockwait; /* lock we're waiting for */ MT_Sema *semawait; /* semaphore we're waiting for */ MT_Cond *condwait; /* condition variable we're waiting for */ @@ -686,6 +694,36 @@ MT_thread_override_limits(void) return self && self->limit_override; } +static struct thread_init_cb { + struct thread_init_cb *next; + void (*init)(void *); + void (*destroy)(void *); + void *data; +} *init_cb; +static MT_Lock thread_init_lock = MT_LOCK_INITIALIZER(thread_init_lock); + +gdk_return +MT_thread_init_add_callback(void (*init)(void *), void (*destroy)(void *), void *data) +{ + struct thread_init_cb *p = GDKmalloc(sizeof(struct thread_init_cb)); + + if (p == NULL) + return GDK_FAIL; + *p = (struct thread_init_cb) { + .init = init, + .destroy = destroy, + .next = NULL, + .data = data, + }; + MT_lock_set(&thread_init_lock); + struct thread_init_cb **pp = &init_cb; + while (*pp) + pp = &(*pp)->next; + *pp = p; + MT_lock_unset(&thread_init_lock); + return GDK_SUCCEED; +} + #ifdef HAVE_PTHREAD_H static void * #else @@ -719,7 +757,16 @@ thread_starter(void *arg) self->data = NULL; self->sp = THRsp(); thread_setself(self); + for (int i = 0; i < self->nthread_funcs; i++) { + if (self->thread_funcs[i].init) + (*self->thread_funcs[i].init)(self->thread_funcs[i].data); + } (*self->func)(data); + for (int i = 0; i < self->nthread_funcs; i++) { + if (self->thread_funcs[i].destroy) + (*self->thread_funcs[i].destroy)(self->thread_funcs[i].data); + } + free(self->thread_funcs); ATOMIC_SET(&self->exited, 1); TRC_DEBUG(THRD, "Exit thread \"%s\"\n", self->threadname); return 0; /* NULL for pthreads, 0 for Windows */ @@ -843,6 +890,33 @@ MT_create_thread(MT_Id *t, void (*f) (vo .refs = 1, .tid = mtid, }; + MT_lock_set(&thread_init_lock); + /* remember the list of callback functions we need to call for +* this thread (i.e. anything registered so far) */ + for (struct thread_init_cb *p = init_cb; p; p = p->next) + self->nthread_funcs++; + if (self->nthread_funcs > 0) { + self->thread_funcs = malloc(self->nthread_funcs * sizeof(*self->thread_funcs)); + if (self->thread_funcs == NULL) { + GDKsyserror("Cannot allocate memory\n"); + MT_lock_unset(&thread_init_lock); + free(self); +#ifdef HAVE_PTHREAD_H + pthread_attr_destroy(&attr); +#endif + return -1; + } + int n = 0; + for (struct thread_init_cb *p = init_cb; p; p = p->next) { + self->thread_funcs[n++] = (struct thread_funcs) { + .init = p->init, + .destroy = p->destroy, + .data = p->data, + }; + } + } + MT_lock_unset(&thread_init_lock); + ATOMIC_INIT(&self->exited, 0); strcpy_len(self->threadname, threadname, sizeof(self->threadname)); char *p; @@ -869,6 +943,7 @@ MT_create_thread(MT_Id *t, vo
MonetDB: geos-reentrant - use a per thread geom library context
Changeset: e1e3417ef50d for MonetDB URL: https://dev.monetdb.org/hg/MonetDB/rev/e1e3417ef50d Modified Files: geom/lib/libgeom.c geom/lib/libgeom.h geom/monetdb5/geom.c Branch: geos-reentrant Log Message: use a per thread geom library context diffs (133 lines): diff --git a/geom/lib/libgeom.c b/geom/lib/libgeom.c --- a/geom/lib/libgeom.c +++ b/geom/lib/libgeom.c @@ -20,8 +20,6 @@ #include "monetdb_config.h" #include "libgeom.h" -GEOSContextHandle_t geoshandle; - static void __attribute__((__format__(__printf__, 1, 2))) geomerror(_In_z_ _Printf_format_string_ const char *fmt, ...) { @@ -34,23 +32,44 @@ geomerror(_In_z_ _Printf_format_string_ va_end(va); } -void +static MT_TLS_t geom_tls_key; + +static void +libgeom_tls_init(void *dummy) +{ + (void)dummy; + GEOSContextHandle_t ctx = GEOS_init_r (); +GEOSContext_setNoticeHandler_r(ctx, (GEOSMessageHandler) geomerror); +GEOSContext_setErrorHandler_r(ctx, (GEOSMessageHandler) geomerror); + GEOS_setWKBByteOrder_r(ctx, 1); /* NDR (little endian) */ + MT_tls_set(geom_tls_key, ctx); +} + +static void +libgeom_tls_exit(void *dummy) +{ + (void)dummy; + GEOSContextHandle_t ctx = MT_tls_get(geom_tls_key); + GEOS_finish_r(ctx); +} + +GEOSContextHandle_t +libgeom_tls(void) +{ + return MT_tls_get(geom_tls_key); +} + +gdk_return libgeom_init(void) { - //geoshandle = initGEOS_r((GEOSMessageHandler) geomerror, (GEOSMessageHandler) geomerror); - geoshandle = GEOS_init_r (); -GEOSContext_setNoticeHandler_r(geoshandle, (GEOSMessageHandler) geomerror); -GEOSContext_setErrorHandler_r(geoshandle, (GEOSMessageHandler) geomerror); + if (MT_alloc_tls(&geom_tls_key) != GDK_SUCCEED || + MT_thread_init_add_callback(libgeom_tls_init, libgeom_tls_exit, NULL) != GDK_SUCCEED) + return GDK_FAIL; + // TODO: deprecated call REMOVE - GEOS_setWKBByteOrder_r(geoshandle, 1); /* NDR (little endian) */ printf("# MonetDB/GIS module loaded\n"); fflush(stdout); /* make merovingian see this *now* */ -} - -void -libgeom_exit(void) -{ - GEOS_finish_r(geoshandle); + return GDK_SUCCEED; } bool diff --git a/geom/lib/libgeom.h b/geom/lib/libgeom.h --- a/geom/lib/libgeom.h +++ b/geom/lib/libgeom.h @@ -36,8 +36,6 @@ #include #endif -/* TODO make this per thread */ -extern GEOSContextHandle_t geoshandle; /* geos does not support 3d envelope */ typedef struct mbr { @@ -100,6 +98,9 @@ 11 = MULTIPOLYGON */ +libgeom_export GEOSContextHandle_t libgeom_tls(void); +#define geoshandle (libgeom_tls()) + typedef enum wkb_type { // TODO: deprecatedtype REMOVE //wkbGeometry_mbd = 0, @@ -133,8 +134,7 @@ typedef struct { wkb wkb; } geom_geometry; -libgeom_export void libgeom_init(void); -libgeom_export void libgeom_exit(void); +libgeom_export gdk_return libgeom_init(void); #define mbr_nil mbrFromGeos(NULL); diff --git a/geom/monetdb5/geom.c b/geom/monetdb5/geom.c --- a/geom/monetdb5/geom.c +++ b/geom/monetdb5/geom.c @@ -2347,18 +2347,9 @@ geom_prelude(void) mbrNIL.xmax = flt_nil; mbrNIL.ymin = flt_nil; mbrNIL.ymax = flt_nil; - libgeom_init(); + if (libgeom_init() != GDK_SUCCEED) + throw(MAL, "geom.prelude", SQLSTATE(HY013) MAL_MALLOC_FAIL); TYPE_mbr = malAtomSize(sizeof(mbr), "mbr"); - - return MAL_SUCCEED; -} - -/* clean geos */ -str -geom_epilogue(void *ret) -{ - (void) ret; - libgeom_exit(); return MAL_SUCCEED; } @@ -5780,7 +5771,6 @@ static mel_func geom_init_funcs[] = { command("geom", "mbrDistance", mbrDistance, false, "Returns the distance of the centroids of the two boxes", args(1,3, arg("",dbl),arg("box1",mbr),arg("box2",mbr))), command("geom", "coordinateFromWKB", wkbCoordinateFromWKB, false, "returns xmin (=1), ymin (=2), xmax (=3) or ymax(=4) of the provided geometry", args(1,3, arg("",dbl),arg("",wkb),arg("",int))), command("geom", "coordinateFromMBR", wkbCoordinateFromMBR, false, "returns xmin (=1), ymin (=2), xmax (=3) or ymax(=4) of the provided mbr", args(1,3, arg("",dbl),arg("",mbr),arg("",int))), - command("geom", "epilogue", geom_epilogue, false, "", args(1,1, arg("",void))), command("batgeom", "FromText", wkbFromText_bat, false, "", args(1,4, batarg("",wkb),batarg("wkt",str),arg("srid",int),arg("type",int))), command("batgeom", "ToText", wkbAsText_bat, false, "", args(1,3, batarg("",str),batarg("w",wkb),arg("withSRID",int))), command("batgeom", "GeometryType", wkbGeometryType_bat, false, "", args(1,3, batarg("",str),batarg("w",wkb),arg("flag",int))), ___ checkin-list mailing list -- checkin-list@monetdb.org To unsubscribe send an email to checkin-list-le...@monetdb.org
MonetDB: geos-reentrant - geom.epiloqu is gone
Changeset: 18e96de41894 for MonetDB URL: https://dev.monetdb.org/hg/MonetDB/rev/18e96de41894 Modified Files: clients/Tests/MAL-signatures-hge.test clients/Tests/MAL-signatures.test Branch: geos-reentrant Log Message: geom.epiloqu is gone diffs (30 lines): diff --git a/clients/Tests/MAL-signatures-hge.test b/clients/Tests/MAL-signatures-hge.test --- a/clients/Tests/MAL-signatures-hge.test +++ b/clients/Tests/MAL-signatures-hge.test @@ -46229,11 +46229,6 @@ command geom.coordinateFromWKB(X_0:wkb, wkbCoordinateFromWKB; returns xmin (=1), ymin (=2), xmax (=3) or ymax(=4) of the provided geometry geom -epilogue -command geom.epilogue():void -geom_epilogue; -(empty) -geom getSRID command geom.getSRID(X_0:wkb):int wkbGetSRID; diff --git a/clients/Tests/MAL-signatures.test b/clients/Tests/MAL-signatures.test --- a/clients/Tests/MAL-signatures.test +++ b/clients/Tests/MAL-signatures.test @@ -34679,11 +34679,6 @@ command geom.coordinateFromWKB(X_0:wkb, wkbCoordinateFromWKB; returns xmin (=1), ymin (=2), xmax (=3) or ymax(=4) of the provided geometry geom -epilogue -command geom.epilogue():void -geom_epilogue; -(empty) -geom getSRID command geom.getSRID(X_0:wkb):int wkbGetSRID; ___ checkin-list mailing list -- checkin-list@monetdb.org To unsubscribe send an email to checkin-list-le...@monetdb.org
MonetDB: client_interrupts - No declaration after label.
Changeset: abf696422135 for MonetDB URL: https://dev.monetdb.org/hg/MonetDB/rev/abf696422135 Modified Files: clients/mapiclient/mclient.c Branch: client_interrupts Log Message: No declaration after label. diffs (14 lines): diff --git a/clients/mapiclient/mclient.c b/clients/mapiclient/mclient.c --- a/clients/mapiclient/mclient.c +++ b/clients/mapiclient/mclient.c @@ -2391,8 +2391,9 @@ doFile(Mapi mid, stream *fp, bool useins } do { + bool seen_null_byte; repeat: - bool seen_null_byte = false; + seen_null_byte = false; if (prompt) { char *p = hdl ? "more>" : prompt; ___ checkin-list mailing list -- checkin-list@monetdb.org To unsubscribe send an email to checkin-list-le...@monetdb.org
MonetDB: geos-reentrant - restored epilogue (keep api stable)
Changeset: 3bd9cd0c28db for MonetDB URL: https://dev.monetdb.org/hg/MonetDB/rev/3bd9cd0c28db Modified Files: clients/Tests/MAL-signatures-hge.test clients/Tests/MAL-signatures.test geom/monetdb5/geom.c geom/monetdb5/geom.h Branch: geos-reentrant Log Message: restored epilogue (keep api stable) diffs (67 lines): diff --git a/clients/Tests/MAL-signatures-hge.test b/clients/Tests/MAL-signatures-hge.test --- a/clients/Tests/MAL-signatures-hge.test +++ b/clients/Tests/MAL-signatures-hge.test @@ -46229,6 +46229,11 @@ command geom.coordinateFromWKB(X_0:wkb, wkbCoordinateFromWKB; returns xmin (=1), ymin (=2), xmax (=3) or ymax(=4) of the provided geometry geom +epilogue +command geom.epilogue():void +geom_epilogue; +(empty) +geom getSRID command geom.getSRID(X_0:wkb):int wkbGetSRID; diff --git a/clients/Tests/MAL-signatures.test b/clients/Tests/MAL-signatures.test --- a/clients/Tests/MAL-signatures.test +++ b/clients/Tests/MAL-signatures.test @@ -34679,6 +34679,11 @@ command geom.coordinateFromWKB(X_0:wkb, wkbCoordinateFromWKB; returns xmin (=1), ymin (=2), xmax (=3) or ymax(=4) of the provided geometry geom +epilogue +command geom.epilogue():void +geom_epilogue; +(empty) +geom getSRID command geom.getSRID(X_0:wkb):int wkbGetSRID; diff --git a/geom/monetdb5/geom.c b/geom/monetdb5/geom.c --- a/geom/monetdb5/geom.c +++ b/geom/monetdb5/geom.c @@ -2353,6 +2353,13 @@ geom_prelude(void) return MAL_SUCCEED; } +static str +geom_epilogue(void *ret) +{ + (void) ret; + return MAL_SUCCEED; +} + /* create the WKB out of the GEOSGeometry * It makes sure to make all checks before returning * the input geosGeometry should not be altered by this function @@ -5771,6 +5778,7 @@ static mel_func geom_init_funcs[] = { command("geom", "mbrDistance", mbrDistance, false, "Returns the distance of the centroids of the two boxes", args(1,3, arg("",dbl),arg("box1",mbr),arg("box2",mbr))), command("geom", "coordinateFromWKB", wkbCoordinateFromWKB, false, "returns xmin (=1), ymin (=2), xmax (=3) or ymax(=4) of the provided geometry", args(1,3, arg("",dbl),arg("",wkb),arg("",int))), command("geom", "coordinateFromMBR", wkbCoordinateFromMBR, false, "returns xmin (=1), ymin (=2), xmax (=3) or ymax(=4) of the provided mbr", args(1,3, arg("",dbl),arg("",mbr),arg("",int))), + command("geom", "epilogue", geom_epilogue, false, "", args(1,1, arg("",void))), command("batgeom", "FromText", wkbFromText_bat, false, "", args(1,4, batarg("",wkb),batarg("wkt",str),arg("srid",int),arg("type",int))), command("batgeom", "ToText", wkbAsText_bat, false, "", args(1,3, batarg("",str),batarg("w",wkb),arg("withSRID",int))), command("batgeom", "GeometryType", wkbGeometryType_bat, false, "", args(1,3, batarg("",str),batarg("w",wkb),arg("flag",int))), diff --git a/geom/monetdb5/geom.h b/geom/monetdb5/geom.h --- a/geom/monetdb5/geom.h +++ b/geom/monetdb5/geom.h @@ -43,8 +43,6 @@ geom_export str geoHasZ(int* res, int* i geom_export str geoHasM(int* res, int* info); geom_export str geoGetType(char** res, int* info, int* flag); -geom_export str geom_epilogue(void *ret); - /* functions that are used when a column is added to an existing table */ geom_export str mbrFromMBR(mbr **w, mbr **src); geom_export str wkbFromWKB(wkb **w, wkb **src); ___ checkin-list mailing list -- checkin-list@monetdb.org To unsubscribe send an email to checkin-list-le...@monetdb.org
MonetDB: geos-reentrant - cleanup indent and comment
Changeset: 8c136cd1ba3d for MonetDB URL: https://dev.monetdb.org/hg/MonetDB/rev/8c136cd1ba3d Modified Files: geom/lib/libgeom.c Branch: geos-reentrant Log Message: cleanup indent and comment diffs (22 lines): diff --git a/geom/lib/libgeom.c b/geom/lib/libgeom.c --- a/geom/lib/libgeom.c +++ b/geom/lib/libgeom.c @@ -39,8 +39,8 @@ libgeom_tls_init(void *dummy) { (void)dummy; GEOSContextHandle_t ctx = GEOS_init_r (); -GEOSContext_setNoticeHandler_r(ctx, (GEOSMessageHandler) geomerror); -GEOSContext_setErrorHandler_r(ctx, (GEOSMessageHandler) geomerror); + GEOSContext_setNoticeHandler_r(ctx, (GEOSMessageHandler) geomerror); + GEOSContext_setErrorHandler_r(ctx, (GEOSMessageHandler) geomerror); GEOS_setWKBByteOrder_r(ctx, 1); /* NDR (little endian) */ MT_tls_set(geom_tls_key, ctx); } @@ -66,7 +66,6 @@ libgeom_init(void) MT_thread_init_add_callback(libgeom_tls_init, libgeom_tls_exit, NULL) != GDK_SUCCEED) return GDK_FAIL; -// TODO: deprecated call REMOVE printf("# MonetDB/GIS module loaded\n"); fflush(stdout); /* make merovingian see this *now* */ return GDK_SUCCEED; ___ checkin-list mailing list -- checkin-list@monetdb.org To unsubscribe send an email to checkin-list-le...@monetdb.org
MonetDB: Dec2023 - Merge geos-reentrant branch into Dec2023: use...
Changeset: bf2eda8dcd71 for MonetDB URL: https://dev.monetdb.org/hg/MonetDB/rev/bf2eda8dcd71 Branch: Dec2023 Log Message: Merge geos-reentrant branch into Dec2023: use reentrant interfaces of geos library. diffs (truncated from 4088 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 @@ -385,6 +385,7 @@ const char *MT_thread_getalgorithm(void) void *MT_thread_getdata(void); const char *MT_thread_getname(void); bool MT_thread_init(void); +gdk_return MT_thread_init_add_callback(void (*init)(void *), void (*destroy)(void *), void *data); bool MT_thread_register(void); void MT_thread_set_qry_ctx(QryCtx *ctx); void MT_thread_setalgorithm(const char *algo); diff --git a/gdk/gdk_system.c b/gdk/gdk_system.c --- a/gdk/gdk_system.c +++ b/gdk/gdk_system.c @@ -184,10 +184,18 @@ GDKlockstatistics(int what) #endif /* LOCK_STATS */ +struct thread_funcs { + void (*init)(void *); + void (*destroy)(void *); + void *data; +}; + static struct mtthread { struct mtthread *next; void (*func) (void *); /* function to be called */ void *data; /* and its data */ + struct thread_funcs *thread_funcs; /* callback funcs */ + int nthread_funcs; MT_Lock *lockwait; /* lock we're waiting for */ MT_Sema *semawait; /* semaphore we're waiting for */ MT_Cond *condwait; /* condition variable we're waiting for */ @@ -686,6 +694,36 @@ MT_thread_override_limits(void) return self && self->limit_override; } +static struct thread_init_cb { + struct thread_init_cb *next; + void (*init)(void *); + void (*destroy)(void *); + void *data; +} *init_cb; +static MT_Lock thread_init_lock = MT_LOCK_INITIALIZER(thread_init_lock); + +gdk_return +MT_thread_init_add_callback(void (*init)(void *), void (*destroy)(void *), void *data) +{ + struct thread_init_cb *p = GDKmalloc(sizeof(struct thread_init_cb)); + + if (p == NULL) + return GDK_FAIL; + *p = (struct thread_init_cb) { + .init = init, + .destroy = destroy, + .next = NULL, + .data = data, + }; + MT_lock_set(&thread_init_lock); + struct thread_init_cb **pp = &init_cb; + while (*pp) + pp = &(*pp)->next; + *pp = p; + MT_lock_unset(&thread_init_lock); + return GDK_SUCCEED; +} + #ifdef HAVE_PTHREAD_H static void * #else @@ -719,7 +757,16 @@ thread_starter(void *arg) self->data = NULL; self->sp = THRsp(); thread_setself(self); + for (int i = 0; i < self->nthread_funcs; i++) { + if (self->thread_funcs[i].init) + (*self->thread_funcs[i].init)(self->thread_funcs[i].data); + } (*self->func)(data); + for (int i = 0; i < self->nthread_funcs; i++) { + if (self->thread_funcs[i].destroy) + (*self->thread_funcs[i].destroy)(self->thread_funcs[i].data); + } + free(self->thread_funcs); ATOMIC_SET(&self->exited, 1); TRC_DEBUG(THRD, "Exit thread \"%s\"\n", self->threadname); return 0; /* NULL for pthreads, 0 for Windows */ @@ -843,6 +890,33 @@ MT_create_thread(MT_Id *t, void (*f) (vo .refs = 1, .tid = mtid, }; + MT_lock_set(&thread_init_lock); + /* remember the list of callback functions we need to call for +* this thread (i.e. anything registered so far) */ + for (struct thread_init_cb *p = init_cb; p; p = p->next) + self->nthread_funcs++; + if (self->nthread_funcs > 0) { + self->thread_funcs = malloc(self->nthread_funcs * sizeof(*self->thread_funcs)); + if (self->thread_funcs == NULL) { + GDKsyserror("Cannot allocate memory\n"); + MT_lock_unset(&thread_init_lock); + free(self); +#ifdef HAVE_PTHREAD_H + pthread_attr_destroy(&attr); +#endif + return -1; + } + int n = 0; + for (struct thread_init_cb *p = init_cb; p; p = p->next) { + self->thread_funcs[n++] = (struct thread_funcs) { + .init = p->init, + .destroy = p->destroy, + .data = p->data, + }; + } + } + MT_lock_unset(&thread_init_lock); + ATOMIC_INIT(&self->exited, 0); strcpy_len(self->threadname, threadname, sizeof(self->threadname)); char *p; @@ -869,6 +943,7 @@ MT_create_thread(MT_Id *t, void (*f) (vo #endif if (ret != 0) { GDKsyserr(ret, "Cannot start thread"); + free(self->thread_funcs);
MonetDB: geos-reentrant - Close branch geos-reentrant.
Changeset: 14f29e2fbf93 for MonetDB URL: https://dev.monetdb.org/hg/MonetDB/rev/14f29e2fbf93 Branch: geos-reentrant Log Message: Close branch geos-reentrant. ___ checkin-list mailing list -- checkin-list@monetdb.org To unsubscribe send an email to checkin-list-le...@monetdb.org
MonetDB: default - Merge with Dec2023 branch.
Changeset: a9c025ec7357 for MonetDB URL: https://dev.monetdb.org/hg/MonetDB/rev/a9c025ec7357 Modified Files: clients/Tests/MAL-signatures-hge.test clients/Tests/MAL-signatures.test Branch: default Log Message: Merge with Dec2023 branch. diffs (truncated from 4088 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 @@ -385,6 +385,7 @@ const char *MT_thread_getalgorithm(void) void *MT_thread_getdata(void); const char *MT_thread_getname(void); bool MT_thread_init(void); +gdk_return MT_thread_init_add_callback(void (*init)(void *), void (*destroy)(void *), void *data); bool MT_thread_register(void); void MT_thread_set_qry_ctx(QryCtx *ctx); void MT_thread_setalgorithm(const char *algo); diff --git a/gdk/gdk_system.c b/gdk/gdk_system.c --- a/gdk/gdk_system.c +++ b/gdk/gdk_system.c @@ -184,10 +184,18 @@ GDKlockstatistics(int what) #endif /* LOCK_STATS */ +struct thread_funcs { + void (*init)(void *); + void (*destroy)(void *); + void *data; +}; + static struct mtthread { struct mtthread *next; void (*func) (void *); /* function to be called */ void *data; /* and its data */ + struct thread_funcs *thread_funcs; /* callback funcs */ + int nthread_funcs; MT_Lock *lockwait; /* lock we're waiting for */ MT_Sema *semawait; /* semaphore we're waiting for */ MT_Cond *condwait; /* condition variable we're waiting for */ @@ -686,6 +694,36 @@ MT_thread_override_limits(void) return self && self->limit_override; } +static struct thread_init_cb { + struct thread_init_cb *next; + void (*init)(void *); + void (*destroy)(void *); + void *data; +} *init_cb; +static MT_Lock thread_init_lock = MT_LOCK_INITIALIZER(thread_init_lock); + +gdk_return +MT_thread_init_add_callback(void (*init)(void *), void (*destroy)(void *), void *data) +{ + struct thread_init_cb *p = GDKmalloc(sizeof(struct thread_init_cb)); + + if (p == NULL) + return GDK_FAIL; + *p = (struct thread_init_cb) { + .init = init, + .destroy = destroy, + .next = NULL, + .data = data, + }; + MT_lock_set(&thread_init_lock); + struct thread_init_cb **pp = &init_cb; + while (*pp) + pp = &(*pp)->next; + *pp = p; + MT_lock_unset(&thread_init_lock); + return GDK_SUCCEED; +} + #ifdef HAVE_PTHREAD_H static void * #else @@ -719,7 +757,16 @@ thread_starter(void *arg) self->data = NULL; self->sp = THRsp(); thread_setself(self); + for (int i = 0; i < self->nthread_funcs; i++) { + if (self->thread_funcs[i].init) + (*self->thread_funcs[i].init)(self->thread_funcs[i].data); + } (*self->func)(data); + for (int i = 0; i < self->nthread_funcs; i++) { + if (self->thread_funcs[i].destroy) + (*self->thread_funcs[i].destroy)(self->thread_funcs[i].data); + } + free(self->thread_funcs); ATOMIC_SET(&self->exited, 1); TRC_DEBUG(THRD, "Exit thread \"%s\"\n", self->threadname); return 0; /* NULL for pthreads, 0 for Windows */ @@ -843,6 +890,33 @@ MT_create_thread(MT_Id *t, void (*f) (vo .refs = 1, .tid = mtid, }; + MT_lock_set(&thread_init_lock); + /* remember the list of callback functions we need to call for +* this thread (i.e. anything registered so far) */ + for (struct thread_init_cb *p = init_cb; p; p = p->next) + self->nthread_funcs++; + if (self->nthread_funcs > 0) { + self->thread_funcs = malloc(self->nthread_funcs * sizeof(*self->thread_funcs)); + if (self->thread_funcs == NULL) { + GDKsyserror("Cannot allocate memory\n"); + MT_lock_unset(&thread_init_lock); + free(self); +#ifdef HAVE_PTHREAD_H + pthread_attr_destroy(&attr); +#endif + return -1; + } + int n = 0; + for (struct thread_init_cb *p = init_cb; p; p = p->next) { + self->thread_funcs[n++] = (struct thread_funcs) { + .init = p->init, + .destroy = p->destroy, + .data = p->data, + }; + } + } + MT_lock_unset(&thread_init_lock); + ATOMIC_INIT(&self->exited, 0); strcpy_len(self->threadname, threadname, sizeof(self->threadname)); char *p; @@ -869,6 +943,7 @@ MT_create_thread(MT_Id *t, void (*f) (vo #endif if (ret != 0) { GDKsyserr(ret, "Cannot start thread"); +
MonetDB: Dec2023 - added test for issue 7426.
Changeset: 49db804b82e9 for MonetDB URL: https://dev.monetdb.org/hg/MonetDB/rev/49db804b82e9 Added Files: sql/test/BugTracker-2024/Tests/All sql/test/BugTracker-2024/Tests/SingleServer sql/test/BugTracker-2024/Tests/inequality-hash-issue-7426.test Modified Files: sql/backends/monet5/rel_bin.c Branch: Dec2023 Log Message: added test for issue 7426. In case of anti select, don't use the hash index diffs (59 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 @@ -4333,7 +4333,7 @@ rel2bin_select(backend *be, sql_rel *rel sql_exp *e = en->data; prop *p; - if ((p=find_prop(e->p, PROP_HASHCOL)) != NULL) { + if ((p=find_prop(e->p, PROP_HASHCOL)) != NULL && !is_anti(e)) { sql_idx *i = p->value.pval; int oldvtop = be->mb->vtop, oldstop = be->mb->stop, oldvid = be->mb->vid; diff --git a/sql/test/BugTracker-2024/Tests/All b/sql/test/BugTracker-2024/Tests/All new file mode 100644 --- /dev/null +++ b/sql/test/BugTracker-2024/Tests/All @@ -0,0 +1,1 @@ +inequality-hash-issue-7426 diff --git a/sql/test/BugTracker-2024/Tests/SingleServer b/sql/test/BugTracker-2024/Tests/SingleServer new file mode 100644 diff --git a/sql/test/BugTracker-2024/Tests/inequality-hash-issue-7426.test b/sql/test/BugTracker-2024/Tests/inequality-hash-issue-7426.test new file mode 100644 --- /dev/null +++ b/sql/test/BugTracker-2024/Tests/inequality-hash-issue-7426.test @@ -0,0 +1,34 @@ + +statement ok +CREATE TABLE t1(c1 INTEGER) + +statement ok +CREATE TABLE t0(c0 BOOL, c1 INTEGER) + +statement ok +INSERT INTO t1 (c1) VALUES (0) + +statement ok +CREATE UNIQUE INDEX i0 ON t0(c1 , c0 ) + +statement ok +INSERT INTO t0 (c0, c1) VALUES (true, 0) + +query III +SELECT t0.c0, t0.c1, t1.c1 FROM t1 INNER JOIN t0 ON t0.c0 + +1 +0 +0 + +query I +SELECT (t0.c1) IS NOT NULL FROM t1 INNER JOIN t0 ON t0.c0 + +1 + +query III +SELECT t0.c0, t0.c1, t1.c1 FROM t1 INNER JOIN t0 ON t0.c0 WHERE (t0.c1) IS NOT NULL + +1 +0 +0 ___ checkin-list mailing list -- checkin-list@monetdb.org To unsubscribe send an email to checkin-list-le...@monetdb.org
MonetDB: Dec2023 - fixed bug 7425 and added test
Changeset: e8b2775129a6 for MonetDB URL: https://dev.monetdb.org/hg/MonetDB/rev/e8b2775129a6 Added Files: sql/test/BugTracker-2024/Tests/pkey-check-failed-7425.test Modified Files: sql/backends/monet5/rel_bin.c sql/test/BugTracker-2024/Tests/All Branch: Dec2023 Log Message: fixed bug 7425 and added test diffs (47 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 @@ -5143,6 +5143,7 @@ update_check_ukey(backend *be, stmt **up */ if (!isNew(k)) { stmt *nu_tids = stmt_tdiff(be, dels, u_tids, NULL); /* not updated ids */ + nu_tids = stmt_project(be, nu_tids, dels); list *lje = sa_list(sql->sa); list *rje = sa_list(sql->sa); @@ -5256,6 +5257,7 @@ update_check_ukey(backend *be, stmt **up /* s should be empty */ if (!isNew(k)) { stmt *nu_tids = stmt_tdiff(be, dels, u_tids, NULL); /* not updated ids */ + nu_tids = stmt_project(be, nu_tids, dels); assert (updates); h = updates[c->c->colnr]; diff --git a/sql/test/BugTracker-2024/Tests/All b/sql/test/BugTracker-2024/Tests/All --- a/sql/test/BugTracker-2024/Tests/All +++ b/sql/test/BugTracker-2024/Tests/All @@ -1,1 +1,2 @@ inequality-hash-issue-7426 +pkey-check-failed-7425 diff --git a/sql/test/BugTracker-2024/Tests/pkey-check-failed-7425.test b/sql/test/BugTracker-2024/Tests/pkey-check-failed-7425.test new file mode 100644 --- /dev/null +++ b/sql/test/BugTracker-2024/Tests/pkey-check-failed-7425.test @@ -0,0 +1,17 @@ +statement ok +create table ttt(id int primary key,k int NOT NULL DEFAULT '0') + +statement ok +insert into ttt values(1,3),(2,3),(3,3),(4,3),(5,3) + +statement ok +update ttt set k=k+1 where id=3 + +statement ok +delete from ttt where id=2 + +statement ok +update ttt set id = 3 where id = 3 + +statement ok +drop table ttt ___ checkin-list mailing list -- checkin-list@monetdb.org To unsubscribe send an email to checkin-list-le...@monetdb.org