This is an automated email from the ASF dual-hosted git repository.
alamb pushed a commit to branch branch-53
in repository https://gitbox.apache.org/repos/asf/datafusion.git
The following commit(s) were added to refs/heads/branch-53 by this push:
new 21cbd3803d [branch-53] Planning speed improve (port of #21084) (#21137)
21cbd3803d is described below
commit 21cbd3803d701d68c13ce913af0fe60a6e79ebb6
Author: Dmitrii Blaginin <[email protected]>
AuthorDate: Wed Mar 25 20:32:04 2026 +0000
[branch-53] Planning speed improve (port of #21084) (#21137)
- Port of #21084 to 53
- Related to https://github.com/apache/datafusion/issues/21079
Co-authored-by: Andrew Lamb <[email protected]>
---
.github/workflows/extended.yml | 8 ++++----
datafusion/common/src/utils/mod.rs | 13 +++++++++----
2 files changed, 13 insertions(+), 8 deletions(-)
diff --git a/.github/workflows/extended.yml b/.github/workflows/extended.yml
index 9768d475c9..8f8597554b 100644
--- a/.github/workflows/extended.yml
+++ b/.github/workflows/extended.yml
@@ -173,10 +173,10 @@ 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
- with:
- rust-version: stable
+ # Don't use setup-builder to avoid configuring RUST_BACKTRACE which is
expensive
+ - name: Install protobuf compiler
+ run: |
+ apt-get update && apt-get install -y protobuf-compiler
- name: Run sqllogictest
run: |
cargo test --features backtrace,parquet_encryption --profile
release-nonlto --test sqllogictests -- --include-sqlite
diff --git a/datafusion/common/src/utils/mod.rs
b/datafusion/common/src/utils/mod.rs
index 7f2d78d579..73e8ba6c70 100644
--- a/datafusion/common/src/utils/mod.rs
+++ b/datafusion/common/src/utils/mod.rs
@@ -39,7 +39,7 @@ use std::cmp::{Ordering, min};
use std::collections::HashSet;
use std::num::NonZero;
use std::ops::Range;
-use std::sync::Arc;
+use std::sync::{Arc, LazyLock};
use std::thread::available_parallelism;
/// Applies an optional projection to a [`SchemaRef`], returning the
@@ -922,10 +922,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(|| {
+ available_parallelism()
+ .unwrap_or(NonZero::new(1).expect("literal value `1` shouldn't be
zero"))
+ .get()
+ });
+ *PARALLELISM
}
/// Converts a collection of function arguments into a fixed-size array of
length N
---------------------------------------------------------------------
To unsubscribe, e-mail: [email protected]
For additional commands, e-mail: [email protected]