Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

mserver5: rel_bin.c:2504: rel2bin_groupby: Assertion `0' failed. #3581

monetdb-team opened this issue Nov 30, 2020 · 0 comments

mserver5: rel_bin.c:2504: rel2bin_groupby: Assertion `0' failed. #3581

monetdb-team opened this issue Nov 30, 2020 · 0 comments


Copy link

@monetdb-team monetdb-team commented Nov 30, 2020

Date: 2014-09-20 16:34:34 +0200
From: @skinkie
To: SQL devs <>
Version: 11.17.21 (Jan2014-SP3)
CC: @njnes

Last updated: 2014-10-31 14:13:56 +0100

Comment 20173

Date: 2014-09-20 16:34:34 +0200
From: @skinkie

User-Agent: Mozilla/5.0 (X11; Linux x86_64) AppleWebKit/537.36 (KHTML, like Gecko) Chrome/37.0.2062.68 Safari/537.36
Build Identifier:

I have found several problems while trying to explore this problem. I'll first show the base I found, then the variation.

Reproducible: Always

Steps to Reproduce:

CREATE TABLE "sys"."kv6" (
"receive" TIMESTAMP,
"message" TIMESTAMP,
"vehicle" TIMESTAMP,
"messagetype" VARCHAR(10),
"operatingday" DATE,
"dataownercode" VARCHAR(10),
"lineplanningnumber" VARCHAR(10),
"journeynumber" INTEGER,
"reinforcementnumber" INTEGER,
"userstopcode" VARCHAR(10),
"passagesequencenumber" INTEGER,
"distancesincelastuserstop" INTEGER,
"punctuality" INTEGER,
"rd_x" INTEGER,
"rd_y" INTEGER,
"blockcode" INTEGER,
"vehiclenumber" INTEGER,
"wheelchairaccessible" VARCHAR(5),
"source" VARCHAR(10),
"numberofcoaches" INTEGER,
"trip_hash" BIGINT

select vehicle, sum(cast(htmbuzz as smallint)) as htmbuzz from (select distinct vehicle, vehiclenumber as htmbuzz from kv6) as x group by vehicle;

Notice that the "distinct" in combination with the cast(... as smallint) in this query is the part that is the difference between working or not. Leaving either out creates a working solution.

This shows:
mserver5: rel_bin.c:2504: rel2bin_groupby: Assertion `0' failed.

Program received signal SIGABRT, Aborted.
[Switching to Thread 0x7ffff17cc700 (LWP 11033)]
0x00007ffff4aac535 in raise () from /lib64/
(gdb) bt
0 0x00007ffff4aac535 in raise () from /lib64/
1 0x00007ffff4aad9b8 in abort () from /lib64/
2 0x00007ffff4aa55f2 in ?? () from /lib64/
3 0x00007ffff4aa56a2 in __assert_fail () from /lib64/
4 0x00007ffff2dabd77 in rel2bin_groupby (sql=0x7fffe4005450, rel=0x7fffe40b92c0, refs=0x7fffe40bb070) at rel_bin.c:2504
5 0x00007ffff2db5472 in subrel_bin (sql=0x7fffe4005450, rel=0x7fffe40b92c0, refs=0x7fffe40bb070) at rel_bin.c:4485
6 0x00007ffff2dabb2f in rel2bin_groupby (sql=0x7fffe4005450, rel=0x7fffe40b9b70, refs=0x7fffe40bb070) at rel_bin.c:2473
7 0x00007ffff2db5472 in subrel_bin (sql=0x7fffe4005450, rel=0x7fffe40b9b70, refs=0x7fffe40bb070) at rel_bin.c:4485
8 0x00007ffff2daaaf1 in rel2bin_project (sql=0x7fffe4005450, rel=0x7fffe40b9d10, refs=0x7fffe40bb070, topn=0x0) at rel_bin.c:2258
9 0x00007ffff2db5416 in subrel_bin (sql=0x7fffe4005450, rel=0x7fffe40b9d10, refs=0x7fffe40bb070) at rel_bin.c:4477
10 0x00007ffff2db5755 in output_rel_bin (sql=0x7fffe4005450, rel=0x7fffe40b9d10) at rel_bin.c:4545
11 0x00007ffff2d7b188 in sql_relation2stmt (c=0x7fffe4005450, r=0x7fffe40b9d10) at sql.c:148
12 0x00007ffff2d9dd06 in SQLparser (c=0x647330) at sql_scenario.c:2105
13 0x00007ffff78fd7c6 in runPhase (c=0x647330, phase=1) at mal_scenario.c:526
14 0x00007ffff78fd968 in runScenarioBody (c=0x647330) at mal_scenario.c:561
15 0x00007ffff78fdb22 in runScenario (c=0x647330) at mal_scenario.c:590
16 0x00007ffff78ff4c8 in MSserveClient (dummy=0x647330) at mal_session.c:459
17 0x00007ffff739c910 in thread_starter (arg=0x7fffec000a20) at gdk_system.c:506
18 0x00007ffff4e27f3a in start_thread () from /lib64/
19 0x00007ffff4b61dad in clone () from /lib64/

(gdb) list
2499 for( en = exps->h; en; en = en->next ) {
2500 sql_exp *e = en->data;
2501 stmt *gbcol = exp_bin(sql, e, sub, NULL, NULL, NULL, NULL, NULL);
2503 if (!gbcol) {
2504 assert(0);
2505 return NULL;
2506 }
2507 groupby = stmt_group(sql->sa, gbcol, grp, ext, cnt);
2508 grp = stmt_result(sql->sa, groupby, 0);

Alternatively running:

select vehicle, sum(cast(htmbuzz as smallint)) as htmbuzz from (select vehicle, vehiclenumber between 0 and 2999 as htmbuzz from kv6) as x group by vehicle;

Results in:

TypeException:user.s4_1[20]:'aggr.subsum' undefined in: _38:bat[:any,:lng] := aggr.subsum(_36:bat[:oid,:bit], _18:bat[:oid,:oid], r1_18:bat[:oid,:oid], _39:bit, _39:bit)
program contains errors

Removing the 'between 0 and 2999' also solves this problem.

MonetDB 5 server v11.19.0 (64-bit, 64-bit oids)
This is an unreleased version
Copyright (c) 1993-July 2008 CWI
Copyright (c) August 2008-2014 MonetDB B.V., all rights reserved
Visit for further information
Found 31.4GiB available memory, 8 available cpu cores
libpcre: 8.33 2013-05-28 (compiled with 8.33)
openssl: OpenSSL 1.0.1h 5 Jun 2014 (compiled with OpenSSL 1.0.1h 5 Jun 2014)
libxml2: 2.9.1 (compiled with 2.9.1)
Compiled by: (x86_64-unknown-linux-gnu)
Compilation: gcc -g -Werror -Wall -Wextra -W -Werror-implicit-function-declaration -Wpointer-arith -Wdeclaration-after-statement -Wundef -Wformat=2 -Wno-format-nonliteral -Winit-self -Winvalid-pch -Wmissing-declarations -Wmissing-format-attribute -Wmissing-prototypes -Wold-style-definition -Wpacked -Wunknown-pragmas -Wvariadic-macros -fstack-protector-all -Wstack-protector -Wpacked-bitfield-compat -Wsync-nand -Wjump-misses-init -Wmissing-include-dirs -Wlogical-op -Wunreachable-code
Linking : /usr/x86_64-pc-linux-gnu/bin/ld -m elf_x86_64

Comment 20191

Date: 2014-09-21 22:35:45 +0200
From: @njnes

solved problem in the rel_distinct_project2groupby

Comment 20192

Date: 2014-09-22 01:23:25 +0200
From: @skinkie

Both problems described (abort, program contains errors) in this bug still exist in my installation.

/opt/monetdb-oct2014/bin/monetdbd stop /mnt/storage2/monetdb-oct2014
hg pull
hg update
make clean
./configure --prefix=/opt/monetdb-oct2014 --enable-optimise
make install
/opt/monetdb-oct2014/bin/monetdbd start /mnt/storage2/monetdb-oct2014

Comment 20193

Date: 2014-09-22 01:25:31 +0200
From: @skinkie

I see that this might be related to the Jan2014 commit instead of Oct2014 commit.

Comment 20345

Date: 2014-10-31 14:13:56 +0100
From: @sjoerdmullender

Oct2014 has been released.

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
None yet
Linked pull requests

Successfully merging a pull request may close this issue.

None yet
1 participant