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 release-nonlto --test sqllogictests -- --include-sqlite
Original file line number Diff line number Diff line change @@ -39,7 +39,7 @@ use std::cmp::{Ordering, min};
3939use std:: collections:: HashSet ;
4040use std:: num:: NonZero ;
4141use std:: ops:: Range ;
42- use std:: sync:: Arc ;
42+ use std:: sync:: { Arc , LazyLock } ;
4343use std:: thread:: available_parallelism;
4444
4545/// Applies an optional projection to a [`SchemaRef`], returning the
@@ -922,10 +922,15 @@ pub fn combine_limit(
922922///
923923/// This is a wrapper around `std::thread::available_parallelism`, providing a default value
924924/// of `1` if the system's parallelism cannot be determined.
925+ ///
926+ /// The result is cached after the first call.
925927pub fn get_available_parallelism ( ) -> usize {
926- available_parallelism ( )
927- . unwrap_or ( NonZero :: new ( 1 ) . expect ( "literal value `1` shouldn't be zero" ) )
928- . get ( )
928+ static PARALLELISM : LazyLock < usize > = LazyLock :: new ( || {
929+ available_parallelism ( )
930+ . unwrap_or ( NonZero :: new ( 1 ) . expect ( "literal value `1` shouldn't be zero" ) )
931+ . get ( )
932+ } ) ;
933+ * PARALLELISM
929934}
930935
931936/// 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