Skip to content

executor: wrong results for outer join in a case #23891

@fzhedu

Description

@fzhedu

Bug Report

Please answer these questions before submitting your issue. Thanks!

1. Minimal reproduce step (Required)

mysql -h172.16.5.85 -P52324 -uroot -D subquery_agg10000

SELECT count(*), table1 . `pk` = 
    (SELECT avg( SUBQUERY5_t1 . `col_tinyint_not_null` ) AS SUBQUERY5_field1
    FROM `R` AS SUBQUERY5_t1 RIGHT OUTER
    JOIN `X` AS SUBQUERY5_t2
        ON (SUBQUERY5_t2 . `col_varchar_64` = SUBQUERY5_t1 . `col_varchar_key` ) ) AS field5
FROM `T` AS table1
RIGHT JOIN 
    (SELECT SUBQUERY6_t1 . *
    FROM `Q` AS SUBQUERY6_t1 LEFT OUTER
    JOIN `L` AS SUBQUERY6_t2
        ON (SUBQUERY6_t2 . `col_char_64` = SUBQUERY6_t1 . `col_varchar_key` ) ) AS table2
LEFT JOIN `W` AS table3
    ON (table3 . `pk` = table2 . `col_int_not_null_key` )
    ON (table3 . `col_int_key` = table2 . `col_int_not_null_key` )
GROUP BY  2
ORDER BY  2,1;

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

+----------+--------+
| count(*) | field5 |
+----------+--------+
|      174 |   NULL |
|      420 |      0 |
+----------+--------+

3. What did you see instead (Required)

+----------+--------+
| count(*) | field5 |
+----------+--------+
|      594 |      0 |
+----------+--------+

4. What is your TiDB version? (Required)

master of nightly

Metadata

Metadata

Assignees

Type

No type

Projects

No projects

Milestone

No milestone

Relationships

None yet

Development

No branches or pull requests

Issue actions