alamb commented on code in PR #21084:
URL: https://github.com/apache/datafusion/pull/21084#discussion_r2969560112


##########
.github/workflows/extended.yml:
##########
@@ -173,10 +173,9 @@ jobs:
           ref: ${{ github.event.inputs.pr_head_sha }} # will be empty if 
triggered by push
           submodules: true
           fetch-depth: 1
-      - name: Setup Rust toolchain
-        uses: ./.github/actions/setup-builder

Review Comment:
   I recommend adding a comment here explaining the rationale for not calling 
`setup-builder` -- otherwise someone in the future could very reasonably undo 
this optimization by accident I think



##########
datafusion/common/src/utils/mod.rs:
##########
@@ -923,10 +923,15 @@ pub fn combine_limit(
 ///
 /// This is a wrapper around `std::thread::available_parallelism`, providing a 
default value
 /// of `1` if the system's parallelism cannot be determined.
+///
+/// The result is cached after the first call.
 pub fn get_available_parallelism() -> usize {
-    available_parallelism()
-        .unwrap_or(NonZero::new(1).expect("literal value `1` shouldn't be 
zero"))
-        .get()
+    static PARALLELISM: LazyLock<usize> = LazyLock::new(|| {

Review Comment:
   I agree -- it would be great if we could solve that and thread the correct 
context down. Maybe as a follow on PR?



-- 
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]


---------------------------------------------------------------------
To unsubscribe, e-mail: [email protected]
For additional commands, e-mail: [email protected]

Reply via email to