MCPcopy Create free account
hub / github.com/apache/paimon-rust / block_on_with_runtime

Function block_on_with_runtime

crates/integrations/datafusion/src/runtime.rs:61–74  ·  view source on GitHub ↗

The blocking variant is for synchronous DataFusion FFI callbacks such as CatalogProvider::schema(), where we cannot `.await` directly.

(future: F, panic_error: &'static str)

Source from the content-addressed store, hash-verified

59// The blocking variant is for synchronous DataFusion FFI callbacks such as
60// CatalogProvider::schema(), where we cannot `.await` directly.
61pub(crate) fn block_on_with_runtime<F>(future: F, panic_error: &'static str) -> F::Output
62where
63 F: Future + Send + 'static,
64 F::Output: Send + 'static,
65{
66 if Handle::try_current().is_ok() {
67 let handle = global_runtime().handle().clone();
68 std::thread::spawn(move || handle.block_on(future))
69 .join()
70 .expect(panic_error)
71 } else {
72 global_runtime().block_on(future)
73 }
74}

Callers 10

schema_namesMethod · 0.85
schemaMethod · 0.85
register_schemaMethod · 0.85
deregister_schemaMethod · 0.85
register_temp_tableMethod · 0.85
table_namesMethod · 0.85
table_existMethod · 0.85
deregister_tableMethod · 0.85
callMethod · 0.85
callMethod · 0.85

Calls 1

global_runtimeFunction · 0.85

Tested by

no test coverage detected