Skip to content

Commit

Permalink
.
Browse files Browse the repository at this point in the history
Signed-off-by: AilinKid <[email protected]>
  • Loading branch information
AilinKid committed Aug 9, 2024
1 parent 4540d13 commit f85d2ad
Show file tree
Hide file tree
Showing 2 changed files with 10 additions and 5 deletions.
9 changes: 6 additions & 3 deletions pkg/planner/util/funcdep_misc.go
Original file line number Diff line number Diff line change
Expand Up @@ -49,7 +49,8 @@ func ExtractNotNullFromConds(conditions []expression.Expression, p base.LogicalP
}

// ExtractConstantCols extracts constant columns from conditions.
func ExtractConstantCols(conditions []expression.Expression, sctx base.PlanContext, fds *funcdep.FDSet) intset.FastIntSet {
func ExtractConstantCols(conditions []expression.Expression, sctx base.PlanContext,
fds *funcdep.FDSet) intset.FastIntSet {
// extract constant cols
// eg: where a=1 and b is null and (1+c)=5.
// TODO: Some columns can only be determined to be constant from multiple constraints (e.g. x <= 1 AND x >= 1)
Expand Down Expand Up @@ -77,7 +78,8 @@ func ExtractConstantCols(conditions []expression.Expression, sctx base.PlanConte
}

// ExtractEquivalenceCols extracts equivalence columns from conditions.
func ExtractEquivalenceCols(conditions []expression.Expression, sctx base.PlanContext, fds *funcdep.FDSet) [][]intset.FastIntSet {
func ExtractEquivalenceCols(conditions []expression.Expression, sctx base.PlanContext,
fds *funcdep.FDSet) [][]intset.FastIntSet {
var equivObjsPair [][]expression.Expression
equivObjsPair = expression.ExtractEquivalenceColumns(equivObjsPair, conditions)
equivUniqueIDs := make([][]intset.FastIntSet, 0, len(equivObjsPair))
Expand Down Expand Up @@ -114,7 +116,8 @@ func ExtractEquivalenceCols(conditions []expression.Expression, sctx base.PlanCo
rhsUniqueID = scalarUniqueID
}
}
equivUniqueIDs = append(equivUniqueIDs, []intset.FastIntSet{intset.NewFastIntSet(lhsUniqueID), intset.NewFastIntSet(rhsUniqueID)})
equivUniqueIDs = append(equivUniqueIDs, []intset.FastIntSet{intset.NewFastIntSet(
lhsUniqueID), intset.NewFastIntSet(rhsUniqueID)})
}
return equivUniqueIDs
}
6 changes: 4 additions & 2 deletions pkg/planner/util/misc.go
Original file line number Diff line number Diff line change
Expand Up @@ -316,7 +316,8 @@ func ExtractTableAlias(p base.Plan, parentOffset int) *h.HintedTable {
firstName := p.OutputNames()[0]
for _, name := range p.OutputNames() {
if name.TblName.L != firstName.TblName.L ||
(name.DBName.L != "" && firstName.DBName.L != "" && name.DBName.L != firstName.DBName.L) { // DBName can be nil, see #46160
(name.DBName.L != "" && firstName.DBName.L != "" &&
name.DBName.L != firstName.DBName.L) { // DBName can be nil, see #46160
return nil
}
}
Expand Down Expand Up @@ -345,5 +346,6 @@ func GetPushDownCtx(pctx base.PlanContext) expression.PushDownContext {

// GetPushDownCtxFromBuildPBContext creates a PushDownContext from BuildPBContext
func GetPushDownCtxFromBuildPBContext(bctx *base.BuildPBContext) expression.PushDownContext {
return expression.NewPushDownContext(bctx.GetExprCtx().GetEvalCtx(), bctx.GetClient(), bctx.InExplainStmt, bctx.WarnHandler, bctx.ExtraWarnghandler, bctx.GroupConcatMaxLen)
return expression.NewPushDownContext(bctx.GetExprCtx().GetEvalCtx(), bctx.GetClient(),
bctx.InExplainStmt, bctx.WarnHandler, bctx.ExtraWarnghandler, bctx.GroupConcatMaxLen)
}

0 comments on commit f85d2ad

Please sign in to comment.