Skip to content

Commit

Permalink
fix: set correct index to fix time offset error (#19)
Browse files Browse the repository at this point in the history
* fix: set correct index to fix time offset error
  • Loading branch information
kgopal492 authored and zhangvi7 committed Aug 1, 2024
1 parent 6fba557 commit 4064687
Showing 1 changed file with 7 additions and 1 deletion.
8 changes: 7 additions & 1 deletion superset/common/query_context_processor.py
Original file line number Diff line number Diff line change
Expand Up @@ -489,7 +489,13 @@ def processing_time_offsets( # pylint: disable=too-many-locals,too-many-stateme
offset_metrics_df = offset_metrics_df.rename(columns=metrics_mapping)

# 3. set time offset for index
index = (get_base_axis_labels(query_object.columns) or [DTTM_ALIAS])[0]
index = (
[
*get_base_axis_labels(query_object.columns),
query_object.granularity,
]
or [DTTM_ALIAS]
)[0]
if not dataframe_utils.is_datetime_series(offset_metrics_df.get(index)):
raise QueryObjectValidationError(
_(
Expand Down

0 comments on commit 4064687

Please sign in to comment.