Skip to content

Conversation

@james5418
Copy link
Contributor

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?

Copy link
Contributor

@kevinjqliu kevinjqliu left a 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

Copy link
Contributor

@kevinjqliu kevinjqliu left a 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?

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
Copy link
Contributor

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

Copy link
Contributor Author

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!

@kevinjqliu
Copy link
Contributor

could you also run make lint locally?

ruff format..............................................................Failed
- hook id: ruff-format
- files were modified by this hook

1 file reformatted, 156 files left unchanged

Copy link
Contributor

@kevinjqliu kevinjqliu left a comment

Choose a reason for hiding this comment

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

LGTM!

@kevinjqliu kevinjqliu merged commit 63a37b1 into apache:main Jul 22, 2025
10 checks passed
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.
-->
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

None yet

Projects

None yet

Development

Successfully merging this pull request may close these issues.

(doc): Change error message to reference column that has mismatch

2 participants