Add Column Name to the Error Message in StatsAggregator#2190
Merged
kevinjqliu merged 4 commits intoapache:mainfrom Jul 22, 2025
Merged
Add Column Name to the Error Message in StatsAggregator#2190kevinjqliu merged 4 commits intoapache:mainfrom
kevinjqliu merged 4 commits intoapache:mainfrom
Conversation
kevinjqliu
reviewed
Jul 18, 2025
Contributor
kevinjqliu
left a comment
There was a problem hiding this comment.
thanks for adding this! this is helpful
i have a comment about maintaining backwards compatibility
kevinjqliu
reviewed
Jul 19, 2025
Contributor
kevinjqliu
left a comment
There was a problem hiding this comment.
taking another look, i think adding column_name just to enrich the error message might be an antipattern. WDYT of re-throwing with the ValueError with extra context?
pyiceberg/io/pyarrow.py
Outdated
| if field_id not in col_aggs: | ||
| col_aggs[field_id] = StatsAggregator( | ||
| stats_col.iceberg_type, statistics.physical_type, stats_col.mode.length | ||
| stats_col.iceberg_type, statistics.physical_type, stats_col.mode.length, stats_col.column_name |
Contributor
There was a problem hiding this comment.
I see that StatsAggregator is only used here. WDYT of this approach?
try:
col_aggs[field_id] = StatsAggregator(
stats_col.iceberg_type, statistics.physical_type, stats_col.mode.length
)
except ValueError as e:
raise ValueError(f"{e} for column '{stats_col.column_name}'") from e
Contributor
Author
There was a problem hiding this comment.
Makes sense. I’ll update the PR to follow this approach. Thanks!
Contributor
|
could you also run |
gabeiglio
pushed a commit
to Netflix/iceberg-python
that referenced
this pull request
Aug 13, 2025
<!--
Thanks for opening a pull request!
-->
<!-- In the case this PR will resolve an issue, please replace
${GITHUB_ISSUE_ID} below with the actual Github issue id. -->
Closes apache#2017
# Rationale for this change
Include the column name in the error message to make it more
descriptive.
# Are these changes tested?
# Are there any user-facing changes?
<!-- In the case of user-facing changes, please add the changelog label.
-->
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
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment
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.
Closes #2017
Rationale for this change
Include the column name in the error message to make it more descriptive.
Are these changes tested?
Are there any user-facing changes?