villebro commented on a change in pull request #13138:
URL: https://github.com/apache/superset/pull/13138#discussion_r578007300
##########
File path: superset/utils/core.py
##########
@@ -1579,3 +1580,34 @@ def format_list(items: Sequence[str], sep: str = ", ",
quote: str = '"') -> str:
def find_duplicates(items: Iterable[InputType]) -> List[InputType]:
"""Find duplicate items in an iterable."""
return [item for item, count in collections.Counter(items).items() if
count > 1]
+
+
+def normalize_dttm_col(
+ df: pd.DataFrame,
+ timestamp_format: Optional[str],
+ offset: int,
+ time_shift: Optional[timedelta],
+) -> pd.DataFrame:
+ if DTTM_ALIAS not in df.columns:
+ return df
+ df = df.copy()
Review comment:
Good point @robdiciuccio . I'm a bit allergic to functions that mutate
their inputs (even Pandas is moving away from this pattern), but this could in
fact have a noticeable performance hit. I'm going to be touching this code in
the coming days, so I'll make sure to address this then (either confirm that
the copy is shallow enough to not cause a perf hit or remove the copy
operation).
----------------------------------------------------------------
This is an automated message from the Apache Git Service.
To respond to the message, please log on to GitHub and use the
URL above to go to the specific comment.
For queries about this service, please contact Infrastructure at:
[email protected]
---------------------------------------------------------------------
To unsubscribe, e-mail: [email protected]
For additional commands, e-mail: [email protected]