You are viewing a plain text version of this content. The canonical link for it is here.
Posted to commits@superset.apache.org by yo...@apache.org on 2022/01/28 07:09:17 UTC
[superset] branch pull/17881/head created (now 7d23b25)
This is an automated email from the ASF dual-hosted git repository.
yongjiezhao pushed a change to branch pull/17881/head
in repository https://gitbox.apache.org/repos/asf/superset.git.
at 7d23b25 add ut
This branch includes the following new commits:
new 65a46c0 fix(sql): missing quotes in sql
new 486e1e1 fix
new fa1ce26 add test
new d558865 fix test
new 26a9d98 rm
new d61d629 rm unused import
new 610278c fix ut
new bf3dce2 fix unused ut
new 0506ddf fix ut
new 7d23b25 add ut
The 10 revisions listed above as "new" are entirely new to this
repository and will be described in separate emails. The revisions
listed as "add" were already present in the repository and have only
been added to this reference.
[superset] 01/10: fix(sql): missing quotes in sql
Posted by yo...@apache.org.
This is an automated email from the ASF dual-hosted git repository.
yongjiezhao pushed a commit to branch pull/17881/head
in repository https://gitbox.apache.org/repos/asf/superset.git
commit 65a46c0da4c6d47e9a695df38067b763c236ceac
Author: stephenLYZ <75...@qq.com>
AuthorDate: Wed Dec 29 00:28:24 2021 +0800
fix(sql): missing quotes in sql
---
superset/connectors/base/models.py | 2 +-
1 file changed, 1 insertion(+), 1 deletion(-)
diff --git a/superset/connectors/base/models.py b/superset/connectors/base/models.py
index 918927c..09aa1c5 100644
--- a/superset/connectors/base/models.py
+++ b/superset/connectors/base/models.py
@@ -398,7 +398,7 @@ class BaseDatasource(
):
return datetime.utcfromtimestamp(value / 1000)
if isinstance(value, str):
- value = value.strip("\t\n'\"")
+ value = value.strip("\t\n ")
if target_column_type == utils.GenericDataType.NUMERIC:
# For backwards compatibility and edge cases
[superset] 04/10: fix test
Posted by yo...@apache.org.
This is an automated email from the ASF dual-hosted git repository.
yongjiezhao pushed a commit to branch pull/17881/head
in repository https://gitbox.apache.org/repos/asf/superset.git
commit d558865945d2833f7f1121be1347ce89d850dc3a
Author: stephenLYZ <75...@qq.com>
AuthorDate: Sun Jan 2 11:19:37 2022 +0800
fix test
---
tests/integration_tests/druid_func_tests.py | 2 +-
1 file changed, 1 insertion(+), 1 deletion(-)
diff --git a/tests/integration_tests/druid_func_tests.py b/tests/integration_tests/druid_func_tests.py
index 6bf4992..8f8d076 100644
--- a/tests/integration_tests/druid_func_tests.py
+++ b/tests/integration_tests/druid_func_tests.py
@@ -365,7 +365,7 @@ class TestDruidFunc(SupersetTestCase):
SupersetTestCase.is_module_installed("pydruid"), "pydruid not installed"
)
def test_get_filters_keeps_values_if_not_between_in_quotes(self):
- filtr = {"col": "A", "op": "in", "val": ['"a"b']}
+ filtr = {"col": "A", "op": "in", "val": ["'a'b"]}
col = DruidColumn(column_name="A")
column_dict = {"A": col}
res = DruidDatasource.get_filters([filtr], [], column_dict)
[superset] 07/10: fix ut
Posted by yo...@apache.org.
This is an automated email from the ASF dual-hosted git repository.
yongjiezhao pushed a commit to branch pull/17881/head
in repository https://gitbox.apache.org/repos/asf/superset.git
commit 610278cdd5545cef61c1485c40f6b42f15bbbeba
Author: stephenLYZ <75...@qq.com>
AuthorDate: Fri Jan 21 23:40:52 2022 +0800
fix ut
---
tests/integration_tests/druid_func_tests.py | 2 +-
tests/integration_tests/druid_func_tests_sip38.py | 2 +-
2 files changed, 2 insertions(+), 2 deletions(-)
diff --git a/tests/integration_tests/druid_func_tests.py b/tests/integration_tests/druid_func_tests.py
index 8f8d076..659fd11 100644
--- a/tests/integration_tests/druid_func_tests.py
+++ b/tests/integration_tests/druid_func_tests.py
@@ -359,7 +359,7 @@ class TestDruidFunc(SupersetTestCase):
col = DruidColumn(column_name="A")
column_dict = {"A": col}
res = DruidDatasource.get_filters([filtr], [], column_dict)
- self.assertEqual("a", res.filter["filter"]["value"])
+ self.assertEqual('"a"', res.filter["filter"]["value"])
@unittest.skipUnless(
SupersetTestCase.is_module_installed("pydruid"), "pydruid not installed"
diff --git a/tests/integration_tests/druid_func_tests_sip38.py b/tests/integration_tests/druid_func_tests_sip38.py
index 79bd130..adc355e 100644
--- a/tests/integration_tests/druid_func_tests_sip38.py
+++ b/tests/integration_tests/druid_func_tests_sip38.py
@@ -364,7 +364,7 @@ class TestDruidFunc(SupersetTestCase):
col = DruidColumn(column_name="A")
column_dict = {"A": col}
res = DruidDatasource.get_filters([filtr], [], column_dict)
- self.assertEqual("a", res.filter["filter"]["value"])
+ self.assertEqual('"a"', res.filter["filter"]["value"])
@unittest.skipUnless(
SupersetTestCase.is_module_installed("pydruid"), "pydruid not installed"
[superset] 08/10: fix unused ut
Posted by yo...@apache.org.
This is an automated email from the ASF dual-hosted git repository.
yongjiezhao pushed a commit to branch pull/17881/head
in repository https://gitbox.apache.org/repos/asf/superset.git
commit bf3dce2a0909e06ecd1966a94a7a834f54270186
Author: stephenLYZ <75...@qq.com>
AuthorDate: Fri Jan 21 23:42:13 2022 +0800
fix unused ut
---
tests/integration_tests/druid_func_tests.py | 10 ----------
1 file changed, 10 deletions(-)
diff --git a/tests/integration_tests/druid_func_tests.py b/tests/integration_tests/druid_func_tests.py
index 659fd11..7227f48 100644
--- a/tests/integration_tests/druid_func_tests.py
+++ b/tests/integration_tests/druid_func_tests.py
@@ -364,16 +364,6 @@ class TestDruidFunc(SupersetTestCase):
@unittest.skipUnless(
SupersetTestCase.is_module_installed("pydruid"), "pydruid not installed"
)
- def test_get_filters_keeps_values_if_not_between_in_quotes(self):
- filtr = {"col": "A", "op": "in", "val": ["'a'b"]}
- col = DruidColumn(column_name="A")
- column_dict = {"A": col}
- res = DruidDatasource.get_filters([filtr], [], column_dict)
- self.assertEqual("'a'b", res.filter["filter"]["value"])
-
- @unittest.skipUnless(
- SupersetTestCase.is_module_installed("pydruid"), "pydruid not installed"
- )
def test_get_filters_keeps_trailing_spaces(self):
filtr = {"col": "A", "op": "in", "val": ["a "]}
col = DruidColumn(column_name="A")
[superset] 05/10: rm
Posted by yo...@apache.org.
This is an automated email from the ASF dual-hosted git repository.
yongjiezhao pushed a commit to branch pull/17881/head
in repository https://gitbox.apache.org/repos/asf/superset.git
commit 26a9d982f44bf288aed812f0f434870ccadfd0de
Author: stephenLYZ <75...@qq.com>
AuthorDate: Fri Jan 21 22:11:08 2022 +0800
rm
---
superset/connectors/base/models.py | 4 ----
1 file changed, 4 deletions(-)
diff --git a/superset/connectors/base/models.py b/superset/connectors/base/models.py
index 85d8edd..6f00740 100644
--- a/superset/connectors/base/models.py
+++ b/superset/connectors/base/models.py
@@ -401,10 +401,6 @@ class BaseDatasource(
if isinstance(value, str):
value = value.strip("\t\n")
- quotes_value = re.findall(r"['|\"](.*?)['|\"]", value)
- if len(quotes_value) == 1 and quotes_value[0] == value.strip("'\""):
- value = value.strip("'\"")
-
if target_column_type == utils.GenericDataType.NUMERIC:
# For backwards compatibility and edge cases
# where a column data type might have changed
[superset] 03/10: add test
Posted by yo...@apache.org.
This is an automated email from the ASF dual-hosted git repository.
yongjiezhao pushed a commit to branch pull/17881/head
in repository https://gitbox.apache.org/repos/asf/superset.git
commit fa1ce26f246a4c3cc9c689e946edcf2c6f89734d
Author: stephenLYZ <75...@qq.com>
AuthorDate: Sun Jan 2 11:09:36 2022 +0800
add test
---
tests/integration_tests/druid_func_tests.py | 10 ++++++++++
1 file changed, 10 insertions(+)
diff --git a/tests/integration_tests/druid_func_tests.py b/tests/integration_tests/druid_func_tests.py
index af31081..6bf4992 100644
--- a/tests/integration_tests/druid_func_tests.py
+++ b/tests/integration_tests/druid_func_tests.py
@@ -364,6 +364,16 @@ class TestDruidFunc(SupersetTestCase):
@unittest.skipUnless(
SupersetTestCase.is_module_installed("pydruid"), "pydruid not installed"
)
+ def test_get_filters_keeps_values_if_not_between_in_quotes(self):
+ filtr = {"col": "A", "op": "in", "val": ['"a"b']}
+ col = DruidColumn(column_name="A")
+ column_dict = {"A": col}
+ res = DruidDatasource.get_filters([filtr], [], column_dict)
+ self.assertEqual("'a'b", res.filter["filter"]["value"])
+
+ @unittest.skipUnless(
+ SupersetTestCase.is_module_installed("pydruid"), "pydruid not installed"
+ )
def test_get_filters_keeps_trailing_spaces(self):
filtr = {"col": "A", "op": "in", "val": ["a "]}
col = DruidColumn(column_name="A")
[superset] 09/10: fix ut
Posted by yo...@apache.org.
This is an automated email from the ASF dual-hosted git repository.
yongjiezhao pushed a commit to branch pull/17881/head
in repository https://gitbox.apache.org/repos/asf/superset.git
commit 0506ddf56cd07e5f186a1fb427d83f2de1b156a8
Author: stephenLYZ <75...@qq.com>
AuthorDate: Fri Jan 21 23:58:28 2022 +0800
fix ut
---
tests/integration_tests/query_context_tests.py | 3 ++-
1 file changed, 2 insertions(+), 1 deletion(-)
diff --git a/tests/integration_tests/query_context_tests.py b/tests/integration_tests/query_context_tests.py
index 91ce67b..166dfe5 100644
--- a/tests/integration_tests/query_context_tests.py
+++ b/tests/integration_tests/query_context_tests.py
@@ -15,6 +15,7 @@
# specific language governing permissions and limitations
# under the License.
import datetime
+import logging
import re
import time
from typing import Any, Dict
@@ -380,7 +381,7 @@ class TestQueryContext(SupersetTestCase):
assert re.search(r'[`"\[]?num[`"\]]? IS NOT NULL', sql_text)
assert re.search(
r"""NOT \([`"\[]?name[`"\]]? IS NULL[\s\n]* """
- r"""OR [`"\[]?name[`"\]]? IN \('abc'\)\)""",
+ r"""OR [`"\[]?name[`"\]]? IN \('"abc"'\)\)""",
sql_text,
)
[superset] 06/10: rm unused import
Posted by yo...@apache.org.
This is an automated email from the ASF dual-hosted git repository.
yongjiezhao pushed a commit to branch pull/17881/head
in repository https://gitbox.apache.org/repos/asf/superset.git
commit d61d62940bdca6543967f3bc75e518c6184a76c9
Author: stephenLYZ <75...@qq.com>
AuthorDate: Fri Jan 21 23:02:15 2022 +0800
rm unused import
---
superset/connectors/base/models.py | 1 -
1 file changed, 1 deletion(-)
diff --git a/superset/connectors/base/models.py b/superset/connectors/base/models.py
index 6f00740..967235f 100644
--- a/superset/connectors/base/models.py
+++ b/superset/connectors/base/models.py
@@ -15,7 +15,6 @@
# specific language governing permissions and limitations
# under the License.
import json
-import re
from datetime import datetime
from enum import Enum
from typing import Any, Dict, Hashable, List, Optional, Set, Type, Union
[superset] 10/10: add ut
Posted by yo...@apache.org.
This is an automated email from the ASF dual-hosted git repository.
yongjiezhao pushed a commit to branch pull/17881/head
in repository https://gitbox.apache.org/repos/asf/superset.git
commit 7d23b2599a9324c5812805f3343810ca8e29f4a0
Author: stephenLYZ <75...@qq.com>
AuthorDate: Wed Jan 26 22:08:49 2022 +0800
add ut
---
tests/integration_tests/sqla_models_tests.py | 23 +++++++++++++++++++++++
1 file changed, 23 insertions(+)
diff --git a/tests/integration_tests/sqla_models_tests.py b/tests/integration_tests/sqla_models_tests.py
index 105316d..2c12620 100644
--- a/tests/integration_tests/sqla_models_tests.py
+++ b/tests/integration_tests/sqla_models_tests.py
@@ -550,6 +550,29 @@ class TestDatabaseModel(SupersetTestCase):
)
assert result_object.df["count"][0] == 4
+ def test_values_in_quotes(self):
+ table = SqlaTable(
+ table_name="test_quotes_in_column",
+ sql=(
+ "SELECT '\"text in double quotes\"' as name "
+ "UNION SELECT '''text in single quotes''' "
+ "UNION SELECT 'double quotes \" in text' "
+ "UNION SELECT 'single quotes '' in text' "
+ ),
+ database=get_example_database(),
+ )
+ TableColumn(column_name="name", type="VARCHAR(255)", table=table)
+
+ rv = table.values_for_column(column_name="name", limit=10000,)
+
+ for item in [
+ '"text in double quotes"',
+ "'text in single quotes'",
+ 'double quotes " in text',
+ "single quotes ' in text",
+ ]:
+ assert item in rv
+
@pytest.mark.parametrize(
"row,dimension,result",
[superset] 02/10: fix
Posted by yo...@apache.org.
This is an automated email from the ASF dual-hosted git repository.
yongjiezhao pushed a commit to branch pull/17881/head
in repository https://gitbox.apache.org/repos/asf/superset.git
commit 486e1e1dc741392b69a5eb541096296ae76ac21e
Author: stephenLYZ <75...@qq.com>
AuthorDate: Sun Jan 2 00:10:03 2022 +0800
fix
---
superset/connectors/base/models.py | 7 ++++++-
1 file changed, 6 insertions(+), 1 deletion(-)
diff --git a/superset/connectors/base/models.py b/superset/connectors/base/models.py
index 09aa1c5..85d8edd 100644
--- a/superset/connectors/base/models.py
+++ b/superset/connectors/base/models.py
@@ -15,6 +15,7 @@
# specific language governing permissions and limitations
# under the License.
import json
+import re
from datetime import datetime
from enum import Enum
from typing import Any, Dict, Hashable, List, Optional, Set, Type, Union
@@ -398,7 +399,11 @@ class BaseDatasource(
):
return datetime.utcfromtimestamp(value / 1000)
if isinstance(value, str):
- value = value.strip("\t\n ")
+ value = value.strip("\t\n")
+
+ quotes_value = re.findall(r"['|\"](.*?)['|\"]", value)
+ if len(quotes_value) == 1 and quotes_value[0] == value.strip("'\""):
+ value = value.strip("'\"")
if target_column_type == utils.GenericDataType.NUMERIC:
# For backwards compatibility and edge cases