Skip to content

Commit

Permalink
🐛 resource == null fixed (#1999)
Browse files Browse the repository at this point in the history
  • Loading branch information
arlimus authored Sep 30, 2023
1 parent a3a4afd commit 8b51b59
Show file tree
Hide file tree
Showing 2 changed files with 22 additions and 2 deletions.
4 changes: 2 additions & 2 deletions llx/builtin_simple.go
Original file line number Diff line number Diff line change
Expand Up @@ -200,11 +200,11 @@ func chunkNeqTrueV2(e *blockExecutor, bind *RawData, chunk *Chunk, ref uint64) (
}

func bindingEqNil(e *blockExecutor, bind *RawData, chunk *Chunk, ref uint64) (*RawData, uint64, error) {
return BoolData(bind == nil), 0, nil
return BoolData(bind.Value == nil), 0, nil
}

func bindingNeqNil(e *blockExecutor, bind *RawData, chunk *Chunk, ref uint64) (*RawData, uint64, error) {
return BoolData(bind != nil), 0, nil
return BoolData(bind.Value != nil), 0, nil
}

// raw operator handling
Expand Down
20 changes: 20 additions & 0 deletions mql/mql_test.go
Original file line number Diff line number Diff line change
Expand Up @@ -169,6 +169,26 @@ func TestNullResources(t *testing.T) {
ResultIndex: 0,
Expectation: nil,
},
{
Code: "muser.nullgroup == null",
ResultIndex: 1,
Expectation: true,
},
{
Code: "muser.nullgroup == empty",
ResultIndex: 2,
Expectation: true,
},
{
Code: "muser.groups.where(null) == empty",
ResultIndex: 2,
Expectation: false,
},
{
Code: "muser.groups.where(name == '') == empty",
ResultIndex: 2,
Expectation: true,
},
{
Code: "muser.groups",
ResultIndex: 0,
Expand Down

0 comments on commit 8b51b59

Please sign in to comment.