Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

planner: remove skip prealloc tag #58805

Open
wants to merge 3 commits into
base: master
Choose a base branch
from
Open
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
8 changes: 3 additions & 5 deletions pkg/planner/core/operator/logicalop/logical_aggregation.go
Original file line number Diff line number Diff line change
Expand Up @@ -135,8 +135,7 @@ func (la *LogicalAggregation) PruneColumns(parentUsedCols []*expression.Column,
}
logicaltrace.AppendColumnPruneTraceStep(la, prunedColumns, opt)
logicaltrace.AppendFunctionPruneTraceStep(la, prunedFunctions, opt)
//nolint: prealloc
var selfUsedCols []*expression.Column
selfUsedCols := make([]*expression.Column, 0, 5)
for _, aggrFunc := range la.AggFuncs {
selfUsedCols = expression.ExtractColumnsFromExpressions(selfUsedCols, aggrFunc.Args, nil)

Expand Down Expand Up @@ -597,13 +596,12 @@ func (la *LogicalAggregation) pushDownCNFPredicatesForAggregation(cond expressio
// (a > 1 and avg(b) > 1) or (a < 3), and `avg(b) > 1` can't be pushed-down.
// Then condsToPush: (a < 3) and (a > 1), ret: (a > 1 and avg(b) > 1) or (a < 3)
func (la *LogicalAggregation) pushDownDNFPredicatesForAggregation(cond expression.Expression, groupByColumns *expression.Schema, exprsOriginal []expression.Expression) ([]expression.Expression, []expression.Expression) {
//nolint: prealloc
var condsToPush []expression.Expression
var ret []expression.Expression
subDNFItem := expression.SplitDNFItems(cond)
if len(subDNFItem) == 1 {
return la.pushDownPredicatesForAggregation(subDNFItem[0], groupByColumns, exprsOriginal)
}
condsToPush := make([]expression.Expression, 0, len(subDNFItem))
var ret []expression.Expression
exprCtx := la.SCtx().GetExprCtx()
for _, item := range subDNFItem {
condsToPushForItem, retForItem := la.pushDownCNFPredicatesForAggregation(item, groupByColumns, exprsOriginal)
Expand Down
3 changes: 1 addition & 2 deletions pkg/planner/core/rule_join_reorder.go
Original file line number Diff line number Diff line change
Expand Up @@ -796,8 +796,7 @@ func findRoots(t *tracing.PlanTrace) []*tracing.PlanTrace {
if t.TP == plancodec.TypeJoin || t.TP == plancodec.TypeDataSource {
return []*tracing.PlanTrace{t}
}
//nolint: prealloc
var r []*tracing.PlanTrace
r := make([]*tracing.PlanTrace, 0, 5)
for _, child := range t.Children {
r = append(r, findRoots(child)...)
}
Expand Down
5 changes: 1 addition & 4 deletions pkg/planner/core/rule_join_reorder_dp.go
Original file line number Diff line number Diff line change
Expand Up @@ -216,18 +216,15 @@ func (s *joinReorderDPSolver) dpGraph(visitID2NodeID, nodeID2VisitID []int, _ []

func (*joinReorderDPSolver) nodesAreConnected(leftMask, rightMask uint, oldPos2NewPos []int,
totalEqEdges []joinGroupEqEdge, totalNonEqEdges []joinGroupNonEqEdge) ([]joinGroupEqEdge, []expression.Expression) {
//nolint: prealloc
var usedEqEdges []joinGroupEqEdge
//nolint: prealloc
var otherConds []expression.Expression

for _, edge := range totalEqEdges {
lIdx := uint(oldPos2NewPos[edge.nodeIDs[0]])
rIdx := uint(oldPos2NewPos[edge.nodeIDs[1]])
if ((leftMask&(1<<lIdx)) > 0 && (rightMask&(1<<rIdx)) > 0) || ((leftMask&(1<<rIdx)) > 0 && (rightMask&(1<<lIdx)) > 0) {
usedEqEdges = append(usedEqEdges, edge)
}
}
otherConds := make([]expression.Expression, 0, len(totalNonEqEdges))
for _, edge := range totalNonEqEdges {
// If the result is false, means that the current group hasn't covered the columns involved in the expression.
if edge.nodeIDMask&(leftMask|rightMask) != edge.nodeIDMask {
Expand Down