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

Remove obsolete MAL signatures and make headless
grouped the open MAL issues at the header.
removed:
sortTH/sortHT
ssort ssort_rev

headless: copy, slice*


diffs (truncated from 650 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
@@ -1537,45 +1537,6 @@ ALGthsort(bat *result, const bat *lid)
        throw(MAL, "algebra.thsort", GDK_EXCEPTION);
 }
 
-str
-ALGssort(bat *result, const bat *bid)
-{
-       BAT *b, *bn;
-
-       if ((b = BATdescriptor(*bid)) == NULL) {
-               throw(MAL, "algebra.ssort", RUNTIME_OBJECT_MISSING);
-       }
-       bn = BATssort(b);
-       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.ssort", GDK_EXCEPTION);
-}
-
-str
-ALGssort_rev(bat *result, const bat *bid)
-{
-       BAT *b, *bn;
-
-       if ((b = BATdescriptor(*bid)) == NULL) {
-               throw(MAL, "algebra.ssort_rev", RUNTIME_OBJECT_MISSING);
-       }
-       bn = BATssort_rev(b);
-       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.ssort_rev", GDK_EXCEPTION);
-}
 
 str
 ALGsubsort33(bat *result, bat *norder, bat *ngroup, const bat *bid, const bat 
*order, const bat *group, const bit *reverse, const bit *stable)
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
@@ -19,20 +19,196 @@
 # that return a BAT.
 module algebra;
 
+# TO BE REMOVED OR CHANGED FOR HEADLESS
+
+command find(b:bat[:any_1,:any_2], h:any_1):any_2
+address ALGfind
+comment "Returns the index position of a value 't'.  If no such BUN exists, an 
error occurs." ;
+
+command fetch(b:bat[:any_2,:any_1], x:oid) :any_1
+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]
+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]
+address ALGtintersect;
+
+# Head-differing elements
+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'.
+               It does *not* do double-elimination over the 'left' BUNs.
+               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]
+address ALGtdifference;
+# Union on head
+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 revert( b:bat[:any_1,:any_2]) :bat[:any_1,:any_2]
+address ALGrevert
+comment "Returns a BAT copy with buns in reverse order";
+
+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.";
+
+
+# Sorted copy
+command sort( b:bat[:any_1,:any_2]) :bat[:any_1,:any_2]
+address ALGhsort
+comment "Returns a BAT copy sorted on the head column.";
+command sortReverse( b:bat[:any_1,:any_2]) :bat[:any_1,:any_2]
+address ALGhsort_rev
+comment "Returns a BAT copy reversely sorted on the head column.";
+
+command sortTail( b:bat[:any_1,:any_2]) :bat[:any_1,:any_2]
+address ALGtsort
+comment "Returns a BAT copy sorted on the tail column.";
+command sortReverseTail( b:bat[:any_1,:any_2]) :bat[:any_1,:any_2]
+address ALGtsort_rev
+comment "Returns a BAT copy reversely sorted on the tail column.";
+
+# 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]
+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]
+address ALGjoin;
+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]
+address ALGleftjoinestimate;
+
+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]
+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]
+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]
+address ALGouterjoinestimate;
+
+# Theta Join
+command thetajoin( left:bat[:any_1,:any_2], right:bat[:any_2,:any_3], 
opname:int) :bat[:any_1,:any_3]
+address ALGthetajoin
+comment "Theta join on for 'mode' in { LE, LT, EQ, GT, GE }.  JOIN_EQ is
+               just the same as join(). All other options do merge algorithms.
+               Either using the fact that they are ordered() already (left on 
tail,
+       right on head), or by using/creating binary search trees on the
+               join columns. ";
+
+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]
+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]
+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,
+               right-head + plus], depending on (l_in/h_in), the bounds
+               are included. Works only for the builtin numerical types,
+               and their derivates.";
+
+command join(l:bat[:any_1,:any_2], rl:bat[:any_3,:any_2], 
rh:bat[:any_3,:any_2], li:bit, hi:bit) :bat[:any_1,:any_3]
+address ALGrangejoin;
+
+#END OF HEADLESS PLANS
+
+# BAT copying
+command copy( b:bat[:oid,:any_2]) :bat[:oid,:any_2]
+address ALGcopy
+comment "Returns physical copy of a BAT.";
+
 command exist(b:bat[:oid,:any_1], val:any_1):bit
 address ALGexist
 comment "Returns whether 'val' occurs in b.";
 
-command find(b:bat[:any_1,:any_2], h:any_1):any_2
-address ALGfind
-comment "Returns the tail value 't' for which some [h,t] BUN
-       exists in b.  If no such BUN exists, an error occurs." ;
-
-command fetch(b:bat[:any_2,:any_1], x:oid) :any_1
-address ALGfetchoid
-comment "Returns the tail value of the BUN at x-th position
-       with 0 <= x < b.count";
-
 # The range selections are targeted at the tail of the BAT.
 command subselect(b:bat[:oid,:any_1], low:any_1, high:any_1, li:bit, hi:bit, 
anti:bit) :bat[:oid,:oid]
 address ALGsubselect1
@@ -116,44 +292,6 @@ command selectNotNil(b:bat[:oid,:any_2])
 address ALGselectNotNil
 comment "Select all not-nil values";
 
-# The second group uses the head to perform the range selection
-
-command slice(b:bat[:any_1,:any_2], x:oid, y:oid) :bat[:any_1,:any_2]
-address ALGslice_oid
-comment "Return the slice based on head oid x till y (exclusive).";
-
-command slice(b:bat[:any_1,:any_2], x:lng, y:lng) :bat[:any_1,:any_2]
-address ALGslice
-comment "Return the slice with the BUNs at position x till y.";
-
-command slice(b:bat[:any_1,:any_2], x:int, y:int) :bat[:any_1,:any_2]
-address ALGslice_int
-comment "Return the slice with the BUNs at position x till y.";
-
-command slice(b:bat[:any_1,:any_2], x:wrd, y:wrd) :bat[:any_1,:any_2]
-address ALGslice_wrd
-comment "Return the slice with the BUNs at position x till y.";
-
-command subslice(b:bat[:oid,:any_1], x:wrd, y:wrd) :bat[:oid,:oid]
-address ALGsubslice_wrd
-comment "Return the oids of the slice with the BUNs at position x till y.";
-
-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.";
-
-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)";
_______________________________________________
checkin-list mailing list
[email protected]
https://www.monetdb.org/mailman/listinfo/checkin-list

Reply via email to