Skip to content

Commit 3cf1de4

Browse files
committed
address comments
1 parent b6e5ce5 commit 3cf1de4

File tree

2 files changed

+4
-25
lines changed

2 files changed

+4
-25
lines changed

planner/core/logical_plans.go

-6
Original file line numberDiff line numberDiff line change
@@ -321,12 +321,6 @@ func (p *LogicalJoin) extractFDForOuterJoin(filtersFromApply []expression.Expres
321321
// judge whether left filters is on non-left-equiv cols.
322322
if outerConditionUniqueIDs.Intersects(outerCols.Difference(equivOuterUniqueIDs)) {
323323
opt.SkipFDRule331 = true
324-
} else {
325-
if equivAcrossNum > 1 {
326-
opt.TypeFDRule331 = fd.CombinedFD
327-
} else {
328-
opt.TypeFDRule331 = fd.SingleFD
329-
}
330324
}
331325
} else {
332326
// if there is none across equivalence condition, skip rule 3.3.1.

planner/funcdep/fd_graph.go

+4-19
Original file line numberDiff line numberDiff line change
@@ -609,7 +609,7 @@ func (s *FDSet) MakeCartesianProduct(rhs *FDSet) {
609609
// above all: constant FD are lost
610610
//
611611
// <3.1> equivalence FD: when the left join conditions only contain equivalence FD (EFD for short below) across left and right
612-
// cols and no other `LEFT` condition on (left cols - RED's from) to filter the left join results. We can maintain the strict
612+
// cols and no other `LEFT` condition on the (left-side cols except the cols in EFD's from) to filter the left join results. We can maintain the strict
613613
// FD from EFD's `from` side to EFD's `to` side over the left join result.
614614
// a b | c d e
615615
// ------+----------------
@@ -733,13 +733,8 @@ func (s *FDSet) MakeOuterJoin(innerFDs, filterFDs *FDSet, outerCols, innerCols F
733733
leftCover := edge.from.Intersection(outerCols)
734734
rightCover := edge.from.Intersection(innerCols)
735735
if leftCover.Len() > 0 && rightCover.Len() > 0 {
736-
if opt.TypeFDRule331 == CombinedFD {
737-
leftCombinedFDFrom.UnionWith(leftCover)
738-
leftCombinedFDTo.UnionWith(rightCover)
739-
} else {
740-
// singleFD case.
741-
s.addFunctionalDependency(leftCover, rightCover, true, false)
742-
}
736+
leftCombinedFDFrom.UnionWith(leftCover)
737+
leftCombinedFDTo.UnionWith(rightCover)
743738
}
744739
}
745740

@@ -775,7 +770,7 @@ func (s *FDSet) MakeOuterJoin(innerFDs, filterFDs *FDSet, outerCols, innerCols F
775770
// Rule #3.1, filters won't produce any strict/lax FDs.
776771
}
777772
// Rule #3.3.1 combinedFD case
778-
if !opt.SkipFDRule331 && opt.TypeFDRule331 == CombinedFD {
773+
if !opt.SkipFDRule331 {
779774
s.addFunctionalDependency(leftCombinedFDFrom, leftCombinedFDTo, true, false)
780775
}
781776

@@ -839,20 +834,10 @@ func (s *FDSet) MakeRestoreRule333() {
839834
// ArgOpts contains some arg used for FD maintenance.
840835
type ArgOpts struct {
841836
SkipFDRule331 bool
842-
TypeFDRule331 TypeFilterFD331
843837
OnlyInnerFilter bool
844838
InnerIsFalse bool
845839
}
846840

847-
// TypeFilterFD331 describes the type of the filter used in this rule.
848-
type TypeFilterFD331 byte
849-
850-
// Here's the two specific type.
851-
const (
852-
SingleFD TypeFilterFD331 = 0
853-
CombinedFD TypeFilterFD331 = 1
854-
)
855-
856841
// FindPrimaryKey checks whether there's a key in the current set which implies key -> all cols.
857842
func (s FDSet) FindPrimaryKey() (*FastIntSet, bool) {
858843
allCols := s.AllCols()

0 commit comments

Comments
 (0)