Skip to content

refactor: use DataFusion errors in integration - #7

Merged
mbutrovich merged 4 commits into
apache:mainfrom
gabotechs:gabotechs/errors
Sep 23, 2026
Merged

mbutrovich merged 4 commits into
apache:mainfrom
gabotechs:gabotechs/errors

Conversation

@gabotechs

@gabotechs gabotechs commented Sep 21, 2026 •

Copy link
Copy Markdown
Contributor

The inherited code treated iceberg::Result as the first-class citizen regarding errors in function signatures. This PR changes it so that, by default, a Result is a datafusion::common::Result instead, making it more datafusion-centric, and reducing error conversions within the DataFusion code.

It also improves the DataFusion->Iceberg and Iceberg->DataFusion error conversion, so that if these errors are sent serialized over the wire, they can be fully recovered.

The specific changes are:

  • make DataFusion-facing Iceberg integration APIs use datafusion::error::Result
  • preserve Iceberg error kinds across the DataFusion error boundary
  • use DataFusion error macros for locally generated failures
  • let integration tests propagate Iceberg and DataFusion errors as boxed errors

Comment on lines +39 to +44
pub fn to_datafusion_error(error: Error) -> DataFusionError {
DataFusionError::Context(
format!("IcebergError({})", error.kind()),
Box::new(DataFusionError::Execution(error.to_string())),
)
}

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.

If anyone has better ideas on how to encode iceberg errors into DataFusionError that's very welcome

Copy link
Copy Markdown

Choose a reason for hiding this comment

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

Could we use DataFusionError::External(Box::new(error)) here? It preserves the original Iceberg error and its source chain before transport. With the kind tag in Context we’d retain the same information after transport.

Copy link
Copy Markdown
Contributor

Choose a reason for hiding this comment

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

I agree keeping the original error might be nice

@gabotechs
gabotechs marked this pull request as ready for review September 22, 2026 13:03

@alexanderbianchi alexanderbianchi left a comment

Copy link
Copy Markdown

Choose a reason for hiding this comment

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

LGTM, if you see other low hanging fruit idiomatic refactors to make this more DF focused we could probably have an epic to get folks involved.

@mbutrovich
mbutrovich self-requested a review September 22, 2026 20:28

@alamb alamb left a comment

Copy link
Copy Markdown
Contributor

Choose a reason for hiding this comment

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

Looks like an improvement to me (and removes just a little more friction from the API)

@mbutrovich
mbutrovich merged commit 697c1da into apache:main Sep 23, 2026
4 checks passed
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.

4 participants