Skip to content

Conversation

alamb
Copy link
Contributor

@alamb alamb commented Oct 7, 2025

Which issue does this PR close?

N/A

Rationale for this change

While working on an upgrade, I noticed the same schema was created by many distinct tests (and I am about to do it again).

Since the schema is always the same and is wrapped in an Arc we can just clone the Arc

What changes are included in this PR?

Use a static LazyLock to create the schema once and just pass out a reference to it

Are these changes tested?

Yes by CI

Are there any user-facing changes?

No this is a test change only

@github-actions github-actions bot added the core Core DataFusion crate label Oct 7, 2025
Field::new("e", DataType::Boolean, true),
]))
});
Arc::clone(&SCHEMA)
Copy link
Contributor Author

Choose a reason for hiding this comment

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

Now each call to schema() clones an Arc rather than actually recreating the schema

@alamb alamb marked this pull request as ready for review October 7, 2025 17:11
@alamb alamb added this pull request to the merge queue Oct 7, 2025
@alamb
Copy link
Contributor Author

alamb commented Oct 7, 2025

Thanks @timsaucer

Merged via the queue into apache:main with commit ab22ad8 Oct 7, 2025
28 checks passed
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
core Core DataFusion crate
Projects
None yet
Development

Successfully merging this pull request may close these issues.

2 participants