Skip to content

Commit 448a395

Browse files
blagininalamb
andauthored
Super fast extended tests and improved planning speed linux (#21084)
This makes sqlite extended finish in 5 minutes: https://github.com/apache/datafusion/actions/runs/23362665318/job/67969547959 Currently on main it takes 20 minutes (and a month ago it would take two hours 🤯) --------- Co-authored-by: Andrew Lamb <andrew@nerdnetworks.org>
1 parent e5c69a4 commit 448a395

File tree

2 files changed

+13
-8
lines changed

2 files changed

+13
-8
lines changed

.github/workflows/extended.yml

Lines changed: 4 additions & 4 deletions
Original file line numberDiff line numberDiff 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

datafusion/common/src/utils/mod.rs

Lines changed: 9 additions & 4 deletions
Original file line numberDiff line numberDiff line change
@@ -40,7 +40,7 @@ use std::cmp::{Ordering, min};
4040
use std::collections::HashSet;
4141
use std::num::NonZero;
4242
use std::ops::Range;
43-
use std::sync::Arc;
43+
use std::sync::{Arc, LazyLock};
4444
use 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.
926928
pub 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

0 commit comments

Comments
 (0)