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

planner: set_var cannot take effect in UNION ALL statements #50068

Closed
qw4990 opened this issue Jan 4, 2024 · 1 comment · Fixed by #50070
Closed

planner: set_var cannot take effect in UNION ALL statements #50068

qw4990 opened this issue Jan 4, 2024 · 1 comment · Fixed by #50070

Comments

@qw4990
Copy link
Contributor

qw4990 commented Jan 4, 2024

Bug Report

Please answer these questions before submitting your issue. Thanks!

1. Minimal reproduce step (Required)

create table t (a int);
insert into t values (1);
insert into t values (1);

mysql> select /*+ set_var(max_execution_time=100) */ a, sleep(1) from t;
ERROR 3024 (HY000): Query execution was interrupted, maximum statement execution time exceeded

mysql> select /*+ set_var(max_execution_time=100) */ a, sleep(1) from t union all select a, 1 from t;
+------+----------+
| a    | sleep(1) |
+------+----------+
|    1 |        1 |
|    1 |        1 |
|    1 |        0 |
|    1 |        0 |
+------+----------+
4 rows in set (2.01 sec)

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

The second query should return an error.

3. What did you see instead (Required)

The second query's execution time exceeds the limitation.

The reason is that UNION ALL's node is not considered when extracting statement hints:

img_v3_026p_32b954e0-92b3-4a15-8aac-c847fca3026g

4. What is your TiDB version? (Required)

Master

@qw4990 qw4990 added type/bug This issue is a bug. sig/planner SIG: Planner epic/hint labels Jan 4, 2024
@qw4990
Copy link
Contributor Author

qw4990 commented Jan 4, 2024

PTAL @hawkingrei Please take a look at this, THX!

@hawkingrei hawkingrei self-assigned this Jan 4, 2024
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Projects
None yet
Development

Successfully merging a pull request may close this issue.

2 participants