pingcap / tidb

TiDB is an open-source, cloud-native, distributed, MySQL-Compatible database for elastic scale and real-time analytics. Try AI-powered Chat2Query free at : https://www.pingcap.com/tidb-serverless/

Home Page:https://pingcap.com

Geek Repo:Geek Repo

Github PK Tool:Github PK Tool

Optimizer: refactor outer to inner join conversion as a separate rule

ghazalfamilyusa opened this issue · comments

Enhancement

Currently, the outer to inner join rewrite is part of the predicate push down. This is causing confusion and difficulty in extending of both rewrites. Also, the current implementation of outer to inner join rewrite has unnecessary special cases and error prone. Also, the unit test cases currently are very limited and we need more coverage of the scope.

Details

The enhancement will basically accomplish the following:

  • Create a new rule "outer_to_inner_join" and add it to the logical optimizations rule set. The rule is indepedent of the predicate push down and precedes it since it can trigger it.
  • Simplify the logic for AND/OR predicates and remove special cases.
  • Detailed unit test that covers all scenarios.