fresh-borzoni commented on code in PR #154:
URL: https://github.com/apache/fluss-rust/pull/154#discussion_r2695031922
##########
bindings/python/src/table.rs:
##########
@@ -321,6 +322,59 @@ impl LogScanner {
Ok(df)
}
+ /// Poll for new records with the specified timeout
+ ///
+ /// Args:
+ /// timeout_ms: Timeout in milliseconds to wait for records
+ ///
+ /// Returns:
+ /// PyArrow Table containing the polled records
+ ///
+ /// Note:
+ /// - Returns an empty table (with correct schema) if no records are
available
+ /// - When timeout expires, returns an empty table (NOT an error)
+ fn poll(&self, py: Python, timeout_ms: i64) -> PyResult<Py<PyAny>> {
+ use std::time::Duration;
+
+ if timeout_ms < 0 {
+ return Err(FlussError::new_err(format!(
+ "timeout_ms must be non-negative, got: {timeout_ms}"
+ )));
+ }
+
+ let timeout = Duration::from_millis(timeout_ms as u64);
+ let scan_records = py
+ .detach(|| TOKIO_RUNTIME.block_on(async {
self.inner.poll(timeout).await }))
Review Comment:
makes sense, thank you!
--
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]