Skip to content

Commit

Permalink
Fix nullsMax in groupby (#4753)
Browse files Browse the repository at this point in the history
Update the groupby proc to make nulls the max value.

Closes #4709
  • Loading branch information
mattnibs authored Aug 15, 2023
1 parent 33a865b commit 08fc271
Showing 1 changed file with 1 addition and 5 deletions.
6 changes: 1 addition & 5 deletions runtime/op/groupby/groupby.go
Original file line number Diff line number Diff line change
Expand Up @@ -77,11 +77,7 @@ func NewAggregator(ctx context.Context, zctx *zed.Context, keyRefs, keyExprs, ag
var keyCompare, valueCompare expr.CompareFn
nkeys := len(keyExprs)
if nkeys > 0 && inputDir != 0 {
// As the default sort behavior, nullsMax=true for ascending order and
// nullsMax=false for descending order is also expected for streaming
// groupby.
nullsMax := inputDir > 0
valueCompare = expr.NewValueCompareFn(order.Which(inputDir < 0), nullsMax)
valueCompare = expr.NewValueCompareFn(order.Which(inputDir < 0), true)
rs := expr.NewCompareFn(true, keyRefs[0])
if inputDir < 0 {
keyCompare = func(a, b *zed.Value) int { return rs(b, a) }
Expand Down

0 comments on commit 08fc271

Please sign in to comment.