Segmentation fault on a query from table expression
Hi,
I am running MonetDB Database Server Toolkit v1.1 (Feb2013-SP6) ,
I have a table DailyData defined as follows.
create table DailyData (
sym varchar(32),
businessdate date,
closePrice float,
adjustedClosePrice float,
openingPrice float,
accVol float,
unique(businessdate, sym)
);
I make the following query.
with dd as (select * from DailyData where businessdate > '2013-06-01'),
r as (select t.businessdate, t.sym, 1 - t.adjustedcloseprice /
y.adjustedcloseprice as ret from dd t
left outer join dd y on t.businessdate = y.businessdate + (interval '1'
day) and t.sym = y.sym),
v as (select sym, stddev_samp(ret) as volatility from r group by sym)
select * from v where v.sym like '%.L' limit 100;
It results in a segmentation fault:
Program received signal SIGSEGV, Segmentation fault.
[Switching to Thread 0x7f5f17023700 (LWP 25178)]
0x0000003ee9327a9a in __strcmp_sse42 () from /lib64/libc.so.6
(gdb) where
#0 0x0000003ee9327a9a in __strcmp_sse42 () from /lib64/libc.so.6
#1 0x00007f6f2d4ef6f8 in rel_use_index (changes=<value optimized out>,
sql=0x7f5f08005470, rel=0x7f5f0850aa70) at rel_optimizer.c:4829
#2 0x00007f6f2d4ea225 in rewrite (sql=0x7f5f08005470, rel=0x7f5f0850aa70,
rewriter=0x7f6f2d4ef610
Can you create a bug report on bugs.monetdb.org please? On 2014-01-14 12:12, Alexander Shestakov wrote:
Hi, I am running MonetDB Database Server Toolkit v1.1 (Feb2013-SP6) ,
I have a table DailyData defined as follows.
create table DailyData ( sym varchar(32), businessdate date, closePrice float, adjustedClosePrice float, openingPrice float, accVol float, unique(businessdate, sym) );
I make the following query.
with dd as (select * from DailyData where businessdate > '2013-06-01'), r as (select t.businessdate, t.sym, 1 - t.adjustedcloseprice / y.adjustedcloseprice as ret from dd t left outer join dd y on t.businessdate = y.businessdate + (interval '1' day) and t.sym = y.sym), v as (select sym, stddev_samp(ret) as volatility from r group by sym) select * from v where v.sym like '%.L' limit 100;
It results in a segmentation fault:
Program received signal SIGSEGV, Segmentation fault. [Switching to Thread 0x7f5f17023700 (LWP 25178)] 0x0000003ee9327a9a in __strcmp_sse42 () from /lib64/libc.so.6 (gdb) where #0 0x0000003ee9327a9a in __strcmp_sse42 () from /lib64/libc.so.6 #1 0x00007f6f2d4ef6f8 in rel_use_index (changes=<value optimized out>, sql=0x7f5f08005470, rel=0x7f5f0850aa70) at rel_optimizer.c:4829 #2 0x00007f6f2d4ea225 in rewrite (sql=0x7f5f08005470, rel=0x7f5f0850aa70, rewriter=0x7f6f2d4ef610
, has_changes=0x7f5f17022cac) at rel_optimizer.c:6106 #3 0x00007f6f2d4ea2bc in rewrite (sql=0x7f5f08005470, rel=0x7f5f0850cb40, rewriter=0x7f6f2d4ef610 , has_changes=0x7f5f17022cac) at rel_optimizer.c:6093 #4 0x00007f6f2d4ea2bc in rewrite (sql=0x7f5f08005470, rel=0x7f5f0850ec30, rewriter=0x7f6f2d4ef610 , has_changes=0x7f5f17022cac) at rel_optimizer.c:6093 #5 0x00007f6f2d4ea2bc in rewrite (sql=0x7f5f08005470, rel=0x7f5f0850ef50, rewriter=0x7f6f2d4ef610 , has_changes=0x7f5f17022cac) at rel_optimizer.c:6093 #6 0x00007f6f2d4ea2bc in rewrite (sql=0x7f5f08005470, rel=0x7f5f08512a90, rewriter=0x7f6f2d4ef610 , has_changes=0x7f5f17022cac) at rel_optimizer.c:6093 #7 0x00007f6f2d4ea2bc in rewrite (sql=0x7f5f08005470, rel=0x7f5f0850feb0, rewriter=0x7f6f2d4ef610 , has_changes=0x7f5f17022cac) at rel_optimizer.c:6093 #8 0x00007f6f2d4ea2bc in rewrite (sql=0x7f5f08005470, rel=0x7f5f085101c0, rewriter=0x7f6f2d4ef610 , has_changes=0x7f5f17022cac) at rel_optimizer.c:6093 #9 0x00007f6f2d4ecf58 in _rel_optimizer (sql=0x7f5f08005470, rel=<value optimized out>, level=0) at rel_optimizer.c:6278 #10 0x00007f6f2d484369 in sql_symbol2relation (c=0x7f5f08005470, sym=<value optimized out>) at sql.mx:1755 http://sql.mx:1755/ #11 0x00007f6f2d454b2f in SQLparser (c=0x7f6f2df49308) at sql_scenario.c:1708 #12 0x00007f6f352ecdd3 in runPhase (c=0x7f6f2df49308) at mal_scenario.c:522 #13 runScenarioBody (c=0x7f6f2df49308) at mal_scenario.c:558 #14 0x00007f6f352ecf1f in runScenario (c=0x7f6f2df49308) at mal_scenario.c:586 #15 0x00007f6f352ed778 in MSserveClient (dummy=0x7f6f2df49308) at mal_session.c:446 #16 0x0000003ee9a07851 in start_thread () from /lib64/libpthread.so.0 #17 0x0000003ee92e890d in clone () from /lib64/libc.so.6 Apparently at rel_optimizer.c:4829 strcmp(exp_relname(nre) returns NULL which is not checked.
If I rewrite the query in the following way it works if not very fast.
with r as (select t.businessdate, t.sym, 1 - t.adjustedcloseprice / y.adjustedcloseprice as ret from DailyData t left outer join DailyData y on t.businessdate = y.businessdate + (interval '1' day) and t.sym = y.sym where t.businessdate > '2013-06-01'), v as (select sym, stddev_samp(ret) as volatility from r group by sym) select * from v where v.sym like '%.L' limit 100;
Regards, Alex Shestakov.
_______________________________________________ developers-list mailing list developers-list@monetdb.org https://www.monetdb.org/mailman/listinfo/developers-list
-- Sjoerd Mullender
I did.
On 14 January 2014 13:15, Sjoerd Mullender
Can you create a bug report on bugs.monetdb.org please?
On 2014-01-14 12:12, Alexander Shestakov wrote:
Hi, I am running MonetDB Database Server Toolkit v1.1 (Feb2013-SP6) ,
I have a table DailyData defined as follows.
create table DailyData ( sym varchar(32), businessdate date, closePrice float, adjustedClosePrice float, openingPrice float, accVol float, unique(businessdate, sym) );
I make the following query.
with dd as (select * from DailyData where businessdate > '2013-06-01'), r as (select t.businessdate, t.sym, 1 - t.adjustedcloseprice / y.adjustedcloseprice as ret from dd t left outer join dd y on t.businessdate = y.businessdate + (interval '1' day) and t.sym = y.sym), v as (select sym, stddev_samp(ret) as volatility from r group by sym) select * from v where v.sym like '%.L' limit 100;
It results in a segmentation fault:
Program received signal SIGSEGV, Segmentation fault. [Switching to Thread 0x7f5f17023700 (LWP 25178)] 0x0000003ee9327a9a in __strcmp_sse42 () from /lib64/libc.so.6 (gdb) where #0 0x0000003ee9327a9a in __strcmp_sse42 () from /lib64/libc.so.6 #1 0x00007f6f2d4ef6f8 in rel_use_index (changes=<value optimized out>, sql=0x7f5f08005470, rel=0x7f5f0850aa70) at rel_optimizer.c:4829 #2 0x00007f6f2d4ea225 in rewrite (sql=0x7f5f08005470, rel=0x7f5f0850aa70, rewriter=0x7f6f2d4ef610
, has_changes=0x7f5f17022cac) at rel_optimizer.c:6106 #3 0x00007f6f2d4ea2bc in rewrite (sql=0x7f5f08005470, rel=0x7f5f0850cb40, rewriter=0x7f6f2d4ef610 , has_changes=0x7f5f17022cac) at rel_optimizer.c:6093 #4 0x00007f6f2d4ea2bc in rewrite (sql=0x7f5f08005470, rel=0x7f5f0850ec30, rewriter=0x7f6f2d4ef610 , has_changes=0x7f5f17022cac) at rel_optimizer.c:6093 #5 0x00007f6f2d4ea2bc in rewrite (sql=0x7f5f08005470, rel=0x7f5f0850ef50, rewriter=0x7f6f2d4ef610 , has_changes=0x7f5f17022cac) at rel_optimizer.c:6093 #6 0x00007f6f2d4ea2bc in rewrite (sql=0x7f5f08005470, rel=0x7f5f08512a90, rewriter=0x7f6f2d4ef610 , has_changes=0x7f5f17022cac) at rel_optimizer.c:6093 #7 0x00007f6f2d4ea2bc in rewrite (sql=0x7f5f08005470, rel=0x7f5f0850feb0, rewriter=0x7f6f2d4ef610 , has_changes=0x7f5f17022cac) at rel_optimizer.c:6093 #8 0x00007f6f2d4ea2bc in rewrite (sql=0x7f5f08005470, rel=0x7f5f085101c0, rewriter=0x7f6f2d4ef610 , has_changes=0x7f5f17022cac) at rel_optimizer.c:6093 #9 0x00007f6f2d4ecf58 in _rel_optimizer (sql=0x7f5f08005470, rel=<value optimized out>, level=0) at rel_optimizer.c:6278 #10 0x00007f6f2d484369 in sql_symbol2relation (c=0x7f5f08005470, sym=<value optimized out>) at sql.mx:1755 http://sql.mx:1755/ #11 0x00007f6f2d454b2f in SQLparser (c=0x7f6f2df49308) at sql_scenario.c:1708 #12 0x00007f6f352ecdd3 in runPhase (c=0x7f6f2df49308) at mal_scenario.c:522 #13 runScenarioBody (c=0x7f6f2df49308) at mal_scenario.c:558 #14 0x00007f6f352ecf1f in runScenario (c=0x7f6f2df49308) at mal_scenario.c:586 #15 0x00007f6f352ed778 in MSserveClient (dummy=0x7f6f2df49308) at mal_session.c:446 #16 0x0000003ee9a07851 in start_thread () from /lib64/libpthread.so.0 #17 0x0000003ee92e890d in clone () from /lib64/libc.so.6 Apparently at rel_optimizer.c:4829 strcmp(exp_relname(nre) returns NULL which is not checked.
If I rewrite the query in the following way it works if not very fast.
with r as (select t.businessdate, t.sym, 1 - t.adjustedcloseprice / y.adjustedcloseprice as ret from DailyData t left outer join DailyData y on t.businessdate = y.businessdate + (interval '1' day) and t.sym = y.sym where t.businessdate > '2013-06-01'), v as (select sym, stddev_samp(ret) as volatility from r group by sym) select * from v where v.sym like '%.L' limit 100;
Regards, Alex Shestakov.
_______________________________________________ developers-list mailing list developers-list@monetdb.org https://www.monetdb.org/mailman/listinfo/developers-list
-- Sjoerd Mullender
_______________________________________________ developers-list mailing list developers-list@monetdb.org https://www.monetdb.org/mailman/listinfo/developers-list
participants (2)
-
Alexander Shestakov
-
Sjoerd Mullender