Changeset: 79b7462356d6 for MonetDB
URL: https://dev.monetdb.org/hg/MonetDB?cmd=changeset;node=79b7462356d6
Modified Files:
        clients/Tests/MAL-signatures.stable.out
        clients/Tests/MAL-signatures.stable.out.int128
        clients/Tests/exports.stable.out
        monetdb5/ChangeLog
        monetdb5/mal/Tests/tst1502.malC
        monetdb5/mal/Tests/tst233.malC
        monetdb5/mal/Tests/tst234.malC
        monetdb5/mal/Tests/tst235.malC
        monetdb5/mal/Tests/tst903.malC
        monetdb5/mal/Tests/tst903.stable.out
        monetdb5/modules/atoms/Tests/xml10.malC
        monetdb5/modules/kernel/Tests/select.malC
        monetdb5/modules/kernel/Tests/time01.malC
        monetdb5/modules/kernel/algebra.c
        monetdb5/modules/kernel/algebra.h
        monetdb5/modules/kernel/algebra.mal
        monetdb5/modules/mal/Tests/inspect05.malC
        monetdb5/modules/mal/Tests/orderidx00.malC
        monetdb5/modules/mal/Tests/orderidx04.malC
        monetdb5/modules/mal/Tests/pqueue.malC
        monetdb5/modules/mal/Tests/pqueue2.malC
        monetdb5/modules/mal/Tests/pqueue3.malC
        monetdb5/optimizer/Tests/DCexample2.malC
        monetdb5/optimizer/Tests/reorder00.malC
        monetdb5/optimizer/Tests/reorder00.stable.out
        monetdb5/optimizer/Tests/tst4700.malC
        sql/backends/monet5/sql_statement.c
        
sql/test/BugTracker-2010/Tests/LIMIT_OFFSET_big-endian.Bug-2622.stable.out
        
sql/test/FeatureRequests/Tests/foreign_key_outer_join_dead_code_elimination-explain-0join-query.stable.out
        
sql/test/FeatureRequests/Tests/foreign_key_outer_join_dead_code_elimination-explain-0join-view.stable.out
        
sql/test/FeatureRequests/Tests/foreign_key_outer_join_dead_code_elimination-explain-1join-query.stable.out
        
sql/test/FeatureRequests/Tests/foreign_key_outer_join_dead_code_elimination-explain-1join-view.stable.out
        
sql/test/FeatureRequests/Tests/foreign_key_outer_join_dead_code_elimination-explain-2join-query.stable.out
        
sql/test/FeatureRequests/Tests/foreign_key_outer_join_dead_code_elimination-explain-2join-view.stable.out
Branch: default
Log Message:

Implemented a nilslast:bit parameter to algebra.sort and algebra.firstn.


diffs (truncated from 2444 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
@@ -527,12 +527,12 @@ Ready.
 [ "algebra",   "exist",        "command algebra.exist(b:bat[:any_1], 
val:any_1):bit ", "ALGexist;",    "Returns whether 'val' occurs in b."    ]
 [ "algebra",   "fetch",        "command algebra.fetch(b:bat[:any_1], 
x:oid):any_1 ",   "ALGfetchoid;", "Returns the value of the BUN at x-th 
position with 0 <= x < b.count"   ]
 [ "algebra",   "find", "command algebra.find(b:bat[:any_1], t:any_1):oid ",    
"ALGfind;",     "Returns the index position of a value.  If no such BUN exists 
return OID-nil." ]
-[ "algebra",   "firstn",       "pattern algebra.firstn(b:bat[:any], n:lng, 
asc:bit, distinct:bit) (X_0:bat[:oid], X_1:bat[:oid]) ",    "ALGfirstn;",   
"Calculate first N values of B" ]
-[ "algebra",   "firstn",       "pattern algebra.firstn(b:bat[:any], n:lng, 
asc:bit, distinct:bit):bat[:oid] ", "ALGfirstn;",   "Calculate first N values 
of B" ]
-[ "algebra",   "firstn",       "pattern algebra.firstn(b:bat[:any], 
s:bat[:oid], g:bat[:oid], n:lng, asc:bit, distinct:bit) (X_0:bat[:oid], 
X_1:bat[:oid]) ",  "ALGfirstn;",   "Calculate first N values of B with 
candidate list S"   ]
-[ "algebra",   "firstn",       "pattern algebra.firstn(b:bat[:any], 
s:bat[:oid], g:bat[:oid], n:lng, asc:bit, distinct:bit):bat[:oid] ",       
"ALGfirstn;",   "Calculate first N values of B with candidate list S"   ]
-[ "algebra",   "firstn",       "pattern algebra.firstn(b:bat[:any], 
s:bat[:oid], n:lng, asc:bit, distinct:bit) (X_0:bat[:oid], X_1:bat[:oid]) ",    
   "ALGfirstn;",   "Calculate first N values of B with candidate list S"   ]
-[ "algebra",   "firstn",       "pattern algebra.firstn(b:bat[:any], 
s:bat[:oid], n:lng, asc:bit, distinct:bit):bat[:oid] ",    "ALGfirstn;",   
"Calculate first N values of B with candidate list S"   ]
+[ "algebra",   "firstn",       "pattern algebra.firstn(b:bat[:any], n:lng, 
asc:bit, nilslast:bit, distinct:bit) (X_0:bat[:oid], X_1:bat[:oid]) ",      
"ALGfirstn;",   "Calculate first N values of B" ]
+[ "algebra",   "firstn",       "pattern algebra.firstn(b:bat[:any], n:lng, 
asc:bit, nilslast:bit, distinct:bit):bat[:oid] ",   "ALGfirstn;",   "Calculate 
first N values of B" ]
+[ "algebra",   "firstn",       "pattern algebra.firstn(b:bat[:any], 
s:bat[:oid], g:bat[:oid], n:lng, asc:bit, nilslast:bit, distinct:bit) 
(X_0:bat[:oid], X_1:bat[:oid]) ",    "ALGfirstn;",   "Calculate first N values 
of B with candidate list S"   ]
+[ "algebra",   "firstn",       "pattern algebra.firstn(b:bat[:any], 
s:bat[:oid], g:bat[:oid], n:lng, asc:bit, nilslast:bit, distinct:bit):bat[:oid] 
", "ALGfirstn;",   "Calculate first N values of B with candidate list S"   ]
+[ "algebra",   "firstn",       "pattern algebra.firstn(b:bat[:any], 
s:bat[:oid], n:lng, asc:bit, nilslast:bit, distinct:bit) (X_0:bat[:oid], 
X_1:bat[:oid]) ", "ALGfirstn;",   "Calculate first N values of B with candidate 
list S"   ]
+[ "algebra",   "firstn",       "pattern algebra.firstn(b:bat[:any], 
s:bat[:oid], n:lng, asc:bit, nilslast:bit, distinct:bit):bat[:oid] ",      
"ALGfirstn;",   "Calculate first N values of B with candidate list S"   ]
 [ "algebra",   "groupby",      "command algebra.groupby(gids:bat[:oid], 
cnts:bat[:lng]):bat[:oid] ",   "ALGgroupby;",  "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."     ]
 [ "algebra",   "ilike",        "command algebra.ilike(s:str, pat:str):bit ",   
"PCREilike2;",  ""      ]
 [ "algebra",   "ilike",        "command algebra.ilike(s:str, pat:str, 
esc:str):bit ",  "PCREilike3;",  ""      ]
@@ -569,15 +569,15 @@ Ready.
 [ "algebra",   "slice",        "command algebra.slice(b:bat[:any_1], x:int, 
y:int):bat[:any_1] ",      "ALGslice_int;",        "Return the slice with the 
BUNs at position x till y."  ]
 [ "algebra",   "slice",        "command algebra.slice(b:bat[:any_1], x:lng, 
y:lng):bat[:any_1] ",      "ALGslice_lng;",        "Return the slice with the 
BUNs at position x till y."  ]
 [ "algebra",   "slice",        "command algebra.slice(b:bat[:any_1], x:oid, 
y:oid):bat[:any_1] ",      "ALGslice_oid;",        "Return the slice based on 
head oid x till y (exclusive)."      ]
-[ "algebra",   "sort", "command algebra.sort(b:bat[:any_1], reverse:bit, 
stable:bit):bat[:any_1] ",    "ALGsort11;",   "Returns a copy of the BAT sorted 
on tail values.\n         The input and output are (must be) dense headed.\n    
     The order is descending if the reverse bit is set.\n\t\t This is a stable 
sort if the stable bit is set."        ]
-[ "algebra",   "sort", "command algebra.sort(b:bat[:any_1], reverse:bit, 
stable:bit) (X_0:bat[:any_1], X_1:bat[:oid]) ",       "ALGsort12;",   "Returns 
a copy of the BAT sorted on tail values and a BAT that\n         specifies how 
the input was reordered.\n         The input and output are (must be) dense 
headed.\n         The order is descending if the reverse bit is set.\n\t\t This 
is a stable sort if the stable bit is set." ]
-[ "algebra",   "sort", "command algebra.sort(b:bat[:any_1], reverse:bit, 
stable:bit) (X_0:bat[:any_1], X_1:bat[:oid], X_2:bat[:oid]) ",        
"ALGsort13;",   "Returns a copy of the BAT sorted on tail values, a BAT that 
specifies\n         how the input was reordered, and a BAT with group 
information.\n         The input and output are (must be) dense headed.\n       
  The order is descending if the reverse bit is set.\n\t\t This is a stable 
sort if the stable bit is set."  ]
-[ "algebra",   "sort", "command algebra.sort(b:bat[:any_1], o:bat[:oid], 
reverse:bit, stable:bit):bat[:any_1] ",       "ALGsort21;",   "Returns a copy 
of the BAT sorted on tail values.\n         The input and output are (must be) 
dense headed.\n         The order is descending if the reverse bit is 
set.\n\t\t This is a stable sort if the stable bit is set."        ]
-[ "algebra",   "sort", "command algebra.sort(b:bat[:any_1], o:bat[:oid], 
reverse:bit, stable:bit) (X_0:bat[:any_1], X_1:bat[:oid]) ",  "ALGsort22;",   
"Returns a copy of the BAT sorted on tail values and a BAT that\n         
specifies how the input was reordered.\n         The input and output are (must 
be) dense headed.\n         The order is descending if the reverse bit is 
set.\n\t\t This is a stable sort if the stable bit is set." ]
-[ "algebra",   "sort", "command algebra.sort(b:bat[:any_1], o:bat[:oid], 
reverse:bit, stable:bit) (X_0:bat[:any_1], X_1:bat[:oid], X_2:bat[:oid]) ",   
"ALGsort23;",   "Returns a copy of the BAT sorted on tail values, a BAT that 
specifies\n         how the input was reordered, and a BAT with group 
information.\n         The input and output are (must be) dense headed.\n       
  The order is descending if the reverse bit is set.\n\t\t This is a stable 
sort if the stable bit is set."  ]
-[ "algebra",   "sort", "command algebra.sort(b:bat[:any_1], o:bat[:oid], 
g:bat[:oid], reverse:bit, stable:bit):bat[:any_1] ",  "ALGsort31;",   "Returns 
a copy of the BAT sorted on tail values.\n         The input and output are 
(must be) dense headed.\n         The order is descending if the reverse bit is 
set.\n\t\t This is a stable sort if the stable bit is set."        ]
-[ "algebra",   "sort", "command algebra.sort(b:bat[:any_1], o:bat[:oid], 
g:bat[:oid], reverse:bit, stable:bit) (X_0:bat[:any_1], X_1:bat[:oid]) ",     
"ALGsort32;",   "Returns a copy of the BAT sorted on tail values and a BAT 
that\n         specifies how the input was reordered.\n         The input and 
output are (must be) dense headed.\n         The order is descending if the 
reverse bit is set.\n\t\t This is a stable sort if the stable bit is set." ]
-[ "algebra",   "sort", "command algebra.sort(b:bat[:any_1], o:bat[:oid], 
g:bat[:oid], reverse:bit, stable:bit) (X_0:bat[:any_1], X_1:bat[:oid], 
X_2:bat[:oid]) ",      "ALGsort33;",   "Returns a copy of the BAT sorted on 
tail values, a BAT that specifies\n         how the input was reordered, and a 
BAT with group information.\n         The input and output are (must be) dense 
headed.\n         The order is descending if the reverse bit is set.\n\t\t This 
is a stable sort if the stable bit is set."  ]
+[ "algebra",   "sort", "command algebra.sort(b:bat[:any_1], reverse:bit, 
nilslast:bit, stable:bit):bat[:any_1] ",      "ALGsort11;",   "Returns a copy 
of the BAT sorted on tail values.\n         The input and output are (must be) 
dense headed.\n         The order is descending if the reverse bit is 
set.\n\t\t This is a stable sort if the stable bit is set."        ]
+[ "algebra",   "sort", "command algebra.sort(b:bat[:any_1], reverse:bit, 
nilslast:bit, stable:bit) (X_0:bat[:any_1], X_1:bat[:oid]) ", "ALGsort12;",   
"Returns a copy of the BAT sorted on tail values and a BAT that\n         
specifies how the input was reordered.\n         The input and output are (must 
be) dense headed.\n         The order is descending if the reverse bit is 
set.\n\t\t This is a stable sort if the stable bit is set." ]
+[ "algebra",   "sort", "command algebra.sort(b:bat[:any_1], reverse:bit, 
nilslast:bit, stable:bit) (X_0:bat[:any_1], X_1:bat[:oid], X_2:bat[:oid]) ",  
"ALGsort13;",   "Returns a copy of the BAT sorted on tail values, a BAT that 
specifies\n         how the input was reordered, and a BAT with group 
information.\n         The input and output are (must be) dense headed.\n       
  The order is descending if the reverse bit is set.\n\t\t This is a stable 
sort if the stable bit is set."  ]
+[ "algebra",   "sort", "command algebra.sort(b:bat[:any_1], o:bat[:oid], 
reverse:bit, nilslast:bit, stable:bit):bat[:any_1] ", "ALGsort21;",   "Returns 
a copy of the BAT sorted on tail values.\n         The input and output are 
(must be) dense headed.\n         The order is descending if the reverse bit is 
set.\n\t\t This is a stable sort if the stable bit is set."        ]
+[ "algebra",   "sort", "command algebra.sort(b:bat[:any_1], o:bat[:oid], 
reverse:bit, nilslast:bit, stable:bit) (X_0:bat[:any_1], X_1:bat[:oid]) ",    
"ALGsort22;",   "Returns a copy of the BAT sorted on tail values and a BAT 
that\n         specifies how the input was reordered.\n         The input and 
output are (must be) dense headed.\n         The order is descending if the 
reverse bit is set.\n\t\t This is a stable sort if the stable bit is set." ]
+[ "algebra",   "sort", "command algebra.sort(b:bat[:any_1], o:bat[:oid], 
reverse:bit, nilslast:bit, stable:bit) (X_0:bat[:any_1], X_1:bat[:oid], 
X_2:bat[:oid]) ",     "ALGsort23;",   "Returns a copy of the BAT sorted on tail 
values, a BAT that specifies\n         how the input was reordered, and a BAT 
with group information.\n         The input and output are (must be) dense 
headed.\n         The order is descending if the reverse bit is set.\n\t\t This 
is a stable sort if the stable bit is set."  ]
+[ "algebra",   "sort", "command algebra.sort(b:bat[:any_1], o:bat[:oid], 
g:bat[:oid], reverse:bit, nilslast:bit, stable:bit):bat[:any_1] ",    
"ALGsort31;",   "Returns a copy of the BAT sorted on tail values.\n         The 
input and output are (must be) dense headed.\n         The order is descending 
if the reverse bit is set.\n\t\t This is a stable sort if the stable bit is 
set."        ]
+[ "algebra",   "sort", "command algebra.sort(b:bat[:any_1], o:bat[:oid], 
g:bat[:oid], reverse:bit, nilslast:bit, stable:bit) (X_0:bat[:any_1], 
X_1:bat[:oid]) ",       "ALGsort32;",   "Returns a copy of the BAT sorted on 
tail values and a BAT that\n         specifies how the input was reordered.\n   
      The input and output are (must be) dense headed.\n         The order is 
descending if the reverse bit is set.\n\t\t This is a stable sort if the stable 
bit is set." ]
+[ "algebra",   "sort", "command algebra.sort(b:bat[:any_1], o:bat[:oid], 
g:bat[:oid], reverse:bit, nilslast:bit, stable:bit) (X_0:bat[:any_1], 
X_1:bat[:oid], X_2:bat[:oid]) ",        "ALGsort33;",   "Returns a copy of the 
BAT sorted on tail values, a BAT that specifies\n         how the input was 
reordered, and a BAT with group information.\n         The input and output are 
(must be) dense headed.\n         The order is descending if the reverse bit is 
set.\n\t\t This is a stable sort if the stable bit is set."  ]
 [ "algebra",   "subslice",     "command algebra.subslice(b:bat[:any_1], x:lng, 
y:lng):bat[:oid] ",     "ALGsubslice_lng;",     "Return the oids of the slice 
with the BUNs at position x till y."      ]
 [ "algebra",   "thetajoin",    "command algebra.thetajoin(l:bat[:any_1], 
r:bat[:any_1], sl:bat[:oid], sr:bat[:oid], op:int, nil_matches:bit, 
estimate:lng) (X_0:bat[:oid], X_1:bat[:oid]) ",   "ALGthetajoin;",        
"Theta join with candidate lists"       ]
 [ "algebra",   "thetaselect",  "command algebra.thetaselect(b:bat[:any_1], 
val:any_1, op:str):bat[:oid] ",     "ALGthetaselect1;",     "Select all head 
values for which the tail value obeys the relation\n\tvalue OP VAL.\n\tInput is 
a dense-headed BAT, output is a dense-headed BAT with in\n\tthe tail the head 
value of the input BAT for which the\n\trelationship holds.  The output BAT is 
sorted on the tail value."        ]
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
@@ -631,12 +631,12 @@ Ready.
 [ "algebra",   "exist",        "command algebra.exist(b:bat[:any_1], 
val:any_1):bit ", "ALGexist;",    "Returns whether 'val' occurs in b."    ]
 [ "algebra",   "fetch",        "command algebra.fetch(b:bat[:any_1], 
x:oid):any_1 ",   "ALGfetchoid;", "Returns the value of the BUN at x-th 
position with 0 <= x < b.count"   ]
 [ "algebra",   "find", "command algebra.find(b:bat[:any_1], t:any_1):oid ",    
"ALGfind;",     "Returns the index position of a value.  If no such BUN exists 
return OID-nil." ]
-[ "algebra",   "firstn",       "pattern algebra.firstn(b:bat[:any], n:lng, 
asc:bit, distinct:bit) (X_0:bat[:oid], X_1:bat[:oid]) ",    "ALGfirstn;",   
"Calculate first N values of B" ]
-[ "algebra",   "firstn",       "pattern algebra.firstn(b:bat[:any], n:lng, 
asc:bit, distinct:bit):bat[:oid] ", "ALGfirstn;",   "Calculate first N values 
of B" ]
-[ "algebra",   "firstn",       "pattern algebra.firstn(b:bat[:any], 
s:bat[:oid], g:bat[:oid], n:lng, asc:bit, distinct:bit) (X_0:bat[:oid], 
X_1:bat[:oid]) ",  "ALGfirstn;",   "Calculate first N values of B with 
candidate list S"   ]
-[ "algebra",   "firstn",       "pattern algebra.firstn(b:bat[:any], 
s:bat[:oid], g:bat[:oid], n:lng, asc:bit, distinct:bit):bat[:oid] ",       
"ALGfirstn;",   "Calculate first N values of B with candidate list S"   ]
-[ "algebra",   "firstn",       "pattern algebra.firstn(b:bat[:any], 
s:bat[:oid], n:lng, asc:bit, distinct:bit) (X_0:bat[:oid], X_1:bat[:oid]) ",    
   "ALGfirstn;",   "Calculate first N values of B with candidate list S"   ]
-[ "algebra",   "firstn",       "pattern algebra.firstn(b:bat[:any], 
s:bat[:oid], n:lng, asc:bit, distinct:bit):bat[:oid] ",    "ALGfirstn;",   
"Calculate first N values of B with candidate list S"   ]
+[ "algebra",   "firstn",       "pattern algebra.firstn(b:bat[:any], n:lng, 
asc:bit, nilslast:bit, distinct:bit) (X_0:bat[:oid], X_1:bat[:oid]) ",      
"ALGfirstn;",   "Calculate first N values of B" ]
+[ "algebra",   "firstn",       "pattern algebra.firstn(b:bat[:any], n:lng, 
asc:bit, nilslast:bit, distinct:bit):bat[:oid] ",   "ALGfirstn;",   "Calculate 
first N values of B" ]
+[ "algebra",   "firstn",       "pattern algebra.firstn(b:bat[:any], 
s:bat[:oid], g:bat[:oid], n:lng, asc:bit, nilslast:bit, distinct:bit) 
(X_0:bat[:oid], X_1:bat[:oid]) ",    "ALGfirstn;",   "Calculate first N values 
of B with candidate list S"   ]
+[ "algebra",   "firstn",       "pattern algebra.firstn(b:bat[:any], 
s:bat[:oid], g:bat[:oid], n:lng, asc:bit, nilslast:bit, distinct:bit):bat[:oid] 
", "ALGfirstn;",   "Calculate first N values of B with candidate list S"   ]
+[ "algebra",   "firstn",       "pattern algebra.firstn(b:bat[:any], 
s:bat[:oid], n:lng, asc:bit, nilslast:bit, distinct:bit) (X_0:bat[:oid], 
X_1:bat[:oid]) ", "ALGfirstn;",   "Calculate first N values of B with candidate 
list S"   ]
+[ "algebra",   "firstn",       "pattern algebra.firstn(b:bat[:any], 
s:bat[:oid], n:lng, asc:bit, nilslast:bit, distinct:bit):bat[:oid] ",      
"ALGfirstn;",   "Calculate first N values of B with candidate list S"   ]
 [ "algebra",   "groupby",      "command algebra.groupby(gids:bat[:oid], 
cnts:bat[:lng]):bat[:oid] ",   "ALGgroupby;",  "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."     ]
 [ "algebra",   "ilike",        "command algebra.ilike(s:str, pat:str):bit ",   
"PCREilike2;",  ""      ]
 [ "algebra",   "ilike",        "command algebra.ilike(s:str, pat:str, 
esc:str):bit ",  "PCREilike3;",  ""      ]
@@ -673,15 +673,15 @@ Ready.
 [ "algebra",   "slice",        "command algebra.slice(b:bat[:any_1], x:int, 
y:int):bat[:any_1] ",      "ALGslice_int;",        "Return the slice with the 
BUNs at position x till y."  ]
 [ "algebra",   "slice",        "command algebra.slice(b:bat[:any_1], x:lng, 
y:lng):bat[:any_1] ",      "ALGslice_lng;",        "Return the slice with the 
BUNs at position x till y."  ]
 [ "algebra",   "slice",        "command algebra.slice(b:bat[:any_1], x:oid, 
y:oid):bat[:any_1] ",      "ALGslice_oid;",        "Return the slice based on 
head oid x till y (exclusive)."      ]
-[ "algebra",   "sort", "command algebra.sort(b:bat[:any_1], reverse:bit, 
stable:bit):bat[:any_1] ",    "ALGsort11;",   "Returns a copy of the BAT sorted 
on tail values.\n         The input and output are (must be) dense headed.\n    
     The order is descending if the reverse bit is set.\n\t\t This is a stable 
sort if the stable bit is set."        ]
-[ "algebra",   "sort", "command algebra.sort(b:bat[:any_1], reverse:bit, 
stable:bit) (X_0:bat[:any_1], X_1:bat[:oid]) ",       "ALGsort12;",   "Returns 
a copy of the BAT sorted on tail values and a BAT that\n         specifies how 
the input was reordered.\n         The input and output are (must be) dense 
headed.\n         The order is descending if the reverse bit is set.\n\t\t This 
is a stable sort if the stable bit is set." ]
-[ "algebra",   "sort", "command algebra.sort(b:bat[:any_1], reverse:bit, 
stable:bit) (X_0:bat[:any_1], X_1:bat[:oid], X_2:bat[:oid]) ",        
"ALGsort13;",   "Returns a copy of the BAT sorted on tail values, a BAT that 
specifies\n         how the input was reordered, and a BAT with group 
information.\n         The input and output are (must be) dense headed.\n       
  The order is descending if the reverse bit is set.\n\t\t This is a stable 
sort if the stable bit is set."  ]
-[ "algebra",   "sort", "command algebra.sort(b:bat[:any_1], o:bat[:oid], 
reverse:bit, stable:bit):bat[:any_1] ",       "ALGsort21;",   "Returns a copy 
of the BAT sorted on tail values.\n         The input and output are (must be) 
dense headed.\n         The order is descending if the reverse bit is 
set.\n\t\t This is a stable sort if the stable bit is set."        ]
-[ "algebra",   "sort", "command algebra.sort(b:bat[:any_1], o:bat[:oid], 
reverse:bit, stable:bit) (X_0:bat[:any_1], X_1:bat[:oid]) ",  "ALGsort22;",   
"Returns a copy of the BAT sorted on tail values and a BAT that\n         
specifies how the input was reordered.\n         The input and output are (must 
be) dense headed.\n         The order is descending if the reverse bit is 
set.\n\t\t This is a stable sort if the stable bit is set." ]
-[ "algebra",   "sort", "command algebra.sort(b:bat[:any_1], o:bat[:oid], 
reverse:bit, stable:bit) (X_0:bat[:any_1], X_1:bat[:oid], X_2:bat[:oid]) ",   
"ALGsort23;",   "Returns a copy of the BAT sorted on tail values, a BAT that 
specifies\n         how the input was reordered, and a BAT with group 
information.\n         The input and output are (must be) dense headed.\n       
  The order is descending if the reverse bit is set.\n\t\t This is a stable 
sort if the stable bit is set."  ]
-[ "algebra",   "sort", "command algebra.sort(b:bat[:any_1], o:bat[:oid], 
g:bat[:oid], reverse:bit, stable:bit):bat[:any_1] ",  "ALGsort31;",   "Returns 
a copy of the BAT sorted on tail values.\n         The input and output are 
(must be) dense headed.\n         The order is descending if the reverse bit is 
set.\n\t\t This is a stable sort if the stable bit is set."        ]
-[ "algebra",   "sort", "command algebra.sort(b:bat[:any_1], o:bat[:oid], 
g:bat[:oid], reverse:bit, stable:bit) (X_0:bat[:any_1], X_1:bat[:oid]) ",     
"ALGsort32;",   "Returns a copy of the BAT sorted on tail values and a BAT 
that\n         specifies how the input was reordered.\n         The input and 
output are (must be) dense headed.\n         The order is descending if the 
reverse bit is set.\n\t\t This is a stable sort if the stable bit is set." ]
-[ "algebra",   "sort", "command algebra.sort(b:bat[:any_1], o:bat[:oid], 
g:bat[:oid], reverse:bit, stable:bit) (X_0:bat[:any_1], X_1:bat[:oid], 
X_2:bat[:oid]) ",      "ALGsort33;",   "Returns a copy of the BAT sorted on 
tail values, a BAT that specifies\n         how the input was reordered, and a 
BAT with group information.\n         The input and output are (must be) dense 
headed.\n         The order is descending if the reverse bit is set.\n\t\t This 
is a stable sort if the stable bit is set."  ]
+[ "algebra",   "sort", "command algebra.sort(b:bat[:any_1], reverse:bit, 
nilslast:bit, stable:bit):bat[:any_1] ",      "ALGsort11;",   "Returns a copy 
of the BAT sorted on tail values.\n         The input and output are (must be) 
dense headed.\n         The order is descending if the reverse bit is 
set.\n\t\t This is a stable sort if the stable bit is set."        ]
+[ "algebra",   "sort", "command algebra.sort(b:bat[:any_1], reverse:bit, 
nilslast:bit, stable:bit) (X_0:bat[:any_1], X_1:bat[:oid]) ", "ALGsort12;",   
"Returns a copy of the BAT sorted on tail values and a BAT that\n         
specifies how the input was reordered.\n         The input and output are (must 
be) dense headed.\n         The order is descending if the reverse bit is 
set.\n\t\t This is a stable sort if the stable bit is set." ]
+[ "algebra",   "sort", "command algebra.sort(b:bat[:any_1], reverse:bit, 
nilslast:bit, stable:bit) (X_0:bat[:any_1], X_1:bat[:oid], X_2:bat[:oid]) ",  
"ALGsort13;",   "Returns a copy of the BAT sorted on tail values, a BAT that 
specifies\n         how the input was reordered, and a BAT with group 
information.\n         The input and output are (must be) dense headed.\n       
  The order is descending if the reverse bit is set.\n\t\t This is a stable 
sort if the stable bit is set."  ]
+[ "algebra",   "sort", "command algebra.sort(b:bat[:any_1], o:bat[:oid], 
reverse:bit, nilslast:bit, stable:bit):bat[:any_1] ", "ALGsort21;",   "Returns 
a copy of the BAT sorted on tail values.\n         The input and output are 
(must be) dense headed.\n         The order is descending if the reverse bit is 
set.\n\t\t This is a stable sort if the stable bit is set."        ]
+[ "algebra",   "sort", "command algebra.sort(b:bat[:any_1], o:bat[:oid], 
reverse:bit, nilslast:bit, stable:bit) (X_0:bat[:any_1], X_1:bat[:oid]) ",    
"ALGsort22;",   "Returns a copy of the BAT sorted on tail values and a BAT 
that\n         specifies how the input was reordered.\n         The input and 
output are (must be) dense headed.\n         The order is descending if the 
reverse bit is set.\n\t\t This is a stable sort if the stable bit is set." ]
+[ "algebra",   "sort", "command algebra.sort(b:bat[:any_1], o:bat[:oid], 
reverse:bit, nilslast:bit, stable:bit) (X_0:bat[:any_1], X_1:bat[:oid], 
X_2:bat[:oid]) ",     "ALGsort23;",   "Returns a copy of the BAT sorted on tail 
values, a BAT that specifies\n         how the input was reordered, and a BAT 
with group information.\n         The input and output are (must be) dense 
headed.\n         The order is descending if the reverse bit is set.\n\t\t This 
is a stable sort if the stable bit is set."  ]
+[ "algebra",   "sort", "command algebra.sort(b:bat[:any_1], o:bat[:oid], 
g:bat[:oid], reverse:bit, nilslast:bit, stable:bit):bat[:any_1] ",    
"ALGsort31;",   "Returns a copy of the BAT sorted on tail values.\n         The 
input and output are (must be) dense headed.\n         The order is descending 
if the reverse bit is set.\n\t\t This is a stable sort if the stable bit is 
set."        ]
+[ "algebra",   "sort", "command algebra.sort(b:bat[:any_1], o:bat[:oid], 
g:bat[:oid], reverse:bit, nilslast:bit, stable:bit) (X_0:bat[:any_1], 
X_1:bat[:oid]) ",       "ALGsort32;",   "Returns a copy of the BAT sorted on 
tail values and a BAT that\n         specifies how the input was reordered.\n   
      The input and output are (must be) dense headed.\n         The order is 
descending if the reverse bit is set.\n\t\t This is a stable sort if the stable 
bit is set." ]
+[ "algebra",   "sort", "command algebra.sort(b:bat[:any_1], o:bat[:oid], 
g:bat[:oid], reverse:bit, nilslast:bit, stable:bit) (X_0:bat[:any_1], 
X_1:bat[:oid], X_2:bat[:oid]) ",        "ALGsort33;",   "Returns a copy of the 
BAT sorted on tail values, a BAT that specifies\n         how the input was 
reordered, and a BAT with group information.\n         The input and output are 
(must be) dense headed.\n         The order is descending if the reverse bit is 
set.\n\t\t This is a stable sort if the stable bit is set."  ]
 [ "algebra",   "subslice",     "command algebra.subslice(b:bat[:any_1], x:lng, 
y:lng):bat[:oid] ",     "ALGsubslice_lng;",     "Return the oids of the slice 
with the BUNs at position x till y."      ]
 [ "algebra",   "thetajoin",    "command algebra.thetajoin(l:bat[:any_1], 
r:bat[:any_1], sl:bat[:oid], sr:bat[:oid], op:int, nil_matches:bit, 
estimate:lng) (X_0:bat[:oid], X_1:bat[:oid]) ",   "ALGthetajoin;",        
"Theta join with candidate lists"       ]
 [ "algebra",   "thetaselect",  "command algebra.thetaselect(b:bat[:any_1], 
val:any_1, op:str):bat[:oid] ",     "ALGthetaselect1;",     "Select all head 
values for which the tail value obeys the relation\n\tvalue OP VAL.\n\tInput is 
a dense-headed BAT, output is a dense-headed BAT with in\n\tthe tail the head 
value of the input BAT for which the\n\trelationship holds.  The output BAT is 
sorted on the tail value."        ]
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
@@ -726,15 +726,15 @@ str ALGslice(bat *ret, const bat *bid, c
 str ALGslice_int(bat *ret, const bat *bid, const int *start, const int *end);
 str ALGslice_lng(bat *ret, const bat *bid, const lng *start, const lng *end);
 str ALGslice_oid(bat *ret, const bat *bid, const oid *start, const oid *end);
-str ALGsort11(bat *result, const bat *bid, const bit *reverse, const bit 
*stable);
-str ALGsort12(bat *result, bat *norder, const bat *bid, const bit *reverse, 
const bit *stable);
-str ALGsort13(bat *result, bat *norder, bat *ngroup, const bat *bid, const bit 
*reverse, const bit *stable);
-str ALGsort21(bat *result, const bat *bid, const bat *order, const bit 
*reverse, const bit *stable);
-str ALGsort22(bat *result, bat *norder, const bat *bid, const bat *order, 
const bit *reverse, const bit *stable);
-str ALGsort23(bat *result, bat *norder, bat *ngroup, const bat *bid, const bat 
*order, const bit *reverse, const bit *stable);
-str ALGsort31(bat *result, const bat *bid, const bat *order, const bat *group, 
const bit *reverse, const bit *stable);
-str ALGsort32(bat *result, bat *norder, const bat *bid, const bat *order, 
const bat *group, const bit *reverse, const bit *stable);
-str ALGsort33(bat *result, bat *norder, bat *ngroup, const bat *bid, const bat 
*order, const bat *group, const bit *reverse, const bit *stable);
+str ALGsort11(bat *result, const bat *bid, const bit *reverse, const bit 
*nilslast, const bit *stable);
+str ALGsort12(bat *result, bat *norder, const bat *bid, const bit *reverse, 
const bit *nilslast, const bit *stable);
+str ALGsort13(bat *result, bat *norder, bat *ngroup, const bat *bid, const bit 
*reverse, const bit *nilslast, const bit *stable);
+str ALGsort21(bat *result, const bat *bid, const bat *order, const bit 
*reverse, const bit *nilslast, const bit *stable);
+str ALGsort22(bat *result, bat *norder, const bat *bid, const bat *order, 
const bit *reverse, const bit *nilslast, const bit *stable);
+str ALGsort23(bat *result, bat *norder, bat *ngroup, const bat *bid, const bat 
*order, const bit *reverse, const bit *nilslast, const bit *stable);
+str ALGsort31(bat *result, const bat *bid, const bat *order, const bat *group, 
const bit *reverse, const bit *nilslast, const bit *stable);
+str ALGsort32(bat *result, bat *norder, const bat *bid, const bat *order, 
const bat *group, const bit *reverse, const bit *nilslast, const bit *stable);
+str ALGsort33(bat *result, bat *norder, bat *ngroup, const bat *bid, const bat 
*order, const bat *group, const bit *reverse, const bit *nilslast, const bit 
*stable);
 str ALGstdev(dbl *res, const bat *bid);
 str ALGstdevp(dbl *res, const bat *bid);
 str ALGsubslice_lng(bat *ret, const bat *bid, const lng *start, const lng 
*end);
diff --git a/monetdb5/ChangeLog b/monetdb5/ChangeLog
--- a/monetdb5/ChangeLog
+++ b/monetdb5/ChangeLog
@@ -1,3 +1,11 @@
 # ChangeLog file for MonetDB5
 # This file is updated with Maddlog
 
+* Thu Nov  8 2018 Sjoerd Mullender <[email protected]>
+- The MAL functions algebra.sort and algebra.firstn now have a new,
+  extra second-to-last argument, nilslast:bit, which indicates where
+  NIL values are to be sorted: at the beginning, or at the end.  The old
+  behavior is when for algebra.sort, the value of nilslast is equal to
+  the value or the reverse:bit parameter, for algebra.firstn when the
+  value of nilslast is opposite to the value of the asc:bit parameter.
+
diff --git a/monetdb5/mal/Tests/tst1502.malC b/monetdb5/mal/Tests/tst1502.malC
--- a/monetdb5/mal/Tests/tst1502.malC
+++ b/monetdb5/mal/Tests/tst1502.malC
@@ -36,9 +36,9 @@
        bat.append(z,"c");
        bat.append(z,"a");
        io.print("sort x"); 
-       xs:=algebra.sort(x,false:bit,false:bit); 
+       xs:=algebra.sort(x,false:bit,false:bit,false:bit); 
        io.print(xs);
        io.print("hsort xrev"); 
-       xrev:=algebra.sort(x,true:bit,false:bit);
+       xrev:=algebra.sort(x,true:bit,true:bit,false:bit);
        io.print(xrev);
 
diff --git a/monetdb5/mal/Tests/tst233.malC b/monetdb5/mal/Tests/tst233.malC
--- a/monetdb5/mal/Tests/tst233.malC
+++ b/monetdb5/mal/Tests/tst233.malC
@@ -4,7 +4,7 @@ function dir():void;
        d:= bbp.getRefCount();
        dl:=bbp.getLRefCount();
        dn:= bbp.getNames();
-       ds:= algebra.sort(dn,false,false); 
+       ds:= algebra.sort(dn,false,false,false); 
        io.print(ds,d,dl);
 end dir;
 
diff --git a/monetdb5/mal/Tests/tst234.malC b/monetdb5/mal/Tests/tst234.malC
--- a/monetdb5/mal/Tests/tst234.malC
+++ b/monetdb5/mal/Tests/tst234.malC
@@ -4,7 +4,7 @@ function dir():void;
        d:= bbp.getRefCount();
        dl:=bbp.getLRefCount();
        dn:= bbp.getNames();
-       ds:= algebra.sort(dn,false,false);
+       ds:= algebra.sort(dn,false,false,false);
        io.print(ds,d,dl);
 end dir;
 
diff --git a/monetdb5/mal/Tests/tst235.malC b/monetdb5/mal/Tests/tst235.malC
--- a/monetdb5/mal/Tests/tst235.malC
+++ b/monetdb5/mal/Tests/tst235.malC
@@ -5,7 +5,7 @@ function dir():void;
        d:= bbp.getRefCount();
        dl:=bbp.getLRefCount();
        dn:= bbp.getNames();
-       ds:= algebra.sort(dn,false,false);
+       ds:= algebra.sort(dn,false,false,false);
        io.print(ds,d,dl);
 end dir;
 
diff --git a/monetdb5/mal/Tests/tst903.malC b/monetdb5/mal/Tests/tst903.malC
--- a/monetdb5/mal/Tests/tst903.malC
+++ b/monetdb5/mal/Tests/tst903.malC
@@ -111,7 +111,7 @@ io.printf("#select 1.0 %d",d0);
 cnt:= aggr.count(z9);
 io.printf(" count %d\n",cnt);
 t0:= alarm.usec();
-s:= algebra.sort(b,false,false);
+s:= algebra.sort(b,false,false,false);
 t1:= alarm.usec();
 d0:= t1-t0;
 io.printf("#head sort %d",d0);
diff --git a/monetdb5/mal/Tests/tst903.stable.out 
b/monetdb5/mal/Tests/tst903.stable.out
--- a/monetdb5/mal/Tests/tst903.stable.out
+++ b/monetdb5/mal/Tests/tst903.stable.out
@@ -130,7 +130,7 @@ exit i;
     cnt := aggr.count(z9);
     io.printf(" count %d\n", cnt);
     t0 := alarm.usec();
-    s := algebra.sort(b, false, false);
+    s := algebra.sort(b, false, false, false);
     t1 := alarm.usec();
     d0 := calc.-(t1, t0);
     io.printf("#head sort %d", d0);
diff --git a/monetdb5/modules/atoms/Tests/xml10.malC 
b/monetdb5/modules/atoms/Tests/xml10.malC
--- a/monetdb5/modules/atoms/Tests/xml10.malC
+++ b/monetdb5/modules/atoms/Tests/xml10.malC
@@ -40,7 +40,7 @@ bat.append(e,0);
 
 k:= algebra.projection(g,te);
 io.print(k);
-l:= algebra.sort(k,false,false);
+l:= algebra.sort(k,false,false,false);
 io.print(l);
 
 ag:= xml.subaggr(te,g,e,true);
diff --git a/monetdb5/modules/kernel/Tests/select.malC 
b/monetdb5/modules/kernel/Tests/select.malC
--- a/monetdb5/modules/kernel/Tests/select.malC
+++ b/monetdb5/modules/kernel/Tests/select.malC
@@ -10,8 +10,8 @@ bat.append(b, 3);
 bat.append(b, 2);
 bat.append(b, 1);
 bat.append(b, 4);
-s := algebra.sort(b, false, true);
-r := algebra.sort(b, true, true);
+s := algebra.sort(b, false, false, true);
+r := algebra.sort(b, true, true, true);
 bat.setAccess(b, "r");
 bat.setAccess(s, "r");
 bat.setAccess(r, "r");
@@ -21,247 +21,247 @@ bat.setAccess(r, "r");
 
 x := algebra.select(b, nil:bat[:oid], nil:int, nil:int, true, true, false);
 z := algebra.projection(x, b);
-z := algebra.sort(z, false, true);
+z := algebra.sort(z, false, false, true);
 io.print(z);                    # nil
 io.print("nil");
 x := algebra.select(b, nil:bat[:oid], nil:int, nil:int, true, false, false);
 z := algebra.projection(x, b);
-z := algebra.sort(z, false, true);
+z := algebra.sort(z, false, false, true);
 io.print(z);                    # 0,1,2,3,4,5,6,7,8,9
 io.print("0,1,2,3,4,5,6,7,8,9");
 x := algebra.select(b, nil:bat[:oid], nil:int, nil:int, false, true, false);
 z := algebra.projection(x, b);
-z := algebra.sort(z, false, true);
+z := algebra.sort(z, false, false, true);
 io.print(z);                    # 0,1,2,3,4,5,6,7,8,9
 io.print("0,1,2,3,4,5,6,7,8,9");
 x := algebra.select(b, nil:bat[:oid], nil:int, nil:int, false, false, false);
 z := algebra.projection(x, b);
-z := algebra.sort(z, false, true);
+z := algebra.sort(z, false, false, true);
 io.print(z);                    # 0,1,2,3,4,5,6,7,8,9
 io.print("0,1,2,3,4,5,6,7,8,9");
 x := algebra.select(b, nil:bat[:oid], nil:int, nil:int, true, true, true);
 z := algebra.projection(x, b);
-z := algebra.sort(z, false, true);
+z := algebra.sort(z, false, false, true);
 io.print(z);                    # 0,1,2,3,4,5,6,7,8,9
 io.print("0,1,2,3,4,5,6,7,8,9");
 x := algebra.select(b, nil:bat[:oid], nil:int, nil:int, true, false, true);
 z := algebra.projection(x, b);
-z := algebra.sort(z, false, true);
+z := algebra.sort(z, false, false, true);
 io.print(z);                    # nothing
 io.print("nothing");
 x := algebra.select(b, nil:bat[:oid], nil:int, nil:int, false, true, true);
 z := algebra.projection(x, b);
-z := algebra.sort(z, false, true);
+z := algebra.sort(z, false, false, true);
 io.print(z);                    # nothing
 io.print("nothing");
 x := algebra.select(b, nil:bat[:oid], nil:int, nil:int, false, false, true);
 z := algebra.projection(x, b);
-z := algebra.sort(z, false, true);
+z := algebra.sort(z, false, false, true);
 io.print(z);                    # nothing
 io.print("nothing");
 
 x := algebra.select(b, nil:bat[:oid], 4, nil:int, true, true, false);
 z := algebra.projection(x, b);
-z := algebra.sort(z, false, true);
+z := algebra.sort(z, false, false, true);
 io.print(z);                    # 4,5,6,7,8,9
 io.print("4,5,6,7,8,9");
 x := algebra.select(b, nil:bat[:oid], 4, nil:int, true, false, false);
 z := algebra.projection(x, b);
-z := algebra.sort(z, false, true);
+z := algebra.sort(z, false, false, true);
 io.print(z);                    # 4,5,6,7,8,9
_______________________________________________
checkin-list mailing list
[email protected]
https://www.monetdb.org/mailman/listinfo/checkin-list

Reply via email to