-
Benny.Wang authored
BUG#18447874: WRONG RESULT COMING FROM SEMI-JOIN BUG#18223655: ASSERTION FAILED: (INT)IDX >= 0 && IDX < PARENT_JOIN->TABLES If the left-hand expression(LHE) of IN predicate is a scalar subquery, E.g select 1 from `b` where (select 1 from d ) in (select `d` from `c`). In current version, during transforming In-predicate into semi-join, the select list of LHE and RHE will be extracted to construct a new equivalent expression as the where_cond to be added to Outer-query. As for the example, IN-predicate (select 1 from d ) in (select `d` from `c`) will make a new equal-condition like 1='d'. However, such a transformation is correct only if table 'd' has one row. If it has an empty resultset, such a transformation is incorrect. Moreover, by executing the scalar query to see whether the resultset is empty or not is not allowed during resolve. Actually, scalar query is parsed into an Item_cache object So in current patch, the where_cond will be constructed as the followings, Item_cache<(select 1 from d )> = Item_row('d'). During execution, Item_cache will be filled by executing the scalar query, which will make the query get the right result.
Benny.Wang authoredBUG#18447874: WRONG RESULT COMING FROM SEMI-JOIN BUG#18223655: ASSERTION FAILED: (INT)IDX >= 0 && IDX < PARENT_JOIN->TABLES If the left-hand expression(LHE) of IN predicate is a scalar subquery, E.g select 1 from `b` where (select 1 from d ) in (select `d` from `c`). In current version, during transforming In-predicate into semi-join, the select list of LHE and RHE will be extracted to construct a new equivalent expression as the where_cond to be added to Outer-query. As for the example, IN-predicate (select 1 from d ) in (select `d` from `c`) will make a new equal-condition like 1='d'. However, such a transformation is correct only if table 'd' has one row. If it has an empty resultset, such a transformation is incorrect. Moreover, by executing the scalar query to see whether the resultset is empty or not is not allowed during resolve. Actually, scalar query is parsed into an Item_cache object So in current patch, the where_cond will be constructed as the followings, Item_cache<(select 1 from d )> = Item_row('d'). During execution, Item_cache will be filled by executing the scalar query, which will make the query get the right result.
Loading