Skip to content
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

fix: do NOT convert errors to strings but keep the type #4436

Merged
merged 1 commit into from
Dec 1, 2022

Conversation

crepererum
Copy link
Contributor

Which issue does this PR close?

Closes #4434.

Rationale for this change

Now that DF emits ResourceExhausted errors for out-of-memory situations, it would be nice if the API user could somehow detect this situation (e.g. to convert this to a suitable HTTP status code).

What changes are included in this PR?

Convert a bunch of Execution errors into typed errors.

Are these changes tested?

⚠️ Consensus required prior to merging ⚠️

None. I'm not really sure how we want to prevent regressions here. It's just too many errors. I somewhat check-able rule (via some regex script?!) would be: "no Execution\(.+\.to_string". Shall I add this to the lint CI workflow?

Are there any user-facing changes?

Errors types slightly changed. This also changes error texts a bit.

@github-actions github-actions bot added core Core DataFusion crate physical-expr Physical Expressions labels Nov 30, 2022
Wrap them into proper containers instead.

Fixes apache#4434.
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.

Thank you @crepererum -- this is a nice cleanup 🧹 I think this PR is ready to go in as it is an improvement and we can perhaps improve the testing situation going forward.

None. I'm not really sure how we want to prevent regressions here. It's just too many errors. I somewhat check-able rule (via some regex script?!) would be: "no Execution(.+.to_string". Shall I add this to the lint CI workflow?

In terms of testing this PR I think that removing the anti-pattern from the codebase will reduce its likelihood of reappearing

We can also reduce the liklihood by adding some more comments to DataFusionError explaining the right pattern to wrap other errors (e.g. use DataFusionError::External to wrap external errors)

I think any sort of CI test to try and avoid new such patterns sneaking in will be brittle at best.

The "right" longer term solution to this approach is more structured errors rather than just messages, but I am not sure the benefits of that approach justify the costs -- and in any event that discussion should be on a separate issue i think

@alamb alamb changed the title fix: do NOT convert errors to strings fix: do NOT convert errors to strings but keep the type Nov 30, 2022
@alamb alamb marked this pull request as ready for review November 30, 2022 15:29
@alamb
Copy link
Contributor

alamb commented Nov 30, 2022

I think this is ready for review -- @andygrove @Dandandan what do you think?

@alamb
Copy link
Contributor

alamb commented Dec 1, 2022

Since I think this is a non controversial change (make the errors more structured) I am merging it in now. If we want additional testing I think we can do so as a follow on PR

@alamb alamb merged commit ffe97e5 into apache:master Dec 1, 2022
@ursabot
Copy link

ursabot commented Dec 1, 2022

Benchmark runs are scheduled for baseline = d9e58db and contender = ffe97e5. ffe97e5 is a master commit associated with this PR. Results will be available as each benchmark for each run completes.
Conbench compare runs links:
[Skipped ⚠️ Benchmarking of arrow-datafusion-commits is not supported on ec2-t3-xlarge-us-east-2] ec2-t3-xlarge-us-east-2
[Skipped ⚠️ Benchmarking of arrow-datafusion-commits is not supported on test-mac-arm] test-mac-arm
[Skipped ⚠️ Benchmarking of arrow-datafusion-commits is not supported on ursa-i9-9960x] ursa-i9-9960x
[Skipped ⚠️ Benchmarking of arrow-datafusion-commits is not supported on ursa-thinkcentre-m75q] ursa-thinkcentre-m75q
Buildkite builds:
Supported benchmarks:
ec2-t3-xlarge-us-east-2: Supported benchmark langs: Python, R. Runs only benchmarks with cloud = True
test-mac-arm: Supported benchmark langs: C++, Python, R
ursa-i9-9960x: Supported benchmark langs: Python, R, JavaScript
ursa-thinkcentre-m75q: Supported benchmark langs: C++, Java

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
core Core DataFusion crate physical-expr Physical Expressions
Projects
None yet
Development

Successfully merging this pull request may close these issues.

Do NOT convert intermediate/source errors to strings.
3 participants