Skip to content

Conversation

@Jefffrey
Copy link
Contributor

Which issue does this PR close?

Related to #7806

Rationale for this change

Some methods in arrow use new() of array types which internally use try_new() and unwraps the result; this can lead to panics instead of propagating errors to downstream users. For example, this DataFusion issue: apache/datafusion#12598

What changes are included in this PR?

Replace usages of new() with try_new() where appropriate (the function they are used inside already return a Result.

Are these changes tested?

Covered by existing tests.

Are there any user-facing changes?

No.

@github-actions github-actions bot added arrow Changes to the arrow crate parquet-variant parquet-variant* crates arrow-avro arrow-avro crate labels Sep 20, 2025
@alamb alamb changed the title Replace usages of new with try_new for Array types Propagate errors instead of panics: Replace usages of new with try_new for Array types Sep 20, 2025
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 @Jefffrey -- this looks great to me

@alamb
Copy link
Contributor

alamb commented Sep 20, 2025

(I also double checked that this didn't change any APIs externally, just propagated errors correctly internally)

@Jefffrey Jefffrey merged commit de84ff5 into apache:main Sep 21, 2025
30 checks passed
@Jefffrey Jefffrey deleted the replace_new_with_try_new branch September 21, 2025 12:46
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

arrow Changes to the arrow crate arrow-avro arrow-avro crate parquet-variant parquet-variant* crates

Projects

None yet

Development

Successfully merging this pull request may close these issues.

2 participants