Skip to content

Commit

Permalink
fix: Presto column_type_mappings time and timestamp (apache#12861)
Browse files Browse the repository at this point in the history
* Fix presto column_type_mappings time and timestamp

* Added unit tests
  • Loading branch information
Ricardo Gândara Pinto authored Feb 1, 2021
1 parent 783aae1 commit 51195af
Show file tree
Hide file tree
Showing 2 changed files with 7 additions and 1 deletion.
2 changes: 1 addition & 1 deletion superset/db_engine_specs/presto.py
Original file line number Diff line number Diff line change
Expand Up @@ -353,8 +353,8 @@ def _show_columns(
(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()),
Expand Down
6 changes: 6 additions & 0 deletions tests/db_engine_specs/presto_tests.py
Original file line number Diff line number Diff line change
Expand Up @@ -554,6 +554,12 @@ def test_get_sqla_column_type(self):
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

Expand Down

0 comments on commit 51195af

Please sign in to comment.