diff --git a/llx/builtin_simple.go b/llx/builtin_simple.go index f921e39013..6b349eb0e7 100644 --- a/llx/builtin_simple.go +++ b/llx/builtin_simple.go @@ -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 diff --git a/mql/mql_test.go b/mql/mql_test.go index 93f03d53bb..9115ec5d61 100644 --- a/mql/mql_test.go +++ b/mql/mql_test.go @@ -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,