Changeset: 7157f1299a6b for MonetDB URL: http://dev.monetdb.org/hg/MonetDB?cmd=changeset;node=7157f1299a6b Added Files: sql/test/BugTracker-2017/Tests/null-quantile.Bug-6218.sql sql/test/BugTracker-2017/Tests/null-quantile.Bug-6218.stable.err sql/test/BugTracker-2017/Tests/null-quantile.Bug-6218.stable.out Modified Files: gdk/gdk_aggr.c sql/test/BugTracker-2017/Tests/All Branch: default Log Message:
Merge with Dec2016 branch. diffs (206 lines): diff --git a/gdk/gdk_aggr.c b/gdk/gdk_aggr.c --- a/gdk/gdk_aggr.c +++ b/gdk/gdk_aggr.c @@ -2482,24 +2482,22 @@ BATgroupquantile(BAT *b, BAT *g, BAT *e, assert(r < p); if ( p == q || grps[p] != prev) { BUN qindex; - if (skip_nils) { + if (skip_nils && !b->tnonil) { while (r < p && (*atomcmp)(BUNtail(bi, r), nil) == 0) r++; - if (r == p) - break; } - while (BATcount(bn) < prev - min) { - bunfastapp_nocheck(bn, BUNlast(bn), - nil, Tsize(bn)); + if (r == p) { + v = nil; nils++; + } else { + qindex = (BUN) (r + (p-r-1) * quantile); + /* be a little paranoid about the index */ + assert(qindex >= r); + assert(qindex < p); + v = BUNtail(bi, qindex); + nils += (*atomcmp)(v, nil) == 0; } - qindex = (BUN) (r + (p-r-1) * quantile); - /* be a little paranoid about the index */ - assert(qindex >= r); - assert(qindex < p); - v = BUNtail(bi, qindex); bunfastapp_nocheck(bn, BUNlast(bn), v, Tsize(bn)); - nils += (*atomcmp)(v, nil) == 0; r = p; if (p < q) diff --git a/sql/test/BugTracker-2017/Tests/All b/sql/test/BugTracker-2017/Tests/All --- a/sql/test/BugTracker-2017/Tests/All +++ b/sql/test/BugTracker-2017/Tests/All @@ -26,3 +26,4 @@ sqlsmith03 sqlsmith04 nested_with.Bug-6187 prepare.Bug-6133 +null-quantile.Bug-6218 diff --git a/sql/test/BugTracker-2017/Tests/null-quantile.Bug-6218.sql b/sql/test/BugTracker-2017/Tests/null-quantile.Bug-6218.sql new file mode 100644 --- /dev/null +++ b/sql/test/BugTracker-2017/Tests/null-quantile.Bug-6218.sql @@ -0,0 +1,15 @@ +start transaction; + +create table bug6218 (i int, j int); +copy 8 records into bug6218 from stdin; +0|0 +1|0 +NULL|1 +NULL|1 +0|2 +1|2 +2|0 +2|2 +select quantile(i,0.5),j from bug6218 group by j order by j; + +rollback; diff --git a/sql/test/BugTracker-2017/Tests/null-quantile.Bug-6218.stable.err b/sql/test/BugTracker-2017/Tests/null-quantile.Bug-6218.stable.err new file mode 100644 --- /dev/null +++ b/sql/test/BugTracker-2017/Tests/null-quantile.Bug-6218.stable.err @@ -0,0 +1,36 @@ +stderr of test 'null-quantile.Bug-6218` in directory 'sql/test/BugTracker-2017` itself: + + +# 12:42:35 > +# 12:42:35 > "mserver5" "--debug=10" "--set" "gdk_nr_threads=0" "--set" "mapi_open=true" "--set" "mapi_port=34225" "--set" "mapi_usock=/var/tmp/mtest-8842/.s.monetdb.34225" "--set" "monet_prompt=" "--forcemito" "--dbpath=/ufs/sjoerd/Monet-stable/var/MonetDB/mTests_sql_test_BugTracker-2017" "--set" "embedded_r=yes" "--set" "embedded_py=true" +# 12:42:35 > + +# builtin opt gdk_dbpath = /ufs/sjoerd/Monet-stable/var/monetdb5/dbfarm/demo +# builtin opt gdk_debug = 0 +# builtin opt gdk_vmtrim = no +# builtin opt monet_prompt = > +# builtin opt monet_daemon = no +# builtin opt mapi_port = 50000 +# builtin opt mapi_open = false +# builtin opt mapi_autosense = false +# builtin opt sql_optimizer = default_pipe +# builtin opt sql_debug = 0 +# cmdline opt gdk_nr_threads = 0 +# cmdline opt mapi_open = true +# cmdline opt mapi_port = 34225 +# cmdline opt mapi_usock = /var/tmp/mtest-8842/.s.monetdb.34225 +# cmdline opt monet_prompt = +# cmdline opt gdk_dbpath = /ufs/sjoerd/Monet-stable/var/MonetDB/mTests_sql_test_BugTracker-2017 +# cmdline opt embedded_r = yes +# cmdline opt embedded_py = true +# cmdline opt gdk_debug = 536870922 + +# 12:42:36 > +# 12:42:36 > "mclient" "-lsql" "-ftest" "-Eutf-8" "-i" "-e" "--host=/var/tmp/mtest-8842" "--port=34225" +# 12:42:36 > + + +# 12:42:37 > +# 12:42:37 > "Done." +# 12:42:37 > + diff --git a/sql/test/BugTracker-2017/Tests/null-quantile.Bug-6218.stable.out b/sql/test/BugTracker-2017/Tests/null-quantile.Bug-6218.stable.out new file mode 100644 --- /dev/null +++ b/sql/test/BugTracker-2017/Tests/null-quantile.Bug-6218.stable.out @@ -0,0 +1,94 @@ +stdout of test 'null-quantile.Bug-6218` in directory 'sql/test/BugTracker-2017` itself: + + +# 12:42:35 > +# 12:42:35 > "mserver5" "--debug=10" "--set" "gdk_nr_threads=0" "--set" "mapi_open=true" "--set" "mapi_port=34225" "--set" "mapi_usock=/var/tmp/mtest-8842/.s.monetdb.34225" "--set" "monet_prompt=" "--forcemito" "--dbpath=/ufs/sjoerd/Monet-stable/var/MonetDB/mTests_sql_test_BugTracker-2017" "--set" "embedded_r=yes" "--set" "embedded_py=true" +# 12:42:35 > + +# MonetDB 5 server v11.25.8 (hg id: 3cf2a50256d9+) +# This is an unreleased version +# Serving database 'mTests_sql_test_BugTracker-2017', using 8 threads +# Compiled for x86_64-unknown-linux-gnu/64bit with 128bit integers +# Found 15.589 GiB available main-memory. +# Copyright (c) 1993-July 2008 CWI. +# Copyright (c) August 2008-2017 MonetDB B.V., all rights reserved +# Visit http://www.monetdb.org/ for further information +# Listening for connection requests on mapi:monetdb://madrid.da.cwi.nl:34225/ +# Listening for UNIX domain connection requests on mapi:monetdb:///var/tmp/mtest-8842/.s.monetdb.34225 +# MonetDB/GIS module loaded +# MonetDB/SQL module loaded +# MonetDB/Python module loaded +# MonetDB/R module loaded + +Ready. +# SQL catalog created, loading sql scripts once +# loading sql script: 09_like.sql +# loading sql script: 10_math.sql +# loading sql script: 11_times.sql +# loading sql script: 12_url.sql +# loading sql script: 13_date.sql +# loading sql script: 14_inet.sql +# loading sql script: 15_querylog.sql +# loading sql script: 16_tracelog.sql +# loading sql script: 17_temporal.sql +# loading sql script: 18_index.sql +# loading sql script: 20_vacuum.sql +# loading sql script: 21_dependency_functions.sql +# loading sql script: 22_clients.sql +# loading sql script: 23_skyserver.sql +# loading sql script: 25_debug.sql +# loading sql script: 26_sysmon.sql +# loading sql script: 27_rejects.sql +# loading sql script: 39_analytics.sql +# loading sql script: 39_analytics_hge.sql +# loading sql script: 40_geom.sql +# loading sql script: 40_json.sql +# loading sql script: 40_json_hge.sql +# loading sql script: 41_md5sum.sql +# loading sql script: 45_uuid.sql +# loading sql script: 46_gsl.sql +# loading sql script: 46_profiler.sql +# loading sql script: 51_sys_schema_extension.sql +# loading sql script: 72_fits.sql +# loading sql script: 74_netcdf.sql +# loading sql script: 75_lidar.sql +# loading sql script: 75_shp.sql +# loading sql script: 75_storagemodel.sql +# loading sql script: 80_statistics.sql +# loading sql script: 80_udf.sql +# loading sql script: 80_udf_hge.sql +# loading sql script: 85_bam.sql +# loading sql script: 90_generator.sql +# loading sql script: 90_generator_hge.sql +# loading sql script: 99_system.sql + +# 12:42:36 > +# 12:42:36 > "mclient" "-lsql" "-ftest" "-Eutf-8" "-i" "-e" "--host=/var/tmp/mtest-8842" "--port=34225" +# 12:42:36 > + +#start transaction; +#create table bug6218 (i int, j int); +#copy 8 records into bug6218 from stdin; +#0|0 +#1|0 +#NULL|1 +#NULL|1 +#0|2 +#1|2 +#2|0 +#2|2 +[ 8 ] +#select quantile(i,0.5),j from bug6218 group by j order by j; +% sys.L3, sys.bug6218 # table_name +% L2, j # name +% int, int # type +% 1, 1 # length +[ 1, 0 ] +[ NULL, 1 ] +[ 1, 2 ] +#rollback; + +# 12:42:37 > +# 12:42:37 > "Done." +# 12:42:37 > + _______________________________________________ checkin-list mailing list checkin-list@monetdb.org https://www.monetdb.org/mailman/listinfo/checkin-list