From 0474120c04557f9f446f6aa445935f45251585ff Mon Sep 17 00:00:00 2001 From: Aakash Saravanan Date: Sat, 3 Oct 2026 21:15:48 +0000 Subject: [PATCH] fix(statement): remove implicit timeout from synchronous execute Signed-off-by: Aakash Saravanan --- docs/spec-v0.md | 2 +- include/databricks_kernel.h | 4 ++-- pyo3/src/statement.rs | 4 ++-- src/c_abi/statement.rs | 2 +- src/client/transport.rs | 6 +++--- src/statement/mutable.rs | 10 ++++------ 6 files changed, 13 insertions(+), 15 deletions(-) diff --git a/docs/spec-v0.md b/docs/spec-v0.md index 4cbb0530..80b7685e 100644 --- a/docs/spec-v0.md +++ b/docs/spec-v0.md @@ -644,7 +644,7 @@ impl Statement { /// Read-only access (for logging or assertion). pub fn spec_ref(&self) -> &StatementSpec; - /// Wait-for-result execution with the existing 600s polling ceiling. + /// Wait-for-result execution without an overall client polling deadline. pub async fn execute(&mut self) -> Result; /// Execute with a client deadline through terminal-state mapping. diff --git a/include/databricks_kernel.h b/include/databricks_kernel.h index 285f35b5..d5ac290d 100644 --- a/include/databricks_kernel.h +++ b/include/databricks_kernel.h @@ -709,8 +709,8 @@ KernelStatusCode kernel_statement_set_query_tags(kernel_statement_t* stmt, const char* query_tags); /* - * Wait-for-result execution with the existing 600-second polling ceiling and - * no caller-supplied deadline. On success, release `*out` with + * Wait-for-result execution without an overall client polling deadline. + * On success, release `*out` with * `kernel_executed_statement_close`. */ KernelStatusCode kernel_statement_execute(kernel_statement_t* stmt, diff --git a/pyo3/src/statement.rs b/pyo3/src/statement.rs index 97b4acd9..2b75eca6 100644 --- a/pyo3/src/statement.rs +++ b/pyo3/src/statement.rs @@ -235,8 +235,8 @@ impl Statement { /// `ExecutedAsyncStatement` the caller drives via `status()` / /// `await_result()` / `fetch_result()`. /// - /// Long-running queries that would blow past `execute()`'s sync - /// polling budget belong on this path. + /// Use this path when the caller needs a poll/cancel handle instead of + /// waiting synchronously for a terminal state. fn submit(&mut self, py: Python<'_>) -> PyResult { let inner = alive_mut!(self, "Statement"); let runtime = inner.runtime.clone(); diff --git a/src/c_abi/statement.rs b/src/c_abi/statement.rs index 29092e34..5f10c9dd 100644 --- a/src/c_abi/statement.rs +++ b/src/c_abi/statement.rs @@ -464,7 +464,7 @@ pub unsafe extern "C" fn kernel_statement_execute( return store_invalid_arg("kernel_statement_execute: out must not be null"); } - execute_with_timeout_mode(stmt, ExecutionTimeout::Default, out) + execute_with_timeout_mode(stmt, ExecutionTimeout::Unlimited, out) } /// Wait-for-result execution with a client deadline in milliseconds. diff --git a/src/client/transport.rs b/src/client/transport.rs index 3b4914c0..4415f78d 100644 --- a/src/client/transport.rs +++ b/src/client/transport.rs @@ -35,12 +35,12 @@ use std::time::{Duration, Instant}; // ─── Transport-shared config ──────────────────────────────────────── -/// Timeout policy for synchronous execution. +/// Timeout policy for statement execution. #[derive(Debug, Clone, Copy, PartialEq, Eq)] pub(crate) enum ExecutionTimeout { /// Preserve the transport's pre-existing polling ceiling. Default, - /// The caller explicitly disabled the client timeout. + /// Skip the transport's polling ceiling. Unlimited, /// Apply one absolute client deadline. Deadline(Instant), @@ -60,7 +60,7 @@ impl ExecutionTimeout { /// never reads it. #[derive(Debug, Clone)] pub(crate) struct TransportConfig { - /// Default polling ceiling for sync, async, and metadata execution (600s). + /// Default polling ceiling for async and metadata execution (600s). pub poll_timeout: Duration, /// Interval between status polls (default: 500ms). pub poll_interval: Duration, diff --git a/src/statement/mutable.rs b/src/statement/mutable.rs index 98b42676..5925fed9 100644 --- a/src/statement/mutable.rs +++ b/src/statement/mutable.rs @@ -303,11 +303,9 @@ impl Statement { /// statement on success and returns `state=CLOSED`. Setting /// `wait_timeout=10s` explicitly returns `state=SUCCEEDED` /// (statement still alive server-side, requires a separate - /// `CloseStatement`) and adds ~150–260ms to the response — - /// observed against Dogfood; see PR description for the bench - /// numbers. The kernel polls internally if the query needs - /// longer than 10s. This entry point retains the transport's 600s polling - /// ceiling; use [`Statement::execute_with_timeout`] to choose another limit. + /// `CloseStatement`). The kernel polls internally if the query needs + /// longer than 10s. This entry point has no overall client polling deadline; + /// use [`Statement::execute_with_timeout`] to set one. /// /// If a prior executed handle is still tracked by this `Statement`, /// the kernel spawns a fire-and-forget `CloseStatement` against it @@ -317,7 +315,7 @@ impl Statement { /// calls on it short-circuit to `InvalidStatementHandle` without /// hitting the wire. pub async fn execute(&mut self) -> Result { - self.execute_with_timeout_mode(ExecutionTimeout::Default) + self.execute_with_timeout_mode(ExecutionTimeout::Unlimited) .await }