From b50c58aac035dbb91b5bc85b579aa559d010dff4 Mon Sep 17 00:00:00 2001 From: Sebastian Harl Date: Sun, 9 Nov 2014 11:48:03 +0100 Subject: [PATCH] data: Don't treat empty arrays (value = NULL) as NULL. Treating them as NULL leads to weird behavior when using ANY/ALL iterators. --- src/core/data.c | 2 -- t/unit/core/store_lookup_test.c | 2 ++ 2 files changed, 2 insertions(+), 2 deletions(-) diff --git a/src/core/data.c b/src/core/data.c index a6cd092..a954b3d 100644 --- a/src/core/data.c +++ b/src/core/data.c @@ -607,8 +607,6 @@ sdb_data_isnull(const sdb_data_t *datum) return 1; if ((datum->type == SDB_TYPE_REGEX) && (! datum->data.re.raw)) return 1; - if ((datum->type & SDB_TYPE_ARRAY) && (! datum->data.array.values)) - return 1; return 0; } /* sdb_data_isnull */ diff --git a/t/unit/core/store_lookup_test.c b/t/unit/core/store_lookup_test.c index dcf72fa..4d968a6 100644 --- a/t/unit/core/store_lookup_test.c +++ b/t/unit/core/store_lookup_test.c @@ -532,6 +532,8 @@ START_TEST(test_scan) { "name =~ 'a|b'", NULL, 2 }, { "name =~ 'host'", NULL, 0 }, { "name =~ '.'", NULL, 3 }, + { "ANY backend = 'backend'", NULL, 0 }, + { "ALL backend = ''", NULL, 3 }, /* backend is empty */ { "ANY metric = 'm1'", NULL, 2 }, { "ANY metric= 'm1'", "name = 'x'", 0 }, /* filter never matches */ { "ANY metric = 'm1'", -- 2.30.2