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

Crash when performing UNION/GROUP BY over tables with different columns #3818

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

Comments

@monetdb-team
Copy link

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

Date: 2015-10-07 18:15:09 +0200
From: Frédéric Jolliton <<frederic.jolliton+monetdb>>
To: SQL devs <>
Version: 11.17.21 (Jan2014-SP3)
CC: martin.van.dinther, @njnes

Last updated: 2015-11-03 10:18:26 +0100

Comment 21320

Date: 2015-10-07 18:15:09 +0200
From: Frédéric Jolliton <<frederic.jolliton+monetdb>>

User-Agent: Mozilla/5.0 (X11; Linux x86_64; rv:41.0) Gecko/20100101 Firefox/41.0
Build Identifier:

A specific combination of UNION / GROUP BY / AGGREGATES and tables definitions causes MonetDB to crash.

The server log just tell about SIGSEGV without further details.

Reproducible: Always

Steps to Reproduce:

  1. Create two tables with random names (it doesn't crash if there are duplicate names between the tables it seems)

CREATE TABLE t1 (cods int, elrik int, ether int, jaelen int, otter int, sora int);
CREATE TABLE t2 (tib0 int);

  1. Query with:

SELECT cods, elrik, ether, jaelen, sora, SUM(otter)
FROM t1
GROUP BY cods, elrik, ether, jaelen, sora
UNION ALL
SELECT 0 AS cods, 0 AS elrik, 0 AS ether, 0 AS jaelen, 0 AS sora, SUM(tib0)
FROM t2
GROUP BY cods, elrik, ether, jaelen, sora;

Actual Results:

MonetDB crashes

Expected Results:

Something..

It is interesting to note that using fewer columns doesn't trigger this bug. It's only when about 5 or more columns are used within the GROUP BY that we see this behavior.

It was rather hard to diagnostic, because we had a very large query in the first place. It tooks hours to find the very specific query that was triggering this problem.

Comment 21321

Date: 2015-10-08 15:26:51 +0200
From: Martin van Dinther <<martin.van.dinther>>

I found the issue is already reproducable (on Jul2015) with query:
SELECT 0 AS cods, 0 AS elrik, 0 AS ether, 0 AS jaelen, 0 AS sora, SUM(tib0)
FROM t2
GROUP BY cods, elrik, ether, jaelen, sora;

Also adding PLAN or EXPLAIN or TRACE in front of the query, also leads to a Segmentation fault in the mserver5.

No problem when grouping less than 5 columns as in query:
SELECT 0 AS elrik, 0 AS ether, 0 AS jaelen, 0 AS sora, SUM(tib0)
FROM t2
GROUP BY elrik, ether, jaelen, sora;

Comment 21330

Date: 2015-10-14 11:40:36 +0200
From: MonetDB Mercurial Repository <>

Changeset d04a59d1b9a9 made by Niels Nes niels@cwi.nl in the MonetDB repo, refers to this bug.

For complete details, see http//devmonetdborg/hg/MonetDB?cmd=changeset;node=d04a59d1b9a9

Changeset description:

fixed bug #3818, ie crash n the reduce groupby optimizer

Comment 21331

Date: 2015-10-14 11:41:39 +0200
From: @njnes

properly handle alias expressions (and no other expressions) in the reduce group by optimizer.

Comment 21444

Date: 2015-11-03 10:18:26 +0100
From: @sjoerdmullender

Jul2015 SP1 has been released.

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

Successfully merging a pull request may close this issue.

None yet
1 participant