diff --git a/superset/exceptions.py b/superset/exceptions.py index 0a27b514a84fe..8059439452a44 100644 --- a/superset/exceptions.py +++ b/superset/exceptions.py @@ -26,5 +26,9 @@ class NoDataException(SupersetException): status = 400 +class NullValueException(SupersetException): + status = 400 + + class SupersetTemplateException(SupersetException): pass diff --git a/superset/viz.py b/superset/viz.py index a595e49b68a98..a460b9f416e60 100644 --- a/superset/viz.py +++ b/superset/viz.py @@ -38,6 +38,7 @@ from six.moves import cPickle as pkl, reduce from superset import app, cache, get_manifest_file, utils +from superset.exceptions import NullValueException from superset.utils import DTTM_ALIAS, JS_MAX_INTEGER, merge_extra_filters @@ -2107,6 +2108,11 @@ def tupleify(s): df[key] = list(zip(latlong.apply(lambda x: x[0]), latlong.apply(lambda x: x[1]))) del df[spatial.get('geohashCol')] + + if df.get(key) is None: + raise NullValueException(_('Encountered invalid NULL spatial entry, \ + please consider filtering those out')) + return df def query_obj(self):