Skip to content

Commit 6d8f384

Browse files
committed
Made detach function return value Send
1 parent d0064c3 commit 6d8f384

3 files changed

Lines changed: 17 additions & 11 deletions

File tree

ext/polars/src/catalog/unity.rs

Lines changed: 12 additions & 8 deletions
Original file line numberDiff line numberDiff line change
@@ -14,7 +14,7 @@ use crate::rb_modules::polars;
1414
use crate::ruby::gvl::GvlExt;
1515
use crate::utils::EnterPolarsExt;
1616
use crate::utils::to_rb_err;
17-
use crate::{RbResult, RbValueError, Wrap};
17+
use crate::{RbResult, Wrap};
1818

1919
macro_rules! rbdict_insert_keys {
2020
($dict:expr, {$a:expr}) => {
@@ -268,29 +268,33 @@ impl RbCatalogClient {
268268
storage_root: Option<String>,
269269
properties: Vec<(String, String)>,
270270
) -> RbResult<Value> {
271-
let table_info = rb.detach(|| {
272-
pl_async::get_runtime()
273-
.block_in_place_on(
271+
let table_info = rb
272+
.detach(|| {
273+
pl_async::get_runtime().block_in_place_on(
274274
self_.client().create_table(
275275
&catalog_name,
276276
&namespace,
277277
&table_name,
278278
schema.as_ref().map(|x| &x.0),
279279
&TableType::from_str(&table_type)
280-
.map_err(|e| RbValueError::new_err(e.to_string()))?,
280+
// TODO fix
281+
// .map_err(|e| RbValueError::new_err(e.to_string()))?,
282+
.unwrap(),
281283
data_source_format
282284
.as_deref()
283285
.map(DataSourceFormat::from_str)
284286
.transpose()
285-
.map_err(|e| RbValueError::new_err(e.to_string()))?
287+
// TODO fix
288+
// .map_err(|e| RbValueError::new_err(e.to_string()))?
289+
.unwrap()
286290
.as_ref(),
287291
comment.as_deref(),
288292
storage_root.as_deref(),
289293
&mut properties.iter().map(|(a, b)| (a.as_str(), b.as_str())),
290294
),
291295
)
292-
.map_err(to_rb_err)
293-
})?;
296+
})
297+
.map_err(to_rb_err)?;
294298

295299
table_info_to_rbobject(rb, table_info)
296300
}

ext/polars/src/ruby/gvl.rs

Lines changed: 3 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -12,7 +12,8 @@ pub trait GvlExt {
1212

1313
fn detach<T, F>(&self, func: F) -> T
1414
where
15-
F: FnOnce() -> T + Send;
15+
F: FnOnce() -> T + Send,
16+
T: Send;
1617
}
1718

1819
unsafe extern "C" {
@@ -52,6 +53,7 @@ impl GvlExt for Ruby {
5253
fn detach<T, F>(&self, func: F) -> T
5354
where
5455
F: Send + FnOnce() -> T,
56+
T: Send,
5557
{
5658
if std::env::var("POLARS_GVL").is_ok() {
5759
func()

ext/polars/src/ruby/thread.rs

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -37,8 +37,8 @@ pub(crate) fn start_background_ruby_thread(rb: &Ruby) {
3737
}
3838

3939
#[allow(unreachable_code)]
40-
Ok(())
41-
})
40+
()
41+
});
4242
});
4343

4444
sender

0 commit comments

Comments
 (0)