mirror of
https://github.com/apache/superset.git
synced 2026-04-19 08:04:53 +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
This commit is contained in:
@@ -1093,3 +1093,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