File tree 2 files changed +10
-10
lines changed
2 files changed +10
-10
lines changed Original file line number Diff line number Diff line change 16
16
// under the License.
17
17
18
18
use crate :: types:: { LogicalTypeRef , NativeType } ;
19
- use std:: sync:: { Arc , OnceLock } ;
19
+ use std:: sync:: { Arc , LazyLock } ;
20
20
21
21
macro_rules! singleton {
22
22
( $name: ident, $getter: ident, $ty: ident) => {
23
- // TODO: Use LazyLock instead of getter function when MSRV gets bumped
24
- static $name : OnceLock < LogicalTypeRef > = OnceLock :: new( ) ;
23
+ static $name : LazyLock < LogicalTypeRef > =
24
+ LazyLock :: new( || Arc :: new ( NativeType :: $ty ) ) ;
25
25
26
26
#[ doc = "Getter for singleton instance of a logical type representing" ]
27
27
#[ doc = concat!( "[`NativeType::" , stringify!( $ty) , "`]." ) ]
28
28
pub fn $getter( ) -> LogicalTypeRef {
29
- Arc :: clone( $name. get_or_init ( || Arc :: new ( NativeType :: $ty ) ) )
29
+ Arc :: clone( & $name)
30
30
}
31
31
} ;
32
32
}
Original file line number Diff line number Diff line change 18
18
use arrow:: datatypes:: DataType ;
19
19
use datafusion_common:: { DFSchema , DFSchemaRef } ;
20
20
use std:: fmt:: { self , Display } ;
21
- use std:: sync:: { Arc , OnceLock } ;
21
+ use std:: sync:: { Arc , LazyLock } ;
22
22
23
23
use crate :: { expr_vec_fmt, Expr , LogicalPlan } ;
24
24
25
- /// Statements have a unchanging empty schema.
26
- /// TODO: Use `LazyLock` when MSRV is 1.80.0
27
- static STATEMENT_EMPTY_SCHEMA : OnceLock < DFSchemaRef > = OnceLock :: new ( ) ;
28
-
29
25
/// Various types of Statements.
30
26
///
31
27
/// # Transactions:
@@ -54,7 +50,11 @@ pub enum Statement {
54
50
impl Statement {
55
51
/// Get a reference to the logical plan's schema
56
52
pub fn schema ( & self ) -> & DFSchemaRef {
57
- STATEMENT_EMPTY_SCHEMA . get_or_init ( || Arc :: new ( DFSchema :: empty ( ) ) )
53
+ // Statements have an unchanging empty schema.
54
+ static STATEMENT_EMPTY_SCHEMA : LazyLock < DFSchemaRef > =
55
+ LazyLock :: new ( || Arc :: new ( DFSchema :: empty ( ) ) ) ;
56
+
57
+ & STATEMENT_EMPTY_SCHEMA
58
58
}
59
59
60
60
/// Return a descriptive string describing the type of this
You can’t perform that action at this time.
0 commit comments