dynamobi/dynamobi — Issue #643: [FRG-229] queries with multiple aggregates for distinct values causes crash/errors
Author: dynamobi-build
Created: 2011-12-30 03:40:11+00:00
State: open
Labels: FRG

[reporter="elin", created="Tue, 31 Oct 2006 17:03:59 -0500 (GMT-05:00)"]
To repro:

create schema s;

set schema 's';

create table EMP (

EMPNO numeric(5,0),

FNAME varchar(20),

LNAME varchar(20),

SEX char(1),

DEPTNO integer,

MANAGER numeric(5,0),

LOCID CHAR(2),

SAL integer,

COMMISSION integer,

HOBBY varchar(20)

);

create server ff_server

foreign data wrapper sys_file_wrapper

options(

directory '/home/elin/open/luciddb/test/sql/company/csv-copy',

file_extension '.csv',

ctrl_file_extension '.bcp',

field_delimiter ',',

line_delimiter '\n',

quote_char '"',

escape_char '',

with_header 'yes',

num_rows_scan '9'

);

INSERT INTO EMP SELECT * FROM ff_server."BCP".EMP;

-- this query crashes (see below for stack trace)

SELECT COUNT(DISTINCT sex), SUM(DISTINCT sal)

FROM emp;

-- the next two queries also crash if no indices are created

SELECT COUNT(DISTINCT SAL), COUNT(DISTINCT SEX)

FROM EMP;

SELECT COUNT(DISTINCT SEX), SUM(DISTINCT SAL),

MIN(DISTINCT SEX), MAX(DISTINCT SAL)

FROM EMP;

-- but if the indexes below are created:

create index EMP_DEPTNO on EMP(DEPTNO);

create index EMP_MANAGER on EMP(MANAGER);

create index EMP_LOCID on EMP(LOCID);

create index EMP_SEX on EMP(SEX);

create index EMP_COMMISSION on EMP(COMMISSION);

then they return the error (the one below is for the 1st of the 2 queries):

Error: FennelResource.en_US.internalError(Assertion `Forgot to initialize output #0of stream 'xo.FennelAggRel.#214:1008'' failed at line 213 in file ExecStreamGraphEmbryo.cpp) (state=,code=0)

net.sf.farrago.jdbc.FarragoJdbcUtil$FarragoSqlException: FennelResource.en_US.internalError(Assertion `Forgot to initialize output #0of stream 'xo.FennelAggRel.#214:1008'' failed at line 213 in file ExecStreamGraphEmbryo.cpp)

at net.sf.farrago.resource.FarragoResource$_Def0.ex(FarragoResource.java:1584)

at net.sf.farrago.fennel.FennelDbHandle.handleNativeException(FennelDbHandle.java:327)

at net.sf.farrago.fennel.FennelDbHandle.executeCmd(FennelDbHandle.java:250)

at net.sf.farrago.runtime.FarragoRuntimeContext.prepareStreamGraph(FarragoRuntimeContext.java:604)

at net.sf.farrago.runtime.FarragoRuntimeContext$1.initializeEntry(FarragoRuntimeContext.java:438)

at net.sf.farrago.util.FarragoObjectCache.pin(FarragoObjectCache.java:163)

at net.sf.farrago.runtime.FarragoRuntimeContext.loadFennelPlan(FarragoRuntimeContext.java:457)

at net.sf.farrago.query.FarragoExecutableFennelStmt.execute(FarragoExecutableFennelStmt.java:99)

at net.sf.farrago.db.FarragoDbStmtContext.execute(FarragoDbStmtContext.java:219)

at net.sf.farrago.jdbc.engine.FarragoJdbcEngineStatement.execute(FarragoJdbcEngineStatement.java:109)

at sqlline.SqlLine$Commands.execute(Unknown Source)

at sqlline.SqlLine$Commands.sql(Unknown Source)

at sqlline.SqlLine.dispatch(Unknown Source)

at sqlline.SqlLine.begin(Unknown Source)

at sqlline.SqlLine.mainWithInputRedirection(Unknown Source)

at sqlline.SqlLine.main(Unknown Source)

-- stack trace for the 1st query below. More detailed hs_err_pid10065.log is attached

#

# An unexpected error has been detected by HotSpot Virtual Machine:

#

# SIGSEGV (0xb) at pc=0x6bb4754d, pid=10065, tid=3087001280

#

# Java VM: Java HotSpot(TM) Server VM (1.5.0_06-b05 mixed mode)

# Problematic frame:

# C [libfennel_segment-0.5.0.so+0x2754d] _ZN6fennel14SegInputStream11endPrefetchEv+0x11

#

# An error report file with more information is saved as hs_err_pid10065.log

#

# If you would like to submit a bug report, please visit:

# http://java.sun.com/webapps/bugreport/crash.jsp

#

*** CAUGHT SIGNAL 6; BACKTRACE:

/home/elin/open/fennel/libfennel/.libs/libfennel_common-0.5.0.so(fennel::AutoBacktrace::signal_handler(int)+0x2c) [0x176e4]

/lib/tls/libpthread.so.0 [0x8d2888]

/lib/ld-linux.so.2 [0x65b7a2]

/lib/tls/libc.so.6(gsignal+0x55) [0x69b7f5]

/lib/tls/libc.so.6(abort+0xe9) [0x69d199]

/usr/java/jdk1.5.0_06/jre/lib/i386/server/libjvm.so [0xb7a58965]

/usr/java/jdk1.5.0_06/jre/lib/i386/server/libjvm.so [0xb7b34bd4]

/usr/java/jdk1.5.0_06/jre/lib/i386/server/libjvm.so(JVM_handle_linux_signal+0x24a) [0xb7a5d30a]

/usr/java/jdk1.5.0_06/jre/lib/i386/server/libjvm.so [0xb7a5a884]

/lib/tls/libpthread.so.0 [0x8d2880]

/home/elin/open/fennel/libfennel/.libs/libfennel_exec-0.5.0.so(fennel::SegBufferExecStream::openBufferForRead(bool)+0x1c6) [0x6a83a]

/home/elin/open/fennel/libfennel/.libs/libfennel_exec-0.5.0.so(fennel::SegBufferExecStream::destroyBuffer()+0x4a) [0x6a602]

/home/elin/open/fennel/libfennel/.libs/libfennel_exec-0.5.0.so(fennel::SegBufferExecStream::closeImpl()+0x1d) [0x6a5a1]

/home/elin/open/fennel/libfennel/.libs/libfennel_common-0.5.0.so(fennel::ClosableObject::close()+0x20) [0x1c490]

/home/elin/open/fennel/libfennel/.libs/libfennel_exec-0.5.0.so(fennel::ExecStreamGraphImpl::closeImpl()+0x217) [0x4bb8f]

/home/elin/open/fennel/libfennel/.libs/libfennel_common-0.5.0.so(fennel::ClosableObject::close()+0x20) [0x1c490]

/home/elin/open/fennel/libfennel/.libs/libfennel_exec-0.5.0.so(boost::detail::sp_counted_impl_pd::dispose()+0x2d) [0x532f5]

/home/elin/open/fennel/farrago/.libs/libfarrago-0.5.0.so(fennel::CmdInterpreter::StreamGraphHandle::~StreamGraphHandle()+0x111) [0x87ccd]

/home/elin/open/fennel/farrago/.libs/libfarrago-0.5.0.so(Java_net_sf_farrago_fennel_FennelStorage_tupleStreamGraphClose+0xf3) [0x6bdc86f3]

[0xb26bb838]

[0xb26b5aeb]

[0xb26b5aeb]

[0xb26b5a14]

[0xb26b5df1]

[0xb26b5a14]

[0xb26b5df1]

[0xb26b5d1a]

[0xb26b5df1]

[0xb26b5c99]

[0xb26b5993]

[0xb26b5993]

[0xb26b5993]

the test for this is under company/aggDistinct.sql but hasn't been enabled yet.