Update of /cvsroot/monetdb/sql/src/test/bugs/Tests
In directory sc8-pr-cvs16.sourceforge.net:/tmp/cvs-serv32491

Modified Files:
      Tag: SQL_2-24
        All 
Added Files:
      Tag: SQL_2-24
        rangejoin_optimize_bug.sql rangejoin_optimize_bug.stable.err 
        rangejoin_optimize_bug.stable.out 
Log Message:
test for a bug in the rangejoin 2 select rewriting.


--- NEW FILE: rangejoin_optimize_bug.stable.out ---
stdout of test 'rangejoin_optimize_bug` in directory 'src/test/bugs` itself:


# 20:37:35 >  
# 20:37:35 >   mserver5 
"--config=/ufs/niels/scratch/rc/Linux-x86_64/etc/monetdb5.conf" --debug=10 
--set 
"monet_mod_path=/ufs/niels/scratch/rc/Linux-x86_64/lib/MonetDB5:/ufs/niels/scratch/rc/Linux-x86_64/lib/MonetDB5/lib:/ufs/niels/scratch/rc/Linux-x86_64/lib/MonetDB5/bin"
 --set "gdk_dbfarm=/ufs/niels/scratch/rc/Linux-x86_64/var/MonetDB5/dbfarm" 
--set "sql_logdir=/ufs/niels/scratch/rc/Linux-x86_64/var/MonetDB5/sql_logs"  
--set mapi_open=true --set xrpc_open=true --set mapi_port=35943 --set 
xrpc_port=43120 --set monet_prompt= --trace  "--dbname=mTests_src_test_bugs" 
--set mal_listing=0 "--dbinit= include sql;" ; echo ; echo Over..
# 20:37:35 >  

# MonetDB server v5.6.0, based on kernel v1.24.0
# Serving database 'mTests_src_test_bugs'
# Compiled for x86_64-unknown-linux-gnu/64bit with 64bit OIDs dynamically linked
# Copyright (c) 1993-2008 CWI, all rights reserved
# Visit http://monetdb.cwi.nl/ for further information
# Listening for connection requests on mapi:monetdb://alf.ins.cwi.nl:35943/
# MonetDB/SQL module v2.24.0 loaded

Ready.
#function user.main():void;
#    clients.quit();
#end main;

Over..

# 20:37:35 >  
# 20:37:35 >  mclient -lsql -umonetdb -Pmonetdb --host=alf --port=35943 
# 20:37:35 >  

[ 89    ]
[ 49    ]
% sys.statistics # table_name
% count_ # name
% int # type
% 2 # length
[ 49    ]
% sys.statistics # table_name
% count_ # name
% int # type
% 2 # length
[ 49    ]
[ 49    ]
[ 49    ]
% sys.statistics # table_name
% count_ # name
% int # type
% 2 # length
[ 49    ]
[ 49    ]
% sys.statistics # table_name
% count_ # name
% int # type
% 1 # length
[ 0     ]
[ 49    ]
% sys.statistics # table_name
% count_ # name
% int # type
% 2 # length
[ 49    ]
% sys.statistics # table_name
% count_ # name
% int # type
% 2 # length
[ 49    ]

# 20:37:35 >  
# 20:37:35 >  Done.
# 20:37:35 >  


--- NEW FILE: rangejoin_optimize_bug.stable.err ---
stderr of test 'rangejoin_optimize_bug` in directory 'src/test/bugs` itself:


# 20:37:35 >  
# 20:37:35 >   mserver5 
"--config=/ufs/niels/scratch/rc/Linux-x86_64/etc/monetdb5.conf" --debug=10 
--set 
"monet_mod_path=/ufs/niels/scratch/rc/Linux-x86_64/lib/MonetDB5:/ufs/niels/scratch/rc/Linux-x86_64/lib/MonetDB5/lib:/ufs/niels/scratch/rc/Linux-x86_64/lib/MonetDB5/bin"
 --set "gdk_dbfarm=/ufs/niels/scratch/rc/Linux-x86_64/var/MonetDB5/dbfarm" 
--set "sql_logdir=/ufs/niels/scratch/rc/Linux-x86_64/var/MonetDB5/sql_logs"  
--set mapi_open=true --set xrpc_open=true --set mapi_port=35943 --set 
xrpc_port=43120 --set monet_prompt= --trace  "--dbname=mTests_src_test_bugs" 
--set mal_listing=0 "--dbinit= include sql;" ; echo ; echo Over..
# 20:37:35 >  

# builtin opt   gdk_arch = 64bitx86_64-unknown-linux-gnu
# builtin opt   gdk_version = 1.24.0
# builtin opt   monet_pid = 9401
# builtin opt   prefix = /ufs/niels/scratch/rc/Linux-x86_64
# builtin opt   exec_prefix = ${prefix}
# builtin opt   gdk_dbname = tst
# builtin opt   gdk_dbfarm = ${prefix}/var/MonetDB
# builtin opt   gdk_debug = 8
# builtin opt   gdk_mem_bigsize = 262144
# builtin opt   gdk_alloc_map = yes
# builtin opt   gdk_mem_pagebits = 14
# builtin opt   gdk_vmtrim = yes
# builtin opt   monet_admin = adm
# builtin opt   monet_prompt = >
# builtin opt   monet_welcome = yes
# builtin opt   monet_mod_path = 
${exec_prefix}/lib/MonetDB:${exec_prefix}/lib/bin
# builtin opt   monet_daemon = yes
# builtin opt   host = localhost
# builtin opt   mapi_port = 50000
# builtin opt   mapi_noheaders = no
# builtin opt   mapi_debug = 0
# builtin opt   mapi_clients = 2
# builtin opt   sql_debug = 0
# builtin opt   sql_logdir = ${prefix}/var/MonetDB/sql_logs
# builtin opt   xquery_logdir = ${prefix}/var/MonetDB/xquery_logs
# builtin opt   standoff_ns = http://monetdb.cwi.nl/standoff
# builtin opt   standoff_start = start
# builtin opt   standoff_end = end
# config opt    prefix = /ufs/niels/scratch/rc/Linux-x86_64
# config opt    config = ${prefix}/etc/monetdb5.conf
# config opt    prefix = /ufs/niels/scratch/rc/Linux-x86_64
# config opt    exec_prefix = ${prefix}
# config opt    gdk_dbfarm = ${prefix}/var/MonetDB5/dbfarm
# config opt    gdk_dbname = demo
# config opt    gdk_alloc_map = no
# config opt    gdk_embedded = no
# config opt    gdk_debug = 0
# config opt    monet_mod_path = 
${exec_prefix}/lib/MonetDB5:${exec_prefix}/lib/MonetDB5/lib:${exec_prefix}/lib/MonetDB5/bin
# config opt    monet_daemon = no
# config opt    monet_welcome = yes
# config opt    mero_msglog = ${prefix}/var/log/merovingian.log
# config opt    mero_errlog = ${prefix}/var/log/merovingian.log
# config opt    mero_timeinterval = 600
# config opt    mero_pidfile = ${prefix}/var/run/merovingian.pid
# config opt    mero_exittimeout = 7
# config opt    mero_doproxy = yes
# config opt    mero_discoveryttl = 600
# config opt    mal_init = ${exec_prefix}/lib/MonetDB5/mal_init.mal
# config opt    mal_listing = 15
# config opt    checkpoint_dir = ${prefix}/var/MonetDB5/chkpnt
# config opt    mapi_port = 50000
# config opt    mapi_open = false
# config opt    sql_debug = 0
# config opt    sql_logdir = ${prefix}/var/MonetDB5/sql_logs
# config opt    sql_init = ${exec_prefix}/lib/MonetDB5/sql_init.sql
# cmdline opt   config = /ufs/niels/scratch/rc/Linux-x86_64/etc/monetdb5.conf
# cmdline opt   monet_mod_path = 
/ufs/niels/scratch/rc/Linux-x86_64/lib/MonetDB5:/ufs/niels/scratch/rc/Linux-x86_64/lib/MonetDB5/lib:/ufs/niels/scratch/rc/Linux-x86_64/lib/MonetDB5/bin
# cmdline opt   gdk_dbfarm = 
/ufs/niels/scratch/rc/Linux-x86_64/var/MonetDB5/dbfarm
# cmdline opt   sql_logdir = 
/ufs/niels/scratch/rc/Linux-x86_64/var/MonetDB5/sql_logs
# cmdline opt   mapi_open = true
# cmdline opt   xrpc_open = true
# cmdline opt   mapi_port = 35943
# cmdline opt   xrpc_port = 43120
# cmdline opt   monet_prompt = 
# cmdline opt   gdk_dbname = mTests_src_test_bugs
# cmdline opt   mal_listing = 0
# cmdline opt   gdk_debug = 10
#warning: please don't forget to set your vault key!
#(see /ufs/niels/scratch/rc/Linux-x86_64/etc/monetdb5.conf)

# 20:37:35 >  
# 20:37:35 >  mclient -lsql -umonetdb -Pmonetdb --host=alf --port=35943 
# 20:37:35 >  


# 20:37:35 >  
# 20:37:35 >  Done.
# 20:37:35 >  


U All
Index: All
===================================================================
RCS file: /cvsroot/monetdb/sql/src/test/bugs/Tests/All,v
retrieving revision 1.112.2.7
retrieving revision 1.112.2.8
diff -u -d -r1.112.2.7 -r1.112.2.8
--- All 1 Jul 2008 15:06:37 -0000       1.112.2.7
+++ All 10 Jul 2008 18:49:55 -0000      1.112.2.8
@@ -93,3 +93,4 @@
 order_limit_offset_bug
 aggr_single_value
 reljoin_join2_bug
+rangejoin_optimize_bug

--- NEW FILE: rangejoin_optimize_bug.sql ---
create table inputStat ( "type" int, "time" int, "carid" int, "speed" int, 
"xway" int, "lane" int, "dir" int, "seg" int, "pos" int, "qid" int, "m_init" 
int, "m_end" int, "dow" int, "tod" int, "day2" int);

COPY 89 RECORDS INTO inputStat from STDIN USING DELIMITERS ',','\n';
0,0,110,27,0,0,1,11,62914,-1,-1,-1,-1,-1,-1
0,0,119,23,0,0,1,5,31306,-1,-1,-1,-1,-1,-1
0,1,123,23,0,0,1,87,464260,-1,-1,-1,-1,-1,-1
0,1,127,25,0,0,1,27,147439,-1,-1,-1,-1,-1,-1
0,2,132,28,0,0,1,37,200156,-1,-1,-1,-1,-1,-1
0,2,141,34,0,0,1,30,163105,-1,-1,-1,-1,-1,-1
0,3,157,18,0,0,1,92,490761,-1,-1,-1,-1,-1,-1
0,3,151,26,0,0,1,88,469480,-1,-1,-1,-1,-1,-1
4,3,151,-1,0,-1,-1,-1,-1,0,0,0,0,0,-1
0,3,124,21,0,0,1,87,464282,-1,-1,-1,-1,-1,-1
0,3,158,32,0,0,1,80,427144,-1,-1,-1,-1,-1,-1
0,3,154,20,0,0,1,77,411507,-1,-1,-1,-1,-1,-1
0,3,150,29,0,0,1,76,406064,-1,-1,-1,-1,-1,-1
0,3,156,32,0,0,1,75,400745,-1,-1,-1,-1,-1,-1
0,3,153,26,0,0,1,44,237160,-1,-1,-1,-1,-1,-1
0,4,177,29,0,0,1,89,474718,-1,-1,-1,-1,-1,-1
0,4,176,23,0,0,1,88,469539,-1,-1,-1,-1,-1,-1
0,5,182,28,0,0,1,96,511676,-1,-1,-1,-1,-1,-1
0,5,186,27,0,0,1,32,173782,-1,-1,-1,-1,-1,-1
0,6,187,20,0,0,1,96,511828,-1,-1,-1,-1,-1,-1
0,6,208,34,0,0,1,56,300401,-1,-1,-1,-1,-1,-1
0,6,199,20,0,0,1,47,253105,-1,-1,-1,-1,-1,-1
0,7,198,18,0,0,1,92,490737,-1,-1,-1,-1,-1,-1
0,7,227,20,0,0,1,88,469594,-1,-1,-1,-1,-1,-1
0,7,212,27,0,0,1,80,427233,-1,-1,-1,-1,-1,-1
0,7,214,23,0,0,1,72,385056,-1,-1,-1,-1,-1,-1
0,8,238,32,0,0,1,99,527464,-1,-1,-1,-1,-1,-1
0,8,235,32,0,0,1,97,516895,-1,-1,-1,-1,-1,-1
0,8,249,20,0,0,1,96,511849,-1,-1,-1,-1,-1,-1
0,8,223,17,0,0,1,92,490766,-1,-1,-1,-1,-1,-1
0,8,241,27,0,0,1,83,443077,-1,-1,-1,-1,-1,-1
0,8,219,23,0,0,1,80,427305,-1,-1,-1,-1,-1,-1
0,8,247,20,0,0,1,76,406244,-1,-1,-1,-1,-1,-1
0,8,243,22,0,0,1,72,385093,-1,-1,-1,-1,-1,-1
0,8,237,30,0,0,1,69,369089,-1,-1,-1,-1,-1,-1
0,8,240,23,0,0,1,60,321704,-1,-1,-1,-1,-1,-1
0,8,216,18,0,0,1,47,253139,-1,-1,-1,-1,-1,-1
0,8,239,34,0,0,1,26,141985,-1,-1,-1,-1,-1,-1
2,8,239,-1,-1,-1,-1,-1,-1,1,-1,-1,-1,-1,-1
0,8,232,20,0,0,1,19,105258,-1,-1,-1,-1,-1,-1
0,9,252,32,0,0,1,97,516902,-1,-1,-1,-1,-1,-1
0,9,257,27,0,0,1,94,501160,-1,-1,-1,-1,-1,-1
0,9,230,19,0,0,1,88,469614,-1,-1,-1,-1,-1,-1
0,9,256,21,0,0,1,87,464302,-1,-1,-1,-1,-1,-1
0,9,242,23,0,0,1,69,369231,-1,-1,-1,-1,-1,-1
0,9,251,27,0,0,1,68,363863,-1,-1,-1,-1,-1,-1
0,10,255,19,0,0,1,88,469616,-1,-1,-1,-1,-1,-1
0,10,264,28,0,0,1,86,458902,-1,-1,-1,-1,-1,-1
0,10,258,27,0,0,1,83,443065,-1,-1,-1,-1,-1,-1
0,10,260,22,0,0,1,80,427303,-1,-1,-1,-1,-1,-1
0,10,246,22,0,0,1,60,321707,-1,-1,-1,-1,-1,-1
0,10,265,26,0,0,1,31,168538,-1,-1,-1,-1,-1,-1
0,10,266,26,0,0,1,11,62944,-1,-1,-1,-1,-1,-1
0,11,278,21,0,0,1,96,511825,-1,-1,-1,-1,-1,-1
0,11,271,24,0,0,1,83,443124,-1,-1,-1,-1,-1,-1
0,11,267,32,0,0,1,40,215929,-1,-1,-1,-1,-1,-1
0,11,273,28,0,0,1,39,210729,-1,-1,-1,-1,-1,-1
2,12,280,-1,-1,-1,-1,-1,-1,2,-1,-1,-1,-1,-1
0,12,287,20,0,0,1,99,527668,-1,-1,-1,-1,-1,-1
0,12,284,29,0,0,1,70,374397,-1,-1,-1,-1,-1,-1
0,12,279,30,0,0,1,66,353234,-1,-1,-1,-1,-1,-1
0,12,286,26,0,0,1,58,311075,-1,-1,-1,-1,-1,-1
0,12,283,25,0,0,1,56,300543,-1,-1,-1,-1,-1,-1
0,12,282,34,0,0,1,55,295097,-1,-1,-1,-1,-1,-1
0,13,303,30,0,0,1,95,506383,-1,-1,-1,-1,-1,-1
0,13,298,29,0,0,1,91,485268,-1,-1,-1,-1,-1,-1
0,13,304,25,0,0,1,78,416720,-1,-1,-1,-1,-1,-1
0,13,306,20,0,0,1,56,300641,-1,-1,-1,-1,-1,-1
0,13,294,30,0,0,1,42,226516,-1,-1,-1,-1,-1,-1
0,13,295,32,0,0,1,36,194810,-1,-1,-1,-1,-1,-1
0,13,307,33,0,0,1,32,173703,-1,-1,-1,-1,-1,-1
0,13,302,34,0,0,1,25,136705,-1,-1,-1,-1,-1,-1
0,14,312,18,0,0,1,96,511855,-1,-1,-1,-1,-1,-1
0,14,313,20,0,0,1,95,506554,-1,-1,-1,-1,-1,-1
0,14,316,27,0,0,1,74,395560,-1,-1,-1,-1,-1,-1
0,14,309,25,0,0,1,12,68217,-1,-1,-1,-1,-1,-1
0,15,336,24,0,0,1,99,527622,-1,-1,-1,-1,-1,-1
0,15,332,19,0,0,1,96,511860,-1,-1,-1,-1,-1,-1
0,15,334,27,0,0,1,82,437807,-1,-1,-1,-1,-1,-1
0,15,326,20,0,0,1,80,427347,-1,-1,-1,-1,-1,-1
0,15,330,25,0,0,1,79,421994,-1,-1,-1,-1,-1,-1
0,15,322,30,0,0,1,71,379635,-1,-1,-1,-1,-1,-1
0,15,331,30,0,0,1,26,142070,-1,-1,-1,-1,-1,-1
0,16,344,25,0,0,1,98,522313,-1,-1,-1,-1,-1,-1
0,16,338,24,0,0,1,78,416715,-1,-1,-1,-1,-1,-1
0,16,345,29,0,0,1,70,374405,-1,-1,-1,-1,-1,-1
0,16,337,25,0,0,1,58,311088,-1,-1,-1,-1,-1,-1
0,16,339,27,0,0,1,57,305782,-1,-1,-1,-1,-1,-1
0,16,340,27,0,0,1,44,237142,-1,-1,-1,-1,-1,-1

CREATE TABLE statistics(dir  int,seg  int,time_minute int,numvehicles int,lav   
float,toll  int,accident int,accidentSeg int);

INSERT INTO  statistics 
(dir,seg,time_minute,numvehicles,lav,toll,accident,accidentSeg) Select dir, 
seg, tme+1, null,null,null,null,null from (select dir as dir , seg as seg, 
(time/60) as tme from inputStat where type = 0) AS tmpT Group by dir,seg,tme;

select count(*) from statistics;
select count(*) from statistics where lav is null;

CREATE TABLE preLav( dir  int,seg  int,time_minute3 int,lav  float);

INSERT INTO prelav(dir, seg, time_minute3, lav )
SELECT dir, seg,  tme, speed
FROM  ( SELECT dir, seg,  tme, avg(speed) as speed
        FROM (  SELECT dir,seg,carid,tme,avg(speed) as speed
FROM    (SELECT  dir AS dir, seg AS seg, carid as carid, (time/60)+1 AS tme,  
speed AS speed FROM inputStat WHERE type=0) AS temp_A
                GROUP BY dir,seg,carid,tme ) AS temp_B
        GROUP BY dir,seg,tme) AS temp_C;

UPDATE statistics SET lav = (SELECT floor(avg(prelav.lav)) FROM   prelav WHERE  
statistics.dir = prelav.dir AND statistics.seg = prelav.seg AND 
prelav.time_minute3 <= statistics.time_minute - 1);

select count(*) from statistics where lav is null;

UPDATE statistics SET lav = (SELECT floor(avg(prelav.lav)) FROM   prelav WHERE  
statistics.dir = prelav.dir AND statistics.seg = prelav.seg AND 
prelav.time_minute3  >= statistics.time_minute - 5);

select count(*) from statistics where lav is null;

UPDATE statistics SET lav = (SELECT floor(avg(prelav.lav)) FROM   prelav WHERE  
statistics.dir = prelav.dir AND statistics.seg = prelav.seg AND 
prelav.time_minute3 <= statistics.time_minute - 1 AND prelav.time_minute3 >= 
statistics.time_minute - 5);

select count(*) from statistics;
select count(*) from statistics where lav is null;

drop table inputStat;
drop table statistics;
drop table preLav;


-------------------------------------------------------------------------
Sponsored by: SourceForge.net Community Choice Awards: VOTE NOW!
Studies have shown that voting for your favorite open source project,
along with a healthy diet, reduces your potential for chronic lameness
and boredom. Vote Now at http://www.sourceforge.net/community/cca08
_______________________________________________
Monetdb-sql-checkins mailing list
[email protected]
https://lists.sourceforge.net/lists/listinfo/monetdb-sql-checkins

Reply via email to