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

group.subgroup is undefined if group by is used on an expression involving only constants #6082

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

Comments

@monetdb-team
Copy link

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

Date: 2016-10-22 14:06:55 +0200
From: @kutsurak
To: SQL devs <>
Version: 11.23.13 (Jun2016-SP2)
CC: @mlkersten, @njnes

Last updated: 2017-03-03 10:24:17 +0100

Comment 24578

Date: 2016-10-22 14:06:55 +0200
From: @kutsurak

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

This bug was reported by José Cavieres in the mailing list. I tried to simplify the query as much as possible, so it might not make any sense :)

Reproducible: Always

Steps to Reproduce:

sql> create table foo (a int, b int);
sql> select 1 + 1 as bar, sum(b) from foo group by bar;

Actual Results:

A MAL plan is generated but during its execution the instruction group.subgroupdone is found to be undefined.

The generated MAL plan:

function user.s2_1(A0:sht,A1:sht):void;
sql.mvc();
A0;
A1;
X_6:sht := calc.+(X_4,X_5);
(X_7,r1_7,r2_7) := group.subgroupdone(X_6);
algebra.projection(r1_7,X_6);
bat.setKey(X_10,true);
X_13:bat[:oid] := sql.tid(X_3,"sys","foo");
X_16:bat[:int] := sql.bind(X_3,"sys","foo","b",0);
(X_19,r1_19) := sql.bind(X_3,"sys","foo","b",2);
X_22:bat[:int] := sql.bind(X_3,"sys","foo","b",1);
sql.delta(X_16,X_19,r1_19,X_22);
algebra.projection(X_13,X_24);
X_26:bat[:hge] := aggr.subsum(X_25,X_7,r1_7,true,true);
bat.new(nil:oid,nil:str);
bat.new(nil:oid,nil:str);
bat.new(nil:oid,nil:str);
bat.new(nil:oid,nil:int);
bat.new(nil:oid,nil:int);
bat.append(X_28,".L1");
bat.append(X_31,"bar");
bat.append(X_32,"smallint");
bat.append(X_33,16);
bat.append(X_35,0);
bat.append(X_36,"sys.L3");
bat.append(X_38,"L2");
bat.append(X_40,"hugeint");
bat.append(X_42,128);
bat.append(X_44,0);
sql.resultSet(X_45,X_47,X_49,X_51,X_53,X_11,X_26);
end user.s2_1;
querylog.define("explain select 1 + 1 as bar, sum(b) from foo group by bar;","default_pipe")

Comment 24634

Date: 2016-10-26 23:41:08 +0200
From: @mlkersten

This error is already triggered in sql_optimizer line 228.
It means that the code generation itself is likely incorrect.

Comment 24962

Date: 2017-02-03 14:44:16 +0100
From: MonetDB Mercurial Repository <>

Changeset 6520196eefda made by Sjoerd Mullender sjoerd@acm.org in the MonetDB repo, refers to this bug.

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

Changeset description:

Added test for bug #6082.

Comment 24991

Date: 2017-02-08 20:57:39 +0100
From: MonetDB Mercurial Repository <>

Changeset 16a638844c75 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=16a638844c75

Changeset description:

fixed bug #6082, ie insert constant into a bat before a group mal statement

Comment 24992

Date: 2017-02-08 20:58:43 +0100
From: @njnes

fixed. make sure we have a bat before calling a group_done

Comment 25112

Date: 2017-03-03 10:24:17 +0100
From: @sjoerdmullender

Dec2016-SP2 has been released, incorporating the fix.

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