codeant-ai-for-open-source[bot] commented on code in PR #36350:
URL: https://github.com/apache/superset/pull/36350#discussion_r3973527804


##########
superset/common/query_context_processor.py:
##########
@@ -219,15 +279,17 @@ def query_cache_key(self, query_obj: QueryObject, 
**kwargs: Any) -> str | None:
         )
         return cache_key
 
-    def get_query_result(self, query_object: QueryObject) -> QueryResult:
+    def get_query_result(
+        self, query_object: QueryObject, query: Query | None = None
+    ) -> QueryResult:
         """
         Returns a pandas dataframe based on the query object.
 
         This method delegates to the datasource's get_query_result method,
         which handles query execution, normalization, time offsets, and
         post-processing.
         """
-        return self._qc_datasource.get_query_result(query_object)
+        return self._qc_datasource.get_query_result(query_object, query=query)

Review Comment:
   Yes. The optional tracking model should only be forwarded when the 
datasource explicitly supports it; otherwise semantic views and other legacy 
datasources will fail with `TypeError`.
   
   A concise fix is to inspect the bound method before passing `query`:
   
   ```python
   import inspect
   
   # ...
   
   get_query_result = self._qc_datasource.get_query_result
   if "query" in inspect.signature(get_query_result).parameters:
       return get_query_result(query_object, query=query)
   
   return get_query_result(query_object)
   ```
   
   This preserves cancellation tracking for datasources whose 
`get_query_result` implementations were updated, while retaining compatibility 
with `SemanticView` and other implementations that still accept only 
`query_object`. The same compatibility behavior should also apply to any 
grouping-set fallback path if those queries need cancellation tracking.



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