mirror of
https://github.com/apache/superset.git
synced 2026-04-19 08:04:53 +00:00
fix: Always use temporal type for dttm columns [ID-2] (#17458)
* fix: Always use temporal type for dttm columns * move inference and implement in chart postproc * fix test * fix test case Co-authored-by: Ville Brofeldt <ville.v.brofeldt@gmail.com>
This commit is contained in:
committed by
GitHub
parent
66d756955b
commit
1f8eff72de
@@ -1121,7 +1121,9 @@ class TestUtils(SupersetTestCase):
|
||||
generated_token = get_form_data_token({})
|
||||
assert re.match(r"^token_[a-z0-9]{8}$", generated_token) is not None
|
||||
|
||||
@pytest.mark.usefixtures("load_birth_names_dashboard_with_slices")
|
||||
def test_extract_dataframe_dtypes(self):
|
||||
slc = self.get_slice("Girls", db.session)
|
||||
cols: Tuple[Tuple[str, GenericDataType, List[Any]], ...] = (
|
||||
("dt", GenericDataType.TEMPORAL, [date(2021, 2, 4), date(2021, 2, 4)]),
|
||||
(
|
||||
@@ -1147,10 +1149,13 @@ class TestUtils(SupersetTestCase):
|
||||
("float_null", GenericDataType.NUMERIC, [None, 0.5]),
|
||||
("bool_null", GenericDataType.BOOLEAN, [None, False]),
|
||||
("obj_null", GenericDataType.STRING, [None, {"a": 1}]),
|
||||
# Non-timestamp columns should be identified as temporal if
|
||||
# `is_dttm` is set to `True` in the underlying datasource
|
||||
("ds", GenericDataType.TEMPORAL, [None, {"ds": "2017-01-01"}]),
|
||||
)
|
||||
|
||||
df = pd.DataFrame(data={col[0]: col[2] for col in cols})
|
||||
assert extract_dataframe_dtypes(df) == [col[1] for col in cols]
|
||||
assert extract_dataframe_dtypes(df, slc.datasource) == [col[1] for col in cols]
|
||||
|
||||
def test_normalize_dttm_col(self):
|
||||
def normalize_col(
|
||||
|
||||
Reference in New Issue
Block a user