Changeset: 5eb6cb5cab82 for MonetDB
URL: http://dev.monetdb.org/hg/MonetDB?cmd=changeset;node=5eb6cb5cab82
Modified Files:
        clients/Tests/exports.stable.out
        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/profiler.c
        monetdb5/optimizer/Tests/Mexample.stable.out
        monetdb5/optimizer/Tests/remap.stable.out
        monetdb5/optimizer/opt_multiplex.c
        monetdb5/tests/mapi/Tests/sample0.stable.out
        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: default
Log Message:

merge


diffs (truncated from 4471 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
@@ -246,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);
@@ -1774,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);
diff --git a/gdk/gdk.h b/gdk/gdk.h
--- a/gdk/gdk.h
+++ b/gdk/gdk.h
@@ -1683,8 +1683,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
 #define fileno _fileno
diff --git a/monetdb5/extras/mal_optimizer_template/opt_sql_append.c 
b/monetdb5/extras/mal_optimizer_template/opt_sql_append.c
--- a/monetdb5/extras/mal_optimizer_template/opt_sql_append.c
+++ b/monetdb5/extras/mal_optimizer_template/opt_sql_append.c
@@ -3,14 +3,14 @@
  * Version 1.1 (the "License"); you may not use this file except in
  * compliance with the License. You may obtain a copy of the License at
  * http://www.monetdb.org/Legal/MonetDBLicense
- * 
+ *
  * Software distributed under the License is distributed on an "AS IS"
  * basis, WITHOUT WARRANTY OF ANY KIND, either express or implied. See the
  * License for the specific language governing rights and limitations
  * under the License.
- * 
+ *
  * The Original Code is the MonetDB Database System.
- * 
+ *
  * The Initial Developer of the Original Code is CWI.
  * Portions created by CWI are Copyright (C) 1997-July 2008 CWI.
  * Copyright August 2008-2012 MonetDB B.V.
@@ -51,7 +51,8 @@
  *
  * i.e., handing a BAT view v2 of BAT v0 as argument to the sql.append()
  * statement, rather than the original BAT v0.
- * My advice, always use new variable names, it may capture some easy to make 
errors.
+ * My advice, always use new variable names, it may capture some easy
+ * to make errors.
  *
  * As a refinement, patterns like
  *
@@ -77,7 +78,7 @@
 /*
  * It is mandatory to make optimizers part of the 'optimizer' module.
  * This allows the optimizer implementation to find them and react on them.
-*/
+ */
 #include "monetdb_config.h"
 #include "opt_sql_append.h"
 #include "mal_interpreter.h"
@@ -164,9 +165,11 @@ OPTsql_appendImplementation(Client cntxt
                        /* look for
                         *  v5 := ... v0 ...;
                         */
-                       /* an expensive loop, better would be to remember that 
v0 has a different role.
-                        * A typical method is to keep a map from variable -> 
instruction where it was
-                        * detected. Then you can check each assignment for use 
of v0
+                       /* an expensive loop, better would be to remember that 
v0
+                        * has a different role.  A typical method is to keep a
_______________________________________________
Checkin-list mailing list
[email protected]
http://mail.monetdb.org/mailman/listinfo/checkin-list

Reply via email to