Skip to content

Commit

Permalink
sort.New: Remove unnecessary error return value (#5305)
Browse files Browse the repository at this point in the history
  • Loading branch information
mattnibs authored Sep 28, 2024
1 parent 9d23bd5 commit 7472e49
Show file tree
Hide file tree
Showing 3 changed files with 5 additions and 16 deletions.
6 changes: 1 addition & 5 deletions compiler/kernel/op.go
Original file line number Diff line number Diff line change
Expand Up @@ -181,11 +181,7 @@ func (b *Builder) compileLeaf(o dag.Op, parent zbuf.Puller) (zbuf.Puller, error)
}
sortExprs = append(sortExprs, expr.NewSortEvaluator(k, s.Order))
}
sort, err := sort.New(b.rctx, parent, sortExprs, v.NullsFirst, v.Reverse, b.resetters)
if err != nil {
return nil, fmt.Errorf("compiling sort: %w", err)
}
return sort, nil
return sort.New(b.rctx, parent, sortExprs, v.NullsFirst, v.Reverse, b.resetters), nil
case *dag.Head:
limit := v.Count
if limit == 0 {
Expand Down
11 changes: 2 additions & 9 deletions runtime/sam/op/join/join.go
Original file line number Diff line number Diff line change
Expand Up @@ -42,21 +42,14 @@ func New(rctx *runtime.Context, anti, inner bool, left, right zbuf.Puller, leftK
case rightDir != order.Unknown:
o = rightDir == order.Down
}
var err error
// Add sorts if needed.
if !leftDir.HasOrder(o) {
s := expr.NewSortEvaluator(leftKey, o)
left, err = sort.New(rctx, left, []expr.SortEvaluator{s}, false, false, resetter)
if err != nil {
return nil, err
}
left = sort.New(rctx, left, []expr.SortEvaluator{s}, false, false, resetter)
}
if !rightDir.HasOrder(o) {
s := expr.NewSortEvaluator(rightKey, o)
right, err = sort.New(rctx, right, []expr.SortEvaluator{s}, false, false, resetter)
if err != nil {
return nil, err
}
right = sort.New(rctx, right, []expr.SortEvaluator{s}, false, false, resetter)
}
ctx, cancel := context.WithCancel(rctx.Context)
return &Op{
Expand Down
4 changes: 2 additions & 2 deletions runtime/sam/op/sort/sort.go
Original file line number Diff line number Diff line change
Expand Up @@ -31,7 +31,7 @@ type Op struct {
comparator *expr.Comparator
}

func New(rctx *runtime.Context, parent zbuf.Puller, fields []expr.SortEvaluator, nullsFirst, reverse bool, resetter expr.Resetter) (*Op, error) {
func New(rctx *runtime.Context, parent zbuf.Puller, fields []expr.SortEvaluator, nullsFirst, reverse bool, resetter expr.Resetter) *Op {
return &Op{
rctx: rctx,
parent: parent,
Expand All @@ -40,7 +40,7 @@ func New(rctx *runtime.Context, parent zbuf.Puller, fields []expr.SortEvaluator,
reverse: reverse,
fieldResolvers: fields,
resultCh: make(chan op.Result),
}, nil
}
}

func (o *Op) Pull(done bool) (zbuf.Batch, error) {
Expand Down

0 comments on commit 7472e49

Please sign in to comment.