Skip to content

Commit

Permalink
Fix join with nulls (#4801)
Browse files Browse the repository at this point in the history
For auto join sorts make sure nulls are max or last.

Closes #4800
mattnibs authored Oct 11, 2023

Verified

This commit was created on GitHub.com and signed with GitHub’s verified signature. The key has expired.
1 parent e0f4839 commit da25095
Showing 2 changed files with 10 additions and 2 deletions.
4 changes: 2 additions & 2 deletions runtime/op/join/join.go
Original file line number Diff line number Diff line change
@@ -50,13 +50,13 @@ func New(octx *op.Context, anti, inner bool, left, right zbuf.Puller, leftKey, r
}
// Add sorts if needed.
if !leftDir.HasOrder(o) {
left, err = sort.New(octx, left, []expr.Evaluator{leftKey}, o, true)
left, err = sort.New(octx, left, []expr.Evaluator{leftKey}, o, false)
if err != nil {
return nil, err
}
}
if !rightDir.HasOrder(o) {
right, err = sort.New(octx, right, []expr.Evaluator{rightKey}, o, true)
right, err = sort.New(octx, right, []expr.Evaluator{rightKey}, o, false)
if err != nil {
return nil, err
}
8 changes: 8 additions & 0 deletions runtime/op/join/ztests/auto-sort.yaml
Original file line number Diff line number Diff line change
@@ -14,30 +14,38 @@ script: |
inputs:
- name: a.zson
data: |
{a:null(int64)}
{a:1}
{a:2}
- name: b.zson
data: |
{b:2}
{b:1}
{b:null(int64)}
outputs:
- name: stdout
data: |
{a:1}
{a:2}
{a:null(int64)}
// ===
{a:2}
{a:1}
{a:null(int64)}
// ===
{a:1}
{a:2}
{a:null(int64)}
// ===
{a:1}
{a:2}
{a:null(int64)}
// ===
{a:2}
{a:1}
{a:null(int64)}
// ===
{a:2}
{a:1}
{a:null(int64)}

0 comments on commit da25095

Please sign in to comment.