stonedb icon indicating copy to clipboard operation
stonedb copied to clipboard

crash: StoneDB crash: SUM

Open ZhengLin-Li opened this issue 11 months ago • 1 comments

Have you read the Contributing Guidelines on issues?

Please confirm if bug report does NOT exists already ?

  • [X] I confirm there is no existing issue for this

Describe the problem

StoneDB V1.0.4 crash when running the following commands:

EXAMPLE 1:

image

EXAMPLE 2:

image

EXAMPLE 3:

image

(Have tried to reduce the statements as fewer as possible)

Expected behavior

EXAMPLE 1:

Return NULL as MySQL 5.7 does: image

EXAMPLE 2:

Return NULL as MySQL 5.7 does: image

EXAMPLE 3:

Return NULL as MySQL 5.7 does: image

How To Reproduce

EXAMPLE 1:

CREATE TABLE t0(c0 INT);
INSERT INTO t0(c0) VALUES (1);
ALTER TABLE t0 CHANGE COLUMN c0 c1 INT;
CREATE TABLE t1(c0 INT);

SELECT SUM(count1) FROM (SELECT CAST(t0.c1 AS UNSIGNED)  as count1 FROM t0, t1) as res;

EXAMPLE 2:

CREATE TABLE t0(c0 INT);
CREATE TABLE t1(c0 INT) ;
INSERT INTO t1(c0) VALUES (111);

SELECT SUM(count1) FROM (SELECT CAST(t1.c0 AS UNSIGNED)  as count1 FROM t1, t0) as res;

EXAMPLE 3:

CREATE TABLE t0(c1 INT );
CREATE TABLE t1(c0 INT );
INSERT INTO t0(c1) VALUES (1);

SELECT SUM(count1) FROM (SELECT CAST(t0.c1 AS UNSIGNED)  as count1 FROM t0, t1) as res;

Environment

Docker image V1.0.4

Are you interested in submitting a PR to solve the problem?

  • [ ] Yes, I will!

ZhengLin-Li avatar Jul 19 '23 05:07 ZhengLin-Li

UPDATE: it seams that the CAST operation is not essential to reproduce this crash, but the SUM operation is essential. image

ZhengLin-Li avatar Jul 29 '23 01:07 ZhengLin-Li