-
Notifications
You must be signed in to change notification settings - Fork 1k
[Parquet] Avoid copying LogicalType in ColumnOrder::get_sort_order, deprecate get_logical_type
#8789
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
Merged
Merged
[Parquet] Avoid copying LogicalType in ColumnOrder::get_sort_order, deprecate get_logical_type
#8789
Changes from all commits
Commits
Show all changes
5 commits
Select commit
Hold shift + click to select a range
3dacc15
Avoid copying LogicalType when computing ColumnOrder::sort_order, dep…
alamb ff1ffd6
fmt
alamb 9636941
Update parquet/src/basic.rs
alamb 2b6b876
Update parquet/src/schema/types.rs
alamb 0e5c0c7
Merge branch 'main' into alamb/more_refs
alamb File filter
Filter by extension
Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
There are no files selected for viewing
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
| Original file line number | Diff line number | Diff line change |
|---|---|---|
|
|
@@ -211,8 +211,8 @@ impl Type { | |
| pub(crate) fn is_list(&self) -> bool { | ||
| if self.is_group() { | ||
| let basic_info = self.get_basic_info(); | ||
| if let Some(logical_type) = basic_info.logical_type() { | ||
| return logical_type == LogicalType::List; | ||
| if let Some(logical_type) = basic_info.logical_type_ref() { | ||
| return logical_type == &LogicalType::List; | ||
| } | ||
| return basic_info.converted_type() == ConvertedType::LIST; | ||
| } | ||
|
|
@@ -710,6 +710,10 @@ impl BasicTypeInfo { | |
| /// | ||
| /// Note that this function will clone the `LogicalType`. If performance is a concern, | ||
| /// use [`Self::logical_type_ref`] instead. | ||
| #[deprecated( | ||
|
Contributor
Author
There was a problem hiding this comment. Choose a reason for hiding this commentThe reason will be displayed to describe this comment to others. Learn more. I just straight up deprecated the non reference version |
||
| since = "57.1.0", | ||
| note = "use `BasicTypeInfo::logical_type_ref` instead (LogicalType cloning is non trivial)" | ||
| )] | ||
| pub fn logical_type(&self) -> Option<LogicalType> { | ||
| // Unlike ConvertedType, LogicalType cannot implement Copy, thus we clone it | ||
| self.logical_type.clone() | ||
|
|
@@ -919,8 +923,15 @@ impl ColumnDescriptor { | |
| /// | ||
| /// Note that this function will clone the `LogicalType`. If performance is a concern, | ||
| /// use [`Self::logical_type_ref`] instead. | ||
| #[deprecated( | ||
| since = "57.1.0", | ||
| note = "use `ColumnDescriptor::logical_type_ref` instead (LogicalType cloning is non trivial)" | ||
| )] | ||
| pub fn logical_type(&self) -> Option<LogicalType> { | ||
| self.primitive_type.get_basic_info().logical_type() | ||
| self.primitive_type | ||
| .get_basic_info() | ||
| .logical_type_ref() | ||
| .cloned() | ||
| } | ||
|
|
||
| /// Returns a reference to the [`LogicalType`] for this column. | ||
|
|
@@ -966,8 +977,8 @@ impl ColumnDescriptor { | |
|
|
||
| /// Returns the sort order for this column | ||
| pub fn sort_order(&self) -> SortOrder { | ||
| ColumnOrder::get_sort_order( | ||
| self.logical_type(), | ||
| ColumnOrder::sort_order_for_type( | ||
| self.logical_type_ref(), | ||
| self.converted_type(), | ||
| self.physical_type(), | ||
| ) | ||
|
|
@@ -1417,8 +1428,8 @@ mod tests { | |
| let basic_info = tp.get_basic_info(); | ||
| assert_eq!(basic_info.repetition(), Repetition::OPTIONAL); | ||
| assert_eq!( | ||
| basic_info.logical_type(), | ||
| Some(LogicalType::Integer { | ||
| basic_info.logical_type_ref(), | ||
| Some(&LogicalType::Integer { | ||
| bit_width: 32, | ||
| is_signed: true | ||
| }) | ||
|
|
@@ -1768,7 +1779,7 @@ mod tests { | |
| assert!(tp.is_group()); | ||
| assert!(!tp.is_primitive()); | ||
| assert_eq!(basic_info.repetition(), Repetition::REPEATED); | ||
| assert_eq!(basic_info.logical_type(), Some(LogicalType::List)); | ||
| assert_eq!(basic_info.logical_type_ref(), Some(&LogicalType::List)); | ||
| assert_eq!(basic_info.converted_type(), ConvertedType::LIST); | ||
| assert_eq!(basic_info.id(), 1); | ||
| assert_eq!(tp.get_fields().len(), 2); | ||
|
|
||
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Oops, something went wrong.
Add this suggestion to a batch that can be applied as a single commit.
This suggestion is invalid because no changes were made to the code.
Suggestions cannot be applied while the pull request is closed.
Suggestions cannot be applied while viewing a subset of changes.
Only one suggestion per line can be applied in a batch.
Add this suggestion to a batch that can be applied as a single commit.
Applying suggestions on deleted lines is not supported.
You must change the existing code in this line in order to create a valid suggestion.
Outdated suggestions cannot be applied.
This suggestion has been applied or marked resolved.
Suggestions cannot be applied from pending reviews.
Suggestions cannot be applied on multi-line comments.
Suggestions cannot be applied while the pull request is queued to merge.
Suggestion cannot be applied right now. Please check back later.
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.
here is one deprecation