apache / datafusion

Apache DataFusion SQL Query Engine
https://datafusion.apache.org/
Apache License 2.0
5.99k stars 1.14k forks source link

Replace `OnceLock` with `LazyLock` #11687

Open jayzhan211 opened 2 months ago

jayzhan211 commented 2 months ago

Is your feature request related to a problem or challenge?

LazyLock is stabilized in 1.80 🚀 It is more ergonomic than OnceLock, it would be nice to switch to LazyLock

Describe the solution you'd like

No response

Describe alternatives you've considered

No response

Additional context

No response

Rafferty97 commented 2 months ago

I'm happy to take this one. For the uses of OnceLock in statics that currently have an associated getter function, such as ROW_GROUP_METADATA and row_group_metadata in access_plan.rs, would it be better to replace calls to the function with direct access to the static, or just simplify the implementation of the getter function without changing the call sites?

jayzhan211 commented 2 months ago

We can direct access to the static data, since it is not a breaking change, changing call sites is fine

Rafferty97 commented 2 months ago

take

Omega359 commented 2 months ago

We can't do that (yet). DataFusion MSRV is 1.76

jayzhan211 commented 2 months ago

We can't do that (yet). DataFusion MSRV is 1.76

Oh, I forgot that. Sorry @Rafferty97

alamb commented 1 week ago

MSRV is now 1.78 so we can probably revive this issue

alamb commented 1 week ago

@Rafferty97 I unassigned you but if you are still interested in working on this issue, please feel free to reassign it to yourself.

For anyone else who finds this issue, you can see what is needed in this PR: https://github.com/apache/datafusion/pull/11690 but that has bitrotted.

I would suggest just applying the same changes in a new PR

OussamaSaoudi commented 5 days ago

take

Omega359 commented 3 days ago

Didn't LazyLock become stable in 1.80.0 ? https://blog.rust-lang.org/2024/07/25/Rust-1.80.0.html

I just tried to use it in main and it wouldn't compile...