From 504e44eca57601adb95b3a6d9c1fabf5e6677de4 Mon Sep 17 00:00:00 2001 From: Kalyan Kanuri Date: Tue, 26 Jul 2016 23:12:18 -0700 Subject: [PATCH 1/3] null check --- caravel/models.py | 3 +++ 1 file changed, 3 insertions(+) diff --git a/caravel/models.py b/caravel/models.py index 444a4da6b7e13..008a3f0d820b7 100644 --- a/caravel/models.py +++ b/caravel/models.py @@ -1410,6 +1410,9 @@ def get_filters(raw_filters): fields.append(Dimension(col) == s) cond = Filter(type="or", fields=fields) else: + #allows setting filter to query that value of dimension is null + if eq == 'null' or eq == 'NULL': + eq = None cond = Dimension(col) == eq if op == 'not in': cond = ~cond From 136139abab94112e5dc3d1791ed8dbb22032230e Mon Sep 17 00:00:00 2001 From: Kalyan Kanuri Date: Wed, 27 Jul 2016 06:24:46 -0700 Subject: [PATCH 2/3] showing NULL --- caravel/models.py | 4 ++-- caravel/viz.py | 2 +- 2 files changed, 3 insertions(+), 3 deletions(-) diff --git a/caravel/models.py b/caravel/models.py index 008a3f0d820b7..4d41716c1311f 100644 --- a/caravel/models.py +++ b/caravel/models.py @@ -1410,8 +1410,8 @@ def get_filters(raw_filters): fields.append(Dimension(col) == s) cond = Filter(type="or", fields=fields) else: - #allows setting filter to query that value of dimension is null - if eq == 'null' or eq == 'NULL': + #allows setting filter to query that value of dimension is NULL + if eq == 'NULL': eq = None cond = Dimension(col) == eq if op == 'not in': diff --git a/caravel/viz.py b/caravel/viz.py index 3259280adb9ea..28ef014d6d829 100755 --- a/caravel/viz.py +++ b/caravel/viz.py @@ -177,7 +177,7 @@ def get_df(self, query_obj=None): if self.datasource.offset: df.timestamp += timedelta(hours=self.datasource.offset) df.replace([np.inf, -np.inf], np.nan) - df = df.fillna(0) + df = df.fillna('NULL') return df @property From 4ce1517e0352d03aedec65103a2e4d7a605d1c0b Mon Sep 17 00:00:00 2001 From: Kalyan Kanuri Date: Tue, 9 Aug 2016 13:19:57 -0700 Subject: [PATCH 3/3] NULL in filters --- caravel/models.py | 2 ++ 1 file changed, 2 insertions(+) diff --git a/caravel/models.py b/caravel/models.py index 909ccb54417cb..2e5c97c4ed6fc 100644 --- a/caravel/models.py +++ b/caravel/models.py @@ -1405,6 +1405,8 @@ def get_filters(raw_filters): if len(splitted) > 1: for s in eq.split(','): s = s.strip() + if s == 'NULL': + s = None fields.append(Dimension(col) == s) cond = Filter(type="or", fields=fields) else: