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

The result of subquery with all is not correct #33083

Closed
SeaRise opened this issue Mar 15, 2022 · 2 comments · Fixed by #33084
Closed

The result of subquery with all is not correct #33083

SeaRise opened this issue Mar 15, 2022 · 2 comments · Fixed by #33084
Assignees
Labels
affects-5.1 This bug affects 5.1.x versions. affects-5.2 This bug affects 5.2.x versions. affects-5.3 This bug affects 5.3.x versions. affects-5.4 This bug affects 5.4.x versions. component/tiflash severity/critical sig/execution SIG execution type/bug The issue is confirmed as a bug.

Comments

@SeaRise
Copy link
Contributor

SeaRise commented Mar 15, 2022

Bug Report

Please answer these questions before submitting your issue. Thanks!

1. Minimal reproduce step (Required)

create table t(a int);
create table t3(id int primary key,a int);
insert into t values(1),(null);
insert into t3 values(1,2),(2,2);
alter table t set tiflash replica 1;
alter table t3 set tiflash replica 1;
select * from t where a = all ( select a from t3 where t.a=t3.id);
/*
+-------------------------------------------+---------+-------------------+---------------+--------------------------------------------------------------------------------------------------------------------------------------------------------------------------+
| id                                        | estRows | task              | access object | operator info                                                                                                                                                            |
+-------------------------------------------+---------+-------------------+---------------+--------------------------------------------------------------------------------------------------------------------------------------------------------------------------+
| Projection_11                             | 2.00    | root              |               | test.t.a                                                                                                                                                                 |
| └─Apply_13                                | 2.00    | root              |               | CARTESIAN inner join, other cond:or(and(le(Column#6, 1), and(eq(test.t.a, Column#5), if(ne(Column#7, 0), NULL, 1))), or(eq(Column#8, 0), if(isnull(test.t.a), NULL, 0))) |
|   ├─TableReader_15(Build)                 | 2.00    | root              |               | data:TableFullScan_14                                                                                                                                                    |
|   │ └─TableFullScan_14                    | 2.00    | cop[tiflash]      | table:t       | keep order:false, stats:pseudo                                                                                                                                           |
|   └─TableReader_32(Probe)                 | 1.00    | root              |               | data:ExchangeSender_31                                                                                                                                                   |
|     └─ExchangeSender_31                   | 1.00    | batchCop[tiflash] |               | ExchangeType: PassThrough                                                                                                                                                |
|       └─Projection_27                     | 1.00    | batchCop[tiflash] |               | Column#5, Column#6, Column#7, Column#8                                                                                                                                   |
|         └─HashAgg_28                      | 1.00    | batchCop[tiflash] |               | funcs:firstrow(Column#14)->Column#5, funcs:count(distinct test.t3.a)->Column#6, funcs:sum(Column#15)->Column#7, funcs:sum(Column#16)->Column#8                           |
|           └─ExchangeReceiver_30           | 1.00    | batchCop[tiflash] |               |                                                                                                                                                                          |
|             └─ExchangeSender_29           | 1.00    | batchCop[tiflash] |               | ExchangeType: PassThrough                                                                                                                                                |
|               └─HashAgg_18                | 1.00    | batchCop[tiflash] |               | group by:Column#22, funcs:firstrow(Column#20)->Column#14, funcs:sum(Column#21)->Column#15, funcs:count(1)->Column#16                                                     |
|                 └─Projection_34           | 1.00    | batchCop[tiflash] |               | test.t3.a, cast(isnull(test.t3.a), decimal(20,0) BINARY)->Column#21, test.t3.a                                                                                           |
|                   └─TableRangeScan_26     | 1.00    | batchCop[tiflash] | table:t3      | range: decided by [eq(test.t.a, test.t3.id)], keep order:false, stats:pseudo                                                                                             |
+-------------------------------------------+---------+-------------------+---------------+--------------------------------------------------------------------------------------------------------------------------------------------------------------------------+
*/

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

null

3. What did you see instead (Required)

empty result

4. What is your TiDB version? (Required)

master nightly

@SeaRise SeaRise added the type/bug The issue is confirmed as a bug. label Mar 15, 2022
@SeaRise
Copy link
Contributor Author

SeaRise commented Mar 15, 2022

pingcap/tiflash#4071

@ti-chi-bot ti-chi-bot added may-affects-4.0 This bug maybe affects 4.0.x versions. may-affects-5.0 This bug maybe affects 5.0.x versions. may-affects-5.1 This bug maybe affects 5.1.x versions. may-affects-5.2 This bug maybe affects 5.2.x versions. may-affects-5.3 This bug maybe affects 5.3.x versions. may-affects-5.4 This bug maybe affects 5.4.x versions. labels Mar 15, 2022
@aytrack aytrack added affects-5.3 This bug affects 5.3.x versions. affects-5.4 This bug affects 5.4.x versions. labels Mar 15, 2022
@ti-chi-bot ti-chi-bot removed may-affects-5.3 This bug maybe affects 5.3.x versions. may-affects-5.4 This bug maybe affects 5.4.x versions. labels Mar 15, 2022
@aytrack aytrack added affects-5.1 This bug affects 5.1.x versions. affects-5.2 This bug affects 5.2.x versions. and removed may-affects-4.0 This bug maybe affects 4.0.x versions. may-affects-5.1 This bug maybe affects 5.1.x versions. may-affects-5.2 This bug maybe affects 5.2.x versions. may-affects-5.0 This bug maybe affects 5.0.x versions. labels Mar 16, 2022
@SeaRise
Copy link
Contributor Author

SeaRise commented Apr 12, 2022

/assign @SeaRise

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
affects-5.1 This bug affects 5.1.x versions. affects-5.2 This bug affects 5.2.x versions. affects-5.3 This bug affects 5.3.x versions. affects-5.4 This bug affects 5.4.x versions. component/tiflash severity/critical 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.

4 participants