fix: add backtrace for assert_*_or_internal_err helpers#18910
Merged
Conversation
|
Thank you for your contribution. Unfortunately, this pull request is stale because it has been open 60 days with no activity. Please remove the stale label or comment or this will be closed in 7 days. |
assert_eq_or_internal_err for backtraceassert_*_or_internal_err helpers for backtrace
assert_*_or_internal_err helpers for backtraceassert_*_or_internal_err helpers
Member
|
This PR breaks the backtrace-enabled tests for Internal errors. I can reproduce this locally: This fails in |
rluvaton
commented
Jun 10, 2026
Comment on lines
1207
to
1315
| @@ -1223,14 +1222,8 @@ mod test { | |||
| ok_result() | |||
| } | |||
|
|
|||
| let err = check().unwrap_err(); | |||
| assert_snapshot!( | |||
| err.to_string(), | |||
| @r" | |||
| Internal error: Assertion failed: 1 == 2 (left: 1, right: 2): expected equality. | |||
| This issue was likely caused by a bug in DataFusion's code. Please help us to resolve this by filing a bug report in our issue tracker: https://github.com/apache/datafusion/issues | |||
| " | |||
| ); | |||
| let err = check().unwrap_err().strip_backtrace(); | |||
| assert!(err.starts_with("Internal error: Assertion failed: 1 == 2 (left: 1, right: 2): expected equality")); | |||
| } | |||
|
|
|||
| #[test] | |||
| @@ -1246,14 +1239,8 @@ mod test { | |||
| ok_result() | |||
| } | |||
|
|
|||
| let err = check().unwrap_err(); | |||
| assert_snapshot!( | |||
| err.to_string(), | |||
| @r" | |||
| Internal error: Assertion failed: 3 != 3 (left: 3, right: 3): values must differ. | |||
| This issue was likely caused by a bug in DataFusion's code. Please help us to resolve this by filing a bug report in our issue tracker: https://github.com/apache/datafusion/issues | |||
| " | |||
| ); | |||
| let err = check().unwrap_err().strip_backtrace(); | |||
| assert!(err.starts_with("Internal error: Assertion failed: 3 != 3 (left: 3, right: 3): values must differ")); | |||
| } | |||
|
|
|||
| #[test] | |||
| @@ -1270,14 +1257,8 @@ mod test { | |||
| ok_result() | |||
| } | |||
|
|
|||
| let err = check().unwrap_err(); | |||
| assert_snapshot!( | |||
| err.to_string(), | |||
| @r" | |||
| Internal error: Assertion failed: false. | |||
| This issue was likely caused by a bug in DataFusion's code. Please help us to resolve this by filing a bug report in our issue tracker: https://github.com/apache/datafusion/issues | |||
| " | |||
| ); | |||
| let err = check().unwrap_err().strip_backtrace(); | |||
| assert!(err.starts_with("Internal error: Assertion failed: false")); | |||
| } | |||
|
|
|||
| #[test] | |||
| @@ -1287,13 +1268,9 @@ mod test { | |||
| ok_result() | |||
| } | |||
|
|
|||
| let err = check().unwrap_err(); | |||
| assert_snapshot!( | |||
| err.to_string(), | |||
| @r" | |||
| Internal error: Assertion failed: false: custom message. | |||
| This issue was likely caused by a bug in DataFusion's code. Please help us to resolve this by filing a bug report in our issue tracker: https://github.com/apache/datafusion/issues | |||
| " | |||
| let err = check().unwrap_err().strip_backtrace(); | |||
| assert!( | |||
| err.starts_with("Internal error: Assertion failed: false: custom message") | |||
| ); | |||
| } | |||
|
|
|||
| @@ -1304,14 +1281,8 @@ mod test { | |||
| ok_result() | |||
| } | |||
|
|
|||
| let err = check().unwrap_err(); | |||
| assert_snapshot!( | |||
| err.to_string(), | |||
| @r" | |||
| Internal error: Assertion failed: false: custom 42. | |||
| This issue was likely caused by a bug in DataFusion's code. Please help us to resolve this by filing a bug report in our issue tracker: https://github.com/apache/datafusion/issues | |||
| " | |||
| ); | |||
| let err = check().unwrap_err().strip_backtrace(); | |||
| assert!(err.starts_with("Internal error: Assertion failed: false: custom 42")); | |||
| } | |||
Member
Author
There was a problem hiding this comment.
Updated the code to use starts_with like done in the original pr that add the backtrace:
Member
Author
|
@Weijun-H fixed |
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment
Add this suggestion to a batch that can be applied as a single commit.This suggestion is invalid because no changes were made to the code.Suggestions cannot be applied while the pull request is closed.Suggestions cannot be applied while viewing a subset of changes.Only one suggestion per line can be applied in a batch.Add this suggestion to a batch that can be applied as a single commit.Applying suggestions on deleted lines is not supported.You must change the existing code in this line in order to create a valid suggestion.Outdated suggestions cannot be applied.This suggestion has been applied or marked resolved.Suggestions cannot be applied from pending reviews.Suggestions cannot be applied on multi-line comments.Suggestions cannot be applied while the pull request is queued to merge.Suggestion cannot be applied right now. Please check back later.
Which issue does this PR close?
N/A
Rationale for this change
No backtrace is added when using the assert macros, so fixing that
What changes are included in this PR?
used
internal_datafusion_errmacro in theassert_*helpersAre these changes tested?
yes
Are there any user-facing changes?
now have backtrace when feature enabled