Skip to content

sometimes the stream_agg return wrong results  #29554

@ChenPeng2013

Description

@ChenPeng2013

Bug Report

Please answer these questions before submitting your issue. Thanks!

1. Minimal reproduce step (Required)

use test;
source [test.txt](https://github.com/pingcap/tidb/files/7495237/test.txt);

// if you can't reproduce, please execute several times
select /*+ hash_agg() */ count(col1), max(col2), min(col2), count(col2), count(1), count(*) from IDT_MULTI21872 where col2 is not null group by col1, col2;

select /*+ stream_agg() */ count(col1), max(col2), min(col2), count(col2), count(1), count(*) from IDT_MULTI21872 where col2 is not null group by col1, col2;

2. What did you expect to see? (Required)

mysql> select /*+ stream_agg() */ count(col1), max(col2), min(col2), count(col2), count(1), count(*) from IDT_MULTI21872 where col2 is not null group by col1, col2;
+-------------+----------------------+----------------------+-------------+----------+----------+
| count(col1) | max(col2)            | min(col2)            | count(col2) | count(1) | count(*) |
+-------------+----------------------+----------------------+-------------+----------+----------+
|           1 |  3483474160408538637 |  3483474160408538637 |           1 |        1 |        1 |
|           1 |  -712285148954991773 |  -712285148954991773 |           1 |        1 |        1 |
...
|           1 | -8957794185274125772 | -8957794185274125772 |           1 |        1 |        1 |
+-------------+----------------------+----------------------+-------------+----------+----------+
103 rows in set (0.00 sec)

3. What did you see instead (Required)

mysql> select /*+ stream_agg() */ count(col1), max(col2), min(col2), count(col2), count(1), count(*) from IDT_MULTI21872 where col2 is not null group by col1, col2;
+----------------------+----------------------+----------------------+-------------+----------+----------+
| count(col1)          | max(col2)            | min(col2)            | count(col2) | count(1) | count(*) |
+----------------------+----------------------+----------------------+-------------+----------+----------+
| -4522959929954248182 | -4522959929954248182 | -4522959929954248182 |           1 |        1 |        1 |
|  8785184831897790124 |  8785184831897790124 |  8785184831897790124 |           1 |        1 |        1 |
...
|  7320670807156461105 |  7320670807156461105 |  7320670807156461105 |           1 |        1 |        1 |
+----------------------+----------------------+----------------------+-------------+----------+----------+
103 rows in set (0.00 sec)

4. What is your TiDB version? (Required)

Release Version: v5.4.0-alpha-45-ge98d58757
Edition: Community
Git Commit Hash: e98d587577d66e358c50edaa39f08852a0b3314d
Git Branch: master
UTC Build Time: 2021-11-08 06:43:19
GoVersion: go1.16.5
Race Enabled: false
TiKV Min Version: v3.0.0-60965b006877ca7234adaced7890d7b029ed1306
Check Table Before Drop: false

Metadata

Metadata

Assignees

No one assigned

    Type

    No type

    Projects

    No projects

    Milestone

    No milestone

    Relationships

    None yet

    Development

    No branches or pull requests

    Issue actions