Details
-
Bug
-
Status: Closed (View Workflow)
-
Major
-
Resolution: Fixed
-
1.0.10
-
None
Description
The following returns garbage:
CREATE TABLE `phased_info` (
`animalid` varchar(18) DEFAULT NULL,
`chipid` tinyint(4) DEFAULT NULL,
`sha1sum` varchar(40) DEFAULT NULL
) ENGINE=Columnstore DEFAULT CHARSET=utf8;
// Default CHARSET=latin1 has same behavior
insert into phased_info values ('HO840F124135526679', 1, '1');
insert into phased_info values ('HO840F124135526679', 1, '2');
insert into phased_info values ('HO840F124135526679', 1, '3');
insert into phased_info values ('HO840F124135526679', 2, '1');
insert into phased_info values ('HO840F124135526679', 2, '2');
insert into phased_info values ('HO840F124135526679', 2, '3');
select group_concat(animalid),count(animalid) as ct from phased_info group by sha1sum;
--------------------------+
group_concat(animalid) | ct |
--------------------------+
,, | 3 |
,,, | 4 |
,,,, | 5 |
--------------------------+
3 rows in set (0.15 sec)
However:
select group_concat(cast(animalid as char)),count(animalid) as ct from phased_info group by sha1sum;
--------------------------------------------------------------------------------------------------+
group_concat(cast(animalid as char)) | ct |
--------------------------------------------------------------------------------------------------+
HOUSAM124135526669,HO840F124135526679,HO840F124135526679 | 3 |
HOUSAM124135526669,HOUSAM124135526669,HO840F124135526679,HO840F124135526679 | 4 |
HOUSAM124135526669,HOUSAM124135526669,HOUSAM124135526669,HO840F124135526679,HO840F124135526679 | 5 |
--------------------------------------------------------------------------------------------------+
3 rows in set (0.18 sec)
and
select group_concat(animalid),count(sha1sum) as ct from phased_info group by sha1sum;--------------------------------------------------------------------------------------------------+
group_concat(animalid) | ct |
--------------------------------------------------------------------------------------------------+
HOUSAM124135526669,HO840F124135526679,HO840F124135526679 | 3 |
HOUSAM124135526669,HOUSAM124135526669,HO840F124135526679,HO840F124135526679 | 4 |
HOUSAM124135526669,HOUSAM124135526669,HOUSAM124135526669,HO840F124135526679,HO840F124135526679 | 5 |
--------------------------------------------------------------------------------------------------+
3 rows in set (0.06 sec)
So casting the column before group_concat, OR not using the same column in another aggregate, seems to fix it.