stoneatom / stonedb

StoneDB is an Open-Source MySQL HTAP and MySQL-Native DataBase for OLTP, Real-Time Analytics, a counterpart of MySQLHeatWave. (https://stonedb.io)
https://stonedb.io/
GNU General Public License v2.0
866 stars 141 forks source link

bug: Executing count(distinct) SQL statements causes service crashes #1962

Open TomeC opened 1 year ago

TomeC commented 1 year ago

Have you read the Contributing Guidelines on issues?

Please confirm if bug report does NOT exists already ?

Describe the problem

mysql> SELECT "count(distinct 17)_test1", count(distinct d1),count(distinct d2),count(distinct d3) FROM cs1; ERROR 2013 (HY000): Lost connection to MySQL server during query

service crashed

Expected behavior

The service runs normally and returns the correct result

How To Reproduce

USE test;
CREATE TABLE cs1 (d1 DECIMAL(17), d2 DECIMAL(17,10), d3 DECIMAL(17,16), d4 DECIMAL(17),d5 DECIMAL(17),i1 INT) ;
INSERT INTO cs1 VALUES
    (1234,5678,-0.123456789012345,2,1,1),     
    (1234,-5678,0.12345678901234,2,1,1),
    (1234567890123,123456.90123,0.12345678901234,2,1,1),
    (NULL,NULL,NULL,2,1,1),
    (0,0,0,2,1,1),
    (1234,5678,0.123456789,3,2,2),
    (-12345678923,-5678,0.1234567890121,3,2,2),
    (56789012,123856.90,0.12345678909,3,2,2),
    (NULL,NULL,NULL,3,2,2),
    (0,0,0,3,2,2),
    (1234,5678,-0.123456789012345,1111111111,1,1),
    (1234,5678,-0.123456789012345,1111111111,1,1),
    (1234,5678,-0.123456789012345,1111111112,1,1); 

mysql> SELECT "count(distinct 17)_test1", count(distinct d1),count(distinct d2),count(distinct d3) FROM cs1

ERROR 2013 (HY000): Lost connection to MySQL server during query

Environment

centos7 branch stonedb-5.7-dev

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