Skip to content

Commit

Permalink
fix: should raise exception when apply a categorical axis (#20451)
Browse files Browse the repository at this point in the history
(cherry picked from commit 8bbbd6f)
  • Loading branch information
zhaoyongjie authored and michael-s-molina committed Jun 28, 2022
1 parent d1ac6e5 commit 4e93690
Showing 1 changed file with 10 additions and 0 deletions.
10 changes: 10 additions & 0 deletions superset/common/query_context_processor.py
Original file line number Diff line number Diff line change
Expand Up @@ -322,6 +322,16 @@ def processing_time_offsets( # pylint: disable=too-many-locals
# multi-dimensional charts
granularity = query_object.granularity
index = granularity if granularity in df.columns else DTTM_ALIAS
if not pd.api.types.is_datetime64_any_dtype(
offset_metrics_df.get(index)
):
raise QueryObjectValidationError(
_(
"A time column must be specified "
"when using a Time Comparison."
)
)

offset_metrics_df[index] = offset_metrics_df[index] - DateOffset(
**normalize_time_delta(offset)
)
Expand Down

0 comments on commit 4e93690

Please sign in to comment.