Skip to content

Commit

Permalink
This is an automated cherry-pick of pingcap#50439
Browse files Browse the repository at this point in the history
Signed-off-by: ti-chi-bot <[email protected]>
  • Loading branch information
AilinKid authored and ti-chi-bot committed Jan 15, 2024
1 parent 3f84f3f commit 9121cc0
Show file tree
Hide file tree
Showing 3 changed files with 1,131 additions and 1 deletion.
16 changes: 15 additions & 1 deletion pkg/planner/core/exhaust_physical_plans.go
Original file line number Diff line number Diff line change
Expand Up @@ -959,7 +959,21 @@ func (p *LogicalJoin) buildIndexJoinInner2IndexScan(
outerIdx int, avgInnerRowCnt float64) (joins []PhysicalPlan) {
ds := wrapper.ds
us := wrapper.us
helper, keyOff2IdxOff := p.getIndexJoinBuildHelper(ds, innerJoinKeys, func(path *util.AccessPath) bool { return !path.IsTablePath() }, outerJoinKeys)
indexValid := func(path *util.AccessPath) bool {
if path.IsTablePath() {
return false
}
// if path is index path. index path currently include two kind of, one is normal, and the other is mv index.
// for mv index like mvi(a, json, b), if driving condition is a=1, and we build a prefix scan with range [1,1]
// on mvi, it will return many index rows which breaks handle-unique attribute here.
//
// the basic rule is that: mv index can be and can only be accessed by indexMerge operator. (embedded handle duplication)
if !isMVIndexPath(path) {
return true // not a MVIndex path, it can successfully be index join probe side.
}
return false
}
helper, keyOff2IdxOff := p.getIndexJoinBuildHelper(ds, innerJoinKeys, indexValid, outerJoinKeys)
if helper == nil {
return nil
}
Expand Down
Loading

0 comments on commit 9121cc0

Please sign in to comment.