You are viewing a plain text version of this content. The canonical link for it is here.
Posted to commits@superset.apache.org by vi...@apache.org on 2021/02/02 08:25:37 UTC

[superset] 03/03: fix: Presto column_type_mappings time and timestamp (#12861)

This is an automated email from the ASF dual-hosted git repository.

villebro pushed a commit to branch 1.0
in repository https://gitbox.apache.org/repos/asf/superset.git

commit d6bd5b8ea24538207a640be23a8e51360914dfc3
Author: Ricardo Gândara Pinto <rp...@gmail.com>
AuthorDate: Mon Feb 1 15:41:57 2021 +0000

    fix: Presto column_type_mappings time and timestamp (#12861)
    
    * Fix presto column_type_mappings time and timestamp
    
    * Added unit tests
---
 superset/db_engine_specs/presto.py    | 2 +-
 tests/db_engine_specs/presto_tests.py | 6 ++++++
 2 files changed, 7 insertions(+), 1 deletion(-)

diff --git a/superset/db_engine_specs/presto.py b/superset/db_engine_specs/presto.py
index 6ef6d9d..1c1868b 100644
--- a/superset/db_engine_specs/presto.py
+++ b/superset/db_engine_specs/presto.py
@@ -353,8 +353,8 @@ class PrestoEngineSpec(BaseEngineSpec):  # pylint: disable=too-many-public-metho
         (re.compile(r"^varbinary.*", re.IGNORECASE), types.VARBINARY()),
         (re.compile(r"^json.*", re.IGNORECASE), types.JSON()),
         (re.compile(r"^date.*", re.IGNORECASE), types.DATE()),
-        (re.compile(r"^time.*", re.IGNORECASE), types.Time()),
         (re.compile(r"^timestamp.*", re.IGNORECASE), types.TIMESTAMP()),
+        (re.compile(r"^time.*", re.IGNORECASE), types.Time()),
         (re.compile(r"^interval.*", re.IGNORECASE), Interval()),
         (re.compile(r"^array.*", re.IGNORECASE), Array()),
         (re.compile(r"^map.*", re.IGNORECASE), Map()),
diff --git a/tests/db_engine_specs/presto_tests.py b/tests/db_engine_specs/presto_tests.py
index 9a493d3..721c2db 100644
--- a/tests/db_engine_specs/presto_tests.py
+++ b/tests/db_engine_specs/presto_tests.py
@@ -513,6 +513,12 @@ class TestPrestoDbEngineSpec(TestDbEngineSpec):
         sqla_type = PrestoEngineSpec.get_sqla_column_type("integer")
         assert isinstance(sqla_type, types.Integer)
 
+        sqla_type = PrestoEngineSpec.get_sqla_column_type("time")
+        assert isinstance(sqla_type, types.Time)
+
+        sqla_type = PrestoEngineSpec.get_sqla_column_type("timestamp")
+        assert isinstance(sqla_type, types.TIMESTAMP)
+
         sqla_type = PrestoEngineSpec.get_sqla_column_type(None)
         assert sqla_type is None