Changeset: 4da4871b6315 for MonetDB
URL: https://dev.monetdb.org/hg/MonetDB?cmd=changeset;node=4da4871b6315
Added Files:
        
sql/test/BugTracker-2018/Tests/sqlitelogictest-coalesce-division-by-zero.Bug-6556.stable.out.int128
        
sql/test/BugTracker-2018/Tests/sqlitelogictest-count-coalesce-nullif.Bug-6586.stable.out.int128
        
sql/test/BugTracker-2018/Tests/sqlitelogictest-select-nullif-case.Bug-6579.stable.out.int128
Removed Files:
        
sql/test/BugTracker-2008/Tests/auto_coersion_bug.SF-2075157.stable.out.int128
Modified Files:
        clients/Tests/MAL-signatures.stable.out
        clients/Tests/MAL-signatures.stable.out.int128
        clients/Tests/exports.stable.out
        monetdb5/modules/kernel/aggr.c
        monetdb5/modules/kernel/aggr.mal
        monetdb5/modules/kernel/aggr.mal.sh
        sql/common/sql_types.c
        sql/common/sql_types.h
        sql/test/BugTracker-2008/Tests/auto_coersion_bug.SF-2075157.sql
        sql/test/BugTracker-2008/Tests/auto_coersion_bug.SF-2075157.stable.out
        
sql/test/BugTracker-2018/Tests/sqlitelogictest-aritmetic-expressions-handling.Bug-6576.stable.out
        
sql/test/BugTracker-2018/Tests/sqlitelogictest-coalesce-division-by-zero.Bug-6556.stable.out
        
sql/test/BugTracker-2018/Tests/sqlitelogictest-count-coalesce-nullif.Bug-6586.stable.out
        
sql/test/BugTracker-2018/Tests/sqlitelogictest-select-nullif-case.Bug-6579.stable.out
        sql/test/emptydb/Tests/check.stable.out
        sql/test/emptydb/Tests/check.stable.out.32bit
        sql/test/emptydb/Tests/check.stable.out.int128
Branch: remote_auth
Log Message:

Merge with default


diffs (truncated from 2613 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
@@ -103,8 +103,7 @@ Ready.
 [ "aggr",      "jsonaggr",     "command aggr.jsonaggr(val:bat[:str]):str ",    
"JSONgroupStr;",        "Aggregate the string values to array." ]
 [ "aggr",      "max",  "command aggr.max(b:bat[:any_1], g:bat[:oid], 
e:bat[:any_2]):bat[:any_1] ",     "AGGRmax3;",    ""      ]
 [ "aggr",      "max",  "command aggr.max(b:bat[:any_2]):any_2 ",       
"ALGmaxany;",   "Return the highest tail value or nil." ]
-[ "aggr",      "median",       "function aggr.median(b:bat[:any_1]):any_1;",   
"",     ""      ]
-[ "aggr",      "median",       "command aggr.median(b:bat[:any_1], 
g:bat[:oid], e:bat[:any_2]):bat[:any_1] ",  "AGGRmedian3;", "Grouped median 
aggregate"      ]
+[ "aggr",      "median",       "command aggr.median(b:bat[:any_1]):any_1 ",    
"AGGRmedian;",  "Median aggregate"      ]
 [ "aggr",      "min",  "command aggr.min(b:bat[:any_1], g:bat[:oid], 
e:bat[:any_2]):bat[:any_1] ",     "AGGRmin3;",    ""      ]
 [ "aggr",      "min",  "command aggr.min(b:bat[:any_2]):any_2 ",       
"ALGminany;",   "Return the lowest tail value or nil."  ]
 [ "aggr",      "prod", "command aggr.prod(b:bat[:bte], g:bat[:oid], 
e:bat[:any_1]):bat[:bte] ",        "AGGRprod3_bte;",       "Grouped tail 
product on bte"   ]
@@ -188,8 +187,7 @@ Ready.
 [ "aggr",      "prod", "pattern aggr.prod(b:bat[:sht], s:bat[:oid], 
nil_if_empty:bit):int ",   "CMDBATprod;",  "Calculate aggregate product of B 
with candidate list." ]
 [ "aggr",      "prod", "pattern aggr.prod(b:bat[:sht], s:bat[:oid], 
nil_if_empty:bit):lng ",   "CMDBATprod;",  "Calculate aggregate product of B 
with candidate list." ]
 [ "aggr",      "prod", "pattern aggr.prod(b:bat[:sht], s:bat[:oid], 
nil_if_empty:bit):sht ",   "CMDBATprod;",  "Calculate aggregate product of B 
with candidate list." ]
-[ "aggr",      "quantile",     "function aggr.quantile(b:bat[:any_1], 
q:bat[:dbl]):any_1;",    "",     ""      ]
-[ "aggr",      "quantile",     "command aggr.quantile(b:bat[:any_1], 
g:bat[:oid], e:bat[:any_2], q:bat[:dbl]):bat[:any_1] ",   "AGGRquantile3;",     
  "Grouped quantile aggregate"    ]
+[ "aggr",      "quantile",     "command aggr.quantile(b:bat[:any_1], 
q:bat[:dbl]):any_1 ",     "AGGRquantile;",        "Quantile aggregate"    ]
 [ "aggr",      "stdev",        "command aggr.stdev(b:bat[:bte], g:bat[:oid], 
e:bat[:any_1]):bat[:dbl] ",       "AGGRstdev3_dbl;",      "Grouped tail 
standard deviation (sample/non-biased) on bte"    ]
 [ "aggr",      "stdev",        "command aggr.stdev(b:bat[:dbl], g:bat[:oid], 
e:bat[:any_1]):bat[:dbl] ",       "AGGRstdev3_dbl;",      "Grouped tail 
standard deviation (sample/non-biased) on dbl"    ]
 [ "aggr",      "stdev",        "command aggr.stdev(b:bat[:flt], g:bat[:oid], 
e:bat[:any_1]):bat[:dbl] ",       "AGGRstdev3_dbl;",      "Grouped tail 
standard deviation (sample/non-biased) on flt"    ]
@@ -260,7 +258,6 @@ Ready.
 [ "aggr",      "submax",       "command aggr.submax(b:bat[:any_1], 
g:bat[:oid], e:bat[:any_2], skip_nils:bit):bat[:any_1] ",   "AGGRsubmax_val;",  
    "Grouped maximum aggregate"     ]
 [ "aggr",      "submax",       "command aggr.submax(b:bat[:any_1], 
g:bat[:oid], e:bat[:any_2], s:bat[:oid], skip_nils:bit):bat[:oid] ",        
"AGGRsubmaxcand;",      "Grouped maximum aggregate with candidates list"        
]
 [ "aggr",      "submax",       "command aggr.submax(b:bat[:any_1], 
g:bat[:oid], e:bat[:any_2], s:bat[:oid], skip_nils:bit):bat[:any_1] ",      
"AGGRsubmaxcand_val;",  "Grouped maximum aggregate with candidates list"        
]
-[ "aggr",      "submedian",    "command aggr.submedian(b:bat[:any_1], 
skip_nils:bit):bat[:any_1] ",    "AGGRmedian;",  "Median aggregate"      ]
 [ "aggr",      "submedian",    "command aggr.submedian(b:bat[:any_1], 
g:bat[:oid], e:bat[:any_2], skip_nils:bit):bat[:any_1] ",        
"AGGRsubmedian;",       "Grouped median aggregate"      ]
 [ "aggr",      "submedian",    "command aggr.submedian(b:bat[:any_1], 
g:bat[:oid], e:bat[:any_2], s:bat[:oid], skip_nils:bit):bat[:any_1] ",   
"AGGRsubmediancand;",   "Grouped median aggregate with candidate list"  ]
 [ "aggr",      "submin",       "command aggr.submin(b:bat[:any_1], 
g:bat[:oid], e:bat[:any_2], skip_nils:bit):bat[:oid] ",     "AGGRsubmin;",  
"Grouped minimum aggregate"     ]
@@ -293,9 +290,8 @@ Ready.
 [ "aggr",      "subprod",      "command aggr.subprod(b:bat[:sht], g:bat[:oid], 
e:bat[:any_1], s:bat[:oid], skip_nils:bit, abort_on_error:bit):bat[:lng] ",     
"AGGRsubprodcand_lng;", "Grouped product aggregate with candidates list"        
]
 [ "aggr",      "subprod",      "command aggr.subprod(b:bat[:bte], g:bat[:oid], 
e:bat[:any_1], s:bat[:oid], skip_nils:bit, abort_on_error:bit):bat[:sht] ",     
"AGGRsubprodcand_sht;", "Grouped product aggregate with candidates list"        
]
 [ "aggr",      "subprod",      "command aggr.subprod(b:bat[:sht], g:bat[:oid], 
e:bat[:any_1], s:bat[:oid], skip_nils:bit, abort_on_error:bit):bat[:sht] ",     
"AGGRsubprodcand_sht;", "Grouped product aggregate with candidates list"        
]
-[ "aggr",      "subquantile",  "command aggr.subquantile(b:bat[:any_1], 
q:bat[:dbl], skip_nils:bit):bat[:any_1] ",     "AGGRquantile;",        
"Quantile aggregate"    ]
 [ "aggr",      "subquantile",  "command aggr.subquantile(b:bat[:any_1], 
q:bat[:dbl], g:bat[:oid], e:bat[:any_2], skip_nils:bit):bat[:any_1] ", 
"AGGRsubquantile;",     "Grouped quantile aggregate"    ]
-[ "aggr",      "subquantile",  "command aggr.subquantile(b:bat[:any_1], 
q:bat[:dbl], g:bat[:oid], e:bat[:any_2], s:bat[:oid], 
skip_nils:bit):bat[:any_1] ",    "AGGRsubquantilecand;", "Grouped median 
quantile with candidate list"   ]
+[ "aggr",      "subquantile",  "command aggr.subquantile(b:bat[:any_1], 
q:bat[:dbl], g:bat[:oid], e:bat[:any_2], s:bat[:oid], 
skip_nils:bit):bat[:any_1] ",    "AGGRsubquantilecand;", "Grouped quantile 
aggregate with candidate list"        ]
 [ "aggr",      "substdev",     "command aggr.substdev(b:bat[:bte], 
g:bat[:oid], e:bat[:any_1], skip_nils:bit, abort_on_error:bit):bat[:dbl] ", 
"AGGRsubstdev_dbl;",    "Grouped standard deviation (sample/non-biased) 
aggregate"      ]
 [ "aggr",      "substdev",     "command aggr.substdev(b:bat[:dbl], 
g:bat[:oid], e:bat[:any_1], skip_nils:bit, abort_on_error:bit):bat[:dbl] ", 
"AGGRsubstdev_dbl;",    "Grouped standard deviation (sample/non-biased) 
aggregate"      ]
 [ "aggr",      "substdev",     "command aggr.substdev(b:bat[:flt], 
g:bat[:oid], e:bat[:any_1], skip_nils:bit, abort_on_error:bit):bat[:dbl] ", 
"AGGRsubstdev_dbl;",    "Grouped standard deviation (sample/non-biased) 
aggregate"      ]
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
@@ -111,8 +111,7 @@ Ready.
 [ "aggr",      "jsonaggr",     "command aggr.jsonaggr(val:bat[:str]):str ",    
"JSONgroupStr;",        "Aggregate the string values to array." ]
 [ "aggr",      "max",  "command aggr.max(b:bat[:any_1], g:bat[:oid], 
e:bat[:any_2]):bat[:any_1] ",     "AGGRmax3;",    ""      ]
 [ "aggr",      "max",  "command aggr.max(b:bat[:any_2]):any_2 ",       
"ALGmaxany;",   "Return the highest tail value or nil." ]
-[ "aggr",      "median",       "function aggr.median(b:bat[:any_1]):any_1;",   
"",     ""      ]
-[ "aggr",      "median",       "command aggr.median(b:bat[:any_1], 
g:bat[:oid], e:bat[:any_2]):bat[:any_1] ",  "AGGRmedian3;", "Grouped median 
aggregate"      ]
+[ "aggr",      "median",       "command aggr.median(b:bat[:any_1]):any_1 ",    
"AGGRmedian;",  "Median aggregate"      ]
 [ "aggr",      "min",  "command aggr.min(b:bat[:any_1], g:bat[:oid], 
e:bat[:any_2]):bat[:any_1] ",     "AGGRmin3;",    ""      ]
 [ "aggr",      "min",  "command aggr.min(b:bat[:any_2]):any_2 ",       
"ALGminany;",   "Return the lowest tail value or nil."  ]
 [ "aggr",      "prod", "command aggr.prod(b:bat[:bte], g:bat[:oid], 
e:bat[:any_1]):bat[:bte] ",        "AGGRprod3_bte;",       "Grouped tail 
product on bte"   ]
@@ -225,8 +224,7 @@ Ready.
 [ "aggr",      "prod", "pattern aggr.prod(b:bat[:sht], s:bat[:oid], 
nil_if_empty:bit):int ",   "CMDBATprod;",  "Calculate aggregate product of B 
with candidate list." ]
 [ "aggr",      "prod", "pattern aggr.prod(b:bat[:sht], s:bat[:oid], 
nil_if_empty:bit):lng ",   "CMDBATprod;",  "Calculate aggregate product of B 
with candidate list." ]
 [ "aggr",      "prod", "pattern aggr.prod(b:bat[:sht], s:bat[:oid], 
nil_if_empty:bit):sht ",   "CMDBATprod;",  "Calculate aggregate product of B 
with candidate list." ]
-[ "aggr",      "quantile",     "function aggr.quantile(b:bat[:any_1], 
q:bat[:dbl]):any_1;",    "",     ""      ]
-[ "aggr",      "quantile",     "command aggr.quantile(b:bat[:any_1], 
g:bat[:oid], e:bat[:any_2], q:bat[:dbl]):bat[:any_1] ",   "AGGRquantile3;",     
  "Grouped quantile aggregate"    ]
+[ "aggr",      "quantile",     "command aggr.quantile(b:bat[:any_1], 
q:bat[:dbl]):any_1 ",     "AGGRquantile;",        "Quantile aggregate"    ]
 [ "aggr",      "stdev",        "command aggr.stdev(b:bat[:bte], g:bat[:oid], 
e:bat[:any_1]):bat[:dbl] ",       "AGGRstdev3_dbl;",      "Grouped tail 
standard deviation (sample/non-biased) on bte"    ]
 [ "aggr",      "stdev",        "command aggr.stdev(b:bat[:dbl], g:bat[:oid], 
e:bat[:any_1]):bat[:dbl] ",       "AGGRstdev3_dbl;",      "Grouped tail 
standard deviation (sample/non-biased) on dbl"    ]
 [ "aggr",      "stdev",        "command aggr.stdev(b:bat[:flt], g:bat[:oid], 
e:bat[:any_1]):bat[:dbl] ",       "AGGRstdev3_dbl;",      "Grouped tail 
standard deviation (sample/non-biased) on flt"    ]
@@ -305,7 +303,6 @@ Ready.
 [ "aggr",      "submax",       "command aggr.submax(b:bat[:any_1], 
g:bat[:oid], e:bat[:any_2], skip_nils:bit):bat[:any_1] ",   "AGGRsubmax_val;",  
    "Grouped maximum aggregate"     ]
 [ "aggr",      "submax",       "command aggr.submax(b:bat[:any_1], 
g:bat[:oid], e:bat[:any_2], s:bat[:oid], skip_nils:bit):bat[:oid] ",        
"AGGRsubmaxcand;",      "Grouped maximum aggregate with candidates list"        
]
 [ "aggr",      "submax",       "command aggr.submax(b:bat[:any_1], 
g:bat[:oid], e:bat[:any_2], s:bat[:oid], skip_nils:bit):bat[:any_1] ",      
"AGGRsubmaxcand_val;",  "Grouped maximum aggregate with candidates list"        
]
-[ "aggr",      "submedian",    "command aggr.submedian(b:bat[:any_1], 
skip_nils:bit):bat[:any_1] ",    "AGGRmedian;",  "Median aggregate"      ]
 [ "aggr",      "submedian",    "command aggr.submedian(b:bat[:any_1], 
g:bat[:oid], e:bat[:any_2], skip_nils:bit):bat[:any_1] ",        
"AGGRsubmedian;",       "Grouped median aggregate"      ]
 [ "aggr",      "submedian",    "command aggr.submedian(b:bat[:any_1], 
g:bat[:oid], e:bat[:any_2], s:bat[:oid], skip_nils:bit):bat[:any_1] ",   
"AGGRsubmediancand;",   "Grouped median aggregate with candidate list"  ]
 [ "aggr",      "submin",       "command aggr.submin(b:bat[:any_1], 
g:bat[:oid], e:bat[:any_2], skip_nils:bit):bat[:oid] ",     "AGGRsubmin;",  
"Grouped minimum aggregate"     ]
@@ -348,9 +345,8 @@ Ready.
 [ "aggr",      "subprod",      "command aggr.subprod(b:bat[:sht], g:bat[:oid], 
e:bat[:any_1], s:bat[:oid], skip_nils:bit, abort_on_error:bit):bat[:lng] ",     
"AGGRsubprodcand_lng;", "Grouped product aggregate with candidates list"        
]
 [ "aggr",      "subprod",      "command aggr.subprod(b:bat[:bte], g:bat[:oid], 
e:bat[:any_1], s:bat[:oid], skip_nils:bit, abort_on_error:bit):bat[:sht] ",     
"AGGRsubprodcand_sht;", "Grouped product aggregate with candidates list"        
]
 [ "aggr",      "subprod",      "command aggr.subprod(b:bat[:sht], g:bat[:oid], 
e:bat[:any_1], s:bat[:oid], skip_nils:bit, abort_on_error:bit):bat[:sht] ",     
"AGGRsubprodcand_sht;", "Grouped product aggregate with candidates list"        
]
-[ "aggr",      "subquantile",  "command aggr.subquantile(b:bat[:any_1], 
q:bat[:dbl], skip_nils:bit):bat[:any_1] ",     "AGGRquantile;",        
"Quantile aggregate"    ]
 [ "aggr",      "subquantile",  "command aggr.subquantile(b:bat[:any_1], 
q:bat[:dbl], g:bat[:oid], e:bat[:any_2], skip_nils:bit):bat[:any_1] ", 
"AGGRsubquantile;",     "Grouped quantile aggregate"    ]
-[ "aggr",      "subquantile",  "command aggr.subquantile(b:bat[:any_1], 
q:bat[:dbl], g:bat[:oid], e:bat[:any_2], s:bat[:oid], 
skip_nils:bit):bat[:any_1] ",    "AGGRsubquantilecand;", "Grouped median 
quantile with candidate list"   ]
+[ "aggr",      "subquantile",  "command aggr.subquantile(b:bat[:any_1], 
q:bat[:dbl], g:bat[:oid], e:bat[:any_2], s:bat[:oid], 
skip_nils:bit):bat[:any_1] ",    "AGGRsubquantilecand;", "Grouped quantile 
aggregate with candidate list"        ]
 [ "aggr",      "substdev",     "command aggr.substdev(b:bat[:bte], 
g:bat[:oid], e:bat[:any_1], skip_nils:bit, abort_on_error:bit):bat[:dbl] ", 
"AGGRsubstdev_dbl;",    "Grouped standard deviation (sample/non-biased) 
aggregate"      ]
 [ "aggr",      "substdev",     "command aggr.substdev(b:bat[:dbl], 
g:bat[:oid], e:bat[:any_1], skip_nils:bit, abort_on_error:bit):bat[:dbl] ", 
"AGGRsubstdev_dbl;",    "Grouped standard deviation (sample/non-biased) 
aggregate"      ]
 [ "aggr",      "substdev",     "command aggr.substdev(b:bat[:flt], 
g:bat[:oid], e:bat[:any_1], skip_nils:bit, abort_on_error:bit):bat[:dbl] ", 
"AGGRsubstdev_dbl;",    "Grouped standard deviation (sample/non-biased) 
aggregate"      ]
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
@@ -593,8 +593,7 @@ str AGGRcount3(bat *retval, const bat *b
 str AGGRcount3nils(bat *retval, const bat *bid, const bat *gid, const bat 
*eid);
 str AGGRcount3nonils(bat *retval, const bat *bid, const bat *gid, const bat 
*eid);
 str AGGRmax3(bat *retval, const bat *bid, const bat *gid, const bat *eid);
-str AGGRmedian(bat *retval, const bat *bid, const bit *skip_nils);
-str AGGRmedian3(bat *retval, const bat *bid, const bat *gid, const bat *eid);
+str AGGRmedian(void *retval, const bat *bid);
 str AGGRmin3(bat *retval, const bat *bid, const bat *gid, const bat *eid);
 str AGGRprod3_bte(bat *retval, const bat *bid, const bat *gid, const bat *eid);
 str AGGRprod3_dbl(bat *retval, const bat *bid, const bat *gid, const bat *eid);
@@ -603,8 +602,7 @@ str AGGRprod3_hge(bat *retval, const bat
 str AGGRprod3_int(bat *retval, const bat *bid, const bat *gid, const bat *eid);
 str AGGRprod3_lng(bat *retval, const bat *bid, const bat *gid, const bat *eid);
 str AGGRprod3_sht(bat *retval, const bat *bid, const bat *gid, const bat *eid);
-str AGGRquantile(bat *retval, const bat *bid, const bat *quantile, const bit 
*skip_nils);
-str AGGRquantile3(bat *retval, const bat *bid, const bat *gid, const bat *eid, 
const bat *quantile);
+str AGGRquantile(void *retval, const bat *bid, const bat *qid);
 str AGGRstdev3_dbl(bat *retval, const bat *bid, const bat *gid, const bat 
*eid);
 str AGGRstdevp3_dbl(bat *retval, const bat *bid, const bat *gid, const bat 
*eid);
 str AGGRstr_group_concat(bat *retval, const bat *bid, const bat *gid, const 
bat *eid);
diff --git a/monetdb5/modules/kernel/aggr.c b/monetdb5/modules/kernel/aggr.c
--- a/monetdb5/modules/kernel/aggr.c
+++ b/monetdb5/modules/kernel/aggr.c
@@ -328,23 +328,6 @@ AGGRmax3(bat *retval, const bat *bid, co
        return err;
 }
 
-mal_export str AGGRmedian3(bat *retval, const bat *bid, const bat *gid, const 
bat *eid);
-str
-AGGRmedian3(bat *retval, const bat *bid, const bat *gid, const bat *eid)
-{
-       return AGGRgrouped(retval, NULL, bid, gid, eid, NULL, 0, 1, TYPE_any,
-                                          BATgroupmedian, NULL, NULL, NULL, 
"aggr.median");
-}
-
-mal_export str AGGRquantile3(bat *retval, const bat *bid, const bat *gid, 
const bat *eid, const bat *quantile);
-str
-AGGRquantile3(bat *retval, const bat *bid, const bat *gid, const bat *eid, 
const bat *quantile)
-{
-       return AGGRgrouped(retval, NULL, bid, gid, eid, NULL, 0, 1, TYPE_any,
-                                          NULL, NULL, BATgroupquantile, 
quantile,
-                                          "aggr.quantile");
-}
-
 mal_export str AGGRsubsum_bte(bat *retval, const bat *bid, const bat *gid, 
const bat *eid, const bit *skip_nils, const bit *abort_on_error);
 str
 AGGRsubsum_bte(bat *retval, const bat *bid, const bat *gid, const bat *eid, 
const bit *skip_nils, const bit *abort_on_error)
@@ -817,13 +800,20 @@ AGGRsubmax_val(bat *retval, const bat *b
        return AGGRsubmaxcand_val(retval, bid, gid, eid, NULL, skip_nils);
 }
 
-mal_export str AGGRmedian(bat *retval, const bat *bid, const bit *skip_nils);
+mal_export str AGGRmedian(void *retval, const bat *bid);
 str
-AGGRmedian(bat *retval, const bat *bid, const bit *skip_nils)
+AGGRmedian(void *retval, const bat *bid)
 {
-       return AGGRgrouped(retval, NULL, bid, NULL, NULL, NULL, *skip_nils,
-                                          0, TYPE_any, BATgroupmedian, NULL,
-                                          NULL, NULL, "aggr.submedian");
+       str err;
+       bat rval;
+       if ((err = AGGRgrouped(&rval, NULL, bid, NULL, NULL, NULL, 1,
+                                                  0, TYPE_any, BATgroupmedian, 
NULL,
+                                                  NULL, NULL, 
"aggr.submedian")) == MAL_SUCCEED) {
+               oid pos = 0;
+               err = ALGfetchoid(retval, &rval, &pos);
+               BBPrelease(rval);
+       }
+       return err;
 }
 
 mal_export str AGGRsubmedian(bat *retval, const bat *bid, const bat *gid, 
const bat *eid, const bit *skip_nils);
@@ -845,13 +835,20 @@ AGGRsubmediancand(bat *retval, const bat
 }
 
 /* quantile functions, could make median functions obsolete completely */
-mal_export str AGGRquantile(bat *retval, const bat *bid, const bat *quantile, 
const bit *skip_nils);
+mal_export str AGGRquantile(void *retval, const bat *bid, const bat *qid);
 str
-AGGRquantile(bat *retval, const bat *bid, const bat *quantile, const bit 
*skip_nils)
+AGGRquantile(void *retval, const bat *bid, const bat *qid)
 {
-       return AGGRgrouped(retval, NULL, bid, NULL, NULL, NULL, *skip_nils,
-                                          0, TYPE_any, NULL, NULL, 
BATgroupquantile,
-                                          quantile, "aggr.subquantile");
+       str err;
+       bat rval;
+       if ((err = AGGRgrouped(&rval, NULL, bid, NULL, NULL, NULL, 1,
+                                                  0, TYPE_any, NULL, NULL, 
BATgroupquantile,
+                                                  qid, "aggr.subquantile")) == 
MAL_SUCCEED) {
+               oid pos = 0;
+               err = ALGfetchoid(retval, &rval, &pos);
+               BBPrelease(rval);
+       }
+       return err;
 }
 
 mal_export str AGGRsubquantile(bat *retval, const bat *bid, const bat 
*quantile, const bat *gid, const bat *eid, const bit *skip_nils);
diff --git a/monetdb5/modules/kernel/aggr.mal b/monetdb5/modules/kernel/aggr.mal
--- a/monetdb5/modules/kernel/aggr.mal
+++ b/monetdb5/modules/kernel/aggr.mal
@@ -859,16 +859,7 @@ address AGGRsubcountcand
 comment "Grouped count aggregate with candidates list";
 
 
-command median(b:bat[:any_1],g:bat[:oid],e:bat[:any_2]) :bat[:any_1]
-address AGGRmedian3
-comment "Grouped median aggregate";
-
-function median(b:bat[:any_1]) :any_1;
-       bn := submedian(b, true);
-       return algebra.fetch(bn, 0@0);
-end aggr.median;
-
-command submedian(b:bat[:any_1],skip_nils:bit) :bat[:any_1]
+command median(b:bat[:any_1]) :any_1
 address AGGRmedian
 comment "Median aggregate";
 
@@ -881,16 +872,7 @@ address AGGRsubmediancand
 comment "Grouped median aggregate with candidate list";
 
 
-command quantile(b:bat[:any_1],g:bat[:oid],e:bat[:any_2],q:bat[:dbl]) 
:bat[:any_1]
-address AGGRquantile3
-comment "Grouped quantile aggregate";
-
-function quantile(b:bat[:any_1],q:bat[:dbl]) :any_1;
-       bn := subquantile(b, q, true);
-       return algebra.fetch(bn, 0@0);
-end aggr.quantile;
-
-command subquantile(b:bat[:any_1],q:bat[:dbl],skip_nils:bit) :bat[:any_1]
+command quantile(b:bat[:any_1],q:bat[:dbl]) :any_1
 address AGGRquantile
 comment "Quantile aggregate";
 
@@ -900,7 +882,7 @@ comment "Grouped quantile aggregate";
 
 command 
subquantile(b:bat[:any_1],q:bat[:dbl],g:bat[:oid],e:bat[:any_2],s:bat[:oid],skip_nils:bit)
 :bat[:any_1]
 address AGGRsubquantilecand
-comment "Grouped median quantile with candidate list";
+comment "Grouped quantile aggregate with candidate list";
 
 command str_group_concat(b:bat[:str],g:bat[:oid],e:bat[:any_1]) :bat[:str]
 address AGGRstr_group_concat
diff --git a/monetdb5/modules/kernel/aggr.mal.sh 
b/monetdb5/modules/kernel/aggr.mal.sh
--- a/monetdb5/modules/kernel/aggr.mal.sh
+++ b/monetdb5/modules/kernel/aggr.mal.sh
@@ -215,16 +215,7 @@ address AGGRsubcountcand
 comment "Grouped count aggregate with candidates list";
 
 
-command median(b:bat[:any_1],g:bat[:oid],e:bat[:any_2]) :bat[:any_1]
-address AGGRmedian3
-comment "Grouped median aggregate";
-
-function median(b:bat[:any_1]) :any_1;
-       bn := submedian(b, true);
-       return algebra.fetch(bn, 0@0);
-end aggr.median;
-
-command submedian(b:bat[:any_1],skip_nils:bit) :bat[:any_1]
+command median(b:bat[:any_1]) :any_1
 address AGGRmedian
 comment "Median aggregate";
 
@@ -237,16 +228,7 @@ address AGGRsubmediancand
 comment "Grouped median aggregate with candidate list";
 
 
-command quantile(b:bat[:any_1],g:bat[:oid],e:bat[:any_2],q:bat[:dbl]) 
:bat[:any_1]
-address AGGRquantile3
-comment "Grouped quantile aggregate";
-
-function quantile(b:bat[:any_1],q:bat[:dbl]) :any_1;
-       bn := subquantile(b, q, true);
-       return algebra.fetch(bn, 0@0);
-end aggr.quantile;
-
-command subquantile(b:bat[:any_1],q:bat[:dbl],skip_nils:bit) :bat[:any_1]
+command quantile(b:bat[:any_1],q:bat[:dbl]) :any_1
 address AGGRquantile
 comment "Quantile aggregate";
 
@@ -256,7 +238,7 @@ comment "Grouped quantile aggregate";
 
 command 
subquantile(b:bat[:any_1],q:bat[:dbl],g:bat[:oid],e:bat[:any_2],s:bat[:oid],skip_nils:bit)
 :bat[:any_1]
 address AGGRsubquantilecand
-comment "Grouped median quantile with candidate list";
+comment "Grouped quantile aggregate with candidate list";
 
 EOF
 
diff --git a/sql/common/sql_types.c b/sql/common/sql_types.c
--- a/sql/common/sql_types.c
+++ b/sql/common/sql_types.c
@@ -998,6 +998,36 @@ sql_bind_func_(sql_allocator *sa, sql_sc
        return NULL;
 }
 
+static sql_subfunc *
+sql_bind_func_result_(sql_allocator *sa, sql_schema *s, const char *sqlfname, 
list *ops, sql_subtype *res)
+{
+       node *n = funcs->h;
+
+       for (; n; n = n->next) {
+               sql_func *f = n->data;
+               sql_arg *firstres = NULL;
+
+               if (!f->res && !IS_FILT(f))
+                       continue;
_______________________________________________
checkin-list mailing list
checkin-list@monetdb.org
https://www.monetdb.org/mailman/listinfo/checkin-list

Reply via email to