Changeset: e10554074397 for MonetDB
URL: http://dev.monetdb.org/hg/MonetDB?cmd=changeset;node=e10554074397
Modified Files:
        monetdb5/modules/kernel/algebra.c
        monetdb5/modules/kernel/algebra.h
        monetdb5/modules/kernel/algebra.mal
Branch: default
Log Message:

Remove superflous signatures and make some headless
- semijoin is removed
- sortTail is renamed
- removed duplicate signatures
- made aggr.() headless.


diffs (truncated from 332 to 300 lines):

diff --git a/monetdb5/modules/kernel/algebra.c 
b/monetdb5/modules/kernel/algebra.c
--- a/monetdb5/modules/kernel/algebra.c
+++ b/monetdb5/modules/kernel/algebra.c
@@ -81,23 +81,6 @@ CMDselect_(BAT **result, BAT *b, ptr low
 }
 
 static int
-CMDuselect_(BAT **result, BAT *b, ptr low, ptr high, const bit *l_in, const 
bit *h_in)
-{
-       int tt = b->ttype;
-       ptr nil = ATOMnilptr(tt);
-
-       if (*l_in == bit_nil && ATOMcmp(tt, low, nil)) {
-               GDKerror("CMDuselect: flag 'l_in' must not be NIL, unless 
boundary 'low' is NIL\n");
-               return GDK_FAIL;
-       }
-       if (*h_in == bit_nil && ATOMcmp(tt, high, nil)) {
-               GDKerror("CMDuselect: flag 'h_in' must not be NIL, unless 
boundary 'high' is NIL\n");
-               return GDK_FAIL;
-       }
-       return (*result = BATuselect_(b, low, high, *l_in, *h_in)) ? 
GDK_SUCCEED : GDK_FAIL;
-}
-
-static int
 CMDgen_group(BAT **result, BAT *gids, BAT *cnts )
 {
        wrd j, gcnt = BATcount(gids);
@@ -441,26 +424,6 @@ ALGselect1(bat *result, const bat *bid, 
        throw(MAL, "algebra.select", GDK_EXCEPTION);
 }
 
-str
-ALGuselect1(bat *result, const bat *bid, ptr value)
-{
-       BAT *b, *bn = NULL;
-
-       if ((b = BATdescriptor(*bid)) == NULL) {
-               throw(MAL, "algebra.uselect", RUNTIME_OBJECT_MISSING);
-       }
-       derefStr(b, t, value);
-       bn = BATuselect(b, value, NULL);
-       BBPunfix(b->batCacheid);
-       if (bn) {
-               if (!(bn->batDirty&2))
-                       bn = BATsetaccess(bn, BAT_READ);
-               *result = bn->batCacheid;
-               BBPkeepref(*result);
-               return MAL_SUCCEED;
-       }
-       throw(MAL, "algebra.uselect", GDK_EXCEPTION);
-}
 
 str
 ALGselect(bat *result, const bat *bid, ptr low, ptr high)
@@ -513,28 +476,6 @@ ALGselectNotNil(bat *result, const bat *
 }
 
 str
-ALGuselect(bat *result, const bat *bid, ptr low, ptr high)
-{
-       BAT *b, *bn = NULL;
-
-       if ((b = BATdescriptor(*bid)) == NULL) {
-               throw(MAL, "algebra.uselect", RUNTIME_OBJECT_MISSING);
-       }
-       derefStr(b, t, low);
-       derefStr(b, t, high);
-       bn = BATuselect(b, low, high);
-       if (bn) {
-               if (!(bn->batDirty&2)) bn = BATsetaccess(bn, BAT_READ);
-               *result = bn->batCacheid;
-               BBPkeepref(*result);
-               BBPunfix(b->batCacheid);
-               return MAL_SUCCEED;
-       }
-       BBPunfix(b->batCacheid);
-       throw(MAL, "algebra.uselect", GDK_EXCEPTION);
-}
-
-str
 ALGselectInclusive(bat *result, const bat *bid, ptr low, ptr high, const bit 
*lin, const bit *rin)
 {
        BAT *b, *bn = NULL;
@@ -557,28 +498,6 @@ ALGselectInclusive(bat *result, const ba
 }
 
 str
-ALGuselectInclusive(bat *result, const bat *bid, ptr low, ptr high, const bit 
*lin, const bit *rin)
-{
-       BAT *b, *bn = NULL;
-
-       if ((b = BATdescriptor(*bid)) == NULL) {
-               throw(MAL, "algebra.uselect", RUNTIME_OBJECT_MISSING);
-       }
-       derefStr(b, t, low);
-       derefStr(b, t, high);
-       CMDuselect_(&bn, b, low, high, lin, rin);
-       if (bn) {
-               if (!(bn->batDirty&2)) bn = BATsetaccess(bn, BAT_READ);
-               *result = bn->batCacheid;
-               BBPkeepref(*result);
-               BBPunfix(b->batCacheid);
-               return MAL_SUCCEED;
-       }
-       BBPunfix(b->batCacheid);
-       throw(MAL, "algebra.uselect", GDK_EXCEPTION);
-}
-
-str
 ALGthetajoinEstimate(bat *result, const bat *lid, const bat *rid, const int 
*opc, const lng *estimate)
 {
        BAT *left, *right, *bn = NULL;
diff --git a/monetdb5/modules/kernel/algebra.h 
b/monetdb5/modules/kernel/algebra.h
--- a/monetdb5/modules/kernel/algebra.h
+++ b/monetdb5/modules/kernel/algebra.h
@@ -48,11 +48,8 @@ algebra_export str ALGsubselect2(bat *re
 algebra_export str ALGthetasubselect1(bat *result, const bat *bid, const void 
*val, const char **op);
 algebra_export str ALGthetasubselect2(bat *result, const bat *bid, const bat 
*sid, const void *val, const char **op);
 algebra_export str ALGselect1(bat *result, const bat *bid, ptr value);
-algebra_export str ALGuselect1(bat *result, const bat *bid, ptr value);
 algebra_export str ALGselect(bat *result, const bat *bid, ptr low, ptr high);
-algebra_export str ALGuselect(bat *result, const bat *bid, ptr low, ptr high);
 algebra_export str ALGselectInclusive(bat *result, const bat *bid, ptr low, 
ptr high, const bit *lin, const bit *rin);
-algebra_export str ALGuselectInclusive(bat *result, const bat *bid, ptr low, 
ptr high, const bit *lin, const bit *rin);
 
 algebra_export str ALGsubjoin(bat *r1, bat *r2, const bat *l, const bat *r, 
const bat *sl, const bat *sr, const bit *nil_matches, const lng *estimate);
 algebra_export str ALGsubleftjoin(bat *r1, bat *r2, const bat *l, const bat 
*r, const bat *sl, const bat *sr, const bit *nil_matches, const lng *estimate);
diff --git a/monetdb5/modules/kernel/algebra.mal 
b/monetdb5/modules/kernel/algebra.mal
--- a/monetdb5/modules/kernel/algebra.mal
+++ b/monetdb5/modules/kernel/algebra.mal
@@ -29,31 +29,18 @@ command fetch(b:bat[:any_2,:any_1], x:oi
 address ALGfetchoid
 comment "Returns the value of the BUN at x-th position with 0 <= x < b.count";
 
-# Head-intersecting elements (a.k.a. semijoin)
-command semijoin( left:bat[:any_1,:any_2], right:bat[:any_1,:any] )
-               :bat[:any_1,:any_2]
-address ALGsemijoin
-comment "Returns the intersection taken over only the *head* columns of
-               two BATs.  Results in all BUNs of 'left' that are also in 
'right'.
-               Does *not* do double-elimination over the 'left' BUNs.
-               If you want this, use: 
'kintersect(kunique(left),kunique(right))'
-       or: 'kunique(kintersect(left,right))'.";
-
-command kintersect( left:bat[:any_1,:any_2], right:bat[:any_1,:any] )
-               :bat[:any_1,:any_2]
+command kintersect( left:bat[:any_1,:any_2], right:bat[:any_1,:any] ) 
:bat[:any_1,:any_2]
 address ALGsemijoin
 comment "Returns the intersection taken over only the *head* columns of two 
BATs.
        Results in all BUNs of 'left' that are also in 'right'.
                Does *not* do double- elimination over the 'left' BUNs.
                If you want this, use: 
'kintersect(kunique(left),kunique(right))'
        or: 'kunique(kintersect(left,right))'.";
-command tintersect( left:bat[:any_1,:any_2], right:bat[:any_1,:any] )
-               :bat[:any_1,:any_2]
+command tintersect( left:bat[:any_1,:any_2], right:bat[:any_1,:any] ) 
:bat[:any_1,:any_2]
 address ALGtintersect;
 
 # Head-differing elements
-command kdifference ( left:bat[:any_1,:any_2], right:bat[:any_1,:any] )
-               :bat[:any_1,:any_2]
+command kdifference ( left:bat[:any_1,:any_2], right:bat[:any_1,:any] ) 
:bat[:any_1,:any_2]
 address ALGkdiff
 comment "Returns the difference taken over only the *head* columns of two BATs.
                Results in all BUNs of 'left' that are *not* in 'right'.
@@ -61,89 +48,50 @@ comment "Returns the difference taken ov
                If you want this, use:
         'kdifference(left.kunique,right.kunique)'
        or: 'kdifference(left,right).kunique'.";
-command tdifference ( left:bat[:any_1,:any_2], right:bat[:any_1,:any] )
-               :bat[:any_1,:any_2]
+command tdifference ( left:bat[:any_1,:any_2], right:bat[:any_1,:any] ) 
:bat[:any_1,:any_2]
 address ALGtdifference;
+#
 # Union on head
-command kunion ( left:bat[:any_1,:any_2], right:bat[:any_1,:any_2])
-               :bat[:any_1,:any_2]
+command kunion ( left:bat[:any_1,:any_2], right:bat[:any_1,:any_2]) 
:bat[:any_1,:any_2]
 address ALGkunion
 comment "Returns the union of two BATs; looking at head-columns only.
                Results in all BUNs of 'left' that are  not in 'right', plus
        all BUNs of 'right'.  *no* double-elimination is done.";
 
-command uselect(b:bat[:any_1,:any_2], low:any_2, high:any_2,
-               li:bit, hi:bit) :bat[:any_1,:void]
-address ALGuselectInclusive
-comment "See select() but limited to head values";
-
-command uselect(b:bat[:any_1,:any_2], low:any_2, high:any_2):bat[:any_1,:void]
-address ALGuselect;
-command uselect(b:bat[:any_1,:any_2], value:any_2) :bat[:any_1,:void]
-address ALGuselect1
-comment "Value select, but returning only the
-       head values. SEE ALSO:select(bat,val)";
-
 command groupby(gids:bat[:oid,:oid], cnts:bat[:oid,:wrd]) :bat[:oid,:oid]
 address ALGgroupby
 comment "Produces a new BAT with groups identified by the head column. The 
result contains tail times the head value, ie the tail contains the result 
group sizes.";
 
-# Note that joins over void columns are handled as if they are oids.
-command antijoin(left:bat[:any_1,:any_2], right:bat[:any_2,:any_4])
-       :bat[:any_1,:any_4]
-address ALGantijoin
-comment "Returns the antijoin";
-
-command join( left:bat[:any_1,:any_2], right:bat[:any_2,:any_3])
-               :bat[:any_1,:any_3]
+command join( left:bat[:any_1,:any_2], right:bat[:any_2,:any_3]) 
:bat[:any_1,:any_3]
 address ALGjoin
 comment "Returns all BUNs, consisting of a head-value from 'left' and
                a tail-value from 'right' for which there are BUNs in 'left'
                and 'right' with equal tail- resp. head-value (i.e. the join
        columns are projected out).";
 
-command join( left:bat[:any_1,:any_2], right:bat[:any_2,:any_3])
-               :bat[:any_1,:any_3]
+command join( left:bat[:any_1,:any_2], right:bat[:any_2,:any_3]) 
:bat[:any_1,:any_3]
 address ALGjoin;
-command leftjoin( left:bat[:any_1,:any_2], right:bat[:any_2,:any_3])
-               :bat[:any_1,:any_3]
+command leftjoin( left:bat[:any_1,:any_2], right:bat[:any_2,:any_3]) 
:bat[:any_1,:any_3]
 address ALGleftjoin;
 
-command leftjoin( left:bat[:any_1,:any_2], right:bat[:any_2,:any_3],
-               estimate:lng) :bat[:any_1,:any_3]
+command leftjoin( left:bat[:any_1,:any_2], right:bat[:any_2,:any_3], 
estimate:lng) :bat[:any_1,:any_3]
 address ALGleftjoinestimate;
 
-command join( left:bat[:any_1,:any_2], right:bat[:any_2,:any_3],
-               estimate:lng) :bat[:any_1,:any_3]
+command join( left:bat[:any_1,:any_2], right:bat[:any_2,:any_3], estimate:lng) 
:bat[:any_1,:any_3]
 address ALGjoinestimate;
 
-command leftfetchjoin ( left:bat[:oid,:oid], right:bat[:oid,:any_3] )
-               :bat[:oid,:any_3]
+command leftfetchjoin ( left:bat[:oid,:oid], right:bat[:oid,:any_3] ) 
:bat[:oid,:any_3]
 address ALGleftfetchjoin
 comment "Hook directly into the left fetch join implementation.";
 
 
-command outerjoin( outer:bat[:any_1,:any_2], inner:bat[:any_2,:any_3])
-               :bat[:any_1,:any_3]
-address ALGouterjoin
-comment "Returns all the result of a join, plus the BUNS formed NIL in
-               the tail and the head-values of 'outer' whose tail-value does
-               not match an head-value in 'inner'.";
-command outerjoin( outer:bat[:any_1,:oid], inner:bat[:oid,:any_3])
-               :bat[:any_1,:any_3]
-address ALGouterjoin
-comment "Returns all the result of a join, plus the BUNS formed NIL in
-               the tail and the head-values of 'outer' whose tail-value does
-               not match an head-value in 'inner'.";
-command outerjoin( outer:bat[:any_1,:oid], inner:bat[:oid,:any_3])
-               :bat[:any_1,:any_3]
+command outerjoin( outer:bat[:any_1,:any_2], inner:bat[:any_2,:any_3]) 
:bat[:any_1,:any_3]
 address ALGouterjoin
 comment "Returns all the result of a join, plus the BUNS formed NIL in
                the tail and the head-values of 'outer' whose tail-value does
                not match an head-value in 'inner'.";
 
-command outerjoin( outer:bat[:any_1,:any_2], inner:bat[:any_2,:any_3],
-               estimate:lng) :bat[:any_1,:any_3]
+command outerjoin( outer:bat[:any_1,:any_2], inner:bat[:any_2,:any_3], 
estimate:lng) :bat[:any_1,:any_3]
 address ALGouterjoinestimate;
 
 # Theta Join
@@ -158,16 +106,14 @@ comment "Theta join on for 'mode' in { L
 command thetajoin( left:bat[:any_1,:any_2], right:bat[:any_2,:any_3], 
opname:int,estimate:lng) :bat[:any_1,:any_3]
 address ALGthetajoinEstimate;
 # Band Join (approximate match)
-command bandjoin( outer:bat[:any_1,:any_2], inner:bat[:any_2,:any_3],
-                  minus:any_2 , plus:any_2 ) :bat[:any_1,:any_3]
+command bandjoin( outer:bat[:any_1,:any_2], inner:bat[:any_2,:any_3], 
minus:any_2 , plus:any_2 ) :bat[:any_1,:any_3]
 address ALGbandjoin_default
 comment "This is a join() for which the predicate is that two BUNs match
                if the left-tail value is within the range [right-head - minus,
                right-head + plus]. Works only for the builtin numerical types,
                and their derivates.";
 
-command bandjoin( outer:bat[:any_1,:any_2], inner:bat[:any_2,:any_3],
-                  minus:any_2 , plus:any_2, li:bit, hi:bit ) 
:bat[:any_1,:any_3]
+command bandjoin( outer:bat[:any_1,:any_2], inner:bat[:any_2,:any_3], 
minus:any_2 , plus:any_2, li:bit, hi:bit ) :bat[:any_1,:any_3]
 address ALGbandjoin
 comment "This is a join() for which the predicate is that two BUNs match
                if the left-tail value is within the range [right-head - minus,
@@ -180,14 +126,6 @@ address ALGrangejoin;
 
 #END OF HEADLESS PLANS
 
-#command sort( b:bat[:oid,:any_2]) :bat[:oid,:any_2]
-#address ALGtsort
-#comment "Returns a BAT copy sorted on the tail column.";
-#
-#command sortReverse( b:bat[:oid,:any_2]) :bat[:oid,:any_2]
-#address ALGtsort_rev
-#comment "Returns a BAT copy reversely sorted on the tail column.";
-
 command revert( b:bat[:oid,:any_1]) :bat[:oid,:any_1]
 address ALGrevert
 comment "Returns a BAT copy with buns in reverse order";
_______________________________________________
checkin-list mailing list
checkin-list@monetdb.org
https://www.monetdb.org/mailman/listinfo/checkin-list

Reply via email to