Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

HashAgg called by apply may hang forever. #12759

Closed
SunRunAway opened this issue Oct 16, 2019 · 0 comments · Fixed by #12760
Closed

HashAgg called by apply may hang forever. #12759

SunRunAway opened this issue Oct 16, 2019 · 0 comments · Fixed by #12760
Labels
sig/execution SIG execution type/bug The issue is confirmed as a bug.

Comments

@SunRunAway
Copy link
Contributor

Bug Report

Please answer these questions before submitting your issue. Thanks!

  1. What did you do?
    If possible, provide a recipe for reproducing the error.
create table test (a int);
insert into test value(1);
mysql> select @@tidb_hashagg_final_concurrency ;
+----------------------------------+
| @@tidb_hashagg_final_concurrency |
+----------------------------------+
| 4                                |
+----------------------------------+
1 row in set (0.00 sec)
mysql> desc select /*+ hash_agg() */ sum(a), (select NULL from test where tt.a = test.a limit 1),(select NULL from test where tt.a = test.a limit 1) ,(select NULL from test where tt.a = test.a limit 1)  from test tt;
+----------------------------------------+-------+-----------+---------------------------------------------------------------+
| id                                     | count | task      | operator info                                                 |
+----------------------------------------+-------+-----------+---------------------------------------------------------------+
| Projection_28                          | 1.00  | root      | Column#3, Column#7, Column#11, Column#15                      |
| └─Apply_30                             | 1.00  | root      | CARTESIAN left outer join, inner:Projection_65                |
|   ├─Apply_32                           | 1.00  | root      | CARTESIAN left outer join, inner:Projection_54                |
|   │ ├─Apply_34                         | 1.00  | root      | CARTESIAN left outer join, inner:Projection_43                |
|   │ │ ├─HashAgg_37                     | 1.00  | root      | funcs:sum(Column#28), firstrow(Column#29)                     |
|   │ │ │ └─Projection_76                | 1.00  | root      | cast(Column#1), Column#1                                      |
|   │ │ │   └─TableReader_42             | 1.00  | root      | data:TableScan_41                                             |
|   │ │ │     └─TableScan_41             | 1.00  | cop[tikv] | table:tt, range:[-inf,+inf], keep order:false, stats:pseudo   |
|   │ │ └─Projection_43                  | 0.00  | root      | NULL                                                          |
|   │ │   └─Limit_44                     | 0.00  | root      | offset:0, count:1                                             |
|   │ │     └─TableReader_50             | 0.00  | root      | data:Limit_49                                                 |
|   │ │       └─Limit_49                 | 0.00  | cop[tikv] | offset:0, count:1                                             |
|   │ │         └─Selection_48           | 0.00  | cop[tikv] | eq(Column#1, Column#5)                                        |
|   │ │           └─TableScan_47         | 1.00  | cop[tikv] | table:test, range:[-inf,+inf], keep order:false, stats:pseudo |
|   │ └─Projection_54                    | 0.00  | root      | NULL                                                          |
|   │   └─Limit_55                       | 0.00  | root      | offset:0, count:1                                             |
|   │     └─TableReader_61               | 0.00  | root      | data:Limit_60                                                 |
|   │       └─Limit_60                   | 0.00  | cop[tikv] | offset:0, count:1                                             |
|   │         └─Selection_59             | 0.00  | cop[tikv] | eq(Column#1, Column#9)                                        |
|   │           └─TableScan_58           | 1.00  | cop[tikv] | table:test, range:[-inf,+inf], keep order:false, stats:pseudo |
|   └─Projection_65                      | 0.00  | root      | NULL                                                          |
|     └─Limit_66                         | 0.00  | root      | offset:0, count:1                                             |
|       └─TableReader_72                 | 0.00  | root      | data:Limit_71                                                 |
|         └─Limit_71                     | 0.00  | cop[tikv] | offset:0, count:1                                             |
|           └─Selection_70               | 0.00  | cop[tikv] | eq(Column#1, Column#13)                                       |
|             └─TableScan_69             | 1.00  | cop[tikv] | table:test, range:[-inf,+inf], keep order:false, stats:pseudo |
+----------------------------------------+-------+-----------+---------------------------------------------------------------+
26 rows in set (0.00 sec)

mysql> select /*+ hash_agg() */ sum(a), (select NULL from test where tt.a = test.a limit 1),(select NULL from test where tt.a = test.a limit 1) ,(select NULL from test where tt.a = test.a limit 1)  from test tt; 
  1. What did you expect to see?

The query returns result.

  1. What did you see instead?

The query hangs forever.

  1. What version of TiDB are you using (tidb-server -V or run select tidb_version(); on TiDB)?

build from master .

| Release Version: v4.0.0-alpha-535-g2f7a66f2d
Git Commit Hash: 2f7a66f2da241765c7a732c6b03b7ec363f861ac
Git Branch: master
UTC Build Time: 2019-10-16 08:54:36
GoVersion: go version go1.13 darwin/amd64
Race Enabled: false
TiKV Min Version: v3.0.0-60965b006877ca7234adaced7890d7b029ed1306
Check Table Before Drop: false |
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
sig/execution SIG execution type/bug The issue is confirmed as a bug.
Projects
None yet
Development

Successfully merging a pull request may close this issue.

1 participant