Skip to content

[BUG] TupleIsNull miss in ResultExpr in SelectStmt #4278

@HangyuanLiu

Description

@HangyuanLiu

Left join InlineView Result is error.

Leftjoin has no rows on the match should be NULL populated instead of an expression evaluating the value

To Reproduce
Steps to reproduce the behavior:
mysql> select * from t1;
+------+------+------+
| v1 | v2 | v3 |
+------+------+------+
| 1 | 2 | 3 |
| 4 | 5 | 6 |
+------+------+------+
2 rows in set (0.01 sec)

mysql> select * from t2;
+------+------+------+
| v1 | v2 | v3 |
+------+------+------+
| 1 | 2 | 3 |
+------+------+------+
1 row in set (0.01 sec)

mysql> select t1.v1,b.v2 from t1 left join (select v1, v2 is null as v2 from t2) as b on t1.v1=b.v1;
+------+------+
| v1 | v2 |
+------+------+
| 1 | 0 |
| 4 | 1 |
+------+------+
2 rows in set (0.01 sec)

Expected behavior
mysql> select t1.v1,b.v2 from t1 left join (select v1, v2 is null as v2 from t2) as b on t1.v1=b.v1;
+------+------+
| v1 | v2 |
+------+------+
| 1 | 0 |
| 4 | NULL |
+------+------+
2 rows in set (0.01 sec)
Additional context
Add any other context about the problem here.

Metadata

Metadata

Assignees

Labels

area/plannerIssues or PRs related to the query plannerkind/fixCategorizes issue or PR as related to a bug.

Type

No type

Projects

No projects

Milestone

No milestone

Relationships

None yet

Development

No branches or pull requests

Issue actions