-
Notifications
You must be signed in to change notification settings - Fork 1.3k
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: Avoid recursive external error wrapping #14371
Merged
+88
−13
Merged
Changes from 8 commits
Commits
Show all changes
16 commits
Select commit
Hold shift + click to select a range
8a895d5
Fix: Avoid recursive external error wrapping in type conversion.
getChan dc9dd5e
cargo fmt
getChan 127705e
test TableProvider
getChan 3723ec5
Revert "test TableProvider"
getChan 5d480a4
create WrappedError
getChan 05293c5
Replace `ExternalError` with `WrappedError` in `RepartitionExec`
getChan 4dc6452
Replace `ExternalError` with `WrappedError` in Join Exec
getChan f3f5b14
sqllogictest
getChan f1c34af
Merge branch 'main' into recursive-external-err
getChan d4e860f
rename SharedError
getChan 63de9b7
Update comments and rename to DataFusionError::Shared
alamb 8907e51
Merge remote-tracking branch 'apache/main' into recursive-external-err
alamb b671378
Improve API
alamb e390b97
fix clippy
alamb 7e60e6c
Merge remote-tracking branch 'apache/main' into recursive-external-err
alamb 285f61f
Merge remote-tracking branch 'apache/main' into recursive-external-err
alamb File filter
Filter by extension
Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
There are no files selected for viewing
This file contains 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
This file contains 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
This file contains 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
This file contains 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
This file contains 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
This file contains 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
This file contains 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
This file contains 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
Original file line number | Diff line number | Diff line change |
---|---|---|
|
@@ -161,3 +161,12 @@ create table records (timestamp timestamp, value float) as values ( | |
'2021-01-01 00:00:00', 1.0, | ||
'2021-01-01 00:00:00', 2.0 | ||
); | ||
|
||
statement ok | ||
CREATE TABLE tab0(col0 INTEGER, col1 INTEGER, col2 INTEGER); | ||
|
||
statement ok | ||
INSERT INTO tab0 VALUES(83,0,38); | ||
|
||
query error DataFusion error: Arrow error: Divide by zero error | ||
SELECT DISTINCT - 84 FROM tab0 AS cor0 WHERE NOT + 96 / + col1 <= NULL GROUP BY col1, col0; | ||
There was a problem hiding this comment. Choose a reason for hiding this commentThe reason will be displayed to describe this comment to others. Learn more. |
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.
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.
Why is this needed (compared to
Context
for example?) I don't understand why we need to keep the data wrappeed (why don't we just pass the underlying error back?)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.
Because if we only pass the underlying error, we can't share the error (due to ownership constraints). For example,
RepartitionExec
needs to send errors to all output partitions. You can see this in the source code.datafusion/datafusion/physical-plan/src/repartition/mod.rs
Lines 914 to 921 in 8d006a2
To share the error, I considered the following.
Implement Clone for DataFusionError
and useerr.clone()
: This is not possible because nested Error types do not implement theClone
trait.Arc<DatafusionError>
: I implemented it this way.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.
If using
Context
, the underlying error is only passed as a singleResult
due to ownership constraints.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 renamed it to
SharedError
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 @getChan -- As DataFusionError is used all over the place and is a very visible part of the API I was thinking it would be best if we can avoid adding too many variants. However, after playing with some other options (like deep cloning the error) I agree that this solution is the best.
to be consistent with the other variants which don't have a
Error
in their name, I renamed this toDataFusionError::Shared