Skip to content

feat: support uint data page extraction #11018

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 1 commit into from
Jun 20, 2024

Conversation

tshauck
Copy link
Contributor

@tshauck tshauck commented Jun 20, 2024

Which issue does this PR close?

Closes #10952

Rationale for this change

Supports additional data types for data page stats.

What changes are included in this PR?

Parse the uints for data page stats. It's adapted from how it works for row groups...

DataType::UInt8 => Ok(Arc::new(UInt8Array::from_iter(
[<$stat_type_prefix Int32StatsIterator>]::new($iterator).map(|x| {
x.and_then(|x| u8::try_from(*x).ok())
}),
))),
DataType::UInt16 => Ok(Arc::new(UInt16Array::from_iter(
[<$stat_type_prefix Int32StatsIterator>]::new($iterator).map(|x| {
x.and_then(|x| u16::try_from(*x).ok())
}),
))),
DataType::UInt32 => Ok(Arc::new(UInt32Array::from_iter(
[<$stat_type_prefix Int32StatsIterator>]::new($iterator).map(|x| x.map(|x| *x as u32)),
))),
DataType::UInt64 => Ok(Arc::new(UInt64Array::from_iter(
[<$stat_type_prefix Int64StatsIterator>]::new($iterator).map(|x| x.map(|x| *x as u64)),
))),

Are these changes tested?

Yes, updates the unit tests to cover row groups and data pages.

Are there any user-facing changes?

No

@github-actions github-actions bot added the core Core DataFusion crate label Jun 20, 2024
@tshauck tshauck marked this pull request as ready for review June 20, 2024 01:23
@@ -1352,7 +1352,7 @@ async fn test_uint() {
expected_null_counts: UInt64Array::from(vec![0, 0, 0, 0, 0]),
expected_row_counts: Some(UInt64Array::from(vec![4, 4, 4, 4, 4])),
column_name: "u8",
check: Check::RowGroup,
Copy link
Contributor Author

Choose a reason for hiding this comment

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

Turning this to Both w/o adding the type above causes a test failure.

Copy link
Member

@Weijun-H Weijun-H left a comment

Choose a reason for hiding this comment

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

LGTM! Thanks @tshauck 👍

Copy link
Contributor

@alamb alamb left a comment

Choose a reason for hiding this comment

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

Thank you @tshauck and @Weijun-H 🚀

@alamb alamb merged commit 58d23c5 into apache:main Jun 20, 2024
24 checks passed
@tshauck tshauck deleted the add-extraction-of-uints branch June 20, 2024 13:12
xinlifoobar pushed a commit to xinlifoobar/datafusion that referenced this pull request Jun 22, 2024
xinlifoobar pushed a commit to xinlifoobar/datafusion that referenced this pull request Jun 22, 2024
findepi pushed a commit to findepi/datafusion that referenced this pull request Jul 16, 2024
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.

Support extracting UInt{8, 16, 32, 64} statistics from Parquet Data Pages
3 participants