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

Add doc for the statistics_from_parquet_meta_calc method #15330

Merged

Conversation

xudong963
Copy link
Member

@xudong963 xudong963 commented Mar 20, 2025

Which issue does this PR close?

Rationale for this change

I'm refactoring the method statistics_from_parquet_meta_calc in #15289, to make sure we're on the same page, I think it's better to write the doc in detail for the method.

What changes are included in this PR?

Add doc

Are these changes tested?

Are there any user-facing changes?

/// For columns without statistics,
/// - For min/max, there are two situations:
/// 1. The column isn't in arrow schema, then min/max values are set to Precision::Absent
/// 2. The column is in arrow schema, but not in parquet schema due to schema revolution, min/max values are set to Precision::Exact(null)
Copy link
Member Author

@xudong963 xudong963 Mar 20, 2025

Choose a reason for hiding this comment

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

In fact, I have questions about this behavior, shouldn't it be Precision::Absent?

Copy link
Contributor

Choose a reason for hiding this comment

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

I think in this case, the default schema adapter will fill in the constant value null for all columns like this so Precision::Exact(null) is correct

However, as @adriangb found in #15263 and elsewhere when users use custom Schema adapters a value other than NULL is filled in

Maybe this is another place where the schema adapter could/should be used 🤔

Copy link
Member Author

Choose a reason for hiding this comment

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

That makes sense, I'll try to make the potential bug surface, thanks @alamb

@xudong963 xudong963 requested a review from alamb March 20, 2025 08:02
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 very much @xudong963 -- I think this makes the code better and describes how the code works that matches my understanding

Your question is a good one -- and I think it may be pointing at a potential bug here when using custom schema adapters. Nice!

///
/// The statistics are calculated for each column in the table schema
/// using the row group statistics in the parquet metadata.
///
/// # Key behaviors:
Copy link
Contributor

Choose a reason for hiding this comment

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

👍

/// For columns without statistics,
/// - For min/max, there are two situations:
/// 1. The column isn't in arrow schema, then min/max values are set to Precision::Absent
/// 2. The column is in arrow schema, but not in parquet schema due to schema revolution, min/max values are set to Precision::Exact(null)
Copy link
Contributor

Choose a reason for hiding this comment

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

I think in this case, the default schema adapter will fill in the constant value null for all columns like this so Precision::Exact(null) is correct

However, as @adriangb found in #15263 and elsewhere when users use custom Schema adapters a value other than NULL is filled in

Maybe this is another place where the schema adapter could/should be used 🤔

@alamb alamb added the documentation Improvements or additions to documentation label Mar 21, 2025
@xudong963 xudong963 merged commit 74aeb91 into apache:main Mar 21, 2025
29 checks passed
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
documentation Improvements or additions to documentation
Projects
None yet
Development

Successfully merging this pull request may close these issues.

2 participants