-
Notifications
You must be signed in to change notification settings - Fork 1.2k
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
Conversation
@@ -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)>, |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
pub statistics: Option<Arc(Statistics)>, | |
pub statistics: Option<Arc<Statistics>>, |
@@ -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. |
There was a problem hiding this comment.
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
Thanks @albinsabu2023 for the PR, please take a look int comments |
Closes #11885 .
Change
PartitionedFile. statistics
datatype toOption<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.