Skip to content

Conversation

@comphead
Copy link
Contributor

@comphead comphead commented Oct 4, 2025

Which issue does this PR close?

  • Closes #.

Rationale for this change

Replace raw DataFusionError with backtrace supported ones

The PR just replaces DataFusionError::Execution and DataFusionError::Internal to use error macros instead

What changes are included in this PR?

Are these changes tested?

Are there any user-facing changes?

@github-actions github-actions bot added sql SQL Planner optimizer Optimizer rules core Core DataFusion crate common Related to common crate execution Related to the execution crate proto Related to proto crate functions Changes to functions implementation datasource Changes to the datasource crate spark labels Oct 4, 2025
@github-actions github-actions bot added logical-expr Logical plan and expressions physical-expr Changes to the physical-expr crates sqllogictest SQL Logic Tests (.slt) catalog Related to the catalog crate ffi Changes to the ffi crate physical-plan Changes to the physical-plan crate labels Oct 4, 2025
@comphead
Copy link
Contributor Author

comphead commented Oct 4, 2025

I'm actually thinking to create custom lint or script which should check errors implementation for PRs to automate checks

@comphead comphead marked this pull request as ready for review October 4, 2025 22:04
@comphead
Copy link
Contributor Author

comphead commented Oct 5, 2025

Just FYI: used Claude and Roo Code to mass change to test it out,
it costed 25 USD and still 1 hour of personal time of babysitting ongoing issues 🤔

Copy link
Contributor

@dqkqd dqkqd left a comment

Choose a reason for hiding this comment

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

This looks great to me, thanks you very much. @comphead

@alamb alamb changed the title chore: Extend backtrace coverage chore: Extend backtrace coverage for Execution and Internal errors Oct 6, 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.

Thanks @comphead and @dqkqd

"There is no UDWF named \"{name}\" in the TaskContext"
))
internal_datafusion_err!(
"There is no UDWF named \"{}\" in the TaskContext",
Copy link
Contributor

Choose a reason for hiding this comment

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

why not keep the inline format?

Suggested change
"There is no UDWF named \"{}\" in the TaskContext",
"There is no UDWF named \"{name}\" in the TaskContext",

?

"Unable to retrieve field in WindowUDF via FFI".to_string(),
)),
true => exec_err!(
"Unable to retrieve field in WindowUDF via FFI - schema has no fields"
Copy link
Contributor

Choose a reason for hiding this comment

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

👍

.map_err(|e| {
DataFusionError::Internal(format!("Failed to decode from base64: {e}"))
})
.map_err(|e| internal_datafusion_err!("Failed to decode from base64: {}", e))
Copy link
Contributor

Choose a reason for hiding this comment

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

likewise in this this file, why not put the exception inline?

Copy link
Contributor Author

Choose a reason for hiding this comment

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

this is how Claude works 🤔 Thanks for pointing this out

Copy link
Contributor

Choose a reason for hiding this comment

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

Probably trained on too much old rust code 😆

@comphead comphead added this pull request to the merge queue Oct 6, 2025
Merged via the queue into apache:main with commit 149d3e9 Oct 6, 2025
30 checks passed
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

catalog Related to the catalog crate common Related to common crate core Core DataFusion crate datasource Changes to the datasource crate execution Related to the execution crate ffi Changes to the ffi crate functions Changes to functions implementation logical-expr Logical plan and expressions optimizer Optimizer rules physical-expr Changes to the physical-expr crates physical-plan Changes to the physical-plan crate proto Related to proto crate spark sql SQL Planner sqllogictest SQL Logic Tests (.slt)

Projects

None yet

Development

Successfully merging this pull request may close these issues.

3 participants