villebro commented on code in PR #23021:
URL: https://github.com/apache/superset/pull/23021#discussion_r1310484513
##########
superset/common/query_context_factory.py:
##########
@@ -99,3 +103,89 @@ def _convert_to_model(self, datasource: DatasourceDict) ->
BaseDatasource:
def _get_slice(self, slice_id: Any) -> Optional[Slice]:
return ChartDAO.find_by_id(slice_id)
+
+ def _process_query_object(
+ self,
+ datasource: BaseDatasource,
+ form_data: Optional[Dict[str, Any]],
+ query_object: QueryObject,
+ ) -> QueryObject:
+ self._apply_granularity(query_object, form_data, datasource)
+ self._apply_filters(query_object)
+ return query_object
+
+ def _apply_granularity(
+ self,
+ query_object: QueryObject,
+ form_data: Optional[Dict[str, Any]],
+ datasource: BaseDatasource,
+ ) -> None:
+ temporal_columns = {
+ column.column_name
+ for column in datasource.columns
+ if (column["is_dttm"] if isinstance(column, dict) else
column.is_dttm)
+ }
+ granularity = query_object.granularity
+ x_axis = form_data and form_data.get("x_axis")
+
+ if granularity:
+ filter_to_remove = None
+ if x_axis and x_axis in temporal_columns:
Review Comment:
@michael-s-molina @zephyring It appears the issue here happens due to using
an adhoc column as an x-axis. Previously I've also noticed that adhoc x-axes
may not always work as expected, and this logic probably needs to be refined
somewhat. Maybe we should have a Zoom session to work on a proper fix for this?
--
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.
To unsubscribe, e-mail: [email protected]
For queries about this service, please contact Infrastructure at:
[email protected]
---------------------------------------------------------------------
To unsubscribe, e-mail: [email protected]
For additional commands, e-mail: [email protected]