From 8b51b59991b1b509864efa654e41ce9490065fa4 Mon Sep 17 00:00:00 2001 From: Dominik Richter Date: Sat, 30 Sep 2023 02:39:58 -0700 Subject: [PATCH] =?UTF-8?q?=F0=9F=90=9B=20resource=20=3D=3D=20null=20fixed?= =?UTF-8?q?=20(#1999)?= MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit --- llx/builtin_simple.go | 4 ++-- mql/mql_test.go | 20 ++++++++++++++++++++ 2 files changed, 22 insertions(+), 2 deletions(-) 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,