Skip to content

Apache DataFusion SQL Query Engine

Replace `once_cell::Lazy` with `std::sync::LazyLock` (#14480)

Matthijs Brobbel85fbde2661bd
diff --git a/datafusion/physical-plan/Cargo.toml b/datafusion/physical-plan/Cargo.toml
index 83dc954953..a72d19cda3 100644
--- a/datafusion/physical-plan/Cargo.toml
+++ b/datafusion/physical-plan/Cargo.toml
@@ -68,7 +68,6 @@ tokio = { workspace = true }
criterion = { version = "0.5", features = ["async_futures"] }
datafusion-functions-aggregate = { workspace = true }
datafusion-functions-window = { workspace = true }
-once_cell = "1.18.0"
rand = { workspace = true }
rstest = { workspace = true }
rstest_reuse = "0.7.0"
diff --git a/datafusion/physical-plan/src/joins/symmetric_hash_join.rs b/datafusion/physical-plan/src/joins/symmetric_hash_join.rs
index 2dbff25e70..59aab3395e 100644
--- a/datafusion/physical-plan/src/joins/symmetric_hash_join.rs
+++ b/datafusion/physical-plan/src/joins/symmetric_hash_join.rs
@@ -1711,7 +1711,7 @@ pub enum SHJStreamState {
#[cfg(test)]
mod tests {
use std::collections::HashMap;
- use std::sync::Mutex;
+ use std::sync::{LazyLock, Mutex};
use super::*;
use crate::joins::test_utils::{
@@ -1729,7 +1729,6 @@ mod tests {
use datafusion_physical_expr::expressions::{binary, col, lit, Column};
use datafusion_physical_expr_common::sort_expr::{LexOrdering, PhysicalSortExpr};
- use once_cell::sync::Lazy;
use rstest::*;
const TABLE_SIZE: i32 = 30;
@@ -1738,8 +1737,8 @@ mod tests {
type TableValue = (Vec<RecordBatch>, Vec<RecordBatch>); // (left, right)
// Cache for storing tables
- static TABLE_CACHE: Lazy<Mutex<HashMap<TableKey, TableValue>>> =
- Lazy::new(|| Mutex::new(HashMap::new()));
+ static TABLE_CACHE: LazyLock<Mutex<HashMap<TableKey, TableValue>>> =
+ LazyLock::new(|| Mutex::new(HashMap::new()));
fn get_or_create_table(
cardinality: (i32, i32),