mirror of
https://github.com/apache/superset.git
synced 2026-05-08 01:15:46 +00:00
fix(sqllab/charts): casting from timestamp[us] to timestamp[ns] would result in out of bounds timestamp (#18873)
* fix casting from timestamp[us] to timestamp[ns] would result in out of bounds timestamp from sqllab and charts
* Add unittests
* Lint changes and parameter variable rename
* Fix linting
(cherry picked from commit 8b72354654)
This commit is contained in:
committed by
Michael S. Molina
parent
9ca53b8905
commit
8becd3e080
@@ -1201,3 +1201,8 @@ class TestUtils(SupersetTestCase):
|
||||
# test numeric epoch_ms format
|
||||
df = pd.DataFrame([{"__timestamp": ts.timestamp() * 1000, "a": 1}])
|
||||
assert normalize_col(df, "epoch_ms", 0, None)[DTTM_ALIAS][0] == ts
|
||||
|
||||
# test that out of bounds timestamps are coerced to None instead of
|
||||
# erroring out
|
||||
df = pd.DataFrame([{"__timestamp": "1677-09-21 00:00:00", "a": 1}])
|
||||
assert pd.isnull(normalize_col(df, None, 0, None)[DTTM_ALIAS][0])
|
||||
|
||||
Reference in New Issue
Block a user