[prev in list] [next in list] [prev in thread] [next in thread]
List: monetdb-developers
Subject: Re: [Monetdb-developers] MonetDB: default - Merge with default branch.
From: Stefan Manegold <Stefan.Manegold () cwi ! nl>
Date: 2012-03-17 14:21:44
Message-ID: 20120317142144.GA2028 () cwi ! nl
[Download RAW message or body]
oop, sorry, message should have been
"Merge with Apr2012 branch."
Stefan
On Sat, Mar 17, 2012 at 03:20:38PM +0100, Stefan Manegold wrote:
> Changeset: 498e01451664 for MonetDB
> URL: http://dev.monetdb.org/hg/MonetDB?cmd=changeset;node=498e01451664
> Modified Files:
> clients/mapiclient/mclient.c
> monetdb5/mal/mal_resolve.c
> sql/backends/monet5/UDF/udf.c
> sql/backends/monet5/UDF/udf.h
> sql/test/bugs/Tests/crash_order_by.stable.out
> tools/merovingian/daemon/controlrunner.c
> tools/merovingian/daemon/merovingian.c
> Branch: default
> Log Message:
>
> Merge with default branch.
>
>
> diffs (truncated from 413 to 300 lines):
>
> diff --git a/clients/mapiclient/mclient.c b/clients/mapiclient/mclient.c
> --- a/clients/mapiclient/mclient.c
> +++ b/clients/mapiclient/mclient.c
> @@ -654,7 +654,9 @@ CSVrenderer(MapiHdl hdl)
> s = mapi_fetch_field(hdl, i);
> if (s == NULL)
> s = nullstring == default_nullstring ? "" : nullstring;
> - if (strchr(s, *sep) != NULL || strchr(s, '\n') != NULL || strchr(s, '"') != \
> NULL) { + if (strchr(s, *sep) != NULL ||
> + strchr(s, '\n') != NULL ||
> + strchr(s, '"') != NULL) {
> mnstr_printf(toConsole, "%s\"",
> i == 0 ? "" : sep);
> while (*s) {
> @@ -675,8 +677,6 @@ CSVrenderer(MapiHdl hdl)
> mnstr_write(toConsole, "\"\"", 1, 2);
> break;
> default:
> - if (*s == *sep)
> - mnstr_write(toConsole, "\\", 1, 1);
> mnstr_write(toConsole, s, 1, 1);
> break;
> }
> diff --git a/monetdb5/mal/mal_resolve.c b/monetdb5/mal/mal_resolve.c
> --- a/monetdb5/mal/mal_resolve.c
> +++ b/monetdb5/mal/mal_resolve.c
> @@ -68,7 +68,7 @@
> * These examples give little room to achieve our prime objective, i.e.
> * a fast and early type resolution scheme. Any non-polymorphic function
> * can be type checked and marked type-safe upon completion.
> - * Type checking polymorphic functions are post-poned until a concrete
> + * Type checking polymorphic functions are postponed until a concrete
> * type instance is known. It leads to a clone, which can be type checked
> * and is entered into the symbol table.
> * The type resolution status is marked in each instruction.
> diff --git a/sql/backends/monet5/UDF/udf.c b/sql/backends/monet5/UDF/udf.c
> --- a/sql/backends/monet5/UDF/udf.c
> +++ b/sql/backends/monet5/UDF/udf.c
> @@ -3,26 +3,26 @@
> * 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.
> * All Rights Reserved.
> -*/
> -
> + */
>
> #include "monetdb_config.h"
> #include "udf.h"
>
> /* Reverse a string */
> -str UDFreverse ( str *ret , str *arg )
> +str
> +UDFreverse(str *ret, str *arg)
> {
> size_t len = 0;
> str src = NULL, dst = NULL;
> @@ -37,7 +37,8 @@ str UDFreverse ( str *ret , str *arg )
> if (src == NULL || strcmp(src, str_nil) == 0) {
> *ret = GDKstrdup(str_nil);
> if (*ret == NULL)
> - throw(MAL, "udf.reverse", "failed to create copy of str_nil");
> + throw(MAL, "udf.reverse",
> + "failed to create copy of str_nil");
>
> return MAL_SUCCEED;
> }
> @@ -46,7 +47,8 @@ str UDFreverse ( str *ret , str *arg )
> len = strlen(src);
> *ret = dst = GDKmalloc(len + 1);
> if (dst == NULL)
> - throw(MAL, "udf.reverse", "failed to allocate string of length " SZFMT, len+1);
> + throw(MAL, "udf.reverse",
> + "failed to allocate string of length " SZFMT, len + 1);
>
> /* copy characters from src to dst in reverse order */
> dst[len] = 0;
> @@ -62,7 +64,8 @@ str UDFreverse ( str *ret , str *arg )
> * Generic "type-oblivious" version,
> * using generic "type-oblivious" BAT access interface.
> */
> -str UDFBATreverse ( bat *ret , bat *bid )
> +str
> +UDFBATreverse(bat *ret, bat *bid)
> {
> BATiter li;
> BAT *bn = NULL, *left = NULL;
> @@ -78,7 +81,8 @@ str UDFBATreverse ( bat *ret , bat *bid
> /* check tail type */
> if (left->ttype != TYPE_str) {
> BBPreleaseref(left->batCacheid);
> - throw(MAL, "batudf.reverse", "tail-type of input BAT must be TYPE_str");
> + throw(MAL, "batudf.reverse",
> + "tail-type of input BAT must be TYPE_str");
> }
>
> /* allocate result BAT */
> @@ -98,6 +102,7 @@ str UDFBATreverse ( bat *ret , bat *bid
> /* the core of the algorithm, expensive due to malloc/frees */
> BATloop(left, p, q) {
> str tr = NULL, err = NULL;
> +
> /* get original head & tail value */
> ptr h = BUNhead(li, p);
> str t = (str) BUNtail(li, p);
> @@ -106,7 +111,8 @@ str UDFBATreverse ( bat *ret , bat *bid
> err = UDFreverse(&tr, &t);
> if (err != MAL_SUCCEED) {
> /* error -> bail out */
> - BATaccessEnd(left, USE_HEAD | USE_TAIL, MMAP_SEQUENTIAL);
> + BATaccessEnd(left, USE_HEAD | USE_TAIL,
> + MMAP_SEQUENTIAL);
> BBPreleaseref(left->batCacheid);
> BBPreleaseref(*ret);
> return err;
> @@ -116,7 +122,7 @@ str UDFBATreverse ( bat *ret , bat *bid
> assert(tr != NULL);
>
> /* insert original head and reversed tail in result BAT */
> - /* BUNins() takes care of all necessary admininstration */
> + /* BUNins() takes care of all necessary administration */
> BUNins(bn, h, tr, FALSE);
>
> /* free memory allocated in UDFreverse() */
> @@ -155,9 +161,9 @@ str UDFfuse_##in##_##out ( out *ret , in
> return MAL_SUCCEED; \
> }
>
> -UDFfuse_scalar_impl(bte,unsigned char ,sht, 8)
> -UDFfuse_scalar_impl(sht,unsigned short,int,16)
> -UDFfuse_scalar_impl(int,unsigned int ,lng,32)
> +UDFfuse_scalar_impl(bte, unsigned char, sht, 8)
> +UDFfuse_scalar_impl(sht, unsigned short, int, 16)
> +UDFfuse_scalar_impl(int, unsigned int, lng, 32)
>
>
> /* BAT fuse */
> @@ -165,8 +171,8 @@ UDFfuse_scalar_impl(int,unsigned int ,l
> * Type-expanded optimized version,
> * accessing value arrays directly.
> */
> -str
> -UDFBATfuse ( bat *ires , bat *ione , bat *itwo)
> + str
> +UDFBATfuse(bat *ires, bat *ione, bat *itwo)
> {
> BAT *bres = NULL, *bone = NULL, *btwo = NULL;
> bit two_tail_sorted_unsigned = FALSE;
> @@ -185,89 +191,102 @@ UDFBATfuse ( bat *ires , bat *ione , bat
> }
>
> /* check for dense & aligned heads */
> - if (!BAThdense(bone) || !BAThdense(btwo) || BATcount(bone) != BATcount(btwo) || \
> bone->hseqbase != btwo->hseqbase) { + if (!BAThdense(bone) ||
> + !BAThdense(btwo) ||
> + BATcount(bone) != BATcount(btwo) ||
> + bone->hseqbase != btwo->hseqbase) {
> BBPreleaseref(bone->batCacheid);
> BBPreleaseref(btwo->batCacheid);
> - throw(MAL, "batudf.fuse", "heads of input BATs must be aligned");
> + throw(MAL, "batudf.fuse",
> + "heads of input BATs must be aligned");
> }
>
> /* check tail types */
> if (bone->ttype != btwo->ttype) {
> BBPreleaseref(bone->batCacheid);
> BBPreleaseref(btwo->batCacheid);
> - throw(MAL, "batudf.fuse", "tails of input BATs must be identical");
> + throw(MAL, "batudf.fuse",
> + "tails of input BATs must be identical");
> }
>
> /* advice on sequential scan */
> BATaccessBegin(bone, USE_TAIL, MMAP_SEQUENTIAL);
> BATaccessBegin(btwo, USE_TAIL, MMAP_SEQUENTIAL);
>
> -#define UDFBATfuse_TYPE(in,uin,out,shift) \
> -{ /* type-specific core algorithm */ \
> - in *one = NULL, *two = NULL; \
> - out *res = NULL; \
> - BUN i, n = BATcount(bone); \
> - \
> - /* allocate result BAT */ \
> - bres = BATnew(TYPE_void, TYPE_##out, n); \
> - if (bres == NULL) { \
> - BBPreleaseref(bone->batCacheid); \
> - BBPreleaseref(btwo->batCacheid); \
> - throw(MAL, "batudf.fuse", MAL_MALLOC_FAIL); \
> - } \
> - \
> - /* get direct access to the tail arrays */ \
> - one = (in *) Tloc(bone, BUNfirst(bone)); \
> - two = (in *) Tloc(btwo, BUNfirst(btwo)); \
> - res = (out*) Tloc(bres, BUNfirst(bres)); \
> - \
> - /* is tail of right/second BAT sorted, also when cast to unsigned type, */ \
> - /* i.e., are the values either all >= 0 or all < 0? */ \
> - two_tail_sorted_unsigned = BATtordered(btwo)&1 && ( two[0] >= 0 || two[n-1] < 0 \
> ); \
> - \
> - /* iterate over all values/tuples and do the work */ \
> - for (i = 0; i < n; i++) \
> - if (one[i] == in##_nil || two[i] == in##_nil) \
> - /* NULL/nil in => NULL/nil out */ \
> - res[i] = out##_nil; \
> - else \
> - /* do the work; watch out for sign bits */ \
> - res[i] = ( ((out)((uin)one[i])) << shift ) | ((uin)two[i]); \
> - \
> - /* set number of tuples in result BAT */ \
> - BATsetcount(bres, n); \
> -}
> +#define UDFBATfuse_TYPE(in,uin,out,shift) \
> +do { /* type-specific core algorithm */ \
> + in *one = NULL, *two = NULL; \
> + out *res = NULL; \
> + BUN i, n = BATcount(bone); \
> + \
> + /* allocate result BAT */ \
> + bres = BATnew(TYPE_void, TYPE_##out, n); \
> + if (bres == NULL) { \
> + BBPreleaseref(bone->batCacheid); \
> + BBPreleaseref(btwo->batCacheid); \
> + throw(MAL, "batudf.fuse", MAL_MALLOC_FAIL); \
> + } \
> + \
> + /* get direct access to the tail arrays */ \
> + one = (in *) Tloc(bone, BUNfirst(bone)); \
> + two = (in *) Tloc(btwo, BUNfirst(btwo)); \
> + res = (out*) Tloc(bres, BUNfirst(bres)); \
> + \
> + /* is tail of right/second BAT sorted, also when cast to \
> + * unsigned type, */ \
> + /* i.e., are the values either all >= 0 or all < 0? */ \
> + two_tail_sorted_unsigned = BATtordered(btwo) & 1 && \
> + (two[0] >= 0 || two[n - 1] < 0); \
> + \
> + /* iterate over all values/tuples and do the work */ \
> + for (i = 0; i < n; i++) \
> + if (one[i] == in##_nil || two[i] == in##_nil) \
> + /* NULL/nil in => NULL/nil out */ \
> + res[i] = out##_nil; \
> + else \
> + /* do the work; watch out for sign bits */ \
> + res[i] = ((out) (uin) one[i] << shift) | (uin) two[i]; \
> + \
> + /* set number of tuples in result BAT */ \
> + BATsetcount(bres, n); \
> +} while (0)
>
> /* type expansion for core algorithm */
> switch (bone->ttype) {
> case TYPE_bte:
> - UDFBATfuse_TYPE(bte,unsigned char ,sht, 8)
> + UDFBATfuse_TYPE(bte, unsigned char, sht, 8);
> break;
> +
> case TYPE_sht:
> - UDFBATfuse_TYPE(sht,unsigned short,int,16)
> + UDFBATfuse_TYPE(sht, unsigned short, int, 16);
> break;
> +
> case TYPE_int:
> - UDFBATfuse_TYPE(int,unsigned int ,lng,32)
> + UDFBATfuse_TYPE(int, unsigned int, lng, 32);
> break;
> +
> default:
> - throw(MAL, "batudf.fuse", "tails of input BATs must be one of {bte, sht, int}");
> + throw(MAL, "batudf.fuse",
> + "tails of input BATs must be one of {bte, sht, int}");
> }
>
> BATaccessEnd(bone, USE_TAIL, MMAP_SEQUENTIAL);
> BATaccessEnd(btwo, USE_TAIL, MMAP_SEQUENTIAL);
>
> /* set result properties */
> - bres->hdense = TRUE; /* result head is dense */
> + bres->hdense = TRUE; /* result head is dense */
> BATseqbase(bres, bone->hseqbase); /* result head has same seqbase as input */
> - bres->hsorted = GDK_SORTED; /* result head is sorted */
> - BATkey(bone, TRUE); /* result head is key (unique) */
> + bres->hsorted = GDK_SORTED; /* result head is sorted */
> + BATkey(bres, TRUE); /* result head is key (unique) */
>
> - /* Result tail is sorted, if the left/first input tail is sorted and key \
> (unique), _______________________________________________
> Checkin-list mailing list
> Checkin-list@monetdb.org
> http://mail.monetdb.org/mailman/listinfo/checkin-list
>
--
> Stefan.Manegold @ CWI.nl | DB Architectures (INS1) |
> http://CWI.nl/~manegold/ | Science Park 123 (L321) |
> Tel.: +31 (0)20 592-4212 | 1098 XG Amsterdam (NL) |
------------------------------------------------------------------------------
This SF email is sponsosred by:
Try Windows Azure free for 90 days Click Here
http://p.sf.net/sfu/sfd2d-msazure
_______________________________________________
Monetdb-developers mailing list
Monetdb-developers@lists.sourceforge.net
https://lists.sourceforge.net/lists/listinfo/monetdb-developers
[prev in list] [next in list] [prev in thread] [next in thread]
Configure |
About |
News |
Add a list |
Sponsored by KoreLogic