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


##########
superset/db_engine_specs/databricks.py:
##########
@@ -775,6 +776,11 @@ class 
DatabricksPythonConnectorEngineSpec(DatabricksDynamicBaseEngineSpec):
 
     parameters_schema = DatabricksPythonConnectorSchema()
 
+    # The driver only populates `cursor.active_command_id` once a statement has
+    # actually been executed, so the cancel id can't be captured up front like
+    # it can for engines where it's tied to the session rather than the query.
+    has_query_id_before_execute = False

Review Comment:
   The concern is valid, but it cannot be resolved by changing 
`has_query_id_before_execute` alone. `cursor.execute()` is synchronous and 
blocks until the Databricks statement completes, so Superset has no opportunity 
to persist a cancellation ID while that call is in flight. The post-execute 
hook is therefore inherently too late for “Stop” during execution.
   
   Supporting this would require a larger execution-flow change, for example:
   
   1. Submit the SEA statement without blocking.
   2. Persist the returned statement ID immediately.
   3. Poll for completion separately.
   4. Allow `cancel_query` to reconstruct and cancel that statement ID while 
polling.
   
   The implementation must also clear or replace any previously stored ID 
before starting a new statement; otherwise a cancellation request could target 
the preceding query. Unless the Databricks connector exposes a public 
submit/poll API that Superset can integrate with, retaining 
`has_query_id_before_execute = False` is correct for the current synchronous 
path. The current change supports cancellation only after the query ID has been 
captured and cannot guarantee cancellation during `cursor.execute()`.



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