This is an automated email from the ASF dual-hosted git repository.
beto pushed a commit to branch master
in repository https://gitbox.apache.org/repos/asf/incubator-superset.git
The following commit(s) were added to refs/heads/master by this push:
new 722043c Allow trailing spaces in simple filter values (#7617)
722043c is described below
commit 722043c67276e1bb72bf297eaa3cf37d3ce83ee0
Author: Erik Ritter <[email protected]>
AuthorDate: Fri May 31 17:06:41 2019 -0700
Allow trailing spaces in simple filter values (#7617)
---
superset/connectors/base/models.py | 2 +-
tests/druid_func_tests.py | 9 ++++++++-
2 files changed, 9 insertions(+), 2 deletions(-)
diff --git a/superset/connectors/base/models.py
b/superset/connectors/base/models.py
index 57db0ad..2e8bc25 100644
--- a/superset/connectors/base/models.py
+++ b/superset/connectors/base/models.py
@@ -220,7 +220,7 @@ class BaseDatasource(AuditMixinNullable, ImportMixin):
def handle_single_value(v):
# backward compatibility with previous <select> components
if isinstance(v, str):
- v = v.strip('\t\n \'"')
+ v = v.strip('\t\n\'"')
if target_column_is_numeric:
# For backwards compatibility and edge cases
# where a column data type might have changed
diff --git a/tests/druid_func_tests.py b/tests/druid_func_tests.py
index 2a7a5af..52b5a51 100644
--- a/tests/druid_func_tests.py
+++ b/tests/druid_func_tests.py
@@ -234,12 +234,19 @@ class DruidFuncTestCase(unittest.TestCase):
self.assertIsNone(res)
def test_get_filters_extracts_values_in_quotes(self):
- filtr = {'col': 'A', 'op': 'in', 'val': [' "a" ']}
+ filtr = {'col': 'A', 'op': 'in', 'val': ['"a"']}
col = DruidColumn(column_name='A')
column_dict = {'A': col}
res = DruidDatasource.get_filters([filtr], [], column_dict)
self.assertEqual('a', res.filter['filter']['value'])
+ def test_get_filters_keeps_trailing_spaces(self):
+ filtr = {'col': 'A', 'op': 'in', 'val': ['a ']}
+ col = DruidColumn(column_name='A')
+ column_dict = {'A': col}
+ res = DruidDatasource.get_filters([filtr], [], column_dict)
+ self.assertEqual('a ', res.filter['filter']['value'])
+
def test_get_filters_converts_strings_to_num(self):
filtr = {'col': 'A', 'op': 'in', 'val': ['6']}
col = DruidColumn(column_name='A')