You are an expert in writing code in many different languages. Your goal is to perform code completion for the following code, keeping in mind the rest of the code and the file meta data.
    Metadata details:
    filename: default_cmp_sel_ops.eg.go
    path of file: ./repos/cockroach/pkg/sql/colexec/colexecsel
    
    the code of the file until where you have to start completion: // Code generated by execgen; DO NOT EDIT.
// Copyright 2020 The Cockroach Authors.
//
// Use of this software is governed by the Business Source License
// included in the file licenses/BSL.txt.
//
// As of the Change Date specified in that file, in accordance with
// the Business Source License, use of this software will be governed
// by the Apache License, Version 2.0, included in the file
// licenses/APL.txt.

package colexecse
    
func (d *defaultCmpConstSelOp) Next() coldata.Batch {
	for {
		batch := d.Input.Next()
		n := batch.Length()
		if n == 0 {
			return coldata.ZeroBatch
		}
		d.toDatumConverter.ConvertBatchAndDeselect(batch)
		leftColumn := d.toDatumConverter.GetDatumColumn(d.colIdx)
		_ = leftColumn[n-1]
		var idx int
		hasSel := batch.Selection() != nil
		batch.SetSelection(true)
		sel := batch.Selection()
		_ = sel[n-1]
		for i := 0; i < n; i++ {
			// Note that we performed a conversion with deselection, so there
			// is no need to check whether hasSel is true.
			//gcassert:bce
			res, err := d.adapter.Eval(d.Ctx, leftColumn[i], d.constArg)
			if err != nil {
				colexecerror.ExpectedError(err)
			}
			if res == tree.DBoolTrue {
				rowIdx := i
				if hasSel {
					//gcassert:bce
					rowIdx = sel[i]
				}
				sel[idx] = rowIdx
				idx++
			}
		}
		if idx > 0 {
			batch.SetLength(idx)
			return batch
		}
	}
}