Skip to content

Commit

Permalink
Merge #57848
Browse files Browse the repository at this point in the history
57848: colexec: remove almost all usages of execgen.SLICE r=yuzefovich a=yuzefovich

In several places we are using `execgen.SLICE` to eliminate some bounds
checks. This commit refactors most of those callsites to use `Get`
instead. I confirmed that the number of BCEs doesn't change because of
this commit in `colexec` and `colexecagg` packages.

Note that in all affected places actually bounds checks didn't work
before nor after this commit. That is left to be figured out later.

Release note: None

Co-authored-by: Yahor Yuzefovich <[email protected]>
  • Loading branch information
craig[bot] and yuzefovich committed Dec 12, 2020
2 parents f43005e + 6675d24 commit 3954691
Show file tree
Hide file tree
Showing 18 changed files with 3,740 additions and 4,663 deletions.
66 changes: 0 additions & 66 deletions pkg/sql/colexec/cast.eg.go

Large diffs are not rendered by default.

6 changes: 0 additions & 6 deletions pkg/sql/colexec/cast_tmpl.go
Original file line number Diff line number Diff line change
Expand Up @@ -69,11 +69,6 @@ func _R_SET(to, from interface{}) {
colexecerror.InternalError(errors.AssertionFailedf(""))
}

// This will be replaced with execgen.SLICE.
func _L_SLICE(col, i, j interface{}) interface{} {
colexecerror.InternalError(errors.AssertionFailedf(""))
}

// */}}

func GetCastOperator(
Expand Down Expand Up @@ -259,7 +254,6 @@ func _CAST_TUPLES(_HAS_NULLS, _HAS_SEL bool) { // */}}
sel = sel[:n]
// {{else}}
// Remove bounds checks for inputCol[i] and outputCol[i].
inputCol = _L_SLICE(inputCol, 0, n)
_ = inputCol.Get(n - 1)
_ = outputCol.Get(n - 1)
// {{end}}
Expand Down
2 changes: 1 addition & 1 deletion pkg/sql/colexec/colexecagg/min_max_agg_tmpl.go
Original file line number Diff line number Diff line change
Expand Up @@ -162,7 +162,7 @@ func (a *_AGG_TYPE_AGGKINDAgg) Compute(
// */}}
if sel == nil {
_ = groups[inputLen-1]
col = execgen.SLICE(col, 0, inputLen)
_ = col.Get(inputLen - 1)
if nulls.MaybeHasNulls() {
for i := 0; i < inputLen; i++ {
_ACCUMULATE_MINMAX(a, nulls, i, true)
Expand Down
44 changes: 20 additions & 24 deletions pkg/sql/colexec/colexecagg/ordered_min_max_agg.eg.go

Some generated files are not rendered by default. Learn more about how customized files appear on GitHub.

12 changes: 0 additions & 12 deletions pkg/sql/colexec/const.eg.go

Some generated files are not rendered by default. Learn more about how customized files appear on GitHub.

1 change: 0 additions & 1 deletion pkg/sql/colexec/const_tmpl.go
Original file line number Diff line number Diff line change
Expand Up @@ -124,7 +124,6 @@ func (c const_TYPEOp) Next(ctx context.Context) coldata.Batch {
execgen.SET(col, i, c.constVal)
}
} else {
col = execgen.SLICE(col, 0, n)
_ = col.Get(n - 1)
for i := 0; i < n; i++ {
execgen.SET(col, i, c.constVal)
Expand Down
Loading

0 comments on commit 3954691

Please sign in to comment.