You are viewing a plain text version of this content. The canonical link for it is here.
Posted to github@datafusion.apache.org by "comphead (via GitHub)" <gi...@apache.org> on 2025/10/04 18:21:21 UTC
[PR] chore: Extend backtrace coverage [datafusion]
comphead opened a new pull request, #17921:
URL: https://github.com/apache/datafusion/pull/17921
## Which issue does this PR close?
<!--
We generally require a GitHub issue to be filed for all bug fixes and enhancements and this helps us generate change logs for our releases. You can link an issue to this PR using the GitHub syntax. For example `Closes #123` indicates that this PR will close issue #123.
-->
- Closes #.
## Rationale for this change
Replace raw `DataFusionError` with backtrace supported ones
<!--
Why are you proposing this change? If this is already explained clearly in the issue then this section is not needed.
Explaining clearly why changes are proposed helps reviewers understand your changes and offer better suggestions for fixes.
-->
## What changes are included in this PR?
<!--
There is no need to duplicate the description in the issue here but it is sometimes worth providing a summary of the individual changes in this PR.
-->
## Are these changes tested?
<!--
We typically require tests for all PRs in order to:
1. Prevent the code from being accidentally broken by subsequent changes
2. Serve as another way to document the expected behavior of the code
If tests are not included in your PR, please explain why (for example, are they covered by existing tests)?
-->
## Are there any user-facing changes?
<!--
If there are user-facing changes then we may require documentation to be updated before approving the PR.
-->
<!--
If there are any breaking changes to public APIs, please add the `api change` label.
-->
--
This is an automated message from the Apache Git Service.
To respond to the message, please log on to GitHub and use the
URL above to go to the specific comment.
To unsubscribe, e-mail: github-unsubscribe@datafusion.apache.org
For queries about this service, please contact Infrastructure at:
users@infra.apache.org
---------------------------------------------------------------------
To unsubscribe, e-mail: github-unsubscribe@datafusion.apache.org
For additional commands, e-mail: github-help@datafusion.apache.org
Re: [PR] chore: Extend backtrace coverage [datafusion]
Posted by "dqkqd (via GitHub)" <gi...@apache.org>.
dqkqd commented on code in PR #17921:
URL: https://github.com/apache/datafusion/pull/17921#discussion_r2404660062
##########
datafusion/datasource/src/write/demux.rs:
##########
@@ -329,7 +322,7 @@ async fn hive_style_partitions_demuxer(
// Finally send the partial batch partitioned by distinct value!
part_tx.send(final_batch_to_send).await.map_err(|_| {
- DataFusionError::Internal("Unexpected error sending parted batch!".into())
+ exec_datafusion_err!("Unexpected error sending parted batch!")
Review Comment:
I think this should be an internal error
```suggestion
internal_datafusion_err!("Unexpected error sending parted batch!")
```
--
This is an automated message from the Apache Git Service.
To respond to the message, please log on to GitHub and use the
URL above to go to the specific comment.
To unsubscribe, e-mail: github-unsubscribe@datafusion.apache.org
For queries about this service, please contact Infrastructure at:
users@infra.apache.org
---------------------------------------------------------------------
To unsubscribe, e-mail: github-unsubscribe@datafusion.apache.org
For additional commands, e-mail: github-help@datafusion.apache.org
Re: [PR] chore: Extend backtrace coverage [datafusion]
Posted by "comphead (via GitHub)" <gi...@apache.org>.
comphead commented on PR #17921:
URL: https://github.com/apache/datafusion/pull/17921#issuecomment-3368751678
Just FYI I used Claude and Roo Code to mass change, so it costed me 25 USD and still 1 hour of my time of babysitting
--
This is an automated message from the Apache Git Service.
To respond to the message, please log on to GitHub and use the
URL above to go to the specific comment.
To unsubscribe, e-mail: github-unsubscribe@datafusion.apache.org
For queries about this service, please contact Infrastructure at:
users@infra.apache.org
---------------------------------------------------------------------
To unsubscribe, e-mail: github-unsubscribe@datafusion.apache.org
For additional commands, e-mail: github-help@datafusion.apache.org
Re: [PR] chore: Extend backtrace coverage for `Execution` and `Internal` errors [datafusion]
Posted by "comphead (via GitHub)" <gi...@apache.org>.
comphead commented on code in PR #17921:
URL: https://github.com/apache/datafusion/pull/17921#discussion_r2408270508
##########
datafusion/functions/src/encoding/inner.rs:
##########
@@ -309,18 +309,15 @@ fn hex_decode(input: &[u8], buf: &mut [u8]) -> Result<usize> {
// only write input / 2 bytes to buf
let out_len = input.len() / 2;
let buf = &mut buf[..out_len];
- hex::decode_to_slice(input, buf).map_err(|e| {
- DataFusionError::Internal(format!("Failed to decode from hex: {e}"))
- })?;
+ hex::decode_to_slice(input, buf)
+ .map_err(|e| internal_datafusion_err!("Failed to decode from hex: {}", e))?;
Ok(out_len)
}
fn base64_decode(input: &[u8], buf: &mut [u8]) -> Result<usize> {
general_purpose::STANDARD_NO_PAD
.decode_slice(input, buf)
- .map_err(|e| {
- DataFusionError::Internal(format!("Failed to decode from base64: {e}"))
- })
+ .map_err(|e| internal_datafusion_err!("Failed to decode from base64: {}", e))
Review Comment:
this is how Claude works 🤔 Thanks for pointing this out
--
This is an automated message from the Apache Git Service.
To respond to the message, please log on to GitHub and use the
URL above to go to the specific comment.
To unsubscribe, e-mail: github-unsubscribe@datafusion.apache.org
For queries about this service, please contact Infrastructure at:
users@infra.apache.org
---------------------------------------------------------------------
To unsubscribe, e-mail: github-unsubscribe@datafusion.apache.org
For additional commands, e-mail: github-help@datafusion.apache.org
Re: [PR] chore: Extend backtrace coverage [datafusion]
Posted by "dqkqd (via GitHub)" <gi...@apache.org>.
dqkqd commented on code in PR #17921:
URL: https://github.com/apache/datafusion/pull/17921#discussion_r2404689267
##########
datafusion/core/src/datasource/file_format/arrow.rs:
##########
@@ -298,7 +300,7 @@ impl FileSink for ArrowFileSink {
demux_task
.join_unwind()
.await
- .map_err(|e| DataFusionError::ExecutionJoin(Box::new(e)))??;
+ .map_err(|e| exec_datafusion_err!("ExecutionJoin error: {}", e))??;
Review Comment:
I'm still quite new to the codebase, but I think using `DataFusionError::Execution` here is not equivalent to `DataFusionError::ExecutionJoin`.
There are other places we used `exec_datafusion_err!` for `ExecutionJoin` as well.
--
This is an automated message from the Apache Git Service.
To respond to the message, please log on to GitHub and use the
URL above to go to the specific comment.
To unsubscribe, e-mail: github-unsubscribe@datafusion.apache.org
For queries about this service, please contact Infrastructure at:
users@infra.apache.org
---------------------------------------------------------------------
To unsubscribe, e-mail: github-unsubscribe@datafusion.apache.org
For additional commands, e-mail: github-help@datafusion.apache.org
Re: [PR] chore: Extend backtrace coverage [datafusion]
Posted by "dqkqd (via GitHub)" <gi...@apache.org>.
dqkqd commented on code in PR #17921:
URL: https://github.com/apache/datafusion/pull/17921#discussion_r2404659014
##########
datafusion/core/src/execution/context/mod.rs:
##########
@@ -1196,9 +1184,11 @@ impl SessionContext {
match function_factory {
Some(f) => f.create(&state, stmt).await?,
- _ => Err(DataFusionError::Configuration(
- "Function factory has not been configured".into(),
- ))?,
+ _ => {
+ return Err(DataFusionError::Configuration(
+ "Function factory has not been configured".to_string(),
+ ))
+ }
Review Comment:
I think we can use `config_err!` here.
```suggestion
_ => {
return config_err!("Function factory has not been configured")
}
```
--
This is an automated message from the Apache Git Service.
To respond to the message, please log on to GitHub and use the
URL above to go to the specific comment.
To unsubscribe, e-mail: github-unsubscribe@datafusion.apache.org
For queries about this service, please contact Infrastructure at:
users@infra.apache.org
---------------------------------------------------------------------
To unsubscribe, e-mail: github-unsubscribe@datafusion.apache.org
For additional commands, e-mail: github-help@datafusion.apache.org
Re: [PR] chore: Extend backtrace coverage [datafusion]
Posted by "comphead (via GitHub)" <gi...@apache.org>.
comphead commented on PR #17921:
URL: https://github.com/apache/datafusion/pull/17921#issuecomment-3368542576
I'm actually thinking to create custom lint or script which should check errors implementation for PRs to automate checks
--
This is an automated message from the Apache Git Service.
To respond to the message, please log on to GitHub and use the
URL above to go to the specific comment.
To unsubscribe, e-mail: github-unsubscribe@datafusion.apache.org
For queries about this service, please contact Infrastructure at:
users@infra.apache.org
---------------------------------------------------------------------
To unsubscribe, e-mail: github-unsubscribe@datafusion.apache.org
For additional commands, e-mail: github-help@datafusion.apache.org
Re: [PR] chore: Extend backtrace coverage [datafusion]
Posted by "comphead (via GitHub)" <gi...@apache.org>.
comphead commented on code in PR #17921:
URL: https://github.com/apache/datafusion/pull/17921#discussion_r2404698254
##########
datafusion/datasource/src/write/demux.rs:
##########
@@ -329,7 +322,7 @@ async fn hive_style_partitions_demuxer(
// Finally send the partial batch partitioned by distinct value!
part_tx.send(final_batch_to_send).await.map_err(|_| {
- DataFusionError::Internal("Unexpected error sending parted batch!".into())
+ exec_datafusion_err!("Unexpected error sending parted batch!")
Review Comment:
agree
##########
datafusion/core/src/datasource/file_format/arrow.rs:
##########
@@ -298,7 +300,7 @@ impl FileSink for ArrowFileSink {
demux_task
.join_unwind()
.await
- .map_err(|e| DataFusionError::ExecutionJoin(Box::new(e)))??;
+ .map_err(|e| exec_datafusion_err!("ExecutionJoin error: {}", e))??;
Review Comment:
correct
--
This is an automated message from the Apache Git Service.
To respond to the message, please log on to GitHub and use the
URL above to go to the specific comment.
To unsubscribe, e-mail: github-unsubscribe@datafusion.apache.org
For queries about this service, please contact Infrastructure at:
users@infra.apache.org
---------------------------------------------------------------------
To unsubscribe, e-mail: github-unsubscribe@datafusion.apache.org
For additional commands, e-mail: github-help@datafusion.apache.org
Re: [PR] chore: Extend backtrace coverage [datafusion]
Posted by "comphead (via GitHub)" <gi...@apache.org>.
comphead commented on code in PR #17921:
URL: https://github.com/apache/datafusion/pull/17921#discussion_r2404697498
##########
datafusion/core/src/execution/context/mod.rs:
##########
@@ -1196,9 +1184,11 @@ impl SessionContext {
match function_factory {
Some(f) => f.create(&state, stmt).await?,
- _ => Err(DataFusionError::Configuration(
- "Function factory has not been configured".into(),
- ))?,
+ _ => {
+ return Err(DataFusionError::Configuration(
+ "Function factory has not been configured".to_string(),
+ ))
+ }
Review Comment:
Thanks @dqkqd this would be addressed in follow up PR along with plan errors
--
This is an automated message from the Apache Git Service.
To respond to the message, please log on to GitHub and use the
URL above to go to the specific comment.
To unsubscribe, e-mail: github-unsubscribe@datafusion.apache.org
For queries about this service, please contact Infrastructure at:
users@infra.apache.org
---------------------------------------------------------------------
To unsubscribe, e-mail: github-unsubscribe@datafusion.apache.org
For additional commands, e-mail: github-help@datafusion.apache.org
Re: [PR] chore: Extend backtrace coverage for `Execution` and `Internal` errors [datafusion]
Posted by "comphead (via GitHub)" <gi...@apache.org>.
comphead merged PR #17921:
URL: https://github.com/apache/datafusion/pull/17921
--
This is an automated message from the Apache Git Service.
To respond to the message, please log on to GitHub and use the
URL above to go to the specific comment.
To unsubscribe, e-mail: github-unsubscribe@datafusion.apache.org
For queries about this service, please contact Infrastructure at:
users@infra.apache.org
---------------------------------------------------------------------
To unsubscribe, e-mail: github-unsubscribe@datafusion.apache.org
For additional commands, e-mail: github-help@datafusion.apache.org
Re: [PR] chore: Extend backtrace coverage for `Execution` and `Internal` errors [datafusion]
Posted by "alamb (via GitHub)" <gi...@apache.org>.
alamb commented on code in PR #17921:
URL: https://github.com/apache/datafusion/pull/17921#discussion_r2408003461
##########
datafusion/ffi/src/udwf/mod.rs:
##########
@@ -336,9 +337,9 @@ impl WindowUDFImpl for ForeignWindowUDF {
let schema: SchemaRef = schema.into();
match schema.fields().is_empty() {
- true => Err(DataFusionError::Execution(
- "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"
Review Comment:
👍
##########
datafusion/execution/src/task.rs:
##########
@@ -168,9 +168,10 @@ impl FunctionRegistry for TaskContext {
let result = self.window_functions.get(name);
result.cloned().ok_or_else(|| {
- DataFusionError::Internal(format!(
- "There is no UDWF named \"{name}\" in the TaskContext"
- ))
+ internal_datafusion_err!(
+ "There is no UDWF named \"{}\" in the TaskContext",
Review Comment:
why not keep the inline format?
```suggestion
"There is no UDWF named \"{name}\" in the TaskContext",
```
?
##########
datafusion/functions/src/encoding/inner.rs:
##########
@@ -309,18 +309,15 @@ fn hex_decode(input: &[u8], buf: &mut [u8]) -> Result<usize> {
// only write input / 2 bytes to buf
let out_len = input.len() / 2;
let buf = &mut buf[..out_len];
- hex::decode_to_slice(input, buf).map_err(|e| {
- DataFusionError::Internal(format!("Failed to decode from hex: {e}"))
- })?;
+ hex::decode_to_slice(input, buf)
+ .map_err(|e| internal_datafusion_err!("Failed to decode from hex: {}", e))?;
Ok(out_len)
}
fn base64_decode(input: &[u8], buf: &mut [u8]) -> Result<usize> {
general_purpose::STANDARD_NO_PAD
.decode_slice(input, buf)
- .map_err(|e| {
- DataFusionError::Internal(format!("Failed to decode from base64: {e}"))
- })
+ .map_err(|e| internal_datafusion_err!("Failed to decode from base64: {}", e))
Review Comment:
likewise in this this file, why not put the exception inline?
--
This is an automated message from the Apache Git Service.
To respond to the message, please log on to GitHub and use the
URL above to go to the specific comment.
To unsubscribe, e-mail: github-unsubscribe@datafusion.apache.org
For queries about this service, please contact Infrastructure at:
users@infra.apache.org
---------------------------------------------------------------------
To unsubscribe, e-mail: github-unsubscribe@datafusion.apache.org
For additional commands, e-mail: github-help@datafusion.apache.org
Re: [PR] chore: Extend backtrace coverage [datafusion]
Posted by "dqkqd (via GitHub)" <gi...@apache.org>.
dqkqd commented on code in PR #17921:
URL: https://github.com/apache/datafusion/pull/17921#discussion_r2404690254
##########
datafusion-examples/examples/memory_pool_execution_plan.rs:
##########
@@ -247,9 +248,7 @@ impl ExecutionPlan for BufferingExecutionPlan {
children[0].clone(),
)))
} else {
- Err(DataFusionError::Internal(
- "BufferingExecutionPlan must have exactly one child".to_string(),
- ))
+ internal_err!("BufferingExecutionPlan must have exactly one child")
Review Comment:
There are places we are using `Err(internal_datafusion_err!`, instead of `internal_err!`, not sure if we should handle those too.
--
This is an automated message from the Apache Git Service.
To respond to the message, please log on to GitHub and use the
URL above to go to the specific comment.
To unsubscribe, e-mail: github-unsubscribe@datafusion.apache.org
For queries about this service, please contact Infrastructure at:
users@infra.apache.org
---------------------------------------------------------------------
To unsubscribe, e-mail: github-unsubscribe@datafusion.apache.org
For additional commands, e-mail: github-help@datafusion.apache.org
Re: [PR] chore: Extend backtrace coverage for `Execution` and `Internal` errors [datafusion]
Posted by "alamb (via GitHub)" <gi...@apache.org>.
alamb commented on code in PR #17921:
URL: https://github.com/apache/datafusion/pull/17921#discussion_r2408450757
##########
datafusion/functions/src/encoding/inner.rs:
##########
@@ -309,18 +309,15 @@ fn hex_decode(input: &[u8], buf: &mut [u8]) -> Result<usize> {
// only write input / 2 bytes to buf
let out_len = input.len() / 2;
let buf = &mut buf[..out_len];
- hex::decode_to_slice(input, buf).map_err(|e| {
- DataFusionError::Internal(format!("Failed to decode from hex: {e}"))
- })?;
+ hex::decode_to_slice(input, buf)
+ .map_err(|e| internal_datafusion_err!("Failed to decode from hex: {}", e))?;
Ok(out_len)
}
fn base64_decode(input: &[u8], buf: &mut [u8]) -> Result<usize> {
general_purpose::STANDARD_NO_PAD
.decode_slice(input, buf)
- .map_err(|e| {
- DataFusionError::Internal(format!("Failed to decode from base64: {e}"))
- })
+ .map_err(|e| internal_datafusion_err!("Failed to decode from base64: {}", e))
Review Comment:
Probably trained on too much old rust code 😆
--
This is an automated message from the Apache Git Service.
To respond to the message, please log on to GitHub and use the
URL above to go to the specific comment.
To unsubscribe, e-mail: github-unsubscribe@datafusion.apache.org
For queries about this service, please contact Infrastructure at:
users@infra.apache.org
---------------------------------------------------------------------
To unsubscribe, e-mail: github-unsubscribe@datafusion.apache.org
For additional commands, e-mail: github-help@datafusion.apache.org