File tree Expand file tree Collapse file tree 2 files changed +13
-8
lines changed
datafusion/common/src/utils Expand file tree Collapse file tree 2 files changed +13
-8
lines changed Original file line number Diff line number Diff line change @@ -173,10 +173,10 @@ jobs:
173173 ref : ${{ github.event.inputs.pr_head_sha }} # will be empty if triggered by push
174174 submodules : true
175175 fetch-depth : 1
176- - name : Setup Rust toolchain
177- uses : ./.github/actions/setup-builder
178- with :
179- rust-version : stable
176+ # Don't use setup-builder to avoid configuring RUST_BACKTRACE which is expensive
177+ - name : Install protobuf compiler
178+ run : |
179+ apt-get update && apt-get install -y protobuf-compiler
180180 - name : Run sqllogictest
181181 run : |
182182 cargo test --features backtrace,parquet_encryption --profile ci-optimized --test sqllogictests -- --include-sqlite
Original file line number Diff line number Diff line change @@ -40,7 +40,7 @@ use std::cmp::{Ordering, min};
4040use std:: collections:: HashSet ;
4141use std:: num:: NonZero ;
4242use std:: ops:: Range ;
43- use std:: sync:: Arc ;
43+ use std:: sync:: { Arc , LazyLock } ;
4444use std:: thread:: available_parallelism;
4545
4646/// Applies an optional projection to a [`SchemaRef`], returning the
@@ -923,10 +923,15 @@ pub fn combine_limit(
923923///
924924/// This is a wrapper around `std::thread::available_parallelism`, providing a default value
925925/// of `1` if the system's parallelism cannot be determined.
926+ ///
927+ /// The result is cached after the first call.
926928pub fn get_available_parallelism ( ) -> usize {
927- available_parallelism ( )
928- . unwrap_or ( NonZero :: new ( 1 ) . expect ( "literal value `1` shouldn't be zero" ) )
929- . get ( )
929+ static PARALLELISM : LazyLock < usize > = LazyLock :: new ( || {
930+ available_parallelism ( )
931+ . unwrap_or ( NonZero :: new ( 1 ) . expect ( "literal value `1` shouldn't be zero" ) )
932+ . get ( )
933+ } ) ;
934+ * PARALLELISM
930935}
931936
932937/// Converts a collection of function arguments into a fixed-size array of length N
You can’t perform that action at this time.
0 commit comments