Query on bigint with group by returns strange results

I have a table with a bigint column. If I group by that column and include it in the projection the values look incorrect.

drop table if exists test_bigint_group_by;
create table test_bigint_group_by (col BIGINT NOT NULL);
insert into test_bigint_group_by (col) values (-6312639302689611776);
insert into test_bigint_group_by (col) values (-6312639302689611776);
insert into test_bigint_group_by (col) values (-6312639302689611776);
insert into test_bigint_group_by (col) values (-6336283200715718656);
insert into test_bigint_group_by (col) values (-6312639302689603584);

select col from test_bigint_group_by group by col;
col
278528
17858560
270336

The values are correct without the group by:

select col from test_bigint_group_by;
col
-6312639302689611776
-6312639302689611776
-6312639302689611776
-6336283200715718656
-6312639302689603584

Casting as decimal in the group-by query yields the correct value:

select cast(col as decimal) from test_bigint_group_by group by col;
EXPR$0
-6312639302689603584
-6336283200715718656
-6312639302689611776

Is there some sort of truncation happening in the group-by query without the cast? Is there a way to get at the correct values without the cast and using group-by?

Using Omnisci version 5.3.2.

Thanks,
Ray

Hi @Ray1, I wanted to let you know that we’ve reproduced internally and are working on a fix. Thank you for reporting the issue and we’ll let you know here when we have a patch commit/release.

Todd

Thanks, Todd,

Do you know when this will be addressed?

Ray

As a workaround, you can insert a row with a positive value (or a null value) and the group by will return the correct result.

Anyway, the patch has been developed, and it will be included in the 5.7 release, so it shouldn’t take so much time.

Regards,
Candido