Changeset: 80d5069801ca for MonetDB URL: http://dev.monetdb.org/hg/MonetDB?cmd=changeset;node=80d5069801ca Modified Files: clients/Tests/exports.stable.out clients/python/monetdb/sql/monetize.py gdk/gdk.h gdk/gdk_private.h gdk/gdk_qsort.c gdk/gdk_search.c gdk/gdk_setop.mx gdk/gdk_ssort.c gdk/gdk_ssort_impl.h monetdb5/extras/jaql/parser/jaql.l monetdb5/extras/mal_optimizer_template/opt_sql_append.c monetdb5/mal/Tests/tst1200.stable.out monetdb5/mal/Tests/tst1201.stable.out monetdb5/mal/Tests/tst1202.stable.out monetdb5/mal/Tests/tst1203.stable.out monetdb5/mal/Tests/tst1205.stable.out monetdb5/mal/Tests/tst850.stable.out monetdb5/mal/Tests/tst901b.mal monetdb5/mal/Tests/tst901b.stable.out monetdb5/mal/Tests/tst902.mal monetdb5/mal/Tests/tst902.stable.out monetdb5/mal/Tests/tst903.stable.out monetdb5/mal/Tests/tst904.stable.out monetdb5/mal/Tests/tst905.stable.out monetdb5/mal/Tests/tst907.stable.out monetdb5/mal/mal_profiler.c monetdb5/modules/kernel/algebra.mx monetdb5/modules/kernel/batmtime.mx monetdb5/modules/mal/Tests/modulechk.mal monetdb5/modules/mal/Tests/modulechk.stable.out monetdb5/modules/mal/pcre.c monetdb5/modules/mal/pcre.mal monetdb5/modules/mal/profiler.c monetdb5/optimizer/Tests/Mexample.stable.out monetdb5/optimizer/Tests/remap.stable.out monetdb5/optimizer/opt_multiplex.c sql/backends/monet5/sql.mx sql/server/sql_parser.h sql/server/sql_parser.y sql/server/sql_scan.c sql/test/Tests/trace.stable.out Branch: xid Log Message:
Merge with default branch. diffs (truncated from 4747 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 @@ -176,6 +176,7 @@ BAT *BATsubselect(BAT *b, BAT *s, const BAT *BATsunion(BAT *b, BAT *c); BAT *BATsunique(BAT *b); BAT *BATthetajoin(BAT *l, BAT *r, int mode, BUN estimate); +BAT *BATthetasubselect(BAT *b, BAT *s, const void *val, const char *op); int BATtopN(BAT *b, BUN topN); BAT *BATundo(BAT *b); BAT *BATuselect(BAT *b, const void *tl, const void *th); @@ -245,8 +246,8 @@ int GDKms(void); int GDKnr_threads; void GDKprotect(void); int GDKprotected; -void GDKqsort(void *h, void *t, void *base, size_t n, int hs, int ts, int tpe); -void GDKqsort_rev(void *h, void *t, void *base, size_t n, int hs, int ts, int tpe); +void GDKqsort(void *h, void *t, const void *base, size_t n, int hs, int ts, int tpe); +void GDKqsort_rev(void *h, void *t, const void *base, size_t n, int hs, int ts, int tpe); void *GDKrealloc(void *pold, size_t size); void GDKsetenv(str name, str value); ssize_t GDKstrFromStr(unsigned char *dst, const unsigned char *src, ssize_t len); @@ -746,6 +747,8 @@ str ALGtdiff(int *result, int *lid, int str ALGthetajoin(int *result, int *lid, int *rid, int *opc); str ALGthetajoinEstimate(int *result, int *lid, int *rid, int *opc, lng *estimate); str ALGthetaselect(int *result, int *bid, ptr low, str *op); +str ALGthetasubselect1(bat *result, bat *bid, const void *val, const char **op); +str ALGthetasubselect2(bat *result, bat *bid, bat *sid, const void *val, const char **op); str ALGthetauselect(int *result, int *bid, ptr value, str *op); str ALGthsort(int *result, int *lid); str ALGtintersect(int *result, int *lid, int *rid); @@ -1771,60 +1774,6 @@ void MSresetInstructions(MalBlkPtr mb, i void MSresetVariables(Client cntxt, MalBlkPtr mb, MalStkPtr glb, int start); void MSscheduleClient(str command, str challenge, bstream *fin, stream *fout); void MSserveClient(void *dummy); -str MTIMEaccum_date_EQ(int *ret, int *d, int *l, int *r); -str MTIMEaccum_date_EQ_cst(int *ret, int *r, int *l, date *cst); -str MTIMEaccum_date_GE(int *ret, int *d, int *l, int *r); -str MTIMEaccum_date_GE_cst(int *ret, int *r, int *l, date *cst); -str MTIMEaccum_date_GT(int *ret, int *d, int *l, int *r); -str MTIMEaccum_date_GT_cst(int *ret, int *r, int *l, date *cst); -str MTIMEaccum_date_LE(int *ret, int *d, int *l, int *r); -str MTIMEaccum_date_LE_cst(int *ret, int *r, int *l, date *cst); -str MTIMEaccum_date_LT(int *ret, int *d, int *l, int *r); -str MTIMEaccum_date_LT_cst(int *ret, int *r, int *l, date *cst); -str MTIMEaccum_date_NEQ(int *ret, int *d, int *l, int *r); -str MTIMEaccum_date_NEQ_cst(int *ret, int *r, int *l, date *cst); -str MTIMEaccum_date_cst_EQ(int *ret, int *r, date *cst, int *l); -str MTIMEaccum_date_cst_GE(int *ret, int *r, date *cst, int *l); -str MTIMEaccum_date_cst_GT(int *ret, int *r, date *cst, int *l); -str MTIMEaccum_date_cst_LE(int *ret, int *r, date *cst, int *l); -str MTIMEaccum_date_cst_LT(int *ret, int *r, date *cst, int *l); -str MTIMEaccum_date_cst_NEQ(int *ret, int *r, date *cst, int *l); -str MTIMEaccum_daytime_EQ(int *ret, int *d, int *l, int *r); -str MTIMEaccum_daytime_EQ_cst(int *ret, int *r, int *l, daytime *cst); -str MTIMEaccum_daytime_GE(int *ret, int *d, int *l, int *r); -str MTIMEaccum_daytime_GE_cst(int *ret, int *r, int *l, daytime *cst); -str MTIMEaccum_daytime_GT(int *ret, int *d, int *l, int *r); -str MTIMEaccum_daytime_GT_cst(int *ret, int *r, int *l, daytime *cst); -str MTIMEaccum_daytime_LE(int *ret, int *d, int *l, int *r); -str MTIMEaccum_daytime_LE_cst(int *ret, int *r, int *l, daytime *cst); -str MTIMEaccum_daytime_LT(int *ret, int *d, int *l, int *r); -str MTIMEaccum_daytime_LT_cst(int *ret, int *r, int *l, daytime *cst); -str MTIMEaccum_daytime_NEQ(int *ret, int *d, int *l, int *r); -str MTIMEaccum_daytime_NEQ_cst(int *ret, int *r, int *l, daytime *cst); -str MTIMEaccum_daytime_cst_EQ(int *ret, int *r, daytime *cst, int *l); -str MTIMEaccum_daytime_cst_GE(int *ret, int *r, daytime *cst, int *l); -str MTIMEaccum_daytime_cst_GT(int *ret, int *r, daytime *cst, int *l); -str MTIMEaccum_daytime_cst_LE(int *ret, int *r, daytime *cst, int *l); -str MTIMEaccum_daytime_cst_LT(int *ret, int *r, daytime *cst, int *l); -str MTIMEaccum_daytime_cst_NEQ(int *ret, int *r, daytime *cst, int *l); -str MTIMEaccum_timestamp_EQ(int *ret, int *d, int *l, int *r); -str MTIMEaccum_timestamp_EQ_cst(int *ret, int *r, int *l, timestamp *cst); -str MTIMEaccum_timestamp_GE(int *ret, int *d, int *l, int *r); -str MTIMEaccum_timestamp_GE_cst(int *ret, int *r, int *l, timestamp *cst); -str MTIMEaccum_timestamp_GT(int *ret, int *d, int *l, int *r); -str MTIMEaccum_timestamp_GT_cst(int *ret, int *r, int *l, timestamp *cst); -str MTIMEaccum_timestamp_LE(int *ret, int *d, int *l, int *r); -str MTIMEaccum_timestamp_LE_cst(int *ret, int *r, int *l, timestamp *cst); -str MTIMEaccum_timestamp_LT(int *ret, int *d, int *l, int *r); -str MTIMEaccum_timestamp_LT_cst(int *ret, int *r, int *l, timestamp *cst); -str MTIMEaccum_timestamp_NEQ(int *ret, int *d, int *l, int *r); -str MTIMEaccum_timestamp_NEQ_cst(int *ret, int *r, int *l, timestamp *cst); -str MTIMEaccum_timestamp_cst_EQ(int *ret, int *r, timestamp *cst, int *l); -str MTIMEaccum_timestamp_cst_GE(int *ret, int *r, timestamp *cst, int *l); -str MTIMEaccum_timestamp_cst_GT(int *ret, int *r, timestamp *cst, int *l); -str MTIMEaccum_timestamp_cst_LE(int *ret, int *r, timestamp *cst, int *l); -str MTIMEaccum_timestamp_cst_LT(int *ret, int *r, timestamp *cst, int *l); -str MTIMEaccum_timestamp_cst_NEQ(int *ret, int *r, timestamp *cst, int *l); str MTIMEbat_date_EQ(int *ret, int *l, int *r); str MTIMEbat_date_EQ_cst(int *ret, int *l, date *cst); str MTIMEbat_date_GE(int *ret, int *l, int *r); @@ -2109,6 +2058,8 @@ str PCRElike3(bit *ret, str *s, str *pat str PCRElike_join_pcre(int *ret, int *b, int *pat, str *esc); str PCRElike_select_pcre(int *ret, int *b, str *pat, str *esc); str PCRElike_uselect_pcre(int *ret, int *b, str *pat, str *esc); +str PCRElikesubselect1(bat *ret, bat *bid, str *pat, str *esc, bit *caseignore, bit *anti); +str PCRElikesubselect2(bat *ret, bat *bid, bat *sid, str *pat, str *esc, bit *caseignore, bit *anti); str PCREmatch(bit *ret, str *val, str *pat); str PCREnotilike2(bit *ret, str *s, str *pat); str PCREnotilike3(bit *ret, str *s, str *pat, str *esc); diff --git a/clients/python/monetdb/sql/monetize.py b/clients/python/monetdb/sql/monetize.py --- a/clients/python/monetdb/sql/monetize.py +++ b/clients/python/monetdb/sql/monetize.py @@ -22,6 +22,7 @@ functions for converting python objects import datetime import decimal +from monetdb.exceptions import ProgrammingError def monet_none(data): """ @@ -76,4 +77,9 @@ def convert(data): try: return mapping[type(data)](data) except KeyError: - raise ProgrammingError("type %s not supported as value" % type(data)) \ No newline at end of file + if hasattr(data, '__unicode__'): + return unicode(data).encode('utf-8') + elif hasattr(data, '__str__'): + return str(data) + else: + raise ProgrammingError("type %s not supported as value" % type(data)) \ No newline at end of file diff --git a/gdk/gdk.h b/gdk/gdk.h --- a/gdk/gdk.h +++ b/gdk/gdk.h @@ -1684,8 +1684,8 @@ gdk_export int BATordered_rev(BAT *b); gdk_export BAT *BATssort(BAT *b); gdk_export BAT *BATssort_rev(BAT *b); -gdk_export void GDKqsort(void *h, void *t, void *base, size_t n, int hs, int ts, int tpe); -gdk_export void GDKqsort_rev(void *h, void *t, void *base, size_t n, int hs, int ts, int tpe); +gdk_export void GDKqsort(void *h, void *t, const void *base, size_t n, int hs, int ts, int tpe); +gdk_export void GDKqsort_rev(void *h, void *t, const void *base, size_t n, int hs, int ts, int tpe); #define BAThordered(b) ((b)->htype == TYPE_void || (b)->hsorted) #define BATtordered(b) ((b)->ttype == TYPE_void || (b)->tsorted) diff --git a/gdk/gdk_private.h b/gdk/gdk_private.h --- a/gdk/gdk_private.h +++ b/gdk/gdk_private.h @@ -69,8 +69,8 @@ int GDKmunmap(void *addr, size_t len); void *GDKreallocmax(void *pold, size_t size, size_t *maxsize, int emergency); int GDKremovedir(const char *nme); int GDKsave(const char *nme, const char *ext, void *buf, size_t size, storage_t mode); -int GDKssort_rev(void *h, void *t, void *base, size_t n, int hs, int ts, int tpe); -int GDKssort(void *h, void *t, void *base, size_t n, int hs, int ts, int tpe); +int GDKssort_rev(void *h, void *t, const void *base, size_t n, int hs, int ts, int tpe); +int GDKssort(void *h, void *t, const void *base, size_t n, int hs, int ts, int tpe); int GDKunlink(const char *dir, const char *nme, const char *extension); int HASHgonebad(BAT *b, const void *v); BUN HASHmask(BUN cnt); diff --git a/gdk/gdk_qsort.c b/gdk/gdk_qsort.c --- a/gdk/gdk_qsort.c +++ b/gdk/gdk_qsort.c @@ -25,7 +25,7 @@ struct qsort_t { unsigned int hs; unsigned int ts; int (*cmp)(const void *, const void *); - char *base; + const char *base; }; /* return index of middle value at indexes a, b, and c */ @@ -293,7 +293,7 @@ struct qsort_t { /* the interface functions */ void -GDKqsort(void *h, void *t, void *base, size_t n, int hs, int ts, int tpe) +GDKqsort(void *h, void *t, const void *base, size_t n, int hs, int ts, int tpe) { struct qsort_t buf; @@ -340,7 +340,7 @@ GDKqsort(void *h, void *t, void *base, s } void -GDKqsort_rev(void *h, void *t, void *base, size_t n, int hs, int ts, int tpe) +GDKqsort_rev(void *h, void *t, const void *base, size_t n, int hs, int ts, int tpe) { struct qsort_t buf; diff --git a/gdk/gdk_search.c b/gdk/gdk_search.c --- a/gdk/gdk_search.c +++ b/gdk/gdk_search.c @@ -459,6 +459,18 @@ SORTfndwhich(BAT *b, const void *v, int if (b == NULL || (!b->tsorted && !b->trevsorted)) return BUN_NONE; + if (BATtdense(b)) { + /* no need for binary search on dense column */ + if (* (const oid *) v < b->tseqbase) + return which == 0 ? BUN_NONE : lo; + if (* (const oid *) v >= b->tseqbase + BATcount(b)) + return which == 0 ? BUN_NONE : hi; + cur = (BUN) (* (const oid *) v - b->tseqbase) + lo; + if (which > 0) + cur++; + return cur; + } + if (which < 0) { end = lo; if (lo >= hi || (b->tsorted ? atom_GE(BUNtail(bi, lo), v, b->ttype) : atom_LE(BUNtail(bi, lo), v, b->ttype))) { diff --git a/gdk/gdk_setop.mx b/gdk/gdk_setop.mx --- a/gdk/gdk_setop.mx +++ b/gdk/gdk_setop.mx @@ -43,23 +43,28 @@ All Rights Reserved. * @item [s,k]intersection * produce bat intersection. * @end itemize - * Implementations typically take two forms: if the input relation(s) is/are - * ordered, a merge-algorithm is used. Otherwise, hash-indices are produced - * on demand for the hash-based versions. * - * The @emph{[k,s]intersect(l,r)} operations result in all BUNs of @emph{l} that - * are also in @emph{r}. They do not do double-elimination over the @emph{l} BUNs. + * Implementations typically take two forms: if the input relation(s) + * is/are ordered, a merge-algorithm is used. Otherwise, hash-indices + * are produced on demand for the hash-based versions. * - * The @emph{[k,s]diff(l,r)} operations result in all BUNs of @emph{l} that are - * not in @emph{r}. They do not do double-elimination over the @emph{l} BUNs. + * The @emph{[k,s]intersect(l,r)} operations result in all BUNs of + * @emph{l} that are also in @emph{r}. They do not do + * double-elimination over the @emph{l} BUNs. * - * The @emph{[k,s]union(l,r)} operations result in all BUNs of @emph{l}, plus - * all BUNs of @emph{r} that are not in @emph{l}. They do not do double-elimination - * over the @emph{l} nor @emph{r} BUNs. + * The @emph{[k,s]diff(l,r)} operations result in all BUNs of @emph{l} + * that are not in @emph{r}. They do not do double-elimination over + * the @emph{l} BUNs. * - * Operations with double-elimination can be formed by performing @emph{[k,s]unique(l)} on their operands. + * The @emph{[k,s]union(l,r)} operations result in all BUNs of + * @emph{l}, plus all BUNs of @emph{r} that are not in @emph{l}. They + * do not do double-elimination over the @emph{l} nor @emph{r} BUNs. * - * The @emph{kintersect(l,r)} is used also as implementation for the @emph{semijoin()}. + * Operations with double-elimination can be formed by performing + * @emph{[k,s]unique(l)} on their operands. + * + * The @emph{kintersect(l,r)} is used also as implementation for the + * @emph{semijoin()}. */ @h #ifndef _GDK_SETOP_H @@ -404,10 +409,10 @@ BATsunique(BAT *b) /* * @+ Difference and Intersect * Difference and Intersection are handled together. For each routine - * there are two versions: @`BATkdiff@5(l,r) and @`BATkintersect@5(l,r) (which - * look at the head column only), versus @`BATsdiff@5(l,r) and - * @`BATsintersect@5(l,r) (looking at both columns). - * TODO synced/key case.. + * there are two versions: @`BATkdiff@5(l,r) and + * @`BATkintersect@5(l,r) (which look at the head column only), versus + * @`BATsdiff@5(l,r) and @`BATsintersect@5(l,r) (looking at both + * columns). TODO synced/key case.. */ @= mergecheck BUN p1 = BUNfirst(l), p2 = BUNfirst(r); diff --git a/gdk/gdk_ssort.c b/gdk/gdk_ssort.c --- a/gdk/gdk_ssort.c +++ b/gdk/gdk_ssort.c @@ -49,7 +49,7 @@ struct slice { typedef struct { /* The comparison function. */ int (*compare) (const void *, const void *); - char *heap; + const char *heap; int hs; int ts; void *bh; diff --git a/gdk/gdk_ssort_impl.h b/gdk/gdk_ssort_impl.h --- a/gdk/gdk_ssort_impl.h +++ b/gdk/gdk_ssort_impl.h @@ -806,7 +806,7 @@ do_ssort(MergeState *ms, ssize_t nremain * the actual key is found at that offset (MonetDB var-sized * atoms). */ int -GDKssortimpl(void *h, void *t, void *heap, size_t nitems, +GDKssortimpl(void *h, void *t, const void *heap, size_t nitems, int hs, int ts, int tpe) { char temp; diff --git a/monetdb5/extras/jaql/parser/jaql.l b/monetdb5/extras/jaql/parser/jaql.l --- a/monetdb5/extras/jaql/parser/jaql.l +++ b/monetdb5/extras/jaql/parser/jaql.l @@ -19,8 +19,8 @@ %{ #include <stdio.h> +#include "jaqltree.h" #include "jaql.tab.h" -#include "jaqltree.h" #ifdef _MSC_VER #define snprintf _snprintf _______________________________________________ Checkin-list mailing list Checkin-list@monetdb.org http://mail.monetdb.org/mailman/listinfo/checkin-list