-
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
feat: Add support for Timestamp data types in data page statistics. #11123
Merged
alamb
merged 2 commits into
apache:main
from
efredine:Support-extracting-Timestamp-statistics-from-Parquet-Data-Pages
Jun 26, 2024
Merged
Changes from 1 commit
Commits
Show all changes
2 commits
Select commit
Hold shift + click to select a range
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 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 |
---|---|---|
|
@@ -713,6 +713,36 @@ macro_rules! get_data_page_statistics { | |
)), | ||
Some(DataType::Float32) => Ok(Arc::new(Float32Array::from_iter([<$stat_type_prefix Float32DataPageStatsIterator>]::new($iterator).flatten()))), | ||
Some(DataType::Float64) => Ok(Arc::new(Float64Array::from_iter([<$stat_type_prefix Float64DataPageStatsIterator>]::new($iterator).flatten()))), | ||
Some(DataType::Timestamp(unit, timezone)) => { | ||
let iter = [<$stat_type_prefix Int64DataPageStatsIterator>]::new($iterator).flatten(); | ||
|
||
Ok(match unit { | ||
TimeUnit::Second => { | ||
Arc::new(match timezone { | ||
Some(tz) => TimestampSecondArray::from_iter(iter).with_timezone(tz.clone()), | ||
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. Not tested, but perhaps 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. that is a great suggestion |
||
None => TimestampSecondArray::from_iter(iter), | ||
}) | ||
} | ||
TimeUnit::Millisecond => { | ||
Arc::new(match timezone { | ||
Some(tz) => TimestampMillisecondArray::from_iter(iter).with_timezone(tz.clone()), | ||
None => TimestampMillisecondArray::from_iter(iter), | ||
}) | ||
} | ||
TimeUnit::Microsecond => { | ||
Arc::new(match timezone { | ||
Some(tz) => TimestampMicrosecondArray::from_iter(iter).with_timezone(tz.clone()), | ||
None => TimestampMicrosecondArray::from_iter(iter), | ||
}) | ||
} | ||
TimeUnit::Nanosecond => { | ||
Arc::new(match timezone { | ||
Some(tz) => TimestampNanosecondArray::from_iter(iter).with_timezone(tz.clone()), | ||
None => TimestampNanosecondArray::from_iter(iter), | ||
}) | ||
} | ||
}) | ||
}, | ||
_ => unimplemented!() | ||
} | ||
} | ||
|
This file contains 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.
Should this repeated code be extracted? I assume it would need to be put into a macro?
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.
Which repeated code do you mean?
If you wnated to more fully macroize this table and avoid repetition that sounds like a great idea to me (though perhaps as a follow on PR)
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.
The four lines in the match unit expression are exactly the same in both macros.