Skip to content

refactor: use LazyLock in the user_doc macro#13684

Merged
jonahgao merged 6 commits intoapache:mainfrom
jonahgao:user_doc
Dec 8, 2024
Merged

refactor: use LazyLock in the user_doc macro#13684
jonahgao merged 6 commits intoapache:mainfrom
jonahgao:user_doc

Conversation

@jonahgao
Copy link
Member

@jonahgao jonahgao commented Dec 7, 2024

Which issue does this PR close?

Part of #11687

Rationale for this change

Replace OnceLock with LazyLock.

What changes are included in this PR?

Are these changes tested?

Yes.
Run ./dev/update_function_docs.sh and verified that the documentation content didn't changed.

Are there any user-facing changes?

No

@github-actions github-actions bot added the functions Changes to functions implementation label Dec 7, 2024
Some(#lock_name.get_or_init(|| {
Documentation::builder(DocSection { include: #doc_section_include, label: #doc_section_lbl, description: #doc_section_description },
fn doc(&self) -> Option<&datafusion_doc::Documentation> {
static DOCUMENTATION: std::sync::LazyLock<datafusion_doc::Documentation> =
Copy link
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

thats interesting, I tried doing the same with OnceLock, to move it inside the doc method but it didn't work. Surprisingly it works with LazyLock

Copy link
Contributor

@comphead comphead left a comment

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

lgtm thanks @jonahgao

This PR will be conflicting with #13685

@jonahgao
Copy link
Member Author

jonahgao commented Dec 8, 2024

Conflicting resolved. Thanks @comphead for the review.

@jonahgao jonahgao merged commit 6c9355d into apache:main Dec 8, 2024
25 checks passed
@jonahgao jonahgao deleted the user_doc branch December 8, 2024 15:37
zhuliquan pushed a commit to zhuliquan/datafusion that referenced this pull request Dec 11, 2024
* refactor: use `LazyLock` in the `user_doc` macro

* Fix cargo doc

* Update datafusion/macros/src/lib.rs

* Fix doc comment

---------

Co-authored-by: Oleks V <comphead@users.noreply.github.com>
zhuliquan pushed a commit to zhuliquan/datafusion that referenced this pull request Dec 15, 2024
* refactor: use `LazyLock` in the `user_doc` macro

* Fix cargo doc

* Update datafusion/macros/src/lib.rs

* Fix doc comment

---------

Co-authored-by: Oleks V <comphead@users.noreply.github.com>
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

functions Changes to functions implementation

Projects

None yet

Development

Successfully merging this pull request may close these issues.

2 participants