Changeset: 0c1817e49f65 for MonetDB URL: http://dev.monetdb.org/hg/MonetDB?cmd=changeset;node=0c1817e49f65 Modified Files: clients/Tests/MAL-signatures.stable.out clients/Tests/MAL-signatures.stable.out.int128 clients/Tests/exports.stable.out gdk/gdk_bat.c gdk/gdk_private.h gdk/gdk_storage.c monetdb5/ChangeLog monetdb5/extras/rapi/Tests/All monetdb5/mal/Tests/dataflow01.mal monetdb5/mal/Tests/dataflow01.stable.out monetdb5/mal/Tests/tst025.stable.out monetdb5/mal/Tests/tst032.stable.out monetdb5/mal/Tests/tst033.mal monetdb5/mal/Tests/tst033.stable.out monetdb5/mal/Tests/tst034.mal monetdb5/mal/Tests/tst034.stable.out monetdb5/mal/Tests/tst201.stable.out monetdb5/mal/Tests/tst220.mal monetdb5/mal/Tests/tst220.stable.out monetdb5/mal/Tests/tst275.stable.out monetdb5/mal/Tests/tst810.stable.out monetdb5/mal/Tests/tst903.mal monetdb5/mal/Tests/tst903.stable.out monetdb5/mal/Tests/tst911.mal monetdb5/mal/Tests/tst911.stable.out monetdb5/mal/Tests/tst912.mal monetdb5/mal/Tests/tst912.stable.out monetdb5/modules/kernel/algebra.c monetdb5/modules/kernel/algebra.h monetdb5/modules/kernel/algebra.mal monetdb5/modules/mal/Tests/batpartition.stable.out monetdb5/modules/mal/Tests/iterator03.stable.out monetdb5/modules/mal/Tests/mapi01.mal monetdb5/modules/mal/Tests/mapi01.stable.out monetdb5/modules/mal/Tests/mapi07.mal monetdb5/modules/mal/Tests/mapi07.stable.out monetdb5/modules/mal/Tests/partition.stable.out monetdb5/modules/mal/Tests/tokenizer00.stable.out monetdb5/modules/mal/mal_io.c monetdb5/modules/mal/mal_io.h monetdb5/optimizer/Tests/All monetdb5/optimizer/Tests/CXexample.mal monetdb5/optimizer/Tests/CXexample.stable.out monetdb5/optimizer/Tests/FTexample.mal monetdb5/optimizer/Tests/FTexample.stable.out monetdb5/optimizer/Tests/dataflow.mal monetdb5/optimizer/Tests/dataflow.stable.out monetdb5/optimizer/Tests/reorder00.mal monetdb5/optimizer/Tests/reorder00.stable.out monetdb5/optimizer/Tests/tst4000.mal monetdb5/optimizer/Tests/tst4000.stable.out monetdb5/optimizer/Tests/tst4003.mal monetdb5/optimizer/Tests/tst4003.stable.out monetdb5/optimizer/Tests/tst4030.mal monetdb5/optimizer/Tests/tst4030.stable.out monetdb5/optimizer/Tests/tst4700.mal monetdb5/optimizer/Tests/tst4700.stable.out monetdb5/tests/gdkTests/Tests/scanselect.mal monetdb5/tests/gdkTests/Tests/scanselect.stable.out Branch: default Log Message:
Merge diffs (truncated from 2069 to 300 lines): diff --git a/clients/Tests/MAL-signatures.stable.out b/clients/Tests/MAL-signatures.stable.out --- a/clients/Tests/MAL-signatures.stable.out +++ b/clients/Tests/MAL-signatures.stable.out @@ -2495,18 +2495,6 @@ command algebra.selectNotNil(b:bat[:oid, address ALGselectNotNil; comment Select all not-nil values -command algebra.select(b:bat[:oid,:any_2],value:any_2):bat[:oid,:any_2] -address ALGselect1; -comment Select all BUNs of a BAT with a certain tail value. Selection on NIL is also possible (it should be properly casted, e.g.:int(nil)). - -command algebra.select(b:bat[:oid,:any_2],low:any_2,high:any_2,li:bit,hi:bit):bat[:oid,:any_2] -address ALGselectInclusive; -comment Select all BUNs that have tail values: {v| low <{=} v <{=} high}. Boundary inclusion is indicated separately. NIL boundary values have a special meaning. + low == nil means: no lower bound + high == nil means: no upper bound. - -command algebra.select(b:bat[:oid,:any_2],low:any_2,high:any_2):bat[:oid,:any_2] -address ALGselect; -comment Select all BUNs that have tail values: {v| low <= v <= high}. NIL boundary values have a special meaning. + low == nil means: no lower bound + high == nil means: no upper bound. NOTE 1: you should cast the nil to the appropriate type, e.g. int(nil) in order to circumvent type clashes. NOTE 2: as the 'nil' element has no clear place in the ordered domain of values, tuples with 'nil' values are NEVER returned by the range select. - command algebra.subselect(b:bat[:oid,:any_1],s:bat[:oid,:oid],low:any_1,high:any_1,li:bit,hi:bit,anti:bit):bat[:oid,:oid] address ALGsubselect2; comment Select all head values of the first input BAT for which the tail value is in range and for which the head value occurs in the tail of the second input BAT. The first input is a dense-headed BAT, the second input is a dense-headed BAT with sorted tail, output is a dense-headed BAT with in the tail the head value of the input BAT for which the tail value is between the values low and high (inclusive if li respectively hi is set). The output BAT is sorted on the tail value. If low or high is nil, the boundary is not considered (effectively - and + infinity). If anti is set, the result is the complement. Nil values in the tail are never matched, unless low=nil, high=nil, li=1, hi=1, anti=0. All non-nil values are returned if low=nil, high=nil, and li, hi are not both 1, or anti=1. Note that the output is suitable as second input for this function. diff --git a/clients/Tests/MAL-signatures.stable.out.int128 b/clients/Tests/MAL-signatures.stable.out.int128 --- a/clients/Tests/MAL-signatures.stable.out.int128 +++ b/clients/Tests/MAL-signatures.stable.out.int128 @@ -3006,18 +3006,6 @@ command algebra.selectNotNil(b:bat[:oid, address ALGselectNotNil; comment Select all not-nil values -command algebra.select(b:bat[:oid,:any_2],value:any_2):bat[:oid,:any_2] -address ALGselect1; -comment Select all BUNs of a BAT with a certain tail value. Selection on NIL is also possible (it should be properly casted, e.g.:int(nil)). - -command algebra.select(b:bat[:oid,:any_2],low:any_2,high:any_2,li:bit,hi:bit):bat[:oid,:any_2] -address ALGselectInclusive; -comment Select all BUNs that have tail values: {v| low <{=} v <{=} high}. Boundary inclusion is indicated separately. NIL boundary values have a special meaning. + low == nil means: no lower bound + high == nil means: no upper bound. - -command algebra.select(b:bat[:oid,:any_2],low:any_2,high:any_2):bat[:oid,:any_2] -address ALGselect; -comment Select all BUNs that have tail values: {v| low <= v <= high}. NIL boundary values have a special meaning. + low == nil means: no lower bound + high == nil means: no upper bound. NOTE 1: you should cast the nil to the appropriate type, e.g. int(nil) in order to circumvent type clashes. NOTE 2: as the 'nil' element has no clear place in the ordered domain of values, tuples with 'nil' values are NEVER returned by the range select. - command algebra.subselect(b:bat[:oid,:any_1],s:bat[:oid,:oid],low:any_1,high:any_1,li:bit,hi:bit,anti:bit):bat[:oid,:oid] address ALGsubselect2; comment Select all head values of the first input BAT for which the tail value is in range and for which the head value occurs in the tail of the second input BAT. The first input is a dense-headed BAT, the second input is a dense-headed BAT with sorted tail, output is a dense-headed BAT with in the tail the head value of the input BAT for which the tail value is between the values low and high (inclusive if li respectively hi is set). The output BAT is sorted on the tail value. If low or high is nil, the boundary is not considered (effectively - and + infinity). If anti is set, the result is the complement. Nil values in the tail are never matched, unless low=nil, high=nil, li=1, hi=1, anti=0. All non-nil values are returned if low=nil, high=nil, and li, hi are not both 1, or anti=1. Note that the output is suitable as second input for this function. 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 @@ -731,9 +731,6 @@ str ALGprojecttail(Client cntxt, MalBlkP str ALGrangejoin2(bat *l, bat *r, const bat *lid, const bat *rlid, const bat *rhid, const bit *li, const bit *hi); str ALGreuse(bat *ret, const bat *bid); str ALGsample(bat *result, const bat *bid, const int *param); -str ALGselect(bat *result, const bat *bid, ptr low, ptr high); -str ALGselect1(bat *result, const bat *bid, ptr value); -str ALGselectInclusive(bat *result, const bat *bid, ptr low, ptr high, const bit *lin, const bit *rin); str ALGselectNotNil(bat *result, const bat *bid); str ALGsemijoin(bat *result, const bat *lid, const bat *rid); str ALGslice(bat *ret, const bat *bid, const lng *start, const lng *end); @@ -1262,7 +1259,6 @@ str INSPECTshowFunction3(Client cntxt, M str INSPECTtypeName(Client cntxt, MalBlkPtr mb, MalStkPtr stk, InstrPtr pci); str IOexport(bit *ret, bat *bid, str *fnme); str IOimport(bat *ret, bat *bid, str *fnme); -str IOprintBoth(Client cntxt, MalBlkPtr mb, MalStkPtr stk, InstrPtr pci, int indx, str hd, str tl, int nobat); str IOprint_val(Client cntxt, MalBlkPtr mb, MalStkPtr stk, InstrPtr p); str IOprintf(Client cntxt, MalBlkPtr mb, MalStkPtr stk, InstrPtr pci); str IOprintfStream(Client cntxt, MalBlkPtr mb, MalStkPtr stk, InstrPtr pci); diff --git a/gdk/gdk_bat.c b/gdk/gdk_bat.c --- a/gdk/gdk_bat.c +++ b/gdk/gdk_bat.c @@ -50,20 +50,20 @@ #define ATOMneedheap(tpe) (BATatoms[tpe].atomHeap != NULL) -char *BATstring_h = "h"; -char *BATstring_t = "t"; +static char *BATstring_h = "h"; +static char *BATstring_t = "t"; -static int +static inline int default_ident(char *s) { - return ((s) == BATstring_h || (s) == BATstring_t); + return (s == BATstring_h || s == BATstring_t); } void BATinit_idents(BAT *bn) { - bn->hident = (char *) BATstring_h; - bn->tident = (char *) BATstring_t; + bn->hident = BATstring_h; + bn->tident = BATstring_t; } BATstore * @@ -112,8 +112,8 @@ BATcreatedesc(int ht, int tt, int heapna bn->hsorted = bn->hrevsorted = ATOMlinear(ht) != 0; bn->tsorted = bn->trevsorted = ATOMlinear(tt) != 0; - bn->hident = (char *) BATstring_h; - bn->tident = (char *) BATstring_t; + bn->hident = BATstring_h; + bn->tident = BATstring_t; bn->halign = OIDnew(2); bn->talign = bn->halign + 1; bn->hseqbase = (ht == TYPE_void) ? oid_nil : 0; @@ -377,33 +377,8 @@ BATattach(int tt, const char *heapfile, * If the BAT runs out of storage for BUNS it will reallocate space. * For memory mapped BATs we simple extend the administration after * having an assurance that the BAT still can be safely stored away. - * - * Most BAT operations use a BAT to assemble the result. In several - * cases it is rather difficult to give a precise estimate of the - * required space. The routine BATguess is used internally for this - * purpose. It balances the cost of small BATs with their probability - * of occurrence. Small results BATs are more likely than 100M BATs. - * - * Likewise, the routines Hgrows and Tgrows provides a heuristic to - * enlarge the space. */ BUN -BATguess(BAT *b) -{ - BUN newcap; - - BATcheck(b, "BATguess", 0); - newcap = b->batCount; - if (newcap < 10 * BATTINY) - return newcap; - if (newcap < 50 * BATTINY) - return newcap / 2; - if (newcap < 100 * BATTINY) - return newcap / 10; - return newcap / 100; -} - -BUN BATgrows(BAT *b) { BUN oldcap, newcap; diff --git a/gdk/gdk_private.h b/gdk/gdk_private.h --- a/gdk/gdk_private.h +++ b/gdk/gdk_private.h @@ -65,8 +65,6 @@ struct BATstore { __attribute__((__visibility__("hidden"))); __hidden gdk_return BATgroup_internal(BAT **groups, BAT **extents, BAT **histo, BAT *b, BAT *g, BAT *e, BAT *h, int subsorted) __attribute__((__visibility__("hidden"))); -__hidden BUN BATguess(BAT *b) - __attribute__((__visibility__("hidden"))); __hidden void BATinit_idents(BAT *bn) __attribute__((__visibility__("hidden"))); __hidden BAT *BATload_intern(bat bid, int lock) diff --git a/gdk/gdk_storage.c b/gdk/gdk_storage.c --- a/gdk/gdk_storage.c +++ b/gdk/gdk_storage.c @@ -1067,11 +1067,10 @@ BATprintf(stream *s, BAT *b) BAT *argv[2]; gdk_return ret = GDK_FAIL; - argv[0] = BATmark(b, 0); + argv[0] = VIEWcombine(b); argv[1] = b; if (argv[0] && argv[1]) { BATroles(argv[0], NULL, b->hident); - BATroles(argv[1], NULL, b->tident); ret = BATprintcolumns(s, 2, argv); } if (argv[0]) diff --git a/monetdb5/ChangeLog b/monetdb5/ChangeLog --- a/monetdb5/ChangeLog +++ b/monetdb5/ChangeLog @@ -1,6 +1,9 @@ # ChangeLog file for MonetDB5 # This file is updated with Maddlog +* Fri Sep 11 2015 Sjoerd Mullender <sjo...@acm.org> +- Removed algebra.select. Use algebra.subselect instead. + * Wed Sep 9 2015 Sjoerd Mullender <sjo...@acm.org> - Removed algebra.revert. diff --git a/monetdb5/extras/rapi/Tests/All b/monetdb5/extras/rapi/Tests/All --- a/monetdb5/extras/rapi/Tests/All +++ b/monetdb5/extras/rapi/Tests/All @@ -7,4 +7,3 @@ HAVE_LIBR?rapi05 HAVE_LIBR?rapi06 HAVE_LIBR?rapi07 HAVE_LIBR?rapi08 -HAVE_LIBR?rapi09 diff --git a/monetdb5/mal/Tests/dataflow01.mal b/monetdb5/mal/Tests/dataflow01.mal --- a/monetdb5/mal/Tests/dataflow01.mal +++ b/monetdb5/mal/Tests/dataflow01.mal @@ -26,7 +26,7 @@ end load; function qry(z:bat[:oid,:lng],low:int,hgh:int):wrd; l:= calc.lng(low); h:= calc.lng(hgh); - s:= algebra.select(z,l,h); + s:= algebra.subselect(z,l,h,true,true,false); c:= aggr.count(s); return qry:= c; end qry; diff --git a/monetdb5/mal/Tests/dataflow01.stable.out b/monetdb5/mal/Tests/dataflow01.stable.out --- a/monetdb5/mal/Tests/dataflow01.stable.out +++ b/monetdb5/mal/Tests/dataflow01.stable.out @@ -33,7 +33,7 @@ end user.load; function user.qry(z:bat[:oid,:lng],low:int,hgh:int):wrd; l := calc.lng(low); h := calc.lng(hgh); - s := algebra.select(z,l,h); + s := algebra.subselect(z,l,h,true,true,false); c := aggr.count(s); return qry := c; end user.qry; diff --git a/monetdb5/mal/Tests/tst025.stable.out b/monetdb5/mal/Tests/tst025.stable.out --- a/monetdb5/mal/Tests/tst025.stable.out +++ b/monetdb5/mal/Tests/tst025.stable.out @@ -50,7 +50,7 @@ end user.main; # void int # type #--------------------------# [ 0@0, 5140046 ] -[ 1@0, 5645862 ] +[ 2@0, 5645862 ] #--------------------------# # t t # name # void int # type diff --git a/monetdb5/mal/Tests/tst032.stable.out b/monetdb5/mal/Tests/tst032.stable.out --- a/monetdb5/mal/Tests/tst032.stable.out +++ b/monetdb5/mal/Tests/tst032.stable.out @@ -57,7 +57,7 @@ end user.main; # oid int # type #--------------------------# [ 0@0, 0 ] -[ 1@0, 2 ] +[ 2@0, 2 ] # 22:30:08 > # 22:30:08 > Done. diff --git a/monetdb5/mal/Tests/tst033.mal b/monetdb5/mal/Tests/tst033.mal --- a/monetdb5/mal/Tests/tst033.mal +++ b/monetdb5/mal/Tests/tst033.mal @@ -4,8 +4,11 @@ bat.append(b,1); bat.append(b,2); bat.append(b,3); -z:= algebra.select(b,0,2); io.print(z); -z:= algebra.select(b,0,2,true,true); io.print(z); -z:= algebra.select(b,0,2,true,false); io.print(z); -z:= algebra.select(b,0,2,false,true); io.print(z); -z:= algebra.select(b,0,2,false,false); io.print(z); +s := algebra.subselect(b,0,2,true,true,false); z := algebra.leftfetchjoin(s,b); io.print(z); +s := algebra.subselect(b,0,2,true,false,false); z := algebra.leftfetchjoin(s,b); io.print(z); +s := algebra.subselect(b,0,2,false,true,false); z := algebra.leftfetchjoin(s,b); io.print(z); +s := algebra.subselect(b,0,2,false,false,false); z := algebra.leftfetchjoin(s,b); io.print(z); +s := algebra.subselect(b,0,2,true,true,true); z := algebra.leftfetchjoin(s,b); io.print(z); +s := algebra.subselect(b,0,2,true,false,true); z := algebra.leftfetchjoin(s,b); io.print(z); +s := algebra.subselect(b,0,2,false,true,true); z := algebra.leftfetchjoin(s,b); io.print(z); +s := algebra.subselect(b,0,2,false,false,true); z := algebra.leftfetchjoin(s,b); io.print(z); diff --git a/monetdb5/mal/Tests/tst033.stable.out b/monetdb5/mal/Tests/tst033.stable.out --- a/monetdb5/mal/Tests/tst033.stable.out +++ b/monetdb5/mal/Tests/tst033.stable.out @@ -29,15 +29,29 @@ function user.main():void; bat.append(b,1); bat.append(b,2); bat.append(b,3); - z := algebra.select(b,0,2); + s := algebra.subselect(b,0,2,true,true,false); + z := algebra.leftfetchjoin(s,b); io.print(z); - z := algebra.select(b,0,2,true,true); + s := algebra.subselect(b,0,2,true,false,false); + z := algebra.leftfetchjoin(s,b); io.print(z); - z := algebra.select(b,0,2,true,false); + s := algebra.subselect(b,0,2,false,true,false); + z := algebra.leftfetchjoin(s,b); io.print(z); - z := algebra.select(b,0,2,false,true); + s := algebra.subselect(b,0,2,false,false,false); + z := algebra.leftfetchjoin(s,b); io.print(z); - z := algebra.select(b,0,2,false,false); + s := algebra.subselect(b,0,2,true,true,true); + z := algebra.leftfetchjoin(s,b); + io.print(z); + s := algebra.subselect(b,0,2,true,false,true); + z := algebra.leftfetchjoin(s,b); + io.print(z); + s := algebra.subselect(b,0,2,false,true,true); + z := algebra.leftfetchjoin(s,b); + io.print(z); + s := algebra.subselect(b,0,2,false,false,true); + z := algebra.leftfetchjoin(s,b); io.print(z); end user.main; #--------------------------# @@ -53,15 +67,8 @@ end user.main; #-----------------# [ 0@0, 0 ] [ 1@0, 1 ] -[ 2@0, 2 ] _______________________________________________ checkin-list mailing list checkin-list@monetdb.org https://www.monetdb.org/mailman/listinfo/checkin-list