jonahgao commented on code in PR #13641:
URL: https://github.com/apache/datafusion/pull/13641#discussion_r1869044427


##########
datafusion/common/src/types/builtin.rs:
##########
@@ -16,17 +16,17 @@
 // under the License.
 
 use crate::types::{LogicalTypeRef, NativeType};
-use std::sync::{Arc, OnceLock};
+use std::sync::{Arc, LazyLock};
 
 macro_rules! singleton {
     ($name:ident, $getter:ident, $ty:ident) => {
-        // TODO: Use LazyLock instead of getter function when MSRV gets bumped
-        static $name: OnceLock<LogicalTypeRef> = OnceLock::new();
+        static $name: LazyLock<LogicalTypeRef> =
+            LazyLock::new(|| Arc::new(NativeType::$ty));
 
         #[doc = "Getter for singleton instance of a logical type representing"]
         #[doc = concat!("[`NativeType::", stringify!($ty), "`].")]
         pub fn $getter() -> LogicalTypeRef {

Review Comment:
   Current callers require a `LogicalTypeRef`, so this getter still seems to be 
needed.



-- 
This is an automated message from the Apache Git Service.
To respond to the message, please log on to GitHub and use the
URL above to go to the specific comment.

To unsubscribe, e-mail: github-unsubscr...@datafusion.apache.org

For queries about this service, please contact Infrastructure at:
us...@infra.apache.org


---------------------------------------------------------------------
To unsubscribe, e-mail: github-unsubscr...@datafusion.apache.org
For additional commands, e-mail: github-h...@datafusion.apache.org

Reply via email to