-
Notifications
You must be signed in to change notification settings - Fork 414
Add Column Name to the Error Message in StatsAggregator #2190
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 Column Name to the Error Message in StatsAggregator #2190
Conversation
kevinjqliu
left a comment
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.
thanks for adding this! this is helpful
i have a comment about maintaining backwards compatibility
kevinjqliu
left a comment
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.
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 |
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.
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
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.
Makes sense. I’ll update the PR to follow this approach. Thanks!
|
could you also run |
kevinjqliu
left a comment
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.
LGTM!
<!--
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.
-->
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?