kangkaisen commented on issue #4616: URL: https://github.com/apache/incubator-doris/issues/4616#issuecomment-694707025
> 一个SQL是这样的: > select * from dwd_applications t1 left join dwd_assignments t2 on t1.id = t2.id > where t2.column = XXX > > 但是,如果t2.column需要的值,【不包含null】,其实可以这样: > select * from dwd_applications t1 left join dwd_assignments t2 on t1.id = t2.id > and t2.column = XXX > where t2.column = XXX > > 即,将右表的条件,【粘贴】一份到on语句中 > > 因为左连接的时候,在 on 阶段,join不上的会被补齐null,但是where里面不要null,所以不影响执行结果 > > 目前在0.12.21,这样的语法,通过explain来看,是没有下推到Scan阶段的 你是对的。 如果右表的条件可以排除掉null,我们可以把left join 转为 inner join。 我已经在我们内部完成了outer join 转inner join 的优化,等稳定后,我会贡献到社区。 ---------------------------------------------------------------- This is an automated message from the Apache Git Service. To respond to the message, please log on to GitHub and use the URL above to go to the specific comment. For queries about this service, please contact Infrastructure at: us...@infra.apache.org --------------------------------------------------------------------- To unsubscribe, e-mail: commits-unsubscr...@doris.apache.org For additional commands, e-mail: commits-h...@doris.apache.org