Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

changed statistics to arc(statistics) #11885 #11893

Closed
wants to merge 3 commits into from
Closed

changed statistics to arc(statistics) #11885 #11893

wants to merge 3 commits into from

Conversation

albinsabu2023
Copy link

@albinsabu2023 albinsabu2023 commented Aug 8, 2024

Closes #11885 .

Change PartitionedFile. statistics datatype to Option<Arc<Statistics>>

Option<Arc<Statistics>> 

In Rust, Option<Arc> is a type that combines two powerful features of the language: optional values and thread-safe reference counting. This type is commonly used in concurrent programming to manage shared ownership of data with optionality. Here’s a breakdown of each component:

Option
Option is an enum that represents either a value (Some) or the absence of a value (None). It is used to handle cases where a value may or may not be present

Arc
Arc stands for "Atomic Reference Counted" and is a thread-safe version of Rc (Reference Counted). It allows multiple ownership of data across threads. Arc is used when you need to share immutable data safely between threads.

Combining Option and Arc
When you combine Option with Arc, you get a type that can either hold a reference-counted value or be empty. This is useful when you want to represent an optional shared resource.

@github-actions github-actions bot added the core Core DataFusion crate label Aug 8, 2024
@@ -78,7 +78,7 @@ pub struct PartitionedFile {
///
/// DataFusion relies on these statistics for planning (in particular to sort file groups),
/// so if they are incorrect, incorrect answers may result.
pub statistics: Option<Statistics>,
pub statistics: Option<Arc(Statistics)>,
Copy link
Contributor

Choose a reason for hiding this comment

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

Suggested change
pub statistics: Option<Arc(Statistics)>,
pub statistics: Option<Arc<Statistics>>,

@comphead comphead added the api change Changes the API exposed to users of the crate label Aug 8, 2024
@@ -78,7 +78,7 @@ pub struct PartitionedFile {
///
/// DataFusion relies on these statistics for planning (in particular to sort file groups),
/// so if they are incorrect, incorrect answers may result.
Copy link
Contributor

Choose a reason for hiding this comment

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

its probably worthy mentioning in the comments the reason why the Option<Arc> datatype was chosen

@comphead
Copy link
Contributor

comphead commented Aug 8, 2024

Thanks @albinsabu2023 for the PR, please take a look int comments

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
api change Changes the API exposed to users of the crate core Core DataFusion crate
Projects
None yet
Development

Successfully merging this pull request may close these issues.

Use Arc<Statistics> rather than Statistics in PartitionedFile
2 participants