-
Notifications
You must be signed in to change notification settings - Fork 1.7k
migrate logical_plan
tests to insta
#16184
New issue
Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.
By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.
Already on GitHub? Sign in to your account
Conversation
Hi @alamb and @blaginin , I'am trying to solve this issue #15792 . This PR is ready to review, please take a look once you have time. In my opinion, the doc should be easily readable by others. With normal |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
thanks, overall looks good - left a few comments
Also can you please check the CI? Some tests are failing |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Thank you for the quick response! Just a few minor things and this PR will be good to go
let DataFusionError::Internal(desc) = err else { | ||
return plan_err!("Plan should have returned an DataFusionError::Internal"); | ||
}; | ||
|
||
let desc = desc | ||
.split(DataFusionError::BACK_TRACE_SEP) | ||
.collect::<Vec<&str>>() | ||
.first() | ||
.unwrap_or(&"") | ||
.to_string(); | ||
|
||
assert_snapshot!(desc, @"trying to unnest on invalid data type UInt32"); |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
what do you think about
let DataFusionError::Internal(desc) = err else { | |
return plan_err!("Plan should have returned an DataFusionError::Internal"); | |
}; | |
let desc = desc | |
.split(DataFusionError::BACK_TRACE_SEP) | |
.collect::<Vec<&str>>() | |
.first() | |
.unwrap_or(&"") | |
.to_string(); | |
assert_snapshot!(desc, @"trying to unnest on invalid data type UInt32"); | |
assert_snapshot!(err.strip_backtrace(), @r" | |
Internal error: trying to unnest on invalid data type UInt32. | |
This was likely caused by a bug in DataFusion's code and we would welcome that you file an bug report in our issue tracker | |
"); |
that way, we won't have to manually split on the string
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
I tried this. When I run the test locally, the snapshot will contain the "This was likey cuased" sentence. But when I submit the code and run the CI, it will failed because the snapshot will not contain the last sentence. I am wondering why.
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Thanks for the screenshot! This may be happening because locally you run tests without the backtrace
feature.
As a result, when you run it without the feature, you get:
Internal error: trying to unnest on invalid data type UInt32.
This was likely caused by a bug in DataFusion's code and we would welcome that you file an bug report in our issue tracker
However, with backtrace, we get:
Internal error: trying to unnest on invalid data type UInt32.
-- (backtrace) --
This was likely caused by a bug in DataFusion's code and we would welcome that you file an bug report in our issue tracker
I think a robust solution would be adding a redaction to eliminate the backtrace and adding a dev note somewhere to apply that redaction to all tests that rely on error formatting. That said, your solution is fine too - up to you if you want to leave it as is or change.
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Thank you for the explanation. And apart from redaction, how about we change the backtrace appending logic for errors? Maybe we can append the backtrace behind the output error message instead of the original error message? In that case, we may need another issue to track it.
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Well done! I'll keep the PR open for a bit in case you want to respond to my point or if someone else wants to review.
let DataFusionError::Internal(desc) = err else { | ||
return plan_err!("Plan should have returned an DataFusionError::Internal"); | ||
}; | ||
|
||
let desc = desc | ||
.split(DataFusionError::BACK_TRACE_SEP) | ||
.collect::<Vec<&str>>() | ||
.first() | ||
.unwrap_or(&"") | ||
.to_string(); | ||
|
||
assert_snapshot!(desc, @"trying to unnest on invalid data type UInt32"); |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Thanks for the screenshot! This may be happening because locally you run tests without the backtrace
feature.
As a result, when you run it without the feature, you get:
Internal error: trying to unnest on invalid data type UInt32.
This was likely caused by a bug in DataFusion's code and we would welcome that you file an bug report in our issue tracker
However, with backtrace, we get:
Internal error: trying to unnest on invalid data type UInt32.
-- (backtrace) --
This was likely caused by a bug in DataFusion's code and we would welcome that you file an bug report in our issue tracker
I think a robust solution would be adding a redaction to eliminate the backtrace and adding a dev note somewhere to apply that redaction to all tests that rely on error formatting. That said, your solution is fine too - up to you if you want to leave it as is or change.
Also, welcome to the project 🎉 |
Hi @alamb , I think this PR is ready to merge. |
Thank you @lifan-ake and @blaginin |
Which issue does this PR close?
logical_plan
tests toinsta
#15792 .Rationale for this change
What changes are included in this PR?
migrate
logical_plan
tests to instaAre these changes tested?
Are there any user-facing changes?