Skip to content

Remove non idiomatic DataFusionError::into_arrow_external_error in favor of From conversion#1645

Merged
alamb merged 1 commit into
apache:masterfrom
alamb:alamb/error-cleanup2
Jan 24, 2022
Merged

Remove non idiomatic DataFusionError::into_arrow_external_error in favor of From conversion#1645
alamb merged 1 commit into
apache:masterfrom
alamb:alamb/error-cleanup2

Conversation

@alamb

@alamb alamb commented Jan 22, 2022

Copy link
Copy Markdown
Contributor

Builds on #1643, so draft until that is merged

Which issue does this PR close?

closes #1644

Rationale for this change

The way to convert DataFusionError into an ArrowError is confusing for Rust programmers coming to the DataFusion codebase and makes our codebase a bit of a mess

DataFusionError::into_arrow_external_error

They typically expect a impl From<..> conversion trait

What changes are included in this PR?

  1. remove DataFusionError::into_arrow_external_error
  2. Update code to use From impl instead

Are there any user-facing changes?

Nicer error handling, but removal of into_arrow_external_error

@alamb alamb added the api change Changes the API exposed to users of the crate label Jan 22, 2022
})
.collect::<Result<Vec<_>>>()
.map_err(|x| x.into_arrow_external_error())?;
.collect::<Result<Vec<_>>>()?;

Copy link
Copy Markdown
Contributor Author

Choose a reason for hiding this comment

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

this is a pretty good exemplar of how this change makes the DataFusion codebase less confusing

@alamb

alamb commented Jan 22, 2022

Copy link
Copy Markdown
Contributor Author

We can probably remove any instances of code like

                    .map_err(DataFusionError::ArrowError)

as well 🤔

@alamb alamb force-pushed the alamb/error-cleanup2 branch from 7356b54 to 342673b Compare January 22, 2022 20:16
@alamb alamb marked this pull request as ready for review January 22, 2022 20:16

@houqp houqp left a comment

Copy link
Copy Markdown
Member

Choose a reason for hiding this comment

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

nice cleanup

@alamb alamb merged commit 741df36 into apache:master Jan 24, 2022
@alamb alamb deleted the alamb/error-cleanup2 branch January 24, 2022 12:06
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

api change Changes the API exposed to users of the crate

Projects

None yet

Development

Successfully merging this pull request may close these issues.

Remove DataFusionError::into_arrow_external_error in favor of From conversion

2 participants