Skip to content

Commit

Permalink
opt: remove unnecessary pointer indirection
Browse files Browse the repository at this point in the history
This commit removes unnecessary pointer indirection in the join order
builder.

Release note: None
  • Loading branch information
mgartner committed Sep 12, 2024
1 parent ecd8a54 commit 88f9f70
Showing 1 changed file with 6 additions and 6 deletions.
12 changes: 6 additions & 6 deletions pkg/sql/opt/xform/join_order_builder.go
Original file line number Diff line number Diff line change
Expand Up @@ -709,13 +709,13 @@ func (jb *JoinOrderBuilder) addJoins(s1, s2 vertexSet) {
func (jb *JoinOrderBuilder) makeInnerEdge(op *operator, filters memo.FiltersExpr) {
if len(filters) == 0 {
// This is a cross join. Create a single edge for the empty FiltersExpr.
jb.edges = append(jb.edges, *jb.makeEdge(op, filters))
jb.edges = append(jb.edges, jb.makeEdge(op, filters))
jb.innerEdges.Add(len(jb.edges) - 1)
return
}
for i := range filters {
// Create an edge for each conjunct.
jb.edges = append(jb.edges, *jb.makeEdge(op, filters[i:i+1]))
jb.edges = append(jb.edges, jb.makeEdge(op, filters[i:i+1]))
jb.innerEdges.Add(len(jb.edges) - 1)
}
}
Expand All @@ -724,7 +724,7 @@ func (jb *JoinOrderBuilder) makeInnerEdge(op *operator, filters memo.FiltersExpr
// join. For any given non-inner join, exactly one edge is constructed.
func (jb *JoinOrderBuilder) makeNonInnerEdge(op *operator, filters memo.FiltersExpr) {
// Always create a single edge from a non-inner join.
jb.edges = append(jb.edges, *jb.makeEdge(op, filters))
jb.edges = append(jb.edges, jb.makeEdge(op, filters))
jb.nonInnerEdges.Add(len(jb.edges) - 1)
}

Expand Down Expand Up @@ -776,13 +776,13 @@ func (jb *JoinOrderBuilder) makeTransitiveEdge(col1, col2 opt.ColumnID) {
filters := memo.FiltersExpr{jb.f.ConstructFiltersItem(condition)}

// Add the edge to the join graph.
jb.edges = append(jb.edges, *jb.makeEdge(op, filters))
jb.edges = append(jb.edges, jb.makeEdge(op, filters))
jb.innerEdges.Add(len(jb.edges) - 1)
}

// makeEdge returns a new edge given an operator and set of filters.
func (jb *JoinOrderBuilder) makeEdge(op *operator, filters memo.FiltersExpr) (e *edge) {
e = &edge{op: op, filters: filters}
func (jb *JoinOrderBuilder) makeEdge(op *operator, filters memo.FiltersExpr) (e edge) {
e = edge{op: op, filters: filters}
e.calcNullRejectedRels(jb)
e.calcSES(jb)
e.calcTES(jb.edges)
Expand Down

0 comments on commit 88f9f70

Please sign in to comment.