Changeset: a6df239ce123 for MonetDB URL: http://dev.monetdb.org/hg/MonetDB?cmd=changeset;node=a6df239ce123 Removed Files: gdk/gdk_select_legacy.c Modified Files: clients/Tests/exports.stable.out gdk/ChangeLog gdk/Makefile.ag gdk/gdk.h gdk/gdk_batop.c gdk/gdk_private.h Branch: default Log Message:
Removed BATselect and BATselect_. diffs (271 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 @@ -161,8 +161,6 @@ gdk_return BATreplace(BAT *b, BAT *p, BA void BATroles(BAT *b, const char *hnme, const char *tnme); BAT *BATsample(BAT *b, BUN n); gdk_return BATsave(BAT *b); -BAT *BATselect(BAT *b, const void *tl, const void *th); -BAT *BATselect_(BAT *b, const void *tl, const void *th, bit li, bit hi); void BATseqbase(BAT *b, oid o); gdk_return BATsetaccess(BAT *b, int mode); void BATsetcapacity(BAT *b, BUN cnt); diff --git a/gdk/ChangeLog b/gdk/ChangeLog --- a/gdk/ChangeLog +++ b/gdk/ChangeLog @@ -2,6 +2,7 @@ # This file is updated with Maddlog * Wed Sep 16 2015 Sjoerd Mullender <sjo...@acm.org> +- Removed BATselect. Use BATsubselect instead. - Removed BATsemijoin. Use BATsubsemijoin instead. - Removed BATjoin. Use BATsubjoin instead. - Removed BATleftjoin. Use BATsubleftjoin or BATproject instead. diff --git a/gdk/Makefile.ag b/gdk/Makefile.ag --- a/gdk/Makefile.ag +++ b/gdk/Makefile.ag @@ -13,7 +13,7 @@ lib_gdk = { NAME = bat SOURCES = \ gdk.h gdk_cand.h gdk_atomic.h gdk_batop.c \ - gdk_select.c gdk_select_legacy.c \ + gdk_select.c \ gdk_search.c gdk_search.h gdk_tm.c \ gdk_align.c gdk_bbp.c gdk_bbp.h \ gdk_heap.c gdk_setop.c gdk_utils.c gdk_utils.h \ diff --git a/gdk/gdk.h b/gdk/gdk.h --- a/gdk/gdk.h +++ b/gdk/gdk.h @@ -3063,23 +3063,6 @@ gdk_export void BATsetprop(BAT *b, int i /* * @- BAT relational operators - * @multitable @columnfractions 0.08 0.7 - * @item BAT * - * @tab BATselect (BAT *b, ptr tl, ptr th) - * @item BAT * - * @tab BATfragment (BAT *b, ptr l, ptr h, ptr L, ptr H) - * @item - * @item BAT * - * @tab BATkdiff (BAT *b, BAT *c) - * @end multitable - * - * The BAT library comes with a full-fledged collection of relational - * operators. The two selection operators BATselect and BATfragment - * produce a partial copy of the BAT. The former performs a search on - * the tail; the latter considers both dimensions. The BATselect - * operation takes two inclusive ranges as search arguments. - * Interpretation of a NULL argument depends on the position, i.e. a - * domain lower or upper bound. * * The full-materialization policy intermediate results in MonetDB * means that a join can produce an arbitrarily large result and choke @@ -3102,8 +3085,6 @@ gdk_export void BATsetprop(BAT *b, int i gdk_export BAT *BATsubselect(BAT *b, BAT *s, const void *tl, const void *th, int li, int hi, int anti); gdk_export BAT *BATthetasubselect(BAT *b, BAT *s, const void *val, const char *op); -gdk_export BAT *BATselect_(BAT *b, const void *tl, const void *th, bit li, bit hi); -gdk_export BAT *BATselect(BAT *b, const void *tl, const void *th); gdk_export BAT *BATconstant(int tt, const void *val, BUN cnt, int role); gdk_export BAT *BATconst(BAT *l, int tt, const void *val, int role); @@ -3160,26 +3141,6 @@ gdk_export BAT *BATsample(BAT *b, BUN n) (c)->dense ? "dense" : "oid" : \ ATOMname((c)->type)) -#define BATselect_(b, h, t, li, hi) \ - ({ \ - BAT *_b = (b); \ - HEADLESSDEBUG fprintf(stderr, \ - "#BATselect_([%s,%s]#"BUNFMT") %s[%s:%d]\n", \ - _COL_TYPE(_b->H), _COL_TYPE(_b->T), BATcount(_b), \ - __func__, __FILE__, __LINE__); \ - BATselect_(_b, (h), (t), (li), (hi)); \ - }) - -#define BATselect(b, h, t) \ - ({ \ - BAT *_b = (b); \ - HEADLESSDEBUG fprintf(stderr, \ - "#BATselect([%s,%s]#"BUNFMT") %s[%s:%d]\n", \ - _COL_TYPE(_b->H), _COL_TYPE(_b->T), BATcount(_b), \ - __func__, __FILE__, __LINE__); \ - BATselect(_b, (h), (t)); \ - }) - #endif #endif diff --git a/gdk/gdk_batop.c b/gdk/gdk_batop.c --- a/gdk/gdk_batop.c +++ b/gdk/gdk_batop.c @@ -925,9 +925,6 @@ BATreplace(BAT *b, BAT *p, BAT *n, bit f * The BAT selectors are among the most heavily used operators. * Their efficient implementation is therefore mandatory. * - * The interface supports seven operations: BATslice, BATselect, - * BATfragment, BATproject, BATrestrict. - * * BAT slice * This function returns a horizontal slice from a BAT. It optimizes * execution by avoiding to copy when the BAT is memory mapped (in @@ -938,9 +935,6 @@ BATreplace(BAT *b, BAT *p, BAT *n, bit f * preserve void-columns (in this case, the seqbase has to be * recomputed in the result). * - * Note that the BATslice() is used indirectly as well as a special - * case for BATselect (range selection on sorted column). - * * NOTE new semantics, the selected range is excluding the high value. */ #undef BATslice diff --git a/gdk/gdk_private.h b/gdk/gdk_private.h --- a/gdk/gdk_private.h +++ b/gdk/gdk_private.h @@ -438,6 +438,12 @@ GDKreallocmax_debug(void *ptr, size_t si #ifdef __GNUC__ /* in debug builds, complain (warn) about usage of legacy functions */ +#define _COL_TYPE(c) ((c)->type == TYPE_void ? \ + (c)->seq == oid_nil ? "nil" : "void" : \ + (c)->type == TYPE_oid ? \ + (c)->dense ? "dense" : "oid" : \ + ATOMname((c)->type)) + #define BATkdiff(l, r) \ ({ \ BAT *_l = (l), *_r = (r); \ diff --git a/gdk/gdk_select_legacy.c b/gdk/gdk_select_legacy.c deleted file mode 100644 --- a/gdk/gdk_select_legacy.c +++ /dev/null @@ -1,129 +0,0 @@ -/* - * This Source Code Form is subject to the terms of the Mozilla Public - * License, v. 2.0. If a copy of the MPL was not distributed with this - * file, You can obtain one at http://mozilla.org/MPL/2.0/. - * - * Copyright 2008-2015 MonetDB B.V. - */ - -#include "monetdb_config.h" -#include "gdk.h" -#include "gdk_private.h" - -/* This file contains the legacy interface to the select functions */ - -#undef BATselect_ -#undef BATselect - -static BAT * -BAT_select_(BAT *b, const void *tl, const void *th, - bit li, bit hi, const char *name) -{ - BAT *bn; - BAT *bn1 = NULL; - BAT *map; - BAT *b1; - - ALGODEBUG fprintf(stderr, "#Legacy %s(b=%s#" BUNFMT "[%s,%s]%s%s%s," - "li=%s,hi=%s)\n", name, - BATgetId(b), BATcount(b), ATOMname(b->htype), ATOMname(b->ttype), - BAThdense(b) ? "-hdense" : "", - b->tsorted ? "-sorted" : "", - b->trevsorted ? "-revsorted" : "", - li ? "true" : "false", - hi ? "true" : "false"); - BATcheck(b, "BAT_select_", NULL); - /* b is a [any_1,any_2] BAT */ - if (!BAThdense(b)) { - ALGODEBUG fprintf(stderr, "#BAT_select_(b=%s#" BUNFMT - "): make map\n", - BATgetId(b), BATcount(b)); - map = BATmirror(BATmark(b, 0)); /* [dense1,any_1] */ - b1 = BATmirror(BATmark(BATmirror(b), 0)); /* dense1,any_2] */ - } else { - ALGODEBUG fprintf(stderr, "#BAT_select_(b=%s#" BUNFMT - "): dense head\n", - BATgetId(b), BATcount(b)); - map = NULL; - b1 = b; /* [dense1,any_2] (any_1==dense1) */ - } - /* b1 is a [dense1,any_2] BAT, map (if set) is a [dense1,any_1] BAT */ - bn = BATsubselect(b1, NULL, tl, th, li, hi, 0); - if (bn == NULL) - goto error; - /* bn is a [dense2,oid] BAT, if b was hdense, oid==any_1 */ - /* we want to return a [any_1,any_2] subset of b */ - if (map) { - bn1 = BATproject(bn, map); - if (bn1 == NULL) - goto error; - /* bn1 is [dense2,any_1] */ - BBPunfix(map->batCacheid); - map = BATmirror(bn1); - /* map is [any_1,dense2] */ - bn1 = BATproject(bn, b1); - if (bn1 == NULL) - goto error; - /* bn1 is [dense2,any_2] */ - BBPunfix(b1->batCacheid); - b1 = NULL; - BBPunfix(bn->batCacheid); - bn = VIEWcreate(map, bn1); - if (bn == NULL) - goto error; - /* bn is [any_1,any_2] */ - BBPunfix(bn1->batCacheid); - BBPunfix(map->batCacheid); - bn1 = map = NULL; - } else { - bn1 = BATproject(bn, b); - if (bn1 == NULL) - goto error; - /* bn1 is [dense2,any_2] */ - /* bn was [dense2,any_1] since b was hdense */ - b1 = VIEWcreate(BATmirror(bn), bn1); - if (b1 == NULL) - goto error; - /* b1 is [any_1,any_2] */ - BBPunfix(bn->batCacheid); - bn = b1; - b1 = NULL; - BBPunfix(bn1->batCacheid); - bn1 = NULL; - } - if (th == NULL && BATcount(bn) > 0 && - ATOMcmp(b->ttype, tl, ATOMnilptr(b->ttype)) == 0) { - /* this was the only way to get nils, so we - * have nils if there are any values at all */ - bn->T->nil = 1; - } else { - /* we can't have nils */ - bn->T->nonil = 1; - } - return bn; - - error: - if (map) - BBPunfix(map->batCacheid); - if (b1 && b1 != b) - BBPunfix(b1->batCacheid); - if (bn1) - BBPunfix(bn1->batCacheid); - if (bn) - BBPunfix(bn->batCacheid); - return NULL; -} - -BAT * -BATselect_(BAT *b, const void *h, const void *t, bit li, bit hi) -{ - return BAT_select_(b, h, t, li, hi, "BATselect_"); -} - -/* Return a BAT which is a subset of b with just the qualifying - * tuples. */ -BAT * -BATselect(BAT *b, const void *h, const void *t) -{ - return BATselect_(b, h, t, TRUE, TRUE); -} _______________________________________________ checkin-list mailing list checkin-list@monetdb.org https://www.monetdb.org/mailman/listinfo/checkin-list