michael-s-molina commented on code in PR #23021:
URL: https://github.com/apache/superset/pull/23021#discussion_r1310337797


##########
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:
   Hi @zephyring. Can you open a draft PR with your changes 
(`x_axis["sqlExpression"]`)? Can you also add a comment to your PR explaining 
what do you mean by 
   
   > it doesn't seem to have the same effect



-- 
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]

Reply via email to