Code

data: Don't treat empty arrays (value = NULL) as NULL.
authorSebastian Harl <sh@tokkee.org>
Sun, 9 Nov 2014 10:48:03 +0000 (11:48 +0100)
committerSebastian Harl <sh@tokkee.org>
Sun, 9 Nov 2014 10:48:03 +0000 (11:48 +0100)
Treating them as NULL leads to weird behavior when using ANY/ALL iterators.

src/core/data.c
t/unit/core/store_lookup_test.c

index a6cd092265a274a3f1c5b316d3f9ddffe30a0f81..a954b3d5eec13b1a084917730f9e154170527fc5 100644 (file)
@@ -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 */
 
index dcf72fa5947638b12879f9d228185a1c004bde0b..4d968a630f00a272b30c6edbfab4f6ad47a97517 100644 (file)
@@ -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'",