This is an automated email from the ASF dual-hosted git repository.

xuanwo pushed a commit to branch main
in repository https://gitbox.apache.org/repos/asf/iceberg-rust.git


The following commit(s) were added to refs/heads/main by this push:
     new ded5926  refactor: replace num_cpus with thread::available_parallelism 
(#526)
ded5926 is described below

commit ded59261703692b2342f904400e361f4bc81e81e
Author: SteveLauC <[email protected]>
AuthorDate: Wed Aug 7 14:37:50 2024 +0800

    refactor: replace num_cpus with thread::available_parallelism (#526)
---
 Cargo.toml                 | 1 -
 crates/iceberg/Cargo.toml  | 1 -
 crates/iceberg/src/scan.rs | 4 +++-
 3 files changed, 3 insertions(+), 3 deletions(-)

diff --git a/Cargo.toml b/Cargo.toml
index bc7a083..642c99b 100644
--- a/Cargo.toml
+++ b/Cargo.toml
@@ -66,7 +66,6 @@ itertools = "0.13"
 log = "^0.4"
 mockito = "^1"
 murmur3 = "0.5.2"
-num_cpus = "1"
 once_cell = "1"
 opendal = "0.48"
 ordered-float = "4.0.0"
diff --git a/crates/iceberg/Cargo.toml b/crates/iceberg/Cargo.toml
index 18e25e9..de5b7cd 100644
--- a/crates/iceberg/Cargo.toml
+++ b/crates/iceberg/Cargo.toml
@@ -61,7 +61,6 @@ fnv = { workspace = true }
 futures = { workspace = true }
 itertools = { workspace = true }
 murmur3 = { workspace = true }
-num_cpus = { workspace = true }
 once_cell = { workspace = true }
 opendal = { workspace = true }
 ordered-float = { workspace = true }
diff --git a/crates/iceberg/src/scan.rs b/crates/iceberg/src/scan.rs
index ebb3b00..91b30ae 100644
--- a/crates/iceberg/src/scan.rs
+++ b/crates/iceberg/src/scan.rs
@@ -61,7 +61,9 @@ pub struct TableScanBuilder<'a> {
 
 impl<'a> TableScanBuilder<'a> {
     pub(crate) fn new(table: &'a Table) -> Self {
-        let num_cpus = num_cpus::get();
+        let num_cpus = std::thread::available_parallelism()
+            .expect("failed to get number of CPUs")
+            .get();
 
         Self {
             table,

Reply via email to