Skip to content

Cop Apply operator will not fill correlated column value in late materialization filter condition #49241

@Lloyd-Pottiger

Description

@Lloyd-Pottiger

Bug Report

Please answer these questions before submitting your issue. Thanks!

1. Minimal reproduce step (Required)

create table t(id int, value int);
create table t1(id int, value int);
insert into t values(10,5),(9,5),(8,5),(7,5),(6,5),(5,5),(4,5),(3,5),(2,5),(1,5);
insert into t1 values(2,5);
insert into t select * from t;
insert into t select * from t;
insert into t select * from t;
insert into t select * from t;
insert into t select * from t;
insert into t select * from t;
insert into t select * from t;
insert into t select * from t;
insert into t select * from t;
insert into t select * from t;
insert into t select * from t;
alter database set tiflash replica 1;
set tidb_allow_mpp=off;
select (select t.value from t where t.id = t1.id order by t.value limit 1) xx from t1 order by t1.value limit 5;
+------+
| xx   |
+------+
| NULL |
+------+
1 row in set (0.02 sec)

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

select (select t.value from t where t.id = t1.id order by t.value limit 1) xx from t1 order by t1.value limit 5;
+------+
| xx   |
+------+
|    5 |
+------+
1 row in set (0.01 sec)

3. What did you see instead (Required)

select (select t.value from t where t.id = t1.id order by t.value limit 1) xx from t1 order by t1.value limit 5;
+------+
| xx   |
+------+
| NULL |
+------+
1 row in set (0.02 sec)

4. What is your TiDB version? (Required)

v7.1.2

Metadata

Metadata

Labels

affects-7.1This bug affects the 7.1.x(LTS) versions.affects-7.5This bug affects the 7.5.x(LTS) versions.severity/majorsig/executionSIG executiontype/bugThe issue is confirmed as a bug.

Type

No type

Projects

No projects

Milestone

No milestone

Relationships

None yet

Development

No branches or pull requests

Issue actions